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
fcd1f6bc
Commit
fcd1f6bc
authored
Jul 03, 2014
by
Andrey Utkin
Committed by
Michael Niedermayer
Jul 07, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avutil/bprint: Add av_bprint_fd_contents()
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
06dae71d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
2 deletions
+26
-2
bprint.c
libavutil/bprint.c
+17
-0
bprint.h
libavutil/bprint.h
+7
-0
version.h
libavutil/version.h
+2
-2
No files found.
libavutil/bprint.c
View file @
fcd1f6bc
...
...
@@ -22,6 +22,7 @@
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include "avassert.h"
#include "avstring.h"
#include "bprint.h"
...
...
@@ -304,6 +305,22 @@ void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_cha
}
}
int
av_bprint_fd_contents
(
AVBPrint
*
pb
,
int
fd
)
{
int
ret
;
char
buf
[
1024
];
while
(
1
)
{
ret
=
read
(
fd
,
buf
,
sizeof
(
buf
));
if
(
!
ret
)
return
0
;
else
if
(
ret
<
0
)
return
AVERROR
(
errno
);
av_bprint_append_data
(
pb
,
buf
,
ret
);
if
(
!
av_bprint_is_complete
(
pb
))
return
AVERROR
(
ENOMEM
);
}
}
#ifdef TEST
#undef printf
...
...
libavutil/bprint.h
View file @
fcd1f6bc
...
...
@@ -213,4 +213,11 @@ int av_bprint_finalize(AVBPrint *buf, char **ret_str);
void
av_bprint_escape
(
AVBPrint
*
dstbuf
,
const
char
*
src
,
const
char
*
special_chars
,
enum
AVEscapeMode
mode
,
int
flags
);
/**
* Read contents of fd into print buffer up to EOF.
*
* @return 0 for success, error code otherwise
*/
int
av_bprint_fd_contents
(
AVBPrint
*
pb
,
int
fd
);
#endif
/* AVUTIL_BPRINT_H */
libavutil/version.h
View file @
fcd1f6bc
...
...
@@ -56,8 +56,8 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 52
#define LIBAVUTIL_VERSION_MINOR 9
0
#define LIBAVUTIL_VERSION_MICRO 10
1
#define LIBAVUTIL_VERSION_MINOR 9
1
#define LIBAVUTIL_VERSION_MICRO 10
0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \
...
...
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