25 #include "lv_common.h"
26 #include "lv_plugin_registry.h"
35 VisPluginData* plugin;
45 VisActorPlugin* get_actor_plugin ()
const;
52 , songcompare {SONG_INFO_TYPE_NULL}
60 delete get_actor_plugin ()->songinfo;
65 VisActorPlugin* Actor::Impl::get_actor_plugin ()
const
72 auto actor_plugin = get_actor_plugin ();
80 return {
new Actor (name),
false};
82 catch (std::exception& error) {
88 Actor::Actor (std::string
const& name)
93 throw std::runtime_error {
"Actor plugin not found"};
97 if (!m_impl->plugin) {
98 throw std::runtime_error {
"Failed to load actor plugin"};
102 m_impl->get_actor_plugin ()->songinfo =
new SongInfo {SONG_INFO_TYPE_NULL};
112 return m_impl->plugin;
122 return m_impl->video;
127 return m_impl->get_actor_plugin ()->songinfo;
132 auto actor_plugin = m_impl->get_actor_plugin ();
135 return actor_plugin->palette (m_impl->plugin);
143 auto output_width = m_impl->video->get_width ();
144 auto output_height = m_impl->video->get_height ();
145 auto output_depth = m_impl->video->get_depth ();
149 int run_width = output_width;
150 int run_height = output_height;
152 m_impl->get_actor_plugin ()->requisition (m_impl->plugin, &run_width, &run_height);
165 m_impl->to_scale.reset ();
166 m_impl->to_convert.reset ();
172 if (m_impl->run_depth != output_depth) {
174 visual_video_depth_name (m_impl->run_depth),
175 visual_video_depth_name (output_depth));
177 m_impl->to_convert =
Video::create (run_width, run_height, m_impl->run_depth);
181 if (run_width != output_width || run_height != output_height) {
183 run_width, run_height, output_width, output_height);
185 m_impl->to_scale =
Video::create (run_width, run_height, output_depth);
204 return m_impl->get_supported_depths ();
207 VisVideoAttrOptions
const* Actor::get_video_attribute_options ()
209 return &m_impl->get_actor_plugin ()->vidoptions;
214 m_impl->video = video;
219 visual_return_if_fail (m_impl->video);
221 auto actor_plugin = m_impl->get_actor_plugin ();
230 if (!visual_songinfo_compare (&m_impl->songcompare, actor_plugin->songinfo) ||
231 m_impl->songcompare.get_elapsed () != actor_plugin->songinfo->get_elapsed ()) {
233 actor_plugin->songinfo->mark ();
238 visual_songinfo_copy (&m_impl->songcompare, actor_plugin->songinfo);
244 auto const& video = m_impl->video;
245 auto const& to_convert = m_impl->to_convert;
246 auto const& to_scale = m_impl->to_scale;
256 to_convert->set_palette (*palette);
260 actor_plugin->render (m_impl->plugin, to_convert.get (),
const_cast<Audio*
> (&audio));
264 to_scale->convert_depth (to_convert);
269 video->convert_depth (to_convert);
277 to_scale->set_palette (*palette);
281 actor_plugin->render (m_impl->plugin, to_scale.get (),
const_cast<Audio*
> (&audio));
286 video->set_palette (*palette);
290 actor_plugin->render (m_impl->plugin, video.get (),
const_cast<Audio*
> (&audio));
295 actor_plugin->render (m_impl->plugin, video.get (),
const_cast<Audio*
> (&audio));