Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Andrey Utkin authored on 2014/07/23 22:12:38... | ... |
@@ -31,6 +31,7 @@ |
31 | 31 |
#include "libavutil/common.h" |
32 | 32 |
#include "libavutil/dict.h" |
33 | 33 |
#include "libavutil/log.h" |
34 |
+#include "libavutil/bprint.h" |
|
34 | 35 |
|
35 | 36 |
#include "libavformat/version.h" |
36 | 37 |
|
... | ... |
@@ -500,4 +501,12 @@ int avio_pause(AVIOContext *h, int pause); |
500 | 500 |
int64_t avio_seek_time(AVIOContext *h, int stream_index, |
501 | 501 |
int64_t timestamp, int flags); |
502 | 502 |
|
503 |
+/** |
|
504 |
+ * Read contents of h into print buffer, up to max_size bytes, or up to EOF. |
|
505 |
+ * |
|
506 |
+ * @return 0 for success (max_size bytes read or EOF reached), negative error |
|
507 |
+ * code otherwise |
|
508 |
+ */ |
|
509 |
+int avio_read_to_bprint(AVIOContext *h, AVBPrint *pb, size_t max_size); |
|
510 |
+ |
|
503 | 511 |
#endif /* AVFORMAT_AVIO_H */ |
... | ... |
@@ -953,6 +953,24 @@ int64_t avio_seek_time(AVIOContext *s, int stream_index, |
953 | 953 |
return ret; |
954 | 954 |
} |
955 | 955 |
|
956 |
+int 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 | 974 |
/* output in a dynamic buffer */ |
957 | 975 |
|
958 | 976 |
typedef struct DynBuffer { |
... | ... |
@@ -30,8 +30,8 @@ |
30 | 30 |
#include "libavutil/version.h" |
31 | 31 |
|
32 | 32 |
#define LIBAVFORMAT_VERSION_MAJOR 55 |
33 |
-#define LIBAVFORMAT_VERSION_MINOR 48 |
|
34 |
-#define LIBAVFORMAT_VERSION_MICRO 101 |
|
33 |
+#define LIBAVFORMAT_VERSION_MINOR 49 |
|
34 |
+#define LIBAVFORMAT_VERSION_MICRO 100 |
|
35 | 35 |
|
36 | 36 |
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ |
37 | 37 |
LIBAVFORMAT_VERSION_MINOR, \ |