amc: If we find multiple codecs with the same name, just merge them

On the ODroid C1+ the H265 and H264 have the same name but are listed as two
different codecs. We have to handle them as the same one that supports both,
as otherwise we will register the same GType name twice which fails and we
then only have H265 support and not H264 support.
This commit is contained in:
Sebastian Dröge 2016-08-01 10:28:26 +03:00
parent cce42ea5a6
commit 8748ce94f4

View file

@ -1852,9 +1852,41 @@ scan_codecs (GstPlugin * plugin)
/* We need at least a valid supported type */
if (valid_codec) {
GST_LOG ("Successfully scanned codec '%s'", name_str);
g_queue_push_tail (&codec_infos, gst_codec_info);
gst_codec_info = NULL;
GList *l;
for (l = codec_infos.head; l; l = l->next) {
GstAmcCodecInfo *tmp = l->data;
if (strcmp (tmp->name, gst_codec_info->name) == 0
&& ! !tmp->is_encoder == ! !gst_codec_info->is_encoder) {
gint m = tmp->n_supported_types, n;
GST_LOG ("Successfully scanned codec '%s', appending to existing",
name_str);
tmp->gl_output_only |= gst_codec_info->gl_output_only;
tmp->n_supported_types += gst_codec_info->n_supported_types;
tmp->supported_types =
g_realloc (tmp->supported_types, tmp->n_supported_types);
for (n = 0; n < gst_codec_info->n_supported_types; n++, m++) {
tmp->supported_types[m] = gst_codec_info->supported_types[n];
}
g_free (gst_codec_info->supported_types);
g_free (gst_codec_info->name);
g_free (gst_codec_info);
gst_codec_info = NULL;
break;
}
}
/* Found no existing codec with this name */
if (l == NULL) {
GST_LOG ("Successfully scanned codec '%s'", name_str);
g_queue_push_tail (&codec_infos, gst_codec_info);
gst_codec_info = NULL;
}
}
/* Clean up of all local references we got */