[vlc-commits] mediacodec: psz_name and psz_name are now visible by sub modules

Thomas Guillem git at videolan.org
Thu Nov 12 10:54:06 CET 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Nov  6 16:40:15 2015 +0100| [089169471c7b5a5332813bae44865b68354044a9] | committer: Thomas Guillem

mediacodec: psz_name and psz_name are now visible by sub modules

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

 modules/codec/omxil/mediacodec.c     |   47 +++++++++++++++++-----------------
 modules/codec/omxil/mediacodec.h     |    6 +++--
 modules/codec/omxil/mediacodec_jni.c |    7 +++--
 modules/codec/omxil/mediacodec_ndk.c |   10 ++++----
 4 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index b1fe5db..4507b65 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -82,9 +82,6 @@ typedef int (*dec_process_output_cb)(decoder_t *, mc_api_out *, picture_t **, bl
 struct decoder_sys_t
 {
     mc_api *api;
-    char *psz_name;
-
-    const char *mime;
 
     /* Codec Specific Data buffer: sent in PutInput after a start or a flush
      * with the BUFFER_FLAG_CODEC_CONFIG flag.*/
@@ -401,11 +398,11 @@ static int StartMediaCodec(decoder_t *p_dec)
                                    &p_sys->u.video.i_h264_profile, NULL, NULL);
             if (p_sys->u.video.i_h264_profile)
             {
-                free(p_sys->psz_name);
-                p_sys->psz_name = MediaCodec_GetName(VLC_OBJECT(p_dec),
-                                                     p_sys->mime,
-                                                     p_sys->u.video.i_h264_profile);
-                if (!p_sys->psz_name)
+                free(p_sys->api->psz_name);
+                p_sys->api->psz_name = MediaCodec_GetName(VLC_OBJECT(p_dec),
+                                                          p_sys->api->psz_mime,
+                                                          p_sys->u.video.i_h264_profile);
+                if (!p_sys->api->psz_name)
                     return VLC_EGENERIC;
             }
         }
@@ -442,7 +439,7 @@ static int StartMediaCodec(decoder_t *p_dec)
         args.audio.i_channel_count  = p_dec->p_sys->u.audio.i_channels;
     }
 
-    return p_sys->api->start(p_sys->api, p_sys->psz_name, p_sys->mime, &args);
+    return p_sys->api->start(p_sys->api, &args);
 }
 
 /*****************************************************************************
@@ -560,8 +557,8 @@ static int OpenDecoder(vlc_object_t *p_this, pf_MediaCodecApi_init pf_init)
     p_dec->fmt_out.i_cat = p_dec->fmt_in.i_cat;
     p_dec->fmt_out.video = p_dec->fmt_in.video;
     p_dec->fmt_out.audio = p_dec->fmt_in.audio;
-    p_sys->mime = mime;
     p_sys->b_new_block = true;
+    p_sys->api->psz_mime = mime;
 
     if (p_dec->fmt_in.i_cat == VIDEO_ES)
     {
@@ -581,15 +578,16 @@ static int OpenDecoder(vlc_object_t *p_this, pf_MediaCodecApi_init pf_init)
             h264_get_profile_level(&p_dec->fmt_in,
                                    &p_sys->u.video.i_h264_profile, NULL, NULL);
 
-        p_sys->psz_name = MediaCodec_GetName(VLC_OBJECT(p_dec), p_sys->mime,
-                                              p_sys->u.video.i_h264_profile);
-        if (!p_sys->psz_name)
+        p_sys->api->psz_name = MediaCodec_GetName(VLC_OBJECT(p_dec),
+                                                  p_sys->api->psz_mime,
+                                                  p_sys->u.video.i_h264_profile);
+        if (!p_sys->api->psz_name)
             goto bailout;
 
-        p_sys->i_quirks = OMXCodec_GetQuirks( VIDEO_ES,
-                                              p_dec->fmt_in.i_codec,
-                                              p_sys->psz_name,
-                                              strlen(p_sys->psz_name) );
+        p_sys->i_quirks = OMXCodec_GetQuirks(VIDEO_ES,
+                                             p_dec->fmt_in.i_codec,
+                                             p_sys->api->psz_name,
+                                             strlen(p_sys->api->psz_name));
 
         if ((p_sys->i_quirks & OMXCODEC_VIDEO_QUIRKS_NEED_SIZE)
          && (!p_sys->u.video.i_width || !p_sys->u.video.i_height))
@@ -606,14 +604,15 @@ static int OpenDecoder(vlc_object_t *p_this, pf_MediaCodecApi_init pf_init)
         p_sys->pf_process_output = Audio_ProcessOutput;
         p_sys->u.audio.i_channels = p_dec->fmt_in.audio.i_channels;
 
-        p_sys->psz_name = MediaCodec_GetName(VLC_OBJECT(p_dec), p_sys->mime, 0);
-        if (!p_sys->psz_name)
+        p_sys->api->psz_name = MediaCodec_GetName(VLC_OBJECT(p_dec),
+                                                  p_sys->api->psz_mime, 0);
+        if (!p_sys->api->psz_name)
             goto bailout;
 
-        p_sys->i_quirks = OMXCodec_GetQuirks( AUDIO_ES,
-                                              p_dec->fmt_in.i_codec,
-                                              p_sys->psz_name,
-                                              strlen(p_sys->psz_name) );
+        p_sys->i_quirks = OMXCodec_GetQuirks(AUDIO_ES,
+                                             p_dec->fmt_in.i_codec,
+                                             p_sys->api->psz_name,
+                                             strlen(p_sys->api->psz_name));
         if ((p_sys->i_quirks & OMXCODEC_AUDIO_QUIRKS_NEED_CHANNELS)
          && !p_sys->u.audio.i_channels)
         {
@@ -678,8 +677,8 @@ static void CloseDecoder(vlc_object_t *p_this)
         if (p_sys->u.video.p_awh)
             AWindowHandler_destroy(p_sys->u.video.p_awh);
     }
+    free(p_sys->api->psz_name);
     free(p_sys->api);
-    free(p_sys->psz_name);
     free(p_sys);
 }
 
diff --git a/modules/codec/omxil/mediacodec.h b/modules/codec/omxil/mediacodec.h
index 4221a9c..0a2acd5 100644
--- a/modules/codec/omxil/mediacodec.h
+++ b/modules/codec/omxil/mediacodec.h
@@ -100,14 +100,16 @@ struct mc_api
 
     mc_api_sys *p_sys;
 
+    char *psz_name;
+    const char *psz_mime;
+
     bool b_started;
     bool b_video;
     bool b_direct_rendering;
     bool b_support_interlaced;
 
     void (*clean)(mc_api *);
-    int (*start)(mc_api *, const char *psz_name, const char *psz_mime,
-                 union mc_api_args *p_args);
+    int (*start)(mc_api *, union mc_api_args *p_args);
     int (*stop)(mc_api *);
     int (*flush)(mc_api *);
 
diff --git a/modules/codec/omxil/mediacodec_jni.c b/modules/codec/omxil/mediacodec_jni.c
index b30cbb1..e245b3a 100644
--- a/modules/codec/omxil/mediacodec_jni.c
+++ b/modules/codec/omxil/mediacodec_jni.c
@@ -467,8 +467,7 @@ static int Stop(mc_api *api)
 /*****************************************************************************
  * Start
  *****************************************************************************/
