FFmpeg
packet.h
Go to the documentation of this file.
1 /*
2  * AVPacket public API
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #ifndef AVCODEC_PACKET_H
22 #define AVCODEC_PACKET_H
23 
24 #include <stddef.h>
25 #include <stdint.h>
26 
27 #include "libavutil/attributes.h"
28 #include "libavutil/buffer.h"
29 #include "libavutil/dict.h"
30 #include "libavutil/rational.h"
31 
32 #include "libavcodec/version.h"
33 
34 /**
35  * @defgroup lavc_packet AVPacket
36  *
37  * Types and functions for working with AVPacket.
38  * @{
39  */
41  /**
42  * An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE
43  * bytes worth of palette. This side data signals that a new palette is
44  * present.
45  */
47 
48  /**
49  * The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format
50  * that the extradata buffer was changed and the receiving side should
51  * act upon it appropriately. The new extradata is embedded in the side
52  * data buffer and should be immediately used for processing the current
53  * frame or packet.
54  */
56 
57  /**
58  * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
59  * @code
60  * u32le param_flags
61  * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT)
62  * s32le channel_count
63  * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT)
64  * u64le channel_layout
65  * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE)
66  * s32le sample_rate
67  * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS)
68  * s32le width
69  * s32le height
70  * @endcode
71  */
73 
74  /**
75  * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of
76  * structures with info about macroblocks relevant to splitting the
77  * packet into smaller packets on macroblock edges (e.g. as for RFC 2190).
78  * That is, it does not necessarily contain info about all macroblocks,
79  * as long as the distance between macroblocks in the info is smaller
80  * than the target payload size.
81  * Each MB info structure is 12 bytes, and is laid out as follows:
82  * @code
83  * u32le bit offset from the start of the packet
84  * u8 current quantizer at the start of the macroblock
85  * u8 GOB number
86  * u16le macroblock address within the GOB
87  * u8 horizontal MV predictor
88  * u8 vertical MV predictor
89  * u8 horizontal MV predictor for block number 3
90  * u8 vertical MV predictor for block number 3
91  * @endcode
92  */
94 
95  /**
96  * This side data should be associated with an audio stream and contains
97  * ReplayGain information in form of the AVReplayGain struct.
98  */
100 
101  /**
102  * This side data contains a 3x3 transformation matrix describing an affine
103  * transformation that needs to be applied to the decoded video frames for
104  * correct presentation.
105  *
106  * See libavutil/display.h for a detailed description of the data.
107  */
109 
110  /**
111  * This side data should be associated with a video stream and contains
112  * Stereoscopic 3D information in form of the AVStereo3D struct.
113  */
115 
116  /**
117  * This side data should be associated with an audio stream and corresponds
118  * to enum AVAudioServiceType.
119  */
121 
122  /**
123  * This side data contains quality related information from the encoder.
124  * @code
125  * u32le quality factor of the compressed frame. Allowed range is between 1 (good) and FF_LAMBDA_MAX (bad).
126  * u8 picture type
127  * u8 error count
128  * u16 reserved
129  * u64le[error count] sum of squared differences between encoder in and output
130  * @endcode
131  */
133 
134  /**
135  * This side data contains an integer value representing the stream index
136  * of a "fallback" track. A fallback track indicates an alternate
137  * track to use when the current track can not be decoded for some reason.
138  * e.g. no decoder available for codec.
139  */
141 
142  /**
143  * This side data corresponds to the AVCPBProperties struct.
144  */
146 
147  /**
148  * Recommmends skipping the specified number of samples
149  * @code
150  * u32le number of samples to skip from start of this packet
151  * u32le number of samples to skip from end of this packet
152  * u8 reason for start skip
153  * u8 reason for end skip (0=padding silence, 1=convergence)
154  * @endcode
155  */
157 
158  /**
159  * An AV_PKT_DATA_JP_DUALMONO side data packet indicates that
160  * the packet may contain "dual mono" audio specific to Japanese DTV
161  * and if it is true, recommends only the selected channel to be used.
162  * @code
163  * u8 selected channels (0=mail/left, 1=sub/right, 2=both)
164  * @endcode
165  */
167 
168  /**
169  * A list of zero terminated key/value strings. There is no end marker for
170  * the list, so it is required to rely on the side data size to stop.
171  */
173 
174  /**
175  * Subtitle event position
176  * @code
177  * u32le x1
178  * u32le y1
179  * u32le x2
180  * u32le y2
181  * @endcode
182  */
184 
185  /**
186  * Data found in BlockAdditional element of matroska container. There is
187  * no end marker for the data, so it is required to rely on the side data
188  * size to recognize the end. 8 byte id (as found in BlockAddId) followed
189  * by data.
190  */
192 
193  /**
194  * The optional first identifier line of a WebVTT cue.
195  */
197 
198  /**
199  * The optional settings (rendering instructions) that immediately
200  * follow the timestamp specifier of a WebVTT cue.
201  */
203 
204  /**
205  * A list of zero terminated key/value strings. There is no end marker for
206  * the list, so it is required to rely on the side data size to stop. This
207  * side data includes updated metadata which appeared in the stream.
208  */
210 
211  /**
212  * MPEGTS stream ID as uint8_t, this is required to pass the stream ID
213  * information from the demuxer to the corresponding muxer.
214  */
216 
217  /**
218  * Mastering display metadata (based on SMPTE-2086:2014). This metadata
219  * should be associated with a video stream and contains data in the form
220  * of the AVMasteringDisplayMetadata struct.
221  */
223 
224  /**
225  * This side data should be associated with a video stream and corresponds
226  * to the AVSphericalMapping structure.
227  */
229 
230  /**
231  * Content light level (based on CTA-861.3). This metadata should be
232  * associated with a video stream and contains data in the form of the
233  * AVContentLightMetadata struct.
234  */
236 
237  /**
238  * ATSC A53 Part 4 Closed Captions. This metadata should be associated with
239  * a video stream. A53 CC bitstream is stored as uint8_t in AVPacketSideData.data.
240  * The number of bytes of CC data is AVPacketSideData.size.
241  */
243 
244  /**
245  * This side data is encryption initialization data.
246  * The format is not part of ABI, use av_encryption_init_info_* methods to
247  * access.
248  */
250 
251  /**
252  * This side data contains encryption info for how to decrypt the packet.
253  * The format is not part of ABI, use av_encryption_info_* methods to access.
254  */
256 
257  /**
258  * Active Format Description data consisting of a single byte as specified
259  * in ETSI TS 101 154 using AVActiveFormatDescription enum.
260  */
262 
263  /**
264  * Producer Reference Time data corresponding to the AVProducerReferenceTime struct,
265  * usually exported by some encoders (on demand through the prft flag set in the
266  * AVCodecContext export_side_data field).
267  */
269 
270  /**
271  * ICC profile data consisting of an opaque octet buffer following the
272  * format described by ISO 15076-1.
273  */
275 
276  /**
277  * DOVI configuration
278  * ref:
279  * dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2.1.2, section 2.2
280  * dolby-vision-bitstreams-in-mpeg-2-transport-stream-multiplex-v1.2, section 3.3
281  * Tags are stored in struct AVDOVIDecoderConfigurationRecord.
282  */
284 
285  /**
286  * Timecode which conforms to SMPTE ST 12-1:2014. The data is an array of 4 uint32_t
287  * where the first uint32_t describes how many (1-3) of the other timecodes are used.
288  * The timecode format is described in the documentation of av_timecode_get_smpte_from_framenum()
289  * function in libavutil/timecode.h.
290  */
292 
293  /**
294  * HDR10+ dynamic metadata associated with a video frame. The metadata is in
295  * the form of the AVDynamicHDRPlus struct and contains
296  * information for color volume transform - application 4 of
297  * SMPTE 2094-40:2016 standard.
298  */
300 
301  /**
302  * The number of side data types.
303  * This is not part of the public API/ABI in the sense that it may
304  * change when new side data types are added.
305  * This must stay the last enum value.
306  * If its value becomes huge, some code using it
307  * needs to be updated as it assumes it to be smaller than other limits.
308  */
310 };
311 
312 #define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED
313 
314 typedef struct AVPacketSideData {
315  uint8_t *data;
316  size_t size;
319 
320 /**
321  * This structure stores compressed data. It is typically exported by demuxers
322  * and then passed as input to decoders, or received as output from encoders and
323  * then passed to muxers.
324  *
325  * For video, it should typically contain one compressed frame. For audio it may
326  * contain several compressed frames. Encoders are allowed to output empty
327  * packets, with no compressed data, containing only side data
328  * (e.g. to update some stream parameters at the end of encoding).
329  *
330  * The semantics of data ownership depends on the buf field.
331  * If it is set, the packet data is dynamically allocated and is
332  * valid indefinitely until a call to av_packet_unref() reduces the
333  * reference count to 0.
334  *
335  * If the buf field is not set av_packet_ref() would make a copy instead
336  * of increasing the reference count.
337  *
338  * The side data is always allocated with av_malloc(), copied by
339  * av_packet_ref() and freed by av_packet_unref().
340  *
341  * sizeof(AVPacket) being a part of the public ABI is deprecated. once
342  * av_init_packet() is removed, new packets will only be able to be allocated
343  * with av_packet_alloc(), and new fields may be added to the end of the struct
344  * with a minor bump.
345  *
346  * @see av_packet_alloc
347  * @see av_packet_ref
348  * @see av_packet_unref
349  */
350 typedef struct AVPacket {
351  /**
352  * A reference to the reference-counted buffer where the packet data is
353  * stored.
354  * May be NULL, then the packet data is not reference-counted.
355  */
357  /**
358  * Presentation timestamp in AVStream->time_base units; the time at which
359  * the decompressed packet will be presented to the user.
360  * Can be AV_NOPTS_VALUE if it is not stored in the file.
361  * pts MUST be larger or equal to dts as presentation cannot happen before
362  * decompression, unless one wants to view hex dumps. Some formats misuse
363  * the terms dts and pts/cts to mean something different. Such timestamps
364  * must be converted to true pts/dts before they are stored in AVPacket.
365  */
366  int64_t pts;
367  /**
368  * Decompression timestamp in AVStream->time_base units; the time at which
369  * the packet is decompressed.
370  * Can be AV_NOPTS_VALUE if it is not stored in the file.
371  */
372  int64_t dts;
373  uint8_t *data;
374  int size;
376  /**
377  * A combination of AV_PKT_FLAG values
378  */
379  int flags;
380  /**
381  * Additional packet data that can be provided by the container.
382  * Packet can contain several types of side information.
383  */
386 
387  /**
388  * Duration of this packet in AVStream->time_base units, 0 if unknown.
389  * Equals next_pts - this_pts in presentation order.
390  */
391  int64_t duration;
392 
393  int64_t pos; ///< byte position in stream, -1 if unknown
394 
395  /**
396  * for some private data of the user
397  */
398  void *opaque;
399 
400  /**
401  * AVBufferRef for free use by the API user. FFmpeg will never check the
402  * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when
403  * the packet is unreferenced. av_packet_copy_props() calls create a new
404  * reference with av_buffer_ref() for the target packet's opaque_ref field.
405  *
406  * This is unrelated to the opaque field, although it serves a similar
407  * purpose.
408  */
410 
411  /**
412  * Time base of the packet's timestamps.
413  * In the future, this field may be set on packets output by encoders or
414  * demuxers, but its value will be by default ignored on input to decoders
415  * or muxers.
416  */
418 } AVPacket;
419 
420 #if FF_API_INIT_PACKET
422 typedef struct AVPacketList {
423  AVPacket pkt;
424  struct AVPacketList *next;
425 } AVPacketList;
426 #endif
427 
428 #define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
429 #define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
430 /**
431  * Flag is used to discard packets which are required to maintain valid
432  * decoder state but are not required for output and should be dropped
433  * after decoding.
434  **/
435 #define AV_PKT_FLAG_DISCARD 0x0004
436 /**
437  * The packet comes from a trusted source.
438  *
439  * Otherwise-unsafe constructs such as arbitrary pointers to data
440  * outside the packet may be followed.
441  */
442 #define AV_PKT_FLAG_TRUSTED 0x0008
443 /**
444  * Flag is used to indicate packets that contain frames that can
445  * be discarded by the decoder. I.e. Non-reference frames.
446  */
447 #define AV_PKT_FLAG_DISPOSABLE 0x0010
448 
454 };
455 
456 /**
457  * Allocate an AVPacket and set its fields to default values. The resulting
458  * struct must be freed using av_packet_free().
459  *
460  * @return An AVPacket filled with default values or NULL on failure.
461  *
462  * @note this only allocates the AVPacket itself, not the data buffers. Those
463  * must be allocated through other means such as av_new_packet.
464  *
465  * @see av_new_packet
466  */
468 
469 /**
470  * Create a new packet that references the same data as src.
471  *
472  * This is a shortcut for av_packet_alloc()+av_packet_ref().
473  *
474  * @return newly created AVPacket on success, NULL on error.
475  *
476  * @see av_packet_alloc
477  * @see av_packet_ref
478  */
480 
481 /**
482  * Free the packet, if the packet is reference counted, it will be
483  * unreferenced first.
484  *
485  * @param pkt packet to be freed. The pointer will be set to NULL.
486  * @note passing NULL is a no-op.
487  */
488 void av_packet_free(AVPacket **pkt);
489 
490 #if FF_API_INIT_PACKET
491 /**
492  * Initialize optional fields of a packet with default values.
493  *
494  * Note, this does not touch the data and size members, which have to be
495  * initialized separately.
496  *
497  * @param pkt packet
498  *
499  * @see av_packet_alloc
500  * @see av_packet_unref
501  *
502  * @deprecated This function is deprecated. Once it's removed,
503  sizeof(AVPacket) will not be a part of the ABI anymore.
504  */
507 #endif
508 
509 /**
510  * Allocate the payload of a packet and initialize its fields with
511  * default values.
512  *
513  * @param pkt packet
514  * @param size wanted payload size
515  * @return 0 if OK, AVERROR_xxx otherwise
516  */
517 int av_new_packet(AVPacket *pkt, int size);
518 
519 /**
520  * Reduce packet size, correctly zeroing padding
521  *
522  * @param pkt packet
523  * @param size new size
524  */
525 void av_shrink_packet(AVPacket *pkt, int size);
526 
527 /**
528  * Increase packet size, correctly zeroing padding
529  *
530  * @param pkt packet
531  * @param grow_by number of bytes by which to increase the size of the packet
532  */
533 int av_grow_packet(AVPacket *pkt, int grow_by);
534 
535 /**
536  * Initialize a reference-counted packet from av_malloc()ed data.
537  *
538  * @param pkt packet to be initialized. This function will set the data, size,
539  * and buf fields, all others are left untouched.
540  * @param data Data allocated by av_malloc() to be used as packet data. If this
541  * function returns successfully, the data is owned by the underlying AVBuffer.
542  * The caller may not access the data through other means.
543  * @param size size of data in bytes, without the padding. I.e. the full buffer
544  * size is assumed to be size + AV_INPUT_BUFFER_PADDING_SIZE.
545  *
546  * @return 0 on success, a negative AVERROR on error
547  */
548 int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size);
549 
550 /**
551  * Allocate new information of a packet.
552  *
553  * @param pkt packet
554  * @param type side information type
555  * @param size side information size
556  * @return pointer to fresh allocated data or NULL otherwise
557  */
559  size_t size);
560 
561 /**
562  * Wrap an existing array as a packet side data.
563  *
564  * @param pkt packet
565  * @param type side information type
566  * @param data the side data array. It must be allocated with the av_malloc()
567  * family of functions. The ownership of the data is transferred to
568  * pkt.
569  * @param size side information size
570  * @return a non-negative number on success, a negative AVERROR code on
571  * failure. On failure, the packet is unchanged and the data remains
572  * owned by the caller.
573  */
575  uint8_t *data, size_t size);
576 
577 /**
578  * Shrink the already allocated side data buffer
579  *
580  * @param pkt packet
581  * @param type side information type
582  * @param size new side information size
583  * @return 0 on success, < 0 on failure
584  */
586  size_t size);
587 
588 /**
589  * Get side information from packet.
590  *
591  * @param pkt packet
592  * @param type desired side information type
593  * @param size If supplied, *size will be set to the size of the side data
594  * or to zero if the desired side data is not present.
595  * @return pointer to data if present or NULL otherwise
596  */
598  size_t *size);
599 
601 
602 /**
603  * Pack a dictionary for use in side_data.
604  *
605  * @param dict The dictionary to pack.
606  * @param size pointer to store the size of the returned data
607  * @return pointer to data if successful, NULL otherwise
608  */
609 uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size);
610 /**
611  * Unpack a dictionary from side_data.
612  *
613  * @param data data from side_data
614  * @param size size of the data
615  * @param dict the metadata storage dictionary
616  * @return 0 on success, < 0 on failure
617  */
618 int av_packet_unpack_dictionary(const uint8_t *data, size_t size,
619  AVDictionary **dict);
620 
621 /**
622  * Convenience function to free all the side data stored.
623  * All the other fields stay untouched.
624  *
625  * @param pkt packet
626  */
628 
629 /**
630  * Setup a new reference to the data described by a given packet
631  *
632  * If src is reference-counted, setup dst as a new reference to the
633  * buffer in src. Otherwise allocate a new buffer in dst and copy the
634  * data from src into it.
635  *
636  * All the other fields are copied from src.
637  *
638  * @see av_packet_unref
639  *
640  * @param dst Destination packet. Will be completely overwritten.
641  * @param src Source packet
642  *
643  * @return 0 on success, a negative AVERROR on error. On error, dst
644  * will be blank (as if returned by av_packet_alloc()).
645  */
646 int av_packet_ref(AVPacket *dst, const AVPacket *src);
647 
648 /**
649  * Wipe the packet.
650  *
651  * Unreference the buffer referenced by the packet and reset the
652  * remaining packet fields to their default values.
653  *
654  * @param pkt The packet to be unreferenced.
655  */
657 
658 /**
659  * Move every field in src to dst and reset src.
660  *
661  * @see av_packet_unref
662  *
663  * @param src Source packet, will be reset
664  * @param dst Destination packet
665  */
667 
668 /**
669  * Copy only "properties" fields from src to dst.
670  *
671  * Properties for the purpose of this function are all the fields
672  * beside those related to the packet data (buf, data, size)
673  *
674  * @param dst Destination packet
675  * @param src Source packet
676  *
677  * @return 0 on success AVERROR on failure.
678  */
679 int av_packet_copy_props(AVPacket *dst, const AVPacket *src);
680 
681 /**
682  * Ensure the data described by a given packet is reference counted.
683  *
684  * @note This function does not ensure that the reference will be writable.
685  * Use av_packet_make_writable instead for that purpose.
686  *
687  * @see av_packet_ref
688  * @see av_packet_make_writable
689  *
690  * @param pkt packet whose data should be made reference counted.
691  *
692  * @return 0 on success, a negative AVERROR on error. On failure, the
693  * packet is unchanged.
694  */
696 
697 /**
698  * Create a writable reference for the data described by a given packet,
699  * avoiding data copy if possible.
700  *
701  * @param pkt Packet whose data should be made writable.
702  *
703  * @return 0 on success, a negative AVERROR on failure. On failure, the
704  * packet is unchanged.
705  */
707 
708 /**
709  * Convert valid timing fields (timestamps / durations) in a packet from one
710  * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be
711  * ignored.
712  *
713  * @param pkt packet on which the conversion will be performed
714  * @param tb_src source timebase, in which the timing fields in pkt are
715  * expressed
716  * @param tb_dst destination timebase, to which the timing fields will be
717  * converted
718  */
719 void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst);
720 
721 /**
722  * @}
723  */
724 
725 #endif // AVCODEC_PACKET_H
av_packet_unref
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: avpacket.c:424
AV_PKT_DATA_NB
@ AV_PKT_DATA_NB
The number of side data types.
Definition: packet.h:309
AV_PKT_DATA_MPEGTS_STREAM_ID
@ 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...
Definition: packet.h:215
AV_PKT_DATA_PARAM_CHANGE
@ AV_PKT_DATA_PARAM_CHANGE
An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows:
Definition: packet.h:72
rational.h
av_grow_packet
int av_grow_packet(AVPacket *pkt, int grow_by)
Increase packet size, correctly zeroing padding.
Definition: avpacket.c:122
AV_PKT_DATA_ENCRYPTION_INFO
@ AV_PKT_DATA_ENCRYPTION_INFO
This side data contains encryption info for how to decrypt the packet.
Definition: packet.h:255
AVPacketSideData
Definition: packet.h:314
AVPacket::data
uint8_t * data
Definition: packet.h:373
av_packet_shrink_side_data
int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, size_t size)
Shrink the already allocated side data buffer.
Definition: avpacket.c:371
AV_PKT_DATA_PALETTE
@ AV_PKT_DATA_PALETTE
An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE bytes worth of palette.
Definition: packet.h:46
data
const char data[16]
Definition: mxf.c:143
AV_PKT_DATA_ENCRYPTION_INIT_INFO
@ AV_PKT_DATA_ENCRYPTION_INIT_INFO
This side data is encryption initialization data.
Definition: packet.h:249
version.h
AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE
@ AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE
Definition: packet.h:452
AV_PKT_DATA_AFD
@ AV_PKT_DATA_AFD
Active Format Description data consisting of a single byte as specified in ETSI TS 101 154 using AVAc...
Definition: packet.h:261
AVPacket::duration
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: packet.h:391
AVDictionary
Definition: dict.c:30
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT
@ AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT
Definition: packet.h:451
AV_PKT_DATA_SPHERICAL
@ AV_PKT_DATA_SPHERICAL
This side data should be associated with a video stream and corresponds to the AVSphericalMapping str...
Definition: packet.h:228
av_packet_free_side_data
void av_packet_free_side_data(AVPacket *pkt)
Convenience function to free all the side data stored.
Definition: avpacket.c:189
av_packet_free
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
Definition: avpacket.c:75
AVPacketSideData::size
size_t size
Definition: packet.h:316
av_packet_add_side_data
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.
Definition: avpacket.c:198
AVPacket::opaque_ref
AVBufferRef * opaque_ref
AVBufferRef for free use by the API user.
Definition: packet.h:409
av_shrink_packet
void av_shrink_packet(AVPacket *pkt, int size)
Reduce packet size, correctly zeroing padding.
Definition: avpacket.c:114
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
AV_PKT_DATA_DISPLAYMATRIX
@ AV_PKT_DATA_DISPLAYMATRIX
This side data contains a 3x3 transformation matrix describing an affine transformation that needs to...
Definition: packet.h:108
AV_PKT_DATA_STRINGS_METADATA
@ AV_PKT_DATA_STRINGS_METADATA
A list of zero terminated key/value strings.
Definition: packet.h:172
AV_PKT_DATA_REPLAYGAIN
@ AV_PKT_DATA_REPLAYGAIN
This side data should be associated with an audio stream and contains ReplayGain information in form ...
Definition: packet.h:99
av_packet_side_data_name
const char * av_packet_side_data_name(enum AVPacketSideDataType type)
Definition: avpacket.c:270
av_init_packet
void av_init_packet(AVPacket *pkt)
Definition: avpacket.c:37
AV_PKT_DATA_WEBVTT_SETTINGS
@ AV_PKT_DATA_WEBVTT_SETTINGS
The optional settings (rendering instructions) that immediately follow the timestamp specifier of a W...
Definition: packet.h:202
pkt
AVPacket * pkt
Definition: movenc.c:59
AV_PKT_DATA_AUDIO_SERVICE_TYPE
@ AV_PKT_DATA_AUDIO_SERVICE_TYPE
This side data should be associated with an audio stream and corresponds to enum AVAudioServiceType.
Definition: packet.h:120
AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS
@ AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS
Definition: packet.h:453
av_new_packet
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
Definition: avpacket.c:99
AV_PKT_DATA_STEREO3D
@ AV_PKT_DATA_STEREO3D
This side data should be associated with a video stream and contains Stereoscopic 3D information in f...
Definition: packet.h:114
AV_PKT_DATA_MASTERING_DISPLAY_METADATA
@ AV_PKT_DATA_MASTERING_DISPLAY_METADATA
Mastering display metadata (based on SMPTE-2086:2014).
Definition: packet.h:222
AV_PKT_DATA_ICC_PROFILE
@ AV_PKT_DATA_ICC_PROFILE
ICC profile data consisting of an opaque octet buffer following the format described by ISO 15076-1.
Definition: packet.h:274
AVPacketSideData::data
uint8_t * data
Definition: packet.h:315
AV_PKT_DATA_DYNAMIC_HDR10_PLUS
@ AV_PKT_DATA_DYNAMIC_HDR10_PLUS
HDR10+ dynamic metadata associated with a video frame.
Definition: packet.h:299
AVPacket::opaque
void * opaque
for some private data of the user
Definition: packet.h:398
AV_PKT_DATA_PRFT
@ AV_PKT_DATA_PRFT
Producer Reference Time data corresponding to the AVProducerReferenceTime struct, usually exported by...
Definition: packet.h:268
AVSideDataParamChangeFlags
AVSideDataParamChangeFlags
Definition: packet.h:449
AVPacket::buf
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
Definition: packet.h:356
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AVPacketSideData::type
enum AVPacketSideDataType type
Definition: packet.h:317
AV_PKT_DATA_SUBTITLE_POSITION
@ AV_PKT_DATA_SUBTITLE_POSITION
Subtitle event position.
Definition: packet.h:183
av_packet_ref
int av_packet_ref(AVPacket *dst, const AVPacket *src)
Setup a new reference to the data described by a given packet.
Definition: avpacket.c:432
av_packet_move_ref
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
Definition: avpacket.c:481
av_packet_from_data
int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size)
Initialize a reference-counted packet from av_malloc()ed data.
Definition: avpacket.c:173
AVPacket::size
int size
Definition: packet.h:374
size
int size
Definition: twinvq_data.h:10344
AV_PKT_DATA_H263_MB_INFO
@ 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...
Definition: packet.h:93
av_packet_unpack_dictionary
int av_packet_unpack_dictionary(const uint8_t *data, size_t size, AVDictionary **dict)
Unpack a dictionary from side_data.
Definition: avpacket.c:344
buffer.h
attribute_deprecated
#define attribute_deprecated
Definition: attributes.h:104
AVPacket::dts
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
Definition: packet.h:372
AVPacketSideDataType
AVPacketSideDataType
Definition: packet.h:40
attributes.h
av_packet_pack_dictionary
uint8_t * av_packet_pack_dictionary(AVDictionary *dict, size_t *size)
Pack a dictionary for use in side_data.
Definition: avpacket.c:309
AV_PKT_DATA_CONTENT_LIGHT_LEVEL
@ AV_PKT_DATA_CONTENT_LIGHT_LEVEL
Content light level (based on CTA-861.3).
Definition: packet.h:235
av_packet_make_refcounted
int av_packet_make_refcounted(AVPacket *pkt)
Ensure the data described by a given packet is reference counted.
Definition: avpacket.c:487
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:379
av_packet_alloc
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
Definition: avpacket.c:64
av_packet_rescale_ts
void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst)
Convert valid timing fields (timestamps / durations) in a packet from one timebase to another.
Definition: avpacket.c:528
AV_PKT_DATA_METADATA_UPDATE
@ AV_PKT_DATA_METADATA_UPDATE
A list of zero terminated key/value strings.
Definition: packet.h:209
AV_PKT_DATA_JP_DUALMONO
@ AV_PKT_DATA_JP_DUALMONO
An AV_PKT_DATA_JP_DUALMONO side data packet indicates that the packet may contain "dual mono" audio s...
Definition: packet.h:166
av_packet_copy_props
int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
Copy only "properties" fields from src to dst.
Definition: avpacket.c:387
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:366
av_packet_get_side_data
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, size_t *size)
Get side information from packet.
Definition: avpacket.c:253
AV_PKT_DATA_A53_CC
@ AV_PKT_DATA_A53_CC
ATSC A53 Part 4 Closed Captions.
Definition: packet.h:242
AV_PKT_DATA_CPB_PROPERTIES
@ AV_PKT_DATA_CPB_PROPERTIES
This side data corresponds to the AVCPBProperties struct.
Definition: packet.h:145
AV_PKT_DATA_SKIP_SAMPLES
@ AV_PKT_DATA_SKIP_SAMPLES
Recommmends skipping the specified number of samples.
Definition: packet.h:156
AV_PKT_DATA_DOVI_CONF
@ AV_PKT_DATA_DOVI_CONF
DOVI configuration ref: dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2....
Definition: packet.h:283
dict.h
AVPacket::side_data
AVPacketSideData * side_data
Additional packet data that can be provided by the container.
Definition: packet.h:384
AV_PKT_DATA_S12M_TIMECODE
@ AV_PKT_DATA_S12M_TIMECODE
Timecode which conforms to SMPTE ST 12-1:2014.
Definition: packet.h:291
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT
@ AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT
Definition: packet.h:450
av_packet_new_side_data
uint8_t * av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, size_t size)
Allocate new information of a packet.
Definition: avpacket.c:232
AV_PKT_DATA_NEW_EXTRADATA
@ 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...
Definition: packet.h:55
av_packet_make_writable
int av_packet_make_writable(AVPacket *pkt)
Create a writable reference for the data described by a given packet, avoiding data copy if possible.
Definition: avpacket.c:506
AVPacket::stream_index
int stream_index
Definition: packet.h:375
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL
@ AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL
Data found in BlockAdditional element of matroska container.
Definition: packet.h:191
AVPacket
This structure stores compressed data.
Definition: packet.h:350
src
INIT_CLIP pixel * src
Definition: h264pred_template.c:418
AVPacket::pos
int64_t pos
byte position in stream, -1 if unknown
Definition: packet.h:393
AV_PKT_DATA_FALLBACK_TRACK
@ AV_PKT_DATA_FALLBACK_TRACK
This side data contains an integer value representing the stream index of a "fallback" track.
Definition: packet.h:140
AV_PKT_DATA_QUALITY_STATS
@ AV_PKT_DATA_QUALITY_STATS
This side data contains quality related information from the encoder.
Definition: packet.h:132
AV_PKT_DATA_WEBVTT_IDENTIFIER
@ AV_PKT_DATA_WEBVTT_IDENTIFIER
The optional first identifier line of a WebVTT cue.
Definition: packet.h:196
AVPacket::time_base
AVRational time_base
Time base of the packet's timestamps.
Definition: packet.h:417
AVPacket::side_data_elems
int side_data_elems
Definition: packet.h:385
av_packet_clone
AVPacket * av_packet_clone(const AVPacket *src)
Create a new packet that references the same data as src.
Definition: avpacket.c:468