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; }
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))); }