mirror of
https://github.com/game-stop/veejay.git
synced 2025-12-19 22:30:06 +01:00
Bye sayVIMS, hello sayOSC, OSC dynamic namespaces, revamped event handlers, bugfixes in livido host implementation, bugfixes in vevosample, some memory leaks fixed
git-svn-id: svn://code.dyne.org/veejay/trunk@593 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
@@ -16,7 +16,6 @@ typedef void (*generic_push_parameter_f)(void *instance, int seq_num, void *va
|
||||
typedef void (*generic_clone_parameter_f)(void *instance, int seq_num, void *fx_values );
|
||||
typedef void (*generic_reverse_clone_parameter_f)(void *instance, int seq_num, void *fxvalues );
|
||||
typedef void (*generic_reverse_clone_out_parameter_f)(void *instance, void *fxvalues );
|
||||
|
||||
typedef void (*generic_deinit_f)(void *instance);
|
||||
typedef void (*generic_init_f)(void *instance, int w, int h );
|
||||
|
||||
|
||||
@@ -47,7 +47,11 @@ static int freeframe_signature_ = VEVO_PLUG_FF;
|
||||
|
||||
void* deal_with_ff( void *handle, char *name )
|
||||
{
|
||||
#ifdef STRICT_CHECKING
|
||||
void *port = vevo_port_new( VEVO_FF_PORT , __FUNCTION__, __LINE__ );
|
||||
#else
|
||||
void *port = vevo_port_new( VEVO_FF_PORT );
|
||||
#endif
|
||||
char *plugin_name = NULL;
|
||||
plugMainType *q = (plugMainType*) dlsym( handle, "plugMain" );
|
||||
|
||||
@@ -135,9 +139,11 @@ void* deal_with_ff( void *handle, char *name )
|
||||
|
||||
if(kind)
|
||||
continue;
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
void *parameter = vevo_port_new( VEVO_FF_PARAM_PORT, __FUNCTION__,__LINE__ );
|
||||
#else
|
||||
void *parameter = vevo_port_new( VEVO_FF_PARAM_PORT );
|
||||
|
||||
#endif
|
||||
double ivalue = (double)q( FF_GETPARAMETERDEFAULT, (LPVOID) p, 0).fvalue;
|
||||
|
||||
vevo_property_set( parameter, "default", VEVO_ATOM_TYPE_DOUBLE,1 ,&ivalue );
|
||||
@@ -332,8 +338,11 @@ int freeframe_plug_init( void *plugin, int w, int h )
|
||||
int num_channels = 0;
|
||||
int i;
|
||||
vevo_property_get( plugin, "num_inputs", 0, &num_channels );
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
void *buf = vevo_port_new( VEVO_ANONYMOUS_PORT, __FUNCTION__, __LINE__ );
|
||||
#else
|
||||
void *buf = vevo_port_new( VEVO_ANONYMOUS_PORT );
|
||||
#endif
|
||||
error = vevo_property_set( instance, "HOST_buffers",
|
||||
VEVO_ATOM_TYPE_PORTPTR,1,&buf);
|
||||
#ifdef STRICT_CHECKING
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <veejay/portdef.h>
|
||||
#ifdef HAVE_STRICT
|
||||
#ifdef STRICT_CHECKING
|
||||
#include <assert.h>
|
||||
#endif
|
||||
/** \defgroup freior Freior Host
|
||||
@@ -44,7 +44,11 @@ typedef void (*f0r_set_param_value_f)(f0r_instance_t *instance, f0r_param_t *par
|
||||
|
||||
static int init_param_fr( void *port, int p, int hint)
|
||||
{
|
||||
#ifdef STRICT_CHECKING
|
||||
void *parameter = vevo_port_new( VEVO_FR_PARAM_PORT, __FUNCTION__,__LINE__ );
|
||||
#else
|
||||
void *parameter = vevo_port_new( VEVO_FR_PARAM_PORT );
|
||||
#endif
|
||||
int min = 0;
|
||||
int max = 100;
|
||||
int dv = 50;
|
||||
@@ -94,7 +98,11 @@ static int init_param_fr( void *port, int p, int hint)
|
||||
}
|
||||
void* deal_with_fr( void *handle, char *name)
|
||||
{
|
||||
#ifdef STRICT_CHECKING
|
||||
void *port = vevo_port_new( VEVO_FR_PORT, __FUNCTION__,__LINE__ );
|
||||
#else
|
||||
void *port = vevo_port_new( VEVO_FR_PORT );
|
||||
#endif
|
||||
char *plugin_name = NULL;
|
||||
f0r_init_f f0r_init = dlsym( handle, "f0r_init" );
|
||||
if( f0r_init == NULL )
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#include <libyuv/yuvconv.h>
|
||||
#include <ffmpeg/avcodec.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <veejay/oscservit.h>
|
||||
#include <libplugger/utility.h>
|
||||
#include <libplugger/livido-loader.h>
|
||||
|
||||
@@ -170,17 +170,17 @@ void livido_plug_parameter_set_text( void *parameter, void *value )
|
||||
}
|
||||
void livido_plug_parameter_set_number( void *parameter, void *value )
|
||||
{
|
||||
veejay_msg(0,"%s: value = '%d'", __FUNCTION__, *((double*) value ));
|
||||
veejay_msg(0,"%s: value = '%g'", __FUNCTION__, (double) *((double*) value ));
|
||||
vevo_property_set( parameter, "value", LIVIDO_ATOM_TYPE_DOUBLE, 1, value );
|
||||
}
|
||||
void livido_plug_parameter_set_index( void *parameter, void *value)
|
||||
{
|
||||
veejay_msg(0,"%s: value = '%s'", __FUNCTION__, *((int*) value ));
|
||||
veejay_msg(0,"%s: value = '%d'", __FUNCTION__, *((int*) value ));
|
||||
vevo_property_set( parameter, "value", VEVO_ATOM_TYPE_INT, 1, value );
|
||||
}
|
||||
void livido_plug_parameter_set_bool( void *parameter, void *value )
|
||||
{
|
||||
veejay_msg(0,"%s: value = '%s'", __FUNCTION__, *((int*) value ));
|
||||
veejay_msg(0,"%s: value = '%d'", __FUNCTION__, *((int*) value ));
|
||||
vevo_property_set( parameter, "value", VEVO_ATOM_TYPE_BOOL, 1, value );
|
||||
}
|
||||
void livido_plug_parameter_set_color( void *parameter,void *value )
|
||||
@@ -244,11 +244,13 @@ static int livido_scan_out_parameters( void *plugin , void *plugger_port)
|
||||
|
||||
|
||||
ikind = livido_pname_to_host_kind(kind);
|
||||
veejay_msg(0, "Parameter %d, kind '%s', type '%d'",n,kind,ikind );
|
||||
|
||||
vevo_property_set( param, "HOST_kind", VEVO_ATOM_TYPE_INT,1,&ikind );
|
||||
#ifdef STRICT_CHECKING
|
||||
void *vje_port = vevo_port_new( VEVO_VJE_PORT, __FUNCTION__, __LINE__ );
|
||||
#else
|
||||
void *vje_port = vevo_port_new( VEVO_VJE_PORT );
|
||||
|
||||
#endif
|
||||
vevo_property_set( plugger_port, key, LIVIDO_ATOM_TYPE_PORTPTR,1, &vje_port );
|
||||
|
||||
|
||||
@@ -285,11 +287,18 @@ static int livido_scan_parameters( void *plugin, void *plugger_port )
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( kind != NULL );
|
||||
#endif
|
||||
#ifdef STRICT_CHECKING
|
||||
void *vje_port = vevo_port_new( VEVO_VJE_PORT,__FUNCTION__,__LINE__ );
|
||||
#else
|
||||
void *vje_port = vevo_port_new( VEVO_VJE_PORT );
|
||||
#endif
|
||||
int tmp[4];
|
||||
double dtmp[4];
|
||||
|
||||
vevo_property_set( plugger_port, key, LIVIDO_ATOM_TYPE_PORTPTR,1, &vje_port );
|
||||
error = vevo_property_set( plugger_port, key, LIVIDO_ATOM_TYPE_PORTPTR,1, &vje_port );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == LIVIDO_NO_ERROR );
|
||||
#endif
|
||||
|
||||
if(strcasecmp(kind, "NUMBER") == 0 ) {
|
||||
ikind = HOST_PARAM_NUMBER; vj_np ++;
|
||||
@@ -515,7 +524,11 @@ static int init_ports_from_template( livido_port_t *filter_instance, livido_port
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == LIVIDO_NO_ERROR );
|
||||
#endif
|
||||
#ifdef STRICT_CHECKING
|
||||
in_channels[i] = livido_port_new( id, __FUNCTION__, i );
|
||||
#else
|
||||
in_channels[i] = livido_port_new( id ); //@ is this ever freed?!
|
||||
#endif
|
||||
livido_property_set( in_channels[i], "parent_template",LIVIDO_ATOM_TYPE_PORTPTR,1, &ptr);
|
||||
livido_property_soft_reference( in_channels[i], "parent_template" );
|
||||
;
|
||||
@@ -546,11 +559,163 @@ static int init_ports_from_template( livido_port_t *filter_instance, livido_port
|
||||
|
||||
|
||||
livido_property_set( filter_instance, iname, LIVIDO_ATOM_TYPE_PORTPTR,num, in_channels );
|
||||
livido_property_soft_reference( filter_instance, name );
|
||||
|
||||
// veejay_msg(0, "%s --> %s",__FUNCTION__, name);
|
||||
// livido_property_soft_reference( filter_instance, name );
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
char *livido_describe_parameter_format_osc( void *instance, int p )
|
||||
{
|
||||
void *param = NULL;
|
||||
void *param_templ = NULL;
|
||||
int error = vevo_property_get( instance, "in_parameters", p, ¶m );
|
||||
if(error != VEVO_NO_ERROR )
|
||||
{
|
||||
veejay_msg(0, "Input parameter %d does not exist ", p );
|
||||
return NULL;
|
||||
}
|
||||
error = vevo_property_get( param, "parent_template",0,¶m_templ);
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
|
||||
int kind = 0;
|
||||
error = vevo_property_get( param_templ, "HOST_kind",0,&kind );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
|
||||
int n_elems = vevo_property_num_elements( param_templ, "default" );
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( n_elems > 0 );
|
||||
#endif
|
||||
|
||||
char fmt[5];
|
||||
|
||||
bzero(fmt,5);
|
||||
|
||||
switch(kind)
|
||||
{
|
||||
case HOST_PARAM_INDEX:
|
||||
fmt[0] = 'i';
|
||||
break;
|
||||
case HOST_PARAM_NUMBER:
|
||||
fmt[0] = 'd';
|
||||
break;
|
||||
case HOST_PARAM_SWITCH:
|
||||
fmt[0] = 'i';
|
||||
break;
|
||||
case HOST_PARAM_COORD:
|
||||
fmt[0] = 'd';
|
||||
fmt[1] = 'd';
|
||||
break;
|
||||
case HOST_PARAM_COLOR:
|
||||
fmt[0] = 'd';
|
||||
fmt[1] = 'd';
|
||||
fmt[2] = 'd';
|
||||
break;
|
||||
case HOST_PARAM_TEXT:
|
||||
fmt[0] = 's';
|
||||
break;
|
||||
default:
|
||||
#ifdef STRICT_CHECKING
|
||||
assert(0);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
char *res = strdup( fmt );
|
||||
return res;
|
||||
}
|
||||
|
||||
void livido_plug_free_namespace( void *fx_instance , void *data )
|
||||
{
|
||||
void *osc_namespace = NULL;
|
||||
int error = vevo_property_get( fx_instance, "HOST_osc",0,&osc_namespace);
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
veejay_osc_del_methods( data,osc_namespace,fx_instance, fx_instance );
|
||||
}
|
||||
|
||||
int livido_plug_build_namespace( void *plugin_template , int entry_id, void *fx_instance , void *data, int sample_id)
|
||||
{
|
||||
void *plug_info = NULL;
|
||||
void *filter_templ = NULL;
|
||||
int flags =0;
|
||||
int error = vevo_property_get( plugin_template, "instance", 0, &plug_info);
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == LIVIDO_NO_ERROR );
|
||||
#endif
|
||||
error = vevo_property_get( plug_info, "filters",0,&filter_templ);
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == LIVIDO_NO_ERROR );
|
||||
#endif
|
||||
|
||||
int n_in = vevo_property_num_elements( filter_templ, "in_parameter_templates" );
|
||||
int i;
|
||||
if( n_in <= 0)
|
||||
{
|
||||
return 0; // no namespace needed yet
|
||||
}
|
||||
|
||||
char *plug_name = get_str_vevo( filter_templ, "name" );
|
||||
|
||||
char base[256];
|
||||
#ifdef STRICT_CHECKING
|
||||
void *osc_namespace = vevo_port_new(VEVO_ANONYMOUS_PORT, __FUNCTION__, __LINE__ );
|
||||
#else
|
||||
void *osc_namespace = vevo_port_new(VEVO_ANONYMOUS_PORT);
|
||||
#endif
|
||||
|
||||
for( i = 0; i < n_in ; i ++ )
|
||||
{
|
||||
void *param_templ = NULL;
|
||||
error = vevo_property_get( filter_templ, "in_parameter_templates", i, ¶m_templ );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
char *param_name = get_str_vevo( param_templ, "name" );
|
||||
char *descrip = get_str_vevo( param_templ, "description" );
|
||||
|
||||
sprintf(base, "/sample_%d/fx_%d/%s",
|
||||
sample_id,
|
||||
entry_id,
|
||||
plug_name );
|
||||
|
||||
char *format = livido_describe_parameter_format_osc( fx_instance ,i);
|
||||
|
||||
|
||||
plugin_new_event(
|
||||
data, osc_namespace, fx_instance, base, param_name, format, NULL, descrip, NULL, entry_id );
|
||||
|
||||
free(param_name);
|
||||
free(format);
|
||||
free(descrip);
|
||||
|
||||
}
|
||||
|
||||
error = vevo_property_set( fx_instance, "HOST_osc", LIVIDO_ATOM_TYPE_PORTPTR,1,&osc_namespace);
|
||||
|
||||
free(plug_name);
|
||||
|
||||
veejay_msg(0, "End of OSC namespace");
|
||||
return n_in;
|
||||
}
|
||||
|
||||
void *livido_get_name_space( void *instance )
|
||||
{
|
||||
void *space = NULL;
|
||||
int error = vevo_property_get( instance, "HOST_osc", 0, &space );
|
||||
if( error != VEVO_NO_ERROR )
|
||||
return NULL;
|
||||
return space;
|
||||
}
|
||||
|
||||
/* initialize a plugin */
|
||||
void *livido_plug_init(void *plugin,int w, int h )
|
||||
{
|
||||
@@ -566,8 +731,11 @@ void *livido_plug_init(void *plugin,int w, int h )
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == LIVIDO_NO_ERROR );
|
||||
#endif
|
||||
#ifdef STRICT_CHECKING
|
||||
void *filter_instance = livido_port_new( LIVIDO_PORT_TYPE_FILTER_INSTANCE, __FUNCTION__,__LINE__ );
|
||||
#else
|
||||
void *filter_instance = livido_port_new( LIVIDO_PORT_TYPE_FILTER_INSTANCE );
|
||||
|
||||
#endif
|
||||
int num_in_channels = init_ports_from_template(
|
||||
filter_instance, filter_templ,
|
||||
LIVIDO_PORT_TYPE_CHANNEL,
|
||||
@@ -763,7 +931,7 @@ void livido_plug_deinit( void *instance )
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void *channel = NULL;
|
||||
int hsampling = 0;
|
||||
error = vevo_property_get( instance, "out_channels", 0, &channel );
|
||||
@@ -781,9 +949,9 @@ void livido_plug_deinit( void *instance )
|
||||
subsample_free(sampler);
|
||||
}
|
||||
|
||||
livido_port_recursive_free( instance );
|
||||
// livido_port_recursive_free( instance );
|
||||
|
||||
instance = NULL;
|
||||
// instance = NULL;
|
||||
}
|
||||
//get plugin defaults
|
||||
void livido_plug_retrieve_values( void *instance, void *fx_values )
|
||||
@@ -833,6 +1001,61 @@ void livido_plug_read_output_parameters( void *instance, void *fx_values )
|
||||
|
||||
}
|
||||
}
|
||||
char *livido_describe_parameter_format( void *instance, int p )
|
||||
{
|
||||
void *param = NULL;
|
||||
void *param_templ = NULL;
|
||||
int error = vevo_property_get( instance, "in_parameters", p, ¶m );
|
||||
if(error != VEVO_NO_ERROR )
|
||||
return 0;
|
||||
error = vevo_property_get( param, "parent_template",0,¶m_templ);
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
int kind = 0;
|
||||
error = vevo_property_get( param_templ, "HOST_kind",0,&kind );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
|
||||
int n_elems = vevo_property_num_elements( param, "value" );
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( n_elems > 0 );
|
||||
#endif
|
||||
|
||||
char fmt[5];
|
||||
|
||||
bzero(fmt,5);
|
||||
|
||||
switch(kind)
|
||||
{
|
||||
case HOST_PARAM_INDEX:
|
||||
fmt[0] = 'd';
|
||||
break;
|
||||
case HOST_PARAM_NUMBER:
|
||||
fmt[0] = 'g';
|
||||
break;
|
||||
case HOST_PARAM_SWITCH:
|
||||
fmt[0] = 'd';
|
||||
break;
|
||||
case HOST_PARAM_COORD:
|
||||
fmt[0] = 'g';
|
||||
fmt[1] = 'g';
|
||||
break;
|
||||
case HOST_PARAM_COLOR:
|
||||
fmt[0] = 'g';
|
||||
fmt[1] = 'g';
|
||||
fmt[2] = 'g';
|
||||
break;
|
||||
case HOST_PARAM_TEXT:
|
||||
fmt[0] = 's';
|
||||
break;
|
||||
}
|
||||
|
||||
char *res = strdup( fmt );
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
int livido_set_parameter_from_string( void *instance, int p, const char *str, void *fx_values )
|
||||
@@ -932,15 +1155,27 @@ void livido_set_parameter( void *instance, int seq, void *value )
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
void *livido_plugin_port_new( int id )
|
||||
{
|
||||
return vevo_port_new(id, "Allocated by plugin" ,rand());
|
||||
}
|
||||
#endif
|
||||
|
||||
void* deal_with_livido( void *handle, const char *name )
|
||||
{
|
||||
#ifdef STRICT_CHECKING
|
||||
void *port = vevo_port_new( VEVO_LIVIDO_PORT, __FUNCTION__, __LINE__ );
|
||||
#else
|
||||
void *port = vevo_port_new( VEVO_LIVIDO_PORT );
|
||||
#endif
|
||||
char *plugin_name = NULL;
|
||||
int lvd = 1;
|
||||
int type = VEVO_LIVIDO_PORT;
|
||||
|
||||
livido_setup_f livido_setup = dlsym( handle, "livido_setup" );
|
||||
|
||||
#ifndef STRICT_CHECKING
|
||||
livido_setup_t setup[] = {
|
||||
{ (void(*)()) vj_malloc },
|
||||
{ (void(*)()) free },
|
||||
@@ -955,6 +1190,24 @@ void* deal_with_livido( void *handle, const char *name )
|
||||
{ (void(*)())vevo_property_element_size },
|
||||
{ (void(*)())vevo_list_properties }
|
||||
};
|
||||
#else
|
||||
livido_setup_t setup[] = {
|
||||
{ (void(*)()) vj_malloc },
|
||||
{ (void(*)()) free },
|
||||
{ (void(*)())memset },
|
||||
{ (void(*)())memcpy },
|
||||
{ (void(*)())livido_plugin_port_new },
|
||||
{ (void(*)())vevo_port_free },
|
||||
{ (void(*)())vevo_property_set },
|
||||
{ (void(*)())vevo_property_get },
|
||||
{ (void(*)())vevo_property_num_elements },
|
||||
{ (void(*)())vevo_property_atom_type },
|
||||
{ (void(*)())vevo_property_element_size },
|
||||
{ (void(*)())vevo_list_properties }
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
void *livido_plugin = livido_setup( setup, 100 );
|
||||
#ifdef STRICT_CHECKING
|
||||
@@ -991,7 +1244,6 @@ void* deal_with_livido( void *handle, const char *name )
|
||||
#endif
|
||||
char *clone_name = (char*) malloc( strlen(plugin_name) + 4);
|
||||
sprintf(clone_name, "LVD%s", plugin_name );
|
||||
veejay_msg(0, "Livido plugin '%s'", plugin_name );
|
||||
|
||||
vevo_property_set( port, "num_params", VEVO_ATOM_TYPE_INT, 1, &n_params );
|
||||
vevo_property_set( port, "num_out_params", VEVO_ATOM_TYPE_INT,1,&n_oparams );
|
||||
@@ -1003,8 +1255,6 @@ void* deal_with_livido( void *handle, const char *name )
|
||||
free(clone_name);
|
||||
free(plugin_name);
|
||||
|
||||
veejay_msg(0, "Input:%d, Output; %d", n_params, n_oparams );
|
||||
|
||||
return port;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,4 +36,13 @@ void livido_exit( void );
|
||||
|
||||
void livido_plug_read_output_parameters( void *instance, void *fx_values );
|
||||
|
||||
char *livido_describe_parameter_format( void *instance, int p );
|
||||
|
||||
int livido_plug_build_namespace( void *plugin_template , int entry_id, void *fx_instance , void *data, int sam);
|
||||
|
||||
char *livido_describe_parameter_format_osc( void *instance, int p );
|
||||
|
||||
void livido_plug_free_namespace( void *fx_instance , void *data );
|
||||
|
||||
void *livido_get_name_space( void *instance );
|
||||
#endif
|
||||
|
||||
@@ -79,6 +79,12 @@ int plug_set_param_from_str( void *plugin , int p, const char *str, void *value
|
||||
return livido_set_parameter_from_string( plugin, p, str, values );
|
||||
}
|
||||
|
||||
char *plug_describe_param( void *plugin, int p )
|
||||
{
|
||||
return livido_describe_parameter_format( plugin,p );
|
||||
}
|
||||
|
||||
|
||||
static void *instantiate_plugin( void *plugin, int w , int h )
|
||||
{
|
||||
int type = 0;
|
||||
@@ -182,7 +188,7 @@ static void add_to_plugin_list( const char *path )
|
||||
continue;
|
||||
}
|
||||
|
||||
veejay_msg(0, "\tOpened plugin '%s' in '%s'", name,path );
|
||||
// veejay_msg(0, "\tOpened plugin '%s' in '%s'", name,path );
|
||||
|
||||
if(dlsym( handle, "plugMain" ))
|
||||
{
|
||||
@@ -195,10 +201,7 @@ static void add_to_plugin_list( const char *path )
|
||||
}
|
||||
else
|
||||
dlclose( handle );
|
||||
}
|
||||
|
||||
if(dlsym( handle, "f0r_construct" ))
|
||||
{
|
||||
} else if(dlsym( handle, "f0r_construct" )) {
|
||||
void *plugin = deal_with_fr( handle, name );
|
||||
if( plugin )
|
||||
{
|
||||
@@ -208,26 +211,18 @@ static void add_to_plugin_list( const char *path )
|
||||
}
|
||||
else
|
||||
dlclose( handle );
|
||||
}
|
||||
|
||||
if(dlsym( handle, "livido_setup" ))
|
||||
{
|
||||
} else if(dlsym( handle, "livido_setup" )) {
|
||||
void *plugin = deal_with_livido( handle , name );
|
||||
if( plugin )
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Load livido plugin '%s' to slot %d",name, index_);
|
||||
|
||||
index_map_[index_] = plugin;
|
||||
index_ ++;
|
||||
n_lvd_ ++;
|
||||
}
|
||||
else
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Failed to load '%s'",name );
|
||||
dlclose(handle);
|
||||
}
|
||||
|
||||
}
|
||||
} else
|
||||
dlclose(handle);
|
||||
|
||||
}
|
||||
|
||||
@@ -242,27 +237,17 @@ static void free_plugin(void *plugin)
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( plugin != NULL );
|
||||
#endif
|
||||
|
||||
int type = 0;
|
||||
int error = vevo_property_get( plugin, "HOST_plugin_type", 0, &type);
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == 0 );
|
||||
#endif
|
||||
|
||||
char *name = get_str_vevo( plugin, "name" );
|
||||
|
||||
veejay_msg(0, "%s: Free plugin '%s' %p, Type %x",
|
||||
__FUNCTION__,name,plugin,type );
|
||||
free(name);
|
||||
|
||||
void *handle = NULL;
|
||||
error = vevo_property_get( plugin, "handle", 0 , &handle );
|
||||
int error = vevo_property_get( plugin, "handle", 0 , &handle );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == 0 );
|
||||
#endif
|
||||
if( handle ) dlclose( handle );
|
||||
|
||||
vevo_port_recursive_free( plugin );
|
||||
|
||||
if( handle ) dlclose( handle );
|
||||
|
||||
plugin = NULL;
|
||||
}
|
||||
|
||||
char *list_plugins()
|
||||
@@ -301,12 +286,14 @@ char *list_plugins()
|
||||
static void free_plugins()
|
||||
{
|
||||
int i;
|
||||
vevo_port_recursive_free( illegal_plugins_ );
|
||||
|
||||
for( i = 0; i < index_ ; i ++ )
|
||||
free_plugin( index_map_[i]);
|
||||
|
||||
vevo_port_recursive_free( illegal_plugins_ );
|
||||
|
||||
free( index_map_ );
|
||||
index_ = 0;
|
||||
index_map_ = NULL;
|
||||
}
|
||||
|
||||
#define CONFIG_FILE_LEN 65535
|
||||
@@ -337,7 +324,6 @@ static int scan_plugins()
|
||||
char *pch = strtok( data, "\n" );
|
||||
while( pch != NULL )
|
||||
{
|
||||
veejay_msg(0, "Add '%s'",pch );
|
||||
add_to_plugin_list( pch );
|
||||
pch = strtok( NULL, "\n");
|
||||
}
|
||||
@@ -393,8 +379,11 @@ void plug_sys_init( int fmt, int w, int h )
|
||||
int plug_sys_detect_plugins(void)
|
||||
{
|
||||
index_map_ = (vevo_port_t**) malloc(sizeof(vevo_port_t*) * 256 );
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
illegal_plugins_ = vevo_port_new( VEVO_ILLEGAL, __FUNCTION__, __LINE__ );
|
||||
#else
|
||||
illegal_plugins_ = vevo_port_new( VEVO_ILLEGAL );
|
||||
#endif
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( illegal_plugins_ != NULL );
|
||||
#endif
|
||||
@@ -427,7 +416,8 @@ int plug_sys_detect_plugins(void)
|
||||
n_lvd_, n_lvd_ == 1 ? "plugin" :"plugins" );
|
||||
veejay_msg(VEEJAY_MSG_INFO, "-------------------------------------------------------------------------------------------");
|
||||
|
||||
|
||||
plug_print_all();
|
||||
|
||||
return index_;
|
||||
}
|
||||
|
||||
@@ -683,6 +673,58 @@ void *plug_activate( int fx_id )
|
||||
return instantiate_plugin( index_map_[fx_id], base_width_,base_height_);
|
||||
}
|
||||
|
||||
void plug_clear_namespace( void *fx_instance, void *data )
|
||||
{
|
||||
livido_plug_free_namespace( fx_instance , data );
|
||||
}
|
||||
|
||||
void plug_build_name_space( int fx_id, void *fx_instance, void *data, int entry_id , int sample_id)
|
||||
{
|
||||
void *plugin = index_map_[fx_id];
|
||||
int type = 0;
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( plugin != NULL );
|
||||
#endif
|
||||
int error = vevo_property_get( plugin, "HOST_plugin_type", 0, &type);
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
switch( type )
|
||||
{
|
||||
case VEVO_PLUG_LIVIDO:
|
||||
livido_plug_build_namespace( plugin, entry_id, fx_instance, data, sample_id );
|
||||
break;
|
||||
case VEVO_PLUG_FF:
|
||||
break;
|
||||
case VEVO_PLUG_FR:
|
||||
break;
|
||||
default:
|
||||
#ifdef STRICT_CHECKING
|
||||
assert(0);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
void plug_print_all()
|
||||
{
|
||||
int n;
|
||||
for(n = 0; n < index_ ; n ++ )
|
||||
{
|
||||
char *fx_name = plug_get_name(n);
|
||||
if(fx_name)
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_INFO, "\t'FX %s loaded", fx_name );
|
||||
free(fx_name);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
char *plug_get_name( int fx_id )
|
||||
{
|
||||
if(!index_map_[fx_id] )
|
||||
@@ -691,6 +733,18 @@ char *plug_get_name( int fx_id )
|
||||
return name;
|
||||
}
|
||||
|
||||
char *plug_get_osc_format(void *fx_instance, int seq_num)
|
||||
{
|
||||
/* void *param_templ = NULL;
|
||||
int error = vevo_property_get( fx_instance, "parent_template",0,¶m_templ);
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif*/
|
||||
|
||||
char *required_format = livido_describe_parameter_format_osc( fx_instance,seq_num );
|
||||
return required_format;
|
||||
}
|
||||
|
||||
int plug_get_fx_id_by_name( const char *name )
|
||||
{
|
||||
int n = 0;
|
||||
@@ -773,3 +827,8 @@ void plug_process( void *instance )
|
||||
(*gpf)( instance,0.0 );
|
||||
}
|
||||
|
||||
|
||||
void *plug_get_name_space( void *instance )
|
||||
{
|
||||
return livido_get_name_space(instance);
|
||||
}
|
||||
|
||||
@@ -39,5 +39,7 @@ void plug_process( void *instance );
|
||||
void plug_get_defaults( void *instance, void *fx_values );
|
||||
void plug_set_parameter( void *instance, int seq_num, int n_elements,void *value );
|
||||
void plug_clone_from_output_parameters( void *instance, void *fx_values );
|
||||
|
||||
char *plug_get_osc_format(void *fx_instance, int p);
|
||||
void plug_build_name_space( int fx_id, void *fx_instance, void *data, int entry_id, int sample_id );
|
||||
void plug_clear_namespace( void *fx_instance, void *data );
|
||||
#endif
|
||||
|
||||
@@ -46,8 +46,11 @@ int vevo_property_atom_type( vevo_port_t *p, const char *key);
|
||||
|
||||
size_t vevo_property_element_size( vevo_port_t * p, const char *key, const int idx);
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
vevo_port_t *vevo_port_new( int port_type, const char *func, int line_no );
|
||||
#else
|
||||
vevo_port_t *vevo_port_new(int port_type);
|
||||
|
||||
#endif
|
||||
int vevo_property_soft_reference(vevo_port_t * p, const char *key);
|
||||
|
||||
void vevo_strict_init();
|
||||
@@ -86,6 +89,7 @@ int vevo_property_from_string( vevo_port_t *port, const char *s, const char *key
|
||||
#define VEVO_ATOM_TYPE_STRING 4
|
||||
#define VEVO_ATOM_TYPE_BOOL 3
|
||||
#define VEVO_ATOM_TYPE_PORTPTR 66
|
||||
#define VEVO_ATOM_TYPE_HIDDEN 50
|
||||
#define VEVO_ATOM_TYPE_UINT64 5
|
||||
|
||||
#define VEVO_NO_ERROR 0
|
||||
@@ -98,10 +102,12 @@ int vevo_property_from_string( vevo_port_t *port, const char *s, const char *key
|
||||
#define VEVO_ERROR_HARDWARE 7
|
||||
#define VEVO_ERROR_PROPERTY_EMPTY 8
|
||||
|
||||
|
||||
#define VEVO_PORT_POOL 1041
|
||||
#define VEVO_ANONYMOUS_PORT -1
|
||||
|
||||
#define VEVO_PROPERTY_READONLY (1<<0)
|
||||
#define VEVO_PROPERTY_SOFTREF (2<<0)
|
||||
#define VEVO_PROPERTY_READONLY (1<<1)
|
||||
#define VEVO_PROPERTY_SOFTREF (1<<2)
|
||||
#define VEVO_PROPERTY_PROTECTED (1<<10)
|
||||
|
||||
#endif
|
||||
|
||||
@@ -130,6 +130,7 @@ typedef struct {
|
||||
} elements;
|
||||
int num_elements; /*!< number of atoms */
|
||||
int flags; /*!< special flags */
|
||||
int softlink; /*! < protected, use to indicate soft link */
|
||||
} vevo_storage_t;
|
||||
|
||||
//! \typedef vevo_property_t
|
||||
@@ -169,6 +170,7 @@ typedef struct {
|
||||
void *pool; /*!< pointer to pool_t object caching */
|
||||
} __vevo_port_t;
|
||||
|
||||
|
||||
//! \var port_ref_ Book keeping of allocated and freed ports
|
||||
static vevo_port_t *port_ref_ = NULL;
|
||||
static size_t atom_sizes_[100];
|
||||
@@ -403,24 +405,24 @@ int vevo_property_soft_reference(vevo_port_t * p, const char *key)
|
||||
if (!port->table) {
|
||||
vevo_property_t *node = NULL;
|
||||
if ((node = prop_node_get(port, hash_key)) != NULL) {
|
||||
node->st->flags |= VEVO_PROPERTY_SOFTREF;
|
||||
node->st->softlink = 1;
|
||||
return VEVO_NO_ERROR;
|
||||
}
|
||||
} else {
|
||||
hnode_t *node = NULL;
|
||||
if ((node = property_exists(port, hash_key)) != NULL) {
|
||||
vevo_storage_t *stor = (vevo_storage_t *) hnode_get(node);
|
||||
stor->flags |= VEVO_PROPERTY_SOFTREF;
|
||||
hnode_t *new_node = hnode_create((void *) stor);
|
||||
hnode_put(new_node, (void *) hash_key);
|
||||
hnode_destroy(new_node);
|
||||
stor->softlink = 1;
|
||||
hnode_put( node, (void*) hash_key );
|
||||
return VEVO_NO_ERROR;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return VEVO_NO_ERROR;
|
||||
}
|
||||
|
||||
|
||||
//! Flag a property as read-only. Use to avoid overriding the value
|
||||
/*!
|
||||
\param p port
|
||||
@@ -926,10 +928,11 @@ vevo_property_element_size(vevo_port_t * p, const char *key,
|
||||
assert(key != NULL);
|
||||
assert(idx >= 0);
|
||||
#endif
|
||||
if(!p) return -1;
|
||||
__vevo_port_t *port = (__vevo_port_t *) p;
|
||||
uint32_t hash_key = hash_key_code(key);
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( port );
|
||||
#endif
|
||||
if (!port->table) {
|
||||
vevo_property_t *node;
|
||||
if ((node = prop_node_get(port, hash_key)) != NULL) {
|
||||
@@ -970,7 +973,26 @@ vevo_property_element_size(vevo_port_t * p, const char *key,
|
||||
\param port_type Type of Port to Create. Port types <= 1024 are typed, > 1024 are anonymous ports.
|
||||
\return A New Port
|
||||
*/
|
||||
#ifndef STRICT_CHECKING
|
||||
vevo_port_t *vevo_port_new(int port_type)
|
||||
{
|
||||
__vevo_port_t *port = (__vevo_port_t *) malloc(sizeof(__vevo_port_t));
|
||||
|
||||
port->index = NULL;
|
||||
port->list = NULL;
|
||||
port->table = NULL;
|
||||
port->pool = vevo_pool_init( sizeof(vevo_property_t),sizeof( vevo_storage_t ), sizeof( atom_t ) , sizeof( port_index_t ) );
|
||||
/* If the port type is a Livido port this or that */
|
||||
if ( (port_type >= 1 && port_type <= 50) || port_type < 0)
|
||||
port->list = NULL;
|
||||
else
|
||||
port->table = hash_create(HASHCOUNT_T_MAX, key_compare, int_hash);
|
||||
|
||||
vevo_port_finalize (port, port_type );
|
||||
return (vevo_port_t *) port;
|
||||
}
|
||||
#else
|
||||
vevo_port_t *vevo_port_new(int port_type, const char *func, int line_num)
|
||||
{
|
||||
__vevo_port_t *port = (__vevo_port_t *) malloc(sizeof(__vevo_port_t));
|
||||
|
||||
@@ -988,13 +1010,24 @@ vevo_port_t *vevo_port_new(int port_type)
|
||||
port->table = hash_create(HASHCOUNT_T_MAX, key_compare, int_hash);
|
||||
|
||||
vevo_port_finalize (port, port_type );
|
||||
|
||||
/* char har[1024];
|
||||
sprintf(har,"%s::%d", func,line_num );
|
||||
vevo_property_set( port, har, VEVO_ATOM_TYPE_HIDDEN,0,NULL);
|
||||
*/
|
||||
return (vevo_port_t *) port;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//! Initialize VeVo. Set up bookkeeping information to track Port construction and destruction
|
||||
void vevo_strict_init()
|
||||
{
|
||||
#ifdef STRICT_CHECKING
|
||||
port_ref_ = vevo_port_new( VEVO_PORT_REFERENCES, __FUNCTION__,__LINE__ );
|
||||
#else
|
||||
port_ref_ = vevo_port_new( VEVO_PORT_REFERENCES );
|
||||
#endif
|
||||
memset( atom_sizes_,0,sizeof(atom_sizes_) );
|
||||
atom_sizes_[1] = sizeof(int32_t);
|
||||
atom_sizes_[2] = sizeof(double);
|
||||
@@ -1128,7 +1161,7 @@ void vevo_port_free( vevo_port_t *port )
|
||||
if( dec_ref)
|
||||
{
|
||||
error = vevo_property_get( port_ref_, pkey, 0, &ref_count );
|
||||
if( error != 0 )
|
||||
if( error != VEVO_NO_ERROR )
|
||||
{
|
||||
veejay_msg(0, "%s: Port '%s' not allocated by vevo_port_new()", __FUNCTION__, pkey );
|
||||
#ifdef STRICT_CHECKING
|
||||
@@ -1144,7 +1177,7 @@ void vevo_port_free( vevo_port_t *port )
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
if( ref_count != 1 )
|
||||
if( ref_count > 1 )
|
||||
{
|
||||
veejay_msg(0, "%s: Port '%s' has a reference count of %d", __FUNCTION__,pkey,ref_count);
|
||||
#ifdef STRICT_CHECKING
|
||||
@@ -1156,7 +1189,7 @@ void vevo_port_free( vevo_port_t *port )
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( ref_count == 0 );
|
||||
#endif
|
||||
vevo_property_set( port_ref_, pkey, VEVO_ATOM_TYPE_INT,0,0 );
|
||||
vevo_property_set( port_ref_, pkey, VEVO_ATOM_TYPE_INT,1,&ref_count );
|
||||
vevo_port_free_( port );
|
||||
}
|
||||
|
||||
@@ -1184,16 +1217,14 @@ vevo_property_is_soft_referenced(vevo_port_t * p,
|
||||
if (!port->table) {
|
||||
vevo_property_t *pnode = NULL;
|
||||
if ((pnode = prop_node_get(port, hash_key)) != NULL) {
|
||||
if (pnode->st->flags & VEVO_PROPERTY_SOFTREF)
|
||||
return 1;
|
||||
return pnode->st->softlink;
|
||||
}
|
||||
} else {
|
||||
hnode_t *old_node = NULL;
|
||||
if ((old_node = property_exists(port, hash_key)) != NULL) {
|
||||
vevo_storage_t *oldstor =
|
||||
(vevo_storage_t *) hnode_get(old_node);
|
||||
if (oldstor->flags & VEVO_PROPERTY_SOFTREF)
|
||||
return 1;
|
||||
return oldstor->softlink;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@@ -1219,6 +1250,8 @@ vevo_property_set(vevo_port_t * p,
|
||||
assert( src != p );
|
||||
if( num_elements > 0 ) assert( src != NULL );
|
||||
assert( key != NULL );
|
||||
if( atom_type != VEVO_ATOM_TYPE_HIDDEN )
|
||||
assert( vevo_atom_size(atom_type) > 0 );
|
||||
#endif
|
||||
__vevo_port_t *port = (__vevo_port_t *) p;
|
||||
uint32_t hash_key = hash_key_code(key);
|
||||
@@ -1234,7 +1267,9 @@ vevo_property_set(vevo_port_t * p,
|
||||
if (pnode->st->atom_type != atom_type)
|
||||
return VEVO_ERROR_WRONG_ATOM_TYPE;
|
||||
if (pnode->st->flags & VEVO_PROPERTY_READONLY)
|
||||
{
|
||||
return VEVO_ERROR_PROPERTY_READONLY;
|
||||
}
|
||||
#endif
|
||||
vevo_free_storage(port,pnode->st);
|
||||
//prop_node_free(pnode);
|
||||
@@ -1392,19 +1427,27 @@ char **vevo_list_properties(vevo_port_t * p)
|
||||
l = (port_index_t *) port->index;
|
||||
i = 0;
|
||||
while (l != NULL) {
|
||||
list[i] = (char *) strdup(l->key);
|
||||
#ifdef STRICT_CHECKING
|
||||
if( vevo_property_atom_type( p, l->key ) != VEVO_ATOM_TYPE_HIDDEN )
|
||||
{
|
||||
#endif
|
||||
list[i] = (char *) strdup(l->key);
|
||||
#ifdef STRICT_CHECING
|
||||
assert(list[i] != NULL);
|
||||
#endif
|
||||
l = l->next;
|
||||
i++;
|
||||
#ifdef STRICT_CHECKING
|
||||
}
|
||||
#endif
|
||||
|
||||
l = l->next;
|
||||
//i++;
|
||||
}
|
||||
list[i] = NULL;
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
int vevo_num_properties(vevo_port_t * p)
|
||||
{
|
||||
__vevo_port_t *port = (__vevo_port_t *) p;
|
||||
@@ -1486,7 +1529,7 @@ static vevo_storage_t **vevo_list_nodes_(vevo_port_t * p, int atype)
|
||||
vevo_storage_t **list = (vevo_storage_t**)malloc(sizeof(vevo_storage_t*) * n );
|
||||
memset(list,0,sizeof(vevo_storage_t*) * n );
|
||||
|
||||
if( port->table)
|
||||
if( port->table)
|
||||
{
|
||||
hnode_t *node;
|
||||
hscan_t scan;
|
||||
@@ -1495,46 +1538,51 @@ static vevo_storage_t **vevo_list_nodes_(vevo_port_t * p, int atype)
|
||||
while((node=hash_scan_next(&scan)) != NULL)
|
||||
{
|
||||
s = hnode_get(node);
|
||||
if( s->atom_type == atype )
|
||||
if( s->atom_type == atype || atype == 0)
|
||||
{
|
||||
int type = 0;
|
||||
atom_get_value(s, 0, &type);
|
||||
if( type != PORT_TYPE_FILTER_CLASS ||
|
||||
int ec = atom_get_value(s, 0, &type);
|
||||
/* if( type != PORT_TYPE_FILTER_CLASS ||
|
||||
type != PORT_TYPE_CHANNEL_TEMPLATE ||
|
||||
type != PORT_TYPE_PARAMETER_TEMPLATE ||
|
||||
type != PORT_TYPE_PLUGIN_INFO ||
|
||||
!(s->flags & VEVO_PROPERTY_SOFTREF) )
|
||||
!(s->flags & VEVO_PROPERTY_SOFTREF) )*/
|
||||
|
||||
if( ec == VEVO_NO_ERROR && !s->softlink )
|
||||
list[i++] = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
vevo_property_t *l = port->list;
|
||||
vevo_property_t *n;
|
||||
vevo_storage_t *s;
|
||||
while( l != NULL )
|
||||
{
|
||||
vevo_property_t *l = port->list;
|
||||
vevo_property_t *n;
|
||||
vevo_storage_t *s;
|
||||
while( l != NULL )
|
||||
n = l->next;
|
||||
s = l->st;
|
||||
|
||||
if( s->atom_type == atype || atype == 0 )
|
||||
{
|
||||
n = l->next;
|
||||
s = l->st;
|
||||
|
||||
if( s->atom_type == atype )
|
||||
{
|
||||
int type = 0;
|
||||
int ec = atom_get_value(l->st, 0, &type);
|
||||
if( (type != PORT_TYPE_FILTER_CLASS ||
|
||||
type != PORT_TYPE_CHANNEL_TEMPLATE ||
|
||||
type != PORT_TYPE_PARAMETER_TEMPLATE ||
|
||||
type != PORT_TYPE_PLUGIN_INFO ) &&
|
||||
ec != VEVO_ERROR_PROPERTY_EMPTY &&
|
||||
int type = 0;
|
||||
int ec = atom_get_value(l->st, 0, &type);
|
||||
/* if( (type != PORT_TYPE_FILTER_CLASS ||
|
||||
type != PORT_TYPE_CHANNEL_TEMPLATE ||
|
||||
type != PORT_TYPE_PARAMETER_TEMPLATE ||
|
||||
type != PORT_TYPE_PLUGIN_INFO ) &&
|
||||
ec != VEVO_ERROR_PROPERTY_EMPTY &&
|
||||
!(s->flags & VEVO_PROPERTY_SOFTREF))
|
||||
|
||||
*/
|
||||
if( ec == VEVO_NO_ERROR && !s->softlink )
|
||||
list[i++] = s;
|
||||
}
|
||||
l = n;
|
||||
}
|
||||
l = n;
|
||||
}
|
||||
|
||||
}
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( i < 256 );
|
||||
#endif
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -1569,8 +1617,13 @@ void *vevo_port_register( vevo_port_t *in, vevo_port_t *ref )
|
||||
{
|
||||
void *port = in;
|
||||
const void *store = ref;
|
||||
#ifndef STRICT_CHECKING
|
||||
if(!port)
|
||||
port = vevo_port_new( VEVO_PORT_POOL );
|
||||
#else
|
||||
if(!port)
|
||||
port = vevo_port_new( VEVO_PORT_POOL, __FUNCTION__, __LINE__ );
|
||||
#endif
|
||||
char pkey[32];
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
@@ -1695,33 +1748,154 @@ void vevo_port_recursive_free( vevo_port_t *port )
|
||||
assert( sor != NULL );
|
||||
#endif
|
||||
int i;
|
||||
//char **item = vevo_list_properties( sor );
|
||||
vevo_storage_t **item = vevo_list_nodes_( sor, VEVO_ATOM_TYPE_PORTPTR );
|
||||
if(!item)
|
||||
{
|
||||
veejay_msg(0, "Port %p empty ?!", port );
|
||||
vevo_port_free(sor);
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( 0 );
|
||||
assert( 0 );
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( item != NULL );
|
||||
int n_freed = 0;
|
||||
#endif
|
||||
for( i = 0; item[i] != NULL ; i ++ )
|
||||
{
|
||||
void *port = NULL;
|
||||
atom_get_value( item[i],0,&port );
|
||||
void *sub_port = NULL;
|
||||
|
||||
int ec = atom_get_value( item[i],0,&sub_port );
|
||||
if( ec == VEVO_NO_ERROR )
|
||||
{
|
||||
#ifdef STRICT_CHECKING
|
||||
assert(port != NULL);
|
||||
assert(sub_port != NULL);
|
||||
n_freed++;
|
||||
#endif
|
||||
vevo_port_free( port );
|
||||
vevo_port_free( sub_port );
|
||||
}
|
||||
}
|
||||
free(item);
|
||||
vevo_port_free( sor );
|
||||
}
|
||||
|
||||
|
||||
char **vevo_port_deepen_namespace( void *port, char *path)
|
||||
{
|
||||
char **top_level = vevo_list_properties(port);
|
||||
int k;
|
||||
int error;
|
||||
int num = 0;
|
||||
if(!top_level)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
num = vevo_num_properties(port );
|
||||
|
||||
if( num == 0 )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
char **res = (char**) malloc( sizeof(char*) * (num+1));
|
||||
memset(res,0,sizeof(char*) * (num+1));
|
||||
int n = 0;
|
||||
|
||||
for( k = 0; top_level[k] != NULL ; k ++ )
|
||||
{
|
||||
int atom_type = vevo_property_atom_type( port, top_level[k] );
|
||||
if( atom_type != VEVO_ATOM_TYPE_VOIDPTR && atom_type != VEVO_ATOM_TYPE_PORTPTR )
|
||||
{
|
||||
int len = strlen(path) + 2;
|
||||
len += strlen( top_level[k] );
|
||||
res[n] = (char*) malloc(sizeof(char) * len );
|
||||
snprintf(res[n],len,"%s/%s",path,top_level[k]);
|
||||
n++;
|
||||
}
|
||||
free(top_level[k]);
|
||||
}
|
||||
free(top_level);
|
||||
res[n] = NULL;
|
||||
return res;
|
||||
}
|
||||
|
||||
char **vevo_port_recurse_namespace( vevo_port_t *port, const char *base )
|
||||
|
||||
{
|
||||
|
||||
char **top_level = vevo_list_properties(port);
|
||||
if(!top_level)
|
||||
return NULL;
|
||||
int k;
|
||||
int num = 0;
|
||||
for( k = 0; top_level[k] != NULL ; k ++ )
|
||||
{
|
||||
int atom_type = vevo_property_atom_type( port, top_level[k] );
|
||||
if( atom_type != VEVO_ATOM_TYPE_VOIDPTR )
|
||||
{
|
||||
if( atom_type == VEVO_ATOM_TYPE_PORTPTR )
|
||||
{
|
||||
void *p = NULL;
|
||||
int error = vevo_property_get( port, top_level[k],0,&p );
|
||||
if( error == VEVO_NO_ERROR )
|
||||
num += vevo_num_properties(p);
|
||||
}
|
||||
num++;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( num > 0 );
|
||||
#endif
|
||||
|
||||
char **namespace = (char**) malloc(sizeof(char*) * (num+1) );
|
||||
memset(namespace, 0,sizeof(char*) * (num+1));
|
||||
int methods = 0;
|
||||
int error;
|
||||
for( k = 0; top_level[k] != NULL ; k ++ )
|
||||
{
|
||||
int atom_type = vevo_property_atom_type( port, top_level[k] );
|
||||
char path[256];
|
||||
|
||||
sprintf(path, "%s", base);
|
||||
|
||||
if( atom_type == VEVO_ATOM_TYPE_PORTPTR )
|
||||
{
|
||||
void *exp = NULL;
|
||||
error = vevo_property_get( port, top_level[k],0,&exp );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
int depth = 0;
|
||||
strcat( path, "/" );
|
||||
strcat( path, top_level[k] );
|
||||
|
||||
char **ns = vevo_port_deepen_namespace( exp, path );
|
||||
if( ns )
|
||||
{
|
||||
int j;
|
||||
for( j = 0; ns[j] != NULL ; j ++ )
|
||||
{
|
||||
namespace[methods] = strdup( ns[j]);
|
||||
methods++;
|
||||
free(ns[j]);
|
||||
}
|
||||
free(ns);
|
||||
}
|
||||
}
|
||||
else if( atom_type != VEVO_ATOM_TYPE_VOIDPTR )
|
||||
{
|
||||
strcat( path, "/" );
|
||||
strcat( path, top_level[k] );
|
||||
}
|
||||
|
||||
namespace[ methods ] = strdup( path );
|
||||
methods ++;
|
||||
|
||||
free(top_level[k]);
|
||||
}
|
||||
free(top_level);
|
||||
return namespace;
|
||||
}
|
||||
//! Flatten all ports and return list of ports to be destroyed
|
||||
/*!
|
||||
\param sorted_port Reference Port
|
||||
@@ -1735,7 +1909,7 @@ static void vevo_port_recurse_free( vevo_port_t *sorted_port, vevo_port_t *p )
|
||||
vevo_storage_t **item = vevo_list_nodes_( p, VEVO_ATOM_TYPE_PORTPTR );
|
||||
if(!item)
|
||||
{
|
||||
veejay_msg(1, "%s: port %p empty", p );
|
||||
free(item);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1809,6 +1983,15 @@ static int vevo_port_ref_verify( vevo_port_t *p)
|
||||
|
||||
if( ref_count != 0 )
|
||||
{
|
||||
#ifdef STRICT_CHECKING
|
||||
void *which_port = NULL;
|
||||
error = vevo_property_get( port_ref_, item[i],0, &which_port );
|
||||
if( error )
|
||||
veejay_msg(0, "Port '%s' retrieval returns error %d", item[i],error );
|
||||
else
|
||||
veejay_msg(0, "Reference to Port %s exists, but may be invalid", item[i]);
|
||||
#endif
|
||||
|
||||
veejay_msg(0, "Port '%s' reference count is %d",item[i], ref_count);
|
||||
err++;
|
||||
}
|
||||
@@ -1943,7 +2126,7 @@ char *vevo_format_kind( vevo_port_t *port, const char *key )
|
||||
break;
|
||||
case VEVO_ATOM_TYPE_PORTPTR:
|
||||
token[0] = 'p';
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
token[0] = 'g';
|
||||
break;
|
||||
|
||||
@@ -128,13 +128,13 @@ void subsample_free(void *data)
|
||||
free(sampler->YUV_to_YCbCr[0]);
|
||||
if(sampler->YUV_to_YCbCr[1])
|
||||
free(sampler->YUV_to_YCbCr[1]);
|
||||
free(sampler);
|
||||
if(sampler->planes[0])
|
||||
free(sampler->planes[0]);
|
||||
if(sampler->planes[1])
|
||||
free(sampler->planes[1]);
|
||||
if(sampler->planes[2])
|
||||
free(sampler->planes[2]);
|
||||
free(sampler);
|
||||
}
|
||||
sampler = NULL;
|
||||
}
|
||||
|
||||
@@ -2,20 +2,12 @@ MAINTAINERCLEANFILES = Makefile.in
|
||||
|
||||
INCLUDES = -I$(top_srcdir) \
|
||||
-I$(includedir) \
|
||||
-I$(top_scrdir)/libvjmem \
|
||||
-I$(top_srcdir)/libvjmsg \
|
||||
-I$(top_srcdir)/libvjnet \
|
||||
$(MJPEGTOOLS_CFLAGS) $(GLIB_CFLAGS)
|
||||
-I${LIBLO_CFLAGS}
|
||||
|
||||
VJLIBS = $(top_builddir)/libvjnet/libvjnet.la \
|
||||
$(top_builddir)/libvjmsg/libvjmsg.la \
|
||||
$(top_builddir)/libvjmem/libvjmem.la
|
||||
sayOSC_SOURCES = veejay-talk.c
|
||||
sayOSC_LDADD = ${LIBLO_LIBS}
|
||||
|
||||
sayVIMS_SOURCES = sayVIMS.c
|
||||
sayVIMS_LDFLAGS = $(LAV_ALL_LIB_OPTS)
|
||||
sayVIMS_LDADD = $(VJLIBS) @LIBGETOPT_LIB@
|
||||
|
||||
YUV2RAWDV_BIN = sayVIMS
|
||||
YUV2RAWDV_BIN = sayOSC
|
||||
|
||||
bin_PROGRAMS = \
|
||||
$(YUV2RAWDV_BIN)
|
||||
|
||||
@@ -1,251 +0,0 @@
|
||||
/* sendVIMS - very simple client for VeeJay
|
||||
* (C) 2002-2004 Niels Elburg <elburg@hio.hen.nl>
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <netdb.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <sys/socket.h>
|
||||
#include <veejay/vims.h>
|
||||
#include <libvjnet/vj-client.h>
|
||||
#include <libvjnet/common.h>
|
||||
#include <libvjmsg/vj-common.h>
|
||||
static int port_num = 3490;
|
||||
static char *filename = NULL;
|
||||
static char *group_name = NULL;
|
||||
static char *host_name = NULL;
|
||||
static vj_client *sayvims = NULL;
|
||||
static int colors = 0;
|
||||
static int fd_in = 0; // stdin
|
||||
static int single_msg = 0;
|
||||
static int dump = 0;
|
||||
|
||||
/* count played frames (delay) */
|
||||
static void vj_flush(int frames) {
|
||||
int n = 0;
|
||||
char status[100];
|
||||
bzero(status,100);
|
||||
|
||||
while(frames>0) {
|
||||
if( vj_client_poll(sayvims, V_STATUS ))
|
||||
{
|
||||
char sta_len[6];
|
||||
bzero(sta_len, 6 );
|
||||
int nb = vj_client_read( sayvims, V_STATUS, sta_len, 5 );
|
||||
if(sta_len[0] == 'V' )
|
||||
{
|
||||
int bytes = 0;
|
||||
sscanf( sta_len + 1, "%03d", &bytes );
|
||||
if(bytes > 0 )
|
||||
{
|
||||
bzero(status, 100);
|
||||
int n = vj_client_read(sayvims,V_STATUS,status,bytes);
|
||||
if( n )
|
||||
{
|
||||
if(dump) fprintf(stdout , "%s\n", status );
|
||||
frames -- ;
|
||||
}
|
||||
if(n == -1)
|
||||
{
|
||||
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void Usage(char *progname)
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Usage: %s [options] [messages]",progname);
|
||||
veejay_msg(VEEJAY_MSG_INFO, "where options are:");
|
||||
veejay_msg(VEEJAY_MSG_INFO, " -p\t\tVeejay port (3490)");
|
||||
veejay_msg(VEEJAY_MSG_INFO, " -g\t\tVeejay groupname (224.0.0.31)");
|
||||
veejay_msg(VEEJAY_MSG_INFO, " -h\t\tVeejay hostname (localhost)");
|
||||
veejay_msg(VEEJAY_MSG_INFO, " -m\t\tSend single message");
|
||||
veejay_msg(VEEJAY_MSG_INFO, " -c\t\tColored output");
|
||||
veejay_msg(VEEJAY_MSG_INFO, " -d\t\tDump status to stdout");
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Messages to send to veejay must be wrapped in quotes");
|
||||
veejay_msg(VEEJAY_MSG_INFO, "You can send multiple messages by seperating them with a whitespace");
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Example: %s \"600:;\"",progname);
|
||||
veejay_msg(VEEJAY_MSG_INFO, " (quit veejay)");
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Example: echo \"%03d:;\" | %s ", VIMS_QUIT, progname);
|
||||
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
static int set_option(const char *name, char *value)
|
||||
{
|
||||
int err = 0;
|
||||
if(strcmp(name, "h") == 0 )
|
||||
{
|
||||
host_name = strdup(optarg);
|
||||
if(group_name) err ++;
|
||||
}
|
||||
else if(strcmp(name, "g") == 0)
|
||||
{
|
||||
if(host_name) err ++;
|
||||
group_name = strdup( optarg );
|
||||
}
|
||||
else if (strcmp(name, "p") == 0)
|
||||
{
|
||||
port_num = atoi(optarg);
|
||||
}
|
||||
else if (strcmp(name, "c") == 0)
|
||||
{
|
||||
colors = 1;
|
||||
}
|
||||
else if (strcmp(name, "m") == 0 )
|
||||
{
|
||||
single_msg = 1;
|
||||
}
|
||||
else if(strcmp(name, "d") == 0)
|
||||
{
|
||||
dump = 1;
|
||||
}
|
||||
else err++;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static char buf[65535];
|
||||
|
||||
vj_client *sayvims_connect(void)
|
||||
{
|
||||
vj_client *client = vj_client_alloc( 0,0,0 );
|
||||
if(host_name == NULL)
|
||||
host_name = strdup( "localhost" );
|
||||
|
||||
if(!vj_client_connect( client, host_name,group_name, port_num ))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
return client;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
int n = 0;
|
||||
int x = 0;
|
||||
int k =0;
|
||||
char msg[20];
|
||||
char option[2];
|
||||
char ibuf[1024];
|
||||
int err = 0;
|
||||
FILE *infile;
|
||||
// parse commandline parameters
|
||||
while( ( n = getopt(argc,argv, "h:g:p:micd")) != EOF)
|
||||
{
|
||||
sprintf(option,"%c",n);
|
||||
err += set_option( option,optarg);
|
||||
}
|
||||
|
||||
veejay_set_colors(colors);
|
||||
|
||||
if( optind > argc )
|
||||
err ++;
|
||||
if ( err )
|
||||
Usage(argv[0]);
|
||||
|
||||
bzero( buf, 65535 );
|
||||
|
||||
// make connection with veejay
|
||||
sayvims = sayvims_connect();
|
||||
if(!sayvims)
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Cannot connect to %s", host_name);
|
||||
exit(1);
|
||||
}
|
||||
veejay_msg(VEEJAY_MSG_INFO,
|
||||
"Connected to %s", host_name );
|
||||
|
||||
if(single_msg || (optind == 1 && err == 0 && argc > 1 ))
|
||||
{
|
||||
char **msg = argv + optind;
|
||||
int nmsg = argc - optind;
|
||||
i=0;
|
||||
while( i < nmsg )
|
||||
{
|
||||
if(msg[i][0] == '+')
|
||||
{
|
||||
int delay = 1;
|
||||
char *tmp = msg[i];
|
||||
if(sscanf(tmp + 1, "%d",&delay) == 1 )
|
||||
{
|
||||
vj_flush(delay);
|
||||
}
|
||||
else
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Fatal: error parsing %s", tmp );
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int n = vj_client_send( sayvims,V_CMD, msg[i] );
|
||||
// vj_flush(1);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* read from stdin*/
|
||||
int not_done = 1;
|
||||
infile = fdopen( fd_in, "r" );
|
||||
if(!infile)
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Cannot read from STDIN");
|
||||
return 0;
|
||||
}
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Reading from STDIN");
|
||||
while( fgets(buf, 100, infile) )
|
||||
{
|
||||
if( buf[0] == '+' )
|
||||
{
|
||||
int wait_ = 1;
|
||||
|
||||
if(sscanf( buf+1, "%d", &wait_ ) )
|
||||
{
|
||||
vj_flush( wait_ );
|
||||
}
|
||||
else
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Delay not valid: '%s'", wait_ );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
vj_client_send( sayvims, V_CMD, buf );
|
||||
}
|
||||
}
|
||||
}
|
||||
veejay_msg(VEEJAY_MSG_INFO, "%s done ", argv[0]);
|
||||
vj_client_close(sayvims);
|
||||
vj_client_free(sayvims);
|
||||
return 0;
|
||||
}
|
||||
71
veejay-ng/tools/veejay-talk.c
Normal file
71
veejay-ng/tools/veejay-talk.c
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (C) 2004 Steve Harris, Uwe Koloska
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* $Id: example_client.c,v 1.1.1.1 2004/08/07 22:21:02 theno23 Exp $
|
||||
*/
|
||||
#include <config.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "lo/lo.h"
|
||||
|
||||
static void Usage(const char *progname)
|
||||
{
|
||||
fprintf(stderr, "Usage: %s [address] [port] [format] [path] {arguments}\n",progname );
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
const char *addr = argv[1];
|
||||
if(!addr || argc < 5)
|
||||
Usage(argv[0]);
|
||||
const char *port = argv[2];
|
||||
const char *format = argv[3];
|
||||
|
||||
lo_address t = lo_address_new(addr, port);
|
||||
if(!t)
|
||||
{
|
||||
fprintf(stderr, "Failed to communicate with %s:%s\n",addr,port);
|
||||
Usage(argv[0]);
|
||||
}
|
||||
const char *path = argv[4];
|
||||
lo_message msg = lo_message_new();
|
||||
int i;
|
||||
int n = 5;
|
||||
|
||||
while (*format )
|
||||
{
|
||||
if( *format == 'i' ) {
|
||||
lo_message_add_int32( msg, atoi( argv[n] )); n ++ ;
|
||||
} else if( *format == 'd' ) {
|
||||
lo_message_add_double( msg, atof( argv[n] )); n ++ ;
|
||||
} else if ( *format == 's' ) {
|
||||
lo_message_add_string( msg, (char*) argv[n] ); n ++ ;
|
||||
} else if ( *format == 'h' ) {
|
||||
lo_message_add_string( msg, (int64_t) atoll( argv[n]) ); n++ ;
|
||||
} else {
|
||||
// fprintf(stderr, "Unknown format identifier %c", *format );
|
||||
// return 0;
|
||||
}
|
||||
*format++;
|
||||
}
|
||||
|
||||
lo_send_message( t,path, msg );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -33,10 +33,9 @@ VEEJAY_ALL_LIB_OPTS = \
|
||||
libveejay_la_SOURCES = vj-misc.c \
|
||||
vj-pjack.c performer.c \
|
||||
gl.c vj-sdl.c \
|
||||
vj-eventman.c \
|
||||
vj-event.c \
|
||||
oscsend.c \
|
||||
oscservit.c \
|
||||
oscevents.c \
|
||||
liblavplayvj.c
|
||||
|
||||
libveejay_la_LDFLAGS = $(VEEJAY_ALL_LIB_OPTS )
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
#include <veejay/veejay.h>
|
||||
#include <veejay/performer.h>
|
||||
#include <libel/lav_io.h>
|
||||
#include <libvjnet/vj-server.h>
|
||||
//#include <libvjnet/vj-server.h>
|
||||
#include <libvevo/libvevo.h>
|
||||
#include <vevosample/vevosample.h>
|
||||
#include <vevosample/defs.h>
|
||||
@@ -103,6 +103,60 @@ int veejay_get_state(veejay_t *info) {
|
||||
video_playback_setup *settings = (video_playback_setup*)info->settings;
|
||||
return settings->state;
|
||||
}
|
||||
|
||||
sample_video_info_t *veejay_get_ps(void *data)
|
||||
{
|
||||
veejay_t *v = (veejay_t*) data;
|
||||
return v->video_info;
|
||||
}
|
||||
int veejay_osc_verify_format( void *vevo_port, char const *types )
|
||||
{
|
||||
char *format = get_str_vevo( vevo_port, "format" );
|
||||
int n = strlen(types);
|
||||
if(!format)
|
||||
{
|
||||
if( (n ==0 || types == NULL) && format == NULL )
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
if( strcasecmp( types,format ) == 0 )
|
||||
{
|
||||
free(format);
|
||||
return 1;
|
||||
}
|
||||
free(format);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int veejay_osc_property_calls_event( void *instance, const char *path, char *types, void **argv[] )
|
||||
{
|
||||
veejay_t *v = (veejay_t*) instance;
|
||||
void *vevo_port = v->osc_namespace;
|
||||
|
||||
int atom_type = vevo_property_atom_type( vevo_port, path );
|
||||
if( atom_type == VEVO_ATOM_TYPE_PORTPTR )
|
||||
{
|
||||
void *port = NULL;
|
||||
int error = vevo_property_get( vevo_port, path,0,&port );
|
||||
|
||||
if(error == VEVO_NO_ERROR )
|
||||
{
|
||||
vevo_event_f f;
|
||||
if( veejay_osc_verify_format( port, types ) )
|
||||
{
|
||||
error = vevo_property_get( port, "func",0,&f );
|
||||
if( error == VEVO_NO_ERROR )
|
||||
{
|
||||
(*f)( instance,path, types, argv );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//! Change Veejay state
|
||||
/**!
|
||||
\param info Veejay Object
|
||||
@@ -541,7 +595,7 @@ int veejay_open(veejay_t * info)
|
||||
memset( &(settings->lastframe_completion), 0, sizeof(struct timeval));
|
||||
pthread_mutex_init(&(settings->valid_mutex), NULL);
|
||||
pthread_mutex_init(&(settings->syncinfo_mutex), NULL);
|
||||
pthread_mutex_init( &(info->display_mutex), 0 );
|
||||
pthread_mutex_init( &(info->vevo_mutex), 0 );
|
||||
|
||||
/* Invalidate all buffers, and initialize the conditions */
|
||||
settings->valid[0] = 0;
|
||||
@@ -689,12 +743,20 @@ int veejay_close(veejay_t * info)
|
||||
|
||||
void veejay_deinit(veejay_t *info)
|
||||
{
|
||||
vj_server_shutdown(info->status_socket);
|
||||
vj_server_shutdown(info->command_socket);
|
||||
vj_server_shutdown(info->frame_socket);
|
||||
veejay_free_osc_server(info->osc_server );
|
||||
vj_event_stop();
|
||||
//vj_event_stop();
|
||||
samplebank_free();
|
||||
|
||||
veejay_osc_del_methods( info,info->osc_namespace,info ,info);
|
||||
|
||||
vevo_port_recursive_free( info->osc_namespace );
|
||||
|
||||
|
||||
|
||||
// vj_server_shutdown(info->status_socket);
|
||||
// vj_server_shutdown(info->command_socket);
|
||||
// vj_server_shutdown(info->frame_socket);
|
||||
veejay_free_osc_server(info->osc_server );
|
||||
|
||||
plug_sys_free();
|
||||
performer_destroy(info);
|
||||
vj_el_deinit();
|
||||
@@ -734,7 +796,8 @@ int veejay_load_devices( veejay_t *info )
|
||||
}
|
||||
else
|
||||
{
|
||||
samplebank_add_sample( sample );
|
||||
int id = samplebank_add_sample( sample );
|
||||
sample_set_user_data( sample,info, id );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -752,7 +815,10 @@ int veejay_load_samples( veejay_t *info, const char **argv, int n_arg )
|
||||
void *sample = sample_new( VJ_TAG_TYPE_COLOR );
|
||||
if( sample_open(sample, NULL, 0, vid_info ) <= 0 )
|
||||
return 0;
|
||||
//sample_set_user_data(sample,info);
|
||||
id = samplebank_add_sample( sample );
|
||||
sample_set_user_data(sample,info, id);
|
||||
|
||||
veejay_load_video_settings(info, id );
|
||||
return 1;
|
||||
}
|
||||
@@ -769,6 +835,8 @@ int veejay_load_samples( veejay_t *info, const char **argv, int n_arg )
|
||||
else
|
||||
{
|
||||
id = samplebank_add_sample( sample );
|
||||
sample_set_user_data(sample,info,id);
|
||||
|
||||
veejay_msg(0, "Loaded '%s' to sample %d", argv[n], id );
|
||||
}
|
||||
}
|
||||
@@ -801,7 +869,7 @@ int veejay_init(veejay_t * info)
|
||||
veejay_msg(VEEJAY_MSG_INFO, "\tPlugin(s) loaded: %d", n);
|
||||
// veejay_msg(VEEJAY_MSG_INFO,"Loaded %d Plugins",n);
|
||||
|
||||
vj_event_init();
|
||||
/* vj_event_init();
|
||||
|
||||
if(!vj_server_setup(info))
|
||||
{
|
||||
@@ -812,7 +880,7 @@ int veejay_init(veejay_t * info)
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_INFO, "TCP/UDP service (port range %d-%d)",
|
||||
info->port_offset, info->port_offset+5);
|
||||
}
|
||||
}*/
|
||||
|
||||
|
||||
vj_el_set_itu601_preference( info->itu601 );
|
||||
@@ -906,7 +974,7 @@ int veejay_init(veejay_t * info)
|
||||
|
||||
void veejay_playback_status( veejay_t *info )
|
||||
{
|
||||
char status_message[300];
|
||||
/* char status_message[300];
|
||||
|
||||
int len = strlen( info->message );
|
||||
|
||||
@@ -929,7 +997,7 @@ void veejay_playback_status( veejay_t *info )
|
||||
_vj_server_del_client( info->command_socket,info->current_link );
|
||||
_vj_server_del_client( info->frame_socket, info->current_link );
|
||||
}
|
||||
//sample_sprintf_port( info->current_sample);
|
||||
//sample_sprintf_port( info->current_sample);*/
|
||||
}
|
||||
|
||||
|
||||
@@ -992,7 +1060,7 @@ static void veejay_playback_cycle(veejay_t * info)
|
||||
veejay_mjpeg_queue_buf(info, 0, 1);
|
||||
|
||||
stats.nqueue = 1;
|
||||
int last_id = sample_get_key_ptr( info->current_sample);
|
||||
int last_id = sample_get_key_ptr( info->current_sample);
|
||||
while (settings->state != VEEJAY_STATE_STOP)
|
||||
{
|
||||
first_free = stats.nsync;
|
||||
@@ -1026,7 +1094,7 @@ static void veejay_playback_cycle(veejay_t * info)
|
||||
stats.tdiff = time_now.tv_sec - bs.timestamp.tv_sec +
|
||||
(time_now.tv_usec - bs.timestamp.tv_usec)*1.e-6;
|
||||
|
||||
vj_event_update_remote( info );
|
||||
//vj_event_update_remote( info );
|
||||
|
||||
} while (stats.tdiff > settings->spvf && (stats.nsync - first_free) < (1 - 1));
|
||||
|
||||
@@ -1165,7 +1233,7 @@ int vj_server_setup(veejay_t * info)
|
||||
{
|
||||
int port = info->port_offset;
|
||||
|
||||
info->command_socket = vj_server_alloc(port, NULL, V_CMD);
|
||||
/*info->command_socket = vj_server_alloc(port, NULL, V_CMD);
|
||||
|
||||
if(!info->command_socket)
|
||||
return 0;
|
||||
@@ -1177,17 +1245,65 @@ int vj_server_setup(veejay_t * info)
|
||||
info->frame_socket = vj_server_alloc(port, NULL, V_MSG );
|
||||
if(!info->frame_socket)
|
||||
return 0;
|
||||
|
||||
*/
|
||||
const char port_str[50];
|
||||
sprintf(port_str, "%d",port );
|
||||
info->osc_server = veejay_new_osc_server( (void*)info, port_str );
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
info->osc_namespace = vevo_port_new( VEVO_ANONYMOUS_PORT, __FUNCTION__, __LINE__ );
|
||||
#else
|
||||
info->osc_namespace = vevo_port_new( VEVO_ANONYMOUS_PORT );
|
||||
#endif
|
||||
veejay_osc_namespace_events( (void*) info, "/veejay");
|
||||
|
||||
// info->mcast_socket =
|
||||
// vj_server_alloc(port, info->settings->vims_group_name, V_CMD );
|
||||
// GoMultiCast( info->settings->group_name );
|
||||
|
||||
return 1;
|
||||
}
|
||||
#define VALID_RESOLUTION(w,h,x,y) (( (w >=64 && w<=2048) && (h >= 64 && h <= 2048) && (x >= 0 && x <2048) && (y>=0 && y <2048)) ? 1: 0 )
|
||||
|
||||
|
||||
void veejay_resize_screen( void *info, int x, int y, int w, int h )
|
||||
{
|
||||
veejay_t *v = (veejay_t*) info;
|
||||
if(!VALID_RESOLUTION(w,h,x,y))
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR,"Invalid dimensions for video window. Width and Height must be >= 64 and <= 2048");
|
||||
return;
|
||||
|
||||
}
|
||||
if( v->use_display == 2)
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_INFO, "OpenGL video window is %gx%g+%gx%g",
|
||||
w,h,x,y );
|
||||
x_display_resize( w,h,x,y );
|
||||
}
|
||||
if( v->use_display == 1 )
|
||||
{
|
||||
if(vj_sdl_resize_window(v->display,w,h,x,y))
|
||||
veejay_msg(VEEJAY_MSG_INFO, "SDL video window is %dx%d+%dx%d",
|
||||
w,h,x,y);
|
||||
}
|
||||
}
|
||||
|
||||
void veejay_fullscreen(void *info, int value)
|
||||
{
|
||||
veejay_t *v = (veejay_t*) info;
|
||||
if( v->use_display == 2 )
|
||||
{
|
||||
if(x_display_set_fullscreen( v->display, value ))
|
||||
veejay_msg(VEEJAY_MSG_INFO,"OpenGL display window Fullscreen %s",
|
||||
value == 0 ? "disabled" : "enabled");
|
||||
}
|
||||
if( v->use_display == 1 )
|
||||
{
|
||||
if(vj_sdl_set_fullscreen( v->display, value ))
|
||||
veejay_msg(VEEJAY_MSG_INFO,"SDL display window fullsceen %s",
|
||||
value == 0 ? "disabled" : "enabled");
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************
|
||||
* veejay_malloc()
|
||||
@@ -1219,10 +1335,24 @@ veejay_t *veejay_malloc()
|
||||
info->settings->currently_processed_entry = -1;
|
||||
info->settings->first_frame = 1;
|
||||
info->settings->state = VEEJAY_STATE_STOP;
|
||||
info->port_offset = VJ_PORT;
|
||||
info->port_offset = 3490;// VJ_PORT;
|
||||
|
||||
samplebank_init();
|
||||
available_diskspace();
|
||||
|
||||
//vj_event_init();
|
||||
|
||||
if(!vj_server_setup(info))
|
||||
{
|
||||
veejay_msg(0, "Cannot setup service");
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_INFO, "TCP/UDP service (port range %d-%d)",
|
||||
info->port_offset, info->port_offset+5);
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
673
veejay-ng/veejay/oscevents.c
Normal file
673
veejay-ng/veejay/oscevents.c
Normal file
@@ -0,0 +1,673 @@
|
||||
/* veejay - Linux VeeJay
|
||||
* (C) 2002-2006 Niels Elburg <nelburg at looze.net>
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <libvjmem/vjmem.h>
|
||||
#include <libvjmsg/vj-common.h>
|
||||
#include <libvevo/libvevo.h>
|
||||
#include <veejay/defs.h>
|
||||
#include <veejay/veejay.h>
|
||||
#include <libplugger/plugload.h>
|
||||
#include <vevosample/vevosample.h>
|
||||
#include <lo/lo.h>
|
||||
#include <ctype.h>
|
||||
#ifdef STRICT_CHECKING
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
void osc_sample_edl_paste_at( void *ptr,const char *path, const char *types, void **dargv )
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
|
||||
if(sample_edl_paste_from_buffer( ptr, (uint64_t) argv[0]->h ))
|
||||
veejay_msg( VEEJAY_MSG_INFO, "Pasted frames from buffer to position %lld",
|
||||
argv[0]->h );
|
||||
else
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Unable to paste frames at position %lld",
|
||||
argv[0]->h );
|
||||
}
|
||||
void osc_sample_edl_cut( void *sample,const char *path, const char *types, void **dargv )
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
|
||||
if(sample_edl_cut_to_buffer( sample, (uint64_t) argv[0]->h, (uint64_t) argv[1]->h ))
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Cut frames %lld - %lld to buffer",argv[0]->h,argv[1]->h);
|
||||
else
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Unable to cut frames %lld - %lld",argv[0]->h,argv[1]->h);
|
||||
}
|
||||
|
||||
void osc_sample_edl_copy(void *sample,const char *path, const char *types, void **dargv )
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
|
||||
if( sample_edl_copy( sample, (uint64_t) argv[0]->h,(uint64_t) argv[1]->h ))
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Copied frames %lld - %lld to buffer",argv[0]->h,argv[1]->h);
|
||||
|
||||
else
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Unable to copy frames %lld - %lld",argv[0]->h,argv[1]->h);
|
||||
}
|
||||
void osc_sample_edl_del(void *sample,const char *path, const char *types, void **dargv )
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
|
||||
if( sample_edl_delete( sample, (uint64_t) argv[0]->h,(uint64_t) argv[1]->h ))
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Deleted frames %lld - %lld to buffer",argv[0]->h,argv[1]->h);
|
||||
|
||||
else
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Unable to delete frames %lld - %lld",argv[0]->h,argv[1]->h);
|
||||
}
|
||||
void osc_sample_play_forward(void *sample,const char *path, const char *types, void **dargv )
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
int speed = sample_get_speed( sample );
|
||||
if(speed <= 0)
|
||||
{
|
||||
if(speed == 0)
|
||||
speed = -1;
|
||||
speed *= -1;
|
||||
|
||||
sample_set_property_ptr( sample, "speed", VEVO_ATOM_TYPE_INT,&speed);
|
||||
}
|
||||
}
|
||||
void osc_sample_play_reverse(void *sample,const char *path, const char *types, void **dargv )
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
int speed = sample_get_speed( sample );
|
||||
if(speed >= 0)
|
||||
{
|
||||
if(speed == 0)
|
||||
speed = -1;
|
||||
speed *= -1;
|
||||
|
||||
sample_set_property_ptr( sample, "speed", VEVO_ATOM_TYPE_INT,&speed);
|
||||
}
|
||||
}
|
||||
void osc_sample_play_pause(void *sample,const char *path, const char *types, void **dargv )
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
int speed = sample_get_speed( sample );
|
||||
if(speed != 0)
|
||||
{
|
||||
speed = 0;
|
||||
sample_set_property_ptr( sample, "speed", VEVO_ATOM_TYPE_INT,&speed);
|
||||
}
|
||||
}
|
||||
|
||||
void osc_sample_set_frame(void *sample,const char *path, const char *types, void **dargv )
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
uint64_t pos = sample_get_current_pos( sample );
|
||||
uint64_t user_pos = argv[0]->h;
|
||||
if(pos != user_pos)
|
||||
{
|
||||
if( sample_valid_pos( sample, user_pos ))
|
||||
{
|
||||
sample_set_property_ptr(sample, "current_pos",
|
||||
VEVO_ATOM_TYPE_UINT64, &user_pos );
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Position changed to %lld",user_pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Position %lld outside sample",user_pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
void osc_sample_set_next_frame(void *sample,const char *path, const char *types, void **dargv )
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
uint64_t pos = sample_get_current_pos( sample );
|
||||
uint64_t user_pos = pos + 1;
|
||||
if(pos != user_pos)
|
||||
{
|
||||
if( sample_valid_pos( sample, user_pos ))
|
||||
{
|
||||
sample_set_property_ptr(sample, "current_pos",
|
||||
VEVO_ATOM_TYPE_UINT64, &user_pos );
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Position changed to %lld",user_pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Position %lld outside sample",user_pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void osc_sample_set_prev_frame(void *sample,const char *path, const char *types, void **dargv )
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
uint64_t pos = sample_get_current_pos( sample );
|
||||
uint64_t user_pos = pos - 1;
|
||||
if(pos != user_pos)
|
||||
{
|
||||
if( sample_valid_pos( sample, user_pos ))
|
||||
{
|
||||
sample_set_property_ptr(sample, "current_pos",
|
||||
VEVO_ATOM_TYPE_UINT64, &user_pos );
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Position changed to %lld",user_pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Position %lld outside sample",user_pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void osc_sample_goto_start(void *sample, const char *path, const char *types, void **dargv )
|
||||
{
|
||||
uint64_t pos = sample_get_start_pos( sample );
|
||||
sample_set_property_ptr( sample, "current_pos",
|
||||
VEVO_ATOM_TYPE_UINT64, &pos );
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Position changed to %lld", pos);
|
||||
}
|
||||
void osc_sample_goto_end(void *sample, const char *path, const char *types, void **dargv )
|
||||
{
|
||||
uint64_t pos = sample_get_end_pos( sample );
|
||||
sample_set_property_ptr( sample, "current_pos",
|
||||
VEVO_ATOM_TYPE_UINT64, &pos );
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Position changed to %lld", pos);
|
||||
}
|
||||
void osc_sample_reset_fx(void *sample,const char *path, const char *types, void **dargv )
|
||||
{
|
||||
sample_fx_chain_reset( sample );
|
||||
}
|
||||
|
||||
void osc_sample_reset_fx_entry( void *sample,const char *path, const char *types, void **dargv)
|
||||
{
|
||||
int fx_id = sample_extract_fx_entry_from_path(sample, path );
|
||||
if( fx_id < 0 )
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Outside chain boundary");
|
||||
return;
|
||||
}
|
||||
if(sample_fx_chain_entry_clear( sample, fx_id ) )
|
||||
veejay_msg(VEEJAY_MSG_INFO, "Cleared FX slot %d",fx_id );
|
||||
}
|
||||
void osc_sample_alpha_fx_entry( void *sample,const char *path, const char *types, void **dargv)
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
|
||||
int fx_id = sample_extract_fx_entry_from_path(sample, path );
|
||||
if( fx_id < 0 )
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Outside chain boundary");
|
||||
return;
|
||||
}
|
||||
|
||||
double alpha = argv[0]->d;
|
||||
sample_set_fx_alpha( sample, fx_id, alpha );
|
||||
}
|
||||
|
||||
void osc_sample_channel_fx_entry( void *sample,const char *path, const char *types, void **dargv)
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
|
||||
int fx_id = sample_extract_fx_entry_from_path(sample, path );
|
||||
if( fx_id < 0 )
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Outside chain boundary");
|
||||
return;
|
||||
}
|
||||
|
||||
int seq = argv[0]->i;
|
||||
int id = argv[1]->i;
|
||||
|
||||
if( find_sample(id) )
|
||||
{
|
||||
int n = sample_fx_set_in_channel( sample, fx_id, seq,id );
|
||||
if(n)
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Input channel %d set to sample %d", seq, id );
|
||||
}
|
||||
}
|
||||
void osc_sample_set_fx_entry( void *sample,const char *path, const char *types, void **dargv)
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
|
||||
int fx_id = sample_extract_fx_entry_from_path(sample, path );
|
||||
if( fx_id < 0 )
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Outside chain boundary");
|
||||
return;
|
||||
}
|
||||
|
||||
char *s = (char*) &(argv[0]->s);
|
||||
int fx = plug_get_fx_id_by_name( s );
|
||||
if( fx < 0 )
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "FX '%s' not found", s );
|
||||
else
|
||||
{
|
||||
if( sample_fx_set( sample, fx_id,fx ) )
|
||||
veejay_msg(VEEJAY_MSG_INFO,
|
||||
"Added '%s' to fx_%d",
|
||||
s,fx_id);
|
||||
}
|
||||
}
|
||||
void osc_sample_bind_fx_entry( void *sample, const char *path, const char *types, void **dargv)
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
|
||||
int fx_id = sample_extract_fx_entry_from_path(sample, path );
|
||||
if( fx_id < 0 )
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Outside chain boundary");
|
||||
return;
|
||||
}
|
||||
void *src_entry = sample_get_fx_port_ptr( sample,fx_id );
|
||||
if(src_entry == NULL )
|
||||
{
|
||||
veejay_msg(0,"Invalid fx entry");
|
||||
return;
|
||||
}
|
||||
|
||||
int error = sample_new_bind( sample, src_entry, argv[0]->i, argv[1]->i, argv[2]->i );
|
||||
if( error == VEVO_NO_ERROR )
|
||||
{
|
||||
veejay_msg(0, "Pushing out parameters on entry %d parameter %d -> Entry %d parameter %d",
|
||||
fx_id,argv[0]->i,argv[1]->i,argv[2]->i);
|
||||
}
|
||||
}
|
||||
void osc_sample_release_fx_entry( void *sample, const char *path, const char *types, void **dargv)
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
|
||||
int fx_id = sample_extract_fx_entry_from_path(sample, path );
|
||||
if( fx_id < 0 )
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Outside chain boundary");
|
||||
return;
|
||||
}
|
||||
void *src_entry = sample_get_fx_port_ptr( sample,fx_id );
|
||||
if(src_entry == NULL )
|
||||
{
|
||||
veejay_msg(0,"Invalid fx entry");
|
||||
return;
|
||||
}
|
||||
int error = sample_del_bind( sample, src_entry, argv[0]->i );
|
||||
if( error == VEVO_NO_ERROR )
|
||||
{
|
||||
veejay_msg(0, "Detached output parameter %d on entry %d", argv[0]->i,fx_id );
|
||||
}
|
||||
}
|
||||
void osc_sample_bind_osc_fx_entry( void *sample, const char *path, const char *types, void **dargv)
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
|
||||
int fx_id = sample_extract_fx_entry_from_path(sample, path );
|
||||
if( fx_id < 0 )
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Outside chain boundary");
|
||||
return;
|
||||
}
|
||||
sample_add_osc_path( sample, (char*) &(argv[0]->s), fx_id );
|
||||
}
|
||||
void osc_sample_release_osc_fx_entry( void *sample, const char *path, const char *types, void **dargv)
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
|
||||
int fx_id = sample_extract_fx_entry_from_path(sample, path );
|
||||
if( fx_id < 0 )
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "Outside chain boundary");
|
||||
return;
|
||||
}
|
||||
sample_del_osc_path( sample, fx_id );
|
||||
}
|
||||
|
||||
|
||||
void osc_sample_parameter_sender_start( void *sample,const char *path, const char *types, void **dargv)
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
sample_new_osc_sender( sample, (char*)&(argv[0]->s), (char*) &(argv[1]->s) );
|
||||
}
|
||||
|
||||
void osc_sample_parameter_sender_stop( void *sample,const char *path, const char *types, void **dargv)
|
||||
{
|
||||
sample_close_osc_sender( sample );
|
||||
}
|
||||
|
||||
void osc_sample_config_record(void *sample,const char *path, const char *types, void **dargv)
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
|
||||
int error = sample_configure_recorder( sample,
|
||||
argv[0]->i, (char*) &(argv[2]->s), argv[1]->i );
|
||||
if( error )
|
||||
veejay_msg(0, "Unable to configure the recorder");
|
||||
}
|
||||
void osc_sample_record_start(void *sample,const char *path, const char *types, void **dargv)
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
|
||||
int error = sample_start_recorder( sample );
|
||||
if( error )
|
||||
veejay_msg(0, "Unable to start the sample recorder");
|
||||
}
|
||||
void osc_sample_record_stop(void *sample,const char *path, const char *types, void **dargv)
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
|
||||
int error = sample_stop_recorder( sample );
|
||||
if( error )
|
||||
veejay_msg(0, "Unable to stop the sample recorder");
|
||||
}
|
||||
|
||||
void osc_veejay_quit(void *info,const char *path, const char *types, void **dargv)
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
veejay_change_state( info, VEEJAY_STATE_STOP );
|
||||
}
|
||||
void osc_veejay_resize(void *info,const char *path, const char *types, void **dargv)
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
veejay_resize_screen( info, argv[0]->i,argv[1]->i,argv[2]->i,argv[3]->i);
|
||||
}
|
||||
void osc_veejay_fullscreen(void *info,const char *path, const char *types, void **dargv)
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
veejay_fullscreen( info, argv[0]->i );
|
||||
}
|
||||
void osc_veejay_select( void *info,const char *path, const char *types, void **dargv)
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
int id = argv[0]->i;
|
||||
veejay_t *v = (veejay_t*) info;
|
||||
void *sample = v->current_sample;
|
||||
void *res = sample;
|
||||
|
||||
if( id > 0 )
|
||||
{
|
||||
res = find_sample( id );
|
||||
}
|
||||
else if( id == -1 )
|
||||
res = sample_last();
|
||||
|
||||
if(sample == res)
|
||||
{
|
||||
uint64_t pos = sample_get_start_pos( v->current_sample );
|
||||
sample_set_property_ptr(
|
||||
v->current_sample, "current_pos", VEVO_ATOM_TYPE_UINT64, &pos );
|
||||
}
|
||||
else
|
||||
{
|
||||
sample_save_cache_data( v->current_sample );
|
||||
v->current_sample = res;
|
||||
}
|
||||
}
|
||||
void osc_veejay_new_sample(void *info,const char *path, const char *types, void **dargv)
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
int type = argv[0]->i;
|
||||
int token = argv[1]->i;
|
||||
char *str = &(argv[2]->s);
|
||||
veejay_t *v = (veejay_t*) info;
|
||||
void *sample = sample_new( type );
|
||||
if(!sample)
|
||||
{
|
||||
veejay_msg(0, "Invalid type");
|
||||
return;
|
||||
}
|
||||
if(sample_open( sample, str,token, v->video_info))
|
||||
{
|
||||
int new_id = samplebank_add_sample( sample );
|
||||
const char *type_str = sample_describe_type( type );
|
||||
|
||||
sample_set_user_data( sample,info,new_id );
|
||||
veejay_msg(VEEJAY_MSG_INFO,"Created new %s from %s as Sample %d",
|
||||
type_str, str, new_id );
|
||||
}
|
||||
else
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR,"Could not create sample from %s",token);
|
||||
}
|
||||
}
|
||||
|
||||
void osc_veejay_del_sample(void *info,const char *path, const char *types, void **dargv)
|
||||
{
|
||||
lo_arg **argv = (lo_arg**) dargv;
|
||||
int id = argv[0]->i;
|
||||
veejay_t *v = (veejay_t*) info;
|
||||
void *sample = find_sample(id);
|
||||
if(sample == v->current_sample)
|
||||
veejay_msg(0, "Cannot delete current playing sample");
|
||||
else
|
||||
if(sample_delete( id ) )
|
||||
veejay_msg(0, "Deleted sample %d", id );
|
||||
}
|
||||
|
||||
void osc_sample_print( void *sample,const char *path, const char *types, void **dargv)
|
||||
{
|
||||
sample_osc_namespace( sample );
|
||||
}
|
||||
|
||||
|
||||
static struct
|
||||
{
|
||||
const char *name;
|
||||
const char *format;
|
||||
const char *args[4];
|
||||
const char *descr;
|
||||
vevo_event_f func;
|
||||
} fx_events_[] = {
|
||||
{ "clear", NULL, {NULL,NULL,NULL,NULL }, "Delete plugin" , osc_sample_reset_fx_entry },
|
||||
{ "alpha", "d", {"Alpha value 0.0 - 1.0",NULL,NULL,NULL }, "Opacity", osc_sample_alpha_fx_entry },
|
||||
{ "input_channel","ii", {"Input Channel", "Sample ID", NULL,NULL}, "Set a plugin's input channel",
|
||||
osc_sample_channel_fx_entry },
|
||||
{ "set", "s", {"FX plugin name", NULL,NULL,NULL }, "Initialize a plugin",
|
||||
osc_sample_set_fx_entry },
|
||||
{ "bind", "iii",{"Output parameter ID",
|
||||
"Bind to FX entry",
|
||||
"Input Parameter ID",
|
||||
NULL }, "Bind output parameter to some input parameter",
|
||||
osc_sample_bind_fx_entry },
|
||||
{ "release", NULL, { NULL,NULL,NULL }, "Release bind between output and input parameter",
|
||||
osc_sample_release_fx_entry },
|
||||
{ "bind_osc", "s", { "OSC message", NULL,NULL,NULL }, "Bind an OSC Path to an output parameter",
|
||||
osc_sample_bind_osc_fx_entry },
|
||||
{ "release_osc", NULL, { NULL,NULL,NULL,NULL}, "Release OSC Path",
|
||||
osc_sample_release_osc_fx_entry },
|
||||
{ NULL, NULL, { NULL,NULL,NULL,NULL}, NULL, NULL }
|
||||
};
|
||||
|
||||
static struct
|
||||
{
|
||||
const char *name;
|
||||
const char *format;
|
||||
const char *args[4];
|
||||
const char *descr;
|
||||
vevo_event_f func;
|
||||
} sample_generic_events_[] =
|
||||
{
|
||||
{ "reset_fx", NULL, { NULL,NULL,NULL,NULL }, "Delete all plugins", osc_sample_reset_fx },
|
||||
{ "register_param_sender","ss", { "Address" , "Port Number",NULL,NULL },
|
||||
"Initialize a new OSC sender",
|
||||
osc_sample_parameter_sender_start },
|
||||
{ "unregister_param_sender", NULL, { NULL, NULL,NULL,NULL },"Close OSC sender",
|
||||
osc_sample_parameter_sender_stop },
|
||||
{ "rec/config", "iis", { "Format", "Frames", "Filename" , NULL },"Configure sample recorder",
|
||||
osc_sample_config_record },
|
||||
{ "rec/start", NULL, { NULL,NULL,NULL,NULL },"Start recording from sample",
|
||||
osc_sample_record_start },
|
||||
{ "rec/stop", NULL, { NULL,NULL,NULL,NULL },"Stop recording from sample",
|
||||
osc_sample_record_stop },
|
||||
{ "print", NULL, { NULL,NULL,NULL,NULL },"Print OSC namespace", osc_sample_print },
|
||||
{ NULL, NULL, { NULL,NULL,NULL,NULL },NULL, NULL },
|
||||
|
||||
};
|
||||
|
||||
static struct
|
||||
{
|
||||
const char *name;
|
||||
const char *format;
|
||||
const char *args[4];
|
||||
const char *descr;
|
||||
vevo_event_f func;
|
||||
} sample_nonstream_events_[] =
|
||||
{
|
||||
{ "video/play", NULL, { NULL,NULL,NULL,NULL },"Play video forward", osc_sample_play_forward },
|
||||
{ "video/reverse",NULL, { NULL,NULL,NULL,NULL },"Play video backward", osc_sample_play_reverse },
|
||||
{ "video/pause", NULL, { NULL,NULL,NULL,NULL },"Pause video", osc_sample_play_pause },
|
||||
{ "video/frame", "h", { "Frame number",NULL,NULL,NULL }, "Set a frame", osc_sample_set_frame },
|
||||
{ "video/next_frame",NULL, { NULL,NULL,NULL,NULL },"Goto next frame", osc_sample_set_next_frame },
|
||||
{ "video/prev_frame",NULL, { NULL,NULL,NULL,NULL },"Goto previous frame", osc_sample_set_prev_frame },
|
||||
{ "video/goto_start", NULL, { NULL,NULL,NULL,NULL },"Goto starting position", osc_sample_goto_start },
|
||||
{ "video/goto_end", NULL, { NULL,NULL,NULL,NULL },"Goto ending position", osc_sample_goto_end },
|
||||
{ "edl/paste_at", "h", { "Destination frame number", NULL,NULL,NULL },"Paste from buffer at position", osc_sample_edl_paste_at },
|
||||
{ "edl/cut", "hh", { "Selection start","Selection end",NULL,NULL },"Cut to buffer from selection", osc_sample_edl_cut },
|
||||
{ "edl/copy", "hh", { "Selection start","Selection end",NULL,NULL },"Copy to buffer from selection",osc_sample_edl_copy },
|
||||
{ "edl/del", "hh", { "Selection start","Selection end",NULL,NULL },"Delete without using buffer", osc_sample_edl_del },
|
||||
{ NULL, NULL, { NULL,NULL,NULL,NULL }, NULL },
|
||||
|
||||
};
|
||||
|
||||
|
||||
static struct
|
||||
{
|
||||
const char *name;
|
||||
const char *format;
|
||||
const char *args[4];
|
||||
const char *descr;
|
||||
vevo_event_f func;
|
||||
} veejay_events_[] =
|
||||
{
|
||||
{ "quit", NULL, { NULL,NULL,NULL,NULL },"Quit Veejay-NG", osc_veejay_quit },
|
||||
{ "resize", "iiii", { "X offset", "Y offset", "Width", "Height" },"Resize video window", osc_veejay_resize },
|
||||
{ "fullscreen","i", { "On=1, Off=0",NULL,NULL,NULL },"Fullscreen video window", osc_veejay_fullscreen },
|
||||
{ "select", "i", { "Sample ID", NULL,NULL,NULL },"Select a sample", osc_veejay_select },
|
||||
{ "new" , "iis", { "Sample Type", "Numeric value", "Filename" , NULL }, "Create a new sample", osc_veejay_new_sample },
|
||||
{ "del" , "i", { "Sample ID", NULL, NULL, NULL },"Delete sample", osc_veejay_del_sample },
|
||||
{ NULL, NULL, { NULL,NULL,NULL,NULL }, NULL },
|
||||
|
||||
};
|
||||
|
||||
|
||||
static void osc_fx_generic_event(
|
||||
lo_server_thread *st,
|
||||
void *user_data,
|
||||
void *osc_port,
|
||||
void *vevo_port,
|
||||
const char *base,
|
||||
const char *key,
|
||||
const char *format,
|
||||
const char **args,
|
||||
const char *descr,
|
||||
vevo_event_f *func )
|
||||
{
|
||||
vevosample_new_event(
|
||||
user_data,
|
||||
osc_port,
|
||||
vevo_port, // Instance!
|
||||
base,
|
||||
key,
|
||||
format,
|
||||
args,
|
||||
descr,
|
||||
func,
|
||||
0
|
||||
);
|
||||
}
|
||||
void osc_add_sample_generic_events( lo_server_thread *st, void *user_data, void *osc_port, void *vevo_port, const char *base, int chain_len )
|
||||
{
|
||||
int i;
|
||||
for( i = 0; sample_generic_events_[i].name != NULL ; i ++ )
|
||||
{
|
||||
vevosample_new_event(
|
||||
user_data,
|
||||
osc_port,
|
||||
vevo_port,
|
||||
base,
|
||||
sample_generic_events_[i].name,
|
||||
sample_generic_events_[i].format,
|
||||
sample_generic_events_[i].args,
|
||||
sample_generic_events_[i].descr,
|
||||
sample_generic_events_[i].func,
|
||||
0 );
|
||||
}
|
||||
|
||||
for( i =0; i < chain_len ; i ++ )
|
||||
{
|
||||
char name[20];
|
||||
sprintf(name, "%s/fx_%d", base, i );
|
||||
|
||||
int k;
|
||||
for( k = 0; fx_events_[k].name != NULL ; k ++ )
|
||||
{
|
||||
vevosample_new_event(
|
||||
user_data,
|
||||
osc_port,
|
||||
vevo_port,
|
||||
name,
|
||||
fx_events_[k].name,
|
||||
fx_events_[k].format,
|
||||
fx_events_[k].args,
|
||||
fx_events_[k].descr,
|
||||
fx_events_[k].func,
|
||||
0
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void osc_add_sample_nonstream_events( lo_server_thread *st, void *user_data, void *osc_port, void *vevo_port, const char *base )
|
||||
{
|
||||
int i;
|
||||
for( i =0 ; sample_nonstream_events_[i].name != NULL ; i ++ )
|
||||
{
|
||||
vevosample_new_event(
|
||||
user_data,
|
||||
osc_port,
|
||||
vevo_port,
|
||||
base,
|
||||
sample_nonstream_events_[i].name,
|
||||
sample_nonstream_events_[i].format,
|
||||
sample_nonstream_events_[i].args,
|
||||
sample_nonstream_events_[i].descr,
|
||||
sample_nonstream_events_[i].func,
|
||||
0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void osc_add_veejay_events( lo_server_thread *st, void *user_data, void *osc_port, const char *base )
|
||||
{
|
||||
int i;
|
||||
for( i = 0; veejay_events_[i].name != NULL ; i ++ )
|
||||
{
|
||||
veejay_new_event(
|
||||
user_data,
|
||||
osc_port,
|
||||
user_data,
|
||||
base,
|
||||
veejay_events_[i].name,
|
||||
veejay_events_[i].format,
|
||||
veejay_events_[i].args,
|
||||
veejay_events_[i].descr,
|
||||
veejay_events_[i].func,
|
||||
0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,91 +31,46 @@
|
||||
#include <veejay/vims.h>
|
||||
#include <veejay/veejay.h>
|
||||
#include <lo/lo.h>
|
||||
|
||||
|
||||
#include <ctype.h>
|
||||
#include <vevosample/vevosample.h>
|
||||
//@ client side implementation
|
||||
#ifdef STRICT_CHECKING
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
#include <veejay/oscservit.h>
|
||||
|
||||
typedef struct {
|
||||
int seq;
|
||||
void *caller;
|
||||
void *instance;
|
||||
} plugin_data_t;
|
||||
typedef struct
|
||||
{
|
||||
lo_server_thread st;
|
||||
void *events;
|
||||
// void *events;
|
||||
} osc_recv_t;
|
||||
|
||||
static struct
|
||||
{
|
||||
const char *path;
|
||||
int id;
|
||||
} osc_paths_[] = {
|
||||
{ "/sample/new", VIMS_SAMPLE_NEW },
|
||||
{ "/sample/select", VIMS_SAMPLE_SELECT },
|
||||
{ "/sample/del", VIMS_SAMPLE_DEL },
|
||||
{ "/sample/set/properties", VIMS_SAMPLE_SET_PROPERTIES },
|
||||
{ "/load/samplelist", VIMS_SAMPLE_LOAD },
|
||||
{ "/save/samplelist", VIMS_SAMPLE_SAVE },
|
||||
{ "/sample/rec/start", VIMS_SAMPLE_START_RECORDER },
|
||||
{ "/sample/rec/stop", VIMS_SAMPLE_STOP_RECORDER },
|
||||
{ "/sample/rec/configure", VIMS_SAMPLE_CONFIGURE_RECORDER },
|
||||
{ "/sample/set/volume", VIMS_SAMPLE_SET_VOLUME },
|
||||
{ "/sample/fxc/active", VIMS_SAMPLE_CHAIN_ACTIVE },
|
||||
{ "/sample/edl/paste_at", VIMS_SAMPLE_EDL_PASTE_AT },
|
||||
{ "/sample/edl/copy", VIMS_SAMPLE_EDL_COPY },
|
||||
{ "/sample/edl/del", VIMS_SAMPLE_EDL_DEL },
|
||||
{ "/sample/edl/crop", VIMS_SAMPLE_EDL_CROP },
|
||||
{ "/sample/edl/cut", VIMS_SAMPLE_EDL_CUT },
|
||||
{ "/sample/edl/append", VIMS_SAMPLE_EDL_ADD },
|
||||
{ "/sample/edl/export", VIMS_SAMPLE_EDL_EXPORT },
|
||||
{ "/sample/edl/load", VIMS_SAMPLE_EDL_LOAD },
|
||||
{ "/sample/edl/save", VIMS_SAMPLE_EDL_SAVE },
|
||||
{ "/sample/chain/clear", VIMS_SAMPLE_CHAIN_CLEAR },
|
||||
{ "/sample/chain/entry/select", VIMS_SAMPLE_CHAIN_SET_ENTRY },
|
||||
{ "/sample/chain/entry/set", VIMS_SAMPLE_CHAIN_ENTRY_SET_FX },
|
||||
{ "/sample/chain/entry/preset", VIMS_SAMPLE_CHAIN_ENTRY_SET_PRESET },
|
||||
{ "/sample/chain/entry/active", VIMS_SAMPLE_CHAIN_ENTRY_SET_ACTIVE },
|
||||
{ "/sample/chain/entry/value", VIMS_SAMPLE_CHAIN_ENTRY_SET_VALUE },
|
||||
{ "/sample/chain/entry/channel", VIMS_SAMPLE_CHAIN_ENTRY_SET_INPUT },
|
||||
{ "/sample/chain/entry/alpha", VIMS_SAMPLE_CHAIN_ENTRY_SET_ALPHA },
|
||||
{ "/sample/chain/entry/clear", VIMS_SAMPLE_CHAIN_ENTRY_CLEAR },
|
||||
{ "/sample/chain/entry/state", VIMS_SAMPLE_CHAIN_ENTRY_SET_STATE },
|
||||
{ "/sample/chain/entry/bind", VIMS_SAMPLE_ATTACH_OUT_PARAMETER },
|
||||
{ "/sample/chain/entry/release", VIMS_SAMPLE_DETACH_OUT_PARAMETER },
|
||||
{ "/sample/chain/entry/register_osc_path", VIMS_SAMPLE_BIND_OUTP_OSC },
|
||||
{ "/sample/chain/entry/unregister_osc_path",VIMS_SAMPLE_RELEASE_OUTP_OSC },
|
||||
{ "/sample/register_osc_client", VIMS_SAMPLE_OSC_START },
|
||||
{ "/sample/unregister_osc_client", VIMS_SAMPLE_OSC_STOP },
|
||||
{ "/samplebank/add", VIMS_SAMPLEBANK_ADD },
|
||||
{ "/samplebank/del", VIMS_SAMPLEBANK_DEL },
|
||||
{ "/play", VIMS_SAMPLE_PLAY_FORWARD },
|
||||
{ "/reverse", VIMS_SAMPLE_PLAY_BACKWARD },
|
||||
{ "/pause", VIMS_SAMPLE_PLAY_STOP },
|
||||
{ "/skip", VIMS_SAMPLE_SKIP_FRAME },
|
||||
{ "/prev", VIMS_SAMPLE_PREV_FRAME },
|
||||
{ "/up", VIMS_SAMPLE_SKIP_SECOND },
|
||||
{ "/down", VIMS_SAMPLE_PREV_SECOND },
|
||||
{ "/start", VIMS_SAMPLE_GOTO_START },
|
||||
{ "/end", VIMS_SAMPLE_GOTO_END },
|
||||
{ "/frame", VIMS_SAMPLE_SET_FRAME },
|
||||
{ "/speed", VIMS_SAMPLE_SET_SPEED },
|
||||
{ "/slow", VIMS_SAMPLE_SET_SLOW },
|
||||
|
||||
{ "/fullscreen", VIMS_FULLSCREEN },
|
||||
{ "/audio", VIMS_AUDIO_SET_ACTIVE },
|
||||
{ "/resize", VIMS_RESIZE_SCREEN },
|
||||
|
||||
{ NULL, 0 }
|
||||
|
||||
};
|
||||
|
||||
void error_handler( int num, const char *msg, const char *path )
|
||||
{
|
||||
veejay_msg(0,"Liblo server error %d in path %s: %s",num,path,msg );
|
||||
}
|
||||
static char *osc_create_path( const char *base, const char *path )
|
||||
{
|
||||
int n = strlen(base) + strlen(path) + 2;
|
||||
char *res = (char*) malloc(n);
|
||||
bzero(res,n);
|
||||
sprintf(res,"%s/%s", base,path);
|
||||
return res;
|
||||
}
|
||||
|
||||
typedef void (*osc_event)(void *ptr, const char format[], va_list ap);
|
||||
static char *osc_fx_pair_str( const char *base, const char *key )
|
||||
{
|
||||
int n = strlen(base) + strlen(key) + 2;
|
||||
char *res = (char*) malloc(n);
|
||||
bzero(res,n);
|
||||
snprintf( res,n, "%s/%s", base,key);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static char *vevo_str_to_liblo( const char *format )
|
||||
@@ -136,119 +91,417 @@ static char *vevo_str_to_liblo( const char *format )
|
||||
return res;
|
||||
}
|
||||
|
||||
int generic_handler( const char *path, const char *types,
|
||||
static char make_valid_char_( const char c )
|
||||
{
|
||||
const char *invalid = " #*,?[]{}";
|
||||
int k = 0;
|
||||
char o = '_';
|
||||
char r = c;
|
||||
for( k = 0; k < 8 ; k ++ )
|
||||
{
|
||||
if ( c == invalid[k] || isspace((unsigned char)c))
|
||||
return o;
|
||||
char l = tolower(c);
|
||||
if(l)
|
||||
r = l;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
char *veejay_valid_osc_name( const char *in )
|
||||
{
|
||||
int n = strlen( in );
|
||||
int k;
|
||||
char *res = strdup( in );
|
||||
for( k = 0; k < n ; k ++ )
|
||||
{
|
||||
res[k] = make_valid_char_( in[k] );
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
void veejay_osc_del_methods( void *user_data, void *osc_space,void *vevo_port, void *fx_instance )
|
||||
{
|
||||
veejay_t *info = (veejay_t*) user_data;
|
||||
osc_recv_t *s = (osc_recv_t*) info->osc_server;
|
||||
|
||||
char **keys = vevo_list_properties( osc_space );
|
||||
int i;
|
||||
int error;
|
||||
for( i = 0; keys[i] != NULL ; i ++ )
|
||||
{
|
||||
void *event_port = NULL;
|
||||
error = vevo_property_get( osc_space, keys[i],0,&event_port );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
|
||||
void *ptr = NULL;
|
||||
error = vevo_property_get( event_port, "userdata",0, &ptr );
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
assert(error == VEVO_NO_ERROR );
|
||||
assert( ptr != NULL );
|
||||
#endif
|
||||
|
||||
char *types = get_str_vevo( event_port, "format" );
|
||||
|
||||
lo_server_thread_del_method( s->st, keys[i], types );
|
||||
|
||||
free(keys[i]);
|
||||
if(types)
|
||||
free(types);
|
||||
free(ptr);
|
||||
}
|
||||
free(keys);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//@ plugin handler!
|
||||
int osc_plugin_handler( const char *path, const char *types,
|
||||
lo_arg **argv, int argc, void *data, void *user_data )
|
||||
{
|
||||
int vims_id = 0;
|
||||
int args[16];
|
||||
double gargs[16];
|
||||
char *str[16];
|
||||
int i;
|
||||
int n = 0;
|
||||
int s = 0;
|
||||
int g = 0;
|
||||
veejay_t *info = (veejay_t*) user_data;
|
||||
osc_recv_t *st = (osc_recv_t*) info->osc_server;
|
||||
plugin_data_t *pd = (plugin_data_t*) user_data;
|
||||
veejay_t *info = pd->caller;
|
||||
|
||||
int error = vevo_property_get( st->events, path,0, &vims_id );
|
||||
|
||||
memset(str, 0, sizeof(str));
|
||||
|
||||
if( vims_id == 0 || error != VEVO_NO_ERROR)
|
||||
pthread_mutex_lock( &(info->vevo_mutex) );
|
||||
char *required_format = plug_get_osc_format( pd->instance, pd->seq );
|
||||
if( strcmp( required_format , types ) != 0 )
|
||||
{
|
||||
veejay_msg(0, "OSC path '%s' does not exist", path );
|
||||
veejay_msg(0, "Plugin Path %s wrong format '%s' , need '%s'",
|
||||
path,types, required_format );
|
||||
pthread_mutex_unlock( &(info->vevo_mutex) );
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int n_elem = strlen(required_format);
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( n_elem == argc );
|
||||
#endif
|
||||
int k;
|
||||
if( types[0] == 'i' )
|
||||
{
|
||||
int32_t *elements = (int32_t*) malloc(sizeof(int32_t) * n_elem );
|
||||
for( k = 0; k < n_elem; k ++ )
|
||||
elements[k] = argv[k]->i32;
|
||||
plug_set_parameter( pd->instance, pd->seq, n_elem, (void*)elements );
|
||||
free(elements);
|
||||
}
|
||||
else if( types[0] == 'd' )
|
||||
{
|
||||
double *elements = (double*) malloc(sizeof(double) * n_elem );
|
||||
for( k = 0; k < n_elem; k ++ )
|
||||
elements[k] = argv[k]->d;
|
||||
plug_set_parameter( pd->instance, pd->seq, n_elem, (void*) elements );
|
||||
free(elements);
|
||||
}
|
||||
else if( types[0] == 's' )
|
||||
{
|
||||
char *strs = malloc(sizeof(char*) * n_elem );
|
||||
for( k = 0; k < n_elem; k ++ )
|
||||
strs[k] = strdup( (char*) &argv[k]->s );
|
||||
plug_set_parameter( pd->instance,pd->seq, n_elem, (void*) strs );
|
||||
}
|
||||
|
||||
pthread_mutex_unlock( &(info->vevo_mutex));
|
||||
|
||||
return 0;
|
||||
}
|
||||
int osc_veejay_handler( const char *path, const char *types,
|
||||
lo_arg **argv, int argc, void *data, void *user_data )
|
||||
{
|
||||
plugin_data_t *pd = (plugin_data_t*) user_data;
|
||||
veejay_t *info = pd->caller;
|
||||
pthread_mutex_lock( &(info->vevo_mutex) );
|
||||
// format of KEY in path!!
|
||||
|
||||
if( veejay_osc_property_calls_event( pd->instance,
|
||||
path,
|
||||
types,
|
||||
argv ))
|
||||
{
|
||||
pthread_mutex_unlock( &(info->vevo_mutex));
|
||||
return 0;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock( &(info->vevo_mutex));
|
||||
return 1;
|
||||
}
|
||||
|
||||
int osc_sample_handler( const char *path, const char *types,
|
||||
lo_arg **argv, int argc, void *data, void *user_data )
|
||||
{
|
||||
plugin_data_t *pd = (plugin_data_t*) user_data;
|
||||
veejay_t *info = pd->caller;
|
||||
pthread_mutex_lock( &(info->vevo_mutex) );
|
||||
if( sample_osc_property_calls_event( pd->instance,
|
||||
path,
|
||||
types,
|
||||
argv ))
|
||||
{
|
||||
pthread_mutex_unlock( &(info->vevo_mutex) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *required_format = sample_property_format_osc( pd->instance, path );
|
||||
if(required_format == NULL )
|
||||
{
|
||||
veejay_msg(0, "Invalid path '%s'", path);
|
||||
pthread_mutex_unlock( &(info->vevo_mutex) );
|
||||
|
||||
return 1;
|
||||
}
|
||||
if( strcmp( required_format , types ) != 0 )
|
||||
{
|
||||
veejay_msg(0, "Sample Path %s wrong format '%s' , need '%s'",
|
||||
path,types, required_format );
|
||||
pthread_mutex_unlock( &(info->vevo_mutex) );
|
||||
|
||||
int vims_args = vj_event_vevo_get_num_args( vims_id );
|
||||
|
||||
char *format = vj_event_vevo_get_event_format( vims_id );
|
||||
|
||||
for( i = 0; i < argc ; i ++ )
|
||||
{
|
||||
switch(types[i])
|
||||
{
|
||||
case 'i':
|
||||
args[n++] = argv[i]->i32;
|
||||
break;
|
||||
|
||||
case 's':
|
||||
str[s++] = strdup( (char*) &argv[i]->s );
|
||||
break;
|
||||
|
||||
case 'd':
|
||||
gargs[g++] = argv[i]->d;
|
||||
break;
|
||||
|
||||
default:
|
||||
veejay_msg(0, "Skipping unknown argument type '%c' ",
|
||||
types[i]);
|
||||
break;
|
||||
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( vims_args != (n + s) )
|
||||
int n_elem = strlen(required_format);
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( n_elem == argc );
|
||||
#endif
|
||||
int k;
|
||||
if( types[0] == 'i' )
|
||||
{
|
||||
char *name = vj_event_vevo_get_event_name( vims_id );
|
||||
char *loarg = vevo_str_to_liblo(format);
|
||||
veejay_msg(0, "Wrong number of arguments for VIMS %d (%s)", vims_id, name);
|
||||
veejay_msg(0, "FORMAT is '%s' but I received '%s'", loarg, types );
|
||||
free(name);
|
||||
if(loarg) free(loarg);
|
||||
int32_t *elements = (int32_t*) malloc(sizeof(int32_t) * n_elem );
|
||||
for( k = 0; k < n_elem; k ++ )
|
||||
elements[k] = argv[k]->i32;
|
||||
sample_set_property_from_path( pd->instance, path, (void*)elements );
|
||||
free(elements);
|
||||
}
|
||||
else
|
||||
else if( types[0] == 'd' )
|
||||
{
|
||||
vj_event_fire_net_event( info,
|
||||
vims_id,
|
||||
str[0],
|
||||
args,
|
||||
n + s,
|
||||
0,
|
||||
gargs,
|
||||
g );
|
||||
double *elements = (double*) malloc(sizeof(double) * n_elem );
|
||||
for( k = 0; k < n_elem; k ++ )
|
||||
elements[k] = argv[k]->d;
|
||||
sample_set_property_from_path( pd->instance, path, (void*)elements );
|
||||
|
||||
free(elements);
|
||||
}
|
||||
if(format)
|
||||
free(format);
|
||||
else if( types[0] == 's' )
|
||||
{
|
||||
char **strs = malloc(sizeof(char*) * n_elem );
|
||||
for( k = 0; k < n_elem; k ++ )
|
||||
strs[k] = strdup( (char*) &argv[k]->s );
|
||||
sample_set_property_from_path( pd->instance, path, (void*)strs );
|
||||
}
|
||||
else if( types[0] == 'h' )
|
||||
{
|
||||
uint64_t *elements = malloc(sizeof(uint64_t) * n_elem );
|
||||
for( k = 0; k < n_elem; k ++ )
|
||||
elements[k] = argv[k]->h;
|
||||
sample_set_property_from_path( pd->instance, path, (void*) elements );
|
||||
}
|
||||
|
||||
free(required_format);
|
||||
|
||||
for( i = 0; i < 16 ; i ++ )
|
||||
if( str[i] )
|
||||
free(str[i]);
|
||||
pthread_mutex_unlock( &(info->vevo_mutex));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void veejay_osc_add_sample_generic_events(void *user_data, void *osc_port, void *vevo_port, const char *base, int fx)
|
||||
{
|
||||
veejay_t *info = (veejay_t*) user_data;
|
||||
osc_recv_t *s = (osc_recv_t*) info->osc_server;
|
||||
osc_add_sample_generic_events( s->st, user_data,osc_port,vevo_port,base,fx );
|
||||
}
|
||||
|
||||
void veejay_osc_add_sample_nonstream_events(void *user_data, void *osc_port, void *vevo_port, const char *base)
|
||||
{
|
||||
veejay_t *info = (veejay_t*) user_data;
|
||||
osc_recv_t *s = (osc_recv_t*) info->osc_server;
|
||||
osc_add_sample_nonstream_events( s->st, user_data,osc_port,vevo_port,base );
|
||||
}
|
||||
|
||||
void veejay_osc_namespace_events(void *user_data, const char *base)
|
||||
{
|
||||
veejay_t *info = (veejay_t*) user_data;
|
||||
osc_recv_t *s = (osc_recv_t*) info->osc_server;
|
||||
osc_add_veejay_events( s->st, user_data, info->osc_namespace,base );
|
||||
}
|
||||
|
||||
void *veejay_new_osc_server( void *data, const char *port )
|
||||
{
|
||||
osc_recv_t *s = (osc_recv_t*) vj_malloc(sizeof( osc_recv_t));
|
||||
s->st = lo_server_thread_new( port, error_handler );
|
||||
|
||||
s->events = vevo_port_new( VEVO_ANONYMOUS_PORT );
|
||||
|
||||
int i;
|
||||
for( i =0; osc_paths_[i].path != NULL ; i ++ )
|
||||
{
|
||||
int error =
|
||||
vevo_property_set( s->events, osc_paths_[i].path, VEVO_ATOM_TYPE_INT,1,
|
||||
&(osc_paths_[i].id) );
|
||||
lo_server_thread_add_method(
|
||||
s->st,
|
||||
NULL,
|
||||
NULL,
|
||||
generic_handler,
|
||||
data );
|
||||
veejay_msg(0, "Added '%s", osc_paths_[i].path );
|
||||
}
|
||||
lo_server_thread_start( s->st );
|
||||
|
||||
veejay_msg( 0, "OSC server ready at UDP port %d", lo_server_thread_get_port(s->st) );
|
||||
return (void*) s;
|
||||
}
|
||||
|
||||
static int servit_new_event(
|
||||
void *userdata,
|
||||
void *osc_space,
|
||||
void *instance,
|
||||
const char *base,
|
||||
const char *key,
|
||||
const char *fmt,
|
||||
const char **args,
|
||||
const char *descr,
|
||||
vevo_event_f *func,
|
||||
int extra_token,
|
||||
lo_method_handler method )
|
||||
{
|
||||
veejay_t *info = (veejay_t*) userdata;
|
||||
osc_recv_t *s = (osc_recv_t*) info->osc_server;
|
||||
#ifdef STRICT_CHECKING
|
||||
void *p = (void*) vevo_port_new( VEVO_ANONYMOUS_PORT,__FUNCTION__,__LINE__ );
|
||||
#else
|
||||
void *p = (void*) vevo_port_new( VEVO_ANONYMOUS_PORT );
|
||||
#endif
|
||||
int error;
|
||||
|
||||
if( func )
|
||||
{
|
||||
error = vevo_property_set( p, "func", VEVO_ATOM_TYPE_VOIDPTR,1,&func );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
}
|
||||
|
||||
if( fmt == NULL )
|
||||
error = vevo_property_set( p, "format", VEVO_ATOM_TYPE_STRING,0,NULL );
|
||||
else
|
||||
error = vevo_property_set( p, "format", VEVO_ATOM_TYPE_STRING,1, &fmt );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
|
||||
if( descr == NULL )
|
||||
error = vevo_property_set(p, "description",VEVO_ATOM_TYPE_STRING,0, NULL );
|
||||
else
|
||||
error = vevo_property_set(p, "description", VEVO_ATOM_TYPE_STRING,1, &descr );
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
|
||||
if( args )
|
||||
{
|
||||
int i;
|
||||
for( i = 0;i < 4; i ++ )
|
||||
{
|
||||
if(args[i])
|
||||
{
|
||||
char index[10];
|
||||
sprintf(index,"help_%d",i);
|
||||
error = vevo_property_set( p, index, VEVO_ATOM_TYPE_STRING,1,&(args[i]) );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugin_data_t *pd = (plugin_data_t*) malloc(sizeof(plugin_data_t));
|
||||
pd->seq = extra_token;
|
||||
pd->caller = userdata;
|
||||
pd->instance = instance;
|
||||
error = vevo_property_set( p,
|
||||
"userdata",
|
||||
VEVO_ATOM_TYPE_VOIDPTR,
|
||||
1,
|
||||
&pd );
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
|
||||
char *tmp_path = NULL;
|
||||
if( base)
|
||||
tmp_path = osc_create_path( base, key );
|
||||
else
|
||||
tmp_path = strdup(key);
|
||||
|
||||
char *my_path = veejay_valid_osc_name( tmp_path );
|
||||
|
||||
error = vevo_property_set( osc_space,
|
||||
my_path,
|
||||
VEVO_ATOM_TYPE_PORTPTR,
|
||||
1,
|
||||
&p );
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
|
||||
lo_server_thread_add_method(
|
||||
s->st,
|
||||
my_path,
|
||||
fmt,
|
||||
method,
|
||||
(void*) pd );
|
||||
|
||||
free(my_path);
|
||||
free(tmp_path);
|
||||
|
||||
return VEVO_NO_ERROR;
|
||||
}
|
||||
|
||||
int vevosample_new_event(
|
||||
void *userdata,
|
||||
void *osc_space,
|
||||
void *instance,
|
||||
const char *base,
|
||||
const char *key,
|
||||
const char *fmt,
|
||||
const char **args,
|
||||
const char *descr,
|
||||
vevo_event_f *func,
|
||||
int extra_token)
|
||||
{
|
||||
return servit_new_event( userdata,osc_space,instance,base,key,fmt,args,descr,func,extra_token,
|
||||
osc_sample_handler );
|
||||
}
|
||||
|
||||
int veejay_new_event(
|
||||
void *userdata,
|
||||
void *osc_space,
|
||||
void *instance,
|
||||
const char *base,
|
||||
const char *key,
|
||||
const char *fmt,
|
||||
const char **args,
|
||||
const char *descr,
|
||||
vevo_event_f *func,
|
||||
int extra_token)
|
||||
{
|
||||
return servit_new_event( userdata,osc_space,instance,base,key,fmt,args,descr,func,extra_token,
|
||||
osc_veejay_handler );
|
||||
}
|
||||
|
||||
int plugin_new_event(
|
||||
void *userdata,
|
||||
void *osc_space,
|
||||
void *instance,
|
||||
const char *base,
|
||||
const char *key,
|
||||
const char *fmt,
|
||||
const char **args,
|
||||
const char *descr,
|
||||
vevo_event_f *func,
|
||||
int extra_token)
|
||||
{
|
||||
return servit_new_event( userdata,osc_space,instance,base,key,fmt,args,descr,func,extra_token,
|
||||
osc_plugin_handler );
|
||||
}
|
||||
|
||||
void veejay_free_osc_server( void *dosc )
|
||||
{
|
||||
osc_recv_t *s = (osc_recv_t*) dosc;
|
||||
lo_server_thread_stop( s->st );
|
||||
vevo_port_free( s->events );
|
||||
lo_server_thread_free( s->st );
|
||||
// vevo_port_free( s->events );
|
||||
free(s);
|
||||
s = NULL;
|
||||
}
|
||||
|
||||
@@ -20,4 +20,43 @@
|
||||
*/
|
||||
void *veejay_new_osc_server( void *data, const char *port );
|
||||
void veejay_free_osc_server( void *dosc );
|
||||
|
||||
void veejay_osc_del_methods( void *user_data, void *osc_space,void *vevo_port, void *fx_instance );
|
||||
|
||||
int plugin_new_event(
|
||||
void *userdata,
|
||||
void *osc_space,
|
||||
void *instance,
|
||||
const char *base,
|
||||
const char *key,
|
||||
const char *fmt,
|
||||
const char **args,
|
||||
const char *descr,
|
||||
void *func,
|
||||
int extra_token);
|
||||
|
||||
int veejay_new_event(
|
||||
void *userdata,
|
||||
void *osc_space,
|
||||
void *instance,
|
||||
const char *base,
|
||||
const char *key,
|
||||
const char *fmt,
|
||||
const char **args,
|
||||
const char *descr,
|
||||
void *func,
|
||||
int extra_token);
|
||||
|
||||
|
||||
int vevosample_new_event(
|
||||
void *userdata,
|
||||
void *osc_space,
|
||||
void *instance,
|
||||
const char *base,
|
||||
const char *key,
|
||||
const char *fmt,
|
||||
const char **args,
|
||||
const char *descr,
|
||||
void *func,
|
||||
int extra_token);
|
||||
#endif
|
||||
|
||||
@@ -654,6 +654,8 @@ static int performer_fetch_frames( veejay_t *info, void *samples_needed)
|
||||
void *value = NULL;
|
||||
int error = vevo_property_get( samples_needed,fetch_list[k],0, &Sk);
|
||||
#ifdef STRICT_CHECKING
|
||||
if( error != VEVO_NO_ERROR )
|
||||
veejay_msg(0, "Error fetching '%s' , error code %d", fetch_list[k], error );
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
value = (void*) p->ref_buffer[ n_fetched ];
|
||||
@@ -860,7 +862,6 @@ static int performer_push_in_frames( void *sample, performer_t *p, int i )
|
||||
return tmp1;
|
||||
}
|
||||
|
||||
|
||||
static int performer_render_entry( veejay_t *info, void *sample, performer_t *p, int i)
|
||||
{
|
||||
int opacity = sample_get_fx_alpha( sample, i );
|
||||
@@ -950,11 +951,20 @@ int performer_queue_frame( veejay_t *info, int skip_incr )
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( info->current_sample != NULL );
|
||||
#endif
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
void *queue_list = vevo_port_new( VEVO_ANONYMOUS_PORT, __FUNCTION__ , __LINE__ );
|
||||
assert( queue_list != NULL );
|
||||
#else
|
||||
void *queue_list =
|
||||
vevo_port_new( VEVO_ANONYMOUS_PORT );//ll
|
||||
|
||||
#endif
|
||||
int i;
|
||||
int error = 0;
|
||||
|
||||
|
||||
pthread_mutex_lock( &(info->vevo_mutex));
|
||||
|
||||
if(!skip_incr)
|
||||
{
|
||||
char key[64];
|
||||
@@ -965,7 +975,8 @@ int performer_queue_frame( veejay_t *info, int skip_incr )
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//@ lock
|
||||
for( i = 0; i < SAMPLE_CHAIN_LEN; i ++ )
|
||||
{
|
||||
if( sample_process_entry( info->current_sample, i ))
|
||||
@@ -977,13 +988,20 @@ int performer_queue_frame( veejay_t *info, int skip_incr )
|
||||
#endif
|
||||
}
|
||||
}
|
||||
#ifdef STRICT_CHECKING
|
||||
p->in_frames = vevo_port_new( VEVO_ANONYMOUS_PORT, __FUNCTION__ , __LINE__ );
|
||||
#else
|
||||
/* Build reference list */
|
||||
p->in_frames = vevo_port_new( VEVO_ANONYMOUS_PORT );
|
||||
|
||||
#endif
|
||||
performer_fetch_frames( info, queue_list );
|
||||
|
||||
performer_render_frame(info, p);
|
||||
|
||||
pthread_mutex_unlock( &(info->vevo_mutex));
|
||||
|
||||
//@ unlock
|
||||
|
||||
vevo_port_free( queue_list );
|
||||
vevo_port_free( p->in_frames );
|
||||
p->in_frames = NULL;
|
||||
|
||||
@@ -345,8 +345,8 @@ int main(int argc, char **argv)
|
||||
|
||||
if( dump_ )
|
||||
{
|
||||
vj_init_vevo_events();
|
||||
vj_event_vevo_dump();
|
||||
// vj_init_vevo_events();
|
||||
// vj_event_vevo_dump();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -115,17 +115,17 @@ typedef struct
|
||||
int audio;
|
||||
void *display;
|
||||
|
||||
void *status_socket;
|
||||
void *command_socket;
|
||||
void *frame_socket;
|
||||
void *mcast_socket;
|
||||
// void *status_socket;
|
||||
// void *command_socket;
|
||||
// void *frame_socket;
|
||||
// void *mcast_socket;
|
||||
void *osc_server;
|
||||
|
||||
void *osc_namespace;
|
||||
int current_link;
|
||||
int port_offset;
|
||||
int use_display;
|
||||
void *sdl_display;
|
||||
pthread_mutex_t display_mutex;
|
||||
pthread_mutex_t vevo_mutex;
|
||||
|
||||
int itu601;
|
||||
char message[256];
|
||||
|
||||
@@ -26,113 +26,79 @@
|
||||
*/
|
||||
|
||||
enum {
|
||||
VIMS_BUNDLE_START = 500,
|
||||
VIMS_BUNDLE_END = 599,
|
||||
VIMS_MAX = 702,
|
||||
VIMS_MAX = 650,
|
||||
};
|
||||
|
||||
enum {
|
||||
/* query information */
|
||||
VIMS_EFFECT_LIST = 401,
|
||||
VIMS_EDITLIST_LIST = 402,
|
||||
VIMS_BUNDLE_LIST = 403,
|
||||
VIMS_STREAM_DEVICES = 406,
|
||||
VIMS_SAMPLE_LIST = 408,
|
||||
VIMS_CHAIN_GET_ENTRY = 410,
|
||||
VIMS_VIMS_LIST = 411,
|
||||
VIMS_LOG = 412,
|
||||
VIMS_SAMPLE_INFO = 413,
|
||||
/* general controls */
|
||||
VIMS_FULLSCREEN = 301,
|
||||
VIMS_FULLSCREEN = 40,
|
||||
VIMS_QUIT = 600,
|
||||
VIMS_RECORD_DATAFORMAT = 302,
|
||||
VIMS_AUDIO_SET_ACTIVE = 306,
|
||||
VIMS_REC_AUTO_START = 320,
|
||||
VIMS_REC_STOP = 321,
|
||||
VIMS_REC_START = 322,
|
||||
VIMS_BEZERK = 324,
|
||||
VIMS_DEBUG_LEVEL = 325,
|
||||
VIMS_RESIZE_SCREEN = 326,
|
||||
VIMS_SCREENSHOT = 330,
|
||||
VIMS_RGB24_IMAGE = 333,
|
||||
|
||||
/* video controls */
|
||||
VIMS_SAMPLE_PLAY_FORWARD = 10,
|
||||
VIMS_SAMPLE_PLAY_BACKWARD = 11,
|
||||
VIMS_SAMPLE_PLAY_STOP = 12,
|
||||
VIMS_SAMPLE_SKIP_FRAME = 13,
|
||||
VIMS_SAMPLE_PREV_FRAME = 14,
|
||||
VIMS_SAMPLE_SKIP_SECOND = 15,
|
||||
VIMS_SAMPLE_PREV_SECOND = 16,
|
||||
VIMS_SAMPLE_GOTO_START = 17,
|
||||
VIMS_SAMPLE_GOTO_END = 18,
|
||||
VIMS_SAMPLE_SET_FRAME = 19,
|
||||
VIMS_SAMPLE_SET_SPEED = 20,
|
||||
VIMS_SAMPLE_SET_SLOW = 21,
|
||||
/* editlist commands */
|
||||
|
||||
VIMS_BEZERK = 11,
|
||||
VIMS_DEBUG_LEVEL = 12,
|
||||
VIMS_RESIZE_SCREEN = 41,
|
||||
VIMS_SCREENSHOT = 13,
|
||||
VIMS_SAMPLE_NEW = 100,
|
||||
VIMS_SAMPLE_SELECT = 101,
|
||||
VIMS_SAMPLE_DEL = 120,
|
||||
VIMS_SAMPLE_SET_PROPERTIES = 103,
|
||||
VIMS_SAMPLE_LOAD = 125,
|
||||
VIMS_SAMPLE_SAVE = 126,
|
||||
VIMS_SAMPLE_DEL_ALL = 121,
|
||||
VIMS_SAMPLE_COPY = 127,
|
||||
VIMS_SAMPLE_REC_START = 130,
|
||||
VIMS_SAMPLE_REC_STOP = 131,
|
||||
VIMS_SAMPLE_CHAIN_ACTIVE = 112,
|
||||
VIMS_SAMPLE_SET_VOLUME = 132,
|
||||
VIMS_SAMPLE_EDL_PASTE_AT = 50,
|
||||
VIMS_SAMPLE_EDL_COPY = 51,
|
||||
VIMS_SAMPLE_EDL_DEL = 52,
|
||||
VIMS_SAMPLE_EDL_CROP = 53,
|
||||
VIMS_SAMPLE_EDL_CUT = 54,
|
||||
VIMS_SAMPLE_EDL_ADD = 55,
|
||||
VIMS_SAMPLE_EDL_SAVE = 58,
|
||||
VIMS_SAMPLE_EDL_LOAD = 59,
|
||||
VIMS_SAMPLE_EDL_EXPORT = 56,
|
||||
VIMS_SAMPLE_DEL = 102,
|
||||
VIMS_SAMPLE_COPY = 103,
|
||||
VIMS_SAMPLE_LOAD = 104,
|
||||
VIMS_SAMPLE_SAVE = 105,
|
||||
|
||||
VIMS_SAMPLE_PLAY_FORWARD = 110,
|
||||
VIMS_SAMPLE_PLAY_BACKWARD = 111,
|
||||
VIMS_SAMPLE_PLAY_STOP = 112,
|
||||
VIMS_SAMPLE_SKIP_FRAME = 113,
|
||||
VIMS_SAMPLE_PREV_FRAME = 114,
|
||||
VIMS_SAMPLE_SKIP_SECOND = 115,
|
||||
VIMS_SAMPLE_PREV_SECOND = 116,
|
||||
VIMS_SAMPLE_GOTO_START = 117,
|
||||
VIMS_SAMPLE_GOTO_END = 118,
|
||||
VIMS_SAMPLE_SET_FRAME = 119,
|
||||
VIMS_SAMPLE_SET_SPEED = 120,
|
||||
VIMS_SAMPLE_SET_SLOW = 121,
|
||||
VIMS_SAMPLE_SET_PROPERTIES = 123,
|
||||
VIMS_SAMPLE_EDL_PASTE_AT = 150,
|
||||
VIMS_SAMPLE_EDL_COPY = 151,
|
||||
VIMS_SAMPLE_EDL_DEL = 152,
|
||||
VIMS_SAMPLE_EDL_CROP = 153,
|
||||
VIMS_SAMPLE_EDL_CUT = 154,
|
||||
VIMS_SAMPLE_EDL_ADD = 155,
|
||||
VIMS_SAMPLE_EDL_SAVE = 158,
|
||||
VIMS_SAMPLE_EDL_LOAD = 159,
|
||||
VIMS_SAMPLE_EDL_EXPORT = 156,
|
||||
VIMS_SAMPLE_CHAIN_SET_ACTIVE = 130,
|
||||
VIMS_SAMPLE_CHAIN_CLEAR = 131,
|
||||
VIMS_SAMPLE_CHAIN_LIST = 132,
|
||||
VIMS_SAMPLE_CHAIN_SET_ENTRY = 133,
|
||||
VIMS_SAMPLE_CHAIN_ENTRY_SET_FX = 134,
|
||||
VIMS_SAMPLE_CHAIN_ENTRY_SET_PRESET = 135,
|
||||
VIMS_SAMPLE_CHAIN_ENTRY_SET_ACTIVE = 136,
|
||||
VIMS_SAMPLE_CHAIN_ENTRY_SET_VALUE = 137,
|
||||
VIMS_SAMPLE_CHAIN_ENTRY_SET_INPUT = 138,
|
||||
VIMS_SAMPLE_CHAIN_ENTRY_CLEAR = 139,
|
||||
VIMS_SAMPLE_ATTACH_OUT_PARAMETER = 180,
|
||||
VIMS_SAMPLE_DETACH_OUT_PARAMETER = 181,
|
||||
|
||||
VIMS_SAMPLE_CHAIN_SET_ACTIVE = 353,
|
||||
VIMS_SAMPLE_CHAIN_CLEAR = 355,
|
||||
VIMS_SAMPLE_CHAIN_LIST = 358,
|
||||
VIMS_SAMPLE_CHAIN_SET_ENTRY = 359,
|
||||
VIMS_SAMPLE_CHAIN_ENTRY_SET_FX = 360,
|
||||
VIMS_SAMPLE_CHAIN_ENTRY_SET_PRESET = 361,
|
||||
VIMS_SAMPLE_CHAIN_ENTRY_SET_ACTIVE = 363,
|
||||
VIMS_SAMPLE_CHAIN_ENTRY_SET_VALUE = 366,
|
||||
VIMS_SAMPLE_CHAIN_ENTRY_SET_INPUT = 367,
|
||||
VIMS_SAMPLE_CHAIN_ENTRY_CLEAR = 369,
|
||||
VIMS_SAMPLE_CHAIN_ENTRY_SET_ALPHA = 370,
|
||||
|
||||
VIMS_SAMPLE_CHAIN_ENTRY_SET_STATE = 377,
|
||||
VIMS_SAMPLE_ATTACH_OUT_PARAMETER = 378,
|
||||
VIMS_SAMPLE_DETACH_OUT_PARAMETER = 379,
|
||||
VIMS_SAMPLE_BIND_OUTP_OSC = 190,
|
||||
VIMS_SAMPLE_RELEASE_OUTP_OSC = 191,
|
||||
VIMS_SAMPLE_OSC_START = 192,
|
||||
VIMS_SAMPLE_OSC_STOP = 193,
|
||||
|
||||
VIMS_SAMPLE_BIND_OUTP_OSC = 380,
|
||||
VIMS_SAMPLE_RELEASE_OUTP_OSC = 381,
|
||||
VIMS_SAMPLE_OSC_START = 382,
|
||||
VIMS_SAMPLE_OSC_STOP = 383,
|
||||
|
||||
VIMS_SAMPLE_CONFIGURE_RECORDER = 390,
|
||||
VIMS_SAMPLE_START_RECORDER = 391,
|
||||
VIMS_SAMPLE_STOP_RECORDER = 392,
|
||||
VIMS_SAMPLE_CONFIGURE_RECORDER = 124,
|
||||
VIMS_SAMPLE_START_RECORDER = 125,
|
||||
VIMS_SAMPLE_STOP_RECORDER = 126,
|
||||
|
||||
VIMS_PERFORMER_SETUP_PREVIEW = 400,
|
||||
VIMS_PERFORMER_GET_PREVIEW = 401,
|
||||
VIMS_PERFORMER_SETUP_PREVIEW = 20,
|
||||
VIMS_PERFORMER_GET_PREVIEW = 21,
|
||||
|
||||
VIMS_SAMPLEBANK_LIST = 402,
|
||||
VIMS_SAMPLEBANK_ADD = 403,
|
||||
VIMS_SAMPLEBANK_DEL = 404,
|
||||
VIMS_FX_LIST = 405,
|
||||
VIMS_FX_DETAILS = 406,
|
||||
VIMS_FX_CURRENT_DETAILS = 407,
|
||||
VIMS_FX_CHAIN = 408,
|
||||
VIMS_SAMPLEBANK_LIST = 1,
|
||||
VIMS_SAMPLEBANK_ADD = 2,
|
||||
VIMS_SAMPLEBANK_DEL = 3,
|
||||
|
||||
VIMS_GET_FRAME = 42,
|
||||
VIMS_GET_FRAME = 5,
|
||||
|
||||
VIMS_SET_PORT = 650,
|
||||
VIMS_GET_PORT = 649,
|
||||
VIMS_SET_PORT = 99,
|
||||
VIMS_GET_PORT = 97,
|
||||
|
||||
};
|
||||
#endif
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Linux VeeJay
|
||||
*
|
||||
* Copyright(C)2002-2004 Niels Elburg <nelburg@looze.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License , or (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
*/
|
||||
|
||||
#ifndef VJ_EVENT_H
|
||||
#define VJ_EVENT_H
|
||||
#include <config.h>
|
||||
#ifdef HAVE_XML2
|
||||
#include <libxml/xmlmemory.h>
|
||||
#include <libxml/parser.h>
|
||||
#endif
|
||||
|
||||
void vj_event_fmt_arg ( int *args, char *str, const char format[], va_list ap);
|
||||
void vj_event_init ();
|
||||
void vj_event_print_range ( int n1, int n2);
|
||||
#ifdef HAVE_SDL
|
||||
#ifdef HAVE_XML2
|
||||
void vj_event_xml_new_keyb_event ( void *v, xmlDocPtr doc, xmlNodePtr cur );
|
||||
#endif
|
||||
#endif
|
||||
void vj_event_update_remote(void *ptr);
|
||||
void vj_event_dump(void);
|
||||
void vj_event_chain_clear ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_el_copy ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_el_crop ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_el_cut ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_el_del ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_el_paste_at ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_el_load_editlist ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_el_save_editlist ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_el_add_video ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_goto_end ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_goto_start ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_inc_frame ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_dec_frame ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_next_second ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_none ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_play_forward ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_play_reverse ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_play_speed ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_play_repeat(void *ptr, const char format[], va_list ap);
|
||||
void vj_event_play_stop ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_prev_second ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_sample_copy ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_sample_del ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_sample_select ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_set_property ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_get_property ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_set_frame ( void *ptr, const char format[], va_list ap );
|
||||
#ifdef USE_DISPLAY
|
||||
void vj_event_set_screen_size ( void *ptr, const char format[], va_list ap );
|
||||
#endif
|
||||
void vj_event_sample_new ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_quit ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_set_volume ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_debug_level ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_bezerk ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_fullscreen ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_chain_entry_set_active ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_chain_entry_set ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_chain_entry_clear ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_chain_entry_set_parameter_value( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_chain_entry_set_input ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_chain_entry_set_alpha ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_sample_attach_out_parameter ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_sample_detach_out_parameter ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_sample_configure_recorder ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_sample_start_recorder ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_sample_stop_recorder ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_performer_configure_preview ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_performer_get_preview_image ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_samplebank_list ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_samplebank_add ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_samplebank_del ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_fx_list ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_fx_info ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_sample_fx_details ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_sample_fx_chain ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_sample_bind_outp_osc ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_sample_release_outp_osc ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_sample_start_osc_sender ( void *ptr, const char format[], va_list ap );
|
||||
void vj_event_sample_stop_osc_sender ( void *ptr, const char format[], va_list ap );
|
||||
#endif
|
||||
File diff suppressed because it is too large
Load Diff
@@ -130,6 +130,7 @@ typedef struct
|
||||
samplerecord_t *record;
|
||||
sampleinfo_t *info;
|
||||
void *osc;
|
||||
void *user_data;
|
||||
} sample_runtime_data;
|
||||
|
||||
|
||||
@@ -142,7 +143,7 @@ typedef struct
|
||||
|
||||
|
||||
/* forward */
|
||||
static void sample_fx_clean_up( void *port );
|
||||
static void sample_fx_clean_up( void *port, void *user_data );
|
||||
static void *sample_get_fx_port_values_ptr( int id, int fx_entry );
|
||||
static void sample_expand_properties( void *sample, const char *key, xmlNodePtr root );
|
||||
static void sample_expand_port( void *port, xmlNodePtr node );
|
||||
@@ -163,6 +164,26 @@ static void sample_new_fx_chain(void *sample);
|
||||
* to reduce vevo set/get , cache each step */
|
||||
|
||||
|
||||
static struct
|
||||
{
|
||||
const char *name;
|
||||
} protected_properties[] =
|
||||
{
|
||||
"type",
|
||||
"audio_spas",
|
||||
"bits",
|
||||
"rate",
|
||||
"has_audio",
|
||||
"channels",
|
||||
"fx_osc",
|
||||
"primary_key",
|
||||
"fps",
|
||||
"bps",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
int compare_elements( char **p1, char **p2 ) { return strcoll(*p1,*p2); }
|
||||
|
||||
|
||||
void trap_vevo_sample() {}
|
||||
@@ -370,12 +391,31 @@ static void free_slot(int key)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int sample_property_is_protected( void *sample , const char *key )
|
||||
{
|
||||
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||
|
||||
int i;
|
||||
for( i = 0; protected_properties[i].name != NULL ;i ++ )
|
||||
{
|
||||
if(strcasecmp(key,protected_properties[i].name ) == 0 )
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sample_get_key_ptr( void *info )
|
||||
{
|
||||
if(!info)
|
||||
return 0;
|
||||
int pk = 0;
|
||||
sample_runtime_data *srd = (sample_runtime_data*) info;
|
||||
|
||||
int error = vevo_property_get( srd->info_port, "primary_key", 0, &pk );
|
||||
#ifdef STRICT_CHECKING
|
||||
if( error != VEVO_NO_ERROR )
|
||||
veejay_msg(0, "primary_key does not exist, error %d",error);
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
return pk;
|
||||
@@ -394,7 +434,15 @@ void sample_delete_ptr( void *info )
|
||||
int pk = 0;
|
||||
int error = vevo_property_get( srd->info_port, "primary_key", 0, &pk );
|
||||
|
||||
sample_fx_clean_up( srd->info_port );
|
||||
void *osc_space = NULL;
|
||||
error = vevo_property_get( srd->info_port, "HOST_osc",0,&osc_space );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
|
||||
veejay_osc_del_methods( srd->user_data, osc_space,srd->info_port ,srd);
|
||||
|
||||
sample_fx_clean_up( srd->info_port, srd->user_data );
|
||||
|
||||
sample_close( srd );
|
||||
|
||||
@@ -402,6 +450,7 @@ void sample_delete_ptr( void *info )
|
||||
|
||||
free_slot( pk );
|
||||
free(srd->info);
|
||||
free(srd->record);
|
||||
free(srd);
|
||||
|
||||
if( error == VEVO_NO_ERROR )
|
||||
@@ -421,7 +470,7 @@ void sample_fx_chain_reset( void *sample )
|
||||
{
|
||||
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||
|
||||
sample_fx_clean_up( srd->info_port );
|
||||
sample_fx_clean_up( srd->info_port,srd->user_data );
|
||||
|
||||
sample_new_fx_chain ( srd->info_port );
|
||||
}
|
||||
@@ -451,6 +500,8 @@ int sample_fx_set( void *info, int fx_entry, const int new_fx )
|
||||
void *port = sample_get_fx_port_ptr( info,fx_entry );
|
||||
void *fx_values = NULL;
|
||||
void *fx_channels = NULL;
|
||||
sample_runtime_data *srd = (sample_runtime_data*) info;
|
||||
|
||||
//int cur_fx_id = 0;
|
||||
int error;
|
||||
#ifdef STRICT_CHECKING
|
||||
@@ -510,12 +561,184 @@ int sample_fx_set( void *info, int fx_entry, const int new_fx )
|
||||
|
||||
|
||||
veejay_msg(0, "Entry %d Plug %d has %d Inputs, %d Outputs",fx_entry, new_fx,n_channels,o_channels );
|
||||
|
||||
|
||||
//@ setup OSC namespace
|
||||
int pk = 0;
|
||||
vevo_property_get( srd->info_port, "primary_key", 0, &pk );
|
||||
|
||||
plug_build_name_space( new_fx, fx_instance, srd->user_data, fx_entry ,pk);
|
||||
//@ FIXME: get default channel configuration
|
||||
// plug_get_channels( fx_instance, fx_channels );
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sample_osc_verify_format( void *vevo_port, char const *types )
|
||||
{
|
||||
char *format = get_str_vevo( vevo_port, "format" );
|
||||
int n = strlen(types);
|
||||
if(!format)
|
||||
{
|
||||
if( n == 0 && format == NULL )
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
if( strcasecmp( types,format ) == 0 )
|
||||
{
|
||||
free(format);
|
||||
return 1;
|
||||
}
|
||||
free(format);
|
||||
return 0;
|
||||
}
|
||||
static void sample_osc_print( void *osc_port )
|
||||
{
|
||||
char **osc_events = vevo_list_properties ( osc_port );
|
||||
int i,k,n=0;
|
||||
|
||||
for( i = 0; osc_events[i] != NULL ; i ++ )
|
||||
{
|
||||
void *osc_info = NULL;
|
||||
int error = vevo_property_get( osc_port, osc_events[i], 0, &osc_info );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
char *format = get_str_vevo( osc_info, "format" );
|
||||
|
||||
veejay_msg(VEEJAY_MSG_INFO, "OSC PATH %s",osc_events[i] );
|
||||
char *descr = get_str_vevo( osc_info, "description" );
|
||||
if(descr)
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_INFO,"\t%s", descr);
|
||||
free(descr);
|
||||
}
|
||||
|
||||
veejay_msg(VEEJAY_MSG_INFO, "\tFormat=%s", format );
|
||||
|
||||
|
||||
if(format)
|
||||
{
|
||||
int n_args = strlen(format);
|
||||
char key[10];
|
||||
int j;
|
||||
for( j = 0; j < n_args ; j ++ )
|
||||
{
|
||||
sprintf(key, "help_%d", j );
|
||||
char *help_str = get_str_vevo( osc_info, key );
|
||||
if(help_str)
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_INFO,"\t\tArgument %d : %s", j, help_str );
|
||||
free(help_str);
|
||||
}
|
||||
}
|
||||
free(format);
|
||||
}
|
||||
veejay_msg(VEEJAY_MSG_INFO,"\t");
|
||||
free( osc_events[i]);
|
||||
}
|
||||
free(osc_events);
|
||||
|
||||
}
|
||||
void sample_osc_namespace(void *sample)
|
||||
{
|
||||
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||
|
||||
void *osc_namespace = NULL;
|
||||
int error = vevo_property_get( srd->info_port, "HOST_osc",0, &osc_namespace);
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
veejay_msg(VEEJAY_MSG_INFO,"OSC namespace:");
|
||||
|
||||
sample_osc_print( osc_namespace );
|
||||
|
||||
veejay_msg(VEEJAY_MSG_INFO,"FX:");
|
||||
int k;
|
||||
for( k = 0; k < SAMPLE_CHAIN_LEN ; k ++ )
|
||||
{
|
||||
void *port = sample_get_fx_port_ptr( srd, k );
|
||||
void *fx_instance = NULL;
|
||||
error = vevo_property_get( port, "fx_instance", 0, &fx_instance );
|
||||
if( error == VEVO_NO_ERROR )
|
||||
{
|
||||
void *space = plug_get_name_space( fx_instance );
|
||||
if(space) sample_osc_print( space );
|
||||
}
|
||||
}
|
||||
veejay_msg(VEEJAY_MSG_INFO,"End of OSC namespace");
|
||||
}
|
||||
|
||||
|
||||
void sample_osc_help( void *sample, const char *path )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int sample_extract_fx_entry_from_path(void *sample, const char *path )
|
||||
{
|
||||
char *my_path = strdup(path);
|
||||
char *token = strtok( my_path, "/");
|
||||
|
||||
char *res = NULL;
|
||||
while( (res = strtok(NULL, "/" ) ))
|
||||
{
|
||||
if(strncasecmp( res, "fx_", 3 ) == 0 )
|
||||
{
|
||||
int id = 0;
|
||||
if(sscanf( res+3,"%d", &id ) == 1 )
|
||||
return id;
|
||||
}
|
||||
}
|
||||
|
||||
free(my_path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
int sample_osc_property_calls_event( void *sample, const char *path, char *types, void **argv[] )
|
||||
{
|
||||
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||
void *vevo_port = srd->info_port;
|
||||
void *osc_port = NULL;
|
||||
int error = vevo_property_get( srd->info_port, "HOST_osc", 0, &osc_port );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
int atom_type = vevo_property_atom_type( osc_port, path );
|
||||
if( atom_type == VEVO_ATOM_TYPE_PORTPTR )
|
||||
{
|
||||
// veejay_msg(0, "path %s is PORTPTR", path );
|
||||
void *port = NULL;
|
||||
error = vevo_property_get( osc_port, path,0,&port );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
if(error == VEVO_NO_ERROR )
|
||||
{
|
||||
vevo_event_f f;
|
||||
//veejay_msg(0, "verify '%s' : %p, types %s, instance=%p", path,port, types,sample);
|
||||
|
||||
|
||||
// char *format = get_str_vevo( port, "format" );
|
||||
//veejay_msg(0, "format is %s", format);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if( sample_osc_verify_format( port, types ) )
|
||||
{
|
||||
error = vevo_property_get( port, "func",0,&f );
|
||||
if( error == VEVO_NO_ERROR )
|
||||
{
|
||||
(*f)( sample, path,types, argv );
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int sample_fx_set_in_channel( void *info, int fx_entry, int seq_num, const int sample_id )
|
||||
{
|
||||
void *port = sample_get_fx_port_ptr( info, fx_entry );
|
||||
@@ -595,6 +818,7 @@ int sample_process_entry( void *data, int fx_entry )
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
|
||||
return fx_status;
|
||||
}
|
||||
int sample_get_fx_alpha( void *data, int fx_entry )
|
||||
@@ -721,6 +945,7 @@ int sample_process_fx( void *sample, int fx_entry )
|
||||
void *fx_out_values = NULL;
|
||||
|
||||
void *port = sample_get_fx_port_ptr( sample,fx_entry );
|
||||
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( port != NULL );
|
||||
#endif
|
||||
@@ -750,8 +975,9 @@ int sample_process_fx( void *sample, int fx_entry )
|
||||
|
||||
sample_apply_bind( sample, port );
|
||||
|
||||
if(srd->osc)
|
||||
//@ send osc message if needed
|
||||
sample_send_osc_path( sample, port );
|
||||
sample_send_osc_path( sample, port );
|
||||
|
||||
|
||||
return VEVO_NO_ERROR;
|
||||
@@ -837,14 +1063,15 @@ void *sample_get_fx_port( int id, int fx_entry )
|
||||
{
|
||||
return sample_get_fx_port_ptr( find_sample(id),fx_entry );
|
||||
}
|
||||
void sample_set_property_ptr( void *ptr, const char *key, int atom_type, void *value )
|
||||
int sample_set_property_ptr( void *ptr, const char *key, int atom_type, void *value )
|
||||
{
|
||||
sample_runtime_data *info = (sample_runtime_data*) ptr;
|
||||
if( info->type == VJ_TAG_TYPE_CAPTURE)
|
||||
{
|
||||
vj_unicap_select_value( info->data,key, atom_type,value );
|
||||
return VEVO_NO_ERROR;
|
||||
}
|
||||
vevo_property_set( info->info_port, key, atom_type,1, value );
|
||||
return vevo_property_set( info->info_port, key, atom_type,1, value );
|
||||
}
|
||||
|
||||
void sample_set_property( int id, const char *key, int atom_type, void *value )
|
||||
@@ -858,12 +1085,141 @@ void sample_set_property( int id, const char *key, int atom_type, void *value )
|
||||
vevo_property_set( info->info_port, key, atom_type,1, value );
|
||||
}
|
||||
|
||||
static char *strip_key( const char *path)
|
||||
{
|
||||
char *start = strdup(path);
|
||||
int k = strlen(path);
|
||||
int i;
|
||||
int n = 0;
|
||||
char *token = strtok( start, "/" );
|
||||
char *s = start;
|
||||
char *res = NULL;
|
||||
while( (token = strtok( NULL, "/" ) ) != NULL )
|
||||
{
|
||||
if(res && token)
|
||||
free(res);
|
||||
res = strdup(token);
|
||||
}
|
||||
free(start);
|
||||
return res;
|
||||
}
|
||||
|
||||
static char *strip_port( const char *path)
|
||||
{
|
||||
char *start = strdup(path);
|
||||
int k = strlen(path);
|
||||
int i;
|
||||
int n = 0;
|
||||
char *token = strtok( start, "/" );
|
||||
char *s = start;
|
||||
char *res = NULL;
|
||||
char *port = NULL;
|
||||
while( (token = strtok( NULL, "/" ) ) != NULL )
|
||||
{
|
||||
if(res)
|
||||
{
|
||||
if(port)
|
||||
free(port);
|
||||
port = strdup(res);
|
||||
free(res);
|
||||
res= NULL;
|
||||
}
|
||||
res = strdup(token);
|
||||
}
|
||||
free(start);
|
||||
if(res) free(res);
|
||||
return port;
|
||||
}
|
||||
|
||||
void sample_set_property_from_path( void *sample, const char *path, void *value )
|
||||
{
|
||||
sample_runtime_data *info = (sample_runtime_data*) sample;
|
||||
int len = strlen(path);
|
||||
int n = 0;
|
||||
int i;
|
||||
int error;
|
||||
for( i =0; i < len ; i ++ )
|
||||
if( path[i] == '/' )
|
||||
n++;
|
||||
|
||||
char *key = strip_key( path );
|
||||
if(!key)
|
||||
{
|
||||
veejay_msg(0, "Error getting key from path '%s'", path );
|
||||
return;
|
||||
}
|
||||
//@ TYPE CAPTURE !
|
||||
int atom_type = vevo_property_atom_type( info->info_port, key );
|
||||
if( n == 3 )
|
||||
{
|
||||
char *pk = strip_port(path);
|
||||
void *port = NULL;
|
||||
int error = vevo_property_get( info->info_port, pk, 0, &port );
|
||||
if( port && error == VEVO_NO_ERROR)
|
||||
{
|
||||
atom_type = vevo_property_atom_type( port , key );
|
||||
if(atom_type)
|
||||
{
|
||||
error = vevo_property_set( port,key, atom_type,1, value );
|
||||
if( error == VEVO_NO_ERROR )
|
||||
veejay_msg(VEEJAY_MSG_INFO,
|
||||
"OSC path '%s' sets property '%s' %d", path, key,atom_type );
|
||||
if(pk) free(pk);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(pk)
|
||||
free(pk);
|
||||
return;
|
||||
}
|
||||
else if (n == 2 )
|
||||
{
|
||||
int error = vevo_property_get( info->info_port, key, 0, NULL );
|
||||
|
||||
if( error != VEVO_ERROR_PROPERTY_EMPTY && error != VEVO_NO_ERROR )
|
||||
{
|
||||
veejay_msg(0, "Unable to get property '%s'",key);
|
||||
if(key)
|
||||
free(key);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
if( info->type == VJ_TAG_TYPE_CAPTURE)
|
||||
{
|
||||
veejay_msg(0,"Warning 'key %s' may not be valid", key );
|
||||
//@ can make translation map in unicap -> key -> key pairs
|
||||
vj_unicap_select_value( info->data,key, VEVO_ATOM_TYPE_DOUBLE,value );
|
||||
}
|
||||
|
||||
if(info)
|
||||
error = vevo_property_set( info->info_port,key, atom_type,1, value );
|
||||
if( error == VEVO_NO_ERROR )
|
||||
veejay_msg(VEEJAY_MSG_INFO,
|
||||
"OSC path '%s' sets property '%s' %d", path, key,atom_type );
|
||||
|
||||
free(key);
|
||||
}
|
||||
|
||||
|
||||
void sample_get_property( int id, const char *key, void *dst )
|
||||
{
|
||||
sample_runtime_data *info = (sample_runtime_data*) find_sample( id );
|
||||
if(info)
|
||||
vevo_property_get( info->info_port, key, 0, dst );
|
||||
}
|
||||
|
||||
//@ only call after sample_new(),
|
||||
void sample_set_user_data( void *sample, void *data, int id )
|
||||
{
|
||||
sample_runtime_data *info = (sample_runtime_data*) sample;
|
||||
info->user_data = data;
|
||||
sample_init_namespace( data, sample, id );
|
||||
|
||||
}
|
||||
|
||||
void sample_get_property_ptr( void *ptr, const char *key, void *dst )
|
||||
{
|
||||
sample_runtime_data *info = (sample_runtime_data*) ptr;
|
||||
@@ -957,7 +1313,7 @@ const char *sample_describe_type( int type )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void sample_fx_entry_clean_up( void *sample, int id )
|
||||
static void sample_fx_entry_clean_up( void *sample, int id, void *user_data )
|
||||
{
|
||||
char entry_key[KEY_LEN];
|
||||
void *entry_port = NULL;
|
||||
@@ -970,8 +1326,12 @@ static void sample_fx_entry_clean_up( void *sample, int id )
|
||||
void *instance = NULL;
|
||||
error = vevo_property_get( entry_port, "fx_instance",0,&instance );
|
||||
if(error == VEVO_NO_ERROR )
|
||||
{
|
||||
// delete OSC space
|
||||
plug_clear_namespace( instance, user_data );
|
||||
|
||||
plug_deactivate( instance );
|
||||
|
||||
}
|
||||
void *fxv = NULL;
|
||||
error = vevo_property_get( entry_port, "fx_values",0,&fxv );
|
||||
#ifdef STRICT_CHECKING
|
||||
@@ -983,10 +1343,11 @@ static void sample_fx_entry_clean_up( void *sample, int id )
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
|
||||
vevo_port_free( fxv );
|
||||
vevo_port_free( fxc );
|
||||
vevo_port_free( entry_port );
|
||||
// vevo_port_free( fxv );
|
||||
// vevo_port_free( fxc );
|
||||
// vevo_port_free( entry_port );
|
||||
|
||||
vevo_port_recursive_free( entry_port );
|
||||
|
||||
error = vevo_property_set( sample, entry_key, VEVO_ATOM_TYPE_PORTPTR, 0, NULL );
|
||||
#ifdef STRICT_CHECKING
|
||||
@@ -995,19 +1356,24 @@ static void sample_fx_entry_clean_up( void *sample, int id )
|
||||
|
||||
}
|
||||
|
||||
static void sample_fx_clean_up( void *sample )
|
||||
static void sample_fx_clean_up( void *sample, void *user_data )
|
||||
{
|
||||
int i;
|
||||
int error;
|
||||
for( i = 0 ; i < SAMPLE_CHAIN_LEN; i ++ )
|
||||
{
|
||||
sample_fx_entry_clean_up( sample,i );
|
||||
sample_fx_entry_clean_up( sample,i,user_data );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void sample_new_fx_chain_entry( void *sample, int id )
|
||||
{
|
||||
#ifdef STRICT_CHECKING
|
||||
void *port = vevo_port_new( VEVO_FX_ENTRY_PORT,__FUNCTION__,__LINE__ );
|
||||
#else
|
||||
void *port = vevo_port_new( VEVO_FX_ENTRY_PORT );
|
||||
#endif
|
||||
char entry_key[KEY_LEN];
|
||||
|
||||
sprintf(entry_key, "fx_%x", id );
|
||||
@@ -1016,10 +1382,20 @@ static void sample_new_fx_chain_entry( void *sample, int id )
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
double alpha = 0.0;
|
||||
error = vevo_property_set( port, "fx_alpha", VEVO_ATOM_TYPE_DOUBLE,1,&alpha );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
#ifdef STRICT_CHECKING
|
||||
void *fx_values = vevo_port_new( VEVO_FX_VALUES_PORT, __FUNCTION__,__LINE__ );
|
||||
void *fx_channels = vevo_port_new( VEVO_ANONYMOUS_PORT, __FUNCTION__,__LINE__ );
|
||||
void *fx_out_values = vevo_port_new( VEVO_ANONYMOUS_PORT, __FUNCTION__,__LINE__ );
|
||||
#else
|
||||
void *fx_values = vevo_port_new( VEVO_FX_VALUES_PORT );
|
||||
void *fx_channels = vevo_port_new( VEVO_ANONYMOUS_PORT );
|
||||
void *fx_out_values = vevo_port_new( VEVO_ANONYMOUS_PORT );
|
||||
|
||||
#endif
|
||||
error = vevo_property_set( port, "fx_values", VEVO_ATOM_TYPE_PORTPTR,1,&fx_values);
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
@@ -1060,7 +1436,7 @@ int sample_fx_chain_entry_clear(void *info, int id )
|
||||
|
||||
if( id >= 0 && id < SAMPLE_CHAIN_LEN )
|
||||
{
|
||||
sample_fx_entry_clean_up( sample->info_port, id );
|
||||
sample_fx_entry_clean_up( sample->info_port, id,sample->user_data );
|
||||
sample_new_fx_chain_entry( sample->info_port, id );
|
||||
return 1;
|
||||
}
|
||||
@@ -1078,8 +1454,11 @@ void *sample_new( int type )
|
||||
rtdata->record = (samplerecord_t*) vj_malloc(sizeof(samplerecord_t));
|
||||
memset(rtdata->record,0,sizeof(samplerecord_t));
|
||||
rtdata->type = type;
|
||||
#ifdef STRICT_CHECKING
|
||||
rtdata->info_port = (void*) vevo_port_new( VEVO_SAMPLE_PORT , __FUNCTION__ , __LINE__ );
|
||||
#else
|
||||
rtdata->info_port = (void*) vevo_port_new( VEVO_SAMPLE_PORT );
|
||||
|
||||
#endif
|
||||
for(i = 0 ; common_property_list[i].name != NULL ; i ++ )
|
||||
vevo_property_set(
|
||||
rtdata->info_port,
|
||||
@@ -1090,7 +1469,7 @@ void *sample_new( int type )
|
||||
|
||||
void *res = NULL;
|
||||
sit->type = type;
|
||||
|
||||
|
||||
if( type == VJ_TAG_TYPE_NONE )
|
||||
{
|
||||
if( sample_new_ext( rtdata->info_port ))
|
||||
@@ -1108,6 +1487,163 @@ void *sample_new( int type )
|
||||
return res;
|
||||
}
|
||||
|
||||
char *sample_property_format_osc( void *sample, const char *path )
|
||||
{
|
||||
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||
int n = 0;
|
||||
int i = 0;
|
||||
int len = strlen(path);
|
||||
for( i =0; i < len ; i ++ )
|
||||
if( path[i] == '/' )
|
||||
n++;
|
||||
if(n==2||n==3)
|
||||
{
|
||||
char *key = strip_key(path);
|
||||
if( key == NULL )
|
||||
return NULL;
|
||||
char *fmt = NULL;
|
||||
// char *fmt = (char*) malloc( n + 1 );
|
||||
// bzero(fmt,n + 1);
|
||||
|
||||
if( sample_property_is_protected( srd->info_port ,key)==1 )
|
||||
{
|
||||
free(key);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int atom_type = 0;
|
||||
int n_elem = vevo_property_num_elements( srd->info_port , key );
|
||||
if(n_elem == 0 ) n_elem = 1;
|
||||
|
||||
if(n==2)
|
||||
atom_type = vevo_property_atom_type( srd->info_port, key );
|
||||
else
|
||||
{
|
||||
void *port = NULL;
|
||||
int id = 0;
|
||||
char *pk = strip_port(path);
|
||||
int error = vevo_property_get( srd->info_port, pk, 0, &port );
|
||||
if( port )
|
||||
{
|
||||
atom_type = vevo_property_atom_type( port , key );
|
||||
n_elem = vevo_property_num_elements( port , key );
|
||||
if(n_elem == 0 ) n_elem = 1;
|
||||
fmt = (char*) malloc( n_elem + 1);
|
||||
bzero(fmt,n_elem+1);
|
||||
}
|
||||
if(pk)
|
||||
free(pk);
|
||||
if( port )
|
||||
{
|
||||
if( sample_property_is_protected( port ,key)==1 )
|
||||
{
|
||||
if(fmt) free(fmt);
|
||||
if(key)free(key);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(!fmt)
|
||||
{
|
||||
fmt = (char*) malloc( n_elem + 1 );
|
||||
bzero(fmt,n_elem+1);
|
||||
}
|
||||
|
||||
for( i = 0; i < n_elem ; i ++ )
|
||||
{
|
||||
if( atom_type == VEVO_ATOM_TYPE_DOUBLE ) {
|
||||
fmt[i] = 'd';
|
||||
} else if (atom_type == VEVO_ATOM_TYPE_INT ) {
|
||||
fmt[i] = 'i';
|
||||
} else if (atom_type == VEVO_ATOM_TYPE_UINT64 ) {
|
||||
fmt[i] = 'h';
|
||||
} else if (atom_type == VEVO_ATOM_TYPE_BOOL ) {
|
||||
fmt[i] = 'i';
|
||||
} else if( atom_type == VEVO_ATOM_TYPE_STRING ){
|
||||
fmt[i] = 's';
|
||||
}
|
||||
else {
|
||||
free(fmt);
|
||||
free(key);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
free(key);
|
||||
return fmt;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void sample_init_namespace( void *data, void *sample , int id )
|
||||
{
|
||||
sample_runtime_data *rtdata = (sample_runtime_data*) sample;
|
||||
|
||||
char name[256];
|
||||
int error;
|
||||
sprintf(name, "/sample_%d",id);
|
||||
char **namespace = vevo_port_recurse_namespace( rtdata->info_port, name );
|
||||
int n = 0;
|
||||
int k;
|
||||
#ifdef STRICT_CHECKING
|
||||
void *osc_namespace = vevo_port_new( VEVO_ANONYMOUS_PORT, __FUNCTION__ , __LINE__ );
|
||||
#else
|
||||
void *osc_namespace = vevo_port_new(VEVO_ANONYMOUS_PORT);
|
||||
#endif
|
||||
for ( k = 0; namespace[k] != NULL ; k ++ )
|
||||
{
|
||||
// sample_set_property_from_path( void *sample, const char *path, void *value );
|
||||
|
||||
char *format = sample_property_format_osc( sample, namespace[k] );
|
||||
if(format == NULL )
|
||||
{
|
||||
if( vevo_property_atom_type( rtdata->info_port, namespace[k] ) == VEVO_ATOM_TYPE_PORTPTR )
|
||||
{
|
||||
char **ns_entries = vevo_port_recurse_namespace(rtdata->info_port,namespace[k]);
|
||||
if(ns_entries)
|
||||
{
|
||||
int q;
|
||||
void *port = NULL;
|
||||
error = vevo_property_get( rtdata->info_port, namespace[k],0,&port );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
for( q = 0; ns_entries[q] != NULL ; q ++ )
|
||||
{
|
||||
char *fmt = sample_property_format_osc( port, ns_entries[q] );
|
||||
vevosample_new_event( data, osc_namespace, sample,NULL, ns_entries[q], fmt, NULL,NULL, NULL,0 );
|
||||
|
||||
if(fmt) free(fmt);
|
||||
free(ns_entries[q]);
|
||||
}
|
||||
free(ns_entries);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
vevosample_new_event( data, osc_namespace, sample, NULL, namespace[k], format,NULL, NULL,NULL, 0 );
|
||||
free(format);
|
||||
}
|
||||
free(namespace[k]);
|
||||
}
|
||||
free(namespace);
|
||||
|
||||
|
||||
if(rtdata->type == VJ_TAG_TYPE_NONE )
|
||||
veejay_osc_add_sample_nonstream_events(data,osc_namespace,rtdata,name);
|
||||
veejay_osc_add_sample_generic_events( data,osc_namespace,rtdata,name, SAMPLE_CHAIN_LEN );
|
||||
|
||||
error = vevo_property_set(
|
||||
rtdata->info_port, "HOST_osc",VEVO_ATOM_TYPE_PORTPTR,1,&osc_namespace);
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
int vevo_num_devices()
|
||||
{
|
||||
return vj_unicap_num_capture_devices( unicap_data_ );
|
||||
@@ -1115,7 +1651,11 @@ int vevo_num_devices()
|
||||
|
||||
void samplebank_init()
|
||||
{
|
||||
#ifdef STRICT_CHECKING
|
||||
sample_bank_ = (void*) vevo_port_new( VEVO_SAMPLE_BANK_PORT, __FUNCTION__, __LINE__ );
|
||||
#else
|
||||
sample_bank_ = (void*) vevo_port_new( VEVO_SAMPLE_BANK_PORT );
|
||||
#endif
|
||||
#ifdef STRICT_CHECKING
|
||||
veejay_msg(2,"VEVO Sampler initialized. (max=%d)", SAMPLE_LIMIT );
|
||||
#endif
|
||||
@@ -1206,10 +1746,18 @@ int samplebank_add_sample( void *sample )
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( pk > 0 );
|
||||
#endif
|
||||
vevo_property_set( port, "primary_key", VEVO_ATOM_TYPE_INT, 1, &pk );
|
||||
|
||||
error = vevo_property_set( port, "primary_key", VEVO_ATOM_TYPE_INT, 1, &pk );
|
||||
#ifdef STRICT_CHECKING
|
||||
if(error != 0)
|
||||
veejay_msg(0, "Fatal error: %d", error );
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
|
||||
sprintf(pri_key, "sample%04x", pk );
|
||||
vevo_property_set( sample_bank_, pri_key, VEVO_ATOM_TYPE_VOIDPTR, 1, &sample );
|
||||
error = vevo_property_set( sample_bank_, pri_key, VEVO_ATOM_TYPE_VOIDPTR, 1, &sample );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
num_samples_ += 1;
|
||||
return pk;
|
||||
}
|
||||
@@ -1359,15 +1907,15 @@ int sample_open( void *sample, const char *token, int extra_token , sample_video
|
||||
sit->bits = project_settings->bits;
|
||||
sit->bps = project_settings->bps;
|
||||
sit->channels = project_settings->chans;
|
||||
srd->data = vj_audio_init( 16384 * 100, sit->channels, 0 );
|
||||
// srd->data = vj_audio_init( 16384 * 100, sit->channels, 0 );
|
||||
sit->speed = 1;
|
||||
sit->end_pos = 32;
|
||||
sit->looptype = 1;
|
||||
|
||||
double freq = 200.94;
|
||||
double amp = 5.0;
|
||||
n_samples = vj_audio_gen_tone( srd->data, 0.04 , sit->rate,freq,amp );
|
||||
veejay_msg(2, "Generated tone of %d samples. Freq %2.2f. Amplitude %2.2f", n_samples,freq,amp);
|
||||
// n_samples = vj_audio_gen_tone( srd->data, 0.04 , sit->rate,freq,amp );
|
||||
// veejay_msg(2, "Generated tone of %d samples. Freq %2.2f. Amplitude %2.2f", n_samples,freq,amp);
|
||||
|
||||
|
||||
uint64_t rate = (uint64_t) project_settings->rate;
|
||||
@@ -1743,11 +2291,11 @@ int sample_get_audio_frame( void *current_sample, void *buffer, int n_packets )
|
||||
break;
|
||||
case VJ_TAG_TYPE_COLOR:
|
||||
|
||||
error = vevo_property_get( srd->info_port, "audio_spas",0,&tmp);
|
||||
// error = vevo_property_get( srd->info_port, "audio_spas",0,&tmp);
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
// assert( error == VEVO_NO_ERROR );
|
||||
#endif
|
||||
return vj_audio_noise_pack( srd->data, buffer , tmp, sit->bps, n_packets );
|
||||
return 0; //vj_audio_noise_pack( srd->data, buffer , tmp, sit->bps, n_packets );
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1756,8 +2304,9 @@ int sample_get_audio_frame( void *current_sample, void *buffer, int n_packets )
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
int sample_get_frame( void *current_sample , VJFrame *slot )
|
||||
int sample_get_frame( void *current_sample , void *dslot )
|
||||
{
|
||||
VJFrame *slot = (VJFrame*) dslot;
|
||||
sample_runtime_data *srd = (sample_runtime_data*) current_sample;
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( srd->info );
|
||||
@@ -2162,6 +2711,98 @@ veejay_msg(0, "Entry %d, Param %d, '%s'",fx_entry,p,str);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
char *sample_describe_param( void *srd, int fx_entry, int p )
|
||||
{
|
||||
void *port = sample_get_fx_port_ptr( srd, fx_entry );
|
||||
if(port)
|
||||
{
|
||||
void *fx_instance = NULL;
|
||||
int error = vevo_property_get( port, "fx_instance",0,&fx_instance );
|
||||
|
||||
return plug_describe_param( fx_instance, p );
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int sample_parse_param( void *fx_instance, int num, const char format[], va_list ap )
|
||||
{
|
||||
int n_elems = strlen( format );
|
||||
if( n_elems <= 0 )
|
||||
return 0;
|
||||
|
||||
double *g = NULL;
|
||||
int32_t *i = NULL;
|
||||
char *s = NULL;
|
||||
void *p = NULL;
|
||||
|
||||
switch(format[0])
|
||||
{
|
||||
case 'd':
|
||||
i = (int32_t*) malloc( sizeof(int32_t) * n_elems );
|
||||
p = &i;
|
||||
break;
|
||||
case 'g':
|
||||
g = (double*) malloc(sizeof(double) * n_elems );
|
||||
p = &g;
|
||||
break;
|
||||
case 's':
|
||||
s = NULL;
|
||||
p = &s;
|
||||
break;
|
||||
default:
|
||||
#ifdef STRICT_CHECKING
|
||||
assert(0);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
while(*format)
|
||||
{
|
||||
switch(*format)
|
||||
{
|
||||
case 'd':
|
||||
*i++ = (int32_t) *(va_arg( ap, int32_t*)); break;
|
||||
case 'g':
|
||||
*g++ = (double) *(va_arg( ap, double*)); break;
|
||||
case 's':
|
||||
s = strdup( (char*) va_arg(ap,char*) ); break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
*format++;
|
||||
}
|
||||
|
||||
plug_set_parameter( fx_instance, num,n_elems, p );
|
||||
|
||||
|
||||
if( i ) free( i );
|
||||
if( g ) free( g );
|
||||
if( s ) free( s );
|
||||
|
||||
return n_elems;
|
||||
}
|
||||
|
||||
int sample_set_param( void *srd, int fx_entry, int p, const char format[] , ... )
|
||||
{
|
||||
va_list ap;
|
||||
int n = 0;
|
||||
|
||||
void *port = sample_get_fx_port_ptr( srd, fx_entry );
|
||||
if(!port)
|
||||
return n;
|
||||
|
||||
void *fx_instance = NULL;
|
||||
int error = vevo_property_get( port, "fx_instance",0,&fx_instance );
|
||||
if( error != VEVO_NO_ERROR )
|
||||
return n;
|
||||
|
||||
va_start( ap, format );
|
||||
n = sample_parse_param( fx_instance, p , format, ap );
|
||||
va_end(ap);
|
||||
|
||||
return n;
|
||||
}
|
||||
void sample_process_fx_chain( void *srd )
|
||||
{
|
||||
int k = 0;
|
||||
@@ -2170,7 +2811,7 @@ void sample_process_fx_chain( void *srd )
|
||||
{
|
||||
void *port = sample_get_fx_port_ptr( srd, k );
|
||||
void *fx_instance = NULL;
|
||||
int fx_status = 0;
|
||||
/* int fx_status = 0;
|
||||
|
||||
int error = vevo_property_get( port, "fx_status", 0, &fx_status);
|
||||
#ifdef STRICT_CHECKING
|
||||
@@ -2180,8 +2821,8 @@ void sample_process_fx_chain( void *srd )
|
||||
//@TODO: Alpha fading
|
||||
|
||||
if( fx_status )
|
||||
{
|
||||
error = vevo_property_get( port, "fx_instance", 0, &fx_instance );
|
||||
{*/
|
||||
int error = vevo_property_get( port, "fx_instance", 0, &fx_instance );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == 0 );
|
||||
#endif
|
||||
@@ -2193,7 +2834,7 @@ void sample_process_fx_chain( void *srd )
|
||||
assert( error == 0 );
|
||||
#endif
|
||||
plug_clone_from_parameters( fx_instance, fx_values );
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2580,8 +3221,7 @@ static long sample_tc_to_frames( const char *tc, float fps )
|
||||
return res;
|
||||
}
|
||||
|
||||
int sample_configure_recorder( void *sample, int format, const char *filename, int nframes,
|
||||
sample_video_info_t *ps)
|
||||
int sample_configure_recorder( void *sample, int format, const char *filename, int nframes)
|
||||
{
|
||||
char fmt = 'Y'; //default uncompressed format
|
||||
int max_size = 0;
|
||||
@@ -2589,7 +3229,7 @@ int sample_configure_recorder( void *sample, int format, const char *filename, i
|
||||
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||
sampleinfo_t *sit = srd->info;
|
||||
samplerecord_t *rec = srd->record;
|
||||
|
||||
sample_video_info_t *ps = veejay_get_ps( srd->user_data );
|
||||
if( !filename )
|
||||
{
|
||||
veejay_msg(VEEJAY_MSG_ERROR, "No filename given");
|
||||
@@ -2694,10 +3334,11 @@ int sample_configure_recorder( void *sample, int format, const char *filename, i
|
||||
return VEVO_NO_ERROR;
|
||||
}
|
||||
|
||||
int sample_start_recorder( void *sample , sample_video_info_t *ps)
|
||||
int sample_start_recorder( void *sample )
|
||||
{
|
||||
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||
samplerecord_t *rec = srd->record;
|
||||
sample_video_info_t *ps = veejay_get_ps( srd->user_data );
|
||||
|
||||
if(!rec->con)
|
||||
{
|
||||
@@ -2789,8 +3430,9 @@ int sample_stop_recorder( void *sample )
|
||||
}
|
||||
|
||||
|
||||
int sample_record_frame( void *sample, VJFrame *frame, uint8_t *audio_buffer, int a_len )
|
||||
int sample_record_frame( void *sample, void *dframe, uint8_t *audio_buffer, int a_len )
|
||||
{
|
||||
VJFrame *frame = (VJFrame*) dframe;
|
||||
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||
samplerecord_t *rec = srd->record;
|
||||
sampleinfo_t *sit = srd->info;
|
||||
@@ -3037,7 +3679,8 @@ void sample_send_osc_path( void *sample, void *fx_entry )
|
||||
|
||||
int error = vevo_property_get( fx_entry, "fx_out_values",0,&fx_out_values );
|
||||
#ifdef STRICT_CHECKING
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
assert( error == VEVO_NO_ERROR );
|
||||
assert( srd->osc != NULL );
|
||||
#endif
|
||||
|
||||
if( osc_path )
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
#ifndef VEVOSAMPLE_H
|
||||
#define VEVOSAMPLE_H
|
||||
#define SAMPLE_CHAIN_LEN 2
|
||||
#define SAMPLE_CHAIN_LEN 5
|
||||
typedef struct
|
||||
{
|
||||
int w;
|
||||
@@ -44,13 +44,13 @@ void samplebank_free();
|
||||
int samplebank_size();
|
||||
void sample_delete_ptr(void *info);
|
||||
int sample_delete(int id);
|
||||
void sample_set_property_ptr( void *ptr, const char *key, int atom_type, void *value );
|
||||
int sample_set_property_ptr( void *ptr, const char *key, int atom_type, void *value );
|
||||
void sample_set_property( int sample_id, const char *key, int atom_type, void *value );
|
||||
void sample_get_property( int sample_id, const char *key, void *dst );
|
||||
void *sample_new( int type );
|
||||
void sample_free(int sample_id);
|
||||
int sample_open( void *sample, const char *token, int extra_token, sample_video_info_t *settings );
|
||||
int sample_get_frame( void *current_sample, VJFrame *slot );
|
||||
int sample_get_frame( void *current_sample, void *slot );
|
||||
void sample_fx_set_parameter( int id, int fx_entry, int param_id,int n, void *data );
|
||||
void sample_fx_get_parameter( int id, int fx_enty,int param_id,int idx, void *dst );
|
||||
void sample_toggle_process_entry( void *data, int fx_entry, int v );
|
||||
@@ -60,9 +60,8 @@ int sample_get_fx_alpha( void *data, int fx_entry );
|
||||
void sample_set_fx_alpha( void *data, int fx_entry, int v );
|
||||
void sample_set_itu601( void *current_sample, int status );
|
||||
int sample_fx_set( void *info, int fx_entry, const int new_fx );
|
||||
void sample_set_input_frame( void *info, int fx_entry, int seq_num, VJFrame *frame );
|
||||
void sample_process_fx_chain( void *srd );
|
||||
int sample_fx_del( int id, int fx_entry );
|
||||
int sample_fx_del( void *veejay, int id, int fx_entry );
|
||||
int sample_xml_load( const char *filename, void *samplebank );
|
||||
int samplebank_xml_save( const char *filename );
|
||||
void *sample_get_fx_port( int id, int fx_entry );
|
||||
@@ -97,16 +96,30 @@ int sample_get_key_ptr( void *sample );
|
||||
int sample_edl_delete( void *current_sample, uint64_t start, uint64_t end );
|
||||
int sample_edl_paste_from_buffer( void *current_sample, uint64_t insert_at );
|
||||
int sample_edl_cut_to_buffer( void *current_sample, uint64_t start_pos, uint64_t end_pos );
|
||||
int sample_configure_recorder( void *sample, int format, const char *filename, int nframes, sample_video_info_t *ps );
|
||||
int sample_start_recorder( void *sample, sample_video_info_t *ps );
|
||||
int sample_configure_recorder( void *sample, int format, const char *filename, int nframes );
|
||||
int sample_start_recorder( void *sample );
|
||||
int sample_stop_recorder( void *sample );
|
||||
int sample_record_frame( void *sample, VJFrame *frame, uint8_t *audio_buffer, int a_len );
|
||||
int sample_record_frame( void *sample, void *frame, uint8_t *audio_buffer, int a_len );
|
||||
char *sample_get_recorded_file( void *sample );
|
||||
|
||||
int sample_new_osc_sender(void *sample, const char *addr, const char *port );
|
||||
void sample_close_osc_sender( void *sample );
|
||||
void sample_add_osc_path( void *sample, const char *path, int fx_entry_id );
|
||||
void sample_del_osc_path( void *sample, int fx_entry_id );
|
||||
void sample_send_osc_path( void *sample, void *fx_entry );
|
||||
char *sample_describe_param( void *srd, int fx_entry, int p );
|
||||
int sample_set_param( void *srd, int fx_entry, int p, const char format[] , ... );
|
||||
void sample_set_user_data( void *sample, void *data, int id );
|
||||
void sample_set_property_from_path( void *sample, const char *path, void *value );
|
||||
char *sample_property_format_osc( void *sample, const char *path );
|
||||
void sample_init_namespace( void *data, void *sample , int id );
|
||||
int sample_osc_property_calls_event( void *sample, const char *path, char *types, void **argv[] );
|
||||
|
||||
typedef void (*vevo_event_f)(void *ptr, const char *path,const char *types, void **argv);
|
||||
int sample_osc_new_sample_event( void *sample,
|
||||
const char *key,
|
||||
const char *fmt,
|
||||
const char **args,
|
||||
vevo_event_f *func );
|
||||
int sample_osc_verify_format( void *vevo_port, char const *types );
|
||||
|
||||
#endif
|
||||
|
||||
@@ -86,9 +86,13 @@ static int vj_unicap_scan_enumerate_devices(void *unicap)
|
||||
|
||||
unicap_reenumerate_properties( ud->handle, &property_count );
|
||||
unicap_reenumerate_formats( ud->handle, &format_count );
|
||||
void *device_port = vevo_port_new( VEVO_ANONYMOUS_PORT );
|
||||
|
||||
char *device_name = strdup( ud->device.identifier );
|
||||
|
||||
#ifdef STRICT_CHECKING
|
||||
void *device_port = vevo_port_new( VEVO_ANONYMOUS_PORT, device_name, i );
|
||||
#else
|
||||
void *device_port = vevo_port_new( VEVO_ANONYMOUS_PORT );
|
||||
#endif
|
||||
char *device_location = strdup( ud->device.device );
|
||||
|
||||
int error = vevo_property_set( device_port,
|
||||
@@ -132,8 +136,11 @@ void *vj_unicap_init(void)
|
||||
{
|
||||
unicap_driver_t *ud = (unicap_driver_t*) vj_malloc(sizeof(unicap_driver_t));
|
||||
memset( ud,0,sizeof(unicap_driver_t));
|
||||
#ifdef STRICT_CHECKING
|
||||
ud->device_list = vevo_port_new( VEVO_ANONYMOUS_PORT, __FUNCTION__, __LINE__ );
|
||||
#else
|
||||
ud->device_list = vevo_port_new( VEVO_ANONYMOUS_PORT );
|
||||
|
||||
#endif
|
||||
ud->num_devices = vj_unicap_scan_enumerate_devices( (void*) ud );
|
||||
veejay_msg(2, "Found %d capture devices on this system", ud->num_devices);
|
||||
return ud;
|
||||
|
||||
Reference in New Issue
Block a user