mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-07-04 05:35:53 +00:00
added EOS event handling to filesrc
Original commit message from CVS: added EOS event handling to filesrc
This commit is contained in:
parent
7be0cd55de
commit
803cf898ed
|
@ -435,7 +435,6 @@ gst_filesrc_get (GstPad *pad)
|
||||||
GstFileSrc *src;
|
GstFileSrc *src;
|
||||||
GstBuffer *buf = NULL, *map;
|
GstBuffer *buf = NULL, *map;
|
||||||
off_t readend,readsize,mapstart,mapend;
|
off_t readend,readsize,mapstart,mapend;
|
||||||
gboolean eof = FALSE;
|
|
||||||
GstFileSrcRegion region;
|
GstFileSrcRegion region;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -443,6 +442,11 @@ gst_filesrc_get (GstPad *pad)
|
||||||
src = GST_FILESRC (gst_pad_get_parent (pad));
|
src = GST_FILESRC (gst_pad_get_parent (pad));
|
||||||
g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_FILESRC_OPEN), NULL);
|
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
|
// calculate end pointers so we don't have to do so repeatedly later
|
||||||
readsize = src->block_size;
|
readsize = src->block_size;
|
||||||
readend = src->curoffset + src->block_size; // note this is the byte *after* the read
|
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) {
|
if (readend > src->filelen) {
|
||||||
readsize = src->filelen - src->curoffset;
|
readsize = src->filelen - src->curoffset;
|
||||||
readend = src->curoffset;
|
readend = src->curoffset;
|
||||||
eof = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the start is past the mapstart
|
// 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);
|
*(GST_BUFFER_DATA(buf)+i) = *(GST_BUFFER_DATA(buf)+i);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we hit EOF,
|
|
||||||
|
|
||||||
/* we're done, return the buffer */
|
/* we're done, return the buffer */
|
||||||
src->curoffset += GST_BUFFER_SIZE(buf);
|
src->curoffset += GST_BUFFER_SIZE(buf);
|
||||||
return buf;
|
return buf;
|
||||||
|
|
|
@ -435,7 +435,6 @@ gst_filesrc_get (GstPad *pad)
|
||||||
GstFileSrc *src;
|
GstFileSrc *src;
|
||||||
GstBuffer *buf = NULL, *map;
|
GstBuffer *buf = NULL, *map;
|
||||||
off_t readend,readsize,mapstart,mapend;
|
off_t readend,readsize,mapstart,mapend;
|
||||||
gboolean eof = FALSE;
|
|
||||||
GstFileSrcRegion region;
|
GstFileSrcRegion region;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -443,6 +442,11 @@ gst_filesrc_get (GstPad *pad)
|
||||||
src = GST_FILESRC (gst_pad_get_parent (pad));
|
src = GST_FILESRC (gst_pad_get_parent (pad));
|
||||||
g_return_val_if_fail (GST_FLAG_IS_SET (src, GST_FILESRC_OPEN), NULL);
|
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
|
// calculate end pointers so we don't have to do so repeatedly later
|
||||||
readsize = src->block_size;
|
readsize = src->block_size;
|
||||||
readend = src->curoffset + src->block_size; // note this is the byte *after* the read
|
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) {
|
if (readend > src->filelen) {
|
||||||
readsize = src->filelen - src->curoffset;
|
readsize = src->filelen - src->curoffset;
|
||||||
readend = src->curoffset;
|
readend = src->curoffset;
|
||||||
eof = TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if the start is past the mapstart
|
// 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);
|
*(GST_BUFFER_DATA(buf)+i) = *(GST_BUFFER_DATA(buf)+i);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we hit EOF,
|
|
||||||
|
|
||||||
/* we're done, return the buffer */
|
/* we're done, return the buffer */
|
||||||
src->curoffset += GST_BUFFER_SIZE(buf);
|
src->curoffset += GST_BUFFER_SIZE(buf);
|
||||||
return buf;
|
return buf;
|
||||||
|
|
Loading…
Reference in a new issue