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
a01ba7f5
Commit
a01ba7f5
authored
Nov 16, 2015
by
Bryan Huh
Committed by
Michael Niedermayer
Nov 16, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/aviobuf: Simplify avio_read() and avio_seek()
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
a01c24e8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
5 deletions
+4
-5
aviobuf.c
libavformat/aviobuf.c
+4
-5
No files found.
libavformat/aviobuf.c
View file @
a01ba7f5
...
...
@@ -234,7 +234,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
/* can do the seek inside the buffer */
s
->
buf_ptr
=
s
->
buffer
+
offset1
;
}
else
if
((
!
s
->
seekable
||
offset1
<=
s
->
buf_end
+
s
->
short_seek_threshold
-
s
->
buffer
)
&&
offset1
<=
buffer_size
+
s
->
short_seek_threshold
)
&&
!
s
->
write_flag
&&
offset1
>=
0
&&
(
!
s
->
direct
||
!
s
->
seek
)
&&
(
whence
!=
SEEK_END
||
force
))
{
...
...
@@ -242,7 +242,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fill_buffer
(
s
);
if
(
s
->
eof_reached
)
return
AVERROR_EOF
;
s
->
buf_ptr
=
s
->
buf_end
+
offset
-
s
->
pos
;
s
->
buf_ptr
=
s
->
buf_end
-
(
s
->
pos
-
offset
)
;
}
else
if
(
!
s
->
write_flag
&&
offset1
<
0
&&
-
offset1
<
buffer_size
>>
1
&&
s
->
seek
&&
offset
>
0
)
{
int64_t
res
;
...
...
@@ -542,14 +542,13 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size)
size1
=
size
;
while
(
size
>
0
)
{
len
=
s
->
buf_end
-
s
->
buf_ptr
;
if
(
len
>
size
)
len
=
size
;
len
=
FFMIN
(
s
->
buf_end
-
s
->
buf_ptr
,
size
);
if
(
len
==
0
||
s
->
write_flag
)
{
if
((
s
->
direct
||
size
>
s
->
buffer_size
)
&&
!
s
->
update_checksum
)
{
// bypass the buffer and read data directly into buf
if
(
s
->
read_packet
)
len
=
s
->
read_packet
(
s
->
opaque
,
buf
,
size
);
if
(
len
<=
0
)
{
/* do not modify buffer if EOF reached so that a seek back can
be done without rereading data */
...
...
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