Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
76aa876e
Commit
76aa876e
authored
Mar 04, 2011
by
Anton Khirnov
Committed by
Ronald S. Bultje
Mar 07, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avio: avio_ prefix for url_fsize
Signed-off-by:
Ronald S. Bultje
<
rsbultje@gmail.com
>
parent
e5197539
Show whitespace changes
Inline
Side-by-side
Showing
25 changed files
with
37 additions
and
32 deletions
+37
-32
ffmpeg.c
ffmpeg.c
+2
-2
ffplay.c
ffplay.c
+1
-1
apetag.c
libavformat/apetag.c
+1
-1
avidec.c
libavformat/avidec.c
+4
-4
avio.h
libavformat/avio.h
+2
-1
aviobuf.c
libavformat/aviobuf.c
+5
-1
cafdec.c
libavformat/cafdec.c
+1
-1
cdg.c
libavformat/cdg.c
+1
-1
dv.c
libavformat/dv.c
+1
-1
ffmdec.c
libavformat/ffmdec.c
+1
-1
filmstripdec.c
libavformat/filmstripdec.c
+1
-1
flvdec.c
libavformat/flvdec.c
+1
-1
gxfenc.c
libavformat/gxfenc.c
+1
-1
id3v1.c
libavformat/id3v1.c
+1
-1
img2.c
libavformat/img2.c
+1
-1
libnut.c
libavformat/libnut.c
+1
-1
mov.c
libavformat/mov.c
+2
-2
nutdec.c
libavformat/nutdec.c
+1
-1
oggdec.c
libavformat/oggdec.c
+1
-1
r3d.c
libavformat/r3d.c
+1
-1
sauce.c
libavformat/sauce.c
+1
-1
tty.c
libavformat/tty.c
+1
-1
utils.c
libavformat/utils.c
+3
-3
vocdec.c
libavformat/vocdec.c
+1
-1
yop.c
libavformat/yop.c
+1
-1
No files found.
ffmpeg.c
View file @
76aa876e
...
...
@@ -1350,8 +1350,8 @@ static void print_report(AVFormatContext **output_files,
oc
=
output_files
[
0
];
total_size
=
url_f
size
(
oc
->
pb
);
if
(
total_size
<
0
)
// FIXME improve
url_f
size() so it works with non seekable output too
total_size
=
avio_
size
(
oc
->
pb
);
if
(
total_size
<
0
)
// FIXME improve
avio_
size() so it works with non seekable output too
total_size
=
avio_tell
(
oc
->
pb
);
buf
[
0
]
=
'\0'
;
...
...
ffplay.c
View file @
76aa876e
...
...
@@ -2838,7 +2838,7 @@ static void event_loop(void)
}
if
(
cur_stream
)
{
if
(
seek_by_bytes
||
cur_stream
->
ic
->
duration
<=
0
){
uint64_t
size
=
url_f
size
(
cur_stream
->
ic
->
pb
);
uint64_t
size
=
avio_
size
(
cur_stream
->
ic
->
pb
);
stream_seek
(
cur_stream
,
size
*
x
/
cur_stream
->
width
,
0
,
1
);
}
else
{
int64_t
ts
;
...
...
libavformat/apetag.c
View file @
76aa876e
...
...
@@ -66,7 +66,7 @@ static int ape_tag_read_field(AVFormatContext *s)
void
ff_ape_parse_tag
(
AVFormatContext
*
s
)
{
AVIOContext
*
pb
=
s
->
pb
;
int
file_size
=
url_f
size
(
pb
);
int
file_size
=
avio_
size
(
pb
);
uint32_t
val
,
fields
,
tag_bytes
;
uint8_t
buf
[
8
];
int
i
;
...
...
libavformat/avidec.c
View file @
76aa876e
...
...
@@ -138,7 +138,7 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){
AVIStream
*
ast
;
int
i
;
int64_t
last_pos
=
-
1
;
int64_t
filesize
=
url_f
size
(
s
->
pb
);
int64_t
filesize
=
avio_
size
(
s
->
pb
);
#ifdef DEBUG_SEEK
av_log
(
s
,
AV_LOG_ERROR
,
"longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16"
PRIX64
"
\n
"
,
...
...
@@ -351,7 +351,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
if
(
get_riff
(
s
,
pb
)
<
0
)
return
-
1
;
avi
->
fsize
=
url_f
size
(
pb
);
avi
->
fsize
=
avio_
size
(
pb
);
if
(
avi
->
fsize
<=
0
)
avi
->
fsize
=
avi
->
riff_end
==
8
?
INT64_MAX
:
avi
->
riff_end
;
...
...
@@ -378,7 +378,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
if
(
tag1
==
MKTAG
(
'm'
,
'o'
,
'v'
,
'i'
))
{
avi
->
movi_list
=
avio_tell
(
pb
)
-
4
;
if
(
size
)
avi
->
movi_end
=
avi
->
movi_list
+
size
+
(
size
&
1
);
else
avi
->
movi_end
=
url_f
size
(
pb
);
else
avi
->
movi_end
=
avio_
size
(
pb
);
av_dlog
(
NULL
,
"movi end=%"
PRIx64
"
\n
"
,
avi
->
movi_end
);
goto
end_of_header
;
}
...
...
@@ -705,7 +705,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
av_log
(
s
,
AV_LOG_ERROR
,
"Something went wrong during header parsing, "
"I will ignore it and try to continue anyway.
\n
"
);
avi
->
movi_list
=
avio_tell
(
pb
)
-
4
;
avi
->
movi_end
=
url_f
size
(
pb
);
avi
->
movi_end
=
avio_
size
(
pb
);
goto
end_of_header
;
}
/* skip tag */
...
...
libavformat/avio.h
View file @
76aa876e
...
...
@@ -426,6 +426,7 @@ attribute_deprecated int url_fclose(AVIOContext *s);
attribute_deprecated
int64_t
url_fseek
(
AVIOContext
*
s
,
int64_t
offset
,
int
whence
);
attribute_deprecated
int
url_fskip
(
AVIOContext
*
s
,
int64_t
offset
);
attribute_deprecated
int64_t
url_ftell
(
AVIOContext
*
s
);
attribute_deprecated
int64_t
url_fsize
(
AVIOContext
*
s
);
#define URL_EOF (-1)
attribute_deprecated
int
url_fgetc
(
AVIOContext
*
s
);
/**
...
...
@@ -491,7 +492,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence);
* Get the filesize.
* @return filesize or AVERROR
*/
int64_t
url_f
size
(
AVIOContext
*
s
);
int64_t
avio_
size
(
AVIOContext
*
s
);
/**
* feof() equivalent for AVIOContext.
...
...
libavformat/aviobuf.c
View file @
76aa876e
...
...
@@ -246,7 +246,7 @@ int64_t url_ftell(AVIOContext *s)
}
#endif
int64_t
url_f
size
(
AVIOContext
*
s
)
int64_t
avio_
size
(
AVIOContext
*
s
)
{
int64_t
size
;
...
...
@@ -371,6 +371,10 @@ int64_t url_fseek(AVIOContext *s, int64_t offset, int whence)
{
return
avio_seek
(
s
,
offset
,
whence
);
}
int64_t
url_fsize
(
AVIOContext
*
s
)
{
return
avio_size
(
s
);
}
#endif
int
avio_put_str
(
AVIOContext
*
s
,
const
char
*
str
)
...
...
libavformat/cafdec.c
View file @
76aa876e
...
...
@@ -284,7 +284,7 @@ static int read_header(AVFormatContext *s,
"block size or frame size are variable.
\n
"
);
return
AVERROR_INVALIDDATA
;
}
s
->
file_size
=
url_f
size
(
pb
);
s
->
file_size
=
avio_
size
(
pb
);
s
->
file_size
=
FFMAX
(
0
,
s
->
file_size
);
av_set_pts_info
(
st
,
64
,
1
,
st
->
codec
->
sample_rate
);
...
...
libavformat/cdg.c
View file @
76aa876e
...
...
@@ -38,7 +38,7 @@ static int read_header(AVFormatContext *s, AVFormatParameters *ap)
/// 75 sectors/sec * 4 packets/sector = 300 packets/sec
av_set_pts_info
(
vst
,
32
,
1
,
300
);
ret
=
url_f
size
(
s
->
pb
);
ret
=
avio_
size
(
s
->
pb
);
if
(
ret
>
0
)
vst
->
duration
=
(
ret
*
vst
->
time_base
.
den
)
/
(
CDG_PACKET_SIZE
*
300
);
...
...
libavformat/dv.c
View file @
76aa876e
...
...
@@ -370,7 +370,7 @@ static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,
// FIXME: sys may be wrong if last dv_read_packet() failed (buffer is junk)
const
DVprofile
*
sys
=
ff_dv_codec_profile
(
c
->
vst
->
codec
);
int64_t
offset
;
int64_t
size
=
url_f
size
(
s
->
pb
)
-
s
->
data_offset
;
int64_t
size
=
avio_
size
(
s
->
pb
)
-
s
->
data_offset
;
int64_t
max_offset
=
((
size
-
1
)
/
sys
->
frame_size
)
*
sys
->
frame_size
;
offset
=
sys
->
frame_size
*
timestamp
;
...
...
libavformat/ffmdec.c
View file @
76aa876e
...
...
@@ -282,7 +282,7 @@ static int ffm_read_header(AVFormatContext *s, AVFormatParameters *ap)
ffm
->
write_index
=
avio_rb64
(
pb
);
/* get also filesize */
if
(
!
url_is_streamed
(
pb
))
{
ffm
->
file_size
=
url_f
size
(
pb
);
ffm
->
file_size
=
avio_
size
(
pb
);
if
(
ffm
->
write_index
)
adjust_write_index
(
s
);
}
else
{
...
...
libavformat/filmstripdec.c
View file @
76aa876e
...
...
@@ -43,7 +43,7 @@ static int read_header(AVFormatContext *s,
if
(
url_is_streamed
(
s
->
pb
))
return
AVERROR
(
EIO
);
avio_seek
(
pb
,
url_f
size
(
pb
)
-
36
,
SEEK_SET
);
avio_seek
(
pb
,
avio_
size
(
pb
)
-
36
,
SEEK_SET
);
if
(
avio_rb32
(
pb
)
!=
RAND_TAG
)
{
av_log
(
s
,
AV_LOG_ERROR
,
"magic number not found"
);
return
AVERROR_INVALIDDATA
;
...
...
libavformat/flvdec.c
View file @
76aa876e
...
...
@@ -373,7 +373,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
if
(
!
url_is_streamed
(
s
->
pb
)
&&
(
!
s
->
duration
||
s
->
duration
==
AV_NOPTS_VALUE
)){
int
size
;
const
int64_t
pos
=
avio_tell
(
s
->
pb
);
const
int64_t
fsize
=
url_f
size
(
s
->
pb
);
const
int64_t
fsize
=
avio_
size
(
s
->
pb
);
avio_seek
(
s
->
pb
,
fsize
-
4
,
SEEK_SET
);
size
=
avio_rb32
(
s
->
pb
);
avio_seek
(
s
->
pb
,
fsize
-
3
-
size
,
SEEK_SET
);
...
...
libavformat/gxfenc.c
View file @
76aa876e
...
...
@@ -310,7 +310,7 @@ static int gxf_write_material_data_section(AVFormatContext *s)
/* estimated size */
avio_w8
(
pb
,
MAT_SIZE
);
avio_w8
(
pb
,
4
);
avio_wb32
(
pb
,
url_f
size
(
pb
)
/
1024
);
avio_wb32
(
pb
,
avio_
size
(
pb
)
/
1024
);
return
updateSize
(
pb
,
pos
);
}
...
...
libavformat/id3v1.c
View file @
76aa876e
...
...
@@ -230,7 +230,7 @@ void ff_id3v1_read(AVFormatContext *s)
if
(
!
url_is_streamed
(
s
->
pb
))
{
/* XXX: change that */
filesize
=
url_f
size
(
s
->
pb
);
filesize
=
avio_
size
(
s
->
pb
);
if
(
filesize
>
128
)
{
avio_seek
(
s
->
pb
,
filesize
-
128
,
SEEK_SET
);
ret
=
avio_read
(
s
->
pb
,
buf
,
ID3v1_TAG_SIZE
);
...
...
libavformat/img2.c
View file @
76aa876e
...
...
@@ -276,7 +276,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
av_log
(
s1
,
AV_LOG_ERROR
,
"Could not open file : %s
\n
"
,
filename
);
return
AVERROR
(
EIO
);
}
size
[
i
]
=
url_f
size
(
f
[
i
]);
size
[
i
]
=
avio_
size
(
f
[
i
]);
if
(
codec
->
codec_id
!=
CODEC_ID_RAWVIDEO
)
break
;
...
...
libavformat/libnut.c
View file @
76aa876e
...
...
@@ -179,7 +179,7 @@ static size_t av_read(void * h, size_t len, uint8_t * buf) {
static
off_t
av_seek
(
void
*
h
,
long
long
pos
,
int
whence
)
{
AVIOContext
*
bc
=
h
;
if
(
whence
==
SEEK_END
)
{
pos
=
url_f
size
(
bc
)
+
pos
;
pos
=
avio_
size
(
bc
)
+
pos
;
whence
=
SEEK_SET
;
}
return
avio_seek
(
bc
,
pos
,
whence
);
...
...
libavformat/mov.c
View file @
76aa876e
...
...
@@ -304,7 +304,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
if
(
err
<
0
)
return
err
;
if
(
c
->
found_moov
&&
c
->
found_mdat
&&
(
url_is_streamed
(
pb
)
||
start_pos
+
a
.
size
==
url_f
size
(
pb
)))
(
url_is_streamed
(
pb
)
||
start_pos
+
a
.
size
==
avio_
size
(
pb
)))
return
0
;
left
=
a
.
size
-
avio_tell
(
pb
)
+
start_pos
;
if
(
left
>
0
)
/* skip garbage at atom end */
...
...
@@ -2351,7 +2351,7 @@ static int mov_read_header(AVFormatContext *s, AVFormatParameters *ap)
mov
->
fc
=
s
;
/* .mov and .mp4 aren't streamable anyway (only progressive download if moov is before mdat) */
if
(
!
url_is_streamed
(
pb
))
atom
.
size
=
url_f
size
(
pb
);
atom
.
size
=
avio_
size
(
pb
);
else
atom
.
size
=
INT64_MAX
;
...
...
libavformat/nutdec.c
View file @
76aa876e
...
...
@@ -508,7 +508,7 @@ static int find_and_decode_index(NUTContext *nut){
AVIOContext
*
bc
=
s
->
pb
;
uint64_t
tmp
,
end
;
int
i
,
j
,
syncpoint_count
;
int64_t
filesize
=
url_f
size
(
bc
);
int64_t
filesize
=
avio_
size
(
bc
);
int64_t
*
syncpoints
;
int8_t
*
has_keyframe
;
int
ret
=
-
1
;
...
...
libavformat/oggdec.c
View file @
76aa876e
...
...
@@ -462,7 +462,7 @@ ogg_get_length (AVFormatContext * s)
if
(
s
->
duration
!=
AV_NOPTS_VALUE
)
return
0
;
size
=
url_f
size
(
s
->
pb
);
size
=
avio_
size
(
s
->
pb
);
if
(
size
<
0
)
return
0
;
end
=
size
>
MAX_PAGE_SIZE
?
size
-
MAX_PAGE_SIZE
:
0
;
...
...
libavformat/r3d.c
View file @
76aa876e
...
...
@@ -180,7 +180,7 @@ static int r3d_read_header(AVFormatContext *s, AVFormatParameters *ap)
if
(
url_is_streamed
(
s
->
pb
))
return
0
;
// find REOB/REOF/REOS to load index
avio_seek
(
s
->
pb
,
url_f
size
(
s
->
pb
)
-
48
-
8
,
SEEK_SET
);
avio_seek
(
s
->
pb
,
avio_
size
(
s
->
pb
)
-
48
-
8
,
SEEK_SET
);
if
(
read_atom
(
s
,
&
atom
)
<
0
)
av_log
(
s
,
AV_LOG_ERROR
,
"error reading end atom
\n
"
);
...
...
libavformat/sauce.c
View file @
76aa876e
...
...
@@ -33,7 +33,7 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g
AVIOContext
*
pb
=
avctx
->
pb
;
char
buf
[
36
];
int
datatype
,
filetype
,
t1
,
t2
,
nb_comments
,
flags
;
uint64_t
start_pos
=
url_f
size
(
pb
)
-
128
;
uint64_t
start_pos
=
avio_
size
(
pb
)
-
128
;
avio_seek
(
pb
,
start_pos
,
SEEK_SET
);
if
(
avio_read
(
pb
,
buf
,
7
)
!=
7
)
...
...
libavformat/tty.c
View file @
76aa876e
...
...
@@ -89,7 +89,7 @@ static int read_header(AVFormatContext *avctx,
s
->
chars_per_frame
=
FFMAX
(
av_q2d
(
st
->
time_base
)
*
(
ap
->
sample_rate
?
ap
->
sample_rate
:
LINE_RATE
),
1
);
if
(
!
url_is_streamed
(
avctx
->
pb
))
{
s
->
fsize
=
url_f
size
(
avctx
->
pb
);
s
->
fsize
=
avio_
size
(
avctx
->
pb
);
st
->
duration
=
(
s
->
fsize
+
s
->
chars_per_frame
-
1
)
/
s
->
chars_per_frame
;
if
(
ff_sauce_read
(
avctx
,
&
s
->
fsize
,
0
,
0
)
<
0
)
...
...
libavformat/utils.c
View file @
76aa876e
...
...
@@ -1557,7 +1557,7 @@ int64_t av_gen_search(AVFormatContext *s, int stream_index, int64_t target_ts, i
if
(
ts_max
==
AV_NOPTS_VALUE
){
int
step
=
1024
;
filesize
=
url_f
size
(
s
->
pb
);
filesize
=
avio_
size
(
s
->
pb
);
pos_max
=
filesize
-
1
;
do
{
pos_max
-=
step
;
...
...
@@ -1666,7 +1666,7 @@ static int av_seek_frame_byte(AVFormatContext *s, int stream_index, int64_t pos,
#endif
pos_min
=
s
->
data_offset
;
pos_max
=
url_f
size
(
s
->
pb
)
-
1
;
pos_max
=
avio_
size
(
s
->
pb
)
-
1
;
if
(
pos
<
pos_min
)
pos
=
pos_min
;
else
if
(
pos
>
pos_max
)
pos
=
pos_max
;
...
...
@@ -2007,7 +2007,7 @@ static void av_estimate_timings(AVFormatContext *ic, int64_t old_offset)
if
(
ic
->
iformat
->
flags
&
AVFMT_NOFILE
)
{
file_size
=
0
;
}
else
{
file_size
=
url_f
size
(
ic
->
pb
);
file_size
=
avio_
size
(
ic
->
pb
);
if
(
file_size
<
0
)
file_size
=
0
;
}
...
...
libavformat/vocdec.c
View file @
76aa876e
...
...
@@ -80,7 +80,7 @@ voc_get_packet(AVFormatContext *s, AVPacket *pkt, AVStream *st, int max_size)
if
(
!
voc
->
remaining_size
)
{
if
(
url_is_streamed
(
s
->
pb
))
return
AVERROR
(
EIO
);
voc
->
remaining_size
=
url_f
size
(
pb
)
-
avio_tell
(
pb
);
voc
->
remaining_size
=
avio_
size
(
pb
)
-
avio_tell
(
pb
);
}
max_size
-=
4
;
...
...
libavformat/yop.c
View file @
76aa876e
...
...
@@ -190,7 +190,7 @@ static int yop_read_seek(AVFormatContext *s, int stream_index,
return
-
1
;
pos_min
=
s
->
data_offset
;
pos_max
=
url_f
size
(
s
->
pb
)
-
yop
->
frame_size
;
pos_max
=
avio_
size
(
s
->
pb
)
-
yop
->
frame_size
;
frame_count
=
(
pos_max
-
pos_min
)
/
yop
->
frame_size
;
timestamp
=
FFMAX
(
0
,
FFMIN
(
frame_count
,
timestamp
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment