summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--av_log.c3
-rw-r--r--av_opts.c6
-rwxr-xr-xconfigure4
-rw-r--r--defaultopts.c1
-rw-r--r--ffmpeg_files/taglists.c2
-rw-r--r--libaf/af_lavcac3enc.c21
-rw-r--r--libmpcodecs/ad_ffmpeg.c27
-rw-r--r--libmpcodecs/vd_ffmpeg.c36
-rw-r--r--libmpcodecs/vf_lavc.c4
-rw-r--r--libmpcodecs/vf_uspp.c7
-rw-r--r--libmpdemux/demux_lavf.c31
-rw-r--r--libmpdemux/demux_rtp_codec.cpp2
-rw-r--r--libmpdemux/demuxer.c2
-rw-r--r--libmpdemux/ebml.c10
-rw-r--r--libvo/vo_png.c17
-rw-r--r--screenshot.c12
-rw-r--r--stream/stream_ffmpeg.c4
-rw-r--r--sub/av_sub.c9
18 files changed, 96 insertions, 102 deletions
diff --git a/av_log.c b/av_log.c
index bccbff54de..b804cd18d0 100644
--- a/av_log.c
+++ b/av_log.c
@@ -111,10 +111,7 @@ static void mp_msg_av_log_callback(void *ptr, int level, const char *fmt,
void init_libav(void)
{
av_log_set_callback(mp_msg_av_log_callback);
-
- avcodec_init();
avcodec_register_all();
-
av_register_all();
}
diff --git a/av_opts.c b/av_opts.c
index 59f47edf52..bc2e392c5f 100644
--- a/av_opts.c
+++ b/av_opts.c
@@ -21,8 +21,10 @@
#include <stdlib.h>
#include <string.h>
+
+#include <libavutil/opt.h>
+
#include "av_opts.h"
-#include "libavcodec/opt.h"
int parse_avopts(void *v, char *str){
char *start;
@@ -37,7 +39,7 @@ int parse_avopts(void *v, char *str){
arg = strchr(str, '=');
if(arg) *arg++= 0;
- if (av_set_string3(v, str, arg, 0, NULL) < 0) {
+ if (av_opt_set(v, str, arg, AV_OPT_SEARCH_CHILDREN) < 0) {
free(start);
return -1;
}
diff --git a/configure b/configure
index 83782c9349..ee2ea4cf14 100755
--- a/configure
+++ b/configure
@@ -6003,7 +6003,9 @@ echores "$_live"
-all_libav_libs="libavutil >= 51.7.0:libavcodec >= 53.5.0:libavformat >= 53.2.0:libswscale >= 2.0.0:libpostproc >= 52.0.0"
+# Test with > against Libav 0.8 versions which will NOT work rather than
+# specify minimum version, to allow (future) point releases to possibly work.
+all_libav_libs="libavutil > 51.21.0:libavcodec > 53.34.0:libavformat > 53.20.0:libswscale >= 2.0.0:libpostproc >= 52.0.0"
echocheck "Libav ($all_libav_libs)"
if test "$ffmpeg" = auto ; then
IFS=":" # shell should not be used for programming
diff --git a/defaultopts.c b/defaultopts.c
index a398c32417..52e63cc489 100644
--- a/defaultopts.c
+++ b/defaultopts.c
@@ -55,7 +55,6 @@ void set_default_mplayer_options(struct MPOpts *opts)
.lavc_param = {
.workaround_bugs = 1, // autodetect
- .error_resilience = 2,
.error_concealment = 3,
},
.input = {
diff --git a/ffmpeg_files/taglists.c b/ffmpeg_files/taglists.c
index ec414a35c1..ee2ac94427 100644
--- a/ffmpeg_files/taglists.c
+++ b/ffmpeg_files/taglists.c
@@ -302,8 +302,6 @@ const struct mp_AVCodecTag mp_ff_codec_wav_tags[] = {
{ CODEC_ID_AAC_LATM, 0x1602 },
{ CODEC_ID_AC3, 0x2000 },
{ CODEC_ID_DTS, 0x2001 },
- { CODEC_ID_SONIC, 0x2048 },
- { CODEC_ID_SONIC_LS, 0x2048 },
{ CODEC_ID_PCM_MULAW, 0x6c75 },
{ CODEC_ID_AAC, 0x706d },
{ CODEC_ID_AAC, 0x4143 },
diff --git a/libaf/af_lavcac3enc.c b/libaf/af_lavcac3enc.c
index db6dc52163..ebb1c6ebea 100644
--- a/libaf/af_lavcac3enc.c
+++ b/libaf/af_lavcac3enc.c
@@ -98,15 +98,14 @@ static int control(struct af_instance_s *af, int cmd, void *arg)
s->lavc_actx->sample_rate != af->data->rate ||
s->lavc_actx->bit_rate != bit_rate) {
- if (s->lavc_actx->codec)
- avcodec_close(s->lavc_actx);
+ avcodec_close(s->lavc_actx);
// Put sample parameters
s->lavc_actx->channels = af->data->nch;
s->lavc_actx->sample_rate = af->data->rate;
s->lavc_actx->bit_rate = bit_rate;
- if(avcodec_open(s->lavc_actx, s->lavc_acodec) < 0) {
+ if (avcodec_open2(s->lavc_actx, s->lavc_acodec, NULL) < 0) {
mp_tmsg(MSGT_AFILTER, MSGL_ERR, "Couldn't open codec %s, br=%d.\n", "ac3", bit_rate);
return AF_ERROR;
}
@@ -160,9 +159,8 @@ static void uninit(struct af_instance_s* af)
af_ac3enc_t *s = af->setup;
af->setup = NULL;
if(s->lavc_actx) {
- if (s->lavc_actx->codec)
- avcodec_close(s->lavc_actx);
- free(s->lavc_actx);
+ avcodec_close(s->lavc_actx);
+ av_free(s->lavc_actx);
}
free(s->pending_data);
free(s);
@@ -291,23 +289,22 @@ static int af_open(af_instance_t* af){
return AF_ERROR;
}
- s->lavc_actx = avcodec_alloc_context();
+ s->lavc_actx = avcodec_alloc_context3(s->lavc_acodec);
if (!s->lavc_actx) {
mp_tmsg(MSGT_AFILTER, MSGL_ERR, "Audio LAVC, couldn't allocate context!\n");
return AF_ERROR;
}
- // using deprecated SampleFormat/FMT, AV* versions only added in 2010-11
- const enum SampleFormat *fmts = s->lavc_acodec->sample_fmts;
+ const enum AVSampleFormat *fmts = s->lavc_acodec->sample_fmts;
for (int i = 0; ; i++) {
- if (fmts[i] == SAMPLE_FMT_NONE) {
+ if (fmts[i] == AV_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] == SAMPLE_FMT_S16) {
+ } else if (fmts[i] == AV_SAMPLE_FMT_S16) {
s->in_sampleformat = AF_FORMAT_S16_NE;
s->lavc_actx->sample_fmt = fmts[i];
break;
- } else if (fmts[i] == SAMPLE_FMT_FLT) {
+ } else if (fmts[i] == AV_SAMPLE_FMT_FLT) {
s->in_sampleformat = AF_FORMAT_FLOAT_NE;
s->lavc_actx->sample_fmt = fmts[i];
break;
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c
index cd742cf8f8..4a5062ba00 100644
--- a/libmpcodecs/ad_ffmpeg.c
+++ b/libmpcodecs/ad_ffmpeg.c
@@ -23,6 +23,7 @@
#include <assert.h>
#include <libavcodec/avcodec.h>
+#include <libavutil/opt.h>
#include "talloc.h"
@@ -67,10 +68,10 @@ static int setup_format(sh_audio_t *sh_audio,
{
int sample_format = sh_audio->sample_format;
switch (lavc_context->sample_fmt) {
- case SAMPLE_FMT_U8: sample_format = AF_FORMAT_U8; break;
- case SAMPLE_FMT_S16: sample_format = AF_FORMAT_S16_NE; break;
- case SAMPLE_FMT_S32: sample_format = AF_FORMAT_S32_NE; break;
- case SAMPLE_FMT_FLT: sample_format = AF_FORMAT_FLOAT_NE; break;
+ case AV_SAMPLE_FMT_U8: sample_format = AF_FORMAT_U8; break;
+ case AV_SAMPLE_FMT_S16: sample_format = AF_FORMAT_S16_NE; break;
+ case AV_SAMPLE_FMT_S32: sample_format = AF_FORMAT_S32_NE; break;
+ case AV_SAMPLE_FMT_FLT: sample_format = AF_FORMAT_FLOAT_NE; break;
default:
mp_msg(MSGT_DECAUDIO, MSGL_FATAL, "Unsupported sample format\n");
}
@@ -119,10 +120,12 @@ static int init(sh_audio_t *sh_audio)
struct priv *ctx = talloc_zero(NULL, struct priv);
sh_audio->context = ctx;
- lavc_context = avcodec_alloc_context();
+ lavc_context = avcodec_alloc_context3(lavc_codec);
ctx->avctx = lavc_context;
- lavc_context->drc_scale = opts->drc_level;
+ // Always try to set - option only exists for AC3 at the moment
+ av_opt_set_double(lavc_context, "drc_scale", opts->drc_level,
+ AV_OPT_SEARCH_CHILDREN);
lavc_context->sample_rate = sh_audio->samplerate;
lavc_context->bit_rate = sh_audio->i_bps * 8;
if (sh_audio->wf) {
@@ -156,7 +159,7 @@ static int init(sh_audio_t *sh_audio)
}
/* open it */
- if (avcodec_open(lavc_context, lavc_codec) < 0) {
+ if (avcodec_open2(lavc_context, lavc_codec, NULL) < 0) {
mp_tmsg(MSGT_DECAUDIO, MSGL_ERR, "Could not open codec.\n");
uninit(sh_audio);
return 0;
@@ -195,10 +198,10 @@ static int init(sh_audio_t *sh_audio)
sh_audio->i_bps = sh_audio->wf->nAvgBytesPerSec;
switch (lavc_context->sample_fmt) {
- case SAMPLE_FMT_U8:
- case SAMPLE_FMT_S16:
- case SAMPLE_FMT_S32:
- case SAMPLE_FMT_FLT:
+ case AV_SAMPLE_FMT_U8:
+ case AV_SAMPLE_FMT_S16:
+ case AV_SAMPLE_FMT_S32:
+ case AV_SAMPLE_FMT_FLT:
break;
default:
uninit(sh_audio);
@@ -215,7 +218,7 @@ static void uninit(sh_audio_t *sh)
AVCodecContext *lavc_context = ctx->avctx;
if (lavc_context) {
- if (lavc_context->codec && avcodec_close(lavc_context) < 0)
+ if (avcodec_close(lavc_context) < 0)
mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "Could not close codec.\n");
av_freep(&lavc_context->extradata);
av_freep(&lavc_context);
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 0688aae7cc..cd59b05e79 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -22,13 +22,15 @@
#include <time.h>
#include <stdbool.h>
+#include <libavutil/common.h>
+#include <libavutil/opt.h>
+
#include "talloc.h"
#include "config.h"
#include "mp_msg.h"
#include "options.h"
#include "av_opts.h"
-#include "libavutil/common.h"
#include "ffmpeg_files/intreadwrite.h"
#include "mpbswap.h"
#include "fmt-conversion.h"
@@ -62,8 +64,6 @@ typedef struct {
int do_dr1;
int vo_initialized;
int best_csp;
- int b_age;
- int ip_age[2];
int qp_stat[32];
double qp_sum;
double inv_qp_sum;
@@ -86,7 +86,6 @@ static void uninit(struct sh_video *sh);
const m_option_t lavc_decode_opts_conf[] = {
OPT_INTRANGE("bug", lavc_param.workaround_bugs, 0, -1, 999999),
- OPT_INTRANGE("er", lavc_param.error_resilience, 0, 0, 99),
OPT_FLAG_ON("gray", lavc_param.gray, 0),
OPT_INTRANGE("idct", lavc_param.idct_algo, 0, 0, 99),
OPT_INTRANGE("ec", lavc_param.error_concealment, 0, 0, 99),
@@ -149,11 +148,10 @@ static int init(sh_video_t *sh)
&& lavc_codec->id != CODEC_ID_ROQ && lavc_codec->id != CODEC_ID_VP8
&& lavc_codec->id != CODEC_ID_LAGARITH)
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;
ctx->pic = avcodec_alloc_frame();
- ctx->avctx = avcodec_alloc_context();
+ ctx->avctx = avcodec_alloc_context3(lavc_codec);
avctx = ctx->avctx;
avctx->opaque = sh;
avctx->codec_type = AVMEDIA_TYPE_VIDEO;
@@ -209,7 +207,6 @@ static int init(sh_video_t *sh)
avctx->coded_width = sh->disp_w;
avctx->coded_height = sh->disp_h;
avctx->workaround_bugs = lavc_param->workaround_bugs;
- avctx->error_recognition = lavc_param->error_resilience;
if (lavc_param->gray)
avctx->flags |= CODEC_FLAG_GRAY;
avctx->flags2 |= lavc_param->fast;
@@ -272,7 +269,7 @@ static int init(sh_video_t *sh)
* MJPG fourcc :( */
if (!sh->bih || sh->bih->biSize <= sizeof(*sh->bih))
break;
- avctx->flags |= CODEC_FLAG_EXTERN_HUFF;
+ av_opt_set_int(avctx, "extern_huff", 1, AV_OPT_SEARCH_CHILDREN);
avctx->extradata_size = sh->bih->biSize - sizeof(*sh->bih);
avctx->extradata = av_mallocz(avctx->extradata_size +
FF_INPUT_BUFFER_PADDING_SIZE);
@@ -318,7 +315,7 @@ static int init(sh_video_t *sh)
avctx->thread_count = lavc_param->threads;
/* open it */
- if (avcodec_open(avctx, lavc_codec) < 0) {
+ if (avcodec_open2(avctx, lavc_codec, NULL) < 0) {
mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "Could not open codec.\n");
uninit(sh);
return 0;
@@ -550,19 +547,6 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic)
pic->opaque = mpi;
- if (pic->reference) {
- pic->age = ctx->ip_age[0];
-
- ctx->ip_age[0] = ctx->ip_age[1] + 1;
- ctx->ip_age[1] = 1;
- ctx->b_age++;
- } else {
- pic->age = ctx->b_age;
-
- ctx->ip_age[0]++;
- ctx->ip_age[1]++;
- ctx->b_age = 1;
- }
pic->type = FF_BUFFER_TYPE_USER;
/* The libavcodec reordered_opaque functionality is implemented by
@@ -708,16 +692,16 @@ static struct mp_image *decode(struct sh_video *sh, struct demux_packet *packet,
all_frametime, (double)(len * 8) / sh->frametime / 1000.0,
(double)(all_len * 8) / all_frametime / 1000.0);
switch (pic->pict_type) {
- case FF_I_TYPE:
+ case AV_PICTURE_TYPE_I:
fprintf(fvstats, "type= I\n");
break;
- case FF_P_TYPE:
+ case AV_PICTURE_TYPE_P:
fprintf(fvstats, "type= P\n");
break;
- case FF_S_TYPE:
+ case AV_PICTURE_TYPE_S:
fprintf(fvstats, "type= S\n");
break;
- case FF_B_TYPE:
+ case AV_PICTURE_TYPE_B:
fprintf(fvstats, "type= B\n");
break;
default:
diff --git a/libmpcodecs/vf_lavc.c b/libmpcodecs/vf_lavc.c
index ba870a8b85..b2c1dd756d 100644
--- a/libmpcodecs/vf_lavc.c
+++ b/libmpcodecs/vf_lavc.c
@@ -71,7 +71,7 @@ static int config(struct vf_instance *vf,
vf->priv->outbuf_size=10000+width*height; // must be enough!
vf->priv->outbuf = malloc(vf->priv->outbuf_size);
- if (avcodec_open(&lavc_venc_context, vf->priv->codec) != 0) {
+ if (avcodec_open2(&lavc_venc_context, vf->priv->codec, NULL) != 0) {
mp_tmsg(MSGT_VFILTER,MSGL_ERR,"Could not open codec.\n");
return 0;
}
@@ -143,7 +143,7 @@ static int vf_open(vf_instance_t *vf, char *args){
return 0;
}
- vf->priv->context=avcodec_alloc_context();
+ vf->priv->context=avcodec_alloc_context3(vf->priv->codec);
vf->priv->pic = avcodec_alloc_frame();
// TODO: parse args ->
diff --git a/libmpcodecs/vf_uspp.c b/libmpcodecs/vf_uspp.c
index 332d59ee22..ae044b19a6 100644
--- a/libmpcodecs/vf_uspp.c
+++ b/libmpcodecs/vf_uspp.c
@@ -222,8 +222,7 @@ static int config(struct vf_instance *vf,
for(i=0; i< (1<<vf->priv->log2_count); i++){
AVCodecContext *avctx_enc;
- avctx_enc=
- vf->priv->avctx_enc[i]= avcodec_alloc_context();
+ avctx_enc = vf->priv->avctx_enc[i] = avcodec_alloc_context3(enc);
avctx_enc->width = width + BLOCK;
avctx_enc->height = height + BLOCK;
avctx_enc->time_base= (AVRational){1,25}; // meaningless
@@ -233,8 +232,8 @@ static int config(struct vf_instance *vf,
avctx_enc->flags = CODEC_FLAG_QSCALE | CODEC_FLAG_LOW_DELAY;
avctx_enc->strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL;
avctx_enc->global_quality= 123;
- avcodec_open(avctx_enc, enc);
- assert(avctx_enc->codec);
+ int res = avcodec_open2(avctx_enc, enc, NULL);
+ assert(res >= 0);
}
vf->priv->frame= avcodec_alloc_frame();
vf->priv->frame_dec= avcodec_alloc_frame();
diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c
index 4314a96c02..cf17664aab 100644
--- a/libmpdemux/demux_lavf.c
+++ b/libmpdemux/demux_lavf.c
@@ -25,6 +25,13 @@
#include <stdbool.h>
#include <string.h>
+#include <libavformat/avformat.h>
+#include <libavformat/avio.h>
+#include <libavutil/avutil.h>
+#include <libavutil/avstring.h>
+#include <libavutil/mathematics.h>
+#include <libavutil/opt.h>
+
#include "config.h"
#include "options.h"
#include "mp_msg.h"
@@ -38,13 +45,6 @@
#include "m_option.h"
#include "sub/sub.h"
-#include "libavformat/avformat.h"
-#include "libavformat/avio.h"
-#include "libavutil/avutil.h"
-#include "libavutil/avstring.h"
-#include <libavutil/mathematics.h>
-#include "libavcodec/opt.h"
-
#include "mp_taglists.h"
#define INITIAL_PROBE_SIZE STREAM_BUFFER_SIZE
@@ -534,7 +534,6 @@ static demuxer_t *demux_open_lavf(demuxer_t *demuxer)
struct MPOpts *opts = demuxer->opts;
struct lavfdopts *lavfdopts = &opts->lavfdopts;
AVFormatContext *avfc;
- const AVOption *opt;
AVDictionaryEntry *t = NULL;
lavf_priv_t *priv = demuxer->priv;
int i;
@@ -559,16 +558,14 @@ static demuxer_t *demux_open_lavf(demuxer_t *demuxer)
avfc->flags |= AVFMT_FLAG_IGNIDX;
if (lavfdopts->probesize) {
- opt = av_set_int(avfc, "probesize", lavfdopts->probesize);
- if (!opt)
+ if (av_opt_set_int(avfc, "probesize", lavfdopts->probesize, 0) < 0)
mp_msg(MSGT_HEADER, MSGL_ERR,
"demux_lavf, couldn't set option probesize to %u\n",
lavfdopts->probesize);
}
if (lavfdopts->analyzeduration) {
- opt = av_set_int(avfc, "analyzeduration",
- lavfdopts->analyzeduration * AV_TIME_BASE);
- if (!opt)
+ if (av_opt_set_int(avfc, "analyzeduration",
+ lavfdopts->analyzeduration * AV_TIME_BASE, 0) < 0)
mp_msg(MSGT_HEADER, MSGL_ERR, "demux_lavf, couldn't set option "
"analyzeduration to %u\n", lavfdopts->analyzeduration);
}
@@ -609,7 +606,7 @@ static demuxer_t *demux_open_lavf(demuxer_t *demuxer)
priv->avfc = avfc;
- if (av_find_stream_info(avfc) < 0) {
+ if (avformat_find_stream_info(avfc, NULL) < 0) {
mp_msg(MSGT_HEADER, MSGL_ERR,
"LAVF_header: av_find_stream_info() failed\n");
return NULL;
@@ -617,7 +614,7 @@ static demuxer_t *demux_open_lavf(demuxer_t *demuxer)
/* Add metadata. */
while ((t = av_dict_get(avfc->metadata, "", t,
- AV_METADATA_IGNORE_SUFFIX)))
+ AV_DICT_IGNORE_SUFFIX)))
demux_info_add(demuxer, t->key, t->value);
for (i = 0; i < avfc->nb_chapters; i++) {
@@ -708,7 +705,7 @@ static void check_internet_radio_hack(struct demuxer *demuxer)
AVDictionaryEntry *t = NULL;
AVStream *stream = avfc->streams[avfc->nb_streams - 1];
while ((t = av_dict_get(stream->metadata, "", t,
- AV_METADATA_IGNORE_SUFFIX)))
+ AV_DICT_IGNORE_SUFFIX)))
demux_info_add(demuxer, t->key, t->value);
} else {
if (priv->internet_radio_hack)
@@ -995,7 +992,7 @@ static void demux_close_lavf(demuxer_t *demuxer)
if (priv) {
if (priv->avfc) {
av_freep(&priv->avfc->key);
- av_close_input_file(priv->avfc);
+ avformat_close_input(&priv->avfc);
}
av_freep(&priv->pb);
free(priv);
diff --git a/libmpdemux/demux_rtp_codec.cpp b/libmpdemux/demux_rtp_codec.cpp
index 28fb51e96e..cb21e6b633 100644
--- a/libmpdemux/demux_rtp_codec.cpp
+++ b/libmpdemux/demux_rtp_codec.cpp
@@ -135,7 +135,7 @@ void rtpCodecInitialize_video(demuxer_t* demuxer,
int fooLen;
const uint8_t* fooData;
h264parserctx = av_parser_init(CODEC_ID_H264);
- avcctx = avcodec_alloc_context();
+ avcctx = avcodec_alloc_context3(NULL);
// Pass the config to the parser
h264parserctx->parser->parser_parse(h264parserctx, avcctx,
&fooData, &fooLen, configData, configLen);
diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c
index b3a1998d0c..0ff734b074 100644
--- a/libmpdemux/demuxer.c
+++ b/libmpdemux/demuxer.c
@@ -547,7 +547,7 @@ static void allocate_parser(AVCodecContext **avctx, AVCodecParserContext **parse
break;
}
if (codec_id != CODEC_ID_NONE) {
- *avctx = avcodec_alloc_context();
+ *avctx = avcodec_alloc_context3(NULL);
if (!*avctx)
return;
*parser = av_parser_init(codec_id);
diff --git a/libmpdemux/ebml.c b/libmpdemux/ebml.c
index 28b4a4643a..9bce3b5182 100644
--- a/libmpdemux/ebml.c
+++ b/libmpdemux/ebml.c
@@ -29,7 +29,7 @@
#include <stddef.h>
#include <assert.h>
-#include <libavutil/intfloat_readwrite.h>
+#include <libavutil/intfloat.h>
#include <libavutil/common.h>
#include "talloc.h"
#include "ebml.h"
@@ -191,11 +191,11 @@ double ebml_read_float(stream_t *s, uint64_t *length)
len = ebml_read_length(s, &l);
switch (len) {
case 4:
- value = av_int2flt(stream_read_dword(s));
+ value = av_int2float(stream_read_dword(s));
break;
case 8:
- value = av_int2dbl(stream_read_qword(s));
+ value = av_int2double(stream_read_qword(s));
break;
default:
@@ -382,9 +382,9 @@ static double ebml_parse_float(uint8_t *data, int length)
assert(length == 4 || length == 8);
uint64_t i = ebml_parse_uint(data, length);
if (length == 4)
- return av_int2flt(i);
+ return av_int2float(i);
else
- return av_int2dbl(i);
+ return av_int2double(i);
}
diff --git a/libvo/vo_png.c b/libvo/vo_png.c
index 5ad683ad22..da08bb379e 100644
--- a/libvo/vo_png.c
+++ b/libvo/vo_png.c
@@ -165,13 +165,20 @@ static int preinit(const char *arg)
if (subopt_parse(arg, subopts) != 0) {
return -1;
}
- avctx = avcodec_alloc_context();
- if (avcodec_open(avctx, avcodec_find_encoder(CODEC_ID_PNG)) < 0) {
- uninit();
- return -1;
- }
+ struct AVCodec *png_codec = avcodec_find_encoder(CODEC_ID_PNG);
+ if (!png_codec)
+ goto error;
+ avctx = avcodec_alloc_context3(png_codec);
+ if (!avctx)
+ goto error;
+ if (avcodec_open2(avctx, png_codec, NULL) < 0)
+ goto error;
avctx->compression_level = z_compression;
return 0;
+
+ error:
+ uninit();
+ return -1;
}
static int control(uint32_t request, void *data)
diff --git a/screenshot.c b/screenshot.c
index 9b8c67a89a..55107bf930 100644
--- a/screenshot.c
+++ b/screenshot.c
@@ -68,11 +68,15 @@ static int write_png(screenshot_ctx *ctx, struct mp_image *image)
void *outbuffer = NULL;
int success = 0;
- AVCodecContext *avctx = avcodec_alloc_context();
+ struct AVCodec *png_codec = avcodec_find_encoder(CODEC_ID_PNG);
+ AVCodecContext *avctx = NULL;
+ if (!png_codec)
+ goto print_open_fail;
+ avctx = avcodec_alloc_context3(png_codec);
if (!avctx)
- goto error_exit;
-
- if (avcodec_open(avctx, avcodec_find_encoder(CODEC_ID_PNG))) {
+ goto print_open_fail;
+ if (avcodec_open2(avctx, png_codec, NULL) < 0) {
+ print_open_fail:
mp_msg(MSGT_CPLAYER, MSGL_INFO, "Could not open libavcodec PNG encoder"
" for saving screenshot\n");
goto error_exit;
diff --git a/stream/stream_ffmpeg.c b/stream/stream_ffmpeg.c
index 74e9db791c..a76b9e5f3b 100644
--- a/stream/stream_ffmpeg.c
+++ b/stream/stream_ffmpeg.c
@@ -101,9 +101,9 @@ static int open_f(stream_t *stream, int mode, void *opts, int *file_format)
int dummy;
if (mode == STREAM_READ)
- flags = URL_RDONLY;
+ flags = AVIO_FLAG_READ;
else if (mode == STREAM_WRITE)
- flags = URL_WRONLY;
+ flags = AVIO_FLAG_WRITE;
else {
mp_msg(MSGT_OPEN, MSGL_ERR, "[ffmpeg] Unknown open mode %d\n", mode);
res = STREAM_UNSUPPORTED;
diff --git a/sub/av_sub.c b/sub/av_sub.c
index 0d8c14db60..3a9e1b4f26 100644
--- a/sub/av_sub.c
+++ b/sub/av_sub.c
@@ -63,9 +63,14 @@ int decode_avsub(struct sh_sub *sh, uint8_t *data, int size,
pkt.convergence_duration = duration * 1000;
if (!ctx) {
AVCodec *sub_codec;
- ctx = avcodec_alloc_context();
sub_codec = avcodec_find_decoder(cid);
- if (!ctx || !sub_codec || avcodec_open(ctx, sub_codec) < 0) {
+ if (!sub_codec)
+ goto error;
+ ctx = avcodec_alloc_context3(sub_codec);
+ if (!ctx)
+ goto error;
+ if (avcodec_open2(ctx, sub_codec, NULL) < 0) {
+ error:
mp_msg(MSGT_SUBREADER, MSGL_FATAL,
"Could not open subtitle decoder\n");
av_freep(&ctx);