replaced malloc for vj_malloc, added assertion in malloc function for debugging purposes

git-svn-id: svn://code.dyne.org/veejay/trunk@596 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
Niels Elburg
2006-09-03 19:07:33 +00:00
parent 3b21a3e1ca
commit 961cc560f5
12 changed files with 77 additions and 78 deletions

View File

@@ -1339,7 +1339,7 @@ void* deal_with_livido( void *handle, const char *name )
#ifdef STRICT_CHECKING #ifdef STRICT_CHECKING
assert( plugin_name != NULL ); assert( plugin_name != NULL );
#endif #endif
char *clone_name = (char*) malloc( strlen(plugin_name) + 4); char *clone_name = (char*) vj_malloc( strlen(plugin_name) + 4);
sprintf(clone_name, "LVD%s", plugin_name ); sprintf(clone_name, "LVD%s", plugin_name );
vevo_property_set( port, "num_params", VEVO_ATOM_TYPE_INT, 1, &n_params ); vevo_property_set( port, "num_params", VEVO_ATOM_TYPE_INT, 1, &n_params );

View File

@@ -268,7 +268,7 @@ char *list_plugins()
if(len <= 0 ) if(len <= 0 )
return NULL; return NULL;
res = (char*) malloc( len ); res = (char*) vj_malloc( len );
memset( res,0,len ); memset( res,0,len );
char *p = res; char *p = res;
for ( i = 0; i < index_; i ++ ) for ( i = 0; i < index_; i ++ )
@@ -344,11 +344,11 @@ void plug_sys_free(void)
void plug_sys_init( int fmt, int w, int h ) void plug_sys_init( int fmt, int w, int h )
{ {
buffer_ = (void*) malloc( w * h * 4); buffer_ = (void*) vj_malloc( w * h * 4);
memset( buffer_, 0, w * h * 4); memset( buffer_, 0, w * h * 4);
buffer2_ = (void*) malloc( w * h * 4); buffer2_ = (void*) vj_malloc( w * h * 4);
memset( buffer2_, 0, w * h * 4); memset( buffer2_, 0, w * h * 4);
buffer_b_ = (void*) malloc( w * h * 4); buffer_b_ = (void*) vj_malloc( w * h * 4);
memset( buffer_b_, 0, w * h * 4); memset( buffer_b_, 0, w * h * 4);
base_width_ = w; base_width_ = w;
@@ -378,7 +378,7 @@ void plug_sys_init( int fmt, int w, int h )
int plug_sys_detect_plugins(void) int plug_sys_detect_plugins(void)
{ {
index_map_ = (vevo_port_t**) malloc(sizeof(vevo_port_t*) * 256 ); index_map_ = (vevo_port_t**) vj_malloc(sizeof(vevo_port_t*) * 256 );
#ifdef STRICT_CHECKING #ifdef STRICT_CHECKING
illegal_plugins_ = vevo_port_new( VEVO_ILLEGAL, __FUNCTION__, __LINE__ ); illegal_plugins_ = vevo_port_new( VEVO_ILLEGAL, __FUNCTION__, __LINE__ );
#else #else
@@ -543,7 +543,7 @@ static char * flatten_port( void *port, const char *key )
if( len <= 0 ) if( len <= 0 )
return NULL; return NULL;
char *res = (char*) malloc( len ); char *res = (char*) vj_malloc( len );
void *subport = NULL; void *subport = NULL;
int error = vevo_property_get( port , key, 0, &subport ); int error = vevo_property_get( port , key, 0, &subport );
@@ -600,7 +600,7 @@ char *plug_describe( int fx_id )
char **out_params = NULL; char **out_params = NULL;
if( pi > 0 ) if( pi > 0 )
{ {
in_params = (char*) malloc(sizeof(char*) * pi ); in_params = (char*) vj_malloc(sizeof(char*) * pi );
for( i = 0; i < pi; i ++ ) for( i = 0; i < pi; i ++ )
{ {
@@ -611,7 +611,7 @@ char *plug_describe( int fx_id )
} }
if( po > 0 ) if( po > 0 )
{ {
out_params = (char*) malloc(sizeof(char*) * pi ); out_params = (char*) vj_malloc(sizeof(char*) * pi );
for( i = 0; i < pi; i ++ ) for( i = 0; i < pi; i ++ )
{ {
@@ -629,7 +629,7 @@ char *plug_describe( int fx_id )
len += strlen( author )+8; len += strlen( author )+8;
len += strlen( license )+9; len += strlen( license )+9;
res = (char*) malloc(sizeof(char) * len + 150 ); res = (char*) vj_malloc(sizeof(char) * len + 150 );
memset(res,0,len); memset(res,0,len);
sprintf( res, sprintf( res,

View File

@@ -42,7 +42,7 @@ char *get_str_vevo( void *port, const char *key )
size_t len = vevo_property_element_size( port, key, 0 ); size_t len = vevo_property_element_size( port, key, 0 );
char *ret = NULL; char *ret = NULL;
if(len<=0) return NULL; if(len<=0) return NULL;
ret = (char*) malloc(sizeof(char) * len ); ret = (char*) vj_malloc(sizeof(char) * len );
vevo_property_get( port, key, 0, &ret ); vevo_property_get( port, key, 0, &ret );
return ret; return ret;
} }
@@ -51,7 +51,7 @@ char *alloc_str_vevo( void *port, const char *key )
size_t len = vevo_property_element_size( port, key, 0 ); size_t len = vevo_property_element_size( port, key, 0 );
char *ret = NULL; char *ret = NULL;
if(len<=0) return NULL; if(len<=0) return NULL;
ret = (char*) malloc(sizeof(char) * len ); ret = (char*) vj_malloc(sizeof(char) * len );
return ret; return ret;
} }
@@ -64,7 +64,7 @@ double *get_dbl_arr_vevo( void *port, const char *key )
if( num <= 0 ) if( num <= 0 )
return NULL; return NULL;
res = (double*) malloc(sizeof(double) * num ); res = (double*) vj_malloc(sizeof(double) * num );
int i; int i;
for( i = 0; i < num ; i++ ) for( i = 0; i < num ; i++ )
@@ -159,7 +159,7 @@ void clone_prop_vevo( void *port, void *to_port, const char *key, const char *as
size_t len = vevo_property_element_size( port,key,i); size_t len = vevo_property_element_size( port,key,i);
stmp[i] = NULL; stmp[i] = NULL;
if( len > 0 ) continue; if( len > 0 ) continue;
stmp[i] = (char*) malloc(sizeof(char) * len ); stmp[i] = (char*) vj_malloc(sizeof(char) * len );
error = vevo_property_get( port, key, i, &(stmp[i]) ); error = vevo_property_get( port, key, i, &(stmp[i]) );
#ifdef STRICT_CHECKING #ifdef STRICT_CHECKING
assert( error == VEVO_NO_ERROR ); assert( error == VEVO_NO_ERROR );

View File

@@ -21,7 +21,9 @@
#include <libvjmem/vjmem.h> #include <libvjmem/vjmem.h>
#include <sys/time.h> #include <sys/time.h>
#include <unistd.h> #include <unistd.h>
#ifdef STRICT_CHECKING
#include <assert.h>
#endif
/** \defgroup memman Fast memory copy and aligned memory allocation /** \defgroup memman Fast memory copy and aligned memory allocation
*/ */
@@ -136,6 +138,12 @@ void *vj_malloc(unsigned int size)
if( size == 0 ) if( size == 0 )
return NULL; return NULL;
void *ptr = NULL; void *ptr = NULL;
#ifdef STRICT_CHECKING
assert( size > 0 );
assert( MEM_ALIGNMENT_SIZE > 0 );
#endif
#ifdef HAVE_POSIX_MEMALIGN #ifdef HAVE_POSIX_MEMALIGN
posix_memalign( &ptr, MEM_ALIGNMENT_SIZE, size ); posix_memalign( &ptr, MEM_ALIGNMENT_SIZE, size );
#else #else

View File

@@ -752,7 +752,7 @@ static int x_display_init_gl( display_ctx *ctx, int w, int h )
void *x_display_init(void) void *x_display_init(void)
{ {
display_ctx *ctx = (display_ctx*) malloc(sizeof(display_ctx)); display_ctx *ctx = (display_ctx*) vj_malloc(sizeof(display_ctx));
memset(ctx, 0,sizeof(display_ctx)); memset(ctx, 0,sizeof(display_ctx));
XSetErrorHandler( x11_err_ ); XSetErrorHandler( x11_err_ );

View File

@@ -33,6 +33,7 @@
#include <lo/lo.h> #include <lo/lo.h>
#include <ctype.h> #include <ctype.h>
#include <vevosample/vevosample.h> #include <vevosample/vevosample.h>
#include <libvjmem/vjmem.h>
//@ client side implementation //@ client side implementation
#ifdef STRICT_CHECKING #ifdef STRICT_CHECKING
#include <assert.h> #include <assert.h>
@@ -57,7 +58,7 @@ void error_handler( int num, const char *msg, const char *path )
static char *osc_create_path( const char *base, const char *path ) static char *osc_create_path( const char *base, const char *path )
{ {
int n = strlen(base) + strlen(path) + 2; int n = strlen(base) + strlen(path) + 2;
char *res = (char*) malloc(n); char *res = (char*) vj_malloc(n);
bzero(res,n); bzero(res,n);
sprintf(res,"%s/%s", base,path); sprintf(res,"%s/%s", base,path);
return res; return res;
@@ -66,7 +67,7 @@ static char *osc_create_path( const char *base, const char *path )
static char *osc_fx_pair_str( const char *base, const char *key ) static char *osc_fx_pair_str( const char *base, const char *key )
{ {
int n = strlen(base) + strlen(key) + 2; int n = strlen(base) + strlen(key) + 2;
char *res = (char*) malloc(n); char *res = (char*) vj_malloc(n);
bzero(res,n); bzero(res,n);
snprintf( res,n, "%s/%s", base,key); snprintf( res,n, "%s/%s", base,key);
return res; return res;
@@ -79,7 +80,7 @@ static char *vevo_str_to_liblo( const char *format )
if( n <= 0 ) if( n <= 0 )
return NULL; return NULL;
char *res = (char*) malloc( n ); char *res = (char*) vj_malloc( n );
int k = 0; int k = 0;
bzero(res,n ); bzero(res,n );
while(*format) while(*format)
@@ -181,7 +182,6 @@ int osc_plugin_handler( const char *path, const char *types,
pthread_mutex_unlock( &(info->vevo_mutex) ); pthread_mutex_unlock( &(info->vevo_mutex) );
return 0; return 0;
} }
veejay_msg(0, "Seq = %d", pd->seq );
int n_elem = strlen(required_format); int n_elem = strlen(required_format);
#ifdef STRICT_CHECKING #ifdef STRICT_CHECKING
assert( n_elem == argc ); assert( n_elem == argc );
@@ -189,7 +189,7 @@ int osc_plugin_handler( const char *path, const char *types,
int k; int k;
if( types[0] == 'i' ) if( types[0] == 'i' )
{ {
int32_t *elements = (int32_t*) malloc(sizeof(int32_t) * n_elem ); int32_t *elements = (int32_t*) vj_malloc(sizeof(int32_t) * n_elem );
for( k = 0; k < n_elem; k ++ ) for( k = 0; k < n_elem; k ++ )
elements[k] = argv[k]->i32; elements[k] = argv[k]->i32;
plug_set_parameter( pd->instance, pd->seq, n_elem, (void*)elements ); plug_set_parameter( pd->instance, pd->seq, n_elem, (void*)elements );
@@ -199,7 +199,7 @@ int osc_plugin_handler( const char *path, const char *types,
} }
else if( types[0] == 'd' ) else if( types[0] == 'd' )
{ {
double *elements = (double*) malloc(sizeof(double) * n_elem ); double *elements = (double*) vj_malloc(sizeof(double) * n_elem );
for( k = 0; k < n_elem; k ++ ) for( k = 0; k < n_elem; k ++ )
elements[k] = argv[k]->d; elements[k] = argv[k]->d;
plug_set_parameter( pd->instance, pd->seq, n_elem, (void*) elements ); plug_set_parameter( pd->instance, pd->seq, n_elem, (void*) elements );
@@ -209,7 +209,7 @@ int osc_plugin_handler( const char *path, const char *types,
} }
else if( types[0] == 's' ) else if( types[0] == 's' )
{ {
char **strs = malloc(sizeof(char*) * n_elem ); char **strs = vj_malloc(sizeof(char*) * n_elem );
for( k = 0; k < n_elem; k ++ ) for( k = 0; k < n_elem; k ++ )
strs[k] = strdup( (char*) &argv[k]->s ); strs[k] = strdup( (char*) &argv[k]->s );
plug_set_parameter( pd->instance,pd->seq, n_elem, (void*) strs ); plug_set_parameter( pd->instance,pd->seq, n_elem, (void*) strs );
@@ -285,7 +285,7 @@ int osc_sample_handler( const char *path, const char *types,
if( types[0] == 'i' ) if( types[0] == 'i' )
{ {
int32_t *elements = (int32_t*) malloc(sizeof(int32_t) * n_elem ); int32_t *elements = (int32_t*) vj_malloc(sizeof(int32_t) * n_elem );
for( k = 0; k < n_elem; k ++ ) for( k = 0; k < n_elem; k ++ )
elements[k] = argv[k]->i32; elements[k] = argv[k]->i32;
sample_set_property_from_path( pd->instance, path, (void*)elements ); sample_set_property_from_path( pd->instance, path, (void*)elements );
@@ -295,7 +295,7 @@ int osc_sample_handler( const char *path, const char *types,
} }
else if( types[0] == 'd' ) else if( types[0] == 'd' )
{ {
double *elements = (double*) malloc(sizeof(double) * n_elem ); double *elements = (double*) vj_malloc(sizeof(double) * n_elem );
for( k = 0; k < n_elem; k ++ ) for( k = 0; k < n_elem; k ++ )
elements[k] = argv[k]->d; elements[k] = argv[k]->d;
sample_set_property_from_path( pd->instance, path, (void*)elements ); sample_set_property_from_path( pd->instance, path, (void*)elements );
@@ -306,7 +306,7 @@ int osc_sample_handler( const char *path, const char *types,
} }
else if( types[0] == 's' ) else if( types[0] == 's' )
{ {
char **strs = malloc(sizeof(char*) * n_elem ); char **strs = vj_malloc(sizeof(char*) * n_elem );
for( k = 0; k < n_elem; k ++ ) for( k = 0; k < n_elem; k ++ )
strs[k] = strdup( (char*) &argv[k]->s ); strs[k] = strdup( (char*) &argv[k]->s );
sample_set_property_from_path( pd->instance, path, (void*)strs ); sample_set_property_from_path( pd->instance, path, (void*)strs );
@@ -317,7 +317,7 @@ int osc_sample_handler( const char *path, const char *types,
} }
else if( types[0] == 'h' ) else if( types[0] == 'h' )
{ {
uint64_t *elements = malloc(sizeof(uint64_t) * n_elem ); uint64_t *elements = vj_malloc(sizeof(uint64_t) * n_elem );
for( k = 0; k < n_elem; k ++ ) for( k = 0; k < n_elem; k ++ )
elements[k] = argv[k]->h; elements[k] = argv[k]->h;
sample_set_property_from_path( pd->instance, path, (void*) elements ); sample_set_property_from_path( pd->instance, path, (void*) elements );
@@ -448,7 +448,7 @@ static int servit_new_event(
} }
} }
plugin_data_t *pd = (plugin_data_t*) malloc(sizeof(plugin_data_t)); plugin_data_t *pd = (plugin_data_t*) vj_malloc(sizeof(plugin_data_t));
pd->seq = extra_token; pd->seq = extra_token;
pd->caller = userdata; pd->caller = userdata;
pd->instance = instance; pd->instance = instance;

View File

@@ -864,16 +864,15 @@ static int performer_push_in_frames( void *sample, performer_t *p, int i )
static int performer_render_entry( veejay_t *info, void *sample, performer_t *p, int i) static int performer_render_entry( veejay_t *info, void *sample, performer_t *p, int i)
{ {
int opacity = sample_get_fx_alpha( sample, i ); double opacity = sample_get_fx_alpha( sample, i );
char key[64]; char key[64];
int error = 0; int error = 0;
sprintf(key, "%p",sample); sprintf(key, "%p",sample);
VJFrame *A = NULL; VJFrame *A = NULL;
VJFrame *pass1 = p->fx_buffer[i]; VJFrame *pass1 = p->fx_buffer[i];
//@ Keep backup of original frame //@ Keep backup of original frame
if( opacity < 256 ) if( opacity > 0.0 )
{ {
VJFrame *A = NULL; VJFrame *A = NULL;
error = vevo_property_get( p->in_frames, key, 0, &A ); error = vevo_property_get( p->in_frames, key, 0, &A );
@@ -902,9 +901,9 @@ static int performer_render_entry( veejay_t *info, void *sample, performer_t *p,
// subsample_ycbcr_clamp_itu601_copy( out, p->ref_buffer[i] ); // subsample_ycbcr_clamp_itu601_copy( out, p->ref_buffer[i] );
if( opacity < 256 ) if( opacity > 0.0 )
{ {
yuv_blend_opacity( pass1, p->out_buffers[idx], opacity ); yuv_blend_opacity( pass1, p->out_buffers[idx],(uint8_t) (opacity * 0xff) );
} }

View File

@@ -35,7 +35,7 @@
vj_sdl *vj_sdl_allocate(int width, int height, int fmt) vj_sdl *vj_sdl_allocate(int width, int height, int fmt)
{ {
vj_sdl *vjsdl = (vj_sdl *) malloc(sizeof(vj_sdl)); vj_sdl *vjsdl = (vj_sdl *) vj_malloc(sizeof(vj_sdl));
if (!vjsdl) if (!vjsdl)
return NULL; return NULL;
vjsdl->flags[0] = 0; vjsdl->flags[0] = 0;

View File

@@ -222,7 +222,7 @@ static struct
} fx_entry_list_[] = } fx_entry_list_[] =
{ {
{ "fx_status", VEVO_ATOM_TYPE_INT }, /* fx status */ { "fx_status", VEVO_ATOM_TYPE_INT }, /* fx status */
{ "fx_alpha", VEVO_ATOM_TYPE_INT }, /* alpha */ { "fx_alpha", VEVO_ATOM_TYPE_DOUBLE }, /* alpha */
{ "fx_instance", VEVO_ATOM_TYPE_VOIDPTR }, /* plugin instance point */ { "fx_instance", VEVO_ATOM_TYPE_VOIDPTR }, /* plugin instance point */
{ "fx_values", VEVO_ATOM_TYPE_PORTPTR }, /* port of p0 .. pN, containing copy of fx parameter values */ { "fx_values", VEVO_ATOM_TYPE_PORTPTR }, /* port of p0 .. pN, containing copy of fx parameter values */
{ "fx_out_values", VEVO_ATOM_TYPE_PORTPTR }, /* output parmaters, p0 ... pN */ { "fx_out_values", VEVO_ATOM_TYPE_PORTPTR }, /* output parmaters, p0 ... pN */
@@ -821,28 +821,27 @@ int sample_process_entry( void *data, int fx_entry )
return fx_status; return fx_status;
} }
int sample_get_fx_alpha( void *data, int fx_entry ) double sample_get_fx_alpha( void *data, int fx_entry )
{ {
void *port = sample_get_fx_port_ptr( data,fx_entry ); void *port = sample_get_fx_port_ptr( data,fx_entry );
#ifdef STRICT_CHECKING #ifdef STRICT_CHECKING
assert( port != NULL ); assert( port != NULL );
#endif #endif
int fx_alpha=0; double fx_alpha=0.0;
int error = vevo_property_get( port, "fx_alpha",0,&fx_alpha); int error = vevo_property_get( port, "fx_alpha",0,&fx_alpha);
if( error != VEVO_NO_ERROR ) if( error != VEVO_NO_ERROR )
return 256; return 0.0;
return fx_alpha; return fx_alpha;
} }
void sample_set_fx_alpha( void *data, int fx_entry, int v ) void sample_set_fx_alpha( void *data, int fx_entry, double v )
{ {
void *port = sample_get_fx_port_ptr( data,fx_entry ); void *port = sample_get_fx_port_ptr( data,fx_entry );
#ifdef STRICT_CHECKING #ifdef STRICT_CHECKING
assert( port != NULL ); assert( port != NULL );
#endif #endif
int fx_alpha = v; int error = vevo_property_set( port, "fx_alpha",VEVO_ATOM_TYPE_DOUBLE,1,&v);
int error = vevo_property_set( port, "fx_alpha",VEVO_ATOM_TYPE_INT,1,&fx_alpha);
#ifdef STRICT_CHECKING #ifdef STRICT_CHECKING
assert( error == VEVO_NO_ERROR ); assert( error == VEVO_NO_ERROR );
#endif #endif
@@ -1446,7 +1445,7 @@ int sample_fx_chain_entry_clear(void *info, int id )
void *sample_new( int type ) void *sample_new( int type )
{ {
int i; int i;
sample_runtime_data *rtdata = (sample_runtime_data*) malloc(sizeof( sample_runtime_data ) ); sample_runtime_data *rtdata = (sample_runtime_data*) vj_malloc(sizeof( sample_runtime_data ) );
memset( rtdata,0,sizeof(sample_runtime_data)); memset( rtdata,0,sizeof(sample_runtime_data));
sampleinfo_t *sit = (sampleinfo_t*) vj_malloc(sizeof(sampleinfo_t)); sampleinfo_t *sit = (sampleinfo_t*) vj_malloc(sizeof(sampleinfo_t));
memset( sit,0,sizeof(sampleinfo_t)); memset( sit,0,sizeof(sampleinfo_t));
@@ -1528,7 +1527,7 @@ char *sample_property_format_osc( void *sample, const char *path )
atom_type = vevo_property_atom_type( port , key ); atom_type = vevo_property_atom_type( port , key );
n_elem = vevo_property_num_elements( port , key ); n_elem = vevo_property_num_elements( port , key );
if(n_elem == 0 ) n_elem = 1; if(n_elem == 0 ) n_elem = 1;
fmt = (char*) malloc( n_elem + 1); fmt = (char*) vj_malloc( n_elem + 1);
bzero(fmt,n_elem+1); bzero(fmt,n_elem+1);
} }
if(pk) if(pk)
@@ -1547,7 +1546,7 @@ char *sample_property_format_osc( void *sample, const char *path )
if(!fmt) if(!fmt)
{ {
fmt = (char*) malloc( n_elem + 1 ); fmt = (char*) vj_malloc( n_elem + 1 );
bzero(fmt,n_elem+1); bzero(fmt,n_elem+1);
} }
@@ -1681,7 +1680,7 @@ char *samplebank_sprint_list()
len += strlen( props[i] ) + 1; len += strlen( props[i] ) + 1;
} }
res = (char*) malloc(sizeof(char) * len ); res = (char*) vj_malloc(sizeof(char) * len );
memset(res,0,len); memset(res,0,len);
char *p = res; char *p = res;
@@ -2399,7 +2398,7 @@ static char *clone_str( void *port, const char *key )
size_t len = vevo_property_element_size( port, key, 0 ); size_t len = vevo_property_element_size( port, key, 0 );
char *ret = NULL; char *ret = NULL;
if(len<=0) return NULL; if(len<=0) return NULL;
ret = (char*) malloc(sizeof(char) * len ); ret = (char*) vj_malloc(sizeof(char) * len );
vevo_property_get( port, key, 0, &ret ); vevo_property_get( port, key, 0, &ret );
return ret; return ret;
} }
@@ -2739,11 +2738,11 @@ static int sample_parse_param( void *fx_instance, int num, const char format[],
switch(format[0]) switch(format[0])
{ {
case 'd': case 'd':
i = (int32_t*) malloc( sizeof(int32_t) * n_elems ); i = (int32_t*) vj_malloc( sizeof(int32_t) * n_elems );
p = &i; p = &i;
break; break;
case 'g': case 'g':
g = (double*) malloc(sizeof(double) * n_elems ); g = (double*) vj_malloc(sizeof(double) * n_elems );
p = &g; p = &g;
break; break;
case 's': case 's':
@@ -3866,13 +3865,8 @@ void sample_produce_khagan_file( void *sample )
int error; int error;
int k; int k;
const char *encoding = "UTF-8"; const char *encoding = "UTF-8";
xmlNodePtr rootnode; int id = 0;
error = vevo_property_get( srd->info_port, "primary_key", 0, &id );
xmlDocPtr doc = xmlNewDoc( "1.0" );
rootnode = xmlNewDocNode( doc, NULL, (const xmlChar*) "gui", NULL );
xmlDocSetRootElement( doc, rootnode );
for( k =0; k < SAMPLE_CHAIN_LEN; k ++ ) for( k =0; k < SAMPLE_CHAIN_LEN; k ++ )
{ {
@@ -3882,23 +3876,19 @@ void sample_produce_khagan_file( void *sample )
if( error == VEVO_NO_ERROR ) if( error == VEVO_NO_ERROR )
{ {
xmlNodePtr rootnode;
xmlDocPtr doc = xmlNewDoc( "1.0" );
rootnode = xmlNewDocNode( doc, NULL, (const xmlChar*) "gui", NULL );
xmlDocSetRootElement( doc, rootnode );
void *osc_port = plug_get_name_space( fxi ); void *osc_port = plug_get_name_space( fxi );
int n = vevo_property_num_elements( fxi, "in_parameters" ); int n = vevo_property_num_elements( fxi, "in_parameters" );
if( osc_port ) if( osc_port )
sample_produce_khagan_widget( osc_port, port_num, rootnode ,n); sample_produce_khagan_widget( osc_port, port_num, rootnode ,n);
}
}
int id = 0;
error = vevo_property_get( srd->info_port, "primary_key", 0, &id );
char filename[256]; char filename[256];
char sfilename[256]; sprintf(filename, "sample_%d_fx_%d.kh", id,k );
sprintf(sfilename, "Fsample_%d.kh", id );
sprintf(filename, "sample_%d.kh", id );
// void xmlDocDump(FILE *f, xmlDocPtr doc);
FILE *res = fopen( filename , "w" ); FILE *res = fopen( filename , "w" );
if(!res) if(!res)
veejay_msg(0, "Cannot write to %s",filename); veejay_msg(0, "Cannot write to %s",filename);
@@ -3906,7 +3896,8 @@ void sample_produce_khagan_file( void *sample )
xmlDocDump( res, doc ); xmlDocDump( res, doc );
fclose(res); fclose(res);
int ret = xmlSaveFormatFileEnc( sfilename, doc, encoding , 1 );
xmlFreeDoc( doc ); xmlFreeDoc( doc );
}
}
} }

View File

@@ -56,8 +56,8 @@ void sample_fx_get_parameter( int id, int fx_enty,int param_id,int idx, void *d
void sample_toggle_process_entry( void *data, int fx_entry, int v ); void sample_toggle_process_entry( void *data, int fx_entry, int v );
int sample_fx_set_active( int id, int fx_entry, int switch_value); int sample_fx_set_active( int id, int fx_entry, int switch_value);
int sample_fx_set_channel( int id, int fx_entry, int n_input, int channel_id ); int sample_fx_set_channel( int id, int fx_entry, int n_input, int channel_id );
int sample_get_fx_alpha( void *data, int fx_entry ); double sample_get_fx_alpha( void *data, int fx_entry );
void sample_set_fx_alpha( void *data, int fx_entry, int v ); void sample_set_fx_alpha( void *data, int fx_entry, double v );
void sample_set_itu601( void *current_sample, int status ); void sample_set_itu601( void *current_sample, int status );
int sample_fx_set( void *info, int fx_entry, const int new_fx ); int sample_fx_set( void *info, int fx_entry, const int new_fx );
void sample_process_fx_chain( void *srd ); void sample_process_fx_chain( void *srd );

View File

@@ -289,7 +289,7 @@ char **vj_unicap_get_list( void *ud )
int n = i; int n = i;
char **res = (char**) malloc(sizeof(char*) * (n+1) ); char **res = (char**) vj_malloc(sizeof(char*) * (n+1) );
memset(res, 0,sizeof(char*) * (n+1)); memset(res, 0,sizeof(char*) * (n+1));
for( i = 0;i < n; i ++ ) for( i = 0;i < n; i ++ )

View File

@@ -28,6 +28,7 @@
#include <string.h> #include <string.h>
/* see vj-v4lvideo for details about structure */ /* see vj-v4lvideo for details about structure */
#include <mjpegtools/mpegconsts.h> #include <mjpegtools/mpegconsts.h>
#include <libvjmem/vjmem.h>
typedef struct { typedef struct {
y4m_stream_info_t streaminfo; y4m_stream_info_t streaminfo;
@@ -46,7 +47,7 @@ int bytecount = 0;
void *vj_yuv4mpeg_alloc(float fps, int w, int h, int sar_w, int sar_h) void *vj_yuv4mpeg_alloc(float fps, int w, int h, int sar_w, int sar_h)
{ {
vj_yuv *yuv4mpeg = (void *) malloc(sizeof(vj_yuv)); vj_yuv *yuv4mpeg = (void *) vj_malloc(sizeof(vj_yuv));
if(!yuv4mpeg) return NULL; if(!yuv4mpeg) return NULL;
yuv4mpeg->sar = y4m_sar_UNKNOWN; yuv4mpeg->sar = y4m_sar_UNKNOWN;
yuv4mpeg->dar = y4m_dar_4_3; yuv4mpeg->dar = y4m_dar_4_3;