00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef AVUTIL_BPRINT_H
00022 #define AVUTIL_BPRINT_H
00023
00024 #include "attributes.h"
00025
00030 #define FF_PAD_STRUCTURE(size, ...) \
00031 __VA_ARGS__ \
00032 char reserved_padding[size - sizeof(struct { __VA_ARGS__ })];
00033
00074 typedef struct AVBPrint {
00075 FF_PAD_STRUCTURE(1024,
00076 char *str;
00077 unsigned len;
00078 unsigned size;
00079 unsigned size_max;
00080 char reserved_internal_buffer[1];
00081 )
00082 } AVBPrint;
00083
00093 void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max);
00094
00098 #define AV_BPRINT_SIZE_UNLIMITED ((unsigned)-1)
00099 #define AV_BPRINT_SIZE_AUTOMATIC 1
00100 #define AV_BPRINT_SIZE_COUNT_ONLY 0
00101
00105 void av_bprintf(AVBPrint *buf, const char *fmt, ...) av_printf_format(2, 3);
00106
00110 void av_bprint_chars(AVBPrint *buf, char c, unsigned n);
00111
00115 void av_bprint_clear(AVBPrint *buf);
00116
00123 static inline int av_bprint_is_complete(AVBPrint *buf)
00124 {
00125 return buf->len < buf->size;
00126 }
00127
00139 int av_bprint_finalize(AVBPrint *buf, char **ret_str);
00140
00141 #endif