Skip to content

Commit

Permalink
avio: avio_ prefix for url_fseek
Browse files Browse the repository at this point in the history
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
  • Loading branch information
elenril authored and rbultje committed Mar 1, 2011
1 parent 76d8846 commit 6b4aa5d
Show file tree
Hide file tree
Showing 90 changed files with 352 additions and 347 deletions.
6 changes: 3 additions & 3 deletions libavformat/4xm.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ static int fourxm_read_header(AVFormatContext *s,
fourxm->fps = 1.0;

/* skip the first 3 32-bit numbers */
url_fseek(pb, 12, SEEK_CUR);
avio_seek(pb, 12, SEEK_CUR);

/* check for LIST-HEAD */
GET_LIST_HEADER();
Expand Down Expand Up @@ -322,12 +322,12 @@ static int fourxm_read_packet(AVFormatContext *s,
fourxm->tracks[track_number].audio_pts += audio_frame_count;

} else {
url_fseek(pb, size, SEEK_CUR);
avio_seek(pb, size, SEEK_CUR);
}
break;

default:
url_fseek(pb, size, SEEK_CUR);
avio_seek(pb, size, SEEK_CUR);
break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions libavformat/aiffdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec,

/* Chunk is over */
if (size)
url_fseek(pb, size, SEEK_CUR);
avio_seek(pb, size, SEEK_CUR);

return num_frames;
}
Expand Down Expand Up @@ -276,7 +276,7 @@ static int aiff_read_header(AVFormatContext *s,
st->nb_frames * st->codec->frame_size : st->nb_frames;

/* Position the stream at the first block */
url_fseek(pb, offset, SEEK_SET);
avio_seek(pb, offset, SEEK_SET);

return 0;
}
Expand Down
8 changes: 4 additions & 4 deletions libavformat/aiffenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,19 @@ static int aiff_write_trailer(AVFormatContext *s)

if (!url_is_streamed(s->pb)) {
/* File length */
url_fseek(pb, aiff->form, SEEK_SET);
avio_seek(pb, aiff->form, SEEK_SET);
avio_wb32(pb, file_size - aiff->form - 4);

/* Number of sample frames */
url_fseek(pb, aiff->frames, SEEK_SET);
avio_seek(pb, aiff->frames, SEEK_SET);
avio_wb32(pb, (file_size-aiff->ssnd-12)/enc->block_align);

/* Sound Data chunk size */
url_fseek(pb, aiff->ssnd, SEEK_SET);
avio_seek(pb, aiff->ssnd, SEEK_SET);
avio_wb32(pb, file_size - aiff->ssnd - 4);

/* return to the end */
url_fseek(pb, end_size, SEEK_SET);
avio_seek(pb, end_size, SEEK_SET);

put_flush_packet(pb);
}
Expand Down
8 changes: 4 additions & 4 deletions libavformat/anm.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ static int read_header(AVFormatContext *s,
goto close_and_return;

/* read page table */
ret = url_fseek(pb, anm->page_table_offset, SEEK_SET);
ret = avio_seek(pb, anm->page_table_offset, SEEK_SET);
if (ret < 0)
goto close_and_return;

Expand Down Expand Up @@ -192,7 +192,7 @@ static int read_packet(AVFormatContext *s,

/* parse page header */
if (anm->record < 0) {
url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16), SEEK_SET);
avio_seek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16), SEEK_SET);
url_fskip(pb, 8 + 2*p->nb_records);
anm->record = 0;
}
Expand All @@ -209,10 +209,10 @@ static int read_packet(AVFormatContext *s,

/* fetch record size */
tmp = url_ftell(pb);
url_fseek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) +
avio_seek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16) +
8 + anm->record * 2, SEEK_SET);
record_size = avio_rl16(pb);
url_fseek(pb, tmp, SEEK_SET);
avio_seek(pb, tmp, SEEK_SET);

/* fetch record */
pkt->size = av_get_packet(s->pb, pkt, record_size);
Expand Down
8 changes: 4 additions & 4 deletions libavformat/ape.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
/* Skip any unknown bytes at the end of the descriptor.
This is for future compatibility */
if (ape->descriptorlength > 52)
url_fseek(pb, ape->descriptorlength - 52, SEEK_CUR);
avio_seek(pb, ape->descriptorlength - 52, SEEK_CUR);

/* Read header data */
ape->compressiontype = avio_rl16(pb);
Expand All @@ -212,7 +212,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
ape->finalframeblocks = avio_rl32(pb);

if (ape->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) {
url_fseek(pb, 4, SEEK_CUR); /* Skip the peak level */
avio_seek(pb, 4, SEEK_CUR); /* Skip the peak level */
ape->headerlength += 4;
}

