#include <common/assert.h>
#include <common/memshfl.h>
#include <common/timer.h>
+#include <common/ptree.h>
#include <boost/algorithm/string.hpp>
#include <boost/property_tree/ptree.hpp>
format = av_guess_format(value.c_str(), nullptr, nullptr);
if(format == nullptr)
- CASPAR_THROW_EXCEPTION(invalid_argument() << arg_name_info("f"));
+ CASPAR_THROW_EXCEPTION(user_error() << msg_info("Unknown format " + value));
return true;
}
{
auto c = avcodec_find_encoder_by_name(value.c_str());
if(c == nullptr)
- CASPAR_THROW_EXCEPTION(invalid_argument() << arg_name_info("vcodec"));
+ CASPAR_THROW_EXCEPTION(user_error() << msg_info("Unknown video codec " + value));
vcodec = avcodec_find_encoder_by_name(value.c_str())->id;
return true;
{
auto c = avcodec_find_encoder_by_name(value.c_str());
if(c == nullptr)
- CASPAR_THROW_EXCEPTION(invalid_argument() << arg_name_info("acodec"));
+ CASPAR_THROW_EXCEPTION(user_error() << msg_info("Unknown audio codec " + value));
acodec = avcodec_find_encoder_by_name(value.c_str())->id;
else if(name == "s")
{
if(av_parse_video_size(&width, &height, value.c_str()) < 0)
- CASPAR_THROW_EXCEPTION(invalid_argument() << arg_name_info("s"));
+ CASPAR_THROW_EXCEPTION(user_error() << msg_info("Unknown video size " + value));
return true;
}
void mark_dropped()
{
- graph_->set_tag("dropped-frame");
+ graph_->set_tag(diagnostics::tag_severity::WARNING, "dropped-frame");
}
std::wstring print() const
c->codec_type = AVMEDIA_TYPE_VIDEO;
c->width = output_format_.width;
c->height = output_format_.height - output_format_.croptop - output_format_.cropbot;
- st->time_base.den = format_desc_.time_scale;
- st->time_base.num = format_desc_.duration;
+ c->time_base.den = format_desc_.time_scale;
+ c->time_base.num = format_desc_.duration;
c->gop_size = 25;
c->flags |= format_desc_.field_mode == core::field_mode::progressive ? 0 : (CODEC_FLAG_INTERLACED_ME | CODEC_FLAG_INTERLACED_DCT);
c->pix_fmt = c->pix_fmt != PIX_FMT_NONE ? c->pix_fmt : PIX_FMT_YUV420P;
if(output_format_.format->flags & AVFMT_GLOBALHEADER)
c->flags |= CODEC_FLAG_GLOBAL_HEADER;
- THROW_ON_ERROR2(tbb_avcodec_open(c, encoder), "[ffmpeg_consumer]");
+ THROW_ON_ERROR2(tbb_avcodec_open(c, encoder, false), "[ffmpeg_consumer]");
return std::shared_ptr<AVStream>(st, [](AVStream* st)
{
c->sample_rate = 48000;
c->channels = 2;
c->sample_fmt = AV_SAMPLE_FMT_S16;
- st->time_base.num = 1;
- st->time_base.den = c->sample_rate;
+ c->time_base.num = 1;
+ c->time_base.den = c->sample_rate;
if(output_format_.vcodec == CODEC_ID_FLV1)
c->sample_rate = 44100;
void describe_consumer(core::help_sink& sink, const core::help_repository& repo)
{
- sink.short_description(L"Can record a channel to a file supported by FFMpeg.");
+ sink.short_description(L"Can record a channel to a file supported by FFmpeg.");
sink.syntax(L"FILE [filename:string] {-[ffmpeg_param1:string] [value1:string] {-[ffmpeg_param2:string] [value2:string] {...}}} {[separate_key:SEPARATE_KEY]}");
- sink.para()->text(L"Can record a channel to a file supported by FFMpeg.");
+ sink.para()->text(L"Can record a channel to a file supported by FFmpeg.");
sink.definitions()
->item(L"filename", L"The filename under the media folder including the extension (decides which kind of container format that will be used).")
- ->item(L"ffmpeg_paramX", L"A parameter supported by FFMpeg. For example vcodec or acodec etc.")
+ ->item(L"ffmpeg_paramX", L"A parameter supported by FFmpeg. For example vcodec or acodec etc.")
->item(L"separate_key", L"If defined will create two files simultaneously -- One for fill and one for key (_A will be appended).")
;
sink.para()->text(L"Examples:");
spl::shared_ptr<core::frame_consumer> create_preconfigured_consumer(
const boost::property_tree::wptree& ptree, core::interaction_sink*)
{
- auto filename = ptree.get<std::wstring>(L"path");
+ auto filename = ptree_get<std::wstring>(ptree, L"path");
auto codec = ptree.get(L"vcodec", L"libx264");
auto separate_key = ptree.get(L"separate-key", false);