mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
adaptivedemux: add utility function to get stream from pad
Simplifies the code a bit and avoid repeating this common operation
This commit is contained in:
parent
63af4649c6
commit
f16916f7e7
2 changed files with 30 additions and 16 deletions
|
@ -1077,6 +1077,21 @@ gst_adaptive_demux_stream_new (GstAdaptiveDemux * demux, GstPad * pad)
|
||||||
return stream;
|
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.
|
/* must be called with manifest_lock taken.
|
||||||
* It will temporarily drop the manifest_lock in order to join the task.
|
* 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
|
* 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;
|
return ret;
|
||||||
}
|
}
|
||||||
case GST_EVENT_RECONFIGURE:{
|
case GST_EVENT_RECONFIGURE:{
|
||||||
GList *iter;
|
GstAdaptiveDemuxStream *stream;
|
||||||
|
|
||||||
GST_MANIFEST_LOCK (demux);
|
GST_MANIFEST_LOCK (demux);
|
||||||
|
stream = gst_adaptive_demux_find_stream_for_pad (demux, pad);
|
||||||
|
|
||||||
for (iter = demux->streams; iter; iter = g_list_next (iter)) {
|
if (stream) {
|
||||||
GstAdaptiveDemuxStream *stream = iter->data;
|
if (stream->last_ret == GST_FLOW_NOT_LINKED) {
|
||||||
|
stream->last_ret = GST_FLOW_OK;
|
||||||
if (stream->pad == pad) {
|
stream->restart_download = TRUE;
|
||||||
if (stream->last_ret == GST_FLOW_NOT_LINKED) {
|
stream->need_header = TRUE;
|
||||||
stream->last_ret = GST_FLOW_OK;
|
stream->discont = TRUE;
|
||||||
stream->restart_download = TRUE;
|
GST_DEBUG_OBJECT (stream->pad, "Restarting download loop");
|
||||||
stream->need_header = TRUE;
|
gst_task_start (stream->download_task);
|
||||||
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_event_unref (event);
|
||||||
|
GST_MANIFEST_UNLOCK (demux);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
GST_MANIFEST_UNLOCK (demux);
|
GST_MANIFEST_UNLOCK (demux);
|
||||||
}
|
}
|
||||||
|
|
|
@ -430,6 +430,8 @@ void gst_adaptive_demux_set_stream_struct_size (GstAdaptiveDemux * demux,
|
||||||
|
|
||||||
GstAdaptiveDemuxStream *gst_adaptive_demux_stream_new (GstAdaptiveDemux * demux,
|
GstAdaptiveDemuxStream *gst_adaptive_demux_stream_new (GstAdaptiveDemux * demux,
|
||||||
GstPad * pad);
|
GstPad * pad);
|
||||||
|
GstAdaptiveDemuxStream *gst_adaptive_demux_find_stream_for_pad (GstAdaptiveDemux * demux,
|
||||||
|
GstPad * pad);
|
||||||
void gst_adaptive_demux_stream_set_caps (GstAdaptiveDemuxStream * stream,
|
void gst_adaptive_demux_stream_set_caps (GstAdaptiveDemuxStream * stream,
|
||||||
GstCaps * caps);
|
GstCaps * caps);
|
||||||
void gst_adaptive_demux_stream_set_tags (GstAdaptiveDemuxStream * stream,
|
void gst_adaptive_demux_stream_set_tags (GstAdaptiveDemuxStream * stream,
|
||||||
|
|
Loading…
Reference in a new issue