1 /*
2  *
3  * This file is part of FFmpeg.
4  *
5  * FFmpeg is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * FFmpeg is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with FFmpeg; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 module ffmpeg.libavutil.frame;
20 
21 /**
22  * @file
23  * @ingroup lavu_frame
24  * reference-counted frame API
25  */
26 
27 //#ifndef AVUTIL_FRAME_H
28 //#define AVUTIL_FRAME_H
29 
30 import std.stdint;
31 
32 import ffmpeg.libavutil.avutil; //#include "avutil.h"
33 import ffmpeg.libavutil.buffer; //#include "buffer.h"
34 import ffmpeg.libavutil.dict; //#include "dict.h"
35 import ffmpeg.libavutil.rational; //#include "rational.h"
36 import ffmpeg.libavutil.samplefmt; //#include "samplefmt.h"
37 import ffmpeg.libavutil.pixfmt; //#include "pixfmt.h"
38 import ffmpeg.libavutil.avutil_version; //#include "version.h"
39 
40 @nogc nothrow extern(C):
41 /**
42  * @defgroup lavu_frame AVFrame
43  * @ingroup lavu_data
44  *
45  * @{
46  * AVFrame is an abstraction for reference-counted raw multimedia data.
47  */
48 
49 enum AVFrameSideDataType {
50     /**
51      * The data is the AVPanScan struct defined in libavcodec.
52      */
53     AV_FRAME_DATA_PANSCAN,
54     /**
55      * ATSC A53 Part 4 Closed Captions.
56      * A53 CC bitstream is stored as uint8_t in AVFrameSideData.data.
57      * The number of bytes of CC data is AVFrameSideData.size.
58      */
59     AV_FRAME_DATA_A53_CC,
60     /**
61      * Stereoscopic 3d metadata.
62      * The data is the AVStereo3D struct defined in libavutil/stereo3d.h.
63      */
64     AV_FRAME_DATA_STEREO3D,
65     /**
66      * The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h.
67      */
68     AV_FRAME_DATA_MATRIXENCODING,
69     /**
70      * Metadata relevant to a downmix procedure.
71      * The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h.
72      */
73     AV_FRAME_DATA_DOWNMIX_INFO,
74     /**
75      * ReplayGain information in the form of the AVReplayGain struct.
76      */
77     AV_FRAME_DATA_REPLAYGAIN,
78     /**
79      * This side data contains a 3x3 transformation matrix describing an affine
80      * transformation that needs to be applied to the frame for correct
81      * presentation.
82      *
83      * See libavutil/display.h for a detailed description of the data.
84      */
85     AV_FRAME_DATA_DISPLAYMATRIX,
86     /**
87      * Active Format Description data consisting of a single byte as specified
88      * in ETSI TS 101 154 using AVActiveFormatDescription enum.
89      */
90     AV_FRAME_DATA_AFD,
91     /**
92      * Motion vectors exported by some codecs (on demand through the export_mvs
93      * flag set in the libavcodec AVCodecContext flags2 option).
94      * The data is the AVMotionVector struct defined in
95      * libavutil/motion_vector.h.
96      */
97     AV_FRAME_DATA_MOTION_VECTORS,
98 };
99 
100 enum AVActiveFormatDescription {
101     AV_AFD_SAME         = 8,
102     AV_AFD_4_3          = 9,
103     AV_AFD_16_9         = 10,
104     AV_AFD_14_9         = 11,
105     AV_AFD_4_3_SP_14_9  = 13,
106     AV_AFD_16_9_SP_14_9 = 14,
107     AV_AFD_SP_4_3       = 15,
108 };
109 
110 struct AVFrameSideData {
111     AVFrameSideDataType type;
112     uint8_t *data;
113     int      size;
114     AVDictionary *metadata;
115 }
116 
117 /**
118  * This structure describes decoded (raw) audio or video data.
119  *
120  * AVFrame must be allocated using av_frame_alloc(). Note that this only
121  * allocates the AVFrame itself, the buffers for the data must be managed
122  * through other means (see below).
123  * AVFrame must be freed with av_frame_free().
124  *
125  * AVFrame is typically allocated once and then reused multiple times to hold
126  * different data (e.g. a single AVFrame to hold frames received from a
127  * decoder). In such a case, av_frame_unref() will free any references held by
128  * the frame and reset it to its original clean state before it
129  * is reused again.
130  *
131  * The data described by an AVFrame is usually reference counted through the
132  * AVBuffer API. The underlying buffer references are stored in AVFrame.buf /
133  * AVFrame.extended_buf. An AVFrame is considered to be reference counted if at
134  * least one reference is set, i.e. if AVFrame.buf[0] != NULL. In such a case,
135  * every single data plane must be contained in one of the buffers in
136  * AVFrame.buf or AVFrame.extended_buf.
137  * There may be a single buffer for all the data, or one separate buffer for
138  * each plane, or anything in between.
139  *
140  * sizeof(AVFrame) is not a part of the public ABI, so new fields may be added
141  * to the end with a minor bump.
142  * Similarly fields that are marked as to be only accessed by
143  * av_opt_ptr() can be reordered. This allows 2 forks to add fields
144  * without breaking compatibility with each other.
145  */
146 struct AVFrame {
147 //#define AV_NUM_DATA_POINTERS 8
148     /**
149      * pointer to the picture/channel planes.
150      * This might be different from the first allocated byte
151      *
152      * Some decoders access areas outside 0,0 - width,height, please
153      * see avcodec_align_dimensions2(). Some filters and swscale can read
154      * up to 16 bytes beyond the planes, if these filters are to be used,
155      * then 16 extra bytes must be allocated.
156      */
157     uint8_t *[AV_NUM_DATA_POINTERS]data;
158     
159     /**
160      * For video, size in bytes of each picture line.
161      * For audio, size in bytes of each plane.
162      *
163      * For audio, only linesize[0] may be set. For planar audio, each channel
164      * plane must be the same size.
165      *
166      * For video the linesizes should be multiples of the CPUs alignment
167      * preference, this is 16 or 32 for modern desktop CPUs.
168      * Some code requires such alignment other code can be slower without
169      * correct alignment, for yet other it makes no difference.
170      *
171      * @note The linesize may be larger than the size of usable data -- there
172      * may be extra padding present for performance reasons.
173      */
174     int [AV_NUM_DATA_POINTERS]linesize;
175     
176     /**
177      * pointers to the data planes/channels.
178      *
179      * For video, this should simply point to data[].
180      *
181      * For planar audio, each channel has a separate data pointer, and
182      * linesize[0] contains the size of each channel buffer.
183      * For packed audio, there is just one data pointer, and linesize[0]
184      * contains the total size of the buffer for all channels.
185      *
186      * Note: Both data and extended_data should always be set in a valid frame,
187      * but for planar audio with more channels that can fit in data,
188      * extended_data must be used in order to access all channels.
189      */
190     uint8_t **extended_data;
191     
192     /**
193      * width and height of the video frame
194      */
195     int width, height;
196     
197     /**
198      * number of audio samples (per channel) described by this frame
199      */
200     int nb_samples;
201     
202     /**
203      * format of the frame, -1 if unknown or unset
204      * Values correspond to enum AVPixelFormat for video frames,
205      * enum AVSampleFormat for audio)
206      */
207     int format;
208     
209     /**
210      * 1 -> keyframe, 0-> not
211      */
212     int key_frame;
213     
214     /**
215      * Picture type of the frame.
216      */
217     AVPictureType pict_type;
218     
219 static if (FF_API_AVFRAME_LAVC) {
220     deprecated
221         uint8_t *[AV_NUM_DATA_POINTERS]base;
222 }
223     
224     /**
225      * Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
226      */
227     AVRational sample_aspect_ratio;
228     
229     /**
230      * Presentation timestamp in time_base units (time when frame should be shown to user).
231      */
232     int64_t pts;
233     
234     /**
235      * PTS copied from the AVPacket that was decoded to produce this frame.
236      */
237     int64_t pkt_pts;
238     
239     /**
240      * DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used)
241      * This is also the Presentation time of this AVFrame calculated from
242      * only AVPacket.dts values without pts values.
243      */
244     int64_t pkt_dts;
245     
246     /**
247      * picture number in bitstream order
248      */
249     int coded_picture_number;
250     /**
251      * picture number in display order
252      */
253     int display_picture_number;
254     
255     /**
256      * quality (between 1 (good) and FF_LAMBDA_MAX (bad))
257      */
258     int quality;
259     
260 static if (FF_API_AVFRAME_LAVC) {
261     deprecated
262         int reference;
263     
264     /**
265      * QP table
266      */
267     deprecated
268         int8_t *qscale_table;
269     /**
270      * QP store stride
271      */
272     deprecated
273         int qstride;
274     
275     deprecated
276         int qscale_type;
277     
278     /**
279      * mbskip_table[mb]>=1 if MB didn't change
280      * stride= mb_width = (width+15)>>4
281      */
282     deprecated
283         uint8_t *mbskip_table;
284     
285     /**
286      * motion vector table
287      * @code
288      * example:
289      * int mv_sample_log2= 4 - motion_subsample_log2;
290      * int mb_width= (width+15)>>4;
291      * int mv_stride= (mb_width << mv_sample_log2) + 1;
292      * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y];
293      * @endcode
294      */
295     int16_t function() [2][2]motion_val;
296     
297     /**
298      * macroblock type table
299      * mb_type_base + mb_width + 2
300      */
301     deprecated
302         uint32_t *mb_type;
303     
304     /**
305      * DCT coefficients
306      */
307     deprecated
308         short *dct_coeff;
309     
310     /**
311      * motion reference frame index
312      * the order in which these are stored can depend on the codec.
313      */
314     deprecated
315         int8_t *[2]ref_index;
316 }
317     
318     /**
319      * for some private data of the user
320      */
321     void *opaque;
322     
323     /**
324      * error
325      */
326     uint64_t [AV_NUM_DATA_POINTERS]error;
327     
328 static if (FF_API_AVFRAME_LAVC) {
329     deprecated
330         int type;
331 }
332     
333     /**
334      * When decoding, this signals how much the picture must be delayed.
335      * extra_delay = repeat_pict / (2*fps)
336      */
337     int repeat_pict;
338     
339     /**
340      * The content of the picture is interlaced.
341      */
342     int interlaced_frame;
343     
344     /**
345      * If the content is interlaced, is top field displayed first.
346      */
347     int top_field_first;
348     
349     /**
350      * Tell user application that palette has changed from previous frame.
351      */
352     int palette_has_changed;
353     
354 static if (FF_API_AVFRAME_LAVC) {
355     deprecated
356         int buffer_hints;
357     
358     /**
359      * Pan scan.
360      */
361     deprecated
362             ffmpeg.libavcodec.avcodec.AVPanScan *pan_scan;
363 }
364     
365     /**
366      * reordered opaque 64bit (generally an integer or a double precision float
367      * PTS but can be anything).
368      * The user sets AVCodecContext.reordered_opaque to represent the input at
369      * that time,
370      * the decoder reorders values as needed and sets AVFrame.reordered_opaque
371      * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque
372      * @deprecated in favor of pkt_pts
373      */
374     int64_t reordered_opaque;
375     
376 static if (FF_API_AVFRAME_LAVC) {
377     /**
378      * @deprecated this field is unused
379      */
380     deprecated void *hwaccel_picture_private;
381     
382     deprecated
383             ffmpeg.libavcodec.avcodec.AVCodecContext *owner;
384     deprecated
385         void *thread_opaque;
386     
387     /**
388      * log2 of the size of the block which a single vector in motion_val represents:
389      * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2)
390      */
391     uint8_t motion_subsample_log2;
392 }
393     
394     /**
395      * Sample rate of the audio data.
396      */
397     int sample_rate;
398     
399     /**
400      * Channel layout of the audio data.
401      */
402     uint64_t channel_layout;
403     
404     /**
405      * AVBuffer references backing the data for this frame. If all elements of
406      * this array are NULL, then this frame is not reference counted.
407      *
408      * There may be at most one AVBuffer per data plane, so for video this array
409      * always contains all the references. For planar audio with more than
410      * AV_NUM_DATA_POINTERS channels, there may be more buffers than can fit in
411      * this array. Then the extra AVBufferRef pointers are stored in the
412      * extended_buf array.
413      */
414     AVBufferRef *[AV_NUM_DATA_POINTERS]buf;
415     
416     /**
417      * For planar audio which requires more than AV_NUM_DATA_POINTERS
418      * AVBufferRef pointers, this array will hold all the references which
419      * cannot fit into AVFrame.buf.
420      *
421      * Note that this is different from AVFrame.extended_data, which always
422      * contains all the pointers. This array only contains the extra pointers,
423      * which cannot fit into AVFrame.buf.
424      *
425      * This array is always allocated using av_malloc() by whoever constructs
426      * the frame. It is freed in av_frame_unref().
427      */
428     AVBufferRef **extended_buf;
429     /**
430      * Number of elements in extended_buf.
431      */
432     int        nb_extended_buf;
433     
434     AVFrameSideData **side_data;
435     int            nb_side_data;
436     
437     /**
438  * @defgroup lavu_frame_flags AV_FRAME_FLAGS
439  * Flags describing additional frame properties.
440  *
441  * @{
442  */
443     
444     /**
445  * The frame data may be corrupted, e.g. due to decoding errors.
446  */
447 //#define AV_FRAME_FLAG_CORRUPT       (1 << 0)
448     /**
449  * @}
450  */
451     
452     /**
453      * Frame flags, a combination of @ref lavu_frame_flags
454      */
455     int flags;
456     
457     /**
458      * MPEG vs JPEG YUV range.
459      * It must be accessed using av_frame_get_color_range() and
460      * av_frame_set_color_range().
461      * - encoding: Set by user
462      * - decoding: Set by libavcodec
463      */
464     AVColorRange color_range;
465     
466     AVColorPrimaries color_primaries;
467     
468     AVColorTransferCharacteristic color_trc;
469     
470     /**
471      * YUV colorspace type.
472      * It must be accessed using av_frame_get_colorspace() and
473      * av_frame_set_colorspace().
474      * - encoding: Set by user
475      * - decoding: Set by libavcodec
476      */
477     AVColorSpace colorspace;
478     
479     AVChromaLocation chroma_location;
480     
481     /**
482      * frame timestamp estimated using various heuristics, in stream time base
483      * Code outside libavcodec should access this field using:
484      * av_frame_get_best_effort_timestamp(frame)
485      * - encoding: unused
486      * - decoding: set by libavcodec, read by user.
487      */
488     int64_t best_effort_timestamp;
489     
490     /**
491      * reordered pos from the last AVPacket that has been input into the decoder
492      * Code outside libavcodec should access this field using:
493      * av_frame_get_pkt_pos(frame)
494      * - encoding: unused
495      * - decoding: Read by user.
496      */
497     int64_t pkt_pos;
498     
499     /**
500      * duration of the corresponding packet, expressed in
501      * AVStream->time_base units, 0 if unknown.
502      * Code outside libavcodec should access this field using:
503      * av_frame_get_pkt_duration(frame)
504      * - encoding: unused
505      * - decoding: Read by user.
506      */
507     int64_t pkt_duration;
508     
509     /**
510      * metadata.
511      * Code outside libavcodec should access this field using:
512      * av_frame_get_metadata(frame)
513      * - encoding: Set by user.
514      * - decoding: Set by libavcodec.
515      */
516     AVDictionary *metadata;
517     
518     /**
519      * decode error flags of the frame, set to a combination of
520      * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there
521      * were errors during the decoding.
522      * Code outside libavcodec should access this field using:
523      * av_frame_get_decode_error_flags(frame)
524      * - encoding: unused
525      * - decoding: set by libavcodec, read by user.
526      */
527     int decode_error_flags;
528 //#define FF_DECODE_ERROR_INVALID_BITSTREAM   1
529 //#define FF_DECODE_ERROR_MISSING_REFERENCE   2
530     
531     /**
532      * number of audio channels, only used for audio.
533      * Code outside libavcodec should access this field using:
534      * av_frame_get_channels(frame)
535      * - encoding: unused
536      * - decoding: Read by user.
537      */
538     int channels;
539     
540     /**
541      * size of the corresponding packet containing the compressed
542      * frame. It must be accessed using av_frame_get_pkt_size() and
543      * av_frame_set_pkt_size().
544      * It is set to a negative value if unknown.
545      * - encoding: unused
546      * - decoding: set by libavcodec, read by user.
547      */
548     int pkt_size;
549     
550     /**
551      * Not to be accessed directly from outside libavutil
552      */
553     AVBufferRef *qp_table_buf;
554 }
555 
556 /**
557  * Accessors for some AVFrame fields.
558  * The position of these field in the structure is not part of the ABI,
559  * they should not be accessed directly outside libavcodec.
560  */
561 int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
562 void    av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
563 int64_t av_frame_get_pkt_duration         (const AVFrame *frame);
564 void    av_frame_set_pkt_duration         (AVFrame *frame, int64_t val);
565 int64_t av_frame_get_pkt_pos              (const AVFrame *frame);
566 void    av_frame_set_pkt_pos              (AVFrame *frame, int64_t val);
567 int64_t av_frame_get_channel_layout       (const AVFrame *frame);
568 void    av_frame_set_channel_layout       (AVFrame *frame, int64_t val);
569 int     av_frame_get_channels             (const AVFrame *frame);
570 void    av_frame_set_channels             (AVFrame *frame, int     val);
571 int     av_frame_get_sample_rate          (const AVFrame *frame);
572 void    av_frame_set_sample_rate          (AVFrame *frame, int     val);
573 AVDictionary *av_frame_get_metadata       (const AVFrame *frame);
574 void          av_frame_set_metadata       (AVFrame *frame, AVDictionary *val);
575 int     av_frame_get_decode_error_flags   (const AVFrame *frame);
576 void    av_frame_set_decode_error_flags   (AVFrame *frame, int     val);
577 int     av_frame_get_pkt_size(const AVFrame *frame);
578 void    av_frame_set_pkt_size(AVFrame *frame, int val);
579 AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame);
580 int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type);
581 int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type);
582 enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
583 void    av_frame_set_colorspace(AVFrame *frame, AVColorSpace val);
584 enum AVColorRange av_frame_get_color_range(const AVFrame *frame);
585 void    av_frame_set_color_range(AVFrame *frame, AVColorRange val);
586 
587 /**
588  * Get the name of a colorspace.
589  * @return a static string identifying the colorspace; can be NULL.
590  */
591 char *av_get_colorspace_name(AVColorSpace val);
592 
593 /**
594  * Allocate an AVFrame and set its fields to default values.  The resulting
595  * struct must be freed using av_frame_free().
596  *
597  * @return An AVFrame filled with default values or NULL on failure.
598  *
599  * @note this only allocates the AVFrame itself, not the data buffers. Those
600  * must be allocated through other means, e.g. with av_frame_get_buffer() or
601  * manually.
602  */
603 AVFrame *av_frame_alloc();
604 
605 /**
606  * Free the frame and any dynamically allocated objects in it,
607  * e.g. extended_data. If the frame is reference counted, it will be
608  * unreferenced first.
609  *
610  * @param frame frame to be freed. The pointer will be set to NULL.
611  */
612 void av_frame_free(AVFrame **frame);
613 
614 /**
615  * Set up a new reference to the data described by the source frame.
616  *
617  * Copy frame properties from src to dst and create a new reference for each
618  * AVBufferRef from src.
619  *
620  * If src is not reference counted, new buffers are allocated and the data is
621  * copied.
622  *
623  * @return 0 on success, a negative AVERROR on error
624  */
625 int av_frame_ref(AVFrame *dst, const AVFrame *src);
626 
627 /**
628  * Create a new frame that references the same data as src.
629  *
630  * This is a shortcut for av_frame_alloc()+av_frame_ref().
631  *
632  * @return newly created AVFrame on success, NULL on error.
633  */
634 AVFrame *av_frame_clone(const AVFrame *src);
635 
636 /**
637  * Unreference all the buffers referenced by frame and reset the frame fields.
638  */
639 void av_frame_unref(AVFrame *frame);
640 
641 /**
642  * Move everythnig contained in src to dst and reset src.
643  */
644 void av_frame_move_ref(AVFrame *dst, AVFrame *src);
645 
646 /**
647  * Allocate new buffer(s) for audio or video data.
648  *
649  * The following fields must be set on frame before calling this function:
650  * - format (pixel format for video, sample format for audio)
651  * - width and height for video
652  * - nb_samples and channel_layout for audio
653  *
654  * This function will fill AVFrame.data and AVFrame.buf arrays and, if
655  * necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf.
656  * For planar formats, one buffer will be allocated for each plane.
657  *
658  * @param frame frame in which to store the new buffers.
659  * @param align required buffer size alignment
660  *
661  * @return 0 on success, a negative AVERROR on error.
662  */
663 int av_frame_get_buffer(AVFrame *frame, int _align);
664 
665 /**
666  * Check if the frame data is writable.
667  *
668  * @return A positive value if the frame data is writable (which is true if and
669  * only if each of the underlying buffers has only one reference, namely the one
670  * stored in this frame). Return 0 otherwise.
671  *
672  * If 1 is returned the answer is valid until av_buffer_ref() is called on any
673  * of the underlying AVBufferRefs (e.g. through av_frame_ref() or directly).
674  *
675  * @see av_frame_make_writable(), av_buffer_is_writable()
676  */
677 int av_frame_is_writable(AVFrame *frame);
678 
679 /**
680  * Ensure that the frame data is writable, avoiding data copy if possible.
681  *
682  * Do nothing if the frame is writable, allocate new buffers and copy the data
683  * if it is not.
684  *
685  * @return 0 on success, a negative AVERROR on error.
686  *
687  * @see av_frame_is_writable(), av_buffer_is_writable(),
688  * av_buffer_make_writable()
689  */
690 int av_frame_make_writable(AVFrame *frame);
691 
692 /**
693  * Copy the frame data from src to dst.
694  *
695  * This function does not allocate anything, dst must be already initialized and
696  * allocated with the same parameters as src.
697  *
698  * This function only copies the frame data (i.e. the contents of the data /
699  * extended data arrays), not any other properties.
700  *
701  * @return >= 0 on success, a negative AVERROR on error.
702  */
703 int av_frame_copy(AVFrame *dst, const AVFrame *src);
704 
705 /**
706  * Copy only "metadata" fields from src to dst.
707  *
708  * Metadata for the purpose of this function are those fields that do not affect
709  * the data layout in the buffers.  E.g. pts, sample rate (for audio) or sample
710  * aspect ratio (for video), but not width/height or channel layout.
711  * Side data is also copied.
712  */
713 int av_frame_copy_props(AVFrame *dst, const AVFrame *src);
714 
715 /**
716  * Get the buffer reference a given data plane is stored in.
717  *
718  * @param plane index of the data plane of interest in frame->extended_data.
719  *
720  * @return the buffer reference that contains the plane or NULL if the input
721  * frame is not valid.
722  */
723 AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane);
724 
725 /**
726  * Add a new side data to a frame.
727  *
728  * @param frame a frame to which the side data should be added
729  * @param type type of the added side data
730  * @param size size of the side data
731  *
732  * @return newly added side data on success, NULL on error
733  */
734 AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
735                                         AVFrameSideDataType type,
736                                         int size);
737 
738 /**
739  * @return a pointer to the side data of a given type on success, NULL if there
740  * is no side data with such type in this frame.
741  */
742 AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
743                                         AVFrameSideDataType type);
744 
745 /**
746  * If side data of the supplied type exists in the frame, free it and remove it
747  * from the frame.
748  */
749 void av_frame_remove_side_data(AVFrame *frame, AVFrameSideDataType type);
750 
751 /**
752  * @return a string identifying the side data type
753  */
754 char *av_frame_side_data_name(AVFrameSideDataType type);
755 
756 /**
757  * @}
758  */
759 
760 //#endif /* AVUTIL_FRAME_H */
761 
762 enum FF_DECODE_ERROR_INVALID_BITSTREAM = 1;
763 enum FF_DECODE_ERROR_MISSING_REFERENCE = 2;
764 enum AV_NUM_DATA_POINTERS = 8;
765 enum AV_FRAME_FLAG_CORRUPT   =   (1 << 0);