summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorThiago Santos <thiagoss@osg.samsung.com>2016-01-26 23:43:24 -0300
committerThiago Santos <thiagoss@osg.samsung.com>2016-02-04 14:03:55 -0300
commitf16916f7e7e29c145c9fc99ca53b66f71acf5f1b (patch)
tree7690401839e4e626684a0593aefc13de207fd395 /gst-libs
parent63af4649c6e6042f39b45c44a82529248dbb6721 (diff)
downloadgstreamer-plugins-bad-f16916f7e7e29c145c9fc99ca53b66f71acf5f1b.tar.gz
adaptivedemux: add utility function to get stream from pad
Simplifies the code a bit and avoid repeating this common operation
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/adaptivedemux/gstadaptivedemux.c46
-rw-r--r--gst-libs/gst/adaptivedemux/gstadaptivedemux.h2
2 files changed, 31 insertions, 17 deletions
diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c
index 91d0be56e..c21584f6f 100644
--- a/gst-libs/gst/adaptivedemux/gstadaptivedemux.c
+++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.c
@@ -1077,6 +1077,21 @@ gst_adaptive_demux_stream_new (GstAdaptiveDemux * demux, GstPad * pad)
return stream;
}
+GstAdaptiveDemuxStream *
+gst_adaptive_demux_find_stream_for_pad (GstAdaptiveDemux * demux, GstPad * pad)
+{
+ GList *iter;
+
+ for (iter = demux->streams; iter; iter = g_list_next (iter)) {
+ GstAdaptiveDemuxStream *stream = iter->data;
+ if (stream->pad == pad) {
+ return stream;
+ }
+ }
+ g_assert_not_reached ();
+ return NULL;
+}
+
/* must be called with manifest_lock taken.
* It will temporarily drop the manifest_lock in order to join the task.
* It will join only the old_streams (the demux->streams are joined by
@@ -1354,26 +1369,23 @@ gst_adaptive_demux_src_event (GstPad * pad, GstObject * parent,
return ret;
}
case GST_EVENT_RECONFIGURE:{
- GList *iter;
+ GstAdaptiveDemuxStream *stream;
GST_MANIFEST_LOCK (demux);
-
- for (iter = demux->streams; iter; iter = g_list_next (iter)) {
- GstAdaptiveDemuxStream *stream = iter->data;
-
- if (stream->pad == pad) {
- if (stream->last_ret == GST_FLOW_NOT_LINKED) {
- stream->last_ret = GST_FLOW_OK;
- stream->restart_download = TRUE;
- stream->need_header = TRUE;
- stream->discont = TRUE;
- GST_DEBUG_OBJECT (stream->pad, "Restarting download loop");
- gst_task_start (stream->download_task);
- }
- gst_event_unref (event);
- GST_MANIFEST_UNLOCK (demux);
- return TRUE;
+ stream = gst_adaptive_demux_find_stream_for_pad (demux, pad);
+
+ if (stream) {
+ if (stream->last_ret == GST_FLOW_NOT_LINKED) {
+ stream->last_ret = GST_FLOW_OK;
+ stream->restart_download = TRUE;
+ stream->need_header = TRUE;
+ stream->discont = TRUE;
+ GST_DEBUG_OBJECT (stream->pad, "Restarting download loop");
+ gst_task_start (stream->download_task);
}
+ gst_event_unref (event);
+ GST_MANIFEST_UNLOCK (demux);
+ return TRUE;
}
GST_MANIFEST_UNLOCK (demux);
}
diff --git a/gst-libs/gst/adaptivedemux/gstadaptivedemux.h b/gst-libs/gst/adaptivedemux/gstadaptivedemux.h
index b5f21f05e..e7ce22783 100644
--- a/gst-libs/gst/adaptivedemux/gstadaptivedemux.h
+++ b/gst-libs/gst/adaptivedemux/gstadaptivedemux.h
@@ -430,6 +430,8 @@ void gst_adaptive_demux_set_stream_struct_size (GstAdaptiveDemux * demux,
GstAdaptiveDemuxStream *gst_adaptive_demux_stream_new (GstAdaptiveDemux * demux,
GstPad * pad);
+GstAdaptiveDemuxStream *gst_adaptive_demux_find_stream_for_pad (GstAdaptiveDemux * demux,
+ GstPad * pad);
void gst_adaptive_demux_stream_set_caps (GstAdaptiveDemuxStream * stream,
GstCaps * caps);
void gst_adaptive_demux_stream_set_tags (GstAdaptiveDemuxStream * stream,