diff options
Diffstat (limited to 'libmpcodecs')
-rw-r--r-- | libmpcodecs/dec_video.c | 6 | ||||
-rw-r--r-- | libmpcodecs/vd_ffmpeg.c | 5 |
2 files changed, 11 insertions, 0 deletions
diff --git a/libmpcodecs/dec_video.c b/libmpcodecs/dec_video.c index 148514db95..e328f3e948 100644 --- a/libmpcodecs/dec_video.c +++ b/libmpcodecs/dec_video.c @@ -129,9 +129,15 @@ void get_detected_video_colorspace(struct sh_video *sh, struct mp_csp_details *c csp->levels_out = opts->requested_output_range; if (csp->format == MP_CSP_AUTO) + csp->format = sh->colorspace; + if (csp->format == MP_CSP_AUTO) csp->format = mp_csp_guess_colorspace(vf->w, vf->h); + + if (csp->levels_in == MP_CSP_LEVELS_AUTO) + csp->levels_in = sh->color_range; if (csp->levels_in == MP_CSP_LEVELS_AUTO) csp->levels_in = MP_CSP_LEVELS_TV; + if (csp->levels_out == MP_CSP_LEVELS_AUTO) csp->levels_out = MP_CSP_LEVELS_PC; } diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index b30648b6f6..b2150579ea 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -42,6 +42,7 @@ #include "libmpdemux/demux_packet.h" #include "codec-cfg.h" #include "osdep/numcores.h" +#include "libvo/csputils.h" static const vd_info_t info = { "libavcodec video codecs", @@ -463,6 +464,10 @@ static int init_vo(sh_video_t *sh, enum PixelFormat pix_fmt) }; else supported_fmts = (const unsigned int[]){ctx->best_csp, 0xffffffff}; + + sh->colorspace = avcol_spc_to_mp_csp(avctx->colorspace); + sh->color_range = avcol_range_to_mp_csp_levels(avctx->color_range); + if (!mpcodecs_config_vo2(sh, sh->disp_w, sh->disp_h, supported_fmts, ctx->best_csp)) return -1; |