[vlc-commits] avcodec: remove redundant codec name parameter

Rémi Denis-Courmont git at videolan.org
Thu Sep 11 22:38:35 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Sep 11 23:23:38 2014 +0300| [757a94aaefecc82e553a5f7d681eea8100e060af] | committer: Rémi Denis-Courmont

avcodec: remove redundant codec name parameter

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

 modules/codec/avcodec/audio.c    |    5 ++---
 modules/codec/avcodec/avcodec.c  |   15 ++++++---------
 modules/codec/avcodec/avcodec.h  |    7 +++----
 modules/codec/avcodec/subtitle.c |    7 +++----
 modules/codec/avcodec/video.c    |    5 ++---
 5 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index f9c430e..f68e7f5 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -127,7 +127,7 @@ static int OpenAudioCodec( decoder_t *p_dec )
               !p_dec->fmt_in.b_packetized ) )
         {
             msg_Warn( p_dec, "waiting for extra data for codec %s",
-                      p_sys->psz_namecodec );
+                      p_sys->p_codec->name );
             return 1;
         }
     }
@@ -236,7 +236,7 @@ static int GetAudioBuf( AVCodecContext *ctx, AVFrame *buf )
  * The avcodec codec will be opened, some memory allocated.
  *****************************************************************************/
 int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
-                  const AVCodec *p_codec, int i_codec_id, const char *psz_namecodec )
+                  const AVCodec *p_codec, int i_codec_id )
 {
     decoder_sys_t *p_sys;
 
@@ -256,7 +256,6 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
     p_sys->p_context = p_context;
     p_sys->p_codec = p_codec;
     p_sys->i_codec_id = i_codec_id;
-    p_sys->psz_namecodec = psz_namecodec;
     p_sys->b_delayed_open = true;
 
     // Initialize decoder extradata
diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index eb13d9c..40489df 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -298,16 +298,13 @@ static int OpenDecoder( vlc_object_t *p_this )
     switch( i_cat )
     {
     case VIDEO_ES:
-        i_result =  InitVideoDec( p_dec, p_context, p_codec,
-                                  i_codec_id, psz_namecodec );
+        i_result =  InitVideoDec( p_dec, p_context, p_codec, i_codec_id );
         break;
     case AUDIO_ES:
-        i_result =  InitAudioDec( p_dec, p_context, p_codec,
-                                  i_codec_id, psz_namecodec );
+        i_result =  InitAudioDec( p_dec, p_context, p_codec, i_codec_id );
         break;
     case SPU_ES:
-        i_result =  InitSubtitleDec( p_dec, p_context, p_codec,
-                                     i_codec_id, psz_namecodec );
+        i_result =  InitSubtitleDec( p_dec, p_context, p_codec, i_codec_id );
         break;
     default:
         return VLC_EGENERIC;
@@ -350,7 +347,7 @@ static void CloseDecoder( vlc_object_t *p_this )
             avcodec_close( p_sys->p_context );
             vlc_avcodec_unlock();
         }
-        msg_Dbg( p_dec, "ffmpeg codec (%s) stopped", p_sys->psz_namecodec );
+        msg_Dbg( p_dec, "ffmpeg codec (%s) stopped", p_sys->p_codec->name );
         av_free( p_sys->p_context );
     }
 
@@ -383,11 +380,11 @@ int ffmpeg_OpenCodec( decoder_t *p_dec )
 
     if( ret < 0 )
     {
-        msg_Err( p_dec, "cannot start codec (%s)", p_sys->psz_namecodec );
+        msg_Err( p_dec, "cannot start codec (%s)", p_sys->p_codec->name );
         return VLC_EGENERIC;
     }
 
-    msg_Dbg( p_dec, "codec (%s) started", p_sys->psz_namecodec );
+    msg_Dbg( p_dec, "codec (%s) started", p_sys->p_codec->name );
     p_sys->b_delayed_open = false;
     return VLC_SUCCESS;
 }
diff --git a/modules/codec/avcodec/avcodec.h b/modules/codec/avcodec/avcodec.h
index b5e80bd..3b8ec20 100644
--- a/modules/codec/avcodec/avcodec.h
+++ b/modules/codec/avcodec/avcodec.h
@@ -45,16 +45,16 @@ void CloseDeinterlace( vlc_object_t * );
 
 /* Video Decoder */
 int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
