diff options
author | wm4 <wm4@nowhere> | 2013-07-27 21:17:31 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-07-28 18:44:20 +0200 |
commit | 13a0e6373ed210d8a43648136ce4011924dbe97e (patch) | |
tree | c77762e9b838b7d3a03f52afd2f983195008456c /video/mp_image.c | |
parent | ff0680c9b432f087f7fa57cc8f27fdeb4ac578f8 (diff) | |
download | mpv-13a0e6373ed210d8a43648136ce4011924dbe97e.tar.bz2 mpv-13a0e6373ed210d8a43648136ce4011924dbe97e.tar.xz |
mp_image: pass through colorspace info to libavfilter
This change affects vf_lavfi. Until recently, libavfilter was not
colorspace aware at all. This changed with the addition of colorspace
fields to AVFrame. libavfilter's vf_scale picks them up (as of recent
ffmpeg git). Since this support is still kind of wonky and not part of
the normal format negotiation, this won't set the correct output
colorspace, though.
Not adding a separate test for HAVE_AVFRAME_COLORSPACE. This is slightly
unclean, but on the other hand adding an explicit test seems like a
waste of effort.
Diffstat (limited to 'video/mp_image.c')
-rw-r--r-- | video/mp_image.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/video/mp_image.c b/video/mp_image.c index 9324e50882..26b8998197 100644 --- a/video/mp_image.c +++ b/video/mp_image.c @@ -521,6 +521,9 @@ void mp_image_copy_fields_from_av_frame(struct mp_image *dst, #endif } +// Not strictly related, but was added in a similar timeframe. +#define HAVE_AVFRAME_COLORSPACE HAVE_AVCODEC_CHROMA_POS_API + // Copy properties and data of the mp_image into the AVFrame, without taking // care of memory management issues. void mp_image_copy_fields_to_av_frame(struct AVFrame *dst, @@ -543,6 +546,11 @@ void mp_image_copy_fields_to_av_frame(struct AVFrame *dst, dst->top_field_first = 1; if (src->fields & MP_IMGFIELD_REPEAT_FIRST) dst->repeat_pict = 1; + +#if HAVE_AVFRAME_COLORSPACE + dst->colorspace = mp_csp_to_avcol_spc(src->colorspace); + dst->color_range = mp_csp_levels_to_avcol_range(src->levels); +#endif } #if HAVE_AVUTIL_REFCOUNTING |