* commit 'eb800f120d2d42590fde2302fe828c847e41e773': libavcodec: set AVFrame colorspace fields on decoding Conflicts: libavcodec/utils.c
Unified · Split
| @@ -785,15 +785,21 @@ int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame) · 784 unmodified lines | ||
| 785 | 785 | } |
| 786 | 786 | frame->reordered_opaque = avctx->reordered_opaque; |
| 787 | 787 | |
| 788 | +#if FF_API_AVFRAME_COLORSPACE | |
| 789 | + frame->color_primaries = avctx->color_primaries; | |
| 790 | + frame->color_trc = avctx->color_trc; | |
| 791 | + if (av_frame_get_colorspace(frame) == AVCOL_SPC_UNSPECIFIED) | |
| 792 | + av_frame_set_colorspace(frame, avctx->colorspace); | |
| 793 | + if (av_frame_get_color_range(frame) == AVCOL_RANGE_UNSPECIFIED) | |
| 794 | + av_frame_set_color_range(frame, avctx->color_range); | |
| 795 | + frame->chroma_location = avctx->chroma_sample_location; | |
| 796 | +#endif | |
| 797 | + | |
| 788 | 798 | switch (avctx->codec->type) { |
| 789 | 799 | case AVMEDIA_TYPE_VIDEO: |
| 790 | 800 | frame->format = avctx->pix_fmt; |
| 791 | 801 | if (!frame->sample_aspect_ratio.num) |
| 792 | 802 | frame->sample_aspect_ratio = avctx->sample_aspect_ratio; |
| 793 | − if (av_frame_get_colorspace(frame) == AVCOL_SPC_UNSPECIFIED) | |
| 794 | − av_frame_set_colorspace(frame, avctx->colorspace); | |
| 795 | − if (av_frame_get_color_range(frame) == AVCOL_RANGE_UNSPECIFIED) | |
| 796 | − av_frame_set_color_range(frame, avctx->color_range); | |
| 797 | 803 | break; |
| 798 | 804 | case AVMEDIA_TYPE_AUDIO: |
| 799 | 805 | if (!frame->sample_rate) |