if( p_sys->p_context->extradata_size <= 0 )
{
- if( p_sys->i_codec_id == AV_CODEC_ID_VORBIS ||
- ( p_sys->i_codec_id == AV_CODEC_ID_AAC &&
+ if( p_sys->p_codec->id == AV_CODEC_ID_VORBIS ||
+ ( p_sys->p_codec->id == AV_CODEC_ID_AAC &&
!p_dec->fmt_in.b_packetized ) )
{
msg_Warn( p_dec, "waiting for extra data for codec %s",
p_sys->p_context->bits_per_coded_sample =
p_dec->fmt_in.audio.i_bitspersample;
- if( p_sys->i_codec_id == AV_CODEC_ID_ADPCM_G726 &&
+ if( p_sys->p_codec->id == AV_CODEC_ID_ADPCM_G726 &&
p_sys->p_context->bit_rate > 0 &&
p_sys->p_context->sample_rate > 0)
p_sys->p_context->bits_per_coded_sample = p_sys->p_context->bit_rate
* 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 AVCodec *p_codec )
{
decoder_sys_t *p_sys;
}
p_context->codec_type = AVMEDIA_TYPE_AUDIO;
- p_context->codec_id = i_codec_id;
+ p_context->codec_id = p_codec->id;
#if (LIBAVCODEC_VERSION_MAJOR >= 55)
p_context->refcounted_frames = true;
#else
#endif
p_sys->p_context = p_context;
p_sys->p_codec = p_codec;
- p_sys->i_codec_id = i_codec_id;
p_sys->b_delayed_open = true;
// Initialize decoder extradata
avcodec_flush_buffers( ctx );
date_Set( &p_sys->end_date, 0 );
- if( p_sys->i_codec_id == AV_CODEC_ID_MP2 || p_sys->i_codec_id == AV_CODEC_ID_MP3 )
+ if( ctx->codec_id == AV_CODEC_ID_MP2 ||
+ ctx->codec_id == AV_CODEC_ID_MP3 )
p_sys->i_reject_count = 3;
goto end;
switch( i_cat )
{
case VIDEO_ES:
- i_result = InitVideoDec( p_dec, p_context, p_codec, i_codec_id );
+ i_result = InitVideoDec( p_dec, p_context, p_codec );
break;
case AUDIO_ES:
- i_result = InitAudioDec( p_dec, p_context, p_codec, i_codec_id );
+ i_result = InitAudioDec( p_dec, p_context, p_codec );
break;
case SPU_ES:
- i_result = InitSubtitleDec( p_dec, p_context, p_codec, i_codec_id );
+ i_result = InitSubtitleDec( p_dec, p_context, p_codec );
break;
default:
return VLC_EGENERIC;
void CloseDeinterlace( vlc_object_t * );
/* Video Decoder */
-int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
- const AVCodec *p_codec, int i_codec_id );
+int InitVideoDec( decoder_t *, AVCodecContext *, const AVCodec * );
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 );
+int InitAudioDec( decoder_t *, AVCodecContext *, const AVCodec * );
/* Subtitle Decoder */
-int InitSubtitleDec( decoder_t *p_dec, AVCodecContext *p_context,
- const AVCodec *p_codec, int i_codec_id );
+int InitSubtitleDec( decoder_t *, AVCodecContext *, const AVCodec * );
/* Initialize decoder */
int ffmpeg_OpenCodec( decoder_t *p_dec );
"hev1 and hev2 are currently supported only with libfdk-aac enabled libavcodec" )
#define AVCODEC_COMMON_MEMBERS \
- int i_codec_id; \
AVCodecContext *p_context; \
const AVCodec *p_codec; \
bool b_delayed_open;
* Initialize subtitle decoder
*/
int InitSubtitleDec(decoder_t *dec, AVCodecContext *context,
- const AVCodec *codec, int codec_id)
+ const AVCodec *codec)
{
decoder_sys_t *sys;
/* */
- switch (codec_id) {
+ switch (codec->id) {
case AV_CODEC_ID_HDMV_PGS_SUBTITLE:
case AV_CODEC_ID_XSUB:
case AV_CODEC_ID_DVB_SUBTITLE:
return VLC_ENOMEM;
context->codec_type = AVMEDIA_TYPE_SUBTITLE;
- context->codec_id = codec_id;
+ context->codec_id = codec->id;
sys->p_context = context;
sys->p_codec = codec;
- sys->i_codec_id = codec_id;
sys->b_delayed_open = false;
/* */
if( p_sys->p_context->extradata_size <= 0 )
{
- if( p_sys->i_codec_id == AV_CODEC_ID_VC1 ||
- p_sys->i_codec_id == AV_CODEC_ID_THEORA )
+ if( p_sys->p_codec->id == AV_CODEC_ID_VC1 ||
+ p_sys->p_codec->id == AV_CODEC_ID_THEORA )
{
msg_Warn( p_dec, "waiting for extra data for codec %s",
p_sys->p_codec->name );
* 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 AVCodec *p_codec )
{
decoder_sys_t *p_sys;
int i_val;
return VLC_ENOMEM;
p_context->codec_type = AVMEDIA_TYPE_VIDEO;
- p_context->codec_id = i_codec_id;
+ p_context->codec_id = p_codec->id;
p_sys->p_context = p_context;
p_sys->p_codec = p_codec;
- p_sys->i_codec_id = i_codec_id;
p_sys->p_ff_pic = avcodec_alloc_frame();
p_sys->b_delayed_open = true;
p_sys->p_va = NULL;
if( var_CreateGetBool( p_dec, "avcodec-dr" ) &&
(p_codec->capabilities & CODEC_CAP_DR1) &&
/* No idea why ... but this fixes flickering on some TSCC streams */
- p_sys->i_codec_id != AV_CODEC_ID_TSCC && p_sys->i_codec_id != AV_CODEC_ID_CSCD &&
- p_sys->i_codec_id != AV_CODEC_ID_CINEPAK )
+ p_sys->p_codec->id != AV_CODEC_ID_TSCC &&
+ p_sys->p_codec->id != AV_CODEC_ID_CSCD &&
+ p_sys->p_codec->id != AV_CODEC_ID_CINEPAK )
{
/* Some codecs set pix_fmt only after the 1st frame has been decoded,
* so we need to do another check in ffmpeg_GetFrameBuf() */
p_context->thread_count = i_thread_count;
p_context->thread_safe_callbacks = true;
- switch( i_codec_id )
+ switch( p_codec->id )
{
case AV_CODEC_ID_MPEG4:
case AV_CODEC_ID_H263:
case AV_CODEC_ID_WMV3:
p_context->thread_type &= ~FF_THREAD_FRAME;
# endif
+ default:
+ break;
}
/* Workaround: frame multithreading is not compatible with
if( !i_size ) return;
- if( p_sys->i_codec_id == AV_CODEC_ID_SVQ3 )
+ if( p_sys->p_codec->id == AV_CODEC_ID_SVQ3 )
{
uint8_t *p;
static picture_t *ffmpeg_dr_GetFrameBuf(struct AVCodecContext *p_context)
{
decoder_t *p_dec = (decoder_t *)p_context->opaque;
- decoder_sys_t *p_sys = p_dec->p_sys;
int i_width = p_context->width;
int i_height = p_context->height;
for( int i = 0; i < p_pic->i_planes; i++ )
{
unsigned i_align;
- switch( p_sys->i_codec_id )
+ switch( p_context->codec_id )
{
case AV_CODEC_ID_SVQ1:
case AV_CODEC_ID_VP5: