X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Favio.h;h=bf74f2bbbe45e009314070ec9a6bb3d2cc90055e;hb=eb45a2188fb8d018bb5fbb0b54706c9e7b6a3749;hp=dcb8dcdf93ade80ba2bb767f2f008fb26ac168cc;hpb=bad70b7af6b909691f5389e14eb7d0c03db10af9;p=ffmpeg diff --git a/libavformat/avio.h b/libavformat/avio.h index dcb8dcdf93a..bf74f2bbbe4 100644 --- a/libavformat/avio.h +++ b/libavformat/avio.h @@ -349,6 +349,30 @@ typedef struct AVIOContext { * Try to buffer at least this amount of data before flushing it */ int min_packet_size; + + /** + * If set, all output will be wrapped in the Metacube format, + * for consumption by the Cubemap reflector. This is so that Cubemap + * can know what the header is, and where it is possible to start + * the stream (ie., from keyframes) without actually parsing and + * understanding the mux. Only relevant if write_flag is set. + * + * When wrapping in Metacube, s->buffer will have room for a 16-byte + * Metacube header while writing, which is constructed in avio_flush() + * before sending. This header is invisible to the calling code; + * e.g., it will not be counted in seeks and similar. + */ + int metacube; + + /** + * If the metacube flag is set, we need to know whether we've seen + * at least one sync point marker (AVIO_DATA_MARKER_SYNC_POINT), + * as many muxes don't send them out at all. If we haven't seen any sync + * point markers, we assume that all packets (in particular + * AVIO_DATA_MARKER_UNKNOWN) are valid sync start points. + * (This may not hold for all codecs in practice.) + */ + int seen_sync_point; } AVIOContext; /** @@ -571,9 +595,29 @@ int64_t avio_size(AVIOContext *s); */ int avio_feof(AVIOContext *s); -/** @warning Writes up to 4 KiB per call */ +/** + * Writes a formatted string to the context. + * @return number of bytes written, < 0 on error. + */ int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3); +/** + * Write a NULL terminated array of strings to the context. + * Usually you don't need to use this function directly but its macro wrapper, + * avio_print. + */ +void avio_print_string_array(AVIOContext *s, const char *strings[]); + +/** + * Write strings (const char *) to the context. + * This is a convenience macro around avio_print_string_array and it + * automatically creates the string array from the variable argument list. + * For simple string concatenations this function is more performant than using + * avio_printf since it does not need a temporary buffer. + */ +#define avio_print(s, ...) \ + avio_print_string_array(s, (const char*[]){__VA_ARGS__, NULL}) + /** * Force flushing of buffered data. * @@ -672,6 +716,12 @@ int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); */ #define AVIO_FLAG_NONBLOCK 8 +/** + * If set, all output will be wrapped in the Metacube format. + * See AVIOContext::metacube for more information. + */ +#define AVIO_FLAG_METACUBE 16 + /** * Use direct mode. * avio_read and avio_write should if possible be satisfied directly @@ -787,6 +837,13 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); */ const char *avio_enum_protocols(void **opaque, int output); +/** + * Get AVClass by names of available protocols. + * + * @return A AVClass of input protocol name or NULL + */ +const AVClass *avio_protocol_get_class(const char *name); + /** * Pause and resume playing - only meaningful if using a network streaming * protocol (e.g. MMS).