Use the `avio_` namespace as per all the other functions using an
AVIOContext.
---

Since we are at it... (version not bumped on purpose)

 doc/APIchanges               |  4 +++
 libavformat/4xm.c            |  2 +-
 libavformat/adxdec.c         |  2 +-
 libavformat/aea.c            |  2 +-
 libavformat/aiffdec.c        |  2 +-
 libavformat/anm.c            |  2 +-
 libavformat/apc.c            |  2 +-
 libavformat/apetag.c         |  2 +-
 libavformat/asfdec.c         |  4 +--
 libavformat/au.c             |  2 +-
 libavformat/avformat.h       | 32 +++++++++++++++++++
 libavformat/avidec.c         |  2 +-
 libavformat/aviobuf.c        | 60 +++++++++++++++++++++++++++++++++++
 libavformat/bethsoftvid.c    |  2 +-
 libavformat/bfi.c            |  4 +--
 libavformat/bink.c           |  4 +--
 libavformat/cafdec.c         |  2 +-
 libavformat/cdg.c            |  2 +-
 libavformat/cdxl.c           |  2 +-
 libavformat/dauddec.c        |  2 +-
 libavformat/dfa.c            |  6 ++--
 libavformat/dsicin.c         |  2 +-
 libavformat/dxa.c            |  2 +-
 libavformat/eacdata.c        |  2 +-
 libavformat/electronicarts.c |  4 +--
 libavformat/filmstripdec.c   |  2 +-
 libavformat/flvdec.c         |  4 +--
 libavformat/gsmdec.c         |  2 +-
 libavformat/gxf.c            |  2 +-
 libavformat/hnm.c            |  2 +-
 libavformat/idcin.c          |  4 +--
 libavformat/idroqdec.c       |  2 +-
 libavformat/iff.c            |  2 +-
 libavformat/ipmovie.c        |  2 +-
 libavformat/iss.c            |  2 +-
 libavformat/iv8.c            |  4 +--
 libavformat/ivfdec.c         |  2 +-
 libavformat/jvdec.c          |  2 +-
 libavformat/lmlm4.c          |  2 +-
 libavformat/mm.c             |  2 +-
 libavformat/mov.c            |  4 +--
 libavformat/mp3dec.c         |  2 +-
 libavformat/mpc8.c           |  2 +-
 libavformat/mpeg.c           |  2 +-
 libavformat/mpjpegdec.c      |  2 +-
 libavformat/msnwc_tcp.c      |  2 +-
 libavformat/mtv.c            |  4 +--
 libavformat/mvdec.c          |  2 +-
 libavformat/mvi.c            |  4 +--
 libavformat/mxfdec.c         |  8 ++---
 libavformat/ncdec.c          |  2 +-
 libavformat/nsvdec.c         |  4 +--
 libavformat/nuv.c            |  2 +-
 libavformat/omadec.c         |  2 +-
 libavformat/pcmdec.c         |  2 +-
 libavformat/pmpdec.c         |  2 +-
 libavformat/pva.c            |  2 +-
 libavformat/qcp.c            |  2 +-
 libavformat/r3d.c            |  4 +--
 libavformat/rawvideodec.c    |  2 +-
 libavformat/rl2.c            |  2 +-
 libavformat/rmdec.c          |  6 ++--
 libavformat/rpl.c            |  4 +--
 libavformat/rsodec.c         |  2 +-
 libavformat/segafilm.c       |  2 +-
 libavformat/siff.c           |  4 +--
 libavformat/smjpegdec.c      |  4 +--
 libavformat/smush.c          |  6 ++--
 libavformat/sol.c            |  2 +-
 libavformat/soxdec.c         |  2 +-
 libavformat/swfdec.c         |  6 ++--
 libavformat/takdec.c         |  2 +-
 libavformat/thp.c            |  4 +--
 libavformat/tiertexseq.c     |  2 +-
 libavformat/tmv.c            |  2 +-
 libavformat/tta.c            |  2 +-
 libavformat/tty.c            |  2 +-
 libavformat/txd.c            |  2 +-
 libavformat/utils.c          | 74 +++++++++-----------------------------------
 libavformat/vc1test.c        |  2 +-
 libavformat/version.h        |  3 ++
 libavformat/vocdec.c         |  2 +-
 libavformat/wavdec.c         |  2 +-
 libavformat/wc3movie.c       |  8 ++---
 libavformat/westwood_aud.c   |  2 +-
 libavformat/wtv.c            |  2 +-
 libavformat/xa.c             |  2 +-
 libavformat/xmv.c            |  2 +-
 libavformat/xwma.c           |  2 +-
 libavformat/yop.c            |  2 +-
 libavformat/yuv4mpegdec.c    |  2 +-
 91 files changed, 229 insertions(+), 176 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 26f8816..c637146 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,10 @@ libavutil:     2015-08-28

 API changes, most recent first:

+2015-xx-xx - xxxxxxx - lavf 57.0.0 - avformat.h
+  Add avio_get_packet and avio_append_packet, they replace
+  av_get_packet and av_append_packet.
+
 2015-xx-xx - xxxxxxx - lavu 55.2.0 - dict.h
   Change return type of av_dict_copy() from void to int, so that a proper
   error code can be reported.
diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index 5eaf985..530863f 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -320,7 +320,7 @@ static int fourxm_read_packet(AVFormatContext *s,

             if (track_number < fourxm->track_count &&
                 fourxm->tracks[track_number].channels > 0) {
-                ret = av_get_packet(s->pb, pkt, size);
+                ret = avio_get_packet(s->pb, pkt, size);
                 if (ret < 0)
                     return AVERROR(EIO);
                 pkt->stream_index =
diff --git a/libavformat/adxdec.c b/libavformat/adxdec.c
index c7bd33a..8d9cb81 100644
--- a/libavformat/adxdec.c
+++ b/libavformat/adxdec.c
@@ -45,7 +45,7 @@ static int adx_read_packet(AVFormatContext *s, AVPacket *pkt)
     pkt->pos = avio_tell(s->pb);
     pkt->stream_index = 0;

-    ret = av_get_packet(s->pb, pkt, size);
+    ret = avio_get_packet(s->pb, pkt, size);
     if (ret != size) {
         av_packet_unref(pkt);
         return ret < 0 ? ret : AVERROR(EIO);
diff --git a/libavformat/aea.c b/libavformat/aea.c
index c107109..1290c2c 100644
--- a/libavformat/aea.c
+++ b/libavformat/aea.c
@@ -84,7 +84,7 @@ static int aea_read_header(AVFormatContext *s)

 static int aea_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    int ret = av_get_packet(s->pb, pkt, s->streams[0]->codec->block_align);
+    int ret = avio_get_packet(s->pb, pkt, s->streams[0]->codec->block_align);

     pkt->stream_index = 0;
     if (ret <= 0)
diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c
index 04cca5d..f84d08d 100644
--- a/libavformat/aiffdec.c
+++ b/libavformat/aiffdec.c
@@ -310,7 +310,7 @@ static int aiff_read_packet(AVFormatContext *s,
     else
         size = (MAX_SIZE / st->codec->block_align) * st->codec->block_align;
     size = FFMIN(max_size, size);
-    res = av_get_packet(s->pb, pkt, size);
+    res = avio_get_packet(s->pb, pkt, size);
     if (res < 0)
         return res;

diff --git a/libavformat/anm.c b/libavformat/anm.c
index 69a1374..0b29d9e 100644
--- a/libavformat/anm.c
+++ b/libavformat/anm.c
@@ -209,7 +209,7 @@ repeat:
     avio_seek(pb, tmp, SEEK_SET);

     /* fetch record */
-    pkt->size = av_get_packet(s->pb, pkt, record_size);
+    pkt->size = avio_get_packet(s->pb, pkt, record_size);
     if (pkt->size < 0)
         return pkt->size;
     if (p->base_record + anm->record == 0)
diff --git a/libavformat/apc.c b/libavformat/apc.c
index 58fd9f8..7a58326 100644
--- a/libavformat/apc.c
+++ b/libavformat/apc.c
@@ -80,7 +80,7 @@ static int apc_read_header(AVFormatContext *s)

 static int apc_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
-    if (av_get_packet(s->pb, pkt, MAX_READ_SIZE) <= 0)
+    if (avio_get_packet(s->pb, pkt, MAX_READ_SIZE) <= 0)
         return AVERROR(EIO);
     pkt->stream_index = 0;
     return 0;
diff --git a/libavformat/apetag.c b/libavformat/apetag.c
index 5591555..9f0dccd 100644
--- a/libavformat/apetag.c
+++ b/libavformat/apetag.c
@@ -80,7 +80,7 @@ static int ape_tag_read_field(AVFormatContext *s)
             AVPacket pkt;
             int ret;

-            ret = av_get_packet(s->pb, &pkt, size);
+            ret = avio_get_packet(s->pb, &pkt, size);
             if (ret < 0) {
                 av_log(s, AV_LOG_ERROR, "Error reading cover art.\n");
                 return ret;
diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c
index e1b0b8c..35c5185 100644
--- a/libavformat/asfdec.c
+++ b/libavformat/asfdec.c
@@ -406,7 +406,7 @@ static int asf_read_picture(AVFormatContext *s, int len)
         return AVERROR(ENOMEM);
     len -= avio_get_str16le(s->pb, len - picsize, desc, desc_len);

-    ret = av_get_packet(s->pb, &pkt, picsize);
+    ret = avio_get_packet(s->pb, &pkt, picsize);
     if (ret < 0)
         goto fail;

@@ -1082,7 +1082,7 @@ static int asf_read_subpayload(AVFormatContext *s, 
AVPacket *pkt, int is_header)
         asf->sub_left = 1;
     }
     sub_len = avio_r8(pb);
-    if ((ret = av_get_packet(pb, pkt, sub_len)) < 0) // each subpayload is 
entire frame
+    if ((ret = avio_get_packet(pb, pkt, sub_len)) < 0) // each subpayload is 
entire frame
         return ret;
     for (i = 0; i < asf->nb_streams; i++) {
         if (asf->stream_index == asf->asf_st[i]->stream_index) {
diff --git a/libavformat/au.c b/libavformat/au.c
index e682cbf..5dcb1d2 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -126,7 +126,7 @@ static int au_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     int ret;

-    ret = av_get_packet(s->pb, pkt, BLOCK_SIZE *
+    ret = avio_get_packet(s->pb, pkt, BLOCK_SIZE *
                         s->streams[0]->codec->block_align);
     if (ret < 0)
         return ret;
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 470bbc6..24c45b3 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -356,6 +356,36 @@ struct AVFormatContext;
  * @param size desired payload size
  * @return >0 (read size) if OK, AVERROR_xxx otherwise
  */
+int avio_get_packet(AVIOContext *s, AVPacket *pkt, int size);
+
+/**
+ * Read data and append it to the current content of the AVPacket.
+ * If pkt->size is 0 this is identical to av_get_packet.
+ * Note that this uses av_grow_packet and thus involves a realloc
+ * which is inefficient. Thus this function should only be used
+ * when there is no reasonable way to know (an upper bound of)
+ * the final size.
+ *
+ * @param s    associated IO context
+ * @param pkt packet
+ * @param size amount of data to read
+ * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data
+ *         will not be lost even if an error occurs.
+ */
+int avio_append_packet(AVIOContext *s, AVPacket *pkt, int size);
+
+#if FF_API_LAVF_AVPACKET_OLD_API
+
+/**
+ * Allocate and read the payload of a packet and initialize its
+ * fields with default values.
+ *
+ * @param s    associated IO context
+ * @param pkt packet
+ * @param size desired payload size
+ * @return >0 (read size) if OK, AVERROR_xxx otherwise
+ * @deprecated Use avio_get_packet
+ */
 int av_get_packet(AVIOContext *s, AVPacket *pkt, int size);


@@ -372,8 +402,10 @@ int av_get_packet(AVIOContext *s, AVPacket *pkt, int size);
  * @param size amount of data to read
  * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data
  *         will not be lost even if an error occurs.
+ * @deprecated Use avio_append_packet
  */
 int av_append_packet(AVIOContext *s, AVPacket *pkt, int size);
+#endif

 #if FF_API_LAVF_FRAC
 /*************************************************/
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 659bfa7..c10b55c 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -1190,7 +1190,7 @@ resync:
         if (size > ast->remaining)
             size = ast->remaining;
         avi->last_pkt_pos = avio_tell(pb);
-        err               = av_get_packet(pb, pkt, size);
+        err               = avio_get_packet(pb, pkt, size);
         if (err < 0)
             return err;

diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index bb575ed..6541f69 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -1049,3 +1049,63 @@ int ffio_close_null_buf(AVIOContext *s)
     av_free(s);
     return size;
 }
+
+/* an arbitrarily chosen "sane" max packet size -- 50M */
+#define SANE_CHUNK_SIZE (50000000)
+
+/* Read the data in sane-sized chunks and append to pkt.
+ * Return the number of bytes read or an error. */
+static int append_packet_chunked(AVIOContext *s, AVPacket *pkt, int size)
+{
+    int64_t chunk_size = size;
+    int64_t orig_pos   = pkt->pos; // av_grow_packet might reset pos
+    int orig_size      = pkt->size;
+    int ret = 0;
+
+    do {
+        int prev_size = pkt->size;
+        int read_size;
+
+        /* When the caller requests a lot of data, limit it to the amount
+         * left in file or SANE_CHUNK_SIZE when it is not known. */
+        if (size > SANE_CHUNK_SIZE) {
+            int64_t filesize = avio_size(s) - avio_tell(s);
+            chunk_size = FFMAX(filesize, SANE_CHUNK_SIZE);
+        }
+        read_size = FFMIN(size, chunk_size);
+
+        ret = av_grow_packet(pkt, read_size);
+        if (ret < 0)
+            break;
+
+        ret = avio_read(s, pkt->data + prev_size, read_size);
+        if (ret != read_size) {
+            av_shrink_packet(pkt, prev_size + FFMAX(ret, 0));
+            break;
+        }
+
+        size -= read_size;
+    } while (size > 0);
+
+    pkt->pos = orig_pos;
+    if (!pkt->size)
+        av_packet_unref(pkt);
+    return pkt->size > orig_size ? pkt->size - orig_size : ret;
+}
+
+int avio_get_packet(AVIOContext *s, AVPacket *pkt, int size)
+{
+    av_init_packet(pkt);
+    pkt->data = NULL;
+    pkt->size = 0;
+    pkt->pos  = avio_tell(s);
+
+    return append_packet_chunked(s, pkt, size);
+}
+
+int avio_append_packet(AVIOContext *s, AVPacket *pkt, int size)
+{
+    if (!pkt->size)
+        return avio_get_packet(s, pkt, size);
+    return append_packet_chunked(s, pkt, size);
+}
diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c
index 135a3c4..401acd4 100644
--- a/libavformat/bethsoftvid.c
+++ b/libavformat/bethsoftvid.c
@@ -251,7 +251,7 @@ static int vid_read_packet(AVFormatContext *s,
                 avpriv_set_pts_info(st, 64, 1, vid->sample_rate);
             }
             audio_length = avio_rl16(pb);
-            if ((ret_value = av_get_packet(pb, pkt, audio_length)) != 
audio_length) {
+            if ((ret_value = avio_get_packet(pb, pkt, audio_length)) != 
audio_length) {
                 if (ret_value < 0)
                     return ret_value;
                 av_log(s, AV_LOG_ERROR, "incomplete audio block\n");
diff --git a/libavformat/bfi.c b/libavformat/bfi.c
index 19060e7..111aca3 100644
--- a/libavformat/bfi.c
+++ b/libavformat/bfi.c
@@ -138,7 +138,7 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * 
pkt)
         }

         //Tossing an audio packet at the audio decoder.
-        ret = av_get_packet(pb, pkt, audio_size);
+        ret = avio_get_packet(pb, pkt, audio_size);
         if (ret < 0)
             return ret;

@@ -147,7 +147,7 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * 
pkt)
     } else if (bfi->video_size > 0) {

         //Tossing a video packet at the video decoder.
-        ret = av_get_packet(pb, pkt, bfi->video_size);
+        ret = avio_get_packet(pb, pkt, bfi->video_size);
         if (ret < 0)
             return ret;

diff --git a/libavformat/bink.c b/libavformat/bink.c
index 608de24..8be0d75 100644
--- a/libavformat/bink.c
+++ b/libavformat/bink.c
@@ -233,7 +233,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
         bink->current_track++;
         if (audio_size >= 4) {
             /* get one audio packet per track */
-            if ((ret = av_get_packet(pb, pkt, audio_size)) < 0)
+            if ((ret = avio_get_packet(pb, pkt, audio_size)) < 0)
                 return ret;
             pkt->stream_index = bink->current_track;
             pkt->pts = bink->audio_pts[bink->current_track - 1];
@@ -250,7 +250,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     }

     /* get video packet */
-    if ((ret = av_get_packet(pb, pkt, bink->remain_packet_size)) < 0)
+    if ((ret = avio_get_packet(pb, pkt, bink->remain_packet_size)) < 0)
         return ret;
     pkt->stream_index = 0;
     pkt->pts = bink->video_pts++;
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index 36c3967..44a3b30 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -369,7 +369,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     if (pkt_size == 0 || pkt_frames == 0 || pkt_size > left)
         return AVERROR(EIO);

-    res = av_get_packet(pb, pkt, pkt_size);
+    res = avio_get_packet(pb, pkt, pkt_size);
     if (res < 0)
         return res;

diff --git a/libavformat/cdg.c b/libavformat/cdg.c
index 285bfaf..e478689 100644
--- a/libavformat/cdg.c
+++ b/libavformat/cdg.c
@@ -59,7 +59,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     int ret;

     while (1) {
-        ret = av_get_packet(s->pb, pkt, CDG_PACKET_SIZE);
+        ret = avio_get_packet(s->pb, pkt, CDG_PACKET_SIZE);
         if (ret < 1 || (pkt->data[0] & CDG_MASK) == CDG_COMMAND)
             break;
         av_packet_unref(pkt);
diff --git a/libavformat/cdxl.c b/libavformat/cdxl.c
index 366da4b..d6e8b29 100644
--- a/libavformat/cdxl.c
+++ b/libavformat/cdxl.c
@@ -115,7 +115,7 @@ static int cdxl_read_packet(AVFormatContext *s, AVPacket 
*pkt)
             avpriv_set_pts_info(st, 64, 1, cdxl->sample_rate);
         }

-        ret = av_get_packet(pb, pkt, audio_size);
+        ret = avio_get_packet(pb, pkt, audio_size);
         if (ret < 0)
             return ret;
         pkt->stream_index = cdxl->audio_stream_index;
diff --git a/libavformat/dauddec.c b/libavformat/dauddec.c
index 1855e84..7b9e767 100644
--- a/libavformat/dauddec.c
+++ b/libavformat/dauddec.c
@@ -45,7 +45,7 @@ static int daud_packet(AVFormatContext *s, AVPacket *pkt) {
         return AVERROR(EIO);
     size = avio_rb16(pb);
     avio_rb16(pb); // unknown
-    ret = av_get_packet(pb, pkt, size);
+    ret = avio_get_packet(pb, pkt, size);
     pkt->stream_index = 0;
     return ret;
 }
diff --git a/libavformat/dfa.c b/libavformat/dfa.c
index 03dca4f..a19cb44 100644
--- a/libavformat/dfa.c
+++ b/libavformat/dfa.c
@@ -76,11 +76,11 @@ static int dfa_read_packet(AVFormatContext *s, AVPacket 
*pkt)
     if (pb->eof_reached)
         return AVERROR_EOF;

-    if (av_get_packet(pb, pkt, 12) != 12)
+    if (avio_get_packet(pb, pkt, 12) != 12)
         return AVERROR(EIO);
     while (!pb->eof_reached) {
         if (!first) {
-            ret = av_append_packet(pb, pkt, 12);
+            ret = avio_append_packet(pb, pkt, 12);
             if (ret < 0) {
                 av_packet_unref(pkt);
                 return ret;
@@ -101,7 +101,7 @@ static int dfa_read_packet(AVFormatContext *s, AVPacket 
*pkt)
             }
             return 0;
         }
-        ret = av_append_packet(pb, pkt, frame_size);
+        ret = avio_append_packet(pb, pkt, frame_size);
         if (ret < 0) {
             av_packet_unref(pkt);
             return ret;
diff --git a/libavformat/dsicin.c b/libavformat/dsicin.c
index 612289f..bf2adb3 100644
--- a/libavformat/dsicin.c
+++ b/libavformat/dsicin.c
@@ -209,7 +209,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket 
*pkt)
     }

     /* audio packet */
-    ret = av_get_packet(pb, pkt, cin->audio_buffer_size);
+    ret = avio_get_packet(pb, pkt, cin->audio_buffer_size);
     if (ret < 0)
         return ret;

diff --git a/libavformat/dxa.c b/libavformat/dxa.c
index 7d04e7b..ad0ea8c 100644
--- a/libavformat/dxa.c
+++ b/libavformat/dxa.c
@@ -161,7 +161,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket 
*pkt)
         c->readvid = 1;
         avio_seek(s->pb, c->wavpos, SEEK_SET);
         size = FFMIN(c->bytes_left, c->bpc);
-        ret = av_get_packet(s->pb, pkt, size);
+        ret = avio_get_packet(s->pb, pkt, size);
         pkt->stream_index = 1;
         if(ret != size)
             return AVERROR(EIO);
diff --git a/libavformat/eacdata.c b/libavformat/eacdata.c
index c81dec8..173faf4 100644
--- a/libavformat/eacdata.c
+++ b/libavformat/eacdata.c
@@ -84,7 +84,7 @@ static int cdata_read_packet(AVFormatContext *s, AVPacket 
*pkt)
     CdataDemuxContext *cdata = s->priv_data;
     int packet_size = 76*cdata->channels;

-    int ret = av_get_packet(s->pb, pkt, packet_size);
+    int ret = avio_get_packet(s->pb, pkt, packet_size);
     if (ret < 0)
         return ret;
     pkt->pts = cdata->audio_pts++;
diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c
index b3855b6..e4e93ba 100644
--- a/libavformat/electronicarts.c
+++ b/libavformat/electronicarts.c
@@ -554,7 +554,7 @@ static int ea_read_packet(AVFormatContext *s, AVPacket *pkt)
             if (!chunk_size)
                 continue;

-            ret = av_get_packet(pb, pkt, chunk_size);
+            ret = avio_get_packet(pb, pkt, chunk_size);
             if (ret < 0)
                 return ret;
             pkt->stream_index = ea->audio_stream_index;
@@ -630,7 +630,7 @@ get_video_packet:
             if (!chunk_size)
                 continue;

-            ret = av_get_packet(pb, pkt, chunk_size);
+            ret = avio_get_packet(pb, pkt, chunk_size);
             if (ret < 0)
                 return ret;
             pkt->stream_index = ea->video_stream_index;
diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c
index c82656e..48f7905 100644
--- a/libavformat/filmstripdec.c
+++ b/libavformat/filmstripdec.c
@@ -83,7 +83,7 @@ static int read_packet(AVFormatContext *s,
     if (s->pb->eof_reached)
         return AVERROR(EIO);
     pkt->dts = avio_tell(s->pb) / (st->codec->width * (st->codec->height + 
film->leading) * 4);
-    pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height 
* 4);
+    pkt->size = avio_get_packet(s->pb, pkt, st->codec->width * 
st->codec->height * 4);
     avio_skip(s->pb, st->codec->width * (int64_t) film->leading * 4);
     if (pkt->size < 0)
         return pkt->size;
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c
index 2375eb1..11dea80 100644
--- a/libavformat/flvdec.c
+++ b/libavformat/flvdec.c
@@ -692,7 +692,7 @@ static int flv_data_packet(AVFormatContext *s, AVPacket 
*pkt,
         AMFDataType type = avio_r8(pb);
         if (type == AMF_DATA_TYPE_STRING && !strcmp(buf, "text")) {
             length = avio_rb16(pb);
-            ret    = av_get_packet(pb, pkt, length);
+            ret    = avio_get_packet(pb, pkt, length);
             if (ret < 0)
                 goto skip;
             else
@@ -949,7 +949,7 @@ skip:
         goto leave;
     }

-    ret = av_get_packet(s->pb, pkt, size);
+    ret = avio_get_packet(s->pb, pkt, size);
     if (ret < 0)
         return AVERROR(EIO);
     /* note: we need to modify the packet size here to handle the last
diff --git a/libavformat/gsmdec.c b/libavformat/gsmdec.c
index 1bc7eed..729ca2c 100644
--- a/libavformat/gsmdec.c
+++ b/libavformat/gsmdec.c
@@ -43,7 +43,7 @@ static int gsm_read_packet(AVFormatContext *s, AVPacket *pkt)
     pkt->pos = avio_tell(s->pb);
     pkt->stream_index = 0;

-    ret = av_get_packet(s->pb, pkt, size);
+    ret = avio_get_packet(s->pb, pkt, size);
     if (ret < GSM_BLOCK_SIZE) {
         av_packet_unref(pkt);
         return ret < 0 ? ret : AVERROR(EIO);
diff --git a/libavformat/gxf.c b/libavformat/gxf.c
index 1895840..0b51125 100644
--- a/libavformat/gxf.c
+++ b/libavformat/gxf.c
@@ -491,7 +491,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
             } else
                 av_log(s, AV_LOG_ERROR, "invalid first and last sample 
values\n");
         }
-        ret = av_get_packet(pb, pkt, pkt_len);
+        ret = avio_get_packet(pb, pkt, pkt_len);
         if (skip)
             avio_skip(pb, skip);
         pkt->stream_index = stream_index;
diff --git a/libavformat/hnm.c b/libavformat/hnm.c
index 31fc42e..56d5e74 100644
--- a/libavformat/hnm.c
+++ b/libavformat/hnm.c
@@ -163,7 +163,7 @@ static int hnm_read_packet(AVFormatContext *s, AVPacket 
*pkt)
     case HNM4_CHUNK_ID_IZ:
     case HNM4_CHUNK_ID_IU:
         avio_seek(pb, -8, SEEK_CUR);
-        ret += av_get_packet(pb, pkt, chunk_size);
+        ret += avio_get_packet(pb, pkt, chunk_size);
         hnm->superchunk_remaining -= chunk_size;
         if (chunk_id == HNM4_CHUNK_ID_IZ || chunk_id == HNM4_CHUNK_ID_IU)
             hnm->currentframe++;
diff --git a/libavformat/idcin.c b/libavformat/idcin.c
index 32cba3a..732cf58 100644
--- a/libavformat/idcin.c
+++ b/libavformat/idcin.c
@@ -304,7 +304,7 @@ static int idcin_read_packet(AVFormatContext *s,
         /* skip the number of decoded bytes (always equal to width * height) */
         avio_skip(pb, 4);
         chunk_size -= 4;
-        ret= av_get_packet(pb, pkt, chunk_size);
+        ret= avio_get_packet(pb, pkt, chunk_size);
         if (ret < 0)
             return ret;
         else if (ret != chunk_size) {
@@ -332,7 +332,7 @@ static int idcin_read_packet(AVFormatContext *s,
             chunk_size = idcin->audio_chunk_size2;
         else
             chunk_size = idcin->audio_chunk_size1;
-        ret= av_get_packet(pb, pkt, chunk_size);
+        ret= avio_get_packet(pb, pkt, chunk_size);
         if (ret < 0)
             return ret;
         pkt->stream_index = idcin->audio_stream_index;
diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c
index 82eff24..d2ab32b 100644
--- a/libavformat/idroqdec.c
+++ b/libavformat/idroqdec.c
@@ -158,7 +158,7 @@ static int roq_read_packet(AVFormatContext *s,
             avio_seek(pb, codebook_offset, SEEK_SET);

             /* load up the packet */
-            ret= av_get_packet(pb, pkt, chunk_size);
+            ret= avio_get_packet(pb, pkt, chunk_size);
             if (ret != chunk_size)
                 return AVERROR(EIO);
             pkt->stream_index = roq->video_stream_index;
diff --git a/libavformat/iff.c b/libavformat/iff.c
index bf09215..09a98bc 100644
--- a/libavformat/iff.c
+++ b/libavformat/iff.c
@@ -283,7 +283,7 @@ static int iff_read_packet(AVFormatContext *s,
     if(iff->sent_bytes >= iff->body_size)
         return AVERROR_EOF;

-    ret = av_get_packet(pb, pkt, iff->body_size);
+    ret = avio_get_packet(pb, pkt, iff->body_size);
     if (ret < 0)
         return ret;

diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c
index fb5124d..f7e4856 100644
--- a/libavformat/ipmovie.c
+++ b/libavformat/ipmovie.c
@@ -133,7 +133,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext 
*pb,
         avio_seek(pb, s->audio_chunk_offset, SEEK_SET);
         s->audio_chunk_offset = 0;

-        if (s->audio_chunk_size != av_get_packet(pb, pkt, s->audio_chunk_size))
+        if (s->audio_chunk_size != avio_get_packet(pb, pkt, 
s->audio_chunk_size))
             return CHUNK_EOF;

         pkt->stream_index = s->audio_stream_index;
diff --git a/libavformat/iss.c b/libavformat/iss.c
index c86b425..10fa58b 100644
--- a/libavformat/iss.c
+++ b/libavformat/iss.c
@@ -117,7 +117,7 @@ static av_cold int iss_read_header(AVFormatContext *s)
 static int iss_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     IssDemuxContext *iss = s->priv_data;
-    int ret = av_get_packet(s->pb, pkt, iss->packet_size);
+    int ret = avio_get_packet(s->pb, pkt, iss->packet_size);

     if(ret != iss->packet_size)
         return AVERROR(EIO);
diff --git a/libavformat/iv8.c b/libavformat/iv8.c
index ad630b3..5865503 100644
--- a/libavformat/iv8.c
+++ b/libavformat/iv8.c
@@ -82,14 +82,14 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
         }

         if (!first_pkt) {
-            ret = av_get_packet(s->pb, pkt, size);
+            ret = avio_get_packet(s->pb, pkt, size);
             if (ret < 0)
                 return ret;
             first_pkt = 1;
             pkt->pts  = pts;
             pkt->pos -= 16;
         } else {
-            ret = av_append_packet(s->pb, pkt, size);
+            ret = avio_append_packet(s->pb, pkt, size);
             if (ret < 0) {
                 av_log(s, AV_LOG_ERROR, "failed to grow packet\n");
                 av_packet_unref(pkt);
diff --git a/libavformat/ivfdec.c b/libavformat/ivfdec.c
index b3555f4..2c0469c 100644
--- a/libavformat/ivfdec.c
+++ b/libavformat/ivfdec.c
@@ -72,7 +72,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     int ret, size = avio_rl32(s->pb);
     int64_t   pts = avio_rl64(s->pb);

-    ret = av_get_packet(s->pb, pkt, size);
+    ret = avio_get_packet(s->pb, pkt, size);
     pkt->stream_index = 0;
     pkt->pts          = pts;
     pkt->pos         -= 12;
diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c
index 1b1c542..40f3454 100644
--- a/libavformat/jvdec.c
+++ b/libavformat/jvdec.c
@@ -174,7 +174,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
         case JV_AUDIO:
             jv->state++;
             if (jvf->audio_size) {
-                if (av_get_packet(s->pb, pkt, jvf->audio_size) < 0)
+                if (avio_get_packet(s->pb, pkt, jvf->audio_size) < 0)
                     return AVERROR(ENOMEM);
                 pkt->stream_index = 0;
                 pkt->pts          = e->timestamp;
diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c
index 1fb03e7..a940c37 100644
--- a/libavformat/lmlm4.c
+++ b/libavformat/lmlm4.c
@@ -101,7 +101,7 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket 
*pkt)
         return AVERROR(EIO);
     }

-    if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0)
+    if ((ret = avio_get_packet(pb, pkt, frame_size)) <= 0)
         return AVERROR(EIO);

     avio_skip(pb, padding);
diff --git a/libavformat/mm.c b/libavformat/mm.c
index cdf1010..a21fa65 100644
--- a/libavformat/mm.c
+++ b/libavformat/mm.c
@@ -174,7 +174,7 @@ static int read_packet(AVFormatContext *s,
             return 0;

         case MM_TYPE_AUDIO :
-            if (av_get_packet(s->pb, pkt, length)<0)
+            if (avio_get_packet(s->pb, pkt, length)<0)
                 return AVERROR(ENOMEM);
             pkt->size = length;
             pkt->stream_index = 1;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 95dc1ee..f1f8198 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -196,7 +196,7 @@ static int mov_read_covr(MOVContext *c, AVIOContext *pb, 
int type, int len)
         return AVERROR(ENOMEM);
     st->priv_data = sc;

-    ret = av_get_packet(pb, &pkt, len);
+    ret = avio_get_packet(pb, &pkt, len);
     if (ret < 0)
         return ret;

@@ -3486,7 +3486,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket 
*pkt)
                    sc->ffindex, sample->pos);
             return AVERROR_INVALIDDATA;
         }
-        ret = av_get_packet(sc->pb, pkt, sample->size);
+        ret = avio_get_packet(sc->pb, pkt, sample->size);
         if (ret < 0)
             return ret;
         if (sc->has_palette) {
diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index a875b82..df0bdab 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -350,7 +350,7 @@ static int mp3_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 {
     int ret;

-    ret = av_get_packet(s->pb, pkt, MP3_PACKET_SIZE);
+    ret = avio_get_packet(s->pb, pkt, MP3_PACKET_SIZE);
     if (ret < 0)
         return ret;

diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c
index 3bc868e..54a72d9 100644
--- a/libavformat/mpc8.c
+++ b/libavformat/mpc8.c
@@ -278,7 +278,7 @@ static int mpc8_read_packet(AVFormatContext *s, AVPacket 
*pkt)
         if (size < 0)
             return -1;
         if(tag == TAG_AUDIOPACKET){
-            if(av_get_packet(s->pb, pkt, size) < 0)
+            if(avio_get_packet(s->pb, pkt, size) < 0)
                 return AVERROR(ENOMEM);
             pkt->stream_index = 0;
             pkt->duration     = 1;
diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c
index ffabe28..6e6ad96 100644
--- a/libavformat/mpeg.c
+++ b/libavformat/mpeg.c
@@ -524,7 +524,7 @@ skip:
 found:
     if (st->discard >= AVDISCARD_ALL)
         goto skip;
-    ret = av_get_packet(s->pb, pkt, len);
+    ret = avio_get_packet(s->pb, pkt, len);

     pkt->pts          = pts;
     pkt->dts          = dts;
diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c
index fda4c38..a63fa42 100644
--- a/libavformat/mpjpegdec.c
+++ b/libavformat/mpjpegdec.c
@@ -204,7 +204,7 @@ static int mpjpeg_read_packet(AVFormatContext *s, AVPacket 
*pkt)
     if (size < 0)
         return size;

-    ret = av_get_packet(s->pb, pkt, size);
+    ret = avio_get_packet(s->pb, pkt, size);
     if (ret < 0)
         return ret;

diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c
index b6d30fe..3ce53bf 100644
--- a/libavformat/msnwc_tcp.c
+++ b/libavformat/msnwc_tcp.c
@@ -114,7 +114,7 @@ static int msnwc_tcp_read_packet(AVFormatContext *ctx, 
AVPacket *pkt)
     avio_skip(pb, 4);
     timestamp = avio_rl32(pb);

-    if(!size || av_get_packet(pb, pkt, size) != size)
+    if(!size || avio_get_packet(pb, pkt, size) != size)
         return -1;

     avio_skip(pb, 1); /* Read ahead one byte of struct size like read_header */
diff --git a/libavformat/mtv.c b/libavformat/mtv.c
index aad30d7..2f84ec4 100644
--- a/libavformat/mtv.c
+++ b/libavformat/mtv.c
@@ -170,7 +170,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket 
*pkt)
     {
         avio_skip(pb, MTV_AUDIO_PADDING_SIZE);

-        ret = av_get_packet(pb, pkt, MTV_ASUBCHUNK_DATA_SIZE);
+        ret = avio_get_packet(pb, pkt, MTV_ASUBCHUNK_DATA_SIZE);
         if(ret < 0)
             return ret;

@@ -179,7 +179,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket 
*pkt)

     }else
     {
-        ret = av_get_packet(pb, pkt, mtv->img_segment_size);
+        ret = avio_get_packet(pb, pkt, mtv->img_segment_size);
         if(ret < 0)
             return ret;

diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c
index e21ec06..5da2c89 100644
--- a/libavformat/mvdec.c
+++ b/libavformat/mvdec.c
@@ -409,7 +409,7 @@ static int mv_read_packet(AVFormatContext *avctx, AVPacket 
*pkt)
             if (ret < 0)
                 return ret;
         }
-        ret = av_get_packet(pb, pkt, index->size);
+        ret = avio_get_packet(pb, pkt, index->size);
         if (ret < 0)
             return ret;

diff --git a/libavformat/mvi.c b/libavformat/mvi.c
index 4abd1c6..1c3e6f3 100644
--- a/libavformat/mvi.c
+++ b/libavformat/mvi.c
@@ -122,13 +122,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
         count = (mvi->audio_size_counter + mvi->audio_frame_size + 512) >> 
MVI_FRAC_BITS;
         if (count > mvi->audio_size_left)
             count = mvi->audio_size_left;
-        if ((ret = av_get_packet(pb, pkt, count)) < 0)
+        if ((ret = avio_get_packet(pb, pkt, count)) < 0)
             return ret;
         pkt->stream_index = MVI_AUDIO_STREAM_INDEX;
         mvi->audio_size_left -= count;
         mvi->audio_size_counter += mvi->audio_frame_size - (count << 
MVI_FRAC_BITS);
     } else {
-        if ((ret = av_get_packet(pb, pkt, mvi->video_frame_size)) < 0)
+        if ((ret = avio_get_packet(pb, pkt, mvi->video_frame_size)) < 0)
             return ret;
         pkt->stream_index = MVI_VIDEO_STREAM_INDEX;
         mvi->video_frame_size = 0;
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 8678dc1..ad49364 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -314,7 +314,7 @@ static int mxf_get_d10_aes3_packet(AVIOContext *pb, 
AVStream *st, AVPacket *pkt,

     if (length > 61444) /* worst case PAL 1920 samples 8 channels */
         return AVERROR_INVALIDDATA;
-    length = av_get_packet(pb, pkt, length);
+    length = avio_get_packet(pb, pkt, length);
     if (length < 0)
         return length;
     data_ptr = pkt->data;
@@ -382,7 +382,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket 
*pkt, KLVPacket *klv
     if (memcmp(tmpbuf, checkv, 16))
         av_log(s, AV_LOG_ERROR, "probably incorrect decryption key\n");
     size -= 32;
-    size = av_get_packet(pb, pkt, size);
+    size = avio_get_packet(pb, pkt, size);
     if (size < 0)
         return size;
     else if (size < plaintext_size)
@@ -2397,7 +2397,7 @@ static int mxf_read_packet_old(AVFormatContext *s, 
AVPacket *pkt)
                     return ret;
                 }
             } else {
-                ret = av_get_packet(s->pb, pkt, klv.length);
+                ret = avio_get_packet(s->pb, pkt, klv.length);
                 if (ret < 0)
                     return ret;
             }
@@ -2479,7 +2479,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket 
*pkt)
     if ((ret64 = avio_seek(s->pb, pos, SEEK_SET)) < 0)
         return ret64;

-        if ((ret = av_get_packet(s->pb, pkt, size)) != size)
+        if ((ret = avio_get_packet(s->pb, pkt, size)) != size)
             return ret < 0 ? ret : AVERROR_EOF;

     pkt->stream_index = 0;
diff --git a/libavformat/ncdec.c b/libavformat/ncdec.c
index ee2aee3..acb592d 100644
--- a/libavformat/ncdec.c
+++ b/libavformat/ncdec.c
@@ -81,7 +81,7 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt)
         return AVERROR(EAGAIN);
     }

-    ret = av_get_packet(s->pb, pkt, size);
+    ret = avio_get_packet(s->pb, pkt, size);
     if (ret != size) {
         if (ret > 0) av_packet_unref(pkt);
         return AVERROR(EIO);
diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c
index 6e31d9b..c7c6f4a 100644
--- a/libavformat/nsvdec.c
+++ b/libavformat/nsvdec.c
@@ -598,7 +598,7 @@ null_chunk_retry:
     if (vsize && st[NSV_ST_VIDEO]) {
         nst = st[NSV_ST_VIDEO]->priv_data;
         pkt = &nsv->ahead[NSV_ST_VIDEO];
-        av_get_packet(pb, pkt, vsize);
+        avio_get_packet(pb, pkt, vsize);
         pkt->stream_index = st[NSV_ST_VIDEO]->index;//NSV_ST_VIDEO;
         pkt->dts = nst->frame_offset;
         pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; 
/* keyframe only likely on a sync frame */
@@ -639,7 +639,7 @@ null_chunk_retry:
                 av_log(s, AV_LOG_TRACE, "NSV RAWAUDIO: bps %d, nchan %d, srate 
%d\n", bps, channels, samplerate);
             }
         }
-        av_get_packet(pb, pkt, asize);
+        avio_get_packet(pb, pkt, asize);
         pkt->stream_index = st[NSV_ST_AUDIO]->index;//NSV_ST_AUDIO;
         pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; 
/* keyframe only likely on a sync frame */
         if( nsv->state == NSV_HAS_READ_NSVS && st[NSV_ST_VIDEO] ) {
diff --git a/libavformat/nuv.c b/libavformat/nuv.c
index aeb2fae..961572d 100644
--- a/libavformat/nuv.c
+++ b/libavformat/nuv.c
@@ -288,7 +288,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt)
                 avio_skip(pb, size);
                 break;
             }
-            ret               = av_get_packet(pb, pkt, size);
+            ret               = avio_get_packet(pb, pkt, size);
             pkt->flags       |= AV_PKT_FLAG_KEY;
             pkt->pos          = pos;
             pkt->pts          = AV_RL32(&hdr[4]);
diff --git a/libavformat/omadec.c b/libavformat/omadec.c
index 756ab17..5d3424f 100644
--- a/libavformat/omadec.c
+++ b/libavformat/omadec.c
@@ -441,7 +441,7 @@ static int oma_read_packet(AVFormatContext *s, AVPacket 
*pkt)
     int packet_size = st->codec->block_align;
     int byte_rate   = st->codec->bit_rate >> 3;
     int64_t pos     = avio_tell(s->pb);
-    int ret         = av_get_packet(s->pb, pkt, packet_size);
+    int ret         = avio_get_packet(s->pb, pkt, packet_size);

     if (ret < packet_size)
         pkt->flags |= AV_PKT_FLAG_CORRUPT;
diff --git a/libavformat/pcmdec.c b/libavformat/pcmdec.c
index 1bbbc66..569262c 100644
--- a/libavformat/pcmdec.c
+++ b/libavformat/pcmdec.c
@@ -67,7 +67,7 @@ static int pcm_read_packet(AVFormatContext *s, AVPacket *pkt)

     size= RAW_SAMPLES*s->streams[0]->codec->block_align;

-    ret= av_get_packet(s->pb, pkt, size);
+    ret= avio_get_packet(s->pb, pkt, size);

     pkt->stream_index = 0;
     if (ret < 0)
diff --git a/libavformat/pmpdec.c b/libavformat/pmpdec.c
index 8ae147f..7af2617 100644
--- a/libavformat/pmpdec.c
+++ b/libavformat/pmpdec.c
@@ -142,7 +142,7 @@ static int pmp_packet(AVFormatContext *s, AVPacket *pkt)
         for (i = 0; i < num_packets; i++)
             pmp->packet_sizes[i] = avio_rl32(pb);
     }
-    ret = av_get_packet(pb, pkt, pmp->packet_sizes[pmp->current_packet]);
+    ret = avio_get_packet(pb, pkt, pmp->packet_sizes[pmp->current_packet]);
     if (ret > 0) {
         ret = 0;
         // FIXME: this is a hack that should be removed once
diff --git a/libavformat/pva.c b/libavformat/pva.c
index 2c485d6..14032f5 100644
--- a/libavformat/pva.c
+++ b/libavformat/pva.c
@@ -163,7 +163,7 @@ static int pva_read_packet(AVFormatContext *s, AVPacket 
*pkt) {
     int ret, length, streamid;

     if (read_part_of_packet(s, &pva_pts, &length, &streamid, 1) < 0 ||
-       (ret = av_get_packet(pb, pkt, length)) <= 0)
+       (ret = avio_get_packet(pb, pkt, length)) <= 0)
         return AVERROR(EIO);

     pkt->stream_index = streamid - 1;
diff --git a/libavformat/qcp.c b/libavformat/qcp.c
index be06e2f..0012f3f 100644
--- a/libavformat/qcp.c
+++ b/libavformat/qcp.c
@@ -157,7 +157,7 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket 
*pkt)
                 pkt_size = c->data_size - 1;
             }

-            if ((ret = av_get_packet(pb, pkt, pkt_size)) >= 0) {
+            if ((ret = avio_get_packet(pb, pkt, pkt_size)) >= 0) {
                 if (pkt_size != ret)
                     av_log(s, AV_LOG_ERROR, "Packet size is too small.\n");

diff --git a/libavformat/r3d.c b/libavformat/r3d.c
index c56bdc6..6f89c1a 100644
--- a/libavformat/r3d.c
+++ b/libavformat/r3d.c
@@ -253,7 +253,7 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, 
Atom *atom)
     tmp = atom->size - 8 - (avio_tell(s->pb) - pos);
     if (tmp < 0)
         return -1;
-    ret = av_get_packet(s->pb, pkt, tmp);
+    ret = avio_get_packet(s->pb, pkt, tmp);
     if (ret < 0) {
         av_log(s, AV_LOG_ERROR, "error reading video packet\n");
         return -1;
@@ -304,7 +304,7 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, 
Atom *atom)
     size = atom->size - 8 - (avio_tell(s->pb) - pos);
     if (size < 0)
         return -1;
-    ret = av_get_packet(s->pb, pkt, size);
+    ret = avio_get_packet(s->pb, pkt, size);
     if (ret < 0) {
         av_log(s, AV_LOG_ERROR, "error reading audio packet\n");
         return ret;
diff --git a/libavformat/rawvideodec.c b/libavformat/rawvideodec.c
index 5f372c9..c3fc7b6 100644
--- a/libavformat/rawvideodec.c
+++ b/libavformat/rawvideodec.c
@@ -89,7 +89,7 @@ static int rawvideo_read_packet(AVFormatContext *s, AVPacket 
*pkt)
     if (packet_size < 0)
         return -1;

-    ret = av_get_packet(s->pb, pkt, packet_size);
+    ret = avio_get_packet(s->pb, pkt, packet_size);
     pkt->pts = pkt->dts = pkt->pos / packet_size;

     pkt->stream_index = 0;
diff --git a/libavformat/rl2.c b/libavformat/rl2.c
index 51de347..4a6dd57 100644
--- a/libavformat/rl2.c
+++ b/libavformat/rl2.c
@@ -243,7 +243,7 @@ static int rl2_read_packet(AVFormatContext *s,
     avio_seek(pb, sample->pos, SEEK_SET);

     /** fill the packet */
-    ret = av_get_packet(pb, pkt, sample->size);
+    ret = avio_get_packet(pb, pkt, sample->size);
     if(ret != sample->size){
         av_packet_unref(pkt);
         return AVERROR(EIO);
diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c
index 5110b03..1c1e045 100644
--- a/libavformat/rmdec.c
+++ b/libavformat/rmdec.c
@@ -777,11 +777,11 @@ ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb,
             } else
                 return -1;
         } else {
-            av_get_packet(pb, pkt, len);
+            avio_get_packet(pb, pkt, len);
             rm_ac3_swap_bytes(st, pkt);
         }
     } else
-        av_get_packet(pb, pkt, len);
+        avio_get_packet(pb, pkt, len);

     pkt->stream_index = st->index;

@@ -815,7 +815,7 @@ ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb,

     if (ast->deint_id == DEINT_ID_VBRF ||
         ast->deint_id == DEINT_ID_VBRS)
-        av_get_packet(pb, pkt, ast->sub_packet_lengths[ast->sub_packet_cnt - 
rm->audio_pkt_cnt]);
+        avio_get_packet(pb, pkt, ast->sub_packet_lengths[ast->sub_packet_cnt - 
rm->audio_pkt_cnt]);
     else {
         int ret = av_new_packet(pkt, st->codec->block_align);
         if (ret < 0)
diff --git a/libavformat/rpl.c b/libavformat/rpl.c
index fdcefdb..3a694d2 100644
--- a/libavformat/rpl.c
+++ b/libavformat/rpl.c
@@ -308,7 +308,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket 
*pkt)
         if (avio_seek(pb, -8, SEEK_CUR) < 0)
             return AVERROR(EIO);

-        ret = av_get_packet(pb, pkt, frame_size);
+        ret = avio_get_packet(pb, pkt, frame_size);
         if (ret != frame_size) {
             av_packet_unref(pkt);
             return AVERROR(EIO);
@@ -323,7 +323,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket 
*pkt)
             rpl->chunk_part++;
         }
     } else {
-        ret = av_get_packet(pb, pkt, index_entry->size);
+        ret = avio_get_packet(pb, pkt, index_entry->size);
         if (ret != index_entry->size) {
             av_packet_unref(pkt);
             return AVERROR(EIO);
diff --git a/libavformat/rsodec.c b/libavformat/rsodec.c
index 1612572..f991ae2 100644
--- a/libavformat/rsodec.c
+++ b/libavformat/rsodec.c
@@ -76,7 +76,7 @@ static int rso_read_header(AVFormatContext *s)
 static int rso_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
     int bps = av_get_bits_per_sample(s->streams[0]->codec->codec_id);
-    int ret = av_get_packet(s->pb, pkt, BLOCK_SIZE * bps >> 3);
+    int ret = avio_get_packet(s->pb, pkt, BLOCK_SIZE * bps >> 3);

     if (ret < 0)
         return ret;
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index 4209197..76a1ec2 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -275,7 +275,7 @@ static int film_read_packet(AVFormatContext *s,
             return AVERROR(ENOMEM);
         avio_read(pb, pkt->data, sample->sample_size);
     } else {
-        ret= av_get_packet(pb, pkt, sample->sample_size);
+        ret= avio_get_packet(pb, pkt, sample->sample_size);
         if (ret != sample->sample_size)
             ret = AVERROR(EIO);
     }
diff --git a/libavformat/siff.c b/libavformat/siff.c
index d97c8b0..3f9840e 100644
--- a/libavformat/siff.c
+++ b/libavformat/siff.c
@@ -215,7 +215,7 @@ static int siff_read_packet(AVFormatContext *s, AVPacket 
*pkt)
             pkt->stream_index = 0;
             c->curstrm        = -1;
         } else {
-            int pktsize = av_get_packet(s->pb, pkt, c->sndsize - 4);
+            int pktsize = avio_get_packet(s->pb, pkt, c->sndsize - 4);
             if (pktsize < 0)
                 return AVERROR(EIO);
             pkt->stream_index = 1;
@@ -227,7 +227,7 @@ static int siff_read_packet(AVFormatContext *s, AVPacket 
*pkt)
         if (c->curstrm == -1)
             c->cur_frame++;
     } else {
-        int pktsize = av_get_packet(s->pb, pkt, c->block_align);
+        int pktsize = avio_get_packet(s->pb, pkt, c->block_align);
         if (pktsize <= 0)
             return AVERROR(EIO);
         pkt->duration = pktsize;
diff --git a/libavformat/smjpegdec.c b/libavformat/smjpegdec.c
index a9ed28e..e226322 100644
--- a/libavformat/smjpegdec.c
+++ b/libavformat/smjpegdec.c
@@ -149,7 +149,7 @@ static int smjpeg_read_packet(AVFormatContext *s, AVPacket 
*pkt)
     case SMJPEG_SNDD:
         timestamp = avio_rb32(s->pb);
         size = avio_rb32(s->pb);
-        ret = av_get_packet(s->pb, pkt, size);
+        ret = avio_get_packet(s->pb, pkt, size);
         pkt->stream_index = sc->audio_stream_index;
         pkt->pts = timestamp;
         pkt->pos = pos;
@@ -157,7 +157,7 @@ static int smjpeg_read_packet(AVFormatContext *s, AVPacket 
*pkt)
     case SMJPEG_VIDD:
         timestamp = avio_rb32(s->pb);
         size = avio_rb32(s->pb);
-        ret = av_get_packet(s->pb, pkt, size);
+        ret = avio_get_packet(s->pb, pkt, size);
         pkt->stream_index = sc->video_stream_index;
         pkt->pts = timestamp;
         pkt->pos = pos;
diff --git a/libavformat/smush.c b/libavformat/smush.c
index 94ecb5c..fbf9e4e 100644
--- a/libavformat/smush.c
+++ b/libavformat/smush.c
@@ -210,14 +210,14 @@ static int smush_read_packet(AVFormatContext *ctx, 
AVPacket *pkt)
         case MKBETAG('F', 'R', 'M', 'E'):
             if (smush->version)
                 break;
-            if ((ret = av_get_packet(pb, pkt, size)) < 0)
+            if ((ret = avio_get_packet(pb, pkt, size)) < 0)
                 return ret;

             pkt->stream_index = smush->video_stream_index;
             done = 1;
             break;
         case MKBETAG('B', 'l', '1', '6'):
-            if ((ret = av_get_packet(pb, pkt, size)) < 0)
+            if ((ret = avio_get_packet(pb, pkt, size)) < 0)
                 return ret;

             pkt->stream_index = smush->video_stream_index;
@@ -227,7 +227,7 @@ static int smush_read_packet(AVFormatContext *ctx, AVPacket 
*pkt)
         case MKBETAG('W', 'a', 'v', 'e'):
             if (size < 13)
                 return AVERROR_INVALIDDATA;
-            if (av_get_packet(pb, pkt, size) < 13)
+            if (avio_get_packet(pb, pkt, size) < 13)
                 return AVERROR(EIO);

             pkt->stream_index = smush->audio_stream_index;
diff --git a/libavformat/sol.c b/libavformat/sol.c
index 30f0547..7c4f56f 100644
--- a/libavformat/sol.c
+++ b/libavformat/sol.c
@@ -130,7 +130,7 @@ static int sol_read_packet(AVFormatContext *s,

     if (s->pb->eof_reached)
         return AVERROR(EIO);
-    ret= av_get_packet(s->pb, pkt, MAX_SIZE);
+    ret= avio_get_packet(s->pb, pkt, MAX_SIZE);
     if (ret < 0)
         return ret;
     pkt->stream_index = 0;
diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c
index ec94675..452b49b 100644
--- a/libavformat/soxdec.c
+++ b/libavformat/soxdec.c
@@ -133,7 +133,7 @@ static int sox_read_packet(AVFormatContext *s,
         return AVERROR_EOF;

     size = SOX_SAMPLES*s->streams[0]->codec->block_align;
-    ret = av_get_packet(s->pb, pkt, size);
+    ret = avio_get_packet(s->pb, pkt, size);
     if (ret < 0)
         return AVERROR(EIO);
     pkt->stream_index = 0;
diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c
index d7a5314..4dd41c2 100644
--- a/libavformat/swfdec.c
+++ b/libavformat/swfdec.c
@@ -168,7 +168,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket 
*pkt)
                     len -= 2;
                     if (len <= 0)
                         goto skip;
-                    if ((res = av_get_packet(pb, pkt, len)) < 0)
+                    if ((res = avio_get_packet(pb, pkt, len)) < 0)
                         return res;
                     pkt->pos = pos;
                     pkt->pts = frame;
@@ -185,12 +185,12 @@ static int swf_read_packet(AVFormatContext *s, AVPacket 
*pkt)
                         len -= 4;
                         if (len <= 0)
                             goto skip;
-                        if ((res = av_get_packet(pb, pkt, len)) < 0)
+                        if ((res = avio_get_packet(pb, pkt, len)) < 0)
                             return res;
                     } else { // ADPCM, PCM
                         if (len <= 0)
                             goto skip;
-                        if ((res = av_get_packet(pb, pkt, len)) < 0)
+                        if ((res = avio_get_packet(pb, pkt, len)) < 0)
                             return res;
                     }
                     pkt->pos          = pos;
diff --git a/libavformat/takdec.c b/libavformat/takdec.c
index 902ba05..f9d3ff6 100644
--- a/libavformat/takdec.c
+++ b/libavformat/takdec.c
@@ -160,7 +160,7 @@ static int raw_read_packet(AVFormatContext *s, AVPacket 
*pkt)
         if (size <= 0)
             return AVERROR_EOF;

-        ret = av_get_packet(pb, pkt, size);
+        ret = avio_get_packet(pb, pkt, size);
         if (ret < 0)
             return ret;

diff --git a/libavformat/thp.c b/libavformat/thp.c
index 18d4afe..8774578 100644
--- a/libavformat/thp.c
+++ b/libavformat/thp.c
@@ -166,7 +166,7 @@ static int thp_read_packet(AVFormatContext *s,
         else
             thp->frame++;

-        ret = av_get_packet(pb, pkt, size);
+        ret = avio_get_packet(pb, pkt, size);
         if (ret != size) {
             av_packet_unref(pkt);
             return AVERROR(EIO);
@@ -174,7 +174,7 @@ static int thp_read_packet(AVFormatContext *s,

         pkt->stream_index = thp->video_stream_index;
     } else {
-        ret = av_get_packet(pb, pkt, thp->audiosize);
+        ret = avio_get_packet(pb, pkt, thp->audiosize);
         if (ret != thp->audiosize) {
             av_packet_unref(pkt);
             return AVERROR(EIO);
diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c
index 45300f9..b5e2c94 100644
--- a/libavformat/tiertexseq.c
+++ b/libavformat/tiertexseq.c
@@ -284,7 +284,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket 
*pkt)
         return AVERROR(EIO);

     avio_seek(pb, seq->current_frame_offs + seq->current_audio_data_offs, 
SEEK_SET);
-    rc = av_get_packet(pb, pkt, seq->current_audio_data_size);
+    rc = avio_get_packet(pb, pkt, seq->current_audio_data_size);
     if (rc < 0)
         return rc;

diff --git a/libavformat/tmv.c b/libavformat/tmv.c
index 103ac4a..aea99f9 100644
--- a/libavformat/tmv.c
+++ b/libavformat/tmv.c
@@ -157,7 +157,7 @@ static int tmv_read_packet(AVFormatContext *s, AVPacket 
*pkt)
     if (pb->eof_reached)
         return AVERROR_EOF;

-    ret = av_get_packet(pb, pkt, pkt_size);
+    ret = avio_get_packet(pb, pkt, pkt_size);

     if (tmv->stream_index)
         avio_skip(pb, tmv->padding);
diff --git a/libavformat/tta.c b/libavformat/tta.c
index f5304f3..f6744cd 100644
--- a/libavformat/tta.c
+++ b/libavformat/tta.c
@@ -141,7 +141,7 @@ static int tta_read_packet(AVFormatContext *s, AVPacket 
*pkt)

     size = st->index_entries[c->currentframe].size;

-    ret = av_get_packet(s->pb, pkt, size);
+    ret = avio_get_packet(s->pb, pkt, size);
     pkt->dts = st->index_entries[c->currentframe++].timestamp;
     pkt->duration = c->currentframe == c->totalframes ? c->last_frame_size :
                                                         c->frame_size;
diff --git a/libavformat/tty.c b/libavformat/tty.c
index 3a34dd8..3e9b23b 100644
--- a/libavformat/tty.c
+++ b/libavformat/tty.c
@@ -133,7 +133,7 @@ static int read_packet(AVFormatContext *avctx, AVPacket 
*pkt)
             n = s->fsize - p;
     }

-    pkt->size = av_get_packet(avctx->pb, pkt, n);
+    pkt->size = avio_get_packet(avctx->pb, pkt, n);
     if (pkt->size <= 0)
         return AVERROR(EIO);
     pkt->flags |= AV_PKT_FLAG_KEY;
diff --git a/libavformat/txd.c b/libavformat/txd.c
index e6522c3..c287bea 100644
--- a/libavformat/txd.c
+++ b/libavformat/txd.c
@@ -83,7 +83,7 @@ next_chunk:
             return AVERROR_INVALIDDATA;
     }

-    ret = av_get_packet(s->pb, pkt, chunk_size);
+    ret = avio_get_packet(s->pb, pkt, chunk_size);
     if (ret < 0)
         return ret;
     pkt->stream_index = 0;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 06cba56..629edd6 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -71,66 +71,6 @@ const char *avformat_license(void)
     return LICENSE_PREFIX LIBAV_LICENSE + sizeof(LICENSE_PREFIX) - 1;
 }

-/* an arbitrarily chosen "sane" max packet size -- 50M */
-#define SANE_CHUNK_SIZE (50000000)
-
-/* Read the data in sane-sized chunks and append to pkt.
- * Return the number of bytes read or an error. */
-static int append_packet_chunked(AVIOContext *s, AVPacket *pkt, int size)
-{
-    int64_t chunk_size = size;
-    int64_t orig_pos   = pkt->pos; // av_grow_packet might reset pos
-    int orig_size      = pkt->size;
-    int ret = 0;
-
-    do {
-        int prev_size = pkt->size;
-        int read_size;
-
-        /* When the caller requests a lot of data, limit it to the amount
-         * left in file or SANE_CHUNK_SIZE when it is not known. */
-        if (size > SANE_CHUNK_SIZE) {
-            int64_t filesize = avio_size(s) - avio_tell(s);
-            chunk_size = FFMAX(filesize, SANE_CHUNK_SIZE);
-        }
-        read_size = FFMIN(size, chunk_size);
-
-        ret = av_grow_packet(pkt, read_size);
-        if (ret < 0)
-            break;
-
-        ret = avio_read(s, pkt->data + prev_size, read_size);
-        if (ret != read_size) {
-            av_shrink_packet(pkt, prev_size + FFMAX(ret, 0));
-            break;
-        }
-
-        size -= read_size;
-    } while (size > 0);
-
-    pkt->pos = orig_pos;
-    if (!pkt->size)
-        av_packet_unref(pkt);
-    return pkt->size > orig_size ? pkt->size - orig_size : ret;
-}
-
-int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
-{
-    av_init_packet(pkt);
-    pkt->data = NULL;
-    pkt->size = 0;
-    pkt->pos  = avio_tell(s);
-
-    return append_packet_chunked(s, pkt, size);
-}
-
-int av_append_packet(AVIOContext *s, AVPacket *pkt, int size)
-{
-    if (!pkt->size)
-        return av_get_packet(s, pkt, size);
-    return append_packet_chunked(s, pkt, size);
-}
-
 int av_filename_number_test(const char *filename)
 {
     char buf[1024];
@@ -3152,3 +3092,17 @@ uint8_t *ff_stream_new_side_data(AVStream *st, enum 
AVPacketSideDataType type,
     sd->size = size;
     return data;
 }
+
+#if FF_API_LAVF_AVPACKET_OLD_API
+FF_DISABLE_DEPRECATION_WARNINGS
+int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
+{
+    return avio_get_packet(s, pkt, size);
+}
+
+int av_append_packet(AVIOContext *s, AVPacket *pkt, int size)
+{
+    return avio_append_packet(s, pkt, size);
+}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c
index f302c2b..24e56b0 100644
--- a/libavformat/vc1test.c
+++ b/libavformat/vc1test.c
@@ -101,7 +101,7 @@ static int vc1t_read_packet(AVFormatContext *s,
     if(avio_r8(pb) & 0x80)
         keyframe = 1;
     pts = avio_rl32(pb);
-    if(av_get_packet(pb, pkt, frame_size) < 0)
+    if(avio_get_packet(pb, pkt, frame_size) < 0)
         return AVERROR(EIO);
     if(s->streams[0]->time_base.den == 1000)
         pkt->pts = pts;
diff --git a/libavformat/version.h b/libavformat/version.h
index d74968a..7ec9a50 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -60,5 +60,8 @@
 #ifndef FF_API_LAVF_FMT_RAWPICTURE
 #define FF_API_LAVF_FMT_RAWPICTURE      (LIBAVFORMAT_VERSION_MAJOR < 58)
 #endif
+#ifndef FF_API_LAVF_AVPACKET_OLD_API
+#define FF_API_LAVF_AVPACKET_OLD_API    (LIBAVFORMAT_VERSION_MAJOR < 59)
+#endif

 #endif /* AVFORMAT_VERSION_H */
diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c
index 2fb8440..c9ee5ea 100644
--- a/libavformat/vocdec.c
+++ b/libavformat/vocdec.c
@@ -156,7 +156,7 @@ ff_voc_get_packet(AVFormatContext *s, AVPacket *pkt, 
AVStream *st, int max_size)
         max_size = 2048;
     size = FFMIN(voc->remaining_size, max_size);
     voc->remaining_size -= size;
-    return av_get_packet(pb, pkt, size);
+    return avio_get_packet(pb, pkt, size);
 }

 static int voc_read_packet(AVFormatContext *s, AVPacket *pkt)
diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 83c860d..e8de9bc 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -397,7 +397,7 @@ static int wav_read_packet(AVFormatContext *s, AVPacket 
*pkt)
         size = (size / st->codec->block_align) * st->codec->block_align;
     }
     size = FFMIN(size, left);
-    ret  = av_get_packet(s->pb, pkt, size);
+    ret  = avio_get_packet(s->pb, pkt, size);
     if (ret < 0)
         return ret;
     pkt->stream_index = 0;
diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
index c673fad..210f6c4 100644
--- a/libavformat/wc3movie.c
+++ b/libavformat/wc3movie.c
@@ -145,7 +145,7 @@ static int wc3_read_header(AVFormatContext *s)
         case PALT_TAG:
             /* one of several palettes */
             avio_seek(pb, -8, SEEK_CUR);
-            av_append_packet(pb, &wc3->vpkt, 8 + PALETTE_SIZE);
+            avio_append_packet(pb, &wc3->vpkt, 8 + PALETTE_SIZE);
             break;

         default:
@@ -222,13 +222,13 @@ static int wc3_read_packet(AVFormatContext *s,
         case SHOT_TAG:
             /* load up new palette */
             avio_seek(pb, -8, SEEK_CUR);
-            av_append_packet(pb, &wc3->vpkt, 8 + 4);
+            avio_append_packet(pb, &wc3->vpkt, 8 + 4);
             break;

         case VGA__TAG:
             /* send out video chunk */
             avio_seek(pb, -8, SEEK_CUR);
-            ret= av_append_packet(pb, &wc3->vpkt, 8 + size);
+            ret= avio_append_packet(pb, &wc3->vpkt, 8 + size);
             // ignore error if we have some data
             if (wc3->vpkt.size > 0)
                 ret = 0;
@@ -260,7 +260,7 @@ static int wc3_read_packet(AVFormatContext *s,

         case AUDI_TAG:
             /* send out audio chunk */
-            ret= av_get_packet(pb, pkt, size);
+            ret= avio_get_packet(pb, pkt, size);
             pkt->stream_index = wc3->audio_stream_index;
             pkt->pts = wc3->pts;

diff --git a/libavformat/westwood_aud.c b/libavformat/westwood_aud.c
index 611d223..805a5c1 100644
--- a/libavformat/westwood_aud.c
+++ b/libavformat/westwood_aud.c
@@ -162,7 +162,7 @@ static int wsaud_read_packet(AVFormatContext *s,

         pkt->duration = out_size;
     } else {
-        ret = av_get_packet(pb, pkt, chunk_size);
+        ret = avio_get_packet(pb, pkt, chunk_size);
         if (ret != chunk_size)
             return AVERROR(EIO);

diff --git a/libavformat/wtv.c b/libavformat/wtv.c
index bab61f3..64df97e 100644
--- a/libavformat/wtv.c
+++ b/libavformat/wtv.c
@@ -1062,7 +1062,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
     if (stream_index < 0)
         return stream_index;

-    ret = av_get_packet(pb, pkt, len - 32);
+    ret = avio_get_packet(pb, pkt, len - 32);
     if (ret < 0)
         return ret;
     pkt->stream_index = stream_index;
diff --git a/libavformat/xa.c b/libavformat/xa.c
index 57a36bc..dea0f5a 100644
--- a/libavformat/xa.c
+++ b/libavformat/xa.c
@@ -107,7 +107,7 @@ static int xa_read_packet(AVFormatContext *s,
     /* 1 byte header and 14 bytes worth of samples * number channels per block 
*/
     packet_size = 15*st->codec->channels;

-    ret = av_get_packet(pb, pkt, packet_size);
+    ret = avio_get_packet(pb, pkt, packet_size);
     if(ret < 0)
         return ret;

diff --git a/libavformat/xmv.c b/libavformat/xmv.c
index b8e3191..0eeb729 100644
--- a/libavformat/xmv.c
+++ b/libavformat/xmv.c
@@ -455,7 +455,7 @@ static int xmv_fetch_audio_packet(AVFormatContext *s,
         data_size = audio->data_size;

     /* Read the packet */
-    result = av_get_packet(pb, pkt, data_size);
+    result = avio_get_packet(pb, pkt, data_size);
     if (result <= 0)
         return result;

diff --git a/libavformat/xwma.c b/libavformat/xwma.c
index b24cde8..ea26621 100644
--- a/libavformat/xwma.c
+++ b/libavformat/xwma.c
@@ -269,7 +269,7 @@ static int xwma_read_packet(AVFormatContext *s, AVPacket 
*pkt)
     size = (st->codec->block_align > 1) ? st->codec->block_align : 2230;
     size = FFMIN(size, left);

-    ret  = av_get_packet(s->pb, pkt, size);
+    ret  = avio_get_packet(s->pb, pkt, size);
     if (ret < 0)
         return ret;

diff --git a/libavformat/yop.c b/libavformat/yop.c
index 933c57d..089c3f1 100644
--- a/libavformat/yop.c
+++ b/libavformat/yop.c
@@ -148,7 +148,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket 
*pkt)
         goto err_out;
     }

-    ret = av_get_packet(pb, pkt, 920);
+    ret = avio_get_packet(pb, pkt, 920);
     if (ret < 0)
         goto err_out;

diff --git a/libavformat/yuv4mpegdec.c b/libavformat/yuv4mpegdec.c
index dd81358..9be1b11 100644
--- a/libavformat/yuv4mpegdec.c
+++ b/libavformat/yuv4mpegdec.c
@@ -230,7 +230,7 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket 
*pkt)
     if (packet_size < 0)
         return packet_size;

-    ret = av_get_packet(s->pb, pkt, packet_size);
+    ret = avio_get_packet(s->pb, pkt, packet_size);
     if (ret < 0)
         return ret;
     else if (ret != packet_size)
--
2.5.0

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to