[gst-cvs] CVS: gstreamer/plugins/mpeg2/parse mpeg2parse.c,1.36,1.37
Wim Taymans
wtay at users.sourceforge.net
Tue Oct 23 12:51:13 PDT 2001
Update of /cvsroot/gstreamer/gstreamer/plugins/mpeg2/parse
In directory usw-pr-cvs1:/tmp/cvs-serv14799/plugins/mpeg2/parse
Modified Files:
mpeg2parse.c
Log Message:
Aplied the patches from vishnu to implement seeking in various plugins.
bytestream now has an event-aware API.
Index: mpeg2parse.c
===================================================================
RCS file: /cvsroot/gstreamer/gstreamer/plugins/mpeg2/parse/mpeg2parse.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- mpeg2parse.c 2001/10/17 10:21:25 1.36
+++ mpeg2parse.c 2001/10/23 19:50:41 1.37
@@ -826,6 +826,13 @@
}
static void
+_queue_eos (GstPad *pad, gpointer ign)
+{
+ // ugh, GstBuffer cast is wrong here
+ gst_pad_push (pad, (GstBuffer*) gst_event_new (GST_EVENT_EOS));
+}
+
+static void
_forall_pads (Mpeg2Parse *mpeg2parse, GFunc fun, gpointer user_data)
{
GstPad *pad;
@@ -874,21 +881,21 @@
}
do {
- gboolean discont = FALSE;
+ gboolean got_event = FALSE;
if (!find_start_code (mpeg2parse))
- discont = TRUE;
+ got_event = TRUE;
else {
GST_DEBUG (0, "mpeg2parse: have chunk 0x%02X\n",mpeg2parse->id);
switch (mpeg2parse->id) {
case 0xBA:
if (!parse_packhead (mpeg2parse))
- discont = TRUE;
+ got_event = TRUE;
break;
case 0xBB:
if (!parse_syshead (mpeg2parse))
- discont = TRUE;
+ got_event = TRUE;
break;
default:
@@ -899,22 +906,48 @@
if (mpeg2parse->MPEG2)
{
if (!parse_pes (mpeg2parse))
- discont = TRUE;
+ got_event = TRUE;
}
else
{
if (!parse_packet (mpeg2parse))
- discont = TRUE;
+ got_event = TRUE;
}
}
}
}
- if (discont)
- _forall_pads (mpeg2parse, (GFunc) _queue_discontinuous, NULL);
+ if (got_event)
+ {
+ guint32 remaining;
+ GstEvent *event;
+ gint etype;
- } while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element));
+ gst_bytestream_get_status (mpeg2parse->bs, &remaining, &event);
+ etype = event? GST_EVENT_TYPE (event) : GST_EVENT_EOS;
+ switch (etype) {
+
+ case GST_EVENT_DISCONTINUOUS:
+ gst_bytestream_flush_fast (mpeg2parse->bs, remaining);
+ _forall_pads (mpeg2parse, (GFunc) _queue_discontinuous, NULL);
+ break;
+
+ case GST_EVENT_EOS:
+ gst_element_set_state (GST_ELEMENT (mpeg2parse), GST_STATE_PAUSED);
+ _forall_pads (mpeg2parse, (GFunc) _queue_eos, NULL);
+ break;
+
+ default:
+ g_warning ("Don't know how to cope with event type %d",
+ GST_EVENT_TYPE (event));
+ break;
+ }
+
+ gst_event_free (event);
+ }
+
+ } while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element));
}
static void
More information about the Gstreamer-commits
mailing list