Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-03 06:50:07 +0400
committerMichael Niedermayer <michaelni@gmx.at>2014-06-03 07:13:51 +0400
commit4e3fe65610c991e547f1103978040dbfb323d891 (patch)
treea8077c4544a5ad1e12a766a4ffd45d5e149c2975 /libavcodec/utils.c
parent763e714442e07f6430b003c8a9f4b62deaa7b3a5 (diff)
avcodec/utils/ff_init_buffer_info: Favor color information from AVFrame if available
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index e1301b0875..565e2ffa58 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -786,13 +786,16 @@ int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame)
frame->reordered_opaque = avctx->reordered_opaque;
#if FF_API_AVFRAME_COLORSPACE
- frame->color_primaries = avctx->color_primaries;
- frame->color_trc = avctx->color_trc;
+ if (frame->color_primaries == AVCOL_PRI_UNSPECIFIED)
+ frame->color_primaries = avctx->color_primaries;
+ if (frame->color_trc == AVCOL_TRC_UNSPECIFIED)
+ frame->color_trc = avctx->color_trc;
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);
- frame->chroma_location = avctx->chroma_sample_location;
+ if (frame->chroma_location == AVCHROMA_LOC_UNSPECIFIED)
+ frame->chroma_location = avctx->chroma_sample_location;
#endif
switch (avctx->codec->type) {