tools: Make the stream-switching action more generic
This allows it to handle both playbin and playbin3
This commit is contained in:
parent
b413f3a404
commit
0799397768
@ -274,9 +274,6 @@ _execute_switch_track (GstValidateScenario * scenario,
|
|||||||
GstValidateAction * action)
|
GstValidateAction * action)
|
||||||
{
|
{
|
||||||
gint index, n;
|
gint index, n;
|
||||||
GstPad *srcpad;
|
|
||||||
GstElement *combiner;
|
|
||||||
GstPad *oldpad, *newpad;
|
|
||||||
const gchar *type, *str_index;
|
const gchar *type, *str_index;
|
||||||
|
|
||||||
gint flags, current, tflag;
|
gint flags, current, tflag;
|
||||||
@ -297,6 +294,10 @@ _execute_switch_track (GstValidateScenario * scenario,
|
|||||||
g_object_get (scenario->pipeline, "flags", &flags, tmp, &n,
|
g_object_get (scenario->pipeline, "flags", &flags, tmp, &n,
|
||||||
current_txt, ¤t, NULL);
|
current_txt, ¤t, NULL);
|
||||||
|
|
||||||
|
/* Don't try to use -1 */
|
||||||
|
if (current == -1)
|
||||||
|
current = 0;
|
||||||
|
|
||||||
g_free (tmp);
|
g_free (tmp);
|
||||||
|
|
||||||
if (gst_structure_has_field (action->structure, "disable")) {
|
if (gst_structure_has_field (action->structure, "disable")) {
|
||||||
@ -321,6 +322,7 @@ _execute_switch_track (GstValidateScenario * scenario,
|
|||||||
|
|
||||||
if (!disabling) {
|
if (!disabling) {
|
||||||
GstState state, next;
|
GstState state, next;
|
||||||
|
GstPad *oldpad, *newpad;
|
||||||
tmp = g_strdup_printf ("get-%s-pad", type);
|
tmp = g_strdup_printf ("get-%s-pad", type);
|
||||||
g_signal_emit_by_name (G_OBJECT (scenario->pipeline), tmp, current,
|
g_signal_emit_by_name (G_OBJECT (scenario->pipeline), tmp, current,
|
||||||
&oldpad);
|
&oldpad);
|
||||||
@ -334,17 +336,27 @@ _execute_switch_track (GstValidateScenario * scenario,
|
|||||||
|
|
||||||
if (gst_element_get_state (scenario->pipeline, &state, &next, 0) &&
|
if (gst_element_get_state (scenario->pipeline, &state, &next, 0) &&
|
||||||
state == GST_STATE_PLAYING && next == GST_STATE_VOID_PENDING) {
|
state == GST_STATE_PLAYING && next == GST_STATE_VOID_PENDING) {
|
||||||
|
GstPad *srcpad = NULL;
|
||||||
|
GstElement *combiner = NULL;
|
||||||
|
if (newpad == oldpad) {
|
||||||
|
srcpad = gst_pad_get_peer (oldpad);
|
||||||
|
} else if (newpad) {
|
||||||
combiner = GST_ELEMENT (gst_object_get_parent (GST_OBJECT (newpad)));
|
combiner = GST_ELEMENT (gst_object_get_parent (GST_OBJECT (newpad)));
|
||||||
|
if (combiner) {
|
||||||
srcpad = gst_element_get_static_pad (combiner, "src");
|
srcpad = gst_element_get_static_pad (combiner, "src");
|
||||||
gst_object_unref (combiner);
|
gst_object_unref (combiner);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (srcpad) {
|
||||||
gst_pad_add_probe (srcpad,
|
gst_pad_add_probe (srcpad,
|
||||||
GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BUFFER_LIST,
|
GST_PAD_PROBE_TYPE_BUFFER | GST_PAD_PROBE_TYPE_BUFFER_LIST,
|
||||||
(GstPadProbeCallback) _check_pad_selection_done, action, NULL);
|
(GstPadProbeCallback) _check_pad_selection_done, action, NULL);
|
||||||
gst_object_unref (srcpad);
|
gst_object_unref (srcpad);
|
||||||
|
|
||||||
res = GST_VALIDATE_EXECUTE_ACTION_ASYNC;
|
res = GST_VALIDATE_EXECUTE_ACTION_ASYNC;
|
||||||
|
} else
|
||||||
|
res = GST_VALIDATE_EXECUTE_ACTION_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user