From 0f1ad9d5a7d7ab0051e284cd2d13b8f31d5a397a Mon Sep 17 00:00:00 2001 From: ronag Date: Fri, 30 Dec 2011 09:18:32 +0000 Subject: [PATCH] Merged from trunk: r1964 --------------------- r1963 -NTSC square should be 540 high. -Possible to choose aspect-ratio in ogl-consumer. --------------------- git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.1.0@1965 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d --- core/video_format.cpp | 2 +- modules/ogl/consumer/ogl_consumer.cpp | 29 ++++++++++++++++++++++++++- shell/casparcg.config | 9 ++++++--- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/core/video_format.cpp b/core/video_format.cpp index 61f434147..a06d94b78 100644 --- a/core/video_format.cpp +++ b/core/video_format.cpp @@ -30,7 +30,7 @@ namespace caspar { namespace core { const std::vector format_descs = boost::assign::list_of (video_format_desc(video_format::pal, 720, 576, 1024, 576, field_mode::upper, 25, 1, L"PAL", boost::assign::list_of(3840))) - (video_format_desc(video_format::ntsc, 720, 486, 720, 534, field_mode::lower, 30000, 1001, L"NTSC", boost::assign::list_of(3204)(3202)(3204)(3202)(3204))) + (video_format_desc(video_format::ntsc, 720, 486, 720, 540, field_mode::lower, 30000, 1001, L"NTSC", boost::assign::list_of(3204)(3202)(3204)(3202)(3204))) (video_format_desc(video_format::x576p2500, 720, 576, 720, 576, field_mode::progressive, 25, 1, L"576p2500", boost::assign::list_of(3840) )) (video_format_desc(video_format::x720p2500, 1280, 720, 1280, 720, field_mode::progressive, 25, 1, L"720p2500", boost::assign::list_of(3840) )) (video_format_desc(video_format::x720p5000, 1280, 720, 1280, 720, field_mode::progressive, 50, 1, L"720p5000", boost::assign::list_of(1920) )) diff --git a/modules/ogl/consumer/ogl_consumer.cpp b/modules/ogl/consumer/ogl_consumer.cpp index 2406c62d1..bf2e69c80 100644 --- a/modules/ogl/consumer/ogl_consumer.cpp +++ b/modules/ogl/consumer/ogl_consumer.cpp @@ -81,12 +81,20 @@ enum stretch struct configuration { + enum aspect_ratio + { + aspect_4_3 = 0, + aspect_16_9, + aspect_invalid, + }; + std::wstring name; int screen_index; stretch stretch; bool windowed; bool auto_deinterlace; bool key_only; + aspect_ratio aspect; configuration() : name(L"ogl") @@ -95,6 +103,7 @@ struct configuration , windowed(true) , auto_deinterlace(true) , key_only(false) + , aspect(aspect_invalid) { } }; @@ -107,7 +116,7 @@ struct ogl_consumer : boost::noncopyable GLuint texture_; std::vector pbos_; - + float width_; float height_; unsigned int screen_x_; @@ -142,6 +151,18 @@ public: , square_height_(format_desc.square_height) , filter_(format_desc.field_mode == core::field_mode::progressive || !config.auto_deinterlace ? L"" : L"YADIF=0:-1", boost::assign::list_of(PIX_FMT_BGRA)) { + if(format_desc_.format == core::video_format::ntsc && config_.aspect == configuration::aspect_4_3) + { + // Use default values which are 4:3. + } + else + { + if(config_.aspect == configuration::aspect_16_9) + square_width_ = (format_desc.height*16)/9; + else if(config_.aspect == configuration::aspect_4_3) + square_width_ = (format_desc.height*4)/3; + } + frame_buffer_.set_capacity(2); graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f)); @@ -530,6 +551,12 @@ safe_ptr create_consumer(const boost::property_tree::wptre config.stretch = stretch::uniform; else if(stretch_str == L"uniform_to_fill") config.stretch = stretch::uniform_to_fill; + + auto aspect_str = ptree.get(L"aspect-ratio", L"default"); + if(aspect_str == L"16:9") + config.aspect = configuration::aspect_16_9; + else if(aspect_str == L"4:3") + config.aspect = configuration::aspect_4_3; return make_safe(config); } diff --git a/shell/casparcg.config b/shell/casparcg.config index 9aa5e31e3..a04a777b1 100644 --- a/shell/casparcg.config +++ b/shell/casparcg.config @@ -10,10 +10,12 @@ true - 720p5000 + PAL - - + + 1 + + @@ -58,6 +60,7 @@ [0..] + default [default|4:3|16:9] fill [none|fill|uniform|uniform_to_fill] false [true|false] false [true|false] -- 2.39.2