From: <ia...@fr...> - 2004-09-26 21:32:35
|
CVS Root: /home/cvs/gstreamer Module: gst-plugins Changes by: iain Date: Sun Sep 26 2004 14:32:32 PDT Log message: Implement event compression for new-media discont events Modified files: . : ChangeLog gst/interleave : interleave.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ChangeLog.diff?r1=1.1091&r2=1.1092 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/gst/interleave/interleave.c.diff?r1=1.7&r2=1.8 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /home/cvs/gstreamer/gst-plugins/ChangeLog,v retrieving revision 1.1091 retrieving revision 1.1092 diff -u -d -r1.1091 -r1.1092 --- ChangeLog 26 Sep 2004 16:53:52 -0000 1.1091 +++ ChangeLog 26 Sep 2004 21:32:20 -0000 1.1092 @@ -8,6 +8,13 @@ 2004-09-26 Iain <iai...@gm...> + * gst/interleave/interleave.c (all_channels_new_media): Checks if all + the channels have received a new media event. + (interleave_buffered_loop): Compresses a new media event on all + channels into one. + +2004-09-26 Iain <iai...@gm...> * gst/wavenc/gstwavenc.c (gst_wavenc_chain): Company says we need to call the sinkpad's default event handler and not the srcpads. He also says this is confusing :) Index: interleave.c RCS file: /home/cvs/gstreamer/gst-plugins/gst/interleave/interleave.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- interleave.c 2 Aug 2004 15:48:57 -0000 1.7 +++ interleave.c 26 Sep 2004 21:32:20 -0000 1.8 @@ -51,6 +51,7 @@ { GstPad *sinkpad; GstBuffer *buffer; + gboolean new_media; }; struct _Interleave @@ -412,6 +413,22 @@ return GST_PAD_LINK_OK; } +static gboolean +all_channels_new_media (GList * channels) +{ + GList *p; + for (p = channels; p; p = p->next) { + InterleaveInputChannel *c = INTERLEAVE_CHANNEL (p); + if (c->new_media == FALSE) { + return FALSE; + } + } + return TRUE; +} static void interleave_buffered_loop (GstElement * element) @@ -438,6 +455,10 @@ for (l = this->channels, i = 0; l; l = l->next, i++) { channel = INTERLEAVE_CHANNEL (l); + if (channel->new_media) { + continue; get_buffer: channel->buffer = GST_BUFFER (gst_pad_pull (channel->sinkpad)); @@ -454,6 +475,33 @@ gst_pad_push (this->srcpad, GST_DATA (e)); gst_element_set_eos (GST_ELEMENT (this)); return; + case GST_EVENT_DISCONTINUOUS: + GST_DEBUG ("its a discont"); + if (GST_EVENT_DISCONT_NEW_MEDIA (e)) { + channel->new_media = TRUE; + if (all_channels_new_media (this->channels)) { + GList *t; + /* Reset new media */ + for (t = this->channels; t; t = t->next) { + InterleaveInputChannel *c = INTERLEAVE_CHANNEL (t); + c->new_media = FALSE; + } + /* Push event */ + gst_pad_event_default (channel->sinkpad, e); + goto get_buffer; + } else { + GST_DEBUG ("Not all channels have received a new-media yet"); + gst_event_unref (e); + } + } + break; default: GST_DEBUG ("doing default action for event"); gst_pad_event_default (channel->sinkpad, e); |