Commit b7effd4e authored by Anton Khirnov's avatar Anton Khirnov Committed by Ronald S. Bultje

avio: avio_ prefixes for get_* functions

In the name of consistency:
get_byte           -> avio_r8
get_<type>         -> avio_r<type>
get_buffer         -> avio_read

get_partial_buffer will be made private later

get_strz is left out becase I want to change it later to return
something useful.
Signed-off-by: default avatarRonald S. Bultje <rsbultje@gmail.com>
parent f8bed30d
......@@ -54,11 +54,11 @@
#define strk_SIZE 0x28
#define GET_LIST_HEADER() \
fourcc_tag = get_le32(pb); \
size = get_le32(pb); \
fourcc_tag = avio_rl32(pb); \
size = avio_rl32(pb); \
if (fourcc_tag != LIST_TAG) \
return AVERROR_INVALIDDATA; \
fourcc_tag = get_le32(pb);
fourcc_tag = avio_rl32(pb);
typedef struct AudioTrack {
int sample_rate;
......@@ -118,7 +118,7 @@ static int fourxm_read_header(AVFormatContext *s,
header = av_malloc(header_size);
if (!header)
return AVERROR(ENOMEM);
if (get_buffer(pb, header, header_size) != header_size){
if (avio_read(pb, header, header_size) != header_size){
av_free(header);
return AVERROR(EIO);
}
......@@ -255,7 +255,7 @@ static int fourxm_read_packet(AVFormatContext *s,
while (!packet_read) {
if ((ret = get_buffer(s->pb, header, 8)) < 0)
if ((ret = avio_read(s->pb, header, 8)) < 0)
return ret;
fourcc_tag = AV_RL32(&header[0]);
size = AV_RL32(&header[4]);
......@@ -268,7 +268,7 @@ static int fourxm_read_packet(AVFormatContext *s,
fourxm->video_pts ++;
/* skip the LIST-* tag and move on to the next fourcc */
get_le32(pb);
avio_rl32(pb);
break;
case ifrm_TAG:
......@@ -285,7 +285,7 @@ static int fourxm_read_packet(AVFormatContext *s,
pkt->pts = fourxm->video_pts;
pkt->pos = url_ftell(s->pb);
memcpy(pkt->data, header, 8);
ret = get_buffer(s->pb, &pkt->data[8], size);
ret = avio_read(s->pb, &pkt->data[8], size);
if (ret < 0){
av_free_packet(pkt);
......@@ -294,8 +294,8 @@ static int fourxm_read_packet(AVFormatContext *s,
break;
case snd__TAG:
track_number = get_le32(pb);
out_size= get_le32(pb);
track_number = avio_rl32(pb);
out_size= avio_rl32(pb);
size-=8;
if (track_number < fourxm->track_count && fourxm->tracks[track_number].channels>0) {
......
......@@ -63,7 +63,7 @@ static int aea_read_header(AVFormatContext *s,
/* Parse the amount of channels and skip to pos 2048(0x800) */
url_fskip(s->pb, 264);
st->codec->channels = get_byte(s->pb);
st->codec->channels = avio_r8(s->pb);
url_fskip(s->pb, 1783);
......
......@@ -54,8 +54,8 @@ static int get_tag(AVIOContext *pb, uint32_t * tag)
if (url_feof(pb))
return AVERROR(EIO);
*tag = get_le32(pb);
size = get_be32(pb);
*tag = avio_rl32(pb);
size = avio_rb32(pb);
if (size < 0)
size = 0x7fffffff;
......@@ -74,7 +74,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size)
return;
}
res = get_buffer(s->pb, str, size);
res = avio_read(s->pb, str, size);
if (res < 0)
return;
......@@ -93,18 +93,18 @@ static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec,
if (size & 1)
size++;
codec->codec_type = AVMEDIA_TYPE_AUDIO;
codec->channels = get_be16(pb);
num_frames = get_be32(pb);
codec->bits_per_coded_sample = get_be16(pb);
codec->channels = avio_rb16(pb);
num_frames = avio_rb32(pb);
codec->bits_per_coded_sample = avio_rb16(pb);
get_buffer(pb, (uint8_t*)&ext, sizeof(ext));/* Sample rate is in */
avio_read(pb, (uint8_t*)&ext, sizeof(ext));/* Sample rate is in */
sample_rate = av_ext2dbl(ext); /* 80 bits BE IEEE extended float */
codec->sample_rate = sample_rate;
size -= 18;
/* Got an AIFF-C? */
if (version == AIFF_C_VERSION1) {
codec->codec_tag = get_le32(pb);
codec->codec_tag = avio_rl32(pb);
codec->codec_id = ff_codec_get_id(ff_codec_aiff_tags, codec->codec_tag);
switch (codec->codec_id) {
......@@ -187,7 +187,7 @@ static int aiff_read_header(AVFormatContext *s,
return AVERROR_INVALIDDATA;
/* AIFF data type */
tag = get_le32(pb);
tag = avio_rl32(pb);
if (tag == MKTAG('A', 'I', 'F', 'F')) /* Got an AIFF file */
version = AIFF;
else if (tag != MKTAG('A', 'I', 'F', 'C')) /* An AIFF-C file then */
......@@ -217,7 +217,7 @@ static int aiff_read_header(AVFormatContext *s,
goto got_sound;
break;
case MKTAG('F', 'V', 'E', 'R'): /* Version chunk */
version = get_be32(pb);
version = avio_rb32(pb);
break;
case MKTAG('N', 'A', 'M', 'E'): /* Sample name chunk */
get_meta(s, "title" , size);
......@@ -233,8 +233,8 @@ static int aiff_read_header(AVFormatContext *s,
break;
case MKTAG('S', 'S', 'N', 'D'): /* Sampled sound chunk */
aiff->data_end = url_ftell(pb) + size;
offset = get_be32(pb); /* Offset of sound data */
get_be32(pb); /* BlockSize... don't care */
offset = avio_rb32(pb); /* Offset of sound data */
avio_rb32(pb); /* BlockSize... don't care */
offset += url_ftell(pb); /* Compute absolute data offset */
if (st->codec->block_align) /* Assume COMM already parsed */
goto got_sound;
......@@ -251,7 +251,7 @@ static int aiff_read_header(AVFormatContext *s,
if (!st->codec->extradata)
return AVERROR(ENOMEM);
st->codec->extradata_size = size;
get_buffer(pb, st->codec->extradata, size);
avio_read(pb, st->codec->extradata, size);
break;
default: /* Jump */
if (size & 1) /* Always even aligned */
......
......@@ -82,7 +82,7 @@ static int amr_read_header(AVFormatContext *s,
AVStream *st;
uint8_t header[9];
get_buffer(pb, header, 6);
avio_read(pb, header, 6);
st = av_new_stream(s, 0);
if (!st)
......@@ -91,7 +91,7 @@ static int amr_read_header(AVFormatContext *s,
}
if(memcmp(header,AMR_header,6)!=0)
{
get_buffer(pb, header+6, 3);
avio_read(pb, header+6, 3);
if(memcmp(header,AMRWB_header,9)!=0)
{
return -1;
......@@ -128,7 +128,7 @@ static int amr_read_packet(AVFormatContext *s,
}
//FIXME this is wrong, this should rather be in a AVParset
toc=get_byte(s->pb);
toc=avio_r8(s->pb);
mode = (toc >> 3) & 0x0F;
if (enc->codec_id == CODEC_ID_AMR_NB)
......@@ -157,7 +157,7 @@ static int amr_read_packet(AVFormatContext *s,
pkt->pos= url_ftell(s->pb);
pkt->data[0]=toc;
pkt->duration= enc->codec_id == CODEC_ID_AMR_NB ? 160 : 320;
read = get_buffer(s->pb, pkt->data+1, size-1);
read = avio_read(s->pb, pkt->data+1, size-1);
if (read != size-1)
{
......
......@@ -84,16 +84,16 @@ static int read_header(AVFormatContext *s,
int i, ret;
url_fskip(pb, 4); /* magic number */
if (get_le16(pb) != MAX_PAGES) {
if (avio_rl16(pb) != MAX_PAGES) {
av_log_ask_for_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES) "\n");
return AVERROR_INVALIDDATA;
}
anm->nb_pages = get_le16(pb);
anm->nb_records = get_le32(pb);
anm->nb_pages = avio_rl16(pb);
anm->nb_records = avio_rl32(pb);
url_fskip(pb, 2); /* max records per page */
anm->page_table_offset = get_le16(pb);
if (get_le32(pb) != ANIM_TAG)
anm->page_table_offset = avio_rl16(pb);
if (avio_rl32(pb) != ANIM_TAG)
return AVERROR_INVALIDDATA;
/* video stream */
......@@ -103,32 +103,32 @@ static int read_header(AVFormatContext *s,
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_ANM;
st->codec->codec_tag = 0; /* no fourcc */
st->codec->width = get_le16(pb);
st->codec->height = get_le16(pb);
if (get_byte(pb) != 0)
st->codec->width = avio_rl16(pb);
st->codec->height = avio_rl16(pb);
if (avio_r8(pb) != 0)
goto invalid;
url_fskip(pb, 1); /* frame rate multiplier info */
/* ignore last delta record (used for looping) */
if (get_byte(pb)) /* has_last_delta */
if (avio_r8(pb)) /* has_last_delta */
anm->nb_records = FFMAX(anm->nb_records - 1, 0);
url_fskip(pb, 1); /* last_delta_valid */
if (get_byte(pb) != 0)
if (avio_r8(pb) != 0)
goto invalid;
if (get_byte(pb) != 1)
if (avio_r8(pb) != 1)
goto invalid;
url_fskip(pb, 1); /* other recs per frame */
if (get_byte(pb) != 1)
if (avio_r8(pb) != 1)
goto invalid;
url_fskip(pb, 32); /* record_types */
st->nb_frames = get_le32(pb);
av_set_pts_info(st, 64, 1, get_le16(pb));
st->nb_frames = avio_rl32(pb);
av_set_pts_info(st, 64, 1, avio_rl16(pb));
url_fskip(pb, 58);
/* color cycling and palette data */
......@@ -138,7 +138,7 @@ static int read_header(AVFormatContext *s,
ret = AVERROR(ENOMEM);
goto close_and_return;
}
ret = get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
ret = avio_read(pb, st->codec->extradata, st->codec->extradata_size);
if (ret < 0)
goto close_and_return;
......@@ -149,9 +149,9 @@ static int read_header(AVFormatContext *s,
for (i = 0; i < MAX_PAGES; i++) {
Page *p = &anm->pt[i];
p->base_record = get_le16(pb);
p->nb_records = get_le16(pb);
p->size = get_le16(pb);
p->base_record = avio_rl16(pb);
p->nb_records = avio_rl16(pb);
p->size = avio_rl16(pb);
}
/* find page of first frame */
......@@ -211,7 +211,7 @@ repeat:
tmp = url_ftell(pb);
url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) +
8 + anm->record * 2, SEEK_SET);
record_size = get_le16(pb);
record_size = avio_rl16(pb);
url_fseek(pb, tmp, SEEK_SET);
/* fetch record */
......
......@@ -35,9 +35,9 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
AVIOContext *pb = s->pb;
AVStream *st;
get_le32(pb); /* CRYO */
get_le32(pb); /* _APC */
get_le32(pb); /* 1.20 */
avio_rl32(pb); /* CRYO */
avio_rl32(pb); /* _APC */
avio_rl32(pb); /* 1.20 */
st = av_new_stream(s, 0);
if (!st)
......@@ -46,8 +46,8 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_ADPCM_IMA_WS;
get_le32(pb); /* number of samples */
st->codec->sample_rate = get_le32(pb);
avio_rl32(pb); /* number of samples */
st->codec->sample_rate = avio_rl32(pb);
st->codec->extradata_size = 2 * 4;
st->codec->extradata = av_malloc(st->codec->extradata_size +
......@@ -56,10 +56,10 @@ static int apc_read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR(ENOMEM);
/* initial predictor values for adpcm decoder */
get_buffer(pb, st->codec->extradata, 2 * 4);
avio_read(pb, st->codec->extradata, 2 * 4);
st->codec->channels = 1;
if (get_le32(pb))
if (avio_rl32(pb))
st->codec->channels = 2;
st->codec->bits_per_coded_sample = 4;
......
......@@ -162,11 +162,11 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
/* TODO: Skip any leading junk such as id3v2 tags */
ape->junklength = 0;
tag = get_le32(pb);
tag = avio_rl32(pb);
if (tag != MKTAG('M', 'A', 'C', ' '))
return -1;
ape->fileversion = get_le16(pb);
ape->fileversion = avio_rl16(pb);
if (ape->fileversion < APE_MIN_VERSION || ape->fileversion > APE_MAX_VERSION) {
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)
}
if (ape->fileversion >= 3980) {
ape->padding1 = get_le16(pb);
ape->descriptorlength = get_le32(pb);
ape->headerlength = get_le32(pb);
ape->seektablelength = get_le32(pb);
ape->wavheaderlength = get_le32(pb);
ape->audiodatalength = get_le32(pb);
ape->audiodatalength_high = get_le32(pb);
ape->wavtaillength = get_le32(pb);
get_buffer(pb, ape->md5, 16);
ape->padding1 = avio_rl16(pb);
ape->descriptorlength = avio_rl32(pb);
ape->headerlength = avio_rl32(pb);
ape->seektablelength = avio_rl32(pb);
ape->wavheaderlength = avio_rl32(pb);
ape->audiodatalength = avio_rl32(pb);
ape->audiodatalength_high = avio_rl32(pb);
ape->wavtaillength = avio_rl32(pb);
avio_read(pb, ape->md5, 16);
/* Skip any unknown bytes at the end of the descriptor.
This is for future compatibility */
......@@ -190,26 +190,26 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
url_fseek(pb, ape->descriptorlength - 52, SEEK_CUR);
/* Read header data */
ape->compressiontype = get_le16(pb);
ape->formatflags = get_le16(pb);
ape->blocksperframe = get_le32(pb);
ape->finalframeblocks = get_le32(pb);
ape->totalframes = get_le32(pb);
ape->bps = get_le16(pb);
ape->channels = get_le16(pb);
ape->samplerate = get_le32(pb);
ape->compressiontype = avio_rl16(pb);
ape->formatflags = avio_rl16(pb);
ape->blocksperframe = avio_rl32(pb);
ape->finalframeblocks = avio_rl32(pb);
ape->totalframes = avio_rl32(pb);
ape->bps = avio_rl16(pb);
ape->channels = avio_rl16(pb);
ape->samplerate = avio_rl32(pb);
} else {
ape->descriptorlength = 0;
ape->headerlength = 32;
ape->compressiontype = get_le16(pb);
ape->formatflags = get_le16(pb);
ape->channels = get_le16(pb);
ape->samplerate = get_le32(pb);
ape->wavheaderlength = get_le32(pb);
ape->wavtaillength = get_le32(pb);
ape->totalframes = get_le32(pb);
ape->finalframeblocks = get_le32(pb);
ape->compressiontype = avio_rl16(pb);
ape->formatflags = avio_rl16(pb);
ape->channels = avio_rl16(pb);
ape->samplerate = avio_rl32(pb);
ape->wavheaderlength = avio_rl32(pb);
ape->wavtaillength = avio_rl32(pb);
ape->totalframes = avio_rl32(pb);
ape->finalframeblocks = avio_rl32(pb);
if (ape->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) {
url_fseek(pb, 4, SEEK_CUR); /* Skip the peak level */
......@@ -217,7 +217,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
}
if (ape->formatflags & MAC_FORMAT_FLAG_HAS_SEEK_ELEMENTS) {
ape->seektablelength = get_le32(pb);
ape->seektablelength = avio_rl32(pb);
ape->headerlength += 4;
ape->seektablelength *= sizeof(int32_t);
} else
......@@ -260,7 +260,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
if (ape->seektablelength > 0) {
ape->seektable = av_malloc(ape->seektablelength);
for (i = 0; i < ape->seektablelength / sizeof(uint32_t); i++)
ape->seektable[i] = get_le32(pb);
ape->seektable[i] = avio_rl32(pb);
}
ape->frames[0].pos = ape->firstframe;
......@@ -355,7 +355,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
AV_WL32(pkt->data , nblocks);
AV_WL32(pkt->data + 4, ape->frames[ape->currentframe].skip);
ret = get_buffer(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
ret = avio_read(s->pb, pkt->data + extra_size, ape->frames[ape->currentframe].size);
pkt->pts = ape->frames[ape->currentframe].pts;
pkt->stream_index = 0;
......
......@@ -38,10 +38,10 @@ static int ape_tag_read_field(AVFormatContext *s)
uint32_t size, flags;
int i, c;
size = get_le32(pb); /* field size */
flags = get_le32(pb); /* field flags */
size = avio_rl32(pb); /* field size */
flags = avio_rl32(pb); /* field flags */
for (i = 0; i < sizeof(key) - 1; i++) {
c = get_byte(pb);
c = avio_r8(pb);
if (c < 0x20 || c > 0x7E)
break;
else
......@@ -57,7 +57,7 @@ static int ape_tag_read_field(AVFormatContext *s)
value = av_malloc(size+1);
if (!value)
return AVERROR(ENOMEM);
get_buffer(pb, value, size);
avio_read(pb, value, size);
value[size] = 0;
av_metadata_set2(&s->metadata, key, value, AV_METADATA_DONT_STRDUP_VAL);
return 0;
......@@ -76,30 +76,30 @@ void ff_ape_parse_tag(AVFormatContext *s)
url_fseek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET);
get_buffer(pb, buf, 8); /* APETAGEX */
avio_read(pb, buf, 8); /* APETAGEX */
if (strncmp(buf, "APETAGEX", 8)) {
return;
}
val = get_le32(pb); /* APE tag version */
val = avio_rl32(pb); /* APE tag version */
if (val > APE_TAG_VERSION) {
av_log(s, AV_LOG_ERROR, "Unsupported tag version. (>=%d)\n", APE_TAG_VERSION);
return;
}
tag_bytes = get_le32(pb); /* tag size */
tag_bytes = avio_rl32(pb); /* tag size */
if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) {
av_log(s, AV_LOG_ERROR, "Tag size is way too big\n");
return;
}
fields = get_le32(pb); /* number of fields */
fields = avio_rl32(pb); /* number of fields */
if (fields > 65536) {
av_log(s, AV_LOG_ERROR, "Too many tag fields (%d)\n", fields);
return;
}
val = get_le32(pb); /* flags */
val = avio_rl32(pb); /* flags */
if (val & APE_TAG_FLAG_IS_HEADER) {
av_log(s, AV_LOG_ERROR, "APE Tag is a header\n");
return;
......
......@@ -135,7 +135,7 @@ static void print_guid(const ff_asf_guid *g)
void ff_get_guid(AVIOContext *s, ff_asf_guid *g)
{
assert(sizeof(*g) == 16);
get_buffer(s, *g, sizeof(*g));
avio_read(s, *g, sizeof(*g));
}
static int asf_probe(AVProbeData *pd)
......@@ -149,10 +149,10 @@ static int asf_probe(AVProbeData *pd)
static int get_value(AVIOContext *pb, int type){
switch(type){
case 2: return get_le32(pb);
case 3: return get_le32(pb);
case 4: return get_le64(pb);
case 5: return get_le16(pb);
case 2: return avio_rl32(pb);
case 3: return avio_rl32(pb);
case 4: return avio_rl64(pb);
case 5: return avio_rl16(pb);
default:return INT_MIN;
}
}
......@@ -191,17 +191,17 @@ static int asf_read_file_properties(AVFormatContext *s, int64_t size)
AVIOContext *pb = s->pb;
ff_get_guid(pb, &asf->hdr.guid);
asf->hdr.file_size = get_le64(pb);
asf->hdr.create_time = get_le64(pb);
get_le64(pb); /* number of packets */
asf->hdr.play_time = get_le64(pb);
asf->hdr.send_time = get_le64(pb);
asf->hdr.preroll = get_le32(pb);
asf->hdr.ignore = get_le32(pb);
asf->hdr.flags = get_le32(pb);
asf->hdr.min_pktsize = get_le32(pb);
asf->hdr.max_pktsize = get_le32(pb);
asf->hdr.max_bitrate = get_le32(pb);
asf->hdr.file_size = avio_rl64(pb);
asf->hdr.create_time = avio_rl64(pb);
avio_rl64(pb); /* number of packets */
asf->hdr.play_time = avio_rl64(pb);
asf->hdr.send_time = avio_rl64(pb);
asf->hdr.preroll = avio_rl32(pb);
asf->hdr.ignore = avio_rl32(pb);
asf->hdr.flags = avio_rl32(pb);
asf->hdr.min_pktsize = avio_rl32(pb);
asf->hdr.max_pktsize = avio_rl32(pb);
asf->hdr.max_bitrate = avio_rl32(pb);
s->packet_size = asf->hdr.max_pktsize;
return 0;
......@@ -263,14 +263,14 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
return -1;
}
ff_get_guid(pb, &g);
total_size = get_le64(pb);
type_specific_size = get_le32(pb);
get_le32(pb);
st->id = get_le16(pb) & 0x7f; /* stream id */
total_size = avio_rl64(pb);
type_specific_size = avio_rl32(pb);
avio_rl32(pb);
st->id = avio_rl16(pb) & 0x7f; /* stream id */
// mapping of asf ID to AV stream ID;
asf->asfid2avid[st->id] = s->nb_streams - 1;
get_le32(pb);
avio_rl32(pb);
if (test_for_ext_stream_audio) {
ff_get_guid(pb, &g);
......@@ -278,11 +278,11 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
type = AVMEDIA_TYPE_AUDIO;
is_dvr_ms_audio=1;
ff_get_guid(pb, &g);
get_le32(pb);
get_le32(pb);
get_le32(pb);
avio_rl32(pb);
avio_rl32(pb);
avio_rl32(pb);
ff_get_guid(pb, &g);
get_le32(pb);
avio_rl32(pb);
}
}
......@@ -303,11 +303,11 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
/* We have to init the frame size at some point .... */
pos2 = url_ftell(pb);
if (size >= (pos2 + 8 - pos1 + 24)) {
asf_st->ds_span = get_byte(pb);
asf_st->ds_packet_size = get_le16(pb);
asf_st->ds_chunk_size = get_le16(pb);
get_le16(pb); //ds_data_size
get_byte(pb); //ds_silence_data
asf_st->ds_span = avio_r8(pb);
asf_st->ds_packet_size = avio_rl16(pb);
asf_st->ds_chunk_size = avio_rl16(pb);
avio_rl16(pb); //ds_data_size
avio_r8(pb); //ds_silence_data
}
//printf("Descrambling: ps:%d cs:%d ds:%d s:%d sd:%d\n",
// 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)
}
} else if (type == AVMEDIA_TYPE_VIDEO &&
size - (url_ftell(pb) - pos1 + 24) >= 51) {
get_le32(pb);
get_le32(pb);
get_byte(pb);
get_le16(pb); /* size */
sizeX= get_le32(pb); /* size */
st->codec->width = get_le32(pb);
st->codec->height = get_le32(pb);
avio_rl32(pb);
avio_rl32(pb);
avio_r8(pb);
avio_rl16(pb); /* size */
sizeX= avio_rl32(pb); /* size */
st->codec->width = avio_rl32(pb);
st->codec->height = avio_rl32(pb);
/* not available for asf */
get_le16(pb); /* panes */
st->codec->bits_per_coded_sample = get_le16(pb); /* depth */
tag1 = get_le32(pb);
avio_rl16(pb); /* panes */
st->codec->bits_per_coded_sample = avio_rl16(pb); /* depth */
tag1 = avio_rl32(pb);
url_fskip(pb, 20);
// av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX);
if (sizeX > 40) {
st->codec->extradata_size = sizeX - 40;
st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
get_buffer(pb, st->codec->extradata, st->codec->extradata_size);
avio_read(pb, st->codec->extradata, st->codec->extradata_size);
}
/* Extract palette from extradata if bpp <= 8 */
......@@ -402,39 +402,39 @@ static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size)
uint32_t ext_d, leak_rate, stream_num;
unsigned int stream_languageid_index;
get_le64(pb); // starttime
get_le64(pb); // endtime
leak_rate = get_le32(pb); // leak-datarate
get_le32(pb); // bucket-datasize
get_le32(pb); // init-bucket-fullness
get_le32(pb); // alt-leak-datarate
get_le32(pb); // alt-bucket-datasize
get_le32(pb); // alt-init-bucket-fullness
get_le32(pb); // max-object-size
get_le32(pb); // flags (reliable,seekable,no_cleanpoints?,resend-live-cleanpoints, rest of bits reserved)
stream_num = get_le16(pb); // stream-num
stream_languageid_index = get_le16(pb); // stream-language-id-index
avio_rl64(pb); // starttime
avio_rl64(pb); // endtime
leak_rate = avio_rl32(pb); // leak-datarate
avio_rl32(pb); // bucket-datasize
avio_rl32(pb); // init-bucket-fullness
avio_rl32(pb); // alt-leak-datarate
avio_rl32(pb); // alt-bucket-datasize
avio_rl32(pb); // alt-init-bucket-fullness
avio_rl32(pb); // max-object-size
avio_rl32(pb); // flags (reliable,seekable,no_cleanpoints?,resend-live-cleanpoints, rest of bits reserved)
stream_num = avio_rl16(pb); // stream-num
stream_languageid_index = avio_rl16(pb); // stream-language-id-index
if (stream_num < 128)
asf->streams[stream_num].stream_language_index = stream_languageid_index;
get_le64(pb); // avg frametime in 100ns units
stream_ct = get_le16(pb); //stream-name-count
payload_ext_ct = get_le16(pb); //payload-extension-system-count
avio_rl64(pb); // avg frametime in 100ns units
stream_ct = avio_rl16(pb); //stream-name-count
payload_ext_ct = avio_rl16(pb); //payload-extension-system-count
if (stream_num < 128)
asf->stream_bitrates[stream_num] = leak_rate;
for (i=0; i<stream_ct; i++){
get_le16(pb);
ext_len = get_le16(pb);
avio_rl16(pb);
ext_len = avio_rl16(pb);
url_fseek(pb, ext_len, SEEK_CUR);
}
for (i=0; i<payload_ext_ct; i++){
ff_get_guid(pb, &g);
ext_d=get_le16(pb);
ext_len=get_le32(pb);
ext_d=avio_rl16(pb);