[vlc-commits] avcodec: make decoder callbacks static

Rémi Denis-Courmont git at videolan.org
Thu Sep 11 21:19:16 CEST 2014


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Sep 11 22:08:46 2014 +0300| [c9a16c71a390528a57a5487064f2b50da81a3d54] | committer: Rémi Denis-Courmont

avcodec: make decoder callbacks static

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

 modules/codec/avcodec/audio.c    |    4 +++-
 modules/codec/avcodec/avcodec.c  |   13 +++++--------
 modules/codec/avcodec/avcodec.h  |    4 ----
 modules/codec/avcodec/subtitle.c |    4 +++-
 modules/codec/avcodec/video.c    |    4 +++-
 5 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index 75957ac..f9895ed 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -69,6 +69,7 @@ struct decoder_sys_t
 #define BLOCK_FLAG_PRIVATE_REALLOCATED (1 << BLOCK_FLAG_PRIVATE_SHIFT)
 
 static void SetupOutputFormat( decoder_t *p_dec, bool b_trust );
+static block_t *DecodeAudio( decoder_t *, block_t ** );
 
 static void InitDecoderConfig( decoder_t *p_dec, AVCodecContext *p_context )
 {
@@ -286,13 +287,14 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
     else if( p_dec->fmt_in.audio.i_rate )
         date_Init( &p_sys->end_date, p_dec->fmt_in.audio.i_rate, 1 );
 
+    p_dec->pf_decode_audio = DecodeAudio;
     return VLC_SUCCESS;
 }
 
 /*****************************************************************************
  * DecodeAudio: Called to decode one frame
  *****************************************************************************/
-block_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
+static block_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
     AVCodecContext *ctx = p_sys->p_context;
diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index bc5ece0..33a1b2f 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -299,22 +299,19 @@ static int OpenDecoder( vlc_object_t *p_this )
     switch( i_cat )
     {
     case VIDEO_ES:
-        p_dec->pf_decode_video = DecodeVideo;
-        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, psz_namecodec );
         break;
     case AUDIO_ES:
-        p_dec->pf_decode_audio = DecodeAudio;
-        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, psz_namecodec );
         break;
     case SPU_ES:
-        p_dec->pf_decode_sub = DecodeSubtitle;
         i_result =  InitSubtitleDec( p_dec, p_context, p_codec,
                                      i_codec_id, psz_namecodec );
         break;
     default:
-        i_result = VLC_EGENERIC;
+        return VLC_EGENERIC;
     }
 
     if( i_result == VLC_SUCCESS )
diff --git a/modules/codec/avcodec/avcodec.h b/modules/codec/avcodec/avcodec.h
index 7551ab5..6156849 100644
--- a/modules/codec/avcodec/avcodec.h
+++ b/modules/codec/avcodec/avcodec.h
@@ -31,10 +31,6 @@ int GetVlcFourcc( unsigned i_ffmpeg_codec, int *pi_cat,
                   vlc_fourcc_t *pi_fourcc, const char **ppsz_name );
 vlc_fourcc_t GetVlcAudioFormat( int i_sample_fmt );
 
-picture_t * DecodeVideo( decoder_t *, block_t ** );
-block_t * DecodeAudio( decoder_t *, block_t ** );
-subpicture_t *DecodeSubtitle( decoder_t *p_dec, block_t ** );
-
 /* Video encoder module */
 int  OpenEncoder ( vlc_object_t * );
 void CloseEncoder( vlc_object_t * );
diff --git a/modules/codec/avcodec/subtitle.c b/modules/codec/avcodec/subtitle.c
index a8bb19f..4389947 100644
--- a/modules/codec/avcodec/subtitle.c
+++ b/modules/codec/avcodec/subtitle.c
@@ -44,6 +44,7 @@ struct decoder_sys_t {
 
 static subpicture_t *ConvertSubtitle(decoder_t *, AVSubtitle *, mtime_t pts,
                                      AVCodecContext *avctx);
+static subpicture_t *DecodeSubtitle(decoder_t *, block_t **);
 
 /**
  * Initialize subtitle decoder
@@ -110,6 +111,7 @@ int InitSubtitleDec(decoder_t *dec, AVCodecContext *context,
     /* */
     msg_Dbg(dec, "libavcodec codec (%s) started", namecodec);
     dec->fmt_out.i_cat = SPU_ES;
+    dec->pf_decode_sub = DecodeSubtitle;
 
     return VLC_SUCCESS;
 }
@@ -117,7 +119,7 @@ int InitSubtitleDec(decoder_t *dec, AVCodecContext *context,
 /**
  * Decode one subtitle
  */
-subpicture_t *DecodeSubtitle(decoder_t *dec, block_t **block_ptr)
+static subpicture_t *DecodeSubtitle(decoder_t *dec, block_t **block_ptr)
 {
     decoder_sys_t *sys = dec->p_sys;
 
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 33319fe..17dfe79 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -106,6 +106,7 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *, AVFrame * );
 #endif
 static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *,
                                           const enum PixelFormat * );
+static picture_t *DecodeVideo( decoder_t *, block_t ** );
 
 static uint32_t ffmpeg_CodecTag( vlc_fourcc_t fcc )
 {
@@ -459,13 +460,14 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
         return VLC_EGENERIC;
     }
 
+    p_dec->pf_decode_video = DecodeVideo;
     return VLC_SUCCESS;
 }
 
 /*****************************************************************************
  * DecodeVideo: Called to decode one or more frames
  *****************************************************************************/
-picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
+static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
     AVCodecContext *p_context = p_sys->p_context;



More information about the vlc-commits mailing list