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

lavf: replace avio_seek(SEEK_CUR) with avio_skip where it makes sense

Signed-off-by: default avatarRonald S. Bultje <rsbultje@gmail.com>
parent cbf5d22d
......@@ -106,7 +106,7 @@ static int fourxm_read_header(AVFormatContext *s,
fourxm->fps = 1.0;
/* skip the first 3 32-bit numbers */
avio_seek(pb, 12, SEEK_CUR);
avio_skip(pb, 12);
/* check for LIST-HEAD */
GET_LIST_HEADER();
......@@ -322,12 +322,12 @@ static int fourxm_read_packet(AVFormatContext *s,
fourxm->tracks[track_number].audio_pts += audio_frame_count;
} else {
avio_seek(pb, size, SEEK_CUR);
avio_skip(pb, size);
}
break;
default:
avio_seek(pb, size, SEEK_CUR);
avio_skip(pb, size);
break;
}
}
......
......@@ -62,9 +62,9 @@ static int aea_read_header(AVFormatContext *s,
return AVERROR(ENOMEM);
/* Parse the amount of channels and skip to pos 2048(0x800) */
avio_seek(s->pb, 264, SEEK_CUR);
avio_skip(s->pb, 264);
st->codec->channels = avio_r8(s->pb);
avio_seek(s->pb, 1783, SEEK_CUR);
avio_skip(s->pb, 1783);
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
......
......@@ -70,7 +70,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size)
int res;
if (!str) {
avio_seek(s->pb, size, SEEK_CUR);
avio_skip(s->pb, size);
return;
}
......@@ -152,7 +152,7 @@ static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec,
/* Chunk is over */
if (size)
avio_seek(pb, size, SEEK_CUR);
avio_skip(pb, size);
return num_frames;
}
......@@ -242,7 +242,7 @@ static int aiff_read_header(AVFormatContext *s,
av_log(s, AV_LOG_ERROR, "file is not seekable\n");
return -1;
}
avio_seek(pb, size - 8, SEEK_CUR);
avio_skip(pb, size - 8);
break;
case MKTAG('w', 'a', 'v', 'e'):
if ((uint64_t)size > (1<<30))
......@@ -256,7 +256,7 @@ static int aiff_read_header(AVFormatContext *s,
default: /* Jump */
if (size & 1) /* Always even aligned */
size++;
avio_seek(pb, size, SEEK_CUR);
avio_skip(pb, size);
}
}
......
......@@ -83,7 +83,7 @@ static int read_header(AVFormatContext *s,
AVStream *st;
int i, ret;
avio_seek(pb, 4, SEEK_CUR); /* magic number */
avio_skip(pb, 4); /* magic number */
if (avio_rl16(pb) != MAX_PAGES) {
av_log_ask_for_sample(s, "max_pages != " AV_STRINGIFY(MAX_PAGES) "\n");
return AVERROR_INVALIDDATA;
......@@ -91,7 +91,7 @@ static int read_header(AVFormatContext *s,
anm->nb_pages = avio_rl16(pb);
anm->nb_records = avio_rl32(pb);
avio_seek(pb, 2, SEEK_CUR); /* max records per page */
avio_skip(pb, 2); /* max records per page */
anm->page_table_offset = avio_rl16(pb);
if (avio_rl32(pb) != ANIM_TAG)
return AVERROR_INVALIDDATA;
......@@ -107,13 +107,13 @@ static int read_header(AVFormatContext *s,
st->codec->height = avio_rl16(pb);
if (avio_r8(pb) != 0)
goto invalid;
avio_seek(pb, 1, SEEK_CUR); /* frame rate multiplier info */
avio_skip(pb, 1); /* frame rate multiplier info */
/* ignore last delta record (used for looping) */
if (avio_r8(pb)) /* has_last_delta */
anm->nb_records = FFMAX(anm->nb_records - 1, 0);
avio_seek(pb, 1, SEEK_CUR); /* last_delta_valid */
avio_skip(pb, 1); /* last_delta_valid */
if (avio_r8(pb) != 0)
goto invalid;
......@@ -121,15 +121,15 @@ static int read_header(AVFormatContext *s,
if (avio_r8(pb) != 1)
goto invalid;
avio_seek(pb, 1, SEEK_CUR); /* other recs per frame */
avio_skip(pb, 1); /* other recs per frame */
if (avio_r8(pb) != 1)
goto invalid;
avio_seek(pb, 32, SEEK_CUR); /* record_types */
avio_skip(pb, 32); /* record_types */
st->nb_frames = avio_rl32(pb);
av_set_pts_info(st, 64, 1, avio_rl16(pb));
avio_seek(pb, 58, SEEK_CUR);
avio_skip(pb, 58);
/* color cycling and palette data */
st->codec->extradata_size = 16*8 + 4*256;
......@@ -193,7 +193,7 @@ repeat:
/* parse page header */
if (anm->record < 0) {
avio_seek(pb, anm->page_table_offset + MAX_PAGES*6 + (anm->page<<16), SEEK_SET);
avio_seek(pb, 8 + 2*p->nb_records, SEEK_CUR);
avio_skip(pb, 8 + 2*p->nb_records);
anm->record = 0;
}
......
......@@ -187,7 +187,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
/* Skip any unknown bytes at the end of the descriptor.
This is for future compatibility */
if (ape->descriptorlength > 52)
avio_seek(pb, ape->descriptorlength - 52, SEEK_CUR);
avio_skip(pb, ape->descriptorlength - 52);
/* Read header data */
ape->compressiontype = avio_rl16(pb);
......@@ -212,7 +212,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
ape->finalframeblocks = avio_rl32(pb);
if (ape->formatflags & MAC_FORMAT_FLAG_HAS_PEAK_LEVEL) {
avio_seek(pb, 4, SEEK_CUR); /* Skip the peak level */
avio_skip(pb, 4); /* Skip the peak level */
ape->headerlength += 4;
}
......@@ -239,7 +239,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
/* Skip any stored wav header */
if (!(ape->formatflags & MAC_FORMAT_FLAG_CREATE_WAV_HEADER))
avio_seek(pb, ape->wavheaderlength, SEEK_CUR);
avio_skip(pb, ape->wavheaderlength);
}
if(!ape->totalframes){
......
......@@ -350,7 +350,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
avio_rl16(pb); /* panes */
st->codec->bits_per_coded_sample = avio_rl16(pb); /* depth */
tag1 = avio_rl32(pb);
avio_seek(pb, 20, SEEK_CUR);
avio_skip(pb, 20);
// av_log(s, AV_LOG_DEBUG, "size:%d tsize:%d sizeX:%d\n", size, total_size, sizeX);
if (sizeX > 40) {
st->codec->extradata_size = sizeX - 40;
......@@ -388,7 +388,7 @@ static int asf_read_stream_properties(AVFormatContext *s, int64_t size)
st->need_parsing = AVSTREAM_PARSE_FULL_ONCE;
}
pos2 = avio_tell(pb);
avio_seek(pb, size - (pos2 - pos1 + 24), SEEK_CUR);
avio_skip(pb, size - (pos2 - pos1 + 24));
return 0;
}
......@@ -428,14 +428,14 @@ static int asf_read_ext_stream_properties(AVFormatContext *s, int64_t size)
for (i=0; i<stream_ct; i++){
avio_rl16(pb);
ext_len = avio_rl16(pb);
avio_seek(pb, ext_len, SEEK_CUR);
avio_skip(pb, ext_len);
}
for (i=0; i<payload_ext_ct; i++){
ff_get_guid(pb, &g);
ext_d=avio_rl16(pb);
ext_len=avio_rl32(pb);
avio_seek(pb, ext_len, SEEK_CUR);
avio_skip(pb, ext_len);
}
return 0;
......@@ -455,7 +455,7 @@ static int asf_read_content_desc(AVFormatContext *s, int64_t size)
get_tag(s, "author" , 0, len2);
get_tag(s, "copyright", 0, len3);
get_tag(s, "comment" , 0, len4);
avio_seek(pb, len5, SEEK_CUR);
avio_skip(pb, len5);
return 0;
}
......@@ -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
name_len += 1;
if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len)
avio_seek(pb, name_len - ret, SEEK_CUR);
avio_skip(pb, name_len - ret);
value_type = avio_rl16(pb);
value_len = avio_rl16(pb);
if (!value_type && value_len%2)
......@@ -505,7 +505,7 @@ static int asf_read_language_list(AVFormatContext *s, int64_t size)
char lang[6];
unsigned int lang_len = avio_r8(pb);
if ((ret = avio_get_str16le(pb, lang_len, lang, sizeof(lang))) < lang_len)
avio_seek(pb, lang_len - ret, SEEK_CUR);
avio_skip(pb, lang_len - ret);
if (j < 128)
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)
value_len= avio_rl32(pb);
if ((ret = avio_get_str16le(pb, name_len, name, sizeof(name))) < name_len)
avio_seek(pb, name_len - ret, SEEK_CUR);
avio_skip(pb, name_len - ret);
//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
avio_seek(pb, value_len - 2, SEEK_CUR);
avio_skip(pb, value_len - 2);
if(stream_num<128){
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)
avio_rl32(pb); // flags
name_len = avio_rl32(pb); // name length
if ((ret = avio_get_str16le(pb, name_len * 2, name, sizeof(name))) < name_len)
avio_seek(pb, name_len - ret, SEEK_CUR);
avio_skip(pb, name_len - ret);
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){
// 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, "\n");
avio_seek(pb, 10, SEEK_CUR);
avio_skip(pb, 10);
ts0= avio_rl64(pb);
ts1= avio_rl64(pb);
avio_seek(pb, 12, SEEK_CUR);
avio_skip(pb, 12);
avio_rl32(pb);
avio_seek(pb, asf->packet_replic_size - 8 - 38 - 4, SEEK_CUR);
avio_skip(pb, asf->packet_replic_size - 8 - 38 - 4);
if(ts0!= -1) asf->packet_frag_timestamp= ts0/10000;
else asf->packet_frag_timestamp= AV_NOPTS_VALUE;
}else
avio_seek(pb, asf->packet_replic_size - 8, SEEK_CUR);
avio_skip(pb, asf->packet_replic_size - 8);
rsize += asf->packet_replic_size; // FIXME - check validity
} else if (asf->packet_replic_size==1){
// multipacket - frag_offset is beginning timestamp
......@@ -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, avio_tell(pb));
assert(ret>=0);
/* fail safe */
avio_seek(pb, ret, SEEK_CUR);
avio_skip(pb, ret);
asf->packet_pos= avio_tell(pb);
if (asf->data_object_size != (uint64_t)-1 &&
......@@ -914,7 +914,7 @@ static int ff_asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pk
) {
asf->packet_time_start = 0;
/* unhandled packet (should not happen) */
avio_seek(pb, asf->packet_frag_size, SEEK_CUR);
avio_skip(pb, asf->packet_frag_size);
asf->packet_size_left -= asf->packet_frag_size;
if(asf->stream_index < 0)
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
if (asf->packet_multi_size < asf->packet_obj_size)
{
asf->packet_time_start = 0;
avio_seek(pb, asf->packet_multi_size, SEEK_CUR);
avio_skip(pb, asf->packet_multi_size);
asf->packet_size_left -= asf->packet_multi_size;
continue;
}
......@@ -1199,7 +1199,7 @@ static void asf_build_simple_index(AVFormatContext *s, int stream_index)
avio_seek(s->pb, current_pos, SEEK_SET);
return;
}
avio_seek(s->pb, gsize-24, SEEK_CUR);
avio_skip(s->pb, gsize-24);
ff_get_guid(s->pb, &g);
}
......
......@@ -147,7 +147,7 @@ static int au_read_header(AVFormatContext *s,
if (size >= 24) {
/* skip unused data */
avio_seek(pb, size - 24, SEEK_CUR);
avio_skip(pb, size - 24);
}
/* now we are ready: build format streams */
......
......@@ -321,12 +321,12 @@ static void avi_read_nikon(AVFormatContext *s, uint64_t end)
}
if (name)
av_metadata_set2(&s->metadata, name, buffer, 0);
avio_seek(s->pb, size, SEEK_CUR);
avio_skip(s->pb, size);
}
break;
}
default:
avio_seek(s->pb, size, SEEK_CUR);
avio_skip(s->pb, size);
break;
}
}
......@@ -392,13 +392,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
unsigned char date[64] = {0};
size += (size & 1);
size -= avio_read(pb, date, FFMIN(size, sizeof(date)-1));
avio_seek(pb, size, SEEK_CUR);
avio_skip(pb, size);
avi_metadata_creation_time(&s->metadata, date);
break;
}
case MKTAG('d', 'm', 'l', 'h'):
avi->is_odml = 1;
avio_seek(pb, size + (size & 1), SEEK_CUR);
avio_skip(pb, size + (size & 1));
break;
case MKTAG('a', 'm', 'v', 'h'):
amv_file_format=1;
......@@ -410,13 +410,13 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
avio_rl32(pb);
avi->non_interleaved |= avio_rl32(pb) & AVIF_MUSTUSEINDEX;
avio_seek(pb, 2 * 4, SEEK_CUR);
avio_skip(pb, 2 * 4);
avio_rl32(pb);
avio_rl32(pb);
avih_width=avio_rl32(pb);
avih_height=avio_rl32(pb);
avio_seek(pb, size - 10 * 4, SEEK_CUR);
avio_skip(pb, size - 10 * 4);
break;
case MKTAG('s', 't', 'r', 'h'):
/* stream header */
......@@ -425,7 +425,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
handler = avio_rl32(pb); /* codec tag */
if(tag1 == MKTAG('p', 'a', 'd', 's')){
avio_seek(pb, size - 8, SEEK_CUR);
avio_skip(pb, size - 8);
break;
}else{
stream_index++;
......@@ -469,10 +469,10 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
goto fail;
}
s->streams[0]->priv_data = ast;
avio_seek(pb, 3 * 4, SEEK_CUR);
avio_skip(pb, 3 * 4);
ast->scale = avio_rl32(pb);
ast->rate = avio_rl32(pb);
avio_seek(pb, 4, SEEK_CUR); /* start time */
avio_skip(pb, 4); /* start time */
dv_dur = avio_rl32(pb);
if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) {
......@@ -485,7 +485,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
*/
stream_index = s->nb_streams - 1;
avio_seek(pb, size - 9*4, SEEK_CUR);
avio_skip(pb, size - 9*4);
break;
}
......@@ -542,12 +542,12 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
if(ast->sample_size == 0)
st->duration = st->nb_frames;
ast->frame_offset= ast->cum_len;
avio_seek(pb, size - 12 * 4, SEEK_CUR);
avio_skip(pb, size - 12 * 4);
break;
case MKTAG('s', 't', 'r', 'f'):
/* stream header */
if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) {
avio_seek(pb, size, SEEK_CUR);
avio_skip(pb, size);
} else {
uint64_t cur_pos = avio_tell(pb);
if (cur_pos < list_end)
......@@ -560,7 +560,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->height=avih_height;
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_AMV;
avio_seek(pb, size, SEEK_CUR);
avio_skip(pb, size);
break;
}
tag1 = ff_get_bmp_header(pb, st);
......@@ -620,7 +620,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
st->codec->height= FFABS(st->codec->height);
// avio_seek(pb, size - 5 * 4, SEEK_CUR);
// avio_skip(pb, size - 5 * 4);
break;
case AVMEDIA_TYPE_AUDIO:
ff_get_wav_header(pb, st->codec, size);
......@@ -630,7 +630,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
ast->sample_size= st->codec->block_align;
}
if (size&1) /* 2-aligned (fix for Stargate SG-1 - 3x18 - Shades of Grey.avi) */
avio_seek(pb, 1, SEEK_CUR);
avio_skip(pb, 1);
/* Force parsing as several audio frames can be in
* one packet and timestamps refer to packet start. */
st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS;
......@@ -658,7 +658,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
st->codec->codec_type = AVMEDIA_TYPE_DATA;
st->codec->codec_id= CODEC_ID_NONE;
st->codec->codec_tag= 0;
avio_seek(pb, size, SEEK_CUR);
avio_skip(pb, size);
break;
}
}
......@@ -693,7 +693,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
size -= 9*4;
}
avio_seek(pb, size, SEEK_CUR);
avio_skip(pb, size);
break;
case MKTAG('s', 't', 'r', 'n'):
if(s->nb_streams){
......@@ -710,7 +710,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
/* skip tag */
size += (size & 1);
avio_seek(pb, size, SEEK_CUR);
avio_skip(pb, size);
break;
}
}
......@@ -762,7 +762,7 @@ static int read_gab2_sub(AVStream *st, AVPacket *pkt) {
goto error;
ret = avio_get_str16le(pb, desc_len, desc, sizeof(desc));
avio_seek(pb, desc_len - ret, SEEK_CUR);
avio_skip(pb, desc_len - ret);
if (*desc)
av_metadata_set2(&st->metadata, "title", desc, 0);
......@@ -1008,14 +1008,14 @@ resync:
//parse JUNK
||(d[0] == 'J' && d[1] == 'U' && d[2] == 'N' && d[3] == 'K')
||(d[0] == 'i' && d[1] == 'd' && d[2] == 'x' && d[3] == '1')){
avio_seek(pb, size, SEEK_CUR);
avio_skip(pb, size);
//av_log(s, AV_LOG_DEBUG, "SKIP\n");
goto resync;
}
//parse stray LIST
if(d[0] == 'L' && d[1] == 'I' && d[2] == 'S' && d[3] == 'T'){
avio_seek(pb, 4, SEEK_CUR);
avio_skip(pb, 4);
goto resync;
}
......@@ -1026,7 +1026,7 @@ resync:
//detect ##ix chunk and skip
if(d[2] == 'i' && d[3] == 'x' && n < s->nb_streams){
avio_seek(pb, size, SEEK_CUR);
avio_skip(pb, size);
goto resync;
}
......@@ -1060,7 +1060,7 @@ resync:
/*|| (st->discard >= AVDISCARD_NONKEY && !(pkt->flags & AV_PKT_FLAG_KEY))*/ //FIXME needs a little reordering
|| st->discard >= AVDISCARD_ALL){
ast->frame_offset += get_duration(ast, size);
avio_seek(pb, size, SEEK_CUR);
avio_skip(pb, size);
goto resync;
}
......@@ -1225,7 +1225,7 @@ static int avi_load_index(AVFormatContext *s)
default:
skip:
size += (size & 1);
if (avio_seek(pb, size, SEEK_CUR) < 0)
if (avio_skip(pb, size) < 0)
goto the_end; // something is wrong here
break;
}
......
......@@ -444,9 +444,9 @@ static int avi_write_ix(AVFormatContext *s)
/* Updating one entry in the AVI OpenDML master index */
avio_seek(pb, avist->indexes.indx_start - 8, SEEK_SET);
ffio_wfourcc(pb, "indx"); /* enabling this entry */
avio_seek(pb, 8, SEEK_CUR);
avio_skip(pb, 8);
avio_wl32(pb, avi->riff_id); /* nEntriesInUse */
avio_seek(pb, 16*avi->riff_id, SEEK_CUR);
avio_skip(pb, 16*avi->riff_id);
avio_wl64(pb, ix); /* qwOffset */
avio_wl32(pb, pos - ix); /* dwSize */
avio_wl32(pb, avist->indexes.entry); /* dwDuration */
......@@ -603,7 +603,7 @@ static int avi_write_trailer(AVFormatContext *s)
file_size = avio_tell(pb);
avio_seek(pb, avi->odml_list - 8, SEEK_SET);
ffio_wfourcc(pb, "LIST"); /* Making this AVI OpenDML one */
avio_seek(pb, 16, SEEK_CUR);
avio_skip(pb, 16);
for (n=nb_frames=0;n<s->nb_streams;n++) {
AVCodecContext *stream = s->streams[n]->codec;
......
......@@ -61,7 +61,7 @@ static int avs_read_header(AVFormatContext * s, AVFormatParameters * ap)
s->ctx_flags |= AVFMTCTX_NOHEADER;
avio_seek(s->pb, 4, SEEK_CUR);
avio_skip(s->pb, 4);
avs->width = avio_rl16(s->pb);
avs->height = 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)
break;
default:
avio_seek(s->pb, size - 4, SEEK_CUR);
avio_skip(s->pb, size - 4);
}
}
}
......
......@@ -67,7 +67,7 @@ static int vid_read_header(AVFormatContext *s,
* bytes: 'V' 'I' 'D'
* int16s: always_512, nframes, width, height, delay, always_14
*/
avio_seek(pb, 5, SEEK_CUR);
avio_skip(pb, 5);
vid->nframes = avio_rl16(pb);
stream = av_new_stream(s, 0);
......
......@@ -65,19 +65,19 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
return AVERROR(ENOMEM);
/* Set the total number of frames. */
avio_seek(pb, 8, SEEK_CUR);
avio_skip(pb, 8);
chunk_header = avio_rl32(pb);
bfi->nframes = avio_rl32(pb);
avio_rl32(pb);
avio_rl32(pb);
avio_rl32(pb);
fps = avio_rl32(pb);
avio_seek(pb, 12, SEEK_CUR);
avio_skip(pb, 12);
vstream->codec->width = avio_rl32(pb);
vstream->codec->height = avio_rl32(pb);
/*Load the palette to extradata */
avio_seek(pb, 8, SEEK_CUR);
avio_skip(pb, 8);
vstream->codec->extradata = av_malloc(768);
vstream->codec->extradata_size = 768;
avio_read(pb, vstream->codec->extradata,
......
......@@ -98,7 +98,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
return AVERROR(EIO);
}
avio_seek(pb, 4, SEEK_CUR);
avio_skip(pb, 4);
vst->codec->width = avio_rl32(pb);
vst->codec->height = avio_rl32(pb);
......@@ -127,7 +127,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
}
if (bink->num_audio_tracks) {
avio_seek(pb, 4 * bink->num_audio_tracks, SEEK_CUR);
avio_skip(pb, 4 * bink->num_audio_tracks);
for (i = 0; i < bink->num_audio_tracks; i++) {
ast = av_new_stream(s, 1);
......@@ -169,7 +169,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
keyframe ? AVINDEX_KEYFRAME : 0);
}
avio_seek(pb, 4, SEEK_CUR);
avio_skip(pb, 4);
bink->current_track = -1;
return 0;
......@@ -225,7 +225,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
AV_RL32(pkt->data) / (2 * s->streams[bink->current_track]->codec->channels);
return 0;
} else {
avio_seek(pb, audio_size, SEEK_CUR);
avio_skip(pb, audio_size);
}
}
......
......@@ -122,7 +122,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR(ENOMEM);
c93->audio->codec->codec_type = AVMEDIA_TYPE_AUDIO;
}
avio_seek(pb, 26, SEEK_CUR); /* VOC header */
avio_skip(pb, 26); /* VOC header */
ret = voc_get_packet(s, pkt, c93->audio, datasize - 26);
if (ret > 0) {
pkt->stream_index = 1;
......
......@@ -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");
return AVERROR_INVALIDDATA;
}
avio_seek(pb, skip, SEEK_CUR);
avio_skip(pb, skip);
} else if (st->codec->codec_id == CODEC_ID_ALAC) {
#define ALAC_PREAMBLE 12
#define ALAC_HEADER 36
if (size < ALAC_PREAMBLE + ALAC_HEADER) {
av_log(s, AV_LOG_ERROR, "invalid ALAC magic cookie\n");
avio_seek(pb, size, SEEK_CUR);
avio_skip(pb, size);
return AVERROR_INVALIDDATA;
}
avio_seek(pb, ALAC_PREAMBLE, SEEK_CUR);
avio_skip(pb, ALAC_PREAMBLE);
st->codec->extradata = av_mallocz(ALAC_HEADER + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata)
return AVERROR(ENOMEM);
avio_read(pb, st->codec->extradata, ALAC_HEADER);
st->codec->extradata_size = ALAC_HEADER;
avio_seek(pb, size - ALAC_PREAMBLE - ALAC_HEADER, SEEK_CUR);
avio_skip(pb, size - ALAC_PREAMBLE - ALAC_HEADER);
} else {
st->codec->extradata = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata)
......@@ -201,7 +201,7 @@ static int read_header(AVFormatContext *s,
int found_data, ret;
int64_t size;
avio_seek(pb, 8, SEEK_CUR); /* magic, version, file flags */
avio_skip(pb, 8); /* magic, version, file flags */
/* audio description chunk */
if (avio_rb32(pb) != MKBETAG('d','e','s','c')) {
......@@ -233,11 +233,11 @@ static int read_header(AVFormatContext *s,
switch (tag) {
case MKBETAG('d','a','t','a'):
avio_seek(pb, 4, SEEK_CUR); /* edit count */
avio_skip(pb, 4); /* edit count */
caf->data_start = avio_tell(pb);
caf->data_size = size < 0 ? -1 : size - 4;
if (caf->data_size > 0 && !url_is_streamed(pb))
avio_seek(pb, caf->data_size, SEEK_CUR);
avio_skip(pb, caf->data_size);
found_data = 1;
break;
......@@ -265,7 +265,7 @@ static int read_header(AVFormatContext *s,
case MKBETAG('f','r','e','e'):
if (size < 0)
return AVERROR_INVALIDDATA;
avio_seek(pb, size, SEEK_CUR);
avio_skip(pb, size);
break;
}
}
......