123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- #ifndef AVUTIL_BPRINT_H
- #define AVUTIL_BPRINT_H
- #include <stdarg.h>
- #include "attributes.h"
- #include "avstring.h"
- #define FF_PAD_STRUCTURE(name, size, ...) \
- struct ff_pad_helper_##name { __VA_ARGS__ }; \
- typedef struct name { \
- __VA_ARGS__ \
- char reserved_padding[size - sizeof(struct ff_pad_helper_##name)]; \
- } name;
- FF_PAD_STRUCTURE(AVBPrint, 1024,
- char *str;
- unsigned len;
- unsigned size;
- unsigned size_max;
- char reserved_internal_buffer[1];
- )
- #define AV_BPRINT_SIZE_UNLIMITED ((unsigned)-1)
- #define AV_BPRINT_SIZE_AUTOMATIC 1
- #define AV_BPRINT_SIZE_COUNT_ONLY 0
- void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max);
- void av_bprint_init_for_buffer(AVBPrint *buf, char *buffer, unsigned size);
- void av_bprintf(AVBPrint *buf, const char *fmt, ...) av_printf_format(2, 3);
- void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg);
- void av_bprint_chars(AVBPrint *buf, char c, unsigned n);
- void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size);
- struct tm;
- void av_bprint_strftime(AVBPrint *buf, const char *fmt, const struct tm *tm);
- void av_bprint_get_buffer(AVBPrint *buf, unsigned size,
- unsigned char **mem, unsigned *actual_size);
- void av_bprint_clear(AVBPrint *buf);
- static inline int av_bprint_is_complete(const AVBPrint *buf)
- {
- return buf->len < buf->size;
- }
- int av_bprint_finalize(AVBPrint *buf, char **ret_str);
- void av_bprint_escape(AVBPrint *dstbuf, const char *src, const char *special_chars,
- enum AVEscapeMode mode, int flags);
- #endif
|