> I don't see the point of doing this in DVswitch.  There are applets
> for this and a stock GNOME installation will warn on low disk space.

I believe it would be nice to see the amount of disk free where I look
to check if the dvsink is working, and made a untested draft patch to
do so.

Something along these lines would help me a bit when doing video
recordings:

Index: src/dvsink-files.c
===================================================================
--- src/dvsink-files.c  (revision 414)
+++ src/dvsink-files.c  (working copy)
@@ -17,6 +17,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <unistd.h>
+#include <sys/statfs.h>
 
 #include "config.h"
 #include "dif.h"
@@ -162,6 +163,19 @@
     return total;
 }
 
+/* Return the amount of megabyte free on the disk of the file descriptor */
+static long freespace(int fd)
+{
+    struct statfs stat;
+    long free;
+    if (0 == fstatfs(fd, &stat))
+    {
+        free = stat.f_bsize * stat.f_bavail / (1024*1024) ;
+    } else {
+        free = -1;
+    }
+}
+
 static void transfer_frames(struct transfer_params * params)
 {
     static uint8_t buf[SINK_FRAME_HEADER_SIZE + DIF_MAX_FRAME_SIZE];
@@ -207,7 +221,8 @@
            file = create_file(output_name_format, &name);
            if (starting)
                printf("INFO: Started recording\n");
-           printf("INFO: Created file %s\n", name);
+           long free = freespace(file);
+           printf("INFO: Created file %s - free space $ld MiB\n", name, free);
            fflush(stdout);
        }
 
Perhaps something to include?

-- 
Happy hacking
Petter Reinholdtsen


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to