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.
Unified · Split
| @@ -54,11 +54,11 @@ · 53 unmodified lines | ||
| 54 | 54 | #define strk_SIZE 0x28 |
| 55 | 55 | |
| 56 | 56 | #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); \ | |
| 59 | 59 | if (fourcc_tag != LIST_TAG) \ |
| 60 | 60 | return AVERROR_INVALIDDATA; \ |
| 61 | − fourcc_tag = get_le32(pb); | |
| 61 | + fourcc_tag = avio_rl32(pb); | |
| 62 | 62 | |
| 63 | 63 | typedef struct AudioTrack { |
| 64 | 64 | int sample_rate; |
| @@ -118,7 +118,7 @@ static int fourxm_read_header(AVFormatContext *s, · 53 unmodified lines | ||
| 118 | 118 | header = av_malloc(header_size); |
| 119 | 119 | if (!header) |
| 120 | 120 | return AVERROR(ENOMEM); |
| 121 | − if (get_buffer(pb, header, header_size) != header_size){ | |
| 121 | + if (avio_read(pb, header, header_size) != header_size){ | |
| 122 | 122 | av_free(header); |
| 123 | 123 | return AVERROR(EIO); |
| 124 | 124 | } |
| @@ -255,7 +255,7 @@ static int fourxm_read_packet(AVFormatContext *s, · 130 unmodified lines | ||
| 255 | 255 | |
| 256 | 256 | while (!packet_read) { |
| 257 | 257 | |
| 258 | − if ((ret = get_buffer(s->pb, header, 8)) < 0) | |
| 258 | + if ((ret = avio_read(s->pb, header, 8)) < 0) | |
| 259 | 259 | return ret; |
| 260 | 260 | fourcc_tag = AV_RL32(&header[0]); |
| 261 | 261 | size = AV_RL32(&header[4]); |
| @@ -268,7 +268,7 @@ static int fourxm_read_packet(AVFormatContext *s, · 6 unmodified lines | ||
| 268 | 268 | fourxm->video_pts ++; |
| 269 | 269 | |
| 270 | 270 | /* skip the LIST-* tag and move on to the next fourcc */ |
| 271 | − get_le32(pb); | |
| 271 | + avio_rl32(pb); | |
| 272 | 272 | break; |
| 273 | 273 | |
| 274 | 274 | case ifrm_TAG: |
| @@ -285,7 +285,7 @@ static int fourxm_read_packet(AVFormatContext *s, · 10 unmodified lines | ||
| 285 | 285 | pkt->pts = fourxm->video_pts; |
| 286 | 286 | pkt->pos = url_ftell(s->pb); |
| 287 | 287 | 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); | |
| 289 | 289 | |
| 290 | 290 | if (ret < 0){ |
| 291 | 291 | av_free_packet(pkt); |
| @@ -294,8 +294,8 @@ static int fourxm_read_packet(AVFormatContext *s, · 2 unmodified lines | ||
| 294 | 294 | break; |
| 295 | 295 | |
| 296 | 296 | 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); | |
| 299 | 299 | size-=8; |
| 300 | 300 | |
| 301 | 301 | if (track_number < fourxm->track_count && fourxm->tracks[track_number].channels>0) { |
| @@ -63,7 +63,7 @@ static int aea_read_header(AVFormatContext *s, · 62 unmodified lines | ||
| 63 | 63 | |
| 64 | 64 | /* Parse the amount of channels and skip to pos 2048(0x800) */ |
| 65 | 65 | url_fskip(s->pb, 264); |
| 66 | − st->codec->channels = get_byte(s->pb); | |
| 66 | + st->codec->channels = avio_r8(s->pb); | |
| 67 | 67 | url_fskip(s->pb, 1783); |
| 68 | 68 | |
| 69 | 69 | |
| @@ -54,8 +54,8 @@ static int get_tag(AVIOContext *pb, uint32_t * tag) · 53 unmodified lines | ||
| 54 | 54 | if (url_feof(pb)) |
| 55 | 55 | return AVERROR(EIO); |
| 56 | 56 | |
| 57 | − *tag = get_le32(pb); | |
| 58 | − size = get_be32(pb); | |
| 57 | + *tag = avio_rl32(pb); | |
| 58 | + size = avio_rb32(pb); | |
| 59 | 59 | |
| 60 | 60 | if (size < 0) |
| 61 | 61 | size = 0x7fffffff; |
| @@ -74,7 +74,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size) · 12 unmodified lines | ||
| 74 | 74 | return; |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | − res = get_buffer(s->pb, str, size); | |
| 77 | + res = avio_read(s->pb, str, size); | |
| 78 | 78 | if (res < 0) |
| 79 | 79 | return; |
| 80 | 80 | |
| @@ -93,18 +93,18 @@ static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec, · 12 unmodified lines | ||
| 93 | 93 | if (size & 1) |
| 94 | 94 | size++; |
| 95 | 95 | 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); | |
| 99 | 99 | |
| 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 */ | |
| 101 | 101 | sample_rate = av_ext2dbl(ext); /* 80 bits BE IEEE extended float */ |
| 102 | 102 | codec->sample_rate = sample_rate; |
| 103 | 103 | size -= 18; |
| 104 | 104 | |
| 105 | 105 | /* Got an AIFF-C? */ |
| 106 | 106 | if (version == AIFF_C_VERSION1) { |
| 107 | − codec->codec_tag = get_le32(pb); | |
| 107 | + codec->codec_tag = avio_rl32(pb); | |
| 108 | 108 | codec->codec_id = ff_codec_get_id(ff_codec_aiff_tags, codec->codec_tag); |
| 109 | 109 | |
| 110 | 110 | switch (codec->codec_id) { |
| @@ -187,7 +187,7 @@ static int aiff_read_header(AVFormatContext *s, · 76 unmodified lines | ||
| 187 | 187 | return AVERROR_INVALIDDATA; |
| 188 | 188 | |
| 189 | 189 | /* AIFF data type */ |
| 190 | − tag = get_le32(pb); | |
| 190 | + tag = avio_rl32(pb); | |
| 191 | 191 | if (tag == MKTAG('A', 'I', 'F', 'F')) /* Got an AIFF file */ |
| 192 | 192 | version = AIFF; |
| 193 | 193 | 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 | ||
| 217 | 217 | goto got_sound; |
| 218 | 218 | break; |
| 219 | 219 | case MKTAG('F', 'V', 'E', 'R'): /* Version chunk */ |
| 220 | − version = get_be32(pb); | |
| 220 | + version = avio_rb32(pb); | |
| 221 | 221 | break; |
| 222 | 222 | case MKTAG('N', 'A', 'M', 'E'): /* Sample name chunk */ |
| 223 | 223 | get_meta(s, "title" , size); |
| @@ -233,8 +233,8 @@ static int aiff_read_header(AVFormatContext *s, · 9 unmodified lines | ||
| 233 | 233 | break; |
| 234 | 234 | case MKTAG('S', 'S', 'N', 'D'): /* Sampled sound chunk */ |
| 235 | 235 | 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 */ | |
| 238 | 238 | offset += url_ftell(pb); /* Compute absolute data offset */ |
| 239 | 239 | if (st->codec->block_align) /* Assume COMM already parsed */ |
| 240 | 240 | goto got_sound; |
| @@ -251,7 +251,7 @@ static int aiff_read_header(AVFormatContext *s, · 10 unmodified lines | ||
| 251 | 251 | if (!st->codec->extradata) |
| 252 | 252 | return AVERROR(ENOMEM); |
| 253 | 253 | st->codec->extradata_size = size; |
| 254 | − get_buffer(pb, st->codec->extradata, size); | |
| 254 | + avio_read(pb, st->codec->extradata, size); | |
| 255 | 255 | break; |
| 256 | 256 | default: /* Jump */ |
| 257 | 257 | if (size & 1) /* Always even aligned */ |
| @@ -82,7 +82,7 @@ static int amr_read_header(AVFormatContext *s, · 81 unmodified lines | ||
| 82 | 82 | AVStream *st; |
| 83 | 83 | uint8_t header[9]; |
| 84 | 84 | |
| 85 | − get_buffer(pb, header, 6); | |
| 85 | + avio_read(pb, header, 6); | |
| 86 | 86 | |
| 87 | 87 | st = av_new_stream(s, 0); |
| 88 | 88 | if (!st) |
| @@ -91,7 +91,7 @@ static int amr_read_header(AVFormatContext *s, · 2 unmodified lines | ||
| 91 | 91 | } |
| 92 | 92 | if(memcmp(header,AMR_header,6)!=0) |
| 93 | 93 | { |
| 94 | − get_buffer(pb, header+6, 3); | |
| 94 | + avio_read(pb, header+6, 3); | |
| 95 | 95 | if(memcmp(header,AMRWB_header,9)!=0) |
| 96 | 96 | { |
| 97 | 97 | return -1; |
| @@ -128,7 +128,7 @@ static int amr_read_packet(AVFormatContext *s, · 30 unmodified lines | ||
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | //FIXME this is wrong, this should rather be in a AVParset |
| 131 | − toc=get_byte(s->pb); | |
| 131 | + toc=avio_r8(s->pb); | |
| 132 | 132 | mode = (toc >> 3) & 0x0F; |
| 133 | 133 | |
| 134 | 134 | if (enc->codec_id == CODEC_ID_AMR_NB) |
| @@ -157,7 +157,7 @@ static int amr_read_packet(AVFormatContext *s, · 22 unmodified lines | ||
| 157 | 157 | pkt->pos= url_ftell(s->pb); |
| 158 | 158 | pkt->data[0]=toc; |
| 159 | 159 | 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); | |
| 161 | 161 | |
| 162 | 162 | if (read != size-1) |
| 163 | 163 | { |
| @@ -84,16 +84,16 @@ static int read_header(AVFormatContext *s, · 83 unmodified lines | ||
| 84 | 84 | int i, ret; |
| 85 | 85 | |
| 86 | 86 | url_fskip(pb, 4); /* magic number */ |
| 87 | − if (get_le16(pb) != MAX_PAGES) { | |
| 87 | + if (avio_rl16(pb) != MAX_PAGES) { | |
| 88 | 88 | av_log_ask_for_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES) "\n"); |
| 89 | 89 | return AVERROR_INVALIDDATA; |
| 90 | 90 | } |
| 91 | 91 | |
| 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); | |
| 94 | 94 | 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) | |
| 97 | 97 | return AVERROR_INVALIDDATA; |
| 98 | 98 | |
| 99 | 99 | /* video stream */ |
| @@ -103,32 +103,32 @@ static int read_header(AVFormatContext *s, · 3 unmodified lines | ||
| 103 | 103 | st->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| 104 | 104 | st->codec->codec_id = CODEC_ID_ANM; |
| 105 | 105 | 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) | |
| 109 | 109 | goto invalid; |
| 110 | 110 | url_fskip(pb, 1); /* frame rate multiplier info */ |
| 111 | 111 | |
| 112 | 112 | /* ignore last delta record (used for looping) */ |
| 113 | − if (get_byte(pb)) /* has_last_delta */ | |
| 113 | + if (avio_r8(pb)) /* has_last_delta */ | |
| 114 | 114 | anm->nb_records = FFMAX(anm->nb_records - 1, 0); |
| 115 | 115 | |
| 116 | 116 | url_fskip(pb, 1); /* last_delta_valid */ |
| 117 | 117 | |
| 118 | − if (get_byte(pb) != 0) | |
| 118 | + if (avio_r8(pb) != 0) | |
| 119 | 119 | goto invalid; |
| 120 | 120 | |
| 121 | − if (get_byte(pb) != 1) | |
| 121 | + if (avio_r8(pb) != 1) | |
| 122 | 122 | goto invalid; |
| 123 | 123 | |
| 124 | 124 | url_fskip(pb, 1); /* other recs per frame */ |
| 125 | 125 | |
| 126 | − if (get_byte(pb) != 1) | |
| 126 | + if (avio_r8(pb) != 1) | |
| 127 | 127 | goto invalid; |
| 128 | 128 | |
| 129 | 129 | 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)); | |
| 132 | 132 | url_fskip(pb, 58); |
| 133 | 133 | |
| 134 | 134 | /* color cycling and palette data */ |
| @@ -138,7 +138,7 @@ static int read_header(AVFormatContext *s, · 3 unmodified lines | ||
| 138 | 138 | ret = AVERROR(ENOMEM); |
| 139 | 139 | goto close_and_return; |
| 140 | 140 | } |
| 141 | − ret = get_buffer(pb, st->codec->extradata, st->codec->extradata_size); | |
| 141 | + ret = avio_read(pb, st->codec->extradata, st->codec->extradata_size); | |
| 142 | 142 | if (ret < 0) |
| 143 | 143 | goto close_and_return; |
| 144 | 144 | |
| @@ -149,9 +149,9 @@ static int read_header(AVFormatContext *s, · 4 unmodified lines | ||
| 149 | 149 | |
| 150 | 150 | for (i = 0; i < MAX_PAGES; i++) { |
| 151 | 151 | 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); | |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | /* find page of first frame */ |
| @@ -211,7 +211,7 @@ repeat: · 53 unmodified lines | ||
| 211 | 211 | tmp = url_ftell(pb); |
| 212 | 212 | url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) + |
| 213 | 213 | 8 + anm->record * 2, SEEK_SET); |
| 214 | − record_size = get_le16(pb); | |
| 214 | + record_size = avio_rl16(pb); | |
| 215 | 215 | url_fseek(pb, tmp, SEEK_SET); |
| 216 | 216 | |
| 217 | 217 | /* fetch record */ |
| @@ -35,9 +35,9 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) · 34 unmodified lines | ||
| 35 | 35 | AVIOContext *pb = s->pb; |
| 36 | 36 | AVStream *st; |
| 37 | 37 | |
| 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 */ | |
| 41 | 41 | |
| 42 | 42 | st = av_new_stream(s, 0); |
| 43 | 43 | if (!st) |
| @@ -46,8 +46,8 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap) · 2 unmodified lines | ||
| 46 | 46 | st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| 47 | 47 | st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS; |
| 48 | 48 | |
| 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); | |
| 51 | 51 | |
| 52 | 52 | st->codec->extradata_size = 2 * 4; |
| 53 | 53 | 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 | ||
| 56 | 56 | return AVERROR(ENOMEM); |
| 57 | 57 | |
| 58 | 58 | /* initial predictor values for adpcm decoder */ |
| 59 | − get_buffer(pb, st->codec->extradata, 2 * 4); | |
| 59 | + avio_read(pb, st->codec->extradata, 2 * 4); | |
| 60 | 60 | |
| 61 | 61 | st->codec->channels = 1; |
| 62 | − if (get_le32(pb)) | |
| 62 | + if (avio_rl32(pb)) | |
| 63 | 63 | st->codec->channels = 2; |
| 64 | 64 | |
| 65 | 65 | st->codec->bits_per_coded_sample = 4; |
| @@ -162,11 +162,11 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) · 161 unmodified lines | ||
| 162 | 162 | /* TODO: Skip any leading junk such as id3v2 tags */ |
| 163 | 163 | ape->junklength = 0; |
| 164 | 164 | |
| 165 | − tag = get_le32(pb); | |
| 165 | + tag = avio_rl32(pb); | |
| 166 | 166 | if (tag != MKTAG('M', 'A', 'C', ' ')) |
| 167 | 167 | return -1; |
| 168 | 168 | |
| 169 | − ape->fileversion = get_le16(pb); | |
| 169 | + ape->fileversion = avio_rl16(pb); | |
| 170 | 170 | |
| 171 | 171 | if (ape->fileversion < APE_MIN_VERSION || ape->fileversion > APE_MAX_VERSION) { |
| 172 | 172 | 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 | ||
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | 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); | |
| 186 | 186 | |
| 187 | 187 | /* Skip any unknown bytes at the end of the descriptor. |
| 188 | 188 | This is for future compatibility */ |
| @@ -190,26 +190,26 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) · 1 unmodified line | ||
| 190 | 190 | url_fseek(pb, ape->descriptorlength - 52, SEEK_CUR); |
| 191 | 191 | |
| 192 | 192 | /* 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); | |
| 201 | 201 | } else { |
| 202 | 202 | ape->descriptorlength = 0; |
| 203 | 203 | ape->headerlength = 32; |
| 204 | 204 | |
| 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); | |
| 213 | 213 | |
| 214 | 214 | if (ape->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) { |
| 215 | 215 | 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 | ||
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | if (ape->formatflags & MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS) { |
| 220 | − ape->seektablelength = get_le32(pb); | |
| 220 | + ape->seektablelength = avio_rl32(pb); | |
| 221 | 221 | ape->headerlength += 4; |
| 222 | 222 | ape->seektablelength *= sizeof(int32_t); |
| 223 | 223 | } else |
| @@ -260,7 +260,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) · 36 unmodified lines | ||
| 260 | 260 | if (ape->seektablelength > 0) { |
| 261 | 261 | ape->seektable = av_malloc(ape->seektablelength); |
| 262 | 262 | for (i = 0; i < ape->seektablelength / sizeof(uint32_t); i++) |
| 263 | − ape->seektable[i] = get_le32(pb); | |
| 263 | + ape->seektable[i] = avio_rl32(pb); | |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | ape->frames[0].pos = ape->firstframe; |
| @@ -355,7 +355,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt) · 88 unmodified lines | ||
| 355 | 355 | |
| 356 | 356 | AV_WL32(pkt->data , nblocks); |
| 357 | 357 | 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); | |
| 359 | 359 | |
| 360 | 360 | pkt->pts = ape->frames[ape->currentframe].pts; |
| 361 | 361 | pkt->stream_index = 0; |
| @@ -38,10 +38,10 @@ static int ape_tag_read_field(AVFormatContext *s) · 37 unmodified lines | ||
| 38 | 38 | uint32_t size, flags; |
| 39 | 39 | int i, c; |
| 40 | 40 | |
| 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 */ | |
| 43 | 43 | for (i = 0; i < sizeof(key) - 1; i++) { |
| 44 | − c = get_byte(pb); | |
| 44 | + c = avio_r8(pb); | |
| 45 | 45 | if (c < 0x20 || c > 0x7E) |
| 46 | 46 | break; |
| 47 | 47 | else |
| @@ -57,7 +57,7 @@ static int ape_tag_read_field(AVFormatContext *s) · 9 unmodified lines | ||
| 57 | 57 | value = av_malloc(size+1); |
| 58 | 58 | if (!value) |
| 59 | 59 | return AVERROR(ENOMEM); |
| 60 | − get_buffer(pb, value, size); | |
| 60 | + avio_read(pb, value, size); | |
| 61 | 61 | value[size] = 0; |
| 62 | 62 | av_metadata_set2(&s->metadata, key, value, AV_METADATA_DONT_STRDUP_VAL); |
| 63 | 63 | return 0; |
| @@ -76,30 +76,30 @@ void ff_ape_parse_tag(AVFormatContext *s) · 12 unmodified lines | ||
| 76 | 76 | |
| 77 | 77 | url_fseek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET); |
| 78 | 78 | |
| 79 | − get_buffer(pb, buf, 8); /* APETAGEX */ | |
| 79 | + avio_read(pb, buf, 8); /* APETAGEX */ | |
| 80 | 80 | if (strncmp(buf, "APETAGEX", 8)) { |
| 81 | 81 | return; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | − val = get_le32(pb); /* APE tag version */ | |
| 84 | + val = avio_rl32(pb); /* APE tag version */ | |
| 85 | 85 | if (val > APE_TAG_VERSION) { |
| 86 | 86 | av_log(s, AV_LOG_ERROR, "Unsupported tag version. (>=%d)\n", APE_TAG_VERSION); |
| 87 | 87 | return; |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | − tag_bytes = get_le32(pb); /* tag size */ | |
| 90 | + tag_bytes = avio_rl32(pb); /* tag size */ | |
| 91 | 91 | if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) { |
| 92 | 92 | av_log(s, AV_LOG_ERROR, "Tag size is way too big\n"); |
| 93 | 93 | return; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | − fields = get_le32(pb); /* number of fields */ | |
| 96 | + fields = avio_rl32(pb); /* number of fields */ | |
| 97 | 97 | if (fields > 65536) { |
| 98 | 98 | av_log(s, AV_LOG_ERROR, "Too many tag fields (%d)\n", fields); |
| 99 | 99 | return; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | − val = get_le32(pb); /* flags */ | |
| 102 | + val = avio_rl32(pb); /* flags */ | |
| 103 | 103 | if (val & APE_TAG_FLAG_IS_HEADER) { |
| 104 | 104 | av_log(s, AV_LOG_ERROR, "APE Tag is a header\n"); |
| 105 | 105 | return; |
| @@ -135,7 +135,7 @@ static void print_guid(const ff_asf_guid *g) · 134 unmodified lines | ||
| 135 | 135 | void ff_get_guid(AVIOContext *s, ff_asf_guid *g) |
| 136 | 136 | { |
| 137 | 137 | assert(sizeof(*g) == 16); |
| 138 | − get_buffer(s, *g, sizeof(*g)); | |
| 138 | + avio_read(s, *g, sizeof(*g)); | |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | static int asf_probe(AVProbeData *pd) |
| @@ -149,10 +149,10 @@ static int asf_probe(AVProbeData *pd) · 7 unmodified lines | ||
| 149 | 149 | |
| 150 | 150 | static int get_value(AVIOContext *pb, int type){ |
| 151 | 151 | 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); | |
| 156 | 156 | default:return INT_MIN; |
| 157 | 157 | } |
| 158 | 158 | } |
| @@ -191,17 +191,17 @@ static int asf_read_file_properties(AVFormatContext *s, int64_t size) · 32 unmodified lines | ||
| 191 | 191 | AVIOContext *pb = s->pb; |
| 192 | 192 | |
| 193 | 193 | 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); | |
| 205 | 205 | s->packet_size = asf->hdr.max_pktsize; |
| 206 | 206 | |
| 207 | 207 | return 0; |
| @@ -263,14 +263,14 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) · 55 unmodified lines | ||
| 263 | 263 | return -1; |
| 264 | 264 | } |
| 265 | 265 | 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 */ | |
| 270 | 270 | // mapping of asf ID to AV stream ID; |
| 271 | 271 | asf->asfid2avid[st->id] = s->nb_streams - 1; |
| 272 | 272 | |
| 273 | − get_le32(pb); | |
| 273 | + avio_rl32(pb); | |
| 274 | 274 | |
| 275 | 275 | if (test_for_ext_stream_audio) { |
| 276 | 276 | ff_get_guid(pb, &g); |
| @@ -278,11 +278,11 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) · 1 unmodified line | ||
| 278 | 278 | type = AVMEDIA_TYPE_AUDIO; |
| 279 | 279 | is_dvr_ms_audio=1; |
| 280 | 280 | 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); | |
| 284 | 284 | ff_get_guid(pb, &g); |
| 285 | − get_le32(pb); | |
| 285 | + avio_rl32(pb); | |
| 286 | 286 | } |
| 287 | 287 | } |
| 288 | 288 | |
| @@ -303,11 +303,11 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) · 14 unmodified lines | ||
| 303 | 303 | /* We have to init the frame size at some point .... */ |
| 304 | 304 | pos2 = url_ftell(pb); |
| 305 | 305 | 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 | |
| 311 | 311 | } |
| 312 | 312 | //printf("Descrambling: ps:%d cs:%d ds:%d s:%d sd:%d\n", |
| 313 | 313 | // 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 | ||
| 339 | 339 | } |
| 340 | 340 | } else if (type == AVMEDIA_TYPE_VIDEO && |
| 341 | 341 | 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); | |
| 349 | 349 | /* 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); | |
| 353 | 353 | url_fskip(pb, 20); |
| 354 | 354 | // av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX); |
| 355 | 355 | if (sizeX > 40) { |
| 356 | 356 | st->codec->extradata_size = sizeX - 40; |
| 357 | 357 | 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); | |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | /* 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 | ||
| 402 | 402 | uint32_t ext_d, leak_rate, stream_num; |
| 403 | 403 | unsigned int stream_languageid_index; |
| 404 | 404 | |
| 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 | |
| 418 | 418 | if (stream_num < 128) |
| 419 | 419 | asf->streams[stream_num].stream_language_index = stream_languageid_index; |
| 420 | 420 | |
| 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 | |
| 424 | 424 | |
| 425 | 425 | if (stream_num < 128) |
| 426 | 426 | asf->stream_bitrates[stream_num] = leak_rate; |
| 427 | 427 | |
| 428 | 428 | 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); | |
| 431 | 431 | url_fseek(pb, ext_len, SEEK_CUR); |
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | for (i=0; i<payload_ext_ct; i++){ |
| 435 | 435 | 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); | |
| 438 | 438 | url_fseek(pb, ext_len, SEEK_CUR); |
| 439 | 439 | } |
| 440 | 440 | |
| @@ -446,11 +446,11 @@ static int asf_read_content_desc(AVFormatContext *s, int64_t size) · 5 unmodified lines | ||
| 446 | 446 | AVIOContext *pb = s->pb; |
| 447 | 447 | int len1, len2, len3, len4, len5; |
| 448 | 448 | |
| 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); | |
| 454 | 454 | get_tag(s, "title" , 0, len1); |
| 455 | 455 | get_tag(s, "author" , 0, len2); |
| 456 | 456 | 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 | ||
| 466 | 466 | ASFContext *asf = s->priv_data; |
| 467 | 467 | int desc_count, i, ret; |
| 468 | 468 | |
| 469 | − desc_count = get_le16(pb); | |
| 469 | + desc_count = avio_rl16(pb); | |
| 470 | 470 | for(i=0;i<desc_count;i++) { |
| 471 | 471 | int name_len,value_type,value_len; |
| 472 | 472 | char name[1024]; |
| 473 | 473 | |
| 474 | − name_len = get_le16(pb); | |
| 474 | + name_len = avio_rl16(pb); | |
| 475 | 475 | if (name_len%2) // must be even, broken lavf versions wrote len-1 |
| 476 | 476 | name_len += 1; |
| 477 | 477 | if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len) |
| 478 | 478 | 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); | |
| 481 | 481 | if (!value_type && value_len%2) |
| 482 | 482 | value_len += 1; |
| 483 | 483 | /** |
| @@ -500,10 +500,10 @@ static int asf_read_language_list(AVFormatContext *s, int64_t size) · 16 unmodified lines | ||
| 500 | 500 | AVIOContext *pb = s->pb; |
| 501 | 501 | ASFContext *asf = s->priv_data; |
| 502 | 502 | int j, ret; |
| 503 | − int stream_count = get_le16(pb); | |
| 503 | + int stream_count = avio_rl16(pb); | |
| 504 | 504 | for(j = 0; j < stream_count; j++) { |
| 505 | 505 | char lang[6]; |
| 506 | − unsigned int lang_len = get_byte(pb); | |
| 506 | + unsigned int lang_len = avio_r8(pb); | |
| 507 | 507 | if ((ret = avio_get_str16le(pb, lang_len, lang, sizeof(lang))) < lang_len) |
| 508 | 508 | url_fskip(pb, lang_len - ret); |
| 509 | 509 | if (j < 128) |
| @@ -519,21 +519,21 @@ static int asf_read_metadata(AVFormatContext *s, int64_t size) · 9 unmodified lines | ||
| 519 | 519 | ASFContext *asf = s->priv_data; |
| 520 | 520 | int n, stream_num, name_len, value_len, value_type, value_num; |
| 521 | 521 | int ret, i; |
| 522 | − n = get_le16(pb); | |
| 522 | + n = avio_rl16(pb); | |
| 523 | 523 | |
| 524 | 524 | for(i=0;i<n;i++) { |
| 525 | 525 | char name[1024]; |
| 526 | 526 | |
| 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); | |
| 532 | 532 | |
| 533 | 533 | if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len) |
| 534 | 534 | url_fskip(pb, name_len - ret); |
| 535 | 535 | //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 | |
| 537 | 537 | url_fskip(pb, value_len - 2); |
| 538 | 538 | |
| 539 | 539 | if(stream_num<128){ |
| @@ -551,25 +551,25 @@ static int asf_read_marker(AVFormatContext *s, int64_t size) · 11 unmodified lines | ||
| 551 | 551 | int i, count, name_len, ret; |
| 552 | 552 | char name[1024]; |
| 553 | 553 | |
| 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 | |
| 559 | 559 | for(i=0;i<name_len;i++){ |
| 560 | − get_byte(pb); // skip the name | |
| 560 | + avio_r8(pb); // skip the name | |
| 561 | 561 | } |
| 562 | 562 | |
| 563 | 563 | for(i=0;i<count;i++){ |
| 564 | 564 | int64_t pres_time; |
| 565 | 565 | int name_len; |
| 566 | 566 | |
| 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 | |
| 573 | 573 | if ((ret = avio_get_str16le(pb, name_len * 2, name, sizeof(name))) < name_len) |
| 574 | 574 | url_fskip(pb, name_len - ret); |
| 575 | 575 | 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 | ||
| 589 | 589 | ff_get_guid(pb, &g); |
| 590 | 590 | if (ff_guidcmp(&g, &ff_asf_header)) |
| 591 | 591 | 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); | |
| 596 | 596 | memset(&asf->asfid2avid, -1, sizeof(asf->asfid2avid)); |
| 597 | 597 | for(;;) { |
| 598 | 598 | uint64_t gpos= url_ftell(pb); |
| 599 | 599 | ff_get_guid(pb, &g); |
| 600 | − gsize = get_le64(pb); | |
| 600 | + gsize = avio_rl64(pb); | |
| 601 | 601 | av_dlog(s, "%08"PRIx64": ", gpos); |
| 602 | 602 | print_guid(&g); |
| 603 | 603 | av_dlog(s, " size=0x%"PRIx64"\n", gsize); |
| @@ -634,8 +634,8 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 30 unmodified lines | ||
| 634 | 634 | } else if (!ff_guidcmp(&g, &ff_asf_head1_guid)) { |
| 635 | 635 | int v1, v2; |
| 636 | 636 | 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); | |
| 639 | 639 | continue; |
| 640 | 640 | } else if (!ff_guidcmp(&g, &ff_asf_marker_header)) { |
| 641 | 641 | asf_read_marker(s, gsize); |
| @@ -657,9 +657,9 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 15 unmodified lines | ||
| 657 | 657 | url_fseek(pb, gpos + gsize, SEEK_SET); |
| 658 | 658 | } |
| 659 | 659 | 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); | |
| 663 | 663 | if (url_feof(pb)) |
| 664 | 664 | return -1; |
| 665 | 665 | asf->data_offset = url_ftell(pb); |
| @@ -704,9 +704,9 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 38 unmodified lines | ||
| 704 | 704 | #define DO_2BITS(bits, var, defval) \ |
| 705 | 705 | switch (bits & 3) \ |
| 706 | 706 | { \ |
| 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; \ | |
| 710 | 710 | default: var = defval; break; \ |
| 711 | 711 | } |
| 712 | 712 | |
| @@ -731,7 +731,7 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) · 18 unmodified lines | ||
| 731 | 731 | c=d=e=-1; |
| 732 | 732 | while(off-- > 0){ |
| 733 | 733 | c=d; d=e; |
| 734 | − e= get_byte(pb); | |
| 734 | + e= avio_r8(pb); | |
| 735 | 735 | if(c == 0x82 && !d && !e) |
| 736 | 736 | break; |
| 737 | 737 | } |
| @@ -754,8 +754,8 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) · 16 unmodified lines | ||
| 754 | 754 | av_log(s, AV_LOG_ERROR, "ff asf bad non zero\n"); |
| 755 | 755 | return -1; |
| 756 | 756 | } |
| 757 | − c= get_byte(pb); | |
| 758 | − d= get_byte(pb); | |
| 757 | + c= avio_r8(pb); | |
| 758 | + d= avio_r8(pb); | |
| 759 | 759 | rsize+=3; |
| 760 | 760 | }else{ |
| 761 | 761 | url_fseek(pb, -1, SEEK_CUR); //FIXME |
| @@ -778,12 +778,12 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) · 16 unmodified lines | ||
| 778 | 778 | return -1; |
| 779 | 779 | } |
| 780 | 780 | |
| 781 | − asf->packet_timestamp = get_le32(pb); | |
| 782 | − get_le16(pb); /* duration */ | |
| 781 | + asf->packet_timestamp = avio_rl32(pb); | |
| 782 | + avio_rl16(pb); /* duration */ | |
| 783 | 783 | // rsize has at least 11 bytes which have to be present |
| 784 | 784 | |
| 785 | 785 | if (asf->packet_flags & 0x01) { |
| 786 | − asf->packet_segsizetype = get_byte(pb); rsize++; | |
| 786 | + asf->packet_segsizetype = avio_r8(pb); rsize++; | |
| 787 | 787 | asf->packet_segments = asf->packet_segsizetype & 0x3f; |
| 788 | 788 | } else { |
| 789 | 789 | asf->packet_segments = 1; |
| @@ -804,7 +804,7 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb) · 14 unmodified lines | ||
| 804 | 804 | static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ |
| 805 | 805 | ASFContext *asf = s->priv_data; |
| 806 | 806 | int rsize = 1; |
| 807 | − int num = get_byte(pb); | |
| 807 | + int num = avio_r8(pb); | |
| 808 | 808 | int64_t ts0, ts1; |
| 809 | 809 | |
| 810 | 810 | asf->packet_segments--; |
| @@ -816,21 +816,21 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ · 5 unmodified lines | ||
| 816 | 816 | DO_2BITS(asf->packet_property, asf->packet_replic_size, 0); |
| 817 | 817 | //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); |
| 818 | 818 | if (asf->packet_replic_size >= 8) { |
| 819 | − asf->packet_obj_size = get_le32(pb); | |
| 819 | + asf->packet_obj_size = avio_rl32(pb); | |
| 820 | 820 | if(asf->packet_obj_size >= (1<<24) || asf->packet_obj_size <= 0){ |
| 821 | 821 | av_log(s, AV_LOG_ERROR, "packet_obj_size invalid\n"); |
| 822 | 822 | return -1; |
| 823 | 823 | } |
| 824 | − asf->packet_frag_timestamp = get_le32(pb); // timestamp | |
| 824 | + asf->packet_frag_timestamp = avio_rl32(pb); // timestamp | |
| 825 | 825 | if(asf->packet_replic_size >= 8+38+4){ |
| 826 | 826 | // 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)); | |
| 828 | 828 | // av_log(s, AV_LOG_DEBUG, "\n"); |
| 829 | 829 | url_fskip(pb, 10); |
| 830 | − ts0= get_le64(pb); | |
| 831 | − ts1= get_le64(pb); | |
| 830 | + ts0= avio_rl64(pb); | |
| 831 | + ts1= avio_rl64(pb); | |
| 832 | 832 | url_fskip(pb, 12); |
| 833 | − get_le32(pb); | |
| 833 | + avio_rl32(pb); | |
| 834 | 834 | url_fskip(pb, asf->packet_replic_size - 8 - 38 - 4); |
| 835 | 835 | if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000; |
| 836 | 836 | 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 | ||
| 843 | 843 | asf->packet_frag_offset = 0; |
| 844 | 844 | asf->packet_frag_timestamp = asf->packet_timestamp; |
| 845 | 845 | |
| 846 | − asf->packet_time_delta = get_byte(pb); | |
| 846 | + asf->packet_time_delta = avio_r8(pb); | |
| 847 | 847 | rsize++; |
| 848 | 848 | }else if(asf->packet_replic_size!=0){ |
| 849 | 849 | 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 | ||
| 928 | 928 | // frag_offset is here used as the beginning timestamp |
| 929 | 929 | asf->packet_frag_timestamp = asf->packet_time_start; |
| 930 | 930 | 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); | |
| 932 | 932 | asf->packet_size_left--; |
| 933 | 933 | asf->packet_multi_size--; |
| 934 | 934 | 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 | ||
| 988 | 988 | continue; |
| 989 | 989 | } |
| 990 | 990 | |
| 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, | |
| 992 | 992 | asf->packet_frag_size); |
| 993 | 993 | if (ret != asf->packet_frag_size) { |
| 994 | 994 | 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 | ||
| 1194 | 1194 | /* the data object can be followed by other top-level objects, |
| 1195 | 1195 | skip them until the simple index object is reached */ |
| 1196 | 1196 | while (ff_guidcmp(&g, &index_guid)) { |
| 1197 | − int64_t gsize= get_le64(s->pb); | |
| 1197 | + int64_t gsize= avio_rl64(s->pb); | |
| 1198 | 1198 | if (gsize < 24 || url_feof(s->pb)) { |
| 1199 | 1199 | url_fseek(s->pb, current_pos, SEEK_SET); |
| 1200 | 1200 | return; |
| @@ -1206,16 +1206,16 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index) · 5 unmodified lines | ||
| 1206 | 1206 | { |
| 1207 | 1207 | int64_t itime, last_pos=-1; |
| 1208 | 1208 | int pct, ict; |
| 1209 | − int64_t av_unused gsize= get_le64(s->pb); | |
| 1209 | + int64_t av_unused gsize= avio_rl64(s->pb); | |
| 1210 | 1210 | 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); | |
| 1214 | 1214 | av_log(s, AV_LOG_DEBUG, "itime:0x%"PRIx64", pct:%d, ict:%d\n",itime,pct,ict); |
| 1215 | 1215 | |
| 1216 | 1216 | 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); | |
| 1219 | 1219 | int64_t pos = s->data_offset + s->packet_size*(int64_t)pktnum; |
| 1220 | 1220 | int64_t index_pts= av_rescale(itime, i, 10000); |
| 1221 | 1221 | |
| @@ -127,15 +127,15 @@ static int au_read_header(AVFormatContext *s, · 126 unmodified lines | ||
| 127 | 127 | AVStream *st; |
| 128 | 128 | |
| 129 | 129 | /* check ".snd" header */ |
| 130 | − tag = get_le32(pb); | |
| 130 | + tag = avio_rl32(pb); | |
| 131 | 131 | if (tag != MKTAG('.', 's', 'n', 'd')) |
| 132 | 132 | 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 */ | |
| 135 | 135 | |
| 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); | |
| 139 | 139 | |
| 140 | 140 | codec = ff_codec_get_id(codec_au_tags, id); |
| 141 | 141 | |
| @@ -107,10 +107,10 @@ static int get_riff(AVFormatContext *s, AVIOContext *pb) · 106 unmodified lines | ||
| 107 | 107 | int i; |
| 108 | 108 | |
| 109 | 109 | /* 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 */ | |
| 112 | 112 | avi->riff_end += url_ftell(pb); /* RIFF chunk end */ |
| 113 | − get_buffer(pb, header+4, 4); | |
| 113 | + avio_read(pb, header+4, 4); | |
| 114 | 114 | |
| 115 | 115 | for(i=0; avi_headers[i][0]; i++) |
| 116 | 116 | if(!memcmp(header, avi_headers[i], 8)) |
| @@ -127,12 +127,12 @@ static int get_riff(AVFormatContext *s, AVIOContext *pb) · 10 unmodified lines | ||
| 127 | 127 | static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ |
| 128 | 128 | AVIContext *avi = s->priv_data; |
| 129 | 129 | 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); | |
| 136 | 136 | int stream_id= 10*((chunk_id&0xFF) - '0') + (((chunk_id>>8)&0xFF) - '0'); |
| 137 | 137 | AVStream *st; |
| 138 | 138 | AVIStream *ast; |
| @@ -153,7 +153,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ · 14 unmodified lines | ||
| 153 | 153 | if(index_sub_type) |
| 154 | 154 | return -1; |
| 155 | 155 | |
| 156 | − get_le32(pb); | |
| 156 | + avio_rl32(pb); | |
| 157 | 157 | |
| 158 | 158 | if(index_type && longs_pre_entry != 2) |
| 159 | 159 | return -1; |
| @@ -170,8 +170,8 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ · 10 unmodified lines | ||
| 170 | 170 | |
| 171 | 171 | for(i=0; i<entries_in_use; i++){ |
| 172 | 172 | 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); | |
| 175 | 175 | int key= len >= 0; |
| 176 | 176 | len &= 0x7FFFFFFF; |
| 177 | 177 | |
| @@ -191,9 +191,9 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ · 13 unmodified lines | ||
| 191 | 191 | }else{ |
| 192 | 192 | int64_t offset, pos; |
| 193 | 193 | 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); | |
| 197 | 197 | |
| 198 | 198 | if(url_feof(pb)) |
| 199 | 199 | return -1; |
| @@ -256,7 +256,7 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag, uint32_t · 56 unmodified lines | ||
| 256 | 256 | value = av_malloc(size+1); |
| 257 | 257 | if (!value) |
| 258 | 258 | return -1; |
| 259 | − get_buffer(pb, value, size); | |
| 259 | + avio_read(pb, value, size); | |
| 260 | 260 | value[size]=0; |
| 261 | 261 | |
| 262 | 262 | 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 | ||
| 268 | 268 | static void avi_read_info(AVFormatContext *s, uint64_t end) |
| 269 | 269 | { |
| 270 | 270 | 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); | |
| 273 | 273 | avi_read_tag(s, NULL, tag, size); |
| 274 | 274 | } |
| 275 | 275 | } |
| @@ -299,17 +299,17 @@ static void avi_metadata_creation_time(AVMetadata **metadata, char *date) · 23 unmodified lines | ||
| 299 | 299 | static void avi_read_nikon(AVFormatContext *s, uint64_t end) |
| 300 | 300 | { |
| 301 | 301 | 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); | |
| 304 | 304 | switch (tag) { |
| 305 | 305 | case MKTAG('n', 'c', 't', 'g'): { /* Nikon Tags */ |
| 306 | 306 | uint64_t tag_end = url_ftell(s->pb) + size; |
| 307 | 307 | 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); | |
| 310 | 310 | const char *name = NULL; |
| 311 | 311 | char buffer[64] = {0}; |
| 312 | − size -= get_buffer(s->pb, buffer, | |
| 312 | + size -= avio_read(s->pb, buffer, | |
| 313 | 313 | FFMIN(size, sizeof(buffer)-1)); |
| 314 | 314 | switch (tag) { |
| 315 | 315 | case 0x03: name = "maker"; break; |
| @@ -362,8 +362,8 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 46 unmodified lines | ||
| 362 | 362 | for(;;) { |
| 363 | 363 | if (url_feof(pb)) |
| 364 | 364 | goto fail; |
| 365 | − tag = get_le32(pb); | |
| 366 | − size = get_le32(pb); | |
| 365 | + tag = avio_rl32(pb); | |
| 366 | + size = avio_rl32(pb); | |
| 367 | 367 | |
| 368 | 368 | print_tag("tag", tag, size); |
| 369 | 369 | |
| @@ -371,7 +371,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1 unmodified line | ||
| 371 | 371 | case MKTAG('L', 'I', 'S', 'T'): |
| 372 | 372 | list_end = url_ftell(pb) + size; |
| 373 | 373 | /* Ignored, except at start of video packets. */ |
| 374 | − tag1 = get_le32(pb); | |
| 374 | + tag1 = avio_rl32(pb); | |
| 375 | 375 | |
| 376 | 376 | print_tag("list", tag1, 0); |
| 377 | 377 | |
| @@ -391,7 +391,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 13 unmodified lines | ||
| 391 | 391 | case MKTAG('I', 'D', 'I', 'T'): { |
| 392 | 392 | unsigned char date[64] = {0}; |
| 393 | 393 | 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)); | |
| 395 | 395 | url_fskip(pb, size); |
| 396 | 396 | avi_metadata_creation_time(&s->metadata, date); |
| 397 | 397 | break; |
| @@ -405,24 +405,24 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 7 unmodified lines | ||
| 405 | 405 | case MKTAG('a', 'v', 'i', 'h'): |
| 406 | 406 | /* AVI header */ |
| 407 | 407 | /* 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; | |
| 412 | 412 | |
| 413 | 413 | 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); | |
| 418 | 418 | |
| 419 | 419 | url_fskip(pb, size - 10 * 4); |
| 420 | 420 | break; |
| 421 | 421 | case MKTAG('s', 't', 'r', 'h'): |
| 422 | 422 | /* stream header */ |
| 423 | 423 | |
| 424 | − tag1 = get_le32(pb); | |
| 425 | − handler = get_le32(pb); /* codec tag */ | |
| 424 | + tag1 = avio_rl32(pb); | |
| 425 | + handler = avio_rl32(pb); /* codec tag */ | |
| 426 | 426 | |
| 427 | 427 | if(tag1 == MKTAG('p', 'a', 'd', 's')){ |
| 428 | 428 | url_fskip(pb, size - 8); |
| @@ -470,11 +470,11 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 41 unmodified lines | ||
| 470 | 470 | } |
| 471 | 471 | s->streams[0]->priv_data = ast; |
| 472 | 472 | 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); | |
| 475 | 475 | url_fskip(pb, 4); /* start time */ |
| 476 | 476 | |
| 477 | − dv_dur = get_le32(pb); | |
| 477 | + dv_dur = avio_rl32(pb); | |
| 478 | 478 | if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) { |
| 479 | 479 | dv_dur *= AV_TIME_BASE; |
| 480 | 480 | 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 | ||
| 492 | 492 | assert(stream_index < s->nb_streams); |
| 493 | 493 | st->codec->stream_codec_tag= handler; |
| 494 | 494 | |
| 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); | |
| 501 | 501 | if(!(ast->scale && ast->rate)){ |
| 502 | 502 | 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); |
| 503 | 503 | if(frame_period){ |
| @@ -510,13 +510,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 6 unmodified lines | ||
| 510 | 510 | } |
| 511 | 511 | av_set_pts_info(st, 64, ast->scale, ast->rate); |
| 512 | 512 | |
| 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); | |
| 515 | 515 | |
| 516 | 516 | 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 */ | |
| 520 | 520 | ast->cum_len *= FFMAX(1, ast->sample_size); |
| 521 | 521 | // av_log(s, AV_LOG_DEBUG, "%d %d %d %d\n", ast->rate, ast->scale, ast->start, ast->sample_size); |
| 522 | 522 | |
| @@ -579,11 +579,11 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 56 unmodified lines | ||
| 579 | 579 | st->codec->extradata_size= 0; |
| 580 | 580 | return AVERROR(ENOMEM); |
| 581 | 581 | } |
| 582 | − get_buffer(pb, st->codec->extradata, st->codec->extradata_size); | |
| 582 | + avio_read(pb, st->codec->extradata, st->codec->extradata_size); | |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | 585 | if(st->codec->extradata_size & 1) //FIXME check if the encoder really did this correctly |
| 586 | − get_byte(pb); | |
| 586 | + avio_r8(pb); | |
| 587 | 587 | |
| 588 | 588 | /* Extract palette from extradata if bpp <= 8. */ |
| 589 | 589 | /* This code assumes that extradata contains only palette. */ |
| @@ -675,17 +675,17 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) · 85 unmodified lines | ||
| 675 | 675 | AVRational active, active_aspect; |
| 676 | 676 | |
| 677 | 677 | 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 | |
| 689 | 689 | |
| 690 | 690 | if(active_aspect.num && active_aspect.den && active.num && active.den){ |
| 691 | 691 | 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 | ||
| 756 | 756 | pkt->size - 7, |
| 757 | 757 | 0, NULL, NULL, NULL, NULL); |
| 758 | 758 | AVProbeData pd; |
| 759 | − unsigned int desc_len = get_le32(pb); | |
| 759 | + unsigned int desc_len = avio_rl32(pb); | |
| 760 | 760 | |
| 761 | 761 | if (desc_len > pb->buf_end - pb->buf_ptr) |
| 762 | 762 | goto error; |
| @@ -766,8 +766,8 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) { · 3 unmodified lines | ||
| 766 | 766 | if (*desc) |
| 767 | 767 | av_metadata_set2(&st->metadata, "title", desc, 0); |
| 768 | 768 | |
| 769 | − get_le16(pb); /* flags? */ | |
| 770 | − get_le32(pb); /* data size */ | |
| 769 | + avio_rl16(pb); /* flags? */ | |
| 770 | + avio_rl32(pb); /* data size */ | |
| 771 | 771 | |
| 772 | 772 | pd = (AVProbeData) { .buf = pb->buf_ptr, .buf_size = pb->buf_end - pb->buf_ptr }; |
| 773 | 773 | if (!(sub_demuxer = av_probe_input_format2(&pd, 1, &score))) |
| @@ -994,7 +994,7 @@ resync: · 220 unmodified lines | ||
| 994 | 994 | |
| 995 | 995 | for(j=0; j<7; j++) |
| 996 | 996 | d[j]= d[j+1]; |
| 997 | − d[7]= get_byte(pb); | |
| 997 | + d[7]= avio_r8(pb); | |
| 998 | 998 | |
| 999 | 999 | size= d[4] + (d[5]<<8) + (d[6]<<16) + (d[7]<<24); |
| 1000 | 1000 | |
| @@ -1065,13 +1065,13 @@ resync: · 64 unmodified lines | ||
| 1065 | 1065 | } |
| 1066 | 1066 | |
| 1067 | 1067 | 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; | |
| 1070 | 1070 | |
| 1071 | − get_le16(pb); //flags | |
| 1071 | + avio_rl16(pb); //flags | |
| 1072 | 1072 | |
| 1073 | 1073 | 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); | |
| 1075 | 1075 | ast->has_pal= 1; |
| 1076 | 1076 | goto resync; |
| 1077 | 1077 | } 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 | ||
| 1123 | 1123 | |
| 1124 | 1124 | /* Read the entries and sort them in each stream component. */ |
| 1125 | 1125 | 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); | |
| 1130 | 1130 | #if defined(DEBUG_SEEK) |
| 1131 | 1131 | av_log(s, AV_LOG_DEBUG, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/", |
| 1132 | 1132 | i, tag, flags, pos, len); |
| @@ -1175,7 +1175,7 @@ static int guess_ni_flag(AVFormatContext *s){ · 42 unmodified lines | ||
| 1175 | 1175 | if(n >= 2){ |
| 1176 | 1176 | int64_t pos= st->index_entries[0].pos; |
| 1177 | 1177 | url_fseek(s->pb, pos + 4, SEEK_SET); |
| 1178 | − size= get_le32(s->pb); | |
| 1178 | + size= avio_rl32(s->pb); | |
| 1179 | 1179 | if(pos + size > st->index_entries[1].pos) |
| 1180 | 1180 | last_start= INT64_MAX; |
| 1181 | 1181 | } |
| @@ -1205,8 +1205,8 @@ static int avi_load_index(AVFormatContext *s) · 23 unmodified lines | ||
| 1205 | 1205 | for(;;) { |
| 1206 | 1206 | if (url_feof(pb)) |
| 1207 | 1207 | break; |
| 1208 | − tag = get_le32(pb); | |
| 1209 | − size = get_le32(pb); | |
| 1208 | + tag = avio_rl32(pb); | |
| 1209 | + size = avio_rl32(pb); | |
| 1210 | 1210 | #ifdef DEBUG_SEEK |
| 1211 | 1211 | printf("tag=%c%c%c%c size=0x%x\n", |
| 1212 | 1212 | tag & 0xff, |
| @@ -378,6 +378,25 @@ attribute_deprecated AVIOContext *av_alloc_put_byte( · 377 unmodified lines | ||
| 378 | 378 | int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), |
| 379 | 379 | int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), |
| 380 | 380 | 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 | + */ | |
| 381 | 400 | #endif |
| 382 | 401 | |
| 383 | 402 | AVIOContext *avio_alloc_context( |
| @@ -477,7 +496,7 @@ void put_flush_packet(AVIOContext *s); · 93 unmodified lines | ||
| 477 | 496 | * Read size bytes from AVIOContext into buf. |
| 478 | 497 | * @return number of bytes read or AVERROR |
| 479 | 498 | */ |
| 480 | −int get_buffer(AVIOContext *s, unsigned char *buf, int size); | |
| 499 | +int avio_read(AVIOContext *s, unsigned char *buf, int size); | |
| 481 | 500 | |
| 482 | 501 | /** |
| 483 | 502 | * 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 | ||
| 489 | 508 | |
| 490 | 509 | /** @note return 0 if EOF, so you cannot use it if EOF handling is |
| 491 | 510 | 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); | |
| 497 | 516 | |
| 498 | 517 | /** |
| 499 | 518 | * 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 | ||
| 505 | 524 | int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); |
| 506 | 525 | |
| 507 | 526 | 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); | |
| 512 | 531 | |
| 513 | 532 | uint64_t ff_get_v(AVIOContext *bc); |
| 514 | 533 | |
| @@ -298,6 +298,32 @@ void put_strz(AVIOContext *s, const char *str) · 297 unmodified lines | ||
| 298 | 298 | { |
| 299 | 299 | avio_put_str(s, str); |
| 300 | 300 | } |
| 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 | +} | |
| 301 | 327 | #endif |
| 302 | 328 | |
| 303 | 329 | int avio_put_str(AVIOContext *s, const char *str) |
| @@ -457,7 +483,7 @@ void init_checksum(AVIOContext *s, · 153 unmodified lines | ||
| 457 | 483 | } |
| 458 | 484 | |
| 459 | 485 | /* XXX: put an inline version */ |
| 460 | −int get_byte(AVIOContext *s) | |
| 486 | +int avio_r8(AVIOContext *s) | |
| 461 | 487 | { |
| 462 | 488 | if (s->buf_ptr >= s->buf_end) |
| 463 | 489 | fill_buffer(s); |
| @@ -475,7 +501,7 @@ int url_fgetc(AVIOContext *s) · 11 unmodified lines | ||
| 475 | 501 | return URL_EOF; |
| 476 | 502 | } |
| 477 | 503 | |
| 478 | −int get_buffer(AVIOContext *s, unsigned char *buf, int size) | |
| 504 | +int avio_read(AVIOContext *s, unsigned char *buf, int size) | |
| 479 | 505 | { |
| 480 | 506 | int len, size1; |
| 481 | 507 | |
| @@ -545,58 +571,58 @@ int get_partial_buffer(AVIOContext *s, unsigned char *buf, int size) · 63 unmodified lines | ||
| 545 | 571 | return len; |
| 546 | 572 | } |
| 547 | 573 | |
| 548 | −unsigned int get_le16(AVIOContext *s) | |
| 574 | +unsigned int avio_rl16(AVIOContext *s) | |
| 549 | 575 | { |
| 550 | 576 | 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; | |
| 553 | 579 | return val; |
| 554 | 580 | } |
| 555 | 581 | |
| 556 | −unsigned int get_le24(AVIOContext *s) | |
| 582 | +unsigned int avio_rl24(AVIOContext *s) | |
| 557 | 583 | { |
| 558 | 584 | 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; | |
| 561 | 587 | return val; |
| 562 | 588 | } |
| 563 | 589 | |
| 564 | −unsigned int get_le32(AVIOContext *s) | |
| 590 | +unsigned int avio_rl32(AVIOContext *s) | |
| 565 | 591 | { |
| 566 | 592 | 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; | |
| 569 | 595 | return val; |
| 570 | 596 | } |
| 571 | 597 | |
| 572 | −uint64_t get_le64(AVIOContext *s) | |
| 598 | +uint64_t avio_rl64(AVIOContext *s) | |
| 573 | 599 | { |
| 574 | 600 | 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; | |
| 577 | 603 | return val; |
| 578 | 604 | } |
| 579 | 605 | |
| 580 | −unsigned int get_be16(AVIOContext *s) | |
| 606 | +unsigned int avio_rb16(AVIOContext *s) | |
| 581 | 607 | { |
| 582 | 608 | 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); | |
| 585 | 611 | return val; |
| 586 | 612 | } |
| 587 | 613 | |
| 588 | −unsigned int get_be24(AVIOContext *s) | |
| 614 | +unsigned int avio_rb24(AVIOContext *s) | |
| 589 | 615 | { |
| 590 | 616 | 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); | |
| 593 | 619 | return val; |
| 594 | 620 | } |
| 595 | −unsigned int get_be32(AVIOContext *s) | |
| 621 | +unsigned int avio_rb32(AVIOContext *s) | |
| 596 | 622 | { |
| 597 | 623 | 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); | |
| 600 | 626 | return val; |
| 601 | 627 | } |
| 602 | 628 | |
| @@ -605,7 +631,7 @@ char *get_strz(AVIOContext *s, char *buf, int maxlen) · 2 unmodified lines | ||
| 605 | 631 | int i = 0; |
| 606 | 632 | char c; |
| 607 | 633 | |
| 608 | − while ((c = get_byte(s))) { | |
| 634 | + while ((c = avio_r8(s))) { | |
| 609 | 635 | if (i < maxlen-1) |
| 610 | 636 | buf[i++] = c; |
| 611 | 637 | } |
| @@ -621,7 +647,7 @@ int ff_get_line(AVIOContext *s, char *buf, int maxlen) · 9 unmodified lines | ||
| 621 | 647 | char c; |
| 622 | 648 | |
| 623 | 649 | do { |
| 624 | − c = get_byte(s); | |
| 650 | + c = avio_r8(s); | |
| 625 | 651 | if (c && i < maxlen-1) |
| 626 | 652 | buf[i++] = c; |
| 627 | 653 | } while (c != '\n' && c); |
| @@ -647,16 +673,16 @@ int ff_get_line(AVIOContext *s, char *buf, int maxlen) · 19 unmodified lines | ||
| 647 | 673 | return ret;\ |
| 648 | 674 | }\ |
| 649 | 675 | |
| 650 | −GET_STR16(le, get_le16) | |
| 651 | −GET_STR16(be, get_be16) | |
| 676 | +GET_STR16(le, avio_rl16) | |
| 677 | +GET_STR16(be, avio_rb16) | |
| 652 | 678 | |
| 653 | 679 | #undef GET_STR16 |
| 654 | 680 | |
| 655 | −uint64_t get_be64(AVIOContext *s) | |
| 681 | +uint64_t avio_rb64(AVIOContext *s) | |
| 656 | 682 | { |
| 657 | 683 | 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); | |
| 660 | 686 | return val; |
| 661 | 687 | } |
| 662 | 688 | |
| @@ -665,7 +691,7 @@ uint64_t ff_get_v(AVIOContext *bc){ · 2 unmodified lines | ||
| 665 | 691 | int tmp; |
| 666 | 692 | |
| 667 | 693 | do{ |
| 668 | − tmp = get_byte(bc); | |
| 694 | + tmp = avio_r8(bc); | |
| 669 | 695 | val= (val<<7) + (tmp&127); |
| 670 | 696 | }while(tmp&128); |
| 671 | 697 | return val; |
| @@ -62,11 +62,11 @@ static int avs_read_header(AVFormatContext * s, AVFormatParameters * ap) · 61 unmodified lines | ||
| 62 | 62 | s->ctx_flags |= AVFMTCTX_NOHEADER; |
| 63 | 63 | |
| 64 | 64 | 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); | |
| 70 | 70 | avs->remaining_frame_size = 0; |
| 71 | 71 | avs->remaining_audio_size = 0; |
| 72 | 72 | |
| @@ -104,7 +104,7 @@ avs_read_video_packet(AVFormatContext * s, AVPacket * pkt, · 31 unmodified lines | ||
| 104 | 104 | pkt->data[palette_size + 1] = type; |
| 105 | 105 | pkt->data[palette_size + 2] = size & 0xFF; |
| 106 | 106 | 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; | |
| 108 | 108 | if (ret < size) { |
| 109 | 109 | av_free_packet(pkt); |
| 110 | 110 | return AVERROR(EIO); |
| @@ -154,20 +154,20 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) · 43 unmodified lines | ||
| 154 | 154 | |
| 155 | 155 | while (1) { |
| 156 | 156 | if (avs->remaining_frame_size <= 0) { |
| 157 | − if (!get_le16(s->pb)) /* found EOF */ | |
| 157 | + if (!avio_rl16(s->pb)) /* found EOF */ | |
| 158 | 158 | return AVERROR(EIO); |
| 159 | − avs->remaining_frame_size = get_le16(s->pb) - 4; | |
| 159 | + avs->remaining_frame_size = avio_rl16(s->pb) - 4; | |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | 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); | |
| 166 | 166 | avs->remaining_frame_size -= size; |
| 167 | 167 | |
| 168 | 168 | switch (type) { |
| 169 | 169 | case AVS_PALETTE: |
| 170 | − ret = get_buffer(s->pb, palette, size - 4); | |
| 170 | + ret = avio_read(s->pb, palette, size - 4); | |
| 171 | 171 | if (ret < size - 4) |
| 172 | 172 | return AVERROR(EIO); |
| 173 | 173 | palette_size = size; |
| @@ -68,7 +68,7 @@ static int vid_read_header(AVFormatContext *s, · 67 unmodified lines | ||
| 68 | 68 | * int16s: always_512, nframes, width, height, delay, always_14 |
| 69 | 69 | */ |
| 70 | 70 | url_fseek(pb, 5, SEEK_CUR); |
| 71 | − vid->nframes = get_le16(pb); | |
| 71 | + vid->nframes = avio_rl16(pb); | |
| 72 | 72 | |
| 73 | 73 | stream = av_new_stream(s, 0); |
| 74 | 74 | if (!stream) |
| @@ -76,11 +76,11 @@ static int vid_read_header(AVFormatContext *s, · 1 unmodified line | ||
| 76 | 76 | av_set_pts_info(stream, 32, 1, 60); // 16 ms increments, i.e. 60 fps |
| 77 | 77 | stream->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| 78 | 78 | 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); | |
| 81 | 81 | 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); | |
| 84 | 84 | |
| 85 | 85 | // done with video codec, set up audio codec |
| 86 | 86 | stream = av_new_stream(s, 0); |
| @@ -117,11 +117,11 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, · 30 unmodified lines | ||
| 117 | 117 | vidbuf_start[vidbuf_nbytes++] = block_type; |
| 118 | 118 | |
| 119 | 119 | // 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); | |
| 121 | 121 | |
| 122 | 122 | // set the y offset if it exists (decoder header data should be in data section) |
| 123 | 123 | 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) | |
| 125 | 125 | goto fail; |
| 126 | 126 | vidbuf_nbytes += 2; |
| 127 | 127 | } |
| @@ -131,21 +131,21 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, · 3 unmodified lines | ||
| 131 | 131 | if(!vidbuf_start) |
| 132 | 132 | return AVERROR(ENOMEM); |
| 133 | 133 | |
| 134 | − code = get_byte(pb); | |
| 134 | + code = avio_r8(pb); | |
| 135 | 135 | vidbuf_start[vidbuf_nbytes++] = code; |
| 136 | 136 | |
| 137 | 137 | if(code >= 0x80){ // rle sequence |
| 138 | 138 | if(block_type == VIDEO_I_FRAME) |
| 139 | − vidbuf_start[vidbuf_nbytes++] = get_byte(pb); | |
| 139 | + vidbuf_start[vidbuf_nbytes++] = avio_r8(pb); | |
| 140 | 140 | } 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) | |
| 142 | 142 | goto fail; |
| 143 | 143 | vidbuf_nbytes += code; |
| 144 | 144 | } |
| 145 | 145 | bytes_copied += code & 0x7F; |
| 146 | 146 | if(bytes_copied == npixels){ // sometimes no stop character is given, need to keep track of bytes copied |
| 147 | 147 | // may contain a 0 byte even if read all pixels |
| 148 | − if(get_byte(pb)) | |
| 148 | + if(avio_r8(pb)) | |
| 149 | 149 | url_fseek(pb, -1, SEEK_CUR); |
| 150 | 150 | break; |
| 151 | 151 | } |
| @@ -182,7 +182,7 @@ static int vid_read_packet(AVFormatContext *s, · 30 unmodified lines | ||
| 182 | 182 | if(vid->is_finished || url_feof(pb)) |
| 183 | 183 | return AVERROR(EIO); |
| 184 | 184 | |
| 185 | − block_type = get_byte(pb); | |
| 185 | + block_type = avio_r8(pb); | |
| 186 | 186 | switch(block_type){ |
| 187 | 187 | case PALETTE_BLOCK: |
| 188 | 188 | url_fseek(pb, -1, SEEK_CUR); // include block type |
| @@ -195,12 +195,12 @@ static int vid_read_packet(AVFormatContext *s, · 6 unmodified lines | ||
| 195 | 195 | return ret_value; |
| 196 | 196 | |
| 197 | 197 | case FIRST_AUDIO_BLOCK: |
| 198 | − get_le16(pb); | |
| 198 | + avio_rl16(pb); | |
| 199 | 199 | // 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)); | |
| 201 | 201 | 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; |
| 202 | 202 | case AUDIO_BLOCK: |
| 203 | − audio_length = get_le16(pb); | |
| 203 | + audio_length = avio_rl16(pb); | |
| 204 | 204 | ret_value = av_get_packet(pb, pkt, audio_length); |
| 205 | 205 | pkt->stream_index = 1; |
| 206 | 206 | return ret_value != audio_length ? AVERROR(EIO) : ret_value; |
| @@ -66,24 +66,24 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap) · 65 unmodified lines | ||
| 66 | 66 | |
| 67 | 67 | /* Set the total number of frames. */ |
| 68 | 68 | 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); | |
| 75 | 75 | 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); | |
| 78 | 78 | |
| 79 | 79 | /*Load the palette to extradata */ |
| 80 | 80 | url_fskip(pb, 8); |
| 81 | 81 | vstream->codec->extradata = av_malloc(768); |
| 82 | 82 | vstream->codec->extradata_size = 768; |
| 83 | − get_buffer(pb, vstream->codec->extradata, | |
| 83 | + avio_read(pb, vstream->codec->extradata, | |
| 84 | 84 | vstream->codec->extradata_size); |
| 85 | 85 | |
| 86 | − astream->codec->sample_rate = get_le32(pb); | |
| 86 | + astream->codec->sample_rate = avio_rl32(pb); | |
| 87 | 87 | |
| 88 | 88 | /* Set up the video codec... */ |
| 89 | 89 | av_set_pts_info(vstream, 32, 1, fps); |
| @@ -119,14 +119,14 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt) · 29 unmodified lines | ||
| 119 | 119 | while(state != MKTAG('S','A','V','I')){ |
| 120 | 120 | if (url_feof(pb)) |
| 121 | 121 | return AVERROR(EIO); |
| 122 | − state = 256*state + get_byte(pb); | |
| 122 | + state = 256*state + avio_r8(pb); | |
| 123 | 123 | } |
| 124 | 124 | /* 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); | |
| 130 | 130 | audio_size = video_offset - audio_offset; |
| 131 | 131 | bfi->video_size = chunk_size - video_offset; |
| 132 | 132 | |
| @@ -82,17 +82,17 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 81 unmodified lines | ||
| 82 | 82 | if (!vst) |
| 83 | 83 | return AVERROR(ENOMEM); |
| 84 | 84 | |
| 85 | − vst->codec->codec_tag = get_le32(pb); | |
| 85 | + vst->codec->codec_tag = avio_rl32(pb); | |
| 86 | 86 | |
| 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); | |
| 89 | 89 | |
| 90 | 90 | if (vst->duration > 1000000) { |
| 91 | 91 | av_log(s, AV_LOG_ERROR, "invalid header: more than 1000000 frames\n"); |
| 92 | 92 | return AVERROR(EIO); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | − if (get_le32(pb) > bink->file_size) { | |
| 95 | + if (avio_rl32(pb) > bink->file_size) { | |
| 96 | 96 | av_log(s, AV_LOG_ERROR, |
| 97 | 97 | "invalid header: largest frame size greater than file size\n"); |
| 98 | 98 | return AVERROR(EIO); |
| @@ -100,11 +100,11 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 1 unmodified line | ||
| 100 | 100 | |
| 101 | 101 | url_fskip(pb, 4); |
| 102 | 102 | |
| 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); | |
| 105 | 105 | |
| 106 | − fps_num = get_le32(pb); | |
| 107 | − fps_den = get_le32(pb); | |
| 106 | + fps_num = avio_rl32(pb); | |
| 107 | + fps_den = avio_rl32(pb); | |
| 108 | 108 | if (fps_num == 0 || fps_den == 0) { |
| 109 | 109 | av_log(s, AV_LOG_ERROR, "invalid header: invalid fps (%d/%d)\n", fps_num, fps_den); |
| 110 | 110 | return AVERROR(EIO); |
| @@ -115,9 +115,9 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 4 unmodified lines | ||
| 115 | 115 | vst->codec->codec_id = CODEC_ID_BINKVIDEO; |
| 116 | 116 | vst->codec->extradata = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE); |
| 117 | 117 | vst->codec->extradata_size = 4; |
| 118 | − get_buffer(pb, vst->codec->extradata, 4); | |
| 118 | + avio_read(pb, vst->codec->extradata, 4); | |
| 119 | 119 | |
| 120 | − bink->num_audio_tracks = get_le32(pb); | |
| 120 | + bink->num_audio_tracks = avio_rl32(pb); | |
| 121 | 121 | |
| 122 | 122 | if (bink->num_audio_tracks > BINK_MAX_AUDIO_TRACKS) { |
| 123 | 123 | av_log(s, AV_LOG_ERROR, |
| @@ -135,9 +135,9 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 11 unmodified lines | ||
| 135 | 135 | return AVERROR(ENOMEM); |
| 136 | 136 | ast->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| 137 | 137 | ast->codec->codec_tag = 0; |
| 138 | − ast->codec->sample_rate = get_le16(pb); | |
| 138 | + ast->codec->sample_rate = avio_rl16(pb); | |
| 139 | 139 | av_set_pts_info(ast, 64, 1, ast->codec->sample_rate); |
| 140 | − flags = get_le16(pb); | |
| 140 | + flags = avio_rl16(pb); | |
| 141 | 141 | ast->codec->codec_id = flags & BINK_AUD_USEDCT ? |
| 142 | 142 | CODEC_ID_BINKAUDIO_DCT : CODEC_ID_BINKAUDIO_RDFT; |
| 143 | 143 | ast->codec->channels = flags & BINK_AUD_STEREO ? 2 : 1; |
| @@ -147,14 +147,14 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 3 unmodified lines | ||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /* frame index table */ |
| 150 | − next_pos = get_le32(pb); | |
| 150 | + next_pos = avio_rl32(pb); | |
| 151 | 151 | for (i = 0; i < vst->duration; i++) { |
| 152 | 152 | pos = next_pos; |
| 153 | 153 | if (i == vst->duration - 1) { |
| 154 | 154 | next_pos = bink->file_size; |
| 155 | 155 | keyframe = 0; |
| 156 | 156 | } else { |
| 157 | − next_pos = get_le32(pb); | |
| 157 | + next_pos = avio_rl32(pb); | |
| 158 | 158 | keyframe = pos & 1; |
| 159 | 159 | } |
| 160 | 160 | pos &= ~1; |
| @@ -201,7 +201,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) · 40 unmodified lines | ||
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | while (bink->current_track < bink->num_audio_tracks) { |
| 204 | − uint32_t audio_size = get_le32(pb); | |
| 204 | + uint32_t audio_size = avio_rl32(pb); | |
| 205 | 205 | if (audio_size > bink->remain_packet_size - 4) { |
| 206 | 206 | av_log(s, AV_LOG_ERROR, |
| 207 | 207 | "frame %"PRId64": audio size in header (%u) > size of packet left (%u)\n", |
| @@ -66,9 +66,9 @@ static int read_header(AVFormatContext *s, · 65 unmodified lines | ||
| 66 | 66 | int framecount = 0; |
| 67 | 67 | |
| 68 | 68 | 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); | |
| 72 | 72 | if (c93->block_records[i].frames > 32) { |
| 73 | 73 | av_log(s, AV_LOG_ERROR, "too many frames in block\n"); |
| 74 | 74 | return AVERROR_INVALIDDATA; |
| @@ -114,7 +114,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) · 39 unmodified lines | ||
| 114 | 114 | if (c93->next_pkt_is_audio) { |
| 115 | 115 | c93->current_frame++; |
| 116 | 116 | c93->next_pkt_is_audio = 0; |
| 117 | − datasize = get_le16(pb); | |
| 117 | + datasize = avio_rl16(pb); | |
| 118 | 118 | if (datasize > 42) { |
| 119 | 119 | if (!c93->audio) { |
| 120 | 120 | c93->audio = av_new_stream(s, 1); |
| @@ -142,13 +142,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) · 21 unmodified lines | ||
| 142 | 142 | if (c93->current_frame == 0) { |
| 143 | 143 | url_fseek(pb, br->index * 2048, SEEK_SET); |
| 144 | 144 | for (i = 0; i < 32; i++) { |
| 145 | − c93->frame_offsets[i] = get_le32(pb); | |
| 145 | + c93->frame_offsets[i] = avio_rl32(pb); | |
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | url_fseek(pb,br->index * 2048 + |
| 150 | 150 | c93->frame_offsets[c93->current_frame], SEEK_SET); |
| 151 | − datasize = get_le16(pb); /* video frame size */ | |
| 151 | + datasize = avio_rl16(pb); /* video frame size */ | |
| 152 | 152 | |
| 153 | 153 | ret = av_new_packet(pkt, datasize + 768 + 1); |
| 154 | 154 | if (ret < 0) |
| @@ -156,13 +156,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) · 1 unmodified line | ||
| 156 | 156 | pkt->data[0] = 0; |
| 157 | 157 | pkt->size = datasize + 1; |
| 158 | 158 | |
| 159 | − ret = get_buffer(pb, pkt->data + 1, datasize); | |
| 159 | + ret = avio_read(pb, pkt->data + 1, datasize); | |
| 160 | 160 | if (ret < datasize) { |
| 161 | 161 | ret = AVERROR(EIO); |
| 162 | 162 | goto fail; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | − datasize = get_le16(pb); /* palette size */ | |
| 165 | + datasize = avio_rl16(pb); /* palette size */ | |
| 166 | 166 | if (datasize) { |
| 167 | 167 | if (datasize != 768) { |
| 168 | 168 | 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 | ||
| 170 | 170 | goto fail; |
| 171 | 171 | } |
| 172 | 172 | 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); | |
| 174 | 174 | if (ret < datasize) { |
| 175 | 175 | ret = AVERROR(EIO); |
| 176 | 176 | goto fail; |
| @@ -65,14 +65,14 @@ static int read_desc_chunk(AVFormatContext *s) · 64 unmodified lines | ||
| 65 | 65 | |
| 66 | 66 | /* parse format description */ |
| 67 | 67 | 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); | |
| 72 | 72 | 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); | |
| 76 | 76 | |
| 77 | 77 | /* calculate bit rate for constant size packets */ |
| 78 | 78 | 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 | ||
| 127 | 127 | st->codec->extradata = av_mallocz(ALAC_HEADER + FF_INPUT_BUFFER_PADDING_SIZE); |
| 128 | 128 | if (!st->codec->extradata) |
| 129 | 129 | return AVERROR(ENOMEM); |
| 130 | − get_buffer(pb, st->codec->extradata, ALAC_HEADER); | |
| 130 | + avio_read(pb, st->codec->extradata, ALAC_HEADER); | |
| 131 | 131 | st->codec->extradata_size = ALAC_HEADER; |
| 132 | 132 | url_fskip(pb, size - ALAC_PREAMBLE - ALAC_HEADER); |
| 133 | 133 | } else { |
| 134 | 134 | st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); |
| 135 | 135 | if (!st->codec->extradata) |
| 136 | 136 | return AVERROR(ENOMEM); |
| 137 | − get_buffer(pb, st->codec->extradata, size); | |
| 137 | + avio_read(pb, st->codec->extradata, size); | |
| 138 | 138 | st->codec->extradata_size = size; |
| 139 | 139 | } |
| 140 | 140 | |
| @@ -152,13 +152,13 @@ static int read_pakt_chunk(AVFormatContext *s, int64_t size) · 11 unmodified lines | ||
| 152 | 152 | |
| 153 | 153 | ccount = url_ftell(pb); |
| 154 | 154 | |
| 155 | − num_packets = get_be64(pb); | |
| 155 | + num_packets = avio_rb64(pb); | |
| 156 | 156 | if (num_packets < 0 || INT32_MAX / sizeof(AVIndexEntry) < num_packets) |
| 157 | 157 | return AVERROR_INVALIDDATA; |
| 158 | 158 | |
| 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 */ | |
| 162 | 162 | |
| 163 | 163 | st->duration = 0; |
| 164 | 164 | for (i = 0; i < num_packets; i++) { |
| @@ -181,7 +181,7 @@ static void read_info_chunk(AVFormatContext *s, int64_t size) · 16 unmodified lines | ||
| 181 | 181 | { |
| 182 | 182 | AVIOContext *pb = s->pb; |
| 183 | 183 | unsigned int i; |
| 184 | − unsigned int nb_entries = get_be32(pb); | |
| 184 | + unsigned int nb_entries = avio_rb32(pb); | |
| 185 | 185 | for (i = 0; i < nb_entries; i++) { |
| 186 | 186 | char key[32]; |
| 187 | 187 | char value[1024]; |
| @@ -204,11 +204,11 @@ static int read_header(AVFormatContext *s, · 16 unmodified lines | ||
| 204 | 204 | url_fskip(pb, 8); /* magic, version, file flags */ |
| 205 | 205 | |
| 206 | 206 | /* audio description chunk */ |
| 207 | − if (get_be32(pb) != MKBETAG('d','e','s','c')) { | |
| 207 | + if (avio_rb32(pb) != MKBETAG('d','e','s','c')) { | |
| 208 | 208 | av_log(s, AV_LOG_ERROR, "desc chunk not present\n"); |
| 209 | 209 | return AVERROR_INVALIDDATA; |
| 210 | 210 | } |
| 211 | − size = get_be64(pb); | |
| 211 | + size = avio_rb64(pb); | |
| 212 | 212 | if (size != 32) |
| 213 | 213 | return AVERROR_INVALIDDATA; |
| 214 | 214 | |
| @@ -226,8 +226,8 @@ static int read_header(AVFormatContext *s, · 11 unmodified lines | ||
| 226 | 226 | if (found_data && (caf->data_size < 0 || url_is_streamed(pb))) |
| 227 | 227 | break; |
| 228 | 228 | |
| 229 | − tag = get_be32(pb); | |
| 230 | − size = get_be64(pb); | |
| 229 | + tag = avio_rb32(pb); | |
| 230 | + size = avio_rb64(pb); | |
| 231 | 231 | if (url_feof(pb)) |
| 232 | 232 | break; |
| 233 | 233 | |
| @@ -40,8 +40,8 @@ static int daud_packet(AVFormatContext *s, AVPacket *pkt) { · 39 unmodified lines | ||
| 40 | 40 | int ret, size; |
| 41 | 41 | if (url_feof(pb)) |
| 42 | 42 | return AVERROR(EIO); |
| 43 | − size = get_be16(pb); | |
| 44 | − get_be16(pb); // unknown | |
| 43 | + size = avio_rb16(pb); | |
| 44 | + avio_rb16(pb); // unknown | |
| 45 | 45 | ret = av_get_packet(pb, pkt, size); |
| 46 | 46 | pkt->stream_index = 0; |
| 47 | 47 | return ret; |
| @@ -73,16 +73,16 @@ static int cin_probe(AVProbeData *p) · 72 unmodified lines | ||
| 73 | 73 | static int cin_read_file_header(CinDemuxContext *cin, AVIOContext *pb) { |
| 74 | 74 | CinFileHeader *hdr = &cin->file_header; |
| 75 | 75 | |
| 76 | − if (get_le32(pb) != 0x55AA0000) | |
| 76 | + if (avio_rl32(pb) != 0x55AA0000) | |
| 77 | 77 | return AVERROR_INVALIDDATA; |
| 78 | 78 | |
| 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); | |
| 86 | 86 | |
| 87 | 87 | if (hdr->audio_frequency != 22050 || hdr->audio_bits != 16 || hdr->audio_stereo != 0) |
| 88 | 88 | return AVERROR_INVALIDDATA; |
| @@ -141,16 +141,16 @@ static int cin_read_header(AVFormatContext *s, AVFormatParameters *ap) · 52 unmodified lines | ||
| 141 | 141 | static int cin_read_frame_header(CinDemuxContext *cin, AVIOContext *pb) { |
| 142 | 142 | CinFrameHeader *hdr = &cin->frame_header; |
| 143 | 143 | |
| 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); | |
| 149 | 149 | |
| 150 | 150 | if (url_feof(pb) || url_ferror(pb)) |
| 151 | 151 | return AVERROR(EIO); |
| 152 | 152 | |
| 153 | − if (get_le32(pb) != 0xAA55AA55) | |
| 153 | + if (avio_rl32(pb) != 0xAA55AA55) | |
| 154 | 154 | return AVERROR_INVALIDDATA; |
| 155 | 155 | |
| 156 | 156 | return 0; |
| @@ -191,7 +191,7 @@ static int cin_read_packet(AVFormatContext *s, AVPacket *pkt) · 34 unmodified lines | ||
| 191 | 191 | pkt->data[2] = hdr->pal_colors_count >> 8; |
| 192 | 192 | pkt->data[3] = hdr->video_frame_type; |
| 193 | 193 | |
| 194 | − ret = get_buffer(pb, &pkt->data[4], pkt_size); | |
| 194 | + ret = avio_read(pb, &pkt->data[4], pkt_size); | |
| 195 | 195 | if (ret < 0) { |
| 196 | 196 | av_free_packet(pkt); |
| 197 | 197 | return ret; |
| @@ -410,7 +410,7 @@ static int dv_read_header(AVFormatContext *s, · 409 unmodified lines | ||
| 410 | 410 | if (!c->dv_demux) |
| 411 | 411 | return -1; |
| 412 | 412 | |
| 413 | − state = get_be32(s->pb); | |
| 413 | + state = avio_rb32(s->pb); | |
| 414 | 414 | while ((state & 0xffffff7f) != 0x1f07003f) { |
| 415 | 415 | if (url_feof(s->pb)) { |
| 416 | 416 | 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 | ||
| 420 | 420 | marker_pos = url_ftell(s->pb); |
| 421 | 421 | if (state == 0xff3f0701 && url_ftell(s->pb) - marker_pos == 80) { |
| 422 | 422 | url_fseek(s->pb, -163, SEEK_CUR); |
| 423 | − state = get_be32(s->pb); | |
| 423 | + state = avio_rb32(s->pb); | |
| 424 | 424 | break; |
| 425 | 425 | } |
| 426 | − state = (state << 8) | get_byte(s->pb); | |
| 426 | + state = (state << 8) | avio_r8(s->pb); | |
| 427 | 427 | } |
| 428 | 428 | AV_WB32(c->buf, state); |
| 429 | 429 | |
| 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 || | |
| 431 | 431 | url_fseek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0) |
| 432 | 432 | return AVERROR(EIO); |
| 433 | 433 | |
| @@ -455,7 +455,7 @@ static int dv_read_packet(AVFormatContext *s, AVPacket *pkt) · 21 unmodified lines | ||
| 455 | 455 | if (!c->dv_demux->sys) |
| 456 | 456 | return AVERROR(EIO); |
| 457 | 457 | 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) | |
| 459 | 459 | return AVERROR(EIO); |
| 460 | 460 | |
| 461 | 461 | size = dv_produce_packet(c->dv_demux, pkt, c->buf, size); |
| @@ -61,17 +61,17 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) · 60 unmodified lines | ||
| 61 | 61 | int num, den; |
| 62 | 62 | int flags; |
| 63 | 63 | |
| 64 | − tag = get_le32(pb); | |
| 64 | + tag = avio_rl32(pb); | |
| 65 | 65 | if (tag != MKTAG('D', 'E', 'X', 'A')) |
| 66 | 66 | return -1; |
| 67 | − flags = get_byte(pb); | |
| 68 | − c->frames = get_be16(pb); | |
| 67 | + flags = avio_r8(pb); | |
| 68 | + c->frames = avio_rb16(pb); | |
| 69 | 69 | if(!c->frames){ |
| 70 | 70 | av_log(s, AV_LOG_ERROR, "File contains no frames ???\n"); |
| 71 | 71 | return -1; |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | − fps = get_be32(pb); | |
| 74 | + fps = avio_rb32(pb); | |
| 75 | 75 | if(fps > 0){ |
| 76 | 76 | den = 1000; |
| 77 | 77 | num = fps; |
| @@ -82,8 +82,8 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) · 4 unmodified lines | ||
| 82 | 82 | den = 10; |
| 83 | 83 | num = 1; |
| 84 | 84 | } |
| 85 | − w = get_be16(pb); | |
| 86 | − h = get_be16(pb); | |
| 85 | + w = avio_rb16(pb); | |
| 86 | + h = avio_rb16(pb); | |
| 87 | 87 | c->has_sound = 0; |
| 88 | 88 | |
| 89 | 89 | st = av_new_stream(s, 0); |
| @@ -91,13 +91,13 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1 unmodified line | ||
| 91 | 91 | return -1; |
| 92 | 92 | |
| 93 | 93 | // Parse WAV data header |
| 94 | − if(get_le32(pb) == MKTAG('W', 'A', 'V', 'E')){ | |
| 94 | + if(avio_rl32(pb) == MKTAG('W', 'A', 'V', 'E')){ | |
| 95 | 95 | uint32_t size, fsize; |
| 96 | 96 | c->has_sound = 1; |
| 97 | − size = get_be32(pb); | |
| 97 | + size = avio_rb32(pb); | |
| 98 | 98 | c->vidpos = url_ftell(pb) + size; |
| 99 | 99 | url_fskip(pb, 16); |
| 100 | − fsize = get_le32(pb); | |
| 100 | + fsize = avio_rl32(pb); | |
| 101 | 101 | |
| 102 | 102 | ast = av_new_stream(s, 0); |
| 103 | 103 | if (!ast) |
| @@ -105,8 +105,8 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1 unmodified line | ||
| 105 | 105 | ff_get_wav_header(pb, ast->codec, fsize); |
| 106 | 106 | // find 'data' chunk |
| 107 | 107 | 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); | |
| 110 | 110 | if(tag == MKTAG('d', 'a', 't', 'a')) break; |
| 111 | 111 | url_fskip(pb, fsize); |
| 112 | 112 | } |
| @@ -163,7 +163,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) · 50 unmodified lines | ||
| 163 | 163 | } |
| 164 | 164 | url_fseek(s->pb, c->vidpos, SEEK_SET); |
| 165 | 165 | while(!url_feof(s->pb) && c->frames){ |
| 166 | − get_buffer(s->pb, buf, 4); | |
| 166 | + avio_read(s->pb, buf, 4); | |
| 167 | 167 | switch(AV_RL32(buf)){ |
| 168 | 168 | case MKTAG('N', 'U', 'L', 'L'): |
| 169 | 169 | 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 | ||
| 178 | 178 | case MKTAG('C', 'M', 'A', 'P'): |
| 179 | 179 | pal_size = 768+4; |
| 180 | 180 | memcpy(pal, buf, 4); |
| 181 | − get_buffer(s->pb, pal + 4, 768); | |
| 181 | + avio_read(s->pb, pal + 4, 768); | |
| 182 | 182 | break; |
| 183 | 183 | 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); | |
| 185 | 185 | size = AV_RB32(buf + 5); |
| 186 | 186 | if(size > 0xFFFFFF){ |
| 187 | 187 | 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 | ||
| 190 | 190 | if(av_new_packet(pkt, size + DXA_EXTRA_SIZE + pal_size) < 0) |
| 191 | 191 | return AVERROR(ENOMEM); |
| 192 | 192 | 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); | |
| 194 | 194 | if(ret != size){ |
| 195 | 195 | av_free_packet(pkt); |
| 196 | 196 | return AVERROR(EIO); |
| @@ -51,7 +51,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) · 50 unmodified lines | ||
| 51 | 51 | unsigned int sample_rate, header; |
| 52 | 52 | AVStream *st; |
| 53 | 53 | |
| 54 | − header = get_be16(pb); | |
| 54 | + header = avio_rb16(pb); | |
| 55 | 55 | switch (header) { |
| 56 | 56 | case 0x0400: cdata->channels = 1; break; |
| 57 | 57 | case 0x0404: cdata->channels = 2; break; |
| @@ -61,7 +61,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) · 3 unmodified lines | ||
| 61 | 61 | return -1; |
| 62 | 62 | }; |
| 63 | 63 | |
| 64 | − sample_rate = get_be16(pb); | |
| 64 | + sample_rate = avio_rb16(pb); | |
| 65 | 65 | url_fskip(pb, 12); |
| 66 | 66 | |
| 67 | 67 | st = av_new_stream(s, 0); |
| @@ -82,11 +82,11 @@ static uint32_t read_arbitary(AVIOContext *pb) { · 81 unmodified lines | ||
| 82 | 82 | int i; |
| 83 | 83 | uint32_t word; |
| 84 | 84 | |
| 85 | − size = get_byte(pb); | |
| 85 | + size = avio_r8(pb); | |
| 86 | 86 | |
| 87 | 87 | word = 0; |
| 88 | 88 | for (i = 0; i < size; i++) { |
| 89 | − byte = get_byte(pb); | |
| 89 | + byte = avio_r8(pb); | |
| 90 | 90 | word <<= 8; |
| 91 | 91 | word |= byte; |
| 92 | 92 | } |
| @@ -112,7 +112,7 @@ static int process_audio_header_elements(AVFormatContext *s) · 19 unmodified lines | ||
| 112 | 112 | while (!url_feof(pb) && inHeader) { |
| 113 | 113 | int inSubheader; |
| 114 | 114 | uint8_t byte; |
| 115 | − byte = get_byte(pb); | |
| 115 | + byte = avio_r8(pb); | |
| 116 | 116 | |
| 117 | 117 | switch (byte) { |
| 118 | 118 | case 0xFD: |
| @@ -120,7 +120,7 @@ static int process_audio_header_elements(AVFormatContext *s) · 1 unmodified line | ||
| 120 | 120 | inSubheader = 1; |
| 121 | 121 | while (!url_feof(pb) && inSubheader) { |
| 122 | 122 | uint8_t subbyte; |
| 123 | − subbyte = get_byte(pb); | |
| 123 | + subbyte = avio_r8(pb); | |
| 124 | 124 | |
| 125 | 125 | switch (subbyte) { |
| 126 | 126 | case 0x80: |
| @@ -218,10 +218,10 @@ static int process_audio_header_eacs(AVFormatContext *s) · 91 unmodified lines | ||
| 218 | 218 | AVIOContext *pb = s->pb; |
| 219 | 219 | int compression_type; |
| 220 | 220 | |
| 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); | |
| 225 | 225 | url_fskip(pb, 13); |
| 226 | 226 | |
| 227 | 227 | switch (compression_type) { |
| @@ -249,9 +249,9 @@ static int process_audio_header_sead(AVFormatContext *s) · 21 unmodified lines | ||
| 249 | 249 | EaDemuxContext *ea = s->priv_data; |
| 250 | 250 | AVIOContext *pb = s->pb; |
| 251 | 251 | |
| 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); | |
| 255 | 255 | ea->audio_codec = CODEC_ID_ADPCM_IMA_EA_SEAD; |
| 256 | 256 | |
| 257 | 257 | return 1; |
| @@ -262,8 +262,8 @@ static int process_video_header_mdec(AVFormatContext *s) · 4 unmodified lines | ||
| 262 | 262 | EaDemuxContext *ea = s->priv_data; |
| 263 | 263 | AVIOContext *pb = s->pb; |
| 264 | 264 | 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); | |
| 267 | 267 | ea->time_base = (AVRational){1,15}; |
| 268 | 268 | ea->video_codec = CODEC_ID_MDEC; |
| 269 | 269 | return 1; |
| @@ -275,8 +275,8 @@ static int process_video_header_vp6(AVFormatContext *s) · 5 unmodified lines | ||
| 275 | 275 | AVIOContext *pb = s->pb; |
| 276 | 276 | |
| 277 | 277 | 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); | |
| 280 | 280 | ea->video_codec = CODEC_ID_VP6; |
| 281 | 281 | |
| 282 | 282 | return 1; |
| @@ -296,8 +296,8 @@ static int process_ea_header(AVFormatContext *s) { · 13 unmodified lines | ||
| 296 | 296 | unsigned int startpos = url_ftell(pb); |
| 297 | 297 | int err = 0; |
| 298 | 298 | |
| 299 | − blockid = get_le32(pb); | |
| 300 | − size = get_le32(pb); | |
| 299 | + blockid = avio_rl32(pb); | |
| 300 | + size = avio_rl32(pb); | |
| 301 | 301 | if (i == 0) |
| 302 | 302 | ea->big_endian = size > 0x000FFFFF; |
| 303 | 303 | if (ea->big_endian) |
| @@ -305,7 +305,7 @@ static int process_ea_header(AVFormatContext *s) { · 1 unmodified line | ||
| 305 | 305 | |
| 306 | 306 | switch (blockid) { |
| 307 | 307 | case ISNh_TAG: |
| 308 | − if (get_le32(pb) != EACS_TAG) { | |
| 308 | + if (avio_rl32(pb) != EACS_TAG) { | |
| 309 | 309 | av_log (s, AV_LOG_ERROR, "unknown 1SNh headerid\n"); |
| 310 | 310 | return 0; |
| 311 | 311 | } |
| @@ -314,7 +314,7 @@ static int process_ea_header(AVFormatContext *s) { · 2 unmodified lines | ||
| 314 | 314 | |
| 315 | 315 | case SCHl_TAG : |
| 316 | 316 | case SHEN_TAG : |
| 317 | − blockid = get_le32(pb); | |
| 317 | + blockid = avio_rl32(pb); | |
| 318 | 318 | if (blockid == GSTR_TAG) { |
| 319 | 319 | url_fskip(pb, 4); |
| 320 | 320 | } else if ((blockid & 0xFFFF)!=PT00_TAG) { |
| @@ -467,8 +467,8 @@ static int ea_read_packet(AVFormatContext *s, · 146 unmodified lines | ||
| 467 | 467 | int av_uninit(num_samples); |
| 468 | 468 | |
| 469 | 469 | 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; | |
| 472 | 472 | |
| 473 | 473 | switch (chunk_type) { |
| 474 | 474 | /* audio data */ |
| @@ -485,7 +485,7 @@ static int ea_read_packet(AVFormatContext *s, · 10 unmodified lines | ||
| 485 | 485 | break; |
| 486 | 486 | } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR || |
| 487 | 487 | ea->audio_codec == CODEC_ID_MP3) { |
| 488 | − num_samples = get_le32(pb); | |
| 488 | + num_samples = avio_rl32(pb); | |
| 489 | 489 | url_fskip(pb, 8); |
| 490 | 490 | chunk_size -= 12; |
| 491 | 491 | } |
| @@ -95,7 +95,7 @@ static int ffm_resync(AVFormatContext *s, int state) · 94 unmodified lines | ||
| 95 | 95 | av_log(s, AV_LOG_ERROR, "cannot find FFM syncword\n"); |
| 96 | 96 | return -1; |
| 97 | 97 | } |
| 98 | − state = (state << 8) | get_byte(s->pb); | |
| 98 | + state = (state << 8) | avio_r8(s->pb); | |
| 99 | 99 | } |
| 100 | 100 | return 0; |
| 101 | 101 | } |
| @@ -120,14 +120,14 @@ static int ffm_read_data(AVFormatContext *s, · 18 unmodified lines | ||
| 120 | 120 | if (url_ftell(pb) == ffm->file_size) |
| 121 | 121 | url_fseek(pb, ffm->packet_size, SEEK_SET); |
| 122 | 122 | retry_read: |
| 123 | − id = get_be16(pb); /* PACKET_ID */ | |
| 123 | + id = avio_rb16(pb); /* PACKET_ID */ | |
| 124 | 124 | if (id != PACKET_ID) |
| 125 | 125 | if (ffm_resync(s, id) < 0) |
| 126 | 126 | 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); | |
| 131 | 131 | ffm->packet_end = ffm->packet + (ffm->packet_size - FFM_HEADER_SIZE - fill_size); |
| 132 | 132 | if (ffm->packet_end < ffm->packet || frame_offset < 0) |
| 133 | 133 | return -1; |
| @@ -188,7 +188,7 @@ static int64_t get_dts(AVFormatContext *s, int64_t pos) · 54 unmodified lines | ||
| 188 | 188 | |
| 189 | 189 | ffm_seek1(s, pos); |
| 190 | 190 | url_fskip(pb, 4); |
| 191 | − dts = get_be64(pb); | |
| 191 | + dts = avio_rb64(pb); | |
| 192 | 192 | #ifdef DEBUG_SEEK |
| 193 | 193 | av_log(s, AV_LOG_DEBUG, "dts=%0.6f\n", dts / 1000000.0); |
| 194 | 194 | #endif |
| @@ -273,13 +273,13 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) · 78 unmodified lines | ||
| 273 | 273 | uint32_t tag; |
| 274 | 274 | |
| 275 | 275 | /* header */ |
| 276 | − tag = get_le32(pb); | |
| 276 | + tag = avio_rl32(pb); | |
| 277 | 277 | if (tag != MKTAG('F', 'F', 'M', '1')) |
| 278 | 278 | goto fail; |
| 279 | − ffm->packet_size = get_be32(pb); | |
| 279 | + ffm->packet_size = avio_rb32(pb); | |
| 280 | 280 | if (ffm->packet_size != FFM_PACKET_SIZE) |
| 281 | 281 | goto fail; |
| 282 | − ffm->write_index = get_be64(pb); | |
| 282 | + ffm->write_index = avio_rb64(pb); | |
| 283 | 283 | /* get also filesize */ |
| 284 | 284 | if (!url_is_streamed(pb)) { |
| 285 | 285 | ffm->file_size = url_fsize(pb); |
| @@ -289,8 +289,8 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) · 3 unmodified lines | ||
| 289 | 289 | ffm->file_size = (UINT64_C(1) << 63) - 1; |
| 290 | 290 | } |
| 291 | 291 | |
| 292 | − nb_streams = get_be32(pb); | |
| 293 | − get_be32(pb); /* total bitrate */ | |
| 292 | + nb_streams = avio_rb32(pb); | |
| 293 | + avio_rb32(pb); /* total bitrate */ | |
| 294 | 294 | /* read each stream */ |
| 295 | 295 | for(i=0;i<nb_streams;i++) { |
| 296 | 296 | char rc_eq_buf[128]; |
| @@ -303,85 +303,85 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap) · 6 unmodified lines | ||
| 303 | 303 | |
| 304 | 304 | codec = st->codec; |
| 305 | 305 | /* 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); | |
| 313 | 313 | /* specific info */ |
| 314 | 314 | switch(codec->codec_type) { |
| 315 | 315 | 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); | |
| 328 | 328 | 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); | |
| 363 | 363 | break; |
| 364 | 364 | 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); | |
| 369 | 369 | break; |
| 370 | 370 | default: |
| 371 | 371 | goto fail; |
| 372 | 372 | } |
| 373 | 373 | if (codec->flags & CODEC_FLAG_GLOBAL_HEADER) { |
| 374 | − codec->extradata_size = get_be32(pb); | |
| 374 | + codec->extradata_size = avio_rb32(pb); | |
| 375 | 375 | codec->extradata = av_malloc(codec->extradata_size); |
| 376 | 376 | if (!codec->extradata) |
| 377 | 377 | return AVERROR(ENOMEM); |
| 378 | − get_buffer(pb, codec->extradata, codec->extradata_size); | |
| 378 | + avio_read(pb, codec->extradata, codec->extradata_size); | |
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | /* get until end of block reached */ |
| 383 | 383 | while ((url_ftell(pb) % ffm->packet_size) != 0) |
| 384 | − get_byte(pb); | |
| 384 | + avio_r8(pb); | |
| 385 | 385 | |
| 386 | 386 | /* init packet demux */ |
| 387 | 387 | ffm->packet_ptr = ffm->packet; |
| @@ -36,11 +36,11 @@ static void get_line(AVIOContext *s, uint8_t *buf, int size) · 35 unmodified lines | ||
| 36 | 36 | uint8_t c; |
| 37 | 37 | int i = 0; |
| 38 | 38 | |
| 39 | − while ((c = get_byte(s))) { | |
| 39 | + while ((c = avio_r8(s))) { | |
| 40 | 40 | if (c == '\\') { |
| 41 | 41 | if (i < size - 1) |
| 42 | 42 | buf[i++] = c; |
| 43 | − c = get_byte(s); | |
| 43 | + c = avio_r8(s); | |
| 44 | 44 | } else if (c == '\n') |
| 45 | 45 | break; |
| 46 | 46 | |
| @@ -44,7 +44,7 @@ static int read_header(AVFormatContext *s, · 43 unmodified lines | ||
| 44 | 44 | return AVERROR(EIO); |
| 45 | 45 | |
| 46 | 46 | url_fseek(pb, url_fsize(pb) - 36, SEEK_SET); |
| 47 | − if (get_be32(pb) != RAND_TAG) { | |
| 47 | + if (avio_rb32(pb) != RAND_TAG) { | |
| 48 | 48 | av_log(s, AV_LOG_ERROR, "magic number not found"); |
| 49 | 49 | return AVERROR_INVALIDDATA; |
| 50 | 50 | } |
| @@ -53,8 +53,8 @@ static int read_header(AVFormatContext *s, · 2 unmodified lines | ||
| 53 | 53 | if (!st) |
| 54 | 54 | return AVERROR(ENOMEM); |
| 55 | 55 | |
| 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) { | |
| 58 | 58 | av_log_ask_for_sample(s, "unsupported packing method\n"); |
| 59 | 59 | return AVERROR_INVALIDDATA; |
| 60 | 60 | } |
| @@ -64,10 +64,10 @@ static int read_header(AVFormatContext *s, · 3 unmodified lines | ||
| 64 | 64 | st->codec->codec_id = CODEC_ID_RAWVIDEO; |
| 65 | 65 | st->codec->pix_fmt = PIX_FMT_RGBA; |
| 66 | 66 | 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)); | |
| 71 | 71 | |
| 72 | 72 | url_fseek(pb, 0, SEEK_SET); |
| 73 | 73 | |
| @@ -40,14 +40,14 @@ static int flac_read_header(AVFormatContext *s, · 39 unmodified lines | ||
| 40 | 40 | /* the parameters will be extracted from the compressed bitstream */ |
| 41 | 41 | |
| 42 | 42 | /* 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')) { | |
| 44 | 44 | url_fseek(s->pb, -4, SEEK_CUR); |
| 45 | 45 | return 0; |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | /* process metadata blocks */ |
| 49 | 49 | while (!url_feof(s->pb) && !metadata_last) { |
| 50 | − get_buffer(s->pb, header, 4); | |
| 50 | + avio_read(s->pb, header, 4); | |
| 51 | 51 | ff_flac_parse_block_header(header, &metadata_last, &metadata_type, |
| 52 | 52 | &metadata_size); |
| 53 | 53 | switch (metadata_type) { |
| @@ -58,7 +58,7 @@ static int flac_read_header(AVFormatContext *s, · 4 unmodified lines | ||
| 58 | 58 | if (!buffer) { |
| 59 | 59 | return AVERROR(ENOMEM); |
| 60 | 60 | } |
| 61 | − if (get_buffer(s->pb, buffer, metadata_size) != metadata_size) { | |
| 61 | + if (avio_read(s->pb, buffer, metadata_size) != metadata_size) { | |
| 62 | 62 | av_freep(&buffer); |
| 63 | 63 | return AVERROR(EIO); |
| 64 | 64 | } |
| @@ -96,7 +96,7 @@ static int flic_read_header(AVFormatContext *s, · 95 unmodified lines | ||
| 96 | 96 | flic->frame_number = 0; |
| 97 | 97 | |
| 98 | 98 | /* 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) | |
| 100 | 100 | return AVERROR(EIO); |
| 101 | 101 | |
| 102 | 102 | magic_number = AV_RL16(&header[4]); |
| @@ -130,7 +130,7 @@ static int flic_read_header(AVFormatContext *s, · 27 unmodified lines | ||
| 130 | 130 | memcpy(st->codec->extradata, header, FLIC_HEADER_SIZE); |
| 131 | 131 | |
| 132 | 132 | /* 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) { | |
| 134 | 134 | av_log(s, AV_LOG_ERROR, "Failed to peek at preamble\n"); |
| 135 | 135 | return AVERROR(EIO); |
| 136 | 136 | } |
| @@ -207,7 +207,7 @@ static int flic_read_packet(AVFormatContext *s, · 70 unmodified lines | ||
| 207 | 207 | |
| 208 | 208 | while (!packet_read) { |
| 209 | 209 | |
| 210 | − if ((ret = get_buffer(pb, preamble, FLIC_PREAMBLE_SIZE)) != | |
| 210 | + if ((ret = avio_read(pb, preamble, FLIC_PREAMBLE_SIZE)) != | |
| 211 | 211 | FLIC_PREAMBLE_SIZE) { |
| 212 | 212 | ret = AVERROR(EIO); |
| 213 | 213 | break; |
| @@ -225,7 +225,7 @@ static int flic_read_packet(AVFormatContext *s, · 11 unmodified lines | ||
| 225 | 225 | pkt->pts = flic->frame_number++; |
| 226 | 226 | pkt->pos = url_ftell(pb); |
| 227 | 227 | 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, | |
| 229 | 229 | size - FLIC_PREAMBLE_SIZE); |
| 230 | 230 | if (ret != size - FLIC_PREAMBLE_SIZE) { |
| 231 | 231 | av_free_packet(pkt); |
| @@ -243,7 +243,7 @@ static int flic_read_packet(AVFormatContext *s, · 11 unmodified lines | ||
| 243 | 243 | |
| 244 | 244 | pkt->stream_index = flic->audio_stream_index; |
| 245 | 245 | pkt->pos = url_ftell(pb); |
| 246 | − ret = get_buffer(pb, pkt->data, size); | |
| 246 | + ret = avio_read(pb, pkt->data, size); | |
| 247 | 247 | |
| 248 | 248 | if (ret != size) { |
| 249 | 249 | av_free_packet(pkt); |
| @@ -97,7 +97,7 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co · 96 unmodified lines | ||
| 97 | 97 | vcodec->extradata_size = 1; |
| 98 | 98 | vcodec->extradata = av_malloc(1); |
| 99 | 99 | } |
| 100 | − vcodec->extradata[0] = get_byte(s->pb); | |
| 100 | + vcodec->extradata[0] = avio_r8(s->pb); | |
| 101 | 101 | return 1; // 1 byte body size adjustment for flv_read_packet() |
| 102 | 102 | case FLV_CODECID_H264: |
| 103 | 103 | 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 | ||
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | static int amf_get_string(AVIOContext *ioc, char *buffer, int buffsize) { |
| 114 | − int length = get_be16(ioc); | |
| 114 | + int length = avio_rb16(ioc); | |
| 115 | 115 | if(length >= buffsize) { |
| 116 | 116 | url_fskip(ioc, length); |
| 117 | 117 | return -1; |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | − get_buffer(ioc, buffer, length); | |
| 120 | + avio_read(ioc, buffer, length); | |
| 121 | 121 | |
| 122 | 122 | buffer[length] = '\0'; |
| 123 | 123 | |
| @@ -134,13 +134,13 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst · 10 unmodified lines | ||
| 134 | 134 | num_val = 0; |
| 135 | 135 | ioc = s->pb; |
| 136 | 136 | |
| 137 | − amf_type = get_byte(ioc); | |
| 137 | + amf_type = avio_r8(ioc); | |
| 138 | 138 | |
| 139 | 139 | switch(amf_type) { |
| 140 | 140 | case AMF_DATA_TYPE_NUMBER: |
| 141 | − num_val = av_int2dbl(get_be64(ioc)); break; | |
| 141 | + num_val = av_int2dbl(avio_rb64(ioc)); break; | |
| 142 | 142 | case AMF_DATA_TYPE_BOOL: |
| 143 | − num_val = get_byte(ioc); break; | |
| 143 | + num_val = avio_r8(ioc); break; | |
| 144 | 144 | case AMF_DATA_TYPE_STRING: |
| 145 | 145 | if(amf_get_string(ioc, str_val, sizeof(str_val)) < 0) |
| 146 | 146 | return -1; |
| @@ -148,12 +148,12 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst · 1 unmodified line | ||
| 148 | 148 | case AMF_DATA_TYPE_OBJECT: { |
| 149 | 149 | unsigned int keylen; |
| 150 | 150 | |
| 151 | − while(url_ftell(ioc) < max_pos - 2 && (keylen = get_be16(ioc))) { | |
| 151 | + while(url_ftell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) { | |
| 152 | 152 | url_fskip(ioc, keylen); //skip key string |
| 153 | 153 | if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0) |
| 154 | 154 | return -1; //if we couldn't skip, bomb out. |
| 155 | 155 | } |
| 156 | − if(get_byte(ioc) != AMF_END_OF_OBJECT) | |
| 156 | + if(avio_r8(ioc) != AMF_END_OF_OBJECT) | |
| 157 | 157 | return -1; |
| 158 | 158 | } |
| 159 | 159 | break; |
| @@ -168,13 +168,13 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst · 8 unmodified lines | ||
| 168 | 168 | if(amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0) |
| 169 | 169 | return -1; |
| 170 | 170 | } |
| 171 | − if(get_byte(ioc) != AMF_END_OF_OBJECT) | |
| 171 | + if(avio_r8(ioc) != AMF_END_OF_OBJECT) | |
| 172 | 172 | return -1; |
| 173 | 173 | break; |
| 174 | 174 | case AMF_DATA_TYPE_ARRAY: { |
| 175 | 175 | unsigned int arraylen, i; |
| 176 | 176 | |
| 177 | − arraylen = get_be32(ioc); | |
| 177 | + arraylen = avio_rb32(ioc); | |
| 178 | 178 | for(i = 0; i < arraylen && url_ftell(ioc) < max_pos - 1; i++) { |
| 179 | 179 | if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0) |
| 180 | 180 | 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 | ||
| 222 | 222 | ioc = s->pb; |
| 223 | 223 | |
| 224 | 224 | //first object needs to be "onMetaData" string |
| 225 | − type = get_byte(ioc); | |
| 225 | + type = avio_r8(ioc); | |
| 226 | 226 | if(type != AMF_DATA_TYPE_STRING || amf_get_string(ioc, buffer, sizeof(buffer)) < 0 || strcmp(buffer, "onMetaData")) |
| 227 | 227 | return -1; |
| 228 | 228 | |
| @@ -255,7 +255,7 @@ static int flv_read_header(AVFormatContext *s, · 26 unmodified lines | ||
| 255 | 255 | int offset, flags; |
| 256 | 256 | |
| 257 | 257 | url_fskip(s->pb, 4); |
| 258 | − flags = get_byte(s->pb); | |
| 258 | + flags = avio_r8(s->pb); | |
| 259 | 259 | /* old flvtool cleared this field */ |
| 260 | 260 | /* FIXME: better fix needed */ |
| 261 | 261 | if (!flags) { |
| @@ -276,7 +276,7 @@ static int flv_read_header(AVFormatContext *s, · 14 unmodified lines | ||
| 276 | 276 | return AVERROR(ENOMEM); |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | − offset = get_be32(s->pb); | |
| 279 | + offset = avio_rb32(s->pb); | |
| 280 | 280 | url_fseek(s->pb, offset, SEEK_SET); |
| 281 | 281 | url_fskip(s->pb, 4); |
| 282 | 282 | |
| @@ -292,7 +292,7 @@ static int flv_get_extradata(AVFormatContext *s, AVStream *st, int size) · 9 unmodified lines | ||
| 292 | 292 | if (!st->codec->extradata) |
| 293 | 293 | return AVERROR(ENOMEM); |
| 294 | 294 | 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); | |
| 296 | 296 | return 0; |
| 297 | 297 | } |
| 298 | 298 | |
| @@ -306,10 +306,10 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) · 7 unmodified lines | ||
| 306 | 306 | |
| 307 | 307 | for(;;url_fskip(s->pb, 4)){ /* pkt size is repeated at end. skip it */ |
| 308 | 308 | 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; | |
| 313 | 313 | // av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, dts:%d\n", type, size, dts); |
| 314 | 314 | if (url_feof(s->pb)) |
| 315 | 315 | return AVERROR_EOF; |
| @@ -323,11 +323,11 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) · 7 unmodified lines | ||
| 323 | 323 | |
| 324 | 324 | if (type == FLV_TAG_TYPE_AUDIO) { |
| 325 | 325 | is_audio=1; |
| 326 | − flags = get_byte(s->pb); | |
| 326 | + flags = avio_r8(s->pb); | |
| 327 | 327 | size--; |
| 328 | 328 | } else if (type == FLV_TAG_TYPE_VIDEO) { |
| 329 | 329 | is_audio=0; |
| 330 | − flags = get_byte(s->pb); | |
| 330 | + flags = avio_r8(s->pb); | |
| 331 | 331 | size--; |
| 332 | 332 | if ((flags & 0xf0) == 0x50) /* video info / command frame */ |
| 333 | 333 | goto skip; |
| @@ -375,11 +375,11 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) · 41 unmodified lines | ||
| 375 | 375 | const int64_t pos= url_ftell(s->pb); |
| 376 | 376 | const int64_t fsize= url_fsize(s->pb); |
| 377 | 377 | url_fseek(s->pb, fsize-4, SEEK_SET); |
| 378 | − size= get_be32(s->pb); | |
| 378 | + size= avio_rb32(s->pb); | |
| 379 | 379 | 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; | |
| 383 | 383 | s->duration = ts * (int64_t)AV_TIME_BASE / 1000; |
| 384 | 384 | } |
| 385 | 385 | url_fseek(s->pb, pos, SEEK_SET); |
| @@ -400,10 +400,10 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) · 14 unmodified lines | ||
| 400 | 400 | |
| 401 | 401 | if (st->codec->codec_id == CODEC_ID_AAC || |
| 402 | 402 | st->codec->codec_id == CODEC_ID_H264) { |
| 403 | − int type = get_byte(s->pb); | |
| 403 | + int type = avio_r8(s->pb); | |
| 404 | 404 | size--; |
| 405 | 405 | 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 | |
| 407 | 407 | pts = dts + cts; |
| 408 | 408 | if (cts < 0) { // dts are wrong |
| 409 | 409 | flv->wrong_dts = 1; |
| @@ -39,20 +39,20 @@ struct gxf_stream_info { · 38 unmodified lines | ||
| 39 | 39 | * \return 0 if header not found or contains invalid data, 1 otherwise |
| 40 | 40 | */ |
| 41 | 41 | static int parse_packet_header(AVIOContext *pb, GXFPktType *type, int *length) { |
| 42 | − if (get_be32(pb)) | |
| 42 | + if (avio_rb32(pb)) | |
| 43 | 43 | return 0; |
| 44 | − if (get_byte(pb) != 1) | |
| 44 | + if (avio_r8(pb) != 1) | |
| 45 | 45 | return 0; |
| 46 | − *type = get_byte(pb); | |
| 47 | − *length = get_be32(pb); | |
| 46 | + *type = avio_r8(pb); | |
| 47 | + *length = avio_rb32(pb); | |
| 48 | 48 | if ((*length >> 24) || *length < 16) |
| 49 | 49 | return 0; |
| 50 | 50 | *length -= 16; |
| 51 | − if (get_be32(pb)) | |
| 51 | + if (avio_rb32(pb)) | |
| 52 | 52 | return 0; |
| 53 | − if (get_byte(pb) != 0xe1) | |
| 53 | + if (avio_r8(pb) != 0xe1) | |
| 54 | 54 | return 0; |
| 55 | − if (get_byte(pb) != 0xe2) | |
| 55 | + if (avio_r8(pb) != 0xe2) | |
| 56 | 56 | return 0; |
| 57 | 57 | return 1; |
| 58 | 58 | } |
| @@ -161,14 +161,14 @@ static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info · 102 unmodified lines | ||
| 161 | 161 | si->first_field = AV_NOPTS_VALUE; |
| 162 | 162 | si->last_field = AV_NOPTS_VALUE; |
| 163 | 163 | 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); | |
| 166 | 166 | *len -= 2; |
| 167 | 167 | if (tlen > *len) |
| 168 | 168 | return; |
| 169 | 169 | *len -= tlen; |
| 170 | 170 | if (tlen == 4) { |
| 171 | − uint32_t value = get_be32(pb); | |
| 171 | + uint32_t value = avio_rb32(pb); | |
| 172 | 172 | if (tag == MAT_FIRST_FIELD) |
| 173 | 173 | si->first_field = value; |
| 174 | 174 | 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 | ||
| 210 | 210 | si->frames_per_second = (AVRational){0, 0}; |
| 211 | 211 | si->fields_per_frame = 0; |
| 212 | 212 | 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); | |
| 215 | 215 | *len -= 2; |
| 216 | 216 | if (tlen > *len) |
| 217 | 217 | return; |
| 218 | 218 | *len -= tlen; |
| 219 | 219 | if (tlen == 4) { |
| 220 | − uint32_t value = get_be32(pb); | |
| 220 | + uint32_t value = avio_rb32(pb); | |
| 221 | 221 | if (tag == TRACK_FPS) |
| 222 | 222 | si->frames_per_second = fps_tag2avr(value); |
| 223 | 223 | 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 | ||
| 233 | 233 | static void gxf_read_index(AVFormatContext *s, int pkt_len) { |
| 234 | 234 | AVIOContext *pb = s->pb; |
| 235 | 235 | 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); | |
| 238 | 238 | int i; |
| 239 | 239 | pkt_len -= 8; |
| 240 | 240 | if (s->flags & AVFMT_FLAG_IGNIDX) { |
| @@ -253,7 +253,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) { · 12 unmodified lines | ||
| 253 | 253 | pkt_len -= 4 * map_cnt; |
| 254 | 254 | av_add_index_entry(st, 0, 0, 0, 0, 0); |
| 255 | 255 | 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, | |
| 257 | 257 | i * (uint64_t)fields_per_map + 1, 0, 0, 0); |
| 258 | 258 | url_fskip(pb, pkt_len); |
| 259 | 259 | } |
| @@ -271,12 +271,12 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { · 11 unmodified lines | ||
| 271 | 271 | return 0; |
| 272 | 272 | } |
| 273 | 273 | map_len -= 2; |
| 274 | − if (get_byte(pb) != 0x0e0 || get_byte(pb) != 0xff) { | |
| 274 | + if (avio_r8(pb) != 0x0e0 || avio_r8(pb) != 0xff) { | |
| 275 | 275 | av_log(s, AV_LOG_ERROR, "unknown version or invalid map preamble\n"); |
| 276 | 276 | return 0; |
| 277 | 277 | } |
| 278 | 278 | map_len -= 2; |
| 279 | − len = get_be16(pb); // length of material data section | |
| 279 | + len = avio_rb16(pb); // length of material data section | |
| 280 | 280 | if (len > map_len) { |
| 281 | 281 | av_log(s, AV_LOG_ERROR, "material data longer than map data\n"); |
| 282 | 282 | return 0; |
| @@ -285,7 +285,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { · 2 unmodified lines | ||
| 285 | 285 | gxf_material_tags(pb, &len, &si); |
| 286 | 286 | url_fskip(pb, len); |
| 287 | 287 | map_len -= 2; |
| 288 | − len = get_be16(pb); // length of track description | |
| 288 | + len = avio_rb16(pb); // length of track description | |
| 289 | 289 | if (len > map_len) { |
| 290 | 290 | av_log(s, AV_LOG_ERROR, "track description longer than map data\n"); |
| 291 | 291 | return 0; |
| @@ -296,9 +296,9 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { · 4 unmodified lines | ||
| 296 | 296 | AVStream *st; |
| 297 | 297 | int idx; |
| 298 | 298 | 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); | |
| 302 | 302 | len -= track_len; |
| 303 | 303 | gxf_track_tags(pb, &track_len, &si); |
| 304 | 304 | url_fskip(pb, track_len); |
| @@ -344,7 +344,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { · 39 unmodified lines | ||
| 344 | 344 | len -= 0x39; |
| 345 | 345 | url_fskip(pb, 5); // preamble |
| 346 | 346 | url_fskip(pb, 0x30); // payload description |
| 347 | − fps = fps_umf2avr(get_le32(pb)); | |
| 347 | + fps = fps_umf2avr(avio_rl32(pb)); | |
| 348 | 348 | if (!main_timebase.num || !main_timebase.den) { |
| 349 | 349 | // this may not always be correct, but simply the best we can get |
| 350 | 350 | main_timebase.num = fps.den; |
| @@ -370,7 +370,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { · 19 unmodified lines | ||
| 370 | 370 | { \ |
| 371 | 371 | if (!max_interval-- || url_feof(pb)) \ |
| 372 | 372 | goto out; \ |
| 373 | − tmp = tmp << 8 | get_byte(pb); \ | |
| 373 | + tmp = tmp << 8 | avio_r8(pb); \ | |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 376 | /** |
| @@ -389,7 +389,7 @@ static int64_t gxf_resync_media(AVFormatContext *s, uint64_t max_interval, int t · 12 unmodified lines | ||
| 389 | 389 | int len; |
| 390 | 390 | AVIOContext *pb = s->pb; |
| 391 | 391 | GXFPktType type; |
| 392 | − tmp = get_be32(pb); | |
| 392 | + tmp = avio_rb32(pb); | |
| 393 | 393 | start: |
| 394 | 394 | while (tmp) |
| 395 | 395 | READ_ONE(); |
| @@ -404,9 +404,9 @@ start: · 8 unmodified lines | ||
| 404 | 404 | goto out; |
| 405 | 405 | goto start; |
| 406 | 406 | } |
| 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); | |
| 410 | 410 | last_found_pos = url_ftell(pb) - 16 - 6; |
| 411 | 411 | if ((track >= 0 && track != cur_track) || (timestamp >= 0 && timestamp > cur_timestamp)) { |
| 412 | 412 | if (url_fseek(pb, last_pos, SEEK_SET) >= 0) |
| @@ -445,17 +445,17 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { · 32 unmodified lines | ||
| 445 | 445 | continue; |
| 446 | 446 | } |
| 447 | 447 | 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); | |
| 450 | 450 | stream_index = get_sindex(s, track_id, track_type); |
| 451 | 451 | if (stream_index < 0) |
| 452 | 452 | return stream_index; |
| 453 | 453 | 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 | |
| 459 | 459 | if (st->codec->codec_id == CODEC_ID_PCM_S24LE || |
| 460 | 460 | st->codec->codec_id == CODEC_ID_PCM_S16LE) { |
| 461 | 461 | int first = field_info >> 16; |
| @@ -233,7 +233,7 @@ void ff_id3v1_read(AVFormatContext *s) · 232 unmodified lines | ||
| 233 | 233 | filesize = url_fsize(s->pb); |
| 234 | 234 | if (filesize > 128) { |
| 235 | 235 | 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); | |
| 237 | 237 | if (ret == ID3v1_TAG_SIZE) { |
| 238 | 238 | parse_tag(s, buf); |
| 239 | 239 | } |
| @@ -55,7 +55,7 @@ static unsigned int get_size(AVIOContext *s, int len) · 54 unmodified lines | ||
| 55 | 55 | { |
| 56 | 56 | int v = 0; |
| 57 | 57 | while (len--) |
| 58 | − v = (v << 7) + (get_byte(s) & 0x7F); | |
| 58 | + v = (v << 7) + (avio_r8(s) & 0x7F); | |
| 59 | 59 | return v; |
| 60 | 60 | } |
| 61 | 61 | |
| @@ -65,7 +65,7 @@ static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, const cha · 3 unmodified lines | ||
| 65 | 65 | const char *val = NULL; |
| 66 | 66 | int len, dstlen = sizeof(dst) - 1; |
| 67 | 67 | unsigned genre; |
| 68 | − unsigned int (*get)(AVIOContext*) = get_be16; | |
| 68 | + unsigned int (*get)(AVIOContext*) = avio_rb16; | |
| 69 | 69 | |
| 70 | 70 | dst[0] = 0; |
| 71 | 71 | if (taglen < 1) |
| @@ -73,22 +73,22 @@ static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, const cha · 1 unmodified line | ||
| 73 | 73 | |
| 74 | 74 | taglen--; /* account for encoding type byte */ |
| 75 | 75 | |
| 76 | − switch (get_byte(pb)) { /* encoding type */ | |
| 76 | + switch (avio_r8(pb)) { /* encoding type */ | |
| 77 | 77 | |
| 78 | 78 | case ID3v2_ENCODING_ISO8859: |
| 79 | 79 | q = dst; |
| 80 | 80 | while (taglen-- && q - dst < dstlen - 7) { |
| 81 | 81 | uint8_t tmp; |
| 82 | − PUT_UTF8(get_byte(pb), tmp, *q++ = tmp;) | |
| 82 | + PUT_UTF8(avio_r8(pb), tmp, *q++ = tmp;) | |
| 83 | 83 | } |
| 84 | 84 | *q = 0; |
| 85 | 85 | break; |
| 86 | 86 | |
| 87 | 87 | case ID3v2_ENCODING_UTF16BOM: |
| 88 | 88 | taglen -= 2; |
| 89 | − switch (get_be16(pb)) { | |
| 89 | + switch (avio_rb16(pb)) { | |
| 90 | 90 | case 0xfffe: |
| 91 | − get = get_le16; | |
| 91 | + get = avio_rl16; | |
| 92 | 92 | case 0xfeff: |
| 93 | 93 | break; |
| 94 | 94 | default: |
| @@ -111,7 +111,7 @@ static void read_ttag(AVFormatContext *s, AVIOContext *pb, int taglen, const cha · 16 unmodified lines | ||
| 111 | 111 | |
| 112 | 112 | case ID3v2_ENCODING_UTF8: |
| 113 | 113 | len = FFMIN(taglen, dstlen); |
| 114 | − get_buffer(pb, dst, len); | |
| 114 | + avio_read(pb, dst, len); | |
| 115 | 115 | dst[len] = 0; |
| 116 | 116 | break; |
| 117 | 117 | default: |
| @@ -178,18 +178,18 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t · 60 unmodified lines | ||
| 178 | 178 | int tunsync = 0; |
| 179 | 179 | |
| 180 | 180 | if (isv34) { |
| 181 | − get_buffer(s->pb, tag, 4); | |
| 181 | + avio_read(s->pb, tag, 4); | |
| 182 | 182 | tag[4] = 0; |
| 183 | 183 | if(version==3){ |
| 184 | − tlen = get_be32(s->pb); | |
| 184 | + tlen = avio_rb32(s->pb); | |
| 185 | 185 | }else |
| 186 | 186 | tlen = get_size(s->pb, 4); |
| 187 | − tflags = get_be16(s->pb); | |
| 187 | + tflags = avio_rb16(s->pb); | |
| 188 | 188 | tunsync = tflags & ID3v2_FLAG_UNSYNCH; |
| 189 | 189 | } else { |
| 190 | − get_buffer(s->pb, tag, 3); | |
| 190 | + avio_read(s->pb, tag, 3); | |
| 191 | 191 | tag[3] = 0; |
| 192 | − tlen = get_be24(s->pb); | |
| 192 | + tlen = avio_rb24(s->pb); | |
| 193 | 193 | } |
| 194 | 194 | len -= taghdrlen + tlen; |
| 195 | 195 | |
| @@ -199,7 +199,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t · 3 unmodified lines | ||
| 199 | 199 | next = url_ftell(s->pb) + tlen; |
| 200 | 200 | |
| 201 | 201 | if (tflags & ID3v2_FLAG_DATALEN) { |
| 202 | − get_be32(s->pb); | |
| 202 | + avio_rb32(s->pb); | |
| 203 | 203 | tlen -= 4; |
| 204 | 204 | } |
| 205 | 205 | |
| @@ -211,7 +211,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t · 5 unmodified lines | ||
| 211 | 211 | int i, j; |
| 212 | 212 | av_fast_malloc(&buffer, &buffer_size, tlen); |
| 213 | 213 | for (i = 0, j = 0; i < tlen; i++, j++) { |
| 214 | − buffer[j] = get_byte(s->pb); | |
| 214 | + buffer[j] = avio_r8(s->pb); | |
| 215 | 215 | if (j > 0 && !buffer[j] && buffer[j - 1] == 0xff) { |
| 216 | 216 | /* Unsynchronised byte, skip it */ |
| 217 | 217 | j--; |
| @@ -259,7 +259,7 @@ void ff_id3v2_read(AVFormatContext *s, const char *magic) · 41 unmodified lines | ||
| 259 | 259 | do { |
| 260 | 260 | /* save the current offset in case there's nothing to read/skip */ |
| 261 | 261 | 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); | |
| 263 | 263 | if (ret != ID3v2_HEADER_SIZE) |
| 264 | 264 | break; |
| 265 | 265 | found_header = ff_id3v2_match(buf, magic); |
| @@ -149,11 +149,11 @@ static int idcin_read_header(AVFormatContext *s, · 148 unmodified lines | ||
| 149 | 149 | unsigned int sample_rate, bytes_per_sample, channels; |
| 150 | 150 | |
| 151 | 151 | /* 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); | |
| 157 | 157 | |
| 158 | 158 | st = av_new_stream(s, 0); |
| 159 | 159 | if (!st) |
| @@ -169,7 +169,7 @@ static int idcin_read_header(AVFormatContext *s, · 9 unmodified lines | ||
| 169 | 169 | /* load up the Huffman tables into extradata */ |
| 170 | 170 | st->codec->extradata_size = HUFFMAN_TABLE_SIZE; |
| 171 | 171 | 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) != | |
| 173 | 173 | HUFFMAN_TABLE_SIZE) |
| 174 | 174 | return AVERROR(EIO); |
| 175 | 175 | /* save a reference in order to transport the palette */ |
| @@ -231,13 +231,13 @@ static int idcin_read_packet(AVFormatContext *s, · 55 unmodified lines | ||
| 231 | 231 | return AVERROR(EIO); |
| 232 | 232 | |
| 233 | 233 | if (idcin->next_chunk_is_video) { |
| 234 | − command = get_le32(pb); | |
| 234 | + command = avio_rl32(pb); | |
| 235 | 235 | if (command == 2) { |
| 236 | 236 | return AVERROR(EIO); |
| 237 | 237 | } else if (command == 1) { |
| 238 | 238 | /* trigger a palette change */ |
| 239 | 239 | idcin->palctrl.palette_changed = 1; |
| 240 | − if (get_buffer(pb, palette_buffer, 768) != 768) | |
| 240 | + if (avio_read(pb, palette_buffer, 768) != 768) | |
| 241 | 241 | return AVERROR(EIO); |
| 242 | 242 | /* scale the palette as necessary */ |
| 243 | 243 | palette_scale = 2; |
| @@ -255,7 +255,7 @@ static int idcin_read_packet(AVFormatContext *s, · 11 unmodified lines | ||
| 255 | 255 | } |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | − chunk_size = get_le32(pb); | |
| 258 | + chunk_size = avio_rl32(pb); | |
| 259 | 259 | /* skip the number of decoded bytes (always equal to width * height) */ |
| 260 | 260 | url_fseek(pb, 4, SEEK_CUR); |
| 261 | 261 | chunk_size -= 4; |
| @@ -74,7 +74,7 @@ static int roq_read_header(AVFormatContext *s, · 73 unmodified lines | ||
| 74 | 74 | unsigned char preamble[RoQ_CHUNK_PREAMBLE_SIZE]; |
| 75 | 75 | |
| 76 | 76 | /* get the main header */ |
| 77 | − if (get_buffer(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != | |
| 77 | + if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != | |
| 78 | 78 | RoQ_CHUNK_PREAMBLE_SIZE) |
| 79 | 79 | return AVERROR(EIO); |
| 80 | 80 | framerate = AV_RL16(&preamble[6]); |
| @@ -115,7 +115,7 @@ static int roq_read_packet(AVFormatContext *s, · 34 unmodified lines | ||
| 115 | 115 | return AVERROR(EIO); |
| 116 | 116 | |
| 117 | 117 | /* 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)) != | |
| 119 | 119 | RoQ_CHUNK_PREAMBLE_SIZE) |
| 120 | 120 | return AVERROR(EIO); |
| 121 | 121 | |
| @@ -129,7 +129,7 @@ static int roq_read_packet(AVFormatContext *s, · 7 unmodified lines | ||
| 129 | 129 | case RoQ_INFO: |
| 130 | 130 | if (!roq->width || !roq->height) { |
| 131 | 131 | 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) | |
| 133 | 133 | return AVERROR(EIO); |
| 134 | 134 | st->codec->width = roq->width = AV_RL16(preamble); |
| 135 | 135 | st->codec->height = roq->height = AV_RL16(preamble + 2); |
| @@ -144,7 +144,7 @@ static int roq_read_packet(AVFormatContext *s, · 8 unmodified lines | ||
| 144 | 144 | codebook_offset = url_ftell(pb) - RoQ_CHUNK_PREAMBLE_SIZE; |
| 145 | 145 | codebook_size = chunk_size; |
| 146 | 146 | 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) != | |
| 148 | 148 | RoQ_CHUNK_PREAMBLE_SIZE) |
| 149 | 149 | return AVERROR(EIO); |
| 150 | 150 | 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 | ||
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | 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, | |
| 202 | 202 | chunk_size); |
| 203 | 203 | if (ret != chunk_size) |
| 204 | 204 | ret = AVERROR(EIO); |
| @@ -101,7 +101,7 @@ static int get_metadata(AVFormatContext *s, · 100 unmodified lines | ||
| 101 | 101 | if (!buf) |
| 102 | 102 | return AVERROR(ENOMEM); |
| 103 | 103 | |
| 104 | − if (get_buffer(s->pb, buf, data_size) < 0) { | |
| 104 | + if (avio_read(s->pb, buf, data_size) < 0) { | |
| 105 | 105 | av_free(buf); |
| 106 | 106 | return AVERROR(EIO); |
| 107 | 107 | } |
| @@ -136,14 +136,14 @@ static int iff_read_header(AVFormatContext *s, · 28 unmodified lines | ||
| 136 | 136 | st->codec->channels = 1; |
| 137 | 137 | url_fskip(pb, 8); |
| 138 | 138 | // 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); | |
| 140 | 140 | |
| 141 | 141 | while(!url_feof(pb)) { |
| 142 | 142 | uint64_t orig_pos; |
| 143 | 143 | int res; |
| 144 | 144 | 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); | |
| 147 | 147 | orig_pos = url_ftell(pb); |
| 148 | 148 | |
| 149 | 149 | switch(chunk_id) { |
| @@ -153,10 +153,10 @@ static int iff_read_header(AVFormatContext *s, · 3 unmodified lines | ||
| 153 | 153 | if (data_size < 14) |
| 154 | 154 | return AVERROR_INVALIDDATA; |
| 155 | 155 | url_fskip(pb, 12); |
| 156 | − st->codec->sample_rate = get_be16(pb); | |
| 156 | + st->codec->sample_rate = avio_rb16(pb); | |
| 157 | 157 | if (data_size >= 16) { |
| 158 | 158 | url_fskip(pb, 1); |
| 159 | − compression = get_byte(pb); | |
| 159 | + compression = avio_r8(pb); | |
| 160 | 160 | } |
| 161 | 161 | break; |
| 162 | 162 | |
| @@ -168,7 +168,7 @@ static int iff_read_header(AVFormatContext *s, · 5 unmodified lines | ||
| 168 | 168 | case ID_CHAN: |
| 169 | 169 | if (data_size < 4) |
| 170 | 170 | return AVERROR_INVALIDDATA; |
| 171 | − st->codec->channels = (get_be32(pb) < 6) ? 1 : 2; | |
| 171 | + st->codec->channels = (avio_rb32(pb) < 6) ? 1 : 2; | |
| 172 | 172 | break; |
| 173 | 173 | |
| 174 | 174 | case ID_CMAP: |
| @@ -176,7 +176,7 @@ static int iff_read_header(AVFormatContext *s, · 1 unmodified line | ||
| 176 | 176 | st->codec->extradata = av_malloc(data_size); |
| 177 | 177 | if (!st->codec->extradata) |
| 178 | 178 | 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) | |
| 180 | 180 | return AVERROR(EIO); |
| 181 | 181 | break; |
| 182 | 182 | |
| @@ -184,18 +184,18 @@ static int iff_read_header(AVFormatContext *s, · 1 unmodified line | ||
| 184 | 184 | st->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| 185 | 185 | if (data_size <= 8) |
| 186 | 186 | 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); | |
| 189 | 189 | 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); | |
| 191 | 191 | if (data_size >= 11) { |
| 192 | 192 | url_fskip(pb, 1); // masking |
| 193 | − compression = get_byte(pb); | |
| 193 | + compression = avio_r8(pb); | |
| 194 | 194 | } |
| 195 | 195 | if (data_size >= 16) { |
| 196 | 196 | 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); | |
| 199 | 199 | } |
| 200 | 200 | break; |
| 201 | 201 | |
| @@ -286,7 +286,7 @@ static int iff_read_packet(AVFormatContext *s, · 84 unmodified lines | ||
| 286 | 286 | if(st->codec->channels == 2) { |
| 287 | 287 | uint8_t sample_buffer[PACKET_SIZE]; |
| 288 | 288 | |
| 289 | − ret = get_buffer(pb, sample_buffer, PACKET_SIZE); | |
| 289 | + ret = avio_read(pb, sample_buffer, PACKET_SIZE); | |
| 290 | 290 | if(av_new_packet(pkt, PACKET_SIZE) < 0) { |
| 291 | 291 | av_log(s, AV_LOG_ERROR, "cannot allocate packet\n"); |
| 292 | 292 | return AVERROR(ENOMEM); |
| @@ -298,7 +298,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt) · 297 unmodified lines | ||
| 298 | 298 | pkt->size= 0; |
| 299 | 299 | for(i=0; i<3; i++){ |
| 300 | 300 | 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]); | |
| 302 | 302 | if (!s->is_pipe) |
| 303 | 303 | url_fclose(f[i]); |
| 304 | 304 | if(ret[i]>0) |
| @@ -27,18 +27,18 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) · 26 unmodified lines | ||
| 27 | 27 | { |
| 28 | 28 | int ret, size, w, h, unk1, unk2; |
| 29 | 29 | |
| 30 | − if (get_le32(s->pb) != MKTAG('M', 'J', 'P', 'G')) | |
| 30 | + if (avio_rl32(s->pb) != MKTAG('M', 'J', 'P', 'G')) | |
| 31 | 31 | return AVERROR(EIO); // FIXME |
| 32 | 32 | |
| 33 | − size = get_le32(s->pb); | |
| 33 | + size = avio_rl32(s->pb); | |
| 34 | 34 | |
| 35 | − w = get_le16(s->pb); | |
| 36 | − h = get_le16(s->pb); | |
| 35 | + w = avio_rl16(s->pb); | |
| 36 | + h = avio_rl16(s->pb); | |
| 37 | 37 | |
| 38 | 38 | url_fskip(s->pb, 8); // zero + size (padded?) |
| 39 | 39 | 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); | |
| 42 | 42 | url_fskip(s->pb, 22); // ASCII timestamp |
| 43 | 43 | |
| 44 | 44 | 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 | ||
| 49 | 49 | |
| 50 | 50 | pkt->pos = url_ftell(s->pb); |
| 51 | 51 | pkt->stream_index = 0; |
| 52 | − ret = get_buffer(s->pb, pkt->data, size); | |
| 52 | + ret = avio_read(s->pb, pkt->data, size); | |
| 53 | 53 | if (ret < 0) { |
| 54 | 54 | av_free_packet(pkt); |
| 55 | 55 | return ret; |
| @@ -166,7 +166,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, · 165 unmodified lines | ||
| 166 | 166 | url_fseek(pb, s->decode_map_chunk_offset, SEEK_SET); |
| 167 | 167 | s->decode_map_chunk_offset = 0; |
| 168 | 168 | |
| 169 | − if (get_buffer(pb, pkt->data, s->decode_map_chunk_size) != | |
| 169 | + if (avio_read(pb, pkt->data, s->decode_map_chunk_size) != | |
| 170 | 170 | s->decode_map_chunk_size) { |
| 171 | 171 | av_free_packet(pkt); |
| 172 | 172 | return CHUNK_EOF; |
| @@ -175,7 +175,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, · 2 unmodified lines | ||
| 175 | 175 | url_fseek(pb, s->video_chunk_offset, SEEK_SET); |
| 176 | 176 | s->video_chunk_offset = 0; |
| 177 | 177 | |
| 178 | − if (get_buffer(pb, pkt->data + s->decode_map_chunk_size, | |
| 178 | + if (avio_read(pb, pkt->data + s->decode_map_chunk_size, | |
| 179 | 179 | s->video_chunk_size) != s->video_chunk_size) { |
| 180 | 180 | av_free_packet(pkt); |
| 181 | 181 | return CHUNK_EOF; |
| @@ -227,7 +227,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, · 45 unmodified lines | ||
| 227 | 227 | /* read the next chunk, wherever the file happens to be pointing */ |
| 228 | 228 | if (url_feof(pb)) |
| 229 | 229 | return CHUNK_EOF; |
| 230 | − if (get_buffer(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) != | |
| 230 | + if (avio_read(pb, chunk_preamble, CHUNK_PREAMBLE_SIZE) != | |
| 231 | 231 | CHUNK_PREAMBLE_SIZE) |
| 232 | 232 | return CHUNK_BAD; |
| 233 | 233 | chunk_size = AV_RL16(&chunk_preamble[0]); |
| @@ -275,7 +275,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, · 41 unmodified lines | ||
| 275 | 275 | chunk_type = CHUNK_EOF; |
| 276 | 276 | break; |
| 277 | 277 | } |
| 278 | − if (get_buffer(pb, opcode_preamble, CHUNK_PREAMBLE_SIZE) != | |
| 278 | + if (avio_read(pb, opcode_preamble, CHUNK_PREAMBLE_SIZE) != | |
| 279 | 279 | CHUNK_PREAMBLE_SIZE) { |
| 280 | 280 | chunk_type = CHUNK_BAD; |
| 281 | 281 | break; |
| @@ -314,7 +314,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, · 32 unmodified lines | ||
| 314 | 314 | chunk_type = CHUNK_BAD; |
| 315 | 315 | break; |
| 316 | 316 | } |
| 317 | − if (get_buffer(pb, scratch, opcode_size) != | |
| 317 | + if (avio_read(pb, scratch, opcode_size) != | |
| 318 | 318 | opcode_size) { |
| 319 | 319 | chunk_type = CHUNK_BAD; |
| 320 | 320 | break; |
| @@ -331,7 +331,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, · 10 unmodified lines | ||
| 331 | 331 | chunk_type = CHUNK_BAD; |
| 332 | 332 | break; |
| 333 | 333 | } |
| 334 | − if (get_buffer(pb, scratch, opcode_size) != | |
| 334 | + if (avio_read(pb, scratch, opcode_size) != | |
| 335 | 335 | opcode_size) { |
| 336 | 336 | chunk_type = CHUNK_BAD; |
| 337 | 337 | break; |
| @@ -369,7 +369,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, · 31 unmodified lines | ||
| 369 | 369 | chunk_type = CHUNK_BAD; |
| 370 | 370 | break; |
| 371 | 371 | } |
| 372 | − if (get_buffer(pb, scratch, opcode_size) != | |
| 372 | + if (avio_read(pb, scratch, opcode_size) != | |
| 373 | 373 | opcode_size) { |
| 374 | 374 | chunk_type = CHUNK_BAD; |
| 375 | 375 | break; |
| @@ -434,7 +434,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, · 58 unmodified lines | ||
| 434 | 434 | chunk_type = CHUNK_BAD; |
| 435 | 435 | break; |
| 436 | 436 | } |
| 437 | − if (get_buffer(pb, scratch, opcode_size) != opcode_size) { | |
| 437 | + if (avio_read(pb, scratch, opcode_size) != opcode_size) { | |
| 438 | 438 | chunk_type = CHUNK_BAD; |
| 439 | 439 | break; |
| 440 | 440 | } |
| @@ -528,10 +528,10 @@ static int ipmovie_read_header(AVFormatContext *s, · 87 unmodified lines | ||
| 528 | 528 | int chunk_type; |
| 529 | 529 | uint8_t signature_buffer[sizeof(signature)]; |
| 530 | 530 | |
| 531 | − get_buffer(pb, signature_buffer, sizeof(signature_buffer)); | |
| 531 | + avio_read(pb, signature_buffer, sizeof(signature_buffer)); | |
| 532 | 532 | while (memcmp(signature_buffer, signature, sizeof(signature))) { |
| 533 | 533 | 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); | |
| 535 | 535 | if (url_feof(pb)) |
| 536 | 536 | return AVERROR_EOF; |
| 537 | 537 | } |
| @@ -549,7 +549,7 @@ static int ipmovie_read_header(AVFormatContext *s, · 11 unmodified lines | ||
| 549 | 549 | |
| 550 | 550 | /* peek ahead to the next chunk-- if it is an init audio chunk, process |
| 551 | 551 | * 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) != | |
| 553 | 553 | CHUNK_PREAMBLE_SIZE) |
| 554 | 554 | return AVERROR(EIO); |
| 555 | 555 | chunk_type = AV_RL16(&chunk_preamble[2]); |
| @@ -346,7 +346,7 @@ int ff_mp4_read_descr_len(AVIOContext *pb) · 345 unmodified lines | ||
| 346 | 346 | int len = 0; |
| 347 | 347 | int count = 4; |
| 348 | 348 | while (count--) { |
| 349 | − int c = get_byte(pb); | |
| 349 | + int c = avio_r8(pb); | |
| 350 | 350 | len = (len << 7) | (c & 0x7f); |
| 351 | 351 | if (!(c & 0x80)) |
| 352 | 352 | break; |
| @@ -357,7 +357,7 @@ int ff_mp4_read_descr_len(AVIOContext *pb) · 4 unmodified lines | ||
| 357 | 357 | int ff_mp4_read_descr(AVFormatContext *fc, AVIOContext *pb, int *tag) |
| 358 | 358 | { |
| 359 | 359 | int len; |
| 360 | − *tag = get_byte(pb); | |
| 360 | + *tag = avio_r8(pb); | |
| 361 | 361 | len = ff_mp4_read_descr_len(pb); |
| 362 | 362 | av_dlog(fc, "MPEG4 description: tag=0x%02x len=%d\n", *tag, len); |
| 363 | 363 | return len; |
| @@ -375,11 +375,11 @@ static const AVCodecTag mp4_audio_types[] = { · 11 unmodified lines | ||
| 375 | 375 | int ff_mp4_read_dec_config_descr(AVFormatContext *fc, AVStream *st, AVIOContext *pb) |
| 376 | 376 | { |
| 377 | 377 | 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 */ | |
| 383 | 383 | |
| 384 | 384 | st->codec->codec_id= ff_codec_get_id(ff_mp4_obj_type, object_type_id); |
| 385 | 385 | 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 | ||
| 392 | 392 | st->codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); |
| 393 | 393 | if (!st->codec->extradata) |
| 394 | 394 | return AVERROR(ENOMEM); |
| 395 | − get_buffer(pb, st->codec->extradata, len); | |
| 395 | + avio_read(pb, st->codec->extradata, len); | |
| 396 | 396 | st->codec->extradata_size = len; |
| 397 | 397 | if (st->codec->codec_id == CODEC_ID_AAC) { |
| 398 | 398 | MPEG4AudioConfig cfg; |
| @@ -44,7 +44,7 @@ static void get_token(AVIOContext *s, char *buf, int maxlen) · 43 unmodified lines | ||
| 44 | 44 | int i = 0; |
| 45 | 45 | char c; |
| 46 | 46 | |
| 47 | − while ((c = get_byte(s))) { | |
| 47 | + while ((c = avio_r8(s))) { | |
| 48 | 48 | if(c == ' ') |
| 49 | 49 | break; |
| 50 | 50 | if (i < maxlen-1) |
| @@ -52,7 +52,7 @@ static void get_token(AVIOContext *s, char *buf, int maxlen) · 1 unmodified line | ||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | if(!c) |
| 55 | − get_byte(s); | |
| 55 | + avio_r8(s); | |
| 56 | 56 | |
| 57 | 57 | buf[i] = 0; /* Ensure null terminated, but may be truncated */ |
| 58 | 58 | } |
| @@ -57,13 +57,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) · 56 unmodified lines | ||
| 57 | 57 | { |
| 58 | 58 | int ret, size, pts, type; |
| 59 | 59 | 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); | |
| 62 | 62 | |
| 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 | |
| 67 | 67 | |
| 68 | 68 | size -= 12; |
| 69 | 69 | if(size<1) |
| @@ -36,9 +36,9 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 35 unmodified lines | ||
| 36 | 36 | AVStream *st; |
| 37 | 37 | AVRational time_base; |
| 38 | 38 | |
| 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 | |
| 42 | 42 | |
| 43 | 43 | st = av_new_stream(s, 0); |
| 44 | 44 | if (!st) |
| @@ -46,13 +46,13 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 1 unmodified line | ||
| 46 | 46 | |
| 47 | 47 | |
| 48 | 48 | 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); | |
| 50 | 50 | 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); | |
| 56 | 56 | |
| 57 | 57 | st->need_parsing = AVSTREAM_PARSE_HEADERS; |
| 58 | 58 | |
| @@ -68,8 +68,8 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 9 unmodified lines | ||
| 68 | 68 | |
| 69 | 69 | static int read_packet(AVFormatContext *s, AVPacket *pkt) |
| 70 | 70 | { |
| 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); | |
| 73 | 73 | |
| 74 | 74 | ret = av_get_packet(s->pb, pkt, size); |
| 75 | 75 | pkt->stream_index = 0; |
| @@ -173,7 +173,7 @@ static int nut_probe(AVProbeData *p) { · 172 unmodified lines | ||
| 173 | 173 | |
| 174 | 174 | static size_t av_read(void * h, size_t len, uint8_t * buf) { |
| 175 | 175 | AVIOContext * bc = h; |
| 176 | − return get_buffer(bc, buf, len); | |
| 176 | + return avio_read(bc, buf, len); | |
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | static off_t av_seek(void * h, long long pos, int whence) { |
| @@ -82,9 +82,9 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) { · 81 unmodified lines | ||
| 82 | 82 | int ret; |
| 83 | 83 | unsigned int frame_type, packet_size, padding, frame_size; |
| 84 | 84 | |
| 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); | |
| 88 | 88 | padding = -packet_size & 511; |
| 89 | 89 | frame_size = packet_size - 8; |
| 90 | 90 | |
| @@ -86,7 +86,7 @@ static int sync(AVFormatContext *s, uint8_t *header) · 85 unmodified lines | ||
| 86 | 86 | uint8_t buf[LXF_IDENT_LENGTH]; |
| 87 | 87 | int ret; |
| 88 | 88 | |
| 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) | |
| 90 | 90 | return ret < 0 ? ret : AVERROR_EOF; |
| 91 | 91 | |
| 92 | 92 | while (memcmp(buf, LXF_IDENT, LXF_IDENT_LENGTH)) { |
| @@ -94,7 +94,7 @@ static int sync(AVFormatContext *s, uint8_t *header) · 1 unmodified line | ||
| 94 | 94 | return AVERROR_EOF; |
| 95 | 95 | |
| 96 | 96 | 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); | |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | 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 | ||
| 120 | 120 | return ret; |
| 121 | 121 | |
| 122 | 122 | //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, | |
| 124 | 124 | LXF_PACKET_HEADER_SIZE - LXF_IDENT_LENGTH)) != |
| 125 | 125 | LXF_PACKET_HEADER_SIZE - LXF_IDENT_LENGTH) { |
| 126 | 126 | return ret < 0 ? ret : AVERROR_EOF; |
| @@ -214,7 +214,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 87 unmodified lines | ||
| 214 | 214 | return AVERROR_INVALIDDATA; |
| 215 | 215 | } |
| 216 | 216 | |
| 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) | |
| 218 | 218 | return ret < 0 ? ret : AVERROR_EOF; |
| 219 | 219 | |
| 220 | 220 | if (!(st = av_new_stream(s, 0))) |
| @@ -315,7 +315,7 @@ static int lxf_read_packet(AVFormatContext *s, AVPacket *pkt) · 94 unmodified lines | ||
| 315 | 315 | //read non-20-bit audio data into lxf->temp so we can deplanarize it |
| 316 | 316 | buf = ast && ast->codec->codec_id != CODEC_ID_PCM_LXF ? lxf->temp : pkt->data; |
| 317 | 317 | |
| 318 | − if ((ret2 = get_buffer(pb, buf, ret)) != ret) { | |
| 318 | + if ((ret2 = avio_read(pb, buf, ret)) != ret) { | |
| 319 | 319 | av_free_packet(pkt); |
| 320 | 320 | return ret2 < 0 ? ret2 : AVERROR_EOF; |
| 321 | 321 | } |
| @@ -543,10 +543,10 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb, · 542 unmodified lines | ||
| 543 | 543 | int read = 1, n = 1; |
| 544 | 544 | uint64_t total = 0; |
| 545 | 545 | |
| 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 | |
| 547 | 547 | * return 0, but since that's not a valid first ebmlID byte, we can |
| 548 | 548 | * use it safely here to catch EOS. */ |
| 549 | − if (!(total = get_byte(pb))) { | |
| 549 | + if (!(total = avio_r8(pb))) { | |
| 550 | 550 | /* we might encounter EOS here */ |
| 551 | 551 | if (!url_feof(pb)) { |
| 552 | 552 | int64_t pos = url_ftell(pb); |
| @@ -570,7 +570,7 @@ static int ebml_read_num(MatroskaDemuxContext *matroska, AVIOContext *pb, · 17 unmodified lines | ||
| 570 | 570 | /* read out length */ |
| 571 | 571 | total ^= 1 << ff_log2_tab[total]; |
| 572 | 572 | while (n++ < read) |
| 573 | − total = (total << 8) | get_byte(pb); | |
| 573 | + total = (total << 8) | avio_r8(pb); | |
| 574 | 574 | |
| 575 | 575 | *number = total; |
| 576 | 576 | |
| @@ -605,7 +605,7 @@ static int ebml_read_uint(AVIOContext *pb, int size, uint64_t *num) · 28 unmodified lines | ||
| 605 | 605 | /* big-endian ordering; build up number */ |
| 606 | 606 | *num = 0; |
| 607 | 607 | while (n++ < size) |
| 608 | − *num = (*num << 8) | get_byte(pb); | |
| 608 | + *num = (*num << 8) | avio_r8(pb); | |
| 609 | 609 | |
| 610 | 610 | return 0; |
| 611 | 611 | } |
| @@ -619,9 +619,9 @@ static int ebml_read_float(AVIOContext *pb, int size, double *num) · 7 unmodified lines | ||
| 619 | 619 | if (size == 0) { |
| 620 | 620 | *num = 0; |
| 621 | 621 | } else if (size == 4) { |
| 622 | − *num= av_int2flt(get_be32(pb)); | |
| 622 | + *num= av_int2flt(avio_rb32(pb)); | |
| 623 | 623 | } else if(size==8){ |
| 624 | − *num= av_int2dbl(get_be64(pb)); | |
| 624 | + *num= av_int2dbl(avio_rb64(pb)); | |
| 625 | 625 | } else |
| 626 | 626 | return AVERROR_INVALIDDATA; |
| 627 | 627 | |
| @@ -639,7 +639,7 @@ static int ebml_read_ascii(AVIOContext *pb, int size, char **str) · 11 unmodified lines | ||
| 639 | 639 | * byte more, read the string and NULL-terminate it ourselves. */ |
| 640 | 640 | if (!(*str = av_malloc(size + 1))) |
| 641 | 641 | return AVERROR(ENOMEM); |
| 642 | − if (get_buffer(pb, (uint8_t *) *str, size) != size) { | |
| 642 | + if (avio_read(pb, (uint8_t *) *str, size) != size) { | |
| 643 | 643 | av_freep(str); |
| 644 | 644 | return AVERROR(EIO); |
| 645 | 645 | } |
| @@ -660,7 +660,7 @@ static int ebml_read_binary(AVIOContext *pb, int length, EbmlBin *bin) · 14 unmodified lines | ||
| 660 | 660 | |
| 661 | 661 | bin->size = length; |
| 662 | 662 | bin->pos = url_ftell(pb); |
| 663 | − if (get_buffer(pb, bin->data, length) != length) { | |
| 663 | + if (avio_read(pb, bin->data, length) != length) { | |
| 664 | 664 | av_freep(&bin->data); |
| 665 | 665 | return AVERROR(EIO); |
| 666 | 666 | } |
| @@ -1394,12 +1394,12 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) · 727 unmodified lines | ||
| 1394 | 1394 | ffio_init_context(&b, track->codec_priv.data,track->codec_priv.size, |
| 1395 | 1395 | 0, NULL, NULL, NULL, NULL); |
| 1396 | 1396 | 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); | |
| 1399 | 1399 | 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); | |
| 1403 | 1403 | track->audio.buf = av_malloc(track->audio.frame_size * track->audio.sub_packet_h); |
| 1404 | 1404 | if (codec_id == CODEC_ID_RA_288) { |
| 1405 | 1405 | st->codec->block_align = track->audio.coded_framesize; |
| @@ -90,18 +90,18 @@ static int read_header(AVFormatContext *s, · 89 unmodified lines | ||
| 90 | 90 | unsigned int type, length; |
| 91 | 91 | unsigned int frame_rate, width, height; |
| 92 | 92 | |
| 93 | − type = get_le16(pb); | |
| 94 | − length = get_le32(pb); | |
| 93 | + type = avio_rl16(pb); | |
| 94 | + length = avio_rl32(pb); | |
| 95 | 95 | |
| 96 | 96 | if (type != MM_TYPE_HEADER) |
| 97 | 97 | return AVERROR_INVALIDDATA; |
| 98 | 98 | |
| 99 | 99 | /* 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); | |
| 105 | 105 | url_fseek(pb, length - 10, SEEK_CUR); /* unknown data */ |
| 106 | 106 | |
| 107 | 107 | /* video stream */ |
| @@ -143,7 +143,7 @@ static int read_packet(AVFormatContext *s, · 35 unmodified lines | ||
| 143 | 143 | |
| 144 | 144 | while(1) { |
| 145 | 145 | |
| 146 | − if (get_buffer(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) { | |
| 146 | + if (avio_read(pb, preamble, MM_PREAMBLE_SIZE) != MM_PREAMBLE_SIZE) { | |
| 147 | 147 | return AVERROR(EIO); |
| 148 | 148 | } |
| 149 | 149 | |
| @@ -162,7 +162,7 @@ static int read_packet(AVFormatContext *s, · 12 unmodified lines | ||
| 162 | 162 | if (av_new_packet(pkt, length + MM_PREAMBLE_SIZE)) |
| 163 | 163 | return AVERROR(ENOMEM); |
| 164 | 164 | 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) | |
| 166 | 166 | return AVERROR(EIO); |
| 167 | 167 | pkt->size = length + MM_PREAMBLE_SIZE; |
| 168 | 168 | pkt->stream_index = 0; |
| @@ -188,15 +188,15 @@ static int mmf_read_header(AVFormatContext *s, · 187 unmodified lines | ||
| 188 | 188 | int64_t file_size, size; |
| 189 | 189 | int rate, params; |
| 190 | 190 | |
| 191 | − tag = get_le32(pb); | |
| 191 | + tag = avio_rl32(pb); | |
| 192 | 192 | if (tag != MKTAG('M', 'M', 'M', 'D')) |
| 193 | 193 | return -1; |
| 194 | − file_size = get_be32(pb); | |
| 194 | + file_size = avio_rb32(pb); | |
| 195 | 195 | |
| 196 | 196 | /* Skip some unused chunks that may or may not be present */ |
| 197 | 197 | 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); | |
| 200 | 200 | if(tag == MKTAG('C','N','T','I')) continue; |
| 201 | 201 | if(tag == MKTAG('O','P','D','A')) continue; |
| 202 | 202 | break; |
| @@ -212,22 +212,22 @@ static int mmf_read_header(AVFormatContext *s, · 9 unmodified lines | ||
| 212 | 212 | return -1; |
| 213 | 213 | } |
| 214 | 214 | |
| 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 */ | |
| 218 | 218 | rate = mmf_rate(params & 0x0f); |
| 219 | 219 | if(rate < 0) { |
| 220 | 220 | av_log(s, AV_LOG_ERROR, "Invalid sample rate\n"); |
| 221 | 221 | return -1; |
| 222 | 222 | } |
| 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 */ | |
| 226 | 226 | |
| 227 | 227 | /* Skip some unused chunks that may or may not be present */ |
| 228 | 228 | 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); | |
| 231 | 231 | if(tag == MKTAG('A','t','s','q')) continue; |
| 232 | 232 | if(tag == MKTAG('A','s','p','I')) continue; |
| 233 | 233 | break; |
| @@ -280,7 +280,7 @@ static int mmf_read_packet(AVFormatContext *s, · 46 unmodified lines | ||
| 280 | 280 | return AVERROR(EIO); |
| 281 | 281 | pkt->stream_index = 0; |
| 282 | 282 | |
| 283 | − ret = get_buffer(s->pb, pkt->data, pkt->size); | |
| 283 | + ret = avio_read(s->pb, pkt->data, pkt->size); | |
| 284 | 284 | if (ret < 0) |
| 285 | 285 | av_free_packet(pkt); |
| 286 | 286 | |
| @@ -83,11 +83,11 @@ static int mov_metadata_trkn(MOVContext *c, AVIOContext *pb, unsigned len) · 82 unmodified lines | ||
| 83 | 83 | { |
| 84 | 84 | char buf[16]; |
| 85 | 85 | |
| 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)); | |
| 88 | 88 | av_metadata_set2(&c->fc->metadata, "track", buf, 0); |
| 89 | 89 | |
| 90 | − get_be16(pb); // total tracks | |
| 90 | + avio_rb16(pb); // total tracks | |
| 91 | 91 | |
| 92 | 92 | return 0; |
| 93 | 93 | } |
| @@ -119,7 +119,7 @@ static int mov_read_mac_string(MOVContext *c, AVIOContext *pb, int len, · 25 unmodified lines | ||
| 119 | 119 | int i; |
| 120 | 120 | |
| 121 | 121 | for (i = 0; i < len; i++) { |
| 122 | − uint8_t t, c = get_byte(pb); | |
| 122 | + uint8_t t, c = avio_r8(pb); | |
| 123 | 123 | if (c < 0x80 && p < end) |
| 124 | 124 | *p++ = c; |
| 125 | 125 | else |
| @@ -165,17 +165,17 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 39 unmodified lines | ||
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | 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); | |
| 170 | 170 | 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 | |
| 173 | 173 | str_size = data_size - 16; |
| 174 | 174 | atom.size -= 16; |
| 175 | 175 | } else return 0; |
| 176 | 176 | } 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); | |
| 179 | 179 | ff_mov_lang_to_iso639(langcode, language); |
| 180 | 180 | atom.size -= 4; |
| 181 | 181 | } else |
| @@ -201,7 +201,7 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 19 unmodified lines | ||
| 201 | 201 | if (data_type == 3 || (data_type == 0 && langcode < 0x800)) { // MAC Encoded |
| 202 | 202 | mov_read_mac_string(c, pb, str_size, str, sizeof(str)); |
| 203 | 203 | } else { |
| 204 | − get_buffer(pb, str, str_size); | |
| 204 | + avio_read(pb, str, str_size); | |
| 205 | 205 | str[str_size] = 0; |
| 206 | 206 | } |
| 207 | 207 | 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 | ||
| 228 | 228 | if ((atom.size -= 5) < 0) |
| 229 | 229 | return 0; |
| 230 | 230 | |
| 231 | − version = get_byte(pb); | |
| 232 | − get_be24(pb); | |
| 231 | + version = avio_r8(pb); | |
| 232 | + avio_rb24(pb); | |
| 233 | 233 | if (version) |
| 234 | − get_be32(pb); // ??? | |
| 235 | − nb_chapters = get_byte(pb); | |
| 234 | + avio_rb32(pb); // ??? | |
| 235 | + nb_chapters = avio_r8(pb); | |
| 236 | 236 | |
| 237 | 237 | for (i = 0; i < nb_chapters; i++) { |
| 238 | 238 | if (atom.size < 9) |
| 239 | 239 | return 0; |
| 240 | 240 | |
| 241 | − start = get_be64(pb); | |
| 242 | − str_len = get_byte(pb); | |
| 241 | + start = avio_rb64(pb); | |
| 242 | + str_len = avio_r8(pb); | |
| 243 | 243 | |
| 244 | 244 | if ((atom.size -= 9+str_len) < 0) |
| 245 | 245 | return 0; |
| 246 | 246 | |
| 247 | − get_buffer(pb, str, str_len); | |
| 247 | + avio_read(pb, str, str_len); | |
| 248 | 248 | str[str_len] = 0; |
| 249 | 249 | ff_new_chapter(c->fc, i, (AVRational){1,10000000}, start, AV_NOPTS_VALUE, str); |
| 250 | 250 | } |
| @@ -264,14 +264,14 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 13 unmodified lines | ||
| 264 | 264 | a.size = atom.size; |
| 265 | 265 | a.type=0; |
| 266 | 266 | 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); | |
| 269 | 269 | } |
| 270 | 270 | av_dlog(c->fc, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n", |
| 271 | 271 | a.type, (char*)&a.type, (char*)&atom.type, a.size, total_size, atom.size); |
| 272 | 272 | total_size += 8; |
| 273 | 273 | if (a.size == 1) { /* 64 bit extended size */ |
| 274 | − a.size = get_be64(pb) - 8; | |
| 274 | + a.size = avio_rb64(pb) - 8; | |
| 275 | 275 | total_size += 8; |
| 276 | 276 | } |
| 277 | 277 | if (a.size == 0) { |
| @@ -331,8 +331,8 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 53 unmodified lines | ||
| 331 | 331 | st = c->fc->streams[c->fc->nb_streams-1]; |
| 332 | 332 | sc = st->priv_data; |
| 333 | 333 | |
| 334 | − get_be32(pb); // version + flags | |
| 335 | − entries = get_be32(pb); | |
| 334 | + avio_rb32(pb); // version + flags | |
| 335 | + entries = avio_rb32(pb); | |
| 336 | 336 | if (entries >= UINT_MAX / sizeof(*sc->drefs)) |
| 337 | 337 | return -1; |
| 338 | 338 | 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 | ||
| 342 | 342 | |
| 343 | 343 | for (i = 0; i < sc->drefs_count; i++) { |
| 344 | 344 | MOVDref *dref = &sc->drefs[i]; |
| 345 | − uint32_t size = get_be32(pb); | |
| 345 | + uint32_t size = avio_rb32(pb); | |
| 346 | 346 | int64_t next = url_ftell(pb) + size - 4; |
| 347 | 347 | |
| 348 | 348 | if (size < 12) |
| 349 | 349 | return -1; |
| 350 | 350 | |
| 351 | − dref->type = get_le32(pb); | |
| 352 | − get_be32(pb); // version + flags | |
| 351 | + dref->type = avio_rl32(pb); | |
| 352 | + avio_rb32(pb); // version + flags | |
| 353 | 353 | av_dlog(c->fc, "type %.4s size %d\n", (char*)&dref->type, size); |
| 354 | 354 | |
| 355 | 355 | 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 | ||
| 359 | 359 | |
| 360 | 360 | url_fskip(pb, 10); |
| 361 | 361 | |
| 362 | − volume_len = get_byte(pb); | |
| 362 | + volume_len = avio_r8(pb); | |
| 363 | 363 | volume_len = FFMIN(volume_len, 27); |
| 364 | − get_buffer(pb, dref->volume, 27); | |
| 364 | + avio_read(pb, dref->volume, 27); | |
| 365 | 365 | dref->volume[volume_len] = 0; |
| 366 | 366 | av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", dref->volume, volume_len); |
| 367 | 367 | |
| 368 | 368 | url_fskip(pb, 12); |
| 369 | 369 | |
| 370 | − len = get_byte(pb); | |
| 370 | + len = avio_r8(pb); | |
| 371 | 371 | len = FFMIN(len, 63); |
| 372 | − get_buffer(pb, dref->filename, 63); | |
| 372 | + avio_read(pb, dref->filename, 63); | |
| 373 | 373 | dref->filename[len] = 0; |
| 374 | 374 | av_log(c->fc, AV_LOG_DEBUG, "filename %s, len %d\n", dref->filename, len); |
| 375 | 375 | |
| 376 | 376 | url_fskip(pb, 16); |
| 377 | 377 | |
| 378 | 378 | /* 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); | |
| 381 | 381 | av_log(c->fc, AV_LOG_DEBUG, "nlvl from %d, nlvl to %d\n", |
| 382 | 382 | dref->nlvl_from, dref->nlvl_to); |
| 383 | 383 | |
| 384 | 384 | url_fskip(pb, 16); |
| 385 | 385 | |
| 386 | 386 | 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); | |
| 389 | 389 | av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len); |
| 390 | 390 | if (len&1) |
| 391 | 391 | len += 1; |
| @@ -394,7 +394,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 2 unmodified lines | ||
| 394 | 394 | dref->path = av_mallocz(len+1); |
| 395 | 395 | if (!dref->path) |
| 396 | 396 | return AVERROR(ENOMEM); |
| 397 | − get_buffer(pb, dref->path, len); | |
| 397 | + avio_read(pb, dref->path, len); | |
| 398 | 398 | if (len > volume_len && !strncmp(dref->path, dref->volume, volume_len)) { |
| 399 | 399 | len -= volume_len; |
| 400 | 400 | 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 | ||
| 409 | 409 | dref->dir = av_malloc(len+1); |
| 410 | 410 | if (!dref->dir) |
| 411 | 411 | return AVERROR(ENOMEM); |
| 412 | − get_buffer(pb, dref->dir, len); | |
| 412 | + avio_read(pb, dref->dir, len); | |
| 413 | 413 | dref->dir[len] = 0; |
| 414 | 414 | for (j = 0; j < len; j++) |
| 415 | 415 | if (dref->dir[j] == ':') |
| @@ -435,12 +435,12 @@ static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 19 unmodified lines | ||
| 435 | 435 | |
| 436 | 436 | st = c->fc->streams[c->fc->nb_streams-1]; |
| 437 | 437 | |
| 438 | − get_byte(pb); /* version */ | |
| 439 | − get_be24(pb); /* flags */ | |
| 438 | + avio_r8(pb); /* version */ | |
| 439 | + avio_rb24(pb); /* flags */ | |
| 440 | 440 | |
| 441 | 441 | /* 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 */ | |
| 444 | 444 | |
| 445 | 445 | av_dlog(c->fc, "ctype= %.4s (0x%08x)\n", (char*)&ctype, ctype); |
| 446 | 446 | 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 | ||
| 454 | 454 | else if(type == MKTAG('s','u','b','p')) |
| 455 | 455 | st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE; |
| 456 | 456 | |
| 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 */ | |
| 460 | 460 | |
| 461 | 461 | return 0; |
| 462 | 462 | } |
| @@ -470,13 +470,13 @@ int ff_mov_read_esds(AVFormatContext *fc, AVIOContext *pb, MOVAtom atom) · 7 unmodified lines | ||
| 470 | 470 | return 0; |
| 471 | 471 | st = fc->streams[fc->nb_streams-1]; |
| 472 | 472 | |
| 473 | − get_be32(pb); /* version + flags */ | |
| 473 | + avio_rb32(pb); /* version + flags */ | |
| 474 | 474 | len = ff_mp4_read_descr(fc, pb, &tag); |
| 475 | 475 | if (tag == MP4ESDescrTag) { |
| 476 | − get_be16(pb); /* ID */ | |
| 477 | − get_byte(pb); /* priority */ | |
| 476 | + avio_rb16(pb); /* ID */ | |
| 477 | + avio_r8(pb); /* priority */ | |
| 478 | 478 | } else |
| 479 | − get_be16(pb); /* ID */ | |
| 479 | + avio_rb16(pb); /* ID */ | |
| 480 | 480 | |
| 481 | 481 | len = ff_mp4_read_descr(fc, pb, &tag); |
| 482 | 482 | if (tag == MP4DecConfigDescrTag) |
| @@ -498,7 +498,7 @@ static int mov_read_dac3(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 15 unmodified lines | ||
| 498 | 498 | return 0; |
| 499 | 499 | st = c->fc->streams[c->fc->nb_streams-1]; |
| 500 | 500 | |
| 501 | − ac3info = get_be24(pb); | |
| 501 | + ac3info = avio_rb24(pb); | |
| 502 | 502 | acmod = (ac3info >> 11) & 0x7; |
| 503 | 503 | lfeon = (ac3info >> 10) & 0x1; |
| 504 | 504 | 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 | ||
| 508 | 508 | |
| 509 | 509 | static int mov_read_pasp(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
| 510 | 510 | { |
| 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); | |
| 513 | 513 | AVStream *st; |
| 514 | 514 | |
| 515 | 515 | if (c->fc->nb_streams < 1) |
| @@ -547,12 +547,12 @@ static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 31 unmodified lines | ||
| 547 | 547 | char* comp_brands_str; |
| 548 | 548 | uint8_t type[5] = {0}; |
| 549 | 549 | |
| 550 | − get_buffer(pb, type, 4); | |
| 550 | + avio_read(pb, type, 4); | |
| 551 | 551 | if (strcmp(type, "qt ")) |
| 552 | 552 | c->isom = 1; |
| 553 | 553 | av_log(c->fc, AV_LOG_DEBUG, "ISO: File Type Major Brand: %.4s\n",(char *)&type); |
| 554 | 554 | 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 */ | |
| 556 | 556 | snprintf(minor_ver_str, sizeof(minor_ver_str), "%d", minor_ver); |
| 557 | 557 | av_metadata_set2(&c->fc->metadata, "minor_version", minor_ver_str, 0); |
| 558 | 558 | |
| @@ -562,7 +562,7 @@ static int mov_read_ftyp(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 3 unmodified lines | ||
| 562 | 562 | comp_brands_str = av_malloc(comp_brand_size + 1); /* Add null terminator */ |
| 563 | 563 | if (!comp_brands_str) |
| 564 | 564 | return AVERROR(ENOMEM); |
| 565 | − get_buffer(pb, comp_brands_str, comp_brand_size); | |
| 565 | + avio_read(pb, comp_brands_str, comp_brand_size); | |
| 566 | 566 | comp_brands_str[comp_brand_size] = 0; |
| 567 | 567 | av_metadata_set2(&c->fc->metadata, "compatible_brands", comp_brands_str, 0); |
| 568 | 568 | av_freep(&comp_brands_str); |
| @@ -615,27 +615,27 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 46 unmodified lines | ||
| 615 | 615 | st = c->fc->streams[c->fc->nb_streams-1]; |
| 616 | 616 | sc = st->priv_data; |
| 617 | 617 | |
| 618 | − version = get_byte(pb); | |
| 618 | + version = avio_r8(pb); | |
| 619 | 619 | if (version > 1) |
| 620 | 620 | return -1; /* unsupported */ |
| 621 | 621 | |
| 622 | − get_be24(pb); /* flags */ | |
| 622 | + avio_rb24(pb); /* flags */ | |
| 623 | 623 | if (version == 1) { |
| 624 | − creation_time = get_be64(pb); | |
| 625 | − get_be64(pb); | |
| 624 | + creation_time = avio_rb64(pb); | |
| 625 | + avio_rb64(pb); | |
| 626 | 626 | } 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 */ | |
| 629 | 629 | } |
| 630 | 630 | mov_metadata_creation_time(&st->metadata, creation_time); |
| 631 | 631 | |
| 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 */ | |
| 634 | 634 | |
| 635 | − lang = get_be16(pb); /* language */ | |
| 635 | + lang = avio_rb16(pb); /* language */ | |
| 636 | 636 | if (ff_mov_lang_to_iso639(lang, language)) |
| 637 | 637 | av_metadata_set2(&st->metadata, "language", language, 0); |
| 638 | − get_be16(pb); /* quality */ | |
| 638 | + avio_rb16(pb); /* quality */ | |
| 639 | 639 | |
| 640 | 640 | return 0; |
| 641 | 641 | } |
| @@ -643,37 +643,37 @@ static int mov_read_mdhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 1 unmodified line | ||
| 643 | 643 | static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
| 644 | 644 | { |
| 645 | 645 | 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 */ | |
| 648 | 648 | |
| 649 | 649 | if (version == 1) { |
| 650 | − creation_time = get_be64(pb); | |
| 651 | − get_be64(pb); | |
| 650 | + creation_time = avio_rb64(pb); | |
| 651 | + avio_rb64(pb); | |
| 652 | 652 | } 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 */ | |
| 655 | 655 | } |
| 656 | 656 | 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 */ | |
| 658 | 658 | |
| 659 | 659 | av_dlog(c->fc, "time scale = %i\n", c->time_scale); |
| 660 | 660 | |
| 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 */ | |
| 663 | 663 | |
| 664 | − get_be16(pb); /* preferred volume */ | |
| 664 | + avio_rb16(pb); /* preferred volume */ | |
| 665 | 665 | |
| 666 | 666 | url_fskip(pb, 10); /* reserved */ |
| 667 | 667 | |
| 668 | 668 | url_fskip(pb, 36); /* display matrix */ |
| 669 | 669 | |
| 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 */ | |
| 677 | 677 | |
| 678 | 678 | return 0; |
| 679 | 679 | } |
| @@ -697,7 +697,7 @@ static int mov_read_smi(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 17 unmodified lines | ||
| 697 | 697 | return AVERROR(ENOMEM); |
| 698 | 698 | st->codec->extradata_size = 0x5a + atom.size; |
| 699 | 699 | 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); | |
| 701 | 701 | av_dlog(c->fc, "Reading SMI %"PRId64" %s\n", atom.size, st->codec->extradata + 0x5a); |
| 702 | 702 | return 0; |
| 703 | 703 | } |
| @@ -711,7 +711,7 @@ static int mov_read_enda(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 7 unmodified lines | ||
| 711 | 711 | return 0; |
| 712 | 712 | st = c->fc->streams[c->fc->nb_streams-1]; |
| 713 | 713 | |
| 714 | − little_endian = get_be16(pb); | |
| 714 | + little_endian = avio_rb16(pb); | |
| 715 | 715 | av_dlog(c->fc, "enda %d\n", little_endian); |
| 716 | 716 | if (little_endian == 1) { |
| 717 | 717 | switch (st->codec->codec_id) { |
| @@ -755,7 +755,7 @@ static int mov_read_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 37 unmodified lines | ||
| 755 | 755 | st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE; |
| 756 | 756 | AV_WB32( buf , atom.size + 8); |
| 757 | 757 | AV_WL32( buf + 4, atom.type); |
| 758 | − get_buffer(pb, buf + 8, atom.size); | |
| 758 | + avio_read(pb, buf + 8, atom.size); | |
| 759 | 759 | return 0; |
| 760 | 760 | } |
| 761 | 761 | |
| @@ -777,7 +777,7 @@ static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 15 unmodified lines | ||
| 777 | 777 | if (!st->codec->extradata) |
| 778 | 778 | return AVERROR(ENOMEM); |
| 779 | 779 | st->codec->extradata_size = atom.size; |
| 780 | − get_buffer(pb, st->codec->extradata, atom.size); | |
| 780 | + avio_read(pb, st->codec->extradata, atom.size); | |
| 781 | 781 | } else if (atom.size > 8) { /* to read frma, esds atoms */ |
| 782 | 782 | if (mov_read_default(c, pb, atom) < 0) |
| 783 | 783 | return -1; |
| @@ -806,7 +806,7 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 22 unmodified lines | ||
| 806 | 806 | if (!st->codec->extradata) |
| 807 | 807 | return AVERROR(ENOMEM); |
| 808 | 808 | st->codec->extradata_size = atom.size; |
| 809 | − get_buffer(pb, st->codec->extradata, atom.size); | |
| 809 | + avio_read(pb, st->codec->extradata, atom.size); | |
| 810 | 810 | return 0; |
| 811 | 811 | } |
| 812 | 812 | |
| @@ -834,7 +834,7 @@ static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 21 unmodified lines | ||
| 834 | 834 | return AVERROR(ENOMEM); |
| 835 | 835 | st->codec->extradata_size = atom.size - 40; |
| 836 | 836 | url_fskip(pb, 40); |
| 837 | − get_buffer(pb, st->codec->extradata, atom.size - 40); | |
| 837 | + avio_read(pb, st->codec->extradata, atom.size - 40); | |
| 838 | 838 | return 0; |
| 839 | 839 | } |
| 840 | 840 | |
| @@ -849,10 +849,10 @@ static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 8 unmodified lines | ||
| 849 | 849 | st = c->fc->streams[c->fc->nb_streams-1]; |
| 850 | 850 | sc = st->priv_data; |
| 851 | 851 | |
| 852 | − get_byte(pb); /* version */ | |
| 853 | − get_be24(pb); /* flags */ | |
| 852 | + avio_r8(pb); /* version */ | |
| 853 | + avio_rb24(pb); /* flags */ | |
| 854 | 854 | |
| 855 | − entries = get_be32(pb); | |
| 855 | + entries = avio_rb32(pb); | |
| 856 | 856 | |
| 857 | 857 | if(entries >= UINT_MAX/sizeof(int64_t)) |
| 858 | 858 | return -1; |
| @@ -864,10 +864,10 @@ static int mov_read_stco(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 5 unmodified lines | ||
| 864 | 864 | |
| 865 | 865 | if (atom.type == MKTAG('s','t','c','o')) |
| 866 | 866 | for(i=0; i<entries; i++) |
| 867 | − sc->chunk_offsets[i] = get_be32(pb); | |
| 867 | + sc->chunk_offsets[i] = avio_rb32(pb); | |
| 868 | 868 | else if (atom.type == MKTAG('c','o','6','4')) |
| 869 | 869 | for(i=0; i<entries; i++) |
| 870 | − sc->chunk_offsets[i] = get_be64(pb); | |
| 870 | + sc->chunk_offsets[i] = avio_rb64(pb); | |
| 871 | 871 | else |
| 872 | 872 | return -1; |
| 873 | 873 | |
| @@ -926,13 +926,13 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) · 52 unmodified lines | ||
| 926 | 926 | int dref_id = 1; |
| 927 | 927 | MOVAtom a = { AV_RL32("stsd") }; |
| 928 | 928 | 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 */ | |
| 931 | 931 | |
| 932 | 932 | 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); | |
| 936 | 936 | } |
| 937 | 937 | |
| 938 | 938 | if (st->codec->codec_tag && |
| @@ -984,21 +984,21 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) · 45 unmodified lines | ||
| 984 | 984 | int color_greyscale; |
| 985 | 985 | |
| 986 | 986 | 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 */ | |
| 992 | 992 | |
| 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 */ | |
| 995 | 995 | |
| 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 */ | |
| 1000 | 1000 | |
| 1001 | − len = get_byte(pb); /* codec name, pascal string */ | |
| 1001 | + len = avio_r8(pb); /* codec name, pascal string */ | |
| 1002 | 1002 | if (len > 31) |
| 1003 | 1003 | len = 31; |
| 1004 | 1004 | 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 | ||
| 1008 | 1008 | if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25)) |
| 1009 | 1009 | st->codec->codec_tag=MKTAG('I', '4', '2', '0'); |
| 1010 | 1010 | |
| 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 */ | |
| 1013 | 1013 | av_dlog(c->fc, "depth %d, ctab id %d\n", |
| 1014 | 1014 | st->codec->bits_per_coded_sample, st->codec->color_table_id); |
| 1015 | 1015 | /* figure out the palette situation */ |
| @@ -1059,23 +1059,23 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) · 43 unmodified lines | ||
| 1059 | 1059 | } |
| 1060 | 1060 | } else { |
| 1061 | 1061 | /* 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); | |
| 1065 | 1065 | if ((color_start <= 255) && |
| 1066 | 1066 | (color_end <= 255)) { |
| 1067 | 1067 | for (j = color_start; j <= color_end; j++) { |
| 1068 | 1068 | /* each R, G, or B component is 16 bits; |
| 1069 | 1069 | * only use the top 8 bits; skip alpha bytes |
| 1070 | 1070 | * 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); | |
| 1079 | 1079 | st->codec->palctrl->palette[j] = |
| 1080 | 1080 | (r << 16) | (g << 8) | (b); |
| 1081 | 1081 | } |
| @@ -1085,38 +1085,38 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) · 3 unmodified lines | ||
| 1085 | 1085 | } |
| 1086 | 1086 | } else if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO) { |
| 1087 | 1087 | int bits_per_sample, flags; |
| 1088 | − uint16_t version = get_be16(pb); | |
| 1088 | + uint16_t version = avio_rb16(pb); | |
| 1089 | 1089 | |
| 1090 | 1090 | 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 */ | |
| 1093 | 1093 | |
| 1094 | − st->codec->channels = get_be16(pb); /* channel count */ | |
| 1094 | + st->codec->channels = avio_rb16(pb); /* channel count */ | |
| 1095 | 1095 | 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 */ | |
| 1097 | 1097 | |
| 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 */ | |
| 1100 | 1100 | |
| 1101 | − st->codec->sample_rate = ((get_be32(pb) >> 16)); | |
| 1101 | + st->codec->sample_rate = ((avio_rb32(pb) >> 16)); | |
| 1102 | 1102 | |
| 1103 | 1103 | //Read QT version 1 fields. In version 0 these do not exist. |
| 1104 | 1104 | av_dlog(c->fc, "version =%d, isom =%d\n",version,c->isom); |
| 1105 | 1105 | if(!c->isom) { |
| 1106 | 1106 | 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 */ | |
| 1111 | 1111 | } 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 */ | |
| 1120 | 1120 | if (format == MKTAG('l','p','c','m')) |
| 1121 | 1121 | st->codec->codec_id = ff_mov_get_lpcm_codec_id(st->codec->bits_per_coded_sample, flags); |
| 1122 | 1122 | } |
| @@ -1249,9 +1249,9 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 126 unmodified lines | ||
| 1249 | 1249 | { |
| 1250 | 1250 | int entries; |
| 1251 | 1251 | |
| 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); | |
| 1255 | 1255 | |
| 1256 | 1256 | return ff_mov_read_stsd_entries(c, pb, entries); |
| 1257 | 1257 | } |
| @@ -1267,10 +1267,10 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 9 unmodified lines | ||
| 1267 | 1267 | st = c->fc->streams[c->fc->nb_streams-1]; |
| 1268 | 1268 | sc = st->priv_data; |
| 1269 | 1269 | |
| 1270 | − get_byte(pb); /* version */ | |
| 1271 | − get_be24(pb); /* flags */ | |
| 1270 | + avio_r8(pb); /* version */ | |
| 1271 | + avio_rb24(pb); /* flags */ | |
| 1272 | 1272 | |
| 1273 | − entries = get_be32(pb); | |
| 1273 | + entries = avio_rb32(pb); | |
| 1274 | 1274 | |
| 1275 | 1275 | av_dlog(c->fc, "track[%i].stsc.entries = %i\n", c->fc->nb_streams-1, entries); |
| 1276 | 1276 | |
| @@ -1282,9 +1282,9 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 5 unmodified lines | ||
| 1282 | 1282 | sc->stsc_count = entries; |
| 1283 | 1283 | |
| 1284 | 1284 | 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); | |
| 1288 | 1288 | } |
| 1289 | 1289 | return 0; |
| 1290 | 1290 | } |
| @@ -1300,9 +1300,9 @@ static int mov_read_stps(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 9 unmodified lines | ||
| 1300 | 1300 | st = c->fc->streams[c->fc->nb_streams-1]; |
| 1301 | 1301 | sc = st->priv_data; |
| 1302 | 1302 | |
| 1303 | − get_be32(pb); // version + flags | |
| 1303 | + avio_rb32(pb); // version + flags | |
| 1304 | 1304 | |
| 1305 | − entries = get_be32(pb); | |
| 1305 | + entries = avio_rb32(pb); | |
| 1306 | 1306 | if (entries >= UINT_MAX / sizeof(*sc->stps_data)) |
| 1307 | 1307 | return -1; |
| 1308 | 1308 | 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 | ||
| 1311 | 1311 | sc->stps_count = entries; |
| 1312 | 1312 | |
| 1313 | 1313 | for (i = 0; i < entries; i++) { |
| 1314 | − sc->stps_data[i] = get_be32(pb); | |
| 1314 | + sc->stps_data[i] = avio_rb32(pb); | |
| 1315 | 1315 | //av_dlog(c->fc, "stps %d\n", sc->stps_data[i]); |
| 1316 | 1316 | } |
| 1317 | 1317 | |
| @@ -1329,10 +1329,10 @@ static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 11 unmodified lines | ||
| 1329 | 1329 | st = c->fc->streams[c->fc->nb_streams-1]; |
| 1330 | 1330 | sc = st->priv_data; |
| 1331 | 1331 | |
| 1332 | − get_byte(pb); /* version */ | |
| 1333 | − get_be24(pb); /* flags */ | |
| 1332 | + avio_r8(pb); /* version */ | |
| 1333 | + avio_rb24(pb); /* flags */ | |
| 1334 | 1334 | |
| 1335 | − entries = get_be32(pb); | |
| 1335 | + entries = avio_rb32(pb); | |
| 1336 | 1336 | |
| 1337 | 1337 | av_dlog(c->fc, "keyframe_count = %d\n", entries); |
| 1338 | 1338 | |
| @@ -1344,7 +1344,7 @@ static int mov_read_stss(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 5 unmodified lines | ||
| 1344 | 1344 | sc->keyframe_count = entries; |
| 1345 | 1345 | |
| 1346 | 1346 | for(i=0; i<entries; i++) { |
| 1347 | − sc->keyframes[i] = get_be32(pb); | |
| 1347 | + sc->keyframes[i] = avio_rb32(pb); | |
| 1348 | 1348 | //av_dlog(c->fc, "keyframes[]=%d\n", sc->keyframes[i]); |
| 1349 | 1349 | } |
| 1350 | 1350 | return 0; |
| @@ -1363,20 +1363,20 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 12 unmodified lines | ||
| 1363 | 1363 | st = c->fc->streams[c->fc->nb_streams-1]; |
| 1364 | 1364 | sc = st->priv_data; |
| 1365 | 1365 | |
| 1366 | − get_byte(pb); /* version */ | |
| 1367 | − get_be24(pb); /* flags */ | |
| 1366 | + avio_r8(pb); /* version */ | |
| 1367 | + avio_rb24(pb); /* flags */ | |
| 1368 | 1368 | |
| 1369 | 1369 | if (atom.type == MKTAG('s','t','s','z')) { |
| 1370 | − sample_size = get_be32(pb); | |
| 1370 | + sample_size = avio_rb32(pb); | |
| 1371 | 1371 | if (!sc->sample_size) /* do not overwrite value computed in stsd */ |
| 1372 | 1372 | sc->sample_size = sample_size; |
| 1373 | 1373 | field_size = 32; |
| 1374 | 1374 | } else { |
| 1375 | 1375 | 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); | |
| 1378 | 1378 | } |
| 1379 | − entries = get_be32(pb); | |
| 1379 | + entries = avio_rb32(pb); | |
| 1380 | 1380 | |
| 1381 | 1381 | av_dlog(c->fc, "sample_size = %d sample_count = %d\n", sc->sample_size, entries); |
| 1382 | 1382 | |
| @@ -1403,7 +1403,7 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 20 unmodified lines | ||
| 1403 | 1403 | return AVERROR(ENOMEM); |
| 1404 | 1404 | } |
| 1405 | 1405 | |
| 1406 | − if (get_buffer(pb, buf, num_bytes) < num_bytes) { | |
| 1406 | + if (avio_read(pb, buf, num_bytes) < num_bytes) { | |
| 1407 | 1407 | av_freep(&sc->sample_sizes); |
| 1408 | 1408 | av_free(buf); |
| 1409 | 1409 | return -1; |
| @@ -1431,9 +1431,9 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 21 unmodified lines | ||
| 1431 | 1431 | st = c->fc->streams[c->fc->nb_streams-1]; |
| 1432 | 1432 | sc = st->priv_data; |
| 1433 | 1433 | |
| 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); | |
| 1437 | 1437 | |
| 1438 | 1438 | av_dlog(c->fc, "track[%i].stts.entries = %i\n", c->fc->nb_streams-1, entries); |
| 1439 | 1439 | |
| @@ -1448,8 +1448,8 @@ static int mov_read_stts(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 8 unmodified lines | ||
| 1448 | 1448 | int sample_duration; |
| 1449 | 1449 | int sample_count; |
| 1450 | 1450 | |
| 1451 | − sample_count=get_be32(pb); | |
| 1452 | − sample_duration = get_be32(pb); | |
| 1451 | + sample_count=avio_rb32(pb); | |
| 1452 | + sample_duration = avio_rb32(pb); | |
| 1453 | 1453 | sc->stts_data[i].count= sample_count; |
| 1454 | 1454 | sc->stts_data[i].duration= sample_duration; |
| 1455 | 1455 | |
| @@ -1476,9 +1476,9 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 20 unmodified lines | ||
| 1476 | 1476 | st = c->fc->streams[c->fc->nb_streams-1]; |
| 1477 | 1477 | sc = st->priv_data; |
| 1478 | 1478 | |
| 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); | |
| 1482 | 1482 | |
| 1483 | 1483 | av_dlog(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries); |
| 1484 | 1484 | |
| @@ -1490,8 +1490,8 @@ static int mov_read_ctts(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 5 unmodified lines | ||
| 1490 | 1490 | sc->ctts_count = entries; |
| 1491 | 1491 | |
| 1492 | 1492 | 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); | |
| 1495 | 1495 | |
| 1496 | 1496 | sc->ctts_data[i].count = count; |
| 1497 | 1497 | sc->ctts_data[i].duration= duration; |
| @@ -1837,7 +1837,7 @@ static int mov_read_ilst(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 339 unmodified lines | ||
| 1837 | 1837 | static int mov_read_meta(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
| 1838 | 1838 | { |
| 1839 | 1839 | while (atom.size > 8) { |
| 1840 | − uint32_t tag = get_le32(pb); | |
| 1840 | + uint32_t tag = avio_rl32(pb); | |
| 1841 | 1841 | atom.size -= 4; |
| 1842 | 1842 | if (tag == MKTAG('h','d','l','r')) { |
| 1843 | 1843 | url_fseek(pb, -8, SEEK_CUR); |
| @@ -1864,8 +1864,8 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 20 unmodified lines | ||
| 1864 | 1864 | st = c->fc->streams[c->fc->nb_streams-1]; |
| 1865 | 1865 | sc = st->priv_data; |
| 1866 | 1866 | |
| 1867 | − version = get_byte(pb); | |
| 1868 | − get_be24(pb); /* flags */ | |
| 1867 | + version = avio_r8(pb); | |
| 1868 | + avio_rb24(pb); /* flags */ | |
| 1869 | 1869 | /* |
| 1870 | 1870 | MOV_TRACK_ENABLED 0x0001 |
| 1871 | 1871 | MOV_TRACK_IN_MOVIE 0x0002 |
| @@ -1874,36 +1874,36 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 2 unmodified lines | ||
| 1874 | 1874 | */ |
| 1875 | 1875 | |
| 1876 | 1876 | if (version == 1) { |
| 1877 | − get_be64(pb); | |
| 1878 | − get_be64(pb); | |
| 1877 | + avio_rb64(pb); | |
| 1878 | + avio_rb64(pb); | |
| 1879 | 1879 | } 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 */ | |
| 1882 | 1882 | } |
| 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 */ | |
| 1885 | 1885 | |
| 1886 | 1886 | /* 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 */ | |
| 1890 | 1890 | |
| 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 */ | |
| 1895 | 1895 | |
| 1896 | 1896 | //read in the display matrix (outlined in ISO 14496-12, Section 6.2.2) |
| 1897 | 1897 | // they're kept in fixed point format through all calculations |
| 1898 | 1898 | // ignore u,v,z b/c we don't need the scale factor to calc aspect ratio |
| 1899 | 1899 | 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) | |
| 1903 | 1903 | } |
| 1904 | 1904 | |
| 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 | |
| 1907 | 1907 | sc->width = width >> 16; |
| 1908 | 1908 | sc->height = height >> 16; |
| 1909 | 1909 | |
| @@ -1937,10 +1937,10 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 27 unmodified lines | ||
| 1937 | 1937 | MOVTrackExt *trex = NULL; |
| 1938 | 1938 | int flags, track_id, i; |
| 1939 | 1939 | |
| 1940 | − get_byte(pb); /* version */ | |
| 1941 | − flags = get_be24(pb); | |
| 1940 | + avio_r8(pb); /* version */ | |
| 1941 | + flags = avio_rb24(pb); | |
| 1942 | 1942 | |
| 1943 | − track_id = get_be32(pb); | |
| 1943 | + track_id = avio_rb32(pb); | |
| 1944 | 1944 | if (!track_id) |
| 1945 | 1945 | return -1; |
| 1946 | 1946 | frag->track_id = track_id; |
| @@ -1954,21 +1954,21 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 7 unmodified lines | ||
| 1954 | 1954 | return -1; |
| 1955 | 1955 | } |
| 1956 | 1956 | |
| 1957 | − if (flags & 0x01) frag->base_data_offset = get_be64(pb); | |
| 1957 | + if (flags & 0x01) frag->base_data_offset = avio_rb64(pb); | |
| 1958 | 1958 | 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); | |
| 1960 | 1960 | else frag->stsd_id = trex->stsd_id; |
| 1961 | 1961 | |
| 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; | |
| 1965 | 1965 | av_dlog(c->fc, "frag flags 0x%x\n", frag->flags); |
| 1966 | 1966 | return 0; |
| 1967 | 1967 | } |
| 1968 | 1968 | |
| 1969 | 1969 | static int mov_read_chap(MOVContext *c, AVIOContext *pb, MOVAtom atom) |
| 1970 | 1970 | { |
| 1971 | − c->chapter_track = get_be32(pb); | |
| 1971 | + c->chapter_track = avio_rb32(pb); | |
| 1972 | 1972 | return 0; |
| 1973 | 1973 | } |
| 1974 | 1974 | |
| @@ -1983,13 +1983,13 @@ static int mov_read_trex(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 8 unmodified lines | ||
| 1983 | 1983 | return AVERROR(ENOMEM); |
| 1984 | 1984 | c->trex_data = trex; |
| 1985 | 1985 | 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); | |
| 1993 | 1993 | return 0; |
| 1994 | 1994 | } |
| 1995 | 1995 | |
| @@ -2017,12 +2017,12 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 21 unmodified lines | ||
| 2017 | 2017 | sc = st->priv_data; |
| 2018 | 2018 | if (sc->pseudo_stream_id+1 != frag->stsd_id) |
| 2019 | 2019 | 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); | |
| 2023 | 2023 | 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); | |
| 2026 | 2026 | if (flags & 0x800) { |
| 2027 | 2027 | MOVStts *ctts_data; |
| 2028 | 2028 | 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 | ||
| 2043 | 2043 | unsigned sample_duration = frag->duration; |
| 2044 | 2044 | int keyframe; |
| 2045 | 2045 | |
| 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); | |
| 2049 | 2049 | if (flags & 0x800) { |
| 2050 | 2050 | 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); | |
| 2052 | 2052 | sc->ctts_count++; |
| 2053 | 2053 | } |
| 2054 | 2054 | 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 | ||
| 2077 | 2077 | |
| 2078 | 2078 | if (atom.size < 8) |
| 2079 | 2079 | 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 */ | |
| 2081 | 2081 | url_fskip(pb, atom.size - 4); |
| 2082 | 2082 | return 0; |
| 2083 | 2083 | } |
| 2084 | − atom.type = get_le32(pb); | |
| 2084 | + atom.type = avio_rl32(pb); | |
| 2085 | 2085 | atom.size -= 8; |
| 2086 | 2086 | if (atom.type != MKTAG('m','d','a','t')) { |
| 2087 | 2087 | url_fskip(pb, atom.size); |
| @@ -2100,17 +2100,17 @@ static int mov_read_cmov(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 12 unmodified lines | ||
| 2100 | 2100 | long cmov_len, moov_len; |
| 2101 | 2101 | int ret = -1; |
| 2102 | 2102 | |
| 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')) | |
| 2105 | 2105 | return -1; |
| 2106 | − if (get_le32(pb) != MKTAG('z','l','i','b')) { | |
| 2106 | + if (avio_rl32(pb) != MKTAG('z','l','i','b')) { | |
| 2107 | 2107 | av_log(c->fc, AV_LOG_ERROR, "unknown compression for cmov atom !"); |
| 2108 | 2108 | return -1; |
| 2109 | 2109 | } |
| 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')) | |
| 2112 | 2112 | return -1; |
| 2113 | − moov_len = get_be32(pb); /* uncompressed size */ | |
| 2113 | + moov_len = avio_rb32(pb); /* uncompressed size */ | |
| 2114 | 2114 | cmov_len = atom.size - 6 * 4; |
| 2115 | 2115 | |
| 2116 | 2116 | cmov_data = av_malloc(cmov_len); |
| @@ -2121,7 +2121,7 @@ static int mov_read_cmov(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 4 unmodified lines | ||
| 2121 | 2121 | av_free(cmov_data); |
| 2122 | 2122 | return AVERROR(ENOMEM); |
| 2123 | 2123 | } |
| 2124 | − get_buffer(pb, cmov_data, cmov_len); | |
| 2124 | + avio_read(pb, cmov_data, cmov_len); | |
| 2125 | 2125 | if(uncompress (moov_data, (uLongf *) &moov_len, (const Bytef *)cmov_data, cmov_len) != Z_OK) |
| 2126 | 2126 | goto free_and_return; |
| 2127 | 2127 | 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 | ||
| 2152 | 2152 | return 0; |
| 2153 | 2153 | sc = c->fc->streams[c->fc->nb_streams-1]->priv_data; |
| 2154 | 2154 | |
| 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 */ | |
| 2158 | 2158 | |
| 2159 | 2159 | if((uint64_t)edit_count*12+8 > atom.size) |
| 2160 | 2160 | return -1; |
| 2161 | 2161 | |
| 2162 | 2162 | for(i=0; i<edit_count; i++){ |
| 2163 | 2163 | 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 */ | |
| 2167 | 2167 | if (i == 0 && time >= -1) { |
| 2168 | 2168 | sc->time_offset = time != -1 ? time : -duration; |
| 2169 | 2169 | } |
| @@ -2314,7 +2314,7 @@ static void mov_read_chapters(AVFormatContext *s) · 144 unmodified lines | ||
| 2314 | 2314 | } |
| 2315 | 2315 | |
| 2316 | 2316 | // the first two bytes are the length of the title |
| 2317 | − len = get_be16(sc->pb); | |
| 2317 | + len = avio_rb16(sc->pb); | |
| 2318 | 2318 | if (len > sample->size-2) |
| 2319 | 2319 | continue; |
| 2320 | 2320 | title_len = 2*len + 1; |
| @@ -2324,7 +2324,7 @@ static void mov_read_chapters(AVFormatContext *s) · 3 unmodified lines | ||
| 2324 | 2324 | // The samples could theoretically be in any encoding if there's an encd |
| 2325 | 2325 | // atom following, but in practice are only utf-8 or utf-16, distinguished |
| 2326 | 2326 | // instead by the presence of a BOM |
| 2327 | − ch = get_be16(sc->pb); | |
| 2327 | + ch = avio_rb16(sc->pb); | |
| 2328 | 2328 | if (ch == 0xfeff) |
| 2329 | 2329 | avio_get_str16be(sc->pb, len, title, title_len); |
| 2330 | 2330 | else if (ch == 0xfffe) |
| @@ -80,7 +80,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) · 79 unmodified lines | ||
| 80 | 80 | MPADecodeHeader c; |
| 81 | 81 | int vbrtag_size = 0; |
| 82 | 82 | |
| 83 | − v = get_be32(s->pb); | |
| 83 | + v = avio_rb32(s->pb); | |
| 84 | 84 | if(ff_mpa_check_header(v) < 0) |
| 85 | 85 | return -1; |
| 86 | 86 | |
| @@ -91,25 +91,25 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) · 4 unmodified lines | ||
| 91 | 91 | |
| 92 | 92 | /* Check for Xing / Info tag */ |
| 93 | 93 | 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); | |
| 95 | 95 | 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); | |
| 97 | 97 | if(v & 0x1) |
| 98 | − frames = get_be32(s->pb); | |
| 98 | + frames = avio_rb32(s->pb); | |
| 99 | 99 | if(v & 0x2) |
| 100 | − size = get_be32(s->pb); | |
| 100 | + size = avio_rb32(s->pb); | |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /* Check for VBRI tag (always 32 bytes after end of mpegaudio header) */ |
| 104 | 104 | url_fseek(s->pb, base + 4 + 32, SEEK_SET); |
| 105 | − v = get_be32(s->pb); | |
| 105 | + v = avio_rb32(s->pb); | |
| 106 | 106 | if(v == MKBETAG('V', 'B', 'R', 'I')) { |
| 107 | 107 | /* Check tag version */ |
| 108 | − if(get_be16(s->pb) == 1) { | |
| 108 | + if(avio_rb16(s->pb) == 1) { | |
| 109 | 109 | /* skip delay and quality */ |
| 110 | 110 | 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); | |
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | |
| @@ -55,16 +55,16 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) · 54 unmodified lines | ||
| 55 | 55 | MPCContext *c = s->priv_data; |
| 56 | 56 | AVStream *st; |
| 57 | 57 | |
| 58 | − if(get_le24(s->pb) != MKTAG('M', 'P', '+', 0)){ | |
| 58 | + if(avio_rl24(s->pb) != MKTAG('M', 'P', '+', 0)){ | |
| 59 | 59 | av_log(s, AV_LOG_ERROR, "Not a Musepack file\n"); |
| 60 | 60 | return -1; |
| 61 | 61 | } |
| 62 | − c->ver = get_byte(s->pb); | |
| 62 | + c->ver = avio_r8(s->pb); | |
| 63 | 63 | if(c->ver != 0x07 && c->ver != 0x17){ |
| 64 | 64 | av_log(s, AV_LOG_ERROR, "Can demux Musepack SV7, got version %02X\n", c->ver); |
| 65 | 65 | return -1; |
| 66 | 66 | } |
| 67 | − c->fcount = get_le32(s->pb); | |
| 67 | + c->fcount = avio_rl32(s->pb); | |
| 68 | 68 | if((int64_t)c->fcount * sizeof(MPCFrame) >= UINT_MAX){ |
| 69 | 69 | av_log(s, AV_LOG_ERROR, "Too many frames, seeking is not possible\n"); |
| 70 | 70 | return -1; |
| @@ -85,7 +85,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) · 14 unmodified lines | ||
| 85 | 85 | |
| 86 | 86 | st->codec->extradata_size = 16; |
| 87 | 87 | 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); | |
| 89 | 89 | st->codec->sample_rate = mpc_rate[st->codec->extradata[2] & 3]; |
| 90 | 90 | av_set_pts_info(st, 32, MPC_FRAMESIZE, st->codec->sample_rate); |
| 91 | 91 | /* scan for seekpoints */ |
| @@ -121,11 +121,11 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) · 29 unmodified lines | ||
| 121 | 121 | c->curframe++; |
| 122 | 122 | curbits = c->curbits; |
| 123 | 123 | pos = url_ftell(s->pb); |
| 124 | − tmp = get_le32(s->pb); | |
| 124 | + tmp = avio_rl32(s->pb); | |
| 125 | 125 | if(curbits <= 12){ |
| 126 | 126 | size2 = (tmp >> (12 - curbits)) & 0xFFFFF; |
| 127 | 127 | }else{ |
| 128 | − tmp = (tmp << 32) | get_le32(s->pb); | |
| 128 | + tmp = (tmp << 32) | avio_rl32(s->pb); | |
| 129 | 129 | size2 = (tmp >> (44 - curbits)) & 0xFFFFF; |
| 130 | 130 | } |
| 131 | 131 | curbits += 20; |
| @@ -151,7 +151,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) · 19 unmodified lines | ||
| 151 | 151 | |
| 152 | 152 | pkt->stream_index = 0; |
| 153 | 153 | pkt->pts = cur; |
| 154 | − ret = get_buffer(s->pb, pkt->data + 4, size); | |
| 154 | + ret = avio_read(s->pb, pkt->data + 4, size); | |
| 155 | 155 | if(c->curbits) |
| 156 | 156 | url_fseek(s->pb, -4, SEEK_CUR); |
| 157 | 157 | if(ret < size){ |
| @@ -121,7 +121,7 @@ static void mpc8_get_chunk_header(AVIOContext *pb, int *tag, int64_t *size) · 120 unmodified lines | ||
| 121 | 121 | { |
| 122 | 122 | int64_t pos; |
| 123 | 123 | pos = url_ftell(pb); |
| 124 | − *tag = get_le16(pb); | |
| 124 | + *tag = avio_rl16(pb); | |
| 125 | 125 | *size = ff_get_v(pb); |
| 126 | 126 | *size -= url_ftell(pb) - pos; |
| 127 | 127 | } |
| @@ -143,7 +143,7 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off) · 15 unmodified lines | ||
| 143 | 143 | } |
| 144 | 144 | if(!(buf = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE))) |
| 145 | 145 | return; |
| 146 | − get_buffer(s->pb, buf, size); | |
| 146 | + avio_read(s->pb, buf, size); | |
| 147 | 147 | init_get_bits(&gb, buf, size * 8); |
| 148 | 148 | size = gb_get_v(&gb); |
| 149 | 149 | 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 | ||
| 195 | 195 | int64_t size, pos; |
| 196 | 196 | |
| 197 | 197 | c->header_pos = url_ftell(pb); |
| 198 | − if(get_le32(pb) != TAG_MPCK){ | |
| 198 | + if(avio_rl32(pb) != TAG_MPCK){ | |
| 199 | 199 | av_log(s, AV_LOG_ERROR, "Not a Musepack8 file\n"); |
| 200 | 200 | return -1; |
| 201 | 201 | } |
| @@ -213,7 +213,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) · 11 unmodified lines | ||
| 213 | 213 | } |
| 214 | 214 | pos = url_ftell(pb); |
| 215 | 215 | url_fskip(pb, 4); //CRC |
| 216 | − c->ver = get_byte(pb); | |
| 216 | + c->ver = avio_r8(pb); | |
| 217 | 217 | if(c->ver != 8){ |
| 218 | 218 | av_log(s, AV_LOG_ERROR, "Unknown stream version %d\n", c->ver); |
| 219 | 219 | return -1; |
| @@ -230,7 +230,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) · 10 unmodified lines | ||
| 230 | 230 | |
| 231 | 231 | st->codec->extradata_size = 2; |
| 232 | 232 | 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); | |
| 234 | 234 | |
| 235 | 235 | st->codec->channels = (st->codec->extradata[1] >> 4) + 1; |
| 236 | 236 | st->codec->sample_rate = mpc8_rate[st->codec->extradata[0] >> 5]; |
| @@ -113,7 +113,7 @@ static int mpegps_read_header(AVFormatContext *s, · 112 unmodified lines | ||
| 113 | 113 | |
| 114 | 114 | m->sofdec = -1; |
| 115 | 115 | do { |
| 116 | − v = get_byte(s->pb); | |
| 116 | + v = avio_r8(s->pb); | |
| 117 | 117 | m->header_state = m->header_state << 8 | v; |
| 118 | 118 | m->sofdec++; |
| 119 | 119 | } while (v == sofdec[i] && i++ < 6); |
| @@ -128,8 +128,8 @@ static int64_t get_pts(AVIOContext *pb, int c) · 8 unmodified lines | ||
| 128 | 128 | { |
| 129 | 129 | uint8_t buf[5]; |
| 130 | 130 | |
| 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); | |
| 133 | 133 | |
| 134 | 134 | return ff_parse_pes_pts(buf); |
| 135 | 135 | } |
| @@ -145,7 +145,7 @@ static int find_next_start_code(AVIOContext *pb, int *size_ptr, · 9 unmodified lines | ||
| 145 | 145 | while (n > 0) { |
| 146 | 146 | if (url_feof(pb)) |
| 147 | 147 | break; |
| 148 | − v = get_byte(pb); | |
| 148 | + v = avio_r8(pb); | |
| 149 | 149 | n--; |
| 150 | 150 | if (state == 0x000001) { |
| 151 | 151 | state = ((state << 8) | v) & 0xffffff; |
| @@ -176,7 +176,7 @@ static int find_prev_start_code(AVIOContext *pb, int *size_ptr) · 24 unmodified lines | ||
| 176 | 176 | if (pos < 0) |
| 177 | 177 | pos = 0; |
| 178 | 178 | url_fseek(pb, pos, SEEK_SET); |
| 179 | − get_byte(pb); | |
| 179 | + avio_r8(pb); | |
| 180 | 180 | |
| 181 | 181 | pos = pos_start; |
| 182 | 182 | for(;;) { |
| @@ -186,7 +186,7 @@ static int find_prev_start_code(AVIOContext *pb, int *size_ptr) · 3 unmodified lines | ||
| 186 | 186 | goto the_end; |
| 187 | 187 | } |
| 188 | 188 | url_fseek(pb, pos, SEEK_SET); |
| 189 | − start_code = get_be32(pb); | |
| 189 | + start_code = avio_rb32(pb); | |
| 190 | 190 | if ((start_code & 0xffffff00) == 0x100) |
| 191 | 191 | break; |
| 192 | 192 | } |
| @@ -206,27 +206,27 @@ static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *pb) · 13 unmodified lines | ||
| 206 | 206 | { |
| 207 | 207 | int psm_length, ps_info_length, es_map_length; |
| 208 | 208 | |
| 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); | |
| 213 | 213 | |
| 214 | 214 | /* skip program_stream_info */ |
| 215 | 215 | url_fskip(pb, ps_info_length); |
| 216 | − es_map_length = get_be16(pb); | |
| 216 | + es_map_length = avio_rb16(pb); | |
| 217 | 217 | |
| 218 | 218 | /* at least one es available? */ |
| 219 | 219 | 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); | |
| 223 | 223 | /* remember mapping from stream id to stream type */ |
| 224 | 224 | m->psm_es_type[es_id] = type; |
| 225 | 225 | /* skip program_stream_info */ |
| 226 | 226 | url_fskip(pb, es_info_length); |
| 227 | 227 | es_map_length -= 4 + es_info_length; |
| 228 | 228 | } |
| 229 | − get_be32(pb); /* crc32 */ | |
| 229 | + avio_rb32(pb); /* crc32 */ | |
| 230 | 230 | return 2 + psm_length; |
| 231 | 231 | } |
| 232 | 232 | |
| @@ -264,16 +264,16 @@ static int mpegps_read_pes_header(AVFormatContext *s, · 31 unmodified lines | ||
| 264 | 264 | if (startcode == SYSTEM_HEADER_START_CODE) |
| 265 | 265 | goto redo; |
| 266 | 266 | if (startcode == PADDING_STREAM) { |
| 267 | − url_fskip(s->pb, get_be16(s->pb)); | |
| 267 | + url_fskip(s->pb, avio_rb16(s->pb)); | |
| 268 | 268 | goto redo; |
| 269 | 269 | } |
| 270 | 270 | if (startcode == PRIVATE_STREAM_2) { |
| 271 | − len = get_be16(s->pb); | |
| 271 | + len = avio_rb16(s->pb); | |
| 272 | 272 | if (!m->sofdec) { |
| 273 | 273 | while (len-- >= 6) { |
| 274 | − if (get_byte(s->pb) == 'S') { | |
| 274 | + if (avio_r8(s->pb) == 'S') { | |
| 275 | 275 | uint8_t buf[5]; |
| 276 | − get_buffer(s->pb, buf, sizeof(buf)); | |
| 276 | + avio_read(s->pb, buf, sizeof(buf)); | |
| 277 | 277 | m->sofdec = !memcmp(buf, "ofdec", 5); |
| 278 | 278 | len -= sizeof(buf); |
| 279 | 279 | break; |
| @@ -297,14 +297,14 @@ static int mpegps_read_pes_header(AVFormatContext *s, · 17 unmodified lines | ||
| 297 | 297 | if (ppos) { |
| 298 | 298 | *ppos = url_ftell(s->pb) - 4; |
| 299 | 299 | } |
| 300 | − len = get_be16(s->pb); | |
| 300 | + len = avio_rb16(s->pb); | |
| 301 | 301 | pts = |
| 302 | 302 | dts = AV_NOPTS_VALUE; |
| 303 | 303 | /* stuffing */ |
| 304 | 304 | for(;;) { |
| 305 | 305 | if (len < 1) |
| 306 | 306 | goto error_redo; |
| 307 | − c = get_byte(s->pb); | |
| 307 | + c = avio_r8(s->pb); | |
| 308 | 308 | len--; |
| 309 | 309 | /* XXX: for mpeg1, should test only bit 7 */ |
| 310 | 310 | if (c != 0xff) |
| @@ -312,8 +312,8 @@ static int mpegps_read_pes_header(AVFormatContext *s, · 1 unmodified line | ||
| 312 | 312 | } |
| 313 | 313 | if ((c & 0xc0) == 0x40) { |
| 314 | 314 | /* 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); | |
| 317 | 317 | len -= 2; |
| 318 | 318 | } |
| 319 | 319 | if ((c & 0xe0) == 0x20) { |
| @@ -331,8 +331,8 @@ static int mpegps_read_pes_header(AVFormatContext *s, · 11 unmodified lines | ||
| 331 | 331 | goto redo; |
| 332 | 332 | } |
| 333 | 333 | #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); | |
| 336 | 336 | len -= 2; |
| 337 | 337 | if (header_len > len) |
| 338 | 338 | goto error_redo; |
| @@ -350,7 +350,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, · 11 unmodified lines | ||
| 350 | 350 | av_log(s, AV_LOG_WARNING, "Further flags set but no bytes left\n"); |
| 351 | 351 | } |
| 352 | 352 | if (flags & 0x01) { /* PES extension */ |
| 353 | − pes_ext = get_byte(s->pb); | |
| 353 | + pes_ext = avio_r8(s->pb); | |
| 354 | 354 | header_len--; |
| 355 | 355 | /* Skip PES private data, program packet sequence counter and P-STD buffer */ |
| 356 | 356 | skip = (pes_ext >> 4) & 0xb; |
| @@ -363,10 +363,10 @@ static int mpegps_read_pes_header(AVFormatContext *s, · 6 unmodified lines | ||
| 363 | 363 | header_len -= skip; |
| 364 | 364 | |
| 365 | 365 | if (pes_ext & 0x01) { /* PES extension 2 */ |
| 366 | − ext2_len = get_byte(s->pb); | |
| 366 | + ext2_len = avio_r8(s->pb); | |
| 367 | 367 | header_len--; |
| 368 | 368 | if ((ext2_len & 0x7f) > 0) { |
| 369 | − id_ext = get_byte(s->pb); | |
| 369 | + id_ext = avio_r8(s->pb); | |
| 370 | 370 | if ((id_ext & 0x80) == 0) |
| 371 | 371 | startcode = ((startcode & 0xff) << 8) | id_ext; |
| 372 | 372 | header_len--; |
| @@ -381,17 +381,17 @@ static int mpegps_read_pes_header(AVFormatContext *s, · 8 unmodified lines | ||
| 381 | 381 | goto redo; |
| 382 | 382 | |
| 383 | 383 | if (startcode == PRIVATE_STREAM_1 && !m->psm_es_type[startcode & 0xff]) { |
| 384 | − startcode = get_byte(s->pb); | |
| 384 | + startcode = avio_r8(s->pb); | |
| 385 | 385 | len--; |
| 386 | 386 | if (startcode >= 0x80 && startcode <= 0xcf) { |
| 387 | 387 | /* 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); | |
| 391 | 391 | len -= 3; |
| 392 | 392 | if (startcode >= 0xb0 && startcode <= 0xbf) { |
| 393 | 393 | /* MLP/TrueHD audio has a 4-byte header */ |
| 394 | − get_byte(s->pb); | |
| 394 | + avio_r8(s->pb); | |
| 395 | 395 | len--; |
| 396 | 396 | } |
| 397 | 397 | } |
| @@ -432,7 +432,7 @@ static int mpegps_read_packet(AVFormatContext *s, · 34 unmodified lines | ||
| 432 | 432 | return len; |
| 433 | 433 | |
| 434 | 434 | if(startcode == 0x1bd) { |
| 435 | − dvdaudio_substream_type = get_byte(s->pb); | |
| 435 | + dvdaudio_substream_type = avio_r8(s->pb); | |
| 436 | 436 | url_fskip(s->pb, 3); |
| 437 | 437 | len -= 4; |
| 438 | 438 | } |
| @@ -474,7 +474,7 @@ static int mpegps_read_packet(AVFormatContext *s, · 35 unmodified lines | ||
| 474 | 474 | } else if (startcode >= 0x1e0 && startcode <= 0x1ef) { |
| 475 | 475 | static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 }; |
| 476 | 476 | unsigned char buf[8]; |
| 477 | − get_buffer(s->pb, buf, 8); | |
| 477 | + avio_read(s->pb, buf, 8); | |
| 478 | 478 | url_fseek(s->pb, -8, SEEK_CUR); |
| 479 | 479 | if(!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1)) |
| 480 | 480 | codec_id = CODEC_ID_CAVS; |
| @@ -547,9 +547,9 @@ static int mpegps_read_packet(AVFormatContext *s, · 66 unmodified lines | ||
| 547 | 547 | audio data */ |
| 548 | 548 | if (len <= 3) |
| 549 | 549 | 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) */ | |
| 553 | 553 | len -= 3; |
| 554 | 554 | freq = (b1 >> 4) & 3; |
| 555 | 555 | st->codec->sample_rate = lpcm_freq_tab[freq]; |
| @@ -564,7 +564,7 @@ static int mpegps_read_packet(AVFormatContext *s, · 8 unmodified lines | ||
| 564 | 564 | return AVERROR(EINVAL); |
| 565 | 565 | } |
| 566 | 566 | av_new_packet(pkt, len); |
| 567 | − get_buffer(s->pb, pkt->data, pkt->size); | |
| 567 | + avio_read(s->pb, pkt->data, pkt->size); | |
| 568 | 568 | pkt->pts = pts; |
| 569 | 569 | pkt->dts = dts; |
| 570 | 570 | pkt->pos = dummy_pos; |
| @@ -860,24 +860,24 @@ static int mp4_read_iods(AVFormatContext *s, const uint8_t *buf, unsigned size, · 859 unmodified lines | ||
| 860 | 860 | |
| 861 | 861 | len = ff_mp4_read_descr(s, &pb, &tag); |
| 862 | 862 | 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); | |
| 869 | 869 | len = ff_mp4_read_descr(s, &pb, &tag); |
| 870 | 870 | if (tag == MP4ESDescrTag) { |
| 871 | − *es_id = get_be16(&pb); /* ES_ID */ | |
| 871 | + *es_id = avio_rb16(&pb); /* ES_ID */ | |
| 872 | 872 | av_dlog(s, "ES_ID %#x\n", *es_id); |
| 873 | − get_byte(&pb); /* priority */ | |
| 873 | + avio_r8(&pb); /* priority */ | |
| 874 | 874 | len = ff_mp4_read_descr(s, &pb, &tag); |
| 875 | 875 | if (tag == MP4DecConfigDescrTag) { |
| 876 | 876 | *dec_config_descr = av_malloc(len); |
| 877 | 877 | if (!*dec_config_descr) |
| 878 | 878 | return AVERROR(ENOMEM); |
| 879 | 879 | *dec_config_descr_size = len; |
| 880 | − get_buffer(&pb, *dec_config_descr, len); | |
| 880 | + avio_read(&pb, *dec_config_descr, len); | |
| 881 | 881 | } |
| 882 | 882 | } |
| 883 | 883 | } |
| @@ -1332,7 +1332,7 @@ static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size) · 448 unmodified lines | ||
| 1332 | 1332 | int skip, len; |
| 1333 | 1333 | |
| 1334 | 1334 | for(;;) { |
| 1335 | − len = get_buffer(pb, buf, TS_PACKET_SIZE); | |
| 1335 | + len = avio_read(pb, buf, TS_PACKET_SIZE); | |
| 1336 | 1336 | if (len != TS_PACKET_SIZE) |
| 1337 | 1337 | return AVERROR(EIO); |
| 1338 | 1338 | /* check paquet sync byte */ |
| @@ -1455,7 +1455,7 @@ static int mpegts_read_header(AVFormatContext *s, · 116 unmodified lines | ||
| 1455 | 1455 | |
| 1456 | 1456 | /* read the first 1024 bytes to get packet size */ |
| 1457 | 1457 | pos = url_ftell(pb); |
| 1458 | − len = get_buffer(pb, buf, sizeof(buf)); | |
| 1458 | + len = avio_read(pb, buf, sizeof(buf)); | |
| 1459 | 1459 | if (len != sizeof(buf)) |
| 1460 | 1460 | goto fail; |
| 1461 | 1461 | 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 | ||
| 1565 | 1565 | pos = url_ftell(s->pb); |
| 1566 | 1566 | for(i = 0; i < MAX_PACKET_READAHEAD; i++) { |
| 1567 | 1567 | 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); | |
| 1569 | 1569 | if (parse_pcr(&next_pcr_h, &next_pcr_l, pcr_buf) == 0) { |
| 1570 | 1570 | /* XXX: not precise enough */ |
| 1571 | 1571 | 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 | ||
| 1650 | 1650 | if (find_next) { |
| 1651 | 1651 | for(;;) { |
| 1652 | 1652 | 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) | |
| 1654 | 1654 | return AV_NOPTS_VALUE; |
| 1655 | 1655 | if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) && |
| 1656 | 1656 | parse_pcr(×tamp, &pcr_l, buf) == 0) { |
| @@ -1664,7 +1664,7 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, · 7 unmodified lines | ||
| 1664 | 1664 | if (pos < 0) |
| 1665 | 1665 | return AV_NOPTS_VALUE; |
| 1666 | 1666 | 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) | |
| 1668 | 1668 | return AV_NOPTS_VALUE; |
| 1669 | 1669 | if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) && |
| 1670 | 1670 | parse_pcr(×tamp, &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 | ||
| 1775 | 1775 | |
| 1776 | 1776 | for(;;) { |
| 1777 | 1777 | 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) | |
| 1779 | 1779 | return -1; |
| 1780 | 1780 | // pid = AV_RB16(buf + 1) & 0x1fff; |
| 1781 | 1781 | if(buf[1] & 0x40) break; |
| @@ -88,7 +88,7 @@ static int msnwc_tcp_read_header(AVFormatContext *ctx, AVFormatParameters *ap) · 87 unmodified lines | ||
| 88 | 88 | |
| 89 | 89 | /* Some files start with "connected\r\n\r\n". |
| 90 | 90 | * 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)); | |
| 92 | 92 | |
| 93 | 93 | if(url_feof(pb)) { |
| 94 | 94 | 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 | ||
| 107 | 107 | url_fskip(pb, 1); /* one byte has been read ahead */ |
| 108 | 108 | url_fskip(pb, 2); |
| 109 | 109 | url_fskip(pb, 2); |
| 110 | − keyframe = get_le16(pb); | |
| 111 | − size = get_le32(pb); | |
| 110 | + keyframe = avio_rl16(pb); | |
| 111 | + size = avio_rl32(pb); | |
| 112 | 112 | url_fskip(pb, 4); |
| 113 | 113 | url_fskip(pb, 4); |
| 114 | − timestamp = get_le32(pb); | |
| 114 | + timestamp = avio_rl32(pb); | |
| 115 | 115 | |
| 116 | 116 | if(!size || av_get_packet(pb, pkt, size) != size) |
| 117 | 117 | return -1; |
| @@ -84,16 +84,16 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) · 83 unmodified lines | ||
| 84 | 84 | unsigned int audio_subsegments; |
| 85 | 85 | |
| 86 | 86 | 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); | |
| 89 | 89 | 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); | |
| 97 | 97 | |
| 98 | 98 | /* Calculate width and height if missing from header */ |
| 99 | 99 | |
| @@ -106,7 +106,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) · 6 unmodified lines | ||
| 106 | 106 | / mtv->img_width; |
| 107 | 107 | |
| 108 | 108 | url_fskip(pb, 4); |
| 109 | − audio_subsegments = get_le16(pb); | |
| 109 | + audio_subsegments = avio_rl16(pb); | |
| 110 | 110 | mtv->full_segment_size = |
| 111 | 111 | audio_subsegments * (MTV_AUDIO_PADDING_SIZE + MTV_ASUBCHUNK_DATA_SIZE) + |
| 112 | 112 | mtv->img_segment_size; |
| @@ -53,20 +53,20 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 52 unmodified lines | ||
| 53 | 53 | vst->codec->extradata_size = 2; |
| 54 | 54 | vst->codec->extradata = av_mallocz(2 + FF_INPUT_BUFFER_PADDING_SIZE); |
| 55 | 55 | |
| 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); | |
| 70 | 70 | |
| 71 | 71 | if (frames_count == 0 || mvi->audio_data_size == 0) |
| 72 | 72 | return AVERROR_INVALIDDATA; |
| @@ -87,7 +87,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 14 unmodified lines | ||
| 87 | 87 | vst->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| 88 | 88 | vst->codec->codec_id = CODEC_ID_MOTIONPIXELS; |
| 89 | 89 | |
| 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; | |
| 91 | 91 | |
| 92 | 92 | mvi->audio_frame_size = ((uint64_t)mvi->audio_data_size << MVI_FRAC_BITS) / frames_count; |
| 93 | 93 | mvi->audio_size_counter = (ast->codec->sample_rate * 830 / mvi->audio_frame_size - 1) * mvi->audio_frame_size; |
| @@ -163,7 +163,7 @@ static const uint8_t mxf_sony_mpeg4_extradata[] = { 0x06,0x0e,0x2b,0x · 162 unmodified lines | ||
| 163 | 163 | |
| 164 | 164 | static int64_t klv_decode_ber_length(AVIOContext *pb) |
| 165 | 165 | { |
| 166 | − uint64_t size = get_byte(pb); | |
| 166 | + uint64_t size = avio_r8(pb); | |
| 167 | 167 | if (size & 0x80) { /* long form */ |
| 168 | 168 | int bytes_num = size & 0x7f; |
| 169 | 169 | /* 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 | ||
| 171 | 171 | return -1; |
| 172 | 172 | size = 0; |
| 173 | 173 | while (bytes_num--) |
| 174 | − size = size << 8 | get_byte(pb); | |
| 174 | + size = size << 8 | avio_r8(pb); | |
| 175 | 175 | } |
| 176 | 176 | return size; |
| 177 | 177 | } |
| @@ -180,7 +180,7 @@ static int mxf_read_sync(AVIOContext *pb, const uint8_t *key, unsigned size) · 2 unmodified lines | ||
| 180 | 180 | { |
| 181 | 181 | int i, b; |
| 182 | 182 | for (i = 0; i < size && !url_feof(pb); i++) { |
| 183 | − b = get_byte(pb); | |
| 183 | + b = avio_r8(pb); | |
| 184 | 184 | if (b == key[0]) |
| 185 | 185 | i = 0; |
| 186 | 186 | else if (b != key[i]) |
| @@ -195,7 +195,7 @@ static int klv_read_packet(KLVPacket *klv, AVIOContext *pb) · 8 unmodified lines | ||
| 195 | 195 | return -1; |
| 196 | 196 | klv->offset = url_ftell(pb) - 4; |
| 197 | 197 | memcpy(klv->key, mxf_klv_key, 4); |
| 198 | − get_buffer(pb, klv->key + 4, 12); | |
| 198 | + avio_read(pb, klv->key + 4, 12); | |
| 199 | 199 | klv->length = klv_decode_ber_length(pb); |
| 200 | 200 | return klv->length == -1 ? -1 : 0; |
| 201 | 201 | } |
| @@ -224,7 +224,7 @@ static int mxf_get_d10_aes3_packet(AVIOContext *pb, AVStream *st, AVPacket *pkt, · 22 unmodified lines | ||
| 224 | 224 | if (length > 61444) /* worst case PAL 1920 samples 8 channels */ |
| 225 | 225 | return -1; |
| 226 | 226 | av_new_packet(pkt, length); |
| 227 | − get_buffer(pb, pkt->data, length); | |
| 227 | + avio_read(pb, pkt->data, length); | |
| 228 | 228 | data_ptr = pkt->data; |
| 229 | 229 | end_ptr = pkt->data + length; |
| 230 | 230 | 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 | ||
| 265 | 265 | url_fskip(pb, klv_decode_ber_length(pb)); |
| 266 | 266 | // plaintext offset |
| 267 | 267 | klv_decode_ber_length(pb); |
| 268 | − plaintext_size = get_be64(pb); | |
| 268 | + plaintext_size = avio_rb64(pb); | |
| 269 | 269 | // source klv key |
| 270 | 270 | klv_decode_ber_length(pb); |
| 271 | − get_buffer(pb, klv->key, 16); | |
| 271 | + avio_read(pb, klv->key, 16); | |
| 272 | 272 | if (!IS_KLV_KEY(klv, mxf_essence_element_key)) |
| 273 | 273 | return -1; |
| 274 | 274 | 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 | ||
| 276 | 276 | return -1; |
| 277 | 277 | // source size |
| 278 | 278 | klv_decode_ber_length(pb); |
| 279 | − orig_size = get_be64(pb); | |
| 279 | + orig_size = avio_rb64(pb); | |
| 280 | 280 | if (orig_size < plaintext_size) |
| 281 | 281 | return -1; |
| 282 | 282 | // enc. code |
| 283 | 283 | size = klv_decode_ber_length(pb); |
| 284 | 284 | if (size < 32 || size - 32 < orig_size) |
| 285 | 285 | 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); | |
| 288 | 288 | if (mxf->aesc) |
| 289 | 289 | av_aes_crypt(mxf->aesc, tmpbuf, tmpbuf, 1, ivec, 1); |
| 290 | 290 | if (memcmp(tmpbuf, checkv, 16)) |
| @@ -347,8 +347,8 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt) · 56 unmodified lines | ||
| 347 | 347 | static int mxf_read_primer_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid) |
| 348 | 348 | { |
| 349 | 349 | 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); | |
| 352 | 352 | |
| 353 | 353 | if (item_len != 18) { |
| 354 | 354 | 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 | ||
| 360 | 360 | mxf->local_tags = av_malloc(item_num*item_len); |
| 361 | 361 | if (!mxf->local_tags) |
| 362 | 362 | return -1; |
| 363 | − get_buffer(pb, mxf->local_tags, item_num*item_len); | |
| 363 | + avio_read(pb, mxf->local_tags, item_num*item_len); | |
| 364 | 364 | return 0; |
| 365 | 365 | } |
| 366 | 366 | |
| @@ -382,7 +382,7 @@ static int mxf_read_cryptographic_context(void *arg, AVIOContext *pb, int tag, i · 15 unmodified lines | ||
| 382 | 382 | if (size != 16) |
| 383 | 383 | return -1; |
| 384 | 384 | 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); | |
| 386 | 386 | return 0; |
| 387 | 387 | } |
| 388 | 388 | |
| @@ -391,14 +391,14 @@ static int mxf_read_content_storage(void *arg, AVIOContext *pb, int tag, int siz · 2 unmodified lines | ||
| 391 | 391 | MXFContext *mxf = arg; |
| 392 | 392 | switch (tag) { |
| 393 | 393 | case 0x1901: |
| 394 | − mxf->packages_count = get_be32(pb); | |
| 394 | + mxf->packages_count = avio_rb32(pb); | |
| 395 | 395 | if (mxf->packages_count >= UINT_MAX / sizeof(UID)) |
| 396 | 396 | return -1; |
| 397 | 397 | mxf->packages_refs = av_malloc(mxf->packages_count * sizeof(UID)); |
| 398 | 398 | if (!mxf->packages_refs) |
| 399 | 399 | return -1; |
| 400 | 400 | 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)); | |
| 402 | 402 | break; |
| 403 | 403 | } |
| 404 | 404 | return 0; |
| @@ -409,18 +409,18 @@ static int mxf_read_source_clip(void *arg, AVIOContext *pb, int tag, int size, U · 4 unmodified lines | ||
| 409 | 409 | MXFStructuralComponent *source_clip = arg; |
| 410 | 410 | switch(tag) { |
| 411 | 411 | case 0x0202: |
| 412 | − source_clip->duration = get_be64(pb); | |
| 412 | + source_clip->duration = avio_rb64(pb); | |
| 413 | 413 | break; |
| 414 | 414 | case 0x1201: |
| 415 | − source_clip->start_position = get_be64(pb); | |
| 415 | + source_clip->start_position = avio_rb64(pb); | |
| 416 | 416 | break; |
| 417 | 417 | case 0x1101: |
| 418 | 418 | /* UMID, only get last 16 bytes */ |
| 419 | 419 | url_fskip(pb, 16); |
| 420 | − get_buffer(pb, source_clip->source_package_uid, 16); | |
| 420 | + avio_read(pb, source_clip->source_package_uid, 16); | |
| 421 | 421 | break; |
| 422 | 422 | case 0x1102: |
| 423 | − source_clip->source_track_id = get_be32(pb); | |
| 423 | + source_clip->source_track_id = avio_rb32(pb); | |
| 424 | 424 | break; |
| 425 | 425 | } |
| 426 | 426 | return 0; |
| @@ -431,14 +431,14 @@ static int mxf_read_material_package(void *arg, AVIOContext *pb, int tag, int si · 4 unmodified lines | ||
| 431 | 431 | MXFPackage *package = arg; |
| 432 | 432 | switch(tag) { |
| 433 | 433 | case 0x4403: |
| 434 | − package->tracks_count = get_be32(pb); | |
| 434 | + package->tracks_count = avio_rb32(pb); | |
| 435 | 435 | if (package->tracks_count >= UINT_MAX / sizeof(UID)) |
| 436 | 436 | return -1; |
| 437 | 437 | package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID)); |
| 438 | 438 | if (!package->tracks_refs) |
| 439 | 439 | return -1; |
| 440 | 440 | 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)); | |
| 442 | 442 | break; |
| 443 | 443 | } |
| 444 | 444 | return 0; |
| @@ -449,17 +449,17 @@ static int mxf_read_track(void *arg, AVIOContext *pb, int tag, int size, UID uid · 4 unmodified lines | ||
| 449 | 449 | MXFTrack *track = arg; |
| 450 | 450 | switch(tag) { |
| 451 | 451 | case 0x4801: |
| 452 | − track->track_id = get_be32(pb); | |
| 452 | + track->track_id = avio_rb32(pb); | |
| 453 | 453 | break; |
| 454 | 454 | case 0x4804: |
| 455 | − get_buffer(pb, track->track_number, 4); | |
| 455 | + avio_read(pb, track->track_number, 4); | |
| 456 | 456 | break; |
| 457 | 457 | 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); | |
| 460 | 460 | break; |
| 461 | 461 | case 0x4803: |
| 462 | − get_buffer(pb, track->sequence_ref, 16); | |
| 462 | + avio_read(pb, track->sequence_ref, 16); | |
| 463 | 463 | break; |
| 464 | 464 | } |
| 465 | 465 | return 0; |
| @@ -470,20 +470,20 @@ static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID · 4 unmodified lines | ||
| 470 | 470 | MXFSequence *sequence = arg; |
| 471 | 471 | switch(tag) { |
| 472 | 472 | case 0x0202: |
| 473 | − sequence->duration = get_be64(pb); | |
| 473 | + sequence->duration = avio_rb64(pb); | |
| 474 | 474 | break; |
| 475 | 475 | case 0x0201: |
| 476 | − get_buffer(pb, sequence->data_definition_ul, 16); | |
| 476 | + avio_read(pb, sequence->data_definition_ul, 16); | |
| 477 | 477 | break; |
| 478 | 478 | case 0x1001: |
| 479 | − sequence->structural_components_count = get_be32(pb); | |
| 479 | + sequence->structural_components_count = avio_rb32(pb); | |
| 480 | 480 | if (sequence->structural_components_count >= UINT_MAX / sizeof(UID)) |
| 481 | 481 | return -1; |
| 482 | 482 | sequence->structural_components_refs = av_malloc(sequence->structural_components_count * sizeof(UID)); |
| 483 | 483 | if (!sequence->structural_components_refs) |
| 484 | 484 | return -1; |
| 485 | 485 | 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)); | |
| 487 | 487 | break; |
| 488 | 488 | } |
| 489 | 489 | return 0; |
| @@ -494,22 +494,22 @@ static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size · 4 unmodified lines | ||
| 494 | 494 | MXFPackage *package = arg; |
| 495 | 495 | switch(tag) { |
| 496 | 496 | case 0x4403: |
| 497 | − package->tracks_count = get_be32(pb); | |
| 497 | + package->tracks_count = avio_rb32(pb); | |
| 498 | 498 | if (package->tracks_count >= UINT_MAX / sizeof(UID)) |
| 499 | 499 | return -1; |
| 500 | 500 | package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID)); |
| 501 | 501 | if (!package->tracks_refs) |
| 502 | 502 | return -1; |
| 503 | 503 | 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)); | |
| 505 | 505 | break; |
| 506 | 506 | case 0x4401: |
| 507 | 507 | /* UMID, only get last 16 bytes */ |
| 508 | 508 | url_fskip(pb, 16); |
| 509 | − get_buffer(pb, package->package_uid, 16); | |
| 509 | + avio_read(pb, package->package_uid, 16); | |
| 510 | 510 | break; |
| 511 | 511 | case 0x4701: |
| 512 | − get_buffer(pb, package->descriptor_ref, 16); | |
| 512 | + avio_read(pb, package->descriptor_ref, 16); | |
| 513 | 513 | break; |
| 514 | 514 | } |
| 515 | 515 | return 0; |
| @@ -518,12 +518,12 @@ static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size · 2 unmodified lines | ||
| 518 | 518 | static int mxf_read_index_table_segment(void *arg, AVIOContext *pb, int tag, int size, UID uid) |
| 519 | 519 | { |
| 520 | 520 | 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; | |
| 527 | 527 | } |
| 528 | 528 | return 0; |
| 529 | 529 | } |
| @@ -534,8 +534,8 @@ static void mxf_read_pixel_layout(AVIOContext *pb, MXFDescriptor *descriptor) · 4 unmodified lines | ||
| 534 | 534 | char layout[16] = {0}; |
| 535 | 535 | |
| 536 | 536 | do { |
| 537 | − code = get_byte(pb); | |
| 538 | − value = get_byte(pb); | |
| 537 | + code = avio_r8(pb); | |
| 538 | + value = avio_r8(pb); | |
| 539 | 539 | av_dlog(NULL, "pixel layout: code %#x\n", code); |
| 540 | 540 | |
| 541 | 541 | if (ofs < 16) { |
| @@ -552,46 +552,46 @@ static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int · 10 unmodified lines | ||
| 552 | 552 | MXFDescriptor *descriptor = arg; |
| 553 | 553 | switch(tag) { |
| 554 | 554 | case 0x3F01: |
| 555 | − descriptor->sub_descriptors_count = get_be32(pb); | |
| 555 | + descriptor->sub_descriptors_count = avio_rb32(pb); | |
| 556 | 556 | if (descriptor->sub_descriptors_count >= UINT_MAX / sizeof(UID)) |
| 557 | 557 | return -1; |
| 558 | 558 | descriptor->sub_descriptors_refs = av_malloc(descriptor->sub_descriptors_count * sizeof(UID)); |
| 559 | 559 | if (!descriptor->sub_descriptors_refs) |
| 560 | 560 | return -1; |
| 561 | 561 | 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)); | |
| 563 | 563 | break; |
| 564 | 564 | case 0x3004: |
| 565 | − get_buffer(pb, descriptor->essence_container_ul, 16); | |
| 565 | + avio_read(pb, descriptor->essence_container_ul, 16); | |
| 566 | 566 | break; |
| 567 | 567 | case 0x3006: |
| 568 | − descriptor->linked_track_id = get_be32(pb); | |
| 568 | + descriptor->linked_track_id = avio_rb32(pb); | |
| 569 | 569 | break; |
| 570 | 570 | case 0x3201: /* PictureEssenceCoding */ |
| 571 | − get_buffer(pb, descriptor->essence_codec_ul, 16); | |
| 571 | + avio_read(pb, descriptor->essence_codec_ul, 16); | |
| 572 | 572 | break; |
| 573 | 573 | case 0x3203: |
| 574 | − descriptor->width = get_be32(pb); | |
| 574 | + descriptor->width = avio_rb32(pb); | |
| 575 | 575 | break; |
| 576 | 576 | case 0x3202: |
| 577 | − descriptor->height = get_be32(pb); | |
| 577 | + descriptor->height = avio_rb32(pb); | |
| 578 | 578 | break; |
| 579 | 579 | 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); | |
| 582 | 582 | break; |
| 583 | 583 | 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); | |
| 586 | 586 | break; |
| 587 | 587 | case 0x3D06: /* SoundEssenceCompression */ |
| 588 | − get_buffer(pb, descriptor->essence_codec_ul, 16); | |
| 588 | + avio_read(pb, descriptor->essence_codec_ul, 16); | |
| 589 | 589 | break; |
| 590 | 590 | case 0x3D07: |
| 591 | − descriptor->channels = get_be32(pb); | |
| 591 | + descriptor->channels = avio_rb32(pb); | |
| 592 | 592 | break; |
| 593 | 593 | case 0x3D01: |
| 594 | − descriptor->bits_per_sample = get_be32(pb); | |
| 594 | + descriptor->bits_per_sample = avio_rb32(pb); | |
| 595 | 595 | break; |
| 596 | 596 | case 0x3401: |
| 597 | 597 | 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 | ||
| 603 | 603 | if (!descriptor->extradata) |
| 604 | 604 | return -1; |
| 605 | 605 | descriptor->extradata_size = size; |
| 606 | − get_buffer(pb, descriptor->extradata, size); | |
| 606 | + avio_read(pb, descriptor->extradata, size); | |
| 607 | 607 | } |
| 608 | 608 | break; |
| 609 | 609 | } |
| @@ -871,8 +871,8 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF · 261 unmodified lines | ||
| 871 | 871 | if (!ctx) |
| 872 | 872 | return -1; |
| 873 | 873 | 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 */ | |
| 876 | 876 | uint64_t next = url_ftell(pb) + size; |
| 877 | 877 | UID uid = {0}; |
| 878 | 878 | |
| @@ -893,7 +893,7 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF · 14 unmodified lines | ||
| 893 | 893 | } |
| 894 | 894 | } |
| 895 | 895 | if (ctx_size && tag == 0x3C0A) |
| 896 | − get_buffer(pb, ctx->uid, 16); | |
| 896 | + avio_read(pb, ctx->uid, 16); | |
| 897 | 897 | else if (read_child(ctx, pb, tag, size, uid) < 0) |
| 898 | 898 | return -1; |
| 899 | 899 | |
| @@ -115,7 +115,7 @@ static int mxg_update_cache(AVFormatContext *s, unsigned int cache_size) · 114 unmodified lines | ||
| 115 | 115 | if (mxg->soi_ptr) mxg->soi_ptr = mxg->buffer + soi_pos; |
| 116 | 116 | |
| 117 | 117 | /* 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, | |
| 119 | 119 | cache_size - mxg->cache_size); |
| 120 | 120 | if (ret < 0) |
| 121 | 121 | return ret; |
| @@ -68,11 +68,11 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt) · 67 unmodified lines | ||
| 68 | 68 | while (state != NC_VIDEO_FLAG) { |
| 69 | 69 | if (url_feof(s->pb)) |
| 70 | 70 | return AVERROR(EIO); |
| 71 | − state = (state<<8) + get_byte(s->pb); | |
| 71 | + state = (state<<8) + avio_r8(s->pb); | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | − get_byte(s->pb); | |
| 75 | − size = get_le16(s->pb); | |
| 74 | + avio_r8(s->pb); | |
| 75 | + size = avio_rl16(s->pb); | |
| 76 | 76 | url_fskip(s->pb, 9); |
| 77 | 77 | |
| 78 | 78 | if (size == 0) { |
| @@ -236,7 +236,7 @@ static int nsv_resync(AVFormatContext *s) · 235 unmodified lines | ||
| 236 | 236 | return -1; |
| 237 | 237 | } |
| 238 | 238 | v <<= 8; |
| 239 | − v |= get_byte(pb); | |
| 239 | + v |= avio_r8(pb); | |
| 240 | 240 | if (i < 8) { |
| 241 | 241 | av_dlog(s, "NSV resync: [%d] = %02x\n", i, v & 0x0FF); |
| 242 | 242 | } |
| @@ -277,23 +277,23 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) · 34 unmodified lines | ||
| 277 | 277 | |
| 278 | 278 | nsv->state = NSV_UNSYNC; /* in case we fail */ |
| 279 | 279 | |
| 280 | − size = get_le32(pb); | |
| 280 | + size = avio_rl32(pb); | |
| 281 | 281 | if (size < 28) |
| 282 | 282 | return -1; |
| 283 | 283 | nsv->NSVf_end = size; |
| 284 | 284 | |
| 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); | |
| 287 | 287 | av_dlog(s, "NSV NSVf chunk_size %u\n", size); |
| 288 | 288 | av_dlog(s, "NSV NSVf file_size %u\n", file_size); |
| 289 | 289 | |
| 290 | − nsv->duration = duration = get_le32(pb); /* in ms */ | |
| 290 | + nsv->duration = duration = avio_rl32(pb); /* in ms */ | |
| 291 | 291 | av_dlog(s, "NSV NSVf duration %"PRId64" ms\n", duration); |
| 292 | 292 | // XXX: store it in AVStreams |
| 293 | 293 | |
| 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); | |
| 297 | 297 | av_dlog(s, "NSV NSVf info-strings size: %d, table entries: %d, bis %d\n", |
| 298 | 298 | strings_size, table_entries, table_entries_used); |
| 299 | 299 | if (url_feof(pb)) |
| @@ -309,7 +309,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) · 9 unmodified lines | ||
| 309 | 309 | |
| 310 | 310 | p = strings = av_mallocz(strings_size + 1); |
| 311 | 311 | endp = strings + strings_size; |
| 312 | − get_buffer(pb, strings, strings_size); | |
| 312 | + avio_read(pb, strings, strings_size); | |
| 313 | 313 | while (p < endp) { |
| 314 | 314 | while (*p == ' ') |
| 315 | 315 | p++; /* strip out spaces */ |
| @@ -344,13 +344,13 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) · 28 unmodified lines | ||
| 344 | 344 | nsv->nsvs_file_offset = av_malloc((unsigned)table_entries_used * sizeof(uint32_t)); |
| 345 | 345 | |
| 346 | 346 | 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; | |
| 348 | 348 | |
| 349 | 349 | if(table_entries > table_entries_used && |
| 350 | − get_le32(pb) == MKTAG('T','O','C','2')) { | |
| 350 | + avio_rl32(pb) == MKTAG('T','O','C','2')) { | |
| 351 | 351 | nsv->nsvs_timestamps = av_malloc((unsigned)table_entries_used*sizeof(uint32_t)); |
| 352 | 352 | for(i=0;i<table_entries_used;i++) { |
| 353 | − nsv->nsvs_timestamps[i] = get_le32(pb); | |
| 353 | + nsv->nsvs_timestamps[i] = avio_rl32(pb); | |
| 354 | 354 | } |
| 355 | 355 | } |
| 356 | 356 | } |
| @@ -365,7 +365,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) · 8 unmodified lines | ||
| 365 | 365 | for (i = 0; i < table_entries; i++) { |
| 366 | 366 | unsigned char b[8]; |
| 367 | 367 | url_fseek(pb, size + nsv->nsvs_file_offset[i], SEEK_SET); |
| 368 | − get_buffer(pb, b, 8); | |
| 368 | + avio_read(pb, b, 8); | |
| 369 | 369 | av_dlog(s, "NSV [0x%08lx][0x%08lx]: %02x %02x %02x %02x %02x %02x %02x %02x" |
| 370 | 370 | "%c%c%c%c%c%c%c%c\n", |
| 371 | 371 | 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 | ||
| 396 | 396 | NSVStream *nst; |
| 397 | 397 | av_dlog(s, "%s()\n", __FUNCTION__); |
| 398 | 398 | |
| 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); | |
| 404 | 404 | |
| 405 | 405 | av_dlog(s, "NSV NSVs framerate code %2x\n", i); |
| 406 | 406 | 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 | ||
| 420 | 420 | else |
| 421 | 421 | framerate= (AVRational){i, 1}; |
| 422 | 422 | |
| 423 | − nsv->avsync = get_le16(pb); | |
| 423 | + nsv->avsync = avio_rl16(pb); | |
| 424 | 424 | nsv->framerate = framerate; |
| 425 | 425 | |
| 426 | 426 | print_tag("NSV NSVs vtag", vtag, 0); |
| @@ -568,16 +568,16 @@ null_chunk_retry: · 141 unmodified lines | ||
| 568 | 568 | if (nsv->state != NSV_HAS_READ_NSVS && nsv->state != NSV_FOUND_BEEF) |
| 569 | 569 | return -1; |
| 570 | 570 | |
| 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); | |
| 574 | 574 | vsize = (vsize << 4) | (auxcount >> 4); |
| 575 | 575 | auxcount &= 0x0f; |
| 576 | 576 | av_dlog(s, "NSV CHUNK %d aux, %u bytes video, %d bytes audio\n", auxcount, vsize, asize); |
| 577 | 577 | /* skip aux stuff */ |
| 578 | 578 | 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); | |
| 581 | 581 | av_dlog(s, "NSV aux data: '%c%c%c%c', %d bytes\n", |
| 582 | 582 | (auxtag & 0x0ff), |
| 583 | 583 | ((auxtag >> 8) & 0x0ff), |
| @@ -623,9 +623,9 @@ null_chunk_retry: · 39 unmodified lines | ||
| 623 | 623 | uint8_t bps; |
| 624 | 624 | uint8_t channels; |
| 625 | 625 | 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); | |
| 629 | 629 | asize-=4; |
| 630 | 630 | av_dlog(s, "NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate); |
| 631 | 631 | if (fill_header) { |
| @@ -39,9 +39,9 @@ static int get_str(AVIOContext *bc, char *string, unsigned int maxlen){ · 38 unmodified lines | ||
| 39 | 39 | unsigned int len= ff_get_v(bc); |
| 40 | 40 | |
| 41 | 41 | if(len && maxlen) |
| 42 | − get_buffer(bc, string, FFMIN(len, maxlen)); | |
| 42 | + avio_read(bc, string, FFMIN(len, maxlen)); | |
| 43 | 43 | while(len > maxlen){ |
| 44 | − get_byte(bc); | |
| 44 | + avio_r8(bc); | |
| 45 | 45 | len--; |
| 46 | 46 | } |
| 47 | 47 | |
| @@ -64,8 +64,8 @@ static int64_t get_s(AVIOContext *bc){ · 16 unmodified lines | ||
| 64 | 64 | static uint64_t get_fourcc(AVIOContext *bc){ |
| 65 | 65 | unsigned int len= ff_get_v(bc); |
| 66 | 66 | |
| 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); | |
| 69 | 69 | else return -1; |
| 70 | 70 | } |
| 71 | 71 | |
| @@ -106,7 +106,7 @@ static int get_packetheader(NUTContext *nut, AVIOContext *bc, int calculate_chec · 34 unmodified lines | ||
| 106 | 106 | init_checksum(bc, ff_crc04C11DB7_update, startcode); |
| 107 | 107 | size= ff_get_v(bc); |
| 108 | 108 | if(size > 4096) |
| 109 | − get_be32(bc); | |
| 109 | + avio_rb32(bc); | |
| 110 | 110 | if(get_checksum(bc) && size > 4096) |
| 111 | 111 | return -1; |
| 112 | 112 | |
| @@ -122,7 +122,7 @@ static uint64_t find_any_startcode(AVIOContext *bc, int64_t pos){ · 9 unmodified lines | ||
| 122 | 122 | 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 |
| 123 | 123 | |
| 124 | 124 | while(!url_feof(bc)){ |
| 125 | − state= (state<<8) | get_byte(bc); | |
| 125 | + state= (state<<8) | avio_r8(bc); | |
| 126 | 126 | if((state>>56) != 'N') |
| 127 | 127 | continue; |
| 128 | 128 | switch(state){ |
| @@ -182,7 +182,7 @@ static int skip_reserved(AVIOContext *bc, int64_t pos){ · 53 unmodified lines | ||
| 182 | 182 | return -1; |
| 183 | 183 | }else{ |
| 184 | 184 | while(pos--) |
| 185 | − get_byte(bc); | |
| 185 | + avio_r8(bc); | |
| 186 | 186 | return 0; |
| 187 | 187 | } |
| 188 | 188 | } |
| @@ -279,7 +279,7 @@ static int decode_main_header(NUTContext *nut){ · 90 unmodified lines | ||
| 279 | 279 | return AVERROR_INVALIDDATA; |
| 280 | 280 | } |
| 281 | 281 | 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]); | |
| 283 | 283 | } |
| 284 | 284 | assert(nut->header_len[0]==0); |
| 285 | 285 | } |
| @@ -355,7 +355,7 @@ static int decode_stream_header(NUTContext *nut){ · 69 unmodified lines | ||
| 355 | 355 | GET_V(st->codec->extradata_size, tmp < (1<<30)); |
| 356 | 356 | if(st->codec->extradata_size){ |
| 357 | 357 | 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); | |
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO){ |
| @@ -514,8 +514,8 @@ static int find_and_decode_index(NUTContext *nut){ · 152 unmodified lines | ||
| 514 | 514 | int ret= -1; |
| 515 | 515 | |
| 516 | 516 | 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){ | |
| 519 | 519 | av_log(s, AV_LOG_ERROR, "no index at the end\n"); |
| 520 | 520 | return -1; |
| 521 | 521 | } |
| @@ -722,7 +722,7 @@ static int decode_frame_header(NUTContext *nut, int64_t *pts, int *stream_id, ui · 200 unmodified lines | ||
| 722 | 722 | size -= nut->header_len[*header_idx]; |
| 723 | 723 | |
| 724 | 724 | if(flags&FLAG_CHECKSUM){ |
| 725 | − get_be32(bc); //FIXME check this | |
| 725 | + avio_rb32(bc); //FIXME check this | |
| 726 | 726 | }else if(size > 2*nut->max_distance || FFABS(stc->last_pts - *pts) > stc->max_pts_distance){ |
| 727 | 727 | av_log(s, AV_LOG_ERROR, "frame size > 2max_distance and no checksum\n"); |
| 728 | 728 | return AVERROR_INVALIDDATA; |
| @@ -764,7 +764,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){ · 35 unmodified lines | ||
| 764 | 764 | av_new_packet(pkt, size + nut->header_len[header_idx]); |
| 765 | 765 | memcpy(pkt->data, nut->header[header_idx], nut->header_len[header_idx]); |
| 766 | 766 | 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); | |
| 768 | 768 | |
| 769 | 769 | pkt->stream_index = stream_id; |
| 770 | 770 | if (stc->last_flags & FLAG_KEY) |
| @@ -789,13 +789,13 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) · 18 unmodified lines | ||
| 789 | 789 | if(tmp){ |
| 790 | 790 | pos-=8; |
| 791 | 791 | }else{ |
| 792 | − frame_code = get_byte(bc); | |
| 792 | + frame_code = avio_r8(bc); | |
| 793 | 793 | if(url_feof(bc)) |
| 794 | 794 | return -1; |
| 795 | 795 | if(frame_code == 'N'){ |
| 796 | 796 | tmp= frame_code; |
| 797 | 797 | for(i=1; i<8; i++) |
| 798 | − tmp = (tmp<<8) + get_byte(bc); | |
| 798 | + tmp = (tmp<<8) + avio_r8(bc); | |
| 799 | 799 | } |
| 800 | 800 | } |
| 801 | 801 | switch(tmp){ |
| @@ -812,7 +812,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) · 10 unmodified lines | ||
| 812 | 812 | case SYNCPOINT_STARTCODE: |
| 813 | 813 | if(decode_syncpoint(nut, &ts, &back_ptr)<0) |
| 814 | 814 | goto resync; |
| 815 | − frame_code = get_byte(bc); | |
| 815 | + frame_code = avio_r8(bc); | |
| 816 | 816 | case 0: |
| 817 | 817 | ret= decode_frame(nut, pkt, frame_code); |
| 818 | 818 | if(ret==0) |
| @@ -62,16 +62,16 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, · 61 unmodified lines | ||
| 62 | 62 | return 1; // no codec data needed |
| 63 | 63 | while (!url_feof(pb)) { |
| 64 | 64 | int size, subtype; |
| 65 | − frametype = get_byte(pb); | |
| 65 | + frametype = avio_r8(pb); | |
| 66 | 66 | switch (frametype) { |
| 67 | 67 | case NUV_EXTRADATA: |
| 68 | − subtype = get_byte(pb); | |
| 68 | + subtype = avio_r8(pb); | |
| 69 | 69 | url_fskip(pb, 6); |
| 70 | − size = PKTSIZE(get_le32(pb)); | |
| 70 | + size = PKTSIZE(avio_rl32(pb)); | |
| 71 | 71 | if (vst && subtype == 'R') { |
| 72 | 72 | vst->codec->extradata_size = size; |
| 73 | 73 | vst->codec->extradata = av_malloc(size); |
| 74 | − get_buffer(pb, vst->codec->extradata, size); | |
| 74 | + avio_read(pb, vst->codec->extradata, size); | |
| 75 | 75 | size = 0; |
| 76 | 76 | if (!myth) |
| 77 | 77 | return 1; |
| @@ -79,12 +79,12 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, · 1 unmodified line | ||
| 79 | 79 | break; |
| 80 | 80 | case NUV_MYTHEXT: |
| 81 | 81 | url_fskip(pb, 7); |
| 82 | − size = PKTSIZE(get_le32(pb)); | |
| 82 | + size = PKTSIZE(avio_rl32(pb)); | |
| 83 | 83 | if (size != 128 * 4) |
| 84 | 84 | break; |
| 85 | − get_le32(pb); // version | |
| 85 | + avio_rl32(pb); // version | |
| 86 | 86 | if (vst) { |
| 87 | − vst->codec->codec_tag = get_le32(pb); | |
| 87 | + vst->codec->codec_tag = avio_rl32(pb); | |
| 88 | 88 | vst->codec->codec_id = |
| 89 | 89 | ff_codec_get_id(ff_codec_bmp_tags, vst->codec->codec_tag); |
| 90 | 90 | 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 | ||
| 93 | 93 | url_fskip(pb, 4); |
| 94 | 94 | |
| 95 | 95 | 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); | |
| 100 | 100 | ast->codec->codec_id = |
| 101 | 101 | ff_wav_codec_get_id(ast->codec->codec_tag, |
| 102 | 102 | ast->codec->bits_per_coded_sample); |
| @@ -112,7 +112,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, · 9 unmodified lines | ||
| 112 | 112 | break; |
| 113 | 113 | default: |
| 114 | 114 | url_fskip(pb, 7); |
| 115 | − size = PKTSIZE(get_le32(pb)); | |
| 115 | + size = PKTSIZE(avio_rl32(pb)); | |
| 116 | 116 | break; |
| 117 | 117 | } |
| 118 | 118 | url_fskip(pb, size); |
| @@ -128,27 +128,27 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { · 9 unmodified lines | ||
| 128 | 128 | int is_mythtv, width, height, v_packs, a_packs; |
| 129 | 129 | int stream_nr = 0; |
| 130 | 130 | AVStream *vst = NULL, *ast = NULL; |
| 131 | − get_buffer(pb, id_string, 12); | |
| 131 | + avio_read(pb, id_string, 12); | |
| 132 | 132 | is_mythtv = !memcmp(id_string, "MythTVVideo", 12); |
| 133 | 133 | url_fskip(pb, 5); // version string |
| 134 | 134 | 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 | |
| 140 | 140 | url_fskip(pb, 3); // padding |
| 141 | − aspect = av_int2dbl(get_le64(pb)); | |
| 141 | + aspect = av_int2dbl(avio_rl64(pb)); | |
| 142 | 142 | if (aspect > 0.9999 && aspect < 1.0001) |
| 143 | 143 | aspect = 4.0 / 3.0; |
| 144 | − fps = av_int2dbl(get_le64(pb)); | |
| 144 | + fps = av_int2dbl(avio_rl64(pb)); | |
| 145 | 145 | |
| 146 | 146 | // 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 | |
| 150 | 150 | |
| 151 | − get_le32(pb); // keyframe distance (?) | |
| 151 | + avio_rl32(pb); // keyframe distance (?) | |
| 152 | 152 | |
| 153 | 153 | if (v_packs) { |
| 154 | 154 | ctx->v_id = stream_nr++; |
| @@ -198,7 +198,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { · 43 unmodified lines | ||
| 198 | 198 | while (!url_feof(pb)) { |
| 199 | 199 | int copyhdrsize = ctx->rtjpg_video ? HDRSIZE : 0; |
| 200 | 200 | uint64_t pos = url_ftell(pb); |
| 201 | − ret = get_buffer(pb, hdr, HDRSIZE); | |
| 201 | + ret = avio_read(pb, hdr, HDRSIZE); | |
| 202 | 202 | if (ret < HDRSIZE) |
| 203 | 203 | return ret < 0 ? ret : AVERROR(EIO); |
| 204 | 204 | frametype = hdr[0]; |
| @@ -225,7 +225,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { · 20 unmodified lines | ||
| 225 | 225 | pkt->pts = AV_RL32(&hdr[4]); |
| 226 | 226 | pkt->stream_index = ctx->v_id; |
| 227 | 227 | memcpy(pkt->data, hdr, copyhdrsize); |
| 228 | − ret = get_buffer(pb, pkt->data + copyhdrsize, size); | |
| 228 | + ret = avio_read(pb, pkt->data + copyhdrsize, size); | |
| 229 | 229 | if (ret < 0) { |
| 230 | 230 | av_free_packet(pkt); |
| 231 | 231 | return ret; |
| @@ -207,7 +207,7 @@ ogg_read_page (AVFormatContext * s, int *str) · 206 unmodified lines | ||
| 207 | 207 | uint8_t sync[4]; |
| 208 | 208 | int sp = 0; |
| 209 | 209 | |
| 210 | − if (get_buffer (bc, sync, 4) < 4) | |
| 210 | + if (avio_read (bc, sync, 4) < 4) | |
| 211 | 211 | return -1; |
| 212 | 212 | |
| 213 | 213 | do{ |
| @@ -233,10 +233,10 @@ ogg_read_page (AVFormatContext * s, int *str) · 19 unmodified lines | ||
| 233 | 233 | return -1; |
| 234 | 234 | |
| 235 | 235 | 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); | |
| 240 | 240 | nsegs = url_fgetc (bc); |
| 241 | 241 | |
| 242 | 242 | idx = ogg_find_stream (ogg, serial); |
| @@ -252,7 +252,7 @@ ogg_read_page (AVFormatContext * s, int *str) · 9 unmodified lines | ||
| 252 | 252 | if(os->psize > 0) |
| 253 | 253 | ogg_new_buf(ogg, idx); |
| 254 | 254 | |
| 255 | − if (get_buffer (bc, os->segments, nsegs) < nsegs) | |
| 255 | + if (avio_read (bc, os->segments, nsegs) < nsegs) | |
| 256 | 256 | return -1; |
| 257 | 257 | |
| 258 | 258 | os->nsegs = nsegs; |
| @@ -284,7 +284,7 @@ ogg_read_page (AVFormatContext * s, int *str) · 25 unmodified lines | ||
| 284 | 284 | os->buf = nb; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | − if (get_buffer (bc, os->buf + os->bufpos, size) < size) | |
| 287 | + if (avio_read (bc, os->buf + os->bufpos, size) < size) | |
| 288 | 288 | return -1; |
| 289 | 289 | |
| 290 | 290 | os->bufpos += size; |
| @@ -79,7 +79,7 @@ static int oma_read_header(AVFormatContext *s, · 78 unmodified lines | ||
| 79 | 79 | AVStream *st; |
| 80 | 80 | |
| 81 | 81 | 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); | |
| 83 | 83 | |
| 84 | 84 | if (memcmp(buf, ((const uint8_t[]){'E', 'A', '3'}),3) || buf[4] != 0 || buf[5] != EA3_HEADER_SIZE) { |
| 85 | 85 | av_log(s, AV_LOG_ERROR, "Couldn't find the EA3 header !\n"); |
| @@ -105,7 +105,7 @@ static int str_read_header(AVFormatContext *s, · 104 unmodified lines | ||
| 105 | 105 | int i; |
| 106 | 106 | |
| 107 | 107 | /* 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) | |
| 109 | 109 | return AVERROR(EIO); |
| 110 | 110 | if (AV_RL32(§or[0]) == RIFF_TAG) |
| 111 | 111 | start = RIFF_HEADER_SIZE; |
| @@ -136,7 +136,7 @@ static int str_read_packet(AVFormatContext *s, · 24 unmodified lines | ||
| 136 | 136 | |
| 137 | 137 | while (1) { |
| 138 | 138 | |
| 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) | |
| 140 | 140 | return AVERROR(EIO); |
| 141 | 141 | |
| 142 | 142 | channel = sector[0x11]; |
| @@ -75,12 +75,12 @@ static int read_part_of_packet(AVFormatContext *s, int64_t *pts, · 74 unmodified lines | ||
| 75 | 75 | recover: |
| 76 | 76 | startpos = url_ftell(pb); |
| 77 | 77 | |
| 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); | |
| 84 | 84 | |
| 85 | 85 | pts_flag = flags & 0x10; |
| 86 | 86 | |
| @@ -101,7 +101,7 @@ recover: · 14 unmodified lines | ||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | if (streamid == PVA_VIDEO_PAYLOAD && pts_flag) { |
| 104 | − pva_pts = get_be32(pb); | |
| 104 | + pva_pts = avio_rb32(pb); | |
| 105 | 105 | length -= 4; |
| 106 | 106 | } else if (streamid == PVA_AUDIO_PAYLOAD) { |
| 107 | 107 | /* PVA Audio Packets either start with a signaled PES packet or |
| @@ -113,11 +113,11 @@ recover: · 5 unmodified lines | ||
| 113 | 113 | pes_flags; |
| 114 | 114 | unsigned char pes_header_data[256]; |
| 115 | 115 | |
| 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); | |
| 121 | 121 | |
| 122 | 122 | if (pes_signal != 1) { |
| 123 | 123 | pva_log(s, AV_LOG_WARNING, "expected signaled PES packet, " |
| @@ -128,7 +128,7 @@ recover: · 4 unmodified lines | ||
| 128 | 128 | goto recover; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | − get_buffer(pb, pes_header_data, pes_header_data_length); | |
| 131 | + avio_read(pb, pes_header_data, pes_header_data_length); | |
| 132 | 132 | length -= 9 + pes_header_data_length; |
| 133 | 133 | |
| 134 | 134 | pes_packet_length -= 3 + pes_header_data_length; |
| @@ -91,13 +91,13 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) · 90 unmodified lines | ||
| 91 | 91 | if (!st) |
| 92 | 92 | return AVERROR(ENOMEM); |
| 93 | 93 | |
| 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; | |
| 96 | 96 | url_fskip(pb, 8 + 4 + 1 + 1); // "QLCMfmt " + chunk-size + major-version + minor-version |
| 97 | 97 | |
| 98 | 98 | st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| 99 | 99 | st->codec->channels = 1; |
| 100 | − get_buffer(pb, buf, 16); | |
| 100 | + avio_read(pb, buf, 16); | |
| 101 | 101 | if (is_qcelp_13k_guid(buf)) { |
| 102 | 102 | st->codec->codec_id = CODEC_ID_QCELP; |
| 103 | 103 | } else if (!memcmp(buf, guid_evrc, 16)) { |
| @@ -111,19 +111,19 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) · 7 unmodified lines | ||
| 111 | 111 | return AVERROR_INVALIDDATA; |
| 112 | 112 | } |
| 113 | 113 | 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); | |
| 115 | 115 | |
| 116 | − s->packet_size = get_le16(pb); | |
| 116 | + s->packet_size = avio_rl16(pb); | |
| 117 | 117 | url_fskip(pb, 2); // block-size |
| 118 | − st->codec->sample_rate = get_le16(pb); | |
| 118 | + st->codec->sample_rate = avio_rl16(pb); | |
| 119 | 119 | url_fskip(pb, 2); // sample-size |
| 120 | 120 | |
| 121 | 121 | memset(c->rates_per_mode, -1, sizeof(c->rates_per_mode)); |
| 122 | − nb_rates = get_le32(pb); | |
| 122 | + nb_rates = avio_rl32(pb); | |
| 123 | 123 | nb_rates = FFMIN(nb_rates, 8); |
| 124 | 124 | 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); | |
| 127 | 127 | if (mode > QCP_MAX_MODE) { |
| 128 | 128 | av_log(s, AV_LOG_WARNING, "Unknown entry %d=>%d in rate-map-table.\n ", mode, size); |
| 129 | 129 | } else |
| @@ -142,7 +142,7 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) · 12 unmodified lines | ||
| 142 | 142 | |
| 143 | 143 | while(!url_feof(pb)) { |
| 144 | 144 | if (c->data_size) { |
| 145 | − int pkt_size, ret, mode = get_byte(pb); | |
| 145 | + int pkt_size, ret, mode = avio_r8(pb); | |
| 146 | 146 | |
| 147 | 147 | if (s->packet_size) { |
| 148 | 148 | pkt_size = s->packet_size - 1; |
| @@ -165,14 +165,14 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) · 16 unmodified lines | ||
| 165 | 165 | return ret; |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | − if (url_ftell(pb) & 1 && get_byte(pb)) | |
| 168 | + if (url_ftell(pb) & 1 && avio_r8(pb)) | |
| 169 | 169 | av_log(s, AV_LOG_WARNING, "Padding should be 0.\n"); |
| 170 | 170 | |
| 171 | − tag = get_le32(pb); | |
| 172 | − chunk_size = get_le32(pb); | |
| 171 | + tag = avio_rl32(pb); | |
| 172 | + chunk_size = avio_rl32(pb); | |
| 173 | 173 | switch (tag) { |
| 174 | 174 | case MKTAG('v', 'r', 'a', 't'): |
| 175 | − if (get_le32(pb)) // var-rate-flag | |
| 175 | + if (avio_rl32(pb)) // var-rate-flag | |
| 176 | 176 | s->packet_size = 0; |
| 177 | 177 | url_fskip(pb, 4); // size-in-packets |
| 178 | 178 | break; |
| @@ -39,10 +39,10 @@ typedef struct { · 38 unmodified lines | ||
| 39 | 39 | static int read_atom(AVFormatContext *s, Atom *atom) |
| 40 | 40 | { |
| 41 | 41 | atom->offset = url_ftell(s->pb); |
| 42 | − atom->size = get_be32(s->pb); | |
| 42 | + atom->size = avio_rb32(s->pb); | |
| 43 | 43 | if (atom->size < 8) |
| 44 | 44 | return -1; |
| 45 | − atom->tag = get_le32(s->pb); | |
| 45 | + atom->tag = avio_rl32(s->pb); | |
| 46 | 46 | av_dlog(s, "atom %d %.4s offset %#llx\n", |
| 47 | 47 | atom->size, (char*)&atom->tag, atom->offset); |
| 48 | 48 | return atom->size; |
| @@ -59,31 +59,31 @@ static int r3d_read_red1(AVFormatContext *s) · 10 unmodified lines | ||
| 59 | 59 | st->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| 60 | 60 | st->codec->codec_id = CODEC_ID_JPEG2000; |
| 61 | 61 | |
| 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 | |
| 64 | 64 | av_dlog(s, "version %d.%d\n", tmp, tmp2); |
| 65 | 65 | |
| 66 | − tmp = get_be16(s->pb); // unknown | |
| 66 | + tmp = avio_rb16(s->pb); // unknown | |
| 67 | 67 | av_dlog(s, "unknown1 %d\n", tmp); |
| 68 | 68 | |
| 69 | − tmp = get_be32(s->pb); | |
| 69 | + tmp = avio_rb32(s->pb); | |
| 70 | 70 | av_set_pts_info(st, 32, 1, tmp); |
| 71 | 71 | |
| 72 | − tmp = get_be32(s->pb); // filenum | |
| 72 | + tmp = avio_rb32(s->pb); // filenum | |
| 73 | 73 | av_dlog(s, "filenum %d\n", tmp); |
| 74 | 74 | |
| 75 | 75 | url_fskip(s->pb, 32); // unknown |
| 76 | 76 | |
| 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); | |
| 79 | 79 | |
| 80 | − tmp = get_be16(s->pb); // unknown | |
| 80 | + tmp = avio_rb16(s->pb); // unknown | |
| 81 | 81 | av_dlog(s, "unknown2 %d\n", tmp); |
| 82 | 82 | |
| 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); | |
| 85 | 85 | |
| 86 | − tmp = get_byte(s->pb); // audio channels | |
| 86 | + tmp = avio_r8(s->pb); // audio channels | |
| 87 | 87 | av_dlog(s, "audio channels %d\n", tmp); |
| 88 | 88 | if (tmp > 0) { |
| 89 | 89 | AVStream *ast = av_new_stream(s, 1); |
| @@ -95,7 +95,7 @@ static int r3d_read_red1(AVFormatContext *s) · 5 unmodified lines | ||
| 95 | 95 | av_set_pts_info(ast, 32, 1, st->time_base.den); |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | − get_buffer(s->pb, filename, 257); | |
| 98 | + avio_read(s->pb, filename, 257); | |
| 99 | 99 | filename[sizeof(filename)-1] = 0; |
| 100 | 100 | av_metadata_set2(&st->metadata, "filename", filename, 0); |
| 101 | 101 | |
| @@ -120,7 +120,7 @@ static int r3d_read_rdvo(AVFormatContext *s, Atom *atom) · 18 unmodified lines | ||
| 120 | 120 | return AVERROR(ENOMEM); |
| 121 | 121 | |
| 122 | 122 | 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); | |
| 124 | 124 | if (!r3d->video_offsets[i]) { |
| 125 | 125 | r3d->video_offsets_count = i; |
| 126 | 126 | break; |
| @@ -141,15 +141,15 @@ static void r3d_read_reos(AVFormatContext *s) · 14 unmodified lines | ||
| 141 | 141 | R3DContext *r3d = s->priv_data; |
| 142 | 142 | int tmp; |
| 143 | 143 | |
| 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 | |
| 148 | 148 | |
| 149 | − tmp = get_be32(s->pb); | |
| 149 | + tmp = avio_rb32(s->pb); | |
| 150 | 150 | av_dlog(s, "num video chunks %d\n", tmp); |
| 151 | 151 | |
| 152 | − tmp = get_be32(s->pb); | |
| 152 | + tmp = avio_rb32(s->pb); | |
| 153 | 153 | av_dlog(s, "num audio chunks %d\n", tmp); |
| 154 | 154 | |
| 155 | 155 | url_fskip(s->pb, 6*4); |
| @@ -214,31 +214,31 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom) · 58 unmodified lines | ||
| 214 | 214 | unsigned dts; |
| 215 | 215 | int ret; |
| 216 | 216 | |
| 217 | − dts = get_be32(s->pb); | |
| 217 | + dts = avio_rb32(s->pb); | |
| 218 | 218 | |
| 219 | − tmp = get_be32(s->pb); | |
| 219 | + tmp = avio_rb32(s->pb); | |
| 220 | 220 | av_dlog(s, "frame num %d\n", tmp); |
| 221 | 221 | |
| 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 | |
| 224 | 224 | av_dlog(s, "version %d.%d\n", tmp, tmp2); |
| 225 | 225 | |
| 226 | − tmp = get_be16(s->pb); // unknown | |
| 226 | + tmp = avio_rb16(s->pb); // unknown | |
| 227 | 227 | av_dlog(s, "unknown %d\n", tmp); |
| 228 | 228 | |
| 229 | 229 | if (tmp > 4) { |
| 230 | − tmp = get_be16(s->pb); // unknown | |
| 230 | + tmp = avio_rb16(s->pb); // unknown | |
| 231 | 231 | av_dlog(s, "unknown %d\n", tmp); |
| 232 | 232 | |
| 233 | − tmp = get_be16(s->pb); // unknown | |
| 233 | + tmp = avio_rb16(s->pb); // unknown | |
| 234 | 234 | av_dlog(s, "unknown %d\n", tmp); |
| 235 | 235 | |
| 236 | − tmp = get_be32(s->pb); | |
| 236 | + tmp = avio_rb32(s->pb); | |
| 237 | 237 | av_dlog(s, "width %d\n", tmp); |
| 238 | − tmp = get_be32(s->pb); | |
| 238 | + tmp = avio_rb32(s->pb); | |
| 239 | 239 | av_dlog(s, "height %d\n", tmp); |
| 240 | 240 | |
| 241 | − tmp = get_be32(s->pb); | |
| 241 | + tmp = avio_rb32(s->pb); | |
| 242 | 242 | av_dlog(s, "metadata len %d\n", tmp); |
| 243 | 243 | } |
| 244 | 244 | 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 | ||
| 268 | 268 | unsigned dts; |
| 269 | 269 | int ret; |
| 270 | 270 | |
| 271 | − dts = get_be32(s->pb); | |
| 271 | + dts = avio_rb32(s->pb); | |
| 272 | 272 | |
| 273 | − st->codec->sample_rate = get_be32(s->pb); | |
| 273 | + st->codec->sample_rate = avio_rb32(s->pb); | |
| 274 | 274 | |
| 275 | − samples = get_be32(s->pb); | |
| 275 | + samples = avio_rb32(s->pb); | |
| 276 | 276 | |
| 277 | − tmp = get_be32(s->pb); | |
| 277 | + tmp = avio_rb32(s->pb); | |
| 278 | 278 | av_dlog(s, "packet num %d\n", tmp); |
| 279 | 279 | |
| 280 | − tmp = get_be16(s->pb); // unkown | |
| 280 | + tmp = avio_rb16(s->pb); // unkown | |
| 281 | 281 | av_dlog(s, "unknown %d\n", tmp); |
| 282 | 282 | |
| 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 | |
| 285 | 285 | av_dlog(s, "version %d.%d\n", tmp, tmp2); |
| 286 | 286 | |
| 287 | − tmp = get_be32(s->pb); // unknown | |
| 287 | + tmp = avio_rb32(s->pb); // unknown | |
| 288 | 288 | av_dlog(s, "unknown %d\n", tmp); |
| 289 | 289 | |
| 290 | 290 | size = atom->size - 8 - (url_ftell(s->pb) - pos); |
| @@ -153,25 +153,25 @@ rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr) · 152 unmodified lines | ||
| 153 | 153 | return -1; |
| 154 | 154 | ffio_init_context(&pb, rdt->mlti_data, rdt->mlti_data_size, 0, |
| 155 | 155 | NULL, NULL, NULL, NULL); |
| 156 | − tag = get_le32(&pb); | |
| 156 | + tag = avio_rl32(&pb); | |
| 157 | 157 | if (tag == MKTAG('M', 'L', 'T', 'I')) { |
| 158 | 158 | int num, chunk_nr; |
| 159 | 159 | |
| 160 | 160 | /* read index of MDPR chunk numbers */ |
| 161 | − num = get_be16(&pb); | |
| 161 | + num = avio_rb16(&pb); | |
| 162 | 162 | if (rule_nr < 0 || rule_nr >= num) |
| 163 | 163 | return -1; |
| 164 | 164 | url_fskip(&pb, rule_nr * 2); |
| 165 | − chunk_nr = get_be16(&pb); | |
| 165 | + chunk_nr = avio_rb16(&pb); | |
| 166 | 166 | url_fskip(&pb, (num - 1 - rule_nr) * 2); |
| 167 | 167 | |
| 168 | 168 | /* read MDPR chunks */ |
| 169 | − num = get_be16(&pb); | |
| 169 | + num = avio_rb16(&pb); | |
| 170 | 170 | if (chunk_nr >= num) |
| 171 | 171 | return -1; |
| 172 | 172 | 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); | |
| 175 | 175 | } else { |
| 176 | 176 | size = rdt->mlti_data_size; |
| 177 | 177 | url_fseek(&pb, 0, SEEK_SET); |
| @@ -481,25 +481,25 @@ void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) · 480 unmodified lines | ||
| 481 | 481 | { |
| 482 | 482 | int id; |
| 483 | 483 | |
| 484 | − id = get_le16(pb); | |
| 484 | + id = avio_rl16(pb); | |
| 485 | 485 | codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| 486 | 486 | 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); | |
| 491 | 491 | if (size == 14) { /* We're dealing with plain vanilla WAVEFORMAT */ |
| 492 | 492 | codec->bits_per_coded_sample = 8; |
| 493 | 493 | }else |
| 494 | − codec->bits_per_coded_sample = get_le16(pb); | |
| 494 | + codec->bits_per_coded_sample = avio_rl16(pb); | |
| 495 | 495 | if (size >= 18) { /* We're obviously dealing with WAVEFORMATEX */ |
| 496 | − int cbSize = get_le16(pb); /* cbSize */ | |
| 496 | + int cbSize = avio_rl16(pb); /* cbSize */ | |
| 497 | 497 | size -= 18; |
| 498 | 498 | cbSize = FFMIN(size, cbSize); |
| 499 | 499 | 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 */ | |
| 503 | 503 | url_fskip(pb, 12); /* skip end of GUID */ |
| 504 | 504 | cbSize -= 22; |
| 505 | 505 | size -= 22; |
| @@ -507,7 +507,7 @@ void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) · 1 unmodified line | ||
| 507 | 507 | codec->extradata_size = cbSize; |
| 508 | 508 | if (cbSize > 0) { |
| 509 | 509 | 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); | |
| 511 | 511 | size -= cbSize; |
| 512 | 512 | } |
| 513 | 513 | |
| @@ -547,17 +547,17 @@ enum CodecID ff_wav_codec_get_id(unsigned int tag, int bps) · 33 unmodified lines | ||
| 547 | 547 | int ff_get_bmp_header(AVIOContext *pb, AVStream *st) |
| 548 | 548 | { |
| 549 | 549 | 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 */ | |
| 561 | 561 | return tag1; |
| 562 | 562 | } |
| 563 | 563 | #endif // CONFIG_DEMUXERS |
| @@ -96,20 +96,20 @@ static av_cold int rl2_read_header(AVFormatContext *s, · 95 unmodified lines | ||
| 96 | 96 | int ret = 0; |
| 97 | 97 | |
| 98 | 98 | 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); | |
| 103 | 103 | |
| 104 | 104 | /* disallow back_sizes and frame_counts that may lead to overflows later */ |
| 105 | 105 | if(back_size > INT_MAX/2 || frame_count > INT_MAX / sizeof(uint32_t)) |
| 106 | 106 | return AVERROR_INVALIDDATA; |
| 107 | 107 | |
| 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); | |
| 113 | 113 | |
| 114 | 114 | /** setup video stream */ |
| 115 | 115 | st = av_new_stream(s, 0); |
| @@ -133,7 +133,7 @@ static av_cold int rl2_read_header(AVFormatContext *s, · 17 unmodified lines | ||
| 133 | 133 | if(!st->codec->extradata) |
| 134 | 134 | return AVERROR(ENOMEM); |
| 135 | 135 | |
| 136 | − if(get_buffer(pb,st->codec->extradata,st->codec->extradata_size) != | |
| 136 | + if(avio_read(pb,st->codec->extradata,st->codec->extradata_size) != | |
| 137 | 137 | st->codec->extradata_size) |
| 138 | 138 | return AVERROR(EIO); |
| 139 | 139 | |
| @@ -173,11 +173,11 @@ static av_cold int rl2_read_header(AVFormatContext *s, · 33 unmodified lines | ||
| 173 | 173 | |
| 174 | 174 | /** read offset and size tables */ |
| 175 | 175 | for(i=0; i < frame_count;i++) |
| 176 | − chunk_size[i] = get_le32(pb); | |
| 176 | + chunk_size[i] = avio_rl32(pb); | |
| 177 | 177 | for(i=0; i < frame_count;i++) |
| 178 | − chunk_offset[i] = get_le32(pb); | |
| 178 | + chunk_offset[i] = avio_rl32(pb); | |
| 179 | 179 | for(i=0; i < frame_count;i++) |
| 180 | − audio_size[i] = get_le32(pb) & 0xFFFF; | |
| 180 | + audio_size[i] = avio_rl32(pb) & 0xFFFF; | |
| 181 | 181 | |
| 182 | 182 | /** build the sample index */ |
| 183 | 183 | for(i=0;i<frame_count;i++){ |
| @@ -71,7 +71,7 @@ static inline void get_strl(AVIOContext *pb, char *buf, int buf_size, int len) · 70 unmodified lines | ||
| 71 | 71 | |
| 72 | 72 | q = buf; |
| 73 | 73 | for(i=0;i<len;i++) { |
| 74 | − r = get_byte(pb); | |
| 74 | + r = avio_r8(pb); | |
| 75 | 75 | if (i < buf_size - 1) |
| 76 | 76 | *q++ = r; |
| 77 | 77 | } |
| @@ -80,7 +80,7 @@ static inline void get_strl(AVIOContext *pb, char *buf, int buf_size, int len) · 2 unmodified lines | ||
| 80 | 80 | |
| 81 | 81 | static void get_str8(AVIOContext *pb, char *buf, int buf_size) |
| 82 | 82 | { |
| 83 | − get_strl(pb, buf, buf_size, get_byte(pb)); | |
| 83 | + get_strl(pb, buf, buf_size, avio_r8(pb)); | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | 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 | ||
| 90 | 90 | avctx->extradata = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); |
| 91 | 91 | if (!avctx->extradata) |
| 92 | 92 | return AVERROR(ENOMEM); |
| 93 | − avctx->extradata_size = get_buffer(pb, avctx->extradata, size); | |
| 93 | + avctx->extradata_size = avio_read(pb, avctx->extradata, size); | |
| 94 | 94 | memset(avctx->extradata + avctx->extradata_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); |
| 95 | 95 | if (avctx->extradata_size != size) |
| 96 | 96 | return AVERROR(EIO); |
| @@ -102,7 +102,7 @@ static void rm_read_metadata(AVFormatContext *s, int wide) · 5 unmodified lines | ||
| 102 | 102 | char buf[1024]; |
| 103 | 103 | int i; |
| 104 | 104 | 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); | |
| 106 | 106 | get_strl(s->pb, buf, sizeof(buf), len); |
| 107 | 107 | av_metadata_set2(&s->metadata, ff_rm_metadata[i], buf, 0); |
| 108 | 108 | } |
| @@ -128,15 +128,15 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, · 19 unmodified lines | ||
| 128 | 128 | int ret; |
| 129 | 129 | |
| 130 | 130 | /* ra type header */ |
| 131 | − version = get_be16(pb); /* version */ | |
| 131 | + version = avio_rb16(pb); /* version */ | |
| 132 | 132 | if (version == 3) { |
| 133 | − int header_size = get_be16(pb); | |
| 133 | + int header_size = avio_rb16(pb); | |
| 134 | 134 | int64_t startpos = url_ftell(pb); |
| 135 | 135 | url_fskip(pb, 14); |
| 136 | 136 | rm_read_metadata(s, 0); |
| 137 | 137 | if ((startpos + header_size) >= url_ftell(pb) + 2) { |
| 138 | 138 | // fourcc (should always be "lpcJ") |
| 139 | − get_byte(pb); | |
| 139 | + avio_r8(pb); | |
| 140 | 140 | get_str8(pb, buf, sizeof(buf)); |
| 141 | 141 | } |
| 142 | 142 | // 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 | ||
| 151 | 151 | int codecdata_length; |
| 152 | 152 | /* old version (4) */ |
| 153 | 153 | 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); /* ??? */ | |
| 167 | 167 | if (version == 5) { |
| 168 | − get_be16(pb); get_be16(pb); get_be16(pb); | |
| 168 | + avio_rb16(pb); avio_rb16(pb); avio_rb16(pb); | |
| 169 | 169 | } |
| 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); | |
| 173 | 173 | if (version == 5) { |
| 174 | − get_be32(pb); | |
| 175 | − get_buffer(pb, buf, 4); | |
| 174 | + avio_rb32(pb); | |
| 175 | + avio_read(pb, buf, 4); | |
| 176 | 176 | buf[4] = 0; |
| 177 | 177 | } else { |
| 178 | 178 | 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 | ||
| 201 | 201 | case CODEC_ID_COOK: |
| 202 | 202 | case CODEC_ID_ATRAC3: |
| 203 | 203 | case CODEC_ID_SIPR: |
| 204 | − get_be16(pb); get_byte(pb); | |
| 204 | + avio_rb16(pb); avio_r8(pb); | |
| 205 | 205 | if (version == 5) |
| 206 | − get_byte(pb); | |
| 207 | − codecdata_length = get_be32(pb); | |
| 206 | + avio_r8(pb); | |
| 207 | + codecdata_length = avio_rb32(pb); | |
| 208 | 208 | if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){ |
| 209 | 209 | av_log(s, AV_LOG_ERROR, "codecdata_length too large\n"); |
| 210 | 210 | return -1; |
| @@ -236,16 +236,16 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, · 25 unmodified lines | ||
| 236 | 236 | av_new_packet(&ast->pkt, ast->audio_framesize * sub_packet_h); |
| 237 | 237 | break; |
| 238 | 238 | case CODEC_ID_AAC: |
| 239 | − get_be16(pb); get_byte(pb); | |
| 239 | + avio_rb16(pb); avio_r8(pb); | |
| 240 | 240 | if (version == 5) |
| 241 | − get_byte(pb); | |
| 242 | − codecdata_length = get_be32(pb); | |
| 241 | + avio_r8(pb); | |
| 242 | + codecdata_length = avio_rb32(pb); | |
| 243 | 243 | if(codecdata_length + FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)codecdata_length){ |
| 244 | 244 | av_log(s, AV_LOG_ERROR, "codecdata_length too large\n"); |
| 245 | 245 | return -1; |
| 246 | 246 | } |
| 247 | 247 | if (codecdata_length >= 1) { |
| 248 | − get_byte(pb); | |
| 248 | + avio_r8(pb); | |
| 249 | 249 | if ((ret = rm_read_extradata(pb, st->codec, codecdata_length - 1)) < 0) |
| 250 | 250 | return ret; |
| 251 | 251 | } |
| @@ -254,9 +254,9 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, · 2 unmodified lines | ||
| 254 | 254 | av_strlcpy(st->codec->codec_name, buf, sizeof(st->codec->codec_name)); |
| 255 | 255 | } |
| 256 | 256 | 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); | |
| 260 | 260 | rm_read_metadata(s, 0); |
| 261 | 261 | } |
| 262 | 262 | } |
| @@ -274,32 +274,32 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, · 11 unmodified lines | ||
| 274 | 274 | |
| 275 | 275 | av_set_pts_info(st, 64, 1, 1000); |
| 276 | 276 | codec_pos = url_ftell(pb); |
| 277 | − v = get_be32(pb); | |
| 277 | + v = avio_rb32(pb); | |
| 278 | 278 | if (v == MKTAG(0xfd, 'a', 'r', '.')) { |
| 279 | 279 | /* ra type header */ |
| 280 | 280 | if (rm_read_audio_stream_info(s, pb, st, rst, 0)) |
| 281 | 281 | return -1; |
| 282 | 282 | } else { |
| 283 | 283 | int fps, fps2; |
| 284 | − if (get_le32(pb) != MKTAG('V', 'I', 'D', 'O')) { | |
| 284 | + if (avio_rl32(pb) != MKTAG('V', 'I', 'D', 'O')) { | |
| 285 | 285 | fail1: |
| 286 | 286 | av_log(st->codec, AV_LOG_ERROR, "Unsupported video codec\n"); |
| 287 | 287 | goto skip; |
| 288 | 288 | } |
| 289 | − st->codec->codec_tag = get_le32(pb); | |
| 289 | + st->codec->codec_tag = avio_rl32(pb); | |
| 290 | 290 | st->codec->codec_id = ff_codec_get_id(ff_rm_codec_tags, |
| 291 | 291 | st->codec->codec_tag); |
| 292 | 292 | // av_log(s, AV_LOG_DEBUG, "%X %X\n", st->codec->codec_tag, MKTAG('R', 'V', '2', '0')); |
| 293 | 293 | if (st->codec->codec_id == CODEC_ID_NONE) |
| 294 | 294 | 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); | |
| 297 | 297 | st->codec->time_base.num= 1; |
| 298 | − fps= get_be16(pb); | |
| 298 | + fps= avio_rb16(pb); | |
| 299 | 299 | 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); | |
| 303 | 303 | |
| 304 | 304 | if ((ret = rm_read_extradata(pb, st->codec, codec_data_size - (url_ftell(pb) - codec_pos))) < 0) |
| 305 | 305 | return ret; |
| @@ -335,15 +335,15 @@ static int rm_read_index(AVFormatContext *s) · 29 unmodified lines | ||
| 335 | 335 | AVStream *st; |
| 336 | 336 | |
| 337 | 337 | do { |
| 338 | − if (get_le32(pb) != MKTAG('I','N','D','X')) | |
| 338 | + if (avio_rl32(pb) != MKTAG('I','N','D','X')) | |
| 339 | 339 | return -1; |
| 340 | − size = get_be32(pb); | |
| 340 | + size = avio_rb32(pb); | |
| 341 | 341 | if (size < 20) |
| 342 | 342 | return -1; |
| 343 | 343 | 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); | |
| 347 | 347 | for (n = 0; n < s->nb_streams; n++) |
| 348 | 348 | if (s->streams[n]->id == str_id) { |
| 349 | 349 | st = s->streams[n]; |
| @@ -354,8 +354,8 @@ static int rm_read_index(AVFormatContext *s) · 4 unmodified lines | ||
| 354 | 354 | |
| 355 | 355 | for (n = 0; n < n_pkts; n++) { |
| 356 | 356 | url_fskip(pb, 2); |
| 357 | − pts = get_be32(pb); | |
| 358 | − pos = get_be32(pb); | |
| 357 | + pts = avio_rb32(pb); | |
| 358 | + pos = avio_rb32(pb); | |
| 359 | 359 | url_fskip(pb, 4); /* packet no. */ |
| 360 | 360 | |
| 361 | 361 | 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 | ||
| 395 | 395 | char buf[128]; |
| 396 | 396 | int flags = 0; |
| 397 | 397 | |
| 398 | − tag = get_le32(pb); | |
| 398 | + tag = avio_rl32(pb); | |
| 399 | 399 | if (tag == MKTAG('.', 'r', 'a', 0xfd)) { |
| 400 | 400 | /* very old .ra format */ |
| 401 | 401 | return rm_read_header_old(s, ap); |
| @@ -403,17 +403,17 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1 unmodified line | ||
| 403 | 403 | return AVERROR(EIO); |
| 404 | 404 | } |
| 405 | 405 | |
| 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 */ | |
| 410 | 410 | |
| 411 | 411 | for(;;) { |
| 412 | 412 | if (url_feof(pb)) |
| 413 | 413 | 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); | |
| 417 | 417 | #if 0 |
| 418 | 418 | printf("tag=%c%c%c%c (%08x) size=%d\n", |
| 419 | 419 | (tag) & 0xff, |
| @@ -428,17 +428,17 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) · 8 unmodified lines | ||
| 428 | 428 | switch(tag) { |
| 429 | 429 | case MKTAG('P', 'R', 'O', 'P'): |
| 430 | 430 | /* 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 */ | |
| 442 | 442 | break; |
| 443 | 443 | case MKTAG('C', 'O', 'N', 'T'): |
| 444 | 444 | rm_read_metadata(s, 1); |
| @@ -447,14 +447,14 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) · 2 unmodified lines | ||
| 447 | 447 | st = av_new_stream(s, 0); |
| 448 | 448 | if (!st) |
| 449 | 449 | 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 */ | |
| 458 | 458 | st->start_time = start_time; |
| 459 | 459 | st->duration = duration; |
| 460 | 460 | get_str8(pb, buf, sizeof(buf)); /* desc */ |
| @@ -462,7 +462,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1 unmodified line | ||
| 462 | 462 | st->codec->codec_type = AVMEDIA_TYPE_DATA; |
| 463 | 463 | st->priv_data = ff_rm_alloc_rmstream(); |
| 464 | 464 | if (ff_rm_read_mdpr_codecdata(s, s->pb, st, st->priv_data, |
| 465 | − get_be32(pb)) < 0) | |
| 465 | + avio_rb32(pb)) < 0) | |
| 466 | 466 | return -1; |
| 467 | 467 | break; |
| 468 | 468 | case MKTAG('D', 'A', 'T', 'A'): |
| @@ -474,10 +474,10 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) · 5 unmodified lines | ||
| 474 | 474 | } |
| 475 | 475 | } |
| 476 | 476 | header_end: |
| 477 | − rm->nb_packets = get_be32(pb); /* number of packets */ | |
| 477 | + rm->nb_packets = avio_rb32(pb); /* number of packets */ | |
| 478 | 478 | if (!rm->nb_packets && (flags & 4)) |
| 479 | 479 | rm->nb_packets = 3600 * 25; |
| 480 | − get_be32(pb); /* next data header */ | |
| 480 | + avio_rb32(pb); /* next data header */ | |
| 481 | 481 | |
| 482 | 482 | if (!data_off) |
| 483 | 483 | data_off = url_ftell(pb) - 18; |
| @@ -494,13 +494,13 @@ static int get_num(AVIOContext *pb, int *len) · 10 unmodified lines | ||
| 494 | 494 | { |
| 495 | 495 | int n, n1; |
| 496 | 496 | |
| 497 | − n = get_be16(pb); | |
| 497 | + n = avio_rb16(pb); | |
| 498 | 498 | (*len)-=2; |
| 499 | 499 | n &= 0x7FFF; |
| 500 | 500 | if (n >= 0x4000) { |
| 501 | 501 | return n - 0x4000; |
| 502 | 502 | } else { |
| 503 | − n1 = get_be16(pb); | |
| 503 | + n1 = avio_rb16(pb); | |
| 504 | 504 | (*len)-=2; |
| 505 | 505 | return (n << 16) | n1; |
| 506 | 506 | } |
| @@ -524,13 +524,13 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ · 17 unmodified lines | ||
| 524 | 524 | *timestamp = AV_NOPTS_VALUE; |
| 525 | 525 | *flags= 0; |
| 526 | 526 | }else{ |
| 527 | − state= (state<<8) + get_byte(pb); | |
| 527 | + state= (state<<8) + avio_r8(pb); | |
| 528 | 528 | |
| 529 | 529 | if(state == MKBETAG('I', 'N', 'D', 'X')){ |
| 530 | 530 | int n_pkts, expected_len; |
| 531 | − len = get_be32(pb); | |
| 531 | + len = avio_rb32(pb); | |
| 532 | 532 | url_fskip(pb, 2); |
| 533 | − n_pkts = get_be32(pb); | |
| 533 | + n_pkts = avio_rb32(pb); | |
| 534 | 534 | expected_len = 20 + n_pkts * 14; |
| 535 | 535 | if (len == 20) |
| 536 | 536 | /* 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 | ||
| 553 | 553 | len=state - 12; |
| 554 | 554 | state= 0xFFFFFFFF; |
| 555 | 555 | |
| 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 */ | |
| 560 | 560 | } |
| 561 | 561 | for(i=0;i<s->nb_streams;i++) { |
| 562 | 562 | st = s->streams[i]; |
| @@ -584,16 +584,16 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, · 21 unmodified lines | ||
| 584 | 584 | int hdr, seq, pic_num, len2, pos; |
| 585 | 585 | int type; |
| 586 | 586 | |
| 587 | − hdr = get_byte(pb); len--; | |
| 587 | + hdr = avio_r8(pb); len--; | |
| 588 | 588 | type = hdr >> 6; |
| 589 | 589 | |
| 590 | 590 | if(type != 3){ // not frame as a part of packet |
| 591 | − seq = get_byte(pb); len--; | |
| 591 | + seq = avio_r8(pb); len--; | |
| 592 | 592 | } |
| 593 | 593 | if(type != 1){ // not whole frame |
| 594 | 594 | len2 = get_num(pb, &len); |
| 595 | 595 | pos = get_num(pb, &len); |
| 596 | − pic_num = get_byte(pb); len--; | |
| 596 | + pic_num = avio_r8(pb); len--; | |
| 597 | 597 | } |
| 598 | 598 | if(len<0) |
| 599 | 599 | return -1; |
| @@ -609,7 +609,7 @@ static int rm_assemble_video_frame(AVFormatContext *s, AVIOContext *pb, · 9 unmodified lines | ||
| 609 | 609 | pkt->data[0] = 0; |
| 610 | 610 | AV_WL32(pkt->data + 1, 1); |
| 611 | 611 | AV_WL32(pkt->data + 5, 0); |
| 612 | − get_buffer(pb, pkt->data + 9, len); | |
| 612 | + avio_read(pb, pkt->data + 9, len); | |
| 613 | 613 | return 0; |
| 614 | 614 | } |
| 615 | 615 | //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 | ||
| 635 | 635 | AV_WL32(vst->pkt.data - 3 + 8*vst->cur_slice, vst->videobufpos - 8*vst->slices - 1); |
| 636 | 636 | if(vst->videobufpos + len > vst->videobufsize) |
| 637 | 637 | 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) | |
| 639 | 639 | return AVERROR(EIO); |
| 640 | 640 | vst->videobufpos += len; |
| 641 | 641 | rm->remaining_len-= len; |
| @@ -730,15 +730,15 @@ ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb, · 88 unmodified lines | ||
| 730 | 730 | switch(st->codec->codec_id) { |
| 731 | 731 | case CODEC_ID_RA_288: |
| 732 | 732 | 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); | |
| 734 | 734 | break; |
| 735 | 735 | case CODEC_ID_ATRAC3: |
| 736 | 736 | case CODEC_ID_COOK: |
| 737 | 737 | 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); | |
| 739 | 739 | break; |
| 740 | 740 | case CODEC_ID_SIPR: |
| 741 | − get_buffer(pb, ast->pkt.data + y * w, w); | |
| 741 | + avio_read(pb, ast->pkt.data + y * w, w); | |
| 742 | 742 | break; |
| 743 | 743 | } |
| 744 | 744 | |
| @@ -753,10 +753,10 @@ ff_rm_parse_packet (AVFormatContext *s, AVIOContext *pb, · 8 unmodified lines | ||
| 753 | 753 | } else if (st->codec->codec_id == CODEC_ID_AAC) { |
| 754 | 754 | int x; |
| 755 | 755 | 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; | |
| 757 | 757 | if (ast->sub_packet_cnt) { |
| 758 | 758 | 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); | |
| 760 | 760 | rm->audio_pkt_cnt = ast->sub_packet_cnt; |
| 761 | 761 | ast->audiotimestamp = timestamp; |
| 762 | 762 | } else |
| @@ -916,9 +916,9 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index, · 153 unmodified lines | ||
| 916 | 916 | |
| 917 | 917 | st = s->streams[stream_index2]; |
| 918 | 918 | if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) { |
| 919 | − h= get_byte(s->pb); len--; | |
| 919 | + h= avio_r8(s->pb); len--; | |
| 920 | 920 | if(!(h & 0x40)){ |
| 921 | − seq = get_byte(s->pb); len--; | |
| 921 | + seq = avio_r8(s->pb); len--; | |
| 922 | 922 | } |
| 923 | 923 | } |
| 924 | 924 | |
| @@ -51,7 +51,7 @@ static int read_line(AVIOContext * pb, char* line, int bufsize) · 50 unmodified lines | ||
| 51 | 51 | { |
| 52 | 52 | int i; |
| 53 | 53 | for (i = 0; i < bufsize - 1; i++) { |
| 54 | − int b = get_byte(pb); | |
| 54 | + int b = avio_r8(pb); | |
| 55 | 55 | if (b == 0) |
| 56 | 56 | break; |
| 57 | 57 | if (b == '\n') { |
| @@ -301,8 +301,8 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) · 243 unmodified lines | ||
| 301 | 301 | // multiple frames per chunk in Escape 124 samples. |
| 302 | 302 | uint32_t frame_size, frame_flags; |
| 303 | 303 | |
| 304 | − frame_flags = get_le32(pb); | |
| 305 | − frame_size = get_le32(pb); | |
| 304 | + frame_flags = avio_rl32(pb); | |
| 305 | + frame_size = avio_rl32(pb); | |
| 306 | 306 | if (url_fseek(pb, -8, SEEK_CUR) < 0) |
| 307 | 307 | return AVERROR(EIO); |
| 308 | 308 | |
| @@ -35,10 +35,10 @@ static int rso_read_header(AVFormatContext *s, AVFormatParameters *ap) · 34 unmodified lines | ||
| 35 | 35 | enum CodecID codec; |
| 36 | 36 | AVStream *st; |
| 37 | 37 | |
| 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) */ | |
| 42 | 42 | |
| 43 | 43 | codec = ff_codec_get_id(ff_codec_rso_tags, id); |
| 44 | 44 | |
| @@ -182,10 +182,10 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, · 181 unmodified lines | ||
| 182 | 182 | while (url_ftell(pb) + 4 < len) { |
| 183 | 183 | int start_off = url_ftell(pb); |
| 184 | 184 | |
| 185 | − mflags = get_byte(pb); | |
| 185 | + mflags = avio_r8(pb); | |
| 186 | 186 | if (mflags & 0x80) |
| 187 | 187 | flags |= RTP_FLAG_KEY; |
| 188 | − len_off = get_be24(pb); | |
| 188 | + len_off = avio_rb24(pb); | |
| 189 | 189 | if (mflags & 0x20) /**< relative timestamp */ |
| 190 | 190 | url_fskip(pb, 4); |
| 191 | 191 | if (mflags & 0x10) /**< has duration */ |
| @@ -104,20 +104,20 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, · 103 unmodified lines | ||
| 104 | 104 | data_len = get_bits(&gb, 16); |
| 105 | 105 | |
| 106 | 106 | url_fseek(&pb, pos + 4, SEEK_SET); |
| 107 | − tag = get_le32(&pb); | |
| 107 | + tag = avio_rl32(&pb); | |
| 108 | 108 | if ((st->codec->codec_type == AVMEDIA_TYPE_VIDEO && |
| 109 | 109 | tag != MKTAG('v','i','d','e')) || |
| 110 | 110 | (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && |
| 111 | 111 | tag != MKTAG('s','o','u','n'))) |
| 112 | 112 | 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)); | |
| 114 | 114 | |
| 115 | 115 | if (pos + data_len > len) |
| 116 | 116 | return AVERROR_INVALIDDATA; |
| 117 | 117 | /* TLVs */ |
| 118 | 118 | 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); | |
| 121 | 121 | if (url_ftell(&pb) + tlv_len > pos + data_len) |
| 122 | 122 | return AVERROR_INVALIDDATA; |
| 123 | 123 | |
| @@ -1784,7 +1784,7 @@ static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1783 unmodified lines | ||
| 1784 | 1784 | /* read the whole sdp file */ |
| 1785 | 1785 | /* XXX: better loading */ |
| 1786 | 1786 | 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); | |
| 1788 | 1788 | if (size <= 0) { |
| 1789 | 1789 | av_free(content); |
| 1790 | 1790 | return AVERROR_INVALIDDATA; |
| @@ -36,13 +36,13 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g · 35 unmodified lines | ||
| 36 | 36 | uint64_t start_pos = url_fsize(pb) - 128; |
| 37 | 37 | |
| 38 | 38 | url_fseek(pb, start_pos, SEEK_SET); |
| 39 | − if (get_buffer(pb, buf, 7) != 7) | |
| 39 | + if (avio_read(pb, buf, 7) != 7) | |
| 40 | 40 | return -1; |
| 41 | 41 | if (memcmp(buf, "SAUCE00", 7)) |
| 42 | 42 | return -1; |
| 43 | 43 | |
| 44 | 44 | #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]) { \ | |
| 46 | 46 | buf[size] = 0; \ |
| 47 | 47 | av_metadata_set2(&avctx->metadata, name, buf, 0); \ |
| 48 | 48 | } |
| @@ -52,12 +52,12 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g · 3 unmodified lines | ||
| 52 | 52 | GET_SAUCE_META("publisher", 20) |
| 53 | 53 | GET_SAUCE_META("date", 8) |
| 54 | 54 | 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); | |
| 61 | 61 | url_fskip(pb, 4); |
| 62 | 62 | GET_SAUCE_META("encoder", 22); |
| 63 | 63 | |
| @@ -83,14 +83,14 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g · 19 unmodified lines | ||
| 83 | 83 | |
| 84 | 84 | if (nb_comments > 0) { |
| 85 | 85 | 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)) { | |
| 87 | 87 | int i; |
| 88 | 88 | char *str = av_malloc(65*nb_comments + 1); |
| 89 | 89 | *fsize -= 64*nb_comments + 5; |
| 90 | 90 | if (!str) |
| 91 | 91 | return 0; |
| 92 | 92 | 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) | |
| 94 | 94 | break; |
| 95 | 95 | str[65*i + 64] = '\n'; |
| 96 | 96 | } |
| @@ -89,7 +89,7 @@ static int film_read_header(AVFormatContext *s, · 88 unmodified lines | ||
| 89 | 89 | film->stereo_buffer_size = 0; |
| 90 | 90 | |
| 91 | 91 | /* load the main FILM header */ |
| 92 | − if (get_buffer(pb, scratch, 16) != 16) | |
| 92 | + if (avio_read(pb, scratch, 16) != 16) | |
| 93 | 93 | return AVERROR(EIO); |
| 94 | 94 | data_offset = AV_RB32(&scratch[4]); |
| 95 | 95 | film->version = AV_RB32(&scratch[8]); |
| @@ -97,7 +97,7 @@ static int film_read_header(AVFormatContext *s, · 1 unmodified line | ||
| 97 | 97 | /* load the FDSC chunk */ |
| 98 | 98 | if (film->version == 0) { |
| 99 | 99 | /* 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) | |
| 101 | 101 | return AVERROR(EIO); |
| 102 | 102 | /* make some assumptions about the audio parameters */ |
| 103 | 103 | film->audio_type = CODEC_ID_PCM_S8; |
| @@ -106,7 +106,7 @@ static int film_read_header(AVFormatContext *s, · 2 unmodified lines | ||
| 106 | 106 | film->audio_bits = 8; |
| 107 | 107 | } else { |
| 108 | 108 | /* normal Saturn .cpk files; 32-byte header */ |
| 109 | − if (get_buffer(pb, scratch, 32) != 32) | |
| 109 | + if (avio_read(pb, scratch, 32) != 32) | |
| 110 | 110 | return AVERROR(EIO); |
| 111 | 111 | film->audio_samplerate = AV_RB16(&scratch[24]); |
| 112 | 112 | film->audio_channels = scratch[21]; |
| @@ -158,7 +158,7 @@ static int film_read_header(AVFormatContext *s, · 45 unmodified lines | ||
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /* load the sample table */ |
| 161 | − if (get_buffer(pb, scratch, 16) != 16) | |
| 161 | + if (avio_read(pb, scratch, 16) != 16) | |
| 162 | 162 | return AVERROR(EIO); |
| 163 | 163 | if (AV_RB32(&scratch[0]) != STAB_TAG) |
| 164 | 164 | return AVERROR_INVALIDDATA; |
| @@ -174,7 +174,7 @@ static int film_read_header(AVFormatContext *s, · 9 unmodified lines | ||
| 174 | 174 | audio_frame_counter = 0; |
| 175 | 175 | for (i = 0; i < film->sample_count; i++) { |
| 176 | 176 | /* 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) { | |
| 178 | 178 | av_free(film->sample_table); |
| 179 | 179 | return AVERROR(EIO); |
| 180 | 180 | } |
| @@ -225,7 +225,7 @@ static int film_read_packet(AVFormatContext *s, · 44 unmodified lines | ||
| 225 | 225 | pkt->pos= url_ftell(pb); |
| 226 | 226 | if (av_new_packet(pkt, sample->sample_size)) |
| 227 | 227 | return AVERROR(ENOMEM); |
| 228 | − get_buffer(pb, pkt->data, sample->sample_size); | |
| 228 | + avio_read(pb, pkt->data, sample->sample_size); | |
| 229 | 229 | } else if ((sample->stream == film->audio_stream_index) && |
| 230 | 230 | (film->audio_channels == 2)) { |
| 231 | 231 | /* stereo PCM needs to be interleaved */ |
| @@ -241,7 +241,7 @@ static int film_read_packet(AVFormatContext *s, · 9 unmodified lines | ||
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | 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); | |
| 245 | 245 | if (ret != sample->sample_size) |
| 246 | 246 | ret = AVERROR(EIO); |
| 247 | 247 | |
| @@ -96,7 +96,7 @@ static int vmd_read_header(AVFormatContext *s, · 95 unmodified lines | ||
| 96 | 96 | |
| 97 | 97 | /* fetch the main header, including the 2 header length bytes */ |
| 98 | 98 | 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) | |
| 100 | 100 | return AVERROR(EIO); |
| 101 | 101 | |
| 102 | 102 | 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 | ||
| 172 | 172 | av_free(vmd->frame_table); |
| 173 | 173 | return AVERROR(ENOMEM); |
| 174 | 174 | } |
| 175 | − if (get_buffer(pb, raw_frame_table, raw_frame_table_size) != | |
| 175 | + if (avio_read(pb, raw_frame_table, raw_frame_table_size) != | |
| 176 | 176 | raw_frame_table_size) { |
| 177 | 177 | av_free(raw_frame_table); |
| 178 | 178 | av_free(vmd->frame_table); |
| @@ -189,7 +189,7 @@ static int vmd_read_header(AVFormatContext *s, · 10 unmodified lines | ||
| 189 | 189 | int type; |
| 190 | 190 | uint32_t size; |
| 191 | 191 | |
| 192 | − get_buffer(pb, chunk, BYTES_PER_FRAME_RECORD); | |
| 192 | + avio_read(pb, chunk, BYTES_PER_FRAME_RECORD); | |
| 193 | 193 | type = chunk[0]; |
| 194 | 194 | size = AV_RL32(&chunk[2]); |
| 195 | 195 | if(!size && type != 1) |
| @@ -250,9 +250,9 @@ static int vmd_read_packet(AVFormatContext *s, · 54 unmodified lines | ||
| 250 | 250 | pkt->pos= url_ftell(pb); |
| 251 | 251 | memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD); |
| 252 | 252 | if(vmd->is_indeo3) |
| 253 | − ret = get_buffer(pb, pkt->data, frame->frame_size); | |
| 253 | + ret = avio_read(pb, pkt->data, frame->frame_size); | |
| 254 | 254 | else |
| 255 | − ret = get_buffer(pb, pkt->data + BYTES_PER_FRAME_RECORD, | |
| 255 | + ret = avio_read(pb, pkt->data + BYTES_PER_FRAME_RECORD, | |
| 256 | 256 | frame->frame_size); |
| 257 | 257 | |
| 258 | 258 | if (ret != frame->frame_size) { |
| @@ -89,28 +89,28 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) · 88 unmodified lines | ||
| 89 | 89 | AVStream *st; |
| 90 | 90 | int width, height; |
| 91 | 91 | |
| 92 | − if (get_le32(pb) != TAG_VBHD){ | |
| 92 | + if (avio_rl32(pb) != TAG_VBHD){ | |
| 93 | 93 | av_log(s, AV_LOG_ERROR, "Header chunk is missing\n"); |
| 94 | 94 | return -1; |
| 95 | 95 | } |
| 96 | − if(get_be32(pb) != 32){ | |
| 96 | + if(avio_rb32(pb) != 32){ | |
| 97 | 97 | av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n"); |
| 98 | 98 | return -1; |
| 99 | 99 | } |
| 100 | − if(get_le16(pb) != 1){ | |
| 100 | + if(avio_rl16(pb) != 1){ | |
| 101 | 101 | av_log(s, AV_LOG_ERROR, "Incorrect header version\n"); |
| 102 | 102 | return -1; |
| 103 | 103 | } |
| 104 | − width = get_le16(pb); | |
| 105 | − height = get_le16(pb); | |
| 104 | + width = avio_rl16(pb); | |
| 105 | + height = avio_rl16(pb); | |
| 106 | 106 | url_fskip(pb, 4); |
| 107 | − c->frames = get_le16(pb); | |
| 107 | + c->frames = avio_rl16(pb); | |
| 108 | 108 | if(!c->frames){ |
| 109 | 109 | av_log(s, AV_LOG_ERROR, "File contains no frames ???\n"); |
| 110 | 110 | return -1; |
| 111 | 111 | } |
| 112 | − c->bits = get_le16(pb); | |
| 113 | − c->rate = get_le16(pb); | |
| 112 | + c->bits = avio_rl16(pb); | |
| 113 | + c->rate = avio_rl16(pb); | |
| 114 | 114 | c->block_align = c->rate * (c->bits >> 3); |
| 115 | 115 | |
| 116 | 116 | url_fskip(pb, 16); //zeroes |
| @@ -137,17 +137,17 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) · 20 unmodified lines | ||
| 137 | 137 | |
| 138 | 138 | static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) |
| 139 | 139 | { |
| 140 | − if (get_le32(pb) != TAG_SHDR){ | |
| 140 | + if (avio_rl32(pb) != TAG_SHDR){ | |
| 141 | 141 | av_log(s, AV_LOG_ERROR, "Header chunk is missing\n"); |
| 142 | 142 | return -1; |
| 143 | 143 | } |
| 144 | − if(get_be32(pb) != 8){ | |
| 144 | + if(avio_rb32(pb) != 8){ | |
| 145 | 145 | av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n"); |
| 146 | 146 | return -1; |
| 147 | 147 | } |
| 148 | 148 | 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); | |
| 151 | 151 | c->block_align = c->rate * (c->bits >> 3); |
| 152 | 152 | return create_audio_stream(s, c); |
| 153 | 153 | } |
| @@ -158,10 +158,10 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap) · 4 unmodified lines | ||
| 158 | 158 | SIFFContext *c = s->priv_data; |
| 159 | 159 | uint32_t tag; |
| 160 | 160 | |
| 161 | − if (get_le32(pb) != TAG_SIFF) | |
| 161 | + if (avio_rl32(pb) != TAG_SIFF) | |
| 162 | 162 | return -1; |
| 163 | 163 | url_fskip(pb, 4); //ignore size |
| 164 | − tag = get_le32(pb); | |
| 164 | + tag = avio_rl32(pb); | |
| 165 | 165 | |
| 166 | 166 | if (tag != TAG_VBV1 && tag != TAG_SOUN){ |
| 167 | 167 | 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 | ||
| 172 | 172 | return -1; |
| 173 | 173 | if (tag == TAG_SOUN && siff_parse_soun(s, c, pb) < 0) |
| 174 | 174 | return -1; |
| 175 | − if (get_le32(pb) != MKTAG('B', 'O', 'D', 'Y')){ | |
| 175 | + if (avio_rl32(pb) != MKTAG('B', 'O', 'D', 'Y')){ | |
| 176 | 176 | av_log(s, AV_LOG_ERROR, "'BODY' chunk is missing\n"); |
| 177 | 177 | return -1; |
| 178 | 178 | } |
| @@ -190,12 +190,12 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt) · 11 unmodified lines | ||
| 190 | 190 | if (c->cur_frame >= c->frames) |
| 191 | 191 | return AVERROR(EIO); |
| 192 | 192 | 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); | |
| 195 | 195 | c->gmcsize = (c->flags & VB_HAS_GMC) ? 4 : 0; |
| 196 | 196 | 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; | |
| 199 | 199 | c->curstrm = !!(c->flags & VB_HAS_AUDIO); |
| 200 | 200 | } |
| 201 | 201 | |
| @@ -206,7 +206,7 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt) · 4 unmodified lines | ||
| 206 | 206 | AV_WL16(pkt->data, c->flags); |
| 207 | 207 | if (c->gmcsize) |
| 208 | 208 | 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); | |
| 210 | 210 | pkt->stream_index = 0; |
| 211 | 211 | c->curstrm = -1; |
| 212 | 212 | }else{ |
| @@ -105,19 +105,19 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) · 104 unmodified lines | ||
| 105 | 105 | int tbase; |
| 106 | 106 | |
| 107 | 107 | /* read and check header */ |
| 108 | − smk->magic = get_le32(pb); | |
| 108 | + smk->magic = avio_rl32(pb); | |
| 109 | 109 | if (smk->magic != MKTAG('S', 'M', 'K', '2') && smk->magic != MKTAG('S', 'M', 'K', '4')) |
| 110 | 110 | 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); | |
| 116 | 116 | if(smk->flags & SMACKER_FLAG_RING_FRAME) |
| 117 | 117 | smk->frames++; |
| 118 | 118 | 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); | |
| 121 | 121 | |
| 122 | 122 | if(smk->treesize >= UINT_MAX/4){ // smk->treesize + 16 must not overflow (this check is probably redundant) |
| 123 | 123 | 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 | ||
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | //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); | |
| 132 | 132 | 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); | |
| 135 | 135 | /* setup data */ |
| 136 | 136 | if(smk->frames > 0xFFFFFF) { |
| 137 | 137 | 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 | ||
| 144 | 144 | |
| 145 | 145 | /* read frame info */ |
| 146 | 146 | for(i = 0; i < smk->frames; i++) { |
| 147 | − smk->frm_size[i] = get_le32(pb); | |
| 147 | + smk->frm_size[i] = avio_rl32(pb); | |
| 148 | 148 | } |
| 149 | 149 | for(i = 0; i < smk->frames; i++) { |
| 150 | − smk->frm_flags[i] = get_byte(pb); | |
| 150 | + smk->frm_flags[i] = avio_r8(pb); | |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | /* init video codec */ |
| @@ -207,7 +207,7 @@ static int smacker_read_header(AVFormatContext *s, AVFormatParameters *ap) · 53 unmodified lines | ||
| 207 | 207 | av_free(smk->frm_flags); |
| 208 | 208 | return -1; |
| 209 | 209 | } |
| 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); | |
| 211 | 211 | if(ret != st->codec->extradata_size - 16){ |
| 212 | 212 | av_free(smk->frm_size); |
| 213 | 213 | av_free(smk->frm_flags); |
| @@ -251,19 +251,19 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) · 37 unmodified lines | ||
| 251 | 251 | uint8_t oldpal[768]; |
| 252 | 252 | |
| 253 | 253 | memcpy(oldpal, pal, 768); |
| 254 | − size = get_byte(s->pb); | |
| 254 | + size = avio_r8(s->pb); | |
| 255 | 255 | size = size * 4 - 1; |
| 256 | 256 | frame_size -= size; |
| 257 | 257 | frame_size--; |
| 258 | 258 | sz = 0; |
| 259 | 259 | pos = url_ftell(s->pb) + size; |
| 260 | 260 | while(sz < 256){ |
| 261 | − t = get_byte(s->pb); | |
| 261 | + t = avio_r8(s->pb); | |
| 262 | 262 | if(t & 0x80){ /* skip palette entries */ |
| 263 | 263 | sz += (t & 0x7F) + 1; |
| 264 | 264 | pal += ((t & 0x7F) + 1) * 3; |
| 265 | 265 | } else if(t & 0x40){ /* copy with offset */ |
| 266 | − off = get_byte(s->pb) * 3; | |
| 266 | + off = avio_r8(s->pb) * 3; | |
| 267 | 267 | j = (t & 0x3F) + 1; |
| 268 | 268 | while(j-- && sz < 256) { |
| 269 | 269 | *pal++ = oldpal[off + 0]; |
| @@ -274,8 +274,8 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) · 4 unmodified lines | ||
| 274 | 274 | } |
| 275 | 275 | } else { /* new entries */ |
| 276 | 276 | *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]; | |
| 279 | 279 | sz++; |
| 280 | 280 | } |
| 281 | 281 | } |
| @@ -288,13 +288,13 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) · 6 unmodified lines | ||
| 288 | 288 | for(i = 0; i < 7; i++) { |
| 289 | 289 | if(flags & 1) { |
| 290 | 290 | int size; |
| 291 | − size = get_le32(s->pb) - 4; | |
| 291 | + size = avio_rl32(s->pb) - 4; | |
| 292 | 292 | frame_size -= size; |
| 293 | 293 | frame_size -= 4; |
| 294 | 294 | smk->curstream++; |
| 295 | 295 | smk->bufs[smk->curstream] = av_realloc(smk->bufs[smk->curstream], size); |
| 296 | 296 | 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); | |
| 298 | 298 | if(ret != size) |
| 299 | 299 | return AVERROR(EIO); |
| 300 | 300 | smk->stream_id[smk->curstream] = smk->indexes[i]; |
| @@ -307,7 +307,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) · 6 unmodified lines | ||
| 307 | 307 | palchange |= 2; |
| 308 | 308 | pkt->data[0] = palchange; |
| 309 | 309 | 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); | |
| 311 | 311 | if(ret != frame_size) |
| 312 | 312 | return AVERROR(EIO); |
| 313 | 313 | pkt->stream_index = smk->videoindex; |
| @@ -93,15 +93,15 @@ static int sol_read_header(AVFormatContext *s, · 92 unmodified lines | ||
| 93 | 93 | AVStream *st; |
| 94 | 94 | |
| 95 | 95 | /* check ".snd" header */ |
| 96 | − magic = get_le16(pb); | |
| 97 | − tag = get_le32(pb); | |
| 96 | + magic = avio_rl16(pb); | |
| 97 | + tag = avio_rl32(pb); | |
| 98 | 98 | if (tag != MKTAG('S', 'O', 'L', 0)) |
| 99 | 99 | 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); | |
| 103 | 103 | if (magic != 0x0B8D) |
| 104 | − get_byte(pb); /* newer SOLs contain padding byte */ | |
| 104 | + avio_r8(pb); /* newer SOLs contain padding byte */ | |
| 105 | 105 | |
| 106 | 106 | codec = sol_codec_id(magic, type); |
| 107 | 107 | channels = sol_channels(magic, type); |
| @@ -55,20 +55,20 @@ static int sox_read_header(AVFormatContext *s, · 54 unmodified lines | ||
| 55 | 55 | |
| 56 | 56 | st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| 57 | 57 | |
| 58 | − if (get_le32(pb) == SOX_TAG) { | |
| 58 | + if (avio_rl32(pb) == SOX_TAG) { | |
| 59 | 59 | st->codec->codec_id = CODEC_ID_PCM_S32LE; |
| 60 | − header_size = get_le32(pb); | |
| 60 | + header_size = avio_rl32(pb); | |
| 61 | 61 | 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); | |
| 65 | 65 | } else { |
| 66 | 66 | st->codec->codec_id = CODEC_ID_PCM_S32BE; |
| 67 | − header_size = get_be32(pb); | |
| 67 | + header_size = avio_rb32(pb); | |
| 68 | 68 | 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); | |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | if (comment_size > 0xFFFFFFFFU - SOX_FIXED_HDR - 4U) { |
| @@ -95,7 +95,7 @@ static int sox_read_header(AVFormatContext *s, · 20 unmodified lines | ||
| 95 | 95 | |
| 96 | 96 | if (comment_size && comment_size < UINT_MAX) { |
| 97 | 97 | 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) { | |
| 99 | 99 | av_freep(&comment); |
| 100 | 100 | return AVERROR(EIO); |
| 101 | 101 | } |
| @@ -170,13 +170,13 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) · 169 unmodified lines | ||
| 170 | 170 | int pkt_size_bits, offset, ret; |
| 171 | 171 | |
| 172 | 172 | while (state != (AV_BSWAP16C(SYNCWORD1) << 16 | AV_BSWAP16C(SYNCWORD2))) { |
| 173 | − state = (state << 8) | get_byte(pb); | |
| 173 | + state = (state << 8) | avio_r8(pb); | |
| 174 | 174 | if (url_feof(pb)) |
| 175 | 175 | return AVERROR_EOF; |
| 176 | 176 | } |
| 177 | 177 | |
| 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); | |
| 180 | 180 | |
| 181 | 181 | if (pkt_size_bits % 16) |
| 182 | 182 | 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 | ||
| 187 | 187 | |
| 188 | 188 | pkt->pos = url_ftell(pb) - BURST_HEADER_SIZE; |
| 189 | 189 | |
| 190 | − if (get_buffer(pb, pkt->data, pkt->size) < pkt->size) { | |
| 190 | + if (avio_read(pb, pkt->data, pkt->size) < pkt->size) { | |
| 191 | 191 | av_free_packet(pkt); |
| 192 | 192 | return AVERROR_EOF; |
| 193 | 193 | } |
| @@ -30,11 +30,11 @@ static int get_swf_tag(AVIOContext *pb, int *len_ptr) · 29 unmodified lines | ||
| 30 | 30 | if (url_feof(pb)) |
| 31 | 31 | return -1; |
| 32 | 32 | |
| 33 | − tag = get_le16(pb); | |
| 33 | + tag = avio_rl16(pb); | |
| 34 | 34 | len = tag & 0x3f; |
| 35 | 35 | tag = tag >> 6; |
| 36 | 36 | if (len == 0x3f) { |
| 37 | − len = get_le32(pb); | |
| 37 | + len = avio_rl32(pb); | |
| 38 | 38 | } |
| 39 | 39 | // av_log(NULL, AV_LOG_DEBUG, "Tag: %d - Len: %d\n", tag, len); |
| 40 | 40 | *len_ptr = len; |
| @@ -58,7 +58,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 17 unmodified lines | ||
| 58 | 58 | AVIOContext *pb = s->pb; |
| 59 | 59 | int nbits, len, tag; |
| 60 | 60 | |
| 61 | − tag = get_be32(pb) & 0xffffff00; | |
| 61 | + tag = avio_rb32(pb) & 0xffffff00; | |
| 62 | 62 | |
| 63 | 63 | if (tag == MKBETAG('C', 'W', 'S', 0)) { |
| 64 | 64 | 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 | ||
| 66 | 66 | } |
| 67 | 67 | if (tag != MKBETAG('F', 'W', 'S', 0)) |
| 68 | 68 | return AVERROR(EIO); |
| 69 | − get_le32(pb); | |
| 69 | + avio_rl32(pb); | |
| 70 | 70 | /* skip rectangle size */ |
| 71 | − nbits = get_byte(pb) >> 3; | |
| 71 | + nbits = avio_r8(pb) >> 3; | |
| 72 | 72 | len = (4 * nbits - 3 + 7) / 8; |
| 73 | 73 | 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 */ | |
| 76 | 76 | |
| 77 | 77 | swf->samples_per_frame = 0; |
| 78 | 78 | s->ctx_flags |= AVFMTCTX_NOHEADER; |
| @@ -92,7 +92,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) · 13 unmodified lines | ||
| 92 | 92 | if (tag < 0) |
| 93 | 93 | return AVERROR(EIO); |
| 94 | 94 | if (tag == TAG_VIDEOSTREAM) { |
| 95 | − int ch_id = get_le16(pb); | |
| 95 | + int ch_id = avio_rl16(pb); | |
| 96 | 96 | len -= 2; |
| 97 | 97 | |
| 98 | 98 | for (i=0; i<s->nb_streams; i++) { |
| @@ -101,16 +101,16 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) · 2 unmodified lines | ||
| 101 | 101 | goto skip; |
| 102 | 102 | } |
| 103 | 103 | |
| 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); | |
| 108 | 108 | /* Check for FLV1 */ |
| 109 | 109 | vst = av_new_stream(s, ch_id); |
| 110 | 110 | if (!vst) |
| 111 | 111 | return -1; |
| 112 | 112 | 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)); | |
| 114 | 114 | av_set_pts_info(vst, 16, 256, swf->frame_rate); |
| 115 | 115 | vst->codec->time_base = (AVRational){ 256, swf->frame_rate }; |
| 116 | 116 | len -= 8; |
| @@ -124,9 +124,9 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) · 7 unmodified lines | ||
| 124 | 124 | goto skip; |
| 125 | 125 | } |
| 126 | 126 | |
| 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); | |
| 130 | 130 | ast = av_new_stream(s, -1); /* -1 to avoid clash with video stream ch_id */ |
| 131 | 131 | if (!ast) |
| 132 | 132 | return -1; |
| @@ -141,12 +141,12 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) · 8 unmodified lines | ||
| 141 | 141 | av_set_pts_info(ast, 64, 1, ast->codec->sample_rate); |
| 142 | 142 | len -= 4; |
| 143 | 143 | } else if (tag == TAG_VIDEOFRAME) { |
| 144 | − int ch_id = get_le16(pb); | |
| 144 | + int ch_id = avio_rl16(pb); | |
| 145 | 145 | len -= 2; |
| 146 | 146 | for(i=0; i<s->nb_streams; i++) { |
| 147 | 147 | st = s->streams[i]; |
| 148 | 148 | if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO && st->id == ch_id) { |
| 149 | − frame = get_le16(pb); | |
| 149 | + frame = avio_rl16(pb); | |
| 150 | 150 | av_get_packet(pb, pkt, len-2); |
| 151 | 151 | pkt->pos = pos; |
| 152 | 152 | pkt->pts = frame; |
| @@ -185,17 +185,17 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) · 32 unmodified lines | ||
| 185 | 185 | vst->codec->time_base = (AVRational){ 256, swf->frame_rate }; |
| 186 | 186 | st = vst; |
| 187 | 187 | } |
| 188 | − get_le16(pb); /* BITMAP_ID */ | |
| 188 | + avio_rl16(pb); /* BITMAP_ID */ | |
| 189 | 189 | av_new_packet(pkt, len-2); |
| 190 | − get_buffer(pb, pkt->data, 4); | |
| 190 | + avio_read(pb, pkt->data, 4); | |
| 191 | 191 | if (AV_RB32(pkt->data) == 0xffd8ffd9 || |
| 192 | 192 | AV_RB32(pkt->data) == 0xffd9ffd8) { |
| 193 | 193 | /* old SWF files containing SOI/EOI as data start */ |
| 194 | 194 | /* files created by swink have reversed tag */ |
| 195 | 195 | pkt->size -= 4; |
| 196 | − get_buffer(pb, pkt->data, pkt->size); | |
| 196 | + avio_read(pb, pkt->data, pkt->size); | |
| 197 | 197 | } else { |
| 198 | − get_buffer(pb, pkt->data + 4, pkt->size - 4); | |
| 198 | + avio_read(pb, pkt->data + 4, pkt->size - 4); | |
| 199 | 199 | } |
| 200 | 200 | pkt->pos = pos; |
| 201 | 201 | pkt->stream_index = st->index; |
| @@ -61,31 +61,31 @@ static int thp_read_header(AVFormatContext *s, · 60 unmodified lines | ||
| 61 | 61 | int i; |
| 62 | 62 | |
| 63 | 63 | /* 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); | |
| 66 | 66 | |
| 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. */ | |
| 69 | 69 | |
| 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. */ | |
| 74 | 74 | |
| 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); | |
| 79 | 79 | |
| 80 | 80 | thp->next_framesz = thp->first_framesz; |
| 81 | 81 | thp->next_frame = thp->first_frame; |
| 82 | 82 | |
| 83 | 83 | /* Read the component structure. */ |
| 84 | 84 | url_fseek (pb, thp->compoff, SEEK_SET); |
| 85 | − thp->compcount = get_be32(pb); | |
| 85 | + thp->compcount = avio_rb32(pb); | |
| 86 | 86 | |
| 87 | 87 | /* Read the list of component types. */ |
| 88 | − get_buffer(pb, thp->components, 16); | |
| 88 | + avio_read(pb, thp->components, 16); | |
| 89 | 89 | |
| 90 | 90 | for (i = 0; i < thp->compcount; i++) { |
| 91 | 91 | if (thp->components[i] == 0) { |
| @@ -103,14 +103,14 @@ static int thp_read_header(AVFormatContext *s, · 11 unmodified lines | ||
| 103 | 103 | st->codec->codec_type = AVMEDIA_TYPE_VIDEO; |
| 104 | 104 | st->codec->codec_id = CODEC_ID_THP; |
| 105 | 105 | 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); | |
| 108 | 108 | st->codec->sample_rate = av_q2d(thp->fps); |
| 109 | 109 | thp->vst = st; |
| 110 | 110 | thp->video_stream_index = st->index; |
| 111 | 111 | |
| 112 | 112 | if (thp->version == 0x11000) |
| 113 | − get_be32(pb); /* Unknown. */ | |
| 113 | + avio_rb32(pb); /* Unknown. */ | |
| 114 | 114 | } else if (thp->components[i] == 1) { |
| 115 | 115 | if (thp->has_audio != 0) |
| 116 | 116 | break; |
| @@ -123,8 +123,8 @@ static int thp_read_header(AVFormatContext *s, · 6 unmodified lines | ||
| 123 | 123 | st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| 124 | 124 | st->codec->codec_id = CODEC_ID_ADPCM_THP; |
| 125 | 125 | 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. */ | |
| 128 | 128 | |
| 129 | 129 | av_set_pts_info(st, 64, 1, st->codec->sample_rate); |
| 130 | 130 | |
| @@ -153,15 +153,15 @@ static int thp_read_packet(AVFormatContext *s, · 22 unmodified lines | ||
| 153 | 153 | |
| 154 | 154 | /* Locate the next frame and read out its size. */ |
| 155 | 155 | thp->next_frame += thp->next_framesz; |
| 156 | − thp->next_framesz = get_be32(pb); | |
| 156 | + thp->next_framesz = avio_rb32(pb); | |
| 157 | 157 | |
| 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. */ | |
| 160 | 160 | |
| 161 | 161 | /* Store the audiosize so the next time this function is called, |
| 162 | 162 | the audio can be read. */ |
| 163 | 163 | if (thp->has_audio) |
| 164 | − thp->audiosize = get_be32(pb); /* Audio size. */ | |
| 164 | + thp->audiosize = avio_rb32(pb); /* Audio size. */ | |
| 165 | 165 | else |
| 166 | 166 | thp->frame++; |
| 167 | 167 | |
| @@ -86,7 +86,7 @@ static int seq_init_frame_buffers(SeqDemuxContext *seq, AVIOContext *pb) · 85 unmodified lines | ||
| 86 | 86 | url_fseek(pb, 256, SEEK_SET); |
| 87 | 87 | |
| 88 | 88 | for (i = 0; i < SEQ_NUM_FRAME_BUFFERS; i++) { |
| 89 | − sz = get_le16(pb); | |
| 89 | + sz = avio_rl16(pb); | |
| 90 | 90 | if (sz == 0) |
| 91 | 91 | break; |
| 92 | 92 | else { |
| @@ -114,7 +114,7 @@ static int seq_fill_buffer(SeqDemuxContext *seq, AVIOContext *pb, int buffer_num · 21 unmodified lines | ||
| 114 | 114 | return AVERROR_INVALIDDATA; |
| 115 | 115 | |
| 116 | 116 | 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) | |
| 118 | 118 | return AVERROR(EIO); |
| 119 | 119 | |
| 120 | 120 | seq_buffer->fill_size += data_size; |
| @@ -131,7 +131,7 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, AVIOContext *pb) · 10 unmodified lines | ||
| 131 | 131 | url_fseek(pb, seq->current_frame_offs, SEEK_SET); |
| 132 | 132 | |
| 133 | 133 | /* sound data */ |
| 134 | − seq->current_audio_data_offs = get_le16(pb); | |
| 134 | + seq->current_audio_data_offs = avio_rl16(pb); | |
| 135 | 135 | if (seq->current_audio_data_offs) { |
| 136 | 136 | seq->current_audio_data_size = SEQ_AUDIO_BUFFER_SIZE * 2; |
| 137 | 137 | } else { |
| @@ -139,7 +139,7 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, AVIOContext *pb) · 1 unmodified line | ||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /* palette data */ |
| 142 | − seq->current_pal_data_offs = get_le16(pb); | |
| 142 | + seq->current_pal_data_offs = avio_rl16(pb); | |
| 143 | 143 | if (seq->current_pal_data_offs) { |
| 144 | 144 | seq->current_pal_data_size = 768; |
| 145 | 145 | } else { |
| @@ -148,10 +148,10 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, AVIOContext *pb) · 2 unmodified lines | ||
| 148 | 148 | |
| 149 | 149 | /* video data */ |
| 150 | 150 | for (i = 0; i < 4; i++) |
| 151 | − buffer_num[i] = get_byte(pb); | |
| 151 | + buffer_num[i] = avio_r8(pb); | |
| 152 | 152 | |
| 153 | 153 | for (i = 0; i < 4; i++) |
| 154 | − offset_table[i] = get_le16(pb); | |
| 154 | + offset_table[i] = avio_rl16(pb); | |
| 155 | 155 | |
| 156 | 156 | for (i = 0; i < 3; i++) { |
| 157 | 157 | if (offset_table[i]) { |
| @@ -257,7 +257,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt) · 99 unmodified lines | ||
| 257 | 257 | if (seq->current_pal_data_size) { |
| 258 | 258 | pkt->data[0] |= 1; |
| 259 | 259 | 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) | |
| 261 | 261 | return AVERROR(EIO); |
| 262 | 262 | } |
| 263 | 263 | if (seq->current_video_data_size) { |
| @@ -70,7 +70,7 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap) · 69 unmodified lines | ||
| 70 | 70 | AVRational fps; |
| 71 | 71 | unsigned comp_method, char_cols, char_rows, features; |
| 72 | 72 | |
| 73 | − if (get_le32(pb) != TMV_TAG) | |
| 73 | + if (avio_rl32(pb) != TMV_TAG) | |
| 74 | 74 | return -1; |
| 75 | 75 | |
| 76 | 76 | if (!(vst = av_new_stream(s, 0))) |
| @@ -79,30 +79,30 @@ static int tmv_read_header(AVFormatContext *s, AVFormatParameters *ap) · 2 unmodified lines | ||
| 79 | 79 | if (!(ast = av_new_stream(s, 0))) |
| 80 | 80 | return AVERROR(ENOMEM); |
| 81 | 81 | |
| 82 | − ast->codec->sample_rate = get_le16(pb); | |
| 82 | + ast->codec->sample_rate = avio_rl16(pb); | |
| 83 | 83 | if (!ast->codec->sample_rate) { |
| 84 | 84 | av_log(s, AV_LOG_ERROR, "invalid sample rate\n"); |
| 85 | 85 | return -1; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | − tmv->audio_chunk_size = get_le16(pb); | |
| 88 | + tmv->audio_chunk_size = avio_rl16(pb); | |
| 89 | 89 | if (!tmv->audio_chunk_size) { |
| 90 | 90 | av_log(s, AV_LOG_ERROR, "invalid audio chunk size\n"); |
| 91 | 91 | return -1; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | − comp_method = get_byte(pb); | |
| 94 | + comp_method = avio_r8(pb); | |
| 95 | 95 | if (comp_method) { |
| 96 | 96 | av_log(s, AV_LOG_ERROR, "unsupported compression method %d\n", |
| 97 | 97 | comp_method); |
| 98 | 98 | return -1; |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | − char_cols = get_byte(pb); | |
| 102 | − char_rows = get_byte(pb); | |
| 101 | + char_cols = avio_r8(pb); | |
| 102 | + char_rows = avio_r8(pb); | |
| 103 | 103 | tmv->video_chunk_size = char_cols * char_rows * 2; |
| 104 | 104 | |
| 105 | − features = get_byte(pb); | |
| 105 | + features = avio_r8(pb); | |
| 106 | 106 | if (features & ~(TMV_PADDING | TMV_STEREO)) { |
| 107 | 107 | av_log(s, AV_LOG_ERROR, "unsupported features 0x%02x\n", |
| 108 | 108 | features & ~(TMV_PADDING | TMV_STEREO)); |
| @@ -47,19 +47,19 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) · 46 unmodified lines | ||
| 47 | 47 | ff_id3v1_read(s); |
| 48 | 48 | |
| 49 | 49 | start_offset = url_ftell(s->pb); |
| 50 | − if (get_le32(s->pb) != AV_RL32("TTA1")) | |
| 50 | + if (avio_rl32(s->pb) != AV_RL32("TTA1")) | |
| 51 | 51 | return -1; // not tta file |
| 52 | 52 | |
| 53 | 53 | 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); | |
| 57 | 57 | if(samplerate <= 0 || samplerate > 1000000){ |
| 58 | 58 | av_log(s, AV_LOG_ERROR, "nonsense samplerate\n"); |
| 59 | 59 | return -1; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | − datalen = get_le32(s->pb); | |
| 62 | + datalen = avio_rl32(s->pb); | |
| 63 | 63 | if(datalen < 0){ |
| 64 | 64 | av_log(s, AV_LOG_ERROR, "nonsense datalen\n"); |
| 65 | 65 | return -1; |
| @@ -87,7 +87,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) · 21 unmodified lines | ||
| 87 | 87 | framepos = url_ftell(s->pb) + 4*c->totalframes + 4; |
| 88 | 88 | |
| 89 | 89 | for (i = 0; i < c->totalframes; i++) { |
| 90 | − uint32_t size = get_le32(s->pb); | |
| 90 | + uint32_t size = avio_rl32(s->pb); | |
| 91 | 91 | av_add_index_entry(st, framepos, i*framelen, size, 0, AVINDEX_KEYFRAME); |
| 92 | 92 | framepos += size; |
| 93 | 93 | } |
| @@ -101,13 +101,13 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) · 7 unmodified lines | ||
| 101 | 101 | |
| 102 | 102 | st->codec->extradata_size = url_ftell(s->pb) - start_offset; |
| 103 | 103 | 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 | |
| 105 | 105 | av_log(s, AV_LOG_ERROR, "extradata_size too large\n"); |
| 106 | 106 | return -1; |
| 107 | 107 | } |
| 108 | 108 | st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE); |
| 109 | 109 | 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); | |
| 111 | 111 | |
| 112 | 112 | return 0; |
| 113 | 113 | } |
| @@ -47,14 +47,14 @@ static int efi_read(AVFormatContext *avctx, uint64_t start_pos) · 46 unmodified lines | ||
| 47 | 47 | int len; |
| 48 | 48 | |
| 49 | 49 | url_fseek(pb, start_pos, SEEK_SET); |
| 50 | − if (get_byte(pb) != 0x1A) | |
| 50 | + if (avio_r8(pb) != 0x1A) | |
| 51 | 51 | return -1; |
| 52 | 52 | |
| 53 | 53 | #define GET_EFI_META(name,size) \ |
| 54 | − len = get_byte(pb); \ | |
| 54 | + len = avio_r8(pb); \ | |
| 55 | 55 | if (len < 1 || len > size) \ |
| 56 | 56 | return -1; \ |
| 57 | − if (get_buffer(pb, buf, size) == size) { \ | |
| 57 | + if (avio_read(pb, buf, size) == size) { \ | |
| 58 | 58 | buf[len] = 0; \ |
| 59 | 59 | av_metadata_set2(&avctx->metadata, name, buf, 0); \ |
| 60 | 60 | } |
| @@ -57,9 +57,9 @@ static int txd_read_packet(AVFormatContext *s, AVPacket *pkt) { · 56 unmodified lines | ||
| 57 | 57 | int ret; |
| 58 | 58 | |
| 59 | 59 | 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); | |
| 63 | 63 | |
| 64 | 64 | if (url_feof(s->pb)) |
| 65 | 65 | return AVERROR_EOF; |
| @@ -332,7 +332,7 @@ int av_get_packet(AVIOContext *s, AVPacket *pkt, int size) · 331 unmodified lines | ||
| 332 | 332 | |
| 333 | 333 | pkt->pos= url_ftell(s); |
| 334 | 334 | |
| 335 | − ret= get_buffer(s, pkt->data, size); | |
| 335 | + ret= avio_read(s, pkt->data, size); | |
| 336 | 336 | if(ret<=0) |
| 337 | 337 | av_free_packet(pkt); |
| 338 | 338 | else |
| @@ -351,7 +351,7 @@ int av_append_packet(AVIOContext *s, AVPacket *pkt, int size) · 12 unmodified lines | ||
| 351 | 351 | ret = av_grow_packet(pkt, size); |
| 352 | 352 | if (ret < 0) |
| 353 | 353 | return ret; |
| 354 | − ret = get_buffer(s, pkt->data + old_size, size); | |
| 354 | + ret = avio_read(s, pkt->data + old_size, size); | |
| 355 | 355 | av_shrink_packet(pkt, old_size + FFMAX(ret, 0)); |
| 356 | 356 | return ret; |
| 357 | 357 | } |
| @@ -555,7 +555,7 @@ int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, · 197 unmodified lines | ||
| 555 | 555 | |
| 556 | 556 | /* read probe data */ |
| 557 | 557 | 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) { | |
| 559 | 559 | /* fail if error was not end of file, otherwise, lower score */ |
| 560 | 560 | if (ret != AVERROR_EOF) { |
| 561 | 561 | av_free(buf); |
| @@ -49,8 +49,8 @@ static int vc1t_read_header(AVFormatContext *s, · 48 unmodified lines | ||
| 49 | 49 | int frames; |
| 50 | 50 | uint32_t fps; |
| 51 | 51 | |
| 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) | |
| 54 | 54 | return -1; |
| 55 | 55 | |
| 56 | 56 | /* init video codec */ |
| @@ -63,13 +63,13 @@ static int vc1t_read_header(AVFormatContext *s, · 6 unmodified lines | ||
| 63 | 63 | |
| 64 | 64 | st->codec->extradata = av_malloc(VC1_EXTRADATA_SIZE); |
| 65 | 65 | 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) | |
| 70 | 70 | return -1; |
| 71 | 71 | url_fskip(pb, 8); |
| 72 | − fps = get_le32(pb); | |
| 72 | + fps = avio_rl32(pb); | |
| 73 | 73 | if(fps == 0xFFFFFFFF) |
| 74 | 74 | av_set_pts_info(st, 32, 1, 1000); |
| 75 | 75 | else{ |
| @@ -95,10 +95,10 @@ static int vc1t_read_packet(AVFormatContext *s, · 19 unmodified lines | ||
| 95 | 95 | if(url_feof(pb)) |
| 96 | 96 | return AVERROR(EIO); |
| 97 | 97 | |
| 98 | − frame_size = get_le24(pb); | |
| 99 | − if(get_byte(pb) & 0x80) | |
| 98 | + frame_size = avio_rl24(pb); | |
| 99 | + if(avio_r8(pb) & 0x80) | |
| 100 | 100 | keyframe = 1; |
| 101 | − pts = get_le32(pb); | |
| 101 | + pts = avio_rl32(pb); | |
| 102 | 102 | if(av_get_packet(pb, pkt, frame_size) < 0) |
| 103 | 103 | return AVERROR(EIO); |
| 104 | 104 | if(s->streams[0]->time_base.den == 1000) |
| @@ -46,7 +46,7 @@ static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap) · 45 unmodified lines | ||
| 46 | 46 | AVStream *st; |
| 47 | 47 | |
| 48 | 48 | url_fskip(pb, 20); |
| 49 | − header_size = get_le16(pb) - 22; | |
| 49 | + header_size = avio_rl16(pb) - 22; | |
| 50 | 50 | if (header_size != 4) { |
| 51 | 51 | av_log(s, AV_LOG_ERROR, "unknown header size: %d\n", header_size); |
| 52 | 52 | return AVERROR(ENOSYS); |
| @@ -73,10 +73,10 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) · 20 unmodified lines | ||
| 73 | 73 | int channels = 1; |
| 74 | 74 | |
| 75 | 75 | while (!voc->remaining_size) { |
| 76 | − type = get_byte(pb); | |
| 76 | + type = avio_r8(pb); | |
| 77 | 77 | if (type == VOC_TYPE_EOF) |
| 78 | 78 | return AVERROR(EIO); |
| 79 | − voc->remaining_size = get_le24(pb); | |
| 79 | + voc->remaining_size = avio_rl24(pb); | |
| 80 | 80 | if (!voc->remaining_size) { |
| 81 | 81 | if (url_is_streamed(s->pb)) |
| 82 | 82 | return AVERROR(EIO); |
| @@ -86,11 +86,11 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) · 3 unmodified lines | ||
| 86 | 86 | |
| 87 | 87 | switch (type) { |
| 88 | 88 | case VOC_TYPE_VOICE_DATA: |
| 89 | − dec->sample_rate = 1000000 / (256 - get_byte(pb)); | |
| 89 | + dec->sample_rate = 1000000 / (256 - avio_r8(pb)); | |
| 90 | 90 | if (sample_rate) |
| 91 | 91 | dec->sample_rate = sample_rate; |
| 92 | 92 | dec->channels = channels; |
| 93 | − tmp_codec = get_byte(pb); | |
| 93 | + tmp_codec = avio_r8(pb); | |
| 94 | 94 | dec->bits_per_coded_sample = av_get_bits_per_sample(dec->codec_id); |
| 95 | 95 | voc->remaining_size -= 2; |
| 96 | 96 | max_size -= 2; |
| @@ -101,19 +101,19 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) · 4 unmodified lines | ||
| 101 | 101 | break; |
| 102 | 102 | |
| 103 | 103 | 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; | |
| 107 | 107 | sample_rate = 256000000 / (channels * (65536 - sample_rate)); |
| 108 | 108 | voc->remaining_size = 0; |
| 109 | 109 | max_size -= 4; |
| 110 | 110 | break; |
| 111 | 111 | |
| 112 | 112 | 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); | |
| 117 | 117 | url_fskip(pb, 4); |
| 118 | 118 | voc->remaining_size -= 12; |
| 119 | 119 | max_size -= 12; |
| @@ -54,7 +54,7 @@ static void add_metadata(AVFormatContext *s, const char *tag, · 53 unmodified lines | ||
| 54 | 54 | buf = av_malloc(len+1); |
| 55 | 55 | if (!buf) |
| 56 | 56 | return; |
| 57 | − get_buffer(s->pb, buf, len); | |
| 57 | + avio_read(s->pb, buf, len); | |
| 58 | 58 | buf[len] = 0; |
| 59 | 59 | av_metadata_set2(&s->metadata, tag, buf, AV_METADATA_DONT_STRDUP_VAL); |
| 60 | 60 | } |
| @@ -74,7 +74,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 13 unmodified lines | ||
| 74 | 74 | |
| 75 | 75 | url_fskip(s->pb, 12); |
| 76 | 76 | |
| 77 | − header_size = get_be32(s->pb); | |
| 77 | + header_size = avio_rb32(s->pb); | |
| 78 | 78 | |
| 79 | 79 | st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| 80 | 80 | st->codec->codec_id = CODEC_ID_TWINVQ; |
| @@ -82,12 +82,12 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) · 1 unmodified line | ||
| 82 | 82 | |
| 83 | 83 | do { |
| 84 | 84 | int len; |
| 85 | − chunk_tag = get_le32(s->pb); | |
| 85 | + chunk_tag = avio_rl32(s->pb); | |
| 86 | 86 | |
| 87 | 87 | if (chunk_tag == MKTAG('D','A','T','A')) |
| 88 | 88 | break; |
| 89 | 89 | |
| 90 | − len = get_be32(s->pb); | |
| 90 | + len = avio_rb32(s->pb); | |
| 91 | 91 | |
| 92 | 92 | if ((unsigned) len > INT_MAX/2) { |
| 93 | 93 | 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 | ||
| 98 | 98 | |
| 99 | 99 | switch(chunk_tag){ |
| 100 | 100 | 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); | |
| 104 | 104 | url_fskip(s->pb, len-12); |
| 105 | 105 | |
| 106 | 106 | st->codec->bit_rate = read_bitrate*1000; |
| @@ -208,7 +208,7 @@ static int vqf_read_packet(AVFormatContext *s, AVPacket *pkt) · 101 unmodified lines | ||
| 208 | 208 | |
| 209 | 209 | pkt->data[0] = 8 - c->remaining_bits; // Number of bits to skip |
| 210 | 210 | 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); | |
| 212 | 212 | |
| 213 | 213 | if (ret<=0) { |
| 214 | 214 | av_free_packet(pkt); |
| @@ -143,8 +143,8 @@ AVOutputFormat ff_wav_muxer = { · 142 unmodified lines | ||
| 143 | 143 | |
| 144 | 144 | static int64_t next_tag(AVIOContext *pb, unsigned int *tag) |
| 145 | 145 | { |
| 146 | − *tag = get_le32(pb); | |
| 147 | − return get_le32(pb); | |
| 146 | + *tag = avio_rl32(pb); | |
| 147 | + return avio_rl32(pb); | |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | /* return the size of the found tag */ |
| @@ -197,25 +197,25 @@ static int wav_read_header(AVFormatContext *s, · 46 unmodified lines | ||
| 197 | 197 | WAVContext *wav = s->priv_data; |
| 198 | 198 | |
| 199 | 199 | /* check RIFF header */ |
| 200 | − tag = get_le32(pb); | |
| 200 | + tag = avio_rl32(pb); | |
| 201 | 201 | |
| 202 | 202 | rf64 = tag == MKTAG('R', 'F', '6', '4'); |
| 203 | 203 | if (!rf64 && tag != MKTAG('R', 'I', 'F', 'F')) |
| 204 | 204 | return -1; |
| 205 | − get_le32(pb); /* file size */ | |
| 206 | − tag = get_le32(pb); | |
| 205 | + avio_rl32(pb); /* file size */ | |
| 206 | + tag = avio_rl32(pb); | |
| 207 | 207 | if (tag != MKTAG('W', 'A', 'V', 'E')) |
| 208 | 208 | return -1; |
| 209 | 209 | |
| 210 | 210 | if (rf64) { |
| 211 | − if (get_le32(pb) != MKTAG('d', 's', '6', '4')) | |
| 211 | + if (avio_rl32(pb) != MKTAG('d', 's', '6', '4')) | |
| 212 | 212 | return -1; |
| 213 | − size = get_le32(pb); | |
| 213 | + size = avio_rl32(pb); | |
| 214 | 214 | if (size < 16) |
| 215 | 215 | 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); | |
| 219 | 219 | url_fskip(pb, size - 16); /* skip rest of ds64 chunk */ |
| 220 | 220 | } |
| 221 | 221 | |
| @@ -239,7 +239,7 @@ static int wav_read_header(AVFormatContext *s, · 17 unmodified lines | ||
| 239 | 239 | if (tag == MKTAG('d', 'a', 't', 'a')){ |
| 240 | 240 | break; |
| 241 | 241 | }else if (tag == MKTAG('f','a','c','t') && !sample_count){ |
| 242 | − sample_count = get_le32(pb); | |
| 242 | + sample_count = avio_rl32(pb); | |
| 243 | 243 | size -= 4; |
| 244 | 244 | } |
| 245 | 245 | 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 | ||
| 269 | 269 | int64_t size; |
| 270 | 270 | |
| 271 | 271 | 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); | |
| 274 | 274 | if (size <= 24) |
| 275 | 275 | return -1; |
| 276 | 276 | if (!memcmp(guid, guid1, 16)) |
| @@ -384,14 +384,14 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap) · 107 unmodified lines | ||
| 384 | 384 | AVStream *st; |
| 385 | 385 | uint8_t guid[16]; |
| 386 | 386 | |
| 387 | − get_buffer(pb, guid, 16); | |
| 387 | + avio_read(pb, guid, 16); | |
| 388 | 388 | if (memcmp(guid, guid_riff, 16)) |
| 389 | 389 | return -1; |
| 390 | 390 | |
| 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 */ | |
| 392 | 392 | return -1; |
| 393 | 393 | |
| 394 | − get_buffer(pb, guid, 16); | |
| 394 | + avio_read(pb, guid, 16); | |
| 395 | 395 | if (memcmp(guid, guid_wave, 16)) { |
| 396 | 396 | av_log(s, AV_LOG_ERROR, "could not find wave guid\n"); |
| 397 | 397 | return -1; |
| @@ -105,8 +105,8 @@ static int wc3_read_header(AVFormatContext *s, · 104 unmodified lines | ||
| 105 | 105 | |
| 106 | 106 | /* traverse through the chunks and load the header information before |
| 107 | 107 | * 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); | |
| 110 | 110 | |
| 111 | 111 | do { |
| 112 | 112 | switch (fourcc_tag) { |
| @@ -127,7 +127,7 @@ static int wc3_read_header(AVFormatContext *s, · 14 unmodified lines | ||
| 127 | 127 | buffer = av_malloc(size+1); |
| 128 | 128 | if (!buffer) |
| 129 | 129 | return AVERROR(ENOMEM); |
| 130 | − if ((ret = get_buffer(pb, buffer, size)) != size) | |
| 130 | + if ((ret = avio_read(pb, buffer, size)) != size) | |
| 131 | 131 | return AVERROR(EIO); |
| 132 | 132 | buffer[size] = 0; |
| 133 | 133 | av_metadata_set2(&s->metadata, "title", buffer, |
| @@ -136,8 +136,8 @@ static int wc3_read_header(AVFormatContext *s, · 2 unmodified lines | ||
| 136 | 136 | |
| 137 | 137 | case SIZE_TAG: |
| 138 | 138 | /* 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); | |
| 141 | 141 | break; |
| 142 | 142 | |
| 143 | 143 | case PALT_TAG: |
| @@ -154,9 +154,9 @@ static int wc3_read_header(AVFormatContext *s, · 10 unmodified lines | ||
| 154 | 154 | break; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | − fourcc_tag = get_le32(pb); | |
| 157 | + fourcc_tag = avio_rl32(pb); | |
| 158 | 158 | /* chunk sizes are 16-bit aligned */ |
| 159 | − size = (get_be32(pb) + 1) & (~1); | |
| 159 | + size = (avio_rb32(pb) + 1) & (~1); | |
| 160 | 160 | if (url_feof(pb)) |
| 161 | 161 | return AVERROR(EIO); |
| 162 | 162 | |
| @@ -205,9 +205,9 @@ static int wc3_read_packet(AVFormatContext *s, · 42 unmodified lines | ||
| 205 | 205 | |
| 206 | 206 | while (!packet_read) { |
| 207 | 207 | |
| 208 | − fourcc_tag = get_le32(pb); | |
| 208 | + fourcc_tag = avio_rl32(pb); | |
| 209 | 209 | /* chunk sizes are 16-bit aligned */ |
| 210 | − size = (get_be32(pb) + 1) & (~1); | |
| 210 | + size = (avio_rb32(pb) + 1) & (~1); | |
| 211 | 211 | if (url_feof(pb)) |
| 212 | 212 | return AVERROR(EIO); |
| 213 | 213 | |
| @@ -242,7 +242,7 @@ static int wc3_read_packet(AVFormatContext *s, · 28 unmodified lines | ||
| 242 | 242 | #if 0 |
| 243 | 243 | url_fseek(pb, size, SEEK_CUR); |
| 244 | 244 | #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) | |
| 246 | 246 | ret = AVERROR(EIO); |
| 247 | 247 | else { |
| 248 | 248 | int i = 0; |
| @@ -130,7 +130,7 @@ static int wsaud_read_header(AVFormatContext *s, · 129 unmodified lines | ||
| 130 | 130 | AVStream *st; |
| 131 | 131 | unsigned char header[AUD_HEADER_SIZE]; |
| 132 | 132 | |
| 133 | − if (get_buffer(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE) | |
| 133 | + if (avio_read(pb, header, AUD_HEADER_SIZE) != AUD_HEADER_SIZE) | |
| 134 | 134 | return AVERROR(EIO); |
| 135 | 135 | wsaud->audio_samplerate = AV_RL16(&header[0]); |
| 136 | 136 | if (header[11] == 99) |
| @@ -173,7 +173,7 @@ static int wsaud_read_packet(AVFormatContext *s, · 36 unmodified lines | ||
| 173 | 173 | unsigned int chunk_size; |
| 174 | 174 | int ret = 0; |
| 175 | 175 | |
| 176 | − if (get_buffer(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) != | |
| 176 | + if (avio_read(pb, preamble, AUD_CHUNK_PREAMBLE_SIZE) != | |
| 177 | 177 | AUD_CHUNK_PREAMBLE_SIZE) |
| 178 | 178 | return AVERROR(EIO); |
| 179 | 179 | |
| @@ -237,7 +237,7 @@ static int wsvqa_read_header(AVFormatContext *s, · 57 unmodified lines | ||
| 237 | 237 | st->codec->extradata_size = VQA_HEADER_SIZE; |
| 238 | 238 | st->codec->extradata = av_mallocz(VQA_HEADER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE); |
| 239 | 239 | 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) != | |
| 241 | 241 | VQA_HEADER_SIZE) { |
| 242 | 242 | av_free(st->codec->extradata); |
| 243 | 243 | return AVERROR(EIO); |
| @@ -277,7 +277,7 @@ static int wsvqa_read_header(AVFormatContext *s, · 33 unmodified lines | ||
| 277 | 277 | /* there are 0 or more chunks before the FINF chunk; iterate until |
| 278 | 278 | * FINF has been skipped and the file will be ready to be demuxed */ |
| 279 | 279 | 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) { | |
| 281 | 281 | av_free(st->codec->extradata); |
| 282 | 282 | return AVERROR(EIO); |
| 283 | 283 | } |
| @@ -320,7 +320,7 @@ static int wsvqa_read_packet(AVFormatContext *s, · 36 unmodified lines | ||
| 320 | 320 | unsigned int chunk_size; |
| 321 | 321 | int skip_byte; |
| 322 | 322 | |
| 323 | − while (get_buffer(pb, preamble, VQA_PREAMBLE_SIZE) == VQA_PREAMBLE_SIZE) { | |
| 323 | + while (avio_read(pb, preamble, VQA_PREAMBLE_SIZE) == VQA_PREAMBLE_SIZE) { | |
| 324 | 324 | chunk_type = AV_RB32(&preamble[0]); |
| 325 | 325 | chunk_size = AV_RB32(&preamble[4]); |
| 326 | 326 | skip_byte = chunk_size & 0x01; |
| @@ -329,7 +329,7 @@ static int wsvqa_read_packet(AVFormatContext *s, · 2 unmodified lines | ||
| 329 | 329 | |
| 330 | 330 | if (av_new_packet(pkt, chunk_size)) |
| 331 | 331 | return AVERROR(EIO); |
| 332 | − ret = get_buffer(pb, pkt->data, chunk_size); | |
| 332 | + ret = avio_read(pb, pkt->data, chunk_size); | |
| 333 | 333 | if (ret != chunk_size) { |
| 334 | 334 | av_free_packet(pkt); |
| 335 | 335 | return AVERROR(EIO); |
| @@ -88,7 +88,7 @@ static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size) · 87 unmodified lines | ||
| 88 | 88 | int remaining_in_sector = (1 << wf->sector_bits) - (wf->position & ((1 << wf->sector_bits) - 1)); |
| 89 | 89 | int read_request = FFMIN(buf_size - nread, remaining_in_sector); |
| 90 | 90 | |
| 91 | − n = get_buffer(pb, buf, read_request); | |
| 91 | + n = avio_read(pb, buf, read_request); | |
| 92 | 92 | if (n <= 0) |
| 93 | 93 | break; |
| 94 | 94 | nread += n; |
| @@ -140,7 +140,7 @@ static int read_ints(AVIOContext *pb, uint32_t *data, int count) · 45 unmodified lines | ||
| 140 | 140 | { |
| 141 | 141 | int i, total = 0; |
| 142 | 142 | for (i = 0; i < count; i++) { |
| 143 | − if ((data[total] = get_le32(pb))) | |
| 143 | + if ((data[total] = avio_rl32(pb))) | |
| 144 | 144 | total++; |
| 145 | 145 | } |
| 146 | 146 | return total; |
| @@ -474,9 +474,9 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) · 327 unmodified lines | ||
| 474 | 474 | if (strcmp(mime, "image/jpeg")) |
| 475 | 475 | goto done; |
| 476 | 476 | |
| 477 | − get_byte(pb); | |
| 477 | + avio_r8(pb); | |
| 478 | 478 | avio_get_str16le(pb, INT_MAX, description, sizeof(description)); |
| 479 | − filesize = get_le32(pb); | |
| 479 | + filesize = avio_rl32(pb); | |
| 480 | 480 | if (!filesize) |
| 481 | 481 | goto done; |
| 482 | 482 | |
| @@ -490,7 +490,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) · 7 unmodified lines | ||
| 490 | 490 | if (!st->codec->extradata) |
| 491 | 491 | goto done; |
| 492 | 492 | st->codec->extradata_size = filesize; |
| 493 | − get_buffer(pb, st->codec->extradata, filesize); | |
| 493 | + avio_read(pb, st->codec->extradata, filesize); | |
| 494 | 494 | done: |
| 495 | 495 | url_fseek(pb, pos + length, SEEK_SET); |
| 496 | 496 | } |
| @@ -503,7 +503,7 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty · 6 unmodified lines | ||
| 503 | 503 | return; |
| 504 | 504 | |
| 505 | 505 | if (type == 0 && length == 4) { |
| 506 | − snprintf(buf, buf_size, "%"PRIi32, get_le32(pb)); | |
| 506 | + snprintf(buf, buf_size, "%"PRIi32, avio_rl32(pb)); | |
| 507 | 507 | } else if (type == 1) { |
| 508 | 508 | avio_get_str16le(pb, length, buf, buf_size); |
| 509 | 509 | if (!strlen(buf)) { |
| @@ -511,9 +511,9 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty · 1 unmodified line | ||
| 511 | 511 | return; |
| 512 | 512 | } |
| 513 | 513 | } else if (type == 3 && length == 4) { |
| 514 | − strcpy(buf, get_le32(pb) ? "true" : "false"); | |
| 514 | + strcpy(buf, avio_rl32(pb) ? "true" : "false"); | |
| 515 | 515 | } else if (type == 4 && length == 8) { |
| 516 | − int64_t num = get_le64(pb); | |
| 516 | + int64_t num = avio_rl64(pb); | |
| 517 | 517 | if (!strcmp(key, "WM/EncodingTime") || |
| 518 | 518 | !strcmp(key, "WM/MediaOriginalBroadcastDateTime")) |
| 519 | 519 | 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 | ||
| 527 | 527 | else |
| 528 | 528 | snprintf(buf, buf_size, "%"PRIi64, num); |
| 529 | 529 | } else if (type == 5 && length == 2) { |
| 530 | − snprintf(buf, buf_size, "%"PRIi16, get_le16(pb)); | |
| 530 | + snprintf(buf, buf_size, "%"PRIi16, avio_rl16(pb)); | |
| 531 | 531 | } else if (type == 6 && length == 16) { |
| 532 | 532 | ff_asf_guid guid; |
| 533 | − get_buffer(pb, guid, 16); | |
| 533 | + avio_read(pb, guid, 16); | |
| 534 | 534 | snprintf(buf, buf_size, PRI_PRETTY_GUID, ARG_PRETTY_GUID(guid)); |
| 535 | 535 | } else if (type == 2 && !strcmp(key, "WM/Picture")) { |
| 536 | 536 | get_attachment(s, pb, length); |
| @@ -557,8 +557,8 @@ static void parse_legacy_attrib(AVFormatContext *s, AVIOContext *pb) · 20 unmodified lines | ||
| 557 | 557 | while(!url_feof(pb)) { |
| 558 | 558 | char key[1024]; |
| 559 | 559 | 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); | |
| 562 | 562 | if (!length) |
| 563 | 563 | break; |
| 564 | 564 | 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 | ||
| 775 | 775 | int len, sid, consumed; |
| 776 | 776 | |
| 777 | 777 | ff_get_guid(pb, &g); |
| 778 | − len = get_le32(pb); | |
| 778 | + len = avio_rl32(pb); | |
| 779 | 779 | if (len < 32) |
| 780 | 780 | break; |
| 781 | − sid = get_le32(pb) & 0x7FFF; | |
| 781 | + sid = avio_rl32(pb) & 0x7FFF; | |
| 782 | 782 | url_fskip(pb, 8); |
| 783 | 783 | consumed = 32; |
| 784 | 784 | |
| @@ -791,7 +791,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p · 6 unmodified lines | ||
| 791 | 791 | ff_get_guid(pb, &subtype); |
| 792 | 792 | url_fskip(pb, 12); |
| 793 | 793 | ff_get_guid(pb, &formattype); |
| 794 | − size = get_le32(pb); | |
| 794 | + size = avio_rl32(pb); | |
| 795 | 795 | parse_media_type(s, 0, sid, mediatype, subtype, formattype, size); |
| 796 | 796 | consumed += 92 + size; |
| 797 | 797 | } |
| @@ -805,7 +805,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p · 7 unmodified lines | ||
| 805 | 805 | ff_get_guid(pb, &subtype); |
| 806 | 806 | url_fskip(pb, 12); |
| 807 | 807 | ff_get_guid(pb, &formattype); |
| 808 | − size = get_le32(pb); | |
| 808 | + size = avio_rl32(pb); | |
| 809 | 809 | parse_media_type(s, s->streams[stream_index], sid, mediatype, subtype, formattype, size); |
| 810 | 810 | consumed += 76 + size; |
| 811 | 811 | } |
| @@ -831,7 +831,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p · 19 unmodified lines | ||
| 831 | 831 | } |
| 832 | 832 | |
| 833 | 833 | buf_size = FFMIN(len - consumed, sizeof(buf)); |
| 834 | − get_buffer(pb, buf, buf_size); | |
| 834 | + avio_read(pb, buf, buf_size); | |
| 835 | 835 | consumed += buf_size; |
| 836 | 836 | ff_parse_mpeg2_descriptor(s, st, 0, &pbuf, buf + buf_size, 0, 0, 0, 0); |
| 837 | 837 | } |
| @@ -841,7 +841,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p · 3 unmodified lines | ||
| 841 | 841 | AVStream *st = s->streams[stream_index]; |
| 842 | 842 | int audio_type; |
| 843 | 843 | url_fskip(pb, 8); |
| 844 | − audio_type = get_byte(pb); | |
| 844 | + audio_type = avio_r8(pb); | |
| 845 | 845 | if (audio_type == 2) |
| 846 | 846 | st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED; |
| 847 | 847 | 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 | ||
| 852 | 852 | int stream_index = ff_find_stream_index(s, sid); |
| 853 | 853 | if (stream_index >= 0) { |
| 854 | 854 | url_fskip(pb, 12); |
| 855 | − if (get_le32(pb)) | |
| 855 | + if (avio_rl32(pb)) | |
| 856 | 856 | av_log(s, AV_LOG_WARNING, "DVB scrambled stream detected (st:%d), decoding will likely fail\n", stream_index); |
| 857 | 857 | consumed += 16; |
| 858 | 858 | } |
| @@ -862,7 +862,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p · 3 unmodified lines | ||
| 862 | 862 | AVStream *st = s->streams[stream_index]; |
| 863 | 863 | uint8_t language[4]; |
| 864 | 864 | url_fskip(pb, 12); |
| 865 | − get_buffer(pb, language, 3); | |
| 865 | + avio_read(pb, language, 3); | |
| 866 | 866 | if (language[0]) { |
| 867 | 867 | language[3] = 0; |
| 868 | 868 | 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 | ||
| 875 | 875 | int stream_index = ff_find_stream_index(s, sid); |
| 876 | 876 | if (stream_index >= 0) { |
| 877 | 877 | url_fskip(pb, 8); |
| 878 | − wtv->pts = get_le64(pb); | |
| 878 | + wtv->pts = avio_rl64(pb); | |
| 879 | 879 | consumed += 16; |
| 880 | 880 | if (wtv->pts == -1) |
| 881 | 881 | wtv->pts = AV_NOPTS_VALUE; |
| @@ -955,16 +955,16 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 73 unmodified lines | ||
| 955 | 955 | |
| 956 | 956 | /* read root directory sector */ |
| 957 | 957 | url_fskip(s->pb, 0x30); |
| 958 | − root_size = get_le32(s->pb); | |
| 958 | + root_size = avio_rl32(s->pb); | |
| 959 | 959 | if (root_size > sizeof(root)) { |
| 960 | 960 | av_log(s, AV_LOG_ERROR, "root directory size exceeds sector size\n"); |
| 961 | 961 | return AVERROR_INVALIDDATA; |
| 962 | 962 | } |
| 963 | 963 | url_fskip(s->pb, 4); |
| 964 | − root_sector = get_le32(s->pb); | |
| 964 | + root_sector = avio_rl32(s->pb); | |
| 965 | 965 | |
| 966 | 966 | 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); | |
| 968 | 968 | if (root_size < 0) |
| 969 | 969 | return AVERROR_INVALIDDATA; |
| 970 | 970 | |
| @@ -995,8 +995,8 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) · 24 unmodified lines | ||
| 995 | 995 | pb = wtvfile_open(s, root, root_size, table_0_entries_time_le16); |
| 996 | 996 | if (pb) { |
| 997 | 997 | 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); | |
| 1000 | 1000 | if (url_feof(pb)) |
| 1001 | 1001 | break; |
| 1002 | 1002 | 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 | ||
| 1009 | 1009 | if (pb) { |
| 1010 | 1010 | int i; |
| 1011 | 1011 | 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); | |
| 1014 | 1014 | if (url_feof(pb)) |
| 1015 | 1015 | break; |
| 1016 | 1016 | for (i = wtv->nb_index_entries - 1; i >= 0; i--) { |
| @@ -86,25 +86,25 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen · 85 unmodified lines | ||
| 86 | 86 | |
| 87 | 87 | wc->pos = url_ftell(pb); |
| 88 | 88 | if(!append){ |
| 89 | − tag = get_le32(pb); | |
| 89 | + tag = avio_rl32(pb); | |
| 90 | 90 | if (tag != MKTAG('w', 'v', 'p', 'k')) |
| 91 | 91 | return -1; |
| 92 | − size = get_le32(pb); | |
| 92 | + size = avio_rl32(pb); | |
| 93 | 93 | if(size < 24 || size > WV_BLOCK_LIMIT){ |
| 94 | 94 | av_log(ctx, AV_LOG_ERROR, "Incorrect block size %i\n", size); |
| 95 | 95 | return -1; |
| 96 | 96 | } |
| 97 | 97 | wc->blksize = size; |
| 98 | − ver = get_le16(pb); | |
| 98 | + ver = avio_rl16(pb); | |
| 99 | 99 | if(ver < 0x402 || ver > 0x410){ |
| 100 | 100 | av_log(ctx, AV_LOG_ERROR, "Unsupported version %03X\n", ver); |
| 101 | 101 | return -1; |
| 102 | 102 | } |
| 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); | |
| 108 | 108 | }else{ |
| 109 | 109 | size = wc->blksize; |
| 110 | 110 | } |
| @@ -127,8 +127,8 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen · 16 unmodified lines | ||
| 127 | 127 | } |
| 128 | 128 | while(url_ftell(pb) < block_end){ |
| 129 | 129 | 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); | |
| 132 | 132 | size <<= 1; |
| 133 | 133 | if(id&0x40) |
| 134 | 134 | size--; |
| @@ -138,24 +138,24 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen · 3 unmodified lines | ||
| 138 | 138 | av_log(ctx, AV_LOG_ERROR, "Insufficient channel information\n"); |
| 139 | 139 | return -1; |
| 140 | 140 | } |
| 141 | − chan = get_byte(pb); | |
| 141 | + chan = avio_r8(pb); | |
| 142 | 142 | switch(size - 2){ |
| 143 | 143 | case 0: |
| 144 | − chmask = get_byte(pb); | |
| 144 | + chmask = avio_r8(pb); | |
| 145 | 145 | break; |
| 146 | 146 | case 1: |
| 147 | − chmask = get_le16(pb); | |
| 147 | + chmask = avio_rl16(pb); | |
| 148 | 148 | break; |
| 149 | 149 | case 2: |
| 150 | − chmask = get_le24(pb); | |
| 150 | + chmask = avio_rl24(pb); | |
| 151 | 151 | break; |
| 152 | 152 | case 3: |
| 153 | − chmask = get_le32(pb); | |
| 153 | + chmask = avio_rl32(pb); | |
| 154 | 154 | break; |
| 155 | 155 | case 5: |
| 156 | 156 | 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); | |
| 159 | 159 | break; |
| 160 | 160 | default: |
| 161 | 161 | 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 | ||
| 163 | 163 | } |
| 164 | 164 | break; |
| 165 | 165 | case 0x27: |
| 166 | − rate = get_le24(pb); | |
| 166 | + rate = avio_rl24(pb); | |
| 167 | 167 | break; |
| 168 | 168 | default: |
| 169 | 169 | url_fskip(pb, size); |
| @@ -254,13 +254,13 @@ static int wv_read_packet(AVFormatContext *s, · 84 unmodified lines | ||
| 254 | 254 | if(wc->multichannel) |
| 255 | 255 | AV_WL32(pkt->data, wc->blksize + WV_EXTRA_SIZE + 12); |
| 256 | 256 | 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); | |
| 258 | 258 | if(ret != wc->blksize){ |
| 259 | 259 | av_free_packet(pkt); |
| 260 | 260 | return AVERROR(EIO); |
| 261 | 261 | } |
| 262 | 262 | 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')){ | |
| 264 | 264 | av_free_packet(pkt); |
| 265 | 265 | return -1; |
| 266 | 266 | } |
| @@ -275,16 +275,16 @@ static int wv_read_packet(AVFormatContext *s, · 8 unmodified lines | ||
| 275 | 275 | return -1; |
| 276 | 276 | } |
| 277 | 277 | wc->blksize = size; |
| 278 | − ver = get_le16(s->pb); | |
| 278 | + ver = avio_rl16(s->pb); | |
| 279 | 279 | if(ver < 0x402 || ver > 0x410){ |
| 280 | 280 | av_free_packet(pkt); |
| 281 | 281 | av_log(s, AV_LOG_ERROR, "Unsupported version %03X\n", ver); |
| 282 | 282 | return -1; |
| 283 | 283 | } |
| 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 | |
| 288 | 288 | if((ret = av_append_packet(s->pb, pkt, WV_EXTRA_SIZE)) < 0){ |
| 289 | 289 | av_free_packet(pkt); |
| 290 | 290 | return ret; |
| @@ -77,14 +77,14 @@ static int xa_read_header(AVFormatContext *s, · 76 unmodified lines | ||
| 77 | 77 | st->codec->codec_type = AVMEDIA_TYPE_AUDIO; |
| 78 | 78 | st->codec->codec_id = CODEC_ID_ADPCM_EA_MAXIS_XA; |
| 79 | 79 | url_fskip(pb, 4); /* Skip the XA ID */ |
| 80 | − xa->out_size = get_le32(pb); | |
| 80 | + xa->out_size = avio_rl32(pb); | |
| 81 | 81 | 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); | |
| 84 | 84 | /* 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); | |
| 88 | 88 | |
| 89 | 89 | av_set_pts_info(st, 64, 1, st->codec->sample_rate); |
| 90 | 90 | |
| @@ -83,14 +83,14 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) · 82 unmodified lines | ||
| 83 | 83 | |
| 84 | 84 | url_fskip(pb, 6); |
| 85 | 85 | |
| 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); | |
| 90 | 90 | |
| 91 | 91 | video_stream->sample_aspect_ratio = (AVRational){1, 2}; |
| 92 | 92 | |
| 93 | − ret = get_buffer(pb, video_dec->extradata, 8); | |
| 93 | + ret = avio_read(pb, video_dec->extradata, 8); | |
| 94 | 94 | if (ret < 8) |
| 95 | 95 | return ret < 0 ? ret : AVERROR_EOF; |
| 96 | 96 | |
| @@ -138,7 +138,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt) · 41 unmodified lines | ||
| 138 | 138 | |
| 139 | 139 | yop->video_packet.pos = url_ftell(pb); |
| 140 | 140 | |
| 141 | − ret = get_buffer(pb, yop->video_packet.data, yop->palette_size); | |
| 141 | + ret = avio_read(pb, yop->video_packet.data, yop->palette_size); | |
| 142 | 142 | if (ret < 0) { |
| 143 | 143 | goto err_out; |
| 144 | 144 | }else if (ret < yop->palette_size) { |
| @@ -155,7 +155,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt) · 10 unmodified lines | ||
| 155 | 155 | |
| 156 | 156 | url_fskip(pb, yop->audio_block_length - ret); |
| 157 | 157 | |
| 158 | − ret = get_buffer(pb, yop->video_packet.data + yop->palette_size, | |
| 158 | + ret = avio_read(pb, yop->video_packet.data + yop->palette_size, | |
| 159 | 159 | actual_video_data_size); |
| 160 | 160 | if (ret < 0) |
| 161 | 161 | goto err_out; |
| @@ -200,7 +200,7 @@ static int yuv4_read_header(AVFormatContext *s, AVFormatParameters *ap) · 199 unmodified lines | ||
| 200 | 200 | struct frame_attributes *s1 = s->priv_data; |
| 201 | 201 | |
| 202 | 202 | for (i=0; i<MAX_YUV4_HEADER; i++) { |
| 203 | − header[i] = get_byte(pb); | |
| 203 | + header[i] = avio_r8(pb); | |
| 204 | 204 | if (header[i] == '\n') { |
| 205 | 205 | header[i+1] = 0x20; // Add a space after last option. Makes parsing "444" vs "444alpha" easier. |
| 206 | 206 | header[i+2] = 0; |
| @@ -352,7 +352,7 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt) · 145 unmodified lines | ||
| 352 | 352 | struct frame_attributes *s1 = s->priv_data; |
| 353 | 353 | |
| 354 | 354 | for (i=0; i<MAX_FRAME_HEADER; i++) { |
| 355 | − header[i] = get_byte(s->pb); | |
| 355 | + header[i] = avio_r8(s->pb); | |
| 356 | 356 | if (header[i] == '\n') { |
| 357 | 357 | header[i+1] = 0; |
| 358 | 358 | break; |