Commit c9a16c71 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

avcodec: make decoder callbacks static

parent c779bd78
...@@ -69,6 +69,7 @@ struct decoder_sys_t ...@@ -69,6 +69,7 @@ struct decoder_sys_t
#define BLOCK_FLAG_PRIVATE_REALLOCATED (1 << BLOCK_FLAG_PRIVATE_SHIFT) #define BLOCK_FLAG_PRIVATE_REALLOCATED (1 << BLOCK_FLAG_PRIVATE_SHIFT)
static void SetupOutputFormat( decoder_t *p_dec, bool b_trust ); 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 ) static void InitDecoderConfig( decoder_t *p_dec, AVCodecContext *p_context )
{ {
...@@ -286,13 +287,14 @@ int InitAudioDec( 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 ) else if( p_dec->fmt_in.audio.i_rate )
date_Init( &p_sys->end_date, p_dec->fmt_in.audio.i_rate, 1 ); date_Init( &p_sys->end_date, p_dec->fmt_in.audio.i_rate, 1 );
p_dec->pf_decode_audio = DecodeAudio;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
/***************************************************************************** /*****************************************************************************
* DecodeAudio: Called to decode one frame * 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; decoder_sys_t *p_sys = p_dec->p_sys;
AVCodecContext *ctx = p_sys->p_context; AVCodecContext *ctx = p_sys->p_context;
......
...@@ -299,22 +299,19 @@ static int OpenDecoder( vlc_object_t *p_this ) ...@@ -299,22 +299,19 @@ static int OpenDecoder( vlc_object_t *p_this )
switch( i_cat ) switch( i_cat )
{ {
case VIDEO_ES: case VIDEO_ES:
p_dec->pf_decode_video = DecodeVideo; i_result = InitVideoDec( p_dec, p_context, p_codec,
i_result = InitVideoDec ( p_dec, p_context, p_codec, i_codec_id, psz_namecodec );
i_codec_id, psz_namecodec );
break; break;
case AUDIO_ES: case AUDIO_ES:
p_dec->pf_decode_audio = DecodeAudio; i_result = InitAudioDec( p_dec, p_context, p_codec,
i_result = InitAudioDec ( p_dec, p_context, p_codec, i_codec_id, psz_namecodec );
i_codec_id, psz_namecodec );
break; break;
case SPU_ES: case SPU_ES:
p_dec->pf_decode_sub = DecodeSubtitle;
i_result = InitSubtitleDec( p_dec, p_context, p_codec, i_result = InitSubtitleDec( p_dec, p_context, p_codec,
i_codec_id, psz_namecodec ); i_codec_id, psz_namecodec );
break; break;
default: default:
i_result = VLC_EGENERIC; return VLC_EGENERIC;
} }
if( i_result == VLC_SUCCESS ) if( i_result == VLC_SUCCESS )
......
...@@ -31,10 +31,6 @@ int GetVlcFourcc( unsigned i_ffmpeg_codec, int *pi_cat, ...@@ -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 *pi_fourcc, const char **ppsz_name );
vlc_fourcc_t GetVlcAudioFormat( int i_sample_fmt ); 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 */ /* Video encoder module */
int OpenEncoder ( vlc_object_t * ); int OpenEncoder ( vlc_object_t * );
void CloseEncoder( vlc_object_t * ); void CloseEncoder( vlc_object_t * );
......
...@@ -44,6 +44,7 @@ struct decoder_sys_t { ...@@ -44,6 +44,7 @@ struct decoder_sys_t {
static subpicture_t *ConvertSubtitle(decoder_t *, AVSubtitle *, mtime_t pts, static subpicture_t *ConvertSubtitle(decoder_t *, AVSubtitle *, mtime_t pts,
AVCodecContext *avctx); AVCodecContext *avctx);
static subpicture_t *DecodeSubtitle(decoder_t *, block_t **);
/** /**
* Initialize subtitle decoder * Initialize subtitle decoder
...@@ -110,6 +111,7 @@ int InitSubtitleDec(decoder_t *dec, AVCodecContext *context, ...@@ -110,6 +111,7 @@ int InitSubtitleDec(decoder_t *dec, AVCodecContext *context,
/* */ /* */
msg_Dbg(dec, "libavcodec codec (%s) started", namecodec); msg_Dbg(dec, "libavcodec codec (%s) started", namecodec);
dec->fmt_out.i_cat = SPU_ES; dec->fmt_out.i_cat = SPU_ES;
dec->pf_decode_sub = DecodeSubtitle;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -117,7 +119,7 @@ int InitSubtitleDec(decoder_t *dec, AVCodecContext *context, ...@@ -117,7 +119,7 @@ int InitSubtitleDec(decoder_t *dec, AVCodecContext *context,
/** /**
* Decode one subtitle * 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; decoder_sys_t *sys = dec->p_sys;
......
...@@ -106,6 +106,7 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *, AVFrame * ); ...@@ -106,6 +106,7 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *, AVFrame * );
#endif #endif
static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *, static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *,
const enum PixelFormat * ); const enum PixelFormat * );
static picture_t *DecodeVideo( decoder_t *, block_t ** );
static uint32_t ffmpeg_CodecTag( vlc_fourcc_t fcc ) static uint32_t ffmpeg_CodecTag( vlc_fourcc_t fcc )
{ {
...@@ -459,13 +460,14 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context, ...@@ -459,13 +460,14 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
return VLC_EGENERIC; return VLC_EGENERIC;
} }
p_dec->pf_decode_video = DecodeVideo;
return VLC_SUCCESS; return VLC_SUCCESS;
} }
/***************************************************************************** /*****************************************************************************
* DecodeVideo: Called to decode one or more frames * 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; decoder_sys_t *p_sys = p_dec->p_sys;
AVCodecContext *p_context = p_sys->p_context; AVCodecContext *p_context = p_sys->p_context;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment