History

avformat/avio: remove 4k limit from avio_printf

We do this by switching to AVBPrint. v2: Also set IO context error flag in case of ENOMEM.

Marton Balint committed 7 years ago

Commit 95fa73a1 parent 61b4daf4 files · +19 −7Browse files

Unified · Split

4 files
  1. doc/APIchanges +3 −0
  2. libavformat/avio.h +4 −1
  3. libavformat/aviobuf.c +11 −5
  4. libavformat/version.h +1 −1
doc/APIchanges+3−0
@@ -15,6 +15,9 @@ libavutil: 2017-10-21 · 14 unmodified lines
15 15
16API changes, most recent first:16API changes, most recent first:
17 17
182019-08-xx - xxxxxxxxxx - lavf 58.31.101 - avio.h
19 4K limit removed from avio_printf.
20
182019-08-xx - xxxxxxxxxx - lavf 58.31.100 - avio.h212019-08-xx - xxxxxxxxxx - lavf 58.31.100 - avio.h
19 Add avio_print_string_array and avio_print.22 Add avio_print_string_array and avio_print.
20 23
libavformat/avio.h+4−1
@@ -571,7 +571,10 @@ int64_t avio_size(AVIOContext *s); · 570 unmodified lines
571 */571 */
572int avio_feof(AVIOContext *s);572int avio_feof(AVIOContext *s);
573 573
574/** @warning Writes up to 4 KiB per call */574/**
575 * Writes a formatted string to the context.
576 * @return number of bytes written, < 0 on error.
577 */
575int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3);578int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3);
576 579
577/**580/**
libavformat/aviobuf.c+11−5
@@ -1249,14 +1249,20 @@ int avio_closep(AVIOContext **s) · 1248 unmodified lines
1249int avio_printf(AVIOContext *s, const char *fmt, ...)1249int avio_printf(AVIOContext *s, const char *fmt, ...)
1250{1250{
1251 va_list ap;1251 va_list ap;
1252 char buf[4096]; /* update doc entry in avio.h if changed */1252 AVBPrint bp;
1253 int ret;
1254 1253
1254 av_bprint_init(&bp, 0, INT_MAX);
1255 va_start(ap, fmt);1255 va_start(ap, fmt);
1256 ret = vsnprintf(buf, sizeof(buf), fmt, ap);1256 av_vbprintf(&bp, fmt, ap);
1257 va_end(ap);1257 va_end(ap);
1258 avio_write(s, buf, strlen(buf));1258 if (!av_bprint_is_complete(&bp)) {
1259 return ret;1259 av_bprint_finalize(&bp, NULL);
1260 s->error = AVERROR(ENOMEM);
1261 return AVERROR(ENOMEM);
1262 }
1263 avio_write(s, bp.str, bp.len);
1264 av_bprint_finalize(&bp, NULL);
1265 return bp.len;
1260}1266}
1261 1267
1262void avio_print_string_array(AVIOContext *s, const char *strings[])1268void avio_print_string_array(AVIOContext *s, const char *strings[])
libavformat/version.h+1−1
@@ -33,7 +33,7 @@ · 32 unmodified lines
33// Also please add any ticket numbers that you believe might be affected here33// Also please add any ticket numbers that you believe might be affected here
34#define LIBAVFORMAT_VERSION_MAJOR 5834#define LIBAVFORMAT_VERSION_MAJOR 58
35#define LIBAVFORMAT_VERSION_MINOR 3135#define LIBAVFORMAT_VERSION_MINOR 31
36#define LIBAVFORMAT_VERSION_MICRO 10036#define LIBAVFORMAT_VERSION_MICRO 101
37 37
38#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \38#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
39 LIBAVFORMAT_VERSION_MINOR, \39 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