amc: Remove gst_amc_format_contains_key()

It is not needed, we can just try to get the key and ignore error.
NdkMediaFormat doesn't have that method.
This commit is contained in:
Xavier Claessens 2018-11-13 13:16:34 -05:00
parent 7fcf3ebf07
commit 0fe0270244
3 changed files with 6 additions and 42 deletions

View file

@ -36,8 +36,6 @@ void gst_amc_format_free (GstAmcFormat * format);
gchar * gst_amc_format_to_string (GstAmcFormat * format, GError **err);
gboolean gst_amc_format_contains_key (GstAmcFormat *format, const gchar *key, GError **err);
gboolean gst_amc_format_get_float (GstAmcFormat *format, const gchar *key, gfloat *value, GError **err);
gboolean gst_amc_format_set_float (GstAmcFormat *format, const gchar *key, gfloat value, GError **err);
gboolean gst_amc_format_get_int (GstAmcFormat *format, const gchar *key, gint *value, GError **err);

View file

@ -379,9 +379,8 @@ gst_amc_audio_dec_set_src_caps (GstAmcAudioDec * self, GstAmcFormat * format)
}
/* Not always present */
if (gst_amc_format_contains_key (format, "channel-mask", NULL))
gst_amc_format_get_int (format, "channel-mask", (gint *) & channel_mask,
NULL);
gst_amc_format_get_int (format, "channel-mask", (gint *) & channel_mask,
NULL);
gst_amc_audio_channel_mask_to_positions (channel_mask, channels,
self->positions);

View file

@ -33,7 +33,6 @@ static struct
jmethodID create_audio_format;
jmethodID create_video_format;
jmethodID to_string;
jmethodID contains_key;
jmethodID get_float;
jmethodID set_float;
jmethodID get_integer;
@ -85,9 +84,6 @@ gst_amc_format_static_init (void)
media_format.to_string =
(*env)->GetMethodID (env, media_format.klass, "toString",
"()Ljava/lang/String;");
media_format.contains_key =
(*env)->GetMethodID (env, media_format.klass, "containsKey",
"(Ljava/lang/String;)Z");
media_format.get_float =
(*env)->GetMethodID (env, media_format.klass, "getFloat",
"(Ljava/lang/String;)F");
@ -113,11 +109,10 @@ gst_amc_format_static_init (void)
(*env)->GetMethodID (env, media_format.klass, "setByteBuffer",
"(Ljava/lang/String;Ljava/nio/ByteBuffer;)V");
if (!media_format.create_audio_format || !media_format.create_video_format
|| !media_format.contains_key || !media_format.get_float
|| !media_format.set_float || !media_format.get_integer
|| !media_format.set_integer || !media_format.get_string
|| !media_format.set_string || !media_format.get_byte_buffer
|| !media_format.set_byte_buffer) {
|| !media_format.get_float || !media_format.set_float
|| !media_format.get_integer || !media_format.set_integer
|| !media_format.get_string || !media_format.set_string
|| !media_format.get_byte_buffer || !media_format.set_byte_buffer) {
ret = FALSE;
GST_ERROR ("Failed to get format methods");
if ((*env)->ExceptionCheck (env)) {
@ -242,34 +237,6 @@ done:
return ret;
}
gboolean
gst_amc_format_contains_key (GstAmcFormat * format, const gchar * key,
GError ** err)
{
JNIEnv *env;
gboolean ret = FALSE;
jstring key_str = NULL;
g_return_val_if_fail (format != NULL, FALSE);
g_return_val_if_fail (key != NULL, FALSE);
env = gst_amc_jni_get_env ();
key_str = gst_amc_jni_string_from_gchar (env, err, FALSE, key);
if (!key_str)
goto done;
if (!gst_amc_jni_call_boolean_method (env, err, format->object,
media_format.contains_key, &ret, key_str))
goto done;
done:
if (key_str)
gst_amc_jni_object_local_unref (env, key_str);
return ret;
}
gboolean
gst_amc_format_get_float (GstAmcFormat * format, const gchar * key,
gfloat * value, GError ** err)