int pipeline_container_realize (LVAVSPipelineContainer *container) { VisListEntry *le = NULL; LVAVSPipelineElement *element; while ((element = visual_list_next (container->members, &le)) != NULL) { switch (element->type) { case LVAVS_PIPELINE_ELEMENT_TYPE_NULL: break; case LVAVS_PIPELINE_ELEMENT_TYPE_ACTOR: visual_actor_realize (element->data.actor); visual_param_container_copy_match (visual_plugin_get_params ( visual_actor_get_plugin (element->data.actor)), element->params); break; case LVAVS_PIPELINE_ELEMENT_TYPE_TRANSFORM: visual_transform_realize (element->data.transform); visual_param_container_copy_match (visual_plugin_get_params ( visual_transform_get_plugin (element->data.transform)), element->params); break; case LVAVS_PIPELINE_ELEMENT_TYPE_MORPH: visual_morph_realize (element->data.morph); break; case LVAVS_PIPELINE_ELEMENT_TYPE_RENDERSTATE: break; case LVAVS_PIPELINE_ELEMENT_TYPE_CONTAINER: pipeline_container_realize (LVAVS_PIPELINE_CONTAINER (element)); break; default: visual_log (VISUAL_LOG_CRITICAL, "Invalid LVAVSPipelineElementType"); break; } } return 0; }
static void act_bumpscope_render (VisPluginData *plugin, VisVideo *video, VisAudio *audio) { BumpscopePrivate *priv = visual_plugin_get_private (plugin); priv->video = video; visual_audio_get_sample_mixed_simple (audio, priv->pcmbuf, 2, VISUAL_AUDIO_CHANNEL_LEFT, VISUAL_AUDIO_CHANNEL_RIGHT); __bumpscope_render_pcm (priv, visual_buffer_get_data (priv->pcmbuf)); visual_mem_copy (visual_video_get_pixels (video), priv->rgb_buf2, visual_video_get_size (video)); priv->colorupdate++; /* Let's not overload the color selector */ if (priv->colorupdate > 1) priv->colorupdate = 0; if (priv->colorchanged == TRUE && priv->colorupdate == 0) { /* I couldn't hold myself */ visual_param_set_value_color ( visual_param_list_get ( visual_plugin_get_params (plugin), "color"), &priv->color); } }
static int inp_debug_init (VisPluginData *plugin) { DebugPriv *priv; VisParamEntry *param; VisParamContainer *paramcontainer = visual_plugin_get_params (plugin); static VisParamEntry params[] = { VISUAL_PARAM_LIST_ENTRY_FLOAT ("frequency", DEFAULT_FREQUENCY), VISUAL_PARAM_LIST_ENTRY_FLOAT ("ampltitude", DEFAULT_AMPLITUDE), VISUAL_PARAM_LIST_END }; priv = visual_mem_new0 (DebugPriv, 1); visual_object_set_private (VISUAL_OBJECT (plugin), priv); priv->frequency = DEFAULT_FREQUENCY; priv->ampltitude = DEFAULT_AMPLITUDE; setup_wave (priv); visual_param_container_add_many (paramcontainer, params); param = visual_param_container_get (paramcontainer, "frequency"); visual_param_entry_min_set_float (param, 0.0); visual_param_entry_max_set_float (param, 22000.0); param = visual_param_container_get (paramcontainer, "ampltitude"); visual_param_entry_min_set_float (param, 0.0); visual_param_entry_max_set_float (param, 1.0); return 0; }
/** * generate a new config-string from current config */ void config_string_genstring(BlurskPrivate *priv) { char *string = paste_genstring(); VisParamContainer *paramcontainer = visual_plugin_get_params(priv->plugin); VisParamEntry *param = visual_param_container_get(paramcontainer, "config_string"); /* don't set if it has already been set */ if(strcmp(string, visual_param_entry_get_string(param)) != 0) visual_param_entry_set_string(param, string); priv->update_config_string = 0; }
/** * generate a new config-string from current config */ void config_string_genstring(BlurskPrivate *priv) { char *string = paste_genstring(); VisParamList *params = visual_plugin_get_params(priv->plugin); VisParam *param = visual_param_list_get(params, "config_string"); /* don't set if it has already been set */ if(strcmp(string, visual_param_get_value_string(param)) != 0) visual_param_set_value_string(param, string); priv->update_config_string = 0; }
const VisPluginInfo *get_plugin_info (void) { static VisActorPlugin actor = { .requisition = act_jakdaw_requisition, .palette = act_jakdaw_palette, .render = act_jakdaw_render, .vidoptions.depth = VISUAL_VIDEO_DEPTH_32BIT }; static VisPluginInfo info = { .type = VISUAL_PLUGIN_TYPE_ACTOR, .plugname = "jakdaw", .name = "Jakdaw plugin", .author = N_("Original by: Christopher Wilson <*****@*****.**>, Port by: Dennis Smit <*****@*****.**>"), .version = "0.0.1", .about = N_("jakdaw visual plugin"), .help = N_("This is the libvisual port of the xmms Jakdaw plugin"), .license = VISUAL_PLUGIN_LICENSE_GPL, .init = act_jakdaw_init, .cleanup = act_jakdaw_cleanup, .events = act_jakdaw_events, .plugin = VISUAL_OBJECT (&actor) }; return &info; } static int act_jakdaw_init (VisPluginData *plugin) { JakdawPrivate *priv; VisParamContainer *paramcontainer = visual_plugin_get_params (plugin); static VisParamEntry params[] = { VISUAL_PARAM_LIST_ENTRY_INTEGER ("zoom mode", FEEDBACK_ZOOMRIPPLE), VISUAL_PARAM_LIST_ENTRY_INTEGER ("plotter trigger", PLOTTER_COLOUR_MUSICTRIG), VISUAL_PARAM_LIST_ENTRY_INTEGER ("plotter type", PLOTTER_SCOPE_LINES), VISUAL_PARAM_LIST_END }; /* static VisParamEntry zoomparamchoices[] = { VISUAL_PARAM_LIST_ENTRY_INTEGER ("Zoom ripple", FEEDBACK_ZOOMRIPPLE), VISUAL_PARAM_LIST_ENTRY_INTEGER ("Blur only", FEEDBACK_BLURONLY), VISUAL_PARAM_LIST_ENTRY_INTEGER ("Zoom rotate", FEEDBACK_ZOOMROTATE), VISUAL_PARAM_LIST_ENTRY_INTEGER ("Scroll", FEEDBACK_SCROLL), VISUAL_PARAM_LIST_ENTRY_INTEGER ("Into screen", FEEDBACK_INTOSCREEN), VISUAL_PARAM_LIST_ENTRY_INTEGER ("Ripple", FEEDBACK_NEWRIPPLE), VISUAL_PARAM_LIST_END }; static VisParamEntry colorparamchoices[] = { VISUAL_PARAM_LIST_ENTRY_INTEGER ("Solid", PLOTTER_COLOUR_SOLID), VISUAL_PARAM_LIST_ENTRY_INTEGER ("Random", PLOTTER_COLOUR_RANDOM), VISUAL_PARAM_LIST_ENTRY_INTEGER ("On music", PLOTTER_COLOUR_MUSICTRIG), VISUAL_PARAM_LIST_END }; static VisParamEntry scopeparamchoices[] = { VISUAL_PARAM_LIST_ENTRY_INTEGER ("Lines", PLOTTER_SCOPE_LINES), VISUAL_PARAM_LIST_ENTRY_INTEGER ("Dots", PLOTTER_SCOPE_DOTS), VISUAL_PARAM_LIST_ENTRY_INTEGER ("Solid", PLOTTER_SCOPE_SOLID), VISUAL_PARAM_LIST_ENTRY_INTEGER ("Nothing", PLOTTER_SCOPE_NOTHING), VISUAL_PARAM_LIST_END }; */ #if ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); #endif priv = visual_mem_new0 (JakdawPrivate, 1); visual_object_set_private (VISUAL_OBJECT (plugin), priv); priv->rcontext = visual_plugin_get_random_context (plugin); priv->decay_rate = 1; priv->zoom_ripplesize = 32; priv->zoom_ripplefact = 0.1; priv->zoom_zoomfact = 0.9; priv->plotter_amplitude = 0.5; /* FIXME make param of this one as well */ priv->plotter_scopecolor = 0xff00ff; visual_param_container_add_many (paramcontainer, params); priv->pcmbuf = visual_buffer_new_allocate (512 * sizeof (float)); priv->freqbuf = visual_buffer_new_allocate (256 * sizeof (float)); return 0; }
/** * reflect the new values. */ static void _config_load_preset(BlurskPrivate *priv, BlurskConfig *conf) { struct { char *name; int type; void *val; }entries[] = { {"color", VISUAL_PARAM_ENTRY_TYPE_COLOR, &conf->color}, {"color_style", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->color_style}, {"fade_speed", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->fade_speed}, {"signal_color", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->signal_color}, {"contour_lines", VISUAL_PARAM_ENTRY_TYPE_INTEGER, &conf->contour_lines}, {"hue_on_beats", VISUAL_PARAM_ENTRY_TYPE_INTEGER, &conf->hue_on_beats}, {"background", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->background}, {"blur_style", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->blur_style}, {"transition_speed", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->transition_speed}, {"blur_when", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->blur_when}, {"blur_stencil", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->blur_stencil}, {"slow_motion", VISUAL_PARAM_ENTRY_TYPE_INTEGER, &conf->slow_motion}, {"signal_style", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->signal_style}, {"plot_style", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->plot_style}, {"thick_on_beats", VISUAL_PARAM_ENTRY_TYPE_INTEGER, &conf->thick_on_beats}, {"flash_style", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->flash_style}, {"overall_effect", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->overall_effect}, {"floaters", VISUAL_PARAM_ENTRY_TYPE_STRING, &conf->floaters}, }; int i; for(i = 0; i < QTY(entries); i++) { VisParamContainer *paramcontainer = visual_plugin_get_params(priv->plugin); VisParamEntry *ptmp = visual_param_container_get(paramcontainer, entries[i].name); switch(entries[i].type) { case VISUAL_PARAM_ENTRY_TYPE_INTEGER: { int *integer = entries[i].val; /* only update if values differ */ if(*integer != visual_param_entry_get_integer(ptmp)) visual_param_entry_set_integer(ptmp, *integer); break; } case VISUAL_PARAM_ENTRY_TYPE_COLOR: { VisColor *color = visual_param_entry_get_color(ptmp); VisColor ncolor; uint32_t nicolor = (((color->b)<<16) + ((color->g)<<8) + color->r); uint32_t *icolor = entries[i].val; /* only update if values differ */ if(*icolor != nicolor) { visual_color_set(&ncolor, (*icolor&0xFF0000)>>16, (*icolor&0xFF00)>>8, (*icolor&0xFF)); visual_param_entry_set_color_by_color(ptmp, &ncolor); } break; } case VISUAL_PARAM_ENTRY_TYPE_STRING: { char **string = entries[i].val; /* only update if values differ */ if(strcmp(*string, visual_param_entry_get_string(ptmp)) != 0) visual_param_entry_set_string(ptmp, *string); break; } } }
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); }
const VisPluginInfo *get_plugin_info (void) { static VisActorPlugin actor = { .requisition = act_gdkpixbuf_requisition, .palette = act_gdkpixbuf_palette, .render = act_gdkpixbuf_render, .vidoptions.depth = VISUAL_VIDEO_DEPTH_24BIT }; static VisPluginInfo info = { .type = VISUAL_PLUGIN_TYPE_ACTOR, .plugname = "gdkpixbuf", .name = "GdkPixbuf image loader", .author = "Dennis Smit <*****@*****.**>", .version = "0.0.1", .about = N_("GdkPixbuf image loader for libvisual"), .help = N_("This plugin can be used to show images"), .license = VISUAL_PLUGIN_LICENSE_LGPL, .init = act_gdkpixbuf_init, .cleanup = act_gdkpixbuf_cleanup, .events = act_gdkpixbuf_events, .plugin = &actor }; return &info; } static int act_gdkpixbuf_init (VisPluginData *plugin) { /* Initialize GObjects, needed for GdkPixbuf */ g_type_init (); #if ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR); #endif PixbufPrivate *priv = visual_mem_new0 (PixbufPrivate, 1); visual_plugin_set_private (plugin, priv); VisParamList *params = visual_plugin_get_params (plugin);; visual_param_list_add_many (params, visual_param_new_string ("filename", N_("Input filename"), "", NULL), visual_param_new_bool ("scaled", N_("Scaled"), TRUE, NULL), visual_param_new_bool ("aspect", N_("Aspect"), TRUE, NULL), visual_param_new_bool ("center", N_("Centered"), TRUE, NULL), visual_param_new_bool ("set_size", N_("Set size"), FALSE, NULL), visual_param_new_integer ("width", N_("Width"), 0, visual_param_in_range_integer (0, INT_MAX)), visual_param_new_integer ("height", N_("Height"), 0, visual_param_in_range_integer (0, INT_MAX)), visual_param_new_integer ("x", N_("x"), 0, visual_param_in_range_integer (0, INT_MAX)), visual_param_new_integer ("y", N_("y"), 0, visual_param_in_range_integer (0, INT_MAX)), visual_param_new_integer ("interpolate", N_("Interpolation method"), 0, NULL), NULL); priv->target = NULL; return TRUE; } static void act_gdkpixbuf_cleanup (VisPluginData *plugin) { PixbufPrivate *priv = visual_plugin_get_private (plugin); visual_mem_free (priv->filename); if (priv->source) { g_object_unref (priv->source); } if (priv->target) { visual_video_unref (priv->target); } visual_mem_free (priv); }
static bg_parameter_info_t * create_parameters(VisActor * actor, VisUIWidget *** widgets, VisParamEntry *** params_ret) { int num_parameters, i, index, supported; bg_parameter_info_t * ret; VisParamContainer * params; // VisHashmapChainEntry *entry; VisParamEntry *param_entry; VisListEntry * list_entry; VisUIWidget * widget; VisUIWidget * param_widget; params = visual_plugin_get_params(visual_actor_get_plugin(actor)); /* Count parameters */ num_parameters = 0; list_entry = NULL; while(visual_list_next(¶ms->entries, &list_entry)) num_parameters++; if(!num_parameters) return NULL; /* Create parameters */ ret = calloc(num_parameters+1, sizeof(*ret)); if(widgets) *widgets = calloc(num_parameters, sizeof(**widgets)); if(params_ret) *params_ret = calloc(num_parameters, sizeof(**params_ret)); list_entry = NULL; index = 0; widget = visual_plugin_get_userinterface(visual_actor_get_plugin(actor)); for(i = 0; i < num_parameters; i++) { visual_list_next(¶ms->entries, &list_entry); param_entry = list_entry->data; // param_entry = VISUAL_PARAMENTRY(entry->data); if(params_ret) (*params_ret)[index] = param_entry; supported = 1; if(widget) param_widget = check_widget(widget, param_entry->name, &ret[index]); else param_widget = NULL; if(!param_widget) { switch(param_entry->type) { case VISUAL_PARAM_ENTRY_TYPE_NULL: /**< No parameter. */ supported = 0; break; case VISUAL_PARAM_ENTRY_TYPE_STRING: /**< String parameter. */ ret[index].type = BG_PARAMETER_STRING; ret[index].val_default.val_str = gavl_strrep(ret[index].val_default.val_str, param_entry->string); break; case VISUAL_PARAM_ENTRY_TYPE_INTEGER: /**< Integer parameter. */ ret[index].type = BG_PARAMETER_INT; ret[index].flags |= BG_PARAMETER_SYNC; ret[index].val_default.val_i = param_entry->numeric.integer; break; case VISUAL_PARAM_ENTRY_TYPE_FLOAT: /**< Floating point parameter. */ ret[index].type = BG_PARAMETER_FLOAT; ret[index].flags |= BG_PARAMETER_SYNC; ret[index].val_default.val_f = param_entry->numeric.floating; break; case VISUAL_PARAM_ENTRY_TYPE_DOUBLE: /**< Double floating point parameter. */ ret[index].type = BG_PARAMETER_FLOAT; ret[index].flags |= BG_PARAMETER_SYNC; ret[index].val_default.val_f = param_entry->numeric.doubleflt; break; case VISUAL_PARAM_ENTRY_TYPE_COLOR: /**< VisColor parameter. */ ret[index].type = BG_PARAMETER_COLOR_RGB; ret[index].flags |= BG_PARAMETER_SYNC; ret[index].val_default.val_color[0] = (float)param_entry->color.r / 255.0; ret[index].val_default.val_color[1] = (float)param_entry->color.g / 255.0; ret[index].val_default.val_color[2] = (float)param_entry->color.b / 255.0; break; case VISUAL_PARAM_ENTRY_TYPE_PALETTE: /**< VisPalette parameter. */ case VISUAL_PARAM_ENTRY_TYPE_OBJECT: /**< VisObject parameter. */ case VISUAL_PARAM_ENTRY_TYPE_END: /**< List end, and used as terminator for VisParamEntry lists. */ supported = 0; break; } } if(widgets) (*widgets)[index] = param_widget; if(!supported) continue; ret[index].name = gavl_strdup(param_entry->name); ret[index].long_name = gavl_strdup(param_entry->name); index++; } return ret; }