-static int Start(mc_api *api, const char *psz_name, const char *psz_mime,
-                 union mc_api_args *p_args)
+static int Start(mc_api *api, union mc_api_args *p_args)
 {
     mc_api_sys *p_sys = api->p_sys;
     JNIEnv* env = NULL;
@@ -487,8 +486,8 @@ static int Start(mc_api *api, const char *psz_name, const char *psz_mime,
 
     GET_ENV();
 
-    jmime = (*env)->NewStringUTF(env, psz_mime);
-    jcodec_name = (*env)->NewStringUTF(env, psz_name);
+    jmime = (*env)->NewStringUTF(env, api->psz_mime);
+    jcodec_name = (*env)->NewStringUTF(env, api->psz_name);
     if (!jmime || !jcodec_name)
         goto error;
 
diff --git a/modules/codec/omxil/mediacodec_ndk.c b/modules/codec/omxil/mediacodec_ndk.c
index dff2f2e..310160e 100644
--- a/modules/codec/omxil/mediacodec_ndk.c
+++ b/modules/codec/omxil/mediacodec_ndk.c
@@ -297,17 +297,17 @@ static int Stop(mc_api *api)
 /*****************************************************************************
  * Start
  *****************************************************************************/
-static int Start(mc_api *api, const char *psz_name, const char *psz_mime,
-                 union mc_api_args *p_args)
+static int Start(mc_api *api, union mc_api_args *p_args)
 {
     mc_api_sys *p_sys = api->p_sys;
     int i_ret = MC_API_ERROR;
     ANativeWindow *p_anw = NULL;
 
-    p_sys->p_codec = syms.AMediaCodec.createCodecByName(psz_name);
+    p_sys->p_codec = syms.AMediaCodec.createCodecByName(api->psz_name);
     if (!p_sys->p_codec)
     {
-        msg_Err(api->p_obj, "AMediaCodec.createCodecByName for %s failed", psz_name);
+        msg_Err(api->p_obj, "AMediaCodec.createCodecByName for %s failed",
+                api->psz_name);
         goto error;
     }
 
@@ -319,7 +319,7 @@ static int Start(mc_api *api, const char *psz_name, const char *psz_mime,
     }
 
     syms.AMediaFormat.setInt32(p_sys->p_format, "encoder", 0);
-    syms.AMediaFormat.setString(p_sys->p_format, "mime", psz_mime);
+    syms.AMediaFormat.setString(p_sys->p_format, "mime", api->psz_mime);
     /* No limits for input size */
     syms.AMediaFormat.setInt32(p_sys->p_format, "max-input-size", 0);
     if (api->b_video)



More information about the vlc-commits mailing list