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

lavf: replace all uses of url_fskip with avio_seek

Signed-off-by: 's avatarRonald S. Bultje <rsbultje@gmail.com>
parent 6b4aa5da
...@@ -62,9 +62,9 @@ static int aea_read_header(AVFormatContext *s, ...@@ -62,9 +62,9 @@ static int aea_read_header(AVFormatContext *s,
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
/* Parse the amount of channels and skip to pos 2048(0x800) */ /* Parse the amount of channels and skip to pos 2048(0x800) */
url_fskip(s->pb, 264); avio_seek(s->pb, 264, SEEK_CUR);
st->codec->channels = avio_r8(s->pb); st->codec->channels = avio_r8(s->pb);
url_fskip(s->pb, 1783); avio_seek(s->pb, 1783, SEEK_CUR);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
......
...@@ -70,7 +70,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size) ...@@ -70,7 +70,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size)
int res; int res;
if (!str) { if (!str) {
url_fskip(s->pb, size); avio_seek(s->pb, size, SEEK_CUR);
return; return;
} }
...@@ -242,7 +242,7 @@ static int aiff_read_header(AVFormatContext *s, ...@@ -242,7 +242,7 @@ static int aiff_read_header(AVFormatContext *s,
av_log(s, AV_LOG_ERROR, "file is not seekable\n"); av_log(s, AV_LOG_ERROR, "file is not seekable\n");
return -1; return -1;
} }
url_fskip(pb, size - 8); avio_seek(pb, size - 8, SEEK_CUR);
break; break;
case MKTAG('w', 'a', 'v', 'e'): case MKTAG('w', 'a', 'v', 'e'):
if ((uint64_t)size > (1<<30)) if ((uint64_t)size > (1<<30))
...@@ -256,7 +256,7 @@ static int aiff_read_header(AVFormatContext *s, ...@@ -256,7 +256,7 @@ static int aiff_read_header(AVFormatContext *s,
default: /* Jump */ default: /* Jump */
if (size & 1) /* Always even aligned */ if (size & 1) /* Always even aligned */
size++; size++;
url_fskip (pb, size); avio_seek(pb, size, SEEK_CUR);
} }
} }
......
...@@ -83,7 +83,7 @@ static int read_header(AVFormatContext *s, ...@@ -83,7 +83,7 @@ static int read_header(AVFormatContext *s,
AVStream *st; AVStream *st;
int i, ret; int i, ret;
url_fskip(pb, 4); /* magic number */ avio_seek(pb, 4, SEEK_CUR); /* magic number */
if (avio_rl16(pb) != MAX_PAGES) { if (avio_rl16(pb) != MAX_PAGES) {
av_log_ask_for_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES) "\n"); av_log_ask_for_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES) "\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
...@@ -91,7 +91,7 @@ static int read_header(AVFormatContext *s, ...@@ -91,7 +91,7 @@ static int read_header(AVFormatContext *s,
anm->nb_pages = avio_rl16(pb); anm->nb_pages = avio_rl16(pb);
anm->nb_records = avio_rl32(pb); anm->nb_records = avio_rl32(pb);
url_fskip(pb, 2); /* max records per page */ avio_seek(pb, 2, SEEK_CUR); /* max records per page */
anm->page_table_offset = avio_rl16(pb); anm->page_table_offset = avio_rl16(pb);
if (avio_rl32(pb) != ANIM_TAG) if (avio_rl32(pb) != ANIM_TAG)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
...@@ -107,13 +107,13 @@ static int read_header(AVFormatContext *s, ...@@ -107,13 +107,13 @@ static int read_header(AVFormatContext *s,
st->codec->height = avio_rl16(pb); st->codec->height = avio_rl16(pb);
if (avio_r8(pb) != 0) if (avio_r8(pb) != 0)
goto invalid; goto invalid;
url_fskip(pb, 1); /* frame rate multiplier info */ avio_seek(pb, 1, SEEK_CUR); /* frame rate multiplier info */
/* ignore last delta record (used for looping) */ /* ignore last delta record (used for looping) */
if (avio_r8(pb)) /* has_last_delta */ if (avio_r8(pb)) /* has_last_delta */
anm->nb_records = FFMAX(anm->nb_records - 1, 0); anm->nb_records = FFMAX(anm->nb_records - 1, 0);
url_fskip(pb, 1); /* last_delta_valid */ avio_seek(pb, 1, SEEK_CUR); /* last_delta_valid */
if (avio_r8(pb) != 0) if (avio_r8(pb) != 0)
goto invalid; goto invalid;
...@@ -121,15 +121,15 @@ static int read_header(AVFormatContext *s, ...@@ -121,15 +121,15 @@ static int read_header(AVFormatContext *s,
if (avio_r8(pb) != 1) if (avio_r8(pb) != 1)
goto invalid; goto invalid;
url_fskip(pb, 1); /* other recs per frame */ avio_seek(pb, 1, SEEK_CUR); /* other recs per frame */
if (avio_r8(pb) != 1) if (avio_r8(pb) != 1)
goto invalid; goto invalid;
url_fskip(pb, 32); /* record_types */ avio_seek(pb, 32, SEEK_CUR); /* record_types */
st->nb_frames = avio_rl32(pb); st->nb_frames = avio_rl32(pb);
av_set_pts_info(st, 64, 1, avio_rl16(pb)); av_set_pts_info(st, 64, 1, avio_rl16(pb));
url_fskip(pb, 58); avio_seek(pb, 58, SEEK_CUR);
/* color cycling and palette data */ /* color cycling and palette data */
st->codec->extradata_size = 16*8 + 4*256; st->codec->extradata_size = 16*8 + 4*256;
...@@ -193,7 +193,7 @@ repeat: ...@@ -193,7 +193,7 @@ repeat:
/* parse page header */ /* parse page header */
if (anm->record < 0) { if (anm->record < 0) {
avio_seek(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); avio_seek(pb, 8 + 2*p->nb_records, SEEK_CUR);
anm->record = 0; anm->record = 0;
} }
......
...@@ -239,7 +239,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) ...@@ -239,7 +239,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
/* Skip any stored wav header */ /* Skip any stored wav header */
if (!(ape->formatflags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER)) if (!(ape->formatflags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER))
url_fskip(pb, ape->wavheaderlength); avio_seek(pb, ape->wavheaderlength, SEEK_CUR);
} }
if(ape->totalframes > UINT_MAX / sizeof(APEFrame)){ if(ape->totalframes > UINT_MAX / sizeof(APEFrame)){
......
...@@ -350,7 +350,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) ...@@ -350,7 +350,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
avio_rl16(pb); /* panes */ avio_rl16(pb); /* panes */
st->codec->bits_per_coded_sample = avio_rl16(pb); /* depth */ st->codec->bits_per_coded_sample = avio_rl16(pb); /* depth */
tag1 = avio_rl32(pb); tag1 = avio_rl32(pb);
url_fskip(pb, 20); avio_seek(pb, 20, SEEK_CUR);
// av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX); // av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX);
if (sizeX > 40) { if (sizeX > 40) {
st->codec->extradata_size = sizeX - 40; st->codec->extradata_size = sizeX - 40;
...@@ -388,7 +388,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size) ...@@ -388,7 +388,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
st->need_parsing = AVSTREAM_PARSE_FULL_ONCE; st->need_parsing = AVSTREAM_PARSE_FULL_ONCE;
} }
pos2 = url_ftell(pb); pos2 = url_ftell(pb);
url_fskip(pb, size - (pos2 - pos1 + 24)); avio_seek(pb, size - (pos2 - pos1 + 24), SEEK_CUR);
return 0; return 0;
} }
...@@ -455,7 +455,7 @@ static int asf_read_content_desc(AVFormatContext *s, int64_t size) ...@@ -455,7 +455,7 @@ static int asf_read_content_desc(AVFormatContext *s, int64_t size)
get_tag(s, "author" , 0, len2); get_tag(s, "author" , 0, len2);
get_tag(s, "copyright", 0, len3); get_tag(s, "copyright", 0, len3);
get_tag(s, "comment" , 0, len4); get_tag(s, "comment" , 0, len4);
url_fskip(pb, len5); avio_seek(pb, len5, SEEK_CUR);
return 0; return 0;
} }
...@@ -475,7 +475,7 @@ static int asf_read_ext_content_desc(AVFormatContext *s, int64_t size) ...@@ -475,7 +475,7 @@ static int asf_read_ext_content_desc(AVFormatContext *s, int64_t size)
if (name_len%2) // must be even, broken lavf versions wrote len-1 if (name_len%2) // must be even, broken lavf versions wrote len-1
name_len += 1; name_len += 1;
if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len) if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len)
url_fskip(pb, name_len - ret); avio_seek(pb, name_len - ret, SEEK_CUR);
value_type = avio_rl16(pb); value_type = avio_rl16(pb);
value_len = avio_rl16(pb); value_len = avio_rl16(pb);
if (!value_type && value_len%2) if (!value_type && value_len%2)
...@@ -505,7 +505,7 @@ static int asf_read_language_list(AVFormatContext *s, int64_t size) ...@@ -505,7 +505,7 @@ static int asf_read_language_list(AVFormatContext *s, int64_t size)
char lang[6]; char lang[6];
unsigned int lang_len = avio_r8(pb); unsigned int lang_len = avio_r8(pb);
if ((ret = avio_get_str16le(pb, lang_len, lang, sizeof(lang))) < lang_len) if ((ret = avio_get_str16le(pb, lang_len, lang, sizeof(lang))) < lang_len)
url_fskip(pb, lang_len - ret); avio_seek(pb, lang_len - ret, SEEK_CUR);
if (j < 128) if (j < 128)
av_strlcpy(asf->stream_languages[j], lang, sizeof(*asf->stream_languages)); av_strlcpy(asf->stream_languages[j], lang, sizeof(*asf->stream_languages));
} }
...@@ -531,10 +531,10 @@ static int asf_read_metadata(AVFormatContext *s, int64_t size) ...@@ -531,10 +531,10 @@ static int asf_read_metadata(AVFormatContext *s, int64_t size)
value_len= avio_rl32(pb); value_len= avio_rl32(pb);
if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len) if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len)
url_fskip(pb, name_len - ret); avio_seek(pb, name_len - ret, SEEK_CUR);
//av_log(s, AV_LOG_ERROR, "%d %d %d %d %d <%s>\n", i, stream_num, name_len, value_type, value_len, name); //av_log(s, AV_LOG_ERROR, "%d %d %d %d %d <%s>\n", i, stream_num, name_len, value_type, value_len, name);
value_num= avio_rl16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere value_num= avio_rl16(pb);//we should use get_value() here but it does not work 2 is le16 here but le32 elsewhere
url_fskip(pb, value_len - 2); avio_seek(pb, value_len - 2, SEEK_CUR);
if(stream_num<128){ if(stream_num<128){
if (!strcmp(name, "AspectRatioX")) asf->dar[stream_num].num= value_num; if (!strcmp(name, "AspectRatioX")) asf->dar[stream_num].num= value_num;
...@@ -571,7 +571,7 @@ static int asf_read_marker(AVFormatContext *s, int64_t size) ...@@ -571,7 +571,7 @@ static int asf_read_marker(AVFormatContext *s, int64_t size)
avio_rl32(pb); // flags avio_rl32(pb); // flags
name_len = avio_rl32(pb); // name length name_len = avio_rl32(pb); // name length
if ((ret = avio_get_str16le(pb, name_len * 2, name, sizeof(name))) < name_len) if ((ret = avio_get_str16le(pb, name_len * 2, name, sizeof(name))) < name_len)
url_fskip(pb, name_len - ret); avio_seek(pb, name_len - ret, SEEK_CUR);
ff_new_chapter(s, i, (AVRational){1, 10000000}, pres_time, AV_NOPTS_VALUE, name ); ff_new_chapter(s, i, (AVRational){1, 10000000}, pres_time, AV_NOPTS_VALUE, name );
} }
...@@ -826,16 +826,16 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ ...@@ -826,16 +826,16 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){
// for(i=0; i<asf->packet_replic_size-8; i++) // for(i=0; i<asf->packet_replic_size-8; i++)
// av_log(s, AV_LOG_DEBUG, "%02X ",avio_r8(pb)); // av_log(s, AV_LOG_DEBUG, "%02X ",avio_r8(pb));
// av_log(s, AV_LOG_DEBUG, "\n"); // av_log(s, AV_LOG_DEBUG, "\n");
url_fskip(pb, 10); avio_seek(pb, 10, SEEK_CUR);
ts0= avio_rl64(pb); ts0= avio_rl64(pb);
ts1= avio_rl64(pb); ts1= avio_rl64(pb);
url_fskip(pb, 12); avio_seek(pb, 12, SEEK_CUR);
avio_rl32(pb); avio_rl32(pb);
url_fskip(pb, asf->packet_replic_size - 8 - 38 - 4); avio_seek(pb, asf->packet_replic_size - 8 - 38 - 4, SEEK_CUR);
if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000; if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000;
else asf->packet_frag_timestamp= AV_NOPTS_VALUE; else asf->packet_frag_timestamp= AV_NOPTS_VALUE;
}else }else
url_fskip(pb, asf->packet_replic_size - 8); avio_seek(pb, asf->packet_replic_size - 8, SEEK_CUR);
rsize += asf->packet_replic_size; // FIXME - check validity rsize += asf->packet_replic_size; // FIXME - check validity
} else if (asf->packet_replic_size==1){ } else if (asf->packet_replic_size==1){
// multipacket - frag_offset is beginning timestamp // multipacket - frag_offset is beginning timestamp
...@@ -895,7 +895,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk ...@@ -895,7 +895,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
//printf("PacketLeftSize:%d Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, url_ftell(pb)); //printf("PacketLeftSize:%d Pad:%d Pos:%"PRId64"\n", asf->packet_size_left, asf->packet_padsize, url_ftell(pb));
assert(ret>=0); assert(ret>=0);
/* fail safe */ /* fail safe */
url_fskip(pb, ret); avio_seek(pb, ret, SEEK_CUR);
asf->packet_pos= url_ftell(pb); asf->packet_pos= url_ftell(pb);
if (asf->data_object_size != (uint64_t)-1 && if (asf->data_object_size != (uint64_t)-1 &&
...@@ -914,7 +914,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk ...@@ -914,7 +914,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
) { ) {
asf->packet_time_start = 0; asf->packet_time_start = 0;
/* unhandled packet (should not happen) */ /* unhandled packet (should not happen) */
url_fskip(pb, asf->packet_frag_size); avio_seek(pb, asf->packet_frag_size, SEEK_CUR);
asf->packet_size_left -= asf->packet_frag_size; asf->packet_size_left -= asf->packet_frag_size;
if(asf->stream_index < 0) if(asf->stream_index < 0)
av_log(s, AV_LOG_ERROR, "ff asf skip %d (unknown stream)\n", asf->packet_frag_size); av_log(s, AV_LOG_ERROR, "ff asf skip %d (unknown stream)\n", asf->packet_frag_size);
...@@ -934,7 +934,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk ...@@ -934,7 +934,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
if (asf->packet_multi_size < asf->packet_obj_size) if (asf->packet_multi_size < asf->packet_obj_size)
{ {
asf->packet_time_start = 0; asf->packet_time_start = 0;
url_fskip(pb, asf->packet_multi_size); avio_seek(pb, asf->packet_multi_size, SEEK_CUR);
asf->packet_size_left -= asf->packet_multi_size; asf->packet_size_left -= asf->packet_multi_size;
continue; continue;
} }
......
...@@ -321,12 +321,12 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end) ...@@ -321,12 +321,12 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end)
} }
if (name) if (name)
av_metadata_set2(&s->metadata, name, buffer, 0); av_metadata_set2(&s->metadata, name, buffer, 0);
url_fskip(s->pb, size); avio_seek(s->pb, size, SEEK_CUR);
} }
break; break;
} }
default: default:
url_fskip(s->pb, size); avio_seek(s->pb, size, SEEK_CUR);
break; break;
} }
} }
...@@ -392,13 +392,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -392,13 +392,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
unsigned char date[64] = {0}; unsigned char date[64] = {0};
size += (size & 1); size += (size & 1);
size -= avio_read(pb, date, FFMIN(size, sizeof(date)-1)); size -= avio_read(pb, date, FFMIN(size, sizeof(date)-1));
url_fskip(pb, size); avio_seek(pb, size, SEEK_CUR);
avi_metadata_creation_time(&s->metadata, date); avi_metadata_creation_time(&s->metadata, date);
break; break;
} }
case MKTAG('d', 'm', 'l', 'h'): case MKTAG('d', 'm', 'l', 'h'):
avi->is_odml = 1; avi->is_odml = 1;
url_fskip(pb, size + (size & 1)); avio_seek(pb, size + (size & 1), SEEK_CUR);
break; break;
case MKTAG('a', 'm', 'v', 'h'): case MKTAG('a', 'm', 'v', 'h'):
amv_file_format=1; amv_file_format=1;
...@@ -410,13 +410,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -410,13 +410,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_rl32(pb); avio_rl32(pb);
avi->non_interleaved |= avio_rl32(pb) & AVIF_MUSTUSEINDEX; avi->non_interleaved |= avio_rl32(pb) & AVIF_MUSTUSEINDEX;
url_fskip(pb, 2 * 4); avio_seek(pb, 2 * 4, SEEK_CUR);
avio_rl32(pb); avio_rl32(pb);
avio_rl32(pb); avio_rl32(pb);
avih_width=avio_rl32(pb); avih_width=avio_rl32(pb);
avih_height=avio_rl32(pb); avih_height=avio_rl32(pb);
url_fskip(pb, size - 10 * 4); avio_seek(pb, size - 10 * 4, SEEK_CUR);
break; break;
case MKTAG('s', 't', 'r', 'h'): case MKTAG('s', 't', 'r', 'h'):
/* stream header */ /* stream header */
...@@ -425,7 +425,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -425,7 +425,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
handler = avio_rl32(pb); /* codec tag */ handler = avio_rl32(pb); /* codec tag */
if(tag1 == MKTAG('p', 'a', 'd', 's')){ if(tag1 == MKTAG('p', 'a', 'd', 's')){
url_fskip(pb, size - 8); avio_seek(pb, size - 8, SEEK_CUR);
break; break;
}else{ }else{
stream_index++; stream_index++;
...@@ -469,10 +469,10 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -469,10 +469,10 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
goto fail; goto fail;
} }
s->streams[0]->priv_data = ast; s->streams[0]->priv_data = ast;
url_fskip(pb, 3 * 4); avio_seek(pb, 3 * 4, SEEK_CUR);
ast->scale = avio_rl32(pb); ast->scale = avio_rl32(pb);
ast->rate = avio_rl32(pb); ast->rate = avio_rl32(pb);
url_fskip(pb, 4); /* start time */ avio_seek(pb, 4, SEEK_CUR); /* start time */
dv_dur = avio_rl32(pb); dv_dur = avio_rl32(pb);
if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) { if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) {
...@@ -485,7 +485,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -485,7 +485,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
*/ */
stream_index = s->nb_streams - 1; stream_index = s->nb_streams - 1;
url_fskip(pb, size - 9*4); avio_seek(pb, size - 9*4, SEEK_CUR);
break; break;
} }
...@@ -542,12 +542,12 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -542,12 +542,12 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
if(ast->sample_size == 0) if(ast->sample_size == 0)
st->duration = st->nb_frames; st->duration = st->nb_frames;
ast->frame_offset= ast->cum_len; ast->frame_offset= ast->cum_len;
url_fskip(pb, size - 12 * 4); avio_seek(pb, size - 12 * 4, SEEK_CUR);
break; break;
case MKTAG('s', 't', 'r', 'f'): case MKTAG('s', 't', 'r', 'f'):
/* stream header */ /* stream header */
if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) { if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) {
url_fskip(pb, size); avio_seek(pb, size, SEEK_CUR);
} else { } else {
uint64_t cur_pos = url_ftell(pb); uint64_t cur_pos = url_ftell(pb);
if (cur_pos < list_end) if (cur_pos < list_end)
...@@ -560,7 +560,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -560,7 +560,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->height=avih_height; st->codec->height=avih_height;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_AMV; st->codec->codec_id = CODEC_ID_AMV;
url_fskip(pb, size); avio_seek(pb, size, SEEK_CUR);
break; break;
} }
tag1 = ff_get_bmp_header(pb, st); tag1 = ff_get_bmp_header(pb, st);
...@@ -620,7 +620,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -620,7 +620,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
} }
st->codec->height= FFABS(st->codec->height); st->codec->height= FFABS(st->codec->height);
// url_fskip(pb, size - 5 * 4); // avio_seek(pb, size - 5 * 4, SEEK_CUR);
break; break;
case AVMEDIA_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
ff_get_wav_header(pb, st->codec, size); ff_get_wav_header(pb, st->codec, size);
...@@ -630,7 +630,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -630,7 +630,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
ast->sample_size= st->codec->block_align; ast->sample_size= st->codec->block_align;
} }
if (size&1) /* 2-aligned (fix for Stargate SG-1 - 3x18 - Shades of Grey.avi) */ if (size&1) /* 2-aligned (fix for Stargate SG-1 - 3x18 - Shades of Grey.avi) */
url_fskip(pb, 1); avio_seek(pb, 1, SEEK_CUR);
/* Force parsing as several audio frames can be in /* Force parsing as several audio frames can be in
* one packet and timestamps refer to packet start. */ * one packet and timestamps refer to packet start. */
st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS; st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS;
...@@ -658,7 +658,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -658,7 +658,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->codec_type = AVMEDIA_TYPE_DATA; st->codec->codec_type = AVMEDIA_TYPE_DATA;
st->codec->codec_id= CODEC_ID_NONE; st->codec->codec_id= CODEC_ID_NONE;
st->codec->codec_tag= 0; st->codec->codec_tag= 0;
url_fskip(pb, size); avio_seek(pb, size, SEEK_CUR);
break; break;
} }
} }
...@@ -710,7 +710,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -710,7 +710,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
} }
/* skip tag */ /* skip tag */
size += (size & 1); size += (size & 1);
url_fskip(pb, size); avio_seek(pb, size, SEEK_CUR);
break; break;
} }
} }
...@@ -762,7 +762,7 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) { ...@@ -762,7 +762,7 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) {
goto error; goto error;
ret = avio_get_str16le(pb, desc_len, desc, sizeof(desc)); ret = avio_get_str16le(pb, desc_len, desc, sizeof(desc));
url_fskip(pb, desc_len - ret); avio_seek(pb, desc_len - ret, SEEK_CUR);
if (*desc) if (*desc)
av_metadata_set2(&st->metadata, "title", desc, 0); av_metadata_set2(&st->metadata, "title", desc, 0);
...@@ -1008,14 +1008,14 @@ resync: ...@@ -1008,14 +1008,14 @@ resync:
//parse JUNK //parse JUNK
||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K') ||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K')
||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){ ||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){
url_fskip(pb, size); avio_seek(pb, size, SEEK_CUR);
//av_log(s, AV_LOG_DEBUG, "SKIP\n"); //av_log(s, AV_LOG_DEBUG, "SKIP\n");
goto resync; goto resync;
} }
//parse stray LIST //parse stray LIST
if(d[0] == 'L' && d[1] == 'I' && d[2] == 'S' && d[3] == 'T'){ if(d[0] == 'L' && d[1] == 'I' && d[2] == 'S' && d[3] == 'T'){
url_fskip(pb, 4); avio_seek(pb, 4, SEEK_CUR);
goto resync; goto resync;
} }
...@@ -1026,7 +1026,7 @@ resync: ...@@ -1026,7 +1026,7 @@ resync:
//detect ##ix chunk and skip //detect ##ix chunk and skip
if(d[2] == 'i' && d[3] == 'x' && n < s->nb_streams){ if(d[2] == 'i' && d[3] == 'x' && n < s->nb_streams){
url_fskip(pb, size); avio_seek(pb, size, SEEK_CUR);
goto resync; goto resync;
} }
...@@ -1060,7 +1060,7 @@ resync: ...@@ -1060,7 +1060,7 @@ resync:
/*|| (st->discard >= AVDISCARD_NONKEY && !(pkt->flags & AV_PKT_FLAG_KEY))*/ //FIXME needs a little reordering /*|| (st->discard >= AVDISCARD_NONKEY && !(pkt->flags & AV_PKT_FLAG_KEY))*/ //FIXME needs a little reordering
|| st->discard >= AVDISCARD_ALL){ || st->discard >= AVDISCARD_ALL){
ast->frame_offset += get_duration(ast, size); ast->frame_offset += get_duration(ast, size);
url_fskip(pb, size); avio_seek(pb, size, SEEK_CUR);
goto resync; goto resync;
} }
......
...@@ -444,9 +444,9 @@ static int avi_write_ix(AVFormatContext *s) ...@@ -444,9 +444,9 @@ static int avi_write_ix(AVFormatContext *s)
/* Updating one entry in the AVI OpenDML master index */ /* Updating one entry in the AVI OpenDML master index */
avio_seek(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 */ ffio_wfourcc(pb, "indx"); /* enabling this entry */
url_fskip(pb, 8); avio_seek(pb, 8, SEEK_CUR);
avio_wl32(pb, avi->riff_id); /* nEntriesInUse */ avio_wl32(pb, avi->riff_id); /* nEntriesInUse */
url_fskip(pb, 16*avi->riff_id); avio_seek(pb, 16*avi->riff_id, SEEK_CUR);
avio_wl64(pb, ix); /* qwOffset */ avio_wl64(pb, ix); /* qwOffset */
avio_wl32(pb, pos - ix); /* dwSize */ avio_wl32(pb, pos - ix); /* dwSize */
avio_wl32(pb, avist->indexes.entry); /* dwDuration */ avio_wl32(pb, avist->indexes.entry); /* dwDuration */
...@@ -603,7 +603,7 @@ static int avi_write_trailer(AVFormatContext *s) ...@@ -603,7 +603,7 @@ static int avi_write_trailer(AVFormatContext *s)
file_size = url_ftell(pb); file_size = url_ftell(pb);
avio_seek(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 */ ffio_wfourcc(pb, "LIST"); /* Making this AVI OpenDML one */
url_fskip(pb, 16); avio_seek(pb, 16, SEEK_CUR);
for (n=nb_frames=0;n<s->nb_streams;n++) { for (n=nb_frames=0;n<s->nb_streams;n++) {
AVCodecContext *stream = s->streams[n]->codec; AVCodecContext *stream = s->streams[n]->codec;
......
...@@ -61,7 +61,7 @@ static int avs_read_header(AVFormatContext * s, AVFormatParameters * ap) ...@@ -61,7 +61,7 @@ static int avs_read_header(AVFormatContext * s, AVFormatParameters * ap)
s->ctx_flags |= AVFMTCTX_NOHEADER; s->ctx_flags |= AVFMTCTX_NOHEADER;
url_fskip(s->pb, 4); avio_seek(s->pb, 4, SEEK_CUR);
avs->width = avio_rl16(s->pb); avs->width = avio_rl16(s->pb);
avs->height = avio_rl16(s->pb); avs->height = avio_rl16(s->pb);
avs->bits_per_sample = avio_rl16(s->pb); avs->bits_per_sample = avio_rl16(s->pb);
...@@ -204,7 +204,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt) ...@@ -204,7 +204,7 @@ static int avs_read_packet(AVFormatContext * s, AVPacket * pkt)
break; break;
default: default:
url_fskip(s->pb, size - 4); avio_seek(s->pb, size - 4, SEEK_CUR);
} }
} }
} }
......
...@@ -65,19 +65,19 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap) ...@@ -65,19 +65,19 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
/* Set the total number of frames. */ /* Set the total number of frames. */
url_fskip(pb, 8); avio_seek(pb, 8, SEEK_CUR);
chunk_header = avio_rl32(pb); chunk_header = avio_rl32(pb);
bfi->nframes = avio_rl32(pb); bfi->nframes = avio_rl32(pb);
avio_rl32(pb); avio_rl32(pb);
avio_rl32(pb); avio_rl32(pb);
avio_rl32(pb); avio_rl32(pb);
fps = avio_rl32(pb); fps = avio_rl32(pb);
url_fskip(pb, 12); avio_seek(pb, 12, SEEK_CUR);
vstream->codec->width = avio_rl32(pb); vstream->codec->width = avio_rl32(pb);
vstream->codec->height = avio_rl32(pb); vstream->codec->height = avio_rl32(pb);
/*Load the palette to extradata */ /*Load the palette to extradata */
url_fskip(pb, 8); avio_seek(pb, 8, SEEK_CUR);
vstream->codec->extradata = av_malloc(768); vstream->codec->extradata = av_malloc(768);
vstream->codec->extradata_size = 768; vstream->codec->extradata_size = 768;
avio_read(pb, vstream->codec->extradata, avio_read(pb, vstream->codec->extradata,
......
...@@ -98,7 +98,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -98,7 +98,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR(EIO); return AVERROR(EIO);
} }
url_fskip(pb, 4); avio_seek(pb, 4, SEEK_CUR);
vst->codec->width = avio_rl32(pb); vst->codec->width = avio_rl32(pb);
vst->codec->height = avio_rl32(pb); vst->codec->height = avio_rl32(pb);
...@@ -127,7 +127,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -127,7 +127,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
} }
if (bink->num_audio_tracks) { if (bink->num_audio_tracks) {
url_fskip(pb, 4 * bink->num_audio_tracks); avio_seek(pb, 4 * bink->num_audio_tracks, SEEK_CUR);
for (i = 0; i < bink->num_audio_tracks; i++) { for (i = 0; i < bink->num_audio_tracks; i++) {
ast = av_new_stream(s, 1); ast = av_new_stream(s, 1);
...@@ -169,7 +169,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -169,7 +169,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
keyframe ? AVINDEX_KEYFRAME : 0); keyframe ? AVINDEX_KEYFRAME : 0);
} }
url_fskip(pb, 4); avio_seek(pb, 4, SEEK_CUR);
bink->current_track = -1; bink->current_track = -1;
return 0; return 0;
......
...@@ -122,7 +122,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -122,7 +122,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO; c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
} }
url_fskip(pb, 26); /* VOC header */ avio_seek(pb, 26, SEEK_CUR); /* VOC header */
ret = voc_get_packet(s, pkt, c93->audio, datasize - 26); ret = voc_get_packet(s, pkt, c93->audio, datasize - 26);
if (ret > 0) { if (ret > 0) {
pkt->stream_index = 1; pkt->stream_index = 1;
......
...@@ -114,22 +114,22 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) ...@@ -114,22 +114,22 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size)
av_log(s, AV_LOG_ERROR, "invalid AAC magic cookie\n"); av_log(s, AV_LOG_ERROR, "invalid AAC magic cookie\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
url_fskip(pb, skip); avio_seek(pb, skip, SEEK_CUR);
} else if (st->codec->codec_id == CODEC_ID_ALAC) { } else if (st->codec->codec_id == CODEC_ID_ALAC) {
#define ALAC_PREAMBLE 12 #define ALAC_PREAMBLE 12
#define ALAC_HEADER 36 #define ALAC_HEADER 36
if (size < ALAC_PREAMBLE + ALAC_HEADER) { if (size < ALAC_PREAMBLE + ALAC_HEADER) {
av_log(s, AV_LOG_ERROR, "invalid ALAC magic cookie\n"); av_log(s, AV_LOG_ERROR, "invalid ALAC magic cookie\n");
url_fskip(pb, size); avio_seek(pb, size, SEEK_CUR);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
url_fskip(pb, ALAC_PREAMBLE); avio_seek(pb, ALAC_PREAMBLE, SEEK_CUR);
st->codec->extradata = av_mallocz(ALAC_HEADER + FF_INPUT_BUFFER_PADDING_SIZE); st->codec->extradata = av_mallocz(ALAC_HEADER + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata) if (!st->codec->extradata)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
avio_read(pb, st->codec->extradata, ALAC_HEADER); avio_read(pb, st->codec->extradata, ALAC_HEADER);
st->codec->extradata_size = ALAC_HEADER; st->codec->extradata_size = ALAC_HEADER;
url_fskip(pb, size - ALAC_PREAMBLE - ALAC_HEADER); avio_seek(pb, size - ALAC_PREAMBLE - ALAC_HEADER, SEEK_CUR);
} else { } else {
st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE); st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata) if (!st->codec->extradata)
...@@ -201,7 +201,7 @@ static int read_header(AVFormatContext *s, ...@@ -201,7 +201,7 @@ static int read_header(AVFormatContext *s,
int found_data, ret; int found_data, ret;
int64_t size; int64_t size;
url_fskip(pb, 8); /* magic, version, file flags */ avio_seek(pb, 8, SEEK_CUR); /* magic, version, file flags */
/* audio description chunk */ /* audio description chunk */
if (avio_rb32(pb) != MKBETAG('d','e','s','c')) { if (avio_rb32(pb) != MKBETAG('d','e','s','c')) {
...@@ -233,11 +233,11 @@ static int read_header(AVFormatContext *s, ...@@ -233,11 +233,11 @@ static int read_header(AVFormatContext *s,
switch (tag) { switch (tag) {
case MKBETAG('d','a','t','a'): case MKBETAG('d','a','t','a'):
url_fskip(pb, 4); /* edit count */ avio_seek(pb, 4, SEEK_CUR); /* edit count */
caf->data_start = url_ftell(pb); caf->data_start = url_ftell(pb);
caf->data_size = size < 0 ? -1 : size - 4; caf->data_size = size < 0 ? -1 : size - 4;
if (caf->data_size > 0 && !url_is_streamed(pb)) if (caf->data_size > 0 && !url_is_streamed(pb))
url_fskip(pb, caf->data_size); avio_seek(pb, caf->data_size, SEEK_CUR);
found_data = 1; found_data = 1;
break; break;
...@@ -265,7 +265,7 @@ static int read_header(AVFormatContext *s, ...@@ -265,7 +265,7 @@ static int read_header(AVFormatContext *s,
case MKBETAG('f','r','e','e'): case MKBETAG('f','r','e','e'):
if (size < 0) if (size < 0)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
url_fskip(pb, size); avio_seek(pb, size, SEEK_CUR);
break; break;
} }
} }
......
...@@ -96,7 +96,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -96,7 +96,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
c->has_sound = 1; c->has_sound = 1;
size = avio_rb32(pb); size = avio_rb32(pb);
c->vidpos = url_ftell(pb) + size; c->vidpos = url_ftell(pb) + size;
url_fskip(pb, 16); avio_seek(pb, 16, SEEK_CUR);
fsize = avio_rl32(pb); fsize = avio_rl32(pb);
ast = av_new_stream(s, 0); ast = av_new_stream(s, 0);
...@@ -108,7 +108,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -108,7 +108,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap)
tag = avio_rl32(pb); tag = avio_rl32(pb);
fsize = avio_rl32(pb); fsize = avio_rl32(pb);
if(tag == MKTAG('d', 'a', 't', 'a')) break; if(tag == MKTAG('d', 'a', 't', 'a')) break;
url_fskip(pb, fsize); avio_seek(pb, fsize, SEEK_CUR);
} }
c->bpc = (fsize + c->frames - 1) / c->frames; c->bpc = (fsize + c->frames - 1) / c->frames;
if(ast->codec->block_align) if(ast->codec->block_align)
......
...@@ -62,7 +62,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -62,7 +62,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap)
}; };
sample_rate = avio_rb16(pb); sample_rate = avio_rb16(pb);
url_fskip(pb, 12); avio_seek(pb, 12, SEEK_CUR);
st = av_new_stream(s, 0); st = av_new_stream(s, 0);
if (!st) if (!st)
......
...@@ -222,7 +222,7 @@ static int process_audio_header_eacs(AVFormatContext *s) ...@@ -222,7 +222,7 @@ static int process_audio_header_eacs(AVFormatContext *s)
ea->bytes = avio_r8(pb); /* 1=8-bit, 2=16-bit */ ea->bytes = avio_r8(pb); /* 1=8-bit, 2=16-bit */
ea->num_channels = avio_r8(pb); ea->num_channels = avio_r8(pb);
compression_type = avio_r8(pb); compression_type = avio_r8(pb);
url_fskip(pb, 13); avio_seek(pb, 13, SEEK_CUR);
switch (compression_type) { switch (compression_type) {
case 0: case 0:
...@@ -261,7 +261,7 @@ static int process_video_header_mdec(AVFormatContext *s) ...@@ -261,7 +261,7 @@ static int process_video_header_mdec(AVFormatContext *s)
{ {
EaDemuxContext *ea = s->priv_data; EaDemuxContext *ea = s->priv_data;
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
url_fskip(pb, 4); avio_seek(pb, 4, SEEK_CUR);
ea->width = avio_rl16(pb); ea->width = avio_rl16(pb);
ea->height = avio_rl16(pb); ea->height = avio_rl16(pb);
ea->time_base = (AVRational){1,15}; ea->time_base = (AVRational){1,15};
...@@ -274,7 +274,7 @@ static int process_video_header_vp6(AVFormatContext *s) ...@@ -274,7 +274,7 @@ static int process_video_header_vp6(AVFormatContext *s)
EaDemuxContext *ea = s->priv_data; EaDemuxContext *ea = s->priv_data;
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
url_fskip(pb, 16); avio_seek(pb, 16, SEEK_CUR);
ea->time_base.den = avio_rl32(pb); ea->time_base.den = avio_rl32(pb);
ea->time_base.num = avio_rl32(pb); ea->time_base.num = avio_rl32(pb);
ea->video_codec = CODEC_ID_VP6; ea->video_codec = CODEC_ID_VP6;
...@@ -316,7 +316,7 @@ static int process_ea_header(AVFormatContext *s) { ...@@ -316,7 +316,7 @@ static int process_ea_header(AVFormatContext *s) {
case SHEN_TAG : case SHEN_TAG :
blockid = avio_rl32(pb); blockid = avio_rl32(pb);
if (blockid == GSTR_TAG) { if (blockid == GSTR_TAG) {
url_fskip(pb, 4); avio_seek(pb, 4, SEEK_CUR);
} else if ((blockid & 0xFFFF)!=PT00_TAG) { } else if ((blockid & 0xFFFF)!=PT00_TAG) {
av_log (s, AV_LOG_ERROR, "unknown SCHl headerid\n"); av_log (s, AV_LOG_ERROR, "unknown SCHl headerid\n");
return 0; return 0;
...@@ -474,19 +474,19 @@ static int ea_read_packet(AVFormatContext *s, ...@@ -474,19 +474,19 @@ static int ea_read_packet(AVFormatContext *s,
/* audio data */ /* audio data */
case ISNh_TAG: case ISNh_TAG:
/* header chunk also contains data; skip over the header portion*/ /* header chunk also contains data; skip over the header portion*/
url_fskip(pb, 32); avio_seek(pb, 32, SEEK_CUR);
chunk_size -= 32; chunk_size -= 32;
case ISNd_TAG: case ISNd_TAG:
case SCDl_TAG: case SCDl_TAG:
case SNDC_TAG: case SNDC_TAG:
case SDEN_TAG: case SDEN_TAG:
if (!ea->audio_codec) { if (!ea->audio_codec) {
url_fskip(pb, chunk_size); avio_seek(pb, chunk_size, SEEK_CUR);
break; break;
} else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR || } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR ||
ea->audio_codec == CODEC_ID_MP3) { ea->audio_codec == CODEC_ID_MP3) {
num_samples = avio_rl32(pb); num_samples = avio_rl32(pb);
url_fskip(pb, 8); avio_seek(pb, 8, SEEK_CUR);
chunk_size -= 12; chunk_size -= 12;
} }
ret = av_get_packet(pb, pkt, chunk_size); ret = av_get_packet(pb, pkt, chunk_size);
......
...@@ -187,7 +187,7 @@ static int64_t get_dts(AVFormatContext *s, int64_t pos) ...@@ -187,7 +187,7 @@ static int64_t get_dts(AVFormatContext *s, int64_t pos)
int64_t dts; int64_t dts;
ffm_seek1(s, pos); ffm_seek1(s, pos);
url_fskip(pb, 4); avio_seek(pb, 4, SEEK_CUR);
dts = avio_rb64(pb); dts = avio_rb64(pb);
#ifdef DEBUG_SEEK #ifdef DEBUG_SEEK
av_log(s, AV_LOG_DEBUG, "dts=%0.6f\n", dts / 1000000.0); av_log(s, AV_LOG_DEBUG, "dts=%0.6f\n", dts / 1000000.0);
......
...@@ -59,7 +59,7 @@ static int read_header(AVFormatContext *s, ...@@ -59,7 +59,7 @@ static int read_header(AVFormatContext *s,
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
url_fskip(pb, 2); avio_seek(pb, 2, SEEK_CUR);
st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_RAWVIDEO; st->codec->codec_id = CODEC_ID_RAWVIDEO;
st->codec->pix_fmt = PIX_FMT_RGBA; st->codec->pix_fmt = PIX_FMT_RGBA;
...@@ -84,7 +84,7 @@ static int read_packet(AVFormatContext *s, ...@@ -84,7 +84,7 @@ static int read_packet(AVFormatContext *s,
return AVERROR(EIO); return AVERROR(EIO);
pkt->dts = url_ftell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4); pkt->dts = url_ftell(s->pb) / (st->codec->width * (st->codec->height + film->leading) * 4);
pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4); pkt->size = av_get_packet(s->pb, pkt, st->codec->width * st->codec->height * 4);
url_fskip(s->pb, st->codec->width * film->leading * 4); avio_seek(s->pb, st->codec->width * film->leading * 4, SEEK_CUR);
if (pkt->size < 0) if (pkt->size < 0)
return pkt->size; return pkt->size;
pkt->flags |= AV_PKT_FLAG_KEY; pkt->flags |= AV_PKT_FLAG_KEY;
......
...@@ -113,7 +113,7 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co ...@@ -113,7 +113,7 @@ static int flv_set_video_codec(AVFormatContext *s, AVStream *vstream, int flv_co
static int amf_get_string(AVIOContext *ioc, char *buffer, int buffsize) { static int amf_get_string(AVIOContext *ioc, char *buffer, int buffsize) {
int length = avio_rb16(ioc); int length = avio_rb16(ioc);
if(length >= buffsize) { if(length >= buffsize) {
url_fskip(ioc, length); avio_seek(ioc, length, SEEK_CUR);
return -1; return -1;
} }
...@@ -149,7 +149,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst ...@@ -149,7 +149,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
unsigned int keylen; unsigned int keylen;
while(url_ftell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) { while(url_ftell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) {
url_fskip(ioc, keylen); //skip key string avio_seek(ioc, keylen, SEEK_CUR); //skip key string
if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0) if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0)
return -1; //if we couldn't skip, bomb out. return -1; //if we couldn't skip, bomb out.
} }
...@@ -162,7 +162,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst ...@@ -162,7 +162,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
case AMF_DATA_TYPE_UNSUPPORTED: case AMF_DATA_TYPE_UNSUPPORTED:
break; //these take up no additional space break; //these take up no additional space
case AMF_DATA_TYPE_MIXEDARRAY: case AMF_DATA_TYPE_MIXEDARRAY:
url_fskip(ioc, 4); //skip 32-bit max array index avio_seek(ioc, 4, SEEK_CUR); //skip 32-bit max array index
while(url_ftell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) { while(url_ftell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) {
//this is the only case in which we would want a nested parse to not skip over the object //this is the only case in which we would want a nested parse to not skip over the object
if(amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0) if(amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0)
...@@ -182,7 +182,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst ...@@ -182,7 +182,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst
} }
break; break;
case AMF_DATA_TYPE_DATE: case AMF_DATA_TYPE_DATE:
url_fskip(ioc, 8 + 2); //timestamp (double) and UTC offset (int16) avio_seek(ioc, 8 + 2, SEEK_CUR); //timestamp (double) and UTC offset (int16)
break; break;
default: //unsupported type, we couldn't skip default: //unsupported type, we couldn't skip
return -1; return -1;
...@@ -254,7 +254,7 @@ static int flv_read_header(AVFormatContext *s, ...@@ -254,7 +254,7 @@ static int flv_read_header(AVFormatContext *s,
{ {
int offset, flags; int offset, flags;
url_fskip(s->pb, 4); avio_seek(s->pb, 4, SEEK_CUR);
flags = avio_r8(s->pb); flags = avio_r8(s->pb);
/* old flvtool cleared this field */ /* old flvtool cleared this field */
/* FIXME: better fix needed */ /* FIXME: better fix needed */
...@@ -278,7 +278,7 @@ static int flv_read_header(AVFormatContext *s, ...@@ -278,7 +278,7 @@ static int flv_read_header(AVFormatContext *s,
offset = avio_rb32(s->pb); offset = avio_rb32(s->pb);
avio_seek(s->pb, offset, SEEK_SET); avio_seek(s->pb, offset, SEEK_SET);
url_fskip(s->pb, 4); avio_seek(s->pb, 4, SEEK_CUR);
s->start_time = 0; s->start_time = 0;
...@@ -304,7 +304,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -304,7 +304,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
int64_t dts, pts = AV_NOPTS_VALUE; int64_t dts, pts = AV_NOPTS_VALUE;
AVStream *st = NULL; AVStream *st = NULL;
for(;;url_fskip(s->pb, 4)){ /* pkt size is repeated at end. skip it */ for(;;avio_seek(s->pb, 4, SEEK_CUR)){ /* pkt size is repeated at end. skip it */
pos = url_ftell(s->pb); pos = url_ftell(s->pb);
type = avio_r8(s->pb); type = avio_r8(s->pb);
size = avio_rb24(s->pb); size = avio_rb24(s->pb);
...@@ -313,7 +313,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -313,7 +313,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
// av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, dts:%d\n", type, size, dts); // av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, dts:%d\n", type, size, dts);
if (url_feof(s->pb)) if (url_feof(s->pb))
return AVERROR_EOF; return AVERROR_EOF;
url_fskip(s->pb, 3); /* stream id, always 0 */ avio_seek(s->pb, 3, SEEK_CUR); /* stream id, always 0 */
flags = 0; flags = 0;
if(size == 0) if(size == 0)
...@@ -454,7 +454,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -454,7 +454,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->flags |= AV_PKT_FLAG_KEY; pkt->flags |= AV_PKT_FLAG_KEY;
leave: leave:
url_fskip(s->pb, 4); avio_seek(s->pb, 4, SEEK_CUR);
return ret; return ret;
} }
......
...@@ -174,7 +174,7 @@ static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info ...@@ -174,7 +174,7 @@ static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info
else if (tag == MAT_LAST_FIELD) else if (tag == MAT_LAST_FIELD)
si->last_field = value; si->last_field = value;
} else } else
url_fskip(pb, tlen); avio_seek(pb, tlen, SEEK_CUR);
} }
} }
...@@ -223,7 +223,7 @@ static void gxf_track_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si ...@@ -223,7 +223,7 @@ static void gxf_track_tags(AVIOContext *pb, int *len, struct gxf_stream_info *si
else if (tag == TRACK_FPF && (value == 1 || value == 2)) else if (tag == TRACK_FPF && (value == 1 || value == 2))
si->fields_per_frame = value; si->fields_per_frame = value;
} else } else
url_fskip(pb, tlen); avio_seek(pb, tlen, SEEK_CUR);
} }
} }
...@@ -238,7 +238,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) { ...@@ -238,7 +238,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) {
int i; int i;
pkt_len -= 8; pkt_len -= 8;
if (s->flags & AVFMT_FLAG_IGNIDX) { if (s->flags & AVFMT_FLAG_IGNIDX) {
url_fskip(pb, pkt_len); avio_seek(pb, pkt_len, SEEK_CUR);
return; return;
} }
if (map_cnt > 1000) { if (map_cnt > 1000) {
...@@ -247,7 +247,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) { ...@@ -247,7 +247,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) {
} }
if (pkt_len < 4 * map_cnt) { if (pkt_len < 4 * map_cnt) {
av_log(s, AV_LOG_ERROR, "invalid index length\n"); av_log(s, AV_LOG_ERROR, "invalid index length\n");
url_fskip(pb, pkt_len); avio_seek(pb, pkt_len, SEEK_CUR);
return; return;
} }
pkt_len -= 4 * map_cnt; pkt_len -= 4 * map_cnt;
...@@ -255,7 +255,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) { ...@@ -255,7 +255,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) {
for (i = 0; i < map_cnt; i++) for (i = 0; i < map_cnt; i++)
av_add_index_entry(st, (uint64_t)avio_rl32(pb) * 1024, av_add_index_entry(st, (uint64_t)avio_rl32(pb) * 1024,
i * (uint64_t)fields_per_map + 1, 0, 0, 0); i * (uint64_t)fields_per_map + 1, 0, 0, 0);
url_fskip(pb, pkt_len); avio_seek(pb, pkt_len, SEEK_CUR);
} }
static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
...@@ -283,7 +283,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { ...@@ -283,7 +283,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
} }
map_len -= len; map_len -= len;
gxf_material_tags(pb, &len, &si); gxf_material_tags(pb, &len, &si);
url_fskip(pb, len); avio_seek(pb, len, SEEK_CUR);
map_len -= 2; map_len -= 2;
len = avio_rb16(pb); // length of track description len = avio_rb16(pb); // length of track description
if (len > map_len) { if (len > map_len) {
...@@ -301,7 +301,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { ...@@ -301,7 +301,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
track_len = avio_rb16(pb); track_len = avio_rb16(pb);
len -= track_len; len -= track_len;
gxf_track_tags(pb, &track_len, &si); gxf_track_tags(pb, &track_len, &si);
url_fskip(pb, track_len); avio_seek(pb, track_len, SEEK_CUR);
if (!(track_type & 0x80)) { if (!(track_type & 0x80)) {
av_log(s, AV_LOG_ERROR, "invalid track type %x\n", track_type); av_log(s, AV_LOG_ERROR, "invalid track type %x\n", track_type);
continue; continue;
...@@ -326,7 +326,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { ...@@ -326,7 +326,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
if (len < 0) if (len < 0)
av_log(s, AV_LOG_ERROR, "invalid track description length specified\n"); av_log(s, AV_LOG_ERROR, "invalid track description length specified\n");
if (map_len) if (map_len)
url_fskip(pb, map_len); avio_seek(pb, map_len, SEEK_CUR);
if (!parse_packet_header(pb, &pkt_type, &len)) { if (!parse_packet_header(pb, &pkt_type, &len)) {
av_log(s, AV_LOG_ERROR, "sync lost in header\n"); av_log(s, AV_LOG_ERROR, "sync lost in header\n");
return -1; return -1;
...@@ -342,8 +342,8 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { ...@@ -342,8 +342,8 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
if (len >= 0x39) { if (len >= 0x39) {
AVRational fps; AVRational fps;
len -= 0x39; len -= 0x39;
url_fskip(pb, 5); // preamble avio_seek(pb, 5, SEEK_CUR); // preamble
url_fskip(pb, 0x30); // payload description avio_seek(pb, 0x30, SEEK_CUR); // payload description
fps = fps_umf2avr(avio_rl32(pb)); fps = fps_umf2avr(avio_rl32(pb));
if (!main_timebase.num || !main_timebase.den) { if (!main_timebase.num || !main_timebase.den) {
// this may not always be correct, but simply the best we can get // this may not always be correct, but simply the best we can get
...@@ -354,7 +354,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { ...@@ -354,7 +354,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) {
av_log(s, AV_LOG_INFO, "UMF packet too short\n"); av_log(s, AV_LOG_INFO, "UMF packet too short\n");
} else } else
av_log(s, AV_LOG_INFO, "UMF packet missing\n"); av_log(s, AV_LOG_INFO, "UMF packet missing\n");
url_fskip(pb, len); avio_seek(pb, len, SEEK_CUR);
// set a fallback value, 60000/1001 is specified for audio-only files // set a fallback value, 60000/1001 is specified for audio-only files
// so use that regardless of why we do not know the video frame rate. // so use that regardless of why we do not know the video frame rate.
if (!main_timebase.num || !main_timebase.den) if (!main_timebase.num || !main_timebase.den)
...@@ -437,7 +437,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { ...@@ -437,7 +437,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
continue; continue;
} }
if (pkt_type != PKT_MEDIA) { if (pkt_type != PKT_MEDIA) {
url_fskip(pb, pkt_len); avio_seek(pb, pkt_len, SEEK_CUR);
continue; continue;
} }
if (pkt_len < 16) { if (pkt_len < 16) {
...@@ -462,7 +462,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { ...@@ -462,7 +462,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
int last = field_info & 0xffff; // last is exclusive int last = field_info & 0xffff; // last is exclusive
int bps = av_get_bits_per_sample(st->codec->codec_id)>>3; int bps = av_get_bits_per_sample(st->codec->codec_id)>>3;
if (first <= last && last*bps <= pkt_len) { if (first <= last && last*bps <= pkt_len) {
url_fskip(pb, first*bps); avio_seek(pb, first*bps, SEEK_CUR);
skip = pkt_len - last*bps; skip = pkt_len - last*bps;
pkt_len = (last-first)*bps; pkt_len = (last-first)*bps;
} else } else
...@@ -470,7 +470,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { ...@@ -470,7 +470,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) {
} }
ret = av_get_packet(pb, pkt, pkt_len); ret = av_get_packet(pb, pkt, pkt_len);
if (skip) if (skip)
url_fskip(pb, skip); avio_seek(pb, skip, SEEK_CUR);
pkt->stream_index = stream_index; pkt->stream_index = stream_index;
pkt->dts = field_nr; pkt->dts = field_nr;
return ret; return ret;
......
...@@ -171,7 +171,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t ...@@ -171,7 +171,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t
unsync = flags & 0x80; unsync = flags & 0x80;
if (isv34 && flags & 0x40) /* Extended header present, just skip over it */ if (isv34 && flags & 0x40) /* Extended header present, just skip over it */
url_fskip(s->pb, get_size(s->pb, 4)); avio_seek(s->pb, get_size(s->pb, 4), SEEK_CUR);
while (len >= taghdrlen) { while (len >= taghdrlen) {
unsigned int tflags; unsigned int tflags;
...@@ -205,7 +205,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t ...@@ -205,7 +205,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t
if (tflags & (ID3v2_FLAG_ENCRYPTION | ID3v2_FLAG_COMPRESSION)) { if (tflags & (ID3v2_FLAG_ENCRYPTION | ID3v2_FLAG_COMPRESSION)) {
av_log(s, AV_LOG_WARNING, "Skipping encrypted/compressed ID3v2 frame %s.\n", tag); av_log(s, AV_LOG_WARNING, "Skipping encrypted/compressed ID3v2 frame %s.\n", tag);
url_fskip(s->pb, tlen); avio_seek(s->pb, tlen, SEEK_CUR);
} else if (tag[0] == 'T') { } else if (tag[0] == 'T') {
if (unsync || tunsync) { if (unsync || tunsync) {
int i, j; int i, j;
...@@ -226,7 +226,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t ...@@ -226,7 +226,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t
else if (!tag[0]) { else if (!tag[0]) {
if (tag[1]) if (tag[1])
av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding"); av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding");
url_fskip(s->pb, tlen); avio_seek(s->pb, tlen, SEEK_CUR);
break; break;
} }
/* Skip to end of tag */ /* Skip to end of tag */
...@@ -235,17 +235,17 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t ...@@ -235,17 +235,17 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t
if (len > 0) { if (len > 0) {
/* Skip padding */ /* Skip padding */
url_fskip(s->pb, len); avio_seek(s->pb, len, SEEK_CUR);
} }
if (version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip over it */ if (version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip over it */
url_fskip(s->pb, 10); avio_seek(s->pb, 10, SEEK_CUR);
av_free(buffer); av_free(buffer);
return; return;
error: error:
av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason); av_log(s, AV_LOG_INFO, "ID3v2.%d tag skipped, cannot handle %s\n", version, reason);
url_fskip(s->pb, len); avio_seek(s->pb, len, SEEK_CUR);
av_free(buffer); av_free(buffer);
} }
......
...@@ -134,7 +134,7 @@ static int iff_read_header(AVFormatContext *s, ...@@ -134,7 +134,7 @@ static int iff_read_header(AVFormatContext *s,
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
st->codec->channels = 1; st->codec->channels = 1;
url_fskip(pb, 8); avio_seek(pb, 8, SEEK_CUR);
// codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content // codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content
st->codec->codec_tag = avio_rl32(pb); st->codec->codec_tag = avio_rl32(pb);
...@@ -152,10 +152,10 @@ static int iff_read_header(AVFormatContext *s, ...@@ -152,10 +152,10 @@ static int iff_read_header(AVFormatContext *s,
if (data_size < 14) if (data_size < 14)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
url_fskip(pb, 12); avio_seek(pb, 12, SEEK_CUR);
st->codec->sample_rate = avio_rb16(pb); st->codec->sample_rate = avio_rb16(pb);
if (data_size >= 16) { if (data_size >= 16) {
url_fskip(pb, 1); avio_seek(pb, 1, SEEK_CUR);
compression = avio_r8(pb); compression = avio_r8(pb);
} }
break; break;
...@@ -186,14 +186,14 @@ static int iff_read_header(AVFormatContext *s, ...@@ -186,14 +186,14 @@ static int iff_read_header(AVFormatContext *s,
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
st->codec->width = avio_rb16(pb); st->codec->width = avio_rb16(pb);
st->codec->height = avio_rb16(pb); st->codec->height = avio_rb16(pb);
url_fskip(pb, 4); // x, y offset avio_seek(pb, 4, SEEK_CUR); // x, y offset
st->codec->bits_per_coded_sample = avio_r8(pb); st->codec->bits_per_coded_sample = avio_r8(pb);
if (data_size >= 11) { if (data_size >= 11) {
url_fskip(pb, 1); // masking avio_seek(pb, 1, SEEK_CUR); // masking
compression = avio_r8(pb); compression = avio_r8(pb);
} }
if (data_size >= 16) { if (data_size >= 16) {
url_fskip(pb, 3); // paddding, transparent avio_seek(pb, 3, SEEK_CUR); // paddding, transparent
st->sample_aspect_ratio.num = avio_r8(pb); st->sample_aspect_ratio.num = avio_r8(pb);
st->sample_aspect_ratio.den = avio_r8(pb); st->sample_aspect_ratio.den = avio_r8(pb);
} }
...@@ -223,7 +223,7 @@ static int iff_read_header(AVFormatContext *s, ...@@ -223,7 +223,7 @@ static int iff_read_header(AVFormatContext *s,
return res; return res;
} }
} }
url_fskip(pb, data_size - (url_ftell(pb) - orig_pos) + (data_size & 1)); avio_seek(pb, data_size - (url_ftell(pb) - orig_pos) + (data_size & 1), SEEK_CUR);
} }
avio_seek(pb, iff->body_pos, SEEK_SET); avio_seek(pb, iff->body_pos, SEEK_SET);
......
...@@ -35,11 +35,11 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -35,11 +35,11 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt)
w = avio_rl16(s->pb); w = avio_rl16(s->pb);
h = avio_rl16(s->pb); h = avio_rl16(s->pb);
url_fskip(s->pb, 8); // zero + size (padded?) avio_seek(s->pb, 8, SEEK_CUR); // zero + size (padded?)
url_fskip(s->pb, 2); avio_seek(s->pb, 2, SEEK_CUR);
unk1 = avio_rl16(s->pb); unk1 = avio_rl16(s->pb);
unk2 = avio_rl16(s->pb); unk2 = avio_rl16(s->pb);
url_fskip(s->pb, 22); // ASCII timestamp avio_seek(s->pb, 22, SEEK_CUR); // ASCII timestamp
av_log(s, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d, unk1=%d unk2=%d\n", av_log(s, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d, unk1=%d unk2=%d\n",
size, w, h, unk1, unk2); size, w, h, unk1, unk2);
......
...@@ -70,7 +70,7 @@ retry: ...@@ -70,7 +70,7 @@ retry:
return -1; return -1;
if(type==258){ if(type==258){
url_fskip(s->pb, size); avio_seek(s->pb, size, SEEK_CUR);
goto retry; goto retry;
} }
......
...@@ -100,7 +100,7 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) { ...@@ -100,7 +100,7 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) {
if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0) if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0)
return AVERROR(EIO); return AVERROR(EIO);
url_fskip(pb, padding); avio_seek(pb, padding, SEEK_CUR);
switch (frame_type) { switch (frame_type) {
case LMLM4_I_FRAME: case LMLM4_I_FRAME:
......
...@@ -137,8 +137,8 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form ...@@ -137,8 +137,8 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form
case 0: case 0:
//video //video
//skip VBI data and metadata //skip VBI data and metadata
url_fskip(pb, (int64_t)(uint32_t)AV_RL32(&header[44]) + avio_seek(pb, (int64_t)(uint32_t)AV_RL32(&header[44]) +
(int64_t)(uint32_t)AV_RL32(&header[52])); (int64_t)(uint32_t)AV_RL32(&header[52]), SEEK_CUR);
break; break;
case 1: case 1:
//audio //audio
...@@ -255,7 +255,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -255,7 +255,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (format == 1) { if (format == 1) {
//skip extended field data //skip extended field data
url_fskip(s->pb, (uint32_t)AV_RL32(&header[40])); avio_seek(s->pb, (uint32_t)AV_RL32(&header[40]), SEEK_CUR);
} }
return 0; return 0;
......
...@@ -1393,10 +1393,10 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -1393,10 +1393,10 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap)
int flavor; int flavor;
ffio_init_context(&b, track->codec_priv.data,track->codec_priv.size, ffio_init_context(&b, track->codec_priv.data,track->codec_priv.size,
0, NULL, NULL, NULL, NULL); 0, NULL, NULL, NULL, NULL);
url_fskip(&b, 22); avio_seek(&b, 22, SEEK_CUR);
flavor = avio_rb16(&b); flavor = avio_rb16(&b);
track->audio.coded_framesize = avio_rb32(&b); track->audio.coded_framesize = avio_rb32(&b);
url_fskip(&b, 12); avio_seek(&b, 12, SEEK_CUR);
track->audio.sub_packet_h = avio_rb16(&b); track->audio.sub_packet_h = avio_rb16(&b);
track->audio.frame_size = avio_rb16(&b); track->audio.frame_size = avio_rb16(&b);
track->audio.sub_packet_size = avio_rb16(&b); track->audio.sub_packet_size = avio_rb16(&b);
......
...@@ -296,7 +296,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -296,7 +296,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
parse = mov_read_udta_string; parse = mov_read_udta_string;
if (!parse) { /* skip leaf atoms data */ if (!parse) { /* skip leaf atoms data */
url_fskip(pb, a.size); avio_seek(pb, a.size, SEEK_CUR);
} else { } else {
int64_t start_pos = url_ftell(pb); int64_t start_pos = url_ftell(pb);
int64_t left; int64_t left;
...@@ -308,14 +308,14 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -308,14 +308,14 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return 0; return 0;
left = a.size - url_ftell(pb) + start_pos; left = a.size - url_ftell(pb) + start_pos;
if (left > 0) /* skip garbage at atom end */ if (left > 0) /* skip garbage at atom end */
url_fskip(pb, left); avio_seek(pb, left, SEEK_CUR);
} }
total_size += a.size; total_size += a.size;
} }
if (total_size < atom.size && atom.size < 0x7ffff) if (total_size < atom.size && atom.size < 0x7ffff)
url_fskip(pb, atom.size - total_size); avio_seek(pb, atom.size - total_size, SEEK_CUR);
return 0; return 0;
} }
...@@ -357,7 +357,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -357,7 +357,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
uint16_t volume_len, len; uint16_t volume_len, len;
int16_t type; int16_t type;
url_fskip(pb, 10); avio_seek(pb, 10, SEEK_CUR);
volume_len = avio_r8(pb); volume_len = avio_r8(pb);
volume_len = FFMIN(volume_len, 27); volume_len = FFMIN(volume_len, 27);
...@@ -365,7 +365,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -365,7 +365,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
dref->volume[volume_len] = 0; dref->volume[volume_len] = 0;
av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", dref->volume, volume_len); av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", dref->volume, volume_len);
url_fskip(pb, 12); avio_seek(pb, 12, SEEK_CUR);
len = avio_r8(pb); len = avio_r8(pb);
len = FFMIN(len, 63); len = FFMIN(len, 63);
...@@ -373,7 +373,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -373,7 +373,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
dref->filename[len] = 0; dref->filename[len] = 0;
av_log(c->fc, AV_LOG_DEBUG, "filename %s, len %d\n", dref->filename, len); av_log(c->fc, AV_LOG_DEBUG, "filename %s, len %d\n", dref->filename, len);
url_fskip(pb, 16); avio_seek(pb, 16, SEEK_CUR);
/* read next level up_from_alias/down_to_target */ /* read next level up_from_alias/down_to_target */
dref->nlvl_from = avio_rb16(pb); dref->nlvl_from = avio_rb16(pb);
...@@ -381,7 +381,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -381,7 +381,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
av_log(c->fc, AV_LOG_DEBUG, "nlvl from %d, nlvl to %d\n", av_log(c->fc, AV_LOG_DEBUG, "nlvl from %d, nlvl to %d\n",
dref->nlvl_from, dref->nlvl_to); dref->nlvl_from, dref->nlvl_to);
url_fskip(pb, 16); avio_seek(pb, 16, SEEK_CUR);
for (type = 0; type != -1 && url_ftell(pb) < next; ) { for (type = 0; type != -1 && url_ftell(pb) < next; ) {
type = avio_rb16(pb); type = avio_rb16(pb);
...@@ -416,7 +416,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -416,7 +416,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
dref->dir[j] = '/'; dref->dir[j] = '/';
av_log(c->fc, AV_LOG_DEBUG, "dir %s\n", dref->dir); av_log(c->fc, AV_LOG_DEBUG, "dir %s\n", dref->dir);
} else } else
url_fskip(pb, len); avio_seek(pb, len, SEEK_CUR);
} }
} }
avio_seek(pb, next, SEEK_SET); avio_seek(pb, next, SEEK_SET);
...@@ -663,9 +663,9 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -663,9 +663,9 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom)
avio_rb16(pb); /* preferred volume */ avio_rb16(pb); /* preferred volume */
url_fskip(pb, 10); /* reserved */ avio_seek(pb, 10, SEEK_CUR); /* reserved */
url_fskip(pb, 36); /* display matrix */ avio_seek(pb, 36, SEEK_CUR); /* display matrix */
avio_rb32(pb); /* preview time */ avio_rb32(pb); /* preview time */
avio_rb32(pb); /* preview duration */ avio_rb32(pb); /* preview duration */
...@@ -782,7 +782,7 @@ static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -782,7 +782,7 @@ static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (mov_read_default(c, pb, atom) < 0) if (mov_read_default(c, pb, atom) < 0)
return -1; return -1;
} else } else
url_fskip(pb, atom.size); avio_seek(pb, atom.size, SEEK_CUR);
return 0; return 0;
} }
...@@ -833,7 +833,7 @@ static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -833,7 +833,7 @@ static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (!st->codec->extradata) if (!st->codec->extradata)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
st->codec->extradata_size = atom.size - 40; st->codec->extradata_size = atom.size - 40;
url_fskip(pb, 40); avio_seek(pb, 40, SEEK_CUR);
avio_read(pb, st->codec->extradata, atom.size - 40); avio_read(pb, st->codec->extradata, atom.size - 40);
return 0; return 0;
} }
...@@ -945,7 +945,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) ...@@ -945,7 +945,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
* in the MOV demuxer, patch welcome. */ * in the MOV demuxer, patch welcome. */
multiple_stsd: multiple_stsd:
av_log(c->fc, AV_LOG_WARNING, "multiple fourcc not supported\n"); av_log(c->fc, AV_LOG_WARNING, "multiple fourcc not supported\n");
url_fskip(pb, size - (url_ftell(pb) - start_pos)); avio_seek(pb, size - (url_ftell(pb) - start_pos), SEEK_CUR);
continue; continue;
} }
/* we cannot demux concatenated h264 streams because of different extradata */ /* we cannot demux concatenated h264 streams because of different extradata */
...@@ -1003,7 +1003,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) ...@@ -1003,7 +1003,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
len = 31; len = 31;
mov_read_mac_string(c, pb, len, st->codec->codec_name, 32); mov_read_mac_string(c, pb, len, st->codec->codec_name, 32);
if (len < 31) if (len < 31)
url_fskip(pb, 31 - len); avio_seek(pb, 31 - len, SEEK_CUR);
/* codec_tag YV12 triggers an UV swap in rawdec.c */ /* codec_tag YV12 triggers an UV swap in rawdec.c */
if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25)) if (!memcmp(st->codec->codec_name, "Planar Y'CbCr 8-bit 4:2:0", 25))
st->codec->codec_tag=MKTAG('I', '4', '2', '0'); st->codec->codec_tag=MKTAG('I', '4', '2', '0');
...@@ -1174,7 +1174,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) ...@@ -1174,7 +1174,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
st->codec->height = sc->height; st->codec->height = sc->height;
} else { } else {
/* other codec type, just skip (rtp, mp4s, tmcd ...) */ /* other codec type, just skip (rtp, mp4s, tmcd ...) */
url_fskip(pb, size - (url_ftell(pb) - start_pos)); avio_seek(pb, size - (url_ftell(pb) - start_pos), SEEK_CUR);
} }
/* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */ /* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */
a.size = size - (url_ftell(pb) - start_pos); a.size = size - (url_ftell(pb) - start_pos);
...@@ -1182,7 +1182,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) ...@@ -1182,7 +1182,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
if (mov_read_default(c, pb, a) < 0) if (mov_read_default(c, pb, a) < 0)
return -1; return -1;
} else if (a.size > 0) } else if (a.size > 0)
url_fskip(pb, a.size); avio_seek(pb, a.size, SEEK_CUR);
} }
if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1) if(st->codec->codec_type==AVMEDIA_TYPE_AUDIO && st->codec->sample_rate==0 && sc->time_scale>1)
...@@ -2078,13 +2078,13 @@ static int mov_read_wide(MOVContext *c, AVIOContext *pb, MOVAtom atom) ...@@ -2078,13 +2078,13 @@ static int mov_read_wide(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if (atom.size < 8) if (atom.size < 8)
return 0; /* continue */ return 0; /* continue */
if (avio_rb32(pb) != 0) { /* 0 sized mdat atom... use the 'wide' atom size */ if (avio_rb32(pb) != 0) { /* 0 sized mdat atom... use the 'wide' atom size */
url_fskip(pb, atom.size - 4); avio_seek(pb, atom.size - 4, SEEK_CUR);
return 0; return 0;
} }
atom.type = avio_rl32(pb); atom.type = avio_rl32(pb);
atom.size -= 8; atom.size -= 8;
if (atom.type != MKTAG('m','d','a','t')) { if (atom.type != MKTAG('m','d','a','t')) {
url_fskip(pb, atom.size); avio_seek(pb, atom.size, SEEK_CUR);
return 0; return 0;
} }
err = mov_read_mdat(c, pb, atom); err = mov_read_mdat(c, pb, atom);
......
...@@ -182,7 +182,7 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in ...@@ -182,7 +182,7 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in
avio_seek(pb, pos, SEEK_SET); avio_seek(pb, pos, SEEK_SET);
break; break;
default: default:
url_fskip(pb, size); avio_seek(pb, size, SEEK_CUR);
} }
} }
...@@ -212,7 +212,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -212,7 +212,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1; return -1;
} }
pos = url_ftell(pb); pos = url_ftell(pb);
url_fskip(pb, 4); //CRC avio_seek(pb, 4, SEEK_CUR); //CRC
c->ver = avio_r8(pb); c->ver = avio_r8(pb);
if(c->ver != 8){ if(c->ver != 8){
av_log(s, AV_LOG_ERROR, "Unknown stream version %d\n", c->ver); av_log(s, AV_LOG_ERROR, "Unknown stream version %d\n", c->ver);
......
...@@ -212,7 +212,7 @@ static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *pb) ...@@ -212,7 +212,7 @@ static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *pb)
ps_info_length = avio_rb16(pb); ps_info_length = avio_rb16(pb);
/* skip program_stream_info */ /* skip program_stream_info */
url_fskip(pb, ps_info_length); avio_seek(pb, ps_info_length, SEEK_CUR);
es_map_length = avio_rb16(pb); es_map_length = avio_rb16(pb);
/* at least one es available? */ /* at least one es available? */
...@@ -223,7 +223,7 @@ static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *pb) ...@@ -223,7 +223,7 @@ static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *pb)
/* remember mapping from stream id to stream type */ /* remember mapping from stream id to stream type */
m->psm_es_type[es_id] = type; m->psm_es_type[es_id] = type;
/* skip program_stream_info */ /* skip program_stream_info */
url_fskip(pb, es_info_length); avio_seek(pb, es_info_length, SEEK_CUR);
es_map_length -= 4 + es_info_length; es_map_length -= 4 + es_info_length;
} }
avio_rb32(pb); /* crc32 */ avio_rb32(pb); /* crc32 */
...@@ -264,7 +264,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, ...@@ -264,7 +264,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
if (startcode == SYSTEM_HEADER_START_CODE) if (startcode == SYSTEM_HEADER_START_CODE)
goto redo; goto redo;
if (startcode == PADDING_STREAM) { if (startcode == PADDING_STREAM) {
url_fskip(s->pb, avio_rb16(s->pb)); avio_seek(s->pb, avio_rb16(s->pb), SEEK_CUR);
goto redo; goto redo;
} }
if (startcode == PRIVATE_STREAM_2) { if (startcode == PRIVATE_STREAM_2) {
...@@ -281,7 +281,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, ...@@ -281,7 +281,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
} }
m->sofdec -= !m->sofdec; m->sofdec -= !m->sofdec;
} }
url_fskip(s->pb, len); avio_seek(s->pb, len, SEEK_CUR);
goto redo; goto redo;
} }
if (startcode == PROGRAM_STREAM_MAP) { if (startcode == PROGRAM_STREAM_MAP) {
...@@ -359,7 +359,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, ...@@ -359,7 +359,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
av_log(s, AV_LOG_WARNING, "pes_ext %X is invalid\n", pes_ext); av_log(s, AV_LOG_WARNING, "pes_ext %X is invalid\n", pes_ext);
pes_ext=skip=0; pes_ext=skip=0;
} }
url_fskip(s->pb, skip); avio_seek(s->pb, skip, SEEK_CUR);
header_len -= skip; header_len -= skip;
if (pes_ext & 0x01) { /* PES extension 2 */ if (pes_ext & 0x01) { /* PES extension 2 */
...@@ -375,7 +375,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, ...@@ -375,7 +375,7 @@ static int mpegps_read_pes_header(AVFormatContext *s,
} }
if(header_len < 0) if(header_len < 0)
goto error_redo; goto error_redo;
url_fskip(s->pb, header_len); avio_seek(s->pb, header_len, SEEK_CUR);
} }
else if( c!= 0xf ) else if( c!= 0xf )
goto redo; goto redo;
...@@ -433,7 +433,7 @@ static int mpegps_read_packet(AVFormatContext *s, ...@@ -433,7 +433,7 @@ static int mpegps_read_packet(AVFormatContext *s,
if(startcode == 0x1bd) { if(startcode == 0x1bd) {
dvdaudio_substream_type = avio_r8(s->pb); dvdaudio_substream_type = avio_r8(s->pb);
url_fskip(s->pb, 3); avio_seek(s->pb, 3, SEEK_CUR);
len -= 4; len -= 4;
} }
...@@ -525,7 +525,7 @@ static int mpegps_read_packet(AVFormatContext *s, ...@@ -525,7 +525,7 @@ static int mpegps_read_packet(AVFormatContext *s,
} else { } else {
skip: skip:
/* skip packet */ /* skip packet */
url_fskip(s->pb, len); avio_seek(s->pb, len, SEEK_CUR);
goto redo; goto redo;
} }
/* no stream found: add a new stream */ /* no stream found: add a new stream */
...@@ -602,7 +602,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index, ...@@ -602,7 +602,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index,
dts != AV_NOPTS_VALUE) { dts != AV_NOPTS_VALUE) {
break; break;
} }
url_fskip(s->pb, len); avio_seek(s->pb, len, SEEK_CUR);
} }
#ifdef DEBUG_SEEK #ifdef DEBUG_SEEK
printf("pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n", pos, dts, dts / 90000.0); printf("pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n", pos, dts, dts / 90000.0);
......
...@@ -1346,7 +1346,7 @@ static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size) ...@@ -1346,7 +1346,7 @@ static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size)
} else { } else {
skip = raw_packet_size - TS_PACKET_SIZE; skip = raw_packet_size - TS_PACKET_SIZE;
if (skip > 0) if (skip > 0)
url_fskip(pb, skip); avio_seek(pb, skip, SEEK_CUR);
break; break;
} }
} }
......
...@@ -104,19 +104,19 @@ static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt) ...@@ -104,19 +104,19 @@ static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt)
uint16_t keyframe; uint16_t keyframe;
uint32_t size, timestamp; uint32_t size, timestamp;
url_fskip(pb, 1); /* one byte has been read ahead */ avio_seek(pb, 1, SEEK_CUR); /* one byte has been read ahead */
url_fskip(pb, 2); avio_seek(pb, 2, SEEK_CUR);
url_fskip(pb, 2); avio_seek(pb, 2, SEEK_CUR);
keyframe = avio_rl16(pb); keyframe = avio_rl16(pb);
size = avio_rl32(pb); size = avio_rl32(pb);
url_fskip(pb, 4); avio_seek(pb, 4, SEEK_CUR);
url_fskip(pb, 4); avio_seek(pb, 4, SEEK_CUR);
timestamp = avio_rl32(pb); timestamp = avio_rl32(pb);
if(!size || av_get_packet(pb, pkt, size) != size) if(!size || av_get_packet(pb, pkt, size) != size)
return -1; return -1;
url_fskip(pb, 1); /* Read ahead one byte of struct size like read_header */ avio_seek(pb, 1, SEEK_CUR); /* Read ahead one byte of struct size like read_header */
pkt->pts = timestamp; pkt->pts = timestamp;
pkt->dts = timestamp; pkt->dts = timestamp;
......
...@@ -83,10 +83,10 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -83,10 +83,10 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
AVStream *st; AVStream *st;
unsigned int audio_subsegments; unsigned int audio_subsegments;
url_fskip(pb, 3); avio_seek(pb, 3, SEEK_CUR);
mtv->file_size = avio_rl32(pb); mtv->file_size = avio_rl32(pb);
mtv->segments = avio_rl32(pb); mtv->segments = avio_rl32(pb);
url_fskip(pb, 32); avio_seek(pb, 32, SEEK_CUR);
mtv->audio_identifier = avio_rl24(pb); mtv->audio_identifier = avio_rl24(pb);
mtv->audio_br = avio_rl16(pb); mtv->audio_br = avio_rl16(pb);
mtv->img_colorfmt = avio_rl24(pb); mtv->img_colorfmt = avio_rl24(pb);
...@@ -105,7 +105,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -105,7 +105,7 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap)
mtv->img_height=mtv->img_segment_size / (mtv->img_bpp>>3) mtv->img_height=mtv->img_segment_size / (mtv->img_bpp>>3)
/ mtv->img_width; / mtv->img_width;
url_fskip(pb, 4); avio_seek(pb, 4, SEEK_CUR);
audio_subsegments = avio_rl16(pb); audio_subsegments = avio_rl16(pb);
mtv->full_segment_size = mtv->full_segment_size =
audio_subsegments * (MTV_AUDIO_PADDING_SIZE + MTV_ASUBCHUNK_DATA_SIZE) + audio_subsegments * (MTV_AUDIO_PADDING_SIZE + MTV_ASUBCHUNK_DATA_SIZE) +
...@@ -164,7 +164,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -164,7 +164,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt)
if((url_ftell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size) if((url_ftell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size)
{ {
url_fskip(pb, MTV_AUDIO_PADDING_SIZE); avio_seek(pb, MTV_AUDIO_PADDING_SIZE, SEEK_CUR);
ret = av_get_packet(pb, pkt, MTV_ASUBCHUNK_DATA_SIZE); ret = av_get_packet(pb, pkt, MTV_ASUBCHUNK_DATA_SIZE);
if(ret < 0) if(ret < 0)
......
...@@ -262,7 +262,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv ...@@ -262,7 +262,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
av_aes_init(mxf->aesc, s->key, 128, 1); av_aes_init(mxf->aesc, s->key, 128, 1);
} }
// crypto context // crypto context
url_fskip(pb, klv_decode_ber_length(pb)); avio_seek(pb, klv_decode_ber_length(pb), SEEK_CUR);
// plaintext offset // plaintext offset
klv_decode_ber_length(pb); klv_decode_ber_length(pb);
plaintext_size = avio_rb64(pb); plaintext_size = avio_rb64(pb);
...@@ -297,7 +297,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv ...@@ -297,7 +297,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv
&pkt->data[plaintext_size], size >> 4, ivec, 1); &pkt->data[plaintext_size], size >> 4, ivec, 1);
pkt->size = orig_size; pkt->size = orig_size;
pkt->stream_index = index; pkt->stream_index = index;
url_fskip(pb, end - url_ftell(pb)); avio_seek(pb, end - url_ftell(pb), SEEK_CUR);
return 0; return 0;
} }
...@@ -339,7 +339,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -339,7 +339,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt)
return 0; return 0;
} else } else
skip: skip:
url_fskip(s->pb, klv.length); avio_seek(s->pb, klv.length, SEEK_CUR);
} }
return AVERROR_EOF; return AVERROR_EOF;
} }
...@@ -397,7 +397,7 @@ static int mxf_read_content_storage(void *arg, AVIOContext *pb, int tag, int siz ...@@ -397,7 +397,7 @@ static int mxf_read_content_storage(void *arg, AVIOContext *pb, int tag, int siz
mxf->packages_refs = av_malloc(mxf->packages_count * sizeof(UID)); mxf->packages_refs = av_malloc(mxf->packages_count * sizeof(UID));
if (!mxf->packages_refs) if (!mxf->packages_refs)
return -1; return -1;
url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */
avio_read(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID)); avio_read(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID));
break; break;
} }
...@@ -416,7 +416,7 @@ static int mxf_read_source_clip(void *arg, AVIOContext *pb, int tag, int size, U ...@@ -416,7 +416,7 @@ static int mxf_read_source_clip(void *arg, AVIOContext *pb, int tag, int size, U
break; break;
case 0x1101: case 0x1101:
/* UMID, only get last 16 bytes */ /* UMID, only get last 16 bytes */
url_fskip(pb, 16); avio_seek(pb, 16, SEEK_CUR);
avio_read(pb, source_clip->source_package_uid, 16); avio_read(pb, source_clip->source_package_uid, 16);
break; break;
case 0x1102: case 0x1102:
...@@ -437,7 +437,7 @@ static int mxf_read_material_package(void *arg, AVIOContext *pb, int tag, int si ...@@ -437,7 +437,7 @@ static int mxf_read_material_package(void *arg, AVIOContext *pb, int tag, int si
package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID)); package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID));
if (!package->tracks_refs) if (!package->tracks_refs)
return -1; return -1;
url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */
avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID)); avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID));
break; break;
} }
...@@ -482,7 +482,7 @@ static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID ...@@ -482,7 +482,7 @@ static int mxf_read_sequence(void *arg, AVIOContext *pb, int tag, int size, UID
sequence->structural_components_refs = av_malloc(sequence->structural_components_count * sizeof(UID)); sequence->structural_components_refs = av_malloc(sequence->structural_components_count * sizeof(UID));
if (!sequence->structural_components_refs) if (!sequence->structural_components_refs)
return -1; return -1;
url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */
avio_read(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID)); avio_read(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID));
break; break;
} }
...@@ -500,12 +500,12 @@ static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size ...@@ -500,12 +500,12 @@ static int mxf_read_source_package(void *arg, AVIOContext *pb, int tag, int size
package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID)); package->tracks_refs = av_malloc(package->tracks_count * sizeof(UID));
if (!package->tracks_refs) if (!package->tracks_refs)
return -1; return -1;
url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */
avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID)); avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID));
break; break;
case 0x4401: case 0x4401:
/* UMID, only get last 16 bytes */ /* UMID, only get last 16 bytes */
url_fskip(pb, 16); avio_seek(pb, 16, SEEK_CUR);
avio_read(pb, package->package_uid, 16); avio_read(pb, package->package_uid, 16);
break; break;
case 0x4701: case 0x4701:
...@@ -558,7 +558,7 @@ static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int ...@@ -558,7 +558,7 @@ static int mxf_read_generic_descriptor(void *arg, AVIOContext *pb, int tag, int
descriptor->sub_descriptors_refs = av_malloc(descriptor->sub_descriptors_count * sizeof(UID)); descriptor->sub_descriptors_refs = av_malloc(descriptor->sub_descriptors_count * sizeof(UID));
if (!descriptor->sub_descriptors_refs) if (!descriptor->sub_descriptors_refs)
return -1; return -1;
url_fskip(pb, 4); /* useless size of objects, always 16 according to specs */ avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */
avio_read(pb, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID)); avio_read(pb, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID));
break; break;
case 0x3004: case 0x3004:
...@@ -943,7 +943,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -943,7 +943,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap)
} }
} }
if (!metadata->read) if (!metadata->read)
url_fskip(s->pb, klv.length); avio_seek(s->pb, klv.length, SEEK_CUR);
} }
return mxf_parse_structural_metadata(mxf); return mxf_parse_structural_metadata(mxf);
} }
......
...@@ -73,7 +73,7 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -73,7 +73,7 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt)
avio_r8(s->pb); avio_r8(s->pb);
size = avio_rl16(s->pb); size = avio_rl16(s->pb);
url_fskip(s->pb, 9); avio_seek(s->pb, 9, SEEK_CUR);
if (size == 0) { if (size == 0) {
av_log(s, AV_LOG_DEBUG, "Next packet size is zero\n"); av_log(s, AV_LOG_DEBUG, "Next packet size is zero\n");
......
...@@ -584,7 +584,7 @@ null_chunk_retry: ...@@ -584,7 +584,7 @@ null_chunk_retry:
((auxtag >> 16) & 0x0ff), ((auxtag >> 16) & 0x0ff),
((auxtag >> 24) & 0x0ff), ((auxtag >> 24) & 0x0ff),
auxsize); auxsize);
url_fskip(pb, auxsize); avio_seek(pb, auxsize, SEEK_CUR);
vsize -= auxsize + sizeof(uint16_t) + sizeof(uint32_t); /* that's becoming braindead */ vsize -= auxsize + sizeof(uint16_t) + sizeof(uint32_t); /* that's becoming braindead */
} }
......
...@@ -757,7 +757,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){ ...@@ -757,7 +757,7 @@ static int decode_frame(NUTContext *nut, AVPacket *pkt, int frame_code){
||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts) ||(discard >= AVDISCARD_BIDIR && last_IP_pts != AV_NOPTS_VALUE && last_IP_pts > pts)
|| discard >= AVDISCARD_ALL || discard >= AVDISCARD_ALL
|| stc->skip_until_key_frame){ || stc->skip_until_key_frame){
url_fskip(bc, size); avio_seek(bc, size, SEEK_CUR);
return 1; return 1;
} }
......
...@@ -66,7 +66,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, ...@@ -66,7 +66,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst,
switch (frametype) { switch (frametype) {
case NUV_EXTRADATA: case NUV_EXTRADATA:
subtype = avio_r8(pb); subtype = avio_r8(pb);
url_fskip(pb, 6); avio_seek(pb, 6, SEEK_CUR);
size = PKTSIZE(avio_rl32(pb)); size = PKTSIZE(avio_rl32(pb));
if (vst && subtype == 'R') { if (vst && subtype == 'R') {
vst->codec->extradata_size = size; vst->codec->extradata_size = size;
...@@ -78,7 +78,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, ...@@ -78,7 +78,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst,
} }
break; break;
case NUV_MYTHEXT: case NUV_MYTHEXT:
url_fskip(pb, 7); avio_seek(pb, 7, SEEK_CUR);
size = PKTSIZE(avio_rl32(pb)); size = PKTSIZE(avio_rl32(pb));
if (size != 128 * 4) if (size != 128 * 4)
break; break;
...@@ -90,7 +90,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, ...@@ -90,7 +90,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst,
if (vst->codec->codec_tag == MKTAG('R', 'J', 'P', 'G')) if (vst->codec->codec_tag == MKTAG('R', 'J', 'P', 'G'))
vst->codec->codec_id = CODEC_ID_NUV; vst->codec->codec_id = CODEC_ID_NUV;
} else } else
url_fskip(pb, 4); avio_seek(pb, 4, SEEK_CUR);
if (ast) { if (ast) {
ast->codec->codec_tag = avio_rl32(pb); ast->codec->codec_tag = avio_rl32(pb);
...@@ -102,20 +102,20 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, ...@@ -102,20 +102,20 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst,
ast->codec->bits_per_coded_sample); ast->codec->bits_per_coded_sample);
ast->need_parsing = AVSTREAM_PARSE_FULL; ast->need_parsing = AVSTREAM_PARSE_FULL;
} else } else
url_fskip(pb, 4 * 4); avio_seek(pb, 4 * 4, SEEK_CUR);
size -= 6 * 4; size -= 6 * 4;
url_fskip(pb, size); avio_seek(pb, size, SEEK_CUR);
return 1; return 1;
case NUV_SEEKP: case NUV_SEEKP:
size = 11; size = 11;
break; break;
default: default:
url_fskip(pb, 7); avio_seek(pb, 7, SEEK_CUR);
size = PKTSIZE(avio_rl32(pb)); size = PKTSIZE(avio_rl32(pb));
break; break;
} }
url_fskip(pb, size); avio_seek(pb, size, SEEK_CUR);
} }
return 0; return 0;
} }
...@@ -130,14 +130,14 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { ...@@ -130,14 +130,14 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) {
AVStream *vst = NULL, *ast = NULL; AVStream *vst = NULL, *ast = NULL;
avio_read(pb, id_string, 12); avio_read(pb, id_string, 12);
is_mythtv = !memcmp(id_string, "MythTVVideo", 12); is_mythtv = !memcmp(id_string, "MythTVVideo", 12);
url_fskip(pb, 5); // version string avio_seek(pb, 5, SEEK_CUR); // version string
url_fskip(pb, 3); // padding avio_seek(pb, 3, SEEK_CUR); // padding
width = avio_rl32(pb); width = avio_rl32(pb);
height = avio_rl32(pb); height = avio_rl32(pb);
avio_rl32(pb); // unused, "desiredwidth" avio_rl32(pb); // unused, "desiredwidth"
avio_rl32(pb); // unused, "desiredheight" avio_rl32(pb); // unused, "desiredheight"
avio_r8(pb); // 'P' == progressive, 'I' == interlaced avio_r8(pb); // 'P' == progressive, 'I' == interlaced
url_fskip(pb, 3); // padding avio_seek(pb, 3, SEEK_CUR); // padding
aspect = av_int2dbl(avio_rl64(pb)); aspect = av_int2dbl(avio_rl64(pb));
if (aspect > 0.9999 && aspect < 1.0001) if (aspect > 0.9999 && aspect < 1.0001)
aspect = 4.0 / 3.0; aspect = 4.0 / 3.0;
...@@ -206,13 +206,13 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { ...@@ -206,13 +206,13 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
switch (frametype) { switch (frametype) {
case NUV_EXTRADATA: case NUV_EXTRADATA:
if (!ctx->rtjpg_video) { if (!ctx->rtjpg_video) {
url_fskip(pb, size); avio_seek(pb, size, SEEK_CUR);
break; break;
} }
case NUV_VIDEO: case NUV_VIDEO:
if (ctx->v_id < 0) { if (ctx->v_id < 0) {
av_log(s, AV_LOG_ERROR, "Video packet in file without video stream!\n"); av_log(s, AV_LOG_ERROR, "Video packet in file without video stream!\n");
url_fskip(pb, size); avio_seek(pb, size, SEEK_CUR);
break; break;
} }
ret = av_new_packet(pkt, copyhdrsize + size); ret = av_new_packet(pkt, copyhdrsize + size);
...@@ -236,7 +236,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { ...@@ -236,7 +236,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
case NUV_AUDIO: case NUV_AUDIO:
if (ctx->a_id < 0) { if (ctx->a_id < 0) {
av_log(s, AV_LOG_ERROR, "Audio packet in file without audio stream!\n"); av_log(s, AV_LOG_ERROR, "Audio packet in file without audio stream!\n");
url_fskip(pb, size); avio_seek(pb, size, SEEK_CUR);
break; break;
} }
ret = av_get_packet(pb, pkt, size); ret = av_get_packet(pb, pkt, size);
...@@ -250,7 +250,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { ...@@ -250,7 +250,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) {
// contains no data, size value is invalid // contains no data, size value is invalid
break; break;
default: default:
url_fskip(pb, size); avio_seek(pb, size, SEEK_CUR);
break; break;
} }
} }
......
...@@ -122,7 +122,7 @@ recover: ...@@ -122,7 +122,7 @@ recover:
if (pes_signal != 1) { if (pes_signal != 1) {
pva_log(s, AV_LOG_WARNING, "expected signaled PES packet, " pva_log(s, AV_LOG_WARNING, "expected signaled PES packet, "
"trying to recover\n"); "trying to recover\n");
url_fskip(pb, length - 9); avio_seek(pb, length - 9, SEEK_CUR);
if (!read_packet) if (!read_packet)
return AVERROR(EIO); return AVERROR(EIO);
goto recover; goto recover;
......
...@@ -93,7 +93,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -93,7 +93,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_rb32(pb); // "RIFF" avio_rb32(pb); // "RIFF"
s->file_size = avio_rl32(pb) + 8; s->file_size = avio_rl32(pb) + 8;
url_fskip(pb, 8 + 4 + 1 + 1); // "QLCMfmt " + chunk-size + major-version + minor-version avio_seek(pb, 8 + 4 + 1 + 1, SEEK_CUR); // "QLCMfmt " + chunk-size + major-version + minor-version
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->channels = 1; st->codec->channels = 1;
...@@ -110,13 +110,13 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -110,13 +110,13 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_log(s, AV_LOG_ERROR, "Unknown codec GUID.\n"); av_log(s, AV_LOG_ERROR, "Unknown codec GUID.\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
url_fskip(pb, 2 + 80); // codec-version + codec-name avio_seek(pb, 2 + 80, SEEK_CUR); // codec-version + codec-name
st->codec->bit_rate = avio_rl16(pb); st->codec->bit_rate = avio_rl16(pb);
s->packet_size = avio_rl16(pb); s->packet_size = avio_rl16(pb);
url_fskip(pb, 2); // block-size avio_seek(pb, 2, SEEK_CUR); // block-size
st->codec->sample_rate = avio_rl16(pb); st->codec->sample_rate = avio_rl16(pb);
url_fskip(pb, 2); // sample-size avio_seek(pb, 2, SEEK_CUR); // sample-size
memset(c->rates_per_mode, -1, sizeof(c->rates_per_mode)); memset(c->rates_per_mode, -1, sizeof(c->rates_per_mode));
nb_rates = avio_rl32(pb); nb_rates = avio_rl32(pb);
...@@ -129,7 +129,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -129,7 +129,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap)
} else } else
c->rates_per_mode[mode] = size; c->rates_per_mode[mode] = size;
} }
url_fskip(pb, 16 - 2*nb_rates + 20); // empty entries of rate-map-table + reserved avio_seek(pb, 16 - 2*nb_rates + 20, SEEK_CUR); // empty entries of rate-map-table + reserved
return 0; return 0;
} }
...@@ -174,14 +174,14 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -174,14 +174,14 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt)
case MKTAG('v', 'r', 'a', 't'): case MKTAG('v', 'r', 'a', 't'):
if (avio_rl32(pb)) // var-rate-flag if (avio_rl32(pb)) // var-rate-flag
s->packet_size = 0; s->packet_size = 0;
url_fskip(pb, 4); // size-in-packets avio_seek(pb, 4, SEEK_CUR); // size-in-packets
break; break;
case MKTAG('d', 'a', 't', 'a'): case MKTAG('d', 'a', 't', 'a'):
c->data_size = chunk_size; c->data_size = chunk_size;
break; break;
default: default:
url_fskip(pb, chunk_size); avio_seek(pb, chunk_size, SEEK_CUR);
} }
} }
return AVERROR_EOF; return AVERROR_EOF;
......
...@@ -72,7 +72,7 @@ static int r3d_read_red1(AVFormatContext *s) ...@@ -72,7 +72,7 @@ static int r3d_read_red1(AVFormatContext *s)
tmp = avio_rb32(s->pb); // filenum tmp = avio_rb32(s->pb); // filenum
av_dlog(s, "filenum %d\n", tmp); av_dlog(s, "filenum %d\n", tmp);
url_fskip(s->pb, 32); // unknown avio_seek(s->pb, 32, SEEK_CUR); // unknown
st->codec->width = avio_rb32(s->pb); st->codec->width = avio_rb32(s->pb);
st->codec->height = avio_rb32(s->pb); st->codec->height = avio_rb32(s->pb);
...@@ -152,7 +152,7 @@ static void r3d_read_reos(AVFormatContext *s) ...@@ -152,7 +152,7 @@ static void r3d_read_reos(AVFormatContext *s)
tmp = avio_rb32(s->pb); tmp = avio_rb32(s->pb);
av_dlog(s, "num audio chunks %d\n", tmp); av_dlog(s, "num audio chunks %d\n", tmp);
url_fskip(s->pb, 6*4); avio_seek(s->pb, 6*4, SEEK_CUR);
} }
static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap)
...@@ -332,7 +332,7 @@ static int r3d_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -332,7 +332,7 @@ static int r3d_read_packet(AVFormatContext *s, AVPacket *pkt)
break; break;
default: default:
skip: skip:
url_fskip(s->pb, atom.size-8); avio_seek(s->pb, atom.size-8, SEEK_CUR);
} }
} }
return err; return err;
......
...@@ -161,16 +161,16 @@ rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr) ...@@ -161,16 +161,16 @@ rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr)
num = avio_rb16(&pb); num = avio_rb16(&pb);
if (rule_nr < 0 || rule_nr >= num) if (rule_nr < 0 || rule_nr >= num)
return -1; return -1;
url_fskip(&pb, rule_nr * 2); avio_seek(&pb, rule_nr * 2, SEEK_CUR);
chunk_nr = avio_rb16(&pb); chunk_nr = avio_rb16(&pb);
url_fskip(&pb, (num - 1 - rule_nr) * 2); avio_seek(&pb, (num - 1 - rule_nr) * 2, SEEK_CUR);
/* read MDPR chunks */ /* read MDPR chunks */
num = avio_rb16(&pb); num = avio_rb16(&pb);
if (chunk_nr >= num) if (chunk_nr >= num)
return -1; return -1;
while (chunk_nr--) while (chunk_nr--)
url_fskip(&pb, avio_rb32(&pb)); avio_seek(&pb, avio_rb32(&pb), SEEK_CUR);
size = avio_rb32(&pb); size = avio_rb32(&pb);
} else { } else {
size = rdt->mlti_data_size; size = rdt->mlti_data_size;
......
...@@ -501,7 +501,7 @@ void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) ...@@ -501,7 +501,7 @@ void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)
codec->bits_per_coded_sample = avio_rl16(pb); codec->bits_per_coded_sample = avio_rl16(pb);
codec->channel_layout = avio_rl32(pb); /* dwChannelMask */ codec->channel_layout = avio_rl32(pb); /* dwChannelMask */
id = avio_rl32(pb); /* 4 first bytes of GUID */ id = avio_rl32(pb); /* 4 first bytes of GUID */
url_fskip(pb, 12); /* skip end of GUID */ avio_seek(pb, 12, SEEK_CUR); /* skip end of GUID */
cbSize -= 22; cbSize -= 22;
size -= 22; size -= 22;
} }
...@@ -514,7 +514,7 @@ void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) ...@@ -514,7 +514,7 @@ void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size)
/* It is possible for the chunk to contain garbage at the end */ /* It is possible for the chunk to contain garbage at the end */
if (size > 0) if (size > 0)
url_fskip(pb, size); avio_seek(pb, size, SEEK_CUR);
} }
codec->codec_id = ff_wav_codec_get_id(id, codec->bits_per_coded_sample); codec->codec_id = ff_wav_codec_get_id(id, codec->bits_per_coded_sample);
if (codec->codec_id == CODEC_ID_AAC_LATM) { if (codec->codec_id == CODEC_ID_AAC_LATM) {
......
...@@ -95,7 +95,7 @@ static av_cold int rl2_read_header(AVFormatContext *s, ...@@ -95,7 +95,7 @@ static av_cold int rl2_read_header(AVFormatContext *s,
int i; int i;
int ret = 0; int ret = 0;
url_fskip(pb,4); /* skip FORM tag */ avio_seek(pb,4, SEEK_CUR); /* skip FORM tag */
back_size = avio_rl32(pb); /**< get size of the background frame */ back_size = avio_rl32(pb); /**< get size of the background frame */
signature = avio_rb32(pb); signature = avio_rb32(pb);
data_size = avio_rb32(pb); data_size = avio_rb32(pb);
......
...@@ -132,7 +132,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, ...@@ -132,7 +132,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
if (version == 3) { if (version == 3) {
int header_size = avio_rb16(pb); int header_size = avio_rb16(pb);
int64_t startpos = url_ftell(pb); int64_t startpos = url_ftell(pb);
url_fskip(pb, 14); avio_seek(pb, 14, SEEK_CUR);
rm_read_metadata(s, 0); rm_read_metadata(s, 0);
if ((startpos + header_size) >= url_ftell(pb) + 2) { if ((startpos + header_size) >= url_ftell(pb) + 2) {
// fourcc (should always be "lpcJ") // fourcc (should always be "lpcJ")
...@@ -141,7 +141,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, ...@@ -141,7 +141,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
} }
// Skip extra header crap (this should never happen) // Skip extra header crap (this should never happen)
if ((startpos + header_size) > url_ftell(pb)) if ((startpos + header_size) > url_ftell(pb))
url_fskip(pb, header_size + startpos - url_ftell(pb)); avio_seek(pb, header_size + startpos - url_ftell(pb), SEEK_CUR);
st->codec->sample_rate = 8000; st->codec->sample_rate = 8000;
st->codec->channels = 1; st->codec->channels = 1;
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
...@@ -150,7 +150,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, ...@@ -150,7 +150,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
int flavor, sub_packet_h, coded_framesize, sub_packet_size; int flavor, sub_packet_h, coded_framesize, sub_packet_size;
int codecdata_length; int codecdata_length;
/* old version (4) */ /* old version (4) */
url_fskip(pb, 2); /* unused */ avio_seek(pb, 2, SEEK_CUR); /* unused */
avio_rb32(pb); /* .ra4 */ avio_rb32(pb); /* .ra4 */
avio_rb32(pb); /* data size */ avio_rb32(pb); /* data size */
avio_rb16(pb); /* version2 */ avio_rb16(pb); /* version2 */
...@@ -321,7 +321,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, ...@@ -321,7 +321,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb,
skip: skip:
/* skip codec info */ /* skip codec info */
size = url_ftell(pb) - codec_pos; size = url_ftell(pb) - codec_pos;
url_fskip(pb, codec_data_size - size); avio_seek(pb, codec_data_size - size, SEEK_CUR);
return 0; return 0;
} }
...@@ -340,7 +340,7 @@ static int rm_read_index(AVFormatContext *s) ...@@ -340,7 +340,7 @@ static int rm_read_index(AVFormatContext *s)
size = avio_rb32(pb); size = avio_rb32(pb);
if (size < 20) if (size < 20)
return -1; return -1;
url_fskip(pb, 2); avio_seek(pb, 2, SEEK_CUR);
n_pkts = avio_rb32(pb); n_pkts = avio_rb32(pb);
str_id = avio_rb16(pb); str_id = avio_rb16(pb);
next_off = avio_rb32(pb); next_off = avio_rb32(pb);
...@@ -353,10 +353,10 @@ static int rm_read_index(AVFormatContext *s) ...@@ -353,10 +353,10 @@ static int rm_read_index(AVFormatContext *s)
goto skip; goto skip;
for (n = 0; n < n_pkts; n++) { for (n = 0; n < n_pkts; n++) {
url_fskip(pb, 2); avio_seek(pb, 2, SEEK_CUR);
pts = avio_rb32(pb); pts = avio_rb32(pb);
pos = avio_rb32(pb); pos = avio_rb32(pb);
url_fskip(pb, 4); /* packet no. */ avio_seek(pb, 4, SEEK_CUR); /* packet no. */
av_add_index_entry(st, pos, pts, 0, 0, AVINDEX_KEYFRAME); av_add_index_entry(st, pos, pts, 0, 0, AVINDEX_KEYFRAME);
} }
...@@ -469,7 +469,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -469,7 +469,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap)
goto header_end; goto header_end;
default: default:
/* unknown tag: skip it */ /* unknown tag: skip it */
url_fskip(pb, tag_size - 10); avio_seek(pb, tag_size - 10, SEEK_CUR);
break; break;
} }
} }
...@@ -529,7 +529,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ ...@@ -529,7 +529,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_
if(state == MKBETAG('I', 'N', 'D', 'X')){ if(state == MKBETAG('I', 'N', 'D', 'X')){
int n_pkts, expected_len; int n_pkts, expected_len;
len = avio_rb32(pb); len = avio_rb32(pb);
url_fskip(pb, 2); avio_seek(pb, 2, SEEK_CUR);
n_pkts = avio_rb32(pb); n_pkts = avio_rb32(pb);
expected_len = 20 + n_pkts * 14; expected_len = 20 + n_pkts * 14;
if (len == 20) if (len == 20)
...@@ -566,7 +566,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ ...@@ -566,7 +566,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_
if (i == s->nb_streams) { if (i == s->nb_streams) {
skip: skip:
/* skip packet if unknown number */ /* skip packet if unknown number */
url_fskip(pb, len); avio_seek(pb, len, SEEK_CUR);
rm->remaining_len = 0; rm->remaining_len = 0;
continue; continue;
} }
...@@ -929,7 +929,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index, ...@@ -929,7 +929,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index,
break; break;
} }
url_fskip(s->pb, len); avio_seek(s->pb, len, SEEK_CUR);
} }
*ppos = pos; *ppos = pos;
return dts; return dts;
......
...@@ -187,11 +187,11 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, ...@@ -187,11 +187,11 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
flags |= RTP_FLAG_KEY; flags |= RTP_FLAG_KEY;
len_off = avio_rb24(pb); len_off = avio_rb24(pb);
if (mflags & 0x20) /**< relative timestamp */ if (mflags & 0x20) /**< relative timestamp */
url_fskip(pb, 4); avio_seek(pb, 4, SEEK_CUR);
if (mflags & 0x10) /**< has duration */ if (mflags & 0x10) /**< has duration */
url_fskip(pb, 4); avio_seek(pb, 4, SEEK_CUR);
if (mflags & 0x8) /**< has location ID */ if (mflags & 0x8) /**< has location ID */
url_fskip(pb, 4); avio_seek(pb, 4, SEEK_CUR);
off = url_ftell(pb); off = url_ftell(pb);
if (!(mflags & 0x40)) { if (!(mflags & 0x40)) {
...@@ -214,7 +214,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, ...@@ -214,7 +214,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
return AVERROR(EIO); return AVERROR(EIO);
avio_write(asf->pktbuf, buf + off, len - off); avio_write(asf->pktbuf, buf + off, len - off);
url_fskip(pb, len - off); avio_seek(pb, len - off, SEEK_CUR);
if (!(flags & RTP_FLAG_MARKER)) if (!(flags & RTP_FLAG_MARKER))
return -1; return -1;
out_len = url_close_dyn_buf(asf->pktbuf, &asf->buf); out_len = url_close_dyn_buf(asf->pktbuf, &asf->buf);
...@@ -234,7 +234,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, ...@@ -234,7 +234,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf,
asf->buf = av_realloc(asf->buf, out_len); asf->buf = av_realloc(asf->buf, out_len);
memcpy(asf->buf + prev_len, buf + off, memcpy(asf->buf + prev_len, buf + off,
FFMIN(cur_len, len - off)); FFMIN(cur_len, len - off));
url_fskip(pb, cur_len); avio_seek(pb, cur_len, SEEK_CUR);
} }
} }
......
...@@ -149,13 +149,13 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, ...@@ -149,13 +149,13 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
break; break;
} }
default: default:
url_fskip(&pb, tlv_len); avio_seek(&pb, tlv_len, SEEK_CUR);
break; break;
} }
} }
/* 32-bit alignment */ /* 32-bit alignment */
url_fskip(&pb, ((url_ftell(&pb) + 3) & ~3) - url_ftell(&pb)); avio_seek(&pb, ((url_ftell(&pb) + 3) & ~3) - url_ftell(&pb), SEEK_CUR);
} else } else
avio_seek(&pb, 4, SEEK_SET); avio_seek(&pb, 4, SEEK_SET);
......
...@@ -51,14 +51,14 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g ...@@ -51,14 +51,14 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g
GET_SAUCE_META("artist", 20) GET_SAUCE_META("artist", 20)
GET_SAUCE_META("publisher", 20) GET_SAUCE_META("publisher", 20)
GET_SAUCE_META("date", 8) GET_SAUCE_META("date", 8)
url_fskip(pb, 4); avio_seek(pb, 4, SEEK_CUR);
datatype = avio_r8(pb); datatype = avio_r8(pb);
filetype = avio_r8(pb); filetype = avio_r8(pb);
t1 = avio_rl16(pb); t1 = avio_rl16(pb);
t2 = avio_rl16(pb); t2 = avio_rl16(pb);
nb_comments = avio_r8(pb); nb_comments = avio_r8(pb);
flags = avio_r8(pb); flags = avio_r8(pb);
url_fskip(pb, 4); avio_seek(pb, 4, SEEK_CUR);
GET_SAUCE_META("encoder", 22); GET_SAUCE_META("encoder", 22);
if (got_width && datatype && filetype) { if (got_width && datatype && filetype) {
......
...@@ -103,7 +103,7 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) ...@@ -103,7 +103,7 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb)
} }
width = avio_rl16(pb); width = avio_rl16(pb);
height = avio_rl16(pb); height = avio_rl16(pb);
url_fskip(pb, 4); avio_seek(pb, 4, SEEK_CUR);
c->frames = avio_rl16(pb); c->frames = avio_rl16(pb);
if(!c->frames){ if(!c->frames){
av_log(s, AV_LOG_ERROR, "File contains no frames ???\n"); av_log(s, AV_LOG_ERROR, "File contains no frames ???\n");
...@@ -113,7 +113,7 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) ...@@ -113,7 +113,7 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb)
c->rate = avio_rl16(pb); c->rate = avio_rl16(pb);
c->block_align = c->rate * (c->bits >> 3); c->block_align = c->rate * (c->bits >> 3);
url_fskip(pb, 16); //zeroes avio_seek(pb, 16, SEEK_CUR); //zeroes
st = av_new_stream(s, 0); st = av_new_stream(s, 0);
if (!st) if (!st)
...@@ -145,7 +145,7 @@ static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) ...@@ -145,7 +145,7 @@ static int siff_parse_soun(AVFormatContext *s, SIFFContext *c, AVIOContext *pb)
av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n"); av_log(s, AV_LOG_ERROR, "Header chunk size is incorrect\n");
return -1; return -1;
} }
url_fskip(pb, 4); //unknown value avio_seek(pb, 4, SEEK_CUR); //unknown value
c->rate = avio_rl16(pb); c->rate = avio_rl16(pb);
c->bits = avio_rl16(pb); c->bits = avio_rl16(pb);
c->block_align = c->rate * (c->bits >> 3); c->block_align = c->rate * (c->bits >> 3);
...@@ -160,7 +160,7 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -160,7 +160,7 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (avio_rl32(pb) != TAG_SIFF) if (avio_rl32(pb) != TAG_SIFF)
return -1; return -1;
url_fskip(pb, 4); //ignore size avio_seek(pb, 4, SEEK_CUR); //ignore size
tag = avio_rl32(pb); tag = avio_rl32(pb);
if (tag != TAG_VBV1 && tag != TAG_SOUN){ if (tag != TAG_VBV1 && tag != TAG_SOUN){
...@@ -176,7 +176,7 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -176,7 +176,7 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_log(s, AV_LOG_ERROR, "'BODY' chunk is missing\n"); av_log(s, AV_LOG_ERROR, "'BODY' chunk is missing\n");
return -1; return -1;
} }
url_fskip(pb, 4); //ignore size avio_seek(pb, 4, SEEK_CUR); //ignore size
return 0; return 0;
} }
......
...@@ -58,14 +58,14 @@ static int sox_read_header(AVFormatContext *s, ...@@ -58,14 +58,14 @@ static int sox_read_header(AVFormatContext *s,
if (avio_rl32(pb) == SOX_TAG) { if (avio_rl32(pb) == SOX_TAG) {
st->codec->codec_id = CODEC_ID_PCM_S32LE; st->codec->codec_id = CODEC_ID_PCM_S32LE;
header_size = avio_rl32(pb); header_size = avio_rl32(pb);
url_fskip(pb, 8); /* sample count */ avio_seek(pb, 8, SEEK_CUR); /* sample count */
sample_rate = av_int2dbl(avio_rl64(pb)); sample_rate = av_int2dbl(avio_rl64(pb));
st->codec->channels = avio_rl32(pb); st->codec->channels = avio_rl32(pb);
comment_size = avio_rl32(pb); comment_size = avio_rl32(pb);
} else { } else {
st->codec->codec_id = CODEC_ID_PCM_S32BE; st->codec->codec_id = CODEC_ID_PCM_S32BE;
header_size = avio_rb32(pb); header_size = avio_rb32(pb);
url_fskip(pb, 8); /* sample count */ avio_seek(pb, 8, SEEK_CUR); /* sample count */
sample_rate = av_int2dbl(avio_rb64(pb)); sample_rate = av_int2dbl(avio_rb64(pb));
st->codec->channels = avio_rb32(pb); st->codec->channels = avio_rb32(pb);
comment_size = avio_rb32(pb); comment_size = avio_rb32(pb);
...@@ -105,7 +105,7 @@ static int sox_read_header(AVFormatContext *s, ...@@ -105,7 +105,7 @@ static int sox_read_header(AVFormatContext *s,
AV_METADATA_DONT_STRDUP_VAL); AV_METADATA_DONT_STRDUP_VAL);
} }
url_fskip(pb, header_size - SOX_FIXED_HDR - comment_size); avio_seek(pb, header_size - SOX_FIXED_HDR - comment_size, SEEK_CUR);
st->codec->sample_rate = sample_rate; st->codec->sample_rate = sample_rate;
st->codec->bits_per_coded_sample = 32; st->codec->bits_per_coded_sample = 32;
......
...@@ -201,7 +201,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -201,7 +201,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
} }
/* skip over the padding to the beginning of the next frame */ /* skip over the padding to the beginning of the next frame */
url_fskip(pb, offset - pkt->size - BURST_HEADER_SIZE); avio_seek(pb, offset - pkt->size - BURST_HEADER_SIZE, SEEK_CUR);
if (!s->nb_streams) { if (!s->nb_streams) {
/* first packet, create a stream */ /* first packet, create a stream */
......
...@@ -70,7 +70,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -70,7 +70,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap)
/* skip rectangle size */ /* skip rectangle size */
nbits = avio_r8(pb) >> 3; nbits = avio_r8(pb) >> 3;
len = (4 * nbits - 3 + 7) / 8; len = (4 * nbits - 3 + 7) / 8;
url_fskip(pb, len); avio_seek(pb, len, SEEK_CUR);
swf->frame_rate = avio_rl16(pb); /* 8.8 fixed */ swf->frame_rate = avio_rl16(pb); /* 8.8 fixed */
avio_rl16(pb); /* frame count */ avio_rl16(pb); /* frame count */
...@@ -159,7 +159,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -159,7 +159,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
st = s->streams[i]; st = s->streams[i];
if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1) { if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1) {
if (st->codec->codec_id == CODEC_ID_MP3) { if (st->codec->codec_id == CODEC_ID_MP3) {
url_fskip(pb, 4); avio_seek(pb, 4, SEEK_CUR);
av_get_packet(pb, pkt, len-4); av_get_packet(pb, pkt, len-4);
} else { // ADPCM, PCM } else { // ADPCM, PCM
av_get_packet(pb, pkt, len); av_get_packet(pb, pkt, len);
...@@ -202,7 +202,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -202,7 +202,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt)
return pkt->size; return pkt->size;
} }
skip: skip:
url_fskip(pb, len); avio_seek(pb, len, SEEK_CUR);
} }
return 0; return 0;
} }
......
...@@ -152,7 +152,7 @@ static int tmv_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -152,7 +152,7 @@ static int tmv_read_packet(AVFormatContext *s, AVPacket *pkt)
ret = av_get_packet(pb, pkt, pkt_size); ret = av_get_packet(pb, pkt, pkt_size);
if (tmv->stream_index) if (tmv->stream_index)
url_fskip(pb, tmv->padding); avio_seek(pb, tmv->padding, SEEK_CUR);
pkt->stream_index = tmv->stream_index; pkt->stream_index = tmv->stream_index;
tmv->stream_index ^= 1; tmv->stream_index ^= 1;
......
...@@ -50,7 +50,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -50,7 +50,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (avio_rl32(s->pb) != AV_RL32("TTA1")) if (avio_rl32(s->pb) != AV_RL32("TTA1"))
return -1; // not tta file return -1; // not tta file
url_fskip(s->pb, 2); // FIXME: flags avio_seek(s->pb, 2, SEEK_CUR); // FIXME: flags
channels = avio_rl16(s->pb); channels = avio_rl16(s->pb);
bps = avio_rl16(s->pb); bps = avio_rl16(s->pb);
samplerate = avio_rl32(s->pb); samplerate = avio_rl32(s->pb);
...@@ -65,7 +65,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -65,7 +65,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
return -1; return -1;
} }
url_fskip(s->pb, 4); // header crc avio_seek(s->pb, 4, SEEK_CUR); // header crc
framelen = samplerate*256/245; framelen = samplerate*256/245;
c->totalframes = datalen / framelen + ((datalen % framelen) ? 1 : 0); c->totalframes = datalen / framelen + ((datalen % framelen) ? 1 : 0);
...@@ -91,7 +91,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -91,7 +91,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_add_index_entry(st, framepos, i*framelen, size, 0, AVINDEX_KEYFRAME); av_add_index_entry(st, framepos, i*framelen, size, 0, AVINDEX_KEYFRAME);
framepos += size; framepos += size;
} }
url_fskip(s->pb, 4); // seektable crc avio_seek(s->pb, 4, SEEK_CUR); // seektable crc
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_TTA; st->codec->codec_id = CODEC_ID_TTA;
......
...@@ -73,7 +73,7 @@ next_chunk: ...@@ -73,7 +73,7 @@ next_chunk:
if (chunk_size > 100) if (chunk_size > 100)
break; break;
case TXD_EXTRA: case TXD_EXTRA:
url_fskip(s->pb, chunk_size); avio_seek(s->pb, chunk_size, SEEK_CUR);
case TXD_FILE: case TXD_FILE:
case TXD_TEXTURE: case TXD_TEXTURE:
goto next_chunk; goto next_chunk;
......
...@@ -68,7 +68,7 @@ static int vc1t_read_header(AVFormatContext *s, ...@@ -68,7 +68,7 @@ static int vc1t_read_header(AVFormatContext *s,
st->codec->width = avio_rl32(pb); st->codec->width = avio_rl32(pb);
if(avio_rl32(pb) != 0xC) if(avio_rl32(pb) != 0xC)
return -1; return -1;
url_fskip(pb, 8); avio_seek(pb, 8, SEEK_CUR);
fps = avio_rl32(pb); fps = avio_rl32(pb);
if(fps == 0xFFFFFFFF) if(fps == 0xFFFFFFFF)
av_set_pts_info(st, 32, 1, 1000); av_set_pts_info(st, 32, 1, 1000);
......
...@@ -45,13 +45,13 @@ static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -45,13 +45,13 @@ static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap)
int header_size; int header_size;
AVStream *st; AVStream *st;
url_fskip(pb, 20); avio_seek(pb, 20, SEEK_CUR);
header_size = avio_rl16(pb) - 22; header_size = avio_rl16(pb) - 22;
if (header_size != 4) { if (header_size != 4) {
av_log(s, AV_LOG_ERROR, "unknown header size: %d\n", header_size); av_log(s, AV_LOG_ERROR, "unknown header size: %d\n", header_size);
return AVERROR(ENOSYS); return AVERROR(ENOSYS);
} }
url_fskip(pb, header_size); avio_seek(pb, header_size, SEEK_CUR);
st = av_new_stream(s, 0); st = av_new_stream(s, 0);
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
...@@ -114,13 +114,13 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size) ...@@ -114,13 +114,13 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
dec->bits_per_coded_sample = avio_r8(pb); dec->bits_per_coded_sample = avio_r8(pb);
dec->channels = avio_r8(pb); dec->channels = avio_r8(pb);
tmp_codec = avio_rl16(pb); tmp_codec = avio_rl16(pb);
url_fskip(pb, 4); avio_seek(pb, 4, SEEK_CUR);
voc->remaining_size -= 12; voc->remaining_size -= 12;
max_size -= 12; max_size -= 12;
break; break;
default: default:
url_fskip(pb, voc->remaining_size); avio_seek(pb, voc->remaining_size, SEEK_CUR);
max_size -= voc->remaining_size; max_size -= voc->remaining_size;
voc->remaining_size = 0; voc->remaining_size = 0;
break; break;
......
...@@ -72,7 +72,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -72,7 +72,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
if (!st) if (!st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
url_fskip(s->pb, 12); avio_seek(s->pb, 12, SEEK_CUR);
header_size = avio_rb32(s->pb); header_size = avio_rb32(s->pb);
...@@ -101,7 +101,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -101,7 +101,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->channels = avio_rb32(s->pb) + 1; st->codec->channels = avio_rb32(s->pb) + 1;
read_bitrate = avio_rb32(s->pb); read_bitrate = avio_rb32(s->pb);
rate_flag = avio_rb32(s->pb); rate_flag = avio_rb32(s->pb);
url_fskip(s->pb, len-12); avio_seek(s->pb, len-12, SEEK_CUR);
st->codec->bit_rate = read_bitrate*1000; st->codec->bit_rate = read_bitrate*1000;
st->codec->bits_per_coded_sample = 16; st->codec->bits_per_coded_sample = 16;
...@@ -140,7 +140,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -140,7 +140,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_log(s, AV_LOG_ERROR, "Unknown chunk: %c%c%c%c\n", av_log(s, AV_LOG_ERROR, "Unknown chunk: %c%c%c%c\n",
((char*)&chunk_tag)[0], ((char*)&chunk_tag)[1], ((char*)&chunk_tag)[0], ((char*)&chunk_tag)[1],
((char*)&chunk_tag)[2], ((char*)&chunk_tag)[3]); ((char*)&chunk_tag)[2], ((char*)&chunk_tag)[3]);
url_fskip(s->pb, FFMIN(len, header_size)); avio_seek(s->pb, FFMIN(len, header_size), SEEK_CUR);
break; break;
} }
......
...@@ -217,7 +217,7 @@ static int wav_read_header(AVFormatContext *s, ...@@ -217,7 +217,7 @@ static int wav_read_header(AVFormatContext *s,
avio_rl64(pb); /* RIFF size */ avio_rl64(pb); /* RIFF size */
data_size = avio_rl64(pb); data_size = avio_rl64(pb);
sample_count = avio_rl64(pb); sample_count = avio_rl64(pb);
url_fskip(pb, size - 16); /* skip rest of ds64 chunk */ avio_seek(pb, size - 16, SEEK_CUR); /* skip rest of ds64 chunk */
} }
/* parse fmt header */ /* parse fmt header */
...@@ -276,7 +276,7 @@ static int64_t find_guid(AVIOContext *pb, const uint8_t guid1[16]) ...@@ -276,7 +276,7 @@ static int64_t find_guid(AVIOContext *pb, const uint8_t guid1[16])
return -1; return -1;
if (!memcmp(guid, guid1, 16)) if (!memcmp(guid, guid1, 16))
return size; return size;
url_fskip(pb, FFALIGN(size, INT64_C(8)) - 24); avio_seek(pb, FFALIGN(size, INT64_C(8)) - 24, SEEK_CUR);
} }
return -1; return -1;
} }
...@@ -410,7 +410,7 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -410,7 +410,7 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap)
/* subtract chunk header size - normal wav file doesn't count it */ /* subtract chunk header size - normal wav file doesn't count it */
ff_get_wav_header(pb, st->codec, size - 24); ff_get_wav_header(pb, st->codec, size - 24);
url_fskip(pb, FFALIGN(size, INT64_C(8)) - size); avio_seek(pb, FFALIGN(size, INT64_C(8)) - size, SEEK_CUR);
st->need_parsing = AVSTREAM_PARSE_FULL; st->need_parsing = AVSTREAM_PARSE_FULL;
......
This diff is collapsed.
...@@ -153,7 +153,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen ...@@ -153,7 +153,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
chmask = avio_rl32(pb); chmask = avio_rl32(pb);
break; break;
case 5: case 5:
url_fskip(pb, 1); avio_seek(pb, 1, SEEK_CUR);
chan |= (avio_r8(pb) & 0xF) << 8; chan |= (avio_r8(pb) & 0xF) << 8;
chmask = avio_rl24(pb); chmask = avio_rl24(pb);
break; break;
...@@ -166,10 +166,10 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen ...@@ -166,10 +166,10 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen
rate = avio_rl24(pb); rate = avio_rl24(pb);
break; break;
default: default:
url_fskip(pb, size); avio_seek(pb, size, SEEK_CUR);
} }
if(id&0x40) if(id&0x40)
url_fskip(pb, 1); avio_seek(pb, 1, SEEK_CUR);
} }
if(rate == -1){ if(rate == -1){
av_log(ctx, AV_LOG_ERROR, "Cannot determine custom sampling rate\n"); av_log(ctx, AV_LOG_ERROR, "Cannot determine custom sampling rate\n");
......
...@@ -76,9 +76,9 @@ static int xa_read_header(AVFormatContext *s, ...@@ -76,9 +76,9 @@ static int xa_read_header(AVFormatContext *s,
st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
st->codec->codec_id = CODEC_ID_ADPCM_EA_MAXIS_XA; st->codec->codec_id = CODEC_ID_ADPCM_EA_MAXIS_XA;
url_fskip(pb, 4); /* Skip the XA ID */ avio_seek(pb, 4, SEEK_CUR); /* Skip the XA ID */
xa->out_size = avio_rl32(pb); xa->out_size = avio_rl32(pb);
url_fskip(pb, 2); /* Skip the tag */ avio_seek(pb, 2, SEEK_CUR); /* Skip the tag */
st->codec->channels = avio_rl16(pb); st->codec->channels = avio_rl16(pb);
st->codec->sample_rate = avio_rl32(pb); st->codec->sample_rate = avio_rl32(pb);
/* Value in file is average byte rate*/ /* Value in file is average byte rate*/
......
...@@ -81,7 +81,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) ...@@ -81,7 +81,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap)
video_dec->codec_type = AVMEDIA_TYPE_VIDEO; video_dec->codec_type = AVMEDIA_TYPE_VIDEO;
video_dec->codec_id = CODEC_ID_YOP; video_dec->codec_id = CODEC_ID_YOP;
url_fskip(pb, 6); avio_seek(pb, 6, SEEK_CUR);
frame_rate = avio_r8(pb); frame_rate = avio_r8(pb);
yop->frame_size = avio_r8(pb) * 2048; yop->frame_size = avio_r8(pb) * 2048;
...@@ -153,7 +153,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -153,7 +153,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt)
// Set position to the start of the frame // Set position to the start of the frame
pkt->pos = yop->video_packet.pos; pkt->pos = yop->video_packet.pos;
url_fskip(pb, yop->audio_block_length - ret); avio_seek(pb, yop->audio_block_length - ret, SEEK_CUR);
ret = avio_read(pb, yop->video_packet.data + yop->palette_size, ret = avio_read(pb, yop->video_packet.data + yop->palette_size,
actual_video_data_size); actual_video_data_size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment