aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-07-14 19:13:46 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-07-17 01:15:31 +0200
commita80e622924c89df69fb1c225ba432fe12fe6648e (patch)
treed2d8f5a4cc4792bc0f6bb8dfd772091a5ed7a192 /libavcodec
parent0092bcdf06f240deed890c0d29a95b86f82fe2ee (diff)
downloadffmpeg-a80e622924c89df69fb1c225ba432fe12fe6648e.tar.gz
avcodec/avutil: Add AVColorSpace and AVColorRange to AVFrames
This also moves AVColorSpace and AVColorRange from avcodec to avutil Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/avcodec.h20
-rw-r--r--libavcodec/utils.c5
2 files changed, 5 insertions, 20 deletions
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 4b462fa5f8..fca8a8f67b 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -627,26 +627,6 @@ enum AVColorTransferCharacteristic{
AVCOL_TRC_NB , ///< Not part of ABI
};
-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_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
-};
-
/**
* X X 3 4 X X are luma samples,
* 1 2 1-6 are possible chroma positions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index d77b5ec661..ff26c5810c 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -643,6 +643,10 @@ int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame)
frame->format = avctx->pix_fmt;
if (!frame->sample_aspect_ratio.num)
frame->sample_aspect_ratio = avctx->sample_aspect_ratio;
+ if (av_frame_get_colorspace(frame) == AVCOL_SPC_UNSPECIFIED)
+ av_frame_set_colorspace(frame, avctx->colorspace);
+ if (av_frame_get_color_range(frame) == AVCOL_RANGE_UNSPECIFIED)
+ av_frame_set_color_range(frame, avctx->color_range);
break;
case AVMEDIA_TYPE_AUDIO:
if (!frame->sample_rate)
@@ -964,6 +968,7 @@ void avcodec_get_frame_defaults(AVFrame *frame)
frame->sample_aspect_ratio = (AVRational) {0, 1 };
frame->format = -1; /* unknown */
frame->extended_data = frame->data;
+ av_frame_set_colorspace(frame, AVCOL_SPC_UNSPECIFIED);
}
AVFrame *avcodec_alloc_frame(void)