Make filesrc respond to seek

Original commit message from CVS:
Make filesrc respond to seek
This commit is contained in:
Wim Taymans 2002-02-02 13:24:25 +00:00
parent a7c0c874b5
commit f0e4bd3b5c
4 changed files with 26 additions and 4 deletions

View file

@ -439,13 +439,18 @@ gst_filesrc_get (GstPad *pad)
/* check for seek */
if (src->seek_happened) {
src->seek_happened = FALSE;
return GST_BUFFER (gst_event_new(GST_EVENT_DISCONTINUOUS));
return GST_BUFFER (gst_event_new (GST_EVENT_DISCONTINUOUS));
}
/* check for flush */
if (src->need_flush) {
src->need_flush = FALSE;
return GST_BUFFER (gst_event_new_flush ());
}
/* check for EOF */
if (src->curoffset == src->filelen) {
gst_element_set_eos (GST_ELEMENT (src));
return GST_BUFFER (gst_event_new(GST_EVENT_EOS));
return GST_BUFFER (gst_event_new (GST_EVENT_EOS));
}
/* calculate end pointers so we don't have to do so repeatedly later */
@ -650,8 +655,13 @@ gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event)
break;
}
src->seek_happened = TRUE;
src->need_flush = GST_EVENT_SEEK_FLUSH(event);
gst_event_free (event);
/* push a discontinuous event? */
break;
case GST_EVENT_FLUSH:
src->need_flush = TRUE;
break;
default:
return FALSE;
break;

View file

@ -74,6 +74,7 @@ struct _GstFileSrc {
GMutex *map_regions_lock;
gboolean seek_happened;
gboolean need_flush;
};
struct _GstFileSrcClass {

View file

@ -439,13 +439,18 @@ gst_filesrc_get (GstPad *pad)
/* check for seek */
if (src->seek_happened) {
src->seek_happened = FALSE;
return GST_BUFFER (gst_event_new(GST_EVENT_DISCONTINUOUS));
return GST_BUFFER (gst_event_new (GST_EVENT_DISCONTINUOUS));
}
/* check for flush */
if (src->need_flush) {
src->need_flush = FALSE;
return GST_BUFFER (gst_event_new_flush ());
}
/* check for EOF */
if (src->curoffset == src->filelen) {
gst_element_set_eos (GST_ELEMENT (src));
return GST_BUFFER (gst_event_new(GST_EVENT_EOS));
return GST_BUFFER (gst_event_new (GST_EVENT_EOS));
}
/* calculate end pointers so we don't have to do so repeatedly later */
@ -650,8 +655,13 @@ gst_filesrc_srcpad_event (GstPad *pad, GstEvent *event)
break;
}
src->seek_happened = TRUE;
src->need_flush = GST_EVENT_SEEK_FLUSH(event);
gst_event_free (event);
/* push a discontinuous event? */
break;
case GST_EVENT_FLUSH:
src->need_flush = TRUE;
break;
default:
return FALSE;
break;

View file

@ -74,6 +74,7 @@ struct _GstFileSrc {
GMutex *map_regions_lock;
gboolean seek_happened;
gboolean need_flush;
};
struct _GstFileSrcClass {