36#define IO_BUFFER_SIZE 32768
43#define SHORT_SEEK_THRESHOLD 32768
55 int (*
read_packet)(
void *opaque, uint8_t *buf,
int buf_size),
56 int (*
write_packet)(
void *opaque,
const uint8_t *buf,
int buf_size),
61 memset(
ctx, 0,
sizeof(*
ctx));
64 ctx->orig_buffer_size =
65 s->buffer_size = buffer_size;
80 s->min_packet_size = 0;
81 s->max_packet_size = 0;
82 s->update_checksum =
NULL;
87 s->buf_end =
s->buffer + buffer_size;
92 s->write_data_type =
NULL;
93 s->ignore_boundary_point = 0;
114 int (*
read_packet)(
void *opaque, uint8_t *buf,
int buf_size),
115 int (*
write_packet)(
void *opaque,
const uint8_t *buf,
int buf_size),
141 if (
s->write_data_type)
142 ret =
s->write_data_type(
s->opaque,
data,
146 else if (
s->write_packet)
147 ret =
s->write_packet(
s->opaque,
data,
len);
151 ctx->bytes_written +=
len;
152 s->bytes_written =
ctx->bytes_written;
154 if (
s->pos +
len >
ctx->written_output_size) {
155 ctx->written_output_size =
s->pos +
len;
164 ctx->writeout_count++;
170 s->buf_ptr_max =
FFMAX(
s->buf_ptr,
s->buf_ptr_max);
171 if (
s->write_flag &&
s->buf_ptr_max >
s->buffer) {
173 if (
s->update_checksum) {
174 s->checksum =
s->update_checksum(
s->checksum,
s->checksum_ptr,
175 s->buf_ptr_max -
s->checksum_ptr);
176 s->checksum_ptr =
s->buffer;
179 s->buf_ptr =
s->buf_ptr_max =
s->buffer;
181 s->buf_end =
s->buffer;
188 if (
s->buf_ptr >=
s->buf_end)
195 int len =
FFMIN(
s->buf_end -
s->buf_ptr, count);
196 memset(
s->buf_ptr,
b,
len);
199 if (
s->buf_ptr >=
s->buf_end)
210 if (
s->direct && !
s->update_checksum) {
217 memcpy(
s->buf_ptr, buf,
len);
220 if (
s->buf_ptr >=
s->buf_end)
230 int seekback =
s->write_flag ?
FFMIN(0,
s->buf_ptr -
s->buf_ptr_max) : 0;
251 buffer_size =
s->buf_end -
s->buffer;
253 pos =
s->pos - (
s->write_flag ? 0 : buffer_size);
255 if (whence != SEEK_CUR && whence != SEEK_SET)
258 if (whence == SEEK_CUR) {
259 offset1 =
pos + (
s->buf_ptr -
s->buffer);
262 if (
offset > INT64_MAX - offset1)
269 short_seek =
ctx->short_seek_threshold;
270 if (
ctx->short_seek_get) {
271 int tmp =
ctx->short_seek_get(
s->opaque);
272 short_seek =
FFMAX(
tmp, short_seek);
276 s->buf_ptr_max =
FFMAX(
s->buf_ptr_max,
s->buf_ptr);
277 if ((!
s->direct || !
s->seek) &&
278 offset1 >= 0 && offset1 <= (
s->write_flag ?
s->buf_ptr_max -
s->buffer : buffer_size)) {
280 s->buf_ptr =
s->buffer + offset1;
282 offset1 <= buffer_size + short_seek) &&
283 !
s->write_flag && offset1 >= 0 &&
284 (!
s->direct || !
s->seek)) {
285 while(
s->pos <
offset && !
s->eof_reached)
289 s->buf_ptr =
s->buf_end - (
s->pos -
offset);
290 }
else if(!
s->write_flag && offset1 < 0 && -offset1 < buffer_size>>1 &&
s->seek &&
offset > 0) {
294 if ((res =
s->seek(
s->opaque,
pos, SEEK_SET)) < 0)
297 s->buf_ptr =
s->buffer;
309 if ((res =
s->seek(
s->opaque,
offset, SEEK_SET)) < 0)
313 s->buf_end =
s->buffer;
314 s->checksum_ptr =
s->buf_ptr =
s->buf_ptr_max =
s->buffer;
334 if (
ctx->written_output_size)
335 return ctx->written_output_size;
341 if ((
size =
s->seek(
s->opaque, -1, SEEK_END)) < 0)
344 s->seek(
s->opaque,
s->pos, SEEK_SET);
357 return s->eof_reached;
389 const uint8_t *q = str;
417#define PUT_STR16(type, big_endian) \
418int avio_put_str16 ## type(AVIOContext *s, const char *str) \
420return put_str16(s, str, big_endian); \
468 if (
s->buf_ptr -
s->buffer >=
s->min_packet_size)
472 if (!
s->write_data_type)
498 ctx->last_time = time;
507 ret =
s->read_packet(
s->opaque, buf,
size);
517 int max_buffer_size =
s->max_packet_size ?
519 uint8_t *
dst =
s->buf_end -
s->buffer + max_buffer_size <=
s->buffer_size ?
520 s->buf_end :
s->buffer;
521 int len =
s->buffer_size - (
dst -
s->buffer);
524 if (!
s->read_packet &&
s->buf_ptr >=
s->buf_end)
531 if (
s->update_checksum &&
dst ==
s->buffer) {
532 if (
s->buf_end >
s->checksum_ptr)
533 s->checksum =
s->update_checksum(
s->checksum,
s->checksum_ptr,
534 s->buf_end -
s->checksum_ptr);
535 s->checksum_ptr =
s->buffer;
539 if (
s->read_packet &&
ctx->orig_buffer_size &&
540 s->buffer_size >
ctx->orig_buffer_size &&
len >=
ctx->orig_buffer_size) {
541 if (
dst ==
s->buffer &&
s->buf_ptr !=
dst) {
546 s->checksum_ptr =
dst =
s->buffer;
548 len =
ctx->orig_buffer_size;
556 }
else if (
len < 0) {
588 s->checksum =
s->update_checksum(
s->checksum,
s->checksum_ptr,
589 s->buf_ptr -
s->checksum_ptr);
590 s->update_checksum =
NULL;
596 unsigned long checksum)
599 if (
s->update_checksum) {
600 s->checksum = checksum;
601 s->checksum_ptr =
s->buf_ptr;
608 if (
s->buf_ptr >=
s->buf_end)
610 if (
s->buf_ptr <
s->buf_end)
611 return *
s->buf_ptr++;
622 if (
len == 0 ||
s->write_flag) {
623 if((
s->direct ||
size >
s->buffer_size) && !
s->update_checksum &&
s->read_packet) {
631 }
else if (
len < 0) {
642 s->buf_ptr =
s->buffer;
643 s->buf_end =
s->buffer;
647 len =
s->buf_end -
s->buf_ptr;
652 memcpy(buf,
s->buf_ptr,
len);
659 if (
s->error)
return s->error;
677 if (
s->buf_end -
s->buf_ptr >=
size && !
s->write_flag) {
694 if (
s->read_packet &&
s->write_flag) {
701 len =
s->buf_end -
s->buf_ptr;
704 len =
s->buf_end -
s->buf_ptr;
708 memcpy(buf,
s->buf_ptr,
len);
711 if (
s->error)
return s->error;
779 if (
c &&
i < maxlen-1)
781 }
while (
c !=
'\n' &&
c !=
'\r' &&
c);
822 }
while (!end &&
len <
sizeof(
tmp) &&
823 ((max_len < 0) || (
read +
len < max_len)));
826 }
while (!end && ((max_len < 0) || (
read < max_len)));
876 buflen =
FFMIN(buflen - 1, maxlen);
877 for (
i = 0;
i < buflen;
i++)
881 for (;
i < maxlen;
i++)
887#define GET_STR16(type, read) \
888 int avio_get_str16 ##type(AVIOContext *pb, int maxlen, char *buf, int buflen)\
893 return AVERROR(EINVAL); \
894 while (ret + 1 < maxlen) {\
897 GET_UTF16(ch, (ret += 2) <= maxlen ? read(pb) : 0, break;)\
900 PUT_UTF8(ch, tmp, if (q - buf < buflen - 1) *q++ = tmp;)\
936 unsigned bits =
byte & 0x7f;
939 leb |=
bits << (
i * 7);
954 for (
int i = 0;
i <
len;
i++) {
955 byte =
val >> (7 *
i) & 0x7f;
964 const unsigned char *ending)
966 int ending_len = ending ? strlen(ending) : 1;
977 if (last ==
'\r' || last ==
'\n')
987 if (
size > 0 && last ==
'\r' && buf[0] ==
'\n') {
996 const char *
opts[] = {
997 "headers",
"user_agent",
"cookies",
"http_proxy",
"referer",
"rw_timeout",
"icy",
"prefer_libcurl",
NULL };
998 const char **opt =
opts;
1004 if (buf[0] !=
'\0') {
1020 if (
s->update_checksum &&
s->buf_ptr >
s->checksum_ptr) {
1021 s->checksum =
s->update_checksum(
s->checksum,
s->checksum_ptr,
1022 s->buf_ptr -
s->checksum_ptr);
1029 int max_buffer_size =
s->max_packet_size ?
1031 ptrdiff_t filled =
s->buf_end -
s->buf_ptr;
1033 if (buf_size <= s->buf_end -
s->buf_ptr)
1036 if (buf_size > INT_MAX - max_buffer_size)
1039 buf_size += max_buffer_size - 1;
1041 if (buf_size +
s->buf_ptr -
s->buffer <=
s->buffer_size ||
s->seekable || !
s->read_packet)
1045 if (buf_size <= s->buffer_size) {
1047 memmove(
s->buffer,
s->buf_ptr, filled);
1053 memcpy(
buffer,
s->buf_ptr, filled);
1056 s->buffer_size = buf_size;
1058 s->buf_ptr =
s->buffer;
1059 s->buf_end =
s->buffer + filled;
1060 s->checksum_ptr =
s->buffer;
1067 if (
ctx->maxsize >= 0) {
1070 if (remaining <
size) {
1072 if (!
ctx->maxsize ||
ctx->maxsize < newsize)
1073 ctx->maxsize = newsize - !newsize;
1074 if (
pos >
ctx->maxsize &&
ctx->maxsize >= 0)
1076 if (
ctx->maxsize >= 0)
1077 remaining =
ctx->maxsize -
pos;
1080 if (
ctx->maxsize >= 0 && remaining < size && size > 1) {
1082 "Truncating packet of size %d to %"PRId64
"\n",
1083 size, remaining + !remaining);
1084 size = remaining + !remaining;
1100 s->buffer_size = buf_size;
1101 s->buf_ptr =
s->buf_ptr_max =
buffer;
1111 if (!
s->buffer_size)
1114 if (buf_size <= s->buffer_size)
1121 data_size =
s->write_flag ? (
s->buf_ptr -
s->buffer) : (
s->buf_end -
s->buf_ptr);
1123 memcpy(
buffer,
s->write_flag ?
s->buffer :
s->buf_ptr, data_size);
1127 s->buffer_size = buf_size;
1128 s->buf_ptr =
s->write_flag ? (
s->buffer + data_size) :
s->buffer;
1130 s->buf_ptr_max =
s->buffer + data_size;
1132 s->buf_end =
s->write_flag ? (
s->buffer +
s->buffer_size) : (
s->buf_ptr + data_size);
1142 s->buf_end =
s->buffer +
s->buffer_size;
1145 s->buf_end =
s->buffer;
1155 int overlap, new_size, alloc_size;
1156 uint8_t *buf = *bufp;
1158 if (
s->write_flag) {
1163 buffer_size =
s->buf_end -
s->buffer;
1166 if ((buffer_start =
s->pos - buffer_size) > buf_size) {
1171 overlap = buf_size - buffer_start;
1172 new_size = buf_size + buffer_size - overlap;
1174 alloc_size =
FFMAX(
s->buffer_size, new_size);
1175 if (alloc_size > buf_size)
1176 if (!(buf = (*bufp) =
av_realloc_f(buf, 1, alloc_size)))
1179 if (new_size > buf_size) {
1180 memcpy(buf + buf_size,
s->buffer + overlap, buffer_size - overlap);
1181 buf_size = new_size;
1185 s->buf_ptr =
s->buffer = buf;
1186 s->buffer_size = alloc_size;
1188 s->buf_end =
s->buf_ptr + buf_size;
1224 for(; *strings; strings++)
1225 avio_write(
s, (
const unsigned char *)*strings, strlen(*strings));
1232 return s->read_pause(
s->opaque, pause);
1241 ret =
s->read_seek(
s->opaque, stream_index, timestamp,
flags);
1244 s->buf_ptr =
s->buf_end;
1245 pos =
s->seek(
s->opaque, 0, SEEK_CUR);
1287 new_size = (unsigned)d->
pos + buf_size;
1288 if (new_size < d->
pos || new_size > INT_MAX)
1294 while (new_size > new_allocated_size)
1295 new_allocated_size += new_allocated_size / 2 + 1;
1297 new_allocated_size =
FFMIN(new_allocated_size, INT_MAX);
1306 memcpy(d->
buffer + d->
pos, buf, buf_size);
1315 unsigned char buf1[4];
1332 if (whence == SEEK_CUR)
1334 else if (whence == SEEK_END)
1348 unsigned io_buffer_size = max_packet_size ? max_packet_size : 1024;
1350 if (
sizeof(*ret) + io_buffer_size < io_buffer_size)
1352 ret =
av_mallocz(
sizeof(*ret) + io_buffer_size);
1361 (*s)->max_packet_size = max_packet_size;
1372 if (max_packet_size <= 0)
1387 if (!
s->error && !d->
size) {
1389 return FFMAX(
s->buf_ptr,
s->buf_ptr_max) -
s->buffer;
1402 int max_packet_size =
s->max_packet_size;
1405 1, d,
NULL,
s->write_packet,
s->seek);
1406 s->max_packet_size = max_packet_size;
1422 if (!
s->max_packet_size) {
1435 return size - padding;
1454 if ((
unsigned)d->
pos + (
unsigned)buf_size > INT_MAX)
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static double val(void *priv, double ch)
#define SHORT_SEEK_THRESHOLD
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert2(cond)
assert() equivalent, that does lie in speed critical code.
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
#define AVIO_FLAG_READ
read-only
unsigned int avio_rb16(AVIOContext *s)
#define AVSEEK_SIZE
Passing this as the "whence" parameter to a seek function causes it to return the filesize without se...
AVIODataMarkerType
Different data types that can be returned via the AVIO write_data_type callback.
@ AVIO_DATA_MARKER_BOUNDARY_POINT
A point in the output bytestream where a demuxer can start parsing (for non self synchronizing bytest...
@ AVIO_DATA_MARKER_TRAILER
Trailer data, which doesn't contain actual content, but only for finalizing the output file.
@ AVIO_DATA_MARKER_HEADER
Header data; this needs to be present for the stream to be decodeable.
@ AVIO_DATA_MARKER_UNKNOWN
This is any, unlabelled data.
@ AVIO_DATA_MARKER_FLUSH_POINT
A point in the output bytestream where the underlying AVIOContext might flush the buffer depending on...
@ AVIO_DATA_MARKER_SYNC_POINT
A point in the output bytestream where a decoder can start decoding (i.e.
#define AVIO_FLAG_WRITE
write-only
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
unsigned int avio_rl16(AVIOContext *s)
#define AVSEEK_FORCE
OR'ing this flag into the "whence" parameter to a seek function causes it to seek by any means (like ...
static av_always_inline FFIOContext * ffiocontext(AVIOContext *ctx)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
void avio_write_marker(AVIOContext *s, int64_t time, enum AVIODataMarkerType type)
Mark the written bytestream as a specific type.
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
void ffio_init_checksum(AVIOContext *s, unsigned long(*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len), unsigned long checksum)
void ffio_init_context(FFIOContext *ctx, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, const uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
void avio_wl64(AVIOContext *s, uint64_t val)
static int set_buf_size(AVIOContext *s, int buf_size)
int avio_pause(AVIOContext *s, int pause)
Pause and resume playing - only meaningful if using a network streaming protocol (e....
void ffio_free_dyn_buf(AVIOContext **s)
Free a dynamic buffer.
int ffio_read_indirect(AVIOContext *s, unsigned char *buf, int size, const unsigned char **data)
Read size bytes from AVIOContext, returning a pointer.
uint64_t avio_rb64(AVIOContext *s)
int64_t ff_read_string_to_bprint_overwrite(AVIOContext *s, AVBPrint *bp, int64_t max_len)
Read a whole null-terminated string of text from AVIOContext to an AVBPrint buffer overwriting its co...
unsigned long ff_crcA001_update(unsigned long checksum, const uint8_t *buf, unsigned int len)
void avio_wl32(AVIOContext *s, unsigned int val)
void avio_wl16(AVIOContext *s, unsigned int val)
int avio_put_str(AVIOContext *s, const char *str)
Write a NULL-terminated string.
unsigned long ffio_get_checksum(AVIOContext *s)
void avio_w8(AVIOContext *s, int b)
void avio_wb32(AVIOContext *s, unsigned int val)
int avio_vprintf(AVIOContext *s, const char *fmt, va_list ap)
Writes a formatted string to the context taking a va_list.
void avio_wb16(AVIOContext *s, unsigned int val)
static void writeout(AVIOContext *s, const uint8_t *data, int len)
static void flush_buffer(AVIOContext *s)
static int dyn_buf_write(void *opaque, const uint8_t *buf, int buf_size)
static int read_packet_wrapper(AVIOContext *s, uint8_t *buf, int size)
static int64_t read_string_to_bprint_overwrite(AVIOContext *s, AVBPrint *bp, FFBPrintReadStringMode mode, int64_t max_len)
int64_t avio_size(AVIOContext *s)
Get the filesize.
unsigned int avio_rb16(AVIOContext *s)
void ffio_reset_dyn_buf(AVIOContext *s)
Reset a dynamic buffer.
static int64_t dyn_buf_seek(void *opaque, int64_t offset, int whence)
int avio_printf(AVIOContext *s, const char *fmt,...)
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
void avio_context_free(AVIOContext **ps)
Free the supplied IO context and everything associated with it.
int avio_read_partial(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
void ffio_write_leb(AVIOContext *s, unsigned val)
static void fill_buffer(AVIOContext *s)
int ffio_rewind_with_probe_data(AVIOContext *s, unsigned char **bufp, int buf_size)
Rewind the AVIOContext using the specified buffer containing the first buf_size bytes of the file.
int ffio_ensure_seekback(AVIOContext *s, int64_t buf_size)
Ensures that the requested seekback buffer size will be available.
int avio_get_str(AVIOContext *s, int maxlen, char *buf, int buflen)
Read a string from pb into buf.
void ffio_init_write_context(FFIOContext *s, uint8_t *buffer, int buffer_size)
Wrap a buffer in an AVIOContext for writing.
unsigned int avio_rl16(AVIOContext *s)
int64_t ff_read_line_to_bprint_overwrite(AVIOContext *s, AVBPrint *bp)
Read a whole line of text from AVIOContext to an AVBPrint buffer overwriting its contents.
int ff_get_chomp_line(AVIOContext *s, char *buf, int maxlen)
Same as ff_get_line but strip the white-space characters in the text tail.
static int64_t read_string_to_bprint(AVIOContext *s, AVBPrint *bp, FFBPrintReadStringMode mode, int64_t max_len)
#define GET_STR16(type, read)
int ffio_open_null_buf(AVIOContext **s)
Open a write-only fake memory stream.
static int dyn_packet_buf_write(void *opaque, const uint8_t *buf, int buf_size)
void avio_wb24(AVIOContext *s, unsigned int val)
void ffio_fill(AVIOContext *s, int b, int64_t count)
unsigned long ff_crcEDB88320_update(unsigned long checksum, const uint8_t *buf, unsigned int len)
static void update_checksum(AVIOContext *s)
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
int64_t avio_seek_time(AVIOContext *s, int stream_index, int64_t timestamp, int flags)
Seek to a given timestamp relative to some component stream.
uint64_t ffio_read_varlen(AVIOContext *bc)
int avio_read_to_bprint(AVIOContext *h, AVBPrint *pb, size_t max_size)
Read contents of h into print buffer, up to max_size bytes, or up to EOF.
void avio_wb64(AVIOContext *s, uint64_t val)
AVIOContext * avio_alloc_context(unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, const uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
Allocate and initialize an AVIOContext for buffered I/O.
void avio_wl24(AVIOContext *s, unsigned int val)
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
int ffio_open_dyn_packet_buf(AVIOContext **s, int max_packet_size)
Open a write only packetized memory stream with a maximum packet size of 'max_packet_size'.
int ffio_realloc_buf(AVIOContext *s, int buf_size)
Reallocate a given buffer for AVIOContext.
static int url_open_dyn_buf_internal(AVIOContext **s, int max_packet_size)
void ffio_init_read_context(FFIOContext *s, const uint8_t *buffer, int buffer_size)
Wrap a buffer in an AVIOContext for reading.
int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
unsigned int ffio_read_leb(AVIOContext *s)
Read a unsigned integer coded as a variable number of up to eight little-endian bytes,...
unsigned int avio_rl32(AVIOContext *s)
int ffio_close_null_buf(AVIOContext *s)
Close a null buffer.
unsigned int avio_rl24(AVIOContext *s)
void avio_print_string_array(AVIOContext *s, const char *const strings[])
Write a NULL terminated array of strings to the context.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
int ff_get_line(AVIOContext *s, char *buf, int maxlen)
Read a whole line of text from AVIOContext.
void avio_flush(AVIOContext *s)
Force flushing of buffered data.
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
unsigned int avio_rb24(AVIOContext *s)
int ffio_limit(AVIOContext *s, int size)
unsigned long ff_crc04C11DB7_update(unsigned long checksum, const uint8_t *buf, unsigned int len)
int ffio_copy_url_options(AVIOContext *pb, AVDictionary **avio_opts)
Read url related dictionary options from the AVIOContext and write to the given dictionary.
#define PUT_STR16(type, big_endian)
unsigned int avio_rb32(AVIOContext *s)
int avio_r8(AVIOContext *s)
int avio_get_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
static int url_resetbuf(AVIOContext *s, int flags)
static int null_buf_write(void *opaque, const uint8_t *buf, int buf_size)
uint64_t avio_rl64(AVIOContext *s)
void ffio_write_lines(AVIOContext *s, const unsigned char *buf, int size, const unsigned char *ending)
Write a sequence of text lines, converting line endings.
static int put_str16(AVIOContext *s, const char *str, const int be)
static void BS_FUNC seek(BSCTX *bc, unsigned pos)
Seek to the given bit position.
static uint32_t BS_FUNC read(BSCTX *bc, unsigned int n)
Return n bits from the buffer, n has to be in the 0-32 range.
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_WB16 unsigned int_TMPL byte
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
#define GET_UTF8(val, GET_BYTE, ERROR)
Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form.
#define PUT_UTF16(val, tmp, PUT_16BIT)
Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes).
Public header for CRC hash function implementation.
Misc types and constants that do not belong anywhere else.
static const uint8_t bits[8]
static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
static int av_bprint_is_complete(const AVBPrint *buf)
Test if the print buffer is complete (not truncated).
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
void av_bprint_append_data(AVBPrint *buf, const char *data, unsigned size)
Append data to a print buffer.
void av_bprint_clear(AVBPrint *buf)
Reset the string to "" but keep internal allocated data.
void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg)
Append a formatted string to a print buffer.
const AVCRC * av_crc_get_table(AVCRCId crc_id)
Get an initialized standard CRC table.
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length)
Calculate the CRC of a block.
#define AV_DICT_DONT_STRDUP_VAL
Take ownership of a value that's been allocated with av_malloc() or another memory allocation functio...
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AVERROR_EOF
End of file.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
static av_const int av_isspace(int c)
Locale-independent conversion of ASCII isspace.
#define AV_NOPTS_VALUE
Undefined timestamp value.
int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
Memory handling functions.
int(* write_packet)(void *opaque, const uint8_t *buf, int buf_size)
int64_t bytes_read
Bytes read statistic.
int orig_buffer_size
Original buffer size used after probing to ensure seekback and to reset the buffer size.
#define av_realloc_f(p, o, n)
static AVFormatContext * ctx
static AVDictionary * opts