37 #if FF_API_CONVERGENCE_DURATION 101 if (pkt->
size <= size)
113 if ((
unsigned)grow_by >
129 pkt->
size += grow_by;
130 memset(pkt->
data + pkt->
size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
151 #if FF_API_AVPACKET_OLD_API 153 #define ALLOC_MALLOC(data, size) data = av_malloc(size) 154 #define ALLOC_BUF(data, size) \ 156 av_buffer_realloc(&pkt->buf, size); \ 157 data = pkt->buf ? pkt->buf->data : NULL; \ 160 #define DUP_DATA(dst, src, size, padding, ALLOC) \ 164 if ((unsigned)(size) > \ 165 (unsigned)(size) + AV_INPUT_BUFFER_PADDING_SIZE) \ 167 ALLOC(data, size + AV_INPUT_BUFFER_PADDING_SIZE); \ 173 memcpy(data, src, size); \ 175 memset((uint8_t *)data + size, 0, \ 176 AV_INPUT_BUFFER_PADDING_SIZE); \ 224 #if FF_API_AVPACKET_OLD_API 246 if ((
unsigned)elems + 1 > INT_MAX /
sizeof(*pkt->
side_data))
323 #if FF_API_CONVERGENCE_DURATION 341 memcpy(dst_data, src_data, size);
417 #if FF_API_CONVERGENCE_DURATION void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
#define DUP_DATA(dst, src, size, padding, ALLOC)
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
memory handling functions
int64_t pos
byte position in stream, -1 if unknown
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
#define ALLOC_MALLOC(data, size)
#define ALLOC_BUF(data, size)
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
#define av_assert0(cond)
assert() equivalent, that is always enabled.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size)
Initialize a reference-counted packet from av_malloc()ed data.
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
void av_buffer_default_free(void *opaque, uint8_t *data)
Default free callback, which calls av_free() on the buffer data.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
void av_packet_rescale_ts(AVPacket *pkt, AVRational src_tb, AVRational dst_tb)
Convert valid timing fields (timestamps / durations) in a packet from one timebase to another...
FF_ENABLE_DEPRECATION_WARNINGS void av_packet_free_side_data(AVPacket *pkt)
Convenience function to free all the side data stored.
int av_dup_packet(AVPacket *pkt)
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
simple assert() macros that are a bit more flexible than ISO C assert().
enum AVPacketSideDataType type
AVBufferRef * av_buffer_create(uint8_t *data, int size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int size)
Shrink the already allocated side data buffer.
int av_buffer_realloc(AVBufferRef **pbuf, int size)
Reallocate a given buffer.
int flags
A combination of AV_PKT_FLAG values.
common internal API header
int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
Copy only "properties" fields from src to dst.
static int packet_alloc(AVBufferRef **buf, int size)
AVPacket * av_packet_clone(AVPacket *src)
Create a new packet that references the same data as src.
Libavcodec external API header.
AVBufferRef * av_buffer_alloc(int size)
Allocate an AVBuffer of the given size using av_malloc().
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
uint8_t * data
The data buffer.
rational number numerator/denominator
FF_ENABLE_DEPRECATION_WARNINGS int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, uint8_t *data, size_t size)
Wrap an existing array as a packet side data.
A reference to a data buffer.
AVPacketSideData * side_data
Additional packet data that can be provided by the container.
attribute_deprecated int64_t convergence_duration
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal and external API header
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
int av_grow_packet(AVPacket *pkt, int grow_by)
Increase packet size, correctly zeroing padding.
void av_init_packet(AVPacket *pkt)
Initialize optional fields of a packet with default values.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
int av_packet_ref(AVPacket *dst, AVPacket *src)
Setup a new reference to the data described by a given packet.
#define FF_ENABLE_DEPRECATION_WARNINGS
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed...
FF_DISABLE_DEPRECATION_WARNINGS void av_free_packet(AVPacket *pkt)
Free a packet.
uint8_t * av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int size)
Allocate new information of a packet.
This structure stores compressed data.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
#define AV_NOPTS_VALUE
Undefined timestamp value.