[FFmpeg-cvslog] avformat: add AVFormatContext to ff_get_extradata()

Paul B Mahol git at videolan.org
Thu Apr 14 18:30:35 CEST 2016


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Apr 14 18:21:08 2016 +0200| [323b8c95e41094b90ed2a9bdd9a06d22d2f74856] | committer: Paul B Mahol

avformat: add AVFormatContext to ff_get_extradata()

Needed for av_log() inside that function.

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=323b8c95e41094b90ed2a9bdd9a06d22d2f74856
---

 libavformat/adxdec.c       |    2 +-
 libavformat/aiffdec.c      |    2 +-
 libavformat/aixdec.c       |    2 +-
 libavformat/apc.c          |    2 +-
 libavformat/apetag.c       |    2 +-
 libavformat/avidec.c       |    4 ++--
 libavformat/bink.c         |    2 +-
 libavformat/cafdec.c       |    2 +-
 libavformat/flvdec.c       |    2 +-
 libavformat/idcin.c        |    2 +-
 libavformat/internal.h     |    2 +-
 libavformat/isom.c         |    2 +-
 libavformat/mov.c          |   10 +++++-----
 libavformat/mpc.c          |    2 +-
 libavformat/mpc8.c         |    2 +-
 libavformat/nutdec.c       |    2 +-
 libavformat/nuv.c          |    2 +-
 libavformat/riffdec.c      |    4 ++--
 libavformat/rl2.c          |    2 +-
 libavformat/rmdec.c        |    2 +-
 libavformat/rsd.c          |    2 +-
 libavformat/utils.c        |    4 ++--
 libavformat/vc1test.c      |    2 +-
 libavformat/westwood_vqa.c |    2 +-
 24 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
index fd09670..4f83348 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 bb5299c..d191bc4 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 5f40d6b..cad8a1e 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 64c1c6d..a4dcf66 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 53e076f..08e80f4 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 87c9bd4..b114a74 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 56dbf9e..b95c83d 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 91b50c8..1c4ca40 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 04f20db..51c4cd6 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 bfc2051..3900e9e 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 1719deb..40ba089 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 d8a330c..e1ce310 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 42f8834..47af98c 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 ffd1c56..f32d65f 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 288caa0..05d0c1a 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 7286a26..2e309bc 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 57eea9e..cd8268d 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 0b10832..1602c31 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 077da4c..69e8be2 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 2500852..cb0481e 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 e02d767..ee6fdfb 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 d6aba5a..b43cfb1 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 1414426..a801f4b 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 44388d6..88bd7cd 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]);



More information about the ffmpeg-cvslog mailing list