Fix deprecation warning.

This commit is contained in:
Themaister 2011-10-22 22:54:36 +02:00
parent fddcc3447c
commit 1fc99c7123
2 changed files with 16 additions and 1 deletions

View File

@ -80,6 +80,7 @@ if [ $HAVE_FFMPEG = yes ]; then
check_lib FFMPEG_AVCODEC_OPEN2 "$AVCODEC_LIBS" avcodec_open2
check_lib FFMPEG_AVIO_OPEN "$AVFORMAT_LIBS" avio_open
check_lib FFMPEG_AVFORMAT_WRITE_HEADER "$AVFORMAT_LIBS" avformat_write_header
check_lib FFMPEG_AVFORMAT_NEW_STREAM "$AVFORMAT_LIBS" avformat_new_stream
fi
check_lib DYNAMIC $DYLIB dlopen
@ -94,7 +95,7 @@ check_pkgconf PYTHON python3
add_define_make OS $OS
# Creates config.mk and config.h.
VARS="ALSA OSS OSS_BSD OSS_LIB AL RSOUND ROAR JACK COREAUDIO PULSE SDL DYLIB CG XML SDL_IMAGE DYNAMIC FFMPEG AVCODEC AVFORMAT AVUTIL SWSCALE CONFIGFILE FREETYPE XVIDEO NETPLAY FBO STRL PYTHON FFMPEG_ALLOC_CONTEXT3 FFMPEG_AVCODEC_OPEN2 FFMPEG_AVIO_OPEN FFMPEG_AVFORMAT_WRITE_HEADER X264RGB"
VARS="ALSA OSS OSS_BSD OSS_LIB AL RSOUND ROAR JACK COREAUDIO PULSE SDL DYLIB CG XML SDL_IMAGE DYNAMIC FFMPEG AVCODEC AVFORMAT AVUTIL SWSCALE CONFIGFILE FREETYPE XVIDEO NETPLAY FBO STRL PYTHON FFMPEG_ALLOC_CONTEXT3 FFMPEG_AVCODEC_OPEN2 FFMPEG_AVIO_OPEN FFMPEG_AVFORMAT_WRITE_HEADER FFMPEG_AVFORMAT_NEW_STREAM X264RGB"
create_config_make config.mk $VARS
create_config_header config.h $VARS

View File

@ -22,6 +22,7 @@
struct video_info
{
AVCodecContext *codec;
AVCodec *encoder;
AVFrame *conv_frame;
uint8_t *conv_frame_buf;
@ -42,6 +43,7 @@ struct video_info
struct audio_info
{
AVCodecContext *codec;
AVCodec *encoder;
int16_t *buffer;
size_t frames_in_buffer;
@ -85,6 +87,8 @@ static bool init_audio(struct audio_info *audio, struct ffemu_params *param)
if (!codec)
return false;
audio->encoder = codec;
// FFmpeg just loves to deprecate stuff :)
#ifdef HAVE_FFMPEG_ALLOC_CONTEXT3
audio->codec = avcodec_alloc_context3(codec);
@ -129,6 +133,8 @@ static bool init_video(struct video_info *video, const struct ffemu_params *para
if (!codec)
return false;
video->encoder = codec;
#if AV_HAVE_BIGENDIAN
video->fmt = PIX_FMT_RGB555BE;
#else
@ -222,8 +228,12 @@ static bool init_muxer(ffemu_t *handle)
return false;
}
#ifdef HAVE_FFMPEG_AVFORMAT_NEW_STREAM
AVStream *stream = avformat_new_stream(ctx, handle->video.encoder);
#else
int stream_cnt = 0;
AVStream *stream = av_new_stream(ctx, stream_cnt++);
#endif
stream->codec = handle->video.codec;
if (ctx->oformat->flags & AVFMT_GLOBALHEADER)
@ -231,7 +241,11 @@ static bool init_muxer(ffemu_t *handle)
handle->muxer.vstream = stream;
handle->muxer.vstream->sample_aspect_ratio = handle->video.codec->sample_aspect_ratio;
#ifdef HAVE_FFMPEG_AVFORMAT_NEW_STREAM
stream = avformat_new_stream(ctx, handle->audio.encoder);
#else
stream = av_new_stream(ctx, stream_cnt++);
#endif
stream->codec = handle->audio.codec;
if (ctx->oformat->flags & AVFMT_GLOBALHEADER)