mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
Print the MediaFormats we get in the debug logs
This commit is contained in:
parent
11b8d33666
commit
0df00d68b5
3 changed files with 54 additions and 0 deletions
|
@ -83,6 +83,7 @@ static struct
|
|||
jclass klass;
|
||||
jmethodID create_audio_format;
|
||||
jmethodID create_video_format;
|
||||
jmethodID to_string;
|
||||
jmethodID contains_key;
|
||||
jmethodID get_float;
|
||||
jmethodID set_float;
|
||||
|
@ -866,6 +867,44 @@ gst_amc_format_free (GstAmcFormat * format)
|
|||
g_slice_free (GstAmcFormat, format);
|
||||
}
|
||||
|
||||
gchar *
|
||||
gst_amc_format_to_string (GstAmcFormat * format)
|
||||
{
|
||||
JNIEnv *env;
|
||||
jstring v_str = NULL;
|
||||
const gchar *v = NULL;
|
||||
gchar *ret = NULL;
|
||||
|
||||
g_return_val_if_fail (format != NULL, FALSE);
|
||||
|
||||
env = gst_amc_get_jni_env ();
|
||||
|
||||
v_str =
|
||||
(*env)->CallObjectMethod (env, format->object, media_format.to_string);
|
||||
if ((*env)->ExceptionCheck (env)) {
|
||||
GST_ERROR ("Failed to call Java method");
|
||||
(*env)->ExceptionClear (env);
|
||||
goto done;
|
||||
}
|
||||
|
||||
v = (*env)->GetStringUTFChars (env, v_str, NULL);
|
||||
if (!v) {
|
||||
GST_ERROR ("Failed to convert string to UTF8");
|
||||
(*env)->ExceptionClear (env);
|
||||
goto done;
|
||||
}
|
||||
|
||||
ret = g_strdup (v);
|
||||
|
||||
done:
|
||||
if (v)
|
||||
(*env)->ReleaseStringUTFChars (env, v_str, v);
|
||||
if (v_str)
|
||||
(*env)->DeleteLocalRef (env, v_str);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gst_amc_format_contains_key (GstAmcFormat * format, const gchar * key)
|
||||
{
|
||||
|
@ -1375,6 +1414,9 @@ get_java_classes (void)
|
|||
media_format.create_video_format =
|
||||
(*env)->GetStaticMethodID (env, media_format.klass, "createVideoFormat",
|
||||
"(Ljava/lang/String;II)Landroid/media/MediaFormat;");
|
||||
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");
|
||||
|
|
|
@ -105,6 +105,8 @@ GstAmcFormat * gst_amc_format_new_audio (const gchar *mime, gint sample_rate, gi
|
|||
GstAmcFormat * gst_amc_format_new_video (const gchar *mime, gint width, gint height);
|
||||
void gst_amc_format_free (GstAmcFormat * format);
|
||||
|
||||
gchar * gst_amc_format_to_string (GstAmcFormat * format);
|
||||
|
||||
gboolean gst_amc_format_contains_key (GstAmcFormat *format, const gchar *key);
|
||||
|
||||
gboolean gst_amc_format_get_float (GstAmcFormat *format, const gchar *key, gfloat *value);
|
||||
|
|
|
@ -741,6 +741,7 @@ retry:
|
|||
}
|
||||
case INFO_OUTPUT_FORMAT_CHANGED:{
|
||||
GstAmcFormat *format;
|
||||
gchar *format_string;
|
||||
|
||||
GST_DEBUG_OBJECT (self, "Output format has changed");
|
||||
|
||||
|
@ -748,6 +749,10 @@ retry:
|
|||
if (!format)
|
||||
goto format_error;
|
||||
|
||||
format_string = gst_amc_format_to_string (format);
|
||||
GST_DEBUG_OBJECT (self, "Got new output format: %s", format_string);
|
||||
g_free (format_string);
|
||||
|
||||
if (!gst_amc_video_dec_set_src_caps (self, format)) {
|
||||
gst_amc_format_free (format);
|
||||
goto format_error;
|
||||
|
@ -1025,6 +1030,7 @@ gst_amc_video_dec_set_format (GstVideoDecoder * decoder,
|
|||
const gchar *mime;
|
||||
gboolean is_format_change = FALSE;
|
||||
gboolean needs_disable = FALSE;
|
||||
gchar *format_string;
|
||||
|
||||
self = GST_AMC_VIDEO_DEC (decoder);
|
||||
|
||||
|
@ -1078,6 +1084,10 @@ gst_amc_video_dec_set_format (GstVideoDecoder * decoder,
|
|||
if (self->codec_data)
|
||||
gst_amc_format_set_buffer (format, "csd-0", self->codec_data);
|
||||
|
||||
format_string = gst_amc_format_to_string (format);
|
||||
GST_DEBUG_OBJECT (self, "Configuring codec with format: %s", format_string);
|
||||
g_free (format_string);
|
||||
|
||||
/* FIXME: Flags? */
|
||||
if (!gst_amc_codec_configure (self->codec, format, 0)) {
|
||||
GST_ERROR_OBJECT (self, "Failed to configure codec");
|
||||
|
|
Loading…
Reference in a new issue