[vlc-commits] mediacodec: add mediacodec-tunneled-playback boolean option

Thomas Guillem git at videolan.org
Mon Dec 21 14:51:33 CET 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Nov 17 15:34:26 2015 +0100| [4d7d1f0313025d6db3e4d5119353a564c3ec8342] | committer: Thomas Guillem

mediacodec: add mediacodec-tunneled-playback boolean option

Can be used if the surface given to mediacodec has a punch hole. Configuring a
punch hole depends of the hardware, therefore, this option is only for
developers that use libvlc with a known hardware.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4d7d1f0313025d6db3e4d5119353a564c3ec8342
---

 modules/codec/omxil/mediacodec.c     |    6 ++++++
 modules/codec/omxil/mediacodec.h     |    1 +
 modules/codec/omxil/mediacodec_jni.c |    5 +++++
 modules/codec/omxil/mediacodec_ndk.c |    6 ++++++
 4 files changed, 18 insertions(+)

diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index c63e7ff..bafc2a9 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -179,6 +179,8 @@ static void RemoveInflightPictures(decoder_t *);
 #define MEDIACODEC_AUDIO_TEXT "Use MediaCodec for audio decoding"
 #define MEDIACODEC_AUDIO_LONGTEXT "Still experimental."
 
+#define MEDIACODEC_TUNNELEDPLAYBACK_TEXT "Use a tunneled surface for playback"
+
 #define CFG_PREFIX "mediacodec-"
 
 vlc_module_begin ()
@@ -191,6 +193,8 @@ vlc_module_begin ()
              DIRECTRENDERING_TEXT, DIRECTRENDERING_LONGTEXT, true)
     add_bool(CFG_PREFIX "audio", false,
              MEDIACODEC_AUDIO_TEXT, MEDIACODEC_AUDIO_LONGTEXT, true)
+    add_bool(CFG_PREFIX "tunneled-playback", false,
+             MEDIACODEC_TUNNELEDPLAYBACK_TEXT, NULL, true)
     set_callbacks( OpenDecoderNdk, CloseDecoder )
     add_shortcut( "mediacodec_ndk" )
     add_submodule ()
@@ -469,6 +473,8 @@ static int StartMediaCodec(decoder_t *p_dec)
             }
         }
         args.video.p_awh = p_sys->u.video.p_awh;
+        args.video.b_tunneled_playback = args.video.p_awh ?
+                var_InheritBool(p_dec, CFG_PREFIX "tunneled-playback") : false;
     }
     else
     {
diff --git a/modules/codec/omxil/mediacodec.h b/modules/codec/omxil/mediacodec.h
index 0a2acd5..1f16186 100644
--- a/modules/codec/omxil/mediacodec.h
+++ b/modules/codec/omxil/mediacodec.h
@@ -86,6 +86,7 @@ union mc_api_args
         int i_width;
         int i_height;
         int i_angle;
+        bool b_tunneled_playback;
     } video;
     struct
     {
diff --git a/modules/codec/omxil/mediacodec_jni.c b/modules/codec/omxil/mediacodec_jni.c
index 85e7190..12549ef 100644
--- a/modules/codec/omxil/mediacodec_jni.c
+++ b/modules/codec/omxil/mediacodec_jni.c
@@ -545,6 +545,11 @@ static int Start(mc_api *api, union mc_api_args *p_args)
 
         if (b_direct_rendering && p_args->video.i_angle != 0)
             SET_INTEGER(jformat, "rotation-degrees", p_args->video.i_angle);
+
+        /* feature-tunneled-playback available since API 21 */
+        if (b_direct_rendering && jfields.get_input_buffer)
+            SET_INTEGER(jformat, "feature-tunneled-playback",
+                        p_args->video.b_tunneled_playback);
     }
     else
     {
diff --git a/modules/codec/omxil/mediacodec_ndk.c b/modules/codec/omxil/mediacodec_ndk.c
index 310160e..06342b8 100644
--- a/modules/codec/omxil/mediacodec_ndk.c
+++ b/modules/codec/omxil/mediacodec_ndk.c
@@ -328,8 +328,14 @@ static int Start(mc_api *api, union mc_api_args *p_args)
         syms.AMediaFormat.setInt32(p_sys->p_format, "height", p_args->video.i_height);
         syms.AMediaFormat.setInt32(p_sys->p_format, "rotation-degrees", p_args->video.i_angle);
         if (p_args->video.p_awh)
+        {
             p_anw = AWindowHandler_getANativeWindow(p_args->video.p_awh,
                                                     AWindow_Video);
+            if( p_anw )
+                syms.AMediaFormat.setInt32(p_sys->p_format,
+                                           "feature-tunneled-playback",
+                                           p_args->video.b_tunneled_playback);
+        }
     }
     else
     {



More information about the vlc-commits mailing list