summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2016-08-01 10:28:26 +0300
committerSebastian Dröge <sebastian@centricular.com>2016-08-16 16:42:23 +0300
commit83c2fbf0385365764dad57929f0e0b488b6b84bf (patch)
tree53d4c40f3bcb1528911702a7a7789724d0204692
parentde89cafe912780e914d5069248e9a7658b132737 (diff)
downloadgstreamer-plugins-bad-83c2fbf0385365764dad57929f0e0b488b6b84bf.tar.gz
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.
-rw-r--r--sys/androidmedia/gstamc.c38
1 files changed, 35 insertions, 3 deletions
diff --git a/sys/androidmedia/gstamc.c b/sys/androidmedia/gstamc.c
index 826174fd0..7f3bf8bdf 100644
--- a/sys/androidmedia/gstamc.c
+++ b/sys/androidmedia/gstamc.c
@@ -1851,9 +1851,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 */