mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 09:40:37 +00:00
gst/playback/: Set state on newly added element to READY so that negotiation can happen ASAP.
Original commit message from CVS: * gst/playback/gstdecodebin.c: (gst_decode_bin_init), (find_compatibles), (close_pad_link), (try_to_link_1), (no_more_pads), (close_link), (type_found): * gst/playback/gstplaybasebin.c: (new_decoded_pad): * gst/playback/gstplaybin.c: (gen_video_element), (gen_audio_element): Set state on newly added element to READY so that negotiation can happen ASAP. Addes some more debug info. Do not try to plug pads with multiple caps structures or ANY because it is too dangerous since we do not do dynamic replugging.
This commit is contained in:
parent
651b92bc77
commit
e3ddfa2c41
4 changed files with 52 additions and 11 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
||||||
|
2004-10-06 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
|
* gst/playback/gstdecodebin.c: (gst_decode_bin_init),
|
||||||
|
(find_compatibles), (close_pad_link), (try_to_link_1),
|
||||||
|
(no_more_pads), (close_link), (type_found):
|
||||||
|
* gst/playback/gstplaybasebin.c: (new_decoded_pad):
|
||||||
|
* gst/playback/gstplaybin.c: (gen_video_element),
|
||||||
|
(gen_audio_element):
|
||||||
|
Set state on newly added element to READY so that negotiation
|
||||||
|
can happen ASAP.
|
||||||
|
Addes some more debug info.
|
||||||
|
Do not try to plug pads with multiple caps structures or ANY
|
||||||
|
because it is too dangerous since we do not do dynamic
|
||||||
|
replugging.
|
||||||
|
|
||||||
2004-10-06 Thomas Vander Stichele <thomas at apestaart dot org>
|
2004-10-06 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
written by: Gora Mohanty <gora_mohanty@yahoo.co.in>
|
written by: Gora Mohanty <gora_mohanty@yahoo.co.in>
|
||||||
|
|
|
@ -380,6 +380,14 @@ close_pad_link (GstElement * element, GstPad * pad, GstCaps * caps,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* the caps is any, this means the pad can be anything and
|
||||||
|
* we don't know yet */
|
||||||
|
if (gst_caps_is_any (caps)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (element, "trying to close %" GST_PTR_FORMAT, caps);
|
||||||
|
|
||||||
/* FIXME, iterate over more structures? */
|
/* FIXME, iterate over more structures? */
|
||||||
structure = gst_caps_get_structure (caps, 0);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
mimetype = gst_structure_get_name (structure);
|
mimetype = gst_structure_get_name (structure);
|
||||||
|
@ -402,6 +410,8 @@ close_pad_link (GstElement * element, GstPad * pad, GstCaps * caps,
|
||||||
/* see if any more pending dynamic connections exist */
|
/* see if any more pending dynamic connections exist */
|
||||||
dynamic = gst_decode_bin_is_dynamic (decode_bin);
|
dynamic = gst_decode_bin_is_dynamic (decode_bin);
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (element, "closed pad %s", padname);
|
||||||
|
|
||||||
/* our own signal with an extra flag that this is the only pad */
|
/* our own signal with an extra flag that this is the only pad */
|
||||||
g_signal_emit (G_OBJECT (decode_bin),
|
g_signal_emit (G_OBJECT (decode_bin),
|
||||||
gst_decode_bin_signals[SIGNAL_NEW_DECODED_PAD], 0, ghost, !dynamic);
|
gst_decode_bin_signals[SIGNAL_NEW_DECODED_PAD], 0, ghost, !dynamic);
|
||||||
|
@ -410,6 +420,7 @@ close_pad_link (GstElement * element, GstPad * pad, GstCaps * caps,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gst_caps_get_size (caps) == 1) {
|
||||||
/* then continue plugging, first find all compatible elements */
|
/* then continue plugging, first find all compatible elements */
|
||||||
to_try = find_compatibles (decode_bin, caps);
|
to_try = find_compatibles (decode_bin, caps);
|
||||||
if (to_try == NULL) {
|
if (to_try == NULL) {
|
||||||
|
@ -419,9 +430,12 @@ close_pad_link (GstElement * element, GstPad * pad, GstCaps * caps,
|
||||||
gst_decode_bin_signals[SIGNAL_UNKNOWN_TYPE], 0, caps);
|
gst_decode_bin_signals[SIGNAL_UNKNOWN_TYPE], 0, caps);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now try to link the elements in the to_try list to the pad */
|
|
||||||
try_to_link_1 (decode_bin, pad, to_try);
|
try_to_link_1 (decode_bin, pad, to_try);
|
||||||
|
} else {
|
||||||
|
GST_LOG_OBJECT (element, "multiple possibilities, delaying");
|
||||||
|
g_warning ("multiple possibilities, delaying");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* given a list of element factories, try to link one of the factories
|
/* given a list of element factories, try to link one of the factories
|
||||||
|
@ -452,6 +466,9 @@ try_to_link_1 (GstDecodeBin * decode_bin, GstPad * pad, GList * factories)
|
||||||
/* now add the element to the bin first */
|
/* now add the element to the bin first */
|
||||||
GST_DEBUG_OBJECT (decode_bin, "adding %s", gst_element_get_name (element));
|
GST_DEBUG_OBJECT (decode_bin, "adding %s", gst_element_get_name (element));
|
||||||
gst_bin_add (GST_BIN (decode_bin), element);
|
gst_bin_add (GST_BIN (decode_bin), element);
|
||||||
|
|
||||||
|
gst_element_set_state (element, GST_STATE_READY);
|
||||||
|
|
||||||
/* keep out own list of elements */
|
/* keep out own list of elements */
|
||||||
decode_bin->elements = g_list_prepend (decode_bin->elements, element);
|
decode_bin->elements = g_list_prepend (decode_bin->elements, element);
|
||||||
|
|
||||||
|
@ -654,7 +671,7 @@ type_found (GstElement * typefind, guint probability, GstCaps * caps,
|
||||||
gst_element_no_more_pads (GST_ELEMENT (decode_bin));
|
gst_element_no_more_pads (GST_ELEMENT (decode_bin));
|
||||||
} else {
|
} else {
|
||||||
/* more dynamic elements exist that could create new pads */
|
/* more dynamic elements exist that could create new pads */
|
||||||
GST_DEBUG_OBJECT (decode_bin, "we more dynamic elements");
|
GST_DEBUG_OBJECT (decode_bin, "we have more dynamic elements");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -336,7 +336,10 @@ new_decoded_pad (GstElement * element, GstPad * pad, gboolean last,
|
||||||
play_base_bin->preroll_elems =
|
play_base_bin->preroll_elems =
|
||||||
g_list_prepend (play_base_bin->preroll_elems, new_element);
|
g_list_prepend (play_base_bin->preroll_elems, new_element);
|
||||||
|
|
||||||
|
gst_element_set_state (new_element, GST_STATE_READY);
|
||||||
|
|
||||||
gst_pad_link (pad, gst_element_get_pad (new_element, "sink"));
|
gst_pad_link (pad, gst_element_get_pad (new_element, "sink"));
|
||||||
|
|
||||||
gst_element_set_state (new_element, GST_STATE_PAUSED);
|
gst_element_set_state (new_element, GST_STATE_PAUSED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -289,6 +289,8 @@ gen_video_element (GstPlayBin * play_bin)
|
||||||
sink = play_bin->video_sink;
|
sink = play_bin->video_sink;
|
||||||
} else {
|
} else {
|
||||||
sink = gst_element_factory_make ("ximagesink", "sink");
|
sink = gst_element_factory_make ("ximagesink", "sink");
|
||||||
|
|
||||||
|
/* g_object_set (G_OBJECT (sink), "pixel-aspect-ratio", "1/1", NULL); */
|
||||||
}
|
}
|
||||||
|
|
||||||
play_bin->seekables = g_list_append (play_bin->seekables, sink);
|
play_bin->seekables = g_list_append (play_bin->seekables, sink);
|
||||||
|
@ -302,6 +304,8 @@ gen_video_element (GstPlayBin * play_bin)
|
||||||
gst_element_add_ghost_pad (element, gst_element_get_pad (conv, "sink"),
|
gst_element_add_ghost_pad (element, gst_element_get_pad (conv, "sink"),
|
||||||
"sink");
|
"sink");
|
||||||
|
|
||||||
|
gst_element_set_state (element, GST_STATE_READY);
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,6 +347,8 @@ gen_audio_element (GstPlayBin * play_bin)
|
||||||
gst_element_add_ghost_pad (element,
|
gst_element_add_ghost_pad (element,
|
||||||
gst_element_get_pad (conv, "sink"), "sink");
|
gst_element_get_pad (conv, "sink"), "sink");
|
||||||
|
|
||||||
|
gst_element_set_state (element, GST_STATE_READY);
|
||||||
|
|
||||||
return element;
|
return element;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue