History

avio: avio_ prefixes for get_* functions

In the name of consistency: get_byte -> avio_r8 get_<type> -> avio_r<type> get_buffer -> avio_read get_partial_buffer will be made private later get_strz is left out becase I want to change it later to return something useful.

Anton Khirnov committed 15 years ago

Commit b7effd41 parent f8bed30107 files · +1823 −1778Browse files

Unified · Split

107 files
  1. libavformat/4xm.c +9 −9
  2. libavformat/aea.c +1 −1
  3. libavformat/aiffdec.c +13 −13
  4. libavformat/amr.c +4 −4
  5. libavformat/anm.c +19 −19
  6. libavformat/apc.c +7 −7
  7. libavformat/ape.c +30 −30
  8. libavformat/apetag.c +9 −9
  9. libavformat/asfdec.c +127 −127
  10. libavformat/au.c +6 −6
  11. libavformat/avidec.c +79 −79
  12. libavformat/avio.h +29 −10
  13. libavformat/aviobuf.c +57 −31
  14. libavformat/avs.c +12 −12
  15. libavformat/bethsoftvid.c +15 −15
  16. libavformat/bfi.c +16 −16
  17. libavformat/bink.c +15 −15
  18. libavformat/c93.c +9 −9
  19. libavformat/cafdec.c +18 −18
  20. libavformat/daud.c +2 −2
  21. libavformat/dsicin.c +15 −15
  22. libavformat/dv.c +5 −5
  23. libavformat/dxa.c +15 −15
  24. libavformat/eacdata.c +2 −2
  25. libavformat/electronicarts.c +22 −22
  26. libavformat/ffmdec.c +72 −72
  27. libavformat/ffmetadec.c +2 −2
  28. libavformat/filmstripdec.c +7 −7
  29. libavformat/flacdec.c +3 −3
  30. libavformat/flic.c +5 −5
  31. libavformat/flvdec.c +26 −26
  32. libavformat/gxf.c +35 −35
  33. libavformat/id3v1.c +1 −1
  34. libavformat/id3v2.c +15 −15
  35. libavformat/idcin.c +9 −9
  36. libavformat/idroqdec.c +5 −5
  37. libavformat/iff.c +15 −15
  38. libavformat/img2.c +1 −1
  39. libavformat/ingenientdec.c +7 −7
  40. libavformat/ipmovie.c +11 −11
  41. libavformat/isom.c +8 −8
  42. libavformat/iss.c +2 −2
  43. libavformat/iv8.c +6 −6
  44. libavformat/ivfdec.c +11 −11
  45. libavformat/libnut.c +1 −1
  46. libavformat/lmlm4.c +3 −3
  47. libavformat/lxfdec.c +5 −5
  48. libavformat/matroskadec.c +13 −13
  49. libavformat/mm.c +9 −9
  50. libavformat/mmf.c +13 −13
  51. libavformat/mov.c +237 −237
  52. libavformat/mp3dec.c +9 −9
  53. libavformat/mpc.c +7 −7
  54. libavformat/mpc8.c +5 −5
  55. libavformat/mpeg.c +39 −39
  56. libavformat/mpegts.c +15 −15
  57. libavformat/msnwc_tcp.c +4 −4
  58. libavformat/mtv.c +10 −10
  59. libavformat/mvi.c +15 −15
  60. libavformat/mxfdec.c +61 −61
  61. libavformat/mxg.c +1 −1
  62. libavformat/ncdec.c +3 −3
  63. libavformat/nsvdec.c +27 −27
  64. libavformat/nutdec.c +16 −16
  65. libavformat/nuv.c +26 −26
  66. libavformat/oggdec.c +7 −7
  67. libavformat/oma.c +1 −1
  68. libavformat/psxstr.c +2 −2
  69. libavformat/pva.c +13 −13
  70. libavformat/qcp.c +14 −14
  71. libavformat/r3d.c +39 −39
  72. libavformat/rdt.c +6 −6
  73. libavformat/riff.c +22 −22
  74. libavformat/rl2.c +13 −13
  75. libavformat/rmdec.c +103 −103
  76. libavformat/rpl.c +3 −3
  77. libavformat/rsodec.c +4 −4
  78. libavformat/rtpdec_asf.c +2 −2
  79. libavformat/rtpdec_qt.c +4 −4
  80. libavformat/rtsp.c +1 −1
  81. libavformat/sauce.c +10 −10
  82. libavformat/segafilm.c +7 −7
  83. libavformat/sierravmd.c +5 −5
  84. libavformat/siff.c +20 −20
  85. libavformat/smacker.c +25 −25
  86. libavformat/sol.c +6 −6
  87. libavformat/soxdec.c +10 −10
  88. libavformat/spdifdec.c +4 −4
  89. libavformat/swfdec.c +22 −22
  90. libavformat/thp.c +23 −23
  91. libavformat/tiertexseq.c +7 −7
  92. libavformat/tmv.c +7 −7
  93. libavformat/tta.c +8 −8
  94. libavformat/tty.c +3 −3
  95. libavformat/txd.c +3 −3
  96. libavformat/utils.c +3 −3
  97. libavformat/vc1test.c +10 −10
  98. libavformat/vocdec.c +12 −12
  99. libavformat/vqf.c +8 −8
  100. libavformat/wav.c +16 −16
  101. libavformat/wc3movie.c +10 −10
  102. libavformat/westwood.c +6 −6
  103. libavformat/wtv.c +28 −28
  104. libavformat/wv.c +25 −25
  105. libavformat/xa.c +6 −6
  106. libavformat/yop.c +7 −7
  107. libavformat/yuv4mpeg.c +2 −2
libavformat/4xm.c+9−9
@@ -54,11 +54,11 @@ · 53 unmodified lines
5454 #define strk_SIZE 0x28
5555
5656 #define GET_LIST_HEADER() \
57− fourcc_tag = get_le32(pb); \
58− size = get_le32(pb); \
57+ fourcc_tag = avio_rl32(pb); \
58+ size = avio_rl32(pb); \
5959 if (fourcc_tag != LIST_TAG) \
6060 return AVERROR_INVALIDDATA; \
61− fourcc_tag = get_le32(pb);
61+ fourcc_tag = avio_rl32(pb);
6262
6363 typedef struct AudioTrack {
6464 int sample_rate;
@@ -118,7 +118,7 @@ static int fourxm_read_header(AVFormatContext *s, · 53 unmodified lines
118118 header = av_malloc(header_size);
119119 if (!header)
120120 return AVERROR(ENOMEM);
121− if (get_buffer(pb, header, header_size) != header_size){
121+ if (avio_read(pb, header, header_size) != header_size){
122122 av_free(header);
123123 return AVERROR(EIO);
124124 }
@@ -255,7 +255,7 @@ static int fourxm_read_packet(AVFormatContext *s, · 130 unmodified lines
255255
256256 while (!packet_read) {
257257
258− if ((ret = get_buffer(s->pb, header, 8)) < 0)
258+ if ((ret = avio_read(s->pb, header, 8)) < 0)
259259 return ret;
260260 fourcc_tag = AV_RL32(&header[0]);
261261 size = AV_RL32(&header[4]);
@@ -268,7 +268,7 @@ static int fourxm_read_packet(AVFormatContext *s, · 6 unmodified lines
268268 fourxm->video_pts ++;
269269
270270 /* skip the LIST-* tag and move on to the next fourcc */
271− get_le32(pb);
271+ avio_rl32(pb);
272272 break;
273273
274274 case ifrm_TAG:
@@ -285,7 +285,7 @@ static int fourxm_read_packet(AVFormatContext *s, · 10 unmodified lines
285285 pkt->pts = fourxm->video_pts;
286286 pkt->pos = url_ftell(s->pb);
287287 memcpy(pkt->data, header, 8);
288− ret = get_buffer(s->pb, &pkt->data[8], size);
288+ ret = avio_read(s->pb, &pkt->data[8], size);
289289
290290 if (ret < 0){
291291 av_free_packet(pkt);
@@ -294,8 +294,8 @@ static int fourxm_read_packet(AVFormatContext *s, · 2 unmodified lines
294294 break;
295295
296296 case snd__TAG:
297− track_number = get_le32(pb);
298− out_size= get_le32(pb);
297+ track_number = avio_rl32(pb);
298+ out_size= avio_rl32(pb);
299299 size-=8;
300300
301301 if (track_number < fourxm->track_count && fourxm->tracks[track_number].channels>0) {
libavformat/aea.c+1−1
@@ -63,7 +63,7 @@ static int aea_read_header(AVFormatContext *s, · 62 unmodified lines
6363
6464 /* Parse the amount of channels and skip to pos 2048(0x800) */
6565 url_fskip(s->pb, 264);
66− st->codec->channels = get_byte(s->pb);
66+ st->codec->channels = avio_r8(s->pb);
6767 url_fskip(s->pb, 1783);
6868
6969
libavformat/aiffdec.c+13−13
@@ -54,8 +54,8 @@ static int get_tag(AVIOContext *pb, uint32_t * tag) · 53 unmodified lines
5454 if (url_feof(pb))
5555 return AVERROR(EIO);
5656
57− *tag = get_le32(pb);
58− size = get_be32(pb);
57+ *tag = avio_rl32(pb);
58+ size = avio_rb32(pb);
5959
6060 if (size < 0)
6161 size = 0x7fffffff;
@@ -74,7 +74,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size) · 12 unmodified lines
7474 return;
7575 }
7676
77− res = get_buffer(s->pb, str, size);
77+ res = avio_read(s->pb, str, size);
7878 if (res < 0)
7979 return;
8080
@@ -93,18 +93,18 @@ static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec, · 12 unmodified lines
9393 if (size & 1)
9494 size++;
9595 codec->codec_type = AVMEDIA_TYPE_AUDIO;
96− codec->channels = get_be16(pb);
97− num_frames = get_be32(pb);
98− codec->bits_per_coded_sample = get_be16(pb);
96+ codec->channels = avio_rb16(pb);
97+ num_frames = avio_rb32(pb);
98+ codec->bits_per_coded_sample = avio_rb16(pb);
9999
100− get_buffer(pb, (uint8_t*)&ext, sizeof(ext));/* Sample rate is in */
100+ avio_read(pb, (uint8_t*)&ext, sizeof(ext));/* Sample rate is in */
101101 sample_rate = av_ext2dbl(ext); /* 80 bits BE IEEE extended float */
102102 codec->sample_rate = sample_rate;
103103 size -= 18;
104104
105105 /* Got an AIFF-C? */
106106 if (version == AIFF_C_VERSION1) {
107− codec->codec_tag = get_le32(pb);
107+ codec->codec_tag = avio_rl32(pb);
108108 codec->codec_id = ff_codec_get_id(ff_codec_aiff_tags, codec->codec_tag);
109109
110110 switch (codec->codec_id) {
@@ -187,7 +187,7 @@ static int aiff_read_header(AVFormatContext *s, · 76 unmodified lines
187187 return AVERROR_INVALIDDATA;
188188
189189 /* AIFF data type */
190− tag = get_le32(pb);
190+ tag = avio_rl32(pb);
191191 if (tag == MKTAG('A', 'I', 'F', 'F')) /* Got an AIFF file */
192192 version = AIFF;
193193 else if (tag != MKTAG('A', 'I', 'F', 'C')) /* An AIFF-C file then */
@@ -217,7 +217,7 @@ static int aiff_read_header(AVFormatContext *s, · 23 unmodified lines
217217 goto got_sound;
218218 break;
219219 case MKTAG('F', 'V', 'E', 'R'): /* Version chunk */
220− version = get_be32(pb);
220+ version = avio_rb32(pb);
221221 break;
222222 case MKTAG('N', 'A', 'M', 'E'): /* Sample name chunk */
223223 get_meta(s, "title" , size);
@@ -233,8 +233,8 @@ static int aiff_read_header(AVFormatContext *s, · 9 unmodified lines
233233 break;
234234 case MKTAG('S', 'S', 'N', 'D'): /* Sampled sound chunk */
235235 aiff->data_end = url_ftell(pb) + size;
236− offset = get_be32(pb); /* Offset of sound data */
237− get_be32(pb); /* BlockSize... don't care */
236+ offset = avio_rb32(pb); /* Offset of sound data */
237+ avio_rb32(pb); /* BlockSize... don't care */
238238 offset += url_ftell(pb); /* Compute absolute data offset */
239239 if (st->codec->block_align) /* Assume COMM already parsed */
240240 goto got_sound;
@@ -251,7 +251,7 @@ static int aiff_read_header(AVFormatContext *s, · 10 unmodified lines
251251 if (!st->codec->extradata)
252252 return AVERROR(ENOMEM);
253253 st->codec->extradata_size = size;
254− get_buffer(pb, st->codec->extradata, size);
254+ avio_read(pb, st->codec->extradata, size);
255255 break;
256256 default: /* Jump */
257257 if (size & 1) /* Always even aligned */
libavformat/amr.c+4−4
@@ -82,7 +82,7 @@ static int amr_read_header(AVFormatContext *s, · 81 unmodified lines
8282 AVStream *st;
8383 uint8_t header[9];
8484
85− get_buffer(pb, header, 6);
85+ avio_read(pb, header, 6);
8686
8787 st = av_new_stream(s, 0);
8888 if (!st)
@@ -91,7 +91,7 @@ static int amr_read_header(AVFormatContext *s, · 2 unmodified lines
9191 }
9292 if(memcmp(header,AMR_header,6)!=0)
9393 {
94− get_buffer(pb, header+6, 3);
94+ avio_read(pb, header+6, 3);
9595 if(memcmp(header,AMRWB_header,9)!=0)
9696 {
9797 return -1;
@@ -128,7 +128,7 @@ static int amr_read_packet(AVFormatContext *s, · 30 unmodified lines
128128 }
129129
130130 //FIXME this is wrong, this should rather be in a AVParset
131− toc=get_byte(s->pb);
131+ toc=avio_r8(s->pb);
132132 mode = (toc >> 3) & 0x0F;
133133
134134 if (enc->codec_id == CODEC_ID_AMR_NB)
@@ -157,7 +157,7 @@ static int amr_read_packet(AVFormatContext *s, · 22 unmodified lines
157157 pkt->pos= url_ftell(s->pb);
158158 pkt->data[0]=toc;
159159 pkt->duration= enc->codec_id == CODEC_ID_AMR_NB ? 160 : 320;
160− read = get_buffer(s->pb, pkt->data+1, size-1);
160+ read = avio_read(s->pb, pkt->data+1, size-1);
161161
162162 if (read != size-1)
163163 {
libavformat/anm.c+19−19
@@ -84,16 +84,16 @@ static int read_header(AVFormatContext *s, · 83 unmodified lines
8484 int i, ret;
8585
8686 url_fskip(pb, 4); /* magic number */
87− if (get_le16(pb) != MAX_PAGES) {
87+ if (avio_rl16(pb) != MAX_PAGES) {
8888 av_log_ask_for_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES) "\n");
8989 return AVERROR_INVALIDDATA;
9090 }
9191
92− anm->nb_pages = get_le16(pb);
93− anm->nb_records = get_le32(pb);
92+ anm->nb_pages = avio_rl16(pb);
93+ anm->nb_records = avio_rl32(pb);
9494 url_fskip(pb, 2); /* max records per page */
95− anm->page_table_offset = get_le16(pb);
96− if (get_le32(pb) != ANIM_TAG)
95+ anm->page_table_offset = avio_rl16(pb);
96+ if (avio_rl32(pb) != ANIM_TAG)
9797 return AVERROR_INVALIDDATA;
9898
9999 /* video stream */
@@ -103,32 +103,32 @@ static int read_header(AVFormatContext *s, · 3 unmodified lines
103103 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
104104 st->codec->codec_id = CODEC_ID_ANM;
105105 st->codec->codec_tag = 0; /* no fourcc */
106− st->codec->width = get_le16(pb);
107− st->codec->height = get_le16(pb);
108− if (get_byte(pb) != 0)
106+ st->codec->width = avio_rl16(pb);
107+ st->codec->height = avio_rl16(pb);
108+ if (avio_r8(pb) != 0)
109109 goto invalid;
110110 url_fskip(pb, 1); /* frame rate multiplier info */
111111
112112 /* ignore last delta record (used for looping) */
113− if (get_byte(pb)) /* has_last_delta */
113+ if (avio_r8(pb)) /* has_last_delta */
114114 anm->nb_records = FFMAX(anm->nb_records - 1, 0);
115115
116116 url_fskip(pb, 1); /* last_delta_valid */
117117
118− if (get_byte(pb) != 0)
118+ if (avio_r8(pb) != 0)
119119 goto invalid;
120120
121− if (get_byte(pb) != 1)
121+ if (avio_r8(pb) != 1)
122122 goto invalid;
123123
124124 url_fskip(pb, 1); /* other recs per frame */
125125
126− if (get_byte(pb) != 1)
126+ if (avio_r8(pb) != 1)
127127 goto invalid;
128128
129129 url_fskip(pb, 32); /* record_types */
130− st->nb_frames = get_le32(pb);
131− av_set_pts_info(st, 64, 1, get_le16(pb));
130+ st->nb_frames = avio_rl32(pb);
131+ av_set_pts_info(st, 64, 1, avio_rl16(pb));
132132 url_fskip(pb, 58);
133133
134134 /* color cycling and palette data */
@@ -138,7 +138,7 @@ static int read_header(AVFormatContext *s, · 3 unmodified lines
138138 ret = AVERROR(ENOMEM);
139139 goto close_and_return;
140140 }
141− ret = get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
141+ ret = avio_read(pb, st->codec->extradata, st->codec->extradata_size);
142142 if (ret < 0)
143143 goto close_and_return;
144144
@@ -149,9 +149,9 @@ static int read_header(AVFormatContext *s, · 4 unmodified lines
149149
150150 for (i = 0; i < MAX_PAGES; i++) {
151151 Page *p = &anm->pt[i];
152− p->base_record = get_le16(pb);
153− p->nb_records = get_le16(pb);
154− p->size = get_le16(pb);
152+ p->base_record = avio_rl16(pb);
153+ p->nb_records = avio_rl16(pb);
154+ p->size = avio_rl16(pb);
155155 }
156156
157157 /* find page of first frame */
@@ -211,7 +211,7 @@ repeat: · 53 unmodified lines
211211 tmp = url_ftell(pb);
212212 url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) +
213213 8 + anm->record * 2, SEEK_SET);
214− record_size = get_le16(pb);
214+ record_size = avio_rl16(pb);
215215 url_fseek(pb, tmp, SEEK_SET);
216216
217217 /* fetch record */
libavformat/apc.c+7−7
@@ -35,9 +35,9 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) · 34 unmodified lines
3535 AVIOContext *pb = s->pb;
3636 AVStream *st;
3737
38− get_le32(pb); /* CRYO */
39− get_le32(pb); /* _APC */
40− get_le32(pb); /* 1.20 */
38+ avio_rl32(pb); /* CRYO */
39+ avio_rl32(pb); /* _APC */
40+ avio_rl32(pb); /* 1.20 */
4141
4242 st = av_new_stream(s, 0);
4343 if (!st)
@@ -46,8 +46,8 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) · 2 unmodified lines
4646 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
4747 st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS;
4848
49− get_le32(pb); /* number of samples */
50− st->codec->sample_rate = get_le32(pb);
49+ avio_rl32(pb); /* number of samples */
50+ st->codec->sample_rate = avio_rl32(pb);
5151
5252 st->codec->extradata_size = 2 * 4;
5353 st->codec->extradata = av_malloc(st->codec->extradata_size +
@@ -56,10 +56,10 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) · 2 unmodified lines
5656 return AVERROR(ENOMEM);
5757
5858 /* initial predictor values for adpcm decoder */
59− get_buffer(pb, st->codec->extradata, 2 * 4);
59+ avio_read(pb, st->codec->extradata, 2 * 4);
6060
6161 st->codec->channels = 1;
62− if (get_le32(pb))
62+ if (avio_rl32(pb))
6363 st->codec->channels = 2;
6464
6565 st->codec->bits_per_coded_sample = 4;
libavformat/ape.c+30−30
@@ -162,11 +162,11 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) · 161 unmodified lines
162162 /* TODO: Skip any leading junk such as id3v2 tags */
163163 ape->junklength = 0;
164164
165− tag = get_le32(pb);
165+ tag = avio_rl32(pb);
166166 if (tag != MKTAG('M', 'A', 'C', ' '))
167167 return -1;
168168
169− ape->fileversion = get_le16(pb);
169+ ape->fileversion = avio_rl16(pb);
170170
171171 if (ape->fileversion < APE_MIN_VERSION || ape->fileversion > APE_MAX_VERSION) {
172172 av_log(s, AV_LOG_ERROR, "Unsupported file version - %d.%02d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10);
@@ -174,15 +174,15 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) · 1 unmodified line
174174 }
175175
176176 if (ape->fileversion >= 3980) {
177− ape->padding1 = get_le16(pb);
178− ape->descriptorlength = get_le32(pb);
179− ape->headerlength = get_le32(pb);
180− ape->seektablelength = get_le32(pb);
181− ape->wavheaderlength = get_le32(pb);
182− ape->audiodatalength = get_le32(pb);
183− ape->audiodatalength_high = get_le32(pb);
184− ape->wavtaillength = get_le32(pb);
185− get_buffer(pb, ape->md5, 16);
177+ ape->padding1 = avio_rl16(pb);
178+ ape->descriptorlength = avio_rl32(pb);
179+ ape->headerlength = avio_rl32(pb);
180+ ape->seektablelength = avio_rl32(pb);
181+ ape->wavheaderlength = avio_rl32(pb);
182+ ape->audiodatalength = avio_rl32(pb);
183+ ape->audiodatalength_high = avio_rl32(pb);
184+ ape->wavtaillength = avio_rl32(pb);
185+ avio_read(pb, ape->md5, 16);
186186
187187 /* Skip any unknown bytes at the end of the descriptor.
188188 This is for future compatibility */
@@ -190,26 +190,26 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) · 1 unmodified line
190190 url_fseek(pb, ape->descriptorlength - 52, SEEK_CUR);
191191
192192 /* Read header data */
193− ape->compressiontype = get_le16(pb);
194− ape->formatflags = get_le16(pb);
195− ape->blocksperframe = get_le32(pb);
196− ape->finalframeblocks = get_le32(pb);
197− ape->totalframes = get_le32(pb);
198− ape->bps = get_le16(pb);
199− ape->channels = get_le16(pb);
200− ape->samplerate = get_le32(pb);
193+ ape->compressiontype = avio_rl16(pb);
194+ ape->formatflags = avio_rl16(pb);
195+ ape->blocksperframe = avio_rl32(pb);
196+ ape->finalframeblocks = avio_rl32(pb);
197+ ape->totalframes = avio_rl32(pb);
198+ ape->bps = avio_rl16(pb);
199+ ape->channels = avio_rl16(pb);
200+ ape->samplerate = avio_rl32(pb);
201201 } else {
202202 ape->descriptorlength = 0;
203203 ape->headerlength = 32;
204204
205− ape->compressiontype = get_le16(pb);
206− ape->formatflags = get_le16(pb);
207− ape->channels = get_le16(pb);
208− ape->samplerate = get_le32(pb);
209− ape->wavheaderlength = get_le32(pb);
210− ape->wavtaillength = get_le32(pb);
211− ape->totalframes = get_le32(pb);
212− ape->finalframeblocks = get_le32(pb);
205+ ape->compressiontype = avio_rl16(pb);
206+ ape->formatflags = avio_rl16(pb);
207+ ape->channels = avio_rl16(pb);
208+ ape->samplerate = avio_rl32(pb);
209+ ape->wavheaderlength = avio_rl32(pb);
210+ ape->wavtaillength = avio_rl32(pb);
211+ ape->totalframes = avio_rl32(pb);
212+ ape->finalframeblocks = avio_rl32(pb);
213213
214214 if (ape->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) {
215215 url_fseek(pb, 4, SEEK_CUR); /* Skip the peak level */
@@ -217,7 +217,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) · 1 unmodified line
217217 }
218218
219219 if (ape->formatflags & MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS) {
220− ape->seektablelength = get_le32(pb);
220+ ape->seektablelength = avio_rl32(pb);
221221 ape->headerlength += 4;
222222 ape->seektablelength *= sizeof(int32_t);
223223 } else
@@ -260,7 +260,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) · 36 unmodified lines
260260 if (ape->seektablelength > 0) {
261261 ape->seektable = av_malloc(ape->seektablelength);
262262 for (i = 0; i < ape->seektablelength / sizeof(uint32_t); i++)
263− ape->seektable[i] = get_le32(pb);
263+ ape->seektable[i] = avio_rl32(pb);
264264 }
265265
266266 ape->frames[0].pos = ape->firstframe;
@@ -355,7 +355,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt) · 88 unmodified lines
355355
356356 AV_WL32(pkt->data , nblocks);
357357 AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip);
358− ret = get_buffer(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
358+ ret = avio_read(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
359359
360360 pkt->pts = ape->frames[ape->currentframe].pts;
361361 pkt->stream_index = 0;
libavformat/apetag.c+9−9
@@ -38,10 +38,10 @@ static int ape_tag_read_field(AVFormatContext *s) · 37 unmodified lines
3838 uint32_t size, flags;
3939 int i, c;
4040
41− size = get_le32(pb); /* field size */
42− flags = get_le32(pb); /* field flags */
41+ size = avio_rl32(pb); /* field size */
42+ flags = avio_rl32(pb); /* field flags */
4343 for (i = 0; i < sizeof(key) - 1; i++) {
44− c = get_byte(pb);
44+ c = avio_r8(pb);
4545 if (c < 0x20 || c > 0x7E)
4646 break;
4747 else
@@ -57,7 +57,7 @@ static int ape_tag_read_field(AVFormatContext *s) · 9 unmodified lines
5757 value = av_malloc(size+1);
5858 if (!value)
5959 return AVERROR(ENOMEM);
60− get_buffer(pb, value, size);
60+ avio_read(pb, value, size);
6161 value[size] = 0;
6262 av_metadata_set2(&s->metadata, key, value, AV_METADATA_DONT_STRDUP_VAL);
6363 return 0;
@@ -76,30 +76,30 @@ void ff_ape_parse_tag(AVFormatContext *s) · 12 unmodified lines
7676
7777 url_fseek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET);
7878
79− get_buffer(pb, buf, 8); /* APETAGEX */
79+ avio_read(pb, buf, 8); /* APETAGEX */
8080 if (strncmp(buf, "APETAGEX", 8)) {
8181 return;
8282 }
8383
84− val = get_le32(pb); /* APE tag version */
84+ val = avio_rl32(pb); /* APE tag version */
8585 if (val > APE_TAG_VERSION) {
8686 av_log(s, AV_LOG_ERROR, "Unsupported tag version. (>=%d)\n", APE_TAG_VERSION);
8787 return;
8888 }
8989
90− tag_bytes = get_le32(pb); /* tag size */
90+ tag_bytes = avio_rl32(pb); /* tag size */
9191 if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) {
9292 av_log(s, AV_LOG_ERROR, "Tag size is way too big\n");
9393 return;
9494 }
9595
96− fields = get_le32(pb); /* number of fields */
96+ fields = avio_rl32(pb); /* number of fields */
9797 if (fields > 65536) {
9898 av_log(s, AV_LOG_ERROR, "Too many tag fields (%d)\n", fields);
9999 return;
100100 }
101101
102− val = get_le32(pb); /* flags */
102+ val = avio_rl32(pb); /* flags */
103103 if (val & APE_TAG_FLAG_IS_HEADER) {
104104 av_log(s, AV_LOG_ERROR, "APE Tag is a header\n");
105105 return;
libavformat/asfdec.c+127−127
@@ -135,7 +135,7 @@ static void print_guid(const ff_asf_guid *g) · 134 unmodified lines
135135 void ff_get_guid(AVIOContext *s, ff_asf_guid *g)
136136 {
137137 assert(sizeof(*g) == 16);
138− get_buffer(s, *g, sizeof(*g));
138+ avio_read(s, *g, sizeof(*g));
139139 }
140140
141141 static int asf_probe(AVProbeData *pd)
@@ -149,10 +149,10 @@ static int asf_probe(AVProbeData *pd) · 7 unmodified lines
149149
150150 static int get_value(AVIOContext *pb, int type){
151151 switch(type){
152− case 2: return get_le32(pb);
153− case 3: return get_le32(pb);
154− case 4: return get_le64(pb);
155− case 5: return get_le16(pb);
152+ case 2: return avio_rl32(pb);
153+ case 3: return avio_rl32(pb);
154+ case 4: return avio_rl64(pb);
155+ case 5: return avio_rl16(pb);
156156 default:return INT_MIN;
157157 }
158158 }
@@ -191,17 +191,17 @@ static int asf_read_file_properties(AVFormatContext *s, int64_t size) · 32 unmodified lines
191191 AVIOContext *pb = s->pb;
192192
193193 ff_get_guid(pb, &asf->hdr.guid);
194− asf->hdr.file_size = get_le64(pb);
195− asf->hdr.create_time = get_le64(pb);
196− get_le64(pb); /* number of packets */
197− asf->hdr.play_time = get_le64(pb);
198− asf->hdr.send_time = get_le64(pb);
199− asf->hdr.preroll = get_le32(pb);
200− asf->hdr.ignore = get_le32(pb);
201− asf->hdr.flags = get_le32(pb);
202− asf->hdr.min_pktsize = get_le32(pb);
203− asf->hdr.max_pktsize = get_le32(pb);
204− asf->hdr.max_bitrate = get_le32(pb);
194+ asf->hdr.file_size = avio_rl64(pb);
195+ asf->hdr.create_time = avio_rl64(pb);
196+ avio_rl64(pb); /* number of packets */
197+ asf->hdr.play_time = avio_rl64(pb);
198+ asf->hdr.send_time = avio_rl64(pb);
199+ asf->hdr.preroll = avio_rl32(pb);
200+ asf->hdr.ignore = avio_rl32(pb);
201+ asf->hdr.flags = avio_rl32(pb);
202+ asf->hdr.min_pktsize = avio_rl32(pb);
203+ asf->hdr.max_pktsize = avio_rl32(pb);
204+ asf->hdr.max_bitrate = avio_rl32(pb);
205205 s->packet_size = asf->hdr.max_pktsize;
206206
207207 return 0;
@@ -263,14 +263,14 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) · 55 unmodified lines
263263 return -1;
264264 }
265265 ff_get_guid(pb, &g);
266− total_size = get_le64(pb);
267− type_specific_size = get_le32(pb);
268− get_le32(pb);
269− st->id = get_le16(pb) & 0x7f; /* stream id */
266+ total_size = avio_rl64(pb);
267+ type_specific_size = avio_rl32(pb);
268+ avio_rl32(pb);
269+ st->id = avio_rl16(pb) & 0x7f; /* stream id */
270270 // mapping of asf ID to AV stream ID;
271271 asf->asfid2avid[st->id] = s->nb_streams - 1;
272272
273− get_le32(pb);
273+ avio_rl32(pb);
274274
275275 if (test_for_ext_stream_audio) {
276276 ff_get_guid(pb, &g);
@@ -278,11 +278,11 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) · 1 unmodified line
278278 type = AVMEDIA_TYPE_AUDIO;
279279 is_dvr_ms_audio=1;
280280 ff_get_guid(pb, &g);
281− get_le32(pb);
282− get_le32(pb);
283− get_le32(pb);
281+ avio_rl32(pb);
282+ avio_rl32(pb);
283+ avio_rl32(pb);
284284 ff_get_guid(pb, &g);
285− get_le32(pb);
285+ avio_rl32(pb);
286286 }
287287 }
288288
@@ -303,11 +303,11 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) · 14 unmodified lines
303303 /* We have to init the frame size at some point .... */
304304 pos2 = url_ftell(pb);
305305 if (size >= (pos2 + 8 - pos1 + 24)) {
306− asf_st->ds_span = get_byte(pb);
307− asf_st->ds_packet_size = get_le16(pb);
308− asf_st->ds_chunk_size = get_le16(pb);
309− get_le16(pb); //ds_data_size
310− get_byte(pb); //ds_silence_data
306+ asf_st->ds_span = avio_r8(pb);
307+ asf_st->ds_packet_size = avio_rl16(pb);
308+ asf_st->ds_chunk_size = avio_rl16(pb);
309+ avio_rl16(pb); //ds_data_size
310+ avio_r8(pb); //ds_silence_data
311311 }
312312 //printf("Descrambling: ps:%d cs:%d ds:%d s:%d sd:%d\n",
313313 // asf_st->ds_packet_size, asf_st->ds_chunk_size,
@@ -339,23 +339,23 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) · 25 unmodified lines
339339 }
340340 } else if (type == AVMEDIA_TYPE_VIDEO &&
341341 size - (url_ftell(pb) - pos1 + 24) >= 51) {
342− get_le32(pb);
343− get_le32(pb);
344− get_byte(pb);
345− get_le16(pb); /* size */
346− sizeX= get_le32(pb); /* size */
347− st->codec->width = get_le32(pb);
348− st->codec->height = get_le32(pb);
342+ avio_rl32(pb);
343+ avio_rl32(pb);
344+ avio_r8(pb);
345+ avio_rl16(pb); /* size */
346+ sizeX= avio_rl32(pb); /* size */
347+ st->codec->width = avio_rl32(pb);
348+ st->codec->height = avio_rl32(pb);
349349 /* not available for asf */
350− get_le16(pb); /* panes */
351− st->codec->bits_per_coded_sample = get_le16(pb); /* depth */
352− tag1 = get_le32(pb);
350+ avio_rl16(pb); /* panes */
351+ st->codec->bits_per_coded_sample = avio_rl16(pb); /* depth */
352+ tag1 = avio_rl32(pb);
353353 url_fskip(pb, 20);
354354 // av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX);
355355 if (sizeX > 40) {
356356 st->codec->extradata_size = sizeX - 40;
357357 st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
358− get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
358+ avio_read(pb, st->codec->extradata, st->codec->extradata_size);
359359 }
360360
361361 /* Extract palette from extradata if bpp <= 8 */
@@ -402,39 +402,39 @@ static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size) · 40 unmodified lines
402402 uint32_t ext_d, leak_rate, stream_num;
403403 unsigned int stream_languageid_index;
404404
405− get_le64(pb); // starttime
406− get_le64(pb); // endtime
407− leak_rate = get_le32(pb); // leak-datarate
408− get_le32(pb); // bucket-datasize
409− get_le32(pb); // init-bucket-fullness
410− get_le32(pb); // alt-leak-datarate
411− get_le32(pb); // alt-bucket-datasize
412− get_le32(pb); // alt-init-bucket-fullness
413− get_le32(pb); // max-object-size
414− get_le32(pb); // flags (reliable,seekable,no_cleanpoints?,resend-live-cleanpoints, rest of bits reserved)
415− stream_num = get_le16(pb); // stream-num
416−
417− stream_languageid_index = get_le16(pb); // stream-language-id-index
405+ avio_rl64(pb); // starttime
406+ avio_rl64(pb); // endtime
407+ leak_rate = avio_rl32(pb); // leak-datarate
408+ avio_rl32(pb); // bucket-datasize
409+ avio_rl32(pb); // init-bucket-fullness
410+ avio_rl32(pb); // alt-leak-datarate
411+ avio_rl32(pb); // alt-bucket-datasize
412+ avio_rl32(pb); // alt-init-bucket-fullness
413+ avio_rl32(pb); // max-object-size
414+ avio_rl32(pb); // flags (reliable,seekable,no_cleanpoints?,resend-live-cleanpoints, rest of bits reserved)
415+ stream_num = avio_rl16(pb); // stream-num
416+
417+ stream_languageid_index = avio_rl16(pb); // stream-language-id-index
418418 if (stream_num < 128)
419419 asf->streams[stream_num].stream_language_index = stream_languageid_index;
420420
421− get_le64(pb); // avg frametime in 100ns units
422− stream_ct = get_le16(pb); //stream-name-count
423− payload_ext_ct = get_le16(pb); //payload-extension-system-count
421+ avio_rl64(pb); // avg frametime in 100ns units
422+ stream_ct = avio_rl16(pb); //stream-name-count
423+ payload_ext_ct = avio_rl16(pb); //payload-extension-system-count
424424
425425 if (stream_num < 128)
426426 asf->stream_bitrates[stream_num] = leak_rate;
427427
428428 for (i=0; i<stream_ct; i++){
429− get_le16(pb);
430− ext_len = get_le16(pb);
429+ avio_rl16(pb);
430+ ext_len = avio_rl16(pb);
431431 url_fseek(pb, ext_len, SEEK_CUR);
432432 }
433433
434434 for (i=0; i<payload_ext_ct; i++){
435435 ff_get_guid(pb, &g);
436− ext_d=get_le16(pb);
437− ext_len=get_le32(pb);
436+ ext_d=avio_rl16(pb);
437+ ext_len=avio_rl32(pb);
438438 url_fseek(pb, ext_len, SEEK_CUR);
439439 }
440440
@@ -446,11 +446,11 @@ static int asf_read_content_desc(AVFormatContext *s, int64_t size) · 5 unmodified lines
446446 AVIOContext *pb = s->pb;
447447 int len1, len2, len3, len4, len5;
448448
449− len1 = get_le16(pb);
450− len2 = get_le16(pb);
451− len3 = get_le16(pb);
452− len4 = get_le16(pb);
453− len5 = get_le16(pb);
449+ len1 = avio_rl16(pb);
450+ len2 = avio_rl16(pb);
451+ len3 = avio_rl16(pb);
452+ len4 = avio_rl16(pb);
453+ len5 = avio_rl16(pb);
454454 get_tag(s, "title" , 0, len1);
455455 get_tag(s, "author" , 0, len2);
456456 get_tag(s, "copyright", 0, len3);
@@ -466,18 +466,18 @@ static int asf_read_ext_content_desc(AVFormatContext *s, int64_t size) · 9 unmodified lines
466466 ASFContext *asf = s->priv_data;
467467 int desc_count, i, ret;
468468
469− desc_count = get_le16(pb);
469+ desc_count = avio_rl16(pb);
470470 for(i=0;i<desc_count;i++) {
471471 int name_len,value_type,value_len;
472472 char name[1024];
473473
474− name_len = get_le16(pb);
474+ name_len = avio_rl16(pb);
475475 if (name_len%2) // must be even, broken lavf versions wrote len-1
476476 name_len += 1;
477477 if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len)
478478 url_fskip(pb, name_len - ret);
479− value_type = get_le16(pb);
480− value_len = get_le16(pb);
479+ value_type = avio_rl16(pb);
480+ value_len = avio_rl16(pb);
481481 if (!value_type && value_len%2)
482482 value_len += 1;
483483 /**
@@ -500,10 +500,10 @@ static int asf_read_language_list(AVFormatContext *s, int64_t size) · 16 unmodified lines
500500 AVIOContext *pb = s->pb;
501501 ASFContext *asf = s->priv_data;
502502 int j, ret;
503− int stream_count = get_le16(pb);
503+ int stream_count = avio_rl16(pb);
504504 for(j = 0; j < stream_count; j++) {
505505 char lang[6];
506− unsigned int lang_len = get_byte(pb);
506+ unsigned int lang_len = avio_r8(pb);
507507 if ((ret = avio_get_str16le(pb, lang_len, lang, sizeof(lang))) < lang_len)
508508 url_fskip(pb, lang_len - ret);
509509 if (j < 128)
@@ -519,21 +519,21 @@ static int asf_read_metadata(AVFormatContext *s, int64_t size) · 9 unmodified lines
519519 ASFContext *asf = s->priv_data;
520520 int n, stream_num, name_len, value_len, value_type, value_num;
521521 int ret, i;
522− n = get_le16(pb);
522+ n = avio_rl16(pb);
523523
524524 for(i=0;i<n;i++) {
525525 char name[1024];
526526
527− get_le16(pb); //lang_list_index
528− stream_num= get_le16(pb);
529− name_len= get_le16(pb);
530− value_type= get_le16(pb);
531− value_len= get_le32(pb);
527+ avio_rl16(pb); //lang_list_index
528+ stream_num= avio_rl16(pb);
529+ name_len= avio_rl16(pb);
530+ value_type= avio_rl16(pb);
531+ value_len= avio_rl32(pb);
532532
533533 if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len)
534534 url_fskip(pb, name_len - ret);
535535 //av_log(s, AV_LOG_ERROR, "%d %d %d %d %d <%s>\n", i, stream_num, name_len, value_type, value_len, name);
536− value_num= get_le16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere
536+ value_num= avio_rl16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere
537537 url_fskip(pb, value_len - 2);
538538
539539 if(stream_num<128){
@@ -551,25 +551,25 @@ static int asf_read_marker(AVFormatContext *s, int64_t size) · 11 unmodified lines
551551 int i, count, name_len, ret;
552552 char name[1024];
553553
554− get_le64(pb); // reserved 16 bytes
555− get_le64(pb); // ...
556− count = get_le32(pb); // markers count
557− get_le16(pb); // reserved 2 bytes
558− name_len = get_le16(pb); // name length
554+ avio_rl64(pb); // reserved 16 bytes
555+ avio_rl64(pb); // ...
556+ count = avio_rl32(pb); // markers count
557+ avio_rl16(pb); // reserved 2 bytes
558+ name_len = avio_rl16(pb); // name length
559559 for(i=0;i<name_len;i++){
560− get_byte(pb); // skip the name
560+ avio_r8(pb); // skip the name
561561 }
562562
563563 for(i=0;i<count;i++){
564564 int64_t pres_time;
565565 int name_len;
566566
567− get_le64(pb); // offset, 8 bytes
568− pres_time = get_le64(pb); // presentation time
569− get_le16(pb); // entry length
570− get_le32(pb); // send time
571− get_le32(pb); // flags
572− name_len = get_le32(pb); // name length
567+ avio_rl64(pb); // offset, 8 bytes
568+ pres_time = avio_rl64(pb); // presentation time
569+ avio_rl16(pb); // entry length
570+ avio_rl32(pb); // send time
571+ avio_rl32(pb); // flags
572+ name_len = avio_rl32(pb); // name length
573573 if ((ret = avio_get_str16le(pb, name_len * 2, name, sizeof(name))) < name_len)
574574 url_fskip(pb, name_len - ret);
575575 ff_new_chapter(s, i, (AVRational){1, 10000000}, pres_time, AV_NOPTS_VALUE, name );
@@ -589,15 +589,15 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 13 unmodified lines
589589 ff_get_guid(pb, &g);
590590 if (ff_guidcmp(&g, &ff_asf_header))
591591 return -1;
592− get_le64(pb);
593− get_le32(pb);
594− get_byte(pb);
595− get_byte(pb);
592+ avio_rl64(pb);
593+ avio_rl32(pb);
594+ avio_r8(pb);
595+ avio_r8(pb);
596596 memset(&asf->asfid2avid, -1, sizeof(asf->asfid2avid));
597597 for(;;) {
598598 uint64_t gpos= url_ftell(pb);
599599 ff_get_guid(pb, &g);
600− gsize = get_le64(pb);
600+ gsize = avio_rl64(pb);
601601 av_dlog(s, "%08"PRIx64": ", gpos);
602602 print_guid(&g);
603603 av_dlog(s, " size=0x%"PRIx64"\n", gsize);
@@ -634,8 +634,8 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 30 unmodified lines
634634 } else if (!ff_guidcmp(&g, &ff_asf_head1_guid)) {
635635 int v1, v2;
636636 ff_get_guid(pb, &g);
637− v1 = get_le32(pb);
638− v2 = get_le16(pb);
637+ v1 = avio_rl32(pb);
638+ v2 = avio_rl16(pb);
639639 continue;
640640 } else if (!ff_guidcmp(&g, &ff_asf_marker_header)) {
641641 asf_read_marker(s, gsize);
@@ -657,9 +657,9 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 15 unmodified lines
657657 url_fseek(pb, gpos + gsize, SEEK_SET);
658658 }
659659 ff_get_guid(pb, &g);
660− get_le64(pb);
661− get_byte(pb);
662− get_byte(pb);
660+ avio_rl64(pb);
661+ avio_r8(pb);
662+ avio_r8(pb);
663663 if (url_feof(pb))
664664 return -1;
665665 asf->data_offset = url_ftell(pb);
@@ -704,9 +704,9 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 38 unmodified lines
704704 #define DO_2BITS(bits, var, defval) \
705705 switch (bits & 3) \
706706 { \
707− case 3: var = get_le32(pb); rsize += 4; break; \
708− case 2: var = get_le16(pb); rsize += 2; break; \
709− case 1: var = get_byte(pb); rsize++; break; \
707+ case 3: var = avio_rl32(pb); rsize += 4; break; \
708+ case 2: var = avio_rl16(pb); rsize += 2; break; \
709+ case 1: var = avio_r8(pb); rsize++; break; \
710710 default: var = defval; break; \
711711 }
712712
@@ -731,7 +731,7 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) · 18 unmodified lines
731731 c=d=e=-1;
732732 while(off-- > 0){
733733 c=d; d=e;
734− e= get_byte(pb);
734+ e= avio_r8(pb);
735735 if(c == 0x82 && !d && !e)
736736 break;
737737 }
@@ -754,8 +754,8 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) · 16 unmodified lines
754754 av_log(s, AV_LOG_ERROR, "ff asf bad non zero\n");
755755 return -1;
756756 }
757− c= get_byte(pb);
758− d= get_byte(pb);
757+ c= avio_r8(pb);
758+ d= avio_r8(pb);
759759 rsize+=3;
760760 }else{
761761 url_fseek(pb, -1, SEEK_CUR); //FIXME
@@ -778,12 +778,12 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) · 16 unmodified lines
778778 return -1;
779779 }
780780
781− asf->packet_timestamp = get_le32(pb);
782− get_le16(pb); /* duration */
781+ asf->packet_timestamp = avio_rl32(pb);
782+ avio_rl16(pb); /* duration */
783783 // rsize has at least 11 bytes which have to be present
784784
785785 if (asf->packet_flags & 0x01) {
786− asf->packet_segsizetype = get_byte(pb); rsize++;
786+ asf->packet_segsizetype = avio_r8(pb); rsize++;
787787 asf->packet_segments = asf->packet_segsizetype & 0x3f;
788788 } else {
789789 asf->packet_segments = 1;
@@ -804,7 +804,7 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) · 14 unmodified lines
804804 static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
805805 ASFContext *asf = s->priv_data;
806806 int rsize = 1;
807− int num = get_byte(pb);
807+ int num = avio_r8(pb);
808808 int64_t ts0, ts1;
809809
810810 asf->packet_segments--;
@@ -816,21 +816,21 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ · 5 unmodified lines
816816 DO_2BITS(asf->packet_property, asf->packet_replic_size, 0);
817817 //printf("key:%d stream:%d seq:%d offset:%d replic_size:%d\n", asf->packet_key_frame, asf->stream_index, asf->packet_seq, //asf->packet_frag_offset, asf->packet_replic_size);
818818 if (asf->packet_replic_size >= 8) {
819− asf->packet_obj_size = get_le32(pb);
819+ asf->packet_obj_size = avio_rl32(pb);
820820 if(asf->packet_obj_size >= (1<<24) || asf->packet_obj_size <= 0){
821821 av_log(s, AV_LOG_ERROR, "packet_obj_size invalid\n");
822822 return -1;
823823 }
824− asf->packet_frag_timestamp = get_le32(pb); // timestamp
824+ asf->packet_frag_timestamp = avio_rl32(pb); // timestamp
825825 if(asf->packet_replic_size >= 8+38+4){
826826 // for(i=0; i<asf->packet_replic_size-8; i++)
827−// av_log(s, AV_LOG_DEBUG, "%02X ",get_byte(pb));
827+// av_log(s, AV_LOG_DEBUG, "%02X ",avio_r8(pb));
828828 // av_log(s, AV_LOG_DEBUG, "\n");
829829 url_fskip(pb, 10);
830− ts0= get_le64(pb);
831− ts1= get_le64(pb);
830+ ts0= avio_rl64(pb);
831+ ts1= avio_rl64(pb);
832832 url_fskip(pb, 12);
833− get_le32(pb);
833+ avio_rl32(pb);
834834 url_fskip(pb, asf->packet_replic_size - 8 - 38 - 4);
835835 if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000;
836836 else asf->packet_frag_timestamp= AV_NOPTS_VALUE;
@@ -843,7 +843,7 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ · 6 unmodified lines
843843 asf->packet_frag_offset = 0;
844844 asf->packet_frag_timestamp = asf->packet_timestamp;
845845
846− asf->packet_time_delta = get_byte(pb);
846+ asf->packet_time_delta = avio_r8(pb);
847847 rsize++;
848848 }else if(asf->packet_replic_size!=0){
849849 av_log(s, AV_LOG_ERROR, "unexpected packet_replic_size of %d\n", asf->packet_replic_size);
@@ -928,7 +928,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk · 78 unmodified lines
928928 // frag_offset is here used as the beginning timestamp
929929 asf->packet_frag_timestamp = asf->packet_time_start;
930930 asf->packet_time_start += asf->packet_time_delta;
931− asf->packet_obj_size = asf->packet_frag_size = get_byte(pb);
931+ asf->packet_obj_size = asf->packet_frag_size = avio_r8(pb);
932932 asf->packet_size_left--;
933933 asf->packet_multi_size--;
934934 if (asf->packet_multi_size < asf->packet_obj_size)
@@ -988,7 +988,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk · 53 unmodified lines
988988 continue;
989989 }
990990
991− ret = get_buffer(pb, asf_st->pkt.data + asf->packet_frag_offset,
991+ ret = avio_read(pb, asf_st->pkt.data + asf->packet_frag_offset,
992992 asf->packet_frag_size);
993993 if (ret != asf->packet_frag_size) {
994994 if (ret < 0 || asf->packet_frag_offset + ret == 0)
@@ -1194,7 +1194,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index) · 199 unmodified lines
11941194 /* the data object can be followed by other top-level objects,
11951195 skip them until the simple index object is reached */
11961196 while (ff_guidcmp(&g, &index_guid)) {
1197− int64_t gsize= get_le64(s->pb);
1197+ int64_t gsize= avio_rl64(s->pb);
11981198 if (gsize < 24 || url_feof(s->pb)) {
11991199 url_fseek(s->pb, current_pos, SEEK_SET);
12001200 return;
@@ -1206,16 +1206,16 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index) · 5 unmodified lines
12061206 {
12071207 int64_t itime, last_pos=-1;
12081208 int pct, ict;
1209− int64_t av_unused gsize= get_le64(s->pb);
1209+ int64_t av_unused gsize= avio_rl64(s->pb);
12101210 ff_get_guid(s->pb, &g);
1211− itime=get_le64(s->pb);
1212− pct=get_le32(s->pb);
1213− ict=get_le32(s->pb);
1211+ itime=avio_rl64(s->pb);
1212+ pct=avio_rl32(s->pb);
1213+ ict=avio_rl32(s->pb);
12141214 av_log(s, AV_LOG_DEBUG, "itime:0x%"PRIx64", pct:%d, ict:%d\n",itime,pct,ict);
12151215
12161216 for (i=0;i<ict;i++){
1217− int pktnum=get_le32(s->pb);
1218− int pktct =get_le16(s->pb);
1217+ int pktnum=avio_rl32(s->pb);
1218+ int pktct =avio_rl16(s->pb);
12191219 int64_t pos = s->data_offset + s->packet_size*(int64_t)pktnum;
12201220 int64_t index_pts= av_rescale(itime, i, 10000);
12211221
libavformat/au.c+6−6
@@ -127,15 +127,15 @@ static int au_read_header(AVFormatContext *s, · 126 unmodified lines
127127 AVStream *st;
128128
129129 /* check ".snd" header */
130− tag = get_le32(pb);
130+ tag = avio_rl32(pb);
131131 if (tag != MKTAG('.', 's', 'n', 'd'))
132132 return -1;
133− size = get_be32(pb); /* header size */
134− get_be32(pb); /* data size */
133+ size = avio_rb32(pb); /* header size */
134+ avio_rb32(pb); /* data size */
135135
136− id = get_be32(pb);
137− rate = get_be32(pb);
138− channels = get_be32(pb);
136+ id = avio_rb32(pb);
137+ rate = avio_rb32(pb);
138+ channels = avio_rb32(pb);
139139
140140 codec = ff_codec_get_id(codec_au_tags, id);
141141
libavformat/avidec.c+79−79
@@ -107,10 +107,10 @@ static int get_riff(AVFormatContext *s, AVIOContext *pb) · 106 unmodified lines
107107 int i;
108108
109109 /* check RIFF header */
110− get_buffer(pb, header, 4);
111− avi->riff_end = get_le32(pb); /* RIFF chunk size */
110+ avio_read(pb, header, 4);
111+ avi->riff_end = avio_rl32(pb); /* RIFF chunk size */
112112 avi->riff_end += url_ftell(pb); /* RIFF chunk end */
113− get_buffer(pb, header+4, 4);
113+ avio_read(pb, header+4, 4);
114114
115115 for(i=0; avi_headers[i][0]; i++)
116116 if(!memcmp(header, avi_headers[i], 8))
@@ -127,12 +127,12 @@ static int get_riff(AVFormatContext *s, AVIOContext *pb) · 10 unmodified lines
127127 static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
128128 AVIContext *avi = s->priv_data;
129129 AVIOContext *pb = s->pb;
130− int longs_pre_entry= get_le16(pb);
131− int index_sub_type = get_byte(pb);
132− int index_type = get_byte(pb);
133− int entries_in_use = get_le32(pb);
134− int chunk_id = get_le32(pb);
135− int64_t base = get_le64(pb);
130+ int longs_pre_entry= avio_rl16(pb);
131+ int index_sub_type = avio_r8(pb);
132+ int index_type = avio_r8(pb);
133+ int entries_in_use = avio_rl32(pb);
134+ int chunk_id = avio_rl32(pb);
135+ int64_t base = avio_rl64(pb);
136136 int stream_id= 10*((chunk_id&0xFF) - '0') + (((chunk_id>>8)&0xFF) - '0');
137137 AVStream *st;
138138 AVIStream *ast;
@@ -153,7 +153,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ · 14 unmodified lines
153153 if(index_sub_type)
154154 return -1;
155155
156− get_le32(pb);
156+ avio_rl32(pb);
157157
158158 if(index_type && longs_pre_entry != 2)
159159 return -1;
@@ -170,8 +170,8 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ · 10 unmodified lines
170170
171171 for(i=0; i<entries_in_use; i++){
172172 if(index_type){
173− int64_t pos= get_le32(pb) + base - 8;
174− int len = get_le32(pb);
173+ int64_t pos= avio_rl32(pb) + base - 8;
174+ int len = avio_rl32(pb);
175175 int key= len >= 0;
176176 len &= 0x7FFFFFFF;
177177
@@ -191,9 +191,9 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ · 13 unmodified lines
191191 }else{
192192 int64_t offset, pos;
193193 int duration;
194− offset = get_le64(pb);
195− get_le32(pb); /* size */
196− duration = get_le32(pb);
194+ offset = avio_rl64(pb);
195+ avio_rl32(pb); /* size */
196+ duration = avio_rl32(pb);
197197
198198 if(url_feof(pb))
199199 return -1;
@@ -256,7 +256,7 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t · 56 unmodified lines
256256 value = av_malloc(size+1);
257257 if (!value)
258258 return -1;
259− get_buffer(pb, value, size);
259+ avio_read(pb, value, size);
260260 value[size]=0;
261261
262262 AV_WL32(key, tag);
@@ -268,8 +268,8 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t · 5 unmodified lines
268268 static void avi_read_info(AVFormatContext *s, uint64_t end)
269269 {
270270 while (url_ftell(s->pb) < end) {
271− uint32_t tag = get_le32(s->pb);
272− uint32_t size = get_le32(s->pb);
271+ uint32_t tag = avio_rl32(s->pb);
272+ uint32_t size = avio_rl32(s->pb);
273273 avi_read_tag(s, NULL, tag, size);
274274 }
275275 }
@@ -299,17 +299,17 @@ static void avi_metadata_creation_time(AVMetadata **metadata, char *date) · 23 unmodified lines
299299 static void avi_read_nikon(AVFormatContext *s, uint64_t end)
300300 {
301301 while (url_ftell(s->pb) < end) {
302− uint32_t tag = get_le32(s->pb);
303− uint32_t size = get_le32(s->pb);
302+ uint32_t tag = avio_rl32(s->pb);
303+ uint32_t size = avio_rl32(s->pb);
304304 switch (tag) {
305305 case MKTAG('n', 'c', 't', 'g'): { /* Nikon Tags */
306306 uint64_t tag_end = url_ftell(s->pb) + size;
307307 while (url_ftell(s->pb) < tag_end) {
308− uint16_t tag = get_le16(s->pb);
309− uint16_t size = get_le16(s->pb);
308+ uint16_t tag = avio_rl16(s->pb);
309+ uint16_t size = avio_rl16(s->pb);
310310 const char *name = NULL;
311311 char buffer[64] = {0};
312− size -= get_buffer(s->pb, buffer,
312+ size -= avio_read(s->pb, buffer,
313313 FFMIN(size, sizeof(buffer)-1));
314314 switch (tag) {
315315 case 0x03: name = "maker"; break;
@@ -362,8 +362,8 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 46 unmodified lines
362362 for(;;) {
363363 if (url_feof(pb))
364364 goto fail;
365− tag = get_le32(pb);
366− size = get_le32(pb);
365+ tag = avio_rl32(pb);
366+ size = avio_rl32(pb);
367367
368368 print_tag("tag", tag, size);
369369
@@ -371,7 +371,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1 unmodified line
371371 case MKTAG('L', 'I', 'S', 'T'):
372372 list_end = url_ftell(pb) + size;
373373 /* Ignored, except at start of video packets. */
374− tag1 = get_le32(pb);
374+ tag1 = avio_rl32(pb);
375375
376376 print_tag("list", tag1, 0);
377377
@@ -391,7 +391,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 13 unmodified lines
391391 case MKTAG('I', 'D', 'I', 'T'): {
392392 unsigned char date[64] = {0};
393393 size += (size & 1);
394− size -= get_buffer(pb, date, FFMIN(size, sizeof(date)-1));
394+ size -= avio_read(pb, date, FFMIN(size, sizeof(date)-1));
395395 url_fskip(pb, size);
396396 avi_metadata_creation_time(&s->metadata, date);
397397 break;
@@ -405,24 +405,24 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 7 unmodified lines
405405 case MKTAG('a', 'v', 'i', 'h'):
406406 /* AVI header */
407407 /* using frame_period is bad idea */
408− frame_period = get_le32(pb);
409− bit_rate = get_le32(pb) * 8;
410− get_le32(pb);
411− avi->non_interleaved |= get_le32(pb) & AVIF_MUSTUSEINDEX;
408+ frame_period = avio_rl32(pb);
409+ bit_rate = avio_rl32(pb) * 8;
410+ avio_rl32(pb);
411+ avi->non_interleaved |= avio_rl32(pb) & AVIF_MUSTUSEINDEX;
412412
413413 url_fskip(pb, 2 * 4);
414− get_le32(pb);
415− get_le32(pb);
416− avih_width=get_le32(pb);
417− avih_height=get_le32(pb);
414+ avio_rl32(pb);
415+ avio_rl32(pb);
416+ avih_width=avio_rl32(pb);
417+ avih_height=avio_rl32(pb);
418418
419419 url_fskip(pb, size - 10 * 4);
420420 break;
421421 case MKTAG('s', 't', 'r', 'h'):
422422 /* stream header */
423423
424− tag1 = get_le32(pb);
425− handler = get_le32(pb); /* codec tag */
424+ tag1 = avio_rl32(pb);
425+ handler = avio_rl32(pb); /* codec tag */
426426
427427 if(tag1 == MKTAG('p', 'a', 'd', 's')){
428428 url_fskip(pb, size - 8);
@@ -470,11 +470,11 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 41 unmodified lines
470470 }
471471 s->streams[0]->priv_data = ast;
472472 url_fskip(pb, 3 * 4);
473− ast->scale = get_le32(pb);
474− ast->rate = get_le32(pb);
473+ ast->scale = avio_rl32(pb);
474+ ast->rate = avio_rl32(pb);
475475 url_fskip(pb, 4); /* start time */
476476
477− dv_dur = get_le32(pb);
477+ dv_dur = avio_rl32(pb);
478478 if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) {
479479 dv_dur *= AV_TIME_BASE;
480480 s->duration = av_rescale(dv_dur, ast->scale, ast->rate);
@@ -492,12 +492,12 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 11 unmodified lines
492492 assert(stream_index < s->nb_streams);
493493 st->codec->stream_codec_tag= handler;
494494
495− get_le32(pb); /* flags */
496− get_le16(pb); /* priority */
497− get_le16(pb); /* language */
498− get_le32(pb); /* initial frame */
499− ast->scale = get_le32(pb);
500− ast->rate = get_le32(pb);
495+ avio_rl32(pb); /* flags */
496+ avio_rl16(pb); /* priority */
497+ avio_rl16(pb); /* language */
498+ avio_rl32(pb); /* initial frame */
499+ ast->scale = avio_rl32(pb);
500+ ast->rate = avio_rl32(pb);
501501 if(!(ast->scale && ast->rate)){
502502 av_log(s, AV_LOG_WARNING, "scale/rate is %u/%u which is invalid. (This file has been generated by broken software.)\n", ast->scale, ast->rate);
503503 if(frame_period){
@@ -510,13 +510,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 6 unmodified lines
510510 }
511511 av_set_pts_info(st, 64, ast->scale, ast->rate);
512512
513− ast->cum_len=get_le32(pb); /* start */
514− st->nb_frames = get_le32(pb);
513+ ast->cum_len=avio_rl32(pb); /* start */
514+ st->nb_frames = avio_rl32(pb);
515515
516516 st->start_time = 0;
517− get_le32(pb); /* buffer size */
518− get_le32(pb); /* quality */
519− ast->sample_size = get_le32(pb); /* sample ssize */
517+ avio_rl32(pb); /* buffer size */
518+ avio_rl32(pb); /* quality */
519+ ast->sample_size = avio_rl32(pb); /* sample ssize */
520520 ast->cum_len *= FFMAX(1, ast->sample_size);
521521 // av_log(s, AV_LOG_DEBUG, "%d %d %d %d\n", ast->rate, ast->scale, ast->start, ast->sample_size);
522522
@@ -579,11 +579,11 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 56 unmodified lines
579579 st->codec->extradata_size= 0;
580580 return AVERROR(ENOMEM);
581581 }
582− get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
582+ avio_read(pb, st->codec->extradata, st->codec->extradata_size);
583583 }
584584
585585 if(st->codec->extradata_size & 1) //FIXME check if the encoder really did this correctly
586− get_byte(pb);
586+ avio_r8(pb);
587587
588588 /* Extract palette from extradata if bpp <= 8. */
589589 /* This code assumes that extradata contains only palette. */
@@ -675,17 +675,17 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 85 unmodified lines
675675 AVRational active, active_aspect;
676676
677677 st = s->streams[stream_index];
678− get_le32(pb);
679− get_le32(pb);
680− get_le32(pb);
681− get_le32(pb);
682− get_le32(pb);
683−
684− active_aspect.den= get_le16(pb);
685− active_aspect.num= get_le16(pb);
686− active.num = get_le32(pb);
687− active.den = get_le32(pb);
688− get_le32(pb); //nbFieldsPerFrame
678+ avio_rl32(pb);
679+ avio_rl32(pb);
680+ avio_rl32(pb);
681+ avio_rl32(pb);
682+ avio_rl32(pb);
683+
684+ active_aspect.den= avio_rl16(pb);
685+ active_aspect.num= avio_rl16(pb);
686+ active.num = avio_rl32(pb);
687+ active.den = avio_rl32(pb);
688+ avio_rl32(pb); //nbFieldsPerFrame
689689
690690 if(active_aspect.num && active_aspect.den && active.num && active.den){
691691 st->sample_aspect_ratio= av_div_q(active_aspect, active);
@@ -756,7 +756,7 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) { · 64 unmodified lines
756756 pkt->size - 7,
757757 0, NULL, NULL, NULL, NULL);
758758 AVProbeData pd;
759− unsigned int desc_len = get_le32(pb);
759+ unsigned int desc_len = avio_rl32(pb);
760760
761761 if (desc_len > pb->buf_end - pb->buf_ptr)
762762 goto error;
@@ -766,8 +766,8 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) { · 3 unmodified lines
766766 if (*desc)
767767 av_metadata_set2(&st->metadata, "title", desc, 0);
768768
769− get_le16(pb); /* flags? */
770− get_le32(pb); /* data size */
769+ avio_rl16(pb); /* flags? */
770+ avio_rl32(pb); /* data size */
771771
772772 pd = (AVProbeData) { .buf = pb->buf_ptr, .buf_size = pb->buf_end - pb->buf_ptr };
773773 if (!(sub_demuxer = av_probe_input_format2(&pd, 1, &score)))
@@ -994,7 +994,7 @@ resync: · 220 unmodified lines
994994
995995 for(j=0; j<7; j++)
996996 d[j]= d[j+1];
997− d[7]= get_byte(pb);
997+ d[7]= avio_r8(pb);
998998
999999 size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24);
10001000
@@ -1065,13 +1065,13 @@ resync: · 64 unmodified lines
10651065 }
10661066
10671067 if (d[2] == 'p' && d[3] == 'c' && size<=4*256+4) {
1068− int k = get_byte(pb);
1069− int last = (k + get_byte(pb) - 1) & 0xFF;
1068+ int k = avio_r8(pb);
1069+ int last = (k + avio_r8(pb) - 1) & 0xFF;
10701070
1071− get_le16(pb); //flags
1071+ avio_rl16(pb); //flags
10721072
10731073 for (; k <= last; k++)
1074− ast->pal[k] = get_be32(pb)>>8;// b + (g << 8) + (r << 16);
1074+ ast->pal[k] = avio_rb32(pb)>>8;// b + (g << 8) + (r << 16);
10751075 ast->has_pal= 1;
10761076 goto resync;
10771077 } else if( ((ast->prefix_count<5 || sync+9 > i) && d[2]<128 && d[3]<128) ||
@@ -1123,10 +1123,10 @@ static int avi_read_idx1(AVFormatContext *s, int size) · 45 unmodified lines
11231123
11241124 /* Read the entries and sort them in each stream component. */
11251125 for(i = 0; i < nb_index_entries; i++) {
1126− tag = get_le32(pb);
1127− flags = get_le32(pb);
1128− pos = get_le32(pb);
1129− len = get_le32(pb);
1126+ tag = avio_rl32(pb);
1127+ flags = avio_rl32(pb);
1128+ pos = avio_rl32(pb);
1129+ len = avio_rl32(pb);
11301130 #if defined(DEBUG_SEEK)
11311131 av_log(s, AV_LOG_DEBUG, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/",
11321132 i, tag, flags, pos, len);
@@ -1175,7 +1175,7 @@ static int guess_ni_flag(AVFormatContext *s){ · 42 unmodified lines
11751175 if(n >= 2){
11761176 int64_t pos= st->index_entries[0].pos;
11771177 url_fseek(s->pb, pos + 4, SEEK_SET);
1178− size= get_le32(s->pb);
1178+ size= avio_rl32(s->pb);
11791179 if(pos + size > st->index_entries[1].pos)
11801180 last_start= INT64_MAX;
11811181 }
@@ -1205,8 +1205,8 @@ static int avi_load_index(AVFormatContext *s) · 23 unmodified lines
12051205 for(;;) {
12061206 if (url_feof(pb))
12071207 break;
1208− tag = get_le32(pb);
1209− size = get_le32(pb);
1208+ tag = avio_rl32(pb);
1209+ size = avio_rl32(pb);
12101210 #ifdef DEBUG_SEEK
12111211 printf("tag=%c%c%c%c size=0x%x\n",
12121212 tag & 0xff,
libavformat/avio.h+29−10
@@ -378,6 +378,25 @@ attribute_deprecated AVIOContext *av_alloc_put_byte( · 377 unmodified lines
378378 int (*read_packet)(void *opaque, uint8_t *buf, int buf_size),
379379 int (*write_packet)(void *opaque, uint8_t *buf, int buf_size),
380380 int64_t (*seek)(void *opaque, int64_t offset, int whence));
381+
382+/**
383+ * @defgroup old_avio_funcs Old put_/get_*() functions
384+ * @deprecated use the avio_ -prefixed functions instead.
385+ * @{
386+ */
387+attribute_deprecated int get_buffer(AVIOContext *s, unsigned char *buf, int size);
388+attribute_deprecated int get_byte(AVIOContext *s);
389+attribute_deprecated unsigned int get_le16(AVIOContext *s);
390+attribute_deprecated unsigned int get_le24(AVIOContext *s);
391+attribute_deprecated unsigned int get_le32(AVIOContext *s);
392+attribute_deprecated uint64_t get_le64(AVIOContext *s);
393+attribute_deprecated unsigned int get_be16(AVIOContext *s);
394+attribute_deprecated unsigned int get_be24(AVIOContext *s);
395+attribute_deprecated unsigned int get_be32(AVIOContext *s);
396+attribute_deprecated uint64_t get_be64(AVIOContext *s);
397+/**
398+ * @}
399+ */
381400 #endif
382401
383402 AVIOContext *avio_alloc_context(
@@ -477,7 +496,7 @@ void put_flush_packet(AVIOContext *s); · 93 unmodified lines
477496 * Read size bytes from AVIOContext into buf.
478497 * @return number of bytes read or AVERROR
479498 */
480−int get_buffer(AVIOContext *s, unsigned char *buf, int size);
499+int avio_read(AVIOContext *s, unsigned char *buf, int size);
481500
482501 /**
483502 * Read size bytes from AVIOContext into buf.
@@ -489,11 +508,11 @@ int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size); · 5 unmodified lines
489508
490509 /** @note return 0 if EOF, so you cannot use it if EOF handling is
491510 necessary */
492−int get_byte(AVIOContext *s);
493−unsigned int get_le24(AVIOContext *s);
494−unsigned int get_le32(AVIOContext *s);
495−uint64_t get_le64(AVIOContext *s);
496−unsigned int get_le16(AVIOContext *s);
511+int avio_r8 (AVIOContext *s);
512+unsigned int avio_rl16(AVIOContext *s);
513+unsigned int avio_rl24(AVIOContext *s);
514+unsigned int avio_rl32(AVIOContext *s);
515+uint64_t avio_rl64(AVIOContext *s);
497516
498517 /**
499518 * Read a UTF-16 string from pb and convert it to UTF-8.
@@ -505,10 +524,10 @@ int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen); · 5 unmodified lines
505524 int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen);
506525
507526 char *get_strz(AVIOContext *s, char *buf, int maxlen);
508−unsigned int get_be16(AVIOContext *s);
509−unsigned int get_be24(AVIOContext *s);
510−unsigned int get_be32(AVIOContext *s);
511−uint64_t get_be64(AVIOContext *s);
527+unsigned int avio_rb16(AVIOContext *s);
528+unsigned int avio_rb24(AVIOContext *s);
529+unsigned int avio_rb32(AVIOContext *s);
530+uint64_t avio_rb64(AVIOContext *s);
512531
513532 uint64_t ff_get_v(AVIOContext *bc);
514533
libavformat/aviobuf.c+57−31
@@ -298,6 +298,32 @@ void put_strz(AVIOContext *s, const char *str) · 297 unmodified lines
298298 {
299299 avio_put_str(s, str);
300300 }
301+
302+#define GET(name, type) \
303+ type get_be ##name(AVIOContext *s) \
304+{\
305+ return avio_rb ##name(s);\
306+}\
307+ type get_le ##name(AVIOContext *s) \
308+{\
309+ return avio_rl ##name(s);\
310+}
311+
312+GET(16, unsigned int)
313+GET(24, unsigned int)
314+GET(32, unsigned int)
315+GET(64, uint64_t)
316+
317+#undef GET
318+
319+int get_byte(AVIOContext *s)
320+{
321+ return avio_r8(s);
322+}
323+int get_buffer(AVIOContext *s, unsigned char *buf, int size)
324+{
325+ return avio_read(s, buf, size);
326+}
301327 #endif
302328
303329 int avio_put_str(AVIOContext *s, const char *str)
@@ -457,7 +483,7 @@ void init_checksum(AVIOContext *s, · 153 unmodified lines
457483 }
458484
459485 /* XXX: put an inline version */
460−int get_byte(AVIOContext *s)
486+int avio_r8(AVIOContext *s)
461487 {
462488 if (s->buf_ptr >= s->buf_end)
463489 fill_buffer(s);
@@ -475,7 +501,7 @@ int url_fgetc(AVIOContext *s) · 11 unmodified lines
475501 return URL_EOF;
476502 }
477503
478−int get_buffer(AVIOContext *s, unsigned char *buf, int size)
504+int avio_read(AVIOContext *s, unsigned char *buf, int size)
479505 {
480506 int len, size1;
481507
@@ -545,58 +571,58 @@ int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size) · 63 unmodified lines
545571 return len;
546572 }
547573
548−unsigned int get_le16(AVIOContext *s)
574+unsigned int avio_rl16(AVIOContext *s)
549575 {
550576 unsigned int val;
551− val = get_byte(s);
552− val |= get_byte(s) << 8;
577+ val = avio_r8(s);
578+ val |= avio_r8(s) << 8;
553579 return val;
554580 }
555581
556−unsigned int get_le24(AVIOContext *s)
582+unsigned int avio_rl24(AVIOContext *s)
557583 {
558584 unsigned int val;
559− val = get_le16(s);
560− val |= get_byte(s) << 16;
585+ val = avio_rl16(s);
586+ val |= avio_r8(s) << 16;
561587 return val;
562588 }
563589
564−unsigned int get_le32(AVIOContext *s)
590+unsigned int avio_rl32(AVIOContext *s)
565591 {
566592 unsigned int val;
567− val = get_le16(s);
568− val |= get_le16(s) << 16;
593+ val = avio_rl16(s);
594+ val |= avio_rl16(s) << 16;
569595 return val;
570596 }
571597
572−uint64_t get_le64(AVIOContext *s)
598+uint64_t avio_rl64(AVIOContext *s)
573599 {
574600 uint64_t val;
575− val = (uint64_t)get_le32(s);
576− val |= (uint64_t)get_le32(s) << 32;
601+ val = (uint64_t)avio_rl32(s);
602+ val |= (uint64_t)avio_rl32(s) << 32;
577603 return val;
578604 }
579605
580−unsigned int get_be16(AVIOContext *s)
606+unsigned int avio_rb16(AVIOContext *s)
581607 {
582608 unsigned int val;
583− val = get_byte(s) << 8;
584− val |= get_byte(s);
609+ val = avio_r8(s) << 8;
610+ val |= avio_r8(s);
585611 return val;
586612 }
587613
588−unsigned int get_be24(AVIOContext *s)
614+unsigned int avio_rb24(AVIOContext *s)
589615 {
590616 unsigned int val;
591− val = get_be16(s) << 8;
592− val |= get_byte(s);
617+ val = avio_rb16(s) << 8;
618+ val |= avio_r8(s);
593619 return val;
594620 }
595−unsigned int get_be32(AVIOContext *s)
621+unsigned int avio_rb32(AVIOContext *s)
596622 {
597623 unsigned int val;
598− val = get_be16(s) << 16;
599− val |= get_be16(s);
624+ val = avio_rb16(s) << 16;
625+ val |= avio_rb16(s);
600626 return val;
601627 }
602628
@@ -605,7 +631,7 @@ char *get_strz(AVIOContext *s, char *buf, int maxlen) · 2 unmodified lines
605631 int i = 0;
606632 char c;
607633
608− while ((c = get_byte(s))) {
634+ while ((c = avio_r8(s))) {
609635 if (i < maxlen-1)
610636 buf[i++] = c;
611637 }
@@ -621,7 +647,7 @@ int ff_get_line(AVIOContext *s, char *buf, int maxlen) · 9 unmodified lines
621647 char c;
622648
623649 do {
624− c = get_byte(s);
650+ c = avio_r8(s);
625651 if (c && i < maxlen-1)
626652 buf[i++] = c;
627653 } while (c != '\n' && c);
@@ -647,16 +673,16 @@ int ff_get_line(AVIOContext *s, char *buf, int maxlen) · 19 unmodified lines
647673 return ret;\
648674 }\
649675
650−GET_STR16(le, get_le16)
651−GET_STR16(be, get_be16)
676+GET_STR16(le, avio_rl16)
677+GET_STR16(be, avio_rb16)
652678
653679 #undef GET_STR16
654680
655−uint64_t get_be64(AVIOContext *s)
681+uint64_t avio_rb64(AVIOContext *s)
656682 {
657683 uint64_t val;
658− val = (uint64_t)get_be32(s) << 32;
659− val |= (uint64_t)get_be32(s);
684+ val = (uint64_t)avio_rb32(s) << 32;
685+ val |= (uint64_t)avio_rb32(s);
660686 return val;
661687 }
662688
@@ -665,7 +691,7 @@ uint64_t ff_get_v(AVIOContext *bc){ · 2 unmodified lines
665691 int tmp;
666692
667693 do{
668− tmp = get_byte(bc);
694+ tmp = avio_r8(bc);
669695 val= (val<<7) + (tmp&127);
670696 }while(tmp&128);
671697 return val;
libavformat/avs.c+12−12
@@ -62,11 +62,11 @@ static int avs_read_header(AVFormatContext * s, AVFormatParameters * ap) · 61 unmodified lines
6262 s->ctx_flags |= AVFMTCTX_NOHEADER;
6363
6464 url_fskip(s->pb, 4);
65− avs->width = get_le16(s->pb);
66− avs->height = get_le16(s->pb);
67− avs->bits_per_sample = get_le16(s->pb);
68− avs->fps = get_le16(s->pb);
69− avs->nb_frames = get_le32(s->pb);
65+ avs->width = avio_rl16(s->pb);
66+ avs->height = avio_rl16(s->pb);
67+ avs->bits_per_sample = avio_rl16(s->pb);
68+ avs->fps = avio_rl16(s->pb);
69+ avs->nb_frames = avio_rl32(s->pb);
7070 avs->remaining_frame_size = 0;
7171 avs->remaining_audio_size = 0;
7272
@@ -104,7 +104,7 @@ avs_read_video_packet(AVFormatContext * s, AVPacket * pkt, · 31 unmodified lines
104104 pkt->data[palette_size + 1] = type;
105105 pkt->data[palette_size + 2] = size & 0xFF;
106106 pkt->data[palette_size + 3] = (size >> 8) & 0xFF;
107− ret = get_buffer(s->pb, pkt->data + palette_size + 4, size - 4) + 4;
107+ ret = avio_read(s->pb, pkt->data + palette_size + 4, size - 4) + 4;
108108 if (ret < size) {
109109 av_free_packet(pkt);
110110 return AVERROR(EIO);
@@ -154,20 +154,20 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) · 43 unmodified lines
154154
155155 while (1) {
156156 if (avs->remaining_frame_size <= 0) {
157− if (!get_le16(s->pb)) /* found EOF */
157+ if (!avio_rl16(s->pb)) /* found EOF */
158158 return AVERROR(EIO);
159− avs->remaining_frame_size = get_le16(s->pb) - 4;
159+ avs->remaining_frame_size = avio_rl16(s->pb) - 4;
160160 }
161161
162162 while (avs->remaining_frame_size > 0) {
163− sub_type = get_byte(s->pb);
164− type = get_byte(s->pb);
165− size = get_le16(s->pb);
163+ sub_type = avio_r8(s->pb);
164+ type = avio_r8(s->pb);
165+ size = avio_rl16(s->pb);
166166 avs->remaining_frame_size -= size;
167167
168168 switch (type) {
169169 case AVS_PALETTE:
170− ret = get_buffer(s->pb, palette, size - 4);
170+ ret = avio_read(s->pb, palette, size - 4);
171171 if (ret < size - 4)
172172 return AVERROR(EIO);
173173 palette_size = size;
libavformat/bethsoftvid.c+15−15
@@ -68,7 +68,7 @@ static int vid_read_header(AVFormatContext *s, · 67 unmodified lines
6868 * int16s: always_512, nframes, width, height, delay, always_14
6969 */
7070 url_fseek(pb, 5, SEEK_CUR);
71− vid->nframes = get_le16(pb);
71+ vid->nframes = avio_rl16(pb);
7272
7373 stream = av_new_stream(s, 0);
7474 if (!stream)
@@ -76,11 +76,11 @@ static int vid_read_header(AVFormatContext *s, · 1 unmodified line
7676 av_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps
7777 stream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
7878 stream->codec->codec_id = CODEC_ID_BETHSOFTVID;
79− stream->codec->width = get_le16(pb);
80− stream->codec->height = get_le16(pb);
79+ stream->codec->width = avio_rl16(pb);
80+ stream->codec->height = avio_rl16(pb);
8181 stream->codec->pix_fmt = PIX_FMT_PAL8;
82− vid->bethsoft_global_delay = get_le16(pb);
83− get_le16(pb);
82+ vid->bethsoft_global_delay = avio_rl16(pb);
83+ avio_rl16(pb);
8484
8585 // done with video codec, set up audio codec
8686 stream = av_new_stream(s, 0);
@@ -117,11 +117,11 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, · 30 unmodified lines
117117 vidbuf_start[vidbuf_nbytes++] = block_type;
118118
119119 // get the video delay (next int16), and set the presentation time
120− vid->video_pts += vid->bethsoft_global_delay + get_le16(pb);
120+ vid->video_pts += vid->bethsoft_global_delay + avio_rl16(pb);
121121
122122 // set the y offset if it exists (decoder header data should be in data section)
123123 if(block_type == VIDEO_YOFF_P_FRAME){
124− if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2)
124+ if(avio_read(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2)
125125 goto fail;
126126 vidbuf_nbytes += 2;
127127 }
@@ -131,21 +131,21 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, · 3 unmodified lines
131131 if(!vidbuf_start)
132132 return AVERROR(ENOMEM);
133133
134− code = get_byte(pb);
134+ code = avio_r8(pb);
135135 vidbuf_start[vidbuf_nbytes++] = code;
136136
137137 if(code >= 0x80){ // rle sequence
138138 if(block_type == VIDEO_I_FRAME)
139− vidbuf_start[vidbuf_nbytes++] = get_byte(pb);
139+ vidbuf_start[vidbuf_nbytes++] = avio_r8(pb);
140140 } else if(code){ // plain sequence
141− if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], code) != code)
141+ if(avio_read(pb, &vidbuf_start[vidbuf_nbytes], code) != code)
142142 goto fail;
143143 vidbuf_nbytes += code;
144144 }
145145 bytes_copied += code & 0x7F;
146146 if(bytes_copied == npixels){ // sometimes no stop character is given, need to keep track of bytes copied
147147 // may contain a 0 byte even if read all pixels
148− if(get_byte(pb))
148+ if(avio_r8(pb))
149149 url_fseek(pb, -1, SEEK_CUR);
150150 break;
151151 }
@@ -182,7 +182,7 @@ static int vid_read_packet(AVFormatContext *s, · 30 unmodified lines
182182 if(vid->is_finished || url_feof(pb))
183183 return AVERROR(EIO);
184184
185− block_type = get_byte(pb);
185+ block_type = avio_r8(pb);
186186 switch(block_type){
187187 case PALETTE_BLOCK:
188188 url_fseek(pb, -1, SEEK_CUR); // include block type
@@ -195,12 +195,12 @@ static int vid_read_packet(AVFormatContext *s, · 6 unmodified lines
195195 return ret_value;
196196
197197 case FIRST_AUDIO_BLOCK:
198− get_le16(pb);
198+ avio_rl16(pb);
199199 // soundblaster DAC used for sample rate, as on specification page (link above)
200− s->streams[1]->codec->sample_rate = 1000000 / (256 - get_byte(pb));
200+ s->streams[1]->codec->sample_rate = 1000000 / (256 - avio_r8(pb));
201201 s->streams[1]->codec->bit_rate = s->streams[1]->codec->channels * s->streams[1]->codec->sample_rate * s->streams[1]->codec->bits_per_coded_sample;
202202 case AUDIO_BLOCK:
203− audio_length = get_le16(pb);
203+ audio_length = avio_rl16(pb);
204204 ret_value = av_get_packet(pb, pkt, audio_length);
205205 pkt->stream_index = 1;
206206 return ret_value != audio_length ? AVERROR(EIO) : ret_value;
libavformat/bfi.c+16−16
@@ -66,24 +66,24 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap) · 65 unmodified lines
6666
6767 /* Set the total number of frames. */
6868 url_fskip(pb, 8);
69− chunk_header = get_le32(pb);
70− bfi->nframes = get_le32(pb);
71− get_le32(pb);
72− get_le32(pb);
73− get_le32(pb);
74− fps = get_le32(pb);
69+ chunk_header = avio_rl32(pb);
70+ bfi->nframes = avio_rl32(pb);
71+ avio_rl32(pb);
72+ avio_rl32(pb);
73+ avio_rl32(pb);
74+ fps = avio_rl32(pb);
7575 url_fskip(pb, 12);
76− vstream->codec->width = get_le32(pb);
77− vstream->codec->height = get_le32(pb);
76+ vstream->codec->width = avio_rl32(pb);
77+ vstream->codec->height = avio_rl32(pb);
7878
7979 /*Load the palette to extradata */
8080 url_fskip(pb, 8);
8181 vstream->codec->extradata = av_malloc(768);
8282 vstream->codec->extradata_size = 768;
83− get_buffer(pb, vstream->codec->extradata,
83+ avio_read(pb, vstream->codec->extradata,
8484 vstream->codec->extradata_size);
8585
86− astream->codec->sample_rate = get_le32(pb);
86+ astream->codec->sample_rate = avio_rl32(pb);
8787
8888 /* Set up the video codec... */
8989 av_set_pts_info(vstream, 32, 1, fps);
@@ -119,14 +119,14 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt) · 29 unmodified lines
119119 while(state != MKTAG('S','A','V','I')){
120120 if (url_feof(pb))
121121 return AVERROR(EIO);
122− state = 256*state + get_byte(pb);
122+ state = 256*state + avio_r8(pb);
123123 }
124124 /* Now that the chunk's location is confirmed, we proceed... */
125− chunk_size = get_le32(pb);
126− get_le32(pb);
127− audio_offset = get_le32(pb);
128− get_le32(pb);
129− video_offset = get_le32(pb);
125+ chunk_size = avio_rl32(pb);
126+ avio_rl32(pb);
127+ audio_offset = avio_rl32(pb);
128+ avio_rl32(pb);
129+ video_offset = avio_rl32(pb);
130130 audio_size = video_offset - audio_offset;
131131 bfi->video_size = chunk_size - video_offset;
132132
libavformat/bink.c+15−15
@@ -82,17 +82,17 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 81 unmodified lines
8282 if (!vst)
8383 return AVERROR(ENOMEM);
8484
85− vst->codec->codec_tag = get_le32(pb);
85+ vst->codec->codec_tag = avio_rl32(pb);
8686
87− bink->file_size = get_le32(pb) + 8;
88− vst->duration = get_le32(pb);
87+ bink->file_size = avio_rl32(pb) + 8;
88+ vst->duration = avio_rl32(pb);
8989
9090 if (vst->duration > 1000000) {
9191 av_log(s, AV_LOG_ERROR, "invalid header: more than 1000000 frames\n");
9292 return AVERROR(EIO);
9393 }
9494
95− if (get_le32(pb) > bink->file_size) {
95+ if (avio_rl32(pb) > bink->file_size) {
9696 av_log(s, AV_LOG_ERROR,
9797 "invalid header: largest frame size greater than file size\n");
9898 return AVERROR(EIO);
@@ -100,11 +100,11 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 1 unmodified line
100100
101101 url_fskip(pb, 4);
102102
103− vst->codec->width = get_le32(pb);
104− vst->codec->height = get_le32(pb);
103+ vst->codec->width = avio_rl32(pb);
104+ vst->codec->height = avio_rl32(pb);
105105
106− fps_num = get_le32(pb);
107− fps_den = get_le32(pb);
106+ fps_num = avio_rl32(pb);
107+ fps_den = avio_rl32(pb);
108108 if (fps_num == 0 || fps_den == 0) {
109109 av_log(s, AV_LOG_ERROR, "invalid header: invalid fps (%d/%d)\n", fps_num, fps_den);
110110 return AVERROR(EIO);
@@ -115,9 +115,9 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 4 unmodified lines
115115 vst->codec->codec_id = CODEC_ID_BINKVIDEO;
116116 vst->codec->extradata = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE);
117117 vst->codec->extradata_size = 4;
118− get_buffer(pb, vst->codec->extradata, 4);
118+ avio_read(pb, vst->codec->extradata, 4);
119119
120− bink->num_audio_tracks = get_le32(pb);
120+ bink->num_audio_tracks = avio_rl32(pb);
121121
122122 if (bink->num_audio_tracks > BINK_MAX_AUDIO_TRACKS) {
123123 av_log(s, AV_LOG_ERROR,
@@ -135,9 +135,9 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 11 unmodified lines
135135 return AVERROR(ENOMEM);
136136 ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
137137 ast->codec->codec_tag = 0;
138− ast->codec->sample_rate = get_le16(pb);
138+ ast->codec->sample_rate = avio_rl16(pb);
139139 av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
140− flags = get_le16(pb);
140+ flags = avio_rl16(pb);
141141 ast->codec->codec_id = flags & BINK_AUD_USEDCT ?
142142 CODEC_ID_BINKAUDIO_DCT : CODEC_ID_BINKAUDIO_RDFT;
143143 ast->codec->channels = flags & BINK_AUD_STEREO ? 2 : 1;
@@ -147,14 +147,14 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 3 unmodified lines
147147 }
148148
149149 /* frame index table */
150− next_pos = get_le32(pb);
150+ next_pos = avio_rl32(pb);
151151 for (i = 0; i < vst->duration; i++) {
152152 pos = next_pos;
153153 if (i == vst->duration - 1) {
154154 next_pos = bink->file_size;
155155 keyframe = 0;
156156 } else {
157− next_pos = get_le32(pb);
157+ next_pos = avio_rl32(pb);
158158 keyframe = pos & 1;
159159 }
160160 pos &= ~1;
@@ -201,7 +201,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) · 40 unmodified lines
201201 }
202202
203203 while (bink->current_track < bink->num_audio_tracks) {
204− uint32_t audio_size = get_le32(pb);
204+ uint32_t audio_size = avio_rl32(pb);
205205 if (audio_size > bink->remain_packet_size - 4) {
206206 av_log(s, AV_LOG_ERROR,
207207 "frame %"PRId64": audio size in header (%u) > size of packet left (%u)\n",
libavformat/c93.c+9−9
@@ -66,9 +66,9 @@ static int read_header(AVFormatContext *s, · 65 unmodified lines
6666 int framecount = 0;
6767
6868 for (i = 0; i < 512; i++) {
69− c93->block_records[i].index = get_le16(pb);
70− c93->block_records[i].length = get_byte(pb);
71− c93->block_records[i].frames = get_byte(pb);
69+ c93->block_records[i].index = avio_rl16(pb);
70+ c93->block_records[i].length = avio_r8(pb);
71+ c93->block_records[i].frames = avio_r8(pb);
7272 if (c93->block_records[i].frames > 32) {
7373 av_log(s, AV_LOG_ERROR, "too many frames in block\n");
7474 return AVERROR_INVALIDDATA;
@@ -114,7 +114,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) · 39 unmodified lines
114114 if (c93->next_pkt_is_audio) {
115115 c93->current_frame++;
116116 c93->next_pkt_is_audio = 0;
117− datasize = get_le16(pb);
117+ datasize = avio_rl16(pb);
118118 if (datasize > 42) {
119119 if (!c93->audio) {
120120 c93->audio = av_new_stream(s, 1);
@@ -142,13 +142,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) · 21 unmodified lines
142142 if (c93->current_frame == 0) {
143143 url_fseek(pb, br->index * 2048, SEEK_SET);
144144 for (i = 0; i < 32; i++) {
145− c93->frame_offsets[i] = get_le32(pb);
145+ c93->frame_offsets[i] = avio_rl32(pb);
146146 }
147147 }
148148
149149 url_fseek(pb,br->index * 2048 +
150150 c93->frame_offsets[c93->current_frame], SEEK_SET);
151− datasize = get_le16(pb); /* video frame size */
151+ datasize = avio_rl16(pb); /* video frame size */
152152
153153 ret = av_new_packet(pkt, datasize + 768 + 1);
154154 if (ret < 0)
@@ -156,13 +156,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) · 1 unmodified line
156156 pkt->data[0] = 0;
157157 pkt->size = datasize + 1;
158158
159− ret = get_buffer(pb, pkt->data + 1, datasize);
159+ ret = avio_read(pb, pkt->data + 1, datasize);
160160 if (ret < datasize) {
161161 ret = AVERROR(EIO);
162162 goto fail;
163163 }
164164
165− datasize = get_le16(pb); /* palette size */
165+ datasize = avio_rl16(pb); /* palette size */
166166 if (datasize) {
167167 if (datasize != 768) {
168168 av_log(s, AV_LOG_ERROR, "invalid palette size %u\n", datasize);
@@ -170,7 +170,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) · 1 unmodified line
170170 goto fail;
171171 }
172172 pkt->data[0] |= C93_HAS_PALETTE;
173− ret = get_buffer(pb, pkt->data + pkt->size, datasize);
173+ ret = avio_read(pb, pkt->data + pkt->size, datasize);
174174 if (ret < datasize) {
175175 ret = AVERROR(EIO);
176176 goto fail;
libavformat/cafdec.c+18−18
@@ -65,14 +65,14 @@ static int read_desc_chunk(AVFormatContext *s) · 64 unmodified lines
6565
6666 /* parse format description */
6767 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
68− st->codec->sample_rate = av_int2dbl(get_be64(pb));
69− st->codec->codec_tag = get_be32(pb);
70− flags = get_be32(pb);
71− caf->bytes_per_packet = get_be32(pb);
68+ st->codec->sample_rate = av_int2dbl(avio_rb64(pb));
69+ st->codec->codec_tag = avio_rb32(pb);
70+ flags = avio_rb32(pb);
71+ caf->bytes_per_packet = avio_rb32(pb);
7272 st->codec->block_align = caf->bytes_per_packet;
73− caf->frames_per_packet = get_be32(pb);
74− st->codec->channels = get_be32(pb);
75− st->codec->bits_per_coded_sample = get_be32(pb);
73+ caf->frames_per_packet = avio_rb32(pb);
74+ st->codec->channels = avio_rb32(pb);
75+ st->codec->bits_per_coded_sample = avio_rb32(pb);
7676
7777 /* calculate bit rate for constant size packets */
7878 if (caf->frames_per_packet > 0 && caf->bytes_per_packet > 0) {
@@ -127,14 +127,14 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) · 48 unmodified lines
127127 st->codec->extradata = av_mallocz(ALAC_HEADER + FF_INPUT_BUFFER_PADDING_SIZE);
128128 if (!st->codec->extradata)
129129 return AVERROR(ENOMEM);
130− get_buffer(pb, st->codec->extradata, ALAC_HEADER);
130+ avio_read(pb, st->codec->extradata, ALAC_HEADER);
131131 st->codec->extradata_size = ALAC_HEADER;
132132 url_fskip(pb, size - ALAC_PREAMBLE - ALAC_HEADER);
133133 } else {
134134 st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
135135 if (!st->codec->extradata)
136136 return AVERROR(ENOMEM);
137− get_buffer(pb, st->codec->extradata, size);
137+ avio_read(pb, st->codec->extradata, size);
138138 st->codec->extradata_size = size;
139139 }
140140
@@ -152,13 +152,13 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size) · 11 unmodified lines
152152
153153 ccount = url_ftell(pb);
154154
155− num_packets = get_be64(pb);
155+ num_packets = avio_rb64(pb);
156156 if (num_packets < 0 || INT32_MAX / sizeof(AVIndexEntry) < num_packets)
157157 return AVERROR_INVALIDDATA;
158158
159− st->nb_frames = get_be64(pb); /* valid frames */
160− st->nb_frames += get_be32(pb); /* priming frames */
161− st->nb_frames += get_be32(pb); /* remainder frames */
159+ st->nb_frames = avio_rb64(pb); /* valid frames */
160+ st->nb_frames += avio_rb32(pb); /* priming frames */
161+ st->nb_frames += avio_rb32(pb); /* remainder frames */
162162
163163 st->duration = 0;
164164 for (i = 0; i < num_packets; i++) {
@@ -181,7 +181,7 @@ static void read_info_chunk(AVFormatContext *s, int64_t size) · 16 unmodified lines
181181 {
182182 AVIOContext *pb = s->pb;
183183 unsigned int i;
184− unsigned int nb_entries = get_be32(pb);
184+ unsigned int nb_entries = avio_rb32(pb);
185185 for (i = 0; i < nb_entries; i++) {
186186 char key[32];
187187 char value[1024];
@@ -204,11 +204,11 @@ static int read_header(AVFormatContext *s, · 16 unmodified lines
204204 url_fskip(pb, 8); /* magic, version, file flags */
205205
206206 /* audio description chunk */
207− if (get_be32(pb) != MKBETAG('d','e','s','c')) {
207+ if (avio_rb32(pb) != MKBETAG('d','e','s','c')) {
208208 av_log(s, AV_LOG_ERROR, "desc chunk not present\n");
209209 return AVERROR_INVALIDDATA;
210210 }
211− size = get_be64(pb);
211+ size = avio_rb64(pb);
212212 if (size != 32)
213213 return AVERROR_INVALIDDATA;
214214
@@ -226,8 +226,8 @@ static int read_header(AVFormatContext *s, · 11 unmodified lines
226226 if (found_data && (caf->data_size < 0 || url_is_streamed(pb)))
227227 break;
228228
229− tag = get_be32(pb);
230− size = get_be64(pb);
229+ tag = avio_rb32(pb);
230+ size = avio_rb64(pb);
231231 if (url_feof(pb))
232232 break;
233233
libavformat/daud.c+2−2
@@ -40,8 +40,8 @@ static int daud_packet(AVFormatContext *s, AVPacket *pkt) { · 39 unmodified lines
4040 int ret, size;
4141 if (url_feof(pb))
4242 return AVERROR(EIO);
43− size = get_be16(pb);
44− get_be16(pb); // unknown
43+ size = avio_rb16(pb);
44+ avio_rb16(pb); // unknown
4545 ret = av_get_packet(pb, pkt, size);
4646 pkt->stream_index = 0;
4747 return ret;
libavformat/dsicin.c+15−15
@@ -73,16 +73,16 @@ static int cin_probe(AVProbeData *p) · 72 unmodified lines
7373 static int cin_read_file_header(CinDemuxContext *cin, AVIOContext *pb) {
7474 CinFileHeader *hdr = &cin->file_header;
7575
76− if (get_le32(pb) != 0x55AA0000)
76+ if (avio_rl32(pb) != 0x55AA0000)
7777 return AVERROR_INVALIDDATA;
7878
79− hdr->video_frame_size = get_le32(pb);
80− hdr->video_frame_width = get_le16(pb);
81− hdr->video_frame_height = get_le16(pb);
82− hdr->audio_frequency = get_le32(pb);
83− hdr->audio_bits = get_byte(pb);
84− hdr->audio_stereo = get_byte(pb);
85− hdr->audio_frame_size = get_le16(pb);
79+ hdr->video_frame_size = avio_rl32(pb);
80+ hdr->video_frame_width = avio_rl16(pb);
81+ hdr->video_frame_height = avio_rl16(pb);
82+ hdr->audio_frequency = avio_rl32(pb);
83+ hdr->audio_bits = avio_r8(pb);
84+ hdr->audio_stereo = avio_r8(pb);
85+ hdr->audio_frame_size = avio_rl16(pb);
8686
8787 if (hdr->audio_frequency != 22050 || hdr->audio_bits != 16 || hdr->audio_stereo != 0)
8888 return AVERROR_INVALIDDATA;
@@ -141,16 +141,16 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap) · 52 unmodified lines
141141 static int cin_read_frame_header(CinDemuxContext *cin, AVIOContext *pb) {
142142 CinFrameHeader *hdr = &cin->frame_header;
143143
144− hdr->video_frame_type = get_byte(pb);
145− hdr->audio_frame_type = get_byte(pb);
146− hdr->pal_colors_count = get_le16(pb);
147− hdr->video_frame_size = get_le32(pb);
148− hdr->audio_frame_size = get_le32(pb);
144+ hdr->video_frame_type = avio_r8(pb);
145+ hdr->audio_frame_type = avio_r8(pb);
146+ hdr->pal_colors_count = avio_rl16(pb);
147+ hdr->video_frame_size = avio_rl32(pb);
148+ hdr->audio_frame_size = avio_rl32(pb);
149149
150150 if (url_feof(pb) || url_ferror(pb))
151151 return AVERROR(EIO);
152152
153− if (get_le32(pb) != 0xAA55AA55)
153+ if (avio_rl32(pb) != 0xAA55AA55)
154154 return AVERROR_INVALIDDATA;
155155
156156 return 0;
@@ -191,7 +191,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt) · 34 unmodified lines
191191 pkt->data[2] = hdr->pal_colors_count >> 8;
192192 pkt->data[3] = hdr->video_frame_type;
193193
194− ret = get_buffer(pb, &pkt->data[4], pkt_size);
194+ ret = avio_read(pb, &pkt->data[4], pkt_size);
195195 if (ret < 0) {
196196 av_free_packet(pkt);
197197 return ret;
libavformat/dv.c+5−5
@@ -410,7 +410,7 @@ static int dv_read_header(AVFormatContext *s, · 409 unmodified lines
410410 if (!c->dv_demux)
411411 return -1;
412412
413− state = get_be32(s->pb);
413+ state = avio_rb32(s->pb);
414414 while ((state & 0xffffff7f) != 0x1f07003f) {
415415 if (url_feof(s->pb)) {
416416 av_log(s, AV_LOG_ERROR, "Cannot find DV header.\n");
@@ -420,14 +420,14 @@ static int dv_read_header(AVFormatContext *s, · 3 unmodified lines
420420 marker_pos = url_ftell(s->pb);
421421 if (state == 0xff3f0701 && url_ftell(s->pb) - marker_pos == 80) {
422422 url_fseek(s->pb, -163, SEEK_CUR);
423− state = get_be32(s->pb);
423+ state = avio_rb32(s->pb);
424424 break;
425425 }
426− state = (state << 8) | get_byte(s->pb);
426+ state = (state << 8) | avio_r8(s->pb);
427427 }
428428 AV_WB32(c->buf, state);
429429
430− if (get_buffer(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 ||
430+ if (avio_read(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 ||
431431 url_fseek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0)
432432 return AVERROR(EIO);
433433
@@ -455,7 +455,7 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt) · 21 unmodified lines
455455 if (!c->dv_demux->sys)
456456 return AVERROR(EIO);
457457 size = c->dv_demux->sys->frame_size;
458− if (get_buffer(s->pb, c->buf, size) <= 0)
458+ if (avio_read(s->pb, c->buf, size) <= 0)
459459 return AVERROR(EIO);
460460
461461 size = dv_produce_packet(c->dv_demux, pkt, c->buf, size);
libavformat/dxa.c+15−15
@@ -61,17 +61,17 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) · 60 unmodified lines
6161 int num, den;
6262 int flags;
6363
64− tag = get_le32(pb);
64+ tag = avio_rl32(pb);
6565 if (tag != MKTAG('D', 'E', 'X', 'A'))
6666 return -1;
67− flags = get_byte(pb);
68− c->frames = get_be16(pb);
67+ flags = avio_r8(pb);
68+ c->frames = avio_rb16(pb);
6969 if(!c->frames){
7070 av_log(s, AV_LOG_ERROR, "File contains no frames ???\n");
7171 return -1;
7272 }
7373
74− fps = get_be32(pb);
74+ fps = avio_rb32(pb);
7575 if(fps > 0){
7676 den = 1000;
7777 num = fps;
@@ -82,8 +82,8 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) · 4 unmodified lines
8282 den = 10;
8383 num = 1;
8484 }
85− w = get_be16(pb);
86− h = get_be16(pb);
85+ w = avio_rb16(pb);
86+ h = avio_rb16(pb);
8787 c->has_sound = 0;
8888
8989 st = av_new_stream(s, 0);
@@ -91,13 +91,13 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1 unmodified line
9191 return -1;
9292
9393 // Parse WAV data header
94− if(get_le32(pb) == MKTAG('W', 'A', 'V', 'E')){
94+ if(avio_rl32(pb) == MKTAG('W', 'A', 'V', 'E')){
9595 uint32_t size, fsize;
9696 c->has_sound = 1;
97− size = get_be32(pb);
97+ size = avio_rb32(pb);
9898 c->vidpos = url_ftell(pb) + size;
9999 url_fskip(pb, 16);
100− fsize = get_le32(pb);
100+ fsize = avio_rl32(pb);
101101
102102 ast = av_new_stream(s, 0);
103103 if (!ast)
@@ -105,8 +105,8 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1 unmodified line
105105 ff_get_wav_header(pb, ast->codec, fsize);
106106 // find 'data' chunk
107107 while(url_ftell(pb) < c->vidpos && !url_feof(pb)){
108− tag = get_le32(pb);
109− fsize = get_le32(pb);
108+ tag = avio_rl32(pb);
109+ fsize = avio_rl32(pb);
110110 if(tag == MKTAG('d', 'a', 't', 'a')) break;
111111 url_fskip(pb, fsize);
112112 }
@@ -163,7 +163,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) · 50 unmodified lines
163163 }
164164 url_fseek(s->pb, c->vidpos, SEEK_SET);
165165 while(!url_feof(s->pb) && c->frames){
166− get_buffer(s->pb, buf, 4);
166+ avio_read(s->pb, buf, 4);
167167 switch(AV_RL32(buf)){
168168 case MKTAG('N', 'U', 'L', 'L'):
169169 if(av_new_packet(pkt, 4 + pal_size) < 0)
@@ -178,10 +178,10 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) · 8 unmodified lines
178178 case MKTAG('C', 'M', 'A', 'P'):
179179 pal_size = 768+4;
180180 memcpy(pal, buf, 4);
181− get_buffer(s->pb, pal + 4, 768);
181+ avio_read(s->pb, pal + 4, 768);
182182 break;
183183 case MKTAG('F', 'R', 'A', 'M'):
184− get_buffer(s->pb, buf + 4, DXA_EXTRA_SIZE - 4);
184+ avio_read(s->pb, buf + 4, DXA_EXTRA_SIZE - 4);
185185 size = AV_RB32(buf + 5);
186186 if(size > 0xFFFFFF){
187187 av_log(s, AV_LOG_ERROR, "Frame size is too big: %d\n", size);
@@ -190,7 +190,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) · 2 unmodified lines
190190 if(av_new_packet(pkt, size + DXA_EXTRA_SIZE + pal_size) < 0)
191191 return AVERROR(ENOMEM);
192192 memcpy(pkt->data + pal_size, buf, DXA_EXTRA_SIZE);
193− ret = get_buffer(s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size);
193+ ret = avio_read(s->pb, pkt->data + DXA_EXTRA_SIZE + pal_size, size);
194194 if(ret != size){
195195 av_free_packet(pkt);
196196 return AVERROR(EIO);
libavformat/eacdata.c+2−2
@@ -51,7 +51,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) · 50 unmodified lines
5151 unsigned int sample_rate, header;
5252 AVStream *st;
5353
54− header = get_be16(pb);
54+ header = avio_rb16(pb);
5555 switch (header) {
5656 case 0x0400: cdata->channels = 1; break;
5757 case 0x0404: cdata->channels = 2; break;
@@ -61,7 +61,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) · 3 unmodified lines
6161 return -1;
6262 };
6363
64− sample_rate = get_be16(pb);
64+ sample_rate = avio_rb16(pb);
6565 url_fskip(pb, 12);
6666
6767 st = av_new_stream(s, 0);
libavformat/electronicarts.c+22−22
@@ -82,11 +82,11 @@ static uint32_t read_arbitary(AVIOContext *pb) { · 81 unmodified lines
8282 int i;
8383 uint32_t word;
8484
85− size = get_byte(pb);
85+ size = avio_r8(pb);
8686
8787 word = 0;
8888 for (i = 0; i < size; i++) {
89− byte = get_byte(pb);
89+ byte = avio_r8(pb);
9090 word <<= 8;
9191 word |= byte;
9292 }
@@ -112,7 +112,7 @@ static int process_audio_header_elements(AVFormatContext *s) · 19 unmodified lines
112112 while (!url_feof(pb) && inHeader) {
113113 int inSubheader;
114114 uint8_t byte;
115− byte = get_byte(pb);
115+ byte = avio_r8(pb);
116116
117117 switch (byte) {
118118 case 0xFD:
@@ -120,7 +120,7 @@ static int process_audio_header_elements(AVFormatContext *s) · 1 unmodified line
120120 inSubheader = 1;
121121 while (!url_feof(pb) && inSubheader) {
122122 uint8_t subbyte;
123− subbyte = get_byte(pb);
123+ subbyte = avio_r8(pb);
124124
125125 switch (subbyte) {
126126 case 0x80:
@@ -218,10 +218,10 @@ static int process_audio_header_eacs(AVFormatContext *s) · 91 unmodified lines
218218 AVIOContext *pb = s->pb;
219219 int compression_type;
220220
221− ea->sample_rate = ea->big_endian ? get_be32(pb) : get_le32(pb);
222− ea->bytes = get_byte(pb); /* 1=8-bit, 2=16-bit */
223− ea->num_channels = get_byte(pb);
224− compression_type = get_byte(pb);
221+ ea->sample_rate = ea->big_endian ? avio_rb32(pb) : avio_rl32(pb);
222+ ea->bytes = avio_r8(pb); /* 1=8-bit, 2=16-bit */
223+ ea->num_channels = avio_r8(pb);
224+ compression_type = avio_r8(pb);
225225 url_fskip(pb, 13);
226226
227227 switch (compression_type) {
@@ -249,9 +249,9 @@ static int process_audio_header_sead(AVFormatContext *s) · 21 unmodified lines
249249 EaDemuxContext *ea = s->priv_data;
250250 AVIOContext *pb = s->pb;
251251
252− ea->sample_rate = get_le32(pb);
253− ea->bytes = get_le32(pb); /* 1=8-bit, 2=16-bit */
254− ea->num_channels = get_le32(pb);
252+ ea->sample_rate = avio_rl32(pb);
253+ ea->bytes = avio_rl32(pb); /* 1=8-bit, 2=16-bit */
254+ ea->num_channels = avio_rl32(pb);
255255 ea->audio_codec = CODEC_ID_ADPCM_IMA_EA_SEAD;
256256
257257 return 1;
@@ -262,8 +262,8 @@ static int process_video_header_mdec(AVFormatContext *s) · 4 unmodified lines
262262 EaDemuxContext *ea = s->priv_data;
263263 AVIOContext *pb = s->pb;
264264 url_fskip(pb, 4);
265− ea->width = get_le16(pb);
266− ea->height = get_le16(pb);
265+ ea->width = avio_rl16(pb);
266+ ea->height = avio_rl16(pb);
267267 ea->time_base = (AVRational){1,15};
268268 ea->video_codec = CODEC_ID_MDEC;
269269 return 1;
@@ -275,8 +275,8 @@ static int process_video_header_vp6(AVFormatContext *s) · 5 unmodified lines
275275 AVIOContext *pb = s->pb;
276276
277277 url_fskip(pb, 16);
278− ea->time_base.den = get_le32(pb);
279− ea->time_base.num = get_le32(pb);
278+ ea->time_base.den = avio_rl32(pb);
279+ ea->time_base.num = avio_rl32(pb);
280280 ea->video_codec = CODEC_ID_VP6;
281281
282282 return 1;
@@ -296,8 +296,8 @@ static int process_ea_header(AVFormatContext *s) { · 13 unmodified lines
296296 unsigned int startpos = url_ftell(pb);
297297 int err = 0;
298298
299− blockid = get_le32(pb);
300− size = get_le32(pb);
299+ blockid = avio_rl32(pb);
300+ size = avio_rl32(pb);
301301 if (i == 0)
302302 ea->big_endian = size > 0x000FFFFF;
303303 if (ea->big_endian)
@@ -305,7 +305,7 @@ static int process_ea_header(AVFormatContext *s) { · 1 unmodified line
305305
306306 switch (blockid) {
307307 case ISNh_TAG:
308− if (get_le32(pb) != EACS_TAG) {
308+ if (avio_rl32(pb) != EACS_TAG) {
309309 av_log (s, AV_LOG_ERROR, "unknown 1SNh headerid\n");
310310 return 0;
311311 }
@@ -314,7 +314,7 @@ static int process_ea_header(AVFormatContext *s) { · 2 unmodified lines
314314
315315 case SCHl_TAG :
316316 case SHEN_TAG :
317− blockid = get_le32(pb);
317+ blockid = avio_rl32(pb);
318318 if (blockid == GSTR_TAG) {
319319 url_fskip(pb, 4);
320320 } else if ((blockid & 0xFFFF)!=PT00_TAG) {
@@ -467,8 +467,8 @@ static int ea_read_packet(AVFormatContext *s, · 146 unmodified lines
467467 int av_uninit(num_samples);
468468
469469 while (!packet_read) {
470− chunk_type = get_le32(pb);
471− chunk_size = (ea->big_endian ? get_be32(pb) : get_le32(pb)) - 8;
470+ chunk_type = avio_rl32(pb);
471+ chunk_size = (ea->big_endian ? avio_rb32(pb) : avio_rl32(pb)) - 8;
472472
473473 switch (chunk_type) {
474474 /* audio data */
@@ -485,7 +485,7 @@ static int ea_read_packet(AVFormatContext *s, · 10 unmodified lines
485485 break;
486486 } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR ||
487487 ea->audio_codec == CODEC_ID_MP3) {
488− num_samples = get_le32(pb);
488+ num_samples = avio_rl32(pb);
489489 url_fskip(pb, 8);
490490 chunk_size -= 12;
491491 }
libavformat/ffmdec.c+72−72
@@ -95,7 +95,7 @@ static int ffm_resync(AVFormatContext *s, int state) · 94 unmodified lines
9595 av_log(s, AV_LOG_ERROR, "cannot find FFM syncword\n");
9696 return -1;
9797 }
98− state = (state << 8) | get_byte(s->pb);
98+ state = (state << 8) | avio_r8(s->pb);
9999 }
100100 return 0;
101101 }
@@ -120,14 +120,14 @@ static int ffm_read_data(AVFormatContext *s, · 18 unmodified lines
120120 if (url_ftell(pb) == ffm->file_size)
121121 url_fseek(pb, ffm->packet_size, SEEK_SET);
122122 retry_read:
123− id = get_be16(pb); /* PACKET_ID */
123+ id = avio_rb16(pb); /* PACKET_ID */
124124 if (id != PACKET_ID)
125125 if (ffm_resync(s, id) < 0)
126126 return -1;
127− fill_size = get_be16(pb);
128− ffm->dts = get_be64(pb);
129− frame_offset = get_be16(pb);
130− get_buffer(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE);
127+ fill_size = avio_rb16(pb);
128+ ffm->dts = avio_rb64(pb);
129+ frame_offset = avio_rb16(pb);
130+ avio_read(pb, ffm->packet, ffm->packet_size - FFM_HEADER_SIZE);
131131 ffm->packet_end = ffm->packet + (ffm->packet_size - FFM_HEADER_SIZE - fill_size);
132132 if (ffm->packet_end < ffm->packet || frame_offset < 0)
133133 return -1;
@@ -188,7 +188,7 @@ static int64_t get_dts(AVFormatContext *s, int64_t pos) · 54 unmodified lines
188188
189189 ffm_seek1(s, pos);
190190 url_fskip(pb, 4);
191− dts = get_be64(pb);
191+ dts = avio_rb64(pb);
192192 #ifdef DEBUG_SEEK
193193 av_log(s, AV_LOG_DEBUG, "dts=%0.6f\n", dts / 1000000.0);
194194 #endif
@@ -273,13 +273,13 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) · 78 unmodified lines
273273 uint32_t tag;
274274
275275 /* header */
276− tag = get_le32(pb);
276+ tag = avio_rl32(pb);
277277 if (tag != MKTAG('F', 'F', 'M', '1'))
278278 goto fail;
279− ffm->packet_size = get_be32(pb);
279+ ffm->packet_size = avio_rb32(pb);
280280 if (ffm->packet_size != FFM_PACKET_SIZE)
281281 goto fail;
282− ffm->write_index = get_be64(pb);
282+ ffm->write_index = avio_rb64(pb);
283283 /* get also filesize */
284284 if (!url_is_streamed(pb)) {
285285 ffm->file_size = url_fsize(pb);
@@ -289,8 +289,8 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) · 3 unmodified lines
289289 ffm->file_size = (UINT64_C(1) << 63) - 1;
290290 }
291291
292− nb_streams = get_be32(pb);
293− get_be32(pb); /* total bitrate */
292+ nb_streams = avio_rb32(pb);
293+ avio_rb32(pb); /* total bitrate */
294294 /* read each stream */
295295 for(i=0;i<nb_streams;i++) {
296296 char rc_eq_buf[128];
@@ -303,85 +303,85 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) · 6 unmodified lines
303303
304304 codec = st->codec;
305305 /* generic info */
306− codec->codec_id = get_be32(pb);
307− codec->codec_type = get_byte(pb); /* codec_type */
308− codec->bit_rate = get_be32(pb);
309− st->quality = get_be32(pb);
310− codec->flags = get_be32(pb);
311− codec->flags2 = get_be32(pb);
312− codec->debug = get_be32(pb);
306+ codec->codec_id = avio_rb32(pb);
307+ codec->codec_type = avio_r8(pb); /* codec_type */
308+ codec->bit_rate = avio_rb32(pb);
309+ st->quality = avio_rb32(pb);
310+ codec->flags = avio_rb32(pb);
311+ codec->flags2 = avio_rb32(pb);
312+ codec->debug = avio_rb32(pb);
313313 /* specific info */
314314 switch(codec->codec_type) {
315315 case AVMEDIA_TYPE_VIDEO:
316− codec->time_base.num = get_be32(pb);
317− codec->time_base.den = get_be32(pb);
318− codec->width = get_be16(pb);
319− codec->height = get_be16(pb);
320− codec->gop_size = get_be16(pb);
321− codec->pix_fmt = get_be32(pb);
322− codec->qmin = get_byte(pb);
323− codec->qmax = get_byte(pb);
324− codec->max_qdiff = get_byte(pb);
325− codec->qcompress = get_be16(pb) / 10000.0;
326− codec->qblur = get_be16(pb) / 10000.0;
327− codec->bit_rate_tolerance = get_be32(pb);
316+ codec->time_base.num = avio_rb32(pb);
317+ codec->time_base.den = avio_rb32(pb);
318+ codec->width = avio_rb16(pb);
319+ codec->height = avio_rb16(pb);
320+ codec->gop_size = avio_rb16(pb);
321+ codec->pix_fmt = avio_rb32(pb);
322+ codec->qmin = avio_r8(pb);
323+ codec->qmax = avio_r8(pb);
324+ codec->max_qdiff = avio_r8(pb);
325+ codec->qcompress = avio_rb16(pb) / 10000.0;
326+ codec->qblur = avio_rb16(pb) / 10000.0;
327+ codec->bit_rate_tolerance = avio_rb32(pb);
328328 codec->rc_eq = av_strdup(get_strz(pb, rc_eq_buf, sizeof(rc_eq_buf)));
329− codec->rc_max_rate = get_be32(pb);
330− codec->rc_min_rate = get_be32(pb);
331− codec->rc_buffer_size = get_be32(pb);
332− codec->i_quant_factor = av_int2dbl(get_be64(pb));
333− codec->b_quant_factor = av_int2dbl(get_be64(pb));
334− codec->i_quant_offset = av_int2dbl(get_be64(pb));
335− codec->b_quant_offset = av_int2dbl(get_be64(pb));
336− codec->dct_algo = get_be32(pb);
337− codec->strict_std_compliance = get_be32(pb);
338− codec->max_b_frames = get_be32(pb);
339− codec->luma_elim_threshold = get_be32(pb);
340− codec->chroma_elim_threshold = get_be32(pb);
341− codec->mpeg_quant = get_be32(pb);
342− codec->intra_dc_precision = get_be32(pb);
343− codec->me_method = get_be32(pb);
344− codec->mb_decision = get_be32(pb);
345− codec->nsse_weight = get_be32(pb);
346− codec->frame_skip_cmp = get_be32(pb);
347− codec->rc_buffer_aggressivity = av_int2dbl(get_be64(pb));
348− codec->codec_tag = get_be32(pb);
349− codec->thread_count = get_byte(pb);
350− codec->coder_type = get_be32(pb);
351− codec->me_cmp = get_be32(pb);
352− codec->partitions = get_be32(pb);
353− codec->me_subpel_quality = get_be32(pb);
354− codec->me_range = get_be32(pb);
355− codec->keyint_min = get_be32(pb);
356− codec->scenechange_threshold = get_be32(pb);
357− codec->b_frame_strategy = get_be32(pb);
358− codec->qcompress = av_int2dbl(get_be64(pb));
359− codec->qblur = av_int2dbl(get_be64(pb));
360− codec->max_qdiff = get_be32(pb);
361− codec->refs = get_be32(pb);
362− codec->directpred = get_be32(pb);
329+ codec->rc_max_rate = avio_rb32(pb);
330+ codec->rc_min_rate = avio_rb32(pb);
331+ codec->rc_buffer_size = avio_rb32(pb);
332+ codec->i_quant_factor = av_int2dbl(avio_rb64(pb));
333+ codec->b_quant_factor = av_int2dbl(avio_rb64(pb));
334+ codec->i_quant_offset = av_int2dbl(avio_rb64(pb));
335+ codec->b_quant_offset = av_int2dbl(avio_rb64(pb));
336+ codec->dct_algo = avio_rb32(pb);
337+ codec->strict_std_compliance = avio_rb32(pb);
338+ codec->max_b_frames = avio_rb32(pb);
339+ codec->luma_elim_threshold = avio_rb32(pb);
340+ codec->chroma_elim_threshold = avio_rb32(pb);
341+ codec->mpeg_quant = avio_rb32(pb);
342+ codec->intra_dc_precision = avio_rb32(pb);
343+ codec->me_method = avio_rb32(pb);
344+ codec->mb_decision = avio_rb32(pb);
345+ codec->nsse_weight = avio_rb32(pb);
346+ codec->frame_skip_cmp = avio_rb32(pb);
347+ codec->rc_buffer_aggressivity = av_int2dbl(avio_rb64(pb));
348+ codec->codec_tag = avio_rb32(pb);
349+ codec->thread_count = avio_r8(pb);
350+ codec->coder_type = avio_rb32(pb);
351+ codec->me_cmp = avio_rb32(pb);
352+ codec->partitions = avio_rb32(pb);
353+ codec->me_subpel_quality = avio_rb32(pb);
354+ codec->me_range = avio_rb32(pb);
355+ codec->keyint_min = avio_rb32(pb);
356+ codec->scenechange_threshold = avio_rb32(pb);
357+ codec->b_frame_strategy = avio_rb32(pb);
358+ codec->qcompress = av_int2dbl(avio_rb64(pb));
359+ codec->qblur = av_int2dbl(avio_rb64(pb));
360+ codec->max_qdiff = avio_rb32(pb);
361+ codec->refs = avio_rb32(pb);
362+ codec->directpred = avio_rb32(pb);
363363 break;
364364 case AVMEDIA_TYPE_AUDIO:
365− codec->sample_rate = get_be32(pb);
366− codec->channels = get_le16(pb);
367− codec->frame_size = get_le16(pb);
368− codec->sample_fmt = (int16_t) get_le16(pb);
365+ codec->sample_rate = avio_rb32(pb);
366+ codec->channels = avio_rl16(pb);
367+ codec->frame_size = avio_rl16(pb);
368+ codec->sample_fmt = (int16_t) avio_rl16(pb);
369369 break;
370370 default:
371371 goto fail;
372372 }
373373 if (codec->flags & CODEC_FLAG_GLOBAL_HEADER) {
374− codec->extradata_size = get_be32(pb);
374+ codec->extradata_size = avio_rb32(pb);
375375 codec->extradata = av_malloc(codec->extradata_size);
376376 if (!codec->extradata)
377377 return AVERROR(ENOMEM);
378− get_buffer(pb, codec->extradata, codec->extradata_size);
378+ avio_read(pb, codec->extradata, codec->extradata_size);
379379 }
380380 }
381381
382382 /* get until end of block reached */
383383 while ((url_ftell(pb) % ffm->packet_size) != 0)
384− get_byte(pb);
384+ avio_r8(pb);
385385
386386 /* init packet demux */
387387 ffm->packet_ptr = ffm->packet;
libavformat/ffmetadec.c+2−2
@@ -36,11 +36,11 @@ static void get_line(AVIOContext *s, uint8_t *buf, int size) · 35 unmodified lines
3636 uint8_t c;
3737 int i = 0;
3838
39− while ((c = get_byte(s))) {
39+ while ((c = avio_r8(s))) {
4040 if (c == '\\') {
4141 if (i < size - 1)
4242 buf[i++] = c;
43− c = get_byte(s);
43+ c = avio_r8(s);
4444 } else if (c == '\n')
4545 break;
4646
libavformat/filmstripdec.c+7−7
@@ -44,7 +44,7 @@ static int read_header(AVFormatContext *s, · 43 unmodified lines
4444 return AVERROR(EIO);
4545
4646 url_fseek(pb, url_fsize(pb) - 36, SEEK_SET);
47− if (get_be32(pb) != RAND_TAG) {
47+ if (avio_rb32(pb) != RAND_TAG) {
4848 av_log(s, AV_LOG_ERROR, "magic number not found");
4949 return AVERROR_INVALIDDATA;
5050 }
@@ -53,8 +53,8 @@ static int read_header(AVFormatContext *s, · 2 unmodified lines
5353 if (!st)
5454 return AVERROR(ENOMEM);
5555
56− st->nb_frames = get_be32(pb);
57− if (get_be16(pb) != 0) {
56+ st->nb_frames = avio_rb32(pb);
57+ if (avio_rb16(pb) != 0) {
5858 av_log_ask_for_sample(s, "unsupported packing method\n");
5959 return AVERROR_INVALIDDATA;
6060 }
@@ -64,10 +64,10 @@ static int read_header(AVFormatContext *s, · 3 unmodified lines
6464 st->codec->codec_id = CODEC_ID_RAWVIDEO;
6565 st->codec->pix_fmt = PIX_FMT_RGBA;
6666 st->codec->codec_tag = 0; /* no fourcc */
67− st->codec->width = get_be16(pb);
68− st->codec->height = get_be16(pb);
69− film->leading = get_be16(pb);
70− av_set_pts_info(st, 64, 1, get_be16(pb));
67+ st->codec->width = avio_rb16(pb);
68+ st->codec->height = avio_rb16(pb);
69+ film->leading = avio_rb16(pb);
70+ av_set_pts_info(st, 64, 1, avio_rb16(pb));
7171
7272 url_fseek(pb, 0, SEEK_SET);
7373
libavformat/flacdec.c+3−3
@@ -40,14 +40,14 @@ static int flac_read_header(AVFormatContext *s, · 39 unmodified lines
4040 /* the parameters will be extracted from the compressed bitstream */
4141
4242 /* if fLaC marker is not found, assume there is no header */
43− if (get_le32(s->pb) != MKTAG('f','L','a','C')) {
43+ if (avio_rl32(s->pb) != MKTAG('f','L','a','C')) {
4444 url_fseek(s->pb, -4, SEEK_CUR);
4545 return 0;
4646 }
4747
4848 /* process metadata blocks */
4949 while (!url_feof(s->pb) && !metadata_last) {
50− get_buffer(s->pb, header, 4);
50+ avio_read(s->pb, header, 4);
5151 ff_flac_parse_block_header(header, &metadata_last, &metadata_type,
5252 &metadata_size);
5353 switch (metadata_type) {
@@ -58,7 +58,7 @@ static int flac_read_header(AVFormatContext *s, · 4 unmodified lines
5858 if (!buffer) {
5959 return AVERROR(ENOMEM);
6060 }
61− if (get_buffer(s->pb, buffer, metadata_size) != metadata_size) {
61+ if (avio_read(s->pb, buffer, metadata_size) != metadata_size) {
6262 av_freep(&buffer);
6363 return AVERROR(EIO);
6464 }
libavformat/flic.c+5−5
@@ -96,7 +96,7 @@ static int flic_read_header(AVFormatContext *s, · 95 unmodified lines
9696 flic->frame_number = 0;
9797
9898 /* load the whole header and pull out the width and height */
99− if (get_buffer(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE)
99+ if (avio_read(pb, header, FLIC_HEADER_SIZE) != FLIC_HEADER_SIZE)
100100 return AVERROR(EIO);
101101
102102 magic_number = AV_RL16(&header[4]);
@@ -130,7 +130,7 @@ static int flic_read_header(AVFormatContext *s, · 27 unmodified lines
130130 memcpy(st->codec->extradata, header, FLIC_HEADER_SIZE);
131131
132132 /* peek at the preamble to detect TFTD videos - they seem to always start with an audio chunk */
133− if (get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE) != FLIC_PREAMBLE_SIZE) {
133+ if (avio_read(pb, preamble, FLIC_PREAMBLE_SIZE) != FLIC_PREAMBLE_SIZE) {
134134 av_log(s, AV_LOG_ERROR, "Failed to peek at preamble\n");
135135 return AVERROR(EIO);
136136 }
@@ -207,7 +207,7 @@ static int flic_read_packet(AVFormatContext *s, · 70 unmodified lines
207207
208208 while (!packet_read) {
209209
210− if ((ret = get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE)) !=
210+ if ((ret = avio_read(pb, preamble, FLIC_PREAMBLE_SIZE)) !=
211211 FLIC_PREAMBLE_SIZE) {
212212 ret = AVERROR(EIO);
213213 break;
@@ -225,7 +225,7 @@ static int flic_read_packet(AVFormatContext *s, · 11 unmodified lines
225225 pkt->pts = flic->frame_number++;
226226 pkt->pos = url_ftell(pb);
227227 memcpy(pkt->data, preamble, FLIC_PREAMBLE_SIZE);
228− ret = get_buffer(pb, pkt->data + FLIC_PREAMBLE_SIZE,
228+ ret = avio_read(pb, pkt->data + FLIC_PREAMBLE_SIZE,
229229 size - FLIC_PREAMBLE_SIZE);
230230 if (ret != size - FLIC_PREAMBLE_SIZE) {
231231 av_free_packet(pkt);
@@ -243,7 +243,7 @@ static int flic_read_packet(AVFormatContext *s, · 11 unmodified lines
243243
244244 pkt->stream_index = flic->audio_stream_index;
245245 pkt->pos = url_ftell(pb);
246− ret = get_buffer(pb, pkt->data, size);
246+ ret = avio_read(pb, pkt->data, size);
247247
248248 if (ret != size) {
249249 av_free_packet(pkt);
libavformat/flvdec.c+26−26
@@ -97,7 +97,7 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co · 96 unmodified lines
9797 vcodec->extradata_size = 1;
9898 vcodec->extradata = av_malloc(1);
9999 }
100− vcodec->extradata[0] = get_byte(s->pb);
100+ vcodec->extradata[0] = avio_r8(s->pb);
101101 return 1; // 1 byte body size adjustment for flv_read_packet()
102102 case FLV_CODECID_H264:
103103 vcodec->codec_id = CODEC_ID_H264;
@@ -111,13 +111,13 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co · 7 unmodified lines
111111 }
112112
113113 static int amf_get_string(AVIOContext *ioc, char *buffer, int buffsize) {
114− int length = get_be16(ioc);
114+ int length = avio_rb16(ioc);
115115 if(length >= buffsize) {
116116 url_fskip(ioc, length);
117117 return -1;
118118 }
119119
120− get_buffer(ioc, buffer, length);
120+ avio_read(ioc, buffer, length);
121121
122122 buffer[length] = '\0';
123123
@@ -134,13 +134,13 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst · 10 unmodified lines
134134 num_val = 0;
135135 ioc = s->pb;
136136
137− amf_type = get_byte(ioc);
137+ amf_type = avio_r8(ioc);
138138
139139 switch(amf_type) {
140140 case AMF_DATA_TYPE_NUMBER:
141− num_val = av_int2dbl(get_be64(ioc)); break;
141+ num_val = av_int2dbl(avio_rb64(ioc)); break;
142142 case AMF_DATA_TYPE_BOOL:
143− num_val = get_byte(ioc); break;
143+ num_val = avio_r8(ioc); break;
144144 case AMF_DATA_TYPE_STRING:
145145 if(amf_get_string(ioc, str_val, sizeof(str_val)) < 0)
146146 return -1;
@@ -148,12 +148,12 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst · 1 unmodified line
148148 case AMF_DATA_TYPE_OBJECT: {
149149 unsigned int keylen;
150150
151− while(url_ftell(ioc) < max_pos - 2 && (keylen = get_be16(ioc))) {
151+ while(url_ftell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) {
152152 url_fskip(ioc, keylen); //skip key string
153153 if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0)
154154 return -1; //if we couldn't skip, bomb out.
155155 }
156− if(get_byte(ioc) != AMF_END_OF_OBJECT)
156+ if(avio_r8(ioc) != AMF_END_OF_OBJECT)
157157 return -1;
158158 }
159159 break;
@@ -168,13 +168,13 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst · 8 unmodified lines
168168 if(amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0)
169169 return -1;
170170 }
171− if(get_byte(ioc) != AMF_END_OF_OBJECT)
171+ if(avio_r8(ioc) != AMF_END_OF_OBJECT)
172172 return -1;
173173 break;
174174 case AMF_DATA_TYPE_ARRAY: {
175175 unsigned int arraylen, i;
176176
177− arraylen = get_be32(ioc);
177+ arraylen = avio_rb32(ioc);
178178 for(i = 0; i < arraylen && url_ftell(ioc) < max_pos - 1; i++) {
179179 if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0)
180180 return -1; //if we couldn't skip, bomb out.
@@ -222,7 +222,7 @@ static int flv_read_metabody(AVFormatContext *s, int64_t next_pos) { · 41 unmodified lines
222222 ioc = s->pb;
223223
224224 //first object needs to be "onMetaData" string
225− type = get_byte(ioc);
225+ type = avio_r8(ioc);
226226 if(type != AMF_DATA_TYPE_STRING || amf_get_string(ioc, buffer, sizeof(buffer)) < 0 || strcmp(buffer, "onMetaData"))
227227 return -1;
228228
@@ -255,7 +255,7 @@ static int flv_read_header(AVFormatContext *s, · 26 unmodified lines
255255 int offset, flags;
256256
257257 url_fskip(s->pb, 4);
258− flags = get_byte(s->pb);
258+ flags = avio_r8(s->pb);
259259 /* old flvtool cleared this field */
260260 /* FIXME: better fix needed */
261261 if (!flags) {
@@ -276,7 +276,7 @@ static int flv_read_header(AVFormatContext *s, · 14 unmodified lines
276276 return AVERROR(ENOMEM);
277277 }
278278
279− offset = get_be32(s->pb);
279+ offset = avio_rb32(s->pb);
280280 url_fseek(s->pb, offset, SEEK_SET);
281281 url_fskip(s->pb, 4);
282282
@@ -292,7 +292,7 @@ static int flv_get_extradata(AVFormatContext *s, AVStream *st, int size) · 9 unmodified lines
292292 if (!st->codec->extradata)
293293 return AVERROR(ENOMEM);
294294 st->codec->extradata_size = size;
295− get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size);
295+ avio_read(s->pb, st->codec->extradata, st->codec->extradata_size);
296296 return 0;
297297 }
298298
@@ -306,10 +306,10 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) · 7 unmodified lines
306306
307307 for(;;url_fskip(s->pb, 4)){ /* pkt size is repeated at end. skip it */
308308 pos = url_ftell(s->pb);
309− type = get_byte(s->pb);
310− size = get_be24(s->pb);
311− dts = get_be24(s->pb);
312− dts |= get_byte(s->pb) << 24;
309+ type = avio_r8(s->pb);
310+ size = avio_rb24(s->pb);
311+ dts = avio_rb24(s->pb);
312+ dts |= avio_r8(s->pb) << 24;
313313 // av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, dts:%d\n", type, size, dts);
314314 if (url_feof(s->pb))
315315 return AVERROR_EOF;
@@ -323,11 +323,11 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) · 7 unmodified lines
323323
324324 if (type == FLV_TAG_TYPE_AUDIO) {
325325 is_audio=1;
326− flags = get_byte(s->pb);
326+ flags = avio_r8(s->pb);
327327 size--;
328328 } else if (type == FLV_TAG_TYPE_VIDEO) {
329329 is_audio=0;
330− flags = get_byte(s->pb);
330+ flags = avio_r8(s->pb);
331331 size--;
332332 if ((flags & 0xf0) == 0x50) /* video info / command frame */
333333 goto skip;
@@ -375,11 +375,11 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) · 41 unmodified lines
375375 const int64_t pos= url_ftell(s->pb);
376376 const int64_t fsize= url_fsize(s->pb);
377377 url_fseek(s->pb, fsize-4, SEEK_SET);
378− size= get_be32(s->pb);
378+ size= avio_rb32(s->pb);
379379 url_fseek(s->pb, fsize-3-size, SEEK_SET);
380− if(size == get_be24(s->pb) + 11){
381− uint32_t ts = get_be24(s->pb);
382− ts |= get_byte(s->pb) << 24;
380+ if(size == avio_rb24(s->pb) + 11){
381+ uint32_t ts = avio_rb24(s->pb);
382+ ts |= avio_r8(s->pb) << 24;
383383 s->duration = ts * (int64_t)AV_TIME_BASE / 1000;
384384 }
385385 url_fseek(s->pb, pos, SEEK_SET);
@@ -400,10 +400,10 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) · 14 unmodified lines
400400
401401 if (st->codec->codec_id == CODEC_ID_AAC ||
402402 st->codec->codec_id == CODEC_ID_H264) {
403− int type = get_byte(s->pb);
403+ int type = avio_r8(s->pb);
404404 size--;
405405 if (st->codec->codec_id == CODEC_ID_H264) {
406− int32_t cts = (get_be24(s->pb)+0xff800000)^0xff800000; // sign extension
406+ int32_t cts = (avio_rb24(s->pb)+0xff800000)^0xff800000; // sign extension
407407 pts = dts + cts;
408408 if (cts < 0) { // dts are wrong
409409 flv->wrong_dts = 1;
libavformat/gxf.c+35−35
@@ -39,20 +39,20 @@ struct gxf_stream_info { · 38 unmodified lines
3939 * \return 0 if header not found or contains invalid data, 1 otherwise
4040 */
4141 static int parse_packet_header(AVIOContext *pb, GXFPktType *type, int *length) {
42− if (get_be32(pb))
42+ if (avio_rb32(pb))
4343 return 0;
44− if (get_byte(pb) != 1)
44+ if (avio_r8(pb) != 1)
4545 return 0;
46− *type = get_byte(pb);
47− *length = get_be32(pb);
46+ *type = avio_r8(pb);
47+ *length = avio_rb32(pb);
4848 if ((*length >> 24) || *length < 16)
4949 return 0;
5050 *length -= 16;
51− if (get_be32(pb))
51+ if (avio_rb32(pb))
5252 return 0;
53− if (get_byte(pb) != 0xe1)
53+ if (avio_r8(pb) != 0xe1)
5454 return 0;
55− if (get_byte(pb) != 0xe2)
55+ if (avio_r8(pb) != 0xe2)
5656 return 0;
5757 return 1;
5858 }
@@ -161,14 +161,14 @@ static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info · 102 unmodified lines
161161 si->first_field = AV_NOPTS_VALUE;
162162 si->last_field = AV_NOPTS_VALUE;
163163 while (*len >= 2) {
164− GXFMatTag tag = get_byte(pb);
165− int tlen = get_byte(pb);
164+ GXFMatTag tag = avio_r8(pb);
165+ int tlen = avio_r8(pb);
166166 *len -= 2;
167167 if (tlen > *len)
168168 return;
169169 *len -= tlen;
170170 if (tlen == 4) {
171− uint32_t value = get_be32(pb);
171+ uint32_t value = avio_rb32(pb);
172172 if (tag == MAT_FIRST_FIELD)
173173 si->first_field = value;
174174 else if (tag == MAT_LAST_FIELD)
@@ -210,14 +210,14 @@ static void gxf_track_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si · 35 unmodified lines
210210 si->frames_per_second = (AVRational){0, 0};
211211 si->fields_per_frame = 0;
212212 while (*len >= 2) {
213− GXFTrackTag tag = get_byte(pb);
214− int tlen = get_byte(pb);
213+ GXFTrackTag tag = avio_r8(pb);
214+ int tlen = avio_r8(pb);
215215 *len -= 2;
216216 if (tlen > *len)
217217 return;
218218 *len -= tlen;
219219 if (tlen == 4) {
220− uint32_t value = get_be32(pb);
220+ uint32_t value = avio_rb32(pb);
221221 if (tag == TRACK_FPS)
222222 si->frames_per_second = fps_tag2avr(value);
223223 else if (tag == TRACK_FPF && (value == 1 || value == 2))
@@ -233,8 +233,8 @@ static void gxf_track_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si · 9 unmodified lines
233233 static void gxf_read_index(AVFormatContext *s, int pkt_len) {
234234 AVIOContext *pb = s->pb;
235235 AVStream *st = s->streams[0];
236− uint32_t fields_per_map = get_le32(pb);
237− uint32_t map_cnt = get_le32(pb);
236+ uint32_t fields_per_map = avio_rl32(pb);
237+ uint32_t map_cnt = avio_rl32(pb);
238238 int i;
239239 pkt_len -= 8;
240240 if (s->flags & AVFMT_FLAG_IGNIDX) {
@@ -253,7 +253,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) { · 12 unmodified lines
253253 pkt_len -= 4 * map_cnt;
254254 av_add_index_entry(st, 0, 0, 0, 0, 0);
255255 for (i = 0; i < map_cnt; i++)
256− av_add_index_entry(st, (uint64_t)get_le32(pb) * 1024,
256+ av_add_index_entry(st, (uint64_t)avio_rl32(pb) * 1024,
257257 i * (uint64_t)fields_per_map + 1, 0, 0, 0);
258258 url_fskip(pb, pkt_len);
259259 }
@@ -271,12 +271,12 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { · 11 unmodified lines
271271 return 0;
272272 }
273273 map_len -= 2;
274− if (get_byte(pb) != 0x0e0 || get_byte(pb) != 0xff) {
274+ if (avio_r8(pb) != 0x0e0 || avio_r8(pb) != 0xff) {
275275 av_log(s, AV_LOG_ERROR, "unknown version or invalid map preamble\n");
276276 return 0;
277277 }
278278 map_len -= 2;
279− len = get_be16(pb); // length of material data section
279+ len = avio_rb16(pb); // length of material data section
280280 if (len > map_len) {
281281 av_log(s, AV_LOG_ERROR, "material data longer than map data\n");
282282 return 0;
@@ -285,7 +285,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { · 2 unmodified lines
285285 gxf_material_tags(pb, &len, &si);
286286 url_fskip(pb, len);
287287 map_len -= 2;
288− len = get_be16(pb); // length of track description
288+ len = avio_rb16(pb); // length of track description
289289 if (len > map_len) {
290290 av_log(s, AV_LOG_ERROR, "track description longer than map data\n");
291291 return 0;
@@ -296,9 +296,9 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { · 4 unmodified lines
296296 AVStream *st;
297297 int idx;
298298 len -= 4;
299− track_type = get_byte(pb);
300− track_id = get_byte(pb);
301− track_len = get_be16(pb);
299+ track_type = avio_r8(pb);
300+ track_id = avio_r8(pb);
301+ track_len = avio_rb16(pb);
302302 len -= track_len;
303303 gxf_track_tags(pb, &track_len, &si);
304304 url_fskip(pb, track_len);
@@ -344,7 +344,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { · 39 unmodified lines
344344 len -= 0x39;
345345 url_fskip(pb, 5); // preamble
346346 url_fskip(pb, 0x30); // payload description
347− fps = fps_umf2avr(get_le32(pb));
347+ fps = fps_umf2avr(avio_rl32(pb));
348348 if (!main_timebase.num || !main_timebase.den) {
349349 // this may not always be correct, but simply the best we can get
350350 main_timebase.num = fps.den;
@@ -370,7 +370,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { · 19 unmodified lines
370370 { \
371371 if (!max_interval-- || url_feof(pb)) \
372372 goto out; \
373− tmp = tmp << 8 | get_byte(pb); \
373+ tmp = tmp << 8 | avio_r8(pb); \
374374 }
375375
376376 /**
@@ -389,7 +389,7 @@ static int64_t gxf_resync_media(AVFormatContext *s, uint64_t max_interval, int t · 12 unmodified lines
389389 int len;
390390 AVIOContext *pb = s->pb;
391391 GXFPktType type;
392− tmp = get_be32(pb);
392+ tmp = avio_rb32(pb);
393393 start:
394394 while (tmp)
395395 READ_ONE();
@@ -404,9 +404,9 @@ start: · 8 unmodified lines
404404 goto out;
405405 goto start;
406406 }
407− get_byte(pb);
408− cur_track = get_byte(pb);
409− cur_timestamp = get_be32(pb);
407+ avio_r8(pb);
408+ cur_track = avio_r8(pb);
409+ cur_timestamp = avio_rb32(pb);
410410 last_found_pos = url_ftell(pb) - 16 - 6;
411411 if ((track >= 0 && track != cur_track) || (timestamp >= 0 && timestamp > cur_timestamp)) {
412412 if (url_fseek(pb, last_pos, SEEK_SET) >= 0)
@@ -445,17 +445,17 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { · 32 unmodified lines
445445 continue;
446446 }
447447 pkt_len -= 16;
448− track_type = get_byte(pb);
449− track_id = get_byte(pb);
448+ track_type = avio_r8(pb);
449+ track_id = avio_r8(pb);
450450 stream_index = get_sindex(s, track_id, track_type);
451451 if (stream_index < 0)
452452 return stream_index;
453453 st = s->streams[stream_index];
454− field_nr = get_be32(pb);
455− field_info = get_be32(pb);
456− get_be32(pb); // "timeline" field number
457− get_byte(pb); // flags
458− get_byte(pb); // reserved
454+ field_nr = avio_rb32(pb);
455+ field_info = avio_rb32(pb);
456+ avio_rb32(pb); // "timeline" field number
457+ avio_r8(pb); // flags
458+ avio_r8(pb); // reserved
459459 if (st->codec->codec_id == CODEC_ID_PCM_S24LE ||
460460 st->codec->codec_id == CODEC_ID_PCM_S16LE) {
461461 int first = field_info >> 16;
libavformat/id3v1.c+1−1
@@ -233,7 +233,7 @@ void ff_id3v1_read(AVFormatContext *s) · 232 unmodified lines
233233 filesize = url_fsize(s->pb);
234234 if (filesize > 128) {
235235 url_fseek(s->pb, filesize - 128, SEEK_SET);
236− ret = get_buffer(s->pb, buf, ID3v1_TAG_SIZE);
236+ ret = avio_read(s->pb, buf, ID3v1_TAG_SIZE);
237237 if (ret == ID3v1_TAG_SIZE) {
238238 parse_tag(s, buf);
239239 }
libavformat/id3v2.c+15−15
@@ -55,7 +55,7 @@ static unsigned int get_size(AVIOContext *s, int len) · 54 unmodified lines
5555 {
5656 int v = 0;
5757 while (len--)
58− v = (v << 7) + (get_byte(s) & 0x7F);
58+ v = (v << 7) + (avio_r8(s) & 0x7F);
5959 return v;
6060 }
6161
@@ -65,7 +65,7 @@ static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, const cha · 3 unmodified lines
6565 const char *val = NULL;
6666 int len, dstlen = sizeof(dst) - 1;
6767 unsigned genre;
68− unsigned int (*get)(AVIOContext*) = get_be16;
68+ unsigned int (*get)(AVIOContext*) = avio_rb16;
6969
7070 dst[0] = 0;
7171 if (taglen < 1)
@@ -73,22 +73,22 @@ static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, const cha · 1 unmodified line
7373
7474 taglen--; /* account for encoding type byte */
7575
76− switch (get_byte(pb)) { /* encoding type */
76+ switch (avio_r8(pb)) { /* encoding type */
7777
7878 case ID3v2_ENCODING_ISO8859:
7979 q = dst;
8080 while (taglen-- && q - dst < dstlen - 7) {
8181 uint8_t tmp;
82− PUT_UTF8(get_byte(pb), tmp, *q++ = tmp;)
82+ PUT_UTF8(avio_r8(pb), tmp, *q++ = tmp;)
8383 }
8484 *q = 0;
8585 break;
8686
8787 case ID3v2_ENCODING_UTF16BOM:
8888 taglen -= 2;
89− switch (get_be16(pb)) {
89+ switch (avio_rb16(pb)) {
9090 case 0xfffe:
91− get = get_le16;
91+ get = avio_rl16;
9292 case 0xfeff:
9393 break;
9494 default:
@@ -111,7 +111,7 @@ static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, const cha · 16 unmodified lines
111111
112112 case ID3v2_ENCODING_UTF8:
113113 len = FFMIN(taglen, dstlen);
114− get_buffer(pb, dst, len);
114+ avio_read(pb, dst, len);
115115 dst[len] = 0;
116116 break;
117117 default:
@@ -178,18 +178,18 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t · 60 unmodified lines
178178 int tunsync = 0;
179179
180180 if (isv34) {
181− get_buffer(s->pb, tag, 4);
181+ avio_read(s->pb, tag, 4);
182182 tag[4] = 0;
183183 if(version==3){
184− tlen = get_be32(s->pb);
184+ tlen = avio_rb32(s->pb);
185185 }else
186186 tlen = get_size(s->pb, 4);
187− tflags = get_be16(s->pb);
187+ tflags = avio_rb16(s->pb);
188188 tunsync = tflags & ID3v2_FLAG_UNSYNCH;
189189 } else {
190− get_buffer(s->pb, tag, 3);
190+ avio_read(s->pb, tag, 3);
191191 tag[3] = 0;
192− tlen = get_be24(s->pb);
192+ tlen = avio_rb24(s->pb);
193193 }
194194 len -= taghdrlen + tlen;
195195
@@ -199,7 +199,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t · 3 unmodified lines
199199 next = url_ftell(s->pb) + tlen;
200200
201201 if (tflags & ID3v2_FLAG_DATALEN) {
202− get_be32(s->pb);
202+ avio_rb32(s->pb);
203203 tlen -= 4;
204204 }
205205
@@ -211,7 +211,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t · 5 unmodified lines
211211 int i, j;
212212 av_fast_malloc(&buffer, &buffer_size, tlen);
213213 for (i = 0, j = 0; i < tlen; i++, j++) {
214− buffer[j] = get_byte(s->pb);
214+ buffer[j] = avio_r8(s->pb);
215215 if (j > 0 && !buffer[j] && buffer[j - 1] == 0xff) {
216216 /* Unsynchronised byte, skip it */
217217 j--;
@@ -259,7 +259,7 @@ void ff_id3v2_read(AVFormatContext *s, const char *magic) · 41 unmodified lines
259259 do {
260260 /* save the current offset in case there's nothing to read/skip */
261261 off = url_ftell(s->pb);
262− ret = get_buffer(s->pb, buf, ID3v2_HEADER_SIZE);
262+ ret = avio_read(s->pb, buf, ID3v2_HEADER_SIZE);
263263 if (ret != ID3v2_HEADER_SIZE)
264264 break;
265265 found_header = ff_id3v2_match(buf, magic);
libavformat/idcin.c+9−9
@@ -149,11 +149,11 @@ static int idcin_read_header(AVFormatContext *s, · 148 unmodified lines
149149 unsigned int sample_rate, bytes_per_sample, channels;
150150
151151 /* get the 5 header parameters */
152− width = get_le32(pb);
153− height = get_le32(pb);
154− sample_rate = get_le32(pb);
155− bytes_per_sample = get_le32(pb);
156− channels = get_le32(pb);
152+ width = avio_rl32(pb);
153+ height = avio_rl32(pb);
154+ sample_rate = avio_rl32(pb);
155+ bytes_per_sample = avio_rl32(pb);
156+ channels = avio_rl32(pb);
157157
158158 st = av_new_stream(s, 0);
159159 if (!st)
@@ -169,7 +169,7 @@ static int idcin_read_header(AVFormatContext *s, · 9 unmodified lines
169169 /* load up the Huffman tables into extradata */
170170 st->codec->extradata_size = HUFFMAN_TABLE_SIZE;
171171 st->codec->extradata = av_malloc(HUFFMAN_TABLE_SIZE);
172− if (get_buffer(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) !=
172+ if (avio_read(pb, st->codec->extradata, HUFFMAN_TABLE_SIZE) !=
173173 HUFFMAN_TABLE_SIZE)
174174 return AVERROR(EIO);
175175 /* save a reference in order to transport the palette */
@@ -231,13 +231,13 @@ static int idcin_read_packet(AVFormatContext *s, · 55 unmodified lines
231231 return AVERROR(EIO);
232232
233233 if (idcin->next_chunk_is_video) {
234− command = get_le32(pb);
234+ command = avio_rl32(pb);
235235 if (command == 2) {
236236 return AVERROR(EIO);
237237 } else if (command == 1) {
238238 /* trigger a palette change */
239239 idcin->palctrl.palette_changed = 1;
240− if (get_buffer(pb, palette_buffer, 768) != 768)
240+ if (avio_read(pb, palette_buffer, 768) != 768)
241241 return AVERROR(EIO);
242242 /* scale the palette as necessary */
243243 palette_scale = 2;
@@ -255,7 +255,7 @@ static int idcin_read_packet(AVFormatContext *s, · 11 unmodified lines
255255 }
256256 }
257257
258− chunk_size = get_le32(pb);
258+ chunk_size = avio_rl32(pb);
259259 /* skip the number of decoded bytes (always equal to width * height) */
260260 url_fseek(pb, 4, SEEK_CUR);
261261 chunk_size -= 4;
libavformat/idroqdec.c+5−5
@@ -74,7 +74,7 @@ static int roq_read_header(AVFormatContext *s, · 73 unmodified lines
7474 unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE];
7575
7676 /* get the main header */
77− if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
77+ if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
7878 RoQ_CHUNK_PREAMBLE_SIZE)
7979 return AVERROR(EIO);
8080 framerate = AV_RL16(&preamble[6]);
@@ -115,7 +115,7 @@ static int roq_read_packet(AVFormatContext *s, · 34 unmodified lines
115115 return AVERROR(EIO);
116116
117117 /* get the next chunk preamble */
118− if ((ret = get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) !=
118+ if ((ret = avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE)) !=
119119 RoQ_CHUNK_PREAMBLE_SIZE)
120120 return AVERROR(EIO);
121121
@@ -129,7 +129,7 @@ static int roq_read_packet(AVFormatContext *s, · 7 unmodified lines
129129 case RoQ_INFO:
130130 if (!roq->width || !roq->height) {
131131 AVStream *st = s->streams[roq->video_stream_index];
132− if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE)
132+ if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE)
133133 return AVERROR(EIO);
134134 st->codec->width = roq->width = AV_RL16(preamble);
135135 st->codec->height = roq->height = AV_RL16(preamble + 2);
@@ -144,7 +144,7 @@ static int roq_read_packet(AVFormatContext *s, · 8 unmodified lines
144144 codebook_offset = url_ftell(pb) - RoQ_CHUNK_PREAMBLE_SIZE;
145145 codebook_size = chunk_size;
146146 url_fseek(pb, codebook_size, SEEK_CUR);
147− if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
147+ if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) !=
148148 RoQ_CHUNK_PREAMBLE_SIZE)
149149 return AVERROR(EIO);
150150 chunk_size = AV_RL32(&preamble[2]) + RoQ_CHUNK_PREAMBLE_SIZE * 2 +
@@ -198,7 +198,7 @@ static int roq_read_packet(AVFormatContext *s, · 47 unmodified lines
198198 }
199199
200200 pkt->pos= url_ftell(pb);
201− ret = get_buffer(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
201+ ret = avio_read(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
202202 chunk_size);
203203 if (ret != chunk_size)
204204 ret = AVERROR(EIO);
libavformat/iff.c+15−15
@@ -101,7 +101,7 @@ static int get_metadata(AVFormatContext *s, · 100 unmodified lines
101101 if (!buf)
102102 return AVERROR(ENOMEM);
103103
104− if (get_buffer(s->pb, buf, data_size) < 0) {
104+ if (avio_read(s->pb, buf, data_size) < 0) {
105105 av_free(buf);
106106 return AVERROR(EIO);
107107 }
@@ -136,14 +136,14 @@ static int iff_read_header(AVFormatContext *s, · 28 unmodified lines
136136 st->codec->channels = 1;
137137 url_fskip(pb, 8);
138138 // codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content
139− st->codec->codec_tag = get_le32(pb);
139+ st->codec->codec_tag = avio_rl32(pb);
140140
141141 while(!url_feof(pb)) {
142142 uint64_t orig_pos;
143143 int res;
144144 const char *metadata_tag = NULL;
145− chunk_id = get_le32(pb);
146− data_size = get_be32(pb);
145+ chunk_id = avio_rl32(pb);
146+ data_size = avio_rb32(pb);
147147 orig_pos = url_ftell(pb);
148148
149149 switch(chunk_id) {
@@ -153,10 +153,10 @@ static int iff_read_header(AVFormatContext *s, · 3 unmodified lines
153153 if (data_size < 14)
154154 return AVERROR_INVALIDDATA;
155155 url_fskip(pb, 12);
156− st->codec->sample_rate = get_be16(pb);
156+ st->codec->sample_rate = avio_rb16(pb);
157157 if (data_size >= 16) {
158158 url_fskip(pb, 1);
159− compression = get_byte(pb);
159+ compression = avio_r8(pb);
160160 }
161161 break;
162162
@@ -168,7 +168,7 @@ static int iff_read_header(AVFormatContext *s, · 5 unmodified lines
168168 case ID_CHAN:
169169 if (data_size < 4)
170170 return AVERROR_INVALIDDATA;
171− st->codec->channels = (get_be32(pb) < 6) ? 1 : 2;
171+ st->codec->channels = (avio_rb32(pb) < 6) ? 1 : 2;
172172 break;
173173
174174 case ID_CMAP:
@@ -176,7 +176,7 @@ static int iff_read_header(AVFormatContext *s, · 1 unmodified line
176176 st->codec->extradata = av_malloc(data_size);
177177 if (!st->codec->extradata)
178178 return AVERROR(ENOMEM);
179− if (get_buffer(pb, st->codec->extradata, data_size) < 0)
179+ if (avio_read(pb, st->codec->extradata, data_size) < 0)
180180 return AVERROR(EIO);
181181 break;
182182
@@ -184,18 +184,18 @@ static int iff_read_header(AVFormatContext *s, · 1 unmodified line
184184 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
185185 if (data_size <= 8)
186186 return AVERROR_INVALIDDATA;
187− st->codec->width = get_be16(pb);
188− st->codec->height = get_be16(pb);
187+ st->codec->width = avio_rb16(pb);
188+ st->codec->height = avio_rb16(pb);
189189 url_fskip(pb, 4); // x, y offset
190− st->codec->bits_per_coded_sample = get_byte(pb);
190+ st->codec->bits_per_coded_sample = avio_r8(pb);
191191 if (data_size >= 11) {
192192 url_fskip(pb, 1); // masking
193− compression = get_byte(pb);
193+ compression = avio_r8(pb);
194194 }
195195 if (data_size >= 16) {
196196 url_fskip(pb, 3); // paddding, transparent
197− st->sample_aspect_ratio.num = get_byte(pb);
198− st->sample_aspect_ratio.den = get_byte(pb);
197+ st->sample_aspect_ratio.num = avio_r8(pb);
198+ st->sample_aspect_ratio.den = avio_r8(pb);
199199 }
200200 break;
201201
@@ -286,7 +286,7 @@ static int iff_read_packet(AVFormatContext *s, · 84 unmodified lines
286286 if(st->codec->channels == 2) {
287287 uint8_t sample_buffer[PACKET_SIZE];
288288
289− ret = get_buffer(pb, sample_buffer, PACKET_SIZE);
289+ ret = avio_read(pb, sample_buffer, PACKET_SIZE);
290290 if(av_new_packet(pkt, PACKET_SIZE) < 0) {
291291 av_log(s, AV_LOG_ERROR, "cannot allocate packet\n");
292292 return AVERROR(ENOMEM);
libavformat/img2.c+1−1
@@ -298,7 +298,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt) · 297 unmodified lines
298298 pkt->size= 0;
299299 for(i=0; i<3; i++){
300300 if(size[i]){
301− ret[i]= get_buffer(f[i], pkt->data + pkt->size, size[i]);
301+ ret[i]= avio_read(f[i], pkt->data + pkt->size, size[i]);
302302 if (!s->is_pipe)
303303 url_fclose(f[i]);
304304 if(ret[i]>0)
libavformat/ingenientdec.c+7−7
@@ -27,18 +27,18 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) · 26 unmodified lines
2727 {
2828 int ret, size, w, h, unk1, unk2;
2929
30− if (get_le32(s->pb) != MKTAG('M', 'J', 'P', 'G'))
30+ if (avio_rl32(s->pb) != MKTAG('M', 'J', 'P', 'G'))
3131 return AVERROR(EIO); // FIXME
3232
33− size = get_le32(s->pb);
33+ size = avio_rl32(s->pb);
3434
35− w = get_le16(s->pb);
36− h = get_le16(s->pb);
35+ w = avio_rl16(s->pb);
36+ h = avio_rl16(s->pb);
3737
3838 url_fskip(s->pb, 8); // zero + size (padded?)
3939 url_fskip(s->pb, 2);
40− unk1 = get_le16(s->pb);
41− unk2 = get_le16(s->pb);
40+ unk1 = avio_rl16(s->pb);
41+ unk2 = avio_rl16(s->pb);
4242 url_fskip(s->pb, 22); // ASCII timestamp
4343
4444 av_log(s, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d, unk1=%d unk2=%d\n",
@@ -49,7 +49,7 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) · 4 unmodified lines
4949
5050 pkt->pos = url_ftell(s->pb);
5151 pkt->stream_index = 0;
52− ret = get_buffer(s->pb, pkt->data, size);
52+ ret = avio_read(s->pb, pkt->data, size);
5353 if (ret < 0) {
5454 av_free_packet(pkt);
5555 return ret;
libavformat/ipmovie.c+11−11
@@ -166,7 +166,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, · 165 unmodified lines
166166 url_fseek(pb, s->decode_map_chunk_offset, SEEK_SET);
167167 s->decode_map_chunk_offset = 0;
168168
169− if (get_buffer(pb, pkt->data, s->decode_map_chunk_size) !=
169+ if (avio_read(pb, pkt->data, s->decode_map_chunk_size) !=
170170 s->decode_map_chunk_size) {
171171 av_free_packet(pkt);
172172 return CHUNK_EOF;
@@ -175,7 +175,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, · 2 unmodified lines
175175 url_fseek(pb, s->video_chunk_offset, SEEK_SET);
176176 s->video_chunk_offset = 0;
177177
178− if (get_buffer(pb, pkt->data + s->decode_map_chunk_size,
178+ if (avio_read(pb, pkt->data + s->decode_map_chunk_size,
179179 s->video_chunk_size) != s->video_chunk_size) {
180180 av_free_packet(pkt);
181181 return CHUNK_EOF;
@@ -227,7 +227,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, · 45 unmodified lines
227227 /* read the next chunk, wherever the file happens to be pointing */
228228 if (url_feof(pb))
229229 return CHUNK_EOF;
230− if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
230+ if (avio_read(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
231231 CHUNK_PREAMBLE_SIZE)
232232 return CHUNK_BAD;
233233 chunk_size = AV_RL16(&chunk_preamble[0]);
@@ -275,7 +275,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, · 41 unmodified lines
275275 chunk_type = CHUNK_EOF;
276276 break;
277277 }
278− if (get_buffer(pb, opcode_preamble, CHUNK_PREAMBLE_SIZE) !=
278+ if (avio_read(pb, opcode_preamble, CHUNK_PREAMBLE_SIZE) !=
279279 CHUNK_PREAMBLE_SIZE) {
280280 chunk_type = CHUNK_BAD;
281281 break;
@@ -314,7 +314,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, · 32 unmodified lines
314314 chunk_type = CHUNK_BAD;
315315 break;
316316 }
317− if (get_buffer(pb, scratch, opcode_size) !=
317+ if (avio_read(pb, scratch, opcode_size) !=
318318 opcode_size) {
319319 chunk_type = CHUNK_BAD;
320320 break;
@@ -331,7 +331,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, · 10 unmodified lines
331331 chunk_type = CHUNK_BAD;
332332 break;
333333 }
334− if (get_buffer(pb, scratch, opcode_size) !=
334+ if (avio_read(pb, scratch, opcode_size) !=
335335 opcode_size) {
336336 chunk_type = CHUNK_BAD;
337337 break;
@@ -369,7 +369,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, · 31 unmodified lines
369369 chunk_type = CHUNK_BAD;
370370 break;
371371 }
372− if (get_buffer(pb, scratch, opcode_size) !=
372+ if (avio_read(pb, scratch, opcode_size) !=
373373 opcode_size) {
374374 chunk_type = CHUNK_BAD;
375375 break;
@@ -434,7 +434,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, · 58 unmodified lines
434434 chunk_type = CHUNK_BAD;
435435 break;
436436 }
437− if (get_buffer(pb, scratch, opcode_size) != opcode_size) {
437+ if (avio_read(pb, scratch, opcode_size) != opcode_size) {
438438 chunk_type = CHUNK_BAD;
439439 break;
440440 }
@@ -528,10 +528,10 @@ static int ipmovie_read_header(AVFormatContext *s, · 87 unmodified lines
528528 int chunk_type;
529529 uint8_t signature_buffer[sizeof(signature)];
530530
531− get_buffer(pb, signature_buffer, sizeof(signature_buffer));
531+ avio_read(pb, signature_buffer, sizeof(signature_buffer));
532532 while (memcmp(signature_buffer, signature, sizeof(signature))) {
533533 memmove(signature_buffer, signature_buffer + 1, sizeof(signature_buffer) - 1);
534− signature_buffer[sizeof(signature_buffer) - 1] = get_byte(pb);
534+ signature_buffer[sizeof(signature_buffer) - 1] = avio_r8(pb);
535535 if (url_feof(pb))
536536 return AVERROR_EOF;
537537 }
@@ -549,7 +549,7 @@ static int ipmovie_read_header(AVFormatContext *s, · 11 unmodified lines
549549
550550 /* peek ahead to the next chunk-- if it is an init audio chunk, process
551551 * it; if it is the first video chunk, this is a silent file */
552− if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
552+ if (avio_read(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) !=
553553 CHUNK_PREAMBLE_SIZE)
554554 return AVERROR(EIO);
555555 chunk_type = AV_RL16(&chunk_preamble[2]);
libavformat/isom.c+8−8
@@ -346,7 +346,7 @@ int ff_mp4_read_descr_len(AVIOContext *pb) · 345 unmodified lines
346346 int len = 0;
347347 int count = 4;
348348 while (count--) {
349− int c = get_byte(pb);
349+ int c = avio_r8(pb);
350350 len = (len << 7) | (c & 0x7f);
351351 if (!(c & 0x80))
352352 break;
@@ -357,7 +357,7 @@ int ff_mp4_read_descr_len(AVIOContext *pb) · 4 unmodified lines
357357 int ff_mp4_read_descr(AVFormatContext *fc, AVIOContext *pb, int *tag)
358358 {
359359 int len;
360− *tag = get_byte(pb);
360+ *tag = avio_r8(pb);
361361 len = ff_mp4_read_descr_len(pb);
362362 av_dlog(fc, "MPEG4 description: tag=0x%02x len=%d\n", *tag, len);
363363 return len;
@@ -375,11 +375,11 @@ static const AVCodecTag mp4_audio_types[] = { · 11 unmodified lines
375375 int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext *pb)
376376 {
377377 int len, tag;
378− int object_type_id = get_byte(pb);
379− get_byte(pb); /* stream type */
380− get_be24(pb); /* buffer size db */
381− get_be32(pb); /* max bitrate */
382− get_be32(pb); /* avg bitrate */
378+ int object_type_id = avio_r8(pb);
379+ avio_r8(pb); /* stream type */
380+ avio_rb24(pb); /* buffer size db */
381+ avio_rb32(pb); /* max bitrate */
382+ avio_rb32(pb); /* avg bitrate */
383383
384384 st->codec->codec_id= ff_codec_get_id(ff_mp4_obj_type, object_type_id);
385385 av_dlog(fc, "esds object type id 0x%02x\n", object_type_id);
@@ -392,7 +392,7 @@ int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext · 6 unmodified lines
392392 st->codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE);
393393 if (!st->codec->extradata)
394394 return AVERROR(ENOMEM);
395− get_buffer(pb, st->codec->extradata, len);
395+ avio_read(pb, st->codec->extradata, len);
396396 st->codec->extradata_size = len;
397397 if (st->codec->codec_id == CODEC_ID_AAC) {
398398 MPEG4AudioConfig cfg;
libavformat/iss.c+2−2
@@ -44,7 +44,7 @@ static void get_token(AVIOContext *s, char *buf, int maxlen) · 43 unmodified lines
4444 int i = 0;
4545 char c;
4646
47− while ((c = get_byte(s))) {
47+ while ((c = avio_r8(s))) {
4848 if(c == ' ')
4949 break;
5050 if (i < maxlen-1)
@@ -52,7 +52,7 @@ static void get_token(AVIOContext *s, char *buf, int maxlen) · 1 unmodified line
5252 }
5353
5454 if(!c)
55− get_byte(s);
55+ avio_r8(s);
5656
5757 buf[i] = 0; /* Ensure null terminated, but may be truncated */
5858 }
libavformat/iv8.c+6−6
@@ -57,13 +57,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) · 56 unmodified lines
5757 {
5858 int ret, size, pts, type;
5959 retry:
60− type= get_be16(s->pb); // 257 or 258
61− size= get_be16(s->pb);
60+ type= avio_rb16(s->pb); // 257 or 258
61+ size= avio_rb16(s->pb);
6262
63− get_be16(s->pb); //some flags, 0x80 indicates end of frame
64− get_be16(s->pb); //packet number
65− pts=get_be32(s->pb);
66− get_be32(s->pb); //6A 13 E3 88
63+ avio_rb16(s->pb); //some flags, 0x80 indicates end of frame
64+ avio_rb16(s->pb); //packet number
65+ pts=avio_rb32(s->pb);
66+ avio_rb32(s->pb); //6A 13 E3 88
6767
6868 size -= 12;
6969 if(size<1)
libavformat/ivfdec.c+11−11
@@ -36,9 +36,9 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 35 unmodified lines
3636 AVStream *st;
3737 AVRational time_base;
3838
39− get_le32(s->pb); // DKIF
40− get_le16(s->pb); // version
41− get_le16(s->pb); // header size
39+ avio_rl32(s->pb); // DKIF
40+ avio_rl16(s->pb); // version
41+ avio_rl16(s->pb); // header size
4242
4343 st = av_new_stream(s, 0);
4444 if (!st)
@@ -46,13 +46,13 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 1 unmodified line
4646
4747
4848 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
49− st->codec->codec_tag = get_le32(s->pb);
49+ st->codec->codec_tag = avio_rl32(s->pb);
5050 st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, st->codec->codec_tag);
51− st->codec->width = get_le16(s->pb);
52− st->codec->height = get_le16(s->pb);
53− time_base.den = get_le32(s->pb);
54− time_base.num = get_le32(s->pb);
55− st->duration = get_le64(s->pb);
51+ st->codec->width = avio_rl16(s->pb);
52+ st->codec->height = avio_rl16(s->pb);
53+ time_base.den = avio_rl32(s->pb);
54+ time_base.num = avio_rl32(s->pb);
55+ st->duration = avio_rl64(s->pb);
5656
5757 st->need_parsing = AVSTREAM_PARSE_HEADERS;
5858
@@ -68,8 +68,8 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 9 unmodified lines
6868
6969 static int read_packet(AVFormatContext *s, AVPacket *pkt)
7070 {
71− int ret, size = get_le32(s->pb);
72− int64_t pts = get_le64(s->pb);
71+ int ret, size = avio_rl32(s->pb);
72+ int64_t pts = avio_rl64(s->pb);
7373
7474 ret = av_get_packet(s->pb, pkt, size);
7575 pkt->stream_index = 0;
libavformat/libnut.c+1−1
@@ -173,7 +173,7 @@ static int nut_probe(AVProbeData *p) { · 172 unmodified lines
173173
174174 static size_t av_read(void * h, size_t len, uint8_t * buf) {
175175 AVIOContext * bc = h;
176− return get_buffer(bc, buf, len);
176+ return avio_read(bc, buf, len);
177177 }
178178
179179 static off_t av_seek(void * h, long long pos, int whence) {
libavformat/lmlm4.c+3−3
@@ -82,9 +82,9 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) { · 81 unmodified lines
8282 int ret;
8383 unsigned int frame_type, packet_size, padding, frame_size;
8484
85− get_be16(pb); /* channel number */
86− frame_type = get_be16(pb);
87− packet_size = get_be32(pb);
85+ avio_rb16(pb); /* channel number */
86+ frame_type = avio_rb16(pb);
87+ packet_size = avio_rb32(pb);
8888 padding = -packet_size & 511;
8989 frame_size = packet_size - 8;
9090
libavformat/lxfdec.c+5−5
@@ -86,7 +86,7 @@ static int sync(AVFormatContext *s, uint8_t *header) · 85 unmodified lines
8686 uint8_t buf[LXF_IDENT_LENGTH];
8787 int ret;
8888
89− if ((ret = get_buffer(s->pb, buf, LXF_IDENT_LENGTH)) != LXF_IDENT_LENGTH)
89+ if ((ret = avio_read(s->pb, buf, LXF_IDENT_LENGTH)) != LXF_IDENT_LENGTH)
9090 return ret < 0 ? ret : AVERROR_EOF;
9191
9292 while (memcmp(buf, LXF_IDENT, LXF_IDENT_LENGTH)) {
@@ -94,7 +94,7 @@ static int sync(AVFormatContext *s, uint8_t *header) · 1 unmodified line
9494 return AVERROR_EOF;
9595
9696 memmove(buf, &buf[1], LXF_IDENT_LENGTH-1);
97− buf[LXF_IDENT_LENGTH-1] = get_byte(s->pb);
97+ buf[LXF_IDENT_LENGTH-1] = avio_r8(s->pb);
9898 }
9999
100100 memcpy(header, LXF_IDENT, LXF_IDENT_LENGTH);
@@ -120,7 +120,7 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form · 19 unmodified lines
120120 return ret;
121121
122122 //read the rest of the packet header
123− if ((ret = get_buffer(pb, header + LXF_IDENT_LENGTH,
123+ if ((ret = avio_read(pb, header + LXF_IDENT_LENGTH,
124124 LXF_PACKET_HEADER_SIZE - LXF_IDENT_LENGTH)) !=
125125 LXF_PACKET_HEADER_SIZE - LXF_IDENT_LENGTH) {
126126 return ret < 0 ? ret : AVERROR_EOF;
@@ -214,7 +214,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 87 unmodified lines
214214 return AVERROR_INVALIDDATA;
215215 }
216216
217− if ((ret = get_buffer(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE)
217+ if ((ret = avio_read(pb, header_data, LXF_HEADER_DATA_SIZE)) != LXF_HEADER_DATA_SIZE)
218218 return ret < 0 ? ret : AVERROR_EOF;
219219
220220 if (!(st = av_new_stream(s, 0)))
@@ -315,7 +315,7 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt) · 94 unmodified lines
315315 //read non-20-bit audio data into lxf->temp so we can deplanarize it
316316 buf = ast && ast->codec->codec_id != CODEC_ID_PCM_LXF ? lxf->temp : pkt->data;
317317
318− if ((ret2 = get_buffer(pb, buf, ret)) != ret) {
318+ if ((ret2 = avio_read(pb, buf, ret)) != ret) {
319319 av_free_packet(pkt);
320320 return ret2 < 0 ? ret2 : AVERROR_EOF;
321321 }
libavformat/matroskadec.c+13−13
@@ -543,10 +543,10 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb, · 542 unmodified lines
543543 int read = 1, n = 1;
544544 uint64_t total = 0;
545545
546− /* The first byte tells us the length in bytes - get_byte() can normally
546+ /* The first byte tells us the length in bytes - avio_r8() can normally
547547 * return 0, but since that's not a valid first ebmlID byte, we can
548548 * use it safely here to catch EOS. */
549− if (!(total = get_byte(pb))) {
549+ if (!(total = avio_r8(pb))) {
550550 /* we might encounter EOS here */
551551 if (!url_feof(pb)) {
552552 int64_t pos = url_ftell(pb);
@@ -570,7 +570,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb, · 17 unmodified lines
570570 /* read out length */
571571 total ^= 1 << ff_log2_tab[total];
572572 while (n++ < read)
573− total = (total << 8) | get_byte(pb);
573+ total = (total << 8) | avio_r8(pb);
574574
575575 *number = total;
576576
@@ -605,7 +605,7 @@ static int ebml_read_uint(AVIOContext *pb, int size, uint64_t *num) · 28 unmodified lines
605605 /* big-endian ordering; build up number */
606606 *num = 0;
607607 while (n++ < size)
608− *num = (*num << 8) | get_byte(pb);
608+ *num = (*num << 8) | avio_r8(pb);
609609
610610 return 0;
611611 }
@@ -619,9 +619,9 @@ static int ebml_read_float(AVIOContext *pb, int size, double *num) · 7 unmodified lines
619619 if (size == 0) {
620620 *num = 0;
621621 } else if (size == 4) {
622− *num= av_int2flt(get_be32(pb));
622+ *num= av_int2flt(avio_rb32(pb));
623623 } else if(size==8){
624− *num= av_int2dbl(get_be64(pb));
624+ *num= av_int2dbl(avio_rb64(pb));
625625 } else
626626 return AVERROR_INVALIDDATA;
627627
@@ -639,7 +639,7 @@ static int ebml_read_ascii(AVIOContext *pb, int size, char **str) · 11 unmodified lines
639639 * byte more, read the string and NULL-terminate it ourselves. */
640640 if (!(*str = av_malloc(size + 1)))
641641 return AVERROR(ENOMEM);
642− if (get_buffer(pb, (uint8_t *) *str, size) != size) {
642+ if (avio_read(pb, (uint8_t *) *str, size) != size) {
643643 av_freep(str);
644644 return AVERROR(EIO);
645645 }
@@ -660,7 +660,7 @@ static int ebml_read_binary(AVIOContext *pb, int length, EbmlBin *bin) · 14 unmodified lines
660660
661661 bin->size = length;
662662 bin->pos = url_ftell(pb);
663− if (get_buffer(pb, bin->data, length) != length) {
663+ if (avio_read(pb, bin->data, length) != length) {
664664 av_freep(&bin->data);
665665 return AVERROR(EIO);
666666 }
@@ -1394,12 +1394,12 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) · 727 unmodified lines
13941394 ffio_init_context(&b, track->codec_priv.data,track->codec_priv.size,
13951395 0, NULL, NULL, NULL, NULL);
13961396 url_fskip(&b, 22);
1397− flavor = get_be16(&b);
1398− track->audio.coded_framesize = get_be32(&b);
1397+ flavor = avio_rb16(&b);
1398+ track->audio.coded_framesize = avio_rb32(&b);
13991399 url_fskip(&b, 12);
1400− track->audio.sub_packet_h = get_be16(&b);
1401− track->audio.frame_size = get_be16(&b);
1402− track->audio.sub_packet_size = get_be16(&b);
1400+ track->audio.sub_packet_h = avio_rb16(&b);
1401+ track->audio.frame_size = avio_rb16(&b);
1402+ track->audio.sub_packet_size = avio_rb16(&b);
14031403 track->audio.buf = av_malloc(track->audio.frame_size * track->audio.sub_packet_h);
14041404 if (codec_id == CODEC_ID_RA_288) {
14051405 st->codec->block_align = track->audio.coded_framesize;
libavformat/mm.c+9−9
@@ -90,18 +90,18 @@ static int read_header(AVFormatContext *s, · 89 unmodified lines
9090 unsigned int type, length;
9191 unsigned int frame_rate, width, height;
9292
93− type = get_le16(pb);
94− length = get_le32(pb);
93+ type = avio_rl16(pb);
94+ length = avio_rl32(pb);
9595
9696 if (type != MM_TYPE_HEADER)
9797 return AVERROR_INVALIDDATA;
9898
9999 /* read header */
100− get_le16(pb); /* total number of chunks */
101− frame_rate = get_le16(pb);
102− get_le16(pb); /* ibm-pc video bios mode */
103− width = get_le16(pb);
104− height = get_le16(pb);
100+ avio_rl16(pb); /* total number of chunks */
101+ frame_rate = avio_rl16(pb);
102+ avio_rl16(pb); /* ibm-pc video bios mode */
103+ width = avio_rl16(pb);
104+ height = avio_rl16(pb);
105105 url_fseek(pb, length - 10, SEEK_CUR); /* unknown data */
106106
107107 /* video stream */
@@ -143,7 +143,7 @@ static int read_packet(AVFormatContext *s, · 35 unmodified lines
143143
144144 while(1) {
145145
146− if (get_buffer(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) {
146+ if (avio_read(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) {
147147 return AVERROR(EIO);
148148 }
149149
@@ -162,7 +162,7 @@ static int read_packet(AVFormatContext *s, · 12 unmodified lines
162162 if (av_new_packet(pkt, length + MM_PREAMBLE_SIZE))
163163 return AVERROR(ENOMEM);
164164 memcpy(pkt->data, preamble, MM_PREAMBLE_SIZE);
165− if (get_buffer(pb, pkt->data + MM_PREAMBLE_SIZE, length) != length)
165+ if (avio_read(pb, pkt->data + MM_PREAMBLE_SIZE, length) != length)
166166 return AVERROR(EIO);
167167 pkt->size = length + MM_PREAMBLE_SIZE;
168168 pkt->stream_index = 0;
libavformat/mmf.c+13−13
@@ -188,15 +188,15 @@ static int mmf_read_header(AVFormatContext *s, · 187 unmodified lines
188188 int64_t file_size, size;
189189 int rate, params;
190190
191− tag = get_le32(pb);
191+ tag = avio_rl32(pb);
192192 if (tag != MKTAG('M', 'M', 'M', 'D'))
193193 return -1;
194− file_size = get_be32(pb);
194+ file_size = avio_rb32(pb);
195195
196196 /* Skip some unused chunks that may or may not be present */
197197 for(;; url_fseek(pb, size, SEEK_CUR)) {
198− tag = get_le32(pb);
199− size = get_be32(pb);
198+ tag = avio_rl32(pb);
199+ size = avio_rb32(pb);
200200 if(tag == MKTAG('C','N','T','I')) continue;
201201 if(tag == MKTAG('O','P','D','A')) continue;
202202 break;
@@ -212,22 +212,22 @@ static int mmf_read_header(AVFormatContext *s, · 9 unmodified lines
212212 return -1;
213213 }
214214
215− get_byte(pb); /* format type */
216− get_byte(pb); /* sequence type */
217− params = get_byte(pb); /* (channel << 7) | (format << 4) | rate */
215+ avio_r8(pb); /* format type */
216+ avio_r8(pb); /* sequence type */
217+ params = avio_r8(pb); /* (channel << 7) | (format << 4) | rate */
218218 rate = mmf_rate(params & 0x0f);
219219 if(rate < 0) {
220220 av_log(s, AV_LOG_ERROR, "Invalid sample rate\n");
221221 return -1;
222222 }
223− get_byte(pb); /* wave base bit */
224− get_byte(pb); /* time base d */
225− get_byte(pb); /* time base g */
223+ avio_r8(pb); /* wave base bit */
224+ avio_r8(pb); /* time base d */
225+ avio_r8(pb); /* time base g */
226226
227227 /* Skip some unused chunks that may or may not be present */
228228 for(;; url_fseek(pb, size, SEEK_CUR)) {
229− tag = get_le32(pb);
230− size = get_be32(pb);
229+ tag = avio_rl32(pb);
230+ size = avio_rb32(pb);
231231 if(tag == MKTAG('A','t','s','q')) continue;
232232 if(tag == MKTAG('A','s','p','I')) continue;
233233 break;
@@ -280,7 +280,7 @@ static int mmf_read_packet(AVFormatContext *s, · 46 unmodified lines
280280 return AVERROR(EIO);
281281 pkt->stream_index = 0;
282282
283− ret = get_buffer(s->pb, pkt->data, pkt->size);
283+ ret = avio_read(s->pb, pkt->data, pkt->size);
284284 if (ret < 0)
285285 av_free_packet(pkt);
286286
libavformat/mov.c+237−237
@@ -83,11 +83,11 @@ static int mov_metadata_trkn(MOVContext *c, AVIOContext *pb, unsigned len) · 82 unmodified lines
8383 {
8484 char buf[16];
8585
86− get_be16(pb); // unknown
87− snprintf(buf, sizeof(buf), "%d", get_be16(pb));
86+ avio_rb16(pb); // unknown
87+ snprintf(buf, sizeof(buf), "%d", avio_rb16(pb));
8888 av_metadata_set2(&c->fc->metadata, "track", buf, 0);
8989
90− get_be16(pb); // total tracks
90+ avio_rb16(pb); // total tracks
9191
9292 return 0;
9393 }
@@ -119,7 +119,7 @@ static int mov_read_mac_string(MOVContext *c, AVIOContext *pb, int len, · 25 unmodified lines
119119 int i;
120120
121121 for (i = 0; i < len; i++) {
122− uint8_t t, c = get_byte(pb);
122+ uint8_t t, c = avio_r8(pb);
123123 if (c < 0x80 && p < end)
124124 *p++ = c;
125125 else
@@ -165,17 +165,17 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 39 unmodified lines
165165 }
166166
167167 if (c->itunes_metadata && atom.size > 8) {
168− int data_size = get_be32(pb);
169− int tag = get_le32(pb);
168+ int data_size = avio_rb32(pb);
169+ int tag = avio_rl32(pb);
170170 if (tag == MKTAG('d','a','t','a')) {
171− data_type = get_be32(pb); // type
172− get_be32(pb); // unknown
171+ data_type = avio_rb32(pb); // type
172+ avio_rb32(pb); // unknown
173173 str_size = data_size - 16;
174174 atom.size -= 16;
175175 } else return 0;
176176 } else if (atom.size > 4 && key && !c->itunes_metadata) {
177− str_size = get_be16(pb); // string length
178− langcode = get_be16(pb);
177+ str_size = avio_rb16(pb); // string length
178+ langcode = avio_rb16(pb);
179179 ff_mov_lang_to_iso639(langcode, language);
180180 atom.size -= 4;
181181 } else
@@ -201,7 +201,7 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 19 unmodified lines
201201 if (data_type == 3 || (data_type == 0 && langcode < 0x800)) { // MAC Encoded
202202 mov_read_mac_string(c, pb, str_size, str, sizeof(str));
203203 } else {
204− get_buffer(pb, str, str_size);
204+ avio_read(pb, str, str_size);
205205 str[str_size] = 0;
206206 }
207207 av_metadata_set2(&c->fc->metadata, key, str, 0);
@@ -228,23 +228,23 @@ static int mov_read_chpl(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 20 unmodified lines
228228 if ((atom.size -= 5) < 0)
229229 return 0;
230230
231− version = get_byte(pb);
232− get_be24(pb);
231+ version = avio_r8(pb);
232+ avio_rb24(pb);
233233 if (version)
234− get_be32(pb); // ???
235− nb_chapters = get_byte(pb);
234+ avio_rb32(pb); // ???
235+ nb_chapters = avio_r8(pb);
236236
237237 for (i = 0; i < nb_chapters; i++) {
238238 if (atom.size < 9)
239239 return 0;
240240
241− start = get_be64(pb);
242− str_len = get_byte(pb);
241+ start = avio_rb64(pb);
242+ str_len = avio_r8(pb);
243243
244244 if ((atom.size -= 9+str_len) < 0)
245245 return 0;
246246
247− get_buffer(pb, str, str_len);
247+ avio_read(pb, str, str_len);
248248 str[str_len] = 0;
249249 ff_new_chapter(c->fc, i, (AVRational){1,10000000}, start, AV_NOPTS_VALUE, str);
250250 }
@@ -264,14 +264,14 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 13 unmodified lines
264264 a.size = atom.size;
265265 a.type=0;
266266 if(atom.size >= 8) {
267− a.size = get_be32(pb);
268− a.type = get_le32(pb);
267+ a.size = avio_rb32(pb);
268+ a.type = avio_rl32(pb);
269269 }
270270 av_dlog(c->fc, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n",
271271 a.type, (char*)&a.type, (char*)&atom.type, a.size, total_size, atom.size);
272272 total_size += 8;
273273 if (a.size == 1) { /* 64 bit extended size */
274− a.size = get_be64(pb) - 8;
274+ a.size = avio_rb64(pb) - 8;
275275 total_size += 8;
276276 }
277277 if (a.size == 0) {
@@ -331,8 +331,8 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 53 unmodified lines
331331 st = c->fc->streams[c->fc->nb_streams-1];
332332 sc = st->priv_data;
333333
334− get_be32(pb); // version + flags
335− entries = get_be32(pb);
334+ avio_rb32(pb); // version + flags
335+ entries = avio_rb32(pb);
336336 if (entries >= UINT_MAX / sizeof(*sc->drefs))
337337 return -1;
338338 sc->drefs = av_mallocz(entries * sizeof(*sc->drefs));
@@ -342,14 +342,14 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 3 unmodified lines
342342
343343 for (i = 0; i < sc->drefs_count; i++) {
344344 MOVDref *dref = &sc->drefs[i];
345− uint32_t size = get_be32(pb);
345+ uint32_t size = avio_rb32(pb);
346346 int64_t next = url_ftell(pb) + size - 4;
347347
348348 if (size < 12)
349349 return -1;
350350
351− dref->type = get_le32(pb);
352− get_be32(pb); // version + flags
351+ dref->type = avio_rl32(pb);
352+ avio_rb32(pb); // version + flags
353353 av_dlog(c->fc, "type %.4s size %d\n", (char*)&dref->type, size);
354354
355355 if (dref->type == MKTAG('a','l','i','s') && size > 150) {
@@ -359,33 +359,33 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 3 unmodified lines
359359
360360 url_fskip(pb, 10);
361361
362− volume_len = get_byte(pb);
362+ volume_len = avio_r8(pb);
363363 volume_len = FFMIN(volume_len, 27);
364− get_buffer(pb, dref->volume, 27);
364+ avio_read(pb, dref->volume, 27);
365365 dref->volume[volume_len] = 0;
366366 av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", dref->volume, volume_len);
367367
368368 url_fskip(pb, 12);
369369
370− len = get_byte(pb);
370+ len = avio_r8(pb);
371371 len = FFMIN(len, 63);
372− get_buffer(pb, dref->filename, 63);
372+ avio_read(pb, dref->filename, 63);
373373 dref->filename[len] = 0;
374374 av_log(c->fc, AV_LOG_DEBUG, "filename %s, len %d\n", dref->filename, len);
375375
376376 url_fskip(pb, 16);
377377
378378 /* read next level up_from_alias/down_to_target */
379− dref->nlvl_from = get_be16(pb);
380− dref->nlvl_to = get_be16(pb);
379+ dref->nlvl_from = avio_rb16(pb);
380+ dref->nlvl_to = avio_rb16(pb);
381381 av_log(c->fc, AV_LOG_DEBUG, "nlvl from %d, nlvl to %d\n",
382382 dref->nlvl_from, dref->nlvl_to);
383383
384384 url_fskip(pb, 16);
385385
386386 for (type = 0; type != -1 && url_ftell(pb) < next; ) {
387− type = get_be16(pb);
388− len = get_be16(pb);
387+ type = avio_rb16(pb);
388+ len = avio_rb16(pb);
389389 av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len);
390390 if (len&1)
391391 len += 1;
@@ -394,7 +394,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 2 unmodified lines
394394 dref->path = av_mallocz(len+1);
395395 if (!dref->path)
396396 return AVERROR(ENOMEM);
397− get_buffer(pb, dref->path, len);
397+ avio_read(pb, dref->path, len);
398398 if (len > volume_len && !strncmp(dref->path, dref->volume, volume_len)) {
399399 len -= volume_len;
400400 memmove(dref->path, dref->path+volume_len, len);
@@ -409,7 +409,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 8 unmodified lines
409409 dref->dir = av_malloc(len+1);
410410 if (!dref->dir)
411411 return AVERROR(ENOMEM);
412− get_buffer(pb, dref->dir, len);
412+ avio_read(pb, dref->dir, len);
413413 dref->dir[len] = 0;
414414 for (j = 0; j < len; j++)
415415 if (dref->dir[j] == ':')
@@ -435,12 +435,12 @@ static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 19 unmodified lines
435435
436436 st = c->fc->streams[c->fc->nb_streams-1];
437437
438− get_byte(pb); /* version */
439− get_be24(pb); /* flags */
438+ avio_r8(pb); /* version */
439+ avio_rb24(pb); /* flags */
440440
441441 /* component type */
442− ctype = get_le32(pb);
443− type = get_le32(pb); /* component subtype */
442+ ctype = avio_rl32(pb);
443+ type = avio_rl32(pb); /* component subtype */
444444
445445 av_dlog(c->fc, "ctype= %.4s (0x%08x)\n", (char*)&ctype, ctype);
446446 av_dlog(c->fc, "stype= %.4s\n", (char*)&type);
@@ -454,9 +454,9 @@ static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 7 unmodified lines
454454 else if(type == MKTAG('s','u','b','p'))
455455 st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
456456
457− get_be32(pb); /* component manufacture */
458− get_be32(pb); /* component flags */
459− get_be32(pb); /* component flags mask */
457+ avio_rb32(pb); /* component manufacture */
458+ avio_rb32(pb); /* component flags */
459+ avio_rb32(pb); /* component flags mask */
460460
461461 return 0;
462462 }
@@ -470,13 +470,13 @@ int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom) · 7 unmodified lines
470470 return 0;
471471 st = fc->streams[fc->nb_streams-1];
472472
473− get_be32(pb); /* version + flags */
473+ avio_rb32(pb); /* version + flags */
474474 len = ff_mp4_read_descr(fc, pb, &tag);
475475 if (tag == MP4ESDescrTag) {
476− get_be16(pb); /* ID */
477− get_byte(pb); /* priority */
476+ avio_rb16(pb); /* ID */
477+ avio_r8(pb); /* priority */
478478 } else
479− get_be16(pb); /* ID */
479+ avio_rb16(pb); /* ID */
480480
481481 len = ff_mp4_read_descr(fc, pb, &tag);
482482 if (tag == MP4DecConfigDescrTag)
@@ -498,7 +498,7 @@ static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 15 unmodified lines
498498 return 0;
499499 st = c->fc->streams[c->fc->nb_streams-1];
500500
501− ac3info = get_be24(pb);
501+ ac3info = avio_rb24(pb);
502502 acmod = (ac3info >> 11) & 0x7;
503503 lfeon = (ac3info >> 10) & 0x1;
504504 st->codec->channels = ((int[]){2,1,2,3,3,4,4,5})[acmod] + lfeon;
@@ -508,8 +508,8 @@ static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 3 unmodified lines
508508
509509 static int mov_read_pasp(MOVContext *c, AVIOContext *pb, MOVAtom atom)
510510 {
511− const int num = get_be32(pb);
512− const int den = get_be32(pb);
511+ const int num = avio_rb32(pb);
512+ const int den = avio_rb32(pb);
513513 AVStream *st;
514514
515515 if (c->fc->nb_streams < 1)
@@ -547,12 +547,12 @@ static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 31 unmodified lines
547547 char* comp_brands_str;
548548 uint8_t type[5] = {0};
549549
550− get_buffer(pb, type, 4);
550+ avio_read(pb, type, 4);
551551 if (strcmp(type, "qt "))
552552 c->isom = 1;
553553 av_log(c->fc, AV_LOG_DEBUG, "ISO: File Type Major Brand: %.4s\n",(char *)&type);
554554 av_metadata_set2(&c->fc->metadata, "major_brand", type, 0);
555− minor_ver = get_be32(pb); /* minor version */
555+ minor_ver = avio_rb32(pb); /* minor version */
556556 snprintf(minor_ver_str, sizeof(minor_ver_str), "%d", minor_ver);
557557 av_metadata_set2(&c->fc->metadata, "minor_version", minor_ver_str, 0);
558558
@@ -562,7 +562,7 @@ static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 3 unmodified lines
562562 comp_brands_str = av_malloc(comp_brand_size + 1); /* Add null terminator */
563563 if (!comp_brands_str)
564564 return AVERROR(ENOMEM);
565− get_buffer(pb, comp_brands_str, comp_brand_size);
565+ avio_read(pb, comp_brands_str, comp_brand_size);
566566 comp_brands_str[comp_brand_size] = 0;
567567 av_metadata_set2(&c->fc->metadata, "compatible_brands", comp_brands_str, 0);
568568 av_freep(&comp_brands_str);
@@ -615,27 +615,27 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 46 unmodified lines
615615 st = c->fc->streams[c->fc->nb_streams-1];
616616 sc = st->priv_data;
617617
618− version = get_byte(pb);
618+ version = avio_r8(pb);
619619 if (version > 1)
620620 return -1; /* unsupported */
621621
622− get_be24(pb); /* flags */
622+ avio_rb24(pb); /* flags */
623623 if (version == 1) {
624− creation_time = get_be64(pb);
625− get_be64(pb);
624+ creation_time = avio_rb64(pb);
625+ avio_rb64(pb);
626626 } else {
627− creation_time = get_be32(pb);
628− get_be32(pb); /* modification time */
627+ creation_time = avio_rb32(pb);
628+ avio_rb32(pb); /* modification time */
629629 }
630630 mov_metadata_creation_time(&st->metadata, creation_time);
631631
632− sc->time_scale = get_be32(pb);
633− st->duration = (version == 1) ? get_be64(pb) : get_be32(pb); /* duration */
632+ sc->time_scale = avio_rb32(pb);
633+ st->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */
634634
635− lang = get_be16(pb); /* language */
635+ lang = avio_rb16(pb); /* language */
636636 if (ff_mov_lang_to_iso639(lang, language))
637637 av_metadata_set2(&st->metadata, "language", language, 0);
638− get_be16(pb); /* quality */
638+ avio_rb16(pb); /* quality */
639639
640640 return 0;
641641 }
@@ -643,37 +643,37 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 1 unmodified line
643643 static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
644644 {
645645 time_t creation_time;
646− int version = get_byte(pb); /* version */
647− get_be24(pb); /* flags */
646+ int version = avio_r8(pb); /* version */
647+ avio_rb24(pb); /* flags */
648648
649649 if (version == 1) {
650− creation_time = get_be64(pb);
651− get_be64(pb);
650+ creation_time = avio_rb64(pb);
651+ avio_rb64(pb);
652652 } else {
653− creation_time = get_be32(pb);
654− get_be32(pb); /* modification time */
653+ creation_time = avio_rb32(pb);
654+ avio_rb32(pb); /* modification time */
655655 }
656656 mov_metadata_creation_time(&c->fc->metadata, creation_time);
657− c->time_scale = get_be32(pb); /* time scale */
657+ c->time_scale = avio_rb32(pb); /* time scale */
658658
659659 av_dlog(c->fc, "time scale = %i\n", c->time_scale);
660660
661− c->duration = (version == 1) ? get_be64(pb) : get_be32(pb); /* duration */
662− get_be32(pb); /* preferred scale */
661+ c->duration = (version == 1) ? avio_rb64(pb) : avio_rb32(pb); /* duration */
662+ avio_rb32(pb); /* preferred scale */
663663
664− get_be16(pb); /* preferred volume */
664+ avio_rb16(pb); /* preferred volume */
665665
666666 url_fskip(pb, 10); /* reserved */
667667
668668 url_fskip(pb, 36); /* display matrix */
669669
670− get_be32(pb); /* preview time */
671− get_be32(pb); /* preview duration */
672− get_be32(pb); /* poster time */
673− get_be32(pb); /* selection time */
674− get_be32(pb); /* selection duration */
675− get_be32(pb); /* current time */
676− get_be32(pb); /* next track ID */
670+ avio_rb32(pb); /* preview time */
671+ avio_rb32(pb); /* preview duration */
672+ avio_rb32(pb); /* poster time */
673+ avio_rb32(pb); /* selection time */
674+ avio_rb32(pb); /* selection duration */
675+ avio_rb32(pb); /* current time */
676+ avio_rb32(pb); /* next track ID */
677677
678678 return 0;
679679 }
@@ -697,7 +697,7 @@ static int mov_read_smi(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 17 unmodified lines
697697 return AVERROR(ENOMEM);
698698 st->codec->extradata_size = 0x5a + atom.size;
699699 memcpy(st->codec->extradata, "SVQ3", 4); // fake
700− get_buffer(pb, st->codec->extradata + 0x5a, atom.size);
700+ avio_read(pb, st->codec->extradata + 0x5a, atom.size);
701701 av_dlog(c->fc, "Reading SMI %"PRId64" %s\n", atom.size, st->codec->extradata + 0x5a);
702702 return 0;
703703 }
@@ -711,7 +711,7 @@ static int mov_read_enda(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 7 unmodified lines
711711 return 0;
712712 st = c->fc->streams[c->fc->nb_streams-1];
713713
714− little_endian = get_be16(pb);
714+ little_endian = avio_rb16(pb);
715715 av_dlog(c->fc, "enda %d\n", little_endian);
716716 if (little_endian == 1) {
717717 switch (st->codec->codec_id) {
@@ -755,7 +755,7 @@ static int mov_read_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 37 unmodified lines
755755 st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE;
756756 AV_WB32( buf , atom.size + 8);
757757 AV_WL32( buf + 4, atom.type);
758− get_buffer(pb, buf + 8, atom.size);
758+ avio_read(pb, buf + 8, atom.size);
759759 return 0;
760760 }
761761
@@ -777,7 +777,7 @@ static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 15 unmodified lines
777777 if (!st->codec->extradata)
778778 return AVERROR(ENOMEM);
779779 st->codec->extradata_size = atom.size;
780− get_buffer(pb, st->codec->extradata, atom.size);
780+ avio_read(pb, st->codec->extradata, atom.size);
781781 } else if (atom.size > 8) { /* to read frma, esds atoms */
782782 if (mov_read_default(c, pb, atom) < 0)
783783 return -1;
@@ -806,7 +806,7 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 22 unmodified lines
806806 if (!st->codec->extradata)
807807 return AVERROR(ENOMEM);
808808 st->codec->extradata_size = atom.size;
809− get_buffer(pb, st->codec->extradata, atom.size);
809+ avio_read(pb, st->codec->extradata, atom.size);
810810 return 0;
811811 }
812812
@@ -834,7 +834,7 @@ static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 21 unmodified lines
834834 return AVERROR(ENOMEM);
835835 st->codec->extradata_size = atom.size - 40;
836836 url_fskip(pb, 40);
837− get_buffer(pb, st->codec->extradata, atom.size - 40);
837+ avio_read(pb, st->codec->extradata, atom.size - 40);
838838 return 0;
839839 }
840840
@@ -849,10 +849,10 @@ static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 8 unmodified lines
849849 st = c->fc->streams[c->fc->nb_streams-1];
850850 sc = st->priv_data;
851851
852− get_byte(pb); /* version */
853− get_be24(pb); /* flags */
852+ avio_r8(pb); /* version */
853+ avio_rb24(pb); /* flags */
854854
855− entries = get_be32(pb);
855+ entries = avio_rb32(pb);
856856
857857 if(entries >= UINT_MAX/sizeof(int64_t))
858858 return -1;
@@ -864,10 +864,10 @@ static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 5 unmodified lines
864864
865865 if (atom.type == MKTAG('s','t','c','o'))
866866 for(i=0; i<entries; i++)
867− sc->chunk_offsets[i] = get_be32(pb);
867+ sc->chunk_offsets[i] = avio_rb32(pb);
868868 else if (atom.type == MKTAG('c','o','6','4'))
869869 for(i=0; i<entries; i++)
870− sc->chunk_offsets[i] = get_be64(pb);
870+ sc->chunk_offsets[i] = avio_rb64(pb);
871871 else
872872 return -1;
873873
@@ -926,13 +926,13 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) · 52 unmodified lines
926926 int dref_id = 1;
927927 MOVAtom a = { AV_RL32("stsd") };
928928 int64_t start_pos = url_ftell(pb);
929− int size = get_be32(pb); /* size */
930− uint32_t format = get_le32(pb); /* data format */
929+ int size = avio_rb32(pb); /* size */
930+ uint32_t format = avio_rl32(pb); /* data format */
931931
932932 if (size >= 16) {
933− get_be32(pb); /* reserved */
934− get_be16(pb); /* reserved */
935− dref_id = get_be16(pb);
933+ avio_rb32(pb); /* reserved */
934+ avio_rb16(pb); /* reserved */
935+ dref_id = avio_rb16(pb);
936936 }
937937
938938 if (st->codec->codec_tag &&
@@ -984,21 +984,21 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) · 45 unmodified lines
984984 int color_greyscale;
985985
986986 st->codec->codec_id = id;
987− get_be16(pb); /* version */
988− get_be16(pb); /* revision level */
989− get_be32(pb); /* vendor */
990− get_be32(pb); /* temporal quality */
991− get_be32(pb); /* spatial quality */
987+ avio_rb16(pb); /* version */
988+ avio_rb16(pb); /* revision level */
989+ avio_rb32(pb); /* vendor */
990+ avio_rb32(pb); /* temporal quality */
991+ avio_rb32(pb); /* spatial quality */
992992
993− st->codec->width = get_be16(pb); /* width */
994− st->codec->height = get_be16(pb); /* height */
993+ st->codec->width = avio_rb16(pb); /* width */
994+ st->codec->height = avio_rb16(pb); /* height */
995995
996− get_be32(pb); /* horiz resolution */
997− get_be32(pb); /* vert resolution */
998− get_be32(pb); /* data size, always 0 */
999− get_be16(pb); /* frames per samples */
996+ avio_rb32(pb); /* horiz resolution */
997+ avio_rb32(pb); /* vert resolution */
998+ avio_rb32(pb); /* data size, always 0 */
999+ avio_rb16(pb); /* frames per samples */
10001000
1001− len = get_byte(pb); /* codec name, pascal string */
1001+ len = avio_r8(pb); /* codec name, pascal string */
10021002 if (len > 31)
10031003 len = 31;
10041004 mov_read_mac_string(c, pb, len, st->codec->codec_name, 32);
@@ -1008,8 +1008,8 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) · 3 unmodified lines
10081008 if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25))
10091009 st->codec->codec_tag=MKTAG('I', '4', '2', '0');
10101010
1011− st->codec->bits_per_coded_sample = get_be16(pb); /* depth */
1012− st->codec->color_table_id = get_be16(pb); /* colortable id */
1011+ st->codec->bits_per_coded_sample = avio_rb16(pb); /* depth */
1012+ st->codec->color_table_id = avio_rb16(pb); /* colortable id */
10131013 av_dlog(c->fc, "depth %d, ctab id %d\n",
10141014 st->codec->bits_per_coded_sample, st->codec->color_table_id);
10151015 /* figure out the palette situation */
@@ -1059,23 +1059,23 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) · 43 unmodified lines
10591059 }
10601060 } else {
10611061 /* load the palette from the file */
1062− color_start = get_be32(pb);
1063− color_count = get_be16(pb);
1064− color_end = get_be16(pb);
1062+ color_start = avio_rb32(pb);
1063+ color_count = avio_rb16(pb);
1064+ color_end = avio_rb16(pb);
10651065 if ((color_start <= 255) &&
10661066 (color_end <= 255)) {
10671067 for (j = color_start; j <= color_end; j++) {
10681068 /* each R, G, or B component is 16 bits;
10691069 * only use the top 8 bits; skip alpha bytes
10701070 * up front */
1071− get_byte(pb);
1072− get_byte(pb);
1073− r = get_byte(pb);
1074− get_byte(pb);
1075− g = get_byte(pb);
1076− get_byte(pb);
1077− b = get_byte(pb);
1078− get_byte(pb);
1071+ avio_r8(pb);
1072+ avio_r8(pb);
1073+ r = avio_r8(pb);
1074+ avio_r8(pb);
1075+ g = avio_r8(pb);
1076+ avio_r8(pb);
1077+ b = avio_r8(pb);
1078+ avio_r8(pb);
10791079 st->codec->palctrl->palette[j] =
10801080 (r << 16) | (g << 8) | (b);
10811081 }
@@ -1085,38 +1085,38 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) · 3 unmodified lines
10851085 }
10861086 } else if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO) {
10871087 int bits_per_sample, flags;
1088− uint16_t version = get_be16(pb);
1088+ uint16_t version = avio_rb16(pb);
10891089
10901090 st->codec->codec_id = id;
1091− get_be16(pb); /* revision level */
1092− get_be32(pb); /* vendor */
1091+ avio_rb16(pb); /* revision level */
1092+ avio_rb32(pb); /* vendor */
10931093
1094− st->codec->channels = get_be16(pb); /* channel count */
1094+ st->codec->channels = avio_rb16(pb); /* channel count */
10951095 av_dlog(c->fc, "audio channels %d\n", st->codec->channels);
1096− st->codec->bits_per_coded_sample = get_be16(pb); /* sample size */
1096+ st->codec->bits_per_coded_sample = avio_rb16(pb); /* sample size */
10971097
1098− sc->audio_cid = get_be16(pb);
1099− get_be16(pb); /* packet size = 0 */
1098+ sc->audio_cid = avio_rb16(pb);
1099+ avio_rb16(pb); /* packet size = 0 */
11001100
1101− st->codec->sample_rate = ((get_be32(pb) >> 16));
1101+ st->codec->sample_rate = ((avio_rb32(pb) >> 16));
11021102
11031103 //Read QT version 1 fields. In version 0 these do not exist.
11041104 av_dlog(c->fc, "version =%d, isom =%d\n",version,c->isom);
11051105 if(!c->isom) {
11061106 if(version==1) {
1107− sc->samples_per_frame = get_be32(pb);
1108− get_be32(pb); /* bytes per packet */
1109− sc->bytes_per_frame = get_be32(pb);
1110− get_be32(pb); /* bytes per sample */
1107+ sc->samples_per_frame = avio_rb32(pb);
1108+ avio_rb32(pb); /* bytes per packet */
1109+ sc->bytes_per_frame = avio_rb32(pb);
1110+ avio_rb32(pb); /* bytes per sample */
11111111 } else if(version==2) {
1112− get_be32(pb); /* sizeof struct only */
1113− st->codec->sample_rate = av_int2dbl(get_be64(pb)); /* float 64 */
1114− st->codec->channels = get_be32(pb);
1115− get_be32(pb); /* always 0x7F000000 */
1116− st->codec->bits_per_coded_sample = get_be32(pb); /* bits per channel if sound is uncompressed */
1117− flags = get_be32(pb); /* lpcm format specific flag */
1118− sc->bytes_per_frame = get_be32(pb); /* bytes per audio packet if constant */
1119− sc->samples_per_frame = get_be32(pb); /* lpcm frames per audio packet if constant */
1112+ avio_rb32(pb); /* sizeof struct only */
1113+ st->codec->sample_rate = av_int2dbl(avio_rb64(pb)); /* float 64 */
1114+ st->codec->channels = avio_rb32(pb);
1115+ avio_rb32(pb); /* always 0x7F000000 */
1116+ st->codec->bits_per_coded_sample = avio_rb32(pb); /* bits per channel if sound is uncompressed */
1117+ flags = avio_rb32(pb); /* lpcm format specific flag */
1118+ sc->bytes_per_frame = avio_rb32(pb); /* bytes per audio packet if constant */
1119+ sc->samples_per_frame = avio_rb32(pb); /* lpcm frames per audio packet if constant */
11201120 if (format == MKTAG('l','p','c','m'))
11211121 st->codec->codec_id = ff_mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, flags);
11221122 }
@@ -1249,9 +1249,9 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 126 unmodified lines
12491249 {
12501250 int entries;
12511251
1252− get_byte(pb); /* version */
1253− get_be24(pb); /* flags */
1254− entries = get_be32(pb);
1252+ avio_r8(pb); /* version */
1253+ avio_rb24(pb); /* flags */
1254+ entries = avio_rb32(pb);
12551255
12561256 return ff_mov_read_stsd_entries(c, pb, entries);
12571257 }
@@ -1267,10 +1267,10 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 9 unmodified lines
12671267 st = c->fc->streams[c->fc->nb_streams-1];
12681268 sc = st->priv_data;
12691269
1270− get_byte(pb); /* version */
1271− get_be24(pb); /* flags */
1270+ avio_r8(pb); /* version */
1271+ avio_rb24(pb); /* flags */
12721272
1273− entries = get_be32(pb);
1273+ entries = avio_rb32(pb);
12741274
12751275 av_dlog(c->fc, "track[%i].stsc.entries = %i\n", c->fc->nb_streams-1, entries);
12761276
@@ -1282,9 +1282,9 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 5 unmodified lines
12821282 sc->stsc_count = entries;
12831283
12841284 for(i=0; i<entries; i++) {
1285− sc->stsc_data[i].first = get_be32(pb);
1286− sc->stsc_data[i].count = get_be32(pb);
1287− sc->stsc_data[i].id = get_be32(pb);
1285+ sc->stsc_data[i].first = avio_rb32(pb);
1286+ sc->stsc_data[i].count = avio_rb32(pb);
1287+ sc->stsc_data[i].id = avio_rb32(pb);
12881288 }
12891289 return 0;
12901290 }
@@ -1300,9 +1300,9 @@ static int mov_read_stps(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 9 unmodified lines
13001300 st = c->fc->streams[c->fc->nb_streams-1];
13011301 sc = st->priv_data;
13021302
1303− get_be32(pb); // version + flags
1303+ avio_rb32(pb); // version + flags
13041304
1305− entries = get_be32(pb);
1305+ entries = avio_rb32(pb);
13061306 if (entries >= UINT_MAX / sizeof(*sc->stps_data))
13071307 return -1;
13081308 sc->stps_data = av_malloc(entries * sizeof(*sc->stps_data));
@@ -1311,7 +1311,7 @@ static int mov_read_stps(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 2 unmodified lines
13111311 sc->stps_count = entries;
13121312
13131313 for (i = 0; i < entries; i++) {
1314− sc->stps_data[i] = get_be32(pb);
1314+ sc->stps_data[i] = avio_rb32(pb);
13151315 //av_dlog(c->fc, "stps %d\n", sc->stps_data[i]);
13161316 }
13171317
@@ -1329,10 +1329,10 @@ static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 11 unmodified lines
13291329 st = c->fc->streams[c->fc->nb_streams-1];
13301330 sc = st->priv_data;
13311331
1332− get_byte(pb); /* version */
1333− get_be24(pb); /* flags */
1332+ avio_r8(pb); /* version */
1333+ avio_rb24(pb); /* flags */
13341334
1335− entries = get_be32(pb);
1335+ entries = avio_rb32(pb);
13361336
13371337 av_dlog(c->fc, "keyframe_count = %d\n", entries);
13381338
@@ -1344,7 +1344,7 @@ static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 5 unmodified lines
13441344 sc->keyframe_count = entries;
13451345
13461346 for(i=0; i<entries; i++) {
1347− sc->keyframes[i] = get_be32(pb);
1347+ sc->keyframes[i] = avio_rb32(pb);
13481348 //av_dlog(c->fc, "keyframes[]=%d\n", sc->keyframes[i]);
13491349 }
13501350 return 0;
@@ -1363,20 +1363,20 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 12 unmodified lines
13631363 st = c->fc->streams[c->fc->nb_streams-1];
13641364 sc = st->priv_data;
13651365
1366− get_byte(pb); /* version */
1367− get_be24(pb); /* flags */
1366+ avio_r8(pb); /* version */
1367+ avio_rb24(pb); /* flags */
13681368
13691369 if (atom.type == MKTAG('s','t','s','z')) {
1370− sample_size = get_be32(pb);
1370+ sample_size = avio_rb32(pb);
13711371 if (!sc->sample_size) /* do not overwrite value computed in stsd */
13721372 sc->sample_size = sample_size;
13731373 field_size = 32;
13741374 } else {
13751375 sample_size = 0;
1376− get_be24(pb); /* reserved */
1377− field_size = get_byte(pb);
1376+ avio_rb24(pb); /* reserved */
1377+ field_size = avio_r8(pb);
13781378 }
1379− entries = get_be32(pb);
1379+ entries = avio_rb32(pb);
13801380
13811381 av_dlog(c->fc, "sample_size = %d sample_count = %d\n", sc->sample_size, entries);
13821382
@@ -1403,7 +1403,7 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 20 unmodified lines
14031403 return AVERROR(ENOMEM);
14041404 }
14051405
1406− if (get_buffer(pb, buf, num_bytes) < num_bytes) {
1406+ if (avio_read(pb, buf, num_bytes) < num_bytes) {
14071407 av_freep(&sc->sample_sizes);
14081408 av_free(buf);
14091409 return -1;
@@ -1431,9 +1431,9 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 21 unmodified lines
14311431 st = c->fc->streams[c->fc->nb_streams-1];
14321432 sc = st->priv_data;
14331433
1434− get_byte(pb); /* version */
1435− get_be24(pb); /* flags */
1436− entries = get_be32(pb);
1434+ avio_r8(pb); /* version */
1435+ avio_rb24(pb); /* flags */
1436+ entries = avio_rb32(pb);
14371437
14381438 av_dlog(c->fc, "track[%i].stts.entries = %i\n", c->fc->nb_streams-1, entries);
14391439
@@ -1448,8 +1448,8 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 8 unmodified lines
14481448 int sample_duration;
14491449 int sample_count;
14501450
1451− sample_count=get_be32(pb);
1452− sample_duration = get_be32(pb);
1451+ sample_count=avio_rb32(pb);
1452+ sample_duration = avio_rb32(pb);
14531453 sc->stts_data[i].count= sample_count;
14541454 sc->stts_data[i].duration= sample_duration;
14551455
@@ -1476,9 +1476,9 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 20 unmodified lines
14761476 st = c->fc->streams[c->fc->nb_streams-1];
14771477 sc = st->priv_data;
14781478
1479− get_byte(pb); /* version */
1480− get_be24(pb); /* flags */
1481− entries = get_be32(pb);
1479+ avio_r8(pb); /* version */
1480+ avio_rb24(pb); /* flags */
1481+ entries = avio_rb32(pb);
14821482
14831483 av_dlog(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries);
14841484
@@ -1490,8 +1490,8 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 5 unmodified lines
14901490 sc->ctts_count = entries;
14911491
14921492 for(i=0; i<entries; i++) {
1493− int count =get_be32(pb);
1494− int duration =get_be32(pb);
1493+ int count =avio_rb32(pb);
1494+ int duration =avio_rb32(pb);
14951495
14961496 sc->ctts_data[i].count = count;
14971497 sc->ctts_data[i].duration= duration;
@@ -1837,7 +1837,7 @@ static int mov_read_ilst(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 339 unmodified lines
18371837 static int mov_read_meta(MOVContext *c, AVIOContext *pb, MOVAtom atom)
18381838 {
18391839 while (atom.size > 8) {
1840− uint32_t tag = get_le32(pb);
1840+ uint32_t tag = avio_rl32(pb);
18411841 atom.size -= 4;
18421842 if (tag == MKTAG('h','d','l','r')) {
18431843 url_fseek(pb, -8, SEEK_CUR);
@@ -1864,8 +1864,8 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 20 unmodified lines
18641864 st = c->fc->streams[c->fc->nb_streams-1];
18651865 sc = st->priv_data;
18661866
1867− version = get_byte(pb);
1868− get_be24(pb); /* flags */
1867+ version = avio_r8(pb);
1868+ avio_rb24(pb); /* flags */
18691869 /*
18701870 MOV_TRACK_ENABLED 0x0001
18711871 MOV_TRACK_IN_MOVIE 0x0002
@@ -1874,36 +1874,36 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 2 unmodified lines
18741874 */
18751875
18761876 if (version == 1) {
1877− get_be64(pb);
1878− get_be64(pb);
1877+ avio_rb64(pb);
1878+ avio_rb64(pb);
18791879 } else {
1880− get_be32(pb); /* creation time */
1881− get_be32(pb); /* modification time */
1880+ avio_rb32(pb); /* creation time */
1881+ avio_rb32(pb); /* modification time */
18821882 }
1883− st->id = (int)get_be32(pb); /* track id (NOT 0 !)*/
1884− get_be32(pb); /* reserved */
1883+ st->id = (int)avio_rb32(pb); /* track id (NOT 0 !)*/
1884+ avio_rb32(pb); /* reserved */
18851885
18861886 /* highlevel (considering edits) duration in movie timebase */
1887− (version == 1) ? get_be64(pb) : get_be32(pb);
1888− get_be32(pb); /* reserved */
1889− get_be32(pb); /* reserved */
1887+ (version == 1) ? avio_rb64(pb) : avio_rb32(pb);
1888+ avio_rb32(pb); /* reserved */
1889+ avio_rb32(pb); /* reserved */
18901890
1891− get_be16(pb); /* layer */
1892− get_be16(pb); /* alternate group */
1893− get_be16(pb); /* volume */
1894− get_be16(pb); /* reserved */
1891+ avio_rb16(pb); /* layer */
1892+ avio_rb16(pb); /* alternate group */
1893+ avio_rb16(pb); /* volume */
1894+ avio_rb16(pb); /* reserved */
18951895
18961896 //read in the display matrix (outlined in ISO 14496-12, Section 6.2.2)
18971897 // they're kept in fixed point format through all calculations
18981898 // ignore u,v,z b/c we don't need the scale factor to calc aspect ratio
18991899 for (i = 0; i < 3; i++) {
1900− display_matrix[i][0] = get_be32(pb); // 16.16 fixed point
1901− display_matrix[i][1] = get_be32(pb); // 16.16 fixed point
1902− get_be32(pb); // 2.30 fixed point (not used)
1900+ display_matrix[i][0] = avio_rb32(pb); // 16.16 fixed point
1901+ display_matrix[i][1] = avio_rb32(pb); // 16.16 fixed point
1902+ avio_rb32(pb); // 2.30 fixed point (not used)
19031903 }
19041904
1905− width = get_be32(pb); // 16.16 fixed point track width
1906− height = get_be32(pb); // 16.16 fixed point track height
1905+ width = avio_rb32(pb); // 16.16 fixed point track width
1906+ height = avio_rb32(pb); // 16.16 fixed point track height
19071907 sc->width = width >> 16;
19081908 sc->height = height >> 16;
19091909
@@ -1937,10 +1937,10 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 27 unmodified lines
19371937 MOVTrackExt *trex = NULL;
19381938 int flags, track_id, i;
19391939
1940− get_byte(pb); /* version */
1941− flags = get_be24(pb);
1940+ avio_r8(pb); /* version */
1941+ flags = avio_rb24(pb);
19421942
1943− track_id = get_be32(pb);
1943+ track_id = avio_rb32(pb);
19441944 if (!track_id)
19451945 return -1;
19461946 frag->track_id = track_id;
@@ -1954,21 +1954,21 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 7 unmodified lines
19541954 return -1;
19551955 }
19561956
1957− if (flags & 0x01) frag->base_data_offset = get_be64(pb);
1957+ if (flags & 0x01) frag->base_data_offset = avio_rb64(pb);
19581958 else frag->base_data_offset = frag->moof_offset;
1959− if (flags & 0x02) frag->stsd_id = get_be32(pb);
1959+ if (flags & 0x02) frag->stsd_id = avio_rb32(pb);
19601960 else frag->stsd_id = trex->stsd_id;
19611961
1962− frag->duration = flags & 0x08 ? get_be32(pb) : trex->duration;
1963− frag->size = flags & 0x10 ? get_be32(pb) : trex->size;
1964− frag->flags = flags & 0x20 ? get_be32(pb) : trex->flags;
1962+ frag->duration = flags & 0x08 ? avio_rb32(pb) : trex->duration;
1963+ frag->size = flags & 0x10 ? avio_rb32(pb) : trex->size;
1964+ frag->flags = flags & 0x20 ? avio_rb32(pb) : trex->flags;
19651965 av_dlog(c->fc, "frag flags 0x%x\n", frag->flags);
19661966 return 0;
19671967 }
19681968
19691969 static int mov_read_chap(MOVContext *c, AVIOContext *pb, MOVAtom atom)
19701970 {
1971− c->chapter_track = get_be32(pb);
1971+ c->chapter_track = avio_rb32(pb);
19721972 return 0;
19731973 }
19741974
@@ -1983,13 +1983,13 @@ static int mov_read_trex(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 8 unmodified lines
19831983 return AVERROR(ENOMEM);
19841984 c->trex_data = trex;
19851985 trex = &c->trex_data[c->trex_count++];
1986− get_byte(pb); /* version */
1987− get_be24(pb); /* flags */
1988− trex->track_id = get_be32(pb);
1989− trex->stsd_id = get_be32(pb);
1990− trex->duration = get_be32(pb);
1991− trex->size = get_be32(pb);
1992− trex->flags = get_be32(pb);
1986+ avio_r8(pb); /* version */
1987+ avio_rb24(pb); /* flags */
1988+ trex->track_id = avio_rb32(pb);
1989+ trex->stsd_id = avio_rb32(pb);
1990+ trex->duration = avio_rb32(pb);
1991+ trex->size = avio_rb32(pb);
1992+ trex->flags = avio_rb32(pb);
19931993 return 0;
19941994 }
19951995
@@ -2017,12 +2017,12 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 21 unmodified lines
20172017 sc = st->priv_data;
20182018 if (sc->pseudo_stream_id+1 != frag->stsd_id)
20192019 return 0;
2020− get_byte(pb); /* version */
2021− flags = get_be24(pb);
2022− entries = get_be32(pb);
2020+ avio_r8(pb); /* version */
2021+ flags = avio_rb24(pb);
2022+ entries = avio_rb32(pb);
20232023 av_dlog(c->fc, "flags 0x%x entries %d\n", flags, entries);
2024− if (flags & 0x001) data_offset = get_be32(pb);
2025− if (flags & 0x004) first_sample_flags = get_be32(pb);
2024+ if (flags & 0x001) data_offset = avio_rb32(pb);
2025+ if (flags & 0x004) first_sample_flags = avio_rb32(pb);
20262026 if (flags & 0x800) {
20272027 MOVStts *ctts_data;
20282028 if ((uint64_t)entries+sc->ctts_count >= UINT_MAX/sizeof(*sc->ctts_data))
@@ -2043,12 +2043,12 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 14 unmodified lines
20432043 unsigned sample_duration = frag->duration;
20442044 int keyframe;
20452045
2046− if (flags & 0x100) sample_duration = get_be32(pb);
2047− if (flags & 0x200) sample_size = get_be32(pb);
2048− if (flags & 0x400) sample_flags = get_be32(pb);
2046+ if (flags & 0x100) sample_duration = avio_rb32(pb);
2047+ if (flags & 0x200) sample_size = avio_rb32(pb);
2048+ if (flags & 0x400) sample_flags = avio_rb32(pb);
20492049 if (flags & 0x800) {
20502050 sc->ctts_data[sc->ctts_count].count = 1;
2051− sc->ctts_data[sc->ctts_count].duration = get_be32(pb);
2051+ sc->ctts_data[sc->ctts_count].duration = avio_rb32(pb);
20522052 sc->ctts_count++;
20532053 }
20542054 if ((keyframe = st->codec->codec_type == AVMEDIA_TYPE_AUDIO ||
@@ -2077,11 +2077,11 @@ static int mov_read_wide(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 22 unmodified lines
20772077
20782078 if (atom.size < 8)
20792079 return 0; /* continue */
2080− if (get_be32(pb) != 0) { /* 0 sized mdat atom... use the 'wide' atom size */
2080+ if (avio_rb32(pb) != 0) { /* 0 sized mdat atom... use the 'wide' atom size */
20812081 url_fskip(pb, atom.size - 4);
20822082 return 0;
20832083 }
2084− atom.type = get_le32(pb);
2084+ atom.type = avio_rl32(pb);
20852085 atom.size -= 8;
20862086 if (atom.type != MKTAG('m','d','a','t')) {
20872087 url_fskip(pb, atom.size);
@@ -2100,17 +2100,17 @@ static int mov_read_cmov(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 12 unmodified lines
21002100 long cmov_len, moov_len;
21012101 int ret = -1;
21022102
2103− get_be32(pb); /* dcom atom */
2104− if (get_le32(pb) != MKTAG('d','c','o','m'))
2103+ avio_rb32(pb); /* dcom atom */
2104+ if (avio_rl32(pb) != MKTAG('d','c','o','m'))
21052105 return -1;
2106− if (get_le32(pb) != MKTAG('z','l','i','b')) {
2106+ if (avio_rl32(pb) != MKTAG('z','l','i','b')) {
21072107 av_log(c->fc, AV_LOG_ERROR, "unknown compression for cmov atom !");
21082108 return -1;
21092109 }
2110− get_be32(pb); /* cmvd atom */
2111− if (get_le32(pb) != MKTAG('c','m','v','d'))
2110+ avio_rb32(pb); /* cmvd atom */
2111+ if (avio_rl32(pb) != MKTAG('c','m','v','d'))
21122112 return -1;
2113− moov_len = get_be32(pb); /* uncompressed size */
2113+ moov_len = avio_rb32(pb); /* uncompressed size */
21142114 cmov_len = atom.size - 6 * 4;
21152115
21162116 cmov_data = av_malloc(cmov_len);
@@ -2121,7 +2121,7 @@ static int mov_read_cmov(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 4 unmodified lines
21212121 av_free(cmov_data);
21222122 return AVERROR(ENOMEM);
21232123 }
2124− get_buffer(pb, cmov_data, cmov_len);
2124+ avio_read(pb, cmov_data, cmov_len);
21252125 if(uncompress (moov_data, (uLongf *) &moov_len, (const Bytef *)cmov_data, cmov_len) != Z_OK)
21262126 goto free_and_return;
21272127 if(ffio_init_context(&ctx, moov_data, moov_len, 0, NULL, NULL, NULL, NULL) != 0)
@@ -2152,18 +2152,18 @@ static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 24 unmodified lines
21522152 return 0;
21532153 sc = c->fc->streams[c->fc->nb_streams-1]->priv_data;
21542154
2155− get_byte(pb); /* version */
2156− get_be24(pb); /* flags */
2157− edit_count = get_be32(pb); /* entries */
2155+ avio_r8(pb); /* version */
2156+ avio_rb24(pb); /* flags */
2157+ edit_count = avio_rb32(pb); /* entries */
21582158
21592159 if((uint64_t)edit_count*12+8 > atom.size)
21602160 return -1;
21612161
21622162 for(i=0; i<edit_count; i++){
21632163 int time;
2164− int duration = get_be32(pb); /* Track duration */
2165− time = get_be32(pb); /* Media time */
2166− get_be32(pb); /* Media rate */
2164+ int duration = avio_rb32(pb); /* Track duration */
2165+ time = avio_rb32(pb); /* Media time */
2166+ avio_rb32(pb); /* Media rate */
21672167 if (i == 0 && time >= -1) {
21682168 sc->time_offset = time != -1 ? time : -duration;
21692169 }
@@ -2314,7 +2314,7 @@ static void mov_read_chapters(AVFormatContext *s) · 144 unmodified lines
23142314 }
23152315
23162316 // the first two bytes are the length of the title
2317− len = get_be16(sc->pb);
2317+ len = avio_rb16(sc->pb);
23182318 if (len > sample->size-2)
23192319 continue;
23202320 title_len = 2*len + 1;
@@ -2324,7 +2324,7 @@ static void mov_read_chapters(AVFormatContext *s) · 3 unmodified lines
23242324 // The samples could theoretically be in any encoding if there's an encd
23252325 // atom following, but in practice are only utf-8 or utf-16, distinguished
23262326 // instead by the presence of a BOM
2327− ch = get_be16(sc->pb);
2327+ ch = avio_rb16(sc->pb);
23282328 if (ch == 0xfeff)
23292329 avio_get_str16be(sc->pb, len, title, title_len);
23302330 else if (ch == 0xfffe)
libavformat/mp3dec.c+9−9
@@ -80,7 +80,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) · 79 unmodified lines
8080 MPADecodeHeader c;
8181 int vbrtag_size = 0;
8282
83− v = get_be32(s->pb);
83+ v = avio_rb32(s->pb);
8484 if(ff_mpa_check_header(v) < 0)
8585 return -1;
8686
@@ -91,25 +91,25 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) · 4 unmodified lines
9191
9292 /* Check for Xing / Info tag */
9393 url_fseek(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR);
94− v = get_be32(s->pb);
94+ v = avio_rb32(s->pb);
9595 if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) {
96− v = get_be32(s->pb);
96+ v = avio_rb32(s->pb);
9797 if(v & 0x1)
98− frames = get_be32(s->pb);
98+ frames = avio_rb32(s->pb);
9999 if(v & 0x2)
100− size = get_be32(s->pb);
100+ size = avio_rb32(s->pb);
101101 }
102102
103103 /* Check for VBRI tag (always 32 bytes after end of mpegaudio header) */
104104 url_fseek(s->pb, base + 4 + 32, SEEK_SET);
105− v = get_be32(s->pb);
105+ v = avio_rb32(s->pb);
106106 if(v == MKBETAG('V', 'B', 'R', 'I')) {
107107 /* Check tag version */
108− if(get_be16(s->pb) == 1) {
108+ if(avio_rb16(s->pb) == 1) {
109109 /* skip delay and quality */
110110 url_fseek(s->pb, 4, SEEK_CUR);
111− frames = get_be32(s->pb);
112− size = get_be32(s->pb);
111+ frames = avio_rb32(s->pb);
112+ size = avio_rb32(s->pb);
113113 }
114114 }
115115
libavformat/mpc.c+7−7
@@ -55,16 +55,16 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) · 54 unmodified lines
5555 MPCContext *c = s->priv_data;
5656 AVStream *st;
5757
58− if(get_le24(s->pb) != MKTAG('M', 'P', '+', 0)){
58+ if(avio_rl24(s->pb) != MKTAG('M', 'P', '+', 0)){
5959 av_log(s, AV_LOG_ERROR, "Not a Musepack file\n");
6060 return -1;
6161 }
62− c->ver = get_byte(s->pb);
62+ c->ver = avio_r8(s->pb);
6363 if(c->ver != 0x07 && c->ver != 0x17){
6464 av_log(s, AV_LOG_ERROR, "Can demux Musepack SV7, got version %02X\n", c->ver);
6565 return -1;
6666 }
67− c->fcount = get_le32(s->pb);
67+ c->fcount = avio_rl32(s->pb);
6868 if((int64_t)c->fcount * sizeof(MPCFrame) >= UINT_MAX){
6969 av_log(s, AV_LOG_ERROR, "Too many frames, seeking is not possible\n");
7070 return -1;
@@ -85,7 +85,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) · 14 unmodified lines
8585
8686 st->codec->extradata_size = 16;
8787 st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
88− get_buffer(s->pb, st->codec->extradata, 16);
88+ avio_read(s->pb, st->codec->extradata, 16);
8989 st->codec->sample_rate = mpc_rate[st->codec->extradata[2] & 3];
9090 av_set_pts_info(st, 32, MPC_FRAMESIZE, st->codec->sample_rate);
9191 /* scan for seekpoints */
@@ -121,11 +121,11 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) · 29 unmodified lines
121121 c->curframe++;
122122 curbits = c->curbits;
123123 pos = url_ftell(s->pb);
124− tmp = get_le32(s->pb);
124+ tmp = avio_rl32(s->pb);
125125 if(curbits <= 12){
126126 size2 = (tmp >> (12 - curbits)) & 0xFFFFF;
127127 }else{
128− tmp = (tmp << 32) | get_le32(s->pb);
128+ tmp = (tmp << 32) | avio_rl32(s->pb);
129129 size2 = (tmp >> (44 - curbits)) & 0xFFFFF;
130130 }
131131 curbits += 20;
@@ -151,7 +151,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) · 19 unmodified lines
151151
152152 pkt->stream_index = 0;
153153 pkt->pts = cur;
154− ret = get_buffer(s->pb, pkt->data + 4, size);
154+ ret = avio_read(s->pb, pkt->data + 4, size);
155155 if(c->curbits)
156156 url_fseek(s->pb, -4, SEEK_CUR);
157157 if(ret < size){
libavformat/mpc8.c+5−5
@@ -121,7 +121,7 @@ static void mpc8_get_chunk_header(AVIOContext *pb, int *tag, int64_t *size) · 120 unmodified lines
121121 {
122122 int64_t pos;
123123 pos = url_ftell(pb);
124− *tag = get_le16(pb);
124+ *tag = avio_rl16(pb);
125125 *size = ff_get_v(pb);
126126 *size -= url_ftell(pb) - pos;
127127 }
@@ -143,7 +143,7 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off) · 15 unmodified lines
143143 }
144144 if(!(buf = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE)))
145145 return;
146− get_buffer(s->pb, buf, size);
146+ avio_read(s->pb, buf, size);
147147 init_get_bits(&gb, buf, size * 8);
148148 size = gb_get_v(&gb);
149149 if(size > UINT_MAX/4 || size > c->samples/1152){
@@ -195,7 +195,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) · 45 unmodified lines
195195 int64_t size, pos;
196196
197197 c->header_pos = url_ftell(pb);
198− if(get_le32(pb) != TAG_MPCK){
198+ if(avio_rl32(pb) != TAG_MPCK){
199199 av_log(s, AV_LOG_ERROR, "Not a Musepack8 file\n");
200200 return -1;
201201 }
@@ -213,7 +213,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) · 11 unmodified lines
213213 }
214214 pos = url_ftell(pb);
215215 url_fskip(pb, 4); //CRC
216− c->ver = get_byte(pb);
216+ c->ver = avio_r8(pb);
217217 if(c->ver != 8){
218218 av_log(s, AV_LOG_ERROR, "Unknown stream version %d\n", c->ver);
219219 return -1;
@@ -230,7 +230,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) · 10 unmodified lines
230230
231231 st->codec->extradata_size = 2;
232232 st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
233− get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
233+ avio_read(pb, st->codec->extradata, st->codec->extradata_size);
234234
235235 st->codec->channels = (st->codec->extradata[1] >> 4) + 1;
236236 st->codec->sample_rate = mpc8_rate[st->codec->extradata[0] >> 5];
libavformat/mpeg.c+39−39
@@ -113,7 +113,7 @@ static int mpegps_read_header(AVFormatContext *s, · 112 unmodified lines
113113
114114 m->sofdec = -1;
115115 do {
116− v = get_byte(s->pb);
116+ v = avio_r8(s->pb);
117117 m->header_state = m->header_state << 8 | v;
118118 m->sofdec++;
119119 } while (v == sofdec[i] && i++ < 6);
@@ -128,8 +128,8 @@ static int64_t get_pts(AVIOContext *pb, int c) · 8 unmodified lines
128128 {
129129 uint8_t buf[5];
130130
131− buf[0] = c<0 ? get_byte(pb) : c;
132− get_buffer(pb, buf+1, 4);
131+ buf[0] = c<0 ? avio_r8(pb) : c;
132+ avio_read(pb, buf+1, 4);
133133
134134 return ff_parse_pes_pts(buf);
135135 }
@@ -145,7 +145,7 @@ static int find_next_start_code(AVIOContext *pb, int *size_ptr, · 9 unmodified lines
145145 while (n > 0) {
146146 if (url_feof(pb))
147147 break;
148− v = get_byte(pb);
148+ v = avio_r8(pb);
149149 n--;
150150 if (state == 0x000001) {
151151 state = ((state << 8) | v) & 0xffffff;
@@ -176,7 +176,7 @@ static int find_prev_start_code(AVIOContext *pb, int *size_ptr) · 24 unmodified lines
176176 if (pos < 0)
177177 pos = 0;
178178 url_fseek(pb, pos, SEEK_SET);
179− get_byte(pb);
179+ avio_r8(pb);
180180
181181 pos = pos_start;
182182 for(;;) {
@@ -186,7 +186,7 @@ static int find_prev_start_code(AVIOContext *pb, int *size_ptr) · 3 unmodified lines
186186 goto the_end;
187187 }
188188 url_fseek(pb, pos, SEEK_SET);
189− start_code = get_be32(pb);
189+ start_code = avio_rb32(pb);
190190 if ((start_code & 0xffffff00) == 0x100)
191191 break;
192192 }
@@ -206,27 +206,27 @@ static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *pb) · 13 unmodified lines
206206 {
207207 int psm_length, ps_info_length, es_map_length;
208208
209− psm_length = get_be16(pb);
210− get_byte(pb);
211− get_byte(pb);
212− ps_info_length = get_be16(pb);
209+ psm_length = avio_rb16(pb);
210+ avio_r8(pb);
211+ avio_r8(pb);
212+ ps_info_length = avio_rb16(pb);
213213
214214 /* skip program_stream_info */
215215 url_fskip(pb, ps_info_length);
216− es_map_length = get_be16(pb);
216+ es_map_length = avio_rb16(pb);
217217
218218 /* at least one es available? */
219219 while (es_map_length >= 4){
220− unsigned char type = get_byte(pb);
221− unsigned char es_id = get_byte(pb);
222− uint16_t es_info_length = get_be16(pb);
220+ unsigned char type = avio_r8(pb);
221+ unsigned char es_id = avio_r8(pb);
222+ uint16_t es_info_length = avio_rb16(pb);
223223 /* remember mapping from stream id to stream type */
224224 m->psm_es_type[es_id] = type;
225225 /* skip program_stream_info */
226226 url_fskip(pb, es_info_length);
227227 es_map_length -= 4 + es_info_length;
228228 }
229− get_be32(pb); /* crc32 */
229+ avio_rb32(pb); /* crc32 */
230230 return 2 + psm_length;
231231 }
232232
@@ -264,16 +264,16 @@ static int mpegps_read_pes_header(AVFormatContext *s, · 31 unmodified lines
264264 if (startcode == SYSTEM_HEADER_START_CODE)
265265 goto redo;
266266 if (startcode == PADDING_STREAM) {
267− url_fskip(s->pb, get_be16(s->pb));
267+ url_fskip(s->pb, avio_rb16(s->pb));
268268 goto redo;
269269 }
270270 if (startcode == PRIVATE_STREAM_2) {
271− len = get_be16(s->pb);
271+ len = avio_rb16(s->pb);
272272 if (!m->sofdec) {
273273 while (len-- >= 6) {
274− if (get_byte(s->pb) == 'S') {
274+ if (avio_r8(s->pb) == 'S') {
275275 uint8_t buf[5];
276− get_buffer(s->pb, buf, sizeof(buf));
276+ avio_read(s->pb, buf, sizeof(buf));
277277 m->sofdec = !memcmp(buf, "ofdec", 5);
278278 len -= sizeof(buf);
279279 break;
@@ -297,14 +297,14 @@ static int mpegps_read_pes_header(AVFormatContext *s, · 17 unmodified lines
297297 if (ppos) {
298298 *ppos = url_ftell(s->pb) - 4;
299299 }
300− len = get_be16(s->pb);
300+ len = avio_rb16(s->pb);
301301 pts =
302302 dts = AV_NOPTS_VALUE;
303303 /* stuffing */
304304 for(;;) {
305305 if (len < 1)
306306 goto error_redo;
307− c = get_byte(s->pb);
307+ c = avio_r8(s->pb);
308308 len--;
309309 /* XXX: for mpeg1, should test only bit 7 */
310310 if (c != 0xff)
@@ -312,8 +312,8 @@ static int mpegps_read_pes_header(AVFormatContext *s, · 1 unmodified line
312312 }
313313 if ((c & 0xc0) == 0x40) {
314314 /* buffer scale & size */
315− get_byte(s->pb);
316− c = get_byte(s->pb);
315+ avio_r8(s->pb);
316+ c = avio_r8(s->pb);
317317 len -= 2;
318318 }
319319 if ((c & 0xe0) == 0x20) {
@@ -331,8 +331,8 @@ static int mpegps_read_pes_header(AVFormatContext *s, · 11 unmodified lines
331331 goto redo;
332332 }
333333 #endif
334− flags = get_byte(s->pb);
335− header_len = get_byte(s->pb);
334+ flags = avio_r8(s->pb);
335+ header_len = avio_r8(s->pb);
336336 len -= 2;
337337 if (header_len > len)
338338 goto error_redo;
@@ -350,7 +350,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, · 11 unmodified lines
350350 av_log(s, AV_LOG_WARNING, "Further flags set but no bytes left\n");
351351 }
352352 if (flags & 0x01) { /* PES extension */
353− pes_ext = get_byte(s->pb);
353+ pes_ext = avio_r8(s->pb);
354354 header_len--;
355355 /* Skip PES private data, program packet sequence counter and P-STD buffer */
356356 skip = (pes_ext >> 4) & 0xb;
@@ -363,10 +363,10 @@ static int mpegps_read_pes_header(AVFormatContext *s, · 6 unmodified lines
363363 header_len -= skip;
364364
365365 if (pes_ext & 0x01) { /* PES extension 2 */
366− ext2_len = get_byte(s->pb);
366+ ext2_len = avio_r8(s->pb);
367367 header_len--;
368368 if ((ext2_len & 0x7f) > 0) {
369− id_ext = get_byte(s->pb);
369+ id_ext = avio_r8(s->pb);
370370 if ((id_ext & 0x80) == 0)
371371 startcode = ((startcode & 0xff) << 8) | id_ext;
372372 header_len--;
@@ -381,17 +381,17 @@ static int mpegps_read_pes_header(AVFormatContext *s, · 8 unmodified lines
381381 goto redo;
382382
383383 if (startcode == PRIVATE_STREAM_1 && !m->psm_es_type[startcode & 0xff]) {
384− startcode = get_byte(s->pb);
384+ startcode = avio_r8(s->pb);
385385 len--;
386386 if (startcode >= 0x80 && startcode <= 0xcf) {
387387 /* audio: skip header */
388− get_byte(s->pb);
389− get_byte(s->pb);
390− get_byte(s->pb);
388+ avio_r8(s->pb);
389+ avio_r8(s->pb);
390+ avio_r8(s->pb);
391391 len -= 3;
392392 if (startcode >= 0xb0 && startcode <= 0xbf) {
393393 /* MLP/TrueHD audio has a 4-byte header */
394− get_byte(s->pb);
394+ avio_r8(s->pb);
395395 len--;
396396 }
397397 }
@@ -432,7 +432,7 @@ static int mpegps_read_packet(AVFormatContext *s, · 34 unmodified lines
432432 return len;
433433
434434 if(startcode == 0x1bd) {
435− dvdaudio_substream_type = get_byte(s->pb);
435+ dvdaudio_substream_type = avio_r8(s->pb);
436436 url_fskip(s->pb, 3);
437437 len -= 4;
438438 }
@@ -474,7 +474,7 @@ static int mpegps_read_packet(AVFormatContext *s, · 35 unmodified lines
474474 } else if (startcode >= 0x1e0 && startcode <= 0x1ef) {
475475 static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 };
476476 unsigned char buf[8];
477− get_buffer(s->pb, buf, 8);
477+ avio_read(s->pb, buf, 8);
478478 url_fseek(s->pb, -8, SEEK_CUR);
479479 if(!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1))
480480 codec_id = CODEC_ID_CAVS;
@@ -547,9 +547,9 @@ static int mpegps_read_packet(AVFormatContext *s, · 66 unmodified lines
547547 audio data */
548548 if (len <= 3)
549549 goto skip;
550− get_byte(s->pb); /* emphasis (1), muse(1), reserved(1), frame number(5) */
551− b1 = get_byte(s->pb); /* quant (2), freq(2), reserved(1), channels(3) */
552− get_byte(s->pb); /* dynamic range control (0x80 = off) */
550+ avio_r8(s->pb); /* emphasis (1), muse(1), reserved(1), frame number(5) */
551+ b1 = avio_r8(s->pb); /* quant (2), freq(2), reserved(1), channels(3) */
552+ avio_r8(s->pb); /* dynamic range control (0x80 = off) */
553553 len -= 3;
554554 freq = (b1 >> 4) & 3;
555555 st->codec->sample_rate = lpcm_freq_tab[freq];
@@ -564,7 +564,7 @@ static int mpegps_read_packet(AVFormatContext *s, · 8 unmodified lines
564564 return AVERROR(EINVAL);
565565 }
566566 av_new_packet(pkt, len);
567− get_buffer(s->pb, pkt->data, pkt->size);
567+ avio_read(s->pb, pkt->data, pkt->size);
568568 pkt->pts = pts;
569569 pkt->dts = dts;
570570 pkt->pos = dummy_pos;
libavformat/mpegts.c+15−15
@@ -860,24 +860,24 @@ static int mp4_read_iods(AVFormatContext *s, const uint8_t *buf, unsigned size, · 859 unmodified lines
860860
861861 len = ff_mp4_read_descr(s, &pb, &tag);
862862 if (tag == MP4IODescrTag) {
863− get_be16(&pb); // ID
864− get_byte(&pb);
865− get_byte(&pb);
866− get_byte(&pb);
867− get_byte(&pb);
868− get_byte(&pb);
863+ avio_rb16(&pb); // ID
864+ avio_r8(&pb);
865+ avio_r8(&pb);
866+ avio_r8(&pb);
867+ avio_r8(&pb);
868+ avio_r8(&pb);
869869 len = ff_mp4_read_descr(s, &pb, &tag);
870870 if (tag == MP4ESDescrTag) {
871− *es_id = get_be16(&pb); /* ES_ID */
871+ *es_id = avio_rb16(&pb); /* ES_ID */
872872 av_dlog(s, "ES_ID %#x\n", *es_id);
873− get_byte(&pb); /* priority */
873+ avio_r8(&pb); /* priority */
874874 len = ff_mp4_read_descr(s, &pb, &tag);
875875 if (tag == MP4DecConfigDescrTag) {
876876 *dec_config_descr = av_malloc(len);
877877 if (!*dec_config_descr)
878878 return AVERROR(ENOMEM);
879879 *dec_config_descr_size = len;
880− get_buffer(&pb, *dec_config_descr, len);
880+ avio_read(&pb, *dec_config_descr, len);
881881 }
882882 }
883883 }
@@ -1332,7 +1332,7 @@ static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size) · 448 unmodified lines
13321332 int skip, len;
13331333
13341334 for(;;) {
1335− len = get_buffer(pb, buf, TS_PACKET_SIZE);
1335+ len = avio_read(pb, buf, TS_PACKET_SIZE);
13361336 if (len != TS_PACKET_SIZE)
13371337 return AVERROR(EIO);
13381338 /* check paquet sync byte */
@@ -1455,7 +1455,7 @@ static int mpegts_read_header(AVFormatContext *s, · 116 unmodified lines
14551455
14561456 /* read the first 1024 bytes to get packet size */
14571457 pos = url_ftell(pb);
1458− len = get_buffer(pb, buf, sizeof(buf));
1458+ len = avio_read(pb, buf, sizeof(buf));
14591459 if (len != sizeof(buf))
14601460 goto fail;
14611461 ts->raw_packet_size = get_packet_size(buf, sizeof(buf));
@@ -1565,7 +1565,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s, · 103 unmodified lines
15651565 pos = url_ftell(s->pb);
15661566 for(i = 0; i < MAX_PACKET_READAHEAD; i++) {
15671567 url_fseek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET);
1568− get_buffer(s->pb, pcr_buf, 12);
1568+ avio_read(s->pb, pcr_buf, 12);
15691569 if (parse_pcr(&next_pcr_h, &next_pcr_l, pcr_buf) == 0) {
15701570 /* XXX: not precise enough */
15711571 ts->pcr_incr = ((next_pcr_h - pcr_h) * 300 + (next_pcr_l - pcr_l)) /
@@ -1650,7 +1650,7 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, · 78 unmodified lines
16501650 if (find_next) {
16511651 for(;;) {
16521652 url_fseek(s->pb, pos, SEEK_SET);
1653− if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
1653+ if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
16541654 return AV_NOPTS_VALUE;
16551655 if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) &&
16561656 parse_pcr(&timestamp, &pcr_l, buf) == 0) {
@@ -1664,7 +1664,7 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, · 7 unmodified lines
16641664 if (pos < 0)
16651665 return AV_NOPTS_VALUE;
16661666 url_fseek(s->pb, pos, SEEK_SET);
1667− if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
1667+ if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
16681668 return AV_NOPTS_VALUE;
16691669 if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) &&
16701670 parse_pcr(&timestamp, &pcr_l, buf) == 0) {
@@ -1775,7 +1775,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, in · 104 unmodified lines
17751775
17761776 for(;;) {
17771777 url_fseek(s->pb, pos, SEEK_SET);
1778− if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
1778+ if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
17791779 return -1;
17801780 // pid = AV_RB16(buf + 1) & 0x1fff;
17811781 if(buf[1] & 0x40) break;
libavformat/msnwc_tcp.c+4−4
@@ -88,7 +88,7 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap) · 87 unmodified lines
8888
8989 /* Some files start with "connected\r\n\r\n".
9090 * So skip until we find the first byte of struct size */
91− while(get_byte(pb) != HEADER_SIZE && !url_feof(pb));
91+ while(avio_r8(pb) != HEADER_SIZE && !url_feof(pb));
9292
9393 if(url_feof(pb)) {
9494 av_log(ctx, AV_LOG_ERROR, "Could not find valid start.");
@@ -107,11 +107,11 @@ static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt) · 12 unmodified lines
107107 url_fskip(pb, 1); /* one byte has been read ahead */
108108 url_fskip(pb, 2);
109109 url_fskip(pb, 2);
110− keyframe = get_le16(pb);
111− size = get_le32(pb);
110+ keyframe = avio_rl16(pb);
111+ size = avio_rl32(pb);
112112 url_fskip(pb, 4);
113113 url_fskip(pb, 4);
114− timestamp = get_le32(pb);
114+ timestamp = avio_rl32(pb);
115115
116116 if(!size || av_get_packet(pb, pkt, size) != size)
117117 return -1;
libavformat/mtv.c+10−10
@@ -84,16 +84,16 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) · 83 unmodified lines
8484 unsigned int audio_subsegments;
8585
8686 url_fskip(pb, 3);
87− mtv->file_size = get_le32(pb);
88− mtv->segments = get_le32(pb);
87+ mtv->file_size = avio_rl32(pb);
88+ mtv->segments = avio_rl32(pb);
8989 url_fskip(pb, 32);
90− mtv->audio_identifier = get_le24(pb);
91− mtv->audio_br = get_le16(pb);
92− mtv->img_colorfmt = get_le24(pb);
93− mtv->img_bpp = get_byte(pb);
94− mtv->img_width = get_le16(pb);
95− mtv->img_height = get_le16(pb);
96− mtv->img_segment_size = get_le16(pb);
90+ mtv->audio_identifier = avio_rl24(pb);
91+ mtv->audio_br = avio_rl16(pb);
92+ mtv->img_colorfmt = avio_rl24(pb);
93+ mtv->img_bpp = avio_r8(pb);
94+ mtv->img_width = avio_rl16(pb);
95+ mtv->img_height = avio_rl16(pb);
96+ mtv->img_segment_size = avio_rl16(pb);
9797
9898 /* Calculate width and height if missing from header */
9999
@@ -106,7 +106,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) · 6 unmodified lines
106106 / mtv->img_width;
107107
108108 url_fskip(pb, 4);
109− audio_subsegments = get_le16(pb);
109+ audio_subsegments = avio_rl16(pb);
110110 mtv->full_segment_size =
111111 audio_subsegments * (MTV_AUDIO_PADDING_SIZE + MTV_ASUBCHUNK_DATA_SIZE) +
112112 mtv->img_segment_size;
libavformat/mvi.c+15−15
@@ -53,20 +53,20 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 52 unmodified lines
5353 vst->codec->extradata_size = 2;
5454 vst->codec->extradata = av_mallocz(2 + FF_INPUT_BUFFER_PADDING_SIZE);
5555
56− version = get_byte(pb);
57− vst->codec->extradata[0] = get_byte(pb);
58− vst->codec->extradata[1] = get_byte(pb);
59− frames_count = get_le32(pb);
60− msecs_per_frame = get_le32(pb);
61− vst->codec->width = get_le16(pb);
62− vst->codec->height = get_le16(pb);
63− get_byte(pb);
64− ast->codec->sample_rate = get_le16(pb);
65− mvi->audio_data_size = get_le32(pb);
66− get_byte(pb);
67− player_version = get_le32(pb);
68− get_le16(pb);
69− get_byte(pb);
56+ version = avio_r8(pb);
57+ vst->codec->extradata[0] = avio_r8(pb);
58+ vst->codec->extradata[1] = avio_r8(pb);
59+ frames_count = avio_rl32(pb);
60+ msecs_per_frame = avio_rl32(pb);
61+ vst->codec->width = avio_rl16(pb);
62+ vst->codec->height = avio_rl16(pb);
63+ avio_r8(pb);
64+ ast->codec->sample_rate = avio_rl16(pb);
65+ mvi->audio_data_size = avio_rl32(pb);
66+ avio_r8(pb);
67+ player_version = avio_rl32(pb);
68+ avio_rl16(pb);
69+ avio_r8(pb);
7070
7171 if (frames_count == 0 || mvi->audio_data_size == 0)
7272 return AVERROR_INVALIDDATA;
@@ -87,7 +87,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 14 unmodified lines
8787 vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
8888 vst->codec->codec_id = CODEC_ID_MOTIONPIXELS;
8989
90− mvi->get_int = (vst->codec->width * vst->codec->height < (1 << 16)) ? get_le16 : get_le24;
90+ mvi->get_int = (vst->codec->width * vst->codec->height < (1 << 16)) ? avio_rl16 : avio_rl24;
9191
9292 mvi->audio_frame_size = ((uint64_t)mvi->audio_data_size << MVI_FRAC_BITS) / frames_count;
9393 mvi->audio_size_counter = (ast->codec->sample_rate * 830 / mvi->audio_frame_size - 1) * mvi->audio_frame_size;
libavformat/mxfdec.c+61−61
@@ -163,7 +163,7 @@ static const uint8_t mxf_sony_mpeg4_extradata[] = { 0x06,0x0e,0x2b,0x · 162 unmodified lines
163163
164164 static int64_t klv_decode_ber_length(AVIOContext *pb)
165165 {
166− uint64_t size = get_byte(pb);
166+ uint64_t size = avio_r8(pb);
167167 if (size & 0x80) { /* long form */
168168 int bytes_num = size & 0x7f;
169169 /* SMPTE 379M 5.3.4 guarantee that bytes_num must not exceed 8 bytes */
@@ -171,7 +171,7 @@ static int64_t klv_decode_ber_length(AVIOContext *pb) · 1 unmodified line
171171 return -1;
172172 size = 0;
173173 while (bytes_num--)
174− size = size << 8 | get_byte(pb);
174+ size = size << 8 | avio_r8(pb);
175175 }
176176 return size;
177177 }
@@ -180,7 +180,7 @@ static int mxf_read_sync(AVIOContext *pb, const uint8_t *key, unsigned size) · 2 unmodified lines
180180 {
181181 int i, b;
182182 for (i = 0; i < size && !url_feof(pb); i++) {
183− b = get_byte(pb);
183+ b = avio_r8(pb);
184184 if (b == key[0])
185185 i = 0;
186186 else if (b != key[i])
@@ -195,7 +195,7 @@ static int klv_read_packet(KLVPacket *klv, AVIOContext *pb) · 8 unmodified lines
195195 return -1;
196196 klv->offset = url_ftell(pb) - 4;
197197 memcpy(klv->key, mxf_klv_key, 4);
198− get_buffer(pb, klv->key + 4, 12);
198+ avio_read(pb, klv->key + 4, 12);
199199 klv->length = klv_decode_ber_length(pb);
200200 return klv->length == -1 ? -1 : 0;
201201 }
@@ -224,7 +224,7 @@ static int mxf_get_d10_aes3_packet(AVIOContext *pb, AVStream *st, AVPacket *pkt, · 22 unmodified lines
224224 if (length > 61444) /* worst case PAL 1920 samples 8 channels */
225225 return -1;
226226 av_new_packet(pkt, length);
227− get_buffer(pb, pkt->data, length);
227+ avio_read(pb, pkt->data, length);
228228 data_ptr = pkt->data;
229229 end_ptr = pkt->data + length;
230230 buf_ptr = pkt->data + 4; /* skip SMPTE 331M header */
@@ -265,10 +265,10 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv · 34 unmodified lines
265265 url_fskip(pb, klv_decode_ber_length(pb));
266266 // plaintext offset
267267 klv_decode_ber_length(pb);
268− plaintext_size = get_be64(pb);
268+ plaintext_size = avio_rb64(pb);
269269 // source klv key
270270 klv_decode_ber_length(pb);
271− get_buffer(pb, klv->key, 16);
271+ avio_read(pb, klv->key, 16);
272272 if (!IS_KLV_KEY(klv, mxf_essence_element_key))
273273 return -1;
274274 index = mxf_get_stream_index(s, klv);
@@ -276,15 +276,15 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv · 1 unmodified line
276276 return -1;
277277 // source size
278278 klv_decode_ber_length(pb);
279− orig_size = get_be64(pb);
279+ orig_size = avio_rb64(pb);
280280 if (orig_size < plaintext_size)
281281 return -1;
282282 // enc. code
283283 size = klv_decode_ber_length(pb);
284284 if (size < 32 || size - 32 < orig_size)
285285 return -1;
286− get_buffer(pb, ivec, 16);
287− get_buffer(pb, tmpbuf, 16);
286+ avio_read(pb, ivec, 16);
287+ avio_read(pb, tmpbuf, 16);
288288 if (mxf->aesc)
289289 av_aes_crypt(mxf->aesc, tmpbuf, tmpbuf, 1, ivec, 1);
290290 if (memcmp(tmpbuf, checkv, 16))
@@ -347,8 +347,8 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt) · 56 unmodified lines
347347 static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid)
348348 {
349349 MXFContext *mxf = arg;
350− int item_num = get_be32(pb);
351− int item_len = get_be32(pb);
350+ int item_num = avio_rb32(pb);
351+ int item_len = avio_rb32(pb);
352352
353353 if (item_len != 18) {
354354 av_log(mxf->fc, AV_LOG_ERROR, "unsupported primer pack item length\n");
@@ -360,7 +360,7 @@ static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, U · 5 unmodified lines
360360 mxf->local_tags = av_malloc(item_num*item_len);
361361 if (!mxf->local_tags)
362362 return -1;
363− get_buffer(pb, mxf->local_tags, item_num*item_len);
363+ avio_read(pb, mxf->local_tags, item_num*item_len);
364364 return 0;
365365 }
366366
@@ -382,7 +382,7 @@ static int mxf_read_cryptographic_context(void *arg, AVIOContext *pb, int tag, i · 15 unmodified lines
382382 if (size != 16)
383383 return -1;
384384 if (IS_KLV_KEY(uid, mxf_crypto_source_container_ul))
385− get_buffer(pb, cryptocontext->source_container_ul, 16);
385+ avio_read(pb, cryptocontext->source_container_ul, 16);
386386 return 0;
387387 }
388388
@@ -391,14 +391,14 @@ static int mxf_read_content_storage(void *arg, AVIOContext *pb, int tag, int siz · 2 unmodified lines
391391 MXFContext *mxf = arg;
392392 switch (tag) {
393393 case 0x1901:
394− mxf->packages_count = get_be32(pb);
394+ mxf->packages_count = avio_rb32(pb);
395395 if (mxf->packages_count >= UINT_MAX / sizeof(UID))
396396 return -1;
397397 mxf->packages_refs = av_malloc(mxf->packages_count * sizeof(UID));
398398 if (!mxf->packages_refs)
399399 return -1;
400400 url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
401− get_buffer(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID));
401+ avio_read(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID));
402402 break;
403403 }
404404 return 0;
@@ -409,18 +409,18 @@ static int mxf_read_source_clip(void *arg, AVIOContext *pb, int tag, int size, U · 4 unmodified lines
409409 MXFStructuralComponent *source_clip = arg;
410410 switch(tag) {
411411 case 0x0202:
412− source_clip->duration = get_be64(pb);
412+ source_clip->duration = avio_rb64(pb);
413413 break;
414414 case 0x1201:
415− source_clip->start_position = get_be64(pb);
415+ source_clip->start_position = avio_rb64(pb);
416416 break;
417417 case 0x1101:
418418 /* UMID, only get last 16 bytes */
419419 url_fskip(pb, 16);
420− get_buffer(pb, source_clip->source_package_uid, 16);
420+ avio_read(pb, source_clip->source_package_uid, 16);
421421 break;
422422 case 0x1102:
423− source_clip->source_track_id = get_be32(pb);
423+ source_clip->source_track_id = avio_rb32(pb);
424424 break;
425425 }
426426 return 0;
@@ -431,14 +431,14 @@ static int mxf_read_material_package(void *arg, AVIOContext *pb, int tag, int si · 4 unmodified lines
431431 MXFPackage *package = arg;
432432 switch(tag) {
433433 case 0x4403:
434− package->tracks_count = get_be32(pb);
434+ package->tracks_count = avio_rb32(pb);
435435 if (package->tracks_count >= UINT_MAX / sizeof(UID))
436436 return -1;
437437 package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID));
438438 if (!package->tracks_refs)
439439 return -1;
440440 url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
441− get_buffer(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID));
441+ avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID));
442442 break;
443443 }
444444 return 0;
@@ -449,17 +449,17 @@ static int mxf_read_track(void *arg, AVIOContext *pb, int tag, int size, UID uid · 4 unmodified lines
449449 MXFTrack *track = arg;
450450 switch(tag) {
451451 case 0x4801:
452− track->track_id = get_be32(pb);
452+ track->track_id = avio_rb32(pb);
453453 break;
454454 case 0x4804:
455− get_buffer(pb, track->track_number, 4);
455+ avio_read(pb, track->track_number, 4);
456456 break;
457457 case 0x4B01:
458− track->edit_rate.den = get_be32(pb);
459− track->edit_rate.num = get_be32(pb);
458+ track->edit_rate.den = avio_rb32(pb);
459+ track->edit_rate.num = avio_rb32(pb);
460460 break;
461461 case 0x4803:
462− get_buffer(pb, track->sequence_ref, 16);
462+ avio_read(pb, track->sequence_ref, 16);
463463 break;
464464 }
465465 return 0;
@@ -470,20 +470,20 @@ static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID · 4 unmodified lines
470470 MXFSequence *sequence = arg;
471471 switch(tag) {
472472 case 0x0202:
473− sequence->duration = get_be64(pb);
473+ sequence->duration = avio_rb64(pb);
474474 break;
475475 case 0x0201:
476− get_buffer(pb, sequence->data_definition_ul, 16);
476+ avio_read(pb, sequence->data_definition_ul, 16);
477477 break;
478478 case 0x1001:
479− sequence->structural_components_count = get_be32(pb);
479+ sequence->structural_components_count = avio_rb32(pb);
480480 if (sequence->structural_components_count >= UINT_MAX / sizeof(UID))
481481 return -1;
482482 sequence->structural_components_refs = av_malloc(sequence->structural_components_count * sizeof(UID));
483483 if (!sequence->structural_components_refs)
484484 return -1;
485485 url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
486− get_buffer(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID));
486+ avio_read(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID));
487487 break;
488488 }
489489 return 0;
@@ -494,22 +494,22 @@ static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size · 4 unmodified lines
494494 MXFPackage *package = arg;
495495 switch(tag) {
496496 case 0x4403:
497− package->tracks_count = get_be32(pb);
497+ package->tracks_count = avio_rb32(pb);
498498 if (package->tracks_count >= UINT_MAX / sizeof(UID))
499499 return -1;
500500 package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID));
501501 if (!package->tracks_refs)
502502 return -1;
503503 url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
504− get_buffer(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID));
504+ avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID));
505505 break;
506506 case 0x4401:
507507 /* UMID, only get last 16 bytes */
508508 url_fskip(pb, 16);
509− get_buffer(pb, package->package_uid, 16);
509+ avio_read(pb, package->package_uid, 16);
510510 break;
511511 case 0x4701:
512− get_buffer(pb, package->descriptor_ref, 16);
512+ avio_read(pb, package->descriptor_ref, 16);
513513 break;
514514 }
515515 return 0;
@@ -518,12 +518,12 @@ static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size · 2 unmodified lines
518518 static int mxf_read_index_table_segment(void *arg, AVIOContext *pb, int tag, int size, UID uid)
519519 {
520520 switch(tag) {
521− case 0x3F05: av_dlog(NULL, "EditUnitByteCount %d\n", get_be32(pb)); break;
522− case 0x3F06: av_dlog(NULL, "IndexSID %d\n", get_be32(pb)); break;
523− case 0x3F07: av_dlog(NULL, "BodySID %d\n", get_be32(pb)); break;
524− case 0x3F0B: av_dlog(NULL, "IndexEditRate %d/%d\n", get_be32(pb), get_be32(pb)); break;
525− case 0x3F0C: av_dlog(NULL, "IndexStartPosition %lld\n", get_be64(pb)); break;
526− case 0x3F0D: av_dlog(NULL, "IndexDuration %lld\n", get_be64(pb)); break;
521+ case 0x3F05: av_dlog(NULL, "EditUnitByteCount %d\n", avio_rb32(pb)); break;
522+ case 0x3F06: av_dlog(NULL, "IndexSID %d\n", avio_rb32(pb)); break;
523+ case 0x3F07: av_dlog(NULL, "BodySID %d\n", avio_rb32(pb)); break;
524+ case 0x3F0B: av_dlog(NULL, "IndexEditRate %d/%d\n", avio_rb32(pb), avio_rb32(pb)); break;
525+ case 0x3F0C: av_dlog(NULL, "IndexStartPosition %lld\n", avio_rb64(pb)); break;
526+ case 0x3F0D: av_dlog(NULL, "IndexDuration %lld\n", avio_rb64(pb)); break;
527527 }
528528 return 0;
529529 }
@@ -534,8 +534,8 @@ static void mxf_read_pixel_layout(AVIOContext *pb, MXFDescriptor *descriptor) · 4 unmodified lines
534534 char layout[16] = {0};
535535
536536 do {
537− code = get_byte(pb);
538− value = get_byte(pb);
537+ code = avio_r8(pb);
538+ value = avio_r8(pb);
539539 av_dlog(NULL, "pixel layout: code %#x\n", code);
540540
541541 if (ofs < 16) {
@@ -552,46 +552,46 @@ static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int · 10 unmodified lines
552552 MXFDescriptor *descriptor = arg;
553553 switch(tag) {
554554 case 0x3F01:
555− descriptor->sub_descriptors_count = get_be32(pb);
555+ descriptor->sub_descriptors_count = avio_rb32(pb);
556556 if (descriptor->sub_descriptors_count >= UINT_MAX / sizeof(UID))
557557 return -1;
558558 descriptor->sub_descriptors_refs = av_malloc(descriptor->sub_descriptors_count * sizeof(UID));
559559 if (!descriptor->sub_descriptors_refs)
560560 return -1;
561561 url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */
562− get_buffer(pb, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID));
562+ avio_read(pb, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID));
563563 break;
564564 case 0x3004:
565− get_buffer(pb, descriptor->essence_container_ul, 16);
565+ avio_read(pb, descriptor->essence_container_ul, 16);
566566 break;
567567 case 0x3006:
568− descriptor->linked_track_id = get_be32(pb);
568+ descriptor->linked_track_id = avio_rb32(pb);
569569 break;
570570 case 0x3201: /* PictureEssenceCoding */
571− get_buffer(pb, descriptor->essence_codec_ul, 16);
571+ avio_read(pb, descriptor->essence_codec_ul, 16);
572572 break;
573573 case 0x3203:
574− descriptor->width = get_be32(pb);
574+ descriptor->width = avio_rb32(pb);
575575 break;
576576 case 0x3202:
577− descriptor->height = get_be32(pb);
577+ descriptor->height = avio_rb32(pb);
578578 break;
579579 case 0x320E:
580− descriptor->aspect_ratio.num = get_be32(pb);
581− descriptor->aspect_ratio.den = get_be32(pb);
580+ descriptor->aspect_ratio.num = avio_rb32(pb);
581+ descriptor->aspect_ratio.den = avio_rb32(pb);
582582 break;
583583 case 0x3D03:
584− descriptor->sample_rate.num = get_be32(pb);
585− descriptor->sample_rate.den = get_be32(pb);
584+ descriptor->sample_rate.num = avio_rb32(pb);
585+ descriptor->sample_rate.den = avio_rb32(pb);
586586 break;
587587 case 0x3D06: /* SoundEssenceCompression */
588− get_buffer(pb, descriptor->essence_codec_ul, 16);
588+ avio_read(pb, descriptor->essence_codec_ul, 16);
589589 break;
590590 case 0x3D07:
591− descriptor->channels = get_be32(pb);
591+ descriptor->channels = avio_rb32(pb);
592592 break;
593593 case 0x3D01:
594− descriptor->bits_per_sample = get_be32(pb);
594+ descriptor->bits_per_sample = avio_rb32(pb);
595595 break;
596596 case 0x3401:
597597 mxf_read_pixel_layout(pb, descriptor);
@@ -603,7 +603,7 @@ static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int · 5 unmodified lines
603603 if (!descriptor->extradata)
604604 return -1;
605605 descriptor->extradata_size = size;
606− get_buffer(pb, descriptor->extradata, size);
606+ avio_read(pb, descriptor->extradata, size);
607607 }
608608 break;
609609 }
@@ -871,8 +871,8 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF · 261 unmodified lines
871871 if (!ctx)
872872 return -1;
873873 while (url_ftell(pb) + 4 < klv_end) {
874− int tag = get_be16(pb);
875− int size = get_be16(pb); /* KLV specified by 0x53 */
874+ int tag = avio_rb16(pb);
875+ int size = avio_rb16(pb); /* KLV specified by 0x53 */
876876 uint64_t next = url_ftell(pb) + size;
877877 UID uid = {0};
878878
@@ -893,7 +893,7 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF · 14 unmodified lines
893893 }
894894 }
895895 if (ctx_size && tag == 0x3C0A)
896− get_buffer(pb, ctx->uid, 16);
896+ avio_read(pb, ctx->uid, 16);
897897 else if (read_child(ctx, pb, tag, size, uid) < 0)
898898 return -1;
899899
libavformat/mxg.c+1−1
@@ -115,7 +115,7 @@ static int mxg_update_cache(AVFormatContext *s, unsigned int cache_size) · 114 unmodified lines
115115 if (mxg->soi_ptr) mxg->soi_ptr = mxg->buffer + soi_pos;
116116
117117 /* get data */
118− ret = get_buffer(s->pb, mxg->buffer_ptr + mxg->cache_size,
118+ ret = avio_read(s->pb, mxg->buffer_ptr + mxg->cache_size,
119119 cache_size - mxg->cache_size);
120120 if (ret < 0)
121121 return ret;
libavformat/ncdec.c+3−3
@@ -68,11 +68,11 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt) · 67 unmodified lines
6868 while (state != NC_VIDEO_FLAG) {
6969 if (url_feof(s->pb))
7070 return AVERROR(EIO);
71− state = (state<<8) + get_byte(s->pb);
71+ state = (state<<8) + avio_r8(s->pb);
7272 }
7373
74− get_byte(s->pb);
75− size = get_le16(s->pb);
74+ avio_r8(s->pb);
75+ size = avio_rl16(s->pb);
7676 url_fskip(s->pb, 9);
7777
7878 if (size == 0) {
libavformat/nsvdec.c+27−27
@@ -236,7 +236,7 @@ static int nsv_resync(AVFormatContext *s) · 235 unmodified lines
236236 return -1;
237237 }
238238 v <<= 8;
239− v |= get_byte(pb);
239+ v |= avio_r8(pb);
240240 if (i < 8) {
241241 av_dlog(s, "NSV resync: [%d] = %02x\n", i, v & 0x0FF);
242242 }
@@ -277,23 +277,23 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) · 34 unmodified lines
277277
278278 nsv->state = NSV_UNSYNC; /* in case we fail */
279279
280− size = get_le32(pb);
280+ size = avio_rl32(pb);
281281 if (size < 28)
282282 return -1;
283283 nsv->NSVf_end = size;
284284
285− //s->file_size = (uint32_t)get_le32(pb);
286− file_size = (uint32_t)get_le32(pb);
285+ //s->file_size = (uint32_t)avio_rl32(pb);
286+ file_size = (uint32_t)avio_rl32(pb);
287287 av_dlog(s, "NSV NSVf chunk_size %u\n", size);
288288 av_dlog(s, "NSV NSVf file_size %u\n", file_size);
289289
290− nsv->duration = duration = get_le32(pb); /* in ms */
290+ nsv->duration = duration = avio_rl32(pb); /* in ms */
291291 av_dlog(s, "NSV NSVf duration %"PRId64" ms\n", duration);
292292 // XXX: store it in AVStreams
293293
294− strings_size = get_le32(pb);
295− table_entries = get_le32(pb);
296− table_entries_used = get_le32(pb);
294+ strings_size = avio_rl32(pb);
295+ table_entries = avio_rl32(pb);
296+ table_entries_used = avio_rl32(pb);
297297 av_dlog(s, "NSV NSVf info-strings size: %d, table entries: %d, bis %d\n",
298298 strings_size, table_entries, table_entries_used);
299299 if (url_feof(pb))
@@ -309,7 +309,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) · 9 unmodified lines
309309
310310 p = strings = av_mallocz(strings_size + 1);
311311 endp = strings + strings_size;
312− get_buffer(pb, strings, strings_size);
312+ avio_read(pb, strings, strings_size);
313313 while (p < endp) {
314314 while (*p == ' ')
315315 p++; /* strip out spaces */
@@ -344,13 +344,13 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) · 28 unmodified lines
344344 nsv->nsvs_file_offset = av_malloc((unsigned)table_entries_used * sizeof(uint32_t));
345345
346346 for(i=0;i<table_entries_used;i++)
347− nsv->nsvs_file_offset[i] = get_le32(pb) + size;
347+ nsv->nsvs_file_offset[i] = avio_rl32(pb) + size;
348348
349349 if(table_entries > table_entries_used &&
350− get_le32(pb) == MKTAG('T','O','C','2')) {
350+ avio_rl32(pb) == MKTAG('T','O','C','2')) {
351351 nsv->nsvs_timestamps = av_malloc((unsigned)table_entries_used*sizeof(uint32_t));
352352 for(i=0;i<table_entries_used;i++) {
353− nsv->nsvs_timestamps[i] = get_le32(pb);
353+ nsv->nsvs_timestamps[i] = avio_rl32(pb);
354354 }
355355 }
356356 }
@@ -365,7 +365,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) · 8 unmodified lines
365365 for (i = 0; i < table_entries; i++) {
366366 unsigned char b[8];
367367 url_fseek(pb, size + nsv->nsvs_file_offset[i], SEEK_SET);
368− get_buffer(pb, b, 8);
368+ avio_read(pb, b, 8);
369369 av_dlog(s, "NSV [0x%08lx][0x%08lx]: %02x %02x %02x %02x %02x %02x %02x %02x"
370370 "%c%c%c%c%c%c%c%c\n",
371371 nsv->nsvs_file_offset[i], size + nsv->nsvs_file_offset[i],
@@ -396,11 +396,11 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) · 24 unmodified lines
396396 NSVStream *nst;
397397 av_dlog(s, "%s()\n", __FUNCTION__);
398398
399− vtag = get_le32(pb);
400− atag = get_le32(pb);
401− vwidth = get_le16(pb);
402− vheight = get_le16(pb);
403− i = get_byte(pb);
399+ vtag = avio_rl32(pb);
400+ atag = avio_rl32(pb);
401+ vwidth = avio_rl16(pb);
402+ vheight = avio_rl16(pb);
403+ i = avio_r8(pb);
404404
405405 av_dlog(s, "NSV NSVs framerate code %2x\n", i);
406406 if(i&0x80) { /* odd way of giving native framerates from docs */
@@ -420,7 +420,7 @@ static int nsv_parse_NSVs_header(AVFormatContext *s, AVFormatParameters *ap) · 13 unmodified lines
420420 else
421421 framerate= (AVRational){i, 1};
422422
423− nsv->avsync = get_le16(pb);
423+ nsv->avsync = avio_rl16(pb);
424424 nsv->framerate = framerate;
425425
426426 print_tag("NSV NSVs vtag", vtag, 0);
@@ -568,16 +568,16 @@ null_chunk_retry: · 141 unmodified lines
568568 if (nsv->state != NSV_HAS_READ_NSVS && nsv->state != NSV_FOUND_BEEF)
569569 return -1;
570570
571− auxcount = get_byte(pb);
572− vsize = get_le16(pb);
573− asize = get_le16(pb);
571+ auxcount = avio_r8(pb);
572+ vsize = avio_rl16(pb);
573+ asize = avio_rl16(pb);
574574 vsize = (vsize << 4) | (auxcount >> 4);
575575 auxcount &= 0x0f;
576576 av_dlog(s, "NSV CHUNK %d aux, %u bytes video, %d bytes audio\n", auxcount, vsize, asize);
577577 /* skip aux stuff */
578578 for (i = 0; i < auxcount; i++) {
579− auxsize = get_le16(pb);
580− auxtag = get_le32(pb);
579+ auxsize = avio_rl16(pb);
580+ auxtag = avio_rl32(pb);
581581 av_dlog(s, "NSV aux data: '%c%c%c%c', %d bytes\n",
582582 (auxtag & 0x0ff),
583583 ((auxtag >> 8) & 0x0ff),
@@ -623,9 +623,9 @@ null_chunk_retry: · 39 unmodified lines
623623 uint8_t bps;
624624 uint8_t channels;
625625 uint16_t samplerate;
626− bps = get_byte(pb);
627− channels = get_byte(pb);
628− samplerate = get_le16(pb);
626+ bps = avio_r8(pb);
627+ channels = avio_r8(pb);
628+ samplerate = avio_rl16(pb);
629629 asize-=4;
630630 av_dlog(s, "NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate);
631631 if (fill_header) {
libavformat/nutdec.c+16−16
@@ -39,9 +39,9 @@ static int get_str(AVIOContext *bc, char *string, unsigned int maxlen){ · 38 unmodified lines
3939 unsigned int len= ff_get_v(bc);
4040
4141 if(len && maxlen)
42− get_buffer(bc, string, FFMIN(len, maxlen));
42+ avio_read(bc, string, FFMIN(len, maxlen));
4343 while(len > maxlen){
44− get_byte(bc);
44+ avio_r8(bc);
4545 len--;
4646 }
4747
@@ -64,8 +64,8 @@ static int64_t get_s(AVIOContext *bc){ · 16 unmodified lines
6464 static uint64_t get_fourcc(AVIOContext *bc){
6565 unsigned int len= ff_get_v(bc);
6666
67− if (len==2) return get_le16(bc);
68− else if(len==4) return get_le32(bc);
67+ if (len==2) return avio_rl16(bc);
68+ else if(len==4) return avio_rl32(bc);
6969 else return -1;
7070 }
7171
@@ -106,7 +106,7 @@ static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_chec · 34 unmodified lines
106106 init_checksum(bc, ff_crc04C11DB7_update, startcode);
107107 size= ff_get_v(bc);
108108 if(size > 4096)
109− get_be32(bc);
109+ avio_rb32(bc);
110110 if(get_checksum(bc) && size > 4096)
111111 return -1;
112112
@@ -122,7 +122,7 @@ static uint64_t find_any_startcode(AVIOContext *bc, int64_t pos){ · 9 unmodified lines
122122 url_fseek(bc, pos, SEEK_SET); //note, this may fail if the stream is not seekable, but that should not matter, as in this case we simply start where we currently are
123123
124124 while(!url_feof(bc)){
125− state= (state<<8) | get_byte(bc);
125+ state= (state<<8) | avio_r8(bc);
126126 if((state>>56) != 'N')
127127 continue;
128128 switch(state){
@@ -182,7 +182,7 @@ static int skip_reserved(AVIOContext *bc, int64_t pos){ · 53 unmodified lines
182182 return -1;
183183 }else{
184184 while(pos--)
185− get_byte(bc);
185+ avio_r8(bc);
186186 return 0;
187187 }
188188 }
@@ -279,7 +279,7 @@ static int decode_main_header(NUTContext *nut){ · 90 unmodified lines
279279 return AVERROR_INVALIDDATA;
280280 }
281281 nut->header[i]= av_malloc(nut->header_len[i]);
282− get_buffer(bc, nut->header[i], nut->header_len[i]);
282+ avio_read(bc, nut->header[i], nut->header_len[i]);
283283 }
284284 assert(nut->header_len[0]==0);
285285 }
@@ -355,7 +355,7 @@ static int decode_stream_header(NUTContext *nut){ · 69 unmodified lines
355355 GET_V(st->codec->extradata_size, tmp < (1<<30));
356356 if(st->codec->extradata_size){
357357 st->codec->extradata= av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
358− get_buffer(bc, st->codec->extradata, st->codec->extradata_size);
358+ avio_read(bc, st->codec->extradata, st->codec->extradata_size);
359359 }
360360
361361 if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO){
@@ -514,8 +514,8 @@ static int find_and_decode_index(NUTContext *nut){ · 152 unmodified lines
514514 int ret= -1;
515515
516516 url_fseek(bc, filesize-12, SEEK_SET);
517− url_fseek(bc, filesize-get_be64(bc), SEEK_SET);
518− if(get_be64(bc) != INDEX_STARTCODE){
517+ url_fseek(bc, filesize-avio_rb64(bc), SEEK_SET);
518+ if(avio_rb64(bc) != INDEX_STARTCODE){
519519 av_log(s, AV_LOG_ERROR, "no index at the end\n");
520520 return -1;
521521 }
@@ -722,7 +722,7 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, ui · 200 unmodified lines
722722 size -= nut->header_len[*header_idx];
723723
724724 if(flags&FLAG_CHECKSUM){
725− get_be32(bc); //FIXME check this
725+ avio_rb32(bc); //FIXME check this
726726 }else if(size > 2*nut->max_distance || FFABS(stc->last_pts - *pts) > stc->max_pts_distance){
727727 av_log(s, AV_LOG_ERROR, "frame size > 2max_distance and no checksum\n");
728728 return AVERROR_INVALIDDATA;
@@ -764,7 +764,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){ · 35 unmodified lines
764764 av_new_packet(pkt, size + nut->header_len[header_idx]);
765765 memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]);
766766 pkt->pos= url_ftell(bc); //FIXME
767− get_buffer(bc, pkt->data + nut->header_len[header_idx], size);
767+ avio_read(bc, pkt->data + nut->header_len[header_idx], size);
768768
769769 pkt->stream_index = stream_id;
770770 if (stc->last_flags & FLAG_KEY)
@@ -789,13 +789,13 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) · 18 unmodified lines
789789 if(tmp){
790790 pos-=8;
791791 }else{
792− frame_code = get_byte(bc);
792+ frame_code = avio_r8(bc);
793793 if(url_feof(bc))
794794 return -1;
795795 if(frame_code == 'N'){
796796 tmp= frame_code;
797797 for(i=1; i<8; i++)
798− tmp = (tmp<<8) + get_byte(bc);
798+ tmp = (tmp<<8) + avio_r8(bc);
799799 }
800800 }
801801 switch(tmp){
@@ -812,7 +812,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) · 10 unmodified lines
812812 case SYNCPOINT_STARTCODE:
813813 if(decode_syncpoint(nut, &ts, &back_ptr)<0)
814814 goto resync;
815− frame_code = get_byte(bc);
815+ frame_code = avio_r8(bc);
816816 case 0:
817817 ret= decode_frame(nut, pkt, frame_code);
818818 if(ret==0)
libavformat/nuv.c+26−26
@@ -62,16 +62,16 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, · 61 unmodified lines
6262 return 1; // no codec data needed
6363 while (!url_feof(pb)) {
6464 int size, subtype;
65− frametype = get_byte(pb);
65+ frametype = avio_r8(pb);
6666 switch (frametype) {
6767 case NUV_EXTRADATA:
68− subtype = get_byte(pb);
68+ subtype = avio_r8(pb);
6969 url_fskip(pb, 6);
70− size = PKTSIZE(get_le32(pb));
70+ size = PKTSIZE(avio_rl32(pb));
7171 if (vst && subtype == 'R') {
7272 vst->codec->extradata_size = size;
7373 vst->codec->extradata = av_malloc(size);
74− get_buffer(pb, vst->codec->extradata, size);
74+ avio_read(pb, vst->codec->extradata, size);
7575 size = 0;
7676 if (!myth)
7777 return 1;
@@ -79,12 +79,12 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, · 1 unmodified line
7979 break;
8080 case NUV_MYTHEXT:
8181 url_fskip(pb, 7);
82− size = PKTSIZE(get_le32(pb));
82+ size = PKTSIZE(avio_rl32(pb));
8383 if (size != 128 * 4)
8484 break;
85− get_le32(pb); // version
85+ avio_rl32(pb); // version
8686 if (vst) {
87− vst->codec->codec_tag = get_le32(pb);
87+ vst->codec->codec_tag = avio_rl32(pb);
8888 vst->codec->codec_id =
8989 ff_codec_get_id(ff_codec_bmp_tags, vst->codec->codec_tag);
9090 if (vst->codec->codec_tag == MKTAG('R', 'J', 'P', 'G'))
@@ -93,10 +93,10 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, · 2 unmodified lines
9393 url_fskip(pb, 4);
9494
9595 if (ast) {
96− ast->codec->codec_tag = get_le32(pb);
97− ast->codec->sample_rate = get_le32(pb);
98− ast->codec->bits_per_coded_sample = get_le32(pb);
99− ast->codec->channels = get_le32(pb);
96+ ast->codec->codec_tag = avio_rl32(pb);
97+ ast->codec->sample_rate = avio_rl32(pb);
98+ ast->codec->bits_per_coded_sample = avio_rl32(pb);
99+ ast->codec->channels = avio_rl32(pb);
100100 ast->codec->codec_id =
101101 ff_wav_codec_get_id(ast->codec->codec_tag,
102102 ast->codec->bits_per_coded_sample);
@@ -112,7 +112,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, · 9 unmodified lines
112112 break;
113113 default:
114114 url_fskip(pb, 7);
115− size = PKTSIZE(get_le32(pb));
115+ size = PKTSIZE(avio_rl32(pb));
116116 break;
117117 }
118118 url_fskip(pb, size);
@@ -128,27 +128,27 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { · 9 unmodified lines
128128 int is_mythtv, width, height, v_packs, a_packs;
129129 int stream_nr = 0;
130130 AVStream *vst = NULL, *ast = NULL;
131− get_buffer(pb, id_string, 12);
131+ avio_read(pb, id_string, 12);
132132 is_mythtv = !memcmp(id_string, "MythTVVideo", 12);
133133 url_fskip(pb, 5); // version string
134134 url_fskip(pb, 3); // padding
135− width = get_le32(pb);
136− height = get_le32(pb);
137− get_le32(pb); // unused, "desiredwidth"
138− get_le32(pb); // unused, "desiredheight"
139− get_byte(pb); // 'P' == progressive, 'I' == interlaced
135+ width = avio_rl32(pb);
136+ height = avio_rl32(pb);
137+ avio_rl32(pb); // unused, "desiredwidth"
138+ avio_rl32(pb); // unused, "desiredheight"
139+ avio_r8(pb); // 'P' == progressive, 'I' == interlaced
140140 url_fskip(pb, 3); // padding
141− aspect = av_int2dbl(get_le64(pb));
141+ aspect = av_int2dbl(avio_rl64(pb));
142142 if (aspect > 0.9999 && aspect < 1.0001)
143143 aspect = 4.0 / 3.0;
144− fps = av_int2dbl(get_le64(pb));
144+ fps = av_int2dbl(avio_rl64(pb));
145145
146146 // number of packets per stream type, -1 means unknown, e.g. streaming
147− v_packs = get_le32(pb);
148− a_packs = get_le32(pb);
149− get_le32(pb); // text
147+ v_packs = avio_rl32(pb);
148+ a_packs = avio_rl32(pb);
149+ avio_rl32(pb); // text
150150
151− get_le32(pb); // keyframe distance (?)
151+ avio_rl32(pb); // keyframe distance (?)
152152
153153 if (v_packs) {
154154 ctx->v_id = stream_nr++;
@@ -198,7 +198,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { · 43 unmodified lines
198198 while (!url_feof(pb)) {
199199 int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0;
200200 uint64_t pos = url_ftell(pb);
201− ret = get_buffer(pb, hdr, HDRSIZE);
201+ ret = avio_read(pb, hdr, HDRSIZE);
202202 if (ret < HDRSIZE)
203203 return ret < 0 ? ret : AVERROR(EIO);
204204 frametype = hdr[0];
@@ -225,7 +225,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { · 20 unmodified lines
225225 pkt->pts = AV_RL32(&hdr[4]);
226226 pkt->stream_index = ctx->v_id;
227227 memcpy(pkt->data, hdr, copyhdrsize);
228− ret = get_buffer(pb, pkt->data + copyhdrsize, size);
228+ ret = avio_read(pb, pkt->data + copyhdrsize, size);
229229 if (ret < 0) {
230230 av_free_packet(pkt);
231231 return ret;
libavformat/oggdec.c+7−7
@@ -207,7 +207,7 @@ ogg_read_page (AVFormatContext * s, int *str) · 206 unmodified lines
207207 uint8_t sync[4];
208208 int sp = 0;
209209
210− if (get_buffer (bc, sync, 4) < 4)
210+ if (avio_read (bc, sync, 4) < 4)
211211 return -1;
212212
213213 do{
@@ -233,10 +233,10 @@ ogg_read_page (AVFormatContext * s, int *str) · 19 unmodified lines
233233 return -1;
234234
235235 flags = url_fgetc (bc);
236− gp = get_le64 (bc);
237− serial = get_le32 (bc);
238− seq = get_le32 (bc);
239− crc = get_le32 (bc);
236+ gp = avio_rl64 (bc);
237+ serial = avio_rl32 (bc);
238+ seq = avio_rl32 (bc);
239+ crc = avio_rl32 (bc);
240240 nsegs = url_fgetc (bc);
241241
242242 idx = ogg_find_stream (ogg, serial);
@@ -252,7 +252,7 @@ ogg_read_page (AVFormatContext * s, int *str) · 9 unmodified lines
252252 if(os->psize > 0)
253253 ogg_new_buf(ogg, idx);
254254
255− if (get_buffer (bc, os->segments, nsegs) < nsegs)
255+ if (avio_read (bc, os->segments, nsegs) < nsegs)
256256 return -1;
257257
258258 os->nsegs = nsegs;
@@ -284,7 +284,7 @@ ogg_read_page (AVFormatContext * s, int *str) · 25 unmodified lines
284284 os->buf = nb;
285285 }
286286
287− if (get_buffer (bc, os->buf + os->bufpos, size) < size)
287+ if (avio_read (bc, os->buf + os->bufpos, size) < size)
288288 return -1;
289289
290290 os->bufpos += size;
libavformat/oma.c+1−1
@@ -79,7 +79,7 @@ static int oma_read_header(AVFormatContext *s, · 78 unmodified lines
7979 AVStream *st;
8080
8181 ff_id3v2_read(s, ID3v2_EA3_MAGIC);
82− ret = get_buffer(s->pb, buf, EA3_HEADER_SIZE);
82+ ret = avio_read(s->pb, buf, EA3_HEADER_SIZE);
8383
8484 if (memcmp(buf, ((const uint8_t[]){'E', 'A', '3'}),3) || buf[4] != 0 || buf[5] != EA3_HEADER_SIZE) {
8585 av_log(s, AV_LOG_ERROR, "Couldn't find the EA3 header !\n");
libavformat/psxstr.c+2−2
@@ -105,7 +105,7 @@ static int str_read_header(AVFormatContext *s, · 104 unmodified lines
105105 int i;
106106
107107 /* skip over any RIFF header */
108− if (get_buffer(pb, sector, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE)
108+ if (avio_read(pb, sector, RIFF_HEADER_SIZE) != RIFF_HEADER_SIZE)
109109 return AVERROR(EIO);
110110 if (AV_RL32(&sector[0]) == RIFF_TAG)
111111 start = RIFF_HEADER_SIZE;
@@ -136,7 +136,7 @@ static int str_read_packet(AVFormatContext *s, · 24 unmodified lines
136136
137137 while (1) {
138138
139− if (get_buffer(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE)
139+ if (avio_read(pb, sector, RAW_CD_SECTOR_SIZE) != RAW_CD_SECTOR_SIZE)
140140 return AVERROR(EIO);
141141
142142 channel = sector[0x11];
libavformat/pva.c+13−13
@@ -75,12 +75,12 @@ static int read_part_of_packet(AVFormatContext *s, int64_t *pts, · 74 unmodified lines
7575 recover:
7676 startpos = url_ftell(pb);
7777
78− syncword = get_be16(pb);
79− streamid = get_byte(pb);
80− get_byte(pb); /* counter not used */
81− reserved = get_byte(pb);
82− flags = get_byte(pb);
83− length = get_be16(pb);
78+ syncword = avio_rb16(pb);
79+ streamid = avio_r8(pb);
80+ avio_r8(pb); /* counter not used */
81+ reserved = avio_r8(pb);
82+ flags = avio_r8(pb);
83+ length = avio_rb16(pb);
8484
8585 pts_flag = flags & 0x10;
8686
@@ -101,7 +101,7 @@ recover: · 14 unmodified lines
101101 }
102102
103103 if (streamid == PVA_VIDEO_PAYLOAD && pts_flag) {
104− pva_pts = get_be32(pb);
104+ pva_pts = avio_rb32(pb);
105105 length -= 4;
106106 } else if (streamid == PVA_AUDIO_PAYLOAD) {
107107 /* PVA Audio Packets either start with a signaled PES packet or
@@ -113,11 +113,11 @@ recover: · 5 unmodified lines
113113 pes_flags;
114114 unsigned char pes_header_data[256];
115115
116− pes_signal = get_be24(pb);
117− get_byte(pb);
118− pes_packet_length = get_be16(pb);
119− pes_flags = get_be16(pb);
120− pes_header_data_length = get_byte(pb);
116+ pes_signal = avio_rb24(pb);
117+ avio_r8(pb);
118+ pes_packet_length = avio_rb16(pb);
119+ pes_flags = avio_rb16(pb);
120+ pes_header_data_length = avio_r8(pb);
121121
122122 if (pes_signal != 1) {
123123 pva_log(s, AV_LOG_WARNING, "expected signaled PES packet, "
@@ -128,7 +128,7 @@ recover: · 4 unmodified lines
128128 goto recover;
129129 }
130130
131− get_buffer(pb, pes_header_data, pes_header_data_length);
131+ avio_read(pb, pes_header_data, pes_header_data_length);
132132 length -= 9 + pes_header_data_length;
133133
134134 pes_packet_length -= 3 + pes_header_data_length;
libavformat/qcp.c+14−14
@@ -91,13 +91,13 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) · 90 unmodified lines
9191 if (!st)
9292 return AVERROR(ENOMEM);
9393
94− get_be32(pb); // "RIFF"
95− s->file_size = get_le32(pb) + 8;
94+ avio_rb32(pb); // "RIFF"
95+ s->file_size = avio_rl32(pb) + 8;
9696 url_fskip(pb, 8 + 4 + 1 + 1); // "QLCMfmt " + chunk-size + major-version + minor-version
9797
9898 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
9999 st->codec->channels = 1;
100− get_buffer(pb, buf, 16);
100+ avio_read(pb, buf, 16);
101101 if (is_qcelp_13k_guid(buf)) {
102102 st->codec->codec_id = CODEC_ID_QCELP;
103103 } else if (!memcmp(buf, guid_evrc, 16)) {
@@ -111,19 +111,19 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) · 7 unmodified lines
111111 return AVERROR_INVALIDDATA;
112112 }
113113 url_fskip(pb, 2 + 80); // codec-version + codec-name
114− st->codec->bit_rate = get_le16(pb);
114+ st->codec->bit_rate = avio_rl16(pb);
115115
116− s->packet_size = get_le16(pb);
116+ s->packet_size = avio_rl16(pb);
117117 url_fskip(pb, 2); // block-size
118− st->codec->sample_rate = get_le16(pb);
118+ st->codec->sample_rate = avio_rl16(pb);
119119 url_fskip(pb, 2); // sample-size
120120
121121 memset(c->rates_per_mode, -1, sizeof(c->rates_per_mode));
122− nb_rates = get_le32(pb);
122+ nb_rates = avio_rl32(pb);
123123 nb_rates = FFMIN(nb_rates, 8);
124124 for (i=0; i<nb_rates; i++) {
125− int size = get_byte(pb);
126− int mode = get_byte(pb);
125+ int size = avio_r8(pb);
126+ int mode = avio_r8(pb);
127127 if (mode > QCP_MAX_MODE) {
128128 av_log(s, AV_LOG_WARNING, "Unknown entry %d=>%d in rate-map-table.\n ", mode, size);
129129 } else
@@ -142,7 +142,7 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) · 12 unmodified lines
142142
143143 while(!url_feof(pb)) {
144144 if (c->data_size) {
145− int pkt_size, ret, mode = get_byte(pb);
145+ int pkt_size, ret, mode = avio_r8(pb);
146146
147147 if (s->packet_size) {
148148 pkt_size = s->packet_size - 1;
@@ -165,14 +165,14 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) · 16 unmodified lines
165165 return ret;
166166 }
167167
168− if (url_ftell(pb) & 1 && get_byte(pb))
168+ if (url_ftell(pb) & 1 && avio_r8(pb))
169169 av_log(s, AV_LOG_WARNING, "Padding should be 0.\n");
170170
171− tag = get_le32(pb);
172− chunk_size = get_le32(pb);
171+ tag = avio_rl32(pb);
172+ chunk_size = avio_rl32(pb);
173173 switch (tag) {
174174 case MKTAG('v', 'r', 'a', 't'):
175− if (get_le32(pb)) // var-rate-flag
175+ if (avio_rl32(pb)) // var-rate-flag
176176 s->packet_size = 0;
177177 url_fskip(pb, 4); // size-in-packets
178178 break;
libavformat/r3d.c+39−39
@@ -39,10 +39,10 @@ typedef struct { · 38 unmodified lines
3939 static int read_atom(AVFormatContext *s, Atom *atom)
4040 {
4141 atom->offset = url_ftell(s->pb);
42− atom->size = get_be32(s->pb);
42+ atom->size = avio_rb32(s->pb);
4343 if (atom->size < 8)
4444 return -1;
45− atom->tag = get_le32(s->pb);
45+ atom->tag = avio_rl32(s->pb);
4646 av_dlog(s, "atom %d %.4s offset %#llx\n",
4747 atom->size, (char*)&atom->tag, atom->offset);
4848 return atom->size;
@@ -59,31 +59,31 @@ static int r3d_read_red1(AVFormatContext *s) · 10 unmodified lines
5959 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
6060 st->codec->codec_id = CODEC_ID_JPEG2000;
6161
62− tmp = get_byte(s->pb); // major version
63− tmp2 = get_byte(s->pb); // minor version
62+ tmp = avio_r8(s->pb); // major version
63+ tmp2 = avio_r8(s->pb); // minor version
6464 av_dlog(s, "version %d.%d\n", tmp, tmp2);
6565
66− tmp = get_be16(s->pb); // unknown
66+ tmp = avio_rb16(s->pb); // unknown
6767 av_dlog(s, "unknown1 %d\n", tmp);
6868
69− tmp = get_be32(s->pb);
69+ tmp = avio_rb32(s->pb);
7070 av_set_pts_info(st, 32, 1, tmp);
7171
72− tmp = get_be32(s->pb); // filenum
72+ tmp = avio_rb32(s->pb); // filenum
7373 av_dlog(s, "filenum %d\n", tmp);
7474
7575 url_fskip(s->pb, 32); // unknown
7676
77− st->codec->width = get_be32(s->pb);
78− st->codec->height = get_be32(s->pb);
77+ st->codec->width = avio_rb32(s->pb);
78+ st->codec->height = avio_rb32(s->pb);
7979
80− tmp = get_be16(s->pb); // unknown
80+ tmp = avio_rb16(s->pb); // unknown
8181 av_dlog(s, "unknown2 %d\n", tmp);
8282
83− st->codec->time_base.den = get_be16(s->pb);
84− st->codec->time_base.num = get_be16(s->pb);
83+ st->codec->time_base.den = avio_rb16(s->pb);
84+ st->codec->time_base.num = avio_rb16(s->pb);
8585
86− tmp = get_byte(s->pb); // audio channels
86+ tmp = avio_r8(s->pb); // audio channels
8787 av_dlog(s, "audio channels %d\n", tmp);
8888 if (tmp > 0) {
8989 AVStream *ast = av_new_stream(s, 1);
@@ -95,7 +95,7 @@ static int r3d_read_red1(AVFormatContext *s) · 5 unmodified lines
9595 av_set_pts_info(ast, 32, 1, st->time_base.den);
9696 }
9797
98− get_buffer(s->pb, filename, 257);
98+ avio_read(s->pb, filename, 257);
9999 filename[sizeof(filename)-1] = 0;
100100 av_metadata_set2(&st->metadata, "filename", filename, 0);
101101
@@ -120,7 +120,7 @@ static int r3d_read_rdvo(AVFormatContext *s, Atom *atom) · 18 unmodified lines
120120 return AVERROR(ENOMEM);
121121
122122 for (i = 0; i < r3d->video_offsets_count; i++) {
123− r3d->video_offsets[i] = get_be32(s->pb);
123+ r3d->video_offsets[i] = avio_rb32(s->pb);
124124 if (!r3d->video_offsets[i]) {
125125 r3d->video_offsets_count = i;
126126 break;
@@ -141,15 +141,15 @@ static void r3d_read_reos(AVFormatContext *s) · 14 unmodified lines
141141 R3DContext *r3d = s->priv_data;
142142 int tmp;
143143
144− r3d->rdvo_offset = get_be32(s->pb);
145− get_be32(s->pb); // rdvs offset
146− get_be32(s->pb); // rdao offset
147− get_be32(s->pb); // rdas offset
144+ r3d->rdvo_offset = avio_rb32(s->pb);
145+ avio_rb32(s->pb); // rdvs offset
146+ avio_rb32(s->pb); // rdao offset
147+ avio_rb32(s->pb); // rdas offset
148148
149− tmp = get_be32(s->pb);
149+ tmp = avio_rb32(s->pb);
150150 av_dlog(s, "num video chunks %d\n", tmp);
151151
152− tmp = get_be32(s->pb);
152+ tmp = avio_rb32(s->pb);
153153 av_dlog(s, "num audio chunks %d\n", tmp);
154154
155155 url_fskip(s->pb, 6*4);
@@ -214,31 +214,31 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom) · 58 unmodified lines
214214 unsigned dts;
215215 int ret;
216216
217− dts = get_be32(s->pb);
217+ dts = avio_rb32(s->pb);
218218
219− tmp = get_be32(s->pb);
219+ tmp = avio_rb32(s->pb);
220220 av_dlog(s, "frame num %d\n", tmp);
221221
222− tmp = get_byte(s->pb); // major version
223− tmp2 = get_byte(s->pb); // minor version
222+ tmp = avio_r8(s->pb); // major version
223+ tmp2 = avio_r8(s->pb); // minor version
224224 av_dlog(s, "version %d.%d\n", tmp, tmp2);
225225
226− tmp = get_be16(s->pb); // unknown
226+ tmp = avio_rb16(s->pb); // unknown
227227 av_dlog(s, "unknown %d\n", tmp);
228228
229229 if (tmp > 4) {
230− tmp = get_be16(s->pb); // unknown
230+ tmp = avio_rb16(s->pb); // unknown
231231 av_dlog(s, "unknown %d\n", tmp);
232232
233− tmp = get_be16(s->pb); // unknown
233+ tmp = avio_rb16(s->pb); // unknown
234234 av_dlog(s, "unknown %d\n", tmp);
235235
236− tmp = get_be32(s->pb);
236+ tmp = avio_rb32(s->pb);
237237 av_dlog(s, "width %d\n", tmp);
238− tmp = get_be32(s->pb);
238+ tmp = avio_rb32(s->pb);
239239 av_dlog(s, "height %d\n", tmp);
240240
241− tmp = get_be32(s->pb);
241+ tmp = avio_rb32(s->pb);
242242 av_dlog(s, "metadata len %d\n", tmp);
243243 }
244244 tmp = atom->size - 8 - (url_ftell(s->pb) - pos);
@@ -268,23 +268,23 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom) · 23 unmodified lines
268268 unsigned dts;
269269 int ret;
270270
271− dts = get_be32(s->pb);
271+ dts = avio_rb32(s->pb);
272272
273− st->codec->sample_rate = get_be32(s->pb);
273+ st->codec->sample_rate = avio_rb32(s->pb);
274274
275− samples = get_be32(s->pb);
275+ samples = avio_rb32(s->pb);
276276
277− tmp = get_be32(s->pb);
277+ tmp = avio_rb32(s->pb);
278278 av_dlog(s, "packet num %d\n", tmp);
279279
280− tmp = get_be16(s->pb); // unkown
280+ tmp = avio_rb16(s->pb); // unkown
281281 av_dlog(s, "unknown %d\n", tmp);
282282
283− tmp = get_byte(s->pb); // major version
284− tmp2 = get_byte(s->pb); // minor version
283+ tmp = avio_r8(s->pb); // major version
284+ tmp2 = avio_r8(s->pb); // minor version
285285 av_dlog(s, "version %d.%d\n", tmp, tmp2);
286286
287− tmp = get_be32(s->pb); // unknown
287+ tmp = avio_rb32(s->pb); // unknown
288288 av_dlog(s, "unknown %d\n", tmp);
289289
290290 size = atom->size - 8 - (url_ftell(s->pb) - pos);
libavformat/rdt.c+6−6
@@ -153,25 +153,25 @@ rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr) · 152 unmodified lines
153153 return -1;
154154 ffio_init_context(&pb, rdt->mlti_data, rdt->mlti_data_size, 0,
155155 NULL, NULL, NULL, NULL);
156− tag = get_le32(&pb);
156+ tag = avio_rl32(&pb);
157157 if (tag == MKTAG('M', 'L', 'T', 'I')) {
158158 int num, chunk_nr;
159159
160160 /* read index of MDPR chunk numbers */
161− num = get_be16(&pb);
161+ num = avio_rb16(&pb);
162162 if (rule_nr < 0 || rule_nr >= num)
163163 return -1;
164164 url_fskip(&pb, rule_nr * 2);
165− chunk_nr = get_be16(&pb);
165+ chunk_nr = avio_rb16(&pb);
166166 url_fskip(&pb, (num - 1 - rule_nr) * 2);
167167
168168 /* read MDPR chunks */
169− num = get_be16(&pb);
169+ num = avio_rb16(&pb);
170170 if (chunk_nr >= num)
171171 return -1;
172172 while (chunk_nr--)
173− url_fskip(&pb, get_be32(&pb));
174− size = get_be32(&pb);
173+ url_fskip(&pb, avio_rb32(&pb));
174+ size = avio_rb32(&pb);
175175 } else {
176176 size = rdt->mlti_data_size;
177177 url_fseek(&pb, 0, SEEK_SET);
libavformat/riff.c+22−22
@@ -481,25 +481,25 @@ void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) · 480 unmodified lines
481481 {
482482 int id;
483483
484− id = get_le16(pb);
484+ id = avio_rl16(pb);
485485 codec->codec_type = AVMEDIA_TYPE_AUDIO;
486486 codec->codec_tag = id;
487− codec->channels = get_le16(pb);
488− codec->sample_rate = get_le32(pb);
489− codec->bit_rate = get_le32(pb) * 8;
490− codec->block_align = get_le16(pb);
487+ codec->channels = avio_rl16(pb);
488+ codec->sample_rate = avio_rl32(pb);
489+ codec->bit_rate = avio_rl32(pb) * 8;
490+ codec->block_align = avio_rl16(pb);
491491 if (size == 14) { /* We're dealing with plain vanilla WAVEFORMAT */
492492 codec->bits_per_coded_sample = 8;
493493 }else
494− codec->bits_per_coded_sample = get_le16(pb);
494+ codec->bits_per_coded_sample = avio_rl16(pb);
495495 if (size >= 18) { /* We're obviously dealing with WAVEFORMATEX */
496− int cbSize = get_le16(pb); /* cbSize */
496+ int cbSize = avio_rl16(pb); /* cbSize */
497497 size -= 18;
498498 cbSize = FFMIN(size, cbSize);
499499 if (cbSize >= 22 && id == 0xfffe) { /* WAVEFORMATEXTENSIBLE */
500− codec->bits_per_coded_sample = get_le16(pb);
501− codec->channel_layout = get_le32(pb); /* dwChannelMask */
502− id = get_le32(pb); /* 4 first bytes of GUID */
500+ codec->bits_per_coded_sample = avio_rl16(pb);
501+ codec->channel_layout = avio_rl32(pb); /* dwChannelMask */
502+ id = avio_rl32(pb); /* 4 first bytes of GUID */
503503 url_fskip(pb, 12); /* skip end of GUID */
504504 cbSize -= 22;
505505 size -= 22;
@@ -507,7 +507,7 @@ void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) · 1 unmodified line
507507 codec->extradata_size = cbSize;
508508 if (cbSize > 0) {
509509 codec->extradata = av_mallocz(codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
510− get_buffer(pb, codec->extradata, codec->extradata_size);
510+ avio_read(pb, codec->extradata, codec->extradata_size);
511511 size -= cbSize;
512512 }
513513
@@ -547,17 +547,17 @@ enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps) · 33 unmodified lines
547547 int ff_get_bmp_header(AVIOContext *pb, AVStream *st)
548548 {
549549 int tag1;
550− get_le32(pb); /* size */
551− st->codec->width = get_le32(pb);
552− st->codec->height = (int32_t)get_le32(pb);
553− get_le16(pb); /* planes */
554− st->codec->bits_per_coded_sample= get_le16(pb); /* depth */
555− tag1 = get_le32(pb);
556− get_le32(pb); /* ImageSize */
557− get_le32(pb); /* XPelsPerMeter */
558− get_le32(pb); /* YPelsPerMeter */
559− get_le32(pb); /* ClrUsed */
560− get_le32(pb); /* ClrImportant */
550+ avio_rl32(pb); /* size */
551+ st->codec->width = avio_rl32(pb);
552+ st->codec->height = (int32_t)avio_rl32(pb);
553+ avio_rl16(pb); /* planes */
554+ st->codec->bits_per_coded_sample= avio_rl16(pb); /* depth */
555+ tag1 = avio_rl32(pb);
556+ avio_rl32(pb); /* ImageSize */
557+ avio_rl32(pb); /* XPelsPerMeter */
558+ avio_rl32(pb); /* YPelsPerMeter */
559+ avio_rl32(pb); /* ClrUsed */
560+ avio_rl32(pb); /* ClrImportant */
561561 return tag1;
562562 }
563563 #endif // CONFIG_DEMUXERS
libavformat/rl2.c+13−13
@@ -96,20 +96,20 @@ static av_cold int rl2_read_header(AVFormatContext *s, · 95 unmodified lines
9696 int ret = 0;
9797
9898 url_fskip(pb,4); /* skip FORM tag */
99− back_size = get_le32(pb); /**< get size of the background frame */
100− signature = get_be32(pb);
101− data_size = get_be32(pb);
102− frame_count = get_le32(pb);
99+ back_size = avio_rl32(pb); /**< get size of the background frame */
100+ signature = avio_rb32(pb);
101+ data_size = avio_rb32(pb);
102+ frame_count = avio_rl32(pb);
103103
104104 /* disallow back_sizes and frame_counts that may lead to overflows later */
105105 if(back_size > INT_MAX/2 || frame_count > INT_MAX / sizeof(uint32_t))
106106 return AVERROR_INVALIDDATA;
107107
108− encoding_method = get_le16(pb);
109− sound_rate = get_le16(pb);
110− rate = get_le16(pb);
111− channels = get_le16(pb);
112− def_sound_size = get_le16(pb);
108+ encoding_method = avio_rl16(pb);
109+ sound_rate = avio_rl16(pb);
110+ rate = avio_rl16(pb);
111+ channels = avio_rl16(pb);
112+ def_sound_size = avio_rl16(pb);
113113
114114 /** setup video stream */
115115 st = av_new_stream(s, 0);
@@ -133,7 +133,7 @@ static av_cold int rl2_read_header(AVFormatContext *s, · 17 unmodified lines
133133 if(!st->codec->extradata)
134134 return AVERROR(ENOMEM);
135135
136− if(get_buffer(pb,st->codec->extradata,st->codec->extradata_size) !=
136+ if(avio_read(pb,st->codec->extradata,st->codec->extradata_size) !=
137137 st->codec->extradata_size)
138138 return AVERROR(EIO);
139139
@@ -173,11 +173,11 @@ static av_cold int rl2_read_header(AVFormatContext *s, · 33 unmodified lines
173173
174174 /** read offset and size tables */
175175 for(i=0; i < frame_count;i++)
176− chunk_size[i] = get_le32(pb);
176+ chunk_size[i] = avio_rl32(pb);
177177 for(i=0; i < frame_count;i++)
178− chunk_offset[i] = get_le32(pb);
178+ chunk_offset[i] = avio_rl32(pb);
179179 for(i=0; i < frame_count;i++)
180− audio_size[i] = get_le32(pb) & 0xFFFF;
180+ audio_size[i] = avio_rl32(pb) & 0xFFFF;
181181
182182 /** build the sample index */
183183 for(i=0;i<frame_count;i++){
libavformat/rmdec.c+103−103
@@ -71,7 +71,7 @@ static inline void get_strl(AVIOContext *pb, char *buf, int buf_size, int len) · 70 unmodified lines
7171
7272 q = buf;
7373 for(i=0;i<len;i++) {
74− r = get_byte(pb);
74+ r = avio_r8(pb);
7575 if (i < buf_size - 1)
7676 *q++ = r;
7777 }
@@ -80,7 +80,7 @@ static inline void get_strl(AVIOContext *pb, char *buf, int buf_size, int len) · 2 unmodified lines
8080
8181 static void get_str8(AVIOContext *pb, char *buf, int buf_size)
8282 {
83− get_strl(pb, buf, buf_size, get_byte(pb));
83+ get_strl(pb, buf, buf_size, avio_r8(pb));
8484 }
8585
8686 static int rm_read_extradata(AVIOContext *pb, AVCodecContext *avctx, unsigned size)
@@ -90,7 +90,7 @@ static int rm_read_extradata(AVIOContext *pb, AVCodecContext *avctx, unsigned si · 3 unmodified lines
9090 avctx->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
9191 if (!avctx->extradata)
9292 return AVERROR(ENOMEM);
93− avctx->extradata_size = get_buffer(pb, avctx->extradata, size);
93+ avctx->extradata_size = avio_read(pb, avctx->extradata, size);
9494 memset(avctx->extradata + avctx->extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
9595 if (avctx->extradata_size != size)
9696 return AVERROR(EIO);
@@ -102,7 +102,7 @@ static void rm_read_metadata(AVFormatContext *s, int wide) · 5 unmodified lines
102102 char buf[1024];
103103 int i;
104104 for (i=0; i<FF_ARRAY_ELEMS(ff_rm_metadata); i++) {
105− int len = wide ? get_be16(s->pb) : get_byte(s->pb);
105+ int len = wide ? avio_rb16(s->pb) : avio_r8(s->pb);
106106 get_strl(s->pb, buf, sizeof(buf), len);
107107 av_metadata_set2(&s->metadata, ff_rm_metadata[i], buf, 0);
108108 }
@@ -128,15 +128,15 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, · 19 unmodified lines
128128 int ret;
129129
130130 /* ra type header */
131− version = get_be16(pb); /* version */
131+ version = avio_rb16(pb); /* version */
132132 if (version == 3) {
133− int header_size = get_be16(pb);
133+ int header_size = avio_rb16(pb);
134134 int64_t startpos = url_ftell(pb);
135135 url_fskip(pb, 14);
136136 rm_read_metadata(s, 0);
137137 if ((startpos + header_size) >= url_ftell(pb) + 2) {
138138 // fourcc (should always be "lpcJ")
139− get_byte(pb);
139+ avio_r8(pb);
140140 get_str8(pb, buf, sizeof(buf));
141141 }
142142 // Skip extra header crap (this should never happen)
@@ -151,28 +151,28 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, · 8 unmodified lines
151151 int codecdata_length;
152152 /* old version (4) */
153153 url_fskip(pb, 2); /* unused */
154− get_be32(pb); /* .ra4 */
155− get_be32(pb); /* data size */
156− get_be16(pb); /* version2 */
157− get_be32(pb); /* header size */
158− flavor= get_be16(pb); /* add codec info / flavor */
159− ast->coded_framesize = coded_framesize = get_be32(pb); /* coded frame size */
160− get_be32(pb); /* ??? */
161− get_be32(pb); /* ??? */
162− get_be32(pb); /* ??? */
163− ast->sub_packet_h = sub_packet_h = get_be16(pb); /* 1 */
164− st->codec->block_align= get_be16(pb); /* frame size */
165− ast->sub_packet_size = sub_packet_size = get_be16(pb); /* sub packet size */
166− get_be16(pb); /* ??? */
154+ avio_rb32(pb); /* .ra4 */
155+ avio_rb32(pb); /* data size */
156+ avio_rb16(pb); /* version2 */
157+ avio_rb32(pb); /* header size */
158+ flavor= avio_rb16(pb); /* add codec info / flavor */
159+ ast->coded_framesize = coded_framesize = avio_rb32(pb); /* coded frame size */
160+ avio_rb32(pb); /* ??? */
161+ avio_rb32(pb); /* ??? */
162+ avio_rb32(pb); /* ??? */
163+ ast->sub_packet_h = sub_packet_h = avio_rb16(pb); /* 1 */
164+ st->codec->block_align= avio_rb16(pb); /* frame size */
165+ ast->sub_packet_size = sub_packet_size = avio_rb16(pb); /* sub packet size */
166+ avio_rb16(pb); /* ??? */
167167 if (version == 5) {
168− get_be16(pb); get_be16(pb); get_be16(pb);
168+ avio_rb16(pb); avio_rb16(pb); avio_rb16(pb);
169169 }
170− st->codec->sample_rate = get_be16(pb);
171− get_be32(pb);
172− st->codec->channels = get_be16(pb);
170+ st->codec->sample_rate = avio_rb16(pb);
171+ avio_rb32(pb);
172+ st->codec->channels = avio_rb16(pb);
173173 if (version == 5) {
174− get_be32(pb);
175− get_buffer(pb, buf, 4);
174+ avio_rb32(pb);
175+ avio_read(pb, buf, 4);
176176 buf[4] = 0;
177177 } else {
178178 get_str8(pb, buf, sizeof(buf)); /* desc */
@@ -201,10 +201,10 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, · 22 unmodified lines
201201 case CODEC_ID_COOK:
202202 case CODEC_ID_ATRAC3:
203203 case CODEC_ID_SIPR:
204− get_be16(pb); get_byte(pb);
204+ avio_rb16(pb); avio_r8(pb);
205205 if (version == 5)
206− get_byte(pb);
207− codecdata_length = get_be32(pb);
206+ avio_r8(pb);
207+ codecdata_length = avio_rb32(pb);
208208 if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){
209209 av_log(s, AV_LOG_ERROR, "codecdata_length too large\n");
210210 return -1;
@@ -236,16 +236,16 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, · 25 unmodified lines
236236 av_new_packet(&ast->pkt, ast->audio_framesize * sub_packet_h);
237237 break;
238238 case CODEC_ID_AAC:
239− get_be16(pb); get_byte(pb);
239+ avio_rb16(pb); avio_r8(pb);
240240 if (version == 5)
241− get_byte(pb);
242− codecdata_length = get_be32(pb);
241+ avio_r8(pb);
242+ codecdata_length = avio_rb32(pb);
243243 if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){
244244 av_log(s, AV_LOG_ERROR, "codecdata_length too large\n");
245245 return -1;
246246 }
247247 if (codecdata_length >= 1) {
248− get_byte(pb);
248+ avio_r8(pb);
249249 if ((ret = rm_read_extradata(pb, st->codec, codecdata_length - 1)) < 0)
250250 return ret;
251251 }
@@ -254,9 +254,9 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, · 2 unmodified lines
254254 av_strlcpy(st->codec->codec_name, buf, sizeof(st->codec->codec_name));
255255 }
256256 if (read_all) {
257− get_byte(pb);
258− get_byte(pb);
259− get_byte(pb);
257+ avio_r8(pb);
258+ avio_r8(pb);
259+ avio_r8(pb);
260260 rm_read_metadata(s, 0);
261261 }
262262 }
@@ -274,32 +274,32 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, · 11 unmodified lines
274274
275275 av_set_pts_info(st, 64, 1, 1000);
276276 codec_pos = url_ftell(pb);
277− v = get_be32(pb);
277+ v = avio_rb32(pb);
278278 if (v == MKTAG(0xfd, 'a', 'r', '.')) {
279279 /* ra type header */
280280 if (rm_read_audio_stream_info(s, pb, st, rst, 0))
281281 return -1;
282282 } else {
283283 int fps, fps2;
284− if (get_le32(pb) != MKTAG('V', 'I', 'D', 'O')) {
284+ if (avio_rl32(pb) != MKTAG('V', 'I', 'D', 'O')) {
285285 fail1:
286286 av_log(st->codec, AV_LOG_ERROR, "Unsupported video codec\n");
287287 goto skip;
288288 }
289− st->codec->codec_tag = get_le32(pb);
289+ st->codec->codec_tag = avio_rl32(pb);
290290 st->codec->codec_id = ff_codec_get_id(ff_rm_codec_tags,
291291 st->codec->codec_tag);
292292 // av_log(s, AV_LOG_DEBUG, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0'));
293293 if (st->codec->codec_id == CODEC_ID_NONE)
294294 goto fail1;
295− st->codec->width = get_be16(pb);
296− st->codec->height = get_be16(pb);
295+ st->codec->width = avio_rb16(pb);
296+ st->codec->height = avio_rb16(pb);
297297 st->codec->time_base.num= 1;
298− fps= get_be16(pb);
298+ fps= avio_rb16(pb);
299299 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
300− get_be32(pb);
301− fps2= get_be16(pb);
302− get_be16(pb);
300+ avio_rb32(pb);
301+ fps2= avio_rb16(pb);
302+ avio_rb16(pb);
303303
304304 if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (url_ftell(pb) - codec_pos))) < 0)
305305 return ret;
@@ -335,15 +335,15 @@ static int rm_read_index(AVFormatContext *s) · 29 unmodified lines
335335 AVStream *st;
336336
337337 do {
338− if (get_le32(pb) != MKTAG('I','N','D','X'))
338+ if (avio_rl32(pb) != MKTAG('I','N','D','X'))
339339 return -1;
340− size = get_be32(pb);
340+ size = avio_rb32(pb);
341341 if (size < 20)
342342 return -1;
343343 url_fskip(pb, 2);
344− n_pkts = get_be32(pb);
345− str_id = get_be16(pb);
346− next_off = get_be32(pb);
344+ n_pkts = avio_rb32(pb);
345+ str_id = avio_rb16(pb);
346+ next_off = avio_rb32(pb);
347347 for (n = 0; n < s->nb_streams; n++)
348348 if (s->streams[n]->id == str_id) {
349349 st = s->streams[n];
@@ -354,8 +354,8 @@ static int rm_read_index(AVFormatContext *s) · 4 unmodified lines
354354
355355 for (n = 0; n < n_pkts; n++) {
356356 url_fskip(pb, 2);
357− pts = get_be32(pb);
358− pos = get_be32(pb);
357+ pts = avio_rb32(pb);
358+ pos = avio_rb32(pb);
359359 url_fskip(pb, 4); /* packet no. */
360360
361361 av_add_index_entry(st, pos, pts, 0, 0, AVINDEX_KEYFRAME);
@@ -395,7 +395,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) · 33 unmodified lines
395395 char buf[128];
396396 int flags = 0;
397397
398− tag = get_le32(pb);
398+ tag = avio_rl32(pb);
399399 if (tag == MKTAG('.', 'r', 'a', 0xfd)) {
400400 /* very old .ra format */
401401 return rm_read_header_old(s, ap);
@@ -403,17 +403,17 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1 unmodified line
403403 return AVERROR(EIO);
404404 }
405405
406− get_be32(pb); /* header size */
407− get_be16(pb);
408− get_be32(pb);
409− get_be32(pb); /* number of headers */
406+ avio_rb32(pb); /* header size */
407+ avio_rb16(pb);
408+ avio_rb32(pb);
409+ avio_rb32(pb); /* number of headers */
410410
411411 for(;;) {
412412 if (url_feof(pb))
413413 return -1;
414− tag = get_le32(pb);
415− tag_size = get_be32(pb);
416− get_be16(pb);
414+ tag = avio_rl32(pb);
415+ tag_size = avio_rb32(pb);
416+ avio_rb16(pb);
417417 #if 0
418418 printf("tag=%c%c%c%c (%08x) size=%d\n",
419419 (tag) & 0xff,
@@ -428,17 +428,17 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) · 8 unmodified lines
428428 switch(tag) {
429429 case MKTAG('P', 'R', 'O', 'P'):
430430 /* file header */
431− get_be32(pb); /* max bit rate */
432− get_be32(pb); /* avg bit rate */
433− get_be32(pb); /* max packet size */
434− get_be32(pb); /* avg packet size */
435− get_be32(pb); /* nb packets */
436− get_be32(pb); /* duration */
437− get_be32(pb); /* preroll */
438− indx_off = get_be32(pb); /* index offset */
439− data_off = get_be32(pb); /* data offset */
440− get_be16(pb); /* nb streams */
441− flags = get_be16(pb); /* flags */
431+ avio_rb32(pb); /* max bit rate */
432+ avio_rb32(pb); /* avg bit rate */
433+ avio_rb32(pb); /* max packet size */
434+ avio_rb32(pb); /* avg packet size */
435+ avio_rb32(pb); /* nb packets */
436+ avio_rb32(pb); /* duration */
437+ avio_rb32(pb); /* preroll */
438+ indx_off = avio_rb32(pb); /* index offset */
439+ data_off = avio_rb32(pb); /* data offset */
440+ avio_rb16(pb); /* nb streams */
441+ flags = avio_rb16(pb); /* flags */
442442 break;
443443 case MKTAG('C', 'O', 'N', 'T'):
444444 rm_read_metadata(s, 1);
@@ -447,14 +447,14 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) · 2 unmodified lines
447447 st = av_new_stream(s, 0);
448448 if (!st)
449449 return AVERROR(ENOMEM);
450− st->id = get_be16(pb);
451− get_be32(pb); /* max bit rate */
452− st->codec->bit_rate = get_be32(pb); /* bit rate */
453− get_be32(pb); /* max packet size */
454− get_be32(pb); /* avg packet size */
455− start_time = get_be32(pb); /* start time */
456− get_be32(pb); /* preroll */
457− duration = get_be32(pb); /* duration */
450+ st->id = avio_rb16(pb);
451+ avio_rb32(pb); /* max bit rate */
452+ st->codec->bit_rate = avio_rb32(pb); /* bit rate */
453+ avio_rb32(pb); /* max packet size */
454+ avio_rb32(pb); /* avg packet size */
455+ start_time = avio_rb32(pb); /* start time */
456+ avio_rb32(pb); /* preroll */
457+ duration = avio_rb32(pb); /* duration */
458458 st->start_time = start_time;
459459 st->duration = duration;
460460 get_str8(pb, buf, sizeof(buf)); /* desc */
@@ -462,7 +462,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1 unmodified line
462462 st->codec->codec_type = AVMEDIA_TYPE_DATA;
463463 st->priv_data = ff_rm_alloc_rmstream();
464464 if (ff_rm_read_mdpr_codecdata(s, s->pb, st, st->priv_data,
465− get_be32(pb)) < 0)
465+ avio_rb32(pb)) < 0)
466466 return -1;
467467 break;
468468 case MKTAG('D', 'A', 'T', 'A'):
@@ -474,10 +474,10 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) · 5 unmodified lines
474474 }
475475 }
476476 header_end:
477− rm->nb_packets = get_be32(pb); /* number of packets */
477+ rm->nb_packets = avio_rb32(pb); /* number of packets */
478478 if (!rm->nb_packets && (flags & 4))
479479 rm->nb_packets = 3600 * 25;
480− get_be32(pb); /* next data header */
480+ avio_rb32(pb); /* next data header */
481481
482482 if (!data_off)
483483 data_off = url_ftell(pb) - 18;
@@ -494,13 +494,13 @@ static int get_num(AVIOContext *pb, int *len) · 10 unmodified lines
494494 {
495495 int n, n1;
496496
497− n = get_be16(pb);
497+ n = avio_rb16(pb);
498498 (*len)-=2;
499499 n &= 0x7FFF;
500500 if (n >= 0x4000) {
501501 return n - 0x4000;
502502 } else {
503− n1 = get_be16(pb);
503+ n1 = avio_rb16(pb);
504504 (*len)-=2;
505505 return (n << 16) | n1;
506506 }
@@ -524,13 +524,13 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ · 17 unmodified lines
524524 *timestamp = AV_NOPTS_VALUE;
525525 *flags= 0;
526526 }else{
527− state= (state<<8) + get_byte(pb);
527+ state= (state<<8) + avio_r8(pb);
528528
529529 if(state == MKBETAG('I', 'N', 'D', 'X')){
530530 int n_pkts, expected_len;
531− len = get_be32(pb);
531+ len = avio_rb32(pb);
532532 url_fskip(pb, 2);
533− n_pkts = get_be32(pb);
533+ n_pkts = avio_rb32(pb);
534534 expected_len = 20 + n_pkts * 14;
535535 if (len == 20)
536536 /* some files don't add index entries to chunk size... */
@@ -553,10 +553,10 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ · 16 unmodified lines
553553 len=state - 12;
554554 state= 0xFFFFFFFF;
555555
556− num = get_be16(pb);
557− *timestamp = get_be32(pb);
558− get_byte(pb); /* reserved */
559− *flags = get_byte(pb); /* flags */
556+ num = avio_rb16(pb);
557+ *timestamp = avio_rb32(pb);
558+ avio_r8(pb); /* reserved */
559+ *flags = avio_r8(pb); /* flags */
560560 }
561561 for(i=0;i<s->nb_streams;i++) {
562562 st = s->streams[i];
@@ -584,16 +584,16 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, · 21 unmodified lines
584584 int hdr, seq, pic_num, len2, pos;
585585 int type;
586586
587− hdr = get_byte(pb); len--;
587+ hdr = avio_r8(pb); len--;
588588 type = hdr >> 6;
589589
590590 if(type != 3){ // not frame as a part of packet
591− seq = get_byte(pb); len--;
591+ seq = avio_r8(pb); len--;
592592 }
593593 if(type != 1){ // not whole frame
594594 len2 = get_num(pb, &len);
595595 pos = get_num(pb, &len);
596− pic_num = get_byte(pb); len--;
596+ pic_num = avio_r8(pb); len--;
597597 }
598598 if(len<0)
599599 return -1;
@@ -609,7 +609,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, · 9 unmodified lines
609609 pkt->data[0] = 0;
610610 AV_WL32(pkt->data + 1, 1);
611611 AV_WL32(pkt->data + 5, 0);
612− get_buffer(pb, pkt->data + 9, len);
612+ avio_read(pb, pkt->data + 9, len);
613613 return 0;
614614 }
615615 //now we have to deal with single slice
@@ -635,7 +635,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, · 19 unmodified lines
635635 AV_WL32(vst->pkt.data - 3 + 8*vst->cur_slice, vst->videobufpos - 8*vst->slices - 1);
636636 if(vst->videobufpos + len > vst->videobufsize)
637637 return 1;
638− if (get_buffer(pb, vst->pkt.data + vst->videobufpos, len) != len)
638+ if (avio_read(pb, vst->pkt.data + vst->videobufpos, len) != len)
639639 return AVERROR(EIO);
640640 vst->videobufpos += len;
641641 rm->remaining_len-= len;
@@ -730,15 +730,15 @@ ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb, · 88 unmodified lines
730730 switch(st->codec->codec_id) {
731731 case CODEC_ID_RA_288:
732732 for (x = 0; x < h/2; x++)
733− get_buffer(pb, ast->pkt.data+x*2*w+y*cfs, cfs);
733+ avio_read(pb, ast->pkt.data+x*2*w+y*cfs, cfs);
734734 break;
735735 case CODEC_ID_ATRAC3:
736736 case CODEC_ID_COOK:
737737 for (x = 0; x < w/sps; x++)
738− get_buffer(pb, ast->pkt.data+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), sps);
738+ avio_read(pb, ast->pkt.data+sps*(h*x+((h+1)/2)*(y&1)+(y>>1)), sps);
739739 break;
740740 case CODEC_ID_SIPR:
741− get_buffer(pb, ast->pkt.data + y * w, w);
741+ avio_read(pb, ast->pkt.data + y * w, w);
742742 break;
743743 }
744744
@@ -753,10 +753,10 @@ ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb, · 8 unmodified lines
753753 } else if (st->codec->codec_id == CODEC_ID_AAC) {
754754 int x;
755755 rm->audio_stream_num = st->index;
756− ast->sub_packet_cnt = (get_be16(pb) & 0xf0) >> 4;
756+ ast->sub_packet_cnt = (avio_rb16(pb) & 0xf0) >> 4;
757757 if (ast->sub_packet_cnt) {
758758 for (x = 0; x < ast->sub_packet_cnt; x++)
759− ast->sub_packet_lengths[x] = get_be16(pb);
759+ ast->sub_packet_lengths[x] = avio_rb16(pb);
760760 rm->audio_pkt_cnt = ast->sub_packet_cnt;
761761 ast->audiotimestamp = timestamp;
762762 } else
@@ -916,9 +916,9 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index, · 153 unmodified lines
916916
917917 st = s->streams[stream_index2];
918918 if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
919− h= get_byte(s->pb); len--;
919+ h= avio_r8(s->pb); len--;
920920 if(!(h & 0x40)){
921− seq = get_byte(s->pb); len--;
921+ seq = avio_r8(s->pb); len--;
922922 }
923923 }
924924
libavformat/rpl.c+3−3
@@ -51,7 +51,7 @@ static int read_line(AVIOContext * pb, char* line, int bufsize) · 50 unmodified lines
5151 {
5252 int i;
5353 for (i = 0; i < bufsize - 1; i++) {
54− int b = get_byte(pb);
54+ int b = avio_r8(pb);
5555 if (b == 0)
5656 break;
5757 if (b == '\n') {
@@ -301,8 +301,8 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) · 243 unmodified lines
301301 // multiple frames per chunk in Escape 124 samples.
302302 uint32_t frame_size, frame_flags;
303303
304− frame_flags = get_le32(pb);
305− frame_size = get_le32(pb);
304+ frame_flags = avio_rl32(pb);
305+ frame_size = avio_rl32(pb);
306306 if (url_fseek(pb, -8, SEEK_CUR) < 0)
307307 return AVERROR(EIO);
308308
libavformat/rsodec.c+4−4
@@ -35,10 +35,10 @@ static int rso_read_header(AVFormatContext *s, AVFormatParameters *ap) · 34 unmodified lines
3535 enum CodecID codec;
3636 AVStream *st;
3737
38− id = get_be16(pb);
39− size = get_be16(pb);
40− rate = get_be16(pb);
41− get_be16(pb); /* play mode ? (0x0000 = don't loop) */
38+ id = avio_rb16(pb);
39+ size = avio_rb16(pb);
40+ rate = avio_rb16(pb);
41+ avio_rb16(pb); /* play mode ? (0x0000 = don't loop) */
4242
4343 codec = ff_codec_get_id(ff_codec_rso_tags, id);
4444
libavformat/rtpdec_asf.c+2−2
@@ -182,10 +182,10 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, · 181 unmodified lines
182182 while (url_ftell(pb) + 4 < len) {
183183 int start_off = url_ftell(pb);
184184
185− mflags = get_byte(pb);
185+ mflags = avio_r8(pb);
186186 if (mflags & 0x80)
187187 flags |= RTP_FLAG_KEY;
188− len_off = get_be24(pb);
188+ len_off = avio_rb24(pb);
189189 if (mflags & 0x20) /**< relative timestamp */
190190 url_fskip(pb, 4);
191191 if (mflags & 0x10) /**< has duration */
libavformat/rtpdec_qt.c+4−4
@@ -104,20 +104,20 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, · 103 unmodified lines
104104 data_len = get_bits(&gb, 16);
105105
106106 url_fseek(&pb, pos + 4, SEEK_SET);
107− tag = get_le32(&pb);
107+ tag = avio_rl32(&pb);
108108 if ((st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
109109 tag != MKTAG('v','i','d','e')) ||
110110 (st->codec->codec_type == AVMEDIA_TYPE_AUDIO &&
111111 tag != MKTAG('s','o','u','n')))
112112 return AVERROR_INVALIDDATA;
113− av_set_pts_info(st, 32, 1, get_be32(&pb));
113+ av_set_pts_info(st, 32, 1, avio_rb32(&pb));
114114
115115 if (pos + data_len > len)
116116 return AVERROR_INVALIDDATA;
117117 /* TLVs */
118118 while (url_ftell(&pb) + 4 < pos + data_len) {
119− int tlv_len = get_be16(&pb);
120− tag = get_le16(&pb);
119+ int tlv_len = avio_rb16(&pb);
120+ tag = avio_rl16(&pb);
121121 if (url_ftell(&pb) + tlv_len > pos + data_len)
122122 return AVERROR_INVALIDDATA;
123123
libavformat/rtsp.c+1−1
@@ -1784,7 +1784,7 @@ static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1783 unmodified lines
17841784 /* read the whole sdp file */
17851785 /* XXX: better loading */
17861786 content = av_malloc(SDP_MAX_SIZE);
1787− size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1);
1787+ size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
17881788 if (size <= 0) {
17891789 av_free(content);
17901790 return AVERROR_INVALIDDATA;
libavformat/sauce.c+10−10
@@ -36,13 +36,13 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g · 35 unmodified lines
3636 uint64_t start_pos = url_fsize(pb) - 128;
3737
3838 url_fseek(pb, start_pos, SEEK_SET);
39− if (get_buffer(pb, buf, 7) != 7)
39+ if (avio_read(pb, buf, 7) != 7)
4040 return -1;
4141 if (memcmp(buf, "SAUCE00", 7))
4242 return -1;
4343
4444 #define GET_SAUCE_META(name,size) \
45− if (get_buffer(pb, buf, size) == size && buf[0]) { \
45+ if (avio_read(pb, buf, size) == size && buf[0]) { \
4646 buf[size] = 0; \
4747 av_metadata_set2(&avctx->metadata, name, buf, 0); \
4848 }
@@ -52,12 +52,12 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g · 3 unmodified lines
5252 GET_SAUCE_META("publisher", 20)
5353 GET_SAUCE_META("date", 8)
5454 url_fskip(pb, 4);
55− datatype = get_byte(pb);
56− filetype = get_byte(pb);
57− t1 = get_le16(pb);
58− t2 = get_le16(pb);
59− nb_comments = get_byte(pb);
60− flags = get_byte(pb);
55+ datatype = avio_r8(pb);
56+ filetype = avio_r8(pb);
57+ t1 = avio_rl16(pb);
58+ t2 = avio_rl16(pb);
59+ nb_comments = avio_r8(pb);
60+ flags = avio_r8(pb);
6161 url_fskip(pb, 4);
6262 GET_SAUCE_META("encoder", 22);
6363
@@ -83,14 +83,14 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g · 19 unmodified lines
8383
8484 if (nb_comments > 0) {
8585 url_fseek(pb, start_pos - 64*nb_comments - 5, SEEK_SET);
86− if (get_buffer(pb, buf, 5) == 5 && !memcmp(buf, "COMNT", 5)) {
86+ if (avio_read(pb, buf, 5) == 5 && !memcmp(buf, "COMNT", 5)) {
8787 int i;
8888 char *str = av_malloc(65*nb_comments + 1);
8989 *fsize -= 64*nb_comments + 5;
9090 if (!str)
9191 return 0;
9292 for (i = 0; i < nb_comments; i++) {
93− if (get_buffer(pb, str + 65*i, 64) != 64)
93+ if (avio_read(pb, str + 65*i, 64) != 64)
9494 break;
9595 str[65*i + 64] = '\n';
9696 }
libavformat/segafilm.c+7−7
@@ -89,7 +89,7 @@ static int film_read_header(AVFormatContext *s, · 88 unmodified lines
8989 film->stereo_buffer_size = 0;
9090
9191 /* load the main FILM header */
92− if (get_buffer(pb, scratch, 16) != 16)
92+ if (avio_read(pb, scratch, 16) != 16)
9393 return AVERROR(EIO);
9494 data_offset = AV_RB32(&scratch[4]);
9595 film->version = AV_RB32(&scratch[8]);
@@ -97,7 +97,7 @@ static int film_read_header(AVFormatContext *s, · 1 unmodified line
9797 /* load the FDSC chunk */
9898 if (film->version == 0) {
9999 /* special case for Lemmings .film files; 20-byte header */
100− if (get_buffer(pb, scratch, 20) != 20)
100+ if (avio_read(pb, scratch, 20) != 20)
101101 return AVERROR(EIO);
102102 /* make some assumptions about the audio parameters */
103103 film->audio_type = CODEC_ID_PCM_S8;
@@ -106,7 +106,7 @@ static int film_read_header(AVFormatContext *s, · 2 unmodified lines
106106 film->audio_bits = 8;
107107 } else {
108108 /* normal Saturn .cpk files; 32-byte header */
109− if (get_buffer(pb, scratch, 32) != 32)
109+ if (avio_read(pb, scratch, 32) != 32)
110110 return AVERROR(EIO);
111111 film->audio_samplerate = AV_RB16(&scratch[24]);
112112 film->audio_channels = scratch[21];
@@ -158,7 +158,7 @@ static int film_read_header(AVFormatContext *s, · 45 unmodified lines
158158 }
159159
160160 /* load the sample table */
161− if (get_buffer(pb, scratch, 16) != 16)
161+ if (avio_read(pb, scratch, 16) != 16)
162162 return AVERROR(EIO);
163163 if (AV_RB32(&scratch[0]) != STAB_TAG)
164164 return AVERROR_INVALIDDATA;
@@ -174,7 +174,7 @@ static int film_read_header(AVFormatContext *s, · 9 unmodified lines
174174 audio_frame_counter = 0;
175175 for (i = 0; i < film->sample_count; i++) {
176176 /* load the next sample record and transfer it to an internal struct */
177− if (get_buffer(pb, scratch, 16) != 16) {
177+ if (avio_read(pb, scratch, 16) != 16) {
178178 av_free(film->sample_table);
179179 return AVERROR(EIO);
180180 }
@@ -225,7 +225,7 @@ static int film_read_packet(AVFormatContext *s, · 44 unmodified lines
225225 pkt->pos= url_ftell(pb);
226226 if (av_new_packet(pkt, sample->sample_size))
227227 return AVERROR(ENOMEM);
228− get_buffer(pb, pkt->data, sample->sample_size);
228+ avio_read(pb, pkt->data, sample->sample_size);
229229 } else if ((sample->stream == film->audio_stream_index) &&
230230 (film->audio_channels == 2)) {
231231 /* stereo PCM needs to be interleaved */
@@ -241,7 +241,7 @@ static int film_read_packet(AVFormatContext *s, · 9 unmodified lines
241241 }
242242
243243 pkt->pos= url_ftell(pb);
244− ret = get_buffer(pb, film->stereo_buffer, sample->sample_size);
244+ ret = avio_read(pb, film->stereo_buffer, sample->sample_size);
245245 if (ret != sample->sample_size)
246246 ret = AVERROR(EIO);
247247
libavformat/sierravmd.c+5−5
@@ -96,7 +96,7 @@ static int vmd_read_header(AVFormatContext *s, · 95 unmodified lines
9696
9797 /* fetch the main header, including the 2 header length bytes */
9898 url_fseek(pb, 0, SEEK_SET);
99− if (get_buffer(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE)
99+ if (avio_read(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE)
100100 return AVERROR(EIO);
101101
102102 if(vmd->vmd_header[16] == 'i' && vmd->vmd_header[17] == 'v' && vmd->vmd_header[18] == '3')
@@ -172,7 +172,7 @@ static int vmd_read_header(AVFormatContext *s, · 69 unmodified lines
172172 av_free(vmd->frame_table);
173173 return AVERROR(ENOMEM);
174174 }
175− if (get_buffer(pb, raw_frame_table, raw_frame_table_size) !=
175+ if (avio_read(pb, raw_frame_table, raw_frame_table_size) !=
176176 raw_frame_table_size) {
177177 av_free(raw_frame_table);
178178 av_free(vmd->frame_table);
@@ -189,7 +189,7 @@ static int vmd_read_header(AVFormatContext *s, · 10 unmodified lines
189189 int type;
190190 uint32_t size;
191191
192− get_buffer(pb, chunk, BYTES_PER_FRAME_RECORD);
192+ avio_read(pb, chunk, BYTES_PER_FRAME_RECORD);
193193 type = chunk[0];
194194 size = AV_RL32(&chunk[2]);
195195 if(!size && type != 1)
@@ -250,9 +250,9 @@ static int vmd_read_packet(AVFormatContext *s, · 54 unmodified lines
250250 pkt->pos= url_ftell(pb);
251251 memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD);
252252 if(vmd->is_indeo3)
253− ret = get_buffer(pb, pkt->data, frame->frame_size);
253+ ret = avio_read(pb, pkt->data, frame->frame_size);
254254 else
255− ret = get_buffer(pb, pkt->data + BYTES_PER_FRAME_RECORD,
255+ ret = avio_read(pb, pkt->data + BYTES_PER_FRAME_RECORD,
256256 frame->frame_size);
257257
258258 if (ret != frame->frame_size) {
libavformat/siff.c+20−20
@@ -89,28 +89,28 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) · 88 unmodified lines
8989 AVStream *st;
9090 int width, height;
9191
92− if (get_le32(pb) != TAG_VBHD){
92+ if (avio_rl32(pb) != TAG_VBHD){
9393 av_log(s, AV_LOG_ERROR, "Header chunk is missing\n");
9494 return -1;
9595 }
96− if(get_be32(pb) != 32){
96+ if(avio_rb32(pb) != 32){
9797 av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n");
9898 return -1;
9999 }
100− if(get_le16(pb) != 1){
100+ if(avio_rl16(pb) != 1){
101101 av_log(s, AV_LOG_ERROR, "Incorrect header version\n");
102102 return -1;
103103 }
104− width = get_le16(pb);
105− height = get_le16(pb);
104+ width = avio_rl16(pb);
105+ height = avio_rl16(pb);
106106 url_fskip(pb, 4);
107− c->frames = get_le16(pb);
107+ c->frames = avio_rl16(pb);
108108 if(!c->frames){
109109 av_log(s, AV_LOG_ERROR, "File contains no frames ???\n");
110110 return -1;
111111 }
112− c->bits = get_le16(pb);
113− c->rate = get_le16(pb);
112+ c->bits = avio_rl16(pb);
113+ c->rate = avio_rl16(pb);
114114 c->block_align = c->rate * (c->bits >> 3);
115115
116116 url_fskip(pb, 16); //zeroes
@@ -137,17 +137,17 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) · 20 unmodified lines
137137
138138 static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, AVIOContext *pb)
139139 {
140− if (get_le32(pb) != TAG_SHDR){
140+ if (avio_rl32(pb) != TAG_SHDR){
141141 av_log(s, AV_LOG_ERROR, "Header chunk is missing\n");
142142 return -1;
143143 }
144− if(get_be32(pb) != 8){
144+ if(avio_rb32(pb) != 8){
145145 av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n");
146146 return -1;
147147 }
148148 url_fskip(pb, 4); //unknown value
149− c->rate = get_le16(pb);
150− c->bits = get_le16(pb);
149+ c->rate = avio_rl16(pb);
150+ c->bits = avio_rl16(pb);
151151 c->block_align = c->rate * (c->bits >> 3);
152152 return create_audio_stream(s, c);
153153 }
@@ -158,10 +158,10 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap) · 4 unmodified lines
158158 SIFFContext *c = s->priv_data;
159159 uint32_t tag;
160160
161− if (get_le32(pb) != TAG_SIFF)
161+ if (avio_rl32(pb) != TAG_SIFF)
162162 return -1;
163163 url_fskip(pb, 4); //ignore size
164− tag = get_le32(pb);
164+ tag = avio_rl32(pb);
165165
166166 if (tag != TAG_VBV1 && tag != TAG_SOUN){
167167 av_log(s, AV_LOG_ERROR, "Not a VBV file\n");
@@ -172,7 +172,7 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap) · 4 unmodified lines
172172 return -1;
173173 if (tag == TAG_SOUN && siff_parse_soun(s, c, pb) < 0)
174174 return -1;
175− if (get_le32(pb) != MKTAG('B', 'O', 'D', 'Y')){
175+ if (avio_rl32(pb) != MKTAG('B', 'O', 'D', 'Y')){
176176 av_log(s, AV_LOG_ERROR, "'BODY' chunk is missing\n");
177177 return -1;
178178 }
@@ -190,12 +190,12 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt) · 11 unmodified lines
190190 if (c->cur_frame >= c->frames)
191191 return AVERROR(EIO);
192192 if (c->curstrm == -1){
193− c->pktsize = get_le32(s->pb) - 4;
194− c->flags = get_le16(s->pb);
193+ c->pktsize = avio_rl32(s->pb) - 4;
194+ c->flags = avio_rl16(s->pb);
195195 c->gmcsize = (c->flags & VB_HAS_GMC) ? 4 : 0;
196196 if (c->gmcsize)
197− get_buffer(s->pb, c->gmc, c->gmcsize);
198− c->sndsize = (c->flags & VB_HAS_AUDIO) ? get_le32(s->pb): 0;
197+ avio_read(s->pb, c->gmc, c->gmcsize);
198+ c->sndsize = (c->flags & VB_HAS_AUDIO) ? avio_rl32(s->pb): 0;
199199 c->curstrm = !!(c->flags & VB_HAS_AUDIO);
200200 }
201201
@@ -206,7 +206,7 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt) · 4 unmodified lines
206206 AV_WL16(pkt->data, c->flags);
207207 if (c->gmcsize)
208208 memcpy(pkt->data + 2, c->gmc, c->gmcsize);
209− get_buffer(s->pb, pkt->data + 2 + c->gmcsize, size - c->gmcsize - 2);
209+ avio_read(s->pb, pkt->data + 2 + c->gmcsize, size - c->gmcsize - 2);
210210 pkt->stream_index = 0;
211211 c->curstrm = -1;
212212 }else{
libavformat/smacker.c+25−25
@@ -105,19 +105,19 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) · 104 unmodified lines
105105 int tbase;
106106
107107 /* read and check header */
108− smk->magic = get_le32(pb);
108+ smk->magic = avio_rl32(pb);
109109 if (smk->magic != MKTAG('S', 'M', 'K', '2') && smk->magic != MKTAG('S', 'M', 'K', '4'))
110110 return -1;
111− smk->width = get_le32(pb);
112− smk->height = get_le32(pb);
113− smk->frames = get_le32(pb);
114− smk->pts_inc = (int32_t)get_le32(pb);
115− smk->flags = get_le32(pb);
111+ smk->width = avio_rl32(pb);
112+ smk->height = avio_rl32(pb);
113+ smk->frames = avio_rl32(pb);
114+ smk->pts_inc = (int32_t)avio_rl32(pb);
115+ smk->flags = avio_rl32(pb);
116116 if(smk->flags & SMACKER_FLAG_RING_FRAME)
117117 smk->frames++;
118118 for(i = 0; i < 7; i++)
119− smk->audio[i] = get_le32(pb);
120− smk->treesize = get_le32(pb);
119+ smk->audio[i] = avio_rl32(pb);
120+ smk->treesize = avio_rl32(pb);
121121
122122 if(smk->treesize >= UINT_MAX/4){ // smk->treesize + 16 must not overflow (this check is probably redundant)
123123 av_log(s, AV_LOG_ERROR, "treesize too large\n");
@@ -125,13 +125,13 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1 unmodified line
125125 }
126126
127127 //FIXME remove extradata "rebuilding"
128− smk->mmap_size = get_le32(pb);
129− smk->mclr_size = get_le32(pb);
130− smk->full_size = get_le32(pb);
131− smk->type_size = get_le32(pb);
128+ smk->mmap_size = avio_rl32(pb);
129+ smk->mclr_size = avio_rl32(pb);
130+ smk->full_size = avio_rl32(pb);
131+ smk->type_size = avio_rl32(pb);
132132 for(i = 0; i < 7; i++)
133− smk->rates[i] = get_le32(pb);
134− smk->pad = get_le32(pb);
133+ smk->rates[i] = avio_rl32(pb);
134+ smk->pad = avio_rl32(pb);
135135 /* setup data */
136136 if(smk->frames > 0xFFFFFF) {
137137 av_log(s, AV_LOG_ERROR, "Too many frames: %i\n", smk->frames);
@@ -144,10 +144,10 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) · 6 unmodified lines
144144
145145 /* read frame info */
146146 for(i = 0; i < smk->frames; i++) {
147− smk->frm_size[i] = get_le32(pb);
147+ smk->frm_size[i] = avio_rl32(pb);
148148 }
149149 for(i = 0; i < smk->frames; i++) {
150− smk->frm_flags[i] = get_byte(pb);
150+ smk->frm_flags[i] = avio_r8(pb);
151151 }
152152
153153 /* init video codec */
@@ -207,7 +207,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) · 53 unmodified lines
207207 av_free(smk->frm_flags);
208208 return -1;
209209 }
210− ret = get_buffer(pb, st->codec->extradata + 16, st->codec->extradata_size - 16);
210+ ret = avio_read(pb, st->codec->extradata + 16, st->codec->extradata_size - 16);
211211 if(ret != st->codec->extradata_size - 16){
212212 av_free(smk->frm_size);
213213 av_free(smk->frm_flags);
@@ -251,19 +251,19 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) · 37 unmodified lines
251251 uint8_t oldpal[768];
252252
253253 memcpy(oldpal, pal, 768);
254− size = get_byte(s->pb);
254+ size = avio_r8(s->pb);
255255 size = size * 4 - 1;
256256 frame_size -= size;
257257 frame_size--;
258258 sz = 0;
259259 pos = url_ftell(s->pb) + size;
260260 while(sz < 256){
261− t = get_byte(s->pb);
261+ t = avio_r8(s->pb);
262262 if(t & 0x80){ /* skip palette entries */
263263 sz += (t & 0x7F) + 1;
264264 pal += ((t & 0x7F) + 1) * 3;
265265 } else if(t & 0x40){ /* copy with offset */
266− off = get_byte(s->pb) * 3;
266+ off = avio_r8(s->pb) * 3;
267267 j = (t & 0x3F) + 1;
268268 while(j-- && sz < 256) {
269269 *pal++ = oldpal[off + 0];
@@ -274,8 +274,8 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) · 4 unmodified lines
274274 }
275275 } else { /* new entries */
276276 *pal++ = smk_pal[t];
277− *pal++ = smk_pal[get_byte(s->pb) & 0x3F];
278− *pal++ = smk_pal[get_byte(s->pb) & 0x3F];
277+ *pal++ = smk_pal[avio_r8(s->pb) & 0x3F];
278+ *pal++ = smk_pal[avio_r8(s->pb) & 0x3F];
279279 sz++;
280280 }
281281 }
@@ -288,13 +288,13 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) · 6 unmodified lines
288288 for(i = 0; i < 7; i++) {
289289 if(flags & 1) {
290290 int size;
291− size = get_le32(s->pb) - 4;
291+ size = avio_rl32(s->pb) - 4;
292292 frame_size -= size;
293293 frame_size -= 4;
294294 smk->curstream++;
295295 smk->bufs[smk->curstream] = av_realloc(smk->bufs[smk->curstream], size);
296296 smk->buf_sizes[smk->curstream] = size;
297− ret = get_buffer(s->pb, smk->bufs[smk->curstream], size);
297+ ret = avio_read(s->pb, smk->bufs[smk->curstream], size);
298298 if(ret != size)
299299 return AVERROR(EIO);
300300 smk->stream_id[smk->curstream] = smk->indexes[i];
@@ -307,7 +307,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) · 6 unmodified lines
307307 palchange |= 2;
308308 pkt->data[0] = palchange;
309309 memcpy(pkt->data + 1, smk->pal, 768);
310− ret = get_buffer(s->pb, pkt->data + 769, frame_size);
310+ ret = avio_read(s->pb, pkt->data + 769, frame_size);
311311 if(ret != frame_size)
312312 return AVERROR(EIO);
313313 pkt->stream_index = smk->videoindex;
libavformat/sol.c+6−6
@@ -93,15 +93,15 @@ static int sol_read_header(AVFormatContext *s, · 92 unmodified lines
9393 AVStream *st;
9494
9595 /* check ".snd" header */
96− magic = get_le16(pb);
97− tag = get_le32(pb);
96+ magic = avio_rl16(pb);
97+ tag = avio_rl32(pb);
9898 if (tag != MKTAG('S', 'O', 'L', 0))
9999 return -1;
100− rate = get_le16(pb);
101− type = get_byte(pb);
102− size = get_le32(pb);
100+ rate = avio_rl16(pb);
101+ type = avio_r8(pb);
102+ size = avio_rl32(pb);
103103 if (magic != 0x0B8D)
104− get_byte(pb); /* newer SOLs contain padding byte */
104+ avio_r8(pb); /* newer SOLs contain padding byte */
105105
106106 codec = sol_codec_id(magic, type);
107107 channels = sol_channels(magic, type);
libavformat/soxdec.c+10−10
@@ -55,20 +55,20 @@ static int sox_read_header(AVFormatContext *s, · 54 unmodified lines
5555
5656 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
5757
58− if (get_le32(pb) == SOX_TAG) {
58+ if (avio_rl32(pb) == SOX_TAG) {
5959 st->codec->codec_id = CODEC_ID_PCM_S32LE;
60− header_size = get_le32(pb);
60+ header_size = avio_rl32(pb);
6161 url_fskip(pb, 8); /* sample count */
62− sample_rate = av_int2dbl(get_le64(pb));
63− st->codec->channels = get_le32(pb);
64− comment_size = get_le32(pb);
62+ sample_rate = av_int2dbl(avio_rl64(pb));
63+ st->codec->channels = avio_rl32(pb);
64+ comment_size = avio_rl32(pb);
6565 } else {
6666 st->codec->codec_id = CODEC_ID_PCM_S32BE;
67− header_size = get_be32(pb);
67+ header_size = avio_rb32(pb);
6868 url_fskip(pb, 8); /* sample count */
69− sample_rate = av_int2dbl(get_be64(pb));
70− st->codec->channels = get_be32(pb);
71− comment_size = get_be32(pb);
69+ sample_rate = av_int2dbl(avio_rb64(pb));
70+ st->codec->channels = avio_rb32(pb);
71+ comment_size = avio_rb32(pb);
7272 }
7373
7474 if (comment_size > 0xFFFFFFFFU - SOX_FIXED_HDR - 4U) {
@@ -95,7 +95,7 @@ static int sox_read_header(AVFormatContext *s, · 20 unmodified lines
9595
9696 if (comment_size && comment_size < UINT_MAX) {
9797 char *comment = av_malloc(comment_size+1);
98− if (get_buffer(pb, comment, comment_size) != comment_size) {
98+ if (avio_read(pb, comment, comment_size) != comment_size) {
9999 av_freep(&comment);
100100 return AVERROR(EIO);
101101 }
libavformat/spdifdec.c+4−4
@@ -170,13 +170,13 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) · 169 unmodified lines
170170 int pkt_size_bits, offset, ret;
171171
172172 while (state != (AV_BSWAP16C(SYNCWORD1) << 16 | AV_BSWAP16C(SYNCWORD2))) {
173− state = (state << 8) | get_byte(pb);
173+ state = (state << 8) | avio_r8(pb);
174174 if (url_feof(pb))
175175 return AVERROR_EOF;
176176 }
177177
178− data_type = get_le16(pb);
179− pkt_size_bits = get_le16(pb);
178+ data_type = avio_rl16(pb);
179+ pkt_size_bits = avio_rl16(pb);
180180
181181 if (pkt_size_bits % 16)
182182 av_log_ask_for_sample(s, "Packet does not end to a 16-bit boundary.");
@@ -187,7 +187,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) · 4 unmodified lines
187187
188188 pkt->pos = url_ftell(pb) - BURST_HEADER_SIZE;
189189
190− if (get_buffer(pb, pkt->data, pkt->size) < pkt->size) {
190+ if (avio_read(pb, pkt->data, pkt->size) < pkt->size) {
191191 av_free_packet(pkt);
192192 return AVERROR_EOF;
193193 }
libavformat/swfdec.c+22−22
@@ -30,11 +30,11 @@ static int get_swf_tag(AVIOContext *pb, int *len_ptr) · 29 unmodified lines
3030 if (url_feof(pb))
3131 return -1;
3232
33− tag = get_le16(pb);
33+ tag = avio_rl16(pb);
3434 len = tag & 0x3f;
3535 tag = tag >> 6;
3636 if (len == 0x3f) {
37− len = get_le32(pb);
37+ len = avio_rl32(pb);
3838 }
3939 // av_log(NULL, AV_LOG_DEBUG, "Tag: %d - Len: %d\n", tag, len);
4040 *len_ptr = len;
@@ -58,7 +58,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 17 unmodified lines
5858 AVIOContext *pb = s->pb;
5959 int nbits, len, tag;
6060
61− tag = get_be32(pb) & 0xffffff00;
61+ tag = avio_rb32(pb) & 0xffffff00;
6262
6363 if (tag == MKBETAG('C', 'W', 'S', 0)) {
6464 av_log(s, AV_LOG_ERROR, "Compressed SWF format not supported\n");
@@ -66,13 +66,13 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1 unmodified line
6666 }
6767 if (tag != MKBETAG('F', 'W', 'S', 0))
6868 return AVERROR(EIO);
69− get_le32(pb);
69+ avio_rl32(pb);
7070 /* skip rectangle size */
71− nbits = get_byte(pb) >> 3;
71+ nbits = avio_r8(pb) >> 3;
7272 len = (4 * nbits - 3 + 7) / 8;
7373 url_fskip(pb, len);
74− swf->frame_rate = get_le16(pb); /* 8.8 fixed */
75− get_le16(pb); /* frame count */
74+ swf->frame_rate = avio_rl16(pb); /* 8.8 fixed */
75+ avio_rl16(pb); /* frame count */
7676
7777 swf->samples_per_frame = 0;
7878 s->ctx_flags |= AVFMTCTX_NOHEADER;
@@ -92,7 +92,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) · 13 unmodified lines
9292 if (tag < 0)
9393 return AVERROR(EIO);
9494 if (tag == TAG_VIDEOSTREAM) {
95− int ch_id = get_le16(pb);
95+ int ch_id = avio_rl16(pb);
9696 len -= 2;
9797
9898 for (i=0; i<s->nb_streams; i++) {
@@ -101,16 +101,16 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) · 2 unmodified lines
101101 goto skip;
102102 }
103103
104− get_le16(pb);
105− get_le16(pb);
106− get_le16(pb);
107− get_byte(pb);
104+ avio_rl16(pb);
105+ avio_rl16(pb);
106+ avio_rl16(pb);
107+ avio_r8(pb);
108108 /* Check for FLV1 */
109109 vst = av_new_stream(s, ch_id);
110110 if (!vst)
111111 return -1;
112112 vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
113− vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, get_byte(pb));
113+ vst->codec->codec_id = ff_codec_get_id(swf_codec_tags, avio_r8(pb));
114114 av_set_pts_info(vst, 16, 256, swf->frame_rate);
115115 vst->codec->time_base = (AVRational){ 256, swf->frame_rate };
116116 len -= 8;
@@ -124,9 +124,9 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) · 7 unmodified lines
124124 goto skip;
125125 }
126126
127− get_byte(pb);
128− v = get_byte(pb);
129− swf->samples_per_frame = get_le16(pb);
127+ avio_r8(pb);
128+ v = avio_r8(pb);
129+ swf->samples_per_frame = avio_rl16(pb);
130130 ast = av_new_stream(s, -1); /* -1 to avoid clash with video stream ch_id */
131131 if (!ast)
132132 return -1;
@@ -141,12 +141,12 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) · 8 unmodified lines
141141 av_set_pts_info(ast, 64, 1, ast->codec->sample_rate);
142142 len -= 4;
143143 } else if (tag == TAG_VIDEOFRAME) {
144− int ch_id = get_le16(pb);
144+ int ch_id = avio_rl16(pb);
145145 len -= 2;
146146 for(i=0; i<s->nb_streams; i++) {
147147 st = s->streams[i];
148148 if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id) {
149− frame = get_le16(pb);
149+ frame = avio_rl16(pb);
150150 av_get_packet(pb, pkt, len-2);
151151 pkt->pos = pos;
152152 pkt->pts = frame;
@@ -185,17 +185,17 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) · 32 unmodified lines
185185 vst->codec->time_base = (AVRational){ 256, swf->frame_rate };
186186 st = vst;
187187 }
188− get_le16(pb); /* BITMAP_ID */
188+ avio_rl16(pb); /* BITMAP_ID */
189189 av_new_packet(pkt, len-2);
190− get_buffer(pb, pkt->data, 4);
190+ avio_read(pb, pkt->data, 4);
191191 if (AV_RB32(pkt->data) == 0xffd8ffd9 ||
192192 AV_RB32(pkt->data) == 0xffd9ffd8) {
193193 /* old SWF files containing SOI/EOI as data start */
194194 /* files created by swink have reversed tag */
195195 pkt->size -= 4;
196− get_buffer(pb, pkt->data, pkt->size);
196+ avio_read(pb, pkt->data, pkt->size);
197197 } else {
198− get_buffer(pb, pkt->data + 4, pkt->size - 4);
198+ avio_read(pb, pkt->data + 4, pkt->size - 4);
199199 }
200200 pkt->pos = pos;
201201 pkt->stream_index = st->index;
libavformat/thp.c+23−23
@@ -61,31 +61,31 @@ static int thp_read_header(AVFormatContext *s, · 60 unmodified lines
6161 int i;
6262
6363 /* Read the file header. */
64− get_be32(pb); /* Skip Magic. */
65− thp->version = get_be32(pb);
64+ avio_rb32(pb); /* Skip Magic. */
65+ thp->version = avio_rb32(pb);
6666
67− get_be32(pb); /* Max buf size. */
68− get_be32(pb); /* Max samples. */
67+ avio_rb32(pb); /* Max buf size. */
68+ avio_rb32(pb); /* Max samples. */
6969
70− thp->fps = av_d2q(av_int2flt(get_be32(pb)), INT_MAX);
71− thp->framecnt = get_be32(pb);
72− thp->first_framesz = get_be32(pb);
73− get_be32(pb); /* Data size. */
70+ thp->fps = av_d2q(av_int2flt(avio_rb32(pb)), INT_MAX);
71+ thp->framecnt = avio_rb32(pb);
72+ thp->first_framesz = avio_rb32(pb);
73+ avio_rb32(pb); /* Data size. */
7474
75− thp->compoff = get_be32(pb);
76− get_be32(pb); /* offsetDataOffset. */
77− thp->first_frame = get_be32(pb);
78− thp->last_frame = get_be32(pb);
75+ thp->compoff = avio_rb32(pb);
76+ avio_rb32(pb); /* offsetDataOffset. */
77+ thp->first_frame = avio_rb32(pb);
78+ thp->last_frame = avio_rb32(pb);
7979
8080 thp->next_framesz = thp->first_framesz;
8181 thp->next_frame = thp->first_frame;
8282
8383 /* Read the component structure. */
8484 url_fseek (pb, thp->compoff, SEEK_SET);
85− thp->compcount = get_be32(pb);
85+ thp->compcount = avio_rb32(pb);
8686
8787 /* Read the list of component types. */
88− get_buffer(pb, thp->components, 16);
88+ avio_read(pb, thp->components, 16);
8989
9090 for (i = 0; i < thp->compcount; i++) {
9191 if (thp->components[i] == 0) {
@@ -103,14 +103,14 @@ static int thp_read_header(AVFormatContext *s, · 11 unmodified lines
103103 st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
104104 st->codec->codec_id = CODEC_ID_THP;
105105 st->codec->codec_tag = 0; /* no fourcc */
106− st->codec->width = get_be32(pb);
107− st->codec->height = get_be32(pb);
106+ st->codec->width = avio_rb32(pb);
107+ st->codec->height = avio_rb32(pb);
108108 st->codec->sample_rate = av_q2d(thp->fps);
109109 thp->vst = st;
110110 thp->video_stream_index = st->index;
111111
112112 if (thp->version == 0x11000)
113− get_be32(pb); /* Unknown. */
113+ avio_rb32(pb); /* Unknown. */
114114 } else if (thp->components[i] == 1) {
115115 if (thp->has_audio != 0)
116116 break;
@@ -123,8 +123,8 @@ static int thp_read_header(AVFormatContext *s, · 6 unmodified lines
123123 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
124124 st->codec->codec_id = CODEC_ID_ADPCM_THP;
125125 st->codec->codec_tag = 0; /* no fourcc */
126− st->codec->channels = get_be32(pb); /* numChannels. */
127− st->codec->sample_rate = get_be32(pb); /* Frequency. */
126+ st->codec->channels = avio_rb32(pb); /* numChannels. */
127+ st->codec->sample_rate = avio_rb32(pb); /* Frequency. */
128128
129129 av_set_pts_info(st, 64, 1, st->codec->sample_rate);
130130
@@ -153,15 +153,15 @@ static int thp_read_packet(AVFormatContext *s, · 22 unmodified lines
153153
154154 /* Locate the next frame and read out its size. */
155155 thp->next_frame += thp->next_framesz;
156− thp->next_framesz = get_be32(pb);
156+ thp->next_framesz = avio_rb32(pb);
157157
158− get_be32(pb); /* Previous total size. */
159− size = get_be32(pb); /* Total size of this frame. */
158+ avio_rb32(pb); /* Previous total size. */
159+ size = avio_rb32(pb); /* Total size of this frame. */
160160
161161 /* Store the audiosize so the next time this function is called,
162162 the audio can be read. */
163163 if (thp->has_audio)
164− thp->audiosize = get_be32(pb); /* Audio size. */
164+ thp->audiosize = avio_rb32(pb); /* Audio size. */
165165 else
166166 thp->frame++;
167167
libavformat/tiertexseq.c+7−7
@@ -86,7 +86,7 @@ static int seq_init_frame_buffers(SeqDemuxContext *seq, AVIOContext *pb) · 85 unmodified lines
8686 url_fseek(pb, 256, SEEK_SET);
8787
8888 for (i = 0; i < SEQ_NUM_FRAME_BUFFERS; i++) {
89− sz = get_le16(pb);
89+ sz = avio_rl16(pb);
9090 if (sz == 0)
9191 break;
9292 else {
@@ -114,7 +114,7 @@ static int seq_fill_buffer(SeqDemuxContext *seq, AVIOContext *pb, int buffer_num · 21 unmodified lines
114114 return AVERROR_INVALIDDATA;
115115
116116 url_fseek(pb, seq->current_frame_offs + data_offs, SEEK_SET);
117− if (get_buffer(pb, seq_buffer->data + seq_buffer->fill_size, data_size) != data_size)
117+ if (avio_read(pb, seq_buffer->data + seq_buffer->fill_size, data_size) != data_size)
118118 return AVERROR(EIO);
119119
120120 seq_buffer->fill_size += data_size;
@@ -131,7 +131,7 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, AVIOContext *pb) · 10 unmodified lines
131131 url_fseek(pb, seq->current_frame_offs, SEEK_SET);
132132
133133 /* sound data */
134− seq->current_audio_data_offs = get_le16(pb);
134+ seq->current_audio_data_offs = avio_rl16(pb);
135135 if (seq->current_audio_data_offs) {
136136 seq->current_audio_data_size = SEQ_AUDIO_BUFFER_SIZE * 2;
137137 } else {
@@ -139,7 +139,7 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, AVIOContext *pb) · 1 unmodified line
139139 }
140140
141141 /* palette data */
142− seq->current_pal_data_offs = get_le16(pb);
142+ seq->current_pal_data_offs = avio_rl16(pb);
143143 if (seq->current_pal_data_offs) {
144144 seq->current_pal_data_size = 768;
145145 } else {
@@ -148,10 +148,10 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, AVIOContext *pb) · 2 unmodified lines
148148
149149 /* video data */
150150 for (i = 0; i < 4; i++)
151− buffer_num[i] = get_byte(pb);
151+ buffer_num[i] = avio_r8(pb);
152152
153153 for (i = 0; i < 4; i++)
154− offset_table[i] = get_le16(pb);
154+ offset_table[i] = avio_rl16(pb);
155155
156156 for (i = 0; i < 3; i++) {
157157 if (offset_table[i]) {
@@ -257,7 +257,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt) · 99 unmodified lines
257257 if (seq->current_pal_data_size) {
258258 pkt->data[0] |= 1;
259259 url_fseek(pb, seq->current_frame_offs + seq->current_pal_data_offs, SEEK_SET);
260− if (get_buffer(pb, &pkt->data[1], seq->current_pal_data_size) != seq->current_pal_data_size)
260+ if (avio_read(pb, &pkt->data[1], seq->current_pal_data_size) != seq->current_pal_data_size)
261261 return AVERROR(EIO);
262262 }
263263 if (seq->current_video_data_size) {
libavformat/tmv.c+7−7
@@ -70,7 +70,7 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap) · 69 unmodified lines
7070 AVRational fps;
7171 unsigned comp_method, char_cols, char_rows, features;
7272
73− if (get_le32(pb) != TMV_TAG)
73+ if (avio_rl32(pb) != TMV_TAG)
7474 return -1;
7575
7676 if (!(vst = av_new_stream(s, 0)))
@@ -79,30 +79,30 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap) · 2 unmodified lines
7979 if (!(ast = av_new_stream(s, 0)))
8080 return AVERROR(ENOMEM);
8181
82− ast->codec->sample_rate = get_le16(pb);
82+ ast->codec->sample_rate = avio_rl16(pb);
8383 if (!ast->codec->sample_rate) {
8484 av_log(s, AV_LOG_ERROR, "invalid sample rate\n");
8585 return -1;
8686 }
8787
88− tmv->audio_chunk_size = get_le16(pb);
88+ tmv->audio_chunk_size = avio_rl16(pb);
8989 if (!tmv->audio_chunk_size) {
9090 av_log(s, AV_LOG_ERROR, "invalid audio chunk size\n");
9191 return -1;
9292 }
9393
94− comp_method = get_byte(pb);
94+ comp_method = avio_r8(pb);
9595 if (comp_method) {
9696 av_log(s, AV_LOG_ERROR, "unsupported compression method %d\n",
9797 comp_method);
9898 return -1;
9999 }
100100
101− char_cols = get_byte(pb);
102− char_rows = get_byte(pb);
101+ char_cols = avio_r8(pb);
102+ char_rows = avio_r8(pb);
103103 tmv->video_chunk_size = char_cols * char_rows * 2;
104104
105− features = get_byte(pb);
105+ features = avio_r8(pb);
106106 if (features & ~(TMV_PADDING | TMV_STEREO)) {
107107 av_log(s, AV_LOG_ERROR, "unsupported features 0x%02x\n",
108108 features & ~(TMV_PADDING | TMV_STEREO));
libavformat/tta.c+8−8
@@ -47,19 +47,19 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) · 46 unmodified lines
4747 ff_id3v1_read(s);
4848
4949 start_offset = url_ftell(s->pb);
50− if (get_le32(s->pb) != AV_RL32("TTA1"))
50+ if (avio_rl32(s->pb) != AV_RL32("TTA1"))
5151 return -1; // not tta file
5252
5353 url_fskip(s->pb, 2); // FIXME: flags
54− channels = get_le16(s->pb);
55− bps = get_le16(s->pb);
56− samplerate = get_le32(s->pb);
54+ channels = avio_rl16(s->pb);
55+ bps = avio_rl16(s->pb);
56+ samplerate = avio_rl32(s->pb);
5757 if(samplerate <= 0 || samplerate > 1000000){
5858 av_log(s, AV_LOG_ERROR, "nonsense samplerate\n");
5959 return -1;
6060 }
6161
62− datalen = get_le32(s->pb);
62+ datalen = avio_rl32(s->pb);
6363 if(datalen < 0){
6464 av_log(s, AV_LOG_ERROR, "nonsense datalen\n");
6565 return -1;
@@ -87,7 +87,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) · 21 unmodified lines
8787 framepos = url_ftell(s->pb) + 4*c->totalframes + 4;
8888
8989 for (i = 0; i < c->totalframes; i++) {
90− uint32_t size = get_le32(s->pb);
90+ uint32_t size = avio_rl32(s->pb);
9191 av_add_index_entry(st, framepos, i*framelen, size, 0, AVINDEX_KEYFRAME);
9292 framepos += size;
9393 }
@@ -101,13 +101,13 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) · 7 unmodified lines
101101
102102 st->codec->extradata_size = url_ftell(s->pb) - start_offset;
103103 if(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){
104− //this check is redundant as get_buffer should fail
104+ //this check is redundant as avio_read should fail
105105 av_log(s, AV_LOG_ERROR, "extradata_size too large\n");
106106 return -1;
107107 }
108108 st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE);
109109 url_fseek(s->pb, start_offset, SEEK_SET);
110− get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size);
110+ avio_read(s->pb, st->codec->extradata, st->codec->extradata_size);
111111
112112 return 0;
113113 }
libavformat/tty.c+3−3
@@ -47,14 +47,14 @@ static int efi_read(AVFormatContext *avctx, uint64_t start_pos) · 46 unmodified lines
4747 int len;
4848
4949 url_fseek(pb, start_pos, SEEK_SET);
50− if (get_byte(pb) != 0x1A)
50+ if (avio_r8(pb) != 0x1A)
5151 return -1;
5252
5353 #define GET_EFI_META(name,size) \
54− len = get_byte(pb); \
54+ len = avio_r8(pb); \
5555 if (len < 1 || len > size) \
5656 return -1; \
57− if (get_buffer(pb, buf, size) == size) { \
57+ if (avio_read(pb, buf, size) == size) { \
5858 buf[len] = 0; \
5959 av_metadata_set2(&avctx->metadata, name, buf, 0); \
6060 }
libavformat/txd.c+3−3
@@ -57,9 +57,9 @@ static int txd_read_packet(AVFormatContext *s, AVPacket *pkt) { · 56 unmodified lines
5757 int ret;
5858
5959 next_chunk:
60− id = get_le32(pb);
61− chunk_size = get_le32(pb);
62− marker = get_le32(pb);
60+ id = avio_rl32(pb);
61+ chunk_size = avio_rl32(pb);
62+ marker = avio_rl32(pb);
6363
6464 if (url_feof(s->pb))
6565 return AVERROR_EOF;
libavformat/utils.c+3−3
@@ -332,7 +332,7 @@ int av_get_packet(AVIOContext *s, AVPacket *pkt, int size) · 331 unmodified lines
332332
333333 pkt->pos= url_ftell(s);
334334
335− ret= get_buffer(s, pkt->data, size);
335+ ret= avio_read(s, pkt->data, size);
336336 if(ret<=0)
337337 av_free_packet(pkt);
338338 else
@@ -351,7 +351,7 @@ int av_append_packet(AVIOContext *s, AVPacket *pkt, int size) · 12 unmodified lines
351351 ret = av_grow_packet(pkt, size);
352352 if (ret < 0)
353353 return ret;
354− ret = get_buffer(s, pkt->data + old_size, size);
354+ ret = avio_read(s, pkt->data + old_size, size);
355355 av_shrink_packet(pkt, old_size + FFMAX(ret, 0));
356356 return ret;
357357 }
@@ -555,7 +555,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, · 197 unmodified lines
555555
556556 /* read probe data */
557557 buf = av_realloc(buf, probe_size + AVPROBE_PADDING_SIZE);
558− if ((ret = get_buffer(pb, buf + buf_offset, probe_size - buf_offset)) < 0) {
558+ if ((ret = avio_read(pb, buf + buf_offset, probe_size - buf_offset)) < 0) {
559559 /* fail if error was not end of file, otherwise, lower score */
560560 if (ret != AVERROR_EOF) {
561561 av_free(buf);
libavformat/vc1test.c+10−10
@@ -49,8 +49,8 @@ static int vc1t_read_header(AVFormatContext *s, · 48 unmodified lines
4949 int frames;
5050 uint32_t fps;
5151
52− frames = get_le24(pb);
53− if(get_byte(pb) != 0xC5 || get_le32(pb) != 4)
52+ frames = avio_rl24(pb);
53+ if(avio_r8(pb) != 0xC5 || avio_rl32(pb) != 4)
5454 return -1;
5555
5656 /* init video codec */
@@ -63,13 +63,13 @@ static int vc1t_read_header(AVFormatContext *s, · 6 unmodified lines
6363
6464 st->codec->extradata = av_malloc(VC1_EXTRADATA_SIZE);
6565 st->codec->extradata_size = VC1_EXTRADATA_SIZE;
66− get_buffer(pb, st->codec->extradata, VC1_EXTRADATA_SIZE);
67− st->codec->height = get_le32(pb);
68− st->codec->width = get_le32(pb);
69− if(get_le32(pb) != 0xC)
66+ avio_read(pb, st->codec->extradata, VC1_EXTRADATA_SIZE);
67+ st->codec->height = avio_rl32(pb);
68+ st->codec->width = avio_rl32(pb);
69+ if(avio_rl32(pb) != 0xC)
7070 return -1;
7171 url_fskip(pb, 8);
72− fps = get_le32(pb);
72+ fps = avio_rl32(pb);
7373 if(fps == 0xFFFFFFFF)
7474 av_set_pts_info(st, 32, 1, 1000);
7575 else{
@@ -95,10 +95,10 @@ static int vc1t_read_packet(AVFormatContext *s, · 19 unmodified lines
9595 if(url_feof(pb))
9696 return AVERROR(EIO);
9797
98− frame_size = get_le24(pb);
99− if(get_byte(pb) & 0x80)
98+ frame_size = avio_rl24(pb);
99+ if(avio_r8(pb) & 0x80)
100100 keyframe = 1;
101− pts = get_le32(pb);
101+ pts = avio_rl32(pb);
102102 if(av_get_packet(pb, pkt, frame_size) < 0)
103103 return AVERROR(EIO);
104104 if(s->streams[0]->time_base.den == 1000)
libavformat/vocdec.c+12−12
@@ -46,7 +46,7 @@ static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap) · 45 unmodified lines
4646 AVStream *st;
4747
4848 url_fskip(pb, 20);
49− header_size = get_le16(pb) - 22;
49+ header_size = avio_rl16(pb) - 22;
5050 if (header_size != 4) {
5151 av_log(s, AV_LOG_ERROR, "unknown header size: %d\n", header_size);
5252 return AVERROR(ENOSYS);
@@ -73,10 +73,10 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) · 20 unmodified lines
7373 int channels = 1;
7474
7575 while (!voc->remaining_size) {
76− type = get_byte(pb);
76+ type = avio_r8(pb);
7777 if (type == VOC_TYPE_EOF)
7878 return AVERROR(EIO);
79− voc->remaining_size = get_le24(pb);
79+ voc->remaining_size = avio_rl24(pb);
8080 if (!voc->remaining_size) {
8181 if (url_is_streamed(s->pb))
8282 return AVERROR(EIO);
@@ -86,11 +86,11 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) · 3 unmodified lines
8686
8787 switch (type) {
8888 case VOC_TYPE_VOICE_DATA:
89− dec->sample_rate = 1000000 / (256 - get_byte(pb));
89+ dec->sample_rate = 1000000 / (256 - avio_r8(pb));
9090 if (sample_rate)
9191 dec->sample_rate = sample_rate;
9292 dec->channels = channels;
93− tmp_codec = get_byte(pb);
93+ tmp_codec = avio_r8(pb);
9494 dec->bits_per_coded_sample = av_get_bits_per_sample(dec->codec_id);
9595 voc->remaining_size -= 2;
9696 max_size -= 2;
@@ -101,19 +101,19 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) · 4 unmodified lines
101101 break;
102102
103103 case VOC_TYPE_EXTENDED:
104− sample_rate = get_le16(pb);
105− get_byte(pb);
106− channels = get_byte(pb) + 1;
104+ sample_rate = avio_rl16(pb);
105+ avio_r8(pb);
106+ channels = avio_r8(pb) + 1;
107107 sample_rate = 256000000 / (channels * (65536 - sample_rate));
108108 voc->remaining_size = 0;
109109 max_size -= 4;
110110 break;
111111
112112 case VOC_TYPE_NEW_VOICE_DATA:
113− dec->sample_rate = get_le32(pb);
114− dec->bits_per_coded_sample = get_byte(pb);
115− dec->channels = get_byte(pb);
116− tmp_codec = get_le16(pb);
113+ dec->sample_rate = avio_rl32(pb);
114+ dec->bits_per_coded_sample = avio_r8(pb);
115+ dec->channels = avio_r8(pb);
116+ tmp_codec = avio_rl16(pb);
117117 url_fskip(pb, 4);
118118 voc->remaining_size -= 12;
119119 max_size -= 12;
libavformat/vqf.c+8−8
@@ -54,7 +54,7 @@ static void add_metadata(AVFormatContext *s, const char *tag, · 53 unmodified lines
5454 buf = av_malloc(len+1);
5555 if (!buf)
5656 return;
57− get_buffer(s->pb, buf, len);
57+ avio_read(s->pb, buf, len);
5858 buf[len] = 0;
5959 av_metadata_set2(&s->metadata, tag, buf, AV_METADATA_DONT_STRDUP_VAL);
6060 }
@@ -74,7 +74,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 13 unmodified lines
7474
7575 url_fskip(s->pb, 12);
7676
77− header_size = get_be32(s->pb);
77+ header_size = avio_rb32(s->pb);
7878
7979 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
8080 st->codec->codec_id = CODEC_ID_TWINVQ;
@@ -82,12 +82,12 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1 unmodified line
8282
8383 do {
8484 int len;
85− chunk_tag = get_le32(s->pb);
85+ chunk_tag = avio_rl32(s->pb);
8686
8787 if (chunk_tag == MKTAG('D','A','T','A'))
8888 break;
8989
90− len = get_be32(s->pb);
90+ len = avio_rb32(s->pb);
9191
9292 if ((unsigned) len > INT_MAX/2) {
9393 av_log(s, AV_LOG_ERROR, "Malformed header\n");
@@ -98,9 +98,9 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 4 unmodified lines
9898
9999 switch(chunk_tag){
100100 case MKTAG('C','O','M','M'):
101− st->codec->channels = get_be32(s->pb) + 1;
102− read_bitrate = get_be32(s->pb);
103− rate_flag = get_be32(s->pb);
101+ st->codec->channels = avio_rb32(s->pb) + 1;
102+ read_bitrate = avio_rb32(s->pb);
103+ rate_flag = avio_rb32(s->pb);
104104 url_fskip(s->pb, len-12);
105105
106106 st->codec->bit_rate = read_bitrate*1000;
@@ -208,7 +208,7 @@ static int vqf_read_packet(AVFormatContext *s, AVPacket *pkt) · 101 unmodified lines
208208
209209 pkt->data[0] = 8 - c->remaining_bits; // Number of bits to skip
210210 pkt->data[1] = c->last_frame_bits;
211− ret = get_buffer(s->pb, pkt->data+2, size);
211+ ret = avio_read(s->pb, pkt->data+2, size);
212212
213213 if (ret<=0) {
214214 av_free_packet(pkt);
libavformat/wav.c+16−16
@@ -143,8 +143,8 @@ AVOutputFormat ff_wav_muxer = { · 142 unmodified lines
143143
144144 static int64_t next_tag(AVIOContext *pb, unsigned int *tag)
145145 {
146− *tag = get_le32(pb);
147− return get_le32(pb);
146+ *tag = avio_rl32(pb);
147+ return avio_rl32(pb);
148148 }
149149
150150 /* return the size of the found tag */
@@ -197,25 +197,25 @@ static int wav_read_header(AVFormatContext *s, · 46 unmodified lines
197197 WAVContext *wav = s->priv_data;
198198
199199 /* check RIFF header */
200− tag = get_le32(pb);
200+ tag = avio_rl32(pb);
201201
202202 rf64 = tag == MKTAG('R', 'F', '6', '4');
203203 if (!rf64 && tag != MKTAG('R', 'I', 'F', 'F'))
204204 return -1;
205− get_le32(pb); /* file size */
206− tag = get_le32(pb);
205+ avio_rl32(pb); /* file size */
206+ tag = avio_rl32(pb);
207207 if (tag != MKTAG('W', 'A', 'V', 'E'))
208208 return -1;
209209
210210 if (rf64) {
211− if (get_le32(pb) != MKTAG('d', 's', '6', '4'))
211+ if (avio_rl32(pb) != MKTAG('d', 's', '6', '4'))
212212 return -1;
213− size = get_le32(pb);
213+ size = avio_rl32(pb);
214214 if (size < 16)
215215 return -1;
216− get_le64(pb); /* RIFF size */
217− data_size = get_le64(pb);
218− sample_count = get_le64(pb);
216+ avio_rl64(pb); /* RIFF size */
217+ data_size = avio_rl64(pb);
218+ sample_count = avio_rl64(pb);
219219 url_fskip(pb, size - 16); /* skip rest of ds64 chunk */
220220 }
221221
@@ -239,7 +239,7 @@ static int wav_read_header(AVFormatContext *s, · 17 unmodified lines
239239 if (tag == MKTAG('d', 'a', 't', 'a')){
240240 break;
241241 }else if (tag == MKTAG('f','a','c','t') && !sample_count){
242− sample_count = get_le32(pb);
242+ sample_count = avio_rl32(pb);
243243 size -= 4;
244244 }
245245 url_fseek(pb, size, SEEK_CUR);
@@ -269,8 +269,8 @@ static int64_t find_guid(AVIOContext *pb, const uint8_t guid1[16]) · 23 unmodified lines
269269 int64_t size;
270270
271271 while (!url_feof(pb)) {
272− get_buffer(pb, guid, 16);
273− size = get_le64(pb);
272+ avio_read(pb, guid, 16);
273+ size = avio_rl64(pb);
274274 if (size <= 24)
275275 return -1;
276276 if (!memcmp(guid, guid1, 16))
@@ -384,14 +384,14 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap) · 107 unmodified lines
384384 AVStream *st;
385385 uint8_t guid[16];
386386
387− get_buffer(pb, guid, 16);
387+ avio_read(pb, guid, 16);
388388 if (memcmp(guid, guid_riff, 16))
389389 return -1;
390390
391− if (get_le64(pb) < 16 + 8 + 16 + 8 + 16 + 8) /* riff + wave + fmt + sizes */
391+ if (avio_rl64(pb) < 16 + 8 + 16 + 8 + 16 + 8) /* riff + wave + fmt + sizes */
392392 return -1;
393393
394− get_buffer(pb, guid, 16);
394+ avio_read(pb, guid, 16);
395395 if (memcmp(guid, guid_wave, 16)) {
396396 av_log(s, AV_LOG_ERROR, "could not find wave guid\n");
397397 return -1;
libavformat/wc3movie.c+10−10
@@ -105,8 +105,8 @@ static int wc3_read_header(AVFormatContext *s, · 104 unmodified lines
105105
106106 /* traverse through the chunks and load the header information before
107107 * the first BRCH tag */
108− fourcc_tag = get_le32(pb);
109− size = (get_be32(pb) + 1) & (~1);
108+ fourcc_tag = avio_rl32(pb);
109+ size = (avio_rb32(pb) + 1) & (~1);
110110
111111 do {
112112 switch (fourcc_tag) {
@@ -127,7 +127,7 @@ static int wc3_read_header(AVFormatContext *s, · 14 unmodified lines
127127 buffer = av_malloc(size+1);
128128 if (!buffer)
129129 return AVERROR(ENOMEM);
130− if ((ret = get_buffer(pb, buffer, size)) != size)
130+ if ((ret = avio_read(pb, buffer, size)) != size)
131131 return AVERROR(EIO);
132132 buffer[size] = 0;
133133 av_metadata_set2(&s->metadata, "title", buffer,
@@ -136,8 +136,8 @@ static int wc3_read_header(AVFormatContext *s, · 2 unmodified lines
136136
137137 case SIZE_TAG:
138138 /* video resolution override */
139− wc3->width = get_le32(pb);
140− wc3->height = get_le32(pb);
139+ wc3->width = avio_rl32(pb);
140+ wc3->height = avio_rl32(pb);
141141 break;
142142
143143 case PALT_TAG:
@@ -154,9 +154,9 @@ static int wc3_read_header(AVFormatContext *s, · 10 unmodified lines
154154 break;
155155 }
156156
157− fourcc_tag = get_le32(pb);
157+ fourcc_tag = avio_rl32(pb);
158158 /* chunk sizes are 16-bit aligned */
159− size = (get_be32(pb) + 1) & (~1);
159+ size = (avio_rb32(pb) + 1) & (~1);
160160 if (url_feof(pb))
161161 return AVERROR(EIO);
162162
@@ -205,9 +205,9 @@ static int wc3_read_packet(AVFormatContext *s, · 42 unmodified lines
205205
206206 while (!packet_read) {
207207
208− fourcc_tag = get_le32(pb);
208+ fourcc_tag = avio_rl32(pb);
209209 /* chunk sizes are 16-bit aligned */
210− size = (get_be32(pb) + 1) & (~1);
210+ size = (avio_rb32(pb) + 1) & (~1);
211211 if (url_feof(pb))
212212 return AVERROR(EIO);
213213
@@ -242,7 +242,7 @@ static int wc3_read_packet(AVFormatContext *s, · 28 unmodified lines
242242 #if 0
243243 url_fseek(pb, size, SEEK_CUR);
244244 #else
245− if ((unsigned)size > sizeof(text) || (ret = get_buffer(pb, text, size)) != size)
245+ if ((unsigned)size > sizeof(text) || (ret = avio_read(pb, text, size)) != size)
246246 ret = AVERROR(EIO);
247247 else {
248248 int i = 0;
libavformat/westwood.c+6−6
@@ -130,7 +130,7 @@ static int wsaud_read_header(AVFormatContext *s, · 129 unmodified lines
130130 AVStream *st;
131131 unsigned char header[AUD_HEADER_SIZE];
132132
133− if (get_buffer(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE)
133+ if (avio_read(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE)
134134 return AVERROR(EIO);
135135 wsaud->audio_samplerate = AV_RL16(&header[0]);
136136 if (header[11] == 99)
@@ -173,7 +173,7 @@ static int wsaud_read_packet(AVFormatContext *s, · 36 unmodified lines
173173 unsigned int chunk_size;
174174 int ret = 0;
175175
176− if (get_buffer(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) !=
176+ if (avio_read(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) !=
177177 AUD_CHUNK_PREAMBLE_SIZE)
178178 return AVERROR(EIO);
179179
@@ -237,7 +237,7 @@ static int wsvqa_read_header(AVFormatContext *s, · 57 unmodified lines
237237 st->codec->extradata_size = VQA_HEADER_SIZE;
238238 st->codec->extradata = av_mallocz(VQA_HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
239239 header = (unsigned char *)st->codec->extradata;
240− if (get_buffer(pb, st->codec->extradata, VQA_HEADER_SIZE) !=
240+ if (avio_read(pb, st->codec->extradata, VQA_HEADER_SIZE) !=
241241 VQA_HEADER_SIZE) {
242242 av_free(st->codec->extradata);
243243 return AVERROR(EIO);
@@ -277,7 +277,7 @@ static int wsvqa_read_header(AVFormatContext *s, · 33 unmodified lines
277277 /* there are 0 or more chunks before the FINF chunk; iterate until
278278 * FINF has been skipped and the file will be ready to be demuxed */
279279 do {
280− if (get_buffer(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) {
280+ if (avio_read(pb, scratch, VQA_PREAMBLE_SIZE) != VQA_PREAMBLE_SIZE) {
281281 av_free(st->codec->extradata);
282282 return AVERROR(EIO);
283283 }
@@ -320,7 +320,7 @@ static int wsvqa_read_packet(AVFormatContext *s, · 36 unmodified lines
320320 unsigned int chunk_size;
321321 int skip_byte;
322322
323− while (get_buffer(pb, preamble, VQA_PREAMBLE_SIZE) == VQA_PREAMBLE_SIZE) {
323+ while (avio_read(pb, preamble, VQA_PREAMBLE_SIZE) == VQA_PREAMBLE_SIZE) {
324324 chunk_type = AV_RB32(&preamble[0]);
325325 chunk_size = AV_RB32(&preamble[4]);
326326 skip_byte = chunk_size & 0x01;
@@ -329,7 +329,7 @@ static int wsvqa_read_packet(AVFormatContext *s, · 2 unmodified lines
329329
330330 if (av_new_packet(pkt, chunk_size))
331331 return AVERROR(EIO);
332− ret = get_buffer(pb, pkt->data, chunk_size);
332+ ret = avio_read(pb, pkt->data, chunk_size);
333333 if (ret != chunk_size) {
334334 av_free_packet(pkt);
335335 return AVERROR(EIO);
libavformat/wtv.c+28−28
@@ -88,7 +88,7 @@ static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size) · 87 unmodified lines
8888 int remaining_in_sector = (1 << wf->sector_bits) - (wf->position & ((1 << wf->sector_bits) - 1));
8989 int read_request = FFMIN(buf_size - nread, remaining_in_sector);
9090
91− n = get_buffer(pb, buf, read_request);
91+ n = avio_read(pb, buf, read_request);
9292 if (n <= 0)
9393 break;
9494 nread += n;
@@ -140,7 +140,7 @@ static int read_ints(AVIOContext *pb, uint32_t *data, int count) · 45 unmodified lines
140140 {
141141 int i, total = 0;
142142 for (i = 0; i < count; i++) {
143− if ((data[total] = get_le32(pb)))
143+ if ((data[total] = avio_rl32(pb)))
144144 total++;
145145 }
146146 return total;
@@ -474,9 +474,9 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) · 327 unmodified lines
474474 if (strcmp(mime, "image/jpeg"))
475475 goto done;
476476
477− get_byte(pb);
477+ avio_r8(pb);
478478 avio_get_str16le(pb, INT_MAX, description, sizeof(description));
479− filesize = get_le32(pb);
479+ filesize = avio_rl32(pb);
480480 if (!filesize)
481481 goto done;
482482
@@ -490,7 +490,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) · 7 unmodified lines
490490 if (!st->codec->extradata)
491491 goto done;
492492 st->codec->extradata_size = filesize;
493− get_buffer(pb, st->codec->extradata, filesize);
493+ avio_read(pb, st->codec->extradata, filesize);
494494 done:
495495 url_fseek(pb, pos + length, SEEK_SET);
496496 }
@@ -503,7 +503,7 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty · 6 unmodified lines
503503 return;
504504
505505 if (type == 0 && length == 4) {
506− snprintf(buf, buf_size, "%"PRIi32, get_le32(pb));
506+ snprintf(buf, buf_size, "%"PRIi32, avio_rl32(pb));
507507 } else if (type == 1) {
508508 avio_get_str16le(pb, length, buf, buf_size);
509509 if (!strlen(buf)) {
@@ -511,9 +511,9 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty · 1 unmodified line
511511 return;
512512 }
513513 } else if (type == 3 && length == 4) {
514− strcpy(buf, get_le32(pb) ? "true" : "false");
514+ strcpy(buf, avio_rl32(pb) ? "true" : "false");
515515 } else if (type == 4 && length == 8) {
516− int64_t num = get_le64(pb);
516+ int64_t num = avio_rl64(pb);
517517 if (!strcmp(key, "WM/EncodingTime") ||
518518 !strcmp(key, "WM/MediaOriginalBroadcastDateTime"))
519519 filetime_to_iso8601(buf, buf_size, num);
@@ -527,10 +527,10 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty · 7 unmodified lines
527527 else
528528 snprintf(buf, buf_size, "%"PRIi64, num);
529529 } else if (type == 5 && length == 2) {
530− snprintf(buf, buf_size, "%"PRIi16, get_le16(pb));
530+ snprintf(buf, buf_size, "%"PRIi16, avio_rl16(pb));
531531 } else if (type == 6 && length == 16) {
532532 ff_asf_guid guid;
533− get_buffer(pb, guid, 16);
533+ avio_read(pb, guid, 16);
534534 snprintf(buf, buf_size, PRI_PRETTY_GUID, ARG_PRETTY_GUID(guid));
535535 } else if (type == 2 && !strcmp(key, "WM/Picture")) {
536536 get_attachment(s, pb, length);
@@ -557,8 +557,8 @@ static void parse_legacy_attrib(AVFormatContext *s, AVIOContext *pb) · 20 unmodified lines
557557 while(!url_feof(pb)) {
558558 char key[1024];
559559 ff_get_guid(pb, &guid);
560− type = get_le32(pb);
561− length = get_le32(pb);
560+ type = avio_rl32(pb);
561+ length = avio_rl32(pb);
562562 if (!length)
563563 break;
564564 if (ff_guidcmp(&guid, metadata_guid)) {
@@ -775,10 +775,10 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p · 210 unmodified lines
775775 int len, sid, consumed;
776776
777777 ff_get_guid(pb, &g);
778− len = get_le32(pb);
778+ len = avio_rl32(pb);
779779 if (len < 32)
780780 break;
781− sid = get_le32(pb) & 0x7FFF;
781+ sid = avio_rl32(pb) & 0x7FFF;
782782 url_fskip(pb, 8);
783783 consumed = 32;
784784
@@ -791,7 +791,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p · 6 unmodified lines
791791 ff_get_guid(pb, &subtype);
792792 url_fskip(pb, 12);
793793 ff_get_guid(pb, &formattype);
794− size = get_le32(pb);
794+ size = avio_rl32(pb);
795795 parse_media_type(s, 0, sid, mediatype, subtype, formattype, size);
796796 consumed += 92 + size;
797797 }
@@ -805,7 +805,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p · 7 unmodified lines
805805 ff_get_guid(pb, &subtype);
806806 url_fskip(pb, 12);
807807 ff_get_guid(pb, &formattype);
808− size = get_le32(pb);
808+ size = avio_rl32(pb);
809809 parse_media_type(s, s->streams[stream_index], sid, mediatype, subtype, formattype, size);
810810 consumed += 76 + size;
811811 }
@@ -831,7 +831,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p · 19 unmodified lines
831831 }
832832
833833 buf_size = FFMIN(len - consumed, sizeof(buf));
834− get_buffer(pb, buf, buf_size);
834+ avio_read(pb, buf, buf_size);
835835 consumed += buf_size;
836836 ff_parse_mpeg2_descriptor(s, st, 0, &pbuf, buf + buf_size, 0, 0, 0, 0);
837837 }
@@ -841,7 +841,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p · 3 unmodified lines
841841 AVStream *st = s->streams[stream_index];
842842 int audio_type;
843843 url_fskip(pb, 8);
844− audio_type = get_byte(pb);
844+ audio_type = avio_r8(pb);
845845 if (audio_type == 2)
846846 st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED;
847847 else if (audio_type == 3)
@@ -852,7 +852,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p · 4 unmodified lines
852852 int stream_index = ff_find_stream_index(s, sid);
853853 if (stream_index >= 0) {
854854 url_fskip(pb, 12);
855− if (get_le32(pb))
855+ if (avio_rl32(pb))
856856 av_log(s, AV_LOG_WARNING, "DVB scrambled stream detected (st:%d), decoding will likely fail\n", stream_index);
857857 consumed += 16;
858858 }
@@ -862,7 +862,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p · 3 unmodified lines
862862 AVStream *st = s->streams[stream_index];
863863 uint8_t language[4];
864864 url_fskip(pb, 12);
865− get_buffer(pb, language, 3);
865+ avio_read(pb, language, 3);
866866 if (language[0]) {
867867 language[3] = 0;
868868 av_metadata_set2(&st->metadata, "language", language, 0);
@@ -875,7 +875,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p · 6 unmodified lines
875875 int stream_index = ff_find_stream_index(s, sid);
876876 if (stream_index >= 0) {
877877 url_fskip(pb, 8);
878− wtv->pts = get_le64(pb);
878+ wtv->pts = avio_rl64(pb);
879879 consumed += 16;
880880 if (wtv->pts == -1)
881881 wtv->pts = AV_NOPTS_VALUE;
@@ -955,16 +955,16 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 73 unmodified lines
955955
956956 /* read root directory sector */
957957 url_fskip(s->pb, 0x30);
958− root_size = get_le32(s->pb);
958+ root_size = avio_rl32(s->pb);
959959 if (root_size > sizeof(root)) {
960960 av_log(s, AV_LOG_ERROR, "root directory size exceeds sector size\n");
961961 return AVERROR_INVALIDDATA;
962962 }
963963 url_fskip(s->pb, 4);
964− root_sector = get_le32(s->pb);
964+ root_sector = avio_rl32(s->pb);
965965
966966 url_fseek(s->pb, root_sector << WTV_SECTOR_BITS, SEEK_SET);
967− root_size = get_buffer(s->pb, root, root_size);
967+ root_size = avio_read(s->pb, root, root_size);
968968 if (root_size < 0)
969969 return AVERROR_INVALIDDATA;
970970
@@ -995,8 +995,8 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 24 unmodified lines
995995 pb = wtvfile_open(s, root, root_size, table_0_entries_time_le16);
996996 if (pb) {
997997 while(1) {
998− uint64_t timestamp = get_le64(pb);
999− uint64_t frame_nb = get_le64(pb);
998+ uint64_t timestamp = avio_rl64(pb);
999+ uint64_t frame_nb = avio_rl64(pb);
10001000 if (url_feof(pb))
10011001 break;
10021002 ff_add_index_entry(&wtv->index_entries, &wtv->nb_index_entries, &wtv->index_entries_allocated_size,
@@ -1009,8 +1009,8 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 6 unmodified lines
10091009 if (pb) {
10101010 int i;
10111011 while (1) {
1012− uint64_t frame_nb = get_le64(pb);
1013− uint64_t position = get_le64(pb);
1012+ uint64_t frame_nb = avio_rl64(pb);
1013+ uint64_t position = avio_rl64(pb);
10141014 if (url_feof(pb))
10151015 break;
10161016 for (i = wtv->nb_index_entries - 1; i >= 0; i--) {
libavformat/wv.c+25−25
@@ -86,25 +86,25 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen · 85 unmodified lines
8686
8787 wc->pos = url_ftell(pb);
8888 if(!append){
89− tag = get_le32(pb);
89+ tag = avio_rl32(pb);
9090 if (tag != MKTAG('w', 'v', 'p', 'k'))
9191 return -1;
92− size = get_le32(pb);
92+ size = avio_rl32(pb);
9393 if(size < 24 || size > WV_BLOCK_LIMIT){
9494 av_log(ctx, AV_LOG_ERROR, "Incorrect block size %i\n", size);
9595 return -1;
9696 }
9797 wc->blksize = size;
98− ver = get_le16(pb);
98+ ver = avio_rl16(pb);
9999 if(ver < 0x402 || ver > 0x410){
100100 av_log(ctx, AV_LOG_ERROR, "Unsupported version %03X\n", ver);
101101 return -1;
102102 }
103− get_byte(pb); // track no
104− get_byte(pb); // track sub index
105− wc->samples = get_le32(pb); // total samples in file
106− wc->soff = get_le32(pb); // offset in samples of current block
107− get_buffer(pb, wc->extra, WV_EXTRA_SIZE);
103+ avio_r8(pb); // track no
104+ avio_r8(pb); // track sub index
105+ wc->samples = avio_rl32(pb); // total samples in file
106+ wc->soff = avio_rl32(pb); // offset in samples of current block
107+ avio_read(pb, wc->extra, WV_EXTRA_SIZE);
108108 }else{
109109 size = wc->blksize;
110110 }
@@ -127,8 +127,8 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen · 16 unmodified lines
127127 }
128128 while(url_ftell(pb) < block_end){
129129 int id, size;
130− id = get_byte(pb);
131− size = (id & 0x80) ? get_le24(pb) : get_byte(pb);
130+ id = avio_r8(pb);
131+ size = (id & 0x80) ? avio_rl24(pb) : avio_r8(pb);
132132 size <<= 1;
133133 if(id&0x40)
134134 size--;
@@ -138,24 +138,24 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen · 3 unmodified lines
138138 av_log(ctx, AV_LOG_ERROR, "Insufficient channel information\n");
139139 return -1;
140140 }
141− chan = get_byte(pb);
141+ chan = avio_r8(pb);
142142 switch(size - 2){
143143 case 0:
144− chmask = get_byte(pb);
144+ chmask = avio_r8(pb);
145145 break;
146146 case 1:
147− chmask = get_le16(pb);
147+ chmask = avio_rl16(pb);
148148 break;
149149 case 2:
150− chmask = get_le24(pb);
150+ chmask = avio_rl24(pb);
151151 break;
152152 case 3:
153− chmask = get_le32(pb);
153+ chmask = avio_rl32(pb);
154154 break;
155155 case 5:
156156 url_fskip(pb, 1);
157− chan |= (get_byte(pb) & 0xF) << 8;
158− chmask = get_le24(pb);
157+ chan |= (avio_r8(pb) & 0xF) << 8;
158+ chmask = avio_rl24(pb);
159159 break;
160160 default:
161161 av_log(ctx, AV_LOG_ERROR, "Invalid channel info size %d\n", size);
@@ -163,7 +163,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen · 1 unmodified line
163163 }
164164 break;
165165 case 0x27:
166− rate = get_le24(pb);
166+ rate = avio_rl24(pb);
167167 break;
168168 default:
169169 url_fskip(pb, size);
@@ -254,13 +254,13 @@ static int wv_read_packet(AVFormatContext *s, · 84 unmodified lines
254254 if(wc->multichannel)
255255 AV_WL32(pkt->data, wc->blksize + WV_EXTRA_SIZE + 12);
256256 memcpy(pkt->data + off, wc->extra, WV_EXTRA_SIZE);
257− ret = get_buffer(s->pb, pkt->data + WV_EXTRA_SIZE + off, wc->blksize);
257+ ret = avio_read(s->pb, pkt->data + WV_EXTRA_SIZE + off, wc->blksize);
258258 if(ret != wc->blksize){
259259 av_free_packet(pkt);
260260 return AVERROR(EIO);
261261 }
262262 while(!(wc->flags & WV_END_BLOCK)){
263− if(get_le32(s->pb) != MKTAG('w', 'v', 'p', 'k')){
263+ if(avio_rl32(s->pb) != MKTAG('w', 'v', 'p', 'k')){
264264 av_free_packet(pkt);
265265 return -1;
266266 }
@@ -275,16 +275,16 @@ static int wv_read_packet(AVFormatContext *s, · 8 unmodified lines
275275 return -1;
276276 }
277277 wc->blksize = size;
278− ver = get_le16(s->pb);
278+ ver = avio_rl16(s->pb);
279279 if(ver < 0x402 || ver > 0x410){
280280 av_free_packet(pkt);
281281 av_log(s, AV_LOG_ERROR, "Unsupported version %03X\n", ver);
282282 return -1;
283283 }
284− get_byte(s->pb); // track no
285− get_byte(s->pb); // track sub index
286− wc->samples = get_le32(s->pb); // total samples in file
287− wc->soff = get_le32(s->pb); // offset in samples of current block
284+ avio_r8(s->pb); // track no
285+ avio_r8(s->pb); // track sub index
286+ wc->samples = avio_rl32(s->pb); // total samples in file
287+ wc->soff = avio_rl32(s->pb); // offset in samples of current block
288288 if((ret = av_append_packet(s->pb, pkt, WV_EXTRA_SIZE)) < 0){
289289 av_free_packet(pkt);
290290 return ret;
libavformat/xa.c+6−6
@@ -77,14 +77,14 @@ static int xa_read_header(AVFormatContext *s, · 76 unmodified lines
7777 st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
7878 st->codec->codec_id = CODEC_ID_ADPCM_EA_MAXIS_XA;
7979 url_fskip(pb, 4); /* Skip the XA ID */
80− xa->out_size = get_le32(pb);
80+ xa->out_size = avio_rl32(pb);
8181 url_fskip(pb, 2); /* Skip the tag */
82− st->codec->channels = get_le16(pb);
83− st->codec->sample_rate = get_le32(pb);
82+ st->codec->channels = avio_rl16(pb);
83+ st->codec->sample_rate = avio_rl32(pb);
8484 /* Value in file is average byte rate*/
85− st->codec->bit_rate = get_le32(pb) * 8;
86− st->codec->block_align = get_le16(pb);
87− st->codec->bits_per_coded_sample = get_le16(pb);
85+ st->codec->bit_rate = avio_rl32(pb) * 8;
86+ st->codec->block_align = avio_rl16(pb);
87+ st->codec->bits_per_coded_sample = avio_rl16(pb);
8888
8989 av_set_pts_info(st, 64, 1, st->codec->sample_rate);
9090
libavformat/yop.c+7−7
@@ -83,14 +83,14 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) · 82 unmodified lines
8383
8484 url_fskip(pb, 6);
8585
86− frame_rate = get_byte(pb);
87− yop->frame_size = get_byte(pb) * 2048;
88− video_dec->width = get_le16(pb);
89− video_dec->height = get_le16(pb);
86+ frame_rate = avio_r8(pb);
87+ yop->frame_size = avio_r8(pb) * 2048;
88+ video_dec->width = avio_rl16(pb);
89+ video_dec->height = avio_rl16(pb);
9090
9191 video_stream->sample_aspect_ratio = (AVRational){1, 2};
9292
93− ret = get_buffer(pb, video_dec->extradata, 8);
93+ ret = avio_read(pb, video_dec->extradata, 8);
9494 if (ret < 8)
9595 return ret < 0 ? ret : AVERROR_EOF;
9696
@@ -138,7 +138,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt) · 41 unmodified lines
138138
139139 yop->video_packet.pos = url_ftell(pb);
140140
141− ret = get_buffer(pb, yop->video_packet.data, yop->palette_size);
141+ ret = avio_read(pb, yop->video_packet.data, yop->palette_size);
142142 if (ret < 0) {
143143 goto err_out;
144144 }else if (ret < yop->palette_size) {
@@ -155,7 +155,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt) · 10 unmodified lines
155155
156156 url_fskip(pb, yop->audio_block_length - ret);
157157
158− ret = get_buffer(pb, yop->video_packet.data + yop->palette_size,
158+ ret = avio_read(pb, yop->video_packet.data + yop->palette_size,
159159 actual_video_data_size);
160160 if (ret < 0)
161161 goto err_out;
libavformat/yuv4mpeg.c+2−2
@@ -200,7 +200,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap) · 199 unmodified lines
200200 struct frame_attributes *s1 = s->priv_data;
201201
202202 for (i=0; i<MAX_YUV4_HEADER; i++) {
203− header[i] = get_byte(pb);
203+ header[i] = avio_r8(pb);
204204 if (header[i] == '\n') {
205205 header[i+1] = 0x20; // Add a space after last option. Makes parsing "444" vs "444alpha" easier.
206206 header[i+2] = 0;
@@ -352,7 +352,7 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt) · 145 unmodified lines
352352 struct frame_attributes *s1 = s->priv_data;
353353
354354 for (i=0; i<MAX_FRAME_HEADER; i++) {
355− header[i] = get_byte(s->pb);
355+ header[i] = avio_r8(s->pb);
356356 if (header[i] == '\n') {
357357 header[i+1] = 0;
358358 break;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t