summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2016-04-14 18:21:08 +0200
committerPaul B Mahol <onemda@gmail.com>2016-04-14 18:21:08 +0200
commit323b8c95e41094b90ed2a9bdd9a06d22d2f74856 (patch)
treed0bb264c76b926aa306f9668adfa79361d8a56db
parent8e26bdd59bf559d00c7e60c53fff292de10139ff (diff)
downloadffmpeg-323b8c95e41094b90ed2a9bdd9a06d22d2f74856.tar.gz
avformat: add AVFormatContext to ff_get_extradata()
Needed for av_log() inside that function. Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--libavformat/adxdec.c2
-rw-r--r--libavformat/aiffdec.c2
-rw-r--r--libavformat/aixdec.c2
-rw-r--r--libavformat/apc.c2
-rw-r--r--libavformat/apetag.c2
-rw-r--r--libavformat/avidec.c4
-rw-r--r--libavformat/bink.c2
-rw-r--r--libavformat/cafdec.c2
-rw-r--r--libavformat/flvdec.c2
-rw-r--r--libavformat/idcin.c2
-rw-r--r--libavformat/internal.h2
-rw-r--r--libavformat/isom.c2
-rw-r--r--libavformat/mov.c10
-rw-r--r--libavformat/mpc.c2
-rw-r--r--libavformat/mpc8.c2
-rw-r--r--libavformat/nutdec.c2
-rw-r--r--libavformat/nuv.c2
-rw-r--r--libavformat/riffdec.c4
-rw-r--r--libavformat/rl2.c2
-rw-r--r--libavformat/rmdec.c2
-rw-r--r--libavformat/rsd.c2
-rw-r--r--libavformat/utils.c4
-rw-r--r--libavformat/vc1test.c2
-rw-r--r--libavformat/westwood_vqa.c2
24 files changed, 31 insertions, 31 deletions
diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
index fd096702c9..4f83348afd 100644
--- a/libavformat/adxdec.c
+++ b/libavformat/adxdec.c
@@ -94,7 +94,7 @@ static int adx_read_header(AVFormatContext *s)
c->header_size = avio_rb16(s->pb) + 4;
avio_seek(s->pb, -4, SEEK_CUR);
- if (ff_get_extradata(par, s->pb, c->header_size) < 0)
+ if (ff_get_extradata(s, par, s->pb, c->header_size) < 0)
return AVERROR(ENOMEM);
if (par->extradata_size < 12) {
diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index bb5299c06f..d191bc4c04 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -299,7 +299,7 @@ static int aiff_read_header(AVFormatContext *s)
case MKTAG('w', 'a', 'v', 'e'):
if ((uint64_t)size > (1<<30))
return -1;
- if (ff_get_extradata(st->codecpar, pb, size) < 0)
+ if (ff_get_extradata(s, st->codecpar, pb, size) < 0)
return AVERROR(ENOMEM);
if (st->codecpar->codec_id == AV_CODEC_ID_QDM2 && size>=12*4 && !st->codecpar->block_align) {
st->codecpar->block_align = AV_RB32(st->codecpar->extradata+11*4);
diff --git a/libavformat/aixdec.c b/libavformat/aixdec.c
index 5f40d6bdcf..cad8a1e116 100644
--- a/libavformat/aixdec.c
+++ b/libavformat/aixdec.c
@@ -77,7 +77,7 @@ static int aix_read_header(AVFormatContext *s)
if (size <= 8)
return AVERROR_INVALIDDATA;
avio_skip(s->pb, 8);
- ff_get_extradata(s->streams[i]->codecpar, s->pb, size - 8);
+ ff_get_extradata(s, s->streams[i]->codecpar, s->pb, size - 8);
}
return 0;
diff --git a/libavformat/apc.c b/libavformat/apc.c
index 64c1c6db3e..a4dcf660e5 100644
--- a/libavformat/apc.c
+++ b/libavformat/apc.c
@@ -53,7 +53,7 @@ static int apc_read_header(AVFormatContext *s)
st->codecpar->sample_rate = avio_rl32(pb);
/* initial predictor values for adpcm decoder */
- if (ff_get_extradata(st->codecpar, pb, 2 * 4) < 0)
+ if (ff_get_extradata(s, st->codecpar, pb, 2 * 4) < 0)
return AVERROR(ENOMEM);
if (avio_rl32(pb)) {
diff --git a/libavformat/apetag.c b/libavformat/apetag.c
index 53e076fb8b..08e80f4aa3 100644
--- a/libavformat/apetag.c
+++ b/libavformat/apetag.c
@@ -96,7 +96,7 @@ static int ape_tag_read_field(AVFormatContext *s)
st->attached_pic.stream_index = st->index;
st->attached_pic.flags |= AV_PKT_FLAG_KEY;
} else {
- if (ff_get_extradata(st->codecpar, s->pb, size) < 0)
+ if (ff_get_extradata(s, st->codecpar, s->pb, size) < 0)
return AVERROR(ENOMEM);
st->codecpar->codec_type = AVMEDIA_TYPE_ATTACHMENT;
}
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 87c9bd4951..b114a744bf 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -762,7 +762,7 @@ static int avi_read_header(AVFormatContext *s)
st->codecpar->extradata_size = esize - 10 * 4;
} else
st->codecpar->extradata_size = size - 10 * 4;
- if (ff_get_extradata(st->codecpar, pb, st->codecpar->extradata_size) < 0)
+ if (ff_get_extradata(s, st->codecpar, pb, st->codecpar->extradata_size) < 0)
return AVERROR(ENOMEM);
}
@@ -917,7 +917,7 @@ static int avi_read_header(AVFormatContext *s)
st = s->streams[stream_index];
if (size<(1<<30)) {
- if (ff_get_extradata(st->codecpar, pb, size) < 0)
+ if (ff_get_extradata(s, st->codecpar, pb, size) < 0)
return AVERROR(ENOMEM);
}
diff --git a/libavformat/bink.c b/libavformat/bink.c
index 56dbf9e1c1..b95c83d97d 100644
--- a/libavformat/bink.c
+++ b/libavformat/bink.c
@@ -129,7 +129,7 @@ static int read_header(AVFormatContext *s)
vst->codecpar->codec_id = AV_CODEC_ID_NONE;
}
- if (ff_get_extradata(vst->codecpar, pb, 4) < 0)
+ if (ff_get_extradata(s, vst->codecpar, pb, 4) < 0)
return AVERROR(ENOMEM);
bink->num_audio_tracks = avio_rl32(pb);
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 91b50c8199..1c4ca401c2 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -168,7 +168,7 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size)
}
} else {
av_freep(&st->codecpar->extradata);
- if (ff_get_extradata(st->codecpar, pb, size) < 0)
+ if (ff_get_extradata(s, st->codecpar, pb, size) < 0)
return AVERROR(ENOMEM);
}
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 04f20db1a5..51c4cd6cec 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -659,7 +659,7 @@ static int flv_read_close(AVFormatContext *s)
static int flv_get_extradata(AVFormatContext *s, AVStream *st, int size)
{
av_freep(&st->codecpar->extradata);
- if (ff_get_extradata(st->codecpar, s->pb, size) < 0)
+ if (ff_get_extradata(s, st->codecpar, s->pb, size) < 0)
return AVERROR(ENOMEM);
return 0;
}
diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index bfc2051d9d..3900e9eddb 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -205,7 +205,7 @@ static int idcin_read_header(AVFormatContext *s)
st->codecpar->height = height;
/* load up the Huffman tables into extradata */
- if ((ret = ff_get_extradata(st->codecpar, pb, HUFFMAN_TABLE_SIZE)) < 0)
+ if ((ret = ff_get_extradata(s, st->codecpar, pb, HUFFMAN_TABLE_SIZE)) < 0)
return ret;
if (idcin->audio_present) {
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 1719deb219..40ba0899b5 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -522,7 +522,7 @@ int ff_alloc_extradata(AVCodecParameters *par, int size);
* @param size size of extradata
* @return >= 0 if OK, AVERROR_xxx on error
*/
-int ff_get_extradata(AVCodecParameters *par, AVIOContext *pb, int size);
+int ff_get_extradata(AVFormatContext *s, AVCodecParameters *par, AVIOContext *pb, int size);
/**
* add frame for rfps calculation.
diff --git a/libavformat/isom.c b/libavformat/isom.c
index d8a330c0b2..e1ce310b1d 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -482,7 +482,7 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext
if (!len || (uint64_t)len > (1<<30))
return -1;
av_free(st->codecpar->extradata);
- if ((ret = ff_get_extradata(st->codecpar, pb, len)) < 0)
+ if ((ret = ff_get_extradata(fc, st->codecpar, pb, len)) < 0)
return ret;
if (st->codecpar->codec_id == AV_CODEC_ID_AAC) {
MPEG4AudioConfig cfg = {0};
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 42f8834771..47af98cead 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1568,7 +1568,7 @@ static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom)
st->codecpar->codec_id == AV_CODEC_ID_SPEEX) {
// pass all frma atom to codec, needed at least for QDMC and QDM2
av_freep(&st->codecpar->extradata);
- ret = ff_get_extradata(st->codecpar, pb, atom.size);
+ ret = ff_get_extradata(c->fc, st->codecpar, pb, atom.size);
if (ret < 0)
return ret;
} else if (atom.size > 8) { /* to read frma, esds atoms */
@@ -1635,7 +1635,7 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return 0;
}
av_freep(&st->codecpar->extradata);
- ret = ff_get_extradata(st->codecpar, pb, atom.size);
+ ret = ff_get_extradata(c->fc, st->codecpar, pb, atom.size);
if (ret < 0)
return ret;
@@ -1661,7 +1661,7 @@ static int mov_read_dvc1(MOVContext *c, AVIOContext *pb, MOVAtom atom)
avio_seek(pb, 6, SEEK_CUR);
av_freep(&st->codecpar->extradata);
- ret = ff_get_extradata(st->codecpar, pb, atom.size - 7);
+ ret = ff_get_extradata(c->fc, st->codecpar, pb, atom.size - 7);
if (ret < 0)
return ret;
@@ -1689,7 +1689,7 @@ static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom)
avio_skip(pb, 40);
av_freep(&st->codecpar->extradata);
- ret = ff_get_extradata(st->codecpar, pb, atom.size - 40);
+ ret = ff_get_extradata(c->fc, st->codecpar, pb, atom.size - 40);
if (ret < 0)
return ret;
@@ -2028,7 +2028,7 @@ static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb,
if ((int)size != size)
return AVERROR(ENOMEM);
- ret = ff_get_extradata(st->codecpar, pb, size);
+ ret = ff_get_extradata(c->fc, st->codecpar, pb, size);
if (ret < 0)
return ret;
if (size > 16) {
diff --git a/libavformat/mpc.c b/libavformat/mpc.c
index ffd1c56c1c..f32d65fa55 100644
--- a/libavformat/mpc.c
+++ b/libavformat/mpc.c
@@ -95,7 +95,7 @@ static int mpc_read_header(AVFormatContext *s)
st->codecpar->channel_layout = AV_CH_LAYOUT_STEREO;
st->codecpar->bits_per_coded_sample = 16;
- if (ff_get_extradata(st->codecpar, s->pb, 16) < 0)
+ if (ff_get_extradata(s, st->codecpar, s->pb, 16) < 0)
return AVERROR(ENOMEM);
st->codecpar->sample_rate = mpc_rate[st->codecpar->extradata[2] & 3];
avpriv_set_pts_info(st, 32, MPC_FRAMESIZE, st->codecpar->sample_rate);
diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c
index 288caa0639..05d0c1ae86 100644
--- a/libavformat/mpc8.c
+++ b/libavformat/mpc8.c
@@ -252,7 +252,7 @@ static int mpc8_read_header(AVFormatContext *s)
st->codecpar->codec_id = AV_CODEC_ID_MUSEPACK8;
st->codecpar->bits_per_coded_sample = 16;
- if (ff_get_extradata(st->codecpar, pb, 2) < 0)
+ if (ff_get_extradata(s, st->codecpar, pb, 2) < 0)
return AVERROR(ENOMEM);
st->codecpar->channels = (st->codecpar->extradata[1] >> 4) + 1;
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 7286a26e17..2e309bcad7 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -463,7 +463,7 @@ static int decode_stream_header(NUTContext *nut)
GET_V(st->codecpar->extradata_size, tmp < (1 << 30));
if (st->codecpar->extradata_size) {
- if (ff_get_extradata(st->codecpar, bc, st->codecpar->extradata_size) < 0)
+ if (ff_get_extradata(s, st->codecpar, bc, st->codecpar->extradata_size) < 0)
return AVERROR(ENOMEM);
}
diff --git a/libavformat/nuv.c b/libavformat/nuv.c
index 57eea9e604..cd8268d2a5 100644
--- a/libavformat/nuv.c
+++ b/libavformat/nuv.c
@@ -87,7 +87,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst,
av_freep(&vst->codecpar->extradata);
vst->codecpar->extradata_size = 0;
}
- if (ff_get_extradata(vst->codecpar, pb, size) < 0)
+ if (ff_get_extradata(NULL, vst->codecpar, pb, size) < 0)
return AVERROR(ENOMEM);
size = 0;
if (!myth)
diff --git a/libavformat/riffdec.c b/libavformat/riffdec.c
index 0b1083264f..1602c31169 100644
--- a/libavformat/riffdec.c
+++ b/libavformat/riffdec.c
@@ -143,7 +143,7 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb,
}
if (cbSize > 0) {
av_freep(&par->extradata);
- if (ff_get_extradata(par, pb, cbSize) < 0)
+ if (ff_get_extradata(s, par, pb, cbSize) < 0)
return AVERROR(ENOMEM);
size -= cbSize;
}
@@ -156,7 +156,7 @@ int ff_get_wav_header(AVFormatContext *s, AVIOContext *pb,
size -= 4;
av_freep(&par->extradata);
- if (ff_get_extradata(par, pb, size) < 0)
+ if (ff_get_extradata(s, par, pb, size) < 0)
return AVERROR(ENOMEM);
nb_streams = AV_RL16(par->extradata + 4);
par->sample_rate = AV_RL32(par->extradata + 12);
diff --git a/libavformat/rl2.c b/libavformat/rl2.c
index 077da4cb0e..69e8be2e57 100644
--- a/libavformat/rl2.c
+++ b/libavformat/rl2.c
@@ -127,7 +127,7 @@ static av_cold int rl2_read_header(AVFormatContext *s)
if(signature == RLV3_TAG && back_size > 0)
st->codecpar->extradata_size += back_size;
- if(ff_get_extradata(st->codecpar, pb, st->codecpar->extradata_size) < 0)
+ if(ff_get_extradata(s, st->codecpar, pb, st->codecpar->extradata_size) < 0)
return AVERROR(ENOMEM);
/** setup audio stream if present */
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 2500852767..cb0481ed4d 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -93,7 +93,7 @@ static int rm_read_extradata(AVFormatContext *s, AVIOContext *pb, AVCodecParamet
av_log(s, AV_LOG_ERROR, "extradata size %u too large\n", size);
return -1;
}
- if (ff_get_extradata(par, pb, size) < 0)
+ if (ff_get_extradata(s, par, pb, size) < 0)
return AVERROR(ENOMEM);
return 0;
}
diff --git a/libavformat/rsd.c b/libavformat/rsd.c
index e02d767a01..ee6fdfbeb1 100644
--- a/libavformat/rsd.c
+++ b/libavformat/rsd.c
@@ -127,7 +127,7 @@ static int rsd_read_header(AVFormatContext *s)
start = avio_rl32(pb);
- if ((ret = ff_get_extradata(par, s->pb, 32)) < 0)
+ if ((ret = ff_get_extradata(s, par, s->pb, 32)) < 0)
return ret;
if (pb->seekable)
st->duration = av_get_audio_frame_duration2(par, avio_size(pb) - start);
diff --git a/libavformat/utils.c b/libavformat/utils.c
index d6aba5a237..b43cfb1eee 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3117,7 +3117,7 @@ int ff_alloc_extradata(AVCodecParameters *par, int size)
return ret;
}
-int ff_get_extradata(AVCodecParameters *par, AVIOContext *pb, int size)
+int ff_get_extradata(AVFormatContext *s, AVCodecParameters *par, AVIOContext *pb, int size)
{
int ret = ff_alloc_extradata(par, size);
if (ret < 0)
@@ -3126,7 +3126,7 @@ int ff_get_extradata(AVCodecParameters *par, AVIOContext *pb, int size)
if (ret != size) {
av_freep(&par->extradata);
par->extradata_size = 0;
- av_log(par, AV_LOG_ERROR, "Failed to read extradata of size %d\n", size);
+ av_log(s, AV_LOG_ERROR, "Failed to read extradata of size %d\n", size);
return ret < 0 ? ret : AVERROR_INVALIDDATA;
}
diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c
index 1414426d02..a801f4bd22 100644
--- a/libavformat/vc1test.c
+++ b/libavformat/vc1test.c
@@ -61,7 +61,7 @@ static int vc1t_read_header(AVFormatContext *s)
st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
st->codecpar->codec_id = AV_CODEC_ID_WMV3;
- if (ff_get_extradata(st->codecpar, pb, VC1_EXTRADATA_SIZE) < 0)
+ if (ff_get_extradata(s, st->codecpar, pb, VC1_EXTRADATA_SIZE) < 0)
return AVERROR(ENOMEM);
st->codecpar->height = avio_rl32(pb);
st->codecpar->width = avio_rl32(pb);
diff --git a/libavformat/westwood_vqa.c b/libavformat/westwood_vqa.c
index 44388d6413..88bd7cd602 100644
--- a/libavformat/westwood_vqa.c
+++ b/libavformat/westwood_vqa.c
@@ -101,7 +101,7 @@ static int wsvqa_read_header(AVFormatContext *s)
avio_seek(pb, 20, SEEK_SET);
/* the VQA header needs to go to the decoder */
- if (ff_get_extradata(st->codecpar, pb, VQA_HEADER_SIZE) < 0)
+ if (ff_get_extradata(s, st->codecpar, pb, VQA_HEADER_SIZE) < 0)
return AVERROR(ENOMEM);
header = st->codecpar->extradata;
st->codecpar->width = AV_RL16(&header[6]);