move stuff

git-svn-id: svn://code.dyne.org/veejay/trunk@1132 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
Niels Elburg
2008-11-01 03:31:40 +00:00
parent ed6cab534f
commit 90197d342b
1117 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
#include <stddef.h>
#include "stdio.h"
#include <include/livido.h>
LIVIDO_PLUGIN
livido_init_f init_instance (livido_port_t *my_instance)
{
return 0;
}
livido_init_f deinit_instance (livido_port_t* my_instance)
{
return 0;
}
livido_process_f process_frame( livido_port_t *my_instance,
double timecode)
{
return 0;
}
#ifdef FUNCSTRUCT
livido_port_t *livido_setup(livido_setup_t *list,int vversion)
#else
livido_port_t *livido_setup(livido_setup_t list[],int vversion)
#endif
{
livido_port_t *info = NULL;
char *name = "Niels Elburg";
int version = 101;
int i = 55;
LIVIDO_IMPORT( list );
info = livido_port_new( i );
livido_property_set( info, "name", LIVIDO_ATOM_TYPE_STRING ,1, &name );
livido_property_set( info, "PLUGIN_foo", LIVIDO_ATOM_TYPE_INT,1, &i);
livido_property_set( info, "PLUGIN_bar", LIVIDO_ATOM_TYPE_STRING,1, &name);
return info;
}

View File

@@ -0,0 +1,106 @@
#include <stddef.h>
#include <stdio.h>
#include <include/livido.h>
LIVIDO_PLUGIN
#include "livido-utils.c"
#define num_palettes 5
int palettes[num_palettes] = { LIVIDO_PALETTE_RGB565,
LIVIDO_PALETTE_RGB888,
LIVIDO_PALETTE_RGBA8888,
LIVIDO_PALETTE_YUV888,
LIVIDO_PALETTE_YUVA8888
} ;
livido_init_f init_instance (livido_port_t *my_instance)
{
livido_set_string_value(my_instance, "PLUGIN_mydata", "My personal data, that the host won't touch!!!");
return 0;
}
livido_init_f deinit_instance (livido_port_t* my_instance)
{
// we would do cleanup and freeing here, but we have nothing to do
return 0;
}
livido_process_f process_frame( livido_port_t *my_instance,
double timecode)
{
return 0;
}
#ifdef FUNCSTRUCT
livido_port_t *livido_setup(livido_setup_t *list, int vversion)
#else
livido_port_t *livido_setup(livido_setup_t list[], int vversion)
#endif
{
livido_port_t *info;
livido_port_t *filter1;
livido_port_t *in_chann, *out_chann, *in_param, *out_param;
LIVIDO_IMPORT( list );
info = livido_port_new(LIVIDO_PORT_TYPE_PLUGIN_INFO);
livido_set_string_value(info, "maintainer", "Andraz Tori");
livido_set_string_value(info, "version", "1.0");
filter1 = livido_port_new(LIVIDO_PORT_TYPE_FILTER_CLASS);
livido_set_string_value (filter1, "name", "Fade plugin");
livido_set_string_value (filter1, "description", "Fades the image with alpha channel when exists or to black when it does not");
livido_set_int_value (filter1, "version", 1);
livido_set_int_value (filter1, "api_version", 100);
livido_set_string_value (filter1, "license", "Public domain");
livido_set_int_value (filter1, "flags", LIVIDO_FILTER_CAN_DO_INPLACE | LIVIDO_FILTER_STATELESS);
livido_set_voidptr_value(filter1, "process_func", &process_frame);
livido_set_voidptr_value(filter1, "init_func", &init_instance);
livido_set_voidptr_value(filter1, "deinit_func", &deinit_instance);
in_chann = livido_port_new(LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE);
livido_set_string_value (in_chann, "name", "input");
livido_set_int_value (in_chann, "flags", 0);
livido_set_int_array (in_chann, "palette_list", num_palettes, palettes);
livido_set_portptr_value(filter1, "in_channel_templates", in_chann);
out_chann = livido_port_new(LIVIDO_PORT_TYPE_CHANNEL_TEMPLATE);
livido_set_string_value (out_chann, "name", "faded output");
livido_set_int_value (out_chann, "flags", 0);
livido_set_int_array (out_chann, "palette_list", num_palettes, palettes);
livido_set_voidptr_value (out_chann, "same_as_size", in_chann);
livido_set_voidptr_value (out_chann, "same_as_palette", in_chann);
livido_set_portptr_value(filter1, "out_channel_templates", in_chann);
in_param = livido_port_new(LIVIDO_PORT_TYPE_PARAMETER_TEMPLATE);
livido_set_string_value (in_param, "name", "Fade percentage");
livido_set_int_value (in_param, "flags", 0);
livido_set_string_value (in_param, "kind", "NUMBER");
livido_set_string_value (in_param, "PLUGIN_kinda", "NUMBER");
livido_set_double_value (in_param, "default", 0.5);
livido_set_double_value (in_param, "min", 0.0);
livido_set_double_value (in_param, "max", 0.0);
livido_set_boolean_value (in_param, "transition", 1);
livido_set_portptr_value(filter1, "in_parameter_templates", in_param);
// Create an empty array of output templates
livido_set_portptr_array(filter1, "out_parameter_templates", 0, 0);
// Just to demonstrate - conformancy checking host will not complain about our own PLUGIN_ variable
livido_set_string_value (filter1, "PLUGIN_my_stuff", "I can put here whatever i want");
livido_set_portptr_value(info, "filters", filter1);
return info;
}

View File

@@ -0,0 +1,359 @@
/* LiViDO is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
LiViDO is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this source code; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
LiViDO is developed by:
Niels Elburg - http://veejay.sf.net
Gabriel "Salsaman" Finch - http://lives.sourceforge.net
Denis "Jaromil" Rojo - http://freej.dyne.org
Tom Schouten - http://zwizwa.fartit.com
Andraz Tori - http://cvs.cinelerra.org
reviewed with suggestions and contributions from:
Silvano "Kysucix" Galliani - http://freej.dyne.org
Kentaro Fukuchi - http://megaui.net/fukuchi
Jun Iio - http://www.malib.net
Carlo Prelz - http://www2.fluido.as:8080/
*/
/* (C) Gabriel "Salsaman" Finch, 2005 */
/////////////////////////////////////////////////////////////////
#include <stdio.h>
#include <stdlib.h>
#include <include/livido.h>
int livido_has_property (livido_port_t *port, const char *key) {
if (livido_property_get(port,key,0,NULL)==LIVIDO_ERROR_NOSUCH_PROPERTY) return 0;
return 1;
}
#include "livido.h"
/////////////////////////////////////////////////////////////////
// property setters
int livido_set_int_value (livido_port_t *port, const char *key, int value) {
// returns a LIVIDO_ERROR
return livido_property_set (port,key,LIVIDO_ATOM_TYPE_INT,1,&value);
}
int livido_set_double_value (livido_port_t *port, const char *key, double value) {
// returns a LIVIDO_ERROR
return livido_property_set (port,key,LIVIDO_ATOM_TYPE_DOUBLE,1,&value);
}
int livido_set_boolean_value (livido_port_t *port, const char *key, int value) {
// returns a LIVIDO_ERROR
return livido_property_set (port,key,LIVIDO_ATOM_TYPE_BOOLEAN,1,&value);
}
int livido_set_string_value (livido_port_t *port, const char *key, char *value) {
// returns a LIVIDO_ERROR
return livido_property_set (port,key,LIVIDO_ATOM_TYPE_STRING,1,&value);
}
int livido_set_portptr_value (livido_port_t *port, const char *key, void *value) {
// returns a LIVIDO_ERROR
return livido_property_set (port,key,LIVIDO_ATOM_TYPE_PORTPTR,1,&value);
}
int livido_set_voidptr_value (livido_port_t *port, const char *key, void *value) {
// returns a LIVIDO_ERROR
return livido_property_set (port,key,LIVIDO_ATOM_TYPE_VOIDPTR,1,&value);
}
/////////// these functions need a size ////////////
//////////////////////////////////////////////////////////////////////////////////////////////////
// general property getter
inline int livido_get_value (livido_port_t *port, const char *key, void *value) {
// returns a LIVIDO_ERROR
return livido_property_get( port, key, 0, value);
}
////////////////////////////////////////////////////////////
int livido_get_int_value (livido_port_t *port, const char *key, int *error) {
int retval=0;
if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_INT) {
*error=LIVIDO_ERROR_WRONG_ATOM_TYPE;
return retval;
}
else *error=livido_get_value (port,key,&retval);
return retval;
}
double livido_get_double_value (livido_port_t *port, const char *key, int *error) {
double retval=0.;
if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_DOUBLE) {
*error=LIVIDO_ERROR_WRONG_ATOM_TYPE;
return retval;
}
*error=livido_get_value (port,key,&retval);
return retval;
}
int livido_get_boolean_value (livido_port_t *port, const char *key, int *error) {
int retval=0;
if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_BOOLEAN) {
*error=LIVIDO_ERROR_WRONG_ATOM_TYPE;
return retval;
}
*error=livido_get_value (port,key,&retval);
return retval;
}
char *livido_get_string_value (livido_port_t *port, const char *key, int *error) {
char *retval=NULL;
if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_STRING) {
*error=LIVIDO_ERROR_WRONG_ATOM_TYPE;
return NULL;
}
if ((retval=(char *)livido_malloc(livido_property_element_size(port,key,0)+1))==NULL) {
*error=LIVIDO_ERROR_MEMORY_ALLOCATION;
return NULL;
}
if ((*error=livido_get_value (port,key,&retval))!=LIVIDO_NO_ERROR) {
livido_free (retval);
return NULL;
}
return retval;
}
void *livido_get_voidptr_value (livido_port_t *port, const char *key, int *error) {
void *retval=NULL;
if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_VOIDPTR) {
*error=LIVIDO_ERROR_WRONG_ATOM_TYPE;
return retval;
}
*error=livido_get_value (port,key,&retval);
return retval;
}
livido_port_t *livido_get_portptr_value (livido_port_t *port, const char *key, int *error) {
livido_port_t *retval=NULL;
if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_PORTPTR) {
*error=LIVIDO_ERROR_WRONG_ATOM_TYPE;
return retval;
}
*error=livido_get_value (port,key,&retval);
return retval;
}
////////////////////////////////////////////////////////////
int *livido_get_int_array (livido_port_t *port, const char *key, int *error) {
int i;
int num_elems;
int *retval;
if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_INT) {
*error=LIVIDO_ERROR_WRONG_ATOM_TYPE;
return NULL;
}
if ((num_elems=livido_property_num_elements (port,key))==0) return NULL;
if ((retval=(int *)livido_malloc(num_elems*sizeof(int)))==NULL) {
*error=LIVIDO_ERROR_MEMORY_ALLOCATION;
return NULL;
}
for (i=0;i<num_elems;i++) {
if ((*error=livido_property_get(port, key, i, &retval[i]))!=LIVIDO_NO_ERROR) {
livido_free (retval);
return NULL;
}
}
return retval;
}
double *livido_get_double_array (livido_port_t *port, const char *key, int *error) {
int i;
int num_elems;
double *retval;
if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_DOUBLE) {
*error=LIVIDO_ERROR_WRONG_ATOM_TYPE;
return NULL;
}
if ((num_elems=livido_property_num_elements (port,key))==0) return NULL;
if ((retval=(double *)livido_malloc(num_elems*sizeof(double)))==NULL) {
*error=LIVIDO_ERROR_MEMORY_ALLOCATION;
return NULL;
}
for (i=0;i<num_elems;i++) {
if ((*error=livido_property_get(port, key, i, &retval[i]))!=LIVIDO_NO_ERROR) {
livido_free (retval);
return NULL;
}
}
return retval;
}
int *livido_get_boolean_array (livido_port_t *port, const char *key, int *error) {
int i;
int num_elems;
int *retval;
if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_BOOLEAN) {
*error=LIVIDO_ERROR_WRONG_ATOM_TYPE;
return NULL;
}
if ((num_elems=livido_property_num_elements (port,key))==0) return NULL;
if ((retval=(int *)livido_malloc(num_elems*sizeof(int)))==NULL) {
*error=LIVIDO_ERROR_MEMORY_ALLOCATION;
return NULL;
}
for (i=0;i<num_elems;i++) {
if ((*error=livido_property_get(port, key, i, &retval[i]))!=LIVIDO_NO_ERROR) {
livido_free (retval);
return NULL;
}
}
return retval;
}
char **livido_get_string_array (livido_port_t *port, const char *key, int *error) {
int i;
int num_elems;
char **retval;
if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_STRING) {
*error=LIVIDO_ERROR_WRONG_ATOM_TYPE;
return NULL;
}
if ((num_elems=livido_property_num_elements (port,key))==0) return NULL;
if ((retval=(char **)livido_malloc(num_elems*sizeof(char *)))==NULL) {
*error=LIVIDO_ERROR_MEMORY_ALLOCATION;
return NULL;
}
for (i=0;i<num_elems;i++) {
if ((retval[i]=(char *)livido_malloc(livido_property_element_size(port,key,i)+1))==NULL) {
for (--i;i>=0;i--) livido_free(retval[i]);
*error=LIVIDO_ERROR_MEMORY_ALLOCATION;
livido_free (retval);
return NULL;
}
if ((*error=livido_property_get(port, key, i, &retval[i]))!=LIVIDO_NO_ERROR) {
for (--i;i>=0;i--) livido_free(retval[i]);
livido_free (retval);
return NULL;
}
}
return retval;
}
void **livido_get_voidptr_array (livido_port_t *port, const char *key, int *error) {
int i;
int num_elems;
void **retval;
if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_VOIDPTR) {
*error=LIVIDO_ERROR_WRONG_ATOM_TYPE;
return NULL;
}
if ((num_elems=livido_property_num_elements (port,key))==0) return NULL;
if ((retval=(void **)livido_malloc(num_elems*sizeof(void *)))==NULL) {
*error=LIVIDO_ERROR_MEMORY_ALLOCATION;
return NULL;
}
for (i=0;i<num_elems;i++) {
if ((*error=livido_property_get(port, key, i, &retval[i]))!=LIVIDO_NO_ERROR) {
livido_free (retval);
return NULL;
}
}
return retval;
}
livido_port_t **livido_get_portptr_array (livido_port_t *port, const char *key, int *error) {
int i;
int num_elems;
livido_port_t **retval;
if (livido_has_property(port,key)&&livido_property_atom_type(port,key)!=LIVIDO_ATOM_TYPE_PORTPTR) {
*error=LIVIDO_ERROR_WRONG_ATOM_TYPE;
return NULL;
}
if ((num_elems=livido_property_num_elements (port,key))==0) return NULL;
if ((retval=(livido_port_t **)livido_malloc(num_elems*sizeof(livido_port_t *)))==NULL) {
*error=LIVIDO_ERROR_MEMORY_ALLOCATION;
return NULL;
}
for (i=0;i<num_elems;i++) {
if ((*error=livido_property_get(port, key, i, &retval[i]))!=LIVIDO_NO_ERROR) {
livido_free (retval);
return NULL;
}
}
return retval;
}
/////////////////////////////////////////////////////
int livido_set_int_array (livido_port_t *port, const char *key, int num_elems, int *values) {
return livido_property_set (port,key,LIVIDO_ATOM_TYPE_INT,num_elems,values);
}
int livido_set_double_array (livido_port_t *port, const char *key, int num_elems, double *values) {
return livido_property_set (port,key,LIVIDO_ATOM_TYPE_DOUBLE,num_elems,values);
}
int livido_set_boolean_array (livido_port_t *port, const char *key, int num_elems, int *values) {
return livido_property_set (port,key,LIVIDO_ATOM_TYPE_BOOLEAN,num_elems,values);
}
int livido_set_string_array (livido_port_t *port, const char *key, int num_elems, char **values) {
return livido_property_set (port,key,LIVIDO_ATOM_TYPE_STRING,num_elems,values);
}
int livido_set_voidptr_array (livido_port_t *port, const char *key, int num_elems, void **values) {
return livido_property_set (port,key,LIVIDO_ATOM_TYPE_VOIDPTR,num_elems,values);
}
int livido_set_portptr_array (livido_port_t *port, const char *key, int num_elems, livido_port_t **values) {
return livido_property_set (port,key,LIVIDO_ATOM_TYPE_PORTPTR,num_elems,values);
}

View File

@@ -0,0 +1,35 @@
CC = gcc
LINKER = ld
CFLAGS = -I. -I../include -I ../ -Wall -g
all:
# vevo - veejay video objects
#
# plugins :
# bathroom
# opacity
#
# compile: make plugins
# run:
# export LD_LIBRARY_PATH=`pwd`
# host <plugin.so>
plugins: fade_plugin.so example_plugin.so
example.so: example_plugin.o
fade.so: fade_plugin.o
clean:
rm -rf *.o *.so
# generic make rules
%: %.c
$(CC) $(CFLAGS) -o $@ $< -ldl
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
%.so: %.o
$(LINKER) -shared $^ -o $@
# $(LINKER) -E -z now -shared $^ -o $@