summaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-01 13:06:21 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-01 13:18:32 +0200
commit6e8e9f1e517ee52fe439f3e8ca762f09d235f21e (patch)
treeffd2f6414002eb7ba196046b78667b5b30676585 /libavutil
parentec1ed6450620f01197920f1083b285e5c8355377 (diff)
parent8c02adc62d71dfbb079a04753d8c16152c49de88 (diff)
downloadffmpeg-streaming-6e8e9f1e517ee52fe439f3e8ca762f09d235f21e.zip
ffmpeg-streaming-6e8e9f1e517ee52fe439f3e8ca762f09d235f21e.tar.gz
Merge commit '8c02adc62d71dfbb079a04753d8c16152c49de88'
* commit '8c02adc62d71dfbb079a04753d8c16152c49de88': lavu: add all color-related enums to AVFrame Conflicts: libavcodec/avcodec.h libavutil/frame.c libavutil/frame.h libavutil/version.h The version check is changed so they are available with the current ABI FFmpeg libs should have no problems with added fields, nor should any application using the libs, and we regularly added fields in the past. We also moved 2 of these fields to AVFrame already previously without issues. See: a80e622924c89df69fb1c225ba432fe12fe6648e Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/frame.c13
-rw-r--r--libavutil/frame.h69
-rw-r--r--libavutil/pixfmt.h83
-rw-r--r--libavutil/version.h6
4 files changed, 127 insertions, 44 deletions
diff --git a/libavutil/frame.c b/libavutil/frame.c
index 89557ed..b6b755f 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -103,8 +103,14 @@ static void get_frame_defaults(AVFrame *frame)
frame->key_frame = 1;
frame->sample_aspect_ratio = (AVRational){ 0, 1 };
frame->format = -1; /* unknown */
- frame->colorspace = AVCOL_SPC_UNSPECIFIED;
frame->extended_data = frame->data;
+#if FF_API_AVFRAME_COLORSPACE
+ frame->color_primaries = AVCOL_PRI_UNSPECIFIED;
+ frame->color_trc = AVCOL_TRC_UNSPECIFIED;
+ frame->colorspace = AVCOL_SPC_UNSPECIFIED;
+ frame->color_range = AVCOL_RANGE_UNSPECIFIED;
+ frame->chroma_location = AVCHROMA_LOC_UNSPECIFIED;
+#endif
}
AVFrame *av_frame_alloc(void)
@@ -469,8 +475,13 @@ int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
dst->display_picture_number = src->display_picture_number;
dst->flags = src->flags;
dst->decode_error_flags = src->decode_error_flags;
+#if FF_API_AVFRAME_COLORSPACE
+ dst->color_primaries = src->color_primaries;
+ dst->color_trc = src->color_trc;
dst->colorspace = src->colorspace;
dst->color_range = src->color_range;
+ dst->chroma_location = src->chroma_location;
+#endif
av_dict_copy(&dst->metadata, src->metadata, 0);
diff --git a/libavutil/frame.h b/libavutil/frame.h
index dd85174..c23e5af 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -33,32 +33,10 @@
#include "dict.h"
#include "rational.h"
#include "samplefmt.h"
+#include "pixfmt.h"
#include "version.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
-};
-
-
/**
* @defgroup lavu_frame AVFrame
* @ingroup lavu_data
@@ -453,6 +431,32 @@ typedef struct AVFrame {
*/
int flags;
+#if FF_API_AVFRAME_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;
+
+ enum AVColorPrimaries color_primaries;
+
+ enum AVColorTransferCharacteristic color_trc;
+
+ /**
+ * 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;
+
+ enum AVChromaLocation chroma_location;
+#endif
+
/**
* frame timestamp estimated using various heuristics, in stream time base
* Code outside libavcodec should access this field using:
@@ -523,25 +527,6 @@ 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;
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 98987a5..69c5b87 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -420,4 +420,87 @@ enum AVPixelFormat {
#define PIX_FMT_GBRP16 AV_PIX_FMT_GBRP16
#endif
+/**
+ * Chromaticity coordinates of the source primaries.
+ */
+enum AVColorPrimaries {
+ AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B
+ AVCOL_PRI_UNSPECIFIED = 2,
+ AVCOL_PRI_BT470M = 4,
+ AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM
+ AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
+ AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above
+ AVCOL_PRI_FILM = 8,
+ AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020
+ AVCOL_PRI_NB, ///< Not part of ABI
+};
+
+/**
+ * Color Transfer Characteristic.
+ */
+enum AVColorTransferCharacteristic {
+ AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361
+ AVCOL_TRC_UNSPECIFIED = 2,
+ AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM
+ AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG
+ AVCOL_TRC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC
+ AVCOL_TRC_SMPTE240M = 7,
+ AVCOL_TRC_LINEAR = 8, ///< "Linear transfer characteristics"
+ AVCOL_TRC_LOG = 9, ///< "Logarithmic transfer characteristic (100:1 range)"
+ AVCOL_TRC_LOG_SQRT = 10, ///< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)"
+ AVCOL_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4
+ AVCOL_TRC_BT1361_ECG = 12, ///< ITU-R BT1361 Extended Colour Gamut
+ AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC)
+ AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10 bit system
+ AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12 bit system
+ AVCOL_TRC_NB, ///< Not part of ABI
+};
+
+/**
+ * YUV colorspace type.
+ */
+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
+
+
+/**
+ * MPEG vs JPEG YUV range.
+ */
+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
+};
+
+/**
+ * Location of chroma samples.
+ *
+ * X X 3 4 X X are luma samples,
+ * 1 2 1-6 are possible chroma positions
+ * X X 5 6 X 0 is undefined/unknown position
+ */
+enum AVChromaLocation {
+ AVCHROMA_LOC_UNSPECIFIED = 0,
+ AVCHROMA_LOC_LEFT = 1, ///< mpeg2/4, h264 default
+ AVCHROMA_LOC_CENTER = 2, ///< mpeg1, jpeg, h263
+ AVCHROMA_LOC_TOPLEFT = 3, ///< DV
+ AVCHROMA_LOC_TOP = 4,
+ AVCHROMA_LOC_BOTTOMLEFT = 5,
+ AVCHROMA_LOC_BOTTOM = 6,
+ AVCHROMA_LOC_NB, ///< Not part of ABI
+};
+
#endif /* AVUTIL_PIXFMT_H */
diff --git a/libavutil/version.h b/libavutil/version.h
index 4dad89a..6fb21b5 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -56,7 +56,7 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 52
-#define LIBAVUTIL_VERSION_MINOR 87
+#define LIBAVUTIL_VERSION_MINOR 88
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -137,6 +137,10 @@
#ifndef FF_API_OPT_TYPE_METADATA
#define FF_API_OPT_TYPE_METADATA (LIBAVUTIL_VERSION_MAJOR < 54)
#endif
+#ifndef FF_API_AVFRAME_COLORSPACE
+#define FF_API_AVFRAME_COLORSPACE (LIBAVUTIL_VERSION_MAJOR >= 52)
+#endif
+
#ifndef FF_CONST_AVUTIL53
#if LIBAVUTIL_VERSION_MAJOR >= 53
OpenPOWER on IntegriCloud