41 #if FF_API_CONVERGENCE_DURATION 43 pkt->convergence_duration = 0;
105 if (pkt->
size <= size)
115 if ((
unsigned)grow_by >
128 if (data_offset > INT_MAX - new_size)
132 if (new_size + data_offset > pkt->
buf->
size ||
136 pkt->
data = old_data;
149 pkt->
size += grow_by;
150 memset(pkt->
data + pkt->
size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
171 #if FF_API_AVPACKET_OLD_API 173 #define ALLOC_MALLOC(data, size) data = av_malloc(size) 174 #define ALLOC_BUF(data, size) \ 176 av_buffer_realloc(&pkt->buf, size); \ 177 data = pkt->buf ? pkt->buf->data : NULL; \ 180 #define DUP_DATA(dst, src, size, padding, ALLOC) \ 184 if ((unsigned)(size) > \ 185 (unsigned)(size) + AV_INPUT_BUFFER_PADDING_SIZE) \ 187 ALLOC(data, size + AV_INPUT_BUFFER_PADDING_SIZE); \ 193 memcpy(data, src, size); \ 195 memset((uint8_t *)data + size, 0, \ 196 AV_INPUT_BUFFER_PADDING_SIZE); \ 282 #if FF_API_AVPACKET_OLD_API 304 for (i = 0; i < elems; i++) {
307 if (sd->
type == type) {
408 #if FF_API_MERGE_SD_API 410 #define FF_MERGE_MARKER 0x8c4d9d108e25e9feULL 438 memset(p, 0, AV_INPUT_BUFFER_PADDING_SIZE);
456 if (size>INT_MAX - 5 || p - pkt->
data < size)
460 if (p - pkt->
data < size + 5)
482 pkt->
size -= size + 5;
505 const size_t keylen = strlen(t->
key);
506 const size_t valuelen = strlen(t->
value);
507 const size_t new_size = *size + keylen + 1 + valuelen + 1;
513 if (new_size > INT_MAX)
516 memcpy(data + *size, t->
key, keylen + 1);
517 memcpy(data + *size + keylen + 1, t->
value, valuelen + 1);
535 if (!dict || !data || !size)
544 if (val >= end || !*key)
550 data = val + strlen(val) + 1;
580 #if FF_API_CONVERGENCE_DURATION 582 dst->convergence_duration = src->convergence_duration;
600 memcpy(dst_data, src_data, size);
721 #if FF_API_CONVERGENCE_DURATION 723 if (pkt->convergence_duration > 0)
724 pkt->convergence_duration =
av_rescale_q(pkt->convergence_duration, src_tb, dst_tb);
757 (*plast_pktl)->next = pktl;
759 *packet_buffer = pktl;
775 *pkt_buffer = pktl->
next;
777 *pkt_buffer_end =
NULL;
804 side_data_size = 4+4+8*error_count;
809 if (!side_data || side_data_size < 4+4+8*error_count)
813 side_data[4] = pict_type;
814 side_data[5] = error_count;
815 for (i = 0; i<error_count; i++)
816 AV_WL64(side_data+8 + 8*i , error[i]);
#define DUP_DATA(dst, src, size, padding, ALLOC)
Producer Reference Time data corresponding to the AVProducerReferenceTime struct, usually exported by...
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
static void copy(const float *p1, float *p2, const int length)
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.
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
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...
ATSC A53 Part 4 Closed Captions.
This side data contains an integer value representing the stream index of a "fallback" track...
#define ALLOC_BUF(data, size)
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static void error(const char *err)
An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of structures with info about macroblo...
Mastering display metadata (based on SMPTE-2086:2014).
#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.
int av_packet_split_side_data(AVPacket *pkt)
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
int av_packet_merge_side_data(AVPacket *pkt)
int64_t wallclock
A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()).
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
This side data is encryption initialization data.
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.
int av_packet_make_writable(AVPacket *pkt)
Create a writable reference for the data described by a given packet, avoiding data copy if possible...
void av_buffer_default_free(void *opaque, uint8_t *data)
Default free callback, which calls av_free() on the buffer data.
MPEGTS stream ID as uint8_t, this is required to pass the stream ID information from the demuxer to t...
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.
DOVI configuration ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2.1.2, section 2.2 dolby-vision-bitstreams-in-mpeg-2-transport-stream-multiplex-v1.2, section 3.3 Tags are stored in struct AVDOVIDecoderConfigurationRecord.
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette...
AVPacket * av_packet_clone(const AVPacket *src)
Create a new packet that references the same data as src.
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:
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, int *size)
Get side information from packet.
FF_ENABLE_DEPRECATION_WARNINGS void av_packet_free_side_data(AVPacket *pkt)
Convenience function to free all the side data stored.
ICC profile data consisting of an opaque octet buffer following the format described by ISO 15076-1...
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_copy_packet_side_data(AVPacket *pkt, const AVPacket *src)
common internal API header
int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
Copy only "properties" fields from src to dst.
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
This side data contains quality related information from the encoder.
static int packet_alloc(AVBufferRef **buf, int size)
int av_packet_make_refcounted(AVPacket *pkt)
Ensure the data described by a given packet is reference counted.
This side data should be associated with a video stream and corresponds to the AVSphericalMapping str...
Active Format Description data consisting of a single byte as specified in ETSI TS 101 154 using AVAc...
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about quality
int av_buffer_is_writable(const AVBufferRef *buf)
int avpriv_packet_list_put(AVPacketList **packet_buffer, AVPacketList **plast_pktl, AVPacket *pkt, int(*copy)(AVPacket *dst, const AVPacket *src), int flags)
Append an AVPacket to the list.
Content light level (based on CTA-861.3).
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
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 avpriv_packet_list_get(AVPacketList **pkt_buffer, AVPacketList **pkt_buffer_end, AVPacket *pkt)
Remove the oldest AVPacket in the list and return it.
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 (pair of numerator and 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.
FF_DISABLE_DEPRECATION_WARNINGS void av_free_packet(AVPacket *pkt)
This side data contains encryption info for how to decrypt the packet.
static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup)
int size
Size of data in bytes.
int av_copy_packet(AVPacket *dst, const AVPacket *src)
#define flags(name, subs,...)
This side data should be associated with an audio stream and contains ReplayGain information in form ...
Timecode which conforms to SMPTE ST 12-1:2014.
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.
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal api header.
struct AVPacketList * next
common internal and external API header
static int ref[MAX_W *MAX_W]
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...
This structure supplies correlation between a packet timestamp and a wall clock production time...
#define FF_ENABLE_DEPRECATION_WARNINGS
int ff_side_data_set_prft(AVPacket *pkt, int64_t timestamp)
int av_dup_packet(AVPacket *pkt)
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
This side data corresponds to the AVCPBProperties struct.
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)
#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.
#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.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
The number of side data types.
static double val(void *priv, double ch)
This structure stores compressed data.
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.
void avpriv_packet_list_free(AVPacketList **pkt_buf, AVPacketList **pkt_buf_end)
Wipe the list and unref all the packets in it.
This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.