3 #include "ffmpeg_consumer.h"
5 #include "../ffmpeg_error.h"
6 #include "../producer/util/util.h"
8 #include <common/except.h>
9 #include <common/executor.h>
10 #include <common/assert.h>
11 #include <common/utf.h>
12 #include <common/future.h>
13 #include <common/env.h>
14 #include <common/scope_exit.h>
15 #include <common/ptree.h>
17 #include <core/consumer/frame_consumer.h>
18 #include <core/frame/frame.h>
19 #include <core/frame/audio_channel_layout.h>
20 #include <core/video_format.h>
21 #include <core/monitor/monitor.h>
22 #include <core/help/help_repository.h>
23 #include <core/help/help_sink.h>
25 #include <boost/noncopyable.hpp>
26 #include <boost/rational.hpp>
27 #include <boost/format.hpp>
28 #include <boost/algorithm/string/predicate.hpp>
29 #include <boost/property_tree/ptree.hpp>
32 #pragma warning(disable: 4244)
33 #pragma warning(disable: 4245)
34 #include <boost/crc.hpp>
37 #include <tbb/atomic.h>
38 #include <tbb/concurrent_queue.h>
39 #include <tbb/parallel_invoke.h>
40 #include <tbb/parallel_for.h>
45 #pragma warning(disable: 4244)
49 #define __STDC_CONSTANT_MACROS
50 #define __STDC_LIMIT_MACROS
51 #include <libavformat/avformat.h>
52 #include <libavcodec/avcodec.h>
53 #include <libavutil/avutil.h>
54 #include <libavutil/frame.h>
55 #include <libavutil/opt.h>
56 #include <libavutil/imgutils.h>
57 #include <libavutil/parseutils.h>
58 #include <libavfilter/avfilter.h>
59 #include <libavfilter/buffersink.h>
60 #include <libavfilter/buffersrc.h>
65 namespace caspar { namespace ffmpeg {
67 int crc16(const std::string& str)
69 boost::crc_16_type result;
71 result.process_bytes(str.data(), str.length());
73 return result.checksum();
76 class streaming_consumer final : public core::frame_consumer
82 core::monitor::subject subject_;
83 boost::filesystem::path path_;
84 int consumer_index_offset_;
86 std::map<std::string, std::string> options_;
87 bool compatibility_mode_;
89 core::video_format_desc in_video_format_;
90 core::audio_channel_layout in_channel_layout_ = core::audio_channel_layout::invalid();
92 std::shared_ptr<AVFormatContext> oc_;
93 tbb::atomic<bool> abort_request_;
95 std::shared_ptr<AVStream> video_st_;
96 std::shared_ptr<AVStream> audio_st_;
98 std::int64_t video_pts_;
99 std::int64_t audio_pts_;
101 AVFilterContext* audio_graph_in_;
102 AVFilterContext* audio_graph_out_;
103 std::shared_ptr<AVFilterGraph> audio_graph_;
105 AVFilterContext* video_graph_in_;
106 AVFilterContext* video_graph_out_;
107 std::shared_ptr<AVFilterGraph> video_graph_;
111 executor video_encoder_executor_;
112 executor audio_encoder_executor_;
114 tbb::atomic<int> tokens_;
115 boost::mutex tokens_mutex_;
116 boost::condition_variable tokens_cond_;
117 tbb::atomic<int64_t> current_encoding_delay_;
119 executor write_executor_;
126 bool compatibility_mode)
128 , consumer_index_offset_(crc16(path))
129 , compatibility_mode_(compatibility_mode)
133 , audio_encoder_executor_(print() + L" audio_encoder")
134 , video_encoder_executor_(print() + L" video_encoder")
135 , write_executor_(print() + L" io")
137 abort_request_ = false;
138 current_encoding_delay_ = 0;
141 boost::sregex_iterator(
144 boost::regex("-(?<NAME>[^-\\s]+)(\\s+(?<VALUE>[^\\s]+))?"));
145 it != boost::sregex_iterator();
148 options_[(*it)["NAME"].str()] = (*it)["VALUE"].matched ? (*it)["VALUE"].str() : "";
151 if (options_.find("threads") == options_.end())
152 options_["threads"] = "auto";
159 boost::regex("tokens")).get_value_or(2));
162 ~streaming_consumer()
166 video_encoder_executor_.begin_invoke([&] { encode_video(core::const_frame::empty(), nullptr); });
167 audio_encoder_executor_.begin_invoke([&] { encode_audio(core::const_frame::empty(), nullptr); });
169 video_encoder_executor_.stop();
170 audio_encoder_executor_.stop();
171 video_encoder_executor_.join();
172 audio_encoder_executor_.join();
174 video_graph_.reset();
175 audio_graph_.reset();
179 write_packet(nullptr, nullptr);
181 write_executor_.stop();
182 write_executor_.join();
184 FF(av_write_trailer(oc_.get()));
186 if (!(oc_->oformat->flags & AVFMT_NOFILE) && oc_->pb)
194 const core::video_format_desc& format_desc,
195 const core::audio_channel_layout& channel_layout,
196 int channel_index) override
200 static boost::regex prot_exp("^.+:.*" );
202 const auto overwrite =
203 try_remove_arg<std::string>(
205 boost::regex("y")) != boost::none;
207 if(!boost::regex_match(
211 if(!path_.is_complete())
215 env::media_folder()) +
219 if(boost::filesystem::exists(path_))
221 if(!overwrite && !compatibility_mode_)
222 BOOST_THROW_EXCEPTION(invalid_argument() << msg_info("File exists"));
224 boost::filesystem::remove(path_);
228 const auto oformat_name =
229 try_remove_arg<std::string>(
231 boost::regex("^f|format$"));
235 FF(avformat_alloc_output_context2(
238 oformat_name && !oformat_name->empty() ? oformat_name->c_str() : nullptr,
239 path_.string().c_str()));
243 avformat_free_context);
245 CASPAR_VERIFY(oc_->oformat);
247 oc_->interrupt_callback.callback = streaming_consumer::interrupt_cb;
248 oc_->interrupt_callback.opaque = this;
250 CASPAR_VERIFY(format_desc.format != core::video_format::invalid);
252 in_video_format_ = format_desc;
253 in_channel_layout_ = channel_layout;
255 CASPAR_VERIFY(oc_->oformat);
257 const auto video_codec_name =
258 try_remove_arg<std::string>(
260 boost::regex("^c:v|codec:v|vcodec$"));
262 const auto video_codec =
264 ? avcodec_find_encoder_by_name(video_codec_name->c_str())
265 : avcodec_find_encoder(oc_->oformat->video_codec);
267 const auto audio_codec_name =
268 try_remove_arg<std::string>(
270 boost::regex("^c:a|codec:a|acodec$"));
272 const auto audio_codec =
274 ? avcodec_find_encoder_by_name(audio_codec_name->c_str())
275 : avcodec_find_encoder(oc_->oformat->audio_codec);
278 CASPAR_THROW_EXCEPTION(user_error() << msg_info(
279 "Failed to find video codec " + (video_codec_name
281 : "with id " + boost::lexical_cast<std::string>(
282 oc_->oformat->video_codec))));
284 CASPAR_THROW_EXCEPTION(user_error() << msg_info(
285 "Failed to find audio codec " + (audio_codec_name
287 : "with id " + boost::lexical_cast<std::string>(
288 oc_->oformat->audio_codec))));
293 configure_video_filters(
295 try_remove_arg<std::string>(options_,
296 boost::regex("vf|f:v|filter:v")).get_value_or(""));
298 configure_audio_filters(
300 try_remove_arg<std::string>(options_,
301 boost::regex("af|f:a|filter:a")).get_value_or(""));
307 auto video_options = options_;
308 auto audio_options = options_;
310 video_st_ = open_encoder(
314 audio_st_ = open_encoder(
318 auto it = options_.begin();
319 while(it != options_.end())
321 if(video_options.find(it->first) == video_options.end() || audio_options.find(it->first) == audio_options.end())
322 it = options_.erase(it);
330 AVDictionary* av_opts = nullptr;
334 std::move(options_));
338 av_dict_free(&av_opts);
341 if (!(oc_->oformat->flags & AVFMT_NOFILE))
345 path_.string().c_str(),
347 &oc_->interrupt_callback,
351 FF(avformat_write_header(
355 options_ = to_map(av_opts);
366 for (const auto& option : options_)
369 << L"Invalid option: -"
372 << u16(option.second);
384 core::monitor::subject& monitor_output() override
389 std::wstring name() const override
394 std::future<bool> send(core::const_frame frame) override
396 CASPAR_VERIFY(in_video_format_.format != core::video_format::invalid);
399 std::shared_ptr<void> token(
404 tokens_cond_.notify_one();
405 current_encoding_delay_ = frame.get_age_millis();
408 return executor_.begin_invoke([=]() -> bool
410 boost::unique_lock<boost::mutex> tokens_lock(tokens_mutex_);
413 tokens_cond_.wait(tokens_lock);
415 video_encoder_executor_.begin_invoke([=]() mutable
422 audio_encoder_executor_.begin_invoke([=]() mutable
433 std::wstring print() const override
435 return L"streaming_consumer[" + u16(path_.string()) + L"]";
438 virtual boost::property_tree::wptree info() const override
440 boost::property_tree::wptree info;
441 info.add(L"type", L"stream");
442 info.add(L"path", path_.wstring());
446 bool has_synchronization_clock() const override
451 int buffer_depth() const override
456 int index() const override
458 return compatibility_mode_ ? 200 : 100000 + consumer_index_offset_;
461 int64_t presentation_frame_age_millis() const override
463 return current_encoding_delay_;
468 static int interrupt_cb(void* ctx)
471 return reinterpret_cast<streaming_consumer*>(ctx)->abort_request_;
474 std::shared_ptr<AVStream> open_encoder(
475 const AVCodec& codec,
476 std::map<std::string,
477 std::string>& options)
485 CASPAR_THROW_EXCEPTION(caspar_exception() << msg_info("Could not allocate video-stream.") << boost::errinfo_api_function("av_new_stream"));
487 auto enc = st->codec;
491 switch(enc->codec_type)
493 case AVMEDIA_TYPE_VIDEO:
495 enc->time_base = video_graph_out_->inputs[0]->time_base;
496 enc->pix_fmt = static_cast<AVPixelFormat>(video_graph_out_->inputs[0]->format);
497 enc->sample_aspect_ratio = st->sample_aspect_ratio = video_graph_out_->inputs[0]->sample_aspect_ratio;
498 enc->width = video_graph_out_->inputs[0]->w;
499 enc->height = video_graph_out_->inputs[0]->h;
500 enc->bit_rate_tolerance = 400 * 1000000;
504 case AVMEDIA_TYPE_AUDIO:
506 enc->time_base = audio_graph_out_->inputs[0]->time_base;
507 enc->sample_fmt = static_cast<AVSampleFormat>(audio_graph_out_->inputs[0]->format);
508 enc->sample_rate = audio_graph_out_->inputs[0]->sample_rate;
509 enc->channel_layout = audio_graph_out_->inputs[0]->channel_layout;
510 enc->channels = audio_graph_out_->inputs[0]->channels;
516 if(oc_->oformat->flags & AVFMT_GLOBALHEADER)
517 enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
519 static const std::array<std::string, 4> char_id_map = {{"v", "a", "d", "s"}};
521 const auto char_id = char_id_map.at(enc->codec_type);
523 const auto codec_opts =
526 boost::regex("^(" + char_id + "?[^:]+):" + char_id + "$"));
528 AVDictionary* av_codec_opts = nullptr;
543 av_codec_opts ? &av_codec_opts : nullptr));
552 AV_DICT_IGNORE_SUFFIX);
556 options[t->key + (codec_opts.find(t->key) != codec_opts.end() ? ":" + char_id : "")] = t->value;
562 AV_DICT_IGNORE_SUFFIX);
565 av_dict_free(&av_codec_opts);
568 if(enc->codec_type == AVMEDIA_TYPE_AUDIO && !(codec.capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE))
570 CASPAR_ASSERT(enc->frame_size > 0);
571 av_buffersink_set_frame_size(audio_graph_out_,
575 return std::shared_ptr<AVStream>(st, [this](AVStream* st)
577 avcodec_close(st->codec);
581 void configure_video_filters(
582 const AVCodec& codec,
583 const std::string& filtergraph)
586 avfilter_graph_alloc(),
589 avfilter_graph_free(&p);
592 video_graph_->nb_threads = boost::thread::hardware_concurrency()/2;
593 video_graph_->thread_type = AVFILTER_THREAD_SLICE;
595 const auto sample_aspect_ratio =
596 boost::rational<int>(
597 in_video_format_.square_width,
598 in_video_format_.square_height) /
599 boost::rational<int>(
600 in_video_format_.width,
601 in_video_format_.height);
603 const auto vsrc_options = (boost::format("video_size=%1%x%2%:pix_fmt=%3%:time_base=%4%/%5%:pixel_aspect=%6%/%7%:frame_rate=%8%/%9%")
604 % in_video_format_.width % in_video_format_.height
606 % in_video_format_.duration % in_video_format_.time_scale
607 % sample_aspect_ratio.numerator() % sample_aspect_ratio.denominator()
608 % in_video_format_.time_scale % in_video_format_.duration).str();
610 AVFilterContext* filt_vsrc = nullptr;
611 FF(avfilter_graph_create_filter(
613 avfilter_get_by_name("buffer"),
614 "ffmpeg_consumer_buffer",
615 vsrc_options.c_str(),
617 video_graph_.get()));
619 AVFilterContext* filt_vsink = nullptr;
620 FF(avfilter_graph_create_filter(
622 avfilter_get_by_name("buffersink"),
623 "ffmpeg_consumer_buffersink",
626 video_graph_.get()));
628 #pragma warning (push)
629 #pragma warning (disable : 4245)
631 FF(av_opt_set_int_list(
636 AV_OPT_SEARCH_CHILDREN));
638 #pragma warning (pop)
640 configure_filtergraph(
646 video_graph_in_ = filt_vsrc;
647 video_graph_out_ = filt_vsink;
650 << u16(std::string("\n")
651 + avfilter_graph_dump(
656 void configure_audio_filters(
657 const AVCodec& codec,
658 const std::string& filtergraph)
661 avfilter_graph_alloc(),
664 avfilter_graph_free(&p);
667 audio_graph_->nb_threads = boost::thread::hardware_concurrency()/2;
668 audio_graph_->thread_type = AVFILTER_THREAD_SLICE;
670 const auto asrc_options = (boost::format("sample_rate=%1%:sample_fmt=%2%:channels=%3%:time_base=%4%/%5%:channel_layout=%6%")
671 % in_video_format_.audio_sample_rate
672 % av_get_sample_fmt_name(AV_SAMPLE_FMT_S32)
673 % in_channel_layout_.num_channels
674 % 1 % in_video_format_.audio_sample_rate
678 av_get_default_channel_layout(in_channel_layout_.num_channels))).str();
680 AVFilterContext* filt_asrc = nullptr;
681 FF(avfilter_graph_create_filter(
683 avfilter_get_by_name("abuffer"),
684 "ffmpeg_consumer_abuffer",
685 asrc_options.c_str(),
687 audio_graph_.get()));
689 AVFilterContext* filt_asink = nullptr;
690 FF(avfilter_graph_create_filter(
692 avfilter_get_by_name("abuffersink"),
693 "ffmpeg_consumer_abuffersink",
696 audio_graph_.get()));
698 #pragma warning (push)
699 #pragma warning (disable : 4245)
703 "all_channel_counts",
705 AV_OPT_SEARCH_CHILDREN));
707 FF(av_opt_set_int_list(
712 AV_OPT_SEARCH_CHILDREN));
714 FF(av_opt_set_int_list(
717 codec.channel_layouts,
719 AV_OPT_SEARCH_CHILDREN));
721 FF(av_opt_set_int_list(
724 codec.supported_samplerates,
726 AV_OPT_SEARCH_CHILDREN));
728 #pragma warning (pop)
730 configure_filtergraph(
736 audio_graph_in_ = filt_asrc;
737 audio_graph_out_ = filt_asink;
740 << u16(std::string("\n")
741 + avfilter_graph_dump(
746 void configure_filtergraph(
747 AVFilterGraph& graph,
748 const std::string& filtergraph,
749 AVFilterContext& source_ctx,
750 AVFilterContext& sink_ctx)
752 AVFilterInOut* outputs = nullptr;
753 AVFilterInOut* inputs = nullptr;
757 if(!filtergraph.empty())
759 outputs = avfilter_inout_alloc();
760 inputs = avfilter_inout_alloc();
762 CASPAR_VERIFY(outputs && inputs);
764 outputs->name = av_strdup("in");
765 outputs->filter_ctx = &source_ctx;
766 outputs->pad_idx = 0;
767 outputs->next = nullptr;
769 inputs->name = av_strdup("out");
770 inputs->filter_ctx = &sink_ctx;
772 inputs->next = nullptr;
774 FF(avfilter_graph_parse(
790 FF(avfilter_graph_config(
796 avfilter_inout_free(&outputs);
797 avfilter_inout_free(&inputs);
802 void encode_video(core::const_frame frame_ptr, std::shared_ptr<void> token)
807 auto enc = video_st_->codec;
809 if(frame_ptr != core::const_frame::empty())
811 auto src_av_frame = create_frame();
813 const auto sample_aspect_ratio =
814 boost::rational<int>(
815 in_video_format_.square_width,
816 in_video_format_.square_height) /
817 boost::rational<int>(
818 in_video_format_.width,
819 in_video_format_.height);
821 src_av_frame->format = AV_PIX_FMT_BGRA;
822 src_av_frame->width = in_video_format_.width;
823 src_av_frame->height = in_video_format_.height;
824 src_av_frame->sample_aspect_ratio.num = sample_aspect_ratio.numerator();
825 src_av_frame->sample_aspect_ratio.den = sample_aspect_ratio.denominator();
826 src_av_frame->pts = video_pts_;
830 FF(av_image_fill_arrays(
832 src_av_frame->linesize,
833 frame_ptr.image_data().begin(),
834 static_cast<AVPixelFormat>(src_av_frame->format),
835 in_video_format_.width,
836 in_video_format_.height,
839 FF(av_buffersrc_add_frame(
841 src_av_frame.get()));
848 auto filt_frame = create_frame();
850 ret = av_buffersink_get_frame(
854 video_encoder_executor_.begin_invoke([=]
856 if(ret == AVERROR_EOF)
858 if(enc->codec->capabilities & CODEC_CAP_DELAY)
860 while(encode_av_frame(
862 avcodec_encode_video2,
865 boost::this_thread::yield(); // TODO:
869 else if(ret != AVERROR(EAGAIN))
871 FF_RET(ret, "av_buffersink_get_frame");
873 if (filt_frame->interlaced_frame)
875 if (enc->codec->id == AV_CODEC_ID_MJPEG)
876 enc->field_order = filt_frame->top_field_first ? AV_FIELD_TT : AV_FIELD_BB;
878 enc->field_order = filt_frame->top_field_first ? AV_FIELD_TB : AV_FIELD_BT;
881 enc->field_order = AV_FIELD_PROGRESSIVE;
883 filt_frame->quality = enc->global_quality;
885 if (!enc->me_threshold)
886 filt_frame->pict_type = AV_PICTURE_TYPE_NONE;
890 avcodec_encode_video2,
894 boost::this_thread::yield(); // TODO:
900 void encode_audio(core::const_frame frame_ptr, std::shared_ptr<void> token)
905 auto enc = audio_st_->codec;
907 if(frame_ptr != core::const_frame::empty())
909 auto src_av_frame = create_frame();
911 src_av_frame->channels = in_channel_layout_.num_channels;
912 src_av_frame->channel_layout = av_get_default_channel_layout(in_channel_layout_.num_channels);
913 src_av_frame->sample_rate = in_video_format_.audio_sample_rate;
914 src_av_frame->nb_samples = static_cast<int>(frame_ptr.audio_data().size()) / src_av_frame->channels;
915 src_av_frame->format = AV_SAMPLE_FMT_S32;
916 src_av_frame->pts = audio_pts_;
918 audio_pts_ += src_av_frame->nb_samples;
920 FF(av_samples_fill_arrays(
921 src_av_frame->extended_data,
922 src_av_frame->linesize,
923 reinterpret_cast<const std::uint8_t*>(&*frame_ptr.audio_data().begin()),
924 src_av_frame->channels,
925 src_av_frame->nb_samples,
926 static_cast<AVSampleFormat>(src_av_frame->format),
929 FF(av_buffersrc_add_frame(
931 src_av_frame.get()));
938 auto filt_frame = create_frame();
940 ret = av_buffersink_get_frame(
944 audio_encoder_executor_.begin_invoke([=]
946 if(ret == AVERROR_EOF)
948 if(enc->codec->capabilities & CODEC_CAP_DELAY)
950 while(encode_av_frame(
952 avcodec_encode_audio2,
956 boost::this_thread::yield(); // TODO:
960 else if(ret != AVERROR(EAGAIN))
964 "av_buffersink_get_frame");
968 avcodec_encode_audio2,
972 boost::this_thread::yield(); // TODO:
979 bool encode_av_frame(
982 const std::shared_ptr<AVFrame>& src_av_frame,
983 std::shared_ptr<void> token)
986 av_init_packet(&pkt);
996 if(!got_packet || pkt.size <= 0)
999 pkt.stream_index = st.index;
1001 if (pkt.pts != AV_NOPTS_VALUE)
1006 st.codec->time_base,
1010 if (pkt.dts != AV_NOPTS_VALUE)
1015 st.codec->time_base,
1023 st.codec->time_base, st.time_base));
1026 std::shared_ptr<AVPacket>(
1038 const std::shared_ptr<AVPacket>& pkt_ptr,
1039 std::shared_ptr<void> token)
1041 write_executor_.begin_invoke([this, pkt_ptr, token]() mutable
1043 FF(av_interleaved_write_frame(
1049 template<typename T>
1050 static boost::optional<T> try_remove_arg(
1051 std::map<std::string, std::string>& options,
1052 const boost::regex& expr)
1054 for(auto it = options.begin(); it != options.end(); ++it)
1056 if(boost::regex_search(it->first, expr))
1058 auto arg = it->second;
1060 return boost::lexical_cast<T>(arg);
1064 return boost::optional<T>();
1067 static std::map<std::string, std::string> remove_options(
1068 std::map<std::string, std::string>& options,
1069 const boost::regex& expr)
1071 std::map<std::string, std::string> result;
1073 auto it = options.begin();
1074 while(it != options.end())
1077 if(boost::regex_search(it->first, what, expr))
1080 what.size() > 0 && what[1].matched
1082 : it->first] = it->second;
1083 it = options.erase(it);
1092 static void to_dict(AVDictionary** dest, const std::map<std::string, std::string>& c)
1094 for (const auto& entry : c)
1098 entry.first.c_str(),
1099 entry.second.c_str(), 0);
1103 static std::map<std::string, std::string> to_map(AVDictionary* dict)
1105 std::map<std::string, std::string> result;
1112 AV_DICT_IGNORE_SUFFIX)
1119 AV_DICT_IGNORE_SUFFIX))
1121 result[t->key] = t->value;
1128 void describe_streaming_consumer(core::help_sink& sink, const core::help_repository& repo)
1130 sink.short_description(L"For streaming the contents of a channel using FFmpeg.");
1131 sink.syntax(L"STREAM [url:string] {-[ffmpeg_param1:string] [value1:string] {-[ffmpeg_param2:string] [value2:string] {...}}}");
1132 sink.para()->text(L"For streaming the contents of a channel using FFmpeg");
1134 ->item(L"url", L"The stream URL to create/stream to.")
1135 ->item(L"ffmpeg_paramX", L"A parameter supported by FFmpeg. For example vcodec or acodec etc.");
1136 sink.para()->text(L"Examples:");
1137 sink.example(L">> ADD 1 STREAM udp://<client_ip_address>:9250 -format mpegts -vcodec libx264 -crf 25 -tune zerolatency -preset ultrafast");
1140 spl::shared_ptr<core::frame_consumer> create_streaming_consumer(
1141 const std::vector<std::wstring>& params, core::interaction_sink*, std::vector<spl::shared_ptr<core::video_channel>> channels)
1143 if (params.size() < 1 || (!boost::iequals(params.at(0), L"STREAM") && !boost::iequals(params.at(0), L"FILE")))
1144 return core::frame_consumer::empty();
1146 auto compatibility_mode = boost::iequals(params.at(0), L"FILE");
1147 auto path = u8(params.size() > 1 ? params.at(1) : L"");
1148 auto args = u8(boost::join(params, L" "));
1150 return spl::make_shared<streaming_consumer>(path, args, compatibility_mode);
1153 spl::shared_ptr<core::frame_consumer> create_preconfigured_streaming_consumer(
1154 const boost::property_tree::wptree& ptree, core::interaction_sink*, std::vector<spl::shared_ptr<core::video_channel>> channels)
1156 return spl::make_shared<streaming_consumer>(
1157 u8(ptree_get<std::wstring>(ptree, L"path")),
1158 u8(ptree.get<std::wstring>(L"args", L"")),