#include <core/frame/frame_factory.h>
#include <core/frame/frame_transform.h>
#include <core/frame/pixel_format.h>
+#include <core/frame/audio_channel_layout.h>
#include <core/video_format.h>
#include <boost/property_tree/ptree.hpp>
struct mixer::impl : boost::noncopyable
{
int channel_index_;
- spl::shared_ptr<diagnostics::graph> graph_;
+ spl::shared_ptr<diagnostics::graph> graph_;
tbb::atomic<int64_t> current_mix_time_;
- audio_mixer audio_mixer_;
+ spl::shared_ptr<monitor::subject> monitor_subject_ = spl::make_shared<monitor::subject>("/mixer");
+ audio_mixer audio_mixer_ { graph_ };
spl::shared_ptr<image_mixer> image_mixer_;
+
+ bool straighten_alpha_ = false;
- executor executor_ { L"mixer " + boost::lexical_cast<std::wstring>(channel_index_) };
+ executor executor_ { L"mixer " + boost::lexical_cast<std::wstring>(channel_index_) };
public:
impl(int channel_index, spl::shared_ptr<diagnostics::graph> graph, spl::shared_ptr<image_mixer> image_mixer)
{
graph_->set_color("mix-time", diagnostics::color(1.0f, 0.0f, 0.9f, 0.8f));
current_mix_time_ = 0;
+ audio_mixer_.monitor_output().attach_parent(monitor_subject_);
}
- const_frame operator()(std::map<int, draw_frame> frames, const video_format_desc& format_desc)
+ const_frame operator()(std::map<int, draw_frame> frames, const video_format_desc& format_desc, const core::audio_channel_layout& channel_layout)
{
caspar::timer frame_timer;
{
try
{
+ CASPAR_SCOPED_CONTEXT_MSG(L" '" + executor_.name() + L"' ");
+
detail::set_current_aspect_ratio(
static_cast<double>(format_desc.square_width)
/ static_cast<double>(format_desc.square_height));
frame.second.accept(*image_mixer_);
}
- auto image = (*image_mixer_)(format_desc);
- auto audio = audio_mixer_(format_desc);
+ auto image = (*image_mixer_)(format_desc, straighten_alpha_);
+ auto audio = audio_mixer_(format_desc, channel_layout);
auto desc = core::pixel_format_desc(core::pixel_format::bgra);
desc.planes.push_back(core::pixel_format_desc::plane(format_desc.width, format_desc.height, 4));
- return const_frame(std::move(image), std::move(audio), this, desc);
+ return const_frame(std::move(image), std::move(audio), this, desc, channel_layout);
}
catch(...)
{
}, task_priority::high_priority);
}
+ void set_straight_alpha_output(bool value)
+ {
+ executor_.begin_invoke([=]
+ {
+ straighten_alpha_ = value;
+ }, task_priority::high_priority);
+ }
+
+ bool get_straight_alpha_output()
+ {
+ return executor_.invoke([=]
+ {
+ return straighten_alpha_;
+ }, task_priority::high_priority);
+ }
+
std::future<boost::property_tree::wptree> info() const
{
boost::property_tree::wptree info;
: impl_(new impl(channel_index, std::move(graph), std::move(image_mixer))){}
void mixer::set_master_volume(float volume) { impl_->set_master_volume(volume); }
float mixer::get_master_volume() { return impl_->get_master_volume(); }
+void mixer::set_straight_alpha_output(bool value) { impl_->set_straight_alpha_output(value); }
+bool mixer::get_straight_alpha_output() { return impl_->get_straight_alpha_output(); }
std::future<boost::property_tree::wptree> mixer::info() const{return impl_->info();}
std::future<boost::property_tree::wptree> mixer::delay_info() const{ return impl_->delay_info(); }
-const_frame mixer::operator()(std::map<int, draw_frame> frames, const video_format_desc& format_desc){ return (*impl_)(std::move(frames), format_desc); }
-mutable_frame mixer::create_frame(const void* tag, const core::pixel_format_desc& desc) {return impl_->image_mixer_->create_frame(tag, desc);}
+const_frame mixer::operator()(std::map<int, draw_frame> frames, const video_format_desc& format_desc, const core::audio_channel_layout& channel_layout){ return (*impl_)(std::move(frames), format_desc, channel_layout); }
+mutable_frame mixer::create_frame(const void* tag, const core::pixel_format_desc& desc, const core::audio_channel_layout& channel_layout) {return impl_->image_mixer_->create_frame(tag, desc, channel_layout);}
+monitor::subject& mixer::monitor_output() { return *impl_->monitor_subject_; }
}}