From b04912422d97cad9787cc499282014bff5eb12a0 Mon Sep 17 00:00:00 2001 From: Ronag Date: Sat, 13 Aug 2011 15:47:32 +0000 Subject: [PATCH] 2.0. ffmpeg_producer: Can't use YUV as separate alpha, convert it to BGRA until support is fixed. git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@1159 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d --- core/producer/frame/pixel_format.h | 1 + modules/ffmpeg/producer/util.cpp | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/producer/frame/pixel_format.h b/core/producer/frame/pixel_format.h index 3cbf8938c..523cd683c 100644 --- a/core/producer/frame/pixel_format.h +++ b/core/producer/frame/pixel_format.h @@ -34,6 +34,7 @@ struct pixel_format abgr, ycbcr, ycbcra, + luma, count, invalid }; diff --git a/modules/ffmpeg/producer/util.cpp b/modules/ffmpeg/producer/util.cpp index 493203fe6..8019ab3e8 100644 --- a/modules/ffmpeg/producer/util.cpp +++ b/modules/ffmpeg/producer/util.cpp @@ -164,7 +164,7 @@ core::pixel_format_desc get_pixel_format_desc(PixelFormat pix_fmt, size_t width, bool try_make_gray(const safe_ptr& frame) { auto pix_fmt = get_pixel_format(static_cast(frame->format)); - if(pix_fmt != core::pixel_format::invalid) + if(pix_fmt == PIX_FMT_RGBA || pix_fmt == PIX_FMT_BGRA) frame->format = PIX_FMT_GRAY8; return pix_fmt != core::pixel_format::invalid; @@ -178,6 +178,10 @@ safe_ptr make_write_frame(const void* tag, const safe_ptrheight; auto desc = get_pixel_format_desc(static_cast(decoded_frame->format), width, height); + // TODO: Can't handle YUV as alpha + if(hints & core::frame_producer::ALPHA_HINT && (desc.pix_fmt == core::pixel_format::ycbcr || desc.pix_fmt == core::pixel_format::ycbcra)) + desc.pix_fmt = core::pixel_format::invalid; + if(desc.pix_fmt == core::pixel_format::invalid) { auto pix_fmt = static_cast(decoded_frame->format); -- 2.39.5