added dialog box, bugfixes to veejay-ng and veejay-ui

git-svn-id: svn://code.dyne.org/veejay/trunk@623 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
Niels Elburg
2006-10-08 19:23:53 +00:00
parent 5e892ca5ac
commit 777567c7a5
10 changed files with 262 additions and 78 deletions

View File

@@ -446,7 +446,14 @@ static int livido_scan_out_parameters( void *plugin , void *plugger_port)
sprintf(key, "p%02d", n );
int ikind = 0;
char *kind = get_str_vevo( param, "kind" );
char *kind = vevo_property_get_string( param, "kind" );
//get_str_vevo( param, "kind" );
#ifdef STRICT_CHECKING
if( kind == NULL )
veejay_msg(0, "\tParameter %d of %d has no property kind", n,NP );
assert( kind != NULL );
#endif
ikind = livido_pname_to_host_kind(kind);

View File

@@ -377,17 +377,19 @@ void subsample_ycbcr_clamp_itu601_copy(VJFrame *frame, VJFrame *dst_frame)
__asm__ __volatile__ ("emms":::"memory");
#endif
}
/*
#ifdef HAVE_ASM_MMX
void subsample_clear_plane( uint8_t bval, uint8_t *plane, uint32_t plane_len )
{
unsigned int k = 0;
unsigned int align = (plane_len/64);
double val = (double) bval;
__asm__ __volatile__ (
"pxor %%mm0, %%mm0\n"
:: );
"movq %%mm0, (%0)\n"
:: "r" (val) );
for( k = 0; k < align ; k ++ )
{
@@ -413,15 +415,14 @@ void subsample_clear_plane( uint8_t bval, uint8_t *plane, uint32_t plane_len )
}
__asm__ __volatile__ ("sfence":::"memory");
__asm__ __volatile__ ("emms":::"memory");
}
#else
}*/
//#else
void subsample_clear_plane( uint8_t bval, uint8_t *plane, uint32_t plane_len )
{
memset( plane, bval, plane_len );
}
#endif
//#endif
/*************************************************************************
* Chroma Subsampling
@@ -889,7 +890,6 @@ static void tr_422_to_444(uint8_t *buffer, int width, int height)
const int mmx_stride = stride / 8;
#endif
int x,y;
for( y = height-1; y > 0 ; y -- )
{
uint8_t *dst = buffer + (y * width);

View File

@@ -92,6 +92,15 @@ static int max_power(int w)
return i;
}
static uint8_t _dilate_kernel3x3( uint8_t *kernel, uint8_t img[9])
{
register int x;
for(x = 0; x < 9; x ++ )
if((kernel[x] * img[x]) > 0 )
return 0xff;
return 0;
}
static int lvd_is_yuv444( int palette )
{
if( palette == LIVIDO_PALETTE_YUV444P )
@@ -122,6 +131,36 @@ static int lvd_uv_plane_len( int palette, int w, int h )
return 0;
}
static int lvd_uv_dimensions( int palette, int w, int h, int *uw, int *uh )
{
switch(palette)
{
case LIVIDO_PALETTE_YUV422P:
*uw = w;
*uh = h/2;
return 1;
break;
case LIVIDO_PALETTE_YUV420P:
*uw = w/2;
*uh = h/2;
return 1;
break;
case LIVIDO_PALETTE_YUV444P:
*uw = w;
*uh = h;
return 1;
break;
default:
#ifdef STRICT_CHECKING
assert(0);
#endif
break;
}
return 0;
}
static double lvd_extract_param_number( livido_port_t *instance, const char *pname, int n )
{
double pn = 0.0;

View File

@@ -665,6 +665,53 @@ GtkWidget *director_get_sample_pad(void)
return SamplePad_;
}
void on_about_clicked(GtkWidget *w, gpointer user_data)
{
const gchar *authors[] = {
"Niels Elburg <nelburg@looze.net>",
NULL
};
const gchar *license =
{
"Veejay-NG\thttp://veejay.dyne.org\n\n"\
"This program is Free Software; You can redistribute it and/or modify\n"\
"under the terms of the GNU General Public License as published by\n" \
"the Free Software Foundation; either version 2, or (at your option)\n"\
"any later version.\n\n"\
"This program is distributed in the hope it will be useful,\n"\
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"\
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"\
"See the GNU General Public License for more details.\n\n"\
"For more information , see also: http://www.gnu.org\n"
};
char path[1024];
bzero(path,1024);
//get_gd( path, NULL, "veejay-logo.png" );
// sprintf(path,"/usr/local/share/veejay/veejay-logo.png");
// GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file
// ( path, NULL );
GtkWidget *about = g_object_new(
GTK_TYPE_ABOUT_DIALOG,
"name", "Veejay-NG Live User Interface",
"version", VERSION,
"copyright", "(C) 2004 - 2006 N. Elburg",
"comments", "A graphical interface for Veejay-NG",
"authors", authors,
"license", license,
NULL,NULL,NULL );
//"logo", pixbuf, NULL );
//g_object_unref(pixbuf);
g_signal_connect( about , "response", G_CALLBACK( gtk_widget_destroy),NULL);
gtk_window_present( GTK_WINDOW( about ) );
}
void director_construct_local_widgets( )
{
GtkWidget *win = gtk_window_new( GTK_WINDOW_TOPLEVEL );
@@ -718,7 +765,11 @@ void director_construct_local_widgets( )
gtk_box_pack_end_( mbox, but, FALSE,FALSE, 0);
but = gtk_button_new_with_label( "Save Samples" );
gtk_box_pack_end_( mbox, but, FALSE,FALSE, 0);
but = gtk_button_new_with_label( "About" );
g_signal_connect( but, "clicked", (GCallback) on_about_clicked, win );
gtk_box_pack_end_( mbox, but, FALSE,FALSE, 0);
gtk_box_pack_end_( hbox, frame, TRUE,TRUE, 0 );
gtk_widget_show(frame);
gtk_widget_show( bbox );

View File

@@ -543,8 +543,8 @@ void osc_new_label(const char *path, const char *types,
char *window_name = &argv[0]->s;
char *panel_name = &argv[1]->s;
char *label = &argv[2]->s;
char *label_name = &argv[3]->s;
char *label_name = &argv[2]->s;
char *label = &argv[3]->s;
int widget_type = LABEL;
if( vevo_property_get(info->tree, window_name,0,&stats ) == VEVO_NO_ERROR )
@@ -555,7 +555,7 @@ void osc_new_label(const char *path, const char *types,
veejay_msg(0,"Widget '%s' is not in register!\n", panel_name);
return;
}
builder_new_label_object( stats, container, label_name, label );
builder_new_label_object( stats, container, label, label_name );
// builder_register_widget(
// stats, window_name, window );
}

View File

@@ -95,8 +95,9 @@ typedef struct
int last; //<<! Last rendered entry
int dlast;
} performer_t;
#ifdef STRICT_CHECKING
static int performer_verify_frame( VJFrame *f );
#endif
//! Allocate a new Chunk depending on output pixel format
/**!
\param info Veejay Object
@@ -152,6 +153,11 @@ static VJFrame *performer_alloc_frame( veejay_t *info, uint8_t *p0, uint8_t *p1,
f->data[1] = p1;
f->data[2] = p2;
f->data[3] = p3;
#ifdef STRICT_CHECKING
assert( performer_verify_frame( f) );
#endif
return f;
}
@@ -491,7 +497,7 @@ void *performer_get_output_frame( veejay_t *info )
void performer_clean_output_frame( veejay_t *info )
{
performer_t *p = (performer_t*) info->performer;
memset( p->display->data[0],0,p->display->len );
memset( p->display->data[0],16,p->display->len );
memset( p->display->data[1],128,p->display->uv_len );
memset( p->display->data[2],128,p->display->uv_len );
}
@@ -909,6 +915,39 @@ static int performer_push_in_frames( void *sample, performer_t *p, int i )
return n_channels;
}
#ifdef STRICT_CHECKING
static int performer_verify_frame( VJFrame *f )
{
int i;
int u = f->uv_len - f->uv_width;
int un = f->uv_len;
int y = f->len - f->width;
int yn = f->len;
int fu = 0;
int fy = 0;
long avg = 0;
int avg_;
for( i = u; i < un; i ++ )
{
if( f->data[1][i] < 16 )
fu ++;
if( f->data[2][i] < 16 )
fu ++;
}
for( i = y; i < yn; i ++ )
{
if( f->data[0][i] < 16)
{ fy ++; avg += f->data[0][i]; avg_ ++; }
}
if( fu > 0 || fy > 0 )
{
veejay_msg(0, "Last line fail count: %d,%d, Y average = %d", fu,fy, ( avg > 0 ? avg / avg_ :0 ));
return 0;
}
return 1;
}
#endif
static int performer_render_entry( veejay_t *info, void *sample, performer_t *p, int i)
{
#ifdef STRICT_CHECKING
@@ -982,6 +1021,9 @@ static void performer_render_frame( veejay_t *info, int i )
#endif
performer_t *p = (performer_t*) info->performer;
p->display = p->ref_buffer[0];
#ifdef STRICT_CHECKING
assert( performer_verify_frame(p->fx_buffer[0]) );
#endif
for( i = 0; i < SAMPLE_CHAIN_LEN; i ++ )
{
if( sample_get_fx_status( cs, i ))

View File

@@ -1,7 +1,9 @@
#ifndef LOCALDEFS
#define LOCALDEFS
#include <stdint.h>
#define BIND_OUT_P 0
#define BIND_IN_P 1
#define BIND_ENTRY 2
//! \typedef sampleinfo_t Sample A/V Information structure
typedef struct
{
@@ -50,8 +52,7 @@ typedef struct
{
double min[2];
double max[2];
int p[2];
int entry;
int p[3];
int kind;
} bind_parameter_t;

View File

@@ -351,7 +351,7 @@ veejay_msg(0, "UI Factory: There are %d input channels", n );
parameter, "value " );
veejay_ui_bundle_add( osc_send, "/create/label",
"ssssx", window,fx_frame,param_id, (parameter_value==NULL ? "inf" : parameter_value) ); //@ updated by apply_bind !!!
"ssssx", window,fx_frame,param_id, (parameter_value==NULL ? " " : parameter_value) ); //@ updated by apply_bind !!!
if(parameter_value)
free(parameter_value);
free(parameter_name );
@@ -494,13 +494,17 @@ void vevosample_ui_get_bind_list( void *sample, const char *window )
for( i = 0; items[i] != NULL ; i ++ )
{
int n[3];
sscanf( items[i], "bp%d_%d_%d", &n[0],&n[1],&n[2] );
fx_slot_t *rel = (fx_slot_t*) sample_get_fx_port_ptr( srd, n[1]);
#ifdef STRICT_CHECKING
assert( sscanf( items[i], "bp%d_%d_%d",&n[BIND_OUT_P],&n[BIND_ENTRY],&n[BIND_IN_P] ) == 3 );
#else
sscanf( items[i], "bp%d_%d_%d", &n[BIND_OUT_P],&n[BIND_ENTRY],&n[BIND_IN_P] );
#endif
fx_slot_t *rel = (fx_slot_t*) sample_get_fx_port_ptr( srd, n[BIND_ENTRY]);
#ifdef STRICT_CHECKING
assert( rel->fx_instance != NULL );
#endif
if( n[0] == p_num && vevo_property_get(sl->bind, items[i],0,NULL) == VEVO_NO_ERROR )
if( n[BIND_OUT_P] == p_num && vevo_property_get(sl->bind, items[i],0,NULL) == VEVO_NO_ERROR )
{
veejay_msg(0, "'%s' is a valid bind",items[i]);
void *filter_template = NULL;
@@ -510,10 +514,10 @@ void vevosample_ui_get_bind_list( void *sample, const char *window )
#endif
char *fxname = vevo_property_get_string( filter_template, "name" );
char *pname = _get_in_parameter_name( rel->fx_instance, n[2] );
char *pname = _get_in_parameter_name( rel->fx_instance, n[BIND_IN_P] );
char list_item[128];
snprintf(list_item, 128, "fx_%d '%s' p%d '%s'",
n[1], fxname,n[2], pname );
n[BIND_ENTRY], fxname,n[BIND_IN_P], pname );
veejay_message_add_argument( osc_send, msg, "s", list_item );
@@ -564,13 +568,13 @@ static void vevosample_ui_construct_bind_list( void *sample, int k, int p_num, v
for( i = 0; items[i] != NULL ; i ++ )
{
int n[3];
sscanf( items[i], "bp%d_%d_%d", &n[0],&n[1],&n[2] );
fx_slot_t *rel = (fx_slot_t*) sample_get_fx_port_ptr( srd, n[1]);
sscanf( items[i], "bp%d_%d_%d", &n[BIND_OUT_P],&n[BIND_ENTRY],&n[BIND_IN_P] );
fx_slot_t *rel = (fx_slot_t*) sample_get_fx_port_ptr( srd, n[BIND_ENTRY]);
#ifdef STRICT_CHECKING
assert( rel->fx_instance != NULL );
#endif
if( n[0] == p_num && vevo_property_get( slot->bind, items[i],0,NULL) == VEVO_NO_ERROR)
if( n[BIND_OUT_P] == p_num && vevo_property_get( slot->bind, items[i],0,NULL) == VEVO_NO_ERROR)
{
void *filter_template = NULL;
int error = vevo_property_get( rel->fx_instance, "filter_templ",0 ,&filter_template );
@@ -579,10 +583,10 @@ static void vevosample_ui_construct_bind_list( void *sample, int k, int p_num, v
#endif
char *fxname = vevo_property_get_string( filter_template, "name" );
char *pname = _get_in_parameter_name( rel->fx_instance, n[2] );
char *pname = _get_in_parameter_name( rel->fx_instance, n[BIND_IN_P] );
char list_item[128];
snprintf(list_item, 128, "fx_%d '%s' p%d '%s'",
n[1], fxname, n[2],pname );
n[BIND_ENTRY], fxname, n[BIND_IN_P],pname );
veejay_message_add_argument( osc_send, msg, "s", list_item );

View File

@@ -265,6 +265,8 @@ static struct
};
void *find_sample(int id)
{
if( id < 0 || id > SAMPLE_LIMIT )
@@ -3613,9 +3615,9 @@ void *sample_new_bind_parameter( void *fx_a, void *fx_b, int n_out_p, int n_in_p
free(bt);
return NULL;
}
bt->p[0] = n_out_p;
bt->p[1] = n_in_p;
bt->entry = n_in_entry;
bt->p[BIND_OUT_P] = n_out_p;
bt->p[BIND_IN_P] = n_in_p;
bt->p[BIND_ENTRY] = n_in_entry;
veejay_msg(0, "New bind %d %d %d", n_out_p,n_in_p, n_in_entry );
@@ -3632,6 +3634,7 @@ int sample_new_bind( void *sample, void *src_entry,int n_out_p, int dst_entry,
char param_key[64];
sample_runtime_data *srd = (sample_runtime_data*) sample;
veejay_msg(0, "Out = %d, In = %d, Entry = %d", n_out_p, n_in_p, dst_entry );
fx_slot_t *dst_slot = sample_get_fx_port_ptr( srd, dst_entry );
fx_slot_t *src_slot = (fx_slot_t*) src_entry;
@@ -3698,65 +3701,87 @@ int sample_apply_bind( void *sample, void *current_entry, int k_entry )
{
void *bp = NULL;
int error = vevo_property_get( slot->bind, items[i],0,&bp );
veejay_msg(0,"\t apply bind '%s' : error %d", items[i], error );
if( error == VEVO_NO_ERROR )
{
bind_parameter_t *bpt = (bind_parameter_t*) bp;
void *fx_b = NULL;
fx_slot_t *dst_slot = sample_get_fx_port_ptr( srd, bpt->entry );
bind_parameter_t *bpt = (bind_parameter_t*) bp;
if(dst_slot->active && slot->active)
{
double weight = 0.0;
int iw = 0;
double value=0.0;
char *path = plug_get_osc_path_parameter( dst_slot->fx_instance, bpt->p[1] );
char *fmt = plug_get_osc_format( dst_slot->fx_instance, bpt->p[1]);
char pkey[8];
sprintf(pkey, "p%02d",bpt->p[0]);
void *sender = veejay_get_osc_sender( srd->user_data );
void *fx_b = NULL;
fx_slot_t *dst_slot = sample_get_fx_port_ptr( srd, bpt->p[BIND_ENTRY] );
char *output_pname[128];
char *output_pval = vevo_sprintf_property_value( slot->out_values, pkey );
sprintf(output_pname, "o%02d", bpt->p[0]);
if(bpt->kind == HOST_PARAM_INDEX)
if(dst_slot->active && slot->active)
{
if( vevo_property_get( slot->out_values, pkey,0,&value ) == VEVO_NO_ERROR )
double weight = 0.0;
int iw = 0;
double value=0.0;
char *path = plug_get_osc_path_parameter( dst_slot->fx_instance, bpt->p[BIND_IN_P] );
char *fmt = plug_get_osc_format( dst_slot->fx_instance, bpt->p[BIND_IN_P]);
char pkey[8];
sprintf(pkey, "p%02d",bpt->p[BIND_OUT_P]);
void *sender = veejay_get_osc_sender( srd->user_data );
char *output_pname[128];
char *output_pval = vevo_sprintf_property_value( slot->out_values, pkey );
sprintf(output_pname, "o%02d", bpt->p[BIND_OUT_P]);
if(bpt->kind == HOST_PARAM_INDEX)
{
weight = 1.0 / (bpt->max[1] - bpt->min[1]);
iw = (int) ( value * weight );
plug_set_parameter( dst_slot->fx_instance, bpt->p[1], 1, &iw );
if(path && sender)
veejay_bundle_add( sender, path, fmt, iw );
if(sender)
veejay_xbundle_add( sender,dwin , output_pname,"s", (output_pval==NULL ? " " : output_pval) );
if( vevo_property_get( slot->out_values, pkey,0,&value ) == VEVO_NO_ERROR )
{
weight = 1.0 / (bpt->max[1] - bpt->min[1]);
iw = (int) ( value * weight );
plug_set_parameter( dst_slot->fx_instance, bpt->p[BIND_IN_P], 1, &iw );
if(path && sender)
veejay_bundle_add( sender, path, fmt, iw );
if(sender)
veejay_xbundle_add( sender,dwin , output_pname,"s", (output_pval==NULL ? " " : output_pval) );
}
}
}
else if(bpt->kind == HOST_PARAM_NUMBER)
{
if( vevo_property_get( slot->out_values, pkey,0,&value ) == VEVO_NO_ERROR )
else if(bpt->kind == HOST_PARAM_NUMBER)
{
double norm = (1.0 / (bpt->max[0] - bpt->min[0])) * value;
double gv = (bpt->max[1] - bpt->min[1]) * norm + bpt->min[1];
plug_set_parameter( dst_slot->fx_instance, bpt->p[1], 1, &gv );
if(path && sender)
veejay_bundle_add( sender, path, fmt, gv );
if(sender)
veejay_xbundle_add( sender, dwin, output_pname,"s",(output_pval==NULL ? " " : output_pval));
int err = vevo_property_get( slot->out_values, pkey,0,&value );
if( err == VEVO_NO_ERROR )
{
double norm = (1.0 / (bpt->max[0] - bpt->min[0])) * value;
double gv = (bpt->max[1] - bpt->min[1]) * norm + bpt->min[1];
plug_set_parameter( dst_slot->fx_instance, bpt->p[BIND_IN_P], 1, &gv );
if(path && sender)
veejay_bundle_add( sender, path, fmt, gv );
if(sender)
veejay_xbundle_add( sender, dwin, output_pname,"s",(output_pval==NULL ? " " : output_pval));
}
#ifdef STRICT_CHECKING
else
{
veejay_msg(0, "key is '%s' , error code %d", pkey,err );
char **items = vevo_list_properties( slot->out_values );
if(!items) veejay_msg(0,"\tThere are no items!");
else
{
int l;
for(l =0; items[l] != NULL;l++ )
{
veejay_msg(0,"have item '%s'", items[l]);
free(items[l]);
}
free(items[l]);
}
}
#endif
}
if(path) free(path);
if(fmt) free(fmt);
if(output_pval) free(output_pval);
}
else
{
veejay_msg(0, "Kind is not compatible: %d", bpt->kind );
}
if(path) free(path);
if(fmt) free(fmt);
if(output_pval) free(output_pval);
}
}
free( items[i] );
}
free(items);

View File

@@ -581,7 +581,7 @@ int vj_unicap_configure_device( void *ud, int pixel_format, int w, int h )
return 0;
}
vut->deinterlace = 1;
// vut->deinterlace = 1;
}
else
{
@@ -674,6 +674,14 @@ int vj_unicap_start_capture( void *vut, void *slot )
veejay_msg( 0, "Failed to start capture on device: %s\n", v->device.identifier );
return 0;
}
if( !SUCCESS( unicap_queue_buffer( v->handle, &(v->buffer) ) ) )
{
veejay_msg( 0, "Failed to queue a buffer on device: %s\n", v->device.identifier );
// unicap_unlock_properties( v->handle );
return 0;
}
v->active = 1;
return 1;
}
@@ -694,13 +702,13 @@ int vj_unicap_grab_frame( void *vut, void *slot )
}
}
if( !SUCCESS( unicap_queue_buffer( v->handle, &(v->buffer) ) ) )
/* if( !SUCCESS( unicap_queue_buffer( v->handle, &(v->buffer) ) ) )
{
veejay_msg( 0, "Failed to queue a buffer on device: %s\n", v->device.identifier );
unicap_unlock_properties( v->handle );
return 0;
}
}*/
if( !SUCCESS( unicap_wait_buffer( v->handle, &(v->returned_buffer )) ) )
{
@@ -709,6 +717,13 @@ int vj_unicap_grab_frame( void *vut, void *slot )
return 0;
}
if( !SUCCESS( unicap_queue_buffer( v->handle, &(v->buffer) ) ) )
{
veejay_msg( 0, "Failed to queue a buffer on device: %s\n", v->device.identifier );
unicap_unlock_properties( v->handle );
return 0;
}
if( v->deinterlace )
{