diff options
author | Anton Khirnov <anton@khirnov.net> | 2011-03-15 11:14:38 +0300 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2011-03-17 05:24:51 +0300 |
commit | 45a8a02a4151c9ff0d1161bf90bffcfbbb312fb8 (patch) | |
tree | 79beacdc9d6d90d0e31558526d83033200f4361d /libavformat/asfdec.c | |
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/asfdec.c')
-rw-r--r-- | libavformat/asfdec.c | 36 |
1 files changed, 18 insertions, 18 deletions
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); } |