[vlc-devel] [PATCH] Update av* code to use new APIs after Libav Big Bump.
Konstantin Pavlov
thresh at videolan.org
Tue Apr 19 13:12:36 CEST 2011
Tested on current libav and ffmpeg @ 25846 svn revision playback only.
No need to bump current lavc/lavf requirements (52.25.0 and 52.45.0), as
all the "new" functions used arrived earlier than abovementioned
versions were published.
---
modules/codec/avcodec/audio.c | 12 ++++--
modules/codec/avcodec/avcodec.c | 26 +++++++-------
modules/codec/avcodec/avcodec.h | 33 +++++++++++++++++++
modules/codec/avcodec/encoder.c | 34 ++++++++++----------
modules/codec/avcodec/subtitle.c | 4 +-
modules/codec/avcodec/video.c | 18 ++++++----
modules/demux/avformat/demux.c | 66 ++++++++++++++++++++++++--------------
modules/demux/avformat/mux.c | 12 +++---
8 files changed, 131 insertions(+), 74 deletions(-)
diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index 9cafc38..33e7418 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -150,8 +150,8 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
return VLC_ENOMEM;
}
- p_codec->type = CODEC_TYPE_AUDIO;
- p_context->codec_type = CODEC_TYPE_AUDIO;
+ p_codec->type = AVMEDIA_TYPE_AUDIO;
+ p_context->codec_type = AVMEDIA_TYPE_AUDIO;
p_context->codec_id = i_codec_id;
p_sys->p_context = p_context;
p_sys->p_codec = p_codec;
@@ -258,6 +258,7 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
int i_used, i_output;
aout_buffer_t *p_buffer;
block_t *p_block;
+ AVPacket pkt;
if( !pp_block || !*pp_block ) return NULL;
@@ -329,9 +330,12 @@ aout_buffer_t * DecodeAudio ( decoder_t *p_dec, block_t **pp_block )
p_sys->p_output = av_realloc( p_sys->p_output, i_output );
}
- i_used = avcodec_decode_audio2( p_sys->p_context,
+ av_init_packet( &pkt );
+ pkt.data = p_block->p_buffer;
+ pkt.size = p_block->i_buffer;
+ i_used = avcodec_decode_audio3( p_sys->p_context,
(int16_t*)p_sys->p_output, &i_output,
- p_block->p_buffer, p_block->i_buffer );
+ &pkt );
if( i_used < 0 || i_output < 0 )
{
diff --git a/modules/codec/avcodec/avcodec.c b/modules/codec/avcodec/avcodec.c
index e1e9f17..3d39a7b 100644
--- a/modules/codec/avcodec/avcodec.c
+++ b/modules/codec/avcodec/avcodec.c
@@ -263,39 +263,39 @@ static int OpenDecoder( vlc_object_t *p_this )
p_context->dsp_mask = 0;
if( !(i_cpu & CPU_CAPABILITY_MMX) )
{
- p_context->dsp_mask |= FF_MM_MMX;
+ p_context->dsp_mask |= AV_CPU_FLAG_MMX;
}
if( !(i_cpu & CPU_CAPABILITY_MMXEXT) )
{
- p_context->dsp_mask |= FF_MM_MMXEXT;
+ p_context->dsp_mask |= AV_CPU_FLAG_MMX2;
}
if( !(i_cpu & CPU_CAPABILITY_3DNOW) )
{
- p_context->dsp_mask |= FF_MM_3DNOW;
+ p_context->dsp_mask |= AV_CPU_FLAG_3DNOW;
}
if( !(i_cpu & CPU_CAPABILITY_SSE) )
{
- p_context->dsp_mask |= FF_MM_SSE;
+ p_context->dsp_mask |= AV_CPU_FLAG_SSE;
}
if( !(i_cpu & CPU_CAPABILITY_SSE2) )
{
- p_context->dsp_mask |= FF_MM_SSE2;
+ p_context->dsp_mask |= AV_CPU_FLAG_SSE2;
}
-#ifdef FF_MM_SSE3
+#ifdef AV_CPU_FLAG_SSE3
if( !(i_cpu & CPU_CAPABILITY_SSE3) )
- p_context->dsp_mask |= FF_MM_SSE3;
+ p_context->dsp_mask |= AV_CPU_FLAG_SSE3;
#endif
-#ifdef FF_MM_SSSE3
+#ifdef AV_CPU_FLAG_SSSE3
if( !(i_cpu & CPU_CAPABILITY_SSSE3) )
- p_context->dsp_mask |= FF_MM_SSSE3;
+ p_context->dsp_mask |= AV_CPU_FLAG_SSSE3;
#endif
-#ifdef FF_MM_SSE4
+#ifdef AV_CPU_FLAG_SSE4
if( !(i_cpu & CPU_CAPABILITY_SSE4_1) )
- p_context->dsp_mask |= FF_MM_SSE4;
+ p_context->dsp_mask |= AV_CPU_FLAG_SSE4;
#endif
-#ifdef FF_MM_SSE42
+#ifdef AV_CPU_FLAG_SSE42
if( !(i_cpu & CPU_CAPABILITY_SSE4_2) )
- p_context->dsp_mask |= FF_MM_SSE42;
+ p_context->dsp_mask |= AV_CPU_FLAG_SSE42;
#endif
p_dec->b_need_packetized = true;
diff --git a/modules/codec/avcodec/avcodec.h b/modules/codec/avcodec/avcodec.h
index 8047db9..b88ddf3 100644
--- a/modules/codec/avcodec/avcodec.h
+++ b/modules/codec/avcodec/avcodec.h
@@ -276,3 +276,36 @@ int ffmpeg_OpenCodec( decoder_t *p_dec );
* system) */
//#define HAVE_AVCODEC_VAAPI 1
//#define HAVE_AVCODEC_DXVA2 1
+
+/* Ugly ifdeffery to provide backwards compatibility with older ffmpeg/libav
+ * versions */
+#ifndef AV_CPU_FLAG_FORCE
+#define AV_CPU_FLAG_FORCE FF_MM_FORCE
+#define AV_CPU_FLAG_MMX FF_MM_MMX
+#define AV_CPU_FLAG_3DNOW FF_MM_3DNOW
+#define AV_CPU_FLAG_MMX2 FF_MM_MMX2
+#define AV_CPU_FLAG_SSE FF_MM_SSE
+#define AV_CPU_FLAG_SSE2 FF_MM_SSE2
+#define AV_CPU_FLAG_SSE2SLOW FF_MM_SSE2SLOW
+#define AV_CPU_FLAG_3DNOWEXT FF_MM_3DNOWEXT
+#define AV_CPU_FLAG_SSE3 FF_MM_SSE3
+#define AV_CPU_FLAG_SSE3SLOW FF_MM_SSE3SLOW
+#define AV_CPU_FLAG_SSSE3 FF_MM_SSSE3
+#define AV_CPU_FLAG_SSE4 FF_MM_SSE4
+#define AV_CPU_FLAG_SSE42 FF_MM_SSE42
+#define AV_CPU_FLAG_IWMMXT FF_MM_IWMMXT
+#define AV_CPU_FLAG_ALTIVEC FF_MM_ALTIVEC
+#endif
+
+#if LIBAVCODEC_VERSION_MAJOR < 53
+#define AVMediaType CodecType
+#define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
+#define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
+#define AVMEDIA_TYPE_SUBTITLE CODEC_TYPE_SUBTITLE
+#define AVMEDIA_TYPE_DATA CODEC_TYPE_DATA
+#define AVMEDIA_TYPE_ATTACHMENT CODEC_TYPE_ATTACHMENT
+#endif
+
+#ifndef AV_PKT_FLAG_KEY
+#define AV_PKT_FLAG_KEY PKT_FLAG_KEY
+#endif
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index b626e47..4be2f1e 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -287,20 +287,20 @@ int OpenEncoder( vlc_object_t *p_this )
p_context->dsp_mask = 0;
if( !(i_cpu & CPU_CAPABILITY_MMX) )
{
- p_context->dsp_mask |= FF_MM_MMX;
+ p_context->dsp_mask |= AV_CPU_FLAG_MMX;
}
if( !(i_cpu & CPU_CAPABILITY_MMXEXT) )
{
- p_context->dsp_mask |= FF_MM_MMXEXT;
+ p_context->dsp_mask |= AV_CPU_FLAG_MMX2;
}
if( !(i_cpu & CPU_CAPABILITY_3DNOW) )
{
- p_context->dsp_mask |= FF_MM_3DNOW;
+ p_context->dsp_mask |= AV_CPU_FLAG_3DNOW;
}
if( !(i_cpu & CPU_CAPABILITY_SSE) )
{
- p_context->dsp_mask |= FF_MM_SSE;
- p_context->dsp_mask |= FF_MM_SSE2;
+ p_context->dsp_mask |= AV_CPU_FLAG_SSE;
+ p_context->dsp_mask |= AV_CPU_FLAG_SSE2;
}
config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
@@ -395,7 +395,7 @@ int OpenEncoder( vlc_object_t *p_this )
return VLC_EGENERIC;
}
- p_context->codec_type = CODEC_TYPE_VIDEO;
+ p_context->codec_type = AVMEDIA_TYPE_VIDEO;
p_context->width = p_enc->fmt_in.video.i_width;
p_context->height = p_enc->fmt_in.video.i_height;
@@ -511,11 +511,6 @@ int OpenEncoder( vlc_object_t *p_this )
i_codec_id == CODEC_ID_SVQ3 )
p_enc->i_threads = 1;
- if ( p_enc->i_threads >= 1 )
- avcodec_thread_init( p_context, p_enc->i_threads );
- else
- avcodec_thread_init( p_context, vlc_GetCPUCount() );
-
if( p_sys->i_vtolerance > 0 )
p_context->bit_rate_tolerance = p_sys->i_vtolerance;
@@ -530,12 +525,12 @@ int OpenEncoder( vlc_object_t *p_this )
if( p_sys->i_qmin > 0 )
{
- p_context->mb_qmin = p_context->qmin = p_sys->i_qmin;
+ p_context->qmin = p_sys->i_qmin;
p_context->mb_lmin = p_context->lmin = p_sys->i_qmin * FF_QP2LAMBDA;
}
if( p_sys->i_qmax > 0 )
{
- p_context->mb_qmax = p_context->qmax = p_sys->i_qmax;
+ p_context->qmax = p_sys->i_qmax;
p_context->mb_lmax = p_context->lmax = p_sys->i_qmax * FF_QP2LAMBDA;
}
p_context->max_qdiff = 3;
@@ -565,7 +560,7 @@ int OpenEncoder( vlc_object_t *p_this )
if( i_codec_id == CODEC_ID_MP3 && p_enc->fmt_in.audio.i_channels > 2 )
p_enc->fmt_in.audio.i_channels = 2;
- p_context->codec_type = CODEC_TYPE_AUDIO;
+ p_context->codec_type = AVMEDIA_TYPE_AUDIO;
p_context->sample_fmt = p_codec->sample_fmts ?
p_codec->sample_fmts[0] :
SAMPLE_FMT_S16;
@@ -607,20 +602,20 @@ int OpenEncoder( vlc_object_t *p_this )
/* Check that we don't overrun users qmin/qmax values */
if( !var_GetInteger( p_enc, ENC_CFG_PREFIX "qmin" ) )
{
- p_context->mb_qmin = p_context->qmin = 10;
+ p_context->qmin = 10;
p_context->mb_lmin = p_context->lmin = 10 * FF_QP2LAMBDA;
}
if( !var_GetInteger( p_enc, ENC_CFG_PREFIX "qmax" ) )
{
- p_context->mb_qmax = p_context->qmax = 42;
+ p_context->qmax = 42;
p_context->mb_lmax = p_context->lmax = 42 * FF_QP2LAMBDA;
}
} else {
if( !var_GetInteger( p_enc, ENC_CFG_PREFIX "qmin" ) )
{
- p_context->mb_qmin = p_context->qmin = 1;
+ p_context->qmin = 1;
p_context->mb_lmin = p_context->lmin = FF_QP2LAMBDA;
}
}
@@ -649,6 +644,11 @@ int OpenEncoder( vlc_object_t *p_this )
p_context->extradata = NULL;
p_context->flags |= CODEC_FLAG_GLOBAL_HEADER;
+ if( p_enc->i_threads >= 1)
+ p_context->thread_count = p_enc->i_threads;
+ else
+ p_context->thread_count = vlc_GetCPUCount();
+
int ret;
vlc_avcodec_lock();
ret = avcodec_open( p_context, p_codec );
diff --git a/modules/codec/avcodec/subtitle.c b/modules/codec/avcodec/subtitle.c
index e5b9e6a..c9ccce6 100644
--- a/modules/codec/avcodec/subtitle.c
+++ b/modules/codec/avcodec/subtitle.c
@@ -76,8 +76,8 @@ int InitSubtitleDec(decoder_t *dec, AVCodecContext *context,
if (!sys)
return VLC_ENOMEM;
- codec->type = CODEC_TYPE_SUBTITLE;
- context->codec_type = CODEC_TYPE_SUBTITLE;
+ codec->type = AVMEDIA_TYPE_SUBTITLE;
+ context->codec_type = AVMEDIA_TYPE_SUBTITLE;
context->codec_id = codec_id;
sys->p_context = context;
sys->p_codec = codec;
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index dacf915..38e7964 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -207,8 +207,8 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
if( ( p_dec->p_sys = p_sys = calloc( 1, sizeof(decoder_sys_t) ) ) == NULL )
return VLC_ENOMEM;
- p_codec->type = CODEC_TYPE_VIDEO;
- p_context->codec_type = CODEC_TYPE_VIDEO;
+ p_codec->type = AVMEDIA_TYPE_VIDEO;
+ p_context->codec_type = AVMEDIA_TYPE_VIDEO;
p_context->codec_id = i_codec_id;
p_sys->p_context = p_context;
p_sys->p_codec = p_codec;
@@ -552,6 +552,7 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
{
int i_used, b_gotpicture;
picture_t *p_pic;
+ AVPacket pkt;
/* Set the PTS/DTS in the context reordered_opaque field */
if( p_block->i_pts > VLC_TS_INVALID )
@@ -568,9 +569,11 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
post_mt( p_sys );
- i_used = avcodec_decode_video( p_context, p_sys->p_ff_pic,
- &b_gotpicture,
- p_block->i_buffer <= 0 && p_sys->b_flush ? NULL : p_block->p_buffer, p_block->i_buffer );
+ av_init_packet( &pkt );
+ pkt.data = p_block->p_buffer;
+ pkt.size = p_block->i_buffer;
+ i_used = avcodec_decode_video2( p_context, p_sys->p_ff_pic,
+ &b_gotpicture, &pkt );
if( b_null_size && !p_sys->b_flush &&
p_context->width > 0 && p_context->height > 0 )
@@ -579,9 +582,8 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
b_null_size = false;
if( p_sys->b_hurry_up )
p_context->skip_frame = p_sys->i_skip_frame;
- i_used = avcodec_decode_video( p_context, p_sys->p_ff_pic,
- &b_gotpicture, p_block->p_buffer,
- p_block->i_buffer );
+ i_used = avcodec_decode_video2( p_context, p_sys->p_ff_pic,
+ &b_gotpicture, &pkt );
}
wait_mt( p_sys );
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index db8f020..2a17882 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -260,7 +260,7 @@ int OpenDemux( vlc_object_t *p_this )
switch( cc->codec_type )
{
- case CODEC_TYPE_AUDIO:
+ case AVMEDIA_TYPE_AUDIO:
es_format_Init( &fmt, AUDIO_ES, fcc );
fmt.i_bitrate = cc->bit_rate;
fmt.audio.i_channels = cc->channels;
@@ -270,7 +270,7 @@ int OpenDemux( vlc_object_t *p_this )
psz_type = "audio";
break;
- case CODEC_TYPE_VIDEO:
+ case AVMEDIA_TYPE_VIDEO:
es_format_Init( &fmt, VIDEO_ES, fcc );
/* Special case for raw video data */
@@ -301,7 +301,7 @@ int OpenDemux( vlc_object_t *p_this )
fmt.video.i_frame_rate_base = cc->time_base.num * __MAX( cc->ticks_per_frame, 1 );
break;
- case CODEC_TYPE_SUBTITLE:
+ case AVMEDIA_TYPE_SUBTITLE:
es_format_Init( &fmt, SPU_ES, fcc );
if( strncmp( p_sys->ic->iformat->name, "matroska", 8 ) == 0 &&
cc->codec_id == CODEC_ID_DVD_SUBTITLE &&
@@ -351,33 +351,44 @@ int OpenDemux( vlc_object_t *p_this )
default:
es_format_Init( &fmt, UNKNOWN_ES, 0 );
#ifdef HAVE_FFMPEG_CODEC_ATTACHMENT
- if( cc->codec_type == CODEC_TYPE_ATTACHMENT )
+ if( cc->codec_type == AVMEDIA_TYPE_ATTACHMENT )
{
input_attachment_t *p_attachment;
+
psz_type = "attachment";
if( cc->codec_id == CODEC_ID_TTF )
{
- p_attachment = vlc_input_attachment_New( s->filename, "application/x-truetype-font", NULL,
- cc->extradata, (int)cc->extradata_size );
- TAB_APPEND( p_sys->i_attachments, p_sys->attachments, p_attachment );
+ AVMetadataTag *filename = av_metadata_get( s->metadata, "filename", NULL, 0 );
+ if( filename && filename->value )
+ {
+ p_attachment = vlc_input_attachment_New(
+ filename->value, "application/x-truetype-font",
+ NULL, cc->extradata, (int)cc->extradata_size );
+ TAB_APPEND( p_sys->i_attachments, p_sys->attachments,
+ p_attachment );
+ }
}
else msg_Warn( p_demux, "unsupported attachment type in ffmpeg demux" );
}
break;
#endif
- if( cc->codec_type == CODEC_TYPE_DATA )
+ if( cc->codec_type == AVMEDIA_TYPE_DATA )
psz_type = "data";
msg_Warn( p_demux, "unsupported track type in ffmpeg demux" );
break;
}
- fmt.psz_language = strdup( s->language );
+
+ AVMetadataTag *language = av_metadata_get( s->metadata, "language", NULL, 0 );
+ if ( language && language->value )
+ fmt.psz_language = strdup( language->value );
+
if( s->disposition & AV_DISPOSITION_DEFAULT )
fmt.i_priority = 1000;
#ifdef HAVE_FFMPEG_CODEC_ATTACHMENT
- if( cc->codec_type != CODEC_TYPE_ATTACHMENT )
+ if( cc->codec_type != AVMEDIA_TYPE_ATTACHMENT )
#endif
{
const bool b_ogg = !strcmp( p_sys->fmt->name, "ogg" );
@@ -466,9 +477,10 @@ int OpenDemux( vlc_object_t *p_this )
{
seekpoint_t *s = vlc_seekpoint_New();
- if( p_sys->ic->chapters[i]->title )
+ AVMetadataTag *title = av_metadata_get( p_sys->ic->metadata, "title", NULL, 0);
+ if( title && title->value )
{
- s->psz_name = strdup( p_sys->ic->chapters[i]->title );
+ s->psz_name = strdup( title->value );
EnsureUTF8( s->psz_name );
msg_Dbg( p_demux, " - chapter %d: %s", i, s->psz_name );
}
@@ -551,7 +563,7 @@ static int Demux( demux_t *p_demux )
memcpy( p_frame->p_buffer, pkt.data, pkt.size );
}
- if( pkt.flags & PKT_FLAG_KEY )
+ if( pkt.flags & AV_PKT_FLAG_KEY )
p_frame->i_flags |= BLOCK_FLAG_TYPE_I;
i_start_time = ( p_sys->ic->start_time != (int64_t)AV_NOPTS_VALUE ) ?
@@ -571,7 +583,7 @@ static int Demux( demux_t *p_demux )
p_stream->time_base.den;
if( pkt.dts != AV_NOPTS_VALUE && pkt.dts == pkt.pts &&
- p_stream->codec->codec_type == CODEC_TYPE_VIDEO )
+ p_stream->codec->codec_type == AVMEDIA_TYPE_VIDEO )
{
/* Add here notoriously bugged file formats/samples regarding PTS */
if( !strcmp( p_sys->fmt->name, "flv" ) )
@@ -752,16 +764,22 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
{
vlc_meta_t *p_meta = (vlc_meta_t*)va_arg( args, vlc_meta_t* );
- if( p_sys->ic->title[0] )
- vlc_meta_SetTitle( p_meta, p_sys->ic->title );
- if( p_sys->ic->author[0] )
- vlc_meta_SetArtist( p_meta, p_sys->ic->author );
- if( p_sys->ic->copyright[0] )
- vlc_meta_SetCopyright( p_meta, p_sys->ic->copyright );
- if( p_sys->ic->comment[0] )
- vlc_meta_SetDescription( p_meta, p_sys->ic->comment );
- if( p_sys->ic->genre[0] )
- vlc_meta_SetGenre( p_meta, p_sys->ic->genre );
+ AVMetadataTag *title = av_metadata_get( p_sys->ic->metadata, "language", NULL, 0 );
+ AVMetadataTag *author = av_metadata_get( p_sys->ic->metadata, "author", NULL, 0 );
+ AVMetadataTag *copyright = av_metadata_get( p_sys->ic->metadata, "copyright", NULL, 0 );
+ AVMetadataTag *comment = av_metadata_get( p_sys->ic->metadata, "comment", NULL, 0 );
+ AVMetadataTag *genre = av_metadata_get( p_sys->ic->metadata, "genre", NULL, 0 );
+
+ if( title && title->value )
+ vlc_meta_SetTitle( p_meta, title->value );
+ if( author && author->value )
+ vlc_meta_SetArtist( p_meta, author->value );
+ if( copyright && copyright->value )
+ vlc_meta_SetCopyright( p_meta, copyright->value );
+ if( comment && comment->value )
+ vlc_meta_SetDescription( p_meta, comment->value );
+ if( genre && genre->value )
+ vlc_meta_SetGenre( p_meta, genre->value );
return VLC_SUCCESS;
}
diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index 19f49c8..41d4de5 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -96,12 +96,12 @@ int OpenMux( vlc_object_t *p_this )
psz_mux = var_GetNonEmptyString( p_mux, "ffmpeg-mux" );
if( psz_mux )
{
- file_oformat = guess_format( psz_mux, NULL, NULL );
+ file_oformat = av_guess_format( psz_mux, NULL, NULL );
}
else
{
file_oformat =
- guess_format(NULL, p_mux->p_access->psz_path, NULL);
+ av_guess_format(NULL, p_mux->p_access->psz_path, NULL);
}
if (!file_oformat)
{
@@ -116,7 +116,7 @@ int OpenMux( vlc_object_t *p_this )
p_mux->pf_mux = Mux;
p_mux->p_sys = p_sys = malloc( sizeof( sout_mux_sys_t ) );
- p_sys->oc = av_alloc_format_context();
+ p_sys->oc = avformat_alloc_context();
p_sys->oc->oformat = file_oformat;
/* Create I/O wrapper */
@@ -225,7 +225,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
switch( p_input->p_fmt->i_cat )
{
case AUDIO_ES:
- codec->codec_type = CODEC_TYPE_AUDIO;
+ codec->codec_type = AVMEDIA_TYPE_AUDIO;
codec->channels = p_input->p_fmt->audio.i_channels;
codec->sample_rate = p_input->p_fmt->audio.i_rate;
codec->time_base = (AVRational){1, codec->sample_rate};
@@ -240,7 +240,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
p_input->p_fmt->video.i_frame_rate = 25;
p_input->p_fmt->video.i_frame_rate_base = 1;
}
- codec->codec_type = CODEC_TYPE_VIDEO;
+ codec->codec_type = AVMEDIA_TYPE_VIDEO;
codec->width = p_input->p_fmt->video.i_width;
codec->height = p_input->p_fmt->video.i_height;
av_reduce( &codec->sample_aspect_ratio.num,
@@ -311,7 +311,7 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
pkt.size = p_data->i_buffer;
pkt.stream_index = i_stream;
- if( p_data->i_flags & BLOCK_FLAG_TYPE_I ) pkt.flags |= PKT_FLAG_KEY;
+ if( p_data->i_flags & BLOCK_FLAG_TYPE_I ) pkt.flags |= AV_PKT_FLAG_KEY;
/* avformat expects pts/dts which start from 0 */
p_data->i_dts -= p_mux->p_sys->i_initial_dts;
--
1.7.4.4
More information about the vlc-devel
mailing list