From: <bi...@fr...> - 2005-11-15 18:11:32
|
CVS Root: /cvs/gstreamer Module: gst-plugins-base Changes by: bilboed Date: Tue Nov 15 2005 10:11:29 PST Log message: * ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event), (gst_ogg_demux_class_init): Implement GstElement::send_event, so we can send seek events in GST_STATE_READY Modified files: . : ChangeLog ext/ogg : gstoggdemux.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.2076&r2=1.2077 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ext/ogg/gstoggdemux.c.diff?r1=1.113&r2=1.114 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v retrieving revision 1.2076 retrieving revision 1.2077 diff -u -d -r1.2076 -r1.2077 --- ChangeLog 14 Nov 2005 22:01:21 -0000 1.2076 +++ ChangeLog 15 Nov 2005 18:11:17 -0000 1.2077 @@ -1,3 +1,10 @@ +2005-11-15 Edward Hervey <ed...@fl...> + + * ext/ogg/gstoggdemux.c: (gst_ogg_demux_receive_event), + (gst_ogg_demux_class_init): + Implement GstElement::send_event, so we can send seek events + in GST_STATE_READY 2005-11-14 Julien MOUTTE <ju...@mo...> * sys/xvimage/xvimagesink.c: (gst_xvimagesink_xwindow_new): Index: gstoggdemux.c RCS file: /cvs/gstreamer/gst-plugins-base/ext/ogg/gstoggdemux.c,v retrieving revision 1.113 retrieving revision 1.114 diff -u -d -r1.113 -r1.114 --- gstoggdemux.c 10 Nov 2005 18:01:28 -0000 1.113 +++ gstoggdemux.c 15 Nov 2005 18:11:17 -0000 1.114 @@ -185,6 +185,8 @@ static gboolean gst_ogg_demux_configure_segment (GstOggDemux * ogg, GstEvent * event, gboolean * running); static gboolean gst_ogg_demux_perform_seek (GstOggDemux * ogg); +static gboolean gst_ogg_demux_receive_event (GstElement * element, + GstEvent * event); static void gst_ogg_pad_class_init (GstOggPadClass * klass); static void gst_ogg_pad_init (GstOggPad * pad); @@ -386,6 +388,54 @@ } static gboolean +gst_ogg_demux_receive_event (GstElement * element, GstEvent * event) +{ + gboolean res; + GstOggDemux *ogg; + ogg = GST_OGG_DEMUX (element); + switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_SEEK: + { + gboolean running; + /* can't seek if we are not seekable, FIXME could pass the + * seek query upstream after converting it to bytes using + * the average bitrate of the stream. */ + if (!ogg->seekable) { + GST_DEBUG ("seek on non seekable stream"); + goto error; + } + if (!gst_ogg_demux_configure_segment (ogg, event, &running)) { + GST_DEBUG ("configure segment failed"); + /* now do the seek */ + if (running) { + res = gst_ogg_demux_perform_seek (ogg); + } else + res = TRUE; + break; + } + default: + GST_DEBUG ("We only handle seek events here"); + goto error; + } + return res; +error: + GST_DEBUG ("error handling event"); + gst_event_unref (event); + return FALSE; +} +static gboolean gst_ogg_pad_event (GstPad * pad, GstEvent * event) { gboolean res; @@ -1072,6 +1122,7 @@ GObjectClass *gobject_class = G_OBJECT_CLASS (klass); gstelement_class->change_state = gst_ogg_demux_change_state; + gstelement_class->send_event = gst_ogg_demux_receive_event; gobject_class->finalize = gst_ogg_demux_finalize; |