mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-07 03:02:17 +00:00
decodebin3: Refactor linking input to slot
The same sequence of calls was done when doing that Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7002>
This commit is contained in:
parent
400b93e957
commit
bf24f813d5
1 changed files with 22 additions and 19 deletions
|
@ -543,6 +543,7 @@ static gboolean gst_decodebin_input_set_group_id (DecodebinInput * input,
|
||||||
guint32 * group_id);
|
guint32 * group_id);
|
||||||
static void gst_decodebin_input_unblock_streams (DecodebinInput * input,
|
static void gst_decodebin_input_unblock_streams (DecodebinInput * input,
|
||||||
gboolean unblock_other_inputs);
|
gboolean unblock_other_inputs);
|
||||||
|
static void gst_decodebin_input_link_to_slot (DecodebinInputStream * input);
|
||||||
|
|
||||||
static gboolean reconfigure_output_stream (DecodebinOutputStream * output,
|
static gboolean reconfigure_output_stream (DecodebinOutputStream * output,
|
||||||
MultiQueueSlot * slot, GstMessage ** msg);
|
MultiQueueSlot * slot, GstMessage ** msg);
|
||||||
|
@ -557,8 +558,6 @@ static void mq_slot_reassign (MultiQueueSlot * slot);
|
||||||
static MultiQueueSlot
|
static MultiQueueSlot
|
||||||
* gst_decodebin_get_slot_for_input_stream_locked (GstDecodebin3 * dbin,
|
* gst_decodebin_get_slot_for_input_stream_locked (GstDecodebin3 * dbin,
|
||||||
DecodebinInputStream * input);
|
DecodebinInputStream * input);
|
||||||
static void link_input_to_slot (DecodebinInputStream * input,
|
|
||||||
MultiQueueSlot * slot);
|
|
||||||
static void mq_slot_free (GstDecodebin3 * dbin, MultiQueueSlot * slot);
|
static void mq_slot_free (GstDecodebin3 * dbin, MultiQueueSlot * slot);
|
||||||
|
|
||||||
static GstStreamCollection *get_merged_collection (GstDecodebin3 * dbin);
|
static GstStreamCollection *get_merged_collection (GstDecodebin3 * dbin);
|
||||||
|
@ -1022,16 +1021,12 @@ gst_decodebin_input_stream_src_probe (GstPad * pad, GstPadProbeInfo * info,
|
||||||
/* FIXME : Would we ever end up with a stream already set on the input ?? */
|
/* FIXME : Would we ever end up with a stream already set on the input ?? */
|
||||||
if (stream) {
|
if (stream) {
|
||||||
if (input->active_stream != stream) {
|
if (input->active_stream != stream) {
|
||||||
MultiQueueSlot *slot;
|
|
||||||
if (input->active_stream)
|
if (input->active_stream)
|
||||||
gst_object_unref (input->active_stream);
|
gst_object_unref (input->active_stream);
|
||||||
input->active_stream = stream;
|
input->active_stream = stream;
|
||||||
/* We have the beginning of a stream, get a multiqueue slot and link to it */
|
/* We have the beginning of a stream, get a multiqueue slot and link to it */
|
||||||
SELECTION_LOCK (input->dbin);
|
SELECTION_LOCK (input->dbin);
|
||||||
slot =
|
gst_decodebin_input_link_to_slot (input);
|
||||||
gst_decodebin_get_slot_for_input_stream_locked (input->dbin,
|
|
||||||
input);
|
|
||||||
link_input_to_slot (input, slot);
|
|
||||||
SELECTION_UNLOCK (input->dbin);
|
SELECTION_UNLOCK (input->dbin);
|
||||||
} else
|
} else
|
||||||
gst_object_unref (stream);
|
gst_object_unref (stream);
|
||||||
|
@ -1254,7 +1249,6 @@ gst_decodebin_input_unblock_streams (DecodebinInput * input,
|
||||||
while (tmp != NULL) {
|
while (tmp != NULL) {
|
||||||
DecodebinInputStream *input_stream = (DecodebinInputStream *) tmp->data;
|
DecodebinInputStream *input_stream = (DecodebinInputStream *) tmp->data;
|
||||||
GList *next = tmp->next;
|
GList *next = tmp->next;
|
||||||
MultiQueueSlot *slot;
|
|
||||||
|
|
||||||
if (input_stream->input != input) {
|
if (input_stream->input != input) {
|
||||||
tmp = next;
|
tmp = next;
|
||||||
|
@ -1266,10 +1260,8 @@ gst_decodebin_input_unblock_streams (DecodebinInput * input,
|
||||||
if (!input_stream->active_stream)
|
if (!input_stream->active_stream)
|
||||||
input_stream->active_stream = gst_pad_get_stream (input_stream->srcpad);
|
input_stream->active_stream = gst_pad_get_stream (input_stream->srcpad);
|
||||||
|
|
||||||
/* Ensure the stream has an associated slot */
|
/* Ensure the stream is linked to a slot */
|
||||||
slot = gst_decodebin_get_slot_for_input_stream_locked (dbin, input_stream);
|
gst_decodebin_input_link_to_slot (input_stream);
|
||||||
if (slot->input != input_stream)
|
|
||||||
link_input_to_slot (input_stream, slot);
|
|
||||||
|
|
||||||
if (input_stream->buffer_probe_id) {
|
if (input_stream->buffer_probe_id) {
|
||||||
GST_DEBUG_OBJECT (dbin,
|
GST_DEBUG_OBJECT (dbin,
|
||||||
|
@ -3550,17 +3542,28 @@ gst_decodebin_get_slot_for_input_stream_locked (GstDecodebin3 * dbin,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** gst_decodebin_input_link_to_slot:
|
||||||
|
* @input_stream: A #DecodebinInputStream
|
||||||
|
*
|
||||||
|
* Figures out the appropriate #MultiQueueSlot for @input_stream and links to it
|
||||||
|
*
|
||||||
|
* Must be called with the SELECTION_LOCK taken
|
||||||
|
*/
|
||||||
static void
|
static void
|
||||||
link_input_to_slot (DecodebinInputStream * input, MultiQueueSlot * slot)
|
gst_decodebin_input_link_to_slot (DecodebinInputStream * input_stream)
|
||||||
{
|
{
|
||||||
if (slot->input != NULL && slot->input != input) {
|
GstDecodebin3 *dbin = input_stream->dbin;
|
||||||
GST_ERROR_OBJECT (slot->dbin,
|
MultiQueueSlot *slot =
|
||||||
"Trying to link input to an already used slot");
|
gst_decodebin_get_slot_for_input_stream_locked (dbin, input_stream);
|
||||||
|
|
||||||
|
if (slot->input != NULL && slot->input != input_stream) {
|
||||||
|
GST_ERROR_OBJECT (slot->dbin, "Input stream is already linked to a slot");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
gst_pad_link_full (input->srcpad, slot->sink_pad, GST_PAD_LINK_CHECK_NOTHING);
|
gst_pad_link_full (input_stream->srcpad, slot->sink_pad,
|
||||||
slot->pending_stream = input->active_stream;
|
GST_PAD_LINK_CHECK_NOTHING);
|
||||||
slot->input = input;
|
slot->pending_stream = input_stream->active_stream;
|
||||||
|
slot->input = input_stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GList *
|
static GList *
|
||||||
|
|
Loading…
Reference in a new issue