[gst-cvs] CVS: gstreamer/gst/elements gstfilesrc.c,1.3.4.1,1.3.4.2

Erik Walthinsen omegahacker at users.sourceforge.net
Fri Sep 21 13:03:02 PDT 2001


Update of /cvsroot/gstreamer/gstreamer/gst/elements
In directory usw-pr-cvs1:/tmp/cvs-serv32612

Modified Files:
      Tag: BRANCH-EVENTS1
	gstfilesrc.c 
Log Message:
added EOS event handling to filesrc

Index: gstfilesrc.c
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/gst/elements/gstfilesrc.c,v
retrieving revision 1.3.4.1
retrieving revision 1.3.4.2
diff -u -d -r1.3.4.1 -r1.3.4.2
--- gstfilesrc.c	2001/09/21 17:28:44	1.3.4.1
+++ gstfilesrc.c	2001/09/21 20:02:01	1.3.4.2
@@ -435,7 +435,6 @@
   GstFileSrc *src;
   GstBuffer *buf = NULL, *map;
   off_t readend,readsize,mapstart,mapend;
-  gboolean eof = FALSE;
   GstFileSrcRegion region;
   int i;
 
@@ -443,6 +442,11 @@
   src = GST_FILESRC (gst_pad_get_parent (pad));
   g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_FILESRC_OPEN), NULL);
 
+  // check for EOF
+  if (src->curoffset == src->filelen) {
+    return gst_event_empty_new(GST_EVENT_EOS);
+  }
+
   // calculate end pointers so we don't have to do so repeatedly later
   readsize = src->block_size;
   readend = src->curoffset + src->block_size;		// note this is the byte *after* the read
@@ -453,7 +457,6 @@
   if (readend > src->filelen) {
     readsize = src->filelen - src->curoffset;
     readend = src->curoffset;
-    eof = TRUE;
   }
 
   // if the start is past the mapstart
@@ -527,8 +530,6 @@
     for (i=0;i<GST_BUFFER_SIZE(buf);i+=src->pagesize)
       *(GST_BUFFER_DATA(buf)+i) = *(GST_BUFFER_DATA(buf)+i);
   }
-
-  // if we hit EOF, 
 
   /* we're done, return the buffer */
   src->curoffset += GST_BUFFER_SIZE(buf);





More information about the Gstreamer-commits mailing list