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
00088 #define AV_BPRINT_SIZE_UNLIMITED ((unsigned)-1)
00089 #define AV_BPRINT_SIZE_AUTOMATIC 1
00090 #define AV_BPRINT_SIZE_COUNT_ONLY 0
00091
00105 void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max);
00106
00116 void av_bprint_init_for_buffer(AVBPrint *buf, char *buffer, unsigned size);
00117
00121 void av_bprintf(AVBPrint *buf, const char *fmt, ...) av_printf_format(2, 3);
00122
00126 void av_bprint_chars(AVBPrint *buf, char c, unsigned n);
00127
00131 void av_bprint_clear(AVBPrint *buf);
00132
00139 static inline int av_bprint_is_complete(AVBPrint *buf)
00140 {
00141 return buf->len < buf->size;
00142 }
00143
00155 int av_bprint_finalize(AVBPrint *buf, char **ret_str);
00156
00157 #endif