added EOS event handling to filesrc

Original commit message from CVS:
added EOS event handling to filesrc
This commit is contained in:
Erik Walthinsen 2001-09-21 20:02:01 +00:00
parent 7be0cd55de
commit 803cf898ed
2 changed files with 10 additions and 8 deletions

View file

@ -435,7 +435,6 @@ gst_filesrc_get (GstPad *pad)
GstFileSrc *src;
GstBuffer *buf = NULL, *map;
off_t readend,readsize,mapstart,mapend;
gboolean eof = FALSE;
GstFileSrcRegion region;
int i;
@ -443,6 +442,11 @@ gst_filesrc_get (GstPad *pad)
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 @@ gst_filesrc_get (GstPad *pad)
if (readend > src->filelen) {
readsize = src->filelen - src->curoffset;
readend = src->curoffset;
eof = TRUE;
}
// if the start is past the mapstart
@ -528,8 +531,6 @@ gst_filesrc_get (GstPad *pad)
*(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);
return buf;

View file

@ -435,7 +435,6 @@ gst_filesrc_get (GstPad *pad)
GstFileSrc *src;
GstBuffer *buf = NULL, *map;
off_t readend,readsize,mapstart,mapend;
gboolean eof = FALSE;
GstFileSrcRegion region;
int i;
@ -443,6 +442,11 @@ gst_filesrc_get (GstPad *pad)
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 @@ gst_filesrc_get (GstPad *pad)
if (readend > src->filelen) {
readsize = src->filelen - src->curoffset;
readend = src->curoffset;
eof = TRUE;
}
// if the start is past the mapstart
@ -528,8 +531,6 @@ gst_filesrc_get (GstPad *pad)
*(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);
return buf;