Exemplo n.º 1
0
const VisPluginInfo *get_plugin_info (void)
{
    static VisMorphPlugin morph = {
        .palette = lv_morph_flash_palette,
        .apply = lv_morph_flash_apply,
        .vidoptions.depth =
        VISUAL_VIDEO_DEPTH_8BIT  |
        VISUAL_VIDEO_DEPTH_16BIT |
        VISUAL_VIDEO_DEPTH_24BIT |
        VISUAL_VIDEO_DEPTH_32BIT
    };

    static VisPluginInfo info = {
        .type = VISUAL_PLUGIN_TYPE_MORPH,

        .plugname = "flash",
        .name = "flash morph",
        .author = "Dennis Smit <*****@*****.**>",
        .version = "0.1",
        .about = "An flash in and out morph plugin",
        .help = "This morph plugin morphs between two video sources using a bright flash",
        .license = VISUAL_PLUGIN_LICENSE_LGPL,

        .init = lv_morph_flash_init,
        .cleanup = lv_morph_flash_cleanup,

        .plugin = VISUAL_OBJECT (&morph)
    };

    return &info;
}

static int lv_morph_flash_init (VisPluginData *plugin)
{
    int i;
    FlashPrivate *priv;
    VisColor *whitepal_colors;

    priv = visual_mem_new0 (FlashPrivate, 1);
    visual_object_set_private (VISUAL_OBJECT (plugin), priv);

    priv->whitepal = visual_palette_new (256);
    whitepal_colors = visual_palette_get_colors (priv->whitepal);

    for (i = 0; i < 256; i++) {
        whitepal_colors[i].r = 0xff;
        whitepal_colors[i].g = 0xff;
        whitepal_colors[i].b = 0xff;
    }

    return 0;
}
Exemplo 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;
}
Exemplo n.º 3
0
int main (int argc, char **argv)
{
	char *d1, *d2;
	VisVideo *dest, *src;
	VisVideoDepth depth1, depth2;
	int i;

	visual_init (&argc, &argv);

	if (argc > 2) {
		d1 = argv[1];
		d2 = argv[2];
	} else {
		d1 = strdup("32");
		d2 = strdup("16");
	}

	depth1 = visual_video_depth_enum_from_value(atoi(d1));
	depth2 = visual_video_depth_enum_from_value(atoi(d2));

	dest = visual_video_new ();
	visual_video_set_depth (dest, depth1);
	visual_video_set_dimension (dest, 640, 400);
	visual_video_set_palette (dest, visual_palette_new (256));
	visual_video_allocate_buffer (dest);

	src = visual_video_new ();
	visual_video_set_depth (src, depth2);
	visual_video_set_dimension (src, 640, 400);
	visual_video_set_palette (src, visual_palette_new (256));
	visual_video_allocate_buffer (src);

	for (i = 0; i < TIMES; i++)
		visual_video_depth_transform (dest, src);

	printf ("Depth transformed %d times from %s to %s\n", TIMES, d1, d2);
}
Exemplo n.º 4
0
int visual_morph_init (VisMorph *morph, const char *morphname)
{
    visual_return_val_if_fail (morph != NULL, -VISUAL_ERROR_MORPH_NULL);

    if (morphname && get_morph_plugin_list ().empty ()) {
        visual_log (VISUAL_LOG_ERROR, _("the plugin list is NULL"));

        return -VISUAL_ERROR_PLUGIN_NO_LIST;
    }

    /* Do the VisObject initialization */
    visual_object_clear (VISUAL_OBJECT (morph));
    visual_object_set_dtor (VISUAL_OBJECT (morph), morph_dtor);
    visual_object_set_allocated (VISUAL_OBJECT (morph), FALSE);

    /* Reset the VisMorph data */
    morph->plugin = NULL;
    morph->dest = NULL;
    morph->morphpal = visual_palette_new (256);
    morph->morphtime = visual_time_new ();
    morph->timer = visual_timer_new ();
    visual_morph_set_rate (morph, 0);
    visual_morph_set_steps (morph, 0);
    morph->stepsdone = 0;

    visual_morph_set_mode (morph, VISUAL_MORPH_MODE_SET);

    if (morphname == NULL)
        return VISUAL_OK;

    if (!LV::PluginRegistry::instance()->has_plugin (VISUAL_PLUGIN_TYPE_MORPH, morphname)) {
        return -VISUAL_ERROR_PLUGIN_NOT_FOUND;
    }

    morph->plugin = visual_plugin_load (VISUAL_PLUGIN_TYPE_MORPH, morphname);

    return VISUAL_OK;
}
Exemplo n.º 5
0
const VisPluginInfo *get_plugin_info (void)
{
	static VisActorPlugin actor = {
		.requisition = act_infinite_requisition,
		.palette = act_infinite_palette,
		.render = act_infinite_render,
		.vidoptions.depth = VISUAL_VIDEO_DEPTH_8BIT
	};

	static VisPluginInfo info = {
		.type = VISUAL_PLUGIN_TYPE_ACTOR,

		.plugname = "infinite",
		.name = "infinite plugin",
		.author = N_("Original by: Julien Carme <*****@*****.**>, Port by: Dennis Smit <*****@*****.**>"),
		.version = "0.1",
		.about = N_("Infinite visual plugin"),
		.help = N_("This is the libvisual plugin for the infinite visual"),
		.license = VISUAL_PLUGIN_LICENSE_GPL,

		.init = act_infinite_init,
		.cleanup = act_infinite_cleanup,
		.events = act_infinite_events,

		.plugin = VISUAL_OBJECT (&actor)
	};

	return &info;
}

