39 #if FF_API_CONVERGENCE_DURATION
103 if (pkt->
size <= size)
115 if ((
unsigned)grow_by >
131 pkt->
size += grow_by;
132 memset(pkt->
data + pkt->
size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
153 #if FF_API_AVPACKET_OLD_API
155 #define ALLOC_MALLOC(data, size) data = av_malloc(size)
156 #define ALLOC_BUF(data, size) \
158 av_buffer_realloc(&pkt->buf, size); \
159 data = pkt->buf ? pkt->buf->data : NULL; \
162 #define DUP_DATA(dst, src, size, padding, ALLOC) \
166 if ((unsigned)(size) > \
167 (unsigned)(size) + AV_INPUT_BUFFER_PADDING_SIZE) \
169 ALLOC(data, size + AV_INPUT_BUFFER_PADDING_SIZE); \
175 memcpy(data, src, size); \
177 memset((uint8_t *)data + size, 0, \
178 AV_INPUT_BUFFER_PADDING_SIZE); \
261 #if FF_API_AVPACKET_OLD_API
282 if ((
unsigned)elems + 1 > INT_MAX /
sizeof(*pkt->
side_data))
358 #define FF_MERGE_MARKER 0x8c4d9d108e25e9feULL
386 memset(p, 0, AV_INPUT_BUFFER_PADDING_SIZE);
404 if (size>INT_MAX || p - pkt->
data < size)
425 pkt->
size -= size + 5;
447 const size_t keylen = strlen(t->
key);
448 const size_t valuelen = strlen(t->
value);
449 const size_t new_size = *size + keylen + 1 + valuelen + 1;
455 if (new_size > INT_MAX)
458 memcpy(data + *size, t->
key, keylen + 1);
459 memcpy(data + *size + keylen + 1, t->
value, valuelen + 1);
477 if (!dict || !data || !size)
491 data = val + strlen(val) + 1;
521 #if FF_API_CONVERGENCE_DURATION
539 memcpy(dst_data, src_data, size);
610 #if FF_API_CONVERGENCE_DURATION
626 side_data_size = 4+4+8*error_count;
631 if (!side_data || side_data_size < 4+4+8*error_count)
635 side_data[4] = pict_type;
636 side_data[5] = error_count;
637 for (i = 0; i<error_count; i++)
638 AV_WL64(side_data+8 + 8*i , error[i]);
const char const char void * val
#define DUP_DATA(dst, src, size, padding, ALLOC)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
A list of zero terminated key/value strings.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
The optional first identifier line of a WebVTT cue.
int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type)
ptrdiff_t const GLvoid * data
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)
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
#define ALLOC_BUF(data, size)
An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of structures with info about macroblo...
#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.
int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict)
Unpack a dictionary from side_data.
static av_cold int end(AVCodecContext *avctx)
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size)
Initialize a reference-counted packet from av_malloc()ed data.
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_RB32
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
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_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...
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
void av_packet_free_side_data(AVPacket *pkt)
Convenience function to free all the side data stored.
FF_ENABLE_DEPRECATION_WARNINGS 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.
int av_packet_merge_side_data(AVPacket *pkt)
common internal API header
int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
Copy only "properties" fields from src to dst.
This side data contains quality related information from the encoder.
static int packet_alloc(AVBufferRef **buf, int size)
int av_packet_split_side_data(AVPacket *pkt)
AVPacket * av_packet_clone(AVPacket *src)
Create a new packet that references the same data as src.
Libavcodec external API header.
A list of zero terminated key/value strings.
AVBufferRef * av_buffer_alloc(int size)
Allocate an AVBuffer of the given size using av_malloc().
uint8_t * av_packet_pack_dictionary(AVDictionary *dict, int *size)
Pack a dictionary for use in side_data.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
uint8_t * data
The data buffer.
int av_copy_packet(AVPacket *dst, const AVPacket *src)
Copy packet, including contents.
Data found in BlockAdditional element of matroska container.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
rational number numerator/denominator
Recommmends skipping the specified number of samples.
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.
static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup)
This side data should be associated with an audio stream and contains ReplayGain information in form ...
A reference to a data buffer.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_RB64
An AV_PKT_DATA_JP_DUALMONO side data packet indicates that the packet may contain "dual mono" audio s...
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 api header.
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.
The optional settings (rendering instructions) that immediately follow the timestamp specifier of a W...
static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
#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...
const char * av_packet_side_data_name(enum AVPacketSideDataType type)
FF_DISABLE_DEPRECATION_WARNINGS void av_free_packet(AVPacket *pkt)
Free a packet.
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key, ignoring the suffix of the found key string.
uint8_t * av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
#define av_malloc_array(a, b)
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, int size)
Allocate new information of a packet.
int av_copy_packet_side_data(AVPacket *pkt, const AVPacket *src)
Copy packet side data.
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.
This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.