safe_ptr<core::frame_consumer> create_ivga_consumer(const core::parameters& params)
{
	if(params.size() < 1 || params[0] != L"NEWTEK_IVGA")
		return core::frame_consumer::empty();
		
	const auto channel_layout = core::default_channel_layout_repository()
		.get_by_name(
			params.get(L"CHANNEL_LAYOUT", L"STEREO"));

	return make_safe<newtek_ivga_consumer>(channel_layout);
}
safe_ptr<core::frame_consumer> create_consumer(const core::parameters& params)
{
	if(params.size() < 1 || params[0] != L"AUDIO")
		return core::frame_consumer::empty();

	return make_safe<oal_consumer>();
}
safe_ptr<core::frame_producer> do_create_producer(const safe_ptr<frame_factory>& my_frame_factory, const core::parameters& params, const std::vector<const producer_factory_t>& factories, bool throw_on_fail = false)
{
	if(params.empty())
		BOOST_THROW_EXCEPTION(invalid_argument() << arg_name_info("params") << arg_value_info(""));
	
	auto producer = frame_producer::empty();
	std::any_of(factories.begin(), factories.end(), [&](const producer_factory_t& factory) -> bool
		{
			try
			{
				producer = factory(my_frame_factory, params);
			}
			catch(...)
			{
				if (throw_on_fail)
					throw;
				else
					CASPAR_LOG_CURRENT_EXCEPTION();
			}
			return producer != frame_producer::empty();
		});

	if(producer == frame_producer::empty())
		producer = create_color_producer(my_frame_factory, params);
	return producer;
}
safe_ptr<core::frame_producer> create_producer(const safe_ptr<frame_factory>& my_frame_factory, const core::parameters& params)
{	
	auto producer = do_create_producer(my_frame_factory, params, g_factories);
	auto key_producer = frame_producer::empty();
	
	std::wstring resource_name = L"";
	auto tokens = parameters::protocol_split(params.at_original(0));
	if (tokens[0].empty())
	{
		resource_name = params.at_original(0);
	}

	if(!resource_name.empty()) {
	try // to find a key file.
	{
		auto params_copy = params;
		if(params_copy.size() > 0)
		{
			auto resource_name = params_copy.at_original(0);
			params_copy.set(0, resource_name + L"_A");
			key_producer = do_create_producer(my_frame_factory, params_copy, g_factories);			
			if(key_producer == frame_producer::empty())
			{
				params_copy.set(0, resource_name + L"_ALPHA");
				key_producer = do_create_producer(my_frame_factory, params_copy, g_factories);	
			}
		}
	}
	catch(...){}
	}

	if(producer != frame_producer::empty() && key_producer != frame_producer::empty())
		return create_separated_producer(producer, key_producer);
	
	if(producer == frame_producer::empty())
	{
		std::wstring str = params.get_original_string();
		BOOST_THROW_EXCEPTION(file_not_found() << msg_info("No match found for supplied commands. Check syntax.") << arg_value_info(narrow(str)));
	}

	return producer;
}
Beispiel #5
0
safe_ptr<core::frame_producer> create_swf_producer(
		const safe_ptr<core::frame_factory>& frame_factory,
		const core::parameters& params) 
{
	auto filename = env::media_folder() + L"\\" + params.at_original(0) + L".swf";
	
	if(!boost::filesystem::exists(filename))
		return core::frame_producer::empty();

	swf_t::header_t header(filename);

	return create_producer_destroy_proxy(
		   create_producer_print_proxy(
			make_safe<flash_producer>(frame_factory, filename, header.frame_width, header.frame_height)));
}
Beispiel #6
0
safe_ptr<core::frame_consumer> create_consumer(const core::parameters& params)
{
	if(params.empty())
		BOOST_THROW_EXCEPTION(invalid_argument() << arg_name_info("params") << arg_value_info(""));
	
	auto consumer = frame_consumer::empty();
	std::any_of(g_factories.begin(), g_factories.end(), [&](const consumer_factory_t& factory) -> bool
		{
			try
			{
				consumer = factory(params);
			}
			catch(...)
			{
				CASPAR_LOG_CURRENT_EXCEPTION();
			}
			return consumer != frame_consumer::empty();
		});

	if(consumer == frame_consumer::empty())
		BOOST_THROW_EXCEPTION(file_not_found() << msg_info("No match found for supplied commands. Check syntax."));

	return consumer;
}