Expand Down Expand Up @@ -289,7 +289,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
/* try to read APE tags */
if (!url_is_streamed(pb)) {
ff_ape_parse_tag(s);
url_fseek(pb, 0, SEEK_SET);
avio_seek(pb, 0, SEEK_SET);
}

av_log(s, AV_LOG_DEBUG, "Decoding file - v%d.%02d, compression level %d\n", ape->fileversion / 1000, (ape->fileversion % 1000) / 10, ape->compressiontype);
Expand Down Expand Up @@ -342,7 +342,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
if (ape->currentframe > ape->totalframes)
return AVERROR(EIO);

url_fseek (s->pb, ape->frames[ape->currentframe].pos, SEEK_SET);
avio_seek (s->pb, ape->frames[ape->currentframe].pos, SEEK_SET);

/* Calculate how many blocks there are in this frame */
if (ape->currentframe == (ape->totalframes - 1))
Expand Down
4 changes: 2 additions & 2 deletions libavformat/apetag.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void ff_ape_parse_tag(AVFormatContext *s)
if (file_size < APE_TAG_FOOTER_BYTES)
return;

url_fseek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET);
avio_seek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET);

avio_read(pb, buf, 8); /* APETAGEX */
if (strncmp(buf, "APETAGEX", 8)) {
Expand Down Expand Up @@ -105,7 +105,7 @@ void ff_ape_parse_tag(AVFormatContext *s)
return;
}

url_fseek(pb, file_size - tag_bytes, SEEK_SET);
avio_seek(pb, file_size - tag_bytes, SEEK_SET);

for (i=0; i<fields; i++)
if (ape_tag_read_field(s) < 0) break;
Expand Down
24 changes: 12 additions & 12 deletions libavformat/asfdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ static void get_tag(AVFormatContext *s, const char *key, int type, int len)
av_metadata_set2(&s->metadata, key, value, 0);
finish:
av_freep(&value);
url_fseek(s->pb, off + len, SEEK_SET);
avio_seek(s->pb, off + len, SEEK_SET);
}

static int asf_read_file_properties(AVFormatContext *s, int64_t size)
Expand Down Expand Up @@ -428,14 +428,14 @@ static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size)
for (i=0; i<stream_ct; i++){
avio_rl16(pb);
ext_len = avio_rl16(pb);
url_fseek(pb, ext_len, SEEK_CUR);
avio_seek(pb, ext_len, SEEK_CUR);
}

for (i=0; i<payload_ext_ct; i++){
ff_get_guid(pb, &g);
ext_d=avio_rl16(pb);
ext_len=avio_rl32(pb);
url_fseek(pb, ext_len, SEEK_CUR);
avio_seek(pb, ext_len, SEEK_CUR);
}

return 0;
Expand Down Expand Up @@ -654,7 +654,7 @@ static int asf_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
if(url_ftell(pb) != gpos + gsize)
av_log(s, AV_LOG_DEBUG, "gpos mismatch our pos=%"PRIu64", end=%"PRIu64"\n", url_ftell(pb)-gpos, gsize);
url_fseek(pb, gpos + gsize, SEEK_SET);
avio_seek(pb, gpos + gsize, SEEK_SET);
}
ff_get_guid(pb, &g);
avio_rl64(pb);
Expand Down Expand Up @@ -758,7 +758,7 @@ static int ff_asf_get_packet(AVFormatContext *s, AVIOContext *pb)
d= avio_r8(pb);
rsize+=3;
}else{
url_fseek(pb, -1, SEEK_CUR); //FIXME
avio_seek(pb, -1, SEEK_CUR); //FIXME
}

asf->packet_flags = c;
Expand Down Expand Up @@ -1146,7 +1146,7 @@ static int64_t asf_read_pts(AVFormatContext *s, int stream_index, int64_t *ppos,
if (s->packet_size > 0)
pos= (pos+s->packet_size-1-s->data_offset)/s->packet_size*s->packet_size+ s->data_offset;
*ppos= pos;
url_fseek(s->pb, pos, SEEK_SET);
avio_seek(s->pb, pos, SEEK_SET);

//printf("asf_read_pts\n");
asf_reset_header(s);
Expand Down Expand Up @@ -1188,18 +1188,18 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
int64_t current_pos= url_ftell(s->pb);
int i;

url_fseek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
avio_seek(s->pb, asf->data_object_offset + asf->data_object_size, SEEK_SET);
ff_get_guid(s->pb, &g);

/* the data object can be followed by other top-level objects,
skip them until the simple index object is reached */
while (ff_guidcmp(&g, &index_guid)) {
int64_t gsize= avio_rl64(s->pb);
if (gsize < 24 || url_feof(s->pb)) {
url_fseek(s->pb, current_pos, SEEK_SET);
avio_seek(s->pb, current_pos, SEEK_SET);
return;
}
url_fseek(s->pb, gsize-24, SEEK_CUR);
avio_seek(s->pb, gsize-24, SEEK_CUR);
ff_get_guid(s->pb, &g);
}

Expand Down Expand Up @@ -1227,7 +1227,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
}
asf->index_read= 1;
}
url_fseek(s->pb, current_pos, SEEK_SET);
avio_seek(s->pb, current_pos, SEEK_SET);
}

