int visual_hashlist_put (VisHashlist *hashlist, char *key, void *data) { VisHashlistEntry *hentry; VisListEntry *le; visual_return_val_if_fail (hashlist != NULL, -VISUAL_ERROR_HASHLIST_NULL); visual_return_val_if_fail (key != NULL, -VISUAL_ERROR_NULL); visual_return_val_if_fail (data != NULL, -VISUAL_ERROR_NULL); le = visual_hashmap_get_string (hashlist->index, key); if (le != NULL) { hentry = le->data; hentry->data = data; } else { hentry = visual_mem_new0 (VisHashlistEntry, 1); hentry->key = key; hentry->data = data; visual_list_add (hashlist->list, hentry); le = hashlist->list->tail; visual_hashmap_put_string (hashlist->index, key, le); } return VISUAL_OK; }
/** * Adds a change notification callback, this shouldn't be used to get notificated within a plugin, but is for * things like VisUI. * * @param param Pointer to the VisParamEntry to which a change notification callback is added. * @param callback The notification callback, which is called on changes in the VisParamEntry. * @param priv A private that can be used in the callback function. * * return callback id in the form of a positive value on succes, * -VISUAL_ERROR_PARAM_NULL, -VISUAL_ERROR_PARAM_CALLBACK_NULL or * -VISUAL_ERROR_PARAM_CALLBACK_TOO_MANY on failure. */ int visual_param_entry_add_callback (VisParamEntry *param, VisParamChangedCallbackFunc callback, void *priv) { VisParamEntryCallback *pcall; int id; visual_log_return_val_if_fail (param != NULL, -VISUAL_ERROR_PARAM_NULL); visual_log_return_val_if_fail (callback != NULL, -VISUAL_ERROR_PARAM_CALLBACK_NULL); id = get_next_pcall_id (¶m->callbacks); visual_log_return_val_if_fail (id >= 0, -VISUAL_ERROR_PARAM_CALLBACK_TOO_MANY); pcall = visual_mem_new0 (VisParamEntryCallback, 1); /* Do the VisObject initialization for the VisParamEntryCallback */ visual_object_initialize (VISUAL_OBJECT (pcall), TRUE, NULL); pcall->id = id; pcall->callback = callback; visual_object_set_private (VISUAL_OBJECT (pcall), priv); visual_list_add (¶m->callbacks, pcall); return id; }
/* LVAVS Preset */ LVAVSPipeline *lvavs_pipeline_new () { LVAVSPipeline *pipeline; VisColor *col = visual_color_black(); int i,j; pipeline = visual_mem_new0 (LVAVSPipeline, 1); pipeline->dummy_vid = visual_video_new_with_buffer(0, 0, 1); pipeline->last_vid = visual_video_new_with_buffer(0, 0, 1); for(i = 0; i < sizeof(pipeline->buffers) / sizeof(VisVideo); i++) { pipeline->buffers[i] = visual_video_new_with_buffer(0, 0, 1); } for (j=0;j<256;j++) for (i=0;i<256;i++) pipeline->blendtable[i][j] = (unsigned char)((i / 255.0) * (float)j); /* Do the VisObject initialization */ visual_object_set_allocated (VISUAL_OBJECT (pipeline), TRUE); visual_object_initialize (VISUAL_OBJECT (pipeline), TRUE, lvavs_pipeline_dtor); return pipeline; }
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; }
/** * Allocate an amount of colors for a VisPalette. * * @param pal Pointer to the VisPalette for which colors are allocated. * @param ncolors The number of colors allocated for the VisPalette. * * @return VISUAL_OK on succes, -VISUAL_ERROR_PALETTE_NULL on failure. */ int visual_palette_allocate_colors (VisPalette *pal, int ncolors) { visual_log_return_val_if_fail (pal != NULL, -VISUAL_ERROR_PALETTE_NULL); pal->colors = visual_mem_new0 (VisColor, ncolors); pal->ncolors = ncolors; return VISUAL_OK; }
/** * Create a VisBeat and initialize it. This object should not be reinitialized. * * @return A newly allocated VisBeatAdv, or NULL on failure. */ VisBeatAdv *visual_beat_adv_new() { VisBeatAdv *adv = visual_mem_new0(VisBeatAdv, 1); visual_object_initialize (VISUAL_OBJECT(adv), TRUE, beat_adv_dtor); visual_beat_adv_init(adv); return adv; }
//VisBeatAdv *visual_beat_adv_new() VisBeat *visual_beat_new() { VisBeat *beat = visual_mem_new0(VisBeat, 1); visual_object_initialize (VISUAL_OBJECT(beat), TRUE, beat_dtor); visual_beat_init(beat); return beat; }
AVSSerializeContainer *avs_serialize_container_new () { AVSSerializeContainer *scont; scont = visual_mem_new0 (AVSSerializeContainer, 1); /* Do the VisObject initialization */ visual_object_initialize (VISUAL_OBJECT (scont), TRUE, avs_data_serialize_container_dtor); return scont; }
/* LVAVS Preset */ LVAVSPreset *lvavs_preset_new () { LVAVSPreset *preset; preset = visual_mem_new0 (LVAVSPreset, 1); /* Do the VisObject initialization */ visual_object_initialize (VISUAL_OBJECT (preset), TRUE, lvavs_preset_dtor); return preset; }
/** * Create a new runnable context. * Can be used to create multiple objects in succession. * * @see avs_runnable_new * @returns A newly created runnable context on success, NULL on failure. */ AvsRunnableContext * avs_runnable_context_new(void) { AvsRunnableContext *ctx; /* Allocate memory for Runnable Context */ ctx = visual_mem_new0(AvsRunnableContext, 1); visual_object_initialize(VISUAL_OBJECT(ctx), TRUE, context_dtor); /* Initialize Runnable Context */ context_ctor(ctx); return ctx; }
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; }
/* AVS parser */ AVSTree *avs_tree_new_from_preset (char *filename) { AVSTree *avstree; avstree = visual_mem_new0 (AVSTree, 1); /* Do the VisObject initialization */ visual_object_initialize (VISUAL_OBJECT (avstree), TRUE, avs_tree_dtor); avs_parse_data (avstree, filename); return avstree; }
LVAVSPipelineElement *lvavs_pipeline_element_new (LVAVSPipelineElementType type) { LVAVSPipelineElement *element; element = visual_mem_new0 (LVAVSPipelineElement, 1); /* Do the VisObject initialization */ visual_object_initialize (VISUAL_OBJECT (element), TRUE, lvavs_pipeline_element_dtor); element->type = type; return element; }
/** * Creates a new VisParamContainer structure. * * @return A newly allocated VisParamContainer structure. */ VisParamContainer *visual_param_container_new () { VisParamContainer *paramcontainer; paramcontainer = visual_mem_new0 (VisParamContainer, 1); /* Do the VisObject initialization */ visual_object_initialize (VISUAL_OBJECT (paramcontainer), TRUE, param_container_dtor); visual_collection_set_destroyer (VISUAL_COLLECTION (¶mcontainer->entries), visual_object_collection_destroyer); return paramcontainer; }
/** * Create a new variable manager, used for sharing variables between * runnable objects. * * @return Pointer to a newly created variable manager */ AvsRunnableVariableManager * avs_runnable_variable_manager_new() { AvsRunnableVariableManager *manager = visual_mem_new0(AvsRunnableVariableManager, 1);//malloc(sizeof(AvsRunnableVariableManager)); visual_object_initialize(VISUAL_OBJECT(manager), TRUE, vm_dtor); // Every manager should have these variables avs_runnable_variable_create(manager, "PI", PI); avs_runnable_variable_create(manager, "E", E); avs_runnable_variable_create(manager, "PHI", PHI); return manager; }
VisAudioSamplePoolChannel *visual_audio_samplepool_channel_new (const char *channelid) { VisAudioSamplePoolChannel *channel; channel = visual_mem_new0 (VisAudioSamplePoolChannel, 1); visual_audio_samplepool_channel_init (channel, channelid); /* Do the VisObject initialization */ visual_object_set_allocated (VISUAL_OBJECT (channel), TRUE); visual_object_ref (VISUAL_OBJECT (channel)); return channel; }
VisHashlist *visual_hashlist_new (VisCollectionDestroyerFunc destroyer, int size) { VisHashlist *hashlist; hashlist = visual_mem_new0 (VisHashlist, 1); visual_hashlist_init (hashlist, destroyer, size); /* Do the VisObject initialization */ visual_object_set_allocated (VISUAL_OBJECT (hashlist), TRUE); visual_object_ref (VISUAL_OBJECT (hashlist)); return hashlist; }
/** * Creates a new transform from name, the plugin will be loaded but won't be realized. * * @param transformname * The name of the plugin to load, or NULL to simply allocate a new * transform. * * @return A newly allocated VisTransform, optionally containing a loaded plugin. Or NULL on failure. */ VisTransform *visual_transform_new (const char *transformname) { VisTransform *transform; transform = visual_mem_new0 (VisTransform, 1); visual_transform_init (transform, transformname); /* Do the VisObject initialization */ visual_object_set_allocated (VISUAL_OBJECT (transform), TRUE); visual_object_ref (VISUAL_OBJECT (transform)); return transform; }
VisRingBufferEntry *visual_ringbuffer_entry_new (VisBuffer *buffer) { VisRingBufferEntry *entry; entry = visual_mem_new0 (VisRingBufferEntry, 1); visual_ringbuffer_entry_init (entry, buffer); /* Do the VisObject initialization */ visual_object_set_allocated (VISUAL_OBJECT (entry), TRUE); visual_object_ref (VISUAL_OBJECT (entry)); return entry; }
/** * Creates a new actor from name, the plugin will be loaded but won't be realized. * * @param actorname * The name of the plugin to load, or NULL to simply allocate a new * actor. * * @return A newly allocated VisActor, optionally containing a loaded plugin. Or NULL on failure. */ VisActor *visual_actor_new (const char *actorname) { VisActor *actor; actor = visual_mem_new0 (VisActor, 1); visual_actor_init (actor, actorname); /* Do the VisObject initialization */ visual_object_set_allocated (VISUAL_OBJECT (actor), TRUE); visual_object_ref (VISUAL_OBJECT (actor)); return actor; }
VisRandomContext *visual_random_context_new (uint32_t seed) { VisRandomContext *rcontext; rcontext = visual_mem_new0 (VisRandomContext, 1); visual_random_context_init (rcontext, seed); /* Do the VisObject initialization */ visual_object_set_allocated (VISUAL_OBJECT (rcontext), TRUE); visual_object_ref (VISUAL_OBJECT (rcontext)); return rcontext; }
VisAudioSamplePool *visual_audio_samplepool_new () { VisAudioSamplePool *samplepool; samplepool = visual_mem_new0 (VisAudioSamplePool, 1); visual_audio_samplepool_init (samplepool); /* Do the VisObject initialization */ visual_object_set_allocated (VISUAL_OBJECT (samplepool), TRUE); visual_object_ref (VISUAL_OBJECT (samplepool)); return samplepool; }
VisRingBuffer *visual_ringbuffer_new () { VisRingBuffer *ringbuffer; ringbuffer = visual_mem_new0 (VisRingBuffer, 1); visual_ringbuffer_init (ringbuffer); /* Do the VisObject initialization */ visual_object_set_allocated (VISUAL_OBJECT (ringbuffer), TRUE); visual_object_ref (VISUAL_OBJECT (ringbuffer)); return ringbuffer; }
VisVideo *visual_video_new () { VisVideo *video; video = visual_mem_new0 (VisVideo, 1); visual_video_init (video); /* Do the VisObject initialization */ visual_object_set_allocated (VISUAL_OBJECT (video), TRUE); visual_object_ref (VISUAL_OBJECT (video)); return video; }
/** * Create a new runnable object * * @param ctx Runnable Context, previously initialized or created with avs_runnable_context_new() * * @see avs_runnable_context_new * @return Newly created object on success, NULL on failure. */ AvsRunnable * avs_runnable_new(AvsRunnableContext *ctx) { AvsRunnable *obj; /* Allocate memory for Runnable Object */ if ((obj = visual_mem_new0(AvsRunnable, 1)) == NULL) return NULL; visual_object_initialize(VISUAL_OBJECT(obj), TRUE, runnable_dtor); /* Initialize Runnable Object */ runnable_ctor(ctx, obj); return obj; }
LVAVSPresetElement *lvavs_preset_element_new (LVAVSPresetElementType type, const char *name) { LVAVSPresetElement *element; element = visual_mem_new0 (LVAVSPresetElement, 1); /* Do the VisObject initialization */ visual_object_initialize (VISUAL_OBJECT (element), TRUE, lvavs_preset_element_dtor); element->type = type; element->element_name = strdup(name); element->pcont = visual_param_container_new(); return element; }
LVAVSPipelineContainer *lvavs_pipeline_container_new () { LVAVSPipelineContainer *container; container = visual_mem_new0 (LVAVSPipelineContainer, 1); /* Do the VisObject initialization */ visual_object_initialize (VISUAL_OBJECT (container), TRUE, lvavs_pipeline_container_dtor); LVAVS_PIPELINE_ELEMENT (container)->type = LVAVS_PIPELINE_ELEMENT_TYPE_CONTAINER; container->members = visual_list_new (visual_object_collection_destroyer); return container; }
LVAVSPresetContainer *lvavs_preset_container_new () { LVAVSPresetContainer *container; container = visual_mem_new0 (LVAVSPresetContainer, 1); /* Do the VisObject initialization */ visual_object_initialize (VISUAL_OBJECT (container), TRUE, lvavs_preset_container_dtor); container->members = visual_list_new (visual_object_collection_destroyer); container->element.element_name = strdup("new container"); container->element.type = LVAVS_PRESET_ELEMENT_TYPE_CONTAINER; return container; }
/** * Creates a new VisParamEntry structure. * * @param name The name that is assigned to the VisParamEntry. * * @return A newly allocated VisParamEntry structure. */ VisParamEntry *visual_param_entry_new (char *name) { VisParamEntry *param; param = visual_mem_new0 (VisParamEntry, 1); /* Do the VisObject initialization */ visual_object_initialize (VISUAL_OBJECT (param), TRUE, param_entry_dtor); visual_param_entry_set_name (param, name); visual_collection_set_destroyer (VISUAL_COLLECTION (¶m->callbacks), visual_object_collection_destroyer); return param; }
const VisPluginInfo *get_plugin_info (void) { static VisActorPlugin actor = { .requisition = lv_goom_requisition, .palette = lv_goom_palette, .render = lv_goom_render, .vidoptions.depth = VISUAL_VIDEO_DEPTH_32BIT }; static VisPluginInfo info = { .type = VISUAL_PLUGIN_TYPE_ACTOR, .plugname = "goom2k4", .name = "libvisual goom2k4 plugin", .author = "Dennis Smit <*****@*****.**>, goom2k4 by: Jean-Christophe Hoelt <*****@*****.**>", .version = "0.1", .about = N_("Libvisual goom2k4 plugin"), .help = N_("This plugin adds support for the supercool goom2k4 plugin that is simply awesome"), .license = VISUAL_PLUGIN_LICENSE_LGPL, .init = lv_goom_init, .cleanup = lv_goom_cleanup, .events = lv_goom_events, .plugin = VISUAL_OBJECT (&actor) }; return &info; } static int lv_goom_init (VisPluginData *plugin) { GoomPrivate *priv; #if ENABLE_NLS bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); #endif priv = visual_mem_new0 (GoomPrivate, 1); visual_object_set_private (VISUAL_OBJECT (plugin), priv); priv->goominfo = goom_init (128, 128); priv->pcmbuf1 = visual_buffer_new (); priv->pcmbuf2 = visual_buffer_new (); return 0; }