diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2015-06-15 12:20:24 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2015-06-15 12:20:24 +0200 |
commit | 90c4a6ecd0e7c8b1b1b5390bae2b1473b70fe313 (patch) | |
tree | 0ed258ae14e1bfee7624b9078bc28d771c26ccb3 /sys | |
parent | 95dd8d9662c7060843021d64e85c4295bd1578e9 (diff) | |
download | gstreamer-plugins-bad-90c4a6ecd0e7c8b1b1b5390bae2b1473b70fe313.tar.gz |
androidmedia: Don't query supported color formats for non-video codecs
Diffstat (limited to 'sys')
-rw-r--r-- | sys/androidmedia/gstamc.c | 73 |
1 files changed, 37 insertions, 36 deletions
diff --git a/sys/androidmedia/gstamc.c b/sys/androidmedia/gstamc.c index 0578d3ca1..c0c341ce5 100644 --- a/sys/androidmedia/gstamc.c +++ b/sys/androidmedia/gstamc.c @@ -1605,10 +1605,8 @@ scan_codecs (GstPlugin * plugin) const gchar *supported_type_str = NULL; jobject capabilities = NULL; jclass capabilities_class = NULL; - jfieldID color_formats_id, profile_levels_id; - jobject color_formats = NULL; + jfieldID profile_levels_id, color_formats_id; jobject profile_levels = NULL; - jint *color_formats_elems = NULL; jsize n_elems, k; gst_codec_type = &gst_codec_info->supported_types[j]; @@ -1668,42 +1666,45 @@ scan_codecs (GstPlugin * plugin) goto next_supported_type; } - color_formats = - (*env)->GetObjectField (env, capabilities, color_formats_id); - if ((*env)->ExceptionCheck (env)) { - GST_ERROR ("Failed to get color formats"); - (*env)->ExceptionDescribe (env); - (*env)->ExceptionClear (env); - valid_codec = FALSE; - goto next_supported_type; - } + if (g_str_has_prefix (gst_codec_type->mime, "video/")) { + jobject color_formats = NULL; + jint *color_formats_elems = NULL; - n_elems = (*env)->GetArrayLength (env, color_formats); - if ((*env)->ExceptionCheck (env)) { - GST_ERROR ("Failed to get color formats array length"); - (*env)->ExceptionDescribe (env); - (*env)->ExceptionClear (env); - valid_codec = FALSE; - goto next_supported_type; - } - gst_codec_type->n_color_formats = n_elems; - gst_codec_type->color_formats = g_new0 (gint, n_elems); - color_formats_elems = - (*env)->GetIntArrayElements (env, color_formats, NULL); - if ((*env)->ExceptionCheck (env)) { - GST_ERROR ("Failed to get color format elements"); - (*env)->ExceptionDescribe (env); - (*env)->ExceptionClear (env); - valid_codec = FALSE; - goto next_supported_type; - } + color_formats = + (*env)->GetObjectField (env, capabilities, color_formats_id); + if ((*env)->ExceptionCheck (env)) { + GST_ERROR ("Failed to get color formats"); + (*env)->ExceptionDescribe (env); + (*env)->ExceptionClear (env); + valid_codec = FALSE; + goto next_supported_type; + } - for (k = 0; k < n_elems; k++) { - GST_INFO ("Color format %d: 0x%x", k, color_formats_elems[k]); - gst_codec_type->color_formats[k] = color_formats_elems[k]; - } + n_elems = (*env)->GetArrayLength (env, color_formats); + if ((*env)->ExceptionCheck (env)) { + GST_ERROR ("Failed to get color formats array length"); + (*env)->ExceptionDescribe (env); + (*env)->ExceptionClear (env); + valid_codec = FALSE; + goto next_supported_type; + } + gst_codec_type->n_color_formats = n_elems; + gst_codec_type->color_formats = g_new0 (gint, n_elems); + color_formats_elems = + (*env)->GetIntArrayElements (env, color_formats, NULL); + if ((*env)->ExceptionCheck (env)) { + GST_ERROR ("Failed to get color format elements"); + (*env)->ExceptionDescribe (env); + (*env)->ExceptionClear (env); + valid_codec = FALSE; + goto next_supported_type; + } + + for (k = 0; k < n_elems; k++) { + GST_INFO ("Color format %d: 0x%x", k, color_formats_elems[k]); + gst_codec_type->color_formats[k] = color_formats_elems[k]; + } - if (g_str_has_prefix (gst_codec_type->mime, "video/")) { if (!n_elems) { GST_ERROR ("No supported color formats for video codec"); valid_codec = FALSE; |