[vlc-commits] mediacodec: add MC_API_VIDEO_QUIRKS_IGNORE_SIZE
Thomas Guillem
git at videolan.org
Wed Oct 30 08:15:53 CET 2019
vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Oct 29 11:01:48 2019 +0100| [f68e9f7b960e32b10af09191697bea2da39213b5] | 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.
(cherry picked from commit 669505d1844188a54f2c63acaf94d58cafb9cbbf)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=f68e9f7b960e32b10af09191697bea2da39213b5
---
modules/codec/omxil/mediacodec.c | 19 +++++++++++++++----
modules/codec/omxil/mediacodec.h | 1 +
modules/codec/omxil/mediacodec_jni.c | 12 +++++++++++-
3 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index 1c8c8e5ca3..fb0e74d92e 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -1010,10 +1010,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 628a3a022d..f786d3a136 100644
--- a/modules/codec/omxil/mediacodec.h
+++ b/modules/codec/omxil/mediacodec.h
@@ -47,6 +47,7 @@ int MediaCodecNdk_Init(mc_api*);
/* MediaCodec only QUIRKS */
#define MC_API_VIDEO_QUIRKS_ADAPTIVE 0x1000
+#define MC_API_VIDEO_QUIRKS_IGNORE_SIZE 0x2000
struct mc_api_out
{
diff --git a/modules/codec/omxil/mediacodec_jni.c b/modules/codec/omxil/mediacodec_jni.c
index e8f6b09bd5..8ef9ff3ace 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;
}
}
More information about the vlc-commits
mailing list