示例#1
0
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;
}
示例#2
0
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;
}
示例#3
0
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;
}
示例#5
0
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;
}
示例#6
0
/**
 * 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;
}
示例#8
0
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;
}
示例#9
0
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;
}
示例#10
0
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;
}
示例#11
0
/**
 * 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;
}
示例#12
0
/**
 * 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;
}
示例#13
0
/**
 * 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;
}
示例#14
0
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;
}
示例#15
0
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;
}
示例#16
0
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;
}
示例#17
0
/**
 * 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;
}
示例#18
0
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;
}
示例#19
0
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;
}
示例#20
0
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;
}