35 #if FF_API_INIT_PACKET
42 #if FF_API_CONVERGENCE_DURATION
44 pkt->convergence_duration = 0;
57 memset(
pkt, 0,
sizeof(*
pkt));
126 if ((
unsigned)grow_by >
139 if (data_offset > INT_MAX - new_size)
143 if (new_size + data_offset >
pkt->
buf->
size ||
182 #if FF_API_AVPACKET_OLD_API
184 #define ALLOC_MALLOC(data, size) data = av_malloc(size)
185 #define ALLOC_BUF(data, size) \
187 av_buffer_realloc(&pkt->buf, size); \
188 data = pkt->buf ? pkt->buf->data : NULL; \
191 #define DUP_DATA(dst, src, size, padding, ALLOC) \
195 if ((unsigned)(size) > \
196 (unsigned)(size) + AV_INPUT_BUFFER_PADDING_SIZE) \
198 ALLOC(data, size + AV_INPUT_BUFFER_PADDING_SIZE); \
204 memcpy(data, src, size); \
206 memset((uint8_t *)data + size, 0, \
207 AV_INPUT_BUFFER_PADDING_SIZE); \
226 if (
src->side_data_elems && dup) {
230 if (
src->side_data_elems && !dup) {
242 if (
src->side_data_elems) {
248 src->side_data_elems *
sizeof(*
src->side_data));
250 for (
i = 0;
i <
src->side_data_elems;
i++) {
293 #if FF_API_AVPACKET_OLD_API
315 for (
i = 0;
i < elems;
i++) {
349 #if FF_API_BUFFER_SIZE_T
423 #if FF_API_MERGE_SD_API
425 #define FF_MERGE_MARKER 0x8c4d9d108e25e9feULL
510 #if FF_API_BUFFER_SIZE_T
524 size_t total_length = 0;
527 for (
int i = 0;
i < 2;
i++) {
529 const size_t len = strlen(
str) + 1;
533 #if FF_API_BUFFER_SIZE_T
534 else if (
len > INT_MAX - total_length)
536 else if (
len > SIZE_MAX - total_length)
547 *
size = total_length;
553 #if FF_API_BUFFER_SIZE_T
608 #if FF_API_CONVERGENCE_DURATION
610 dst->convergence_duration =
src->convergence_duration;
618 for (
i = 0;
i <
src->side_data_elems;
i++) {
628 memcpy(dst_data, src_data,
size);
745 #if FF_API_CONVERGENCE_DURATION
747 if (
pkt->convergence_duration > 0)
781 (*plast_pktl)->next = pktl;
783 *packet_buffer = pktl;
799 *pkt_buffer = pktl->
next;
801 *pkt_buffer_end =
NULL;
828 side_data_size = 4+4+8*error_count;
833 if (!side_data || side_data_size < 4+4+8*error_count)
837 side_data[4] = pict_type;
838 side_data[5] = error_count;
839 for (
i = 0;
i<error_count;
i++)
static double val(void *priv, double ch)
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int av_dup_packet(AVPacket *pkt)
int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **dict)
#define DUP_DATA(dst, src, size, padding, ALLOC)
static int packet_alloc(AVBufferRef **buf, int size)
int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, buffer_size_t size)
#define ALLOC_BUF(data, size)
void avpriv_packet_list_free(PacketList **pkt_buf, PacketList **pkt_buf_end)
Wipe the list and unref all the packets in it.
#define ALLOC_MALLOC(data, size)
int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type)
int av_copy_packet_side_data(AVPacket *pkt, const AVPacket *src)
uint8_t * av_packet_pack_dictionary(AVDictionary *dict, int *size)
int av_packet_split_side_data(AVPacket *pkt)
int av_copy_packet(AVPacket *dst, const AVPacket *src)
static void get_packet_defaults(AVPacket *pkt)
FF_DISABLE_DEPRECATION_WARNINGS void av_free_packet(AVPacket *pkt)
int avpriv_packet_list_get(PacketList **pkt_buffer, PacketList **pkt_buffer_end, AVPacket *pkt)
Remove the oldest AVPacket in the list and return it.
static int copy_packet_data(AVPacket *pkt, const AVPacket *src, int dup)
int ff_side_data_set_prft(AVPacket *pkt, int64_t timestamp)
void av_init_packet(AVPacket *pkt)
int avpriv_packet_list_put(PacketList **packet_buffer, PacketList **plast_pktl, AVPacket *pkt, int(*copy)(AVPacket *dst, const AVPacket *src), int flags)
Append an AVPacket to the list.
int av_packet_merge_side_data(AVPacket *pkt)
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, buffer_size_t *size)
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, buffer_size_t size)
static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size)
#define flags(name, subs,...)
common internal and external API header
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
FF_ENABLE_DEPRECATION_WARNINGS void av_packet_free_side_data(AVPacket *pkt)
Convenience function to free all the side data stored.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int av_grow_packet(AVPacket *pkt, int grow_by)
Increase packet size, correctly zeroing padding.
const char * av_packet_side_data_name(enum AVPacketSideDataType type)
int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size)
Initialize a reference-counted packet from av_malloc()ed data.
int av_packet_make_refcounted(AVPacket *pkt)
Ensure the data described by a given packet is reference counted.
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.
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
int av_packet_make_writable(AVPacket *pkt)
Create a writable reference for the data described by a given packet, avoiding data copy if possible.
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
AVPacket * av_packet_clone(const AVPacket *src)
Create a new packet that references the same data as src.
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
Copy only "properties" fields from src to dst.
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.
@ AV_PKT_DATA_JP_DUALMONO
An AV_PKT_DATA_JP_DUALMONO side data packet indicates that the packet may contain "dual mono" audio s...
@ AV_PKT_DATA_STRINGS_METADATA
A list of zero terminated key/value strings.
@ AV_PKT_DATA_S12M_TIMECODE
Timecode which conforms to SMPTE ST 12-1:2014.
@ AV_PKT_DATA_SKIP_SAMPLES
Recommmends skipping the specified number of samples.
@ AV_PKT_DATA_MPEGTS_STREAM_ID
MPEGTS stream ID as uint8_t, this is required to pass the stream ID information from the demuxer to t...
@ AV_PKT_DATA_PRFT
Producer Reference Time data corresponding to the AVProducerReferenceTime struct, usually exported by...
@ AV_PKT_DATA_H263_MB_INFO
An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of structures with info about macroblo...
@ AV_PKT_DATA_ICC_PROFILE
ICC profile data consisting of an opaque octet buffer following the format described by ISO 15076-1.
@ AV_PKT_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata (based on SMPTE-2086:2014).
@ AV_PKT_DATA_AUDIO_SERVICE_TYPE
This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.
@ AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL
Data found in BlockAdditional element of matroska container.
@ AV_PKT_DATA_A53_CC
ATSC A53 Part 4 Closed Captions.
@ AV_PKT_DATA_SPHERICAL
This side data should be associated with a video stream and corresponds to the AVSphericalMapping str...
@ AV_PKT_DATA_QUALITY_STATS
This side data contains quality related information from the encoder.
@ AV_PKT_DATA_WEBVTT_SETTINGS
The optional settings (rendering instructions) that immediately follow the timestamp specifier of a W...
@ AV_PKT_DATA_METADATA_UPDATE
A list of zero terminated key/value strings.
@ AV_PKT_DATA_SUBTITLE_POSITION
Subtitle event position.
@ AV_PKT_DATA_PALETTE
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette.
@ AV_PKT_DATA_ENCRYPTION_INFO
This side data contains encryption info for how to decrypt the packet.
@ AV_PKT_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
@ AV_PKT_DATA_AFD
Active Format Description data consisting of a single byte as specified in ETSI TS 101 154 using AVAc...
@ AV_PKT_DATA_ENCRYPTION_INIT_INFO
This side data is encryption initialization data.
@ AV_PKT_DATA_CPB_PROPERTIES
This side data corresponds to the AVCPBProperties struct.
@ AV_PKT_DATA_NEW_EXTRADATA
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
@ AV_PKT_DATA_NB
The number of side data types.
@ AV_PKT_DATA_PARAM_CHANGE
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
@ AV_PKT_DATA_STEREO3D
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
@ AV_PKT_DATA_WEBVTT_IDENTIFIER
The optional first identifier line of a WebVTT cue.
@ AV_PKT_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
@ AV_PKT_DATA_FALLBACK_TRACK
This side data contains an integer value representing the stream index of a "fallback" track.
@ AV_PKT_DATA_REPLAYGAIN
This side data should be associated with an audio stream and contains ReplayGain information in form ...
@ AV_PKT_DATA_DOVI_CONF
DOVI configuration ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2....
int av_buffer_is_writable(const AVBufferRef *buf)
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
void av_buffer_default_free(void *opaque, uint8_t *data)
Default free callback, which calls av_free() on the buffer data.
AVBufferRef * av_buffer_create(uint8_t *data, buffer_size_t size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
AVBufferRef * av_buffer_alloc(buffer_size_t size)
Allocate an AVBuffer of the given size using av_malloc().
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
int av_buffer_realloc(AVBufferRef **pbuf, buffer_size_t size)
Reallocate a given buffer.
#define AV_DICT_IGNORE_SUFFIX
Return first entry in a dictionary whose first part corresponds to the search key,...
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
void * av_realloc(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
#define AV_NOPTS_VALUE
Undefined timestamp value.
common internal API header
#define FF_DISABLE_DEPRECATION_WARNINGS
#define FF_ENABLE_DEPRECATION_WARNINGS
Memory handling functions.
A reference to a data buffer.
int size
Size of data in bytes.
uint8_t * data
The data buffer.
enum AVPacketSideDataType type
This structure stores compressed data.
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
int flags
A combination of AV_PKT_FLAG values.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
int64_t pos
byte position in stream, -1 if unknown
AVPacketSideData * side_data
Additional packet data that can be provided by the container.
This structure supplies correlation between a packet timestamp and a wall clock production time.
int64_t wallclock
A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()).
Rational number (pair of numerator and denominator).
#define av_malloc_array(a, b)
static void error(const char *err)
static int ref[MAX_W *MAX_W]
static void copy(const float *p1, float *p2, const int length)