-                  const AVCodec *p_codec, int i_codec_id, const char *psz_namecodec );
+                  const AVCodec *p_codec, int i_codec_id );
 void EndVideoDec( decoder_t *p_dec );
 
 /* Audio Decoder */
 int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
-                  const AVCodec *p_codec, int i_codec_id, const char *psz_namecodec );
+                  const AVCodec *p_codec, int i_codec_id );
 
 /* Subtitle Decoder */
 int InitSubtitleDec( decoder_t *p_dec, AVCodecContext *p_context,
-                     const AVCodec *p_codec, int i_codec_id, const char *psz_namecodec );
+                     const AVCodec *p_codec, int i_codec_id );
 
 /* Initialize decoder */
 int ffmpeg_OpenCodec( decoder_t *p_dec );
@@ -244,7 +244,6 @@ int ffmpeg_OpenCodec( decoder_t *p_dec );
 
 #define AVCODEC_COMMON_MEMBERS   \
     int i_codec_id;             \
-    const char *psz_namecodec;  \
     AVCodecContext *p_context;  \
     const AVCodec  *p_codec;    \
     bool b_delayed_open;
diff --git a/modules/codec/avcodec/subtitle.c b/modules/codec/avcodec/subtitle.c
index e69b4ee..d2d4ba1 100644
--- a/modules/codec/avcodec/subtitle.c
+++ b/modules/codec/avcodec/subtitle.c
@@ -50,7 +50,7 @@ static subpicture_t *DecodeSubtitle(decoder_t *, block_t **);
  * Initialize subtitle decoder
  */
 int InitSubtitleDec(decoder_t *dec, AVCodecContext *context,
-                    const AVCodec *codec, int codec_id, const char *namecodec)
+                    const AVCodec *codec, int codec_id)
 {
     decoder_sys_t *sys;
 
@@ -75,7 +75,6 @@ int InitSubtitleDec(decoder_t *dec, AVCodecContext *context,
     sys->p_context = context;
     sys->p_codec = codec;
     sys->i_codec_id = codec_id;
-    sys->psz_namecodec = namecodec;
     sys->b_delayed_open = false;
 
     /* */
@@ -101,14 +100,14 @@ int InitSubtitleDec(decoder_t *dec, AVCodecContext *context,
     av_dict_free(&options);
 
     if (ret < 0) {
-        msg_Err(dec, "cannot open codec (%s)", namecodec);
+        msg_Err(dec, "cannot open codec (%s)", codec->name);
         free(context->extradata);
         free(sys);
         return VLC_EGENERIC;
     }
 
     /* */
-    msg_Dbg(dec, "libavcodec codec (%s) started", namecodec);
+    msg_Dbg(dec, "libavcodec codec (%s) started", codec->name);
     dec->fmt_out.i_cat = SPU_ES;
     dec->pf_decode_sub = DecodeSubtitle;
 
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 329b169..2f12c96 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -206,7 +206,7 @@ static int OpenVideoCodec( decoder_t *p_dec )
             p_sys->i_codec_id == AV_CODEC_ID_THEORA )
         {
             msg_Warn( p_dec, "waiting for extra data for codec %s",
-                      p_sys->psz_namecodec );
+                      p_sys->p_codec->name );
             return 1;
         }
     }
@@ -258,7 +258,7 @@ static int OpenVideoCodec( decoder_t *p_dec )
  * opened (done after the first decoded frame).
  *****************************************************************************/
 int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
-                  const AVCodec *p_codec, int i_codec_id, const char *psz_namecodec )
+                  const AVCodec *p_codec, int i_codec_id )
 {
     decoder_sys_t *p_sys;
     int i_val;
@@ -272,7 +272,6 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
     p_sys->p_context = p_context;
     p_sys->p_codec = p_codec;
     p_sys->i_codec_id = i_codec_id;
-    p_sys->psz_namecodec = psz_namecodec;
     p_sys->p_ff_pic = avcodec_alloc_frame();
     p_sys->b_delayed_open = true;
     p_sys->p_va = NULL;



More information about the vlc-commits mailing list