Commit 4e3fe656 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/utils/ff_init_buffer_info: Favor color information from AVFrame if available

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 763e7144
...@@ -786,12 +786,15 @@ int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame) ...@@ -786,12 +786,15 @@ int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame)
frame->reordered_opaque = avctx->reordered_opaque; frame->reordered_opaque = avctx->reordered_opaque;
#if FF_API_AVFRAME_COLORSPACE #if FF_API_AVFRAME_COLORSPACE
if (frame->color_primaries == AVCOL_PRI_UNSPECIFIED)
frame->color_primaries = avctx->color_primaries; frame->color_primaries = avctx->color_primaries;
if (frame->color_trc == AVCOL_TRC_UNSPECIFIED)
frame->color_trc = avctx->color_trc; frame->color_trc = avctx->color_trc;
if (av_frame_get_colorspace(frame) == AVCOL_SPC_UNSPECIFIED) if (av_frame_get_colorspace(frame) == AVCOL_SPC_UNSPECIFIED)
av_frame_set_colorspace(frame, avctx->colorspace); av_frame_set_colorspace(frame, avctx->colorspace);
if (av_frame_get_color_range(frame) == AVCOL_RANGE_UNSPECIFIED) if (av_frame_get_color_range(frame) == AVCOL_RANGE_UNSPECIFIED)
av_frame_set_color_range(frame, avctx->color_range); av_frame_set_color_range(frame, avctx->color_range);
if (frame->chroma_location == AVCHROMA_LOC_UNSPECIFIED)
frame->chroma_location = avctx->chroma_sample_location; frame->chroma_location = avctx->chroma_sample_location;
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment