diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-02-28 14:57:54 +0100 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2011-03-01 12:12:33 -0500 |
commit | 6b4aa5dac8f41aa452d0ce9a1bede9e59a303060 (patch) | |
tree | a2790d8f7304a735dc8edf52207b823ceb73a7da | |
parent | 76d8846c4e918749b045ea2ee7399a069af5e4a5 (diff) | |
download | ffmpeg-6b4aa5dac8f41aa452d0ce9a1bede9e59a303060.tar.gz |
avio: avio_ prefix for url_fseek
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
90 files changed, 352 insertions, 347 deletions
diff --git a/libavformat/4xm.c b/libavformat/4xm.c index bf2d7384b5..2757e89269 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -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(); @@ -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; } } diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 7b3d1e7297..b8e4ea28ed 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -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; } @@ -276,7 +276,7 @@ got_sound: 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; } diff --git a/libavformat/aiffenc.c b/libavformat/aiffenc.c index de88382e67..150f36bdc0 100644 --- a/libavformat/aiffenc.c +++ b/libavformat/aiffenc.c @@ -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); } diff --git a/libavformat/anm.c b/libavformat/anm.c index 6bcb90db1a..463beee345 100644 --- a/libavformat/anm.c +++ b/libavformat/anm.c @@ -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; @@ -192,7 +192,7 @@ repeat: /* 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; } @@ -209,10 +209,10 @@ repeat: /* 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); diff --git a/libavformat/ape.c b/libavformat/ape.c index 862ac1a482..657a3d9c49 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -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); @@ -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; } @@ -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); @@ -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)) diff --git a/libavformat/apetag.c b/libavformat/apetag.c index 7252fd2b2c..c3c57717bd 100644 --- a/libavformat/apetag.c +++ b/libavformat/apetag.c @@ -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)) { @@ -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; diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index 242f81cd6b..4f6f6f2c0d 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -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) @@ -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; @@ -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); @@ -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; @@ -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); @@ -1188,7 +1188,7 @@ 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, @@ -1196,10 +1196,10 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index) 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); } @@ -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) @@ -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); @@ -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; diff --git a/libavformat/asfenc.c b/libavformat/asfenc.c index b181f2321e..267f9b3d49 100644 --- a/libavformat/asfenc.c +++ b/libavformat/asfenc.c @@ -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) */ @@ -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); @@ -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; @@ -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); } diff --git a/libavformat/au.c b/libavformat/au.c index 9aed1dcaf3..16b33e78c7 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -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); } @@ -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 */ diff --git a/libavformat/avidec.c b/libavformat/avidec.c index b2db2dc36d..a0f86adea5 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -205,13 +205,13 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ return -1; } - url_fseek(pb, offset+8, SEEK_SET); + avio_seek(pb, offset+8, SEEK_SET); avi->odml_depth++; read_braindead_odml_indx(s, frame_num); avi->odml_depth--; frame_num += duration; - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } } avi->index_loaded=1; @@ -668,7 +668,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) if(!url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX)){ read_braindead_odml_indx(s, 0); } - url_fseek(pb, i+size, SEEK_SET); + avio_seek(pb, i+size, SEEK_SET); break; case MKTAG('v', 'p', 'r', 'p'): if(stream_index < (unsigned)s->nb_streams && size > 9*4){ @@ -693,7 +693,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) } size -= 9*4; } - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); break; case MKTAG('s', 't', 'r', 'n'): if(s->nb_streams){ @@ -892,7 +892,7 @@ static int avi_read_packet(AVFormatContext *s, AVPacket *pkt) if(i>=0){ int64_t pos= best_st->index_entries[i].pos; pos += best_ast->packet_size - best_ast->remaining; - url_fseek(s->pb, pos + 8, SEEK_SET); + avio_seek(s->pb, pos + 8, SEEK_SET); // av_log(s, AV_LOG_DEBUG, "pos=%"PRId64"\n", pos); assert(best_ast->remaining <= best_ast->packet_size); @@ -1174,7 +1174,7 @@ static int guess_ni_flag(AVFormatContext *s){ if(n >= 2){ int64_t pos= st->index_entries[0].pos; - url_fseek(s->pb, pos + 4, SEEK_SET); + avio_seek(s->pb, pos + 4, SEEK_SET); size= avio_rl32(s->pb); if(pos + size > st->index_entries[1].pos) last_start= INT64_MAX; @@ -1185,7 +1185,7 @@ static int guess_ni_flag(AVFormatContext *s){ if(st->index_entries[n-1].pos < first_end) first_end= st->index_entries[n-1].pos; } - url_fseek(s->pb, oldpos, SEEK_SET); + avio_seek(s->pb, oldpos, SEEK_SET); return last_start > first_end; } @@ -1197,7 +1197,7 @@ static int avi_load_index(AVFormatContext *s) int64_t pos= url_ftell(pb); int ret = -1; - if (url_fseek(pb, avi->movi_end, SEEK_SET) < 0) + if (avio_seek(pb, avi->movi_end, SEEK_SET) < 0) goto the_end; // maybe truncated file #ifdef DEBUG_SEEK printf("movi_end=0x%"PRIx64"\n", avi->movi_end); @@ -1225,13 +1225,13 @@ static int avi_load_index(AVFormatContext *s) default: skip: size += (size & 1); - if (url_fseek(pb, size, SEEK_CUR) < 0) + if (avio_seek(pb, size, SEEK_CUR) < 0) goto the_end; // something is wrong here break; } } the_end: - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); return ret; } @@ -1282,7 +1282,7 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp /* DV demux so it can synthesize correct timestamps. */ dv_offset_reset(avi->dv_demux, timestamp); - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); avi->stream_index= -1; return 0; } @@ -1324,7 +1324,7 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp } /* do the seek */ - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); avi->stream_index= -1; return 0; } diff --git a/libavformat/avienc.c b/libavformat/avienc.c index c161133342..49585b685b 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -130,7 +130,7 @@ static int avi_write_counters(AVFormatContext* s, int riff_id) assert(avist->frames_hdr_strm); stream = s->streams[n]->codec; - url_fseek(pb, avist->frames_hdr_strm, SEEK_SET); + avio_seek(pb, avist->frames_hdr_strm, SEEK_SET); ff_parse_specific_params(stream, &au_byterate, &au_ssize, &au_scale); if(au_ssize == 0) { avio_wl32(pb, avist->packet_count); @@ -142,10 +142,10 @@ static int avi_write_counters(AVFormatContext* s, int riff_id) } if(riff_id == 1) { assert(avi->frames_hdr_all); - url_fseek(pb, avi->frames_hdr_all, SEEK_SET); + avio_seek(pb, avi->frames_hdr_all, SEEK_SET); avio_wl32(pb, nb_frames); } - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); return 0; } @@ -442,7 +442,7 @@ static int avi_write_ix(AVFormatContext *s) pos = url_ftell(pb); /* Updating one entry in the AVI OpenDML master index */ - url_fseek(pb, avist->indexes.indx_start - 8, SEEK_SET); + avio_seek(pb, avist->indexes.indx_start - 8, SEEK_SET); ffio_wfourcc(pb, "indx"); /* enabling this entry */ url_fskip(pb, 8); avio_wl32(pb, avi->riff_id); /* nEntriesInUse */ @@ -451,7 +451,7 @@ static int avi_write_ix(AVFormatContext *s) avio_wl32(pb, pos - ix); /* dwSize */ avio_wl32(pb, avist->indexes.entry); /* dwDuration */ - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } return 0; } @@ -601,7 +601,7 @@ static int avi_write_trailer(AVFormatContext *s) ff_end_tag(pb, avi->riff_start); file_size = url_ftell(pb); - url_fseek(pb, avi->odml_list - 8, SEEK_SET); + avio_seek(pb, avi->odml_list - 8, SEEK_SET); ffio_wfourcc(pb, "LIST"); /* Making this AVI OpenDML one */ url_fskip(pb, 16); @@ -619,7 +619,7 @@ static int avi_write_trailer(AVFormatContext *s) } } avio_wl32(pb, nb_frames); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); avi_write_counters(s, avi->riff_id); } diff --git a/libavformat/avio.h b/libavformat/avio.h index 613d77d240..568bdd346a 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -420,6 +420,7 @@ attribute_deprecated void put_tag(AVIOContext *s, const char *tag); */ attribute_deprecated int url_fopen( AVIOContext **s, const char *url, int flags); attribute_deprecated int url_fclose(AVIOContext *s); +attribute_deprecated int64_t url_fseek(AVIOContext *s, int64_t offset, int whence); /** * @} */ @@ -465,7 +466,7 @@ int avio_put_str16le(AVIOContext *s, const char *str); * fseek() equivalent for AVIOContext. * @return new position or AVERROR. */ -int64_t url_fseek(AVIOContext *s, int64_t offset, int whence); +int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); /** * Skip given number of bytes forward. diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index f53ec562f5..a74ad21604 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -176,7 +176,7 @@ void put_flush_packet(AVIOContext *s) s->must_flush = 0; } -int64_t url_fseek(AVIOContext *s, int64_t offset, int whence) +int64_t avio_seek(AVIOContext *s, int64_t offset, int whence) { int64_t offset1; int64_t pos; @@ -235,13 +235,13 @@ int64_t url_fseek(AVIOContext *s, int64_t offset, int whence) int url_fskip(AVIOContext *s, int64_t offset) { - int64_t ret = url_fseek(s, offset, SEEK_CUR); + int64_t ret = avio_seek(s, offset, SEEK_CUR); return ret < 0 ? ret : 0; } int64_t url_ftell(AVIOContext *s) { - return url_fseek(s, 0, SEEK_CUR); + return avio_seek(s, 0, SEEK_CUR); } int64_t url_fsize(AVIOContext *s) @@ -365,6 +365,10 @@ int url_fclose(AVIOContext *s) { return avio_close(s); } +int64_t url_fseek(AVIOContext *s, int64_t offset, int whence) +{ + return avio_seek(s, offset, whence); +} #endif int avio_put_str(AVIOContext *s, const char *str) diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c index 40d0e6296a..00b3ea2ae3 100644 --- a/libavformat/bethsoftvid.c +++ b/libavformat/bethsoftvid.c @@ -67,7 +67,7 @@ static int vid_read_header(AVFormatContext *s, * bytes: 'V' 'I' 'D' * int16s: always_512, nframes, width, height, delay, always_14 */ - url_fseek(pb, 5, SEEK_CUR); + avio_seek(pb, 5, SEEK_CUR); vid->nframes = avio_rl16(pb); stream = av_new_stream(s, 0); @@ -146,7 +146,7 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, if(bytes_copied == npixels){ // sometimes no stop character is given, need to keep track of bytes copied // may contain a 0 byte even if read all pixels if(avio_r8(pb)) - url_fseek(pb, -1, SEEK_CUR); + avio_seek(pb, -1, SEEK_CUR); break; } if(bytes_copied > npixels) @@ -185,7 +185,7 @@ static int vid_read_packet(AVFormatContext *s, block_type = avio_r8(pb); switch(block_type){ case PALETTE_BLOCK: - url_fseek(pb, -1, SEEK_CUR); // include block type + avio_seek(pb, -1, SEEK_CUR); // include block type ret_value = av_get_packet(pb, pkt, 3 * 256 + 1); if(ret_value != 3 * 256 + 1){ av_free_packet(pkt); diff --git a/libavformat/bfi.c b/libavformat/bfi.c index 7313e7b337..4d0bd097a9 100644 --- a/libavformat/bfi.c +++ b/libavformat/bfi.c @@ -98,7 +98,7 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap) astream->codec->bits_per_coded_sample = 8; astream->codec->bit_rate = astream->codec->sample_rate * astream->codec->bits_per_coded_sample; - url_fseek(pb, chunk_header - 3, SEEK_SET); + avio_seek(pb, chunk_header - 3, SEEK_SET); av_set_pts_info(astream, 64, 1, astream->codec->sample_rate); return 0; } diff --git a/libavformat/bink.c b/libavformat/bink.c index 79c3a25ec5..f76d7b987a 100644 --- a/libavformat/bink.c +++ b/libavformat/bink.c @@ -225,7 +225,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) AV_RL32(pkt->data) / (2 * s->streams[bink->current_track]->codec->channels); return 0; } else { - url_fseek(pb, audio_size, SEEK_CUR); + avio_seek(pb, audio_size, SEEK_CUR); } } @@ -251,7 +251,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, in return -1; /* seek to the first frame */ - url_fseek(s->pb, vst->index_entries[0].pos, SEEK_SET); + avio_seek(s->pb, vst->index_entries[0].pos, SEEK_SET); bink->video_pts = 0; memset(bink->audio_pts, 0, sizeof(bink->audio_pts)); bink->current_track = -1; diff --git a/libavformat/c93.c b/libavformat/c93.c index 3e3cd9cb0f..84cf65c73e 100644 --- a/libavformat/c93.c +++ b/libavformat/c93.c @@ -140,13 +140,13 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) } if (c93->current_frame == 0) { - url_fseek(pb, br->index * 2048, SEEK_SET); + avio_seek(pb, br->index * 2048, SEEK_SET); for (i = 0; i < 32; i++) { c93->frame_offsets[i] = avio_rl32(pb); } } - url_fseek(pb,br->index * 2048 + + avio_seek(pb,br->index * 2048 + c93->frame_offsets[c93->current_frame], SEEK_SET); datasize = avio_rl16(pb); /* video frame size */ diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index 86f1005fdc..8532946c5c 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -292,7 +292,7 @@ static int read_header(AVFormatContext *s, /* position the stream at the start of data */ if (caf->data_size >= 0) - url_fseek(pb, caf->data_start, SEEK_SET); + avio_seek(pb, caf->data_start, SEEK_SET); return 0; } @@ -377,7 +377,7 @@ static int read_seek(AVFormatContext *s, int stream_index, return -1; } - url_fseek(s->pb, pos + caf->data_start, SEEK_SET); + avio_seek(s->pb, pos + caf->data_start, SEEK_SET); return 0; } diff --git a/libavformat/dv.c b/libavformat/dv.c index 0598607ff4..cdc5f76923 100644 --- a/libavformat/dv.c +++ b/libavformat/dv.c @@ -419,7 +419,7 @@ static int dv_read_header(AVFormatContext *s, if (state == 0x003f0700 || state == 0xff3f0700) marker_pos = url_ftell(s->pb); if (state == 0xff3f0701 && url_ftell(s->pb) - marker_pos == 80) { - url_fseek(s->pb, -163, SEEK_CUR); + avio_seek(s->pb, -163, SEEK_CUR); state = avio_rb32(s->pb); break; } @@ -428,7 +428,7 @@ static int dv_read_header(AVFormatContext *s, AV_WB32(c->buf, state); if (avio_read(s->pb, c->buf + 4, DV_PROFILE_BYTES - 4) <= 0 || - url_fseek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0) + avio_seek(s->pb, -DV_PROFILE_BYTES, SEEK_CUR) < 0) return AVERROR(EIO); c->dv_demux->sys = ff_dv_frame_profile(c->dv_demux->sys, c->buf, DV_PROFILE_BYTES); @@ -473,7 +473,7 @@ static int dv_read_seek(AVFormatContext *s, int stream_index, dv_offset_reset(c, offset / c->sys->frame_size); - offset = url_fseek(s->pb, offset, SEEK_SET); + offset = avio_seek(s->pb, offset, SEEK_SET); return (offset < 0) ? offset : 0; } diff --git a/libavformat/dxa.c b/libavformat/dxa.c index 188fc29d63..60ae92a048 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -115,7 +115,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) c->bpc = ((c->bpc + ast->codec->block_align - 1) / ast->codec->block_align) * ast->codec->block_align; c->bytes_left = fsize; c->wavpos = url_ftell(pb); - url_fseek(pb, c->vidpos, SEEK_SET); + avio_seek(pb, c->vidpos, SEEK_SET); } /* now we are ready: build format streams */ @@ -151,7 +151,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) if(!c->readvid && c->has_sound && c->bytes_left){ c->readvid = 1; - url_fseek(s->pb, c->wavpos, SEEK_SET); + avio_seek(s->pb, c->wavpos, SEEK_SET); size = FFMIN(c->bytes_left, c->bpc); ret = av_get_packet(s->pb, pkt, size); pkt->stream_index = 1; @@ -161,7 +161,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) c->wavpos = url_ftell(s->pb); return 0; } - url_fseek(s->pb, c->vidpos, SEEK_SET); + avio_seek(s->pb, c->vidpos, SEEK_SET); while(!url_feof(s->pb) && c->frames){ avio_read(s->pb, buf, 4); switch(AV_RL32(buf)){ diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index 6179d22e60..9f79897b85 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -369,10 +369,10 @@ static int process_ea_header(AVFormatContext *s) { return err; } - url_fseek(pb, startpos + size, SEEK_SET); + avio_seek(pb, startpos + size, SEEK_SET); } - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); return 1; } @@ -536,12 +536,12 @@ static int ea_read_packet(AVFormatContext *s, case fVGT_TAG: case MADm_TAG: case MADe_TAG: - url_fseek(pb, -8, SEEK_CUR); // include chunk preamble + avio_seek(pb, -8, SEEK_CUR); // include chunk preamble chunk_size += 8; goto get_video_packet; case mTCD_TAG: - url_fseek(pb, 8, SEEK_CUR); // skip ea dct header + avio_seek(pb, 8, SEEK_CUR); // skip ea dct header chunk_size -= 8; goto get_video_packet; @@ -560,7 +560,7 @@ get_video_packet: break; default: - url_fseek(pb, chunk_size, SEEK_CUR); + avio_seek(pb, chunk_size, SEEK_CUR); break; } } diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 1ae1422ea2..764d55c60a 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -118,7 +118,7 @@ static int ffm_read_data(AVFormatContext *s, len = size; if (len == 0) { if (url_ftell(pb) == ffm->file_size) - url_fseek(pb, ffm->packet_size, SEEK_SET); + avio_seek(pb, ffm->packet_size, SEEK_SET); retry_read: id = avio_rb16(pb); /* PACKET_ID */ if (id != PACKET_ID) @@ -137,7 +137,7 @@ static int ffm_read_data(AVFormatContext *s, if (!frame_offset) { /* This packet has no frame headers in it */ if (url_ftell(pb) >= ffm->packet_size * 3) { - url_fseek(pb, -ffm->packet_size * 2, SEEK_CUR); + avio_seek(pb, -ffm->packet_size * 2, SEEK_CUR); goto retry_read; } /* This is bad, we cannot find a valid frame header */ @@ -178,7 +178,7 @@ static void ffm_seek1(AVFormatContext *s, int64_t pos1) #ifdef DEBUG_SEEK av_log(s, AV_LOG_DEBUG, "seek to %"PRIx64" -> %"PRIx64"\n", pos1, pos); #endif - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } static int64_t get_dts(AVFormatContext *s, int64_t pos) @@ -248,7 +248,7 @@ static void adjust_write_index(AVFormatContext *s) //printf("pts range %0.6f - %0.6f\n", get_dts(s, 0) / 1000000. , get_dts(s, ffm->file_size - 2 * FFM_PACKET_SIZE) / 1000000. ); end: - url_fseek(pb, ptr, SEEK_SET); + avio_seek(pb, ptr, SEEK_SET); } diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c index 87219c83ff..8a0770e688 100644 --- a/libavformat/filmstripdec.c +++ b/libavformat/filmstripdec.c @@ -43,7 +43,7 @@ static int read_header(AVFormatContext *s, if (url_is_streamed(s->pb)) return AVERROR(EIO); - url_fseek(pb, url_fsize(pb) - 36, SEEK_SET); + avio_seek(pb, url_fsize(pb) - 36, SEEK_SET); if (avio_rb32(pb) != RAND_TAG) { av_log(s, AV_LOG_ERROR, "magic number not found"); return AVERROR_INVALIDDATA; @@ -69,7 +69,7 @@ static int read_header(AVFormatContext *s, film->leading = avio_rb16(pb); av_set_pts_info(st, 64, 1, avio_rb16(pb)); - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); return 0; } @@ -94,7 +94,7 @@ static int read_packet(AVFormatContext *s, static int read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { AVStream *st = s->streams[stream_index]; - url_fseek(s->pb, FFMAX(timestamp, 0) * st->codec->width * st->codec->height * 4, SEEK_SET); + avio_seek(s->pb, FFMAX(timestamp, 0) * st->codec->width * st->codec->height * 4, SEEK_SET); return 0; } diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index bed9863f9a..73eeacb422 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -41,7 +41,7 @@ static int flac_read_header(AVFormatContext *s, /* if fLaC marker is not found, assume there is no header */ if (avio_rl32(s->pb) != MKTAG('f','L','a','C')) { - url_fseek(s->pb, -4, SEEK_CUR); + avio_seek(s->pb, -4, SEEK_CUR); return 0; } @@ -65,7 +65,7 @@ static int flac_read_header(AVFormatContext *s, break; /* skip metadata block for unsupported types */ default: - ret = url_fseek(s->pb, metadata_size, SEEK_CUR); + ret = avio_seek(s->pb, metadata_size, SEEK_CUR); if (ret < 0) return ret; } diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c index d11d75d27d..cfd9e09499 100644 --- a/libavformat/flacenc.c +++ b/libavformat/flacenc.c @@ -101,9 +101,9 @@ static int flac_write_trailer(struct AVFormatContext *s) if (!url_is_streamed(pb)) { /* rewrite the STREAMINFO header block data */ file_size = url_ftell(pb); - url_fseek(pb, 8, SEEK_SET); + avio_seek(pb, 8, SEEK_SET); avio_write(pb, streaminfo, FLAC_STREAMINFO_SIZE); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); put_flush_packet(pb); } else { av_log(s, AV_LOG_WARNING, "unable to rewrite FLAC header.\n"); diff --git a/libavformat/flic.c b/libavformat/flic.c index 2f6e218357..cdbd9c80eb 100644 --- a/libavformat/flic.c +++ b/libavformat/flic.c @@ -135,7 +135,7 @@ static int flic_read_header(AVFormatContext *s, return AVERROR(EIO); } - url_fseek(pb, -FLIC_PREAMBLE_SIZE, SEEK_CUR); + avio_seek(pb, -FLIC_PREAMBLE_SIZE, SEEK_CUR); /* Time to figure out the framerate: * If the first preamble's magic number is 0xAAAA then this file is from @@ -173,7 +173,7 @@ static int flic_read_header(AVFormatContext *s, av_set_pts_info(st, 64, FLIC_MC_SPEED, 70); /* rewind the stream since the first chunk is at offset 12 */ - url_fseek(pb, 12, SEEK_SET); + avio_seek(pb, 12, SEEK_SET); /* send over abbreviated FLIC header chunk */ av_free(st->codec->extradata); @@ -239,7 +239,7 @@ static int flic_read_packet(AVFormatContext *s, } /* skip useless 10B sub-header (yes, it's not accounted for in the chunk header) */ - url_fseek(pb, 10, SEEK_CUR); + avio_seek(pb, 10, SEEK_CUR); pkt->stream_index = flic->audio_stream_index; pkt->pos = url_ftell(pb); @@ -253,7 +253,7 @@ static int flic_read_packet(AVFormatContext *s, packet_read = 1; } else { /* not interested in this chunk */ - url_fseek(pb, size - 6, SEEK_CUR); + avio_seek(pb, size - 6, SEEK_CUR); } } diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index e42598d98e..05f1ab558a 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -277,7 +277,7 @@ static int flv_read_header(AVFormatContext *s, } offset = avio_rb32(s->pb); - url_fseek(s->pb, offset, SEEK_SET); + avio_seek(s->pb, offset, SEEK_SET); url_fskip(s->pb, 4); s->start_time = 0; @@ -337,7 +337,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) else /* skip packet */ av_log(s, AV_LOG_DEBUG, "skipping flv packet: type %d, size %d, flags %d\n", type, size, flags); skip: - url_fseek(s->pb, next, SEEK_SET); + avio_seek(s->pb, next, SEEK_SET); continue; } @@ -361,7 +361,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) ||(st->discard >= AVDISCARD_BIDIR && ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && !is_audio)) || st->discard >= AVDISCARD_ALL ){ - url_fseek(s->pb, next, SEEK_SET); + avio_seek(s->pb, next, SEEK_SET); continue; } if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY) @@ -374,15 +374,15 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) int size; const int64_t pos= url_ftell(s->pb); const int64_t fsize= url_fsize(s->pb); - url_fseek(s->pb, fsize-4, SEEK_SET); + avio_seek(s->pb, fsize-4, SEEK_SET); size= avio_rb32(s->pb); - url_fseek(s->pb, fsize-3-size, SEEK_SET); + avio_seek(s->pb, fsize-3-size, SEEK_SET); if(size == avio_rb24(s->pb) + 11){ uint32_t ts = avio_rb24(s->pb); ts |= avio_r8(s->pb) << 24; s->duration = ts * (int64_t)AV_TIME_BASE / 1000; } - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); } if(is_audio){ diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 4d49a966e9..7dd47da8a4 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -289,9 +289,9 @@ static int flv_write_header(AVFormatContext *s) /* write total size of tag */ data_size= url_ftell(pb) - metadata_size_pos - 10; - url_fseek(pb, metadata_size_pos, SEEK_SET); + avio_seek(pb, metadata_size_pos, SEEK_SET); avio_wb24(pb, data_size); - url_fseek(pb, data_size + 10 - 3, SEEK_CUR); + avio_seek(pb, data_size + 10 - 3, SEEK_CUR); avio_wb32(pb, data_size + 11); for (i = 0; i < s->nb_streams; i++) { @@ -316,9 +316,9 @@ static int flv_write_header(AVFormatContext *s) ff_isom_write_avcc(pb, enc->extradata, enc->extradata_size); } data_size = url_ftell(pb) - pos; - url_fseek(pb, -data_size - 10, SEEK_CUR); + avio_seek(pb, -data_size - 10, SEEK_CUR); avio_wb24(pb, data_size); - url_fseek(pb, data_size + 10 - 3, SEEK_CUR); + avio_seek(pb, data_size + 10 - 3, SEEK_CUR); avio_wb32(pb, data_size + 11); // previous tag size } } @@ -346,12 +346,12 @@ static int flv_write_trailer(AVFormatContext *s) file_size = url_ftell(pb); /* update informations */ - url_fseek(pb, flv->duration_offset, SEEK_SET); + avio_seek(pb, flv->duration_offset, SEEK_SET); put_amf_double(pb, flv->duration / (double)1000); - url_fseek(pb, flv->filesize_offset, SEEK_SET); + avio_seek(pb, flv->filesize_offset, SEEK_SET); put_amf_double(pb, file_size); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); return 0; } diff --git a/libavformat/gxf.c b/libavformat/gxf.c index 5b8b33c5f2..b290035c90 100644 --- a/libavformat/gxf.c +++ b/libavformat/gxf.c @@ -397,10 +397,10 @@ start: if (tmp != 1) goto start; last_pos = url_ftell(pb); - if (url_fseek(pb, -5, SEEK_CUR) < 0) + if (avio_seek(pb, -5, SEEK_CUR) < 0) goto out; if (!parse_packet_header(pb, &type, &len) || type != PKT_MEDIA) { - if (url_fseek(pb, last_pos, SEEK_SET) < 0) + if (avio_seek(pb, last_pos, SEEK_SET) < 0) goto out; goto start; } @@ -409,12 +409,12 @@ start: cur_timestamp = avio_rb32(pb); last_found_pos = url_ftell(pb) - 16 - 6; if ((track >= 0 && track != cur_track) || (timestamp >= 0 && timestamp > cur_timestamp)) { - if (url_fseek(pb, last_pos, SEEK_SET) >= 0) + if (avio_seek(pb, last_pos, SEEK_SET) >= 0) goto start; } out: if (last_found_pos) - url_fseek(pb, last_found_pos, SEEK_SET); + avio_seek(pb, last_found_pos, SEEK_SET); return cur_timestamp; } @@ -495,7 +495,7 @@ static int gxf_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int if (idx < st->nb_index_entries - 2) maxlen = st->index_entries[idx + 2].pos - pos; maxlen = FFMAX(maxlen, 200 * 1024); - res = url_fseek(s->pb, pos, SEEK_SET); + res = avio_seek(s->pb, pos, SEEK_SET); if (res < 0) return res; found = gxf_resync_media(s, maxlen, -1, timestamp); @@ -508,7 +508,7 @@ static int64_t gxf_read_timestamp(AVFormatContext *s, int stream_index, int64_t *pos, int64_t pos_limit) { AVIOContext *pb = s->pb; int64_t res; - if (url_fseek(pb, *pos, SEEK_SET) < 0) + if (avio_seek(pb, *pos, SEEK_SET) < 0) return AV_NOPTS_VALUE; res = gxf_resync_media(s, pos_limit - *pos, -1, -1); *pos = url_ftell(pb); diff --git a/libavformat/gxfenc.c b/libavformat/gxfenc.c index 1b12f41e22..66accb3e08 100644 --- a/libavformat/gxfenc.c +++ b/libavformat/gxfenc.c @@ -131,9 +131,9 @@ static int64_t updatePacketSize(AVIOContext *pb, int64_t pos) size = url_ftell(pb) - pos; } curpos = url_ftell(pb); - url_fseek(pb, pos + 6, SEEK_SET); + avio_seek(pb, pos + 6, SEEK_SET); avio_wb32(pb, size); - url_fseek(pb, curpos, SEEK_SET); + avio_seek(pb, curpos, SEEK_SET); return curpos - pos; } @@ -142,9 +142,9 @@ static int64_t updateSize(AVIOContext *pb, int64_t pos) int64_t curpos; curpos = url_ftell(pb); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); avio_wb16(pb, curpos - pos - 2); - url_fseek(pb, curpos, SEEK_SET); + avio_seek(pb, curpos, SEEK_SET); return curpos - pos; } @@ -581,9 +581,9 @@ static int gxf_write_umf_media_description(AVFormatContext *s) } curpos = url_ftell(pb); - url_fseek(pb, startpos, SEEK_SET); + avio_seek(pb, startpos, SEEK_SET); avio_wl16(pb, curpos - startpos); - url_fseek(pb, curpos, SEEK_SET); + avio_seek(pb, curpos, SEEK_SET); } return url_ftell(pb) - pos; } @@ -776,7 +776,7 @@ static int gxf_write_trailer(AVFormatContext *s) gxf_write_eos_packet(pb); end = url_ftell(pb); - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); /* overwrite map, flt and umf packets with new values */ gxf_write_map_packet(s, 1); gxf_write_flt_packet(s); @@ -784,12 +784,12 @@ static int gxf_write_trailer(AVFormatContext *s) put_flush_packet(pb); /* update duration in all map packets */ for (i = 1; i < gxf->map_offsets_nb; i++) { - url_fseek(pb, gxf->map_offsets[i], SEEK_SET); + avio_seek(pb, gxf->map_offsets[i], SEEK_SET); gxf_write_map_packet(s, 1); put_flush_packet(pb); } - url_fseek(pb, end, SEEK_SET); + avio_seek(pb, end, SEEK_SET); av_freep(&gxf->flt_entries); av_freep(&gxf->map_offsets); diff --git a/libavformat/id3v1.c b/libavformat/id3v1.c index 35199d89f8..e17e785ad5 100644 --- a/libavformat/id3v1.c +++ b/libavformat/id3v1.c @@ -232,12 +232,12 @@ void ff_id3v1_read(AVFormatContext *s) /* XXX: change that */ filesize = url_fsize(s->pb); if (filesize > 128) { - url_fseek(s->pb, filesize - 128, SEEK_SET); + avio_seek(s->pb, filesize - 128, SEEK_SET); ret = avio_read(s->pb, buf, ID3v1_TAG_SIZE); if (ret == ID3v1_TAG_SIZE) { parse_tag(s, buf); } - url_fseek(s->pb, 0, SEEK_SET); + avio_seek(s->pb, 0, SEEK_SET); } } } diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index a3e51407e9..43a41c2d55 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -230,7 +230,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t break; } /* Skip to end of tag */ - url_fseek(s->pb, next, SEEK_SET); + avio_seek(s->pb, next, SEEK_SET); } if (len > 0) { @@ -271,7 +271,7 @@ void ff_id3v2_read(AVFormatContext *s, const char *magic) (buf[9] & 0x7f); ff_id3v2_parse(s, len, buf[3], buf[5]); } else { - url_fseek(s->pb, off, SEEK_SET); + avio_seek(s->pb, off, SEEK_SET); } } while (found_header); ff_metadata_conv(&s->metadata, NULL, ff_id3v2_34_metadata_conv); diff --git a/libavformat/idcin.c b/libavformat/idcin.c index 7421901a9b..1aecf86669 100644 --- a/libavformat/idcin.c +++ b/libavformat/idcin.c @@ -257,7 +257,7 @@ static int idcin_read_packet(AVFormatContext *s, chunk_size = avio_rl32(pb); /* skip the number of decoded bytes (always equal to width * height) */ - url_fseek(pb, 4, SEEK_CUR); + avio_seek(pb, 4, SEEK_CUR); chunk_size -= 4; ret= av_get_packet(pb, pkt, chunk_size); if (ret < 0) diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c index 5b18397532..71324d8803 100644 --- a/libavformat/idroqdec.c +++ b/libavformat/idroqdec.c @@ -136,14 +136,14 @@ static int roq_read_packet(AVFormatContext *s, break; } /* don't care about this chunk anymore */ - url_fseek(pb, RoQ_CHUNK_PREAMBLE_SIZE, SEEK_CUR); + avio_seek(pb, RoQ_CHUNK_PREAMBLE_SIZE, SEEK_CUR); break; case RoQ_QUAD_CODEBOOK: /* packet needs to contain both this codebook and next VQ chunk */ codebook_offset = url_ftell(pb) - RoQ_CHUNK_PREAMBLE_SIZE; codebook_size = chunk_size; - url_fseek(pb, codebook_size, SEEK_CUR); + avio_seek(pb, codebook_size, SEEK_CUR); if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE) return AVERROR(EIO); @@ -151,7 +151,7 @@ static int roq_read_packet(AVFormatContext *s, codebook_size; /* rewind */ - url_fseek(pb, codebook_offset, SEEK_SET); + avio_seek(pb, codebook_offset, SEEK_SET); /* load up the packet */ ret= av_get_packet(pb, pkt, chunk_size); diff --git a/libavformat/iff.c b/libavformat/iff.c index 15327c2421..a5332ab945 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -226,7 +226,7 @@ static int iff_read_header(AVFormatContext *s, url_fskip(pb, data_size - (url_ftell(pb) - orig_pos) + (data_size & 1)); } - url_fseek(pb, iff->body_pos, SEEK_SET); + avio_seek(pb, iff->body_pos, SEEK_SET); switch(st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c index 6514397a1e..e02e00b15a 100644 --- a/libavformat/ipmovie.c +++ b/libavformat/ipmovie.c @@ -133,7 +133,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, s->audio_chunk_size -= 6; } - url_fseek(pb, s->audio_chunk_offset, SEEK_SET); + avio_seek(pb, s->audio_chunk_offset, SEEK_SET); s->audio_chunk_offset = 0; if (s->audio_chunk_size != av_get_packet(pb, pkt, s->audio_chunk_size)) @@ -163,7 +163,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, return CHUNK_NOMEM; pkt->pos= s->decode_map_chunk_offset; - url_fseek(pb, s->decode_map_chunk_offset, SEEK_SET); + avio_seek(pb, s->decode_map_chunk_offset, SEEK_SET); s->decode_map_chunk_offset = 0; if (avio_read(pb, pkt->data, s->decode_map_chunk_size) != @@ -172,7 +172,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, return CHUNK_EOF; } - url_fseek(pb, s->video_chunk_offset, SEEK_SET); + avio_seek(pb, s->video_chunk_offset, SEEK_SET); s->video_chunk_offset = 0; if (avio_read(pb, pkt->data + s->decode_map_chunk_size, @@ -193,7 +193,7 @@ static int load_ipmovie_packet(IPMVEContext *s, AVIOContext *pb, } else { - url_fseek(pb, s->next_chunk_offset, SEEK_SET); + avio_seek(pb, s->next_chunk_offset, SEEK_SET); chunk_type = CHUNK_DONE; } @@ -299,12 +299,12 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, case OPCODE_END_OF_STREAM: debug_ipmovie("end of stream\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_END_OF_CHUNK: debug_ipmovie("end of chunk\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_CREATE_TIMER: @@ -359,7 +359,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, case OPCODE_START_STOP_AUDIO: debug_ipmovie("start/stop audio\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_INIT_VIDEO_BUFFERS: @@ -393,12 +393,12 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, case OPCODE_UNKNOWN_14: case OPCODE_UNKNOWN_15: debug_ipmovie("unknown (but documented) opcode %02X\n", opcode_type); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_SEND_BUFFER: debug_ipmovie("send buffer\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_AUDIO_FRAME: @@ -407,22 +407,22 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, /* log position and move on for now */ s->audio_chunk_offset = url_ftell(pb); s->audio_chunk_size = opcode_size; - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_SILENCE_FRAME: debug_ipmovie("silence frame\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_INIT_VIDEO_MODE: debug_ipmovie("initialize video mode\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_CREATE_GRADIENT: debug_ipmovie("create gradient\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_SET_PALETTE: @@ -464,7 +464,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, case OPCODE_SET_PALETTE_COMPRESSED: debug_ipmovie("set palette compressed\n"); - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_SET_DECODING_MAP: @@ -473,7 +473,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, /* log position and move on for now */ s->decode_map_chunk_offset = url_ftell(pb); s->decode_map_chunk_size = opcode_size; - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; case OPCODE_VIDEO_DATA: @@ -482,7 +482,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, /* log position and move on for now */ s->video_chunk_offset = url_ftell(pb); s->video_chunk_size = opcode_size; - url_fseek(pb, opcode_size, SEEK_CUR); + avio_seek(pb, opcode_size, SEEK_CUR); break; default: @@ -553,7 +553,7 @@ static int ipmovie_read_header(AVFormatContext *s, CHUNK_PREAMBLE_SIZE) return AVERROR(EIO); chunk_type = AV_RL16(&chunk_preamble[2]); - url_fseek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR); + avio_seek(pb, -CHUNK_PREAMBLE_SIZE, SEEK_CUR); if (chunk_type == CHUNK_VIDEO) ipmovie->audio_type = CODEC_ID_NONE; /* no audio */ diff --git a/libavformat/libnut.c b/libavformat/libnut.c index af94d8c30e..467ca9c4a5 100644 --- a/libavformat/libnut.c +++ b/libavformat/libnut.c @@ -182,7 +182,7 @@ static off_t av_seek(void * h, long long pos, int whence) { pos = url_fsize(bc) + pos; whence = SEEK_SET; } - return url_fseek(bc, pos, whence); + return avio_seek(bc, pos, whence); } static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) { diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 4488dd6c50..72abfc1d56 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -831,7 +831,7 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska, return ebml_parse_nest(matroska, syntax->def.n, data); case EBML_PASS: return ebml_parse_id(matroska, syntax->def.n, id, data); case EBML_STOP: return 1; - default: return url_fseek(pb,length,SEEK_CUR)<0 ? AVERROR(EIO) : 0; + default: return avio_seek(pb,length,SEEK_CUR)<0 ? AVERROR(EIO) : 0; } if (res == AVERROR_INVALIDDATA) av_log(matroska->ctx, AV_LOG_ERROR, "Invalid element\n"); @@ -1130,7 +1130,7 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska) continue; /* seek */ - if (url_fseek(matroska->ctx->pb, offset, SEEK_SET) != offset) + if (avio_seek(matroska->ctx->pb, offset, SEEK_SET) != offset) continue; /* We don't want to lose our seekhead level, so we add @@ -1159,7 +1159,7 @@ static void matroska_execute_seekhead(MatroskaDemuxContext *matroska) } /* seek back */ - url_fseek(matroska->ctx->pb, before_pos, SEEK_SET); + avio_seek(matroska->ctx->pb, before_pos, SEEK_SET); matroska->level_up = level_up; matroska->current_id = saved_id; } @@ -1889,7 +1889,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index, timestamp = FFMAX(timestamp, st->index_entries[0].timestamp); if ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) { - url_fseek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET); + avio_seek(s->pb, st->index_entries[st->nb_index_entries-1].pos, SEEK_SET); while ((index = av_index_search_timestamp(st, timestamp, flags)) < 0) { matroska_clear_queue(matroska); if (matroska_parse_cluster(matroska) < 0) @@ -1914,7 +1914,7 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index, } } - url_fseek(s->pb, st->index_entries[index_min].pos, SEEK_SET); + avio_seek(s->pb, st->index_entries[index_min].pos, SEEK_SET); matroska->skip_to_keyframe = !(flags & AVSEEK_FLAG_ANY); matroska->skip_to_timecode = st->index_entries[index].timestamp; matroska->done = 0; diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 2f075942ec..6f752204cc 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -231,10 +231,10 @@ static void end_ebml_master(AVIOContext *pb, ebml_master master) { int64_t pos = url_ftell(pb); - if (url_fseek(pb, master.pos - master.sizebytes, SEEK_SET) < 0) + if (avio_seek(pb, master.pos - master.sizebytes, SEEK_SET) < 0) return; put_ebml_num(pb, pos - master.pos, master.sizebytes); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } static void put_xiph_size(AVIOContext *pb, int size) @@ -313,7 +313,7 @@ static int64_t mkv_write_seekhead(AVIOContext *pb, mkv_seekhead *seekhead) currentpos = url_ftell(pb); if (seekhead->reserved_size > 0) - if (url_fseek(pb, seekhead->filepos, SEEK_SET) < 0) + if (avio_seek(pb, seekhead->filepos, SEEK_SET) < 0) return -1; metaseek = start_ebml_master(pb, MATROSKA_ID_SEEKHEAD, seekhead->reserved_size); @@ -334,7 +334,7 @@ static int64_t mkv_write_seekhead(AVIOContext *pb, mkv_seekhead *seekhead) if (seekhead->reserved_size > 0) { uint64_t remaining = seekhead->filepos + seekhead->reserved_size - url_ftell(pb); put_ebml_void(pb, remaining); - url_fseek(pb, currentpos, SEEK_SET); + avio_seek(pb, currentpos, SEEK_SET); currentpos = seekhead->filepos; } @@ -1163,10 +1163,10 @@ static int mkv_write_trailer(AVFormatContext *s) // update the duration av_log(s, AV_LOG_DEBUG, "end duration = %" PRIu64 "\n", mkv->duration); currentpos = url_ftell(pb); - url_fseek(pb, mkv->duration_offset, SEEK_SET); + avio_seek(pb, mkv->duration_offset, SEEK_SET); put_ebml_float(pb, MATROSKA_ID_DURATION, mkv->duration); - url_fseek(pb, currentpos, SEEK_SET); + avio_seek(pb, currentpos, SEEK_SET); } end_ebml_master(pb, mkv->segment); diff --git a/libavformat/mm.c b/libavformat/mm.c index 2c0d215abf..699daac5e9 100644 --- a/libavformat/mm.c +++ b/libavformat/mm.c @@ -102,7 +102,7 @@ static int read_header(AVFormatContext *s, avio_rl16(pb); /* ibm-pc video bios mode */ width = avio_rl16(pb); height = avio_rl16(pb); - url_fseek(pb, length - 10, SEEK_CUR); /* unknown data */ + avio_seek(pb, length - 10, SEEK_CUR); /* unknown data */ /* video stream */ st = av_new_stream(s, 0); @@ -181,7 +181,7 @@ static int read_packet(AVFormatContext *s, default : av_log(s, AV_LOG_INFO, "unknown chunk type 0x%x\n", type); - url_fseek(pb, length, SEEK_CUR); + avio_seek(pb, length, SEEK_CUR); } } diff --git a/libavformat/mmf.c b/libavformat/mmf.c index bcb862c4b5..a68870c1c2 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -53,9 +53,9 @@ static void end_tag_be(AVIOContext *pb, int64_t start) int64_t pos; pos = url_ftell(pb); - url_fseek(pb, start - 4, SEEK_SET); + avio_seek(pb, start - 4, SEEK_SET); avio_wb32(pb, (uint32_t)(pos - start)); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } static int mmf_write_header(AVFormatContext *s) @@ -143,7 +143,7 @@ static int mmf_write_trailer(AVFormatContext *s) size = pos - mmf->awapos; /* Fill Atsq chunk */ - url_fseek(pb, mmf->atsqpos, SEEK_SET); + avio_seek(pb, mmf->atsqpos, SEEK_SET); /* "play wav" */ avio_w8(pb, 0); /* start time */ @@ -158,7 +158,7 @@ static int mmf_write_trailer(AVFormatContext *s) /* "end of sequence" */ avio_write(pb, "\x00\x00\x00\x00", 4); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); put_flush_packet(pb); } @@ -195,7 +195,7 @@ static int mmf_read_header(AVFormatContext *s, file_size = avio_rb32(pb); /* Skip some unused chunks that may or may not be present */ - for(;; url_fseek(pb, size, SEEK_CUR)) { + for(;; avio_seek(pb, size, SEEK_CUR)) { tag = avio_rl32(pb); size = avio_rb32(pb); if(tag == MKTAG('C','N','T','I')) continue; @@ -226,7 +226,7 @@ static int mmf_read_header(AVFormatContext *s, avio_r8(pb); /* time base g */ /* Skip some unused chunks that may or may not be present */ - for(;; url_fseek(pb, size, SEEK_CUR)) { + for(;; avio_seek(pb, size, SEEK_CUR)) { tag = avio_rl32(pb); size = avio_rb32(pb); if(tag == MKTAG('A','t','s','q')) continue; diff --git a/libavformat/mov.c b/libavformat/mov.c index 6becc77c0c..f8360c6e61 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -419,7 +419,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) url_fskip(pb, len); } } - url_fseek(pb, next, SEEK_SET); + avio_seek(pb, next, SEEK_SET); } return 0; } @@ -1840,7 +1840,7 @@ static int mov_read_meta(MOVContext *c, AVIOContext *pb, MOVAtom atom) uint32_t tag = avio_rl32(pb); atom.size -= 4; if (tag == MKTAG('h','d','l','r')) { - url_fseek(pb, -8, SEEK_CUR); + avio_seek(pb, -8, SEEK_CUR); atom.size += 8; return mov_read_default(c, pb, atom); } @@ -2308,7 +2308,7 @@ static void mov_read_chapters(AVFormatContext *s) uint16_t ch; int len, title_len; - if (url_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { + if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { av_log(s, AV_LOG_ERROR, "Chapter %d not found in file\n", i); goto finish; } @@ -2338,7 +2338,7 @@ static void mov_read_chapters(AVFormatContext *s) av_freep(&title); } finish: - url_fseek(sc->pb, cur_pos, SEEK_SET); + avio_seek(sc->pb, cur_pos, SEEK_SET); } static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap) @@ -2421,7 +2421,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) sc->current_sample++; if (st->discard != AVDISCARD_ALL) { - if (url_fseek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { + if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) { av_log(mov->fc, AV_LOG_ERROR, "stream %d, offset 0x%"PRIx64": partial file\n", sc->ffindex, sample->pos); return -1; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index de16b5b190..030cbda467 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -40,9 +40,9 @@ static int64_t updateSize(AVIOContext *pb, int64_t pos) { int64_t curpos = url_ftell(pb); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); avio_wb32(pb, curpos - pos); /* rewrite size */ - url_fseek(pb, curpos, SEEK_SET); + avio_seek(pb, curpos, SEEK_SET); return curpos - pos; } @@ -130,9 +130,9 @@ static int mov_write_stsc_tag(AVIOContext *pb, MOVTrack *track) } } curpos = url_ftell(pb); - url_fseek(pb, entryPos, SEEK_SET); + avio_seek(pb, entryPos, SEEK_SET); avio_wb32(pb, index); // rewrite size - url_fseek(pb, curpos, SEEK_SET); + avio_seek(pb, curpos, SEEK_SET); return updateSize(pb, pos); } @@ -155,9 +155,9 @@ static int mov_write_stss_tag(AVIOContext *pb, MOVTrack *track, uint32_t flag) } } curpos = url_ftell(pb); - url_fseek(pb, entryPos, SEEK_SET); + avio_seek(pb, entryPos, SEEK_SET); avio_wb32(pb, index); // rewrite size - url_fseek(pb, curpos, SEEK_SET); + avio_seek(pb, curpos, SEEK_SET); return updateSize(pb, pos); } @@ -2235,16 +2235,16 @@ static int mov_write_trailer(AVFormatContext *s) /* Write size of mdat tag */ if (mov->mdat_size+8 <= UINT32_MAX) { - url_fseek(pb, mov->mdat_pos, SEEK_SET); + avio_seek(pb, mov->mdat_pos, SEEK_SET); avio_wb32(pb, mov->mdat_size+8); } else { /* overwrite 'wide' placeholder atom */ - url_fseek(pb, mov->mdat_pos - 8, SEEK_SET); + avio_seek(pb, mov->mdat_pos - 8, SEEK_SET); avio_wb32(pb, 1); /* special value: real atom size will be 64 bit value after tag field */ ffio_wfourcc(pb, "mdat"); avio_wb64(pb, mov->mdat_size+16); } - url_fseek(pb, moov_pos, SEEK_SET); + avio_seek(pb, moov_pos, SEEK_SET); mov_write_moov_tag(pb, mov, s); diff --git a/libavformat/movenchint.c b/libavformat/movenchint.c index fbc7faace6..e6f74cdb0f 100644 --- a/libavformat/movenchint.c +++ b/libavformat/movenchint.c @@ -372,15 +372,15 @@ static int write_hint_packets(AVIOContext *out, const uint8_t *data, size -= packet_len; curpos = url_ftell(out); - url_fseek(out, entries_pos, SEEK_SET); + avio_seek(out, entries_pos, SEEK_SET); avio_wb16(out, entries); - url_fseek(out, curpos, SEEK_SET); + avio_seek(out, curpos, SEEK_SET); } curpos = url_ftell(out); - url_fseek(out, count_pos, SEEK_SET); + avio_seek(out, count_pos, SEEK_SET); avio_wb16(out, count); - url_fseek(out, curpos, SEEK_SET); + avio_seek(out, curpos, SEEK_SET); return count; } diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index a71638ee13..f90348c114 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -90,7 +90,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) return -1; /* Check for Xing / Info tag */ - url_fseek(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR); + avio_seek(s->pb, xing_offtbl[c.lsf == 1][c.nb_channels == 1], SEEK_CUR); v = avio_rb32(s->pb); if(v == MKBETAG('X', 'i', 'n', 'g') || v == MKBETAG('I', 'n', 'f', 'o')) { v = avio_rb32(s->pb); @@ -101,13 +101,13 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) } /* Check for VBRI tag (always 32 bytes after end of mpegaudio header) */ - url_fseek(s->pb, base + 4 + 32, SEEK_SET); + avio_seek(s->pb, base + 4 + 32, SEEK_SET); v = avio_rb32(s->pb); if(v == MKBETAG('V', 'B', 'R', 'I')) { /* Check tag version */ if(avio_rb16(s->pb) == 1) { /* skip delay and quality */ - url_fseek(s->pb, 4, SEEK_CUR); + avio_seek(s->pb, 4, SEEK_CUR); frames = avio_rb32(s->pb); size = avio_rb32(s->pb); } @@ -117,7 +117,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) return -1; /* Skip the vbr tag frame */ - url_fseek(s->pb, base + vbrtag_size, SEEK_SET); + avio_seek(s->pb, base + vbrtag_size, SEEK_SET); spf = c.lsf ? 576 : 1152; /* Samples per frame, layer 3 */ if(frames) @@ -153,7 +153,7 @@ static int mp3_read_header(AVFormatContext *s, ff_id3v1_read(s); if (mp3_parse_vbr_tags(s, st, off) < 0) - url_fseek(s->pb, off, SEEK_SET); + avio_seek(s->pb, off, SEEK_SET); /* the parameters will be extracted from the compressed bitstream */ return 0; diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c index 0635228f61..c465420691 100644 --- a/libavformat/mp3enc.c +++ b/libavformat/mp3enc.c @@ -238,9 +238,9 @@ static int mp3_write_header(struct AVFormatContext *s) } cur_pos = url_ftell(s->pb); - url_fseek(s->pb, size_pos, SEEK_SET); + avio_seek(s->pb, size_pos, SEEK_SET); id3v2_put_size(s, totlen); - url_fseek(s->pb, cur_pos, SEEK_SET); + avio_seek(s->pb, cur_pos, SEEK_SET); return 0; } diff --git a/libavformat/mpc.c b/libavformat/mpc.c index 73217a31ea..c22938366b 100644 --- a/libavformat/mpc.c +++ b/libavformat/mpc.c @@ -98,7 +98,7 @@ static int mpc_read_header(AVFormatContext *s, AVFormatParameters *ap) ff_ape_parse_tag(s); if (!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) ff_id3v1_read(s); - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); } return 0; @@ -114,7 +114,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) return -1; if(c->curframe != c->lastframe + 1){ - url_fseek(s->pb, c->frames[c->curframe].pos, SEEK_SET); + avio_seek(s->pb, c->frames[c->curframe].pos, SEEK_SET); c->curbits = c->frames[c->curframe].skip; } c->lastframe = c->curframe; @@ -129,7 +129,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) size2 = (tmp >> (44 - curbits)) & 0xFFFFF; } curbits += 20; - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); size = ((size2 + curbits + 31) & ~31) >> 3; if(cur == c->frames_noted){ @@ -153,7 +153,7 @@ static int mpc_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->pts = cur; ret = avio_read(s->pb, pkt->data + 4, size); if(c->curbits) - url_fseek(s->pb, -4, SEEK_CUR); + avio_seek(s->pb, -4, SEEK_CUR); if(ret < size){ av_free_packet(pkt); return AVERROR(EIO); diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index 22439f94a0..893fb6b191 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -135,7 +135,7 @@ static void mpc8_parse_seektable(AVFormatContext *s, int64_t off) int i, t, seekd; GetBitContext gb; - url_fseek(s->pb, off, SEEK_SET); + avio_seek(s->pb, off, SEEK_SET); mpc8_get_chunk_header(s->pb, &tag, &size); if(tag != TAG_SEEKTABLE){ av_log(s, AV_LOG_ERROR, "No seek table at given position\n"); @@ -179,7 +179,7 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in pos = url_ftell(pb) + size; off = ff_get_v(pb); mpc8_parse_seektable(s, chunk_pos + off); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); break; default: url_fskip(pb, size); @@ -273,7 +273,7 @@ static int mpc8_read_seek(AVFormatContext *s, int stream_index, int64_t timestam int index = av_index_search_timestamp(st, timestamp, flags); if(index < 0) return -1; - url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET); + avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET); c->frame = st->index_entries[index].timestamp; return 0; } diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index c5b6bfc727..6c7481e79c 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -175,7 +175,7 @@ static int find_prev_start_code(AVIOContext *pb, int *size_ptr) pos = pos_start - 16386; if (pos < 0) pos = 0; - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); avio_r8(pb); pos = pos_start; @@ -185,7 +185,7 @@ static int find_prev_start_code(AVIOContext *pb, int *size_ptr) start_code = -1; goto the_end; } - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); start_code = avio_rb32(pb); if ((start_code & 0xffffff00) == 0x100) break; @@ -244,7 +244,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, int64_t last_sync= url_ftell(s->pb); error_redo: - url_fseek(s->pb, last_sync, SEEK_SET); + avio_seek(s->pb, last_sync, SEEK_SET); redo: /* next start code (should be immediately after) */ m->header_state = 0xff; @@ -475,7 +475,7 @@ static int mpegps_read_packet(AVFormatContext *s, static const unsigned char avs_seqh[4] = { 0, 0, 1, 0xb0 }; unsigned char buf[8]; avio_read(s->pb, buf, 8); - url_fseek(s->pb, -8, SEEK_CUR); + avio_seek(s->pb, -8, SEEK_CUR); if(!memcmp(buf, avs_seqh, 4) && (buf[6] != 0 || buf[7] != 1)) codec_id = CODEC_ID_CAVS; else @@ -587,7 +587,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index, #ifdef DEBUG_SEEK printf("read_dts: pos=0x%"PRIx64" next=%d -> ", pos, find_next); #endif - if (url_fseek(s->pb, pos, SEEK_SET) < 0) + if (avio_seek(s->pb, pos, SEEK_SET) < 0) return AV_NOPTS_VALUE; for(;;) { diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index 3307685b41..6a1b77301b 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1316,7 +1316,7 @@ static int mpegts_resync(AVFormatContext *s) if (c < 0) return -1; if (c == 0x47) { - url_fseek(pb, -1, SEEK_CUR); + avio_seek(pb, -1, SEEK_CUR); return 0; } } @@ -1338,7 +1338,7 @@ static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size) /* check paquet sync byte */ if (buf[0] != 0x47) { /* find a new packet start */ - url_fseek(pb, -TS_PACKET_SIZE, SEEK_CUR); + avio_seek(pb, -TS_PACKET_SIZE, SEEK_CUR); if (mpegts_resync(s) < 0) return AVERROR(EAGAIN); else @@ -1468,7 +1468,7 @@ static int mpegts_read_header(AVFormatContext *s, /* normal demux */ /* first do a scaning to get all the services */ - if (url_fseek(pb, pos, SEEK_SET) < 0) + if (avio_seek(pb, pos, SEEK_SET) < 0) av_log(s, AV_LOG_ERROR, "Unable to seek back to the start\n"); mpegts_open_section_filter(ts, SDT_PID, sdt_cb, ts, 1); @@ -1533,7 +1533,7 @@ static int mpegts_read_header(AVFormatContext *s, #endif } - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); return 0; fail: return -1; @@ -1564,7 +1564,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s, /* we read the next PCR (XXX: optimize it by using a bigger buffer */ pos = url_ftell(s->pb); for(i = 0; i < MAX_PACKET_READAHEAD; i++) { - url_fseek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET); + avio_seek(s->pb, pos + i * ts->raw_packet_size, SEEK_SET); avio_read(s->pb, pcr_buf, 12); if (parse_pcr(&next_pcr_h, &next_pcr_l, pcr_buf) == 0) { /* XXX: not precise enough */ @@ -1573,7 +1573,7 @@ static int mpegts_raw_read_packet(AVFormatContext *s, break; } } - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); /* no next PCR found: we use previous increment */ ts->cur_pcr = pcr_h * 300 + pcr_l; } @@ -1649,7 +1649,7 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, pos = ((*ppos + ts->raw_packet_size - 1 - ts->pos47) / ts->raw_packet_size) * ts->raw_packet_size + ts->pos47; if (find_next) { for(;;) { - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) return AV_NOPTS_VALUE; if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) && @@ -1663,7 +1663,7 @@ static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, pos -= ts->raw_packet_size; if (pos < 0) return AV_NOPTS_VALUE; - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) return AV_NOPTS_VALUE; if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) && @@ -1774,14 +1774,14 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, in pos= url_ftell(s->pb); for(;;) { - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); if (avio_read(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) return -1; // pid = AV_RB16(buf + 1) & 0x1fff; if(buf[1] & 0x40) break; pos += ts->raw_packet_size; } - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); return 0; } diff --git a/libavformat/mtv.c b/libavformat/mtv.c index 94d8aff548..af1a8f01ce 100644 --- a/libavformat/mtv.c +++ b/libavformat/mtv.c @@ -146,7 +146,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) // Jump over header - if(url_fseek(pb, MTV_HEADER_SIZE, SEEK_SET) != MTV_HEADER_SIZE) + if(avio_seek(pb, MTV_HEADER_SIZE, SEEK_SET) != MTV_HEADER_SIZE) return AVERROR(EIO); return 0; diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index 9f694e30ff..3810c0cc63 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -897,7 +897,7 @@ static int mxf_read_local_tags(MXFContext *mxf, KLVPacket *klv, MXFMetadataReadF else if (read_child(ctx, pb, tag, size, uid) < 0) return -1; - url_fseek(pb, next, SEEK_SET); + avio_seek(pb, next, SEEK_SET); } if (ctx_size) ctx->type = type; return ctx_size ? mxf_add_metadata_set(mxf, ctx) : 0; @@ -912,7 +912,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "could not find header partition pack key\n"); return -1; } - url_fseek(s->pb, -14, SEEK_CUR); + avio_seek(s->pb, -14, SEEK_CUR); mxf->fc = s; while (!url_feof(s->pb)) { const MXFMetadataReadTableEntry *metadata; @@ -924,7 +924,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap) if (IS_KLV_KEY(klv.key, mxf_encrypted_triplet_key) || IS_KLV_KEY(klv.key, mxf_essence_element_key)) { /* FIXME avoid seek */ - url_fseek(s->pb, klv.offset, SEEK_SET); + avio_seek(s->pb, klv.offset, SEEK_SET); break; } @@ -1009,7 +1009,7 @@ static int mxf_read_seek(AVFormatContext *s, int stream_index, int64_t sample_ti if (sample_time < 0) sample_time = 0; seconds = av_rescale(sample_time, st->time_base.num, st->time_base.den); - url_fseek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET); + avio_seek(s->pb, (s->bit_rate * seconds) >> 3, SEEK_SET); av_update_cur_dts(s, st, sample_time); return 0; } diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 9e63531388..395d7c392d 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -1267,9 +1267,9 @@ static void mxf_write_partition(AVFormatContext *s, int bodysid, header_byte_count = pos - start + klv_fill_size(pos); // update header_byte_count - url_fseek(pb, header_byte_count_offset, SEEK_SET); + avio_seek(pb, header_byte_count_offset, SEEK_SET); avio_wb64(pb, header_byte_count); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } put_flush_packet(pb); @@ -1785,7 +1785,7 @@ static int mxf_write_footer(AVFormatContext *s) mxf_write_random_index_pack(s); if (!url_is_streamed(s->pb)) { - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); if (mxf->edit_unit_byte_count) { mxf_write_partition(s, 1, 2, header_closed_partition_key, 1); mxf_write_klv_fill(s); diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index 6ac8866144..dfd5e0fc78 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -364,7 +364,7 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) av_dlog(s, "NSV [dataoffset][fileoffset]\n", table_entries); for (i = 0; i < table_entries; i++) { unsigned char b[8]; - url_fseek(pb, size + nsv->nsvs_file_offset[i], SEEK_SET); + avio_seek(pb, size + nsv->nsvs_file_offset[i], SEEK_SET); avio_read(pb, b, 8); av_dlog(s, "NSV [0x%08lx][0x%08lx]: %02x %02x %02x %02x %02x %02x %02x %02x" "%c%c%c%c%c%c%c%c\n", @@ -372,11 +372,11 @@ static int nsv_parse_NSVf_header(AVFormatContext *s, AVFormatParameters *ap) b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7], V(b[0]), V(b[1]), V(b[2]), V(b[3]), V(b[4]), V(b[5]), V(b[6]), V(b[7]) ); } - //url_fseek(pb, size, SEEK_SET); /* go back to end of header */ + //avio_seek(pb, size, SEEK_SET); /* go back to end of header */ #undef V #endif - url_fseek(pb, nsv->base_offset + size, SEEK_SET); /* required for dumbdriving-271.nsv (2 extra bytes) */ + avio_seek(pb, nsv->base_offset + size, SEEK_SET); /* required for dumbdriving-271.nsv (2 extra bytes) */ if (url_feof(pb)) return -1; @@ -700,7 +700,7 @@ static int nsv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp if(index < 0) return -1; - url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET); + avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET); nst->frame_offset = st->index_entries[index].timestamp; nsv->state = NSV_UNSYNC; return 0; diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index a2e6ec17f1..7920b0d13f 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -119,7 +119,7 @@ static uint64_t find_any_startcode(AVIOContext *bc, int64_t pos){ uint64_t state=0; if(pos >= 0) - 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 + avio_seek(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 while(!url_feof(bc)){ state= (state<<8) | avio_r8(bc); @@ -178,7 +178,7 @@ static int nut_probe(AVProbeData *p){ static int skip_reserved(AVIOContext *bc, int64_t pos){ pos -= url_ftell(bc); if(pos<0){ - url_fseek(bc, pos, SEEK_CUR); + avio_seek(bc, pos, SEEK_CUR); return -1; }else{ while(pos--) @@ -513,8 +513,8 @@ static int find_and_decode_index(NUTContext *nut){ int8_t *has_keyframe; int ret= -1; - url_fseek(bc, filesize-12, SEEK_SET); - url_fseek(bc, filesize-avio_rb64(bc), SEEK_SET); + avio_seek(bc, filesize-12, SEEK_SET); + avio_seek(bc, filesize-avio_rb64(bc), SEEK_SET); if(avio_rb64(bc) != INDEX_STARTCODE){ av_log(s, AV_LOG_ERROR, "no index at the end\n"); return -1; @@ -655,7 +655,7 @@ static int nut_read_header(AVFormatContext *s, AVFormatParameters *ap) if(!url_is_streamed(bc)){ int64_t orig_pos= url_ftell(bc); find_and_decode_index(nut); - url_fseek(bc, orig_pos, SEEK_SET); + avio_seek(bc, orig_pos, SEEK_SET); } assert(nut->next_startcode == SYNCPOINT_STARTCODE); @@ -803,7 +803,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) case STREAM_STARTCODE: case INDEX_STARTCODE: skip= get_packetheader(nut, bc, 0, tmp); - url_fseek(bc, skip, SEEK_CUR); + avio_seek(bc, skip, SEEK_CUR); break; case INFO_STARTCODE: if(decode_info_header(nut)<0) @@ -900,7 +900,7 @@ static int read_seek(AVFormatContext *s, int stream_index, int64_t pts, int flag } av_log(NULL, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos2); pos= find_startcode(s->pb, SYNCPOINT_STARTCODE, pos2); - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); av_log(NULL, AV_LOG_DEBUG, "SP: %"PRId64"\n", pos); if(pos2 > pos || pos2 + 15 < pos){ av_log(NULL, AV_LOG_ERROR, "no syncpoint at backptr pos\n"); diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c index a79cd3ef9d..af9860bf53 100644 --- a/libavformat/oggdec.c +++ b/libavformat/oggdec.c @@ -97,7 +97,7 @@ ogg_restore (AVFormatContext * s, int discard) for (i = 0; i < ogg->nstreams; i++) av_free (ogg->streams[i].buf); - url_fseek (bc, ost->pos, SEEK_SET); + avio_seek (bc, ost->pos, SEEK_SET); ogg->curidx = ost->curidx; ogg->nstreams = ost->nstreams; memcpy(ogg->streams, ost->streams, @@ -468,7 +468,7 @@ ogg_get_length (AVFormatContext * s) end = size > MAX_PAGE_SIZE? size - MAX_PAGE_SIZE: 0; ogg_save (s); - url_fseek (s->pb, end, SEEK_SET); + avio_seek (s->pb, end, SEEK_SET); while (!ogg_read_page (s, &i)){ if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 && @@ -604,7 +604,7 @@ ogg_read_timestamp (AVFormatContext * s, int stream_index, int64_t * pos_arg, AVIOContext *bc = s->pb; int64_t pts = AV_NOPTS_VALUE; int i; - url_fseek(bc, *pos_arg, SEEK_SET); + avio_seek(bc, *pos_arg, SEEK_SET); ogg_reset(ogg); while (url_ftell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) { diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c index fc4010d3b8..92591dde12 100644 --- a/libavformat/oggenc.c +++ b/libavformat/oggenc.c @@ -69,9 +69,9 @@ static void ogg_update_checksum(AVFormatContext *s, AVIOContext *pb, int64_t crc { int64_t pos = url_ftell(pb); uint32_t checksum = get_checksum(pb); - url_fseek(pb, crc_offset, SEEK_SET); + avio_seek(pb, crc_offset, SEEK_SET); avio_wb32(pb, checksum); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } static int ogg_write_page(AVFormatContext *s, OGGPage *page, int extra_flags) diff --git a/libavformat/pcm.c b/libavformat/pcm.c index 5de23af1cb..def183c5b2 100644 --- a/libavformat/pcm.c +++ b/libavformat/pcm.c @@ -49,7 +49,7 @@ int pcm_read_seek(AVFormatContext *s, /* recompute exact position */ st->cur_dts = av_rescale(pos, st->time_base.den, byte_rate * (int64_t)st->time_base.num); - if ((ret = url_fseek(s->pb, pos + s->data_offset, SEEK_SET)) < 0) + if ((ret = avio_seek(s->pb, pos + s->data_offset, SEEK_SET)) < 0) return ret; return 0; } diff --git a/libavformat/psxstr.c b/libavformat/psxstr.c index 69013c5f58..a0dc531ae6 100644 --- a/libavformat/psxstr.c +++ b/libavformat/psxstr.c @@ -112,7 +112,7 @@ static int str_read_header(AVFormatContext *s, else start = 0; - url_fseek(pb, start, SEEK_SET); + avio_seek(pb, start, SEEK_SET); for(i=0; i<32; i++){ str->channels[i].video_stream_index= diff --git a/libavformat/pva.c b/libavformat/pva.c index ea7db47c76..f781026c1c 100644 --- a/libavformat/pva.c +++ b/libavformat/pva.c @@ -182,7 +182,7 @@ static int64_t pva_read_timestamp(struct AVFormatContext *s, int stream_index, while (*pos < pos_limit) { res = AV_NOPTS_VALUE; - url_fseek(pb, *pos, SEEK_SET); + avio_seek(pb, *pos, SEEK_SET); pvactx->continue_pes = 0; if (read_part_of_packet(s, &res, &length, &streamid, 0)) { diff --git a/libavformat/r3d.c b/libavformat/r3d.c index bb39e03e50..63ed26cee3 100644 --- a/libavformat/r3d.c +++ b/libavformat/r3d.c @@ -180,7 +180,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) if (url_is_streamed(s->pb)) return 0; // find REOB/REOF/REOS to load index - url_fseek(s->pb, url_fsize(s->pb)-48-8, SEEK_SET); + avio_seek(s->pb, url_fsize(s->pb)-48-8, SEEK_SET); if (read_atom(s, &atom) < 0) av_log(s, AV_LOG_ERROR, "error reading end atom\n"); @@ -192,7 +192,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) r3d_read_reos(s); if (r3d->rdvo_offset) { - url_fseek(s->pb, r3d->rdvo_offset, SEEK_SET); + avio_seek(s->pb, r3d->rdvo_offset, SEEK_SET); if (read_atom(s, &atom) < 0) av_log(s, AV_LOG_ERROR, "error reading 'rdvo' atom\n"); if (atom.tag == MKTAG('R','D','V','O')) { @@ -202,7 +202,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) } out: - url_fseek(s->pb, s->data_offset, SEEK_SET); + avio_seek(s->pb, s->data_offset, SEEK_SET); return 0; } @@ -359,7 +359,7 @@ static int r3d_seek(AVFormatContext *s, int stream_index, int64_t sample_time, i av_dlog(s, "seek frame num %d timestamp %lld\n", frame_num, sample_time); if (frame_num < r3d->video_offsets_count) { - url_fseek(s->pb, r3d->video_offsets_count, SEEK_SET); + avio_seek(s->pb, r3d->video_offsets_count, SEEK_SET); } else { av_log(s, AV_LOG_ERROR, "could not seek to frame %d\n", frame_num); return -1; diff --git a/libavformat/rdt.c b/libavformat/rdt.c index ad84a6cbe5..022cb720ac 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -174,7 +174,7 @@ rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr) size = avio_rb32(&pb); } else { size = rdt->mlti_data_size; - url_fseek(&pb, 0, SEEK_SET); + avio_seek(&pb, 0, SEEK_SET); } if (ff_rm_read_mdpr_codecdata(rdt->rmctx, &pb, st, rdt->rmst[st->index], size) < 0) return -1; diff --git a/libavformat/riff.c b/libavformat/riff.c index 4e21b1c841..9fd5c50609 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -332,9 +332,9 @@ void ff_end_tag(AVIOContext *pb, int64_t start) int64_t pos; pos = url_ftell(pb); - url_fseek(pb, start - 4, SEEK_SET); + avio_seek(pb, start - 4, SEEK_SET); avio_wl32(pb, (uint32_t)(pos - start)); - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } /* WAVEFORMATEX header */ diff --git a/libavformat/rl2.c b/libavformat/rl2.c index 16e029f679..eb1ef1285e 100644 --- a/libavformat/rl2.c +++ b/libavformat/rl2.c @@ -237,7 +237,7 @@ static int rl2_read_packet(AVFormatContext *s, ++rl2->index_pos[stream_id]; /** position the stream (will probably be there anyway) */ - url_fseek(pb, sample->pos, SEEK_SET); + avio_seek(pb, sample->pos, SEEK_SET); /** fill the packet */ ret = av_get_packet(pb, pkt, sample->size); diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index c34d128e40..4d7c763db4 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -363,7 +363,7 @@ static int rm_read_index(AVFormatContext *s) skip: if (next_off && url_ftell(pb) != next_off && - url_fseek(pb, next_off, SEEK_SET) < 0) + avio_seek(pb, next_off, SEEK_SET) < 0) return -1; } while (next_off); @@ -482,9 +482,9 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) if (!data_off) data_off = url_ftell(pb) - 18; if (indx_off && !url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX) && - url_fseek(pb, indx_off, SEEK_SET) >= 0) { + avio_seek(pb, indx_off, SEEK_SET) >= 0) { rm_read_index(s); - url_fseek(pb, data_off + 18, SEEK_SET); + avio_seek(pb, data_off + 18, SEEK_SET); } return 0; @@ -904,7 +904,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index, if(rm->old_format) return AV_NOPTS_VALUE; - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); rm->remaining_len=0; for(;;){ int seq=1; diff --git a/libavformat/rmenc.c b/libavformat/rmenc.c index 29a6a35d18..8a608861f5 100644 --- a/libavformat/rmenc.c +++ b/libavformat/rmenc.c @@ -436,7 +436,7 @@ static int rm_write_trailer(AVFormatContext *s) if (!url_is_streamed(s->pb)) { /* end of file: finish to write header */ - index_pos = url_fseek(pb, 0, SEEK_CUR); + index_pos = avio_seek(pb, 0, SEEK_CUR); data_size = index_pos - rm->data_pos; /* FIXME: write index */ @@ -445,7 +445,7 @@ static int rm_write_trailer(AVFormatContext *s) avio_wb32(pb, 0); avio_wb32(pb, 0); - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); for(i=0;i<s->nb_streams;i++) rm->streams[i].total_frames = rm->streams[i].nb_frames; rv10_write_header(s, data_size, 0); diff --git a/libavformat/rpl.c b/libavformat/rpl.c index 5c0a21fe90..9702fc7035 100644 --- a/libavformat/rpl.c +++ b/libavformat/rpl.c @@ -250,7 +250,7 @@ static int rpl_read_header(AVFormatContext *s, AVFormatParameters *ap) error |= read_line(pb, line, sizeof(line)); // offset to key frame list // Read the index - url_fseek(pb, chunk_catalog_offset, SEEK_SET); + avio_seek(pb, chunk_catalog_offset, SEEK_SET); total_audio_size = 0; for (i = 0; i < number_of_chunks; i++) { int64_t offset, video_size, audio_size; @@ -292,7 +292,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) index_entry = &stream->index_entries[rpl->chunk_number]; if (rpl->frame_in_part == 0) - if (url_fseek(pb, index_entry->pos, SEEK_SET) < 0) + if (avio_seek(pb, index_entry->pos, SEEK_SET) < 0) return AVERROR(EIO); if (stream->codec->codec_type == AVMEDIA_TYPE_VIDEO && @@ -303,7 +303,7 @@ static int rpl_read_packet(AVFormatContext *s, AVPacket *pkt) frame_flags = avio_rl32(pb); frame_size = avio_rl32(pb); - if (url_fseek(pb, -8, SEEK_CUR) < 0) + if (avio_seek(pb, -8, SEEK_CUR) < 0) return AVERROR(EIO); ret = av_get_packet(pb, pkt, frame_size); diff --git a/libavformat/rsoenc.c b/libavformat/rsoenc.c index 9c5ee9bd62..c776a1ac2a 100644 --- a/libavformat/rsoenc.c +++ b/libavformat/rsoenc.c @@ -91,9 +91,9 @@ static int rso_write_trailer(AVFormatContext *s) } /* update file size */ - url_fseek(pb, 2, SEEK_SET); + avio_seek(pb, 2, SEEK_SET); avio_wb16(pb, coded_file_size); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); put_flush_packet(pb); diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c index 24052a2357..7476bb944e 100644 --- a/libavformat/rtpdec_qt.c +++ b/libavformat/rtpdec_qt.c @@ -103,7 +103,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, skip_bits(&gb, 12); // reserved data_len = get_bits(&gb, 16); - url_fseek(&pb, pos + 4, SEEK_SET); + avio_seek(&pb, pos + 4, SEEK_SET); tag = avio_rl32(&pb); if ((st->codec->codec_type == AVMEDIA_TYPE_VIDEO && tag != MKTAG('v','i','d','e')) || @@ -157,7 +157,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, /* 32-bit alignment */ url_fskip(&pb, ((url_ftell(&pb) + 3) & ~3) - url_ftell(&pb)); } else - url_fseek(&pb, 4, SEEK_SET); + avio_seek(&pb, 4, SEEK_SET); if (has_packet_info) { av_log_missing_feature(s, "RTP-X-QT with packet specific info", 1); diff --git a/libavformat/sauce.c b/libavformat/sauce.c index e861b14e16..f4ebc2fe68 100644 --- a/libavformat/sauce.c +++ b/libavformat/sauce.c @@ -35,7 +35,7 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g int datatype, filetype, t1, t2, nb_comments, flags; uint64_t start_pos = url_fsize(pb) - 128; - url_fseek(pb, start_pos, SEEK_SET); + avio_seek(pb, start_pos, SEEK_SET); if (avio_read(pb, buf, 7) != 7) return -1; if (memcmp(buf, "SAUCE00", 7)) @@ -82,7 +82,7 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g *fsize -= 128; if (nb_comments > 0) { - url_fseek(pb, start_pos - 64*nb_comments - 5, SEEK_SET); + avio_seek(pb, start_pos - 64*nb_comments - 5, SEEK_SET); if (avio_read(pb, buf, 5) == 5 && !memcmp(buf, "COMNT", 5)) { int i; char *str = av_malloc(65*nb_comments + 1); diff --git a/libavformat/seek.c b/libavformat/seek.c index 26b622f035..9fee91101c 100644 --- a/libavformat/seek.c +++ b/libavformat/seek.c @@ -313,7 +313,7 @@ int64_t ff_gen_syncpoint_search(AVFormatContext *s, step = s->pb->buffer_size; curpos = FFMAX(pos - step / 2, 0); for (;;) { - url_fseek(s->pb, curpos, SEEK_SET); + avio_seek(s->pb, curpos, SEEK_SET); search_hi_lo_keyframes(s, ts, time_base, flags, @@ -385,7 +385,7 @@ int64_t ff_gen_syncpoint_search(AVFormatContext *s, } } - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); av_free(sync); return pos; } @@ -456,7 +456,7 @@ void ff_restore_parser_state(AVFormatContext *s, AVParserState *state) if (!state) return; - url_fseek(s->pb, state->fpos, SEEK_SET); + avio_seek(s->pb, state->fpos, SEEK_SET); // copy context structures s->cur_st = state->cur_st; diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c index 906cb915ad..7b689906cc 100644 --- a/libavformat/segafilm.c +++ b/libavformat/segafilm.c @@ -217,7 +217,7 @@ static int film_read_packet(AVFormatContext *s, sample = &film->sample_table[film->current_sample]; /* position the stream (will probably be there anyway) */ - url_fseek(pb, sample->sample_offset, SEEK_SET); + avio_seek(pb, sample->sample_offset, SEEK_SET); /* do a special song and dance when loading FILM Cinepak chunks */ if ((sample->stream == film->video_stream_index) && diff --git a/libavformat/sierravmd.c b/libavformat/sierravmd.c index 323938639c..778746594a 100644 --- a/libavformat/sierravmd.c +++ b/libavformat/sierravmd.c @@ -95,7 +95,7 @@ static int vmd_read_header(AVFormatContext *s, int sound_buffers; /* fetch the main header, including the 2 header length bytes */ - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); if (avio_read(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE) return AVERROR(EIO); @@ -155,7 +155,7 @@ static int vmd_read_header(AVFormatContext *s, toc_offset = AV_RL32(&vmd->vmd_header[812]); vmd->frame_count = AV_RL16(&vmd->vmd_header[6]); vmd->frames_per_block = AV_RL16(&vmd->vmd_header[18]); - url_fseek(pb, toc_offset, SEEK_SET); + avio_seek(pb, toc_offset, SEEK_SET); raw_frame_table = NULL; vmd->frame_table = NULL; @@ -243,7 +243,7 @@ static int vmd_read_packet(AVFormatContext *s, frame = &vmd->frame_table[vmd->current_frame]; /* position the stream (will probably be there already) */ - url_fseek(pb, frame->frame_offset, SEEK_SET); + avio_seek(pb, frame->frame_offset, SEEK_SET); if (av_new_packet(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD)) return AVERROR(ENOMEM); diff --git a/libavformat/smacker.c b/libavformat/smacker.c index 42d3672d79..8feb4e5f69 100644 --- a/libavformat/smacker.c +++ b/libavformat/smacker.c @@ -240,7 +240,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) /* if we demuxed all streams, pass another frame */ if(smk->curstream < 0) { - url_fseek(s->pb, smk->nextpos, 0); + avio_seek(s->pb, smk->nextpos, 0); frame_size = smk->frm_size[smk->cur_frame] & (~3); flags = smk->frm_flags[smk->cur_frame]; /* handle palette change event */ @@ -279,7 +279,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) sz++; } } - url_fseek(s->pb, pos, 0); + avio_seek(s->pb, pos, 0); palchange |= 1; } flags >>= 1; diff --git a/libavformat/soxenc.c b/libavformat/soxenc.c index 9c06dd7ea3..dbb2972ead 100644 --- a/libavformat/soxenc.c +++ b/libavformat/soxenc.c @@ -100,12 +100,12 @@ static int sox_write_trailer(AVFormatContext *s) /* update number of samples */ int64_t file_size = url_ftell(pb); int64_t num_samples = (file_size - sox->header_size - 4LL) >> 2LL; - url_fseek(pb, 8, SEEK_SET); + avio_seek(pb, 8, SEEK_SET); if (enc->codec_id == CODEC_ID_PCM_S32LE) { avio_wl64(pb, num_samples); } else avio_wb64(pb, num_samples); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); put_flush_packet(pb); } diff --git a/libavformat/swfenc.c b/libavformat/swfenc.c index 296b9c27d9..c898c0ec5f 100644 --- a/libavformat/swfenc.c +++ b/libavformat/swfenc.c @@ -50,7 +50,7 @@ static void put_swf_end_tag(AVFormatContext *s) pos = url_ftell(pb); tag_len = pos - swf->tag_pos - 2; tag = swf->tag; - url_fseek(pb, swf->tag_pos, SEEK_SET); + avio_seek(pb, swf->tag_pos, SEEK_SET); if (tag & TAG_LONG) { tag &= ~TAG_LONG; avio_wl16(pb, (tag << 6) | 0x3f); @@ -59,7 +59,7 @@ static void put_swf_end_tag(AVFormatContext *s) assert(tag_len < 0x3f); avio_wl16(pb, (tag << 6) | tag_len); } - url_fseek(pb, pos, SEEK_SET); + avio_seek(pb, pos, SEEK_SET); } static inline void max_nbits(int *nbits_ptr, int val) @@ -494,13 +494,13 @@ static int swf_write_trailer(AVFormatContext *s) /* patch file size and number of frames if not streamed */ if (!url_is_streamed(s->pb) && video_enc) { file_size = url_ftell(pb); - url_fseek(pb, 4, SEEK_SET); + avio_seek(pb, 4, SEEK_SET); avio_wl32(pb, file_size); - url_fseek(pb, swf->duration_pos, SEEK_SET); + avio_seek(pb, swf->duration_pos, SEEK_SET); avio_wl16(pb, swf->video_frame_number); - url_fseek(pb, swf->vframes_pos, SEEK_SET); + avio_seek(pb, swf->vframes_pos, SEEK_SET); avio_wl16(pb, swf->video_frame_number); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); } return 0; } diff --git a/libavformat/thp.c b/libavformat/thp.c index 39a8bc2c35..2d1f74e38b 100644 --- a/libavformat/thp.c +++ b/libavformat/thp.c @@ -81,7 +81,7 @@ static int thp_read_header(AVFormatContext *s, thp->next_frame = thp->first_frame; /* Read the component structure. */ - url_fseek (pb, thp->compoff, SEEK_SET); + avio_seek (pb, thp->compoff, SEEK_SET); thp->compcount = avio_rb32(pb); /* Read the list of component types. */ @@ -149,7 +149,7 @@ static int thp_read_packet(AVFormatContext *s, if (thp->frame >= thp->framecnt) return AVERROR(EIO); - url_fseek(pb, thp->next_frame, SEEK_SET); + avio_seek(pb, thp->next_frame, SEEK_SET); /* Locate the next frame and read out its size. */ thp->next_frame += thp->next_framesz; diff --git a/libavformat/tiertexseq.c b/libavformat/tiertexseq.c index e368b17959..f8a5db1813 100644 --- a/libavformat/tiertexseq.c +++ b/libavformat/tiertexseq.c @@ -83,7 +83,7 @@ static int seq_init_frame_buffers(SeqDemuxContext *seq, AVIOContext *pb) int i, sz; TiertexSeqFrameBuffer *seq_buffer; - url_fseek(pb, 256, SEEK_SET); + avio_seek(pb, 256, SEEK_SET); for (i = 0; i < SEQ_NUM_FRAME_BUFFERS; i++) { sz = avio_rl16(pb); @@ -113,7 +113,7 @@ static int seq_fill_buffer(SeqDemuxContext *seq, AVIOContext *pb, int buffer_num if (seq_buffer->fill_size + data_size > seq_buffer->data_size || data_size <= 0) return AVERROR_INVALIDDATA; - url_fseek(pb, seq->current_frame_offs + data_offs, SEEK_SET); + avio_seek(pb, seq->current_frame_offs + data_offs, SEEK_SET); if (avio_read(pb, seq_buffer->data + seq_buffer->fill_size, data_size) != data_size) return AVERROR(EIO); @@ -128,7 +128,7 @@ static int seq_parse_frame_data(SeqDemuxContext *seq, AVIOContext *pb) int i, e, err; seq->current_frame_offs += SEQ_FRAME_SIZE; - url_fseek(pb, seq->current_frame_offs, SEEK_SET); + avio_seek(pb, seq->current_frame_offs, SEEK_SET); /* sound data */ seq->current_audio_data_offs = avio_rl16(pb); @@ -256,7 +256,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->data[0] = 0; if (seq->current_pal_data_size) { pkt->data[0] |= 1; - url_fseek(pb, seq->current_frame_offs + seq->current_pal_data_offs, SEEK_SET); + avio_seek(pb, seq->current_frame_offs + seq->current_pal_data_offs, SEEK_SET); if (avio_read(pb, &pkt->data[1], seq->current_pal_data_size) != seq->current_pal_data_size) return AVERROR(EIO); } @@ -279,7 +279,7 @@ static int seq_read_packet(AVFormatContext *s, AVPacket *pkt) if (seq->current_audio_data_offs == 0) /* end of data reached */ return AVERROR(EIO); - url_fseek(pb, seq->current_frame_offs + seq->current_audio_data_offs, SEEK_SET); + avio_seek(pb, seq->current_frame_offs + seq->current_audio_data_offs, SEEK_SET); rc = av_get_packet(pb, pkt, seq->current_audio_data_size); if (rc < 0) return rc; diff --git a/libavformat/tmv.c b/libavformat/tmv.c index 3fe9e65dcc..7b0691db0f 100644 --- a/libavformat/tmv.c +++ b/libavformat/tmv.c @@ -173,7 +173,7 @@ static int tmv_read_seek(AVFormatContext *s, int stream_index, pos = timestamp * (tmv->audio_chunk_size + tmv->video_chunk_size + tmv->padding); - url_fseek(s->pb, pos + TMV_HEADER_SIZE, SEEK_SET); + avio_seek(s->pb, pos + TMV_HEADER_SIZE, SEEK_SET); tmv->stream_index = 0; return 0; } diff --git a/libavformat/tta.c b/libavformat/tta.c index 61a41df90b..42d551de35 100644 --- a/libavformat/tta.c +++ b/libavformat/tta.c @@ -106,7 +106,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; } st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE); - url_fseek(s->pb, start_offset, SEEK_SET); + avio_seek(s->pb, start_offset, SEEK_SET); avio_read(s->pb, st->codec->extradata, st->codec->extradata_size); return 0; @@ -138,7 +138,7 @@ static int tta_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp return -1; c->currentframe = index; - url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET); + avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET); return 0; } diff --git a/libavformat/tty.c b/libavformat/tty.c index 767006b5a3..74750584c1 100644 --- a/libavformat/tty.c +++ b/libavformat/tty.c @@ -46,7 +46,7 @@ static int efi_read(AVFormatContext *avctx, uint64_t start_pos) char buf[37]; int len; - url_fseek(pb, start_pos, SEEK_SET); + avio_seek(pb, start_pos, SEEK_SET); if (avio_r8(pb) != 0x1A) return -1; @@ -95,7 +95,7 @@ static int read_header(AVFormatContext *avctx, if (ff_sauce_read(avctx, &s->fsize, 0, 0) < 0) efi_read(avctx, s->fsize - 51); - url_fseek(avctx->pb, 0, SEEK_SET); + avio_seek(avctx->pb, 0, SEEK_SET); } return 0; diff --git a/libavformat/utils.c b/libavformat/utils.c index 1f0164ffac..70da4ca147 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1531,7 +1531,7 @@ int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts return -1; /* do the seek */ - if ((ret = url_fseek(s->pb, pos, SEEK_SET)) < 0) + if ((ret = avio_seek(s->pb, pos, SEEK_SET)) < 0) return ret; av_update_cur_dts(s, st, ts); @@ -1671,7 +1671,7 @@ static int av_seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos, if (pos < pos_min) pos= pos_min; else if(pos > pos_max) pos= pos_max; - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); #if 0 av_update_cur_dts(s, st, ts); @@ -1701,11 +1701,11 @@ static int av_seek_frame_generic(AVFormatContext *s, if(st->nb_index_entries){ assert(st->index_entries); ie= &st->index_entries[st->nb_index_entries-1]; - if ((ret = url_fseek(s->pb, ie->pos, SEEK_SET)) < 0) + if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0) return ret; av_update_cur_dts(s, st, ie->timestamp); }else{ - if ((ret = url_fseek(s->pb, s->data_offset, SEEK_SET)) < 0) + if ((ret = avio_seek(s->pb, s->data_offset, SEEK_SET)) < 0) return ret; } for(i=0;; i++) { @@ -1732,7 +1732,7 @@ static int av_seek_frame_generic(AVFormatContext *s, return 0; } ie = &st->index_entries[index]; - if ((ret = url_fseek(s->pb, ie->pos, SEEK_SET)) < 0) + if ((ret = avio_seek(s->pb, ie->pos, SEEK_SET)) < 0) return ret; av_update_cur_dts(s, st, ie->timestamp); @@ -1956,7 +1956,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset if (offset < 0) offset = 0; - url_fseek(ic->pb, offset, SEEK_SET); + avio_seek(ic->pb, offset, SEEK_SET); read_size = 0; for(;;) { if (read_size >= DURATION_MAX_READ_SIZE<<(FFMAX(retry-1,0))) @@ -1991,7 +1991,7 @@ static void av_estimate_timings_from_pts(AVFormatContext *ic, int64_t old_offset fill_all_stream_timings(ic); - url_fseek(ic->pb, old_offset, SEEK_SET); + avio_seek(ic->pb, old_offset, SEEK_SET); for (i=0; i<ic->nb_streams; i++) { st= ic->streams[i]; st->cur_dts= st->first_dts; diff --git a/libavformat/vc1testenc.c b/libavformat/vc1testenc.c index 65889fc55c..65ac6029ac 100644 --- a/libavformat/vc1testenc.c +++ b/libavformat/vc1testenc.c @@ -74,7 +74,7 @@ static int vc1test_write_trailer(AVFormatContext *s) AVIOContext *pb = s->pb; if (!url_is_streamed(s->pb)) { - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); avio_wl24(pb, ctx->frames); put_flush_packet(pb); } diff --git a/libavformat/vqf.c b/libavformat/vqf.c index 8a3d170574..dfa1a156d0 100644 --- a/libavformat/vqf.c +++ b/libavformat/vqf.c @@ -240,7 +240,7 @@ static int vqf_read_seek(AVFormatContext *s, st->cur_dts = av_rescale(pos, st->time_base.den, st->codec->bit_rate * (int64_t)st->time_base.num); - if ((ret = url_fseek(s->pb, ((pos-7) >> 3) + s->data_offset, SEEK_SET)) < 0) + if ((ret = avio_seek(s->pb, ((pos-7) >> 3) + s->data_offset, SEEK_SET)) < 0) return ret; c->remaining_bits = -7 - ((pos-7)&7); diff --git a/libavformat/wav.c b/libavformat/wav.c index a574b3b16f..54f9ff7d87 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -103,9 +103,9 @@ static int wav_write_trailer(AVFormatContext *s) /* update file size */ file_size = url_ftell(pb); - url_fseek(pb, 4, SEEK_SET); + avio_seek(pb, 4, SEEK_SET); avio_wl32(pb, (uint32_t)(file_size - 8)); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); put_flush_packet(pb); @@ -115,9 +115,9 @@ static int wav_write_trailer(AVFormatContext *s) number_of_samples = av_rescale(wav->maxpts - wav->minpts + wav->last_duration, s->streams[0]->codec->sample_rate * (int64_t)s->streams[0]->time_base.num, s->streams[0]->time_base.den); - url_fseek(pb, wav->data-12, SEEK_SET); + avio_seek(pb, wav->data-12, SEEK_SET); avio_wl32(pb, number_of_samples); - url_fseek(pb, file_size, SEEK_SET); + avio_seek(pb, file_size, SEEK_SET); put_flush_packet(pb); } } @@ -160,7 +160,7 @@ static int64_t find_tag(AVIOContext *pb, uint32_t tag1) size = next_tag(pb, &tag); if (tag == tag1) break; - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); } return size; } @@ -243,7 +243,7 @@ static int wav_read_header(AVFormatContext *s, sample_count = avio_rl32(pb); size -= 4; } - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); } if (rf64) size = data_size; diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c index 478b46f913..a4dd26b442 100644 --- a/libavformat/wc3movie.c +++ b/libavformat/wc3movie.c @@ -101,7 +101,7 @@ static int wc3_read_header(AVFormatContext *s, wc3->vpkt.data = NULL; wc3->vpkt.size = 0; /* skip the first 3 32-bit numbers */ - url_fseek(pb, 12, SEEK_CUR); + avio_seek(pb, 12, SEEK_CUR); /* traverse through the chunks and load the header information before * the first BRCH tag */ @@ -114,12 +114,12 @@ static int wc3_read_header(AVFormatContext *s, case SOND_TAG: case INDX_TAG: /* SOND unknown, INDX unnecessary; ignore both */ - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); break; case PC__TAG: /* number of palettes, unneeded */ - url_fseek(pb, 12, SEEK_CUR); + avio_seek(pb, 12, SEEK_CUR); break; case BNAM_TAG: @@ -142,7 +142,7 @@ static int wc3_read_header(AVFormatContext *s, case PALT_TAG: /* one of several palettes */ - url_fseek(pb, -8, SEEK_CUR); + avio_seek(pb, -8, SEEK_CUR); av_append_packet(pb, &wc3->vpkt, 8 + PALETTE_SIZE); break; @@ -219,13 +219,13 @@ static int wc3_read_packet(AVFormatContext *s, case SHOT_TAG: /* load up new palette */ - url_fseek(pb, -8, SEEK_CUR); + avio_seek(pb, -8, SEEK_CUR); av_append_packet(pb, &wc3->vpkt, 8 + 4); break; case VGA__TAG: /* send out video chunk */ - url_fseek(pb, -8, SEEK_CUR); + avio_seek(pb, -8, SEEK_CUR); ret= av_append_packet(pb, &wc3->vpkt, 8 + size); // ignore error if we have some data if (wc3->vpkt.size > 0) @@ -240,7 +240,7 @@ static int wc3_read_packet(AVFormatContext *s, case TEXT_TAG: /* subtitle chunk */ #if 0 - url_fseek(pb, size, SEEK_CUR); + avio_seek(pb, size, SEEK_CUR); #else if ((unsigned)size > sizeof(text) || (ret = avio_read(pb, text, size)) != size) ret = AVERROR(EIO); diff --git a/libavformat/westwood.c b/libavformat/westwood.c index b923fef79c..adb35319e2 100644 --- a/libavformat/westwood.c +++ b/libavformat/westwood.c @@ -231,7 +231,7 @@ static int wsvqa_read_header(AVFormatContext *s, st->codec->codec_tag = 0; /* no fourcc */ /* skip to the start of the VQA header */ - url_fseek(pb, 20, SEEK_SET); + avio_seek(pb, 20, SEEK_SET); /* the VQA header needs to go to the decoder */ st->codec->extradata_size = VQA_HEADER_SIZE; @@ -303,7 +303,7 @@ static int wsvqa_read_header(AVFormatContext *s, break; } - url_fseek(pb, chunk_size, SEEK_CUR); + avio_seek(pb, chunk_size, SEEK_CUR); } while (chunk_tag != FINF_TAG); return 0; @@ -348,7 +348,7 @@ static int wsvqa_read_packet(AVFormatContext *s, } /* stay on 16-bit alignment */ if (skip_byte) - url_fseek(pb, 1, SEEK_CUR); + avio_seek(pb, 1, SEEK_CUR); return ret; } else { @@ -359,7 +359,7 @@ static int wsvqa_read_packet(AVFormatContext *s, default: av_log(s, AV_LOG_INFO, "Skipping unknown chunk 0x%08X\n", chunk_type); } - url_fseek(pb, chunk_size + skip_byte, SEEK_CUR); + avio_seek(pb, chunk_size + skip_byte, SEEK_CUR); } } diff --git a/libavformat/wtv.c b/libavformat/wtv.c index 0ed06aaa58..6c9993b15b 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -98,7 +98,7 @@ static int wtvfile_read_packet(void *opaque, uint8_t *buf, int buf_size) int i = wf->position >> wf->sector_bits; if (i >= wf->nb_sectors || (wf->sectors[i] != wf->sectors[i - 1] + (1 << (wf->sector_bits - WTV_SECTOR_BITS)) && - url_fseek(pb, (int64_t)wf->sectors[i] << WTV_SECTOR_BITS, SEEK_SET) < 0)) { + avio_seek(pb, (int64_t)wf->sectors[i] << WTV_SECTOR_BITS, SEEK_SET) < 0)) { wf->error = 1; break; } @@ -123,7 +123,7 @@ static int64_t wtvfile_seek(void *opaque, int64_t offset, int whence) offset = wf->length; wf->error = offset < 0 || offset >= wf->length || - url_fseek(pb, ((int64_t)wf->sectors[offset >> wf->sector_bits] << WTV_SECTOR_BITS) + avio_seek(pb, ((int64_t)wf->sectors[offset >> wf->sector_bits] << WTV_SECTOR_BITS) + (offset & ((1 << wf->sector_bits) - 1)), SEEK_SET) < 0; wf->position = offset; return offset; @@ -159,7 +159,7 @@ static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int WtvFile *wf; uint8_t *buffer; - if (url_fseek(s->pb, first_sector << WTV_SECTOR_BITS, SEEK_SET) < 0) + if (avio_seek(s->pb, first_sector << WTV_SECTOR_BITS, SEEK_SET) < 0) return NULL; wf = av_mallocz(sizeof(WtvFile)); @@ -195,7 +195,7 @@ static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int } wf->nb_sectors = 0; for (i = 0; i < nb_sectors1; i++) { - if (url_fseek(s->pb, (int64_t)sectors1[i] << WTV_SECTOR_BITS, SEEK_SET) < 0) + if (avio_seek(s->pb, (int64_t)sectors1[i] << WTV_SECTOR_BITS, SEEK_SET) < 0) break; wf->nb_sectors += read_ints(s->pb, wf->sectors + i * WTV_SECTOR_SIZE / 4, WTV_SECTOR_SIZE / 4); } @@ -222,7 +222,7 @@ static AVIOContext * wtvfile_open_sector(int first_sector, uint64_t length, int /* seek to intial sector */ wf->position = 0; - if (url_fseek(s->pb, (int64_t)wf->sectors[0] << WTV_SECTOR_BITS, SEEK_SET) < 0) { + if (avio_seek(s->pb, (int64_t)wf->sectors[0] << WTV_SECTOR_BITS, SEEK_SET) < 0) { av_free(wf->sectors); av_free(wf); return NULL; @@ -492,7 +492,7 @@ static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length) st->codec->extradata_size = filesize; avio_read(pb, st->codec->extradata, filesize); done: - url_fseek(pb, pos + length, SEEK_SET); + avio_seek(pb, pos + length, SEEK_SET); } static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int type, int length) @@ -665,7 +665,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, url_fskip(pb, size - 32); ff_get_guid(pb, &actual_subtype); ff_get_guid(pb, &actual_formattype); - url_fseek(pb, -size, SEEK_CUR); + avio_seek(pb, -size, SEEK_CUR); st = parse_media_type(s, st, sid, mediatype, actual_subtype, actual_formattype, size - 32); url_fskip(pb, 32); @@ -963,7 +963,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) url_fskip(s->pb, 4); root_sector = avio_rl32(s->pb); - url_fseek(s->pb, root_sector << WTV_SECTOR_BITS, SEEK_SET); + avio_seek(s->pb, root_sector << WTV_SECTOR_BITS, SEEK_SET); root_size = avio_read(s->pb, root, root_size); if (root_size < 0) return AVERROR_INVALIDDATA; @@ -978,7 +978,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) ret = parse_chunks(s, SEEK_TO_DATA, 0, 0); if (ret < 0) return ret; - url_fseek(wtv->pb, -32, SEEK_CUR); + avio_seek(wtv->pb, -32, SEEK_CUR); timeline_pos = url_ftell(s->pb); // save before opening another file @@ -1028,7 +1028,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) } } - url_fseek(s->pb, timeline_pos, SEEK_SET); + avio_seek(s->pb, timeline_pos, SEEK_SET); return 0; } @@ -1072,9 +1072,9 @@ static int read_seek(AVFormatContext *s, int stream_index, i = ff_index_search_timestamp(wtv->index_entries, wtv->nb_index_entries, ts_relative, flags); if (i < 0) { if (wtv->last_valid_pts == AV_NOPTS_VALUE || ts < wtv->last_valid_pts) - url_fseek(pb, 0, SEEK_SET); + avio_seek(pb, 0, SEEK_SET); else if (st->duration != AV_NOPTS_VALUE && ts_relative > st->duration && wtv->nb_index_entries) - url_fseek(pb, wtv->index_entries[wtv->nb_index_entries - 1].pos, SEEK_SET); + avio_seek(pb, wtv->index_entries[wtv->nb_index_entries - 1].pos, SEEK_SET); if (parse_chunks(s, SEEK_TO_PTS, ts, 0) < 0) return AVERROR(ERANGE); return 0; @@ -1083,7 +1083,7 @@ static int read_seek(AVFormatContext *s, int stream_index, if (wtv->epoch != AV_NOPTS_VALUE) wtv->pts += wtv->epoch; wtv->last_valid_pts = wtv->pts; - url_fseek(pb, wtv->index_entries[i].pos, SEEK_SET); + avio_seek(pb, wtv->index_entries[i].pos, SEEK_SET); return 0; } diff --git a/libavformat/wv.c b/libavformat/wv.c index fca35b818b..c2ef8d6356 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -175,7 +175,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen av_log(ctx, AV_LOG_ERROR, "Cannot determine custom sampling rate\n"); return -1; } - url_fseek(pb, block_end - wc->blksize + 24, SEEK_SET); + avio_seek(pb, block_end - wc->blksize + 24, SEEK_SET); } if(!wc->bpp) wc->bpp = bpp; if(!wc->chan) wc->chan = chan; @@ -228,7 +228,7 @@ static int wv_read_header(AVFormatContext *s, ff_ape_parse_tag(s); if(!av_metadata_get(s->metadata, "", NULL, AV_METADATA_IGNORE_SUFFIX)) ff_id3v1_read(s); - url_fseek(s->pb, cur, SEEK_SET); + avio_seek(s->pb, cur, SEEK_SET); } return 0; @@ -320,7 +320,7 @@ static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, /* if found, seek there */ if (index >= 0){ wc->block_parsed = 1; - url_fseek(s->pb, st->index_entries[index].pos, SEEK_SET); + avio_seek(s->pb, st->index_entries[index].pos, SEEK_SET); return 0; } /* if timestamp is out of bounds, return error */ @@ -331,7 +331,7 @@ static int wv_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, do{ ret = av_read_frame(s, pkt); if (ret < 0){ - url_fseek(s->pb, pos, SEEK_SET); + avio_seek(s->pb, pos, SEEK_SET); return -1; } pts = pkt->pts; diff --git a/libavformat/yop.c b/libavformat/yop.c index 2e58cc660a..0c87724c53 100644 --- a/libavformat/yop.c +++ b/libavformat/yop.c @@ -104,7 +104,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) return AVERROR_INVALIDDATA; } - url_fseek(pb, 2048, SEEK_SET); + avio_seek(pb, 2048, SEEK_SET); av_set_pts_info(video_stream, 32, 1, frame_rate); @@ -198,7 +198,7 @@ static int yop_read_seek(AVFormatContext *s, int stream_index, frame_pos = timestamp * yop->frame_size + pos_min; yop->odd_frame = timestamp & 1; - url_fseek(s->pb, frame_pos, SEEK_SET); + avio_seek(s->pb, frame_pos, SEEK_SET); return 0; } |