[vlc-commits] mediacodec: also set quirks from MediaCodec_GetName()

Thomas Guillem git at videolan.org
Tue Oct 29 11:23:51 CET 2019


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Oct 29 11:00:23 2019 +0100| [556d28188bc91bc7f7f46ecb2885048129bd3c4c] | committer: Thomas Guillem

mediacodec: also set quirks from MediaCodec_GetName()

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

 modules/codec/omxil/mediacodec_jni.c | 19 ++++++++++---------
 modules/codec/omxil/mediacodec_ndk.c | 13 ++++++-------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/modules/codec/omxil/mediacodec_jni.c b/modules/codec/omxil/mediacodec_jni.c
index 3a3a71c745..671e9ce975 100644
--- a/modules/codec/omxil/mediacodec_jni.c
+++ b/modules/codec/omxil/mediacodec_jni.c
@@ -39,7 +39,7 @@
 #include "mediacodec.h"
 
 char* MediaCodec_GetName(vlc_object_t *p_obj, const char *psz_mime,
-                         int profile, bool *p_adaptive);
+                         int profile, int *p_quirks);
 
 #define THREAD_NAME "mediacodec_jni"
 
@@ -318,7 +318,7 @@ struct mc_api_sys
  * MediaCodec_GetName
  *****************************************************************************/
 char* MediaCodec_GetName(vlc_object_t *p_obj, const char *psz_mime,
-                         int profile, bool *p_adaptive)
+                         int profile, int *p_quirks)
 {
     JNIEnv *env;
     int num_codecs;
@@ -453,8 +453,10 @@ 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)
+                    *p_quirks |= MC_API_VIDEO_QUIRKS_ADAPTIVE;
             }
-            *p_adaptive = b_adaptive;
         }
 loopclean:
         if (name)
@@ -1009,19 +1011,18 @@ static void Clean(mc_api *api)
 static int Prepare(mc_api *api, int i_profile)
 {
     free(api->psz_name);
-    bool b_adaptive;
+
+    api->i_quirks = 0;
     api->psz_name = MediaCodec_GetName(api->p_obj, api->psz_mime,
-                                       i_profile, &b_adaptive);
+                                       i_profile, &api->i_quirks);
     if (!api->psz_name)
         return MC_API_ERROR;
-    api->i_quirks = OMXCodec_GetQuirks(api->i_cat, api->i_codec, api->psz_name,
-                                       strlen(api->psz_name));
+    api->i_quirks |= OMXCodec_GetQuirks(api->i_cat, api->i_codec, api->psz_name,
+                                        strlen(api->psz_name));
 
     /* Allow interlaced picture after API 21 */
     if (jfields.get_input_buffer && jfields.get_output_buffer)
         api->i_quirks |= MC_API_VIDEO_QUIRKS_SUPPORT_INTERLACED;
-    if (b_adaptive)
-        api->i_quirks |= MC_API_VIDEO_QUIRKS_ADAPTIVE;
     return 0;
 }
 
diff --git a/modules/codec/omxil/mediacodec_ndk.c b/modules/codec/omxil/mediacodec_ndk.c
index a72bf165cb..d9a1641208 100644
--- a/modules/codec/omxil/mediacodec_ndk.c
+++ b/modules/codec/omxil/mediacodec_ndk.c
@@ -39,7 +39,7 @@
 #include "mediacodec.h"
 
 char* MediaCodec_GetName(vlc_object_t *p_obj, const char *psz_mime,
-                         int hxxx_profile, bool *p_adaptive);
+                         int hxxx_profile, int *p_quirks);
 
 #define THREAD_NAME "mediacodec_ndk"
 
@@ -625,17 +625,16 @@ static void Clean(mc_api *api)
 static int Prepare(mc_api * api, int i_profile)
 {
     free(api->psz_name);
-    bool b_adaptive;
+
+    api->i_quirks = 0;
     api->psz_name = MediaCodec_GetName(api->p_obj, api->psz_mime,
-                                       i_profile, &b_adaptive);
+                                       i_profile, &api->i_quirks);
     if (!api->psz_name)
         return MC_API_ERROR;
-    api->i_quirks = OMXCodec_GetQuirks(api->i_cat, api->i_codec, api->psz_name,
-                                       strlen(api->psz_name));
+    api->i_quirks |= OMXCodec_GetQuirks(api->i_cat, api->i_codec, api->psz_name,
+                                        strlen(api->psz_name));
     /* Allow interlaced picture after API 21 */
     api->i_quirks |= MC_API_VIDEO_QUIRKS_SUPPORT_INTERLACED;
-    if (b_adaptive)
-        api->i_quirks |= MC_API_VIDEO_QUIRKS_ADAPTIVE;
     return 0;
 }
 



More information about the vlc-commits mailing list