From: <wt...@ke...> - 2007-04-12 10:10:41
|
CVS Root: /cvs/gstreamer Module: gst-plugins-ugly Changes by: wtay Date: Thu Apr 12 2007 10:10:35 UTC Log message: Patch by: René Stadler <mail at renestadler dot de> * gst/realmedia/rmdemux.c: (find_seek_offset_bytes), (find_seek_offset_time), (gst_rmdemux_reset), (gst_rmdemux_get_stream_by_id), (gst_rmdemux_send_event), (gst_rmdemux_add_stream), (gst_rmdemux_combine_flows): * gst/realmedia/rmdemux.h: Make rmdemux handle any number of logical streams. Fixes #428698. Modified files: . : ChangeLog gst/realmedia : rmdemux.c rmdemux.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-ugly/ChangeLog.diff?r1=1.2178&r2=1.2179 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-ugly/gst/realmedia/rmdemux.c.diff?r1=1.86&r2=1.87 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-ugly/gst/realmedia/rmdemux.h.diff?r1=1.16&r2=1.17 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins-ugly/ChangeLog,v retrieving revision 1.2178 retrieving revision 1.2179 diff -u -d -r1.2178 -r1.2179 --- ChangeLog 5 Apr 2007 13:48:12 -0000 1.2178 +++ ChangeLog 12 Apr 2007 10:10:22 -0000 1.2179 @@ -1,3 +1,14 @@ +2007-04-12 Wim Taymans <wi...@fl...> + + Patch by: René Stadler <mail at renestadler dot de> + * gst/realmedia/rmdemux.c: (find_seek_offset_bytes), + (find_seek_offset_time), (gst_rmdemux_reset), + (gst_rmdemux_get_stream_by_id), (gst_rmdemux_send_event), + (gst_rmdemux_add_stream), (gst_rmdemux_combine_flows): + * gst/realmedia/rmdemux.h: + Make rmdemux handle any number of logical streams. Fixes #428698. 2007-04-05 Thomas Vander Stichele <thomas at apestaart dot org> submitted by: Mogens Jaeger <mo...@ja...> Index: rmdemux.c RCS file: /cvs/gstreamer/gst-plugins-ugly/gst/realmedia/rmdemux.c,v retrieving revision 1.86 retrieving revision 1.87 diff -u -d -r1.86 -r1.87 --- rmdemux.c 22 Mar 2007 21:44:45 -0000 1.86 +++ rmdemux.c 12 Apr 2007 10:10:22 -0000 1.87 @@ -376,16 +376,15 @@ static gboolean find_seek_offset_bytes (GstRMDemux * rmdemux, guint target) { - int i, n; + int i; + GSList *cur; gboolean ret = FALSE; if (target < 0) return FALSE; - for (n = 0; n < rmdemux->n_streams; n++) { - GstRMDemuxStream *stream; - - stream = rmdemux->streams[n]; + for (cur = rmdemux->streams; cur; cur = cur->next) { + GstRMDemuxStream *stream = cur->data; /* Search backwards through this stream's index until we find the first * timestamp before our target time */ @@ -406,14 +405,14 @@ find_seek_offset_time (GstRMDemux * rmdemux, GstClockTime time) + int i, n_stream; GstClockTime earliest = GST_CLOCK_TIME_NONE; + n_stream = 0; + for (cur = rmdemux->streams; cur; cur = cur->next, n_stream++) { @@ -433,7 +432,7 @@ GST_DEBUG_OBJECT (rmdemux, "We're looking for %" GST_TIME_FORMAT " and we found that stream %d has the latest index at %" - GST_TIME_FORMAT, GST_TIME_ARGS (rmdemux->segment.start), n, + GST_TIME_FORMAT, GST_TIME_ARGS (rmdemux->segment.start), n_stream, GST_TIME_ARGS (earliest)); } @@ -675,22 +674,24 @@ static void gst_rmdemux_reset (GstRMDemux * rmdemux) - guint n; GST_OBJECT_LOCK (rmdemux); rmdemux->running = FALSE; GST_OBJECT_UNLOCK (rmdemux); - for (n = 0; n < rmdemux->n_streams; ++n) { - gst_rmdemux_stream_clear_cached_subpackets (rmdemux, rmdemux->streams[n]); - gst_element_remove_pad (GST_ELEMENT (rmdemux), rmdemux->streams[n]->pad); - if (rmdemux->streams[n]->subpackets) - g_ptr_array_free (rmdemux->streams[n]->subpackets, TRUE); - g_free (rmdemux->streams[n]->index); - g_free (rmdemux->streams[n]); - rmdemux->streams[n] = NULL; + gst_rmdemux_stream_clear_cached_subpackets (rmdemux, stream); + gst_element_remove_pad (GST_ELEMENT (rmdemux), stream->pad); + if (stream->subpackets) + g_ptr_array_free (stream->subpackets, TRUE); + g_free (stream->index); + g_free (stream); } - rmdemux->n_streams = 0; + g_slist_free (rmdemux->streams); + rmdemux->streams = NULL; rmdemux->n_audio_streams = 0; rmdemux->n_video_streams = 0; @@ -1203,12 +1204,11 @@ static GstRMDemuxStream * gst_rmdemux_get_stream_by_id (GstRMDemux * rmdemux, int id) - int i; - for (i = 0; i < rmdemux->n_streams; i++) { - stream = rmdemux->streams[i]; if (stream->id == id) { return stream; } @@ -1220,10 +1220,10 @@ gst_rmdemux_send_event (GstRMDemux * rmdemux, GstEvent * event) - GstRMDemuxStream *stream = rmdemux->streams[i]; GST_DEBUG_OBJECT (rmdemux, "Pushing %s event on pad %s", GST_EVENT_TYPE_NAME (event), GST_PAD_NAME (stream->pad)); @@ -1403,9 +1403,9 @@ GST_PAD_ELEMENT_PRIVATE (stream->pad) = stream; - rmdemux->streams[rmdemux->n_streams] = stream; - rmdemux->n_streams++; - GST_LOG_OBJECT (rmdemux, "n_streams is now %d", rmdemux->n_streams); + rmdemux->streams = g_slist_append (rmdemux->streams, stream); + GST_LOG_OBJECT (rmdemux, "n_streams is now %d", + g_slist_length (rmdemux->streams)); GST_LOG ("stream->pad = %p, stream_caps = %" GST_PTR_FORMAT, stream->pad, stream_caps); @@ -1803,7 +1803,7 @@ gst_rmdemux_combine_flows (GstRMDemux * rmdemux, GstRMDemuxStream * stream, GstFlowReturn ret) - gint i; /* store the value */ stream->last_flow = ret; @@ -1817,8 +1817,8 @@ if (ret != GST_FLOW_NOT_LINKED) goto done; - for (i = 0; i < rmdemux->n_streams; ++i) { - GstRMDemuxStream *ostream = rmdemux->streams[i]; + GstRMDemuxStream *ostream = cur->data; ret = ostream->last_flow; /* some other return value (must be SUCCESS but we can return Index: rmdemux.h RCS file: /cvs/gstreamer/gst-plugins-ugly/gst/realmedia/rmdemux.h,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- rmdemux.h 13 Jul 2006 11:28:32 -0000 1.16 +++ rmdemux.h 12 Apr 2007 10:10:22 -0000 1.17 @@ -37,8 +37,6 @@ #define GST_IS_RMDEMUX_CLASS(klass) \ (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RMDEMUX)) -#define GST_RMDEMUX_MAX_STREAMS 8 typedef enum RMDEMUX_STATE_NULL, @@ -83,8 +81,7 @@ /* pads */ GstPad *sinkpad; - GstRMDemuxStream *streams[GST_RMDEMUX_MAX_STREAMS]; - int n_streams; + GSList *streams; int n_video_streams; int n_audio_streams; GstAdapter *adapter; |