diff options
author | Anton Khirnov | 2011-03-15 09:14:38 +0100 |
---|---|---|
committer | Ronald S. Bultje | 2011-03-16 22:24:51 -0400 |
commit | 45a8a02a4151c9ff0d1161bf90bffcfbbb312fb8 (patch) | |
tree | 79beacdc9d6d90d0e31558526d83033200f4361d /libavformat | |
parent | cbf5d22d24945e52b3c1e4c1a00d4d8179be930a (diff) |
lavf: replace avio_seek(SEEK_CUR) with avio_skip where it makes sense
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavformat')
76 files changed, 348 insertions, 348 deletions
diff --git a/libavformat/4xm.c b/libavformat/4xm.c index 95bd717915..ee4f54244e 100644 --- a/libavformat/4xm.c +++ b/libavformat/4xm.c @@ -106,7 +106,7 @@ static int fourxm_read_header(AVFormatContext *s, fourxm->fps = 1.0; /* skip the first 3 32-bit numbers */ - 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; } } diff --git a/libavformat/aea.c b/libavformat/aea.c index 60b2d38fdc..2a1d24d7a2 100644 --- a/libavformat/aea.c +++ b/libavformat/aea.c @@ -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; diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index 8506d8b5c8..2cec376e14 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -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); } } diff --git a/libavformat/anm.c b/libavformat/anm.c index 980920f52a..1f19b50d08 100644 --- a/libavformat/anm.c +++ b/libavformat/anm.c @@ -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; } diff --git a/libavformat/ape.c b/libavformat/ape.c index dd2aeb9ff3..d9c988753b 100644 --- a/libavformat/ape.c +++ b/libavformat/ape.c @@ -187,7 +187,7 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap) /* Skip any unknown bytes at the end of the descriptor. This is for future compatibility */ if (ape->descriptorlength > 52) - 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){ diff --git a/libavformat/asfdec.c b/libavformat/asfdec.c index cbcd576c9f..e27c29b193 100644 --- a/libavformat/asfdec.c +++ b/libavformat/asfdec.c @@ -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); } diff --git a/libavformat/au.c b/libavformat/au.c index 9ea4010039..3ee0e45fb6 100644 --- a/libavformat/au.c +++ b/libavformat/au.c @@ -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 */ diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 8181298959..83b476144e 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -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; } diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 8d9980cf46..3604a6c399 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -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; diff --git a/libavformat/avs.c b/libavformat/avs.c index 0ddb0af06d..355ae31f35 100644 --- a/libavformat/avs.c +++ b/libavformat/avs.c @@ -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); } } } diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c index 0b45115f0c..e371a2a80c 100644 --- a/libavformat/bethsoftvid.c +++ b/libavformat/bethsoftvid.c @@ -67,7 +67,7 @@ static int vid_read_header(AVFormatContext *s, * bytes: 'V' 'I' 'D' * int16s: always_512, nframes, width, height, delay, always_14 */ - avio_seek(pb, 5, SEEK_CUR); + avio_skip(pb, 5); vid->nframes = avio_rl16(pb); stream = av_new_stream(s, 0); diff --git a/libavformat/bfi.c b/libavformat/bfi.c index cec02fd646..5b72322320 100644 --- a/libavformat/bfi.c +++ b/libavformat/bfi.c @@ -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, diff --git a/libavformat/bink.c b/libavformat/bink.c index 22beb4cbbd..4622f89e5a 100644 --- a/libavformat/bink.c +++ b/libavformat/bink.c @@ -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); } } diff --git a/libavformat/c93.c b/libavformat/c93.c index a4a0fe3ad0..270a09bf6b 100644 --- a/libavformat/c93.c +++ b/libavformat/c93.c @@ -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; diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index ec3054ff2b..82db4efef4 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -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; } } diff --git a/libavformat/dxa.c b/libavformat/dxa.c index 2c599865bb..6b9a55221a 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -96,7 +96,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) c->has_sound = 1; size = avio_rb32(pb); c->vidpos = avio_tell(pb) + size; - avio_seek(pb, 16, SEEK_CUR); + avio_skip(pb, 16); fsize = avio_rl32(pb); ast = av_new_stream(s, 0); @@ -108,7 +108,7 @@ static int dxa_read_header(AVFormatContext *s, AVFormatParameters *ap) tag = avio_rl32(pb); fsize = avio_rl32(pb); if(tag == MKTAG('d', 'a', 't', 'a')) break; - avio_seek(pb, fsize, SEEK_CUR); + avio_skip(pb, fsize); } c->bpc = (fsize + c->frames - 1) / c->frames; if(ast->codec->block_align) diff --git a/libavformat/eacdata.c b/libavformat/eacdata.c index 8fc8c4221e..7b109ff888 100644 --- a/libavformat/eacdata.c +++ b/libavformat/eacdata.c @@ -62,7 +62,7 @@ static int cdata_read_header(AVFormatContext *s, AVFormatParameters *ap) }; sample_rate = avio_rb16(pb); - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); st = av_new_stream(s, 0); if (!st) diff --git a/libavformat/electronicarts.c b/libavformat/electronicarts.c index a43cfc8d66..d4d0d553ba 100644 --- a/libavformat/electronicarts.c +++ b/libavformat/electronicarts.c @@ -222,7 +222,7 @@ static int process_audio_header_eacs(AVFormatContext *s) ea->bytes = avio_r8(pb); /* 1=8-bit, 2=16-bit */ ea->num_channels = avio_r8(pb); compression_type = avio_r8(pb); - avio_seek(pb, 13, SEEK_CUR); + avio_skip(pb, 13); switch (compression_type) { case 0: @@ -261,7 +261,7 @@ static int process_video_header_mdec(AVFormatContext *s) { EaDemuxContext *ea = s->priv_data; AVIOContext *pb = s->pb; - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); ea->width = avio_rl16(pb); ea->height = avio_rl16(pb); ea->time_base = (AVRational){1,15}; @@ -274,7 +274,7 @@ static int process_video_header_vp6(AVFormatContext *s) EaDemuxContext *ea = s->priv_data; AVIOContext *pb = s->pb; - avio_seek(pb, 16, SEEK_CUR); + avio_skip(pb, 16); ea->time_base.den = avio_rl32(pb); ea->time_base.num = avio_rl32(pb); ea->video_codec = CODEC_ID_VP6; @@ -316,7 +316,7 @@ static int process_ea_header(AVFormatContext *s) { case SHEN_TAG : blockid = avio_rl32(pb); if (blockid == GSTR_TAG) { - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); } else if ((blockid & 0xFFFF)!=PT00_TAG) { av_log (s, AV_LOG_ERROR, "unknown SCHl headerid\n"); return 0; @@ -474,19 +474,19 @@ static int ea_read_packet(AVFormatContext *s, /* audio data */ case ISNh_TAG: /* header chunk also contains data; skip over the header portion*/ - avio_seek(pb, 32, SEEK_CUR); + avio_skip(pb, 32); chunk_size -= 32; case ISNd_TAG: case SCDl_TAG: case SNDC_TAG: case SDEN_TAG: if (!ea->audio_codec) { - avio_seek(pb, chunk_size, SEEK_CUR); + avio_skip(pb, chunk_size); break; } else if (ea->audio_codec == CODEC_ID_PCM_S16LE_PLANAR || ea->audio_codec == CODEC_ID_MP3) { num_samples = avio_rl32(pb); - avio_seek(pb, 8, SEEK_CUR); + avio_skip(pb, 8); chunk_size -= 12; } ret = av_get_packet(pb, pkt, chunk_size); @@ -541,7 +541,7 @@ static int ea_read_packet(AVFormatContext *s, goto get_video_packet; case mTCD_TAG: - avio_seek(pb, 8, SEEK_CUR); // skip ea dct header + avio_skip(pb, 8); // skip ea dct header chunk_size -= 8; goto get_video_packet; @@ -560,7 +560,7 @@ get_video_packet: break; default: - avio_seek(pb, chunk_size, SEEK_CUR); + avio_skip(pb, chunk_size); break; } } diff --git a/libavformat/ffmdec.c b/libavformat/ffmdec.c index 1b5be16ff7..591a83525f 100644 --- a/libavformat/ffmdec.c +++ b/libavformat/ffmdec.c @@ -187,7 +187,7 @@ static int64_t get_dts(AVFormatContext *s, int64_t pos) int64_t dts; ffm_seek1(s, pos); - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); dts = avio_rb64(pb); #ifdef DEBUG_SEEK av_log(s, AV_LOG_DEBUG, "dts=%0.6f\n", dts / 1000000.0); diff --git a/libavformat/filmstripdec.c b/libavformat/filmstripdec.c index 568bc0d17a..107f9e3622 100644 --- a/libavformat/filmstripdec.c +++ b/libavformat/filmstripdec.c @@ -59,7 +59,7 @@ static int read_header(AVFormatContext *s, return AVERROR_INVALIDDATA; } - avio_seek(pb, 2, SEEK_CUR); + avio_skip(pb, 2); st->codec->codec_type = AVMEDIA_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_RAWVIDEO; st->codec->pix_fmt = PIX_FMT_RGBA; @@ -84,7 +84,7 @@ static int read_packet(AVFormatContext *s, return AVERROR(EIO); pkt->dts = avio_tell(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); - avio_seek(s->pb, st->codec->width * film->leading * 4, SEEK_CUR); + avio_skip(s->pb, st->codec->width * film->leading * 4); if (pkt->size < 0) return pkt->size; pkt->flags |= AV_PKT_FLAG_KEY; diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c index e935c3f168..8ab4d9a80c 100644 --- a/libavformat/flacdec.c +++ b/libavformat/flacdec.c @@ -65,7 +65,7 @@ static int flac_read_header(AVFormatContext *s, break; /* skip metadata block for unsupported types */ default: - ret = avio_seek(s->pb, metadata_size, SEEK_CUR); + ret = avio_skip(s->pb, metadata_size); if (ret < 0) return ret; } diff --git a/libavformat/flic.c b/libavformat/flic.c index 520ba6423e..d6aadb7730 100644 --- a/libavformat/flic.c +++ b/libavformat/flic.c @@ -239,7 +239,7 @@ static int flic_read_packet(AVFormatContext *s, } /* skip useless 10B sub-header (yes, it's not accounted for in the chunk header) */ - avio_seek(pb, 10, SEEK_CUR); + avio_skip(pb, 10); pkt->stream_index = flic->audio_stream_index; pkt->pos = avio_tell(pb); @@ -253,7 +253,7 @@ static int flic_read_packet(AVFormatContext *s, packet_read = 1; } else { /* not interested in this chunk */ - avio_seek(pb, size - 6, SEEK_CUR); + avio_skip(pb, size - 6); } } diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index bb27131cfd..65d77fcc7d 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -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) { int length = avio_rb16(ioc); if(length >= buffsize) { - avio_seek(ioc, length, SEEK_CUR); + avio_skip(ioc, length); return -1; } @@ -149,7 +149,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst unsigned int keylen; while(avio_tell(ioc) < max_pos - 2 && (keylen = avio_rb16(ioc))) { - avio_seek(ioc, keylen, SEEK_CUR); //skip key string + avio_skip(ioc, keylen); //skip key string if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0) return -1; //if we couldn't skip, bomb out. } @@ -162,7 +162,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst case AMF_DATA_TYPE_UNSUPPORTED: break; //these take up no additional space case AMF_DATA_TYPE_MIXEDARRAY: - avio_seek(ioc, 4, SEEK_CUR); //skip 32-bit max array index + avio_skip(ioc, 4); //skip 32-bit max array index while(avio_tell(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 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 } break; case AMF_DATA_TYPE_DATE: - avio_seek(ioc, 8 + 2, SEEK_CUR); //timestamp (double) and UTC offset (int16) + avio_skip(ioc, 8 + 2); //timestamp (double) and UTC offset (int16) break; default: //unsupported type, we couldn't skip return -1; @@ -254,7 +254,7 @@ static int flv_read_header(AVFormatContext *s, { int offset, flags; - avio_seek(s->pb, 4, SEEK_CUR); + avio_skip(s->pb, 4); flags = avio_r8(s->pb); /* old flvtool cleared this field */ /* FIXME: better fix needed */ @@ -278,7 +278,7 @@ static int flv_read_header(AVFormatContext *s, offset = avio_rb32(s->pb); avio_seek(s->pb, offset, SEEK_SET); - avio_seek(s->pb, 4, SEEK_CUR); + avio_skip(s->pb, 4); s->start_time = 0; @@ -304,7 +304,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) int64_t dts, pts = AV_NOPTS_VALUE; AVStream *st = NULL; - for(;;avio_seek(s->pb, 4, SEEK_CUR)){ /* pkt size is repeated at end. skip it */ + for(;;avio_skip(s->pb, 4)){ /* pkt size is repeated at end. skip it */ pos = avio_tell(s->pb); type = avio_r8(s->pb); size = avio_rb24(s->pb); @@ -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); if (s->pb->eof_reached) return AVERROR_EOF; - avio_seek(s->pb, 3, SEEK_CUR); /* stream id, always 0 */ + avio_skip(s->pb, 3); /* stream id, always 0 */ flags = 0; if(size == 0) @@ -454,7 +454,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) pkt->flags |= AV_PKT_FLAG_KEY; leave: - avio_seek(s->pb, 4, SEEK_CUR); + avio_skip(s->pb, 4); return ret; } diff --git a/libavformat/flvenc.c b/libavformat/flvenc.c index 68da7f6907..a1ed705d7b 100644 --- a/libavformat/flvenc.c +++ b/libavformat/flvenc.c @@ -291,7 +291,7 @@ static int flv_write_header(AVFormatContext *s) data_size= avio_tell(pb) - metadata_size_pos - 10; avio_seek(pb, metadata_size_pos, SEEK_SET); avio_wb24(pb, data_size); - avio_seek(pb, data_size + 10 - 3, SEEK_CUR); + avio_skip(pb, data_size + 10 - 3); avio_wb32(pb, data_size + 11); for (i = 0; i < s->nb_streams; i++) { @@ -318,7 +318,7 @@ static int flv_write_header(AVFormatContext *s) data_size = avio_tell(pb) - pos; avio_seek(pb, -data_size - 10, SEEK_CUR); avio_wb24(pb, data_size); - avio_seek(pb, data_size + 10 - 3, SEEK_CUR); + avio_skip(pb, data_size + 10 - 3); avio_wb32(pb, data_size + 11); // previous tag size } } diff --git a/libavformat/gxf.c b/libavformat/gxf.c index 9e47249152..e959bf9dc4 100644 --- a/libavformat/gxf.c +++ b/libavformat/gxf.c @@ -174,7 +174,7 @@ static void gxf_material_tags(AVIOContext *pb, int *len, struct gxf_stream_info else if (tag == MAT_LAST_FIELD) si->last_field = value; } else - avio_seek(pb, tlen, SEEK_CUR); + avio_skip(pb, tlen); } } @@ -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)) si->fields_per_frame = value; } else - avio_seek(pb, tlen, SEEK_CUR); + avio_skip(pb, tlen); } } @@ -238,7 +238,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) { int i; pkt_len -= 8; if (s->flags & AVFMT_FLAG_IGNIDX) { - avio_seek(pb, pkt_len, SEEK_CUR); + avio_skip(pb, pkt_len); return; } if (map_cnt > 1000) { @@ -247,7 +247,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) { } if (pkt_len < 4 * map_cnt) { av_log(s, AV_LOG_ERROR, "invalid index length\n"); - avio_seek(pb, pkt_len, SEEK_CUR); + avio_skip(pb, pkt_len); return; } pkt_len -= 4 * map_cnt; @@ -255,7 +255,7 @@ static void gxf_read_index(AVFormatContext *s, int pkt_len) { for (i = 0; i < map_cnt; i++) av_add_index_entry(st, (uint64_t)avio_rl32(pb) * 1024, i * (uint64_t)fields_per_map + 1, 0, 0, 0); - avio_seek(pb, pkt_len, SEEK_CUR); + avio_skip(pb, pkt_len); } static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { @@ -283,7 +283,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { } map_len -= len; gxf_material_tags(pb, &len, &si); - avio_seek(pb, len, SEEK_CUR); + avio_skip(pb, len); map_len -= 2; len = avio_rb16(pb); // length of track description if (len > map_len) { @@ -301,7 +301,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { track_len = avio_rb16(pb); len -= track_len; gxf_track_tags(pb, &track_len, &si); - avio_seek(pb, track_len, SEEK_CUR); + avio_skip(pb, track_len); if (!(track_type & 0x80)) { av_log(s, AV_LOG_ERROR, "invalid track type %x\n", track_type); continue; @@ -326,7 +326,7 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { if (len < 0) av_log(s, AV_LOG_ERROR, "invalid track description length specified\n"); if (map_len) - avio_seek(pb, map_len, SEEK_CUR); + avio_skip(pb, map_len); if (!parse_packet_header(pb, &pkt_type, &len)) { av_log(s, AV_LOG_ERROR, "sync lost in header\n"); return -1; @@ -342,8 +342,8 @@ static int gxf_header(AVFormatContext *s, AVFormatParameters *ap) { if (len >= 0x39) { AVRational fps; len -= 0x39; - avio_seek(pb, 5, SEEK_CUR); // preamble - avio_seek(pb, 0x30, SEEK_CUR); // payload description + avio_skip(pb, 5); // preamble + avio_skip(pb, 0x30); // payload description fps = fps_umf2avr(avio_rl32(pb)); if (!main_timebase.num || !main_timebase.den) { // 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) { av_log(s, AV_LOG_INFO, "UMF packet too short\n"); } else av_log(s, AV_LOG_INFO, "UMF packet missing\n"); - avio_seek(pb, len, SEEK_CUR); + avio_skip(pb, len); // 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. if (!main_timebase.num || !main_timebase.den) @@ -437,7 +437,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { continue; } if (pkt_type != PKT_MEDIA) { - avio_seek(pb, pkt_len, SEEK_CUR); + avio_skip(pb, pkt_len); continue; } if (pkt_len < 16) { @@ -462,7 +462,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { int last = field_info & 0xffff; // last is exclusive int bps = av_get_bits_per_sample(st->codec->codec_id)>>3; if (first <= last && last*bps <= pkt_len) { - avio_seek(pb, first*bps, SEEK_CUR); + avio_skip(pb, first*bps); skip = pkt_len - last*bps; pkt_len = (last-first)*bps; } else @@ -470,7 +470,7 @@ static int gxf_packet(AVFormatContext *s, AVPacket *pkt) { } ret = av_get_packet(pb, pkt, pkt_len); if (skip) - avio_seek(pb, skip, SEEK_CUR); + avio_skip(pb, skip); pkt->stream_index = stream_index; pkt->dts = field_nr; return ret; diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index be88d10caa..b288ec6eec 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -217,7 +217,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t unsync = flags & 0x80; if (isv34 && flags & 0x40) /* Extended header present, just skip over it */ - avio_seek(s->pb, get_size(s->pb, 4), SEEK_CUR); + avio_skip(s->pb, get_size(s->pb, 4)); while (len >= taghdrlen) { unsigned int tflags; @@ -251,7 +251,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t if (tflags & (ID3v2_FLAG_ENCRYPTION | ID3v2_FLAG_COMPRESSION)) { av_log(s, AV_LOG_WARNING, "Skipping encrypted/compressed ID3v2 frame %s.\n", tag); - avio_seek(s->pb, tlen, SEEK_CUR); + avio_skip(s->pb, tlen); } else if (tag[0] == 'T') { if (unsync || tunsync) { int i, j; @@ -272,7 +272,7 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t else if (!tag[0]) { if (tag[1]) av_log(s, AV_LOG_WARNING, "invalid frame id, assuming padding"); - avio_seek(s->pb, tlen, SEEK_CUR); + avio_skip(s->pb, tlen); break; } /* Skip to end of tag */ @@ -281,10 +281,10 @@ static void ff_id3v2_parse(AVFormatContext *s, int len, uint8_t version, uint8_t if (len > 0) { /* Skip padding */ - avio_seek(s->pb, len, SEEK_CUR); + avio_skip(s->pb, len); } if (version == 4 && flags & 0x10) /* Footer preset, always 10 bytes, skip over it */ - avio_seek(s->pb, 10, SEEK_CUR); + avio_skip(s->pb, 10); av_free(buffer); return; diff --git a/libavformat/idcin.c b/libavformat/idcin.c index 78e6caf1ca..5c1d48df4c 100644 --- a/libavformat/idcin.c +++ b/libavformat/idcin.c @@ -257,7 +257,7 @@ static int idcin_read_packet(AVFormatContext *s, chunk_size = avio_rl32(pb); /* skip the number of decoded bytes (always equal to width * height) */ - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); chunk_size -= 4; ret= av_get_packet(pb, pkt, chunk_size); if (ret < 0) diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c index 1feb236188..92c48d42fe 100644 --- a/libavformat/idroqdec.c +++ b/libavformat/idroqdec.c @@ -136,14 +136,14 @@ static int roq_read_packet(AVFormatContext *s, break; } /* don't care about this chunk anymore */ - avio_seek(pb, RoQ_CHUNK_PREAMBLE_SIZE, SEEK_CUR); + avio_skip(pb, RoQ_CHUNK_PREAMBLE_SIZE); break; case RoQ_QUAD_CODEBOOK: /* packet needs to contain both this codebook and next VQ chunk */ codebook_offset = avio_tell(pb) - RoQ_CHUNK_PREAMBLE_SIZE; codebook_size = chunk_size; - avio_seek(pb, codebook_size, SEEK_CUR); + avio_skip(pb, codebook_size); if (avio_read(pb, preamble, RoQ_CHUNK_PREAMBLE_SIZE) != RoQ_CHUNK_PREAMBLE_SIZE) return AVERROR(EIO); diff --git a/libavformat/iff.c b/libavformat/iff.c index 3e329343a4..900d823d2b 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -134,7 +134,7 @@ static int iff_read_header(AVFormatContext *s, return AVERROR(ENOMEM); st->codec->channels = 1; - avio_seek(pb, 8, SEEK_CUR); + avio_skip(pb, 8); // codec_tag used by ByteRun1 decoder to distinguish progressive (PBM) and interlaced (ILBM) content st->codec->codec_tag = avio_rl32(pb); @@ -152,10 +152,10 @@ static int iff_read_header(AVFormatContext *s, if (data_size < 14) return AVERROR_INVALIDDATA; - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); st->codec->sample_rate = avio_rb16(pb); if (data_size >= 16) { - avio_seek(pb, 1, SEEK_CUR); + avio_skip(pb, 1); compression = avio_r8(pb); } break; @@ -186,14 +186,14 @@ static int iff_read_header(AVFormatContext *s, return AVERROR_INVALIDDATA; st->codec->width = avio_rb16(pb); st->codec->height = avio_rb16(pb); - avio_seek(pb, 4, SEEK_CUR); // x, y offset + avio_skip(pb, 4); // x, y offset st->codec->bits_per_coded_sample = avio_r8(pb); if (data_size >= 11) { - avio_seek(pb, 1, SEEK_CUR); // masking + avio_skip(pb, 1); // masking compression = avio_r8(pb); } if (data_size >= 16) { - avio_seek(pb, 3, SEEK_CUR); // paddding, transparent + avio_skip(pb, 3); // paddding, transparent st->sample_aspect_ratio.num = avio_r8(pb); st->sample_aspect_ratio.den = avio_r8(pb); } @@ -223,7 +223,7 @@ static int iff_read_header(AVFormatContext *s, return res; } } - avio_seek(pb, data_size - (avio_tell(pb) - orig_pos) + (data_size & 1), SEEK_CUR); + avio_skip(pb, data_size - (avio_tell(pb) - orig_pos) + (data_size & 1)); } avio_seek(pb, iff->body_pos, SEEK_SET); diff --git a/libavformat/ingenientdec.c b/libavformat/ingenientdec.c index eb24da9cac..eb1e6f6521 100644 --- a/libavformat/ingenientdec.c +++ b/libavformat/ingenientdec.c @@ -35,11 +35,11 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) w = avio_rl16(s->pb); h = avio_rl16(s->pb); - avio_seek(s->pb, 8, SEEK_CUR); // zero + size (padded?) - avio_seek(s->pb, 2, SEEK_CUR); + avio_skip(s->pb, 8); // zero + size (padded?) + avio_skip(s->pb, 2); unk1 = avio_rl16(s->pb); unk2 = avio_rl16(s->pb); - avio_seek(s->pb, 22, SEEK_CUR); // ASCII timestamp + avio_skip(s->pb, 22); // ASCII timestamp av_log(s, AV_LOG_DEBUG, "Ingenient packet: size=%d, width=%d, height=%d, unk1=%d unk2=%d\n", size, w, h, unk1, unk2); diff --git a/libavformat/ipmovie.c b/libavformat/ipmovie.c index 508a82b6be..97f225618d 100644 --- a/libavformat/ipmovie.c +++ b/libavformat/ipmovie.c @@ -299,12 +299,12 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, case OPCODE_END_OF_STREAM: debug_ipmovie("end of stream\n"); - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_END_OF_CHUNK: debug_ipmovie("end of chunk\n"); - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_CREATE_TIMER: @@ -359,7 +359,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, case OPCODE_START_STOP_AUDIO: debug_ipmovie("start/stop audio\n"); - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_INIT_VIDEO_BUFFERS: @@ -393,12 +393,12 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, case OPCODE_UNKNOWN_14: case OPCODE_UNKNOWN_15: debug_ipmovie("unknown (but documented) opcode %02X\n", opcode_type); - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_SEND_BUFFER: debug_ipmovie("send buffer\n"); - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_AUDIO_FRAME: @@ -407,22 +407,22 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, /* log position and move on for now */ s->audio_chunk_offset = avio_tell(pb); s->audio_chunk_size = opcode_size; - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_SILENCE_FRAME: debug_ipmovie("silence frame\n"); - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_INIT_VIDEO_MODE: debug_ipmovie("initialize video mode\n"); - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_CREATE_GRADIENT: debug_ipmovie("create gradient\n"); - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_SET_PALETTE: @@ -464,7 +464,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, case OPCODE_SET_PALETTE_COMPRESSED: debug_ipmovie("set palette compressed\n"); - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_SET_DECODING_MAP: @@ -473,7 +473,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, /* log position and move on for now */ s->decode_map_chunk_offset = avio_tell(pb); s->decode_map_chunk_size = opcode_size; - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; case OPCODE_VIDEO_DATA: @@ -482,7 +482,7 @@ static int process_ipmovie_chunk(IPMVEContext *s, AVIOContext *pb, /* log position and move on for now */ s->video_chunk_offset = avio_tell(pb); s->video_chunk_size = opcode_size; - avio_seek(pb, opcode_size, SEEK_CUR); + avio_skip(pb, opcode_size); break; default: diff --git a/libavformat/iv8.c b/libavformat/iv8.c index 4671a18eac..df5eb116c1 100644 --- a/libavformat/iv8.c +++ b/libavformat/iv8.c @@ -70,7 +70,7 @@ retry: return -1; if(type==258){ - avio_seek(s->pb, size, SEEK_CUR); + avio_skip(s->pb, size); goto retry; } diff --git a/libavformat/lmlm4.c b/libavformat/lmlm4.c index 97ece0153c..d68e6608ea 100644 --- a/libavformat/lmlm4.c +++ b/libavformat/lmlm4.c @@ -100,7 +100,7 @@ static int lmlm4_read_packet(AVFormatContext *s, AVPacket *pkt) { if ((ret = av_get_packet(pb, pkt, frame_size)) <= 0) return AVERROR(EIO); - avio_seek(pb, padding, SEEK_CUR); + avio_skip(pb, padding); switch (frame_type) { case LMLM4_I_FRAME: diff --git a/libavformat/lxfdec.c b/libavformat/lxfdec.c index 0d5d8e8f91..c4aea3d44f 100644 --- a/libavformat/lxfdec.c +++ b/libavformat/lxfdec.c @@ -137,8 +137,8 @@ static int get_packet_header(AVFormatContext *s, uint8_t *header, uint32_t *form case 0: //video //skip VBI data and metadata - avio_seek(pb, (int64_t)(uint32_t)AV_RL32(&header[44]) + - (int64_t)(uint32_t)AV_RL32(&header[52]), SEEK_CUR); + avio_skip(pb, (int64_t)(uint32_t)AV_RL32(&header[44]) + + (int64_t)(uint32_t)AV_RL32(&header[52])); break; case 1: //audio @@ -255,7 +255,7 @@ static int lxf_read_header(AVFormatContext *s, AVFormatParameters *ap) if (format == 1) { //skip extended field data - avio_seek(s->pb, (uint32_t)AV_RL32(&header[40]), SEEK_CUR); + avio_skip(s->pb, (uint32_t)AV_RL32(&header[40])); } return 0; diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index a356611930..dff97b2cc8 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -831,7 +831,7 @@ static int ebml_parse_elem(MatroskaDemuxContext *matroska, return ebml_parse_nest(matroska, syntax->def.n, data); case EBML_PASS: return ebml_parse_id(matroska, syntax->def.n, id, data); case EBML_STOP: return 1; - default: return avio_seek(pb,length,SEEK_CUR)<0 ? AVERROR(EIO) : 0; + default: return avio_skip(pb,length)<0 ? AVERROR(EIO) : 0; } if (res == AVERROR_INVALIDDATA) av_log(matroska->ctx, AV_LOG_ERROR, "Invalid element\n"); @@ -1393,10 +1393,10 @@ static int matroska_read_header(AVFormatContext *s, AVFormatParameters *ap) int flavor; ffio_init_context(&b, track->codec_priv.data,track->codec_priv.size, 0, NULL, NULL, NULL, NULL); - avio_seek(&b, 22, SEEK_CUR); + avio_skip(&b, 22); flavor = avio_rb16(&b); track->audio.coded_framesize = avio_rb32(&b); - avio_seek(&b, 12, SEEK_CUR); + avio_skip(&b, 12); track->audio.sub_packet_h = avio_rb16(&b); track->audio.frame_size = avio_rb16(&b); track->audio.sub_packet_size = avio_rb16(&b); diff --git a/libavformat/mm.c b/libavformat/mm.c index 699daac5e9..c6264f1cb7 100644 --- a/libavformat/mm.c +++ b/libavformat/mm.c @@ -102,7 +102,7 @@ static int read_header(AVFormatContext *s, avio_rl16(pb); /* ibm-pc video bios mode */ width = avio_rl16(pb); height = avio_rl16(pb); - avio_seek(pb, length - 10, SEEK_CUR); /* unknown data */ + avio_skip(pb, length - 10); /* unknown data */ /* video stream */ st = av_new_stream(s, 0); @@ -181,7 +181,7 @@ static int read_packet(AVFormatContext *s, default : av_log(s, AV_LOG_INFO, "unknown chunk type 0x%x\n", type); - avio_seek(pb, length, SEEK_CUR); + avio_skip(pb, length); } } diff --git a/libavformat/mmf.c b/libavformat/mmf.c index be3f649b41..a3e8b99cb4 100644 --- a/libavformat/mmf.c +++ b/libavformat/mmf.c @@ -195,7 +195,7 @@ static int mmf_read_header(AVFormatContext *s, file_size = avio_rb32(pb); /* Skip some unused chunks that may or may not be present */ - for(;; avio_seek(pb, size, SEEK_CUR)) { + for(;; avio_skip(pb, size)) { tag = avio_rl32(pb); size = avio_rb32(pb); if(tag == MKTAG('C','N','T','I')) continue; @@ -226,7 +226,7 @@ static int mmf_read_header(AVFormatContext *s, avio_r8(pb); /* time base g */ /* Skip some unused chunks that may or may not be present */ - for(;; avio_seek(pb, size, SEEK_CUR)) { + for(;; avio_skip(pb, size)) { tag = avio_rl32(pb); size = avio_rb32(pb); if(tag == MKTAG('A','t','s','q')) continue; diff --git a/libavformat/mov.c b/libavformat/mov.c index db798154a0..746939d781 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -296,7 +296,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) parse = mov_read_udta_string; if (!parse) { /* skip leaf atoms data */ - avio_seek(pb, a.size, SEEK_CUR); + avio_skip(pb, a.size); } else { int64_t start_pos = avio_tell(pb); int64_t left; @@ -308,14 +308,14 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; left = a.size - avio_tell(pb) + start_pos; if (left > 0) /* skip garbage at atom end */ - avio_seek(pb, left, SEEK_CUR); + avio_skip(pb, left); } total_size += a.size; } if (total_size < atom.size && atom.size < 0x7ffff) - avio_seek(pb, atom.size - total_size, SEEK_CUR); + avio_skip(pb, atom.size - total_size); return 0; } @@ -357,7 +357,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) uint16_t volume_len, len; int16_t type; - avio_seek(pb, 10, SEEK_CUR); + avio_skip(pb, 10); volume_len = avio_r8(pb); volume_len = FFMIN(volume_len, 27); @@ -365,7 +365,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) dref->volume[volume_len] = 0; av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", dref->volume, volume_len); - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); len = avio_r8(pb); len = FFMIN(len, 63); @@ -373,7 +373,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) dref->filename[len] = 0; av_log(c->fc, AV_LOG_DEBUG, "filename %s, len %d\n", dref->filename, len); - avio_seek(pb, 16, SEEK_CUR); + avio_skip(pb, 16); /* read next level up_from_alias/down_to_target */ dref->nlvl_from = avio_rb16(pb); @@ -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", dref->nlvl_from, dref->nlvl_to); - avio_seek(pb, 16, SEEK_CUR); + avio_skip(pb, 16); for (type = 0; type != -1 && avio_tell(pb) < next; ) { type = avio_rb16(pb); @@ -416,7 +416,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) dref->dir[j] = '/'; av_log(c->fc, AV_LOG_DEBUG, "dir %s\n", dref->dir); } else - avio_seek(pb, len, SEEK_CUR); + avio_skip(pb, len); } } avio_seek(pb, next, SEEK_SET); @@ -663,9 +663,9 @@ static int mov_read_mvhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) avio_rb16(pb); /* preferred volume */ - avio_seek(pb, 10, SEEK_CUR); /* reserved */ + avio_skip(pb, 10); /* reserved */ - avio_seek(pb, 36, SEEK_CUR); /* display matrix */ + avio_skip(pb, 36); /* display matrix */ avio_rb32(pb); /* preview time */ avio_rb32(pb); /* preview duration */ @@ -782,7 +782,7 @@ static int mov_read_wave(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (mov_read_default(c, pb, atom) < 0) return -1; } else - avio_seek(pb, atom.size, SEEK_CUR); + avio_skip(pb, atom.size); return 0; } @@ -833,7 +833,7 @@ static int mov_read_strf(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = atom.size - 40; - avio_seek(pb, 40, SEEK_CUR); + avio_skip(pb, 40); avio_read(pb, st->codec->extradata, atom.size - 40); return 0; } @@ -945,7 +945,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) * in the MOV demuxer, patch welcome. */ multiple_stsd: av_log(c->fc, AV_LOG_WARNING, "multiple fourcc not supported\n"); - avio_seek(pb, size - (avio_tell(pb) - start_pos), SEEK_CUR); + avio_skip(pb, size - (avio_tell(pb) - start_pos)); continue; } /* 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) len = 31; mov_read_mac_string(c, pb, len, st->codec->codec_name, 32); if (len < 31) - avio_seek(pb, 31 - len, SEEK_CUR); + avio_skip(pb, 31 - len); /* 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)) 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) st->codec->height = sc->height; } else { /* other codec type, just skip (rtp, mp4s, tmcd ...) */ - avio_seek(pb, size - (avio_tell(pb) - start_pos), SEEK_CUR); + avio_skip(pb, size - (avio_tell(pb) - start_pos)); } /* this will read extra atoms at the end (wave, alac, damr, avcC, SMI ...) */ a.size = size - (avio_tell(pb) - start_pos); @@ -1182,7 +1182,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) if (mov_read_default(c, pb, a) < 0) return -1; } else if (a.size > 0) - avio_seek(pb, a.size, SEEK_CUR); + avio_skip(pb, a.size); } 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) if (atom.size < 8) return 0; /* continue */ if (avio_rb32(pb) != 0) { /* 0 sized mdat atom... use the 'wide' atom size */ - avio_seek(pb, atom.size - 4, SEEK_CUR); + avio_skip(pb, atom.size - 4); return 0; } atom.type = avio_rl32(pb); atom.size -= 8; if (atom.type != MKTAG('m','d','a','t')) { - avio_seek(pb, atom.size, SEEK_CUR); + avio_skip(pb, atom.size); return 0; } err = mov_read_mdat(c, pb, atom); diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c index 98dde547c8..b7386fb78f 100644 --- a/libavformat/mp3dec.c +++ b/libavformat/mp3dec.c @@ -107,7 +107,7 @@ static int mp3_parse_vbr_tags(AVFormatContext *s, AVStream *st, int64_t base) /* Check tag version */ if(avio_rb16(s->pb) == 1) { /* skip delay and quality */ - avio_seek(s->pb, 4, SEEK_CUR); + avio_skip(s->pb, 4); frames = avio_rb32(s->pb); size = avio_rb32(s->pb); } diff --git a/libavformat/mpc8.c b/libavformat/mpc8.c index a1615a835b..00217fa2ab 100644 --- a/libavformat/mpc8.c +++ b/libavformat/mpc8.c @@ -182,7 +182,7 @@ static void mpc8_handle_chunk(AVFormatContext *s, int tag, int64_t chunk_pos, in avio_seek(pb, pos, SEEK_SET); break; default: - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); } } @@ -212,7 +212,7 @@ static int mpc8_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; } pos = avio_tell(pb); - avio_seek(pb, 4, SEEK_CUR); //CRC + avio_skip(pb, 4); //CRC c->ver = avio_r8(pb); if(c->ver != 8){ av_log(s, AV_LOG_ERROR, "Unknown stream version %d\n", c->ver); diff --git a/libavformat/mpeg.c b/libavformat/mpeg.c index 7a93c637f7..821cd6c763 100644 --- a/libavformat/mpeg.c +++ b/libavformat/mpeg.c @@ -212,7 +212,7 @@ static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *pb) ps_info_length = avio_rb16(pb); /* skip program_stream_info */ - avio_seek(pb, ps_info_length, SEEK_CUR); + avio_skip(pb, ps_info_length); es_map_length = avio_rb16(pb); /* at least one es available? */ @@ -223,7 +223,7 @@ static long mpegps_psm_parse(MpegDemuxContext *m, AVIOContext *pb) /* remember mapping from stream id to stream type */ m->psm_es_type[es_id] = type; /* skip program_stream_info */ - avio_seek(pb, es_info_length, SEEK_CUR); + avio_skip(pb, es_info_length); es_map_length -= 4 + es_info_length; } avio_rb32(pb); /* crc32 */ @@ -264,7 +264,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, if (startcode == SYSTEM_HEADER_START_CODE) goto redo; if (startcode == PADDING_STREAM) { - avio_seek(s->pb, avio_rb16(s->pb), SEEK_CUR); + avio_skip(s->pb, avio_rb16(s->pb)); goto redo; } if (startcode == PRIVATE_STREAM_2) { @@ -281,7 +281,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, } m->sofdec -= !m->sofdec; } - avio_seek(s->pb, len, SEEK_CUR); + avio_skip(s->pb, len); goto redo; } if (startcode == PROGRAM_STREAM_MAP) { @@ -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); pes_ext=skip=0; } - avio_seek(s->pb, skip, SEEK_CUR); + avio_skip(s->pb, skip); header_len -= skip; if (pes_ext & 0x01) { /* PES extension 2 */ @@ -375,7 +375,7 @@ static int mpegps_read_pes_header(AVFormatContext *s, } if(header_len < 0) goto error_redo; - avio_seek(s->pb, header_len, SEEK_CUR); + avio_skip(s->pb, header_len); } else if( c!= 0xf ) goto redo; @@ -433,7 +433,7 @@ static int mpegps_read_packet(AVFormatContext *s, if(startcode == 0x1bd) { dvdaudio_substream_type = avio_r8(s->pb); - avio_seek(s->pb, 3, SEEK_CUR); + avio_skip(s->pb, 3); len -= 4; } @@ -525,7 +525,7 @@ static int mpegps_read_packet(AVFormatContext *s, } else { skip: /* skip packet */ - avio_seek(s->pb, len, SEEK_CUR); + avio_skip(s->pb, len); goto redo; } /* no stream found: add a new stream */ @@ -602,7 +602,7 @@ static int64_t mpegps_read_dts(AVFormatContext *s, int stream_index, dts != AV_NOPTS_VALUE) { break; } - avio_seek(s->pb, len, SEEK_CUR); + avio_skip(s->pb, len); } #ifdef DEBUG_SEEK printf("pos=0x%"PRIx64" dts=0x%"PRIx64" %0.3f\n", pos, dts, dts / 90000.0); diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index ea41d81c11..2ef80c088c 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1362,7 +1362,7 @@ static int read_packet(AVFormatContext *s, uint8_t *buf, int raw_packet_size) } else { skip = raw_packet_size - TS_PACKET_SIZE; if (skip > 0) - avio_seek(pb, skip, SEEK_CUR); + avio_skip(pb, skip); break; } } diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c index 692dc1fdb9..a5dab2013f 100644 --- a/libavformat/msnwc_tcp.c +++ b/libavformat/msnwc_tcp.c @@ -104,19 +104,19 @@ static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt) uint16_t keyframe; uint32_t size, timestamp; - avio_seek(pb, 1, SEEK_CUR); /* one byte has been read ahead */ - avio_seek(pb, 2, SEEK_CUR); - avio_seek(pb, 2, SEEK_CUR); + avio_skip(pb, 1); /* one byte has been read ahead */ + avio_skip(pb, 2); + avio_skip(pb, 2); keyframe = avio_rl16(pb); size = avio_rl32(pb); - avio_seek(pb, 4, SEEK_CUR); - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); + avio_skip(pb, 4); timestamp = avio_rl32(pb); if(!size || av_get_packet(pb, pkt, size) != size) return -1; - avio_seek(pb, 1, SEEK_CUR); /* Read ahead one byte of struct size like read_header */ + avio_skip(pb, 1); /* Read ahead one byte of struct size like read_header */ pkt->pts = timestamp; pkt->dts = timestamp; diff --git a/libavformat/mtv.c b/libavformat/mtv.c index 462ae202fc..76e0862cf4 100644 --- a/libavformat/mtv.c +++ b/libavformat/mtv.c @@ -83,10 +83,10 @@ static int mtv_read_header(AVFormatContext *s, AVFormatParameters *ap) AVStream *st; unsigned int audio_subsegments; - avio_seek(pb, 3, SEEK_CUR); + avio_skip(pb, 3); mtv->file_size = avio_rl32(pb); mtv->segments = avio_rl32(pb); - avio_seek(pb, 32, SEEK_CUR); + avio_skip(pb, 32); mtv->audio_identifier = avio_rl24(pb); mtv->audio_br = avio_rl16(pb); mtv->img_colorfmt = avio_rl24(pb); @@ -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_width; - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); audio_subsegments = avio_rl16(pb); mtv->full_segment_size = audio_subsegments * (MTV_AUDIO_PADDING_SIZE + MTV_ASUBCHUNK_DATA_SIZE) + @@ -164,7 +164,7 @@ static int mtv_read_packet(AVFormatContext *s, AVPacket *pkt) if((avio_tell(pb) - s->data_offset + mtv->img_segment_size) % mtv->full_segment_size) { - avio_seek(pb, MTV_AUDIO_PADDING_SIZE, SEEK_CUR); + avio_skip(pb, MTV_AUDIO_PADDING_SIZE); ret = av_get_packet(pb, pkt, MTV_ASUBCHUNK_DATA_SIZE); if(ret < 0) diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c index de91fce755..fa0b734853 100644 --- a/libavformat/mxfdec.c +++ b/libavformat/mxfdec.c @@ -262,7 +262,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv av_aes_init(mxf->aesc, s->key, 128, 1); } // crypto context - avio_seek(pb, klv_decode_ber_length(pb), SEEK_CUR); + avio_skip(pb, klv_decode_ber_length(pb)); // plaintext offset klv_decode_ber_length(pb); plaintext_size = avio_rb64(pb); @@ -297,7 +297,7 @@ static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv &pkt->data[plaintext_size], size >> 4, ivec, 1); pkt->size = orig_size; pkt->stream_index = index; - avio_seek(pb, end - avio_tell(pb), SEEK_CUR); + avio_skip(pb, end - avio_tell(pb)); return 0; } @@ -339,7 +339,7 @@ static int mxf_read_packet(AVFormatContext *s, AVPacket *pkt) return 0; } else skip: - avio_seek(s->pb, klv.length, SEEK_CUR); + avio_skip(s->pb, klv.length); } return AVERROR_EOF; } @@ -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)); if (!mxf->packages_refs) return -1; - avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ + avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */ avio_read(pb, (uint8_t *)mxf->packages_refs, mxf->packages_count * sizeof(UID)); break; } @@ -416,7 +416,7 @@ static int mxf_read_source_clip(void *arg, AVIOContext *pb, int tag, int size, U break; case 0x1101: /* UMID, only get last 16 bytes */ - avio_seek(pb, 16, SEEK_CUR); + avio_skip(pb, 16); avio_read(pb, source_clip->source_package_uid, 16); break; case 0x1102: @@ -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)); if (!package->tracks_refs) return -1; - avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ + avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */ avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID)); break; } @@ -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)); if (!sequence->structural_components_refs) return -1; - avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ + avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */ avio_read(pb, (uint8_t *)sequence->structural_components_refs, sequence->structural_components_count * sizeof(UID)); break; } @@ -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)); if (!package->tracks_refs) return -1; - avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ + avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */ avio_read(pb, (uint8_t *)package->tracks_refs, package->tracks_count * sizeof(UID)); break; case 0x4401: /* UMID, only get last 16 bytes */ - avio_seek(pb, 16, SEEK_CUR); + avio_skip(pb, 16); avio_read(pb, package->package_uid, 16); break; case 0x4701: @@ -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)); if (!descriptor->sub_descriptors_refs) return -1; - avio_seek(pb, 4, SEEK_CUR); /* useless size of objects, always 16 according to specs */ + avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */ avio_read(pb, (uint8_t *)descriptor->sub_descriptors_refs, descriptor->sub_descriptors_count * sizeof(UID)); break; case 0x3004: @@ -943,7 +943,7 @@ static int mxf_read_header(AVFormatContext *s, AVFormatParameters *ap) } } if (!metadata->read) - avio_seek(s->pb, klv.length, SEEK_CUR); + avio_skip(s->pb, klv.length); } return mxf_parse_structural_metadata(mxf); } diff --git a/libavformat/ncdec.c b/libavformat/ncdec.c index 0c44aaa5be..142fd37ad1 100644 --- a/libavformat/ncdec.c +++ b/libavformat/ncdec.c @@ -73,7 +73,7 @@ static int nc_read_packet(AVFormatContext *s, AVPacket *pkt) avio_r8(s->pb); size = avio_rl16(s->pb); - avio_seek(s->pb, 9, SEEK_CUR); + avio_skip(s->pb, 9); if (size == 0) { av_log(s, AV_LOG_DEBUG, "Next packet size is zero\n"); diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index 1dc7cb0869..06565cdb43 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -584,7 +584,7 @@ null_chunk_retry: ((auxtag >> 16) & 0x0ff), ((auxtag >> 24) & 0x0ff), auxsize); - avio_seek(pb, auxsize, SEEK_CUR); + avio_skip(pb, auxsize); vsize -= auxsize + sizeof(uint16_t) + sizeof(uint32_t); /* that's becoming braindead */ } diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index d31040efb8..f010ad1e4b 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -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_ALL || stc->skip_until_key_frame){ - avio_seek(bc, size, SEEK_CUR); + avio_skip(bc, size); return 1; } @@ -803,7 +803,7 @@ static int nut_read_packet(AVFormatContext *s, AVPacket *pkt) case STREAM_STARTCODE: case INDEX_STARTCODE: skip= get_packetheader(nut, bc, 0, tmp); - avio_seek(bc, skip, SEEK_CUR); + avio_skip(bc, skip); break; case INFO_STARTCODE: if(decode_info_header(nut)<0) diff --git a/libavformat/nuv.c b/libavformat/nuv.c index bd2e28145e..5d63291868 100644 --- a/libavformat/nuv.c +++ b/libavformat/nuv.c @@ -66,7 +66,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, switch (frametype) { case NUV_EXTRADATA: subtype = avio_r8(pb); - avio_seek(pb, 6, SEEK_CUR); + avio_skip(pb, 6); size = PKTSIZE(avio_rl32(pb)); if (vst && subtype == 'R') { vst->codec->extradata_size = size; @@ -78,7 +78,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, } break; case NUV_MYTHEXT: - avio_seek(pb, 7, SEEK_CUR); + avio_skip(pb, 7); size = PKTSIZE(avio_rl32(pb)); if (size != 128 * 4) break; @@ -90,7 +90,7 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, if (vst->codec->codec_tag == MKTAG('R', 'J', 'P', 'G')) vst->codec->codec_id = CODEC_ID_NUV; } else - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); if (ast) { ast->codec->codec_tag = avio_rl32(pb); @@ -102,20 +102,20 @@ static int get_codec_data(AVIOContext *pb, AVStream *vst, ast->codec->bits_per_coded_sample); ast->need_parsing = AVSTREAM_PARSE_FULL; } else - avio_seek(pb, 4 * 4, SEEK_CUR); + avio_skip(pb, 4 * 4); size -= 6 * 4; - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); return 1; case NUV_SEEKP: size = 11; break; default: - avio_seek(pb, 7, SEEK_CUR); + avio_skip(pb, 7); size = PKTSIZE(avio_rl32(pb)); break; } - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); } return 0; } @@ -130,14 +130,14 @@ static int nuv_header(AVFormatContext *s, AVFormatParameters *ap) { AVStream *vst = NULL, *ast = NULL; avio_read(pb, id_string, 12); is_mythtv = !memcmp(id_string, "MythTVVideo", 12); - avio_seek(pb, 5, SEEK_CUR); // version string - avio_seek(pb, 3, SEEK_CUR); // padding + avio_skip(pb, 5); // version string + avio_skip(pb, 3); // padding width = avio_rl32(pb); height = avio_rl32(pb); avio_rl32(pb); // unused, "desiredwidth" avio_rl32(pb); // unused, "desiredheight" avio_r8(pb); // 'P' == progressive, 'I' == interlaced - avio_seek(pb, 3, SEEK_CUR); // padding + avio_skip(pb, 3); // padding aspect = av_int2dbl(avio_rl64(pb)); if (aspect > 0.9999 && aspect < 1.0001) aspect = 4.0 / 3.0; @@ -206,13 +206,13 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { switch (frametype) { case NUV_EXTRADATA: if (!ctx->rtjpg_video) { - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); break; } case NUV_VIDEO: if (ctx->v_id < 0) { av_log(s, AV_LOG_ERROR, "Video packet in file without video stream!\n"); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); break; } ret = av_new_packet(pkt, copyhdrsize + size); @@ -236,7 +236,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { case NUV_AUDIO: if (ctx->a_id < 0) { av_log(s, AV_LOG_ERROR, "Audio packet in file without audio stream!\n"); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); break; } ret = av_get_packet(pb, pkt, size); @@ -250,7 +250,7 @@ static int nuv_packet(AVFormatContext *s, AVPacket *pkt) { // contains no data, size value is invalid break; default: - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); break; } } diff --git a/libavformat/pva.c b/libavformat/pva.c index a3b350e316..8e8c060a65 100644 --- a/libavformat/pva.c +++ b/libavformat/pva.c @@ -122,7 +122,7 @@ recover: if (pes_signal != 1) { pva_log(s, AV_LOG_WARNING, "expected signaled PES packet, " "trying to recover\n"); - avio_seek(pb, length - 9, SEEK_CUR); + avio_skip(pb, length - 9); if (!read_packet) return AVERROR(EIO); goto recover; diff --git a/libavformat/qcp.c b/libavformat/qcp.c index b58ae33579..46eb0a9685 100644 --- a/libavformat/qcp.c +++ b/libavformat/qcp.c @@ -93,7 +93,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) avio_rb32(pb); // "RIFF" s->file_size = avio_rl32(pb) + 8; - avio_seek(pb, 8 + 4 + 1 + 1, SEEK_CUR); // "QLCMfmt " + chunk-size + major-version + minor-version + avio_skip(pb, 8 + 4 + 1 + 1); // "QLCMfmt " + chunk-size + major-version + minor-version st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->channels = 1; @@ -110,13 +110,13 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "Unknown codec GUID.\n"); return AVERROR_INVALIDDATA; } - avio_seek(pb, 2 + 80, SEEK_CUR); // codec-version + codec-name + avio_skip(pb, 2 + 80); // codec-version + codec-name st->codec->bit_rate = avio_rl16(pb); s->packet_size = avio_rl16(pb); - avio_seek(pb, 2, SEEK_CUR); // block-size + avio_skip(pb, 2); // block-size st->codec->sample_rate = avio_rl16(pb); - avio_seek(pb, 2, SEEK_CUR); // sample-size + avio_skip(pb, 2); // sample-size memset(c->rates_per_mode, -1, sizeof(c->rates_per_mode)); nb_rates = avio_rl32(pb); @@ -129,7 +129,7 @@ static int qcp_read_header(AVFormatContext *s, AVFormatParameters *ap) } else c->rates_per_mode[mode] = size; } - avio_seek(pb, 16 - 2*nb_rates + 20, SEEK_CUR); // empty entries of rate-map-table + reserved + avio_skip(pb, 16 - 2*nb_rates + 20); // empty entries of rate-map-table + reserved return 0; } @@ -174,14 +174,14 @@ static int qcp_read_packet(AVFormatContext *s, AVPacket *pkt) case MKTAG('v', 'r', 'a', 't'): if (avio_rl32(pb)) // var-rate-flag s->packet_size = 0; - avio_seek(pb, 4, SEEK_CUR); // size-in-packets + avio_skip(pb, 4); // size-in-packets break; case MKTAG('d', 'a', 't', 'a'): c->data_size = chunk_size; break; default: - avio_seek(pb, chunk_size, SEEK_CUR); + avio_skip(pb, chunk_size); } } return AVERROR_EOF; diff --git a/libavformat/r3d.c b/libavformat/r3d.c index 39f97ff9aa..aad88ee9c7 100644 --- a/libavformat/r3d.c +++ b/libavformat/r3d.c @@ -72,7 +72,7 @@ static int r3d_read_red1(AVFormatContext *s) tmp = avio_rb32(s->pb); // filenum av_dlog(s, "filenum %d\n", tmp); - avio_seek(s->pb, 32, SEEK_CUR); // unknown + avio_skip(s->pb, 32); // unknown st->codec->width = avio_rb32(s->pb); st->codec->height = avio_rb32(s->pb); @@ -152,7 +152,7 @@ static void r3d_read_reos(AVFormatContext *s) tmp = avio_rb32(s->pb); av_dlog(s, "num audio chunks %d\n", tmp); - avio_seek(s->pb, 6*4, SEEK_CUR); + avio_skip(s->pb, 6*4); } static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap) @@ -332,7 +332,7 @@ static int r3d_read_packet(AVFormatContext *s, AVPacket *pkt) break; default: skip: - avio_seek(s->pb, atom.size-8, SEEK_CUR); + avio_skip(s->pb, atom.size-8); } } return err; diff --git a/libavformat/rdt.c b/libavformat/rdt.c index 36e61c02ed..d6a96de5c1 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -161,16 +161,16 @@ rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr) num = avio_rb16(&pb); if (rule_nr < 0 || rule_nr >= num) return -1; - avio_seek(&pb, rule_nr * 2, SEEK_CUR); + avio_skip(&pb, rule_nr * 2); chunk_nr = avio_rb16(&pb); - avio_seek(&pb, (num - 1 - rule_nr) * 2, SEEK_CUR); + avio_skip(&pb, (num - 1 - rule_nr) * 2); /* read MDPR chunks */ num = avio_rb16(&pb); if (chunk_nr >= num) return -1; while (chunk_nr--) - avio_seek(&pb, avio_rb32(&pb), SEEK_CUR); + avio_skip(&pb, avio_rb32(&pb)); size = avio_rb32(&pb); } else { size = rdt->mlti_data_size; diff --git a/libavformat/riff.c b/libavformat/riff.c index 920cd96e37..fb8ab1c075 100644 --- a/libavformat/riff.c +++ b/libavformat/riff.c @@ -502,7 +502,7 @@ void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) codec->bits_per_coded_sample = avio_rl16(pb); codec->channel_layout = avio_rl32(pb); /* dwChannelMask */ id = avio_rl32(pb); /* 4 first bytes of GUID */ - avio_seek(pb, 12, SEEK_CUR); /* skip end of GUID */ + avio_skip(pb, 12); /* skip end of GUID */ cbSize -= 22; size -= 22; } @@ -515,7 +515,7 @@ void ff_get_wav_header(AVIOContext *pb, AVCodecContext *codec, int size) /* It is possible for the chunk to contain garbage at the end */ if (size > 0) - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); } codec->codec_id = ff_wav_codec_get_id(id, codec->bits_per_coded_sample); if (codec->codec_id == CODEC_ID_AAC_LATM) { diff --git a/libavformat/rl2.c b/libavformat/rl2.c index 4538d5c5cd..93d4c34459 100644 --- a/libavformat/rl2.c +++ b/libavformat/rl2.c @@ -95,7 +95,7 @@ static av_cold int rl2_read_header(AVFormatContext *s, int i; int ret = 0; - avio_seek(pb,4, SEEK_CUR); /* skip FORM tag */ + avio_skip(pb,4); /* skip FORM tag */ back_size = avio_rl32(pb); /**< get size of the background frame */ signature = avio_rb32(pb); data_size = avio_rb32(pb); diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index 4fd2e86759..c29905db58 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -132,7 +132,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, if (version == 3) { int header_size = avio_rb16(pb); int64_t startpos = avio_tell(pb); - avio_seek(pb, 14, SEEK_CUR); + avio_skip(pb, 14); rm_read_metadata(s, 0); if ((startpos + header_size) >= avio_tell(pb) + 2) { // fourcc (should always be "lpcJ") @@ -141,7 +141,7 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb, } // Skip extra header crap (this should never happen) if ((startpos + header_size) > avio_tell(pb)) - avio_seek(pb, header_size + startpos - avio_tell(pb), SEEK_CUR); + avio_skip(pb, header_size + startpos - avio_tell(pb)); st->codec->sample_rate = 8000; st->codec->channels = 1; st->codec->codec_type = AVMEDIA_TYPE_AUDIO; @@ -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 codecdata_length; /* old version (4) */ - avio_seek(pb, 2, SEEK_CUR); /* unused */ + avio_skip(pb, 2); /* unused */ avio_rb32(pb); /* .ra4 */ avio_rb32(pb); /* data size */ avio_rb16(pb); /* version2 */ @@ -321,7 +321,7 @@ ff_rm_read_mdpr_codecdata (AVFormatContext *s, AVIOContext *pb, skip: /* skip codec info */ size = avio_tell(pb) - codec_pos; - avio_seek(pb, codec_data_size - size, SEEK_CUR); + avio_skip(pb, codec_data_size - size); return 0; } @@ -340,7 +340,7 @@ static int rm_read_index(AVFormatContext *s) size = avio_rb32(pb); if (size < 20) return -1; - avio_seek(pb, 2, SEEK_CUR); + avio_skip(pb, 2); n_pkts = avio_rb32(pb); str_id = avio_rb16(pb); next_off = avio_rb32(pb); @@ -353,10 +353,10 @@ static int rm_read_index(AVFormatContext *s) goto skip; for (n = 0; n < n_pkts; n++) { - avio_seek(pb, 2, SEEK_CUR); + avio_skip(pb, 2); pts = avio_rb32(pb); pos = avio_rb32(pb); - avio_seek(pb, 4, SEEK_CUR); /* packet no. */ + avio_skip(pb, 4); /* packet no. */ av_add_index_entry(st, pos, pts, 0, 0, AVINDEX_KEYFRAME); } @@ -469,7 +469,7 @@ static int rm_read_header(AVFormatContext *s, AVFormatParameters *ap) goto header_end; default: /* unknown tag: skip it */ - avio_seek(pb, tag_size - 10, SEEK_CUR); + avio_skip(pb, tag_size - 10); break; } } @@ -529,7 +529,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ if(state == MKBETAG('I', 'N', 'D', 'X')){ int n_pkts, expected_len; len = avio_rb32(pb); - avio_seek(pb, 2, SEEK_CUR); + avio_skip(pb, 2); n_pkts = avio_rb32(pb); expected_len = 20 + n_pkts * 14; if (len == 20) @@ -566,7 +566,7 @@ static int sync(AVFormatContext *s, int64_t *timestamp, int *flags, int *stream_ if (i == s->nb_streams) { skip: /* skip packet if unknown number */ - avio_seek(pb, len, SEEK_CUR); + avio_skip(pb, len); rm->remaining_len = 0; continue; } @@ -929,7 +929,7 @@ static int64_t rm_read_dts(AVFormatContext *s, int stream_index, break; } - avio_seek(s->pb, len, SEEK_CUR); + avio_skip(s->pb, len); } *ppos = pos; return dts; diff --git a/libavformat/rtpdec_asf.c b/libavformat/rtpdec_asf.c index 8c4969111c..3c19ad6e5b 100644 --- a/libavformat/rtpdec_asf.c +++ b/libavformat/rtpdec_asf.c @@ -187,11 +187,11 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, flags |= RTP_FLAG_KEY; len_off = avio_rb24(pb); if (mflags & 0x20) /**< relative timestamp */ - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); if (mflags & 0x10) /**< has duration */ - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); if (mflags & 0x8) /**< has location ID */ - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); off = avio_tell(pb); if (!(mflags & 0x40)) { @@ -214,7 +214,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, return AVERROR(EIO); avio_write(asf->pktbuf, buf + off, len - off); - avio_seek(pb, len - off, SEEK_CUR); + avio_skip(pb, len - off); if (!(flags & RTP_FLAG_MARKER)) return -1; out_len = url_close_dyn_buf(asf->pktbuf, &asf->buf); @@ -234,7 +234,7 @@ static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, asf->buf = av_realloc(asf->buf, out_len); memcpy(asf->buf + prev_len, buf + off, FFMIN(cur_len, len - off)); - avio_seek(pb, cur_len, SEEK_CUR); + avio_skip(pb, cur_len); } } diff --git a/libavformat/rtpdec_qt.c b/libavformat/rtpdec_qt.c index 4041a0fca5..206ed347b4 100644 --- a/libavformat/rtpdec_qt.c +++ b/libavformat/rtpdec_qt.c @@ -149,13 +149,13 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, break; } default: - avio_seek(&pb, tlv_len, SEEK_CUR); + avio_skip(&pb, tlv_len); break; } } /* 32-bit alignment */ - avio_seek(&pb, ((avio_tell(&pb) + 3) & ~3) - avio_tell(&pb), SEEK_CUR); + avio_skip(&pb, ((avio_tell(&pb) + 3) & ~3) - avio_tell(&pb)); } else avio_seek(&pb, 4, SEEK_SET); diff --git a/libavformat/sauce.c b/libavformat/sauce.c index 8f1acb4a77..41e991e3e7 100644 --- a/libavformat/sauce.c +++ b/libavformat/sauce.c @@ -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("publisher", 20) GET_SAUCE_META("date", 8) - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); datatype = avio_r8(pb); filetype = avio_r8(pb); t1 = avio_rl16(pb); t2 = avio_rl16(pb); nb_comments = avio_r8(pb); flags = avio_r8(pb); - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); GET_SAUCE_META("encoder", 22); if (got_width && datatype && filetype) { diff --git a/libavformat/siff.c b/libavformat/siff.c index 880132ff67..d0f682b0cf 100644 --- a/libavformat/siff.c +++ b/libavformat/siff.c @@ -103,7 +103,7 @@ static int siff_parse_vbv1(AVFormatContext *s, SIFFContext *c, AVIOContext *pb) } width = avio_rl16(pb); height = avio_rl16(pb); - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); c->frames = avio_rl16(pb); if(!c->frames){ 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) c->rate = avio_rl16(pb); c->block_align = c->rate * (c->bits >> 3); - avio_seek(pb, 16, SEEK_CUR); //zeroes + avio_skip(pb, 16); //zeroes st = av_new_stream(s, 0); if (!st) @@ -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"); return -1; } - avio_seek(pb, 4, SEEK_CUR); //unknown value + avio_skip(pb, 4); //unknown value c->rate = avio_rl16(pb); c->bits = avio_rl16(pb); c->block_align = c->rate * (c->bits >> 3); @@ -160,7 +160,7 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap) if (avio_rl32(pb) != TAG_SIFF) return -1; - avio_seek(pb, 4, SEEK_CUR); //ignore size + avio_skip(pb, 4); //ignore size tag = avio_rl32(pb); if (tag != TAG_VBV1 && tag != TAG_SOUN){ @@ -176,7 +176,7 @@ static int siff_read_header(AVFormatContext *s, AVFormatParameters *ap) av_log(s, AV_LOG_ERROR, "'BODY' chunk is missing\n"); return -1; } - avio_seek(pb, 4, SEEK_CUR); //ignore size + avio_skip(pb, 4); //ignore size return 0; } diff --git a/libavformat/soxdec.c b/libavformat/soxdec.c index 293e8463a3..4f0984dde4 100644 --- a/libavformat/soxdec.c +++ b/libavformat/soxdec.c @@ -58,14 +58,14 @@ static int sox_read_header(AVFormatContext *s, if (avio_rl32(pb) == SOX_TAG) { st->codec->codec_id = CODEC_ID_PCM_S32LE; header_size = avio_rl32(pb); - avio_seek(pb, 8, SEEK_CUR); /* sample count */ + avio_skip(pb, 8); /* sample count */ sample_rate = av_int2dbl(avio_rl64(pb)); st->codec->channels = avio_rl32(pb); comment_size = avio_rl32(pb); } else { st->codec->codec_id = CODEC_ID_PCM_S32BE; header_size = avio_rb32(pb); - avio_seek(pb, 8, SEEK_CUR); /* sample count */ + avio_skip(pb, 8); /* sample count */ sample_rate = av_int2dbl(avio_rb64(pb)); st->codec->channels = avio_rb32(pb); comment_size = avio_rb32(pb); @@ -105,7 +105,7 @@ static int sox_read_header(AVFormatContext *s, AV_METADATA_DONT_STRDUP_VAL); } - avio_seek(pb, header_size - SOX_FIXED_HDR - comment_size, SEEK_CUR); + avio_skip(pb, header_size - SOX_FIXED_HDR - comment_size); st->codec->sample_rate = sample_rate; st->codec->bits_per_coded_sample = 32; diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c index 0ca66118f0..1d198ca2c4 100644 --- a/libavformat/spdifdec.c +++ b/libavformat/spdifdec.c @@ -201,7 +201,7 @@ static int spdif_read_packet(AVFormatContext *s, AVPacket *pkt) } /* skip over the padding to the beginning of the next frame */ - avio_seek(pb, offset - pkt->size - BURST_HEADER_SIZE, SEEK_CUR); + avio_skip(pb, offset - pkt->size - BURST_HEADER_SIZE); if (!s->nb_streams) { /* first packet, create a stream */ diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index 57eb233b35..bf70fc5250 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -70,7 +70,7 @@ static int swf_read_header(AVFormatContext *s, AVFormatParameters *ap) /* skip rectangle size */ nbits = avio_r8(pb) >> 3; len = (4 * nbits - 3 + 7) / 8; - avio_seek(pb, len, SEEK_CUR); + avio_skip(pb, len); swf->frame_rate = avio_rl16(pb); /* 8.8 fixed */ avio_rl16(pb); /* frame count */ @@ -159,7 +159,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) st = s->streams[i]; if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO && st->id == -1) { if (st->codec->codec_id == CODEC_ID_MP3) { - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); av_get_packet(pb, pkt, len-4); } else { // ADPCM, PCM av_get_packet(pb, pkt, len); @@ -202,7 +202,7 @@ static int swf_read_packet(AVFormatContext *s, AVPacket *pkt) return pkt->size; } skip: - avio_seek(pb, len, SEEK_CUR); + avio_skip(pb, len); } return 0; } diff --git a/libavformat/tmv.c b/libavformat/tmv.c index 1116ca0369..828a556720 100644 --- a/libavformat/tmv.c +++ b/libavformat/tmv.c @@ -152,7 +152,7 @@ static int tmv_read_packet(AVFormatContext *s, AVPacket *pkt) ret = av_get_packet(pb, pkt, pkt_size); if (tmv->stream_index) - avio_seek(pb, tmv->padding, SEEK_CUR); + avio_skip(pb, tmv->padding); pkt->stream_index = tmv->stream_index; tmv->stream_index ^= 1; diff --git a/libavformat/tta.c b/libavformat/tta.c index 8669057fbd..d5f8e1ed61 100644 --- a/libavformat/tta.c +++ b/libavformat/tta.c @@ -50,7 +50,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) if (avio_rl32(s->pb) != AV_RL32("TTA1")) return -1; // not tta file - avio_seek(s->pb, 2, SEEK_CUR); // FIXME: flags + avio_skip(s->pb, 2); // FIXME: flags channels = avio_rl16(s->pb); bps = avio_rl16(s->pb); samplerate = avio_rl32(s->pb); @@ -65,7 +65,7 @@ static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) return -1; } - avio_seek(s->pb, 4, SEEK_CUR); // header crc + avio_skip(s->pb, 4); // header crc framelen = samplerate*256/245; c->totalframes = datalen / framelen + ((datalen % framelen) ? 1 : 0); @@ -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); framepos += size; } - avio_seek(s->pb, 4, SEEK_CUR); // seektable crc + avio_skip(s->pb, 4); // seektable crc st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_TTA; diff --git a/libavformat/txd.c b/libavformat/txd.c index b62a7dcbf6..dd95366795 100644 --- a/libavformat/txd.c +++ b/libavformat/txd.c @@ -73,7 +73,7 @@ next_chunk: if (chunk_size > 100) break; case TXD_EXTRA: - avio_seek(s->pb, chunk_size, SEEK_CUR); + avio_skip(s->pb, chunk_size); case TXD_FILE: case TXD_TEXTURE: goto next_chunk; diff --git a/libavformat/vc1test.c b/libavformat/vc1test.c index 54d96f57d7..783ab88ebf 100644 --- a/libavformat/vc1test.c +++ b/libavformat/vc1test.c @@ -68,7 +68,7 @@ static int vc1t_read_header(AVFormatContext *s, st->codec->width = avio_rl32(pb); if(avio_rl32(pb) != 0xC) return -1; - avio_seek(pb, 8, SEEK_CUR); + avio_skip(pb, 8); fps = avio_rl32(pb); if(fps == 0xFFFFFFFF) av_set_pts_info(st, 32, 1, 1000); diff --git a/libavformat/vocdec.c b/libavformat/vocdec.c index f4fb8cc37b..d11e68c49f 100644 --- a/libavformat/vocdec.c +++ b/libavformat/vocdec.c @@ -45,13 +45,13 @@ static int voc_read_header(AVFormatContext *s, AVFormatParameters *ap) int header_size; AVStream *st; - avio_seek(pb, 20, SEEK_CUR); + avio_skip(pb, 20); header_size = avio_rl16(pb) - 22; if (header_size != 4) { av_log(s, AV_LOG_ERROR, "unknown header size: %d\n", header_size); return AVERROR(ENOSYS); } - avio_seek(pb, header_size, SEEK_CUR); + avio_skip(pb, header_size); st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); @@ -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->channels = avio_r8(pb); tmp_codec = avio_rl16(pb); - avio_seek(pb, 4, SEEK_CUR); + avio_skip(pb, 4); voc->remaining_size -= 12; max_size -= 12; break; default: - avio_seek(pb, voc->remaining_size, SEEK_CUR); + avio_skip(pb, voc->remaining_size); max_size -= voc->remaining_size; voc->remaining_size = 0; break; diff --git a/libavformat/vqf.c b/libavformat/vqf.c index 49ed8b4e95..94ba543ba5 100644 --- a/libavformat/vqf.c +++ b/libavformat/vqf.c @@ -72,7 +72,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) if (!st) return AVERROR(ENOMEM); - avio_seek(s->pb, 12, SEEK_CUR); + avio_skip(s->pb, 12); header_size = avio_rb32(s->pb); @@ -101,7 +101,7 @@ static int vqf_read_header(AVFormatContext *s, AVFormatParameters *ap) st->codec->channels = avio_rb32(s->pb) + 1; read_bitrate = avio_rb32(s->pb); rate_flag = avio_rb32(s->pb); - avio_seek(s->pb, len-12, SEEK_CUR); + avio_skip(s->pb, len-12); st->codec->bit_rate = read_bitrate*1000; st->codec->bits_per_coded_sample = 16; @@ -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", ((char*)&chunk_tag)[0], ((char*)&chunk_tag)[1], ((char*)&chunk_tag)[2], ((char*)&chunk_tag)[3]); - avio_seek(s->pb, FFMIN(len, header_size), SEEK_CUR); + avio_skip(s->pb, FFMIN(len, header_size)); break; } diff --git a/libavformat/wav.c b/libavformat/wav.c index d51c01208e..d96b379b2c 100644 --- a/libavformat/wav.c +++ b/libavformat/wav.c @@ -160,7 +160,7 @@ static int64_t find_tag(AVIOContext *pb, uint32_t tag1) size = next_tag(pb, &tag); if (tag == tag1) break; - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); } return size; } @@ -217,7 +217,7 @@ static int wav_read_header(AVFormatContext *s, avio_rl64(pb); /* RIFF size */ data_size = avio_rl64(pb); sample_count = avio_rl64(pb); - avio_seek(pb, size - 16, SEEK_CUR); /* skip rest of ds64 chunk */ + avio_skip(pb, size - 16); /* skip rest of ds64 chunk */ } /* parse fmt header */ @@ -243,7 +243,7 @@ static int wav_read_header(AVFormatContext *s, sample_count = avio_rl32(pb); size -= 4; } - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); } if (rf64) size = data_size; @@ -276,7 +276,7 @@ static int64_t find_guid(AVIOContext *pb, const uint8_t guid1[16]) return -1; if (!memcmp(guid, guid1, 16)) return size; - avio_seek(pb, FFALIGN(size, INT64_C(8)) - 24, SEEK_CUR); + avio_skip(pb, FFALIGN(size, INT64_C(8)) - 24); } return -1; } @@ -410,7 +410,7 @@ static int w64_read_header(AVFormatContext *s, AVFormatParameters *ap) /* subtract chunk header size - normal wav file doesn't count it */ ff_get_wav_header(pb, st->codec, size - 24); - avio_seek(pb, FFALIGN(size, INT64_C(8)) - size, SEEK_CUR); + avio_skip(pb, FFALIGN(size, INT64_C(8)) - size); st->need_parsing = AVSTREAM_PARSE_FULL; diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c index e4c871ca09..01bed4f714 100644 --- a/libavformat/wc3movie.c +++ b/libavformat/wc3movie.c @@ -101,7 +101,7 @@ static int wc3_read_header(AVFormatContext *s, wc3->vpkt.data = NULL; wc3->vpkt.size = 0; /* skip the first 3 32-bit numbers */ - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); /* traverse through the chunks and load the header information before * the first BRCH tag */ @@ -114,12 +114,12 @@ static int wc3_read_header(AVFormatContext *s, case SOND_TAG: case INDX_TAG: /* SOND unknown, INDX unnecessary; ignore both */ - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); break; case PC__TAG: /* number of palettes, unneeded */ - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); break; case BNAM_TAG: @@ -240,7 +240,7 @@ static int wc3_read_packet(AVFormatContext *s, case TEXT_TAG: /* subtitle chunk */ #if 0 - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); #else if ((unsigned)size > sizeof(text) || (ret = avio_read(pb, text, size)) != size) ret = AVERROR(EIO); diff --git a/libavformat/westwood.c b/libavformat/westwood.c index adb35319e2..818fe2d8d3 100644 --- a/libavformat/westwood.c +++ b/libavformat/westwood.c @@ -303,7 +303,7 @@ static int wsvqa_read_header(AVFormatContext *s, break; } - avio_seek(pb, chunk_size, SEEK_CUR); + avio_skip(pb, chunk_size); } while (chunk_tag != FINF_TAG); return 0; @@ -348,7 +348,7 @@ static int wsvqa_read_packet(AVFormatContext *s, } /* stay on 16-bit alignment */ if (skip_byte) - avio_seek(pb, 1, SEEK_CUR); + avio_skip(pb, 1); return ret; } else { @@ -359,7 +359,7 @@ static int wsvqa_read_packet(AVFormatContext *s, default: av_log(s, AV_LOG_INFO, "Skipping unknown chunk 0x%08X\n", chunk_type); } - avio_seek(pb, chunk_size + skip_byte, SEEK_CUR); + avio_skip(pb, chunk_size + skip_byte); } } diff --git a/libavformat/wtv.c b/libavformat/wtv.c index 191c1c1d67..6337502209 100644 --- a/libavformat/wtv.c +++ b/libavformat/wtv.c @@ -539,7 +539,7 @@ static void get_tag(AVFormatContext *s, AVIOContext *pb, const char *key, int ty } else { av_freep(&buf); av_log(s, AV_LOG_WARNING, "unsupported metadata entry; key:%s, type:%d, length:0x%x\n", key, type, length); - avio_seek(pb, length, SEEK_CUR); + avio_skip(pb, length); return; } @@ -582,7 +582,7 @@ static int parse_videoinfoheader2(AVFormatContext *s, AVStream *st) WtvContext *wtv = s->priv_data; AVIOContext *pb = wtv->pb; - avio_seek(pb, 72, SEEK_CUR); // picture aspect ratio is unreliable + avio_skip(pb, 72); // picture aspect ratio is unreliable ff_get_bmp_header(pb, st); return 72 + 40; @@ -658,17 +658,17 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, if (size < 32) { av_log(s, AV_LOG_WARNING, "format buffer size underflow\n"); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); return NULL; } - avio_seek(pb, size - 32, SEEK_CUR); + avio_skip(pb, size - 32); ff_get_guid(pb, &actual_subtype); ff_get_guid(pb, &actual_formattype); avio_seek(pb, -size, SEEK_CUR); st = parse_media_type(s, st, sid, mediatype, actual_subtype, actual_formattype, size - 32); - avio_seek(pb, 32, SEEK_CUR); + avio_skip(pb, 32); return st; } else if (!ff_guidcmp(mediatype, mediatype_audio)) { st = new_stream(s, st, sid, AVMEDIA_TYPE_AUDIO); @@ -679,7 +679,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, } else { if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); } if (!memcmp(subtype + 4, (const uint8_t[]){MEDIASUBTYPE_BASE_GUID}, 12)) { @@ -708,7 +708,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, } else { if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); } if (!memcmp(subtype + 4, (const uint8_t[]){MEDIASUBTYPE_BASE_GUID}, 12)) { @@ -726,7 +726,7 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, return NULL; if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); st->codec->codec_id = CODEC_ID_DVB_SUBTITLE; return st; } else if (!ff_guidcmp(mediatype, mediatype_mstvcaption) && @@ -736,21 +736,21 @@ static AVStream * parse_media_type(AVFormatContext *s, AVStream *st, int sid, return NULL; if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); st->codec->codec_id = CODEC_ID_DVB_TELETEXT; return st; } else if (!ff_guidcmp(mediatype, mediatype_mpeg2_sections) && !ff_guidcmp(subtype, mediasubtype_mpeg2_sections)) { if (ff_guidcmp(formattype, format_none)) av_log(s, AV_LOG_WARNING, "unknown formattype:"PRI_GUID"\n", ARG_GUID(formattype)); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); return NULL; } av_log(s, AV_LOG_WARNING, "unknown media type, mediatype:"PRI_GUID ", subtype:"PRI_GUID", formattype:"PRI_GUID"\n", ARG_GUID(mediatype), ARG_GUID(subtype), ARG_GUID(formattype)); - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); return NULL; } @@ -779,17 +779,17 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p if (len < 32) break; sid = avio_rl32(pb) & 0x7FFF; - avio_seek(pb, 8, SEEK_CUR); + avio_skip(pb, 8); consumed = 32; if (!ff_guidcmp(g, stream_guid)) { if (ff_find_stream_index(s, sid) < 0) { ff_asf_guid mediatype, subtype, formattype; int size; - avio_seek(pb, 28, SEEK_CUR); + avio_skip(pb, 28); ff_get_guid(pb, &mediatype); ff_get_guid(pb, &subtype); - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); ff_get_guid(pb, &formattype); size = avio_rl32(pb); parse_media_type(s, 0, sid, mediatype, subtype, formattype, size); @@ -800,10 +800,10 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p if (stream_index >= 0 && !((WtvStream*)s->streams[stream_index]->priv_data)->seen_data) { ff_asf_guid mediatype, subtype, formattype; int size; - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); ff_get_guid(pb, &mediatype); ff_get_guid(pb, &subtype); - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); ff_get_guid(pb, &formattype); size = avio_rl32(pb); parse_media_type(s, s->streams[stream_index], sid, mediatype, subtype, formattype, size); @@ -822,11 +822,11 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p const uint8_t *pbuf = buf; int buf_size; - avio_seek(pb, 8, SEEK_CUR); + avio_skip(pb, 8); consumed += 8; if (!ff_guidcmp(g, EVENTID_CtxADescriptorSpanningEvent) || !ff_guidcmp(g, EVENTID_CSDescriptorSpanningEvent)) { - avio_seek(pb, 6, SEEK_CUR); + avio_skip(pb, 6); consumed += 6; } @@ -840,7 +840,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p if (stream_index >= 0) { AVStream *st = s->streams[stream_index]; int audio_type; - avio_seek(pb, 8, SEEK_CUR); + avio_skip(pb, 8); audio_type = avio_r8(pb); if (audio_type == 2) st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED; @@ -851,7 +851,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p } else if (!ff_guidcmp(g, EVENTID_DVBScramblingControlSpanningEvent)) { int stream_index = ff_find_stream_index(s, sid); if (stream_index >= 0) { - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); if (avio_rl32(pb)) av_log(s, AV_LOG_WARNING, "DVB scrambled stream detected (st:%d), decoding will likely fail\n", stream_index); consumed += 16; @@ -861,7 +861,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p if (stream_index >= 0) { AVStream *st = s->streams[stream_index]; uint8_t language[4]; - avio_seek(pb, 12, SEEK_CUR); + avio_skip(pb, 12); avio_read(pb, language, 3); if (language[0]) { language[3] = 0; @@ -874,7 +874,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p } else if (!ff_guidcmp(g, timestamp_guid)) { int stream_index = ff_find_stream_index(s, sid); if (stream_index >= 0) { - avio_seek(pb, 8, SEEK_CUR); + avio_skip(pb, 8); wtv->pts = avio_rl64(pb); consumed += 16; if (wtv->pts == -1) @@ -885,7 +885,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p wtv->epoch = wtv->pts; if (mode == SEEK_TO_PTS && wtv->pts >= seekts) { #define WTV_PAD8(x) (((x) + 7) & ~7) - avio_seek(pb, WTV_PAD8(len) - consumed, SEEK_CUR); + avio_skip(pb, WTV_PAD8(len) - consumed); return 0; } } @@ -923,7 +923,7 @@ static int parse_chunks(AVFormatContext *s, int mode, int64_t seekts, int *len_p } else av_log(s, AV_LOG_WARNING, "unsupported chunk:"PRI_GUID"\n", ARG_GUID(g)); - avio_seek(pb, WTV_PAD8(len) - consumed, SEEK_CUR); + avio_skip(pb, WTV_PAD8(len) - consumed); } return AVERROR_EOF; } @@ -954,13 +954,13 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap) wtv->last_valid_pts = AV_NOPTS_VALUE; /* read root directory sector */ - avio_seek(s->pb, 0x30, SEEK_CUR); + avio_skip(s->pb, 0x30); root_size = avio_rl32(s->pb); if (root_size > sizeof(root)) { av_log(s, AV_LOG_ERROR, "root directory size exceeds sector size\n"); return AVERROR_INVALIDDATA; } - avio_seek(s->pb, 4, SEEK_CUR); + avio_skip(s->pb, 4); root_sector = avio_rl32(s->pb); avio_seek(s->pb, root_sector << WTV_SECTOR_BITS, SEEK_SET); @@ -1047,7 +1047,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) return ret; pkt->stream_index = stream_index; pkt->pts = wtv->pts; - avio_seek(pb, WTV_PAD8(len) - len, SEEK_CUR); + avio_skip(pb, WTV_PAD8(len) - len); return 0; } diff --git a/libavformat/wv.c b/libavformat/wv.c index 12aaef991b..9a8f857968 100644 --- a/libavformat/wv.c +++ b/libavformat/wv.c @@ -153,7 +153,7 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen chmask = avio_rl32(pb); break; case 5: - avio_seek(pb, 1, SEEK_CUR); + avio_skip(pb, 1); chan |= (avio_r8(pb) & 0xF) << 8; chmask = avio_rl24(pb); break; @@ -166,10 +166,10 @@ static int wv_read_block_header(AVFormatContext *ctx, AVIOContext *pb, int appen rate = avio_rl24(pb); break; default: - avio_seek(pb, size, SEEK_CUR); + avio_skip(pb, size); } if(id&0x40) - avio_seek(pb, 1, SEEK_CUR); + avio_skip(pb, 1); } if(rate == -1){ av_log(ctx, AV_LOG_ERROR, "Cannot determine custom sampling rate\n"); diff --git a/libavformat/xa.c b/libavformat/xa.c index 17cf237a9d..3b6a77f4af 100644 --- a/libavformat/xa.c +++ b/libavformat/xa.c @@ -76,9 +76,9 @@ static int xa_read_header(AVFormatContext *s, st->codec->codec_type = AVMEDIA_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_ADPCM_EA_MAXIS_XA; - avio_seek(pb, 4, SEEK_CUR); /* Skip the XA ID */ + avio_skip(pb, 4); /* Skip the XA ID */ xa->out_size = avio_rl32(pb); - avio_seek(pb, 2, SEEK_CUR); /* Skip the tag */ + avio_skip(pb, 2); /* Skip the tag */ st->codec->channels = avio_rl16(pb); st->codec->sample_rate = avio_rl32(pb); /* Value in file is average byte rate*/ diff --git a/libavformat/yop.c b/libavformat/yop.c index 20de06ca85..486fdc5616 100644 --- a/libavformat/yop.c +++ b/libavformat/yop.c @@ -81,7 +81,7 @@ static int yop_read_header(AVFormatContext *s, AVFormatParameters *ap) video_dec->codec_type = AVMEDIA_TYPE_VIDEO; video_dec->codec_id = CODEC_ID_YOP; - avio_seek(pb, 6, SEEK_CUR); + avio_skip(pb, 6); frame_rate = avio_r8(pb); yop->frame_size = avio_r8(pb) * 2048; @@ -153,7 +153,7 @@ static int yop_read_packet(AVFormatContext *s, AVPacket *pkt) // Set position to the start of the frame pkt->pos = yop->video_packet.pos; - avio_seek(pb, yop->audio_block_length - ret, SEEK_CUR); + avio_skip(pb, yop->audio_block_length - ret); ret = avio_read(pb, yop->video_packet.data + yop->palette_size, actual_video_data_size); |