static int act_infinite_init (VisPluginData *plugin)
{
	InfinitePrivate *priv;

#if ENABLE_NLS
	bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
#endif

	visual_return_val_if_fail (plugin != NULL, -1);

	priv = visual_mem_new0 (InfinitePrivate, 1);
	visual_object_set_private (VISUAL_OBJECT (plugin), priv);

	priv->rcontext = visual_plugin_get_random_context (plugin);

	priv->plugwidth = 32;
	priv->plugheight = 32;

	priv->pal = visual_palette_new (256);

	_inf_init_renderer (priv);
	_inf_load_random_effect(priv, &priv->current_effect);


	priv->color = visual_random_context_int_range (priv->rcontext, 0, NB_PALETTES - 1);
	_inf_change_color(priv, priv->old_color, priv->color, 256);
	priv->old_color = priv->color;

	priv->color = visual_random_context_int_range (priv->rcontext, 0, NB_PALETTES - 1);

	return 0;
}
Exemplo n.º 6
0
const VisPluginInfo *get_plugin_info (void)
{
	static VisActorPlugin actor = {
		.requisition = act_bumpscope_requisition,
		.palette     = act_bumpscope_palette,
		.render      = act_bumpscope_render,
		.vidoptions.depth = VISUAL_VIDEO_DEPTH_8BIT
	};

	static VisPluginInfo info = {
		.type     = VISUAL_PLUGIN_TYPE_ACTOR,

		.plugname = "bumpscope",
		.name     = "Bumpscope plugin",
		.author   = N_("Original by: Zinx Verituse <*****@*****.**>, Port by: Dennis Smit <*****@*****.**>"),
		.version  = "0.0.1",
		.about    = N_("Bumpscope visual plugin"),
		.help     = N_("This is the libvisual port of the xmms Bumpscope plugin"),
		.license  = VISUAL_PLUGIN_LICENSE_GPL,

		.init     = act_bumpscope_init,
		.cleanup  = act_bumpscope_cleanup,
		.events   = act_bumpscope_events,
		.plugin   = &actor
	};

	return &info;
}

static int act_bumpscope_init (VisPluginData *plugin)
{
#if ENABLE_NLS
	bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR);
#endif

	VisParamList *params = visual_plugin_get_params (plugin);
	visual_param_list_add_many (params,
                                visual_param_new_color_rgb ("color",
                                                            N_("The light's color"),
                                                            122, 204, 255,
                                                            NULL),
                                visual_param_new_integer   ("light_size",
                                                            N_("The size of the light"),
                                                            256,
                                                            visual_param_in_range_integer (0, 1000)),
                                visual_param_new_bool      ("color_cycle",
                                                            N_("Whether to cycle colors"),
                                                            TRUE,
                                                            NULL),
                                visual_param_new_bool      ("moving_light",
                                                            N_("Whether the light moves with the mouse"),
                                                            TRUE,
                                                            NULL),
                                visual_param_new_bool      ("diamond",
                                                            N_("Whether to use a diamond shape light"),
                                                            FALSE,
                                                            NULL),
                                NULL);

	BumpscopePrivate *priv = visual_mem_new0 (BumpscopePrivate, 1);
	visual_plugin_set_private (plugin, priv);

	priv->phongres = 256;
	priv->rcontext = visual_plugin_get_random_context (plugin);
	priv->pal      = visual_palette_new (256);
	priv->pcmbuf   = visual_buffer_new_allocate (512 * sizeof (float));

	return TRUE;
}

static void act_bumpscope_cleanup (VisPluginData *plugin)
{
	BumpscopePrivate *priv = visual_plugin_get_private (plugin);

	__bumpscope_cleanup (priv);

	visual_palette_free (priv->pal);

	visual_buffer_unref (priv->pcmbuf);

	visual_mem_free (priv);
}