vlc | branch: master | Thomas Guillem <[email protected]> | Tue Oct 29 11:01:48 2019 +0100| [669505d1844188a54f2c63acaf94d58cafb9cbbf] | committer: Thomas Guillem
mediacodec: add MC_API_VIDEO_QUIRKS_IGNORE_SIZE Some implementations return the surface output size instead of the input video size. In that case, use the size parsed by the hxxx_helper. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=669505d1844188a54f2c63acaf94d58cafb9cbbf --- modules/codec/omxil/mediacodec.c | 19 +++++++++++++++---- modules/codec/omxil/mediacodec.h | 3 ++- modules/codec/omxil/mediacodec_jni.c | 12 +++++++++++- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c index 68912a8f2d..0254c9c230 100644 --- a/modules/codec/omxil/mediacodec.c +++ b/modules/codec/omxil/mediacodec.c @@ -1024,10 +1024,21 @@ static int Video_ProcessOutput(decoder_t *p_dec, mc_api_out *p_out, i_height = p_out->conf.video.height; } - p_dec->fmt_out.video.i_visible_width = - p_dec->fmt_out.video.i_width = i_width; - p_dec->fmt_out.video.i_visible_height = - p_dec->fmt_out.video.i_height = i_height; + if (!(p_sys->api.i_quirks & MC_API_VIDEO_QUIRKS_IGNORE_SIZE)) + { + p_dec->fmt_out.video.i_visible_width = + p_dec->fmt_out.video.i_width = i_width; + p_dec->fmt_out.video.i_visible_height = + p_dec->fmt_out.video.i_height = i_height; + } + else + { + p_dec->fmt_out.video.i_visible_width = + p_dec->fmt_out.video.i_width = p_sys->video.i_input_width; + p_dec->fmt_out.video.i_visible_height = + p_dec->fmt_out.video.i_height = p_sys->video.i_input_height; + msg_Dbg(p_dec, "video size ignored from MediaCodec"); + } p_sys->video.i_stride = p_out->conf.video.stride; p_sys->video.i_slice_height = p_out->conf.video.slice_height; diff --git a/modules/codec/omxil/mediacodec.h b/modules/codec/omxil/mediacodec.h index bcc7d665d4..2147f9f8ef 100644 --- a/modules/codec/omxil/mediacodec.h +++ b/modules/codec/omxil/mediacodec.h @@ -43,7 +43,8 @@ int MediaCodecNdk_Init(mc_api*); #define MC_API_QUIRKS_NEED_CSD 0x1 #define MC_API_VIDEO_QUIRKS_IGNORE_PADDING 0x2 #define MC_API_VIDEO_QUIRKS_SUPPORT_INTERLACED 0x4 -#define MC_API_AUDIO_QUIRKS_NEED_CHANNELS 0x8 +#define MC_API_VIDEO_QUIRKS_IGNORE_SIZE 0x8 +#define MC_API_AUDIO_QUIRKS_NEED_CHANNELS 0x10 /* MediaCodec only QUIRKS */ #define MC_API_VIDEO_QUIRKS_ADAPTIVE 0x1000 diff --git a/modules/codec/omxil/mediacodec_jni.c b/modules/codec/omxil/mediacodec_jni.c index 671e9ce975..ba2e92f21e 100644 --- a/modules/codec/omxil/mediacodec_jni.c +++ b/modules/codec/omxil/mediacodec_jni.c @@ -454,7 +454,17 @@ char* MediaCodec_GetName(vlc_object_t *p_obj, const char *psz_mime, memcpy(psz_name, name_ptr, name_len); psz_name[name_len] = '\0'; - if (b_adaptive) + bool ignore_size = false; + + if (ignore_size) + { + *p_quirks |= MC_API_VIDEO_QUIRKS_IGNORE_SIZE; + /* If the MediaCodec size is ignored, the adaptive mode + * should be disabled in order to trigger the hxxx_helper + * parsers that will parse the correct video size. Hence + * the following 'else if' */ + } + else if (b_adaptive) *p_quirks |= MC_API_VIDEO_QUIRKS_ADAPTIVE; } } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
