int visual_collection_iter_init (VisCollectionIter *iter, VisCollectionIterAssignFunc assignfunc, VisCollectionIterNextFunc nextfunc, VisCollectionIterHasMoreFunc hasmorefunc, VisCollectionIterGetDataFunc getdatafunc, VisCollection *collection, VisObject *context) { visual_log_return_val_if_fail (iter != NULL, -VISUAL_ERROR_COLLECTION_ITER_NULL); /* Do the VisObject initialization */ visual_object_clear (VISUAL_OBJECT (iter)); visual_object_set_dtor (VISUAL_OBJECT (iter), NULL); visual_object_set_allocated (VISUAL_OBJECT (iter), FALSE); /* Set the VisCollectionIter data */ iter->assignfunc = assignfunc; iter->nextfunc = nextfunc; iter->hasmorefunc = hasmorefunc; iter->getdatafunc = getdatafunc; iter->collection = collection; iter->context = context; if (iter->collection != NULL) visual_object_ref (VISUAL_OBJECT (iter->collection)); return VISUAL_OK; }
int pipeline_container_propagate_event (LVAVSPipelineContainer *container, VisEvent *event) { VisListEntry *le = NULL; VisEventQueue *pluginqueue; LVAVSPipelineElement *element; while ((element = visual_list_next (container->members, &le)) != NULL) { switch (element->type) { case LVAVS_PIPELINE_ELEMENT_TYPE_ACTOR: pluginqueue = visual_plugin_get_eventqueue (visual_actor_get_plugin (element->data.actor)); visual_object_ref (VISUAL_OBJECT (event)); visual_event_queue_add (pluginqueue, event); break; case LVAVS_PIPELINE_ELEMENT_TYPE_TRANSFORM: pluginqueue = visual_plugin_get_eventqueue (visual_actor_get_plugin (element->data.actor)); visual_object_ref (VISUAL_OBJECT (event)); visual_event_queue_add (pluginqueue, event); break; case LVAVS_PIPELINE_ELEMENT_TYPE_CONTAINER: pipeline_container_propagate_event (LVAVS_PIPELINE_CONTAINER (element), event); break; default: break; } } return VISUAL_OK; }
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; }
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; }
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; }
/** * 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; }
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; }
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; }
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; }
/** * Creates a new VisPalette. * * @return A newly allocated VisPalette. */ VisPalette *visual_palette_new (int ncolors) { VisPalette *pal; pal = visual_mem_new0 (VisPalette, 1); visual_palette_init (pal); /* Do the VisObject initialization */ visual_object_set_allocated (VISUAL_OBJECT (pal), TRUE); visual_object_ref (VISUAL_OBJECT (pal)); visual_palette_allocate_colors (pal, ncolors); return pal; }
/** * Sets the VisParamEntry to VISUAL_PARAM_ENTRY_TYPE_COLLECTION and assigns a VisCollection to the VisParamEntry. * * @param param Pointer to the VisParamEntry to which a parameter is set. * @param object Pointer to the VisObject that is linked to the VisParamEntry. * * @return VISUAL_OK on success, -VISUAL_ERROR_PARAM_NULL on failure. */ int visual_param_entry_set_collection (VisParamEntry *param, VisCollection *collection) { visual_log_return_val_if_fail(param != NULL, -VISUAL_ERROR_PARAM_NULL); param->type = VISUAL_PARAM_ENTRY_TYPE_COLLECTION; if (param->collection != NULL) visual_object_unref (VISUAL_OBJECT(param->collection)); param->collection = collection; if (param->collection != NULL) visual_object_ref(VISUAL_OBJECT(param->collection)); return VISUAL_OK; }
VisAudioSample *visual_audio_sample_new (VisBuffer *buffer, VisTime *timestamp, VisAudioSampleFormatType format, VisAudioSampleRateType rate) { VisAudioSample *sample; sample = visual_mem_new0 (VisAudioSample, 1); visual_audio_sample_init (sample, buffer, timestamp, format, rate); /* Do the VisObject initialization */ visual_object_set_allocated (VISUAL_OBJECT (sample), TRUE); visual_object_ref (VISUAL_OBJECT (sample)); return sample; }
VisAudio *visual_audio_new () { VisAudio *audio; audio = visual_mem_new0 (VisAudio, 1); visual_audio_init (audio); audio->beat = visual_beat_new(); /* Do the VisObject initialization */ visual_object_set_allocated (VISUAL_OBJECT (audio), TRUE); visual_object_ref (VISUAL_OBJECT (audio)); return audio; }
VisCollectionIter *visual_collection_iter_new ( VisCollectionIterAssignFunc assignfunc, VisCollectionIterNextFunc nextfunc, VisCollectionIterHasMoreFunc hasmorefunc, VisCollectionIterGetDataFunc getdatafunc, VisCollection *collection, VisObject *context) { VisCollectionIter *iter; iter = visual_mem_new0 (VisCollectionIter, 1); visual_collection_iter_init (iter, assignfunc, nextfunc, hasmorefunc, getdatafunc, collection, context); /* do the visobject initialization */ visual_object_set_allocated (VISUAL_OBJECT (iter), TRUE); visual_object_ref (VISUAL_OBJECT (iter)); return iter; }
/** * Sets the VisParamEntry to VISUAL_PARAM_ENTRY_TYPE_OBJECT and assigns a VisObject to the VisParamEntry. * With a VisObject VisParamEntry, the VisObject is referenced, not cloned. * * @param param Pointer to the VisParamEntry to which a parameter is set. * @param object Pointer to the VisObject that is linked to the VisParamEntry. * * @return VISUAL_OK on succes, -VISUAL_ERROR_PARAM_NULL on failure. */ int visual_param_entry_set_object (VisParamEntry *param, VisObject *object) { visual_log_return_val_if_fail (param != NULL, -VISUAL_ERROR_PARAM_NULL); param->type = VISUAL_PARAM_ENTRY_TYPE_OBJECT; if (param->objdata != NULL) visual_object_unref (param->objdata); param->objdata = object; if (param->objdata != NULL) visual_object_ref (param->objdata); visual_param_entry_changed (param); return VISUAL_OK; }
VisRingBufferEntry *visual_ringbuffer_entry_new_function ( VisRingBufferDataFunc datafunc, VisRingBufferDestroyFunc destroyfunc, VisRingBufferSizeFunc sizefunc, void *functiondata) { VisRingBufferEntry *entry; entry = visual_mem_new0 (VisRingBufferEntry, 1); visual_ringbuffer_entry_init_function (entry, datafunc, destroyfunc, sizefunc, functiondata); /* Do the VisObject initialization */ visual_object_set_allocated (VISUAL_OBJECT (entry), TRUE); visual_object_ref (VISUAL_OBJECT (entry)); return entry; }
VisMorph *visual_morph_new (const char *morphname) { VisMorph *morph; int result; morph = visual_mem_new0 (VisMorph, 1); result = visual_morph_init (morph, morphname); if (result != VISUAL_OK) { visual_mem_free (morph); return NULL; } /* Do the VisObject initialization */ visual_object_set_allocated (VISUAL_OBJECT (morph), TRUE); visual_object_ref (VISUAL_OBJECT (morph)); return morph; }
VisTransform *visual_transform_new (const char *transformname) { VisTransform *transform; int result; transform = visual_mem_new0 (VisTransform, 1); result = visual_transform_init (transform, transformname); if (result != VISUAL_OK) { visual_mem_free (transform); return NULL; } /* Do the VisObject initialization */ visual_object_set_allocated (VISUAL_OBJECT (transform), TRUE); visual_object_ref (VISUAL_OBJECT (transform)); return transform; }