From e1a8392cae584ddce6a92d88bda47e7f366769cf Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Tue, 8 Feb 2011 18:37:05 +0200 Subject: fix compilation with old FFmpeg versions af_lavcac3enc: use old SampleFormat names without AV_ prefix, the latter were only added in 2010-11 vd_ffmpeg: add ifdef around CODEC_ID_LAGARITH use demux_real: use ffmpeg_files/intreadwrite.h stream/http.c, stream/realrtsp/real.c: define AV_BASE64_SIZE macro for old libavutil versions lacking it --- libaf/af_lavcac3enc.c | 9 +++++---- libmpcodecs/vd_ffmpeg.c | 9 ++++++++- libmpdemux/demux_real.c | 2 +- stream/http.c | 5 +++++ stream/realrtsp/real.c | 6 ++++++ 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/libaf/af_lavcac3enc.c b/libaf/af_lavcac3enc.c index e2de58b26b..819f3f7382 100644 --- a/libaf/af_lavcac3enc.c +++ b/libaf/af_lavcac3enc.c @@ -298,17 +298,18 @@ static int af_open(af_instance_t* af){ mp_tmsg(MSGT_AFILTER, MSGL_ERR, "Audio LAVC, couldn't allocate context!\n"); return AF_ERROR; } - const enum AVSampleFormat *fmts = s->lavc_acodec->sample_fmts; + // using deprecated SampleFormat/FMT, AV* versions only added in 2010-11 + const enum SampleFormat *fmts = s->lavc_acodec->sample_fmts; for (int i = 0; ; i++) { - if (fmts[i] == AV_SAMPLE_FMT_NONE) { + if (fmts[i] == SAMPLE_FMT_NONE) { mp_msg(MSGT_AFILTER, MSGL_ERR, "Audio LAVC, encoder doesn't " "support expected sample formats!\n"); return AF_ERROR; - } else if (fmts[i] == AV_SAMPLE_FMT_S16) { + } else if (fmts[i] == SAMPLE_FMT_S16) { s->in_sampleformat = AF_FORMAT_S16_NE; s->lavc_actx->sample_fmt = fmts[i]; break; - } else if (fmts[i] == AV_SAMPLE_FMT_FLT) { + } else if (fmts[i] == SAMPLE_FMT_FLT) { s->in_sampleformat = AF_FORMAT_FLOAT_NE; s->lavc_actx->sample_fmt = fmts[i]; break; diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index 058446936d..d56a63ea59 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -192,7 +192,14 @@ static int init(sh_video_t *sh){ if(sh->opts->vd_use_slices && (lavc_codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND) && !do_vis_debug) ctx->do_slices=1; - if(lavc_codec->capabilities&CODEC_CAP_DR1 && !do_vis_debug && lavc_codec->id != CODEC_ID_H264 && lavc_codec->id != CODEC_ID_INTERPLAY_VIDEO && lavc_codec->id != CODEC_ID_ROQ && lavc_codec->id != CODEC_ID_VP8 && lavc_codec->id != CODEC_ID_LAGARITH) + if(lavc_codec->capabilities&CODEC_CAP_DR1 && !do_vis_debug + && lavc_codec->id != CODEC_ID_H264 + && lavc_codec->id != CODEC_ID_INTERPLAY_VIDEO + && lavc_codec->id != CODEC_ID_ROQ && lavc_codec->id != CODEC_ID_VP8 +#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 108, 0) + && lavc_codec->id != CODEC_ID_LAGARITH +#endif + ) ctx->do_dr1=1; ctx->b_age= ctx->ip_age[0]= ctx->ip_age[1]= 256*256*256*64; ctx->ip_count= ctx->b_count= 0; diff --git a/libmpdemux/demux_real.c b/libmpdemux/demux_real.c index 93a899539e..1bdf8ec19b 100644 --- a/libmpdemux/demux_real.c +++ b/libmpdemux/demux_real.c @@ -43,7 +43,7 @@ #include "mp_msg.h" #include "mpbswap.h" #include "libavutil/common.h" -#include "libavutil/intreadwrite.h" +#include "ffmpeg_files/intreadwrite.h" #include "stream/stream.h" #include "aviprint.h" #include "demuxer.h" diff --git a/stream/http.c b/stream/http.c index 9ef5ae8446..9372cb1262 100644 --- a/stream/http.c +++ b/stream/http.c @@ -43,6 +43,11 @@ #include "libavutil/base64.h" +#include +#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(50, 17, 0) +#define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) +#endif + extern int stream_cache_size; extern int network_bandwidth; diff --git a/stream/realrtsp/real.c b/stream/realrtsp/real.c index 6d77157f34..3ddf9a12d0 100644 --- a/stream/realrtsp/real.c +++ b/stream/realrtsp/real.c @@ -39,6 +39,12 @@ #include "libavutil/md5.h" #include "ffmpeg_files/intreadwrite.h" #include "libavutil/base64.h" + +#include +#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(50, 17, 0) +#define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) +#endif + #include "stream/http.h" #include "mp_msg.h" -- cgit v1.2.3