Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
bff0349d
Commit
bff0349d
authored
May 26, 2015
by
Vittorio Giovara
Committed by
Luca Barbato
May 31, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avio: Add avio_read wrapper to simplify error checking
Signed-off-by:
Luca Barbato
<
lu_zero@gentoo.org
>
parent
cffb9ea8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
0 deletions
+15
-0
avio_internal.h
libavformat/avio_internal.h
+7
-0
aviobuf.c
libavformat/aviobuf.c
+8
-0
No files found.
libavformat/avio_internal.h
View file @
bff0349d
...
@@ -85,6 +85,13 @@ int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size
...
@@ -85,6 +85,13 @@ int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char *buf, int buf_size
uint64_t
ffio_read_varlen
(
AVIOContext
*
bc
);
uint64_t
ffio_read_varlen
(
AVIOContext
*
bc
);
/**
* Read size bytes from AVIOContext into buf.
* Check that exactly size bytes have been read.
* @return number of bytes read or AVERROR
*/
int
ffio_read_size
(
AVIOContext
*
s
,
unsigned
char
*
buf
,
int
size
);
/** @warning must be called before any I/O */
/** @warning must be called before any I/O */
int
ffio_set_buf_size
(
AVIOContext
*
s
,
int
buf_size
);
int
ffio_set_buf_size
(
AVIOContext
*
s
,
int
buf_size
);
...
...
libavformat/aviobuf.c
View file @
bff0349d
...
@@ -496,6 +496,14 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size)
...
@@ -496,6 +496,14 @@ int avio_read(AVIOContext *s, unsigned char *buf, int size)
return
size1
-
size
;
return
size1
-
size
;
}
}
int
ffio_read_size
(
AVIOContext
*
s
,
unsigned
char
*
buf
,
int
size
)
{
int
ret
=
avio_read
(
s
,
buf
,
size
);
if
(
ret
!=
size
)
return
AVERROR_INVALIDDATA
;
return
ret
;
}
int
ffio_read_indirect
(
AVIOContext
*
s
,
unsigned
char
*
buf
,
int
size
,
const
unsigned
char
**
data
)
int
ffio_read_indirect
(
AVIOContext
*
s
,
unsigned
char
*
buf
,
int
size
,
const
unsigned
char
**
data
)
{
{
if
(
s
->
buf_end
-
s
->
buf_ptr
>=
size
&&
!
s
->
write_flag
)
{
if
(
s
->
buf_end
-
s
->
buf_ptr
>=
size
&&
!
s
->
write_flag
)
{
...
...
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