Ejemplo n.º 1
0
/**
 * Gives a pointer to the song info data within the VisActor. This song info data can be used
 * to set name, artist and even coverart which can be used by the plugins and the framework itself.
 *
 * @see VisSongInfo
 *
 * @param actor Pointer to a VisActor of which the song info is needed.
 *
 * @return Pointer to the song info structure on succes or NULL on failure.
 */
VisSongInfo *visual_actor_get_songinfo (VisActor *actor)
{
	VisActorPlugin *actplugin;

	visual_log_return_val_if_fail (actor != NULL, NULL);

	actplugin = get_actor_plugin (actor);
	visual_log_return_val_if_fail (actplugin != NULL, NULL);

	return &actplugin->songinfo;
}
Ejemplo n.º 2
0
static int negotiate_video_with_unsupported_depth (VisActor *actor, int rundepth, int noevent, int forced)
{
	VisActorPlugin *actplugin = get_actor_plugin (actor);
	int depthflag = visual_actor_get_supported_depth (actor);
	
	/* Depth transform enviroment, it automaticly
	 * fits size because it can use the pitch from
	 * the dest video context */
	actor->transform = visual_video_new ();

	visual_log (VISUAL_LOG_INFO, _("run depth %d forced %d\n"), rundepth, forced);

	if (forced == TRUE)
		visual_video_set_depth (actor->transform, rundepth);
	else
		visual_video_set_depth (actor->transform,
				visual_video_depth_get_highest_nogl (depthflag));

	visual_log (VISUAL_LOG_INFO, _("transpitch1 %d depth %d bpp %d"), actor->transform->pitch, actor->transform->depth,
			actor->transform->bpp);
	/* If there is only GL (which gets returned by highest nogl if
	 * nothing else is there, stop here */
	if (actor->transform->depth == VISUAL_VIDEO_DEPTH_GL)
		return -VISUAL_ERROR_ACTOR_GL_NEGOTIATE;

	visual_video_set_dimension (actor->transform, actor->video->width, actor->video->height);
	visual_log (VISUAL_LOG_INFO, _("transpitch2 %d %d"), actor->transform->width, actor->transform->pitch);

	actplugin->requisition (visual_actor_get_plugin (actor), &actor->transform->width, &actor->transform->height);
	visual_log (VISUAL_LOG_INFO, _("transpitch3 %d"), actor->transform->pitch);

	if (noevent == FALSE) {
		visual_event_queue_add_resize (&actor->plugin->eventqueue, actor->transform,
				actor->transform->width, actor->transform->height);
		visual_plugin_events_pump (actor->plugin);
	} else {
		/* Normally a visual_video_set_dimension get's called within the
		 * event handler, but we won't come there right now so we've
		 * got to set the pitch ourself */
		visual_video_set_dimension (actor->transform,
				actor->transform->width, actor->transform->height);
	}

	visual_log (VISUAL_LOG_INFO, _("rundepth: %d transpitch %d\n"), rundepth, actor->transform->pitch);
	visual_video_allocate_buffer (actor->transform);

	if (actor->video->depth == VISUAL_VIDEO_DEPTH_8BIT)
		actor->ditherpal = visual_palette_new (256);

	return VISUAL_OK;
}
Ejemplo n.º 3
0
VisVideoAttributeOptions *visual_actor_get_video_attribute_options (VisActor *actor)
{
	VisActorPlugin *actplugin;

	visual_log_return_val_if_fail (actor != NULL, NULL);
	visual_log_return_val_if_fail (actor->plugin != NULL, NULL);

	actplugin = get_actor_plugin (actor);

	if (actplugin == NULL)
		return NULL;

	return &actplugin->vidoptions;
}
Ejemplo n.º 4
0
/**
 * Gives the by the plugin natively supported depths
 *
 * @param actor Pointer to a VisActor of which the supported depth of it's
 * 	  encapsulated plugin is requested.
 *
 * @return an OR value of the VISUAL_VIDEO_DEPTH_* values which can be checked against using AND on succes,
 * 	-VISUAL_ERROR_ACTOR_NULL, -VISUAL_ERROR_PLUGIN_NULL or -VISUAL_ERROR_ACTOR_PLUGIN_NULL on failure.
 */
