History

avio: Introduce avio_read_to_bprint(avioctx, bp, max_size)

Andrey Utkin committed 12 years ago

Commit 8a4c0861 parent 01b236b4 files · +32 −2Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavformat/avio.h +9 −0
  3. libavformat/aviobuf.c +18 −0
  4. libavformat/version.h +2 −2
doc/APIchanges+3−0
@@ -15,6 +15,9 @@ libavutil: 2012-10-22 · 14 unmodified lines
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182014-07-23 - XXXXXXX - lavf 55.49.100 - avio.h
19 Add avio_read_to_bprint()
20
182014-07-14 - 62227a7 - lavf 55.47.100 - avformat.h212014-07-14 - 62227a7 - lavf 55.47.100 - avformat.h
19 Add av_stream_get_parser()22 Add av_stream_get_parser()
20 23
libavformat/avio.h+9−0
@@ -31,6 +31,7 @@ · 30 unmodified lines
31#include "libavutil/common.h"31#include "libavutil/common.h"
32#include "libavutil/dict.h"32#include "libavutil/dict.h"
33#include "libavutil/log.h"33#include "libavutil/log.h"
34#include "libavutil/bprint.h"
34 35
35#include "libavformat/version.h"36#include "libavformat/version.h"
36 37
@@ -500,4 +501,12 @@ int avio_pause(AVIOContext *h, int pause); · 463 unmodified lines
500int64_t avio_seek_time(AVIOContext *h, int stream_index,501int64_t avio_seek_time(AVIOContext *h, int stream_index,
501 int64_t timestamp, int flags);502 int64_t timestamp, int flags);
502 503
504/**
505 * Read contents of h into print buffer, up to max_size bytes, or up to EOF.
506 *
507 * @return 0 for success (max_size bytes read or EOF reached), negative error
508 * code otherwise
509 */
510int avio_read_to_bprint(AVIOContext *h, AVBPrint *pb, size_t max_size);
511
503#endif /* AVFORMAT_AVIO_H */512#endif /* AVFORMAT_AVIO_H */
libavformat/aviobuf.c+18−0
@@ -953,6 +953,24 @@ int64_t avio_seek_time(AVIOContext *s, int stream_index, · 952 unmodified lines
953 return ret;953 return ret;
954}954}
955 955
956int avio_read_to_bprint(AVIOContext *h, AVBPrint *pb, size_t max_size)
957{
958 int ret;
959 char buf[1024];
960 while (max_size) {
961 ret = avio_read(h, buf, FFMIN(max_size, sizeof(buf)));
962 if (ret == AVERROR_EOF)
963 return 0;
964 if (ret <= 0)
965 return ret;
966 av_bprint_append_data(pb, buf, ret);
967 if (!av_bprint_is_complete(pb))
968 return AVERROR(ENOMEM);
969 max_size -= ret;
970 }
971 return 0;
972}
973
956/* output in a dynamic buffer */974/* output in a dynamic buffer */
957 975
958typedef struct DynBuffer {976typedef struct DynBuffer {
libavformat/version.h+2−2
@@ -30,8 +30,8 @@ · 29 unmodified lines
30#include "libavutil/version.h"30#include "libavutil/version.h"
31 31
32#define LIBAVFORMAT_VERSION_MAJOR 5532#define LIBAVFORMAT_VERSION_MAJOR 55
33#define LIBAVFORMAT_VERSION_MINOR 4833#define LIBAVFORMAT_VERSION_MINOR 49
34#define LIBAVFORMAT_VERSION_MICRO 10134#define LIBAVFORMAT_VERSION_MICRO 100
35 35
36#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \36#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
37 LIBAVFORMAT_VERSION_MINOR, \37 LIBAVFORMAT_VERSION_MINOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t