static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags)
Expand Down Expand Up @@ -1265,7 +1265,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int

// various attempts to find key frame have failed so far
// asf_reset_header(s);
// url_fseek(s->pb, pos, SEEK_SET);
// avio_seek(s->pb, pos, SEEK_SET);
// key_pos = pos;
// for(i=0;i<16;i++){
// pos = url_ftell(s->pb);
Expand All @@ -1286,7 +1286,7 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int

/* do the seek */
av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos);
url_fseek(s->pb, pos, SEEK_SET);
avio_seek(s->pb, pos, SEEK_SET);
}
asf_reset_header(s);
return 0;
Expand Down
18 changes: 9 additions & 9 deletions libavformat/asfenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ static void end_header(AVIOContext *pb, int64_t pos)
int64_t pos1;

pos1 = url_ftell(pb);
url_fseek(pb, pos + 16, SEEK_SET);
avio_seek(pb, pos + 16, SEEK_SET);
avio_wl64(pb, pos1 - pos);
url_fseek(pb, pos1, SEEK_SET);
avio_seek(pb, pos1, SEEK_SET);
}

/* write an asf chunk (only used in streaming case) */
Expand Down Expand Up @@ -443,9 +443,9 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
return -1;
if (wavsize != extra_size) {
cur_pos = url_ftell(pb);
url_fseek(pb, es_pos, SEEK_SET);
avio_seek(pb, es_pos, SEEK_SET);
avio_wl32(pb, wavsize); /* wav header len */
url_fseek(pb, cur_pos, SEEK_SET);
avio_seek(pb, cur_pos, SEEK_SET);
}
/* ERROR Correction */
avio_w8(pb, 0x01);
Expand Down Expand Up @@ -530,17 +530,17 @@ static int asf_write_header1(AVFormatContext *s, int64_t file_size, int64_t data
if (asf->is_streamed) {
header_size += 8 + 30 + 50;

url_fseek(pb, header_offset - 10 - 30, SEEK_SET);
avio_seek(pb, header_offset - 10 - 30, SEEK_SET);
avio_wl16(pb, header_size);
url_fseek(pb, header_offset - 2 - 30, SEEK_SET);
avio_seek(pb, header_offset - 2 - 30, SEEK_SET);
avio_wl16(pb, header_size);

header_size -= 8 + 30 + 50;
}
header_size += 24 + 6;
url_fseek(pb, header_offset - 14, SEEK_SET);
avio_seek(pb, header_offset - 14, SEEK_SET);
avio_wl64(pb, header_size);
url_fseek(pb, cur_pos, SEEK_SET);
avio_seek(pb, cur_pos, SEEK_SET);

/* movie chunk, followed by packets of packet_size */
asf->data_offset = cur_pos;
Expand Down Expand Up @@ -871,7 +871,7 @@ static int asf_write_trailer(AVFormatContext *s)
} else {
/* rewrite an updated header */
file_size = url_ftell(s->pb);
url_fseek(s->pb, 0, SEEK_SET);
avio_seek(s->pb, 0, SEEK_SET);
asf_write_header1(s, file_size, data_size - asf->data_offset);
}

Expand Down
6 changes: 3 additions & 3 deletions libavformat/au.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ static int au_write_trailer(AVFormatContext *s)

/* update file size */
file_size = url_ftell(pb);
url_fseek(pb, 8, SEEK_SET);
avio_seek(pb, 8, SEEK_SET);
avio_wb32(pb, (uint32_t)(file_size - 24));
url_fseek(pb, file_size, SEEK_SET);
avio_seek(pb, file_size, SEEK_SET);

put_flush_packet(pb);
}
Expand Down Expand Up @@ -147,7 +147,7 @@ static int au_read_header(AVFormatContext *s,

if (size >= 24) {
/* skip unused data */
url_fseek(pb, size - 24, SEEK_CUR);
avio_seek(pb, size - 24, SEEK_CUR);
}

/* now we are ready: build format streams */
Expand Down
Loading

0 comments on commit 6b4aa5d

Please sign in to comment.