int visual_actor_get_supported_depth (VisActor *actor)
{
	VisActorPlugin *actplugin;

	visual_log_return_val_if_fail (actor != NULL, -VISUAL_ERROR_ACTOR_NULL);
	visual_log_return_val_if_fail (actor->plugin != NULL, -VISUAL_ERROR_PLUGIN_NULL);

	actplugin = get_actor_plugin (actor);

	if (actplugin == NULL)
		return -VISUAL_ERROR_ACTOR_PLUGIN_NULL;

	return actplugin->vidoptions.depth;
}
Ejemplo n.º 5
0
/**
 * This is called to run a VisActor. It also pump it's events when needed, checks for new song events and also does the fitting 
 * and depth transformation actions when needed.
 *
 * Every run cycle one frame is created, so this function needs to be used in the main draw loop of the application.
 *
 * @param actor Pointer to a VisActor that needs to be runned.
 * @param audio Pointer to a VisAudio that contains all the audio data.
 *
 * return VISUAL_OK on succes, -VISUAL_ERROR_ACTOR_NULL, -VISUAL_ERROR_ACTOR_VIDEO_NULL, -VISUAL_ERROR_NULL or
 * 	-VISUAL_ERROR_ACTOR_PLUGIN_NULL on failure.
 */
int visual_actor_run (VisActor *actor, VisAudio *audio)
{
	VisActorPlugin *actplugin;
	VisPluginData *plugin;
	VisVideo *video;
	VisVideo *transform;
	VisVideo *fitting;

	/* We don't check for video, because we don't always need a video */
	/*
	 * Really? take a look at visual_video_set_palette bellow
	 */
	visual_log_return_val_if_fail (actor != NULL, -VISUAL_ERROR_ACTOR_NULL);
	visual_log_return_val_if_fail (actor->video != NULL, -VISUAL_ERROR_ACTOR_VIDEO_NULL);
	visual_log_return_val_if_fail (audio != NULL, -VISUAL_ERROR_NULL);

	actplugin = get_actor_plugin (actor);
	plugin = visual_actor_get_plugin (actor);

	if (actplugin == NULL) {
		visual_log (VISUAL_LOG_CRITICAL,
			_("The given actor does not reference any actor plugin"));

		return -VISUAL_ERROR_ACTOR_PLUGIN_NULL;
	}

	/* Songinfo handling */
	if(0) /*FIXME*/if (visual_songinfo_compare (&actor->songcompare, &actplugin->songinfo) == FALSE ||
        actor->songcompare.elapsed != actplugin->songinfo.elapsed) {
		visual_songinfo_mark (&actplugin->songinfo);

		visual_event_queue_add_newsong (
			visual_plugin_get_eventqueue (plugin),
			&actplugin->songinfo);

		visual_songinfo_free_strings (&actor->songcompare);
		visual_songinfo_copy (&actor->songcompare, &actplugin->songinfo);
	}

	video = actor->video;
	transform = actor->transform;
	fitting = actor->fitting;

	/*
	 * This needs to happen before palette, render stuff, always, period.
	 * Also internal vars can be initialized when params have been set in init on the param
	 * events in the event loop.
	 */
	visual_plugin_events_pump (actor->plugin);

	visual_video_set_palette (video, visual_actor_get_palette (actor));

	/* Set the palette to the target video */
	video->pal = visual_actor_get_palette (actor);

	/* Yeah some transformation magic is going on here when needed */
	if (transform != NULL && (transform->depth != video->depth)) {
		actplugin->render (plugin, transform, audio);

		if (transform->depth == VISUAL_VIDEO_DEPTH_8BIT) {
			visual_video_set_palette (transform, visual_actor_get_palette (actor));
			visual_video_depth_transform (video, transform);
		} else {
			visual_video_set_palette (transform, actor->ditherpal);
			visual_video_depth_transform (video, transform);
		}
	} else {
		if (fitting != NULL && (fitting->width != video->width || fitting->height != video->height)) {
			actplugin->render (plugin, fitting, audio);
			visual_video_blit_overlay (video, fitting, 0, 0, FALSE);
		} else {
			actplugin->render (plugin, video, audio);
		}
	}

	return VISUAL_OK;
}
Ejemplo n.º 6
0
  VisVideoDepth Actor::Impl::get_supported_depths ()
  {
      auto actor_plugin = get_actor_plugin ();

      return actor_plugin ? actor_plugin->vidoptions.depth : VISUAL_VIDEO_DEPTH_NONE;
  }