diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-12-29 12:19:38 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-12-29 12:19:38 +0000 |
| commit | f7813a5324be39d13ab536c245d15dfc602a7849 (patch) | |
| tree | fad99148b88823d34a5df2f0a25881a002eb291b /ffmpeg/libavutil/frame.h | |
| parent | b7a5a477b8ff4d4e3028b9dfb9a9df0a41463f92 (diff) | |
basic type mechanism working
Diffstat (limited to 'ffmpeg/libavutil/frame.h')
| -rw-r--r-- | ffmpeg/libavutil/frame.h | 84 |
1 files changed, 80 insertions, 4 deletions
diff --git a/ffmpeg/libavutil/frame.h b/ffmpeg/libavutil/frame.h index 39a664f..b31cc3e 100644 --- a/ffmpeg/libavutil/frame.h +++ b/ffmpeg/libavutil/frame.h @@ -30,11 +30,45 @@ #include "rational.h" #include "samplefmt.h" +enum AVColorSpace{ + AVCOL_SPC_RGB = 0, + AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B + AVCOL_SPC_UNSPECIFIED = 2, + AVCOL_SPC_FCC = 4, + AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 + AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above + AVCOL_SPC_SMPTE240M = 7, + AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 + AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system + AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system + AVCOL_SPC_NB , ///< Not part of ABI +}; +#define AVCOL_SPC_YCGCO AVCOL_SPC_YCOCG + +enum AVColorRange{ + AVCOL_RANGE_UNSPECIFIED = 0, + AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges + AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges + AVCOL_RANGE_NB , ///< Not part of ABI +}; + + enum AVFrameSideDataType { /** * The data is the AVPanScan struct defined in libavcodec. */ AV_FRAME_DATA_PANSCAN, + /** + * ATSC A53 Part 4 Closed Captions. + * A53 CC bitstream is stored as uint8_t in AVFrameSideData.data. + * The number of bytes of CC data is AVFrameSideData.size. + */ + AV_FRAME_DATA_A53_CC, + /** + * Stereoscopic 3d metadata. + * The data is the AVStereo3D struct defined in libavutil/stereo3d.h. + */ + AV_FRAME_DATA_STEREO3D, }; typedef struct AVFrameSideData { @@ -97,6 +131,9 @@ typedef struct AVFrame { * preference, this is 16 or 32 for modern desktop CPUs. * Some code requires such alignment other code can be slower without * correct alignment, for yet other it makes no difference. + * + * @note The linesize may be larger than the size of usable data -- there + * may be extra padding present for performance reasons. */ int linesize[AV_NUM_DATA_POINTERS]; @@ -363,6 +400,16 @@ typedef struct AVFrame { AVFrameSideData **side_data; int nb_side_data; +/** + * The frame data may be corrupted, e.g. due to decoding errors. + */ +#define AV_FRAME_FLAG_CORRUPT (1 << 0) + + /** + * Frame flags, a combination of AV_FRAME_FLAG_* + */ + int flags; + /** * frame timestamp estimated using various heuristics, in stream time base * Code outside libavcodec should access this field using: @@ -433,6 +480,25 @@ typedef struct AVFrame { int pkt_size; /** + * YUV colorspace type. + * It must be accessed using av_frame_get_colorspace() and + * av_frame_set_colorspace(). + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorSpace colorspace; + + /** + * MPEG vs JPEG YUV range. + * It must be accessed using av_frame_get_color_range() and + * av_frame_set_color_range(). + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorRange color_range; + + + /** * Not to be accessed directly from outside libavutil */ AVBufferRef *qp_table_buf; @@ -464,6 +530,16 @@ void av_frame_set_pkt_size(AVFrame *frame, int val); AVDictionary **avpriv_frame_get_metadatap(AVFrame *frame); int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type); int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type); +enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame); +void av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val); +enum AVColorRange av_frame_get_color_range(const AVFrame *frame); +void av_frame_set_color_range(AVFrame *frame, enum AVColorRange val); + +/** + * Get the name of a colorspace. + * @return a static string identifying the colorspace; can be NULL. + */ +const char *av_get_colorspace_name(enum AVColorSpace val); /** * Allocate an AVFrame and set its fields to default values. The resulting @@ -487,7 +563,7 @@ AVFrame *av_frame_alloc(void); void av_frame_free(AVFrame **frame); /** - * Setup a new reference to the data described by an given frame. + * Setup a new reference to the data described by a given frame. * * Copy frame properties from src to dst and create a new reference for each * AVBufferRef from src. @@ -497,7 +573,7 @@ void av_frame_free(AVFrame **frame); * * @return 0 on success, a negative AVERROR on error */ -int av_frame_ref(AVFrame *dst, AVFrame *src); +int av_frame_ref(AVFrame *dst, const AVFrame *src); /** * Create a new frame that references the same data as src. @@ -506,7 +582,7 @@ int av_frame_ref(AVFrame *dst, AVFrame *src); * * @return newly created AVFrame on success, NULL on error. */ -AVFrame *av_frame_clone(AVFrame *src); +AVFrame *av_frame_clone(const AVFrame *src); /** * Unreference all the buffers referenced by frame and reset the frame fields. @@ -601,7 +677,7 @@ AVFrameSideData *av_frame_new_side_data(AVFrame *frame, * @return a pointer to the side data of a given type on success, NULL if there * is no side data with such type in this frame. */ -AVFrameSideData *av_frame_get_side_data(AVFrame *frame, +AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type); #endif /* AVUTIL_FRAME_H */ |
