return boost::join(cadence | boost::adaptors::transformed([](size_t i) { return boost::lexical_cast<std::wstring>(i); }), L", ");
}
+ffmpeg::audio_input_pad create_input_pad(const core::video_format_desc& in_format, int num_channels)
+{
+ return ffmpeg::audio_input_pad(
+ boost::rational<int>(1, in_format.audio_sample_rate),
+ in_format.audio_sample_rate,
+ AVSampleFormat::AV_SAMPLE_FMT_S32,
+ av_get_default_channel_layout(num_channels));
+}
+
class decklink_producer : boost::noncopyable, public IDeckLinkInputCallback
{
const int device_index_;
boost::circular_buffer<size_t> sync_buffer_ { audio_cadence_.size() };
spl::shared_ptr<core::frame_factory> frame_factory_;
core::audio_channel_layout channel_layout_;
- ffmpeg::frame_muxer muxer_ { in_format_desc_.framerate, frame_factory_, out_format_desc_, channel_layout_, filter_, ffmpeg::filter::is_deinterlacing(filter_) };
+ ffmpeg::frame_muxer muxer_ {
+ in_format_desc_.framerate,
+ { create_input_pad(in_format_desc_, channel_layout_.num_channels) },
+ frame_factory_,
+ out_format_desc_,
+ channel_layout_,
+ filter_,
+ ffmpeg::filter::is_deinterlacing(filter_)
+ };
core::constraints constraints_ { in_format_desc_.width, in_format_desc_.height };
<< msg_info(print() + L" Failed to start input stream.")
<< boost::errinfo_api_function("StartStreams"));
+ // Wait for first frame until returning or give up after 2 seconds.
+ caspar::timer timeout_timer;
+
+ while (frame_buffer_.size() < 1 && timeout_timer.elapsed() < 2.0)
+ boost::this_thread::sleep_for(boost::chrono::milliseconds(1));
+
CASPAR_LOG(info) << print() << L" Initialized";
}
// PUSH
- muxer_.push(audio_buffer);
+ muxer_.push({ audio_buffer });
muxer_.push(static_cast<std::shared_ptr<AVFrame>>(video_frame));
// POLL