androidmedia: Don't query supported color formats for non-video codecs

This commit is contained in:
Sebastian Dröge 2015-06-15 12:20:24 +02:00
parent 95dd8d9662
commit 90c4a6ecd0

View file

@ -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;
}
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/")) {
jobject color_formats = NULL;
jint *color_formats_elems = NULL;
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;
}
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 (!n_elems) {
GST_ERROR ("No supported color formats for video codec");
valid_codec = FALSE;