mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 15:27:07 +00:00
playbin: Fix sorting for decoder factories for which we didn't find a compatible sink
They might just need some converters for raw audio/video. https://bugzilla.gnome.org/show_bug.cgi?id=704285
This commit is contained in:
parent
1ed1792560
commit
5ee98c146e
1 changed files with 32 additions and 10 deletions
|
@ -3544,15 +3544,28 @@ avelement_compare (gconstpointer p1, gconstpointer p2)
|
||||||
v1 = (GstAVElement *) p1;
|
v1 = (GstAVElement *) p1;
|
||||||
v2 = (GstAVElement *) p2;
|
v2 = (GstAVElement *) p2;
|
||||||
|
|
||||||
fs1 = (GstPluginFeature *) v1->sink;
|
|
||||||
fs2 = (GstPluginFeature *) v2->sink;
|
|
||||||
fd1 = (GstPluginFeature *) v1->dec;
|
fd1 = (GstPluginFeature *) v1->dec;
|
||||||
fd2 = (GstPluginFeature *) v2->dec;
|
fd2 = (GstPluginFeature *) v2->dec;
|
||||||
|
|
||||||
v1_rank =
|
/* If both have a sink, we also compare their ranks */
|
||||||
gst_plugin_feature_get_rank (fd1) * gst_plugin_feature_get_rank (fs1);
|
if (v1->sink && v2->sink) {
|
||||||
v2_rank =
|
fs1 = (GstPluginFeature *) v1->sink;
|
||||||
gst_plugin_feature_get_rank (fd2) * gst_plugin_feature_get_rank (fs2);
|
fs2 = (GstPluginFeature *) v2->sink;
|
||||||
|
v1_rank =
|
||||||
|
gst_plugin_feature_get_rank (fd1) * gst_plugin_feature_get_rank (fs1);
|
||||||
|
v2_rank =
|
||||||
|
gst_plugin_feature_get_rank (fd2) * gst_plugin_feature_get_rank (fs2);
|
||||||
|
} else {
|
||||||
|
/* If one has a sink, prefer that one */
|
||||||
|
if (v1->sink)
|
||||||
|
return -1;
|
||||||
|
else if (v2->sink)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
v1_rank = gst_plugin_feature_get_rank (fd1);
|
||||||
|
v2_rank = gst_plugin_feature_get_rank (fd2);
|
||||||
|
fs1 = fs2 = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/* comparison based on the rank */
|
/* comparison based on the rank */
|
||||||
diff = v2_rank - v1_rank;
|
diff = v2_rank - v1_rank;
|
||||||
|
@ -3566,10 +3579,12 @@ avelement_compare (gconstpointer p1, gconstpointer p2)
|
||||||
if (diff != 0)
|
if (diff != 0)
|
||||||
return diff;
|
return diff;
|
||||||
|
|
||||||
/* comparison based on the name of sink elements */
|
if (fs1 && fs2) {
|
||||||
diff = strcmp (GST_OBJECT_NAME (fs1), GST_OBJECT_NAME (fs2));
|
/* comparison based on the name of sink elements */
|
||||||
if (diff != 0)
|
diff = strcmp (GST_OBJECT_NAME (fs1), GST_OBJECT_NAME (fs2));
|
||||||
return diff;
|
if (diff != 0)
|
||||||
|
return diff;
|
||||||
|
}
|
||||||
|
|
||||||
/* comparison based on the name of decoder elements */
|
/* comparison based on the name of decoder elements */
|
||||||
return strcmp (GST_OBJECT_NAME (fd1), GST_OBJECT_NAME (fd2));
|
return strcmp (GST_OBJECT_NAME (fd1), GST_OBJECT_NAME (fd2));
|
||||||
|
@ -3751,6 +3766,13 @@ create_decoders_list (GList * factory_list, GSequence * avelements)
|
||||||
g_sequence_lookup (avelements, factory,
|
g_sequence_lookup (avelements, factory,
|
||||||
(GCompareDataFunc) avelement_lookup_decoder, NULL);
|
(GCompareDataFunc) avelement_lookup_decoder, NULL);
|
||||||
if (!seq_iter) {
|
if (!seq_iter) {
|
||||||
|
GstAVElement *ave = g_slice_new0 (GstAVElement);
|
||||||
|
|
||||||
|
ave->dec = factory;
|
||||||
|
ave->sink = NULL;
|
||||||
|
/* There's at least raw */
|
||||||
|
ave->n_comm_cf = 1;
|
||||||
|
|
||||||
dec_list = g_list_prepend (dec_list, factory);
|
dec_list = g_list_prepend (dec_list, factory);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue