Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
external
ffmpeg
Commits
45a8a02a
Commit
45a8a02a
authored
Mar 15, 2011
by
Anton Khirnov
Committed by
Ronald S. Bultje
Mar 16, 2011
Browse files
lavf: replace avio_seek(SEEK_CUR) with avio_skip where it makes sense
Signed-off-by:
Ronald S. Bultje
<
rsbultje@gmail.com
>
parent
cbf5d22d
Changes
76
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
100 additions
and
100 deletions
+100
-100
libavformat/4xm.c
libavformat/4xm.c
+3
-3
libavformat/aea.c
libavformat/aea.c
+2
-2
libavformat/aiffdec.c
libavformat/aiffdec.c
+4
-4
libavformat/anm.c
libavformat/anm.c
+8
-8
libavformat/ape.c
libavformat/ape.c
+3
-3
libavformat/asfdec.c
libavformat/asfdec.c
+18
-18
libavformat/au.c
libavformat/au.c
+1
-1
libavformat/avidec.c
libavformat/avidec.c
+24
-24
libavformat/avienc.c
libavformat/avienc.c
+3
-3
libavformat/avs.c
libavformat/avs.c
+2
-2
libavformat/bethsoftvid.c
libavformat/bethsoftvid.c
+1
-1
libavformat/bfi.c
libavformat/bfi.c
+3
-3
libavformat/bink.c
libavformat/bink.c
+4
-4
libavformat/c93.c
libavformat/c93.c
+1
-1
libavformat/cafdec.c
libavformat/cafdec.c
+8
-8
libavformat/dxa.c
libavformat/dxa.c
+2
-2
libavformat/eacdata.c
libavformat/eacdata.c
+1
-1
libavformat/electronicarts.c
libavformat/electronicarts.c
+9
-9
libavformat/ffmdec.c
libavformat/ffmdec.c
+1
-1
libavformat/filmstripdec.c
libavformat/filmstripdec.c
+2
-2
No files found.
libavformat/4xm.c
View file @
45a8a02a
...
...
@@ -106,7 +106,7 @@ static int fourxm_read_header(AVFormatContext *s,
fourxm
->
fps
=
1
.
0
;
/* skip the first 3 32-bit numbers */
avio_s
eek
(
pb
,
12
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
size
,
SEEK_CUR
);
avio_s
kip
(
pb
,
size
);
}
break
;
default:
avio_s
eek
(
pb
,
size
,
SEEK_CUR
);
avio_s
kip
(
pb
,
size
);
break
;
}
}
...
...
libavformat/aea.c
View file @
45a8a02a
...
...
@@ -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_s
eek
(
s
->
pb
,
264
,
SEEK_CUR
);
avio_s
kip
(
s
->
pb
,
264
);
st
->
codec
->
channels
=
avio_r8
(
s
->
pb
);
avio_s
eek
(
s
->
pb
,
1783
,
SEEK_CUR
);
avio_s
kip
(
s
->
pb
,
1783
);
st
->
codec
->
codec_type
=
AVMEDIA_TYPE_AUDIO
;
...
...
libavformat/aiffdec.c
View file @
45a8a02a
...
...
@@ -70,7 +70,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size)
int
res
;
if
(
!
str
)
{
avio_s
eek
(
s
->
pb
,
size
,
SEEK_CUR
);
avio_s
kip
(
s
->
pb
,
size
);
return
;
}
...
...
@@ -152,7 +152,7 @@ static unsigned int get_aiff_header(AVIOContext *pb, AVCodecContext *codec,
/* Chunk is over */
if
(
size
)
avio_s
eek
(
pb
,
size
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
size
-
8
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
size
,
SEEK_CUR
);
avio_s
kip
(
pb
,
size
);
}
}
...
...
libavformat/anm.c
View file @
45a8a02a
...
...
@@ -83,7 +83,7 @@ static int read_header(AVFormatContext *s,
AVStream
*
st
;
int
i
,
ret
;
avio_s
eek
(
pb
,
4
,
SEEK_CUR
);
/* magic number */
avio_s
kip
(
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_s
eek
(
pb
,
2
,
SEEK_CUR
);
/* max records per page */
avio_s
kip
(
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_s
eek
(
pb
,
1
,
SEEK_CUR
);
/* frame rate multiplier info */
avio_s
kip
(
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_s
eek
(
pb
,
1
,
SEEK_CUR
);
/* last_delta_valid */
avio_s
kip
(
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_s
eek
(
pb
,
1
,
SEEK_CUR
);
/* other recs per frame */
avio_s
kip
(
pb
,
1
);
/* other recs per frame */
if
(
avio_r8
(
pb
)
!=
1
)
goto
invalid
;
avio_s
eek
(
pb
,
32
,
SEEK_CUR
);
/* record_types */
avio_s
kip
(
pb
,
32
);
/* record_types */
st
->
nb_frames
=
avio_rl32
(
pb
);
av_set_pts_info
(
st
,
64
,
1
,
avio_rl16
(
pb
));
avio_s
eek
(
pb
,
58
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
8
+
2
*
p
->
nb_records
,
SEEK_CUR
);
avio_s
kip
(
pb
,
8
+
2
*
p
->
nb_records
);
anm
->
record
=
0
;
}
...
...
libavformat/ape.c
View file @
45a8a02a
...
...
@@ -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_s
eek
(
pb
,
ape
->
descriptorlength
-
52
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
4
,
SEEK_CUR
);
/* Skip the peak level */
avio_s
kip
(
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_s
eek
(
pb
,
ape
->
wavheaderlength
,
SEEK_CUR
);
avio_s
kip
(
pb
,
ape
->
wavheaderlength
);
}
if
(
!
ape
->
totalframes
){
...
...
libavformat/asfdec.c
View file @
45a8a02a
...
...
@@ -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_s
eek
(
pb
,
20
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
size
-
(
pos2
-
pos1
+
24
)
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
ext_len
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
ext_len
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
len5
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
name_len
-
ret
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
lang_len
-
ret
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
name_len
-
ret
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
value_len
-
2
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
name_len
-
ret
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
10
,
SEEK_CUR
);
avio_s
kip
(
pb
,
10
);
ts0
=
avio_rl64
(
pb
);
ts1
=
avio_rl64
(
pb
);
avio_s
eek
(
pb
,
12
,
SEEK_CUR
);
avio_s
kip
(
pb
,
12
);
avio_rl32
(
pb
);
avio_s
eek
(
pb
,
asf
->
packet_replic_size
-
8
-
38
-
4
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
asf
->
packet_replic_size
-
8
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
ret
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
asf
->
packet_frag_size
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
asf
->
packet_multi_size
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
s
->
pb
,
gsize
-
24
,
SEEK_CUR
);
avio_s
kip
(
s
->
pb
,
gsize
-
24
);
ff_get_guid
(
s
->
pb
,
&
g
);
}
...
...
libavformat/au.c
View file @
45a8a02a
...
...
@@ -147,7 +147,7 @@ static int au_read_header(AVFormatContext *s,
if
(
size
>=
24
)
{
/* skip unused data */
avio_s
eek
(
pb
,
size
-
24
,
SEEK_CUR
);
avio_s
kip
(
pb
,
size
-
24
);
}
/* now we are ready: build format streams */
...
...
libavformat/avidec.c
View file @
45a8a02a
...
...
@@ -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_s
eek
(
s
->
pb
,
size
,
SEEK_CUR
);
avio_s
kip
(
s
->
pb
,
size
);
}
break
;
}
default:
avio_s
eek
(
s
->
pb
,
size
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
size
,
SEEK_CUR
);
avio_s
kip
(
pb
,
size
);
avi_metadata_creation_time
(
&
s
->
metadata
,
date
);
break
;
}
case
MKTAG
(
'd'
,
'm'
,
'l'
,
'h'
):
avi
->
is_odml
=
1
;
avio_s
eek
(
pb
,
size
+
(
size
&
1
)
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
2
*
4
,
SEEK_CUR
);
avio_s
kip
(
pb
,
2
*
4
);
avio_rl32
(
pb
);
avio_rl32
(
pb
);
avih_width
=
avio_rl32
(
pb
);
avih_height
=
avio_rl32
(
pb
);
avio_s
eek
(
pb
,
size
-
10
*
4
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
size
-
8
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
3
*
4
,
SEEK_CUR
);
avio_s
kip
(
pb
,
3
*
4
);
ast
->
scale
=
avio_rl32
(
pb
);
ast
->
rate
=
avio_rl32
(
pb
);
avio_s
eek
(
pb
,
4
,
SEEK_CUR
);
/* start time */
avio_s
kip
(
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_s
eek
(
pb
,
size
-
9
*
4
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
size
-
12
*
4
,
SEEK_CUR
);
avio_s
kip
(
pb
,
size
-
12
*
4
);
break
;
case
MKTAG
(
's'
,
't'
,
'r'
,
'f'
):
/* stream header */
if
(
stream_index
>=
(
unsigned
)
s
->
nb_streams
||
avi
->
dv_demux
)
{
avio_s
eek
(
pb
,
size
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
size
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(pb, size - 5 * 4
, SEEK_CUR
);
// avio_s
kip
(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_s
eek
(
pb
,
1
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
size
,
SEEK_CUR
);
avio_s
kip
(
pb
,
size
);
break
;
}
}
...
...
@@ -693,7 +693,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
}
size
-=
9
*
4
;
}
avio_s
eek
(
pb
,
size
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
size
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
desc_len
-
ret
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
size
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
4
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
size
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
size
,
SEEK_CUR
);
avio_s
kip
(
pb
,
size
);
goto
resync
;
}
...
...
@@ -1225,7 +1225,7 @@ static int avi_load_index(AVFormatContext *s)
default:
skip:
size
+=
(
size
&
1
);
if
(
avio_s
eek
(
pb
,
size
,
SEEK_CUR
)
<
0
)
if
(
avio_s
kip
(
pb
,
size
)
<
0
)
goto
the_end
;
// something is wrong here
break
;
}
...
...
libavformat/avienc.c
View file @
45a8a02a
...
...
@@ -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_s
eek
(
pb
,
8
,
SEEK_CUR
);
avio_s
kip
(
pb
,
8
);
avio_wl32
(
pb
,
avi
->
riff_id
);
/* nEntriesInUse */
avio_s
eek
(
pb
,
16
*
avi
->
riff_id
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
16
,
SEEK_CUR
);
avio_s
kip
(
pb
,
16
);
for
(
n
=
nb_frames
=
0
;
n
<
s
->
nb_streams
;
n
++
)
{
AVCodecContext
*
stream
=
s
->
streams
[
n
]
->
codec
;
...
...
libavformat/avs.c
View file @
45a8a02a
...
...
@@ -61,7 +61,7 @@ static int avs_read_header(AVFormatContext * s, AVFormatParameters * ap)
s
->
ctx_flags
|=
AVFMTCTX_NOHEADER
;
avio_s
eek
(
s
->
pb
,
4
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
s
->
pb
,
size
-
4
,
SEEK_CUR
);
avio_s
kip
(
s
->
pb
,
size
-
4
);
}
}
}
...
...
libavformat/bethsoftvid.c
View file @
45a8a02a
...
...
@@ -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_s
eek
(
pb
,
5
,
SEEK_CUR
);
avio_s
kip
(
pb
,
5
);
vid
->
nframes
=
avio_rl16
(
pb
);
stream
=
av_new_stream
(
s
,
0
);
...
...
libavformat/bfi.c
View file @
45a8a02a
...
...
@@ -65,19 +65,19 @@ static int bfi_read_header(AVFormatContext * s, AVFormatParameters * ap)
return
AVERROR
(
ENOMEM
);
/* Set the total number of frames. */
avio_s
eek
(
pb
,
8
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
12
,
SEEK_CUR
);
avio_s
kip
(
pb
,
12
);
vstream
->
codec
->
width
=
avio_rl32
(
pb
);
vstream
->
codec
->
height
=
avio_rl32
(
pb
);
/*Load the palette to extradata */
avio_s
eek
(
pb
,
8
,
SEEK_CUR
);
avio_s
kip
(
pb
,
8
);
vstream
->
codec
->
extradata
=
av_malloc
(
768
);
vstream
->
codec
->
extradata_size
=
768
;
avio_read
(
pb
,
vstream
->
codec
->
extradata
,
...
...
libavformat/bink.c
View file @
45a8a02a
...
...
@@ -98,7 +98,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
return
AVERROR
(
EIO
);
}
avio_s
eek
(
pb
,
4
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
4
*
bink
->
num_audio_tracks
,
SEEK_CUR
);
avio_s
kip
(
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_s
eek
(
pb
,
4
,
SEEK_CUR
);
avio_s
kip
(
pb
,
4
);
bink
->
current_track
=
-
1
;