mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
playback: GstStreamType is a flag
Therefor don't use equality
This commit is contained in:
parent
acc3a9d242
commit
8485a8d786
2 changed files with 62 additions and 92 deletions
|
@ -1796,7 +1796,7 @@ reconfigure_output_stream (DecodebinOutputStream * output,
|
||||||
can_reuse_decoder = FALSE;
|
can_reuse_decoder = FALSE;
|
||||||
|
|
||||||
if (can_reuse_decoder) {
|
if (can_reuse_decoder) {
|
||||||
if (output->type == GST_STREAM_TYPE_VIDEO && output->drop_probe_id == 0) {
|
if (output->type & GST_STREAM_TYPE_VIDEO && output->drop_probe_id == 0) {
|
||||||
GST_DEBUG_OBJECT (dbin, "Adding keyframe-waiter probe");
|
GST_DEBUG_OBJECT (dbin, "Adding keyframe-waiter probe");
|
||||||
output->drop_probe_id =
|
output->drop_probe_id =
|
||||||
gst_pad_add_probe (slot->src_pad, GST_PAD_PROBE_TYPE_BUFFER,
|
gst_pad_add_probe (slot->src_pad, GST_PAD_PROBE_TYPE_BUFFER,
|
||||||
|
@ -1863,7 +1863,7 @@ reconfigure_output_stream (DecodebinOutputStream * output,
|
||||||
}
|
}
|
||||||
output->decoder_sink = gst_element_get_static_pad (output->decoder, "sink");
|
output->decoder_sink = gst_element_get_static_pad (output->decoder, "sink");
|
||||||
output->decoder_src = gst_element_get_static_pad (output->decoder, "src");
|
output->decoder_src = gst_element_get_static_pad (output->decoder, "src");
|
||||||
if (output->type == GST_STREAM_TYPE_VIDEO) {
|
if (output->type & GST_STREAM_TYPE_VIDEO) {
|
||||||
GST_DEBUG_OBJECT (dbin, "Adding keyframe-waiter probe");
|
GST_DEBUG_OBJECT (dbin, "Adding keyframe-waiter probe");
|
||||||
output->drop_probe_id =
|
output->drop_probe_id =
|
||||||
gst_pad_add_probe (slot->src_pad, GST_PAD_PROBE_TYPE_BUFFER,
|
gst_pad_add_probe (slot->src_pad, GST_PAD_PROBE_TYPE_BUFFER,
|
||||||
|
@ -2395,27 +2395,22 @@ create_output_stream (GstDecodebin3 * dbin, GstStreamType type)
|
||||||
res->type = type;
|
res->type = type;
|
||||||
res->dbin = dbin;
|
res->dbin = dbin;
|
||||||
|
|
||||||
switch (type) {
|
if (type & GST_STREAM_TYPE_VIDEO) {
|
||||||
case GST_STREAM_TYPE_VIDEO:
|
templ = &video_src_template;
|
||||||
templ = &video_src_template;
|
counter = &dbin->vpadcount;
|
||||||
counter = &dbin->vpadcount;
|
prefix = "video";
|
||||||
prefix = "video";
|
} else if (type & GST_STREAM_TYPE_AUDIO) {
|
||||||
break;
|
templ = &audio_src_template;
|
||||||
case GST_STREAM_TYPE_AUDIO:
|
counter = &dbin->apadcount;
|
||||||
templ = &audio_src_template;
|
prefix = "audio";
|
||||||
counter = &dbin->apadcount;
|
} else if (type & GST_STREAM_TYPE_TEXT) {
|
||||||
prefix = "audio";
|
templ = &text_src_template;
|
||||||
break;
|
counter = &dbin->tpadcount;
|
||||||
case GST_STREAM_TYPE_TEXT:
|
prefix = "text";
|
||||||
templ = &text_src_template;
|
} else {
|
||||||
counter = &dbin->tpadcount;
|
templ = &src_template;
|
||||||
prefix = "text";
|
counter = &dbin->opadcount;
|
||||||
break;
|
prefix = "src";
|
||||||
default:
|
|
||||||
templ = &src_template;
|
|
||||||
counter = &dbin->opadcount;
|
|
||||||
prefix = "src";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pad_name = g_strdup_printf ("%s_%u", prefix, *counter);
|
pad_name = g_strdup_printf ("%s_%u", prefix, *counter);
|
||||||
|
|
|
@ -1167,21 +1167,15 @@ update_combiner_info (GstPlayBin3 * playbin)
|
||||||
gst_stream_collection_get_stream (playbin->collection, i);
|
gst_stream_collection_get_stream (playbin->collection, i);
|
||||||
GstStreamType stype = gst_stream_get_stream_type (stream);
|
GstStreamType stype = gst_stream_get_stream_type (stream);
|
||||||
|
|
||||||
switch (stype) {
|
if (stype & GST_STREAM_TYPE_AUDIO) {
|
||||||
case GST_STREAM_TYPE_AUDIO:
|
g_ptr_array_add (playbin->combiner[PLAYBIN_STREAM_AUDIO].streams,
|
||||||
g_ptr_array_add (playbin->combiner[PLAYBIN_STREAM_AUDIO].streams,
|
gst_object_ref (stream));
|
||||||
gst_object_ref (stream));
|
} else if (stype & GST_STREAM_TYPE_VIDEO) {
|
||||||
break;
|
g_ptr_array_add (playbin->combiner[PLAYBIN_STREAM_VIDEO].streams,
|
||||||
case GST_STREAM_TYPE_VIDEO:
|
gst_object_ref (stream));
|
||||||
g_ptr_array_add (playbin->combiner[PLAYBIN_STREAM_VIDEO].streams,
|
} else if (stype & GST_STREAM_TYPE_TEXT) {
|
||||||
gst_object_ref (stream));
|
g_ptr_array_add (playbin->combiner[PLAYBIN_STREAM_TEXT].streams,
|
||||||
break;
|
gst_object_ref (stream));
|
||||||
case GST_STREAM_TYPE_TEXT:
|
|
||||||
g_ptr_array_add (playbin->combiner[PLAYBIN_STREAM_TEXT].streams,
|
|
||||||
gst_object_ref (stream));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1198,20 +1192,14 @@ static void
|
||||||
set_selected_stream (GstPlayBin3 * playbin, GstStream * stream)
|
set_selected_stream (GstPlayBin3 * playbin, GstStream * stream)
|
||||||
{
|
{
|
||||||
GstSourceCombine *combine = NULL;
|
GstSourceCombine *combine = NULL;
|
||||||
|
GstStreamType stype = gst_stream_get_stream_type (stream);
|
||||||
|
|
||||||
switch (gst_stream_get_stream_type (stream)) {
|
if (stype & GST_STREAM_TYPE_AUDIO)
|
||||||
case GST_STREAM_TYPE_AUDIO:
|
combine = &playbin->combiner[PLAYBIN_STREAM_AUDIO];
|
||||||
combine = &playbin->combiner[PLAYBIN_STREAM_AUDIO];
|
else if (stype & GST_STREAM_TYPE_VIDEO)
|
||||||
break;
|
combine = &playbin->combiner[PLAYBIN_STREAM_VIDEO];
|
||||||
case GST_STREAM_TYPE_VIDEO:
|
else if (stype & GST_STREAM_TYPE_TEXT)
|
||||||
combine = &playbin->combiner[PLAYBIN_STREAM_VIDEO];
|
combine = &playbin->combiner[PLAYBIN_STREAM_TEXT];
|
||||||
break;
|
|
||||||
case GST_STREAM_TYPE_TEXT:
|
|
||||||
combine = &playbin->combiner[PLAYBIN_STREAM_TEXT];
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (combine) {
|
if (combine) {
|
||||||
if (combine->combiner == NULL) {
|
if (combine->combiner == NULL) {
|
||||||
|
@ -2460,34 +2448,28 @@ do_stream_selection (GstPlayBin3 * playbin)
|
||||||
gint pb_stream_type = -1;
|
gint pb_stream_type = -1;
|
||||||
gboolean select_this = FALSE;
|
gboolean select_this = FALSE;
|
||||||
|
|
||||||
switch (stream_type) {
|
if (stream_type & GST_STREAM_TYPE_AUDIO) {
|
||||||
case GST_STREAM_TYPE_AUDIO:
|
pb_stream_type = PLAYBIN_STREAM_AUDIO;
|
||||||
pb_stream_type = PLAYBIN_STREAM_AUDIO;
|
/* Select the stream if it's the current one or if there's a custom selector */
|
||||||
/* Select the stream if it's the current one or if there's a custom selector */
|
select_this =
|
||||||
select_this =
|
(nb_audio == playbin->current_audio ||
|
||||||
(nb_audio == playbin->current_audio ||
|
(playbin->current_audio == -1 && nb_audio == 0) ||
|
||||||
(playbin->current_audio == -1 && nb_audio == 0) ||
|
playbin->audio_stream_combiner != NULL);
|
||||||
playbin->audio_stream_combiner != NULL);
|
nb_audio++;
|
||||||
nb_audio++;
|
} else if (stream_type & GST_STREAM_TYPE_VIDEO) {
|
||||||
break;
|
pb_stream_type = PLAYBIN_STREAM_AUDIO;
|
||||||
case GST_STREAM_TYPE_VIDEO:
|
select_this =
|
||||||
pb_stream_type = PLAYBIN_STREAM_AUDIO;
|
(nb_video == playbin->current_video ||
|
||||||
select_this =
|
(playbin->current_video == -1 && nb_video == 0) ||
|
||||||
(nb_video == playbin->current_video ||
|
playbin->video_stream_combiner != NULL);
|
||||||
(playbin->current_video == -1 && nb_video == 0) ||
|
nb_video++;
|
||||||
playbin->video_stream_combiner != NULL);
|
} else if (stream_type & GST_STREAM_TYPE_TEXT) {
|
||||||
nb_video++;
|
pb_stream_type = PLAYBIN_STREAM_TEXT;
|
||||||
break;
|
select_this =
|
||||||
case GST_STREAM_TYPE_TEXT:
|
(nb_text == playbin->current_text ||
|
||||||
pb_stream_type = PLAYBIN_STREAM_TEXT;
|
(playbin->current_text == -1 && nb_text == 0) ||
|
||||||
select_this =
|
playbin->text_stream_combiner != NULL);
|
||||||
(nb_text == playbin->current_text ||
|
nb_text++;
|
||||||
(playbin->current_text == -1 && nb_text == 0) ||
|
|
||||||
playbin->text_stream_combiner != NULL);
|
|
||||||
nb_text++;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (pb_stream_type < 0) {
|
if (pb_stream_type < 0) {
|
||||||
GST_DEBUG_OBJECT (playbin,
|
GST_DEBUG_OBJECT (playbin,
|
||||||
|
@ -3070,19 +3052,12 @@ select_stream_cb (GstElement * decodebin, GstStreamCollection * collection,
|
||||||
GstStreamType stype = gst_stream_get_stream_type (stream);
|
GstStreamType stype = gst_stream_get_stream_type (stream);
|
||||||
GstElement *combiner = NULL;
|
GstElement *combiner = NULL;
|
||||||
|
|
||||||
switch (stype) {
|
if (stype & GST_STREAM_TYPE_AUDIO)
|
||||||
case GST_STREAM_TYPE_AUDIO:
|
combiner = playbin->audio_stream_combiner;
|
||||||
combiner = playbin->audio_stream_combiner;
|
else if (stype & GST_STREAM_TYPE_VIDEO)
|
||||||
break;
|
combiner = playbin->video_stream_combiner;
|
||||||
case GST_STREAM_TYPE_VIDEO:
|
else if (stype & GST_STREAM_TYPE_TEXT)
|
||||||
combiner = playbin->video_stream_combiner;
|
combiner = playbin->text_stream_combiner;
|
||||||
break;
|
|
||||||
case GST_STREAM_TYPE_TEXT:
|
|
||||||
combiner = playbin->text_stream_combiner;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (combiner) {
|
if (combiner) {
|
||||||
GST_DEBUG_OBJECT (playbin, "Got a combiner, requesting stream activation");
|
GST_DEBUG_OBJECT (playbin, "Got a combiner, requesting stream activation");
|
||||||
|
|
Loading…
Reference in a new issue