plugins/elements/gstfdsrc.c: Add some debugging.
authorWim Taymans <wim.taymans@gmail.com>
Fri, 3 Nov 2006 09:40:03 +0000 (09:40 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Fri, 3 Nov 2006 09:40:03 +0000 (09:40 +0000)
Original commit message from CVS:
* plugins/elements/gstfdsrc.c: (gst_fd_src_update_fd),
(gst_fd_src_create):
Add some debugging.
Only update fd when it's different from the old.

ChangeLog
plugins/elements/gstfdsrc.c

index 06a1140..1b65c88 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-11-03  Wim Taymans  <wim@fluendo.com>
+
+       * plugins/elements/gstfdsrc.c: (gst_fd_src_update_fd),
+       (gst_fd_src_create):
+       Add some debugging. 
+       Only update fd when it's different from the old.
+
 2006-11-02  Tim-Philipp Müller  <tim at centricular dot net>
 
        * plugins/elements/gstfilesrc.c: (gst_file_src_create_mmap):
index dc9a0e6..c1f90c0 100644 (file)
@@ -192,26 +192,34 @@ gst_fd_src_update_fd (GstFdSrc * src)
 {
   struct stat stat_results;
 
-  src->fd = src->new_fd;
-  GST_INFO_OBJECT (src, "Updating to fd %d", src->fd);
-  g_free (src->uri);
-  src->uri = g_strdup_printf ("fd://%d", src->fd);
+  if (src->fd != src->new_fd) {
+    GST_INFO_OBJECT (src, "Updating to fd %d", src->new_fd);
 
-  if (fstat (src->fd, &stat_results) < 0)
-    goto not_seekable;
+    src->fd = src->new_fd;
+
+    g_free (src->uri);
+    src->uri = g_strdup_printf ("fd://%d", src->fd);
+
+    if (fstat (src->fd, &stat_results) < 0)
+      goto not_seekable;
 
-  if (!S_ISREG (stat_results.st_mode))
-    goto not_seekable;
+    if (!S_ISREG (stat_results.st_mode))
+      goto not_seekable;
 
-  /* Try a seek of 0 bytes offset to check for seekability */
-  if (lseek (src->fd, 0, SEEK_CUR) < 0)
-    goto not_seekable;
+    /* Try a seek of 0 bytes offset to check for seekability */
+    if (lseek (src->fd, 0, SEEK_CUR) < 0)
+      goto not_seekable;
 
-  src->seekable_fd = TRUE;
+    GST_INFO_OBJECT (src, "marking fd %d as seekable", src->fd);
+    src->seekable_fd = TRUE;
+  }
   return;
 
 not_seekable:
-  src->seekable_fd = FALSE;
+  {
+    GST_INFO_OBJECT (src, "marking fd %d as NOT seekable", src->fd);
+    src->seekable_fd = FALSE;
+  }
 }
 
 static gboolean
@@ -341,6 +349,8 @@ gst_fd_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
       gchar command;
       int res;
 
+      GST_LOG_OBJECT (src, "reading command");
+
       READ_COMMAND (src, command, res);
       if (res < 0) {
         GST_LOG_OBJECT (src, "no more commands");
@@ -359,6 +369,7 @@ gst_fd_src_create (GstPushSrc * psrc, GstBuffer ** outbuf)
 
   do {
     readbytes = read (src->fd, GST_BUFFER_DATA (buf), blocksize);
+    GST_LOG_OBJECT (src, "read %d", readbytes);
   } while (readbytes == -1 && errno == EINTR);  /* retry if interrupted */
 
   if (readbytes < 0)