mirror of
https://github.com/game-stop/veejay.git
synced 2025-12-20 06:40:01 +01:00
fixed v4l deinterlacer, added UI factory, bugfixes, speed up,many changes
git-svn-id: svn://code.dyne.org/veejay/trunk@601 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
@@ -26,7 +26,7 @@ VEVOSAMPLE_ALL_LIB_OPTS = \
|
|||||||
-release $(LT_RELEASE) \
|
-release $(LT_RELEASE) \
|
||||||
-export-dynamic
|
-export-dynamic
|
||||||
|
|
||||||
libvevosample_la_SOURCES = vj-unicap.c vj-yuv4mpeg.c vevosample.c
|
libvevosample_la_SOURCES = vj-unicap.c vj-yuv4mpeg.c uifactory.c vevosample.c
|
||||||
libvevosample_la_LIBADD = \
|
libvevosample_la_LIBADD = \
|
||||||
-L$(top_builddir)/libhash -lhash \
|
-L$(top_builddir)/libhash -lhash \
|
||||||
-L$(top_builddir)/libvjmsg -lvjmsg \
|
-L$(top_builddir)/libvjmsg -lvjmsg \
|
||||||
|
|||||||
97
veejay-ng/vevosample/ldefs.h
Normal file
97
veejay-ng/vevosample/ldefs.h
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
#ifndef LOCALDEFS
|
||||||
|
#define LOCALDEFS
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
//! \typedef sampleinfo_t Sample A/V Information structure
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint64_t start_pos; //!< Starting position
|
||||||
|
uint64_t end_pos; //!< Ending position
|
||||||
|
int looptype; //!< Looptype
|
||||||
|
int speed; //!< Playback speed
|
||||||
|
int repeat;
|
||||||
|
uint64_t in_point; //!< In point (overrides start_pos)
|
||||||
|
uint64_t out_point; //!< Out point (overrides end_pos)
|
||||||
|
uint64_t current_pos; //!< Current position
|
||||||
|
int marker_lock; //!< Keep in-out point length constant
|
||||||
|
int rel_pos; //!< Relative position
|
||||||
|
int has_audio; //!< Audio available
|
||||||
|
int repeat_count;
|
||||||
|
int type; //!< Type of Sample
|
||||||
|
uint64_t rate; //!< AudioRate
|
||||||
|
double fps; //!< Frame rate of Sample
|
||||||
|
int bps;
|
||||||
|
int bits;
|
||||||
|
int channels;
|
||||||
|
double rec; //!< Rec. percentage done
|
||||||
|
} sampleinfo_t;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int id;
|
||||||
|
int active;
|
||||||
|
int fx_id;
|
||||||
|
void *fx_osc;
|
||||||
|
void *fx_instance;
|
||||||
|
void *in_values;
|
||||||
|
void *out_values;
|
||||||
|
void *in_channels;
|
||||||
|
void *out_channels;
|
||||||
|
void *bind;
|
||||||
|
char *window;
|
||||||
|
char *frame;
|
||||||
|
char *subwindow;
|
||||||
|
char *subframe;
|
||||||
|
double alpha;
|
||||||
|
} fx_slot_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
double min[2];
|
||||||
|
double max[2];
|
||||||
|
int p[2];
|
||||||
|
int entry;
|
||||||
|
int kind;
|
||||||
|
} bind_parameter_t;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int rec;
|
||||||
|
int con;
|
||||||
|
int max_size;
|
||||||
|
int format;
|
||||||
|
char aformat;
|
||||||
|
void *fd;
|
||||||
|
long tf;
|
||||||
|
long nf;
|
||||||
|
uint8_t *buf;
|
||||||
|
void *codec;
|
||||||
|
} samplerecord_t;
|
||||||
|
|
||||||
|
//! \typedef sample_runtime_data Sample Runtime Data structure
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
void *data; /* private data, depends on stream type */
|
||||||
|
void *info_port; /* collection of sample properties */
|
||||||
|
int width; /* processing information */
|
||||||
|
int height;
|
||||||
|
int format;
|
||||||
|
int palette;
|
||||||
|
int type; /* type of sample */
|
||||||
|
samplerecord_t *record;
|
||||||
|
sampleinfo_t *info;
|
||||||
|
void *osc;
|
||||||
|
void *user_data;
|
||||||
|
void *mapping;
|
||||||
|
void *rmapping;
|
||||||
|
void *bundle;
|
||||||
|
int primary_key;
|
||||||
|
void *fmt_port;
|
||||||
|
} sample_runtime_data;
|
||||||
|
|
||||||
|
char *sample_translate_property( void *sample, char *name );
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
927
veejay-ng/vevosample/uifactory.c
Normal file
927
veejay-ng/vevosample/uifactory.c
Normal file
@@ -0,0 +1,927 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2002-2006 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
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <vevosample/vevosample.h>
|
||||||
|
#include <vevosample/defs.h>
|
||||||
|
#include <vevosample/uifactory.h>
|
||||||
|
#include <vevosample/ldefs.h>
|
||||||
|
#include <vevosample/defs.h>
|
||||||
|
#include <libplugger/ldefs.h>
|
||||||
|
#include <libvevo/libvevo.h>
|
||||||
|
|
||||||
|
#include <veejay/oscsend.h>
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
#include <assert.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static void vevosample_ui_type_shared( void *sample, char *window );
|
||||||
|
static void vevosample_ui_type_capture( void *sample, const char *window, const char *frame);
|
||||||
|
static void vevosample_ui_type_none( void *sample, const char *window, const char *frame);
|
||||||
|
static void vevosample_ui_construct_fx_contents( void *sample, int entry_id, const char *window , const char *fx_frame);
|
||||||
|
static char * vevosample_ui_new_window( sample_runtime_data *src, const char *window_prefix, const int id, const char *title, const char *infix, int suffix );
|
||||||
|
|
||||||
|
|
||||||
|
void vevosample_ui_new_vframe( void *sample, const char *window, const char *frame, const char *label )
|
||||||
|
{
|
||||||
|
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||||
|
void *osc_send = veejay_get_osc_sender(srd->user_data );
|
||||||
|
if(!osc_send)
|
||||||
|
return;
|
||||||
|
veejay_ui_bundle_add(
|
||||||
|
osc_send,
|
||||||
|
"/create/vframe",
|
||||||
|
"sssx",
|
||||||
|
window,
|
||||||
|
frame,
|
||||||
|
label );
|
||||||
|
}
|
||||||
|
void vevosample_ui_new_frame( void *sample, const char *window, const char *frame, const char *label )
|
||||||
|
{
|
||||||
|
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||||
|
void *osc_send = veejay_get_osc_sender(srd->user_data );
|
||||||
|
if(!osc_send)
|
||||||
|
return;
|
||||||
|
veejay_ui_bundle_add(
|
||||||
|
osc_send,
|
||||||
|
"/create/frame",
|
||||||
|
"sssx",
|
||||||
|
window,
|
||||||
|
frame,
|
||||||
|
label );
|
||||||
|
}
|
||||||
|
|
||||||
|
void vevosample_ui_new_button( void *sample, const char *window, const char *frame, const char *label,
|
||||||
|
const char *path, const char *tooltip )
|
||||||
|
{
|
||||||
|
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||||
|
void *osc_send = veejay_get_osc_sender(srd->user_data );
|
||||||
|
if(!osc_send)
|
||||||
|
return;
|
||||||
|
|
||||||
|
veejay_ui_bundle_add(
|
||||||
|
osc_send,
|
||||||
|
"/create/button",
|
||||||
|
"sssssx",
|
||||||
|
window,
|
||||||
|
frame,
|
||||||
|
label,
|
||||||
|
path,
|
||||||
|
tooltip );
|
||||||
|
}
|
||||||
|
void vevosample_ui_new_label( void *sample, const char *window, const char *frame, const char *label )
|
||||||
|
{
|
||||||
|
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||||
|
void *osc_send = veejay_get_osc_sender(srd->user_data );
|
||||||
|
if(!osc_send)
|
||||||
|
return;
|
||||||
|
|
||||||
|
veejay_ui_bundle_add(
|
||||||
|
osc_send,
|
||||||
|
"/create/label",
|
||||||
|
"sssx",
|
||||||
|
window,
|
||||||
|
frame,
|
||||||
|
label );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void vevosample_ui_new_numeric( void *sample, const char *window, const char *frame, const char *label,
|
||||||
|
double min, double max, double value, int wrap, int extra, const char *widget_name,
|
||||||
|
const char *path, const char *format, const char *tooltip)
|
||||||
|
|
||||||
|
{
|
||||||
|
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||||
|
void *osc_send = veejay_get_osc_sender(srd->user_data );
|
||||||
|
if(!osc_send)
|
||||||
|
return;
|
||||||
|
veejay_ui_bundle_add(
|
||||||
|
osc_send,
|
||||||
|
"/create/numeric",
|
||||||
|
"sssdddiissssx",
|
||||||
|
window,
|
||||||
|
frame,
|
||||||
|
label,
|
||||||
|
min,
|
||||||
|
max,
|
||||||
|
value,
|
||||||
|
wrap,
|
||||||
|
extra,
|
||||||
|
widget_name,
|
||||||
|
path,
|
||||||
|
format,
|
||||||
|
tooltip);
|
||||||
|
}
|
||||||
|
|
||||||
|
void vevosample_ui_new_radiogroup( void *osc, const char *window, const char *framename , const char *prefix,const char *label_prefix, int n_buttons, int active_button )
|
||||||
|
{
|
||||||
|
veejay_ui_bundle_add( osc, "/create/radiogroup", "ssssii", window,framename,prefix,label_prefix,
|
||||||
|
n_buttons, active_button );
|
||||||
|
}
|
||||||
|
void vevosample_ui_new_switch( void *sample, const char *window, const char *framename , const char *widget,const char *label, int active, const char *path, const char *tooltip)
|
||||||
|
{
|
||||||
|
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||||
|
void *osc_send = veejay_get_osc_sender(srd->user_data );
|
||||||
|
if(!osc_send)
|
||||||
|
return;
|
||||||
|
veejay_ui_bundle_add( osc_send, "/create/switch", "ssssissx", window,framename,widget,label,active,path,tooltip );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static void vevosample_ui_construct_fx_contents( void *sample, int entry_id, const char *window , const char *fx_frame)
|
||||||
|
{
|
||||||
|
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||||
|
void *osc_send = veejay_get_osc_sender( srd->user_data );
|
||||||
|
int id = 0;
|
||||||
|
if(!osc_send)
|
||||||
|
return;
|
||||||
|
fx_slot_t *slot = sample_get_fx_port_ptr( srd, entry_id );
|
||||||
|
if(slot->window)
|
||||||
|
free(slot->window);
|
||||||
|
slot->window = strdup( window );
|
||||||
|
|
||||||
|
int error = vevo_property_get( srd->info_port, "primary_key", 0, &id );
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( error == VEVO_NO_ERROR );
|
||||||
|
#endif
|
||||||
|
void *filter_template = NULL;
|
||||||
|
error = vevo_property_get( slot->fx_instance, "filter_templ",0 ,&filter_template );
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( error == VEVO_NO_ERROR );
|
||||||
|
#endif
|
||||||
|
char *label_str = vevo_property_get_string( filter_template, "name" );
|
||||||
|
char label[128];
|
||||||
|
sprintf( label, "FX slot %d with \"%s\" ", entry_id, label_str );
|
||||||
|
free(label_str);
|
||||||
|
|
||||||
|
sprintf(fx_frame, "fx_%d", entry_id );
|
||||||
|
|
||||||
|
veejay_ui_bundle_add( osc_send, "/create/frame", "sssx", window, fx_frame, label );
|
||||||
|
|
||||||
|
char alpha_tmp[128];
|
||||||
|
sprintf( alpha_tmp, "/sample_%d/fx_%d/alpha", id, entry_id );
|
||||||
|
|
||||||
|
veejay_ui_bundle_add( osc_send, "/create/numeric", "sssdddiissssx",window,fx_frame,
|
||||||
|
"Alpha", 0.0, 1.0, slot->alpha,2,0,"VSlider",alpha_tmp, "d", "Transparency" );
|
||||||
|
|
||||||
|
|
||||||
|
sprintf( alpha_tmp, "/sample_%d/fx_%d/status", id, entry_id);
|
||||||
|
|
||||||
|
veejay_ui_bundle_add( osc_send, "/create/switch", "ssssissx", window, fx_frame, "Check",
|
||||||
|
"Enabled", slot->active, alpha_tmp, "Turn on/off FX" );
|
||||||
|
|
||||||
|
int q;
|
||||||
|
int n = vevo_property_num_elements( slot->fx_instance, "in_parameters" );
|
||||||
|
|
||||||
|
for( q = 0; q < n ; q ++ )
|
||||||
|
{
|
||||||
|
void *parameter = NULL;
|
||||||
|
error = vevo_property_get( slot->fx_instance, "in_parameters", q, ¶meter );
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( error == VEVO_NO_ERROR );
|
||||||
|
#endif
|
||||||
|
void *parameter_templ = NULL;
|
||||||
|
error = vevo_property_get( parameter, "parent_template",0,¶meter_templ);
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( error == VEVO_NO_ERROR );
|
||||||
|
#endif
|
||||||
|
int kind = 0;
|
||||||
|
error = vevo_property_get( parameter_templ, "HOST_kind",0,&kind );
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( error == VEVO_NO_ERROR );
|
||||||
|
#endif
|
||||||
|
char *parameter_name = vevo_property_get_string(parameter_templ, "name" );
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( parameter_name != NULL );
|
||||||
|
#endif
|
||||||
|
char *osc_path = vevo_property_get_string(parameter, "HOST_osc_path" );
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
if( !osc_path )
|
||||||
|
veejay_msg(0,"No osc path for '%s' ",parameter_name );
|
||||||
|
assert( osc_path != NULL );
|
||||||
|
#endif
|
||||||
|
int ival = 0;
|
||||||
|
double gval = 0.0;
|
||||||
|
int imin = 0, imax = 0;
|
||||||
|
double gmin = 0.0, gmax = 0.0;
|
||||||
|
char *hint = vevo_property_get_string( parameter_templ, "description" );
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( hint != NULL );
|
||||||
|
#endif
|
||||||
|
switch( kind )
|
||||||
|
{
|
||||||
|
case HOST_PARAM_INDEX:
|
||||||
|
vevo_property_get( parameter, "value",0,&ival);
|
||||||
|
gval = (double) ival;
|
||||||
|
vevo_property_get( parameter_templ, "min",0,&imin );
|
||||||
|
gmin = (double) imin;
|
||||||
|
vevo_property_get( parameter_templ, "max",0,&imax );
|
||||||
|
gmax = (double) imax;
|
||||||
|
veejay_ui_bundle_add( osc_send, "/create/numeric", "sssdddiissssx", window, fx_frame,
|
||||||
|
parameter_name,gmin,gmax,gval,0,0,"VSlider", osc_path, "i", hint );
|
||||||
|
|
||||||
|
break;
|
||||||
|
case HOST_PARAM_NUMBER:
|
||||||
|
vevo_property_get( parameter, "value",0,&gval);
|
||||||
|
vevo_property_get( parameter_templ, "min",0,&gmin );
|
||||||
|
vevo_property_get( parameter_templ, "max",0,&gmax );
|
||||||
|
veejay_ui_bundle_add( osc_send, "/create/numeric", "sssdddiissssx",
|
||||||
|
window,fx_frame,parameter_name,gmin,gmax,gval,2,0,"VSlider",osc_path,"d", hint);
|
||||||
|
break;
|
||||||
|
case HOST_PARAM_SWITCH:
|
||||||
|
vevo_property_get( parameter, "value",0,&ival );
|
||||||
|
veejay_ui_bundle_add( osc_send, "/create/switch", "ssssissx", window,fx_frame, "Check",
|
||||||
|
parameter_name, ival ,osc_path, hint );
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
veejay_msg(0 ,"Parameter types not implemented");
|
||||||
|
assert(0);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
free(hint);
|
||||||
|
free(parameter_name);
|
||||||
|
free(osc_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
n = vevo_property_num_elements( slot->fx_instance, "in_channels" );
|
||||||
|
|
||||||
|
veejay_msg(0, "UI Factory: There are %d input channels", n );
|
||||||
|
|
||||||
|
if( n > 1 )
|
||||||
|
{
|
||||||
|
char ch_path[128];
|
||||||
|
sprintf( ch_path, "/sample_%d/fx_%d/input_channel", id, entry_id);
|
||||||
|
|
||||||
|
|
||||||
|
void *msg = veejay_message_new_widget( osc_send, window,
|
||||||
|
ch_path, n-1 );
|
||||||
|
|
||||||
|
void *ch = sample_get_fx_port_channels_ptr( id , entry_id );
|
||||||
|
char **items = vevo_list_properties( ch );
|
||||||
|
for( q = 0; items[q] != NULL ;q ++ )
|
||||||
|
{
|
||||||
|
void *sample = NULL;
|
||||||
|
vevo_property_get( ch, items[q],0,&sample);
|
||||||
|
if(sample && strncasecmp( items[q] , "slot0", 5 ) != 0)
|
||||||
|
{
|
||||||
|
int id = sample_get_run_id( sample );
|
||||||
|
char name[32];
|
||||||
|
sprintf(name , "S%d", id );
|
||||||
|
veejay_message_add_argument( osc_send, msg, "s", name );
|
||||||
|
veejay_msg(0, "Added '%s' ", name);
|
||||||
|
}
|
||||||
|
free(items[q]);
|
||||||
|
}
|
||||||
|
free(items);
|
||||||
|
// veejay_message_add_argument( osc_send, msg, "s", name );
|
||||||
|
|
||||||
|
veejay_message_widget_done( osc_send, msg );
|
||||||
|
}
|
||||||
|
|
||||||
|
n = vevo_property_num_elements( slot->fx_instance, "out_parameters" );
|
||||||
|
if( n <= 0 )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
char long_label[128];
|
||||||
|
snprintf(long_label,128,"Output parameters", label);
|
||||||
|
sprintf(fx_frame, "bind_%d", entry_id );
|
||||||
|
veejay_ui_bundle_add( osc_send, "/create/frame", "sssx", window, fx_frame, long_label );
|
||||||
|
|
||||||
|
char box_name[128];
|
||||||
|
sprintf( box_name, "%s_box", fx_frame );
|
||||||
|
|
||||||
|
veejay_ui_bundle_add( osc_send, "/create/box", "sssix", window,fx_frame, box_name, 0 );
|
||||||
|
|
||||||
|
for( q = 0; q < n ; q ++ )
|
||||||
|
{
|
||||||
|
void *parameter = NULL;
|
||||||
|
error = vevo_property_get( slot->fx_instance, "out_parameters", q, ¶meter );
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( error == VEVO_NO_ERROR );
|
||||||
|
#endif
|
||||||
|
void *parameter_templ = NULL;
|
||||||
|
error = vevo_property_get( parameter, "parent_template",0,¶meter_templ);
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( error == VEVO_NO_ERROR );
|
||||||
|
#endif
|
||||||
|
int kind = 0;
|
||||||
|
error = vevo_property_get( parameter_templ, "HOST_kind",0,&kind );
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( error == VEVO_NO_ERROR );
|
||||||
|
#endif
|
||||||
|
if( kind == HOST_PARAM_NUMBER || kind == HOST_PARAM_SWITCH || kind == HOST_PARAM_INDEX )
|
||||||
|
{
|
||||||
|
char *parameter_name = vevo_property_get_string(parameter_templ, "name" );
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( parameter_name != NULL );
|
||||||
|
#endif
|
||||||
|
sprintf(fx_frame, "fxb_%d",q );
|
||||||
|
veejay_ui_bundle_add( osc_send, "/create/vframe", "ssssx", window, box_name,fx_frame, parameter_name );
|
||||||
|
char param_id[32];
|
||||||
|
sprintf(param_id,"o%02d",q );
|
||||||
|
|
||||||
|
char *parameter_value = vevo_sprintf_property_value(
|
||||||
|
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 !!!
|
||||||
|
if(parameter_value)
|
||||||
|
free(parameter_value);
|
||||||
|
free(parameter_name );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
char hint[128];
|
||||||
|
snprintf(hint, 128,"Bind %s to an Input Parameter of another FX slot");
|
||||||
|
char bindname[32];
|
||||||
|
char unbindname[32];
|
||||||
|
sprintf(bindname,"bind_p%d", q);
|
||||||
|
sprintf(unbindname,"unbind_p%d",q );
|
||||||
|
|
||||||
|
//@ special button
|
||||||
|
veejay_ui_bundle_add( osc_send, "/create/button","sssssx",
|
||||||
|
window, fx_frame, "B", bindname, hint );
|
||||||
|
|
||||||
|
|
||||||
|
//@ normal button, special parameters
|
||||||
|
veejay_ui_bundle_add( osc_send, "/create/button","sssssx",
|
||||||
|
window, fx_frame, "C", unbindname, "Reset binding");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
static char *_get_out_parameter_name( void *instance, int id )
|
||||||
|
{
|
||||||
|
void *p = NULL;
|
||||||
|
int error = vevo_property_get( instance, "out_parameters", id, &p );
|
||||||
|
if( error != VEVO_NO_ERROR )
|
||||||
|
return NULL;
|
||||||
|
void *t = NULL;
|
||||||
|
error = vevo_property_get( p, "parent_template", 0, &t );
|
||||||
|
if( error == VEVO_NO_ERROR )
|
||||||
|
return vevo_property_get_string( t, "name" );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
static char *_get_in_parameter_name( void *instance, int id )
|
||||||
|
{
|
||||||
|
void *p = NULL;
|
||||||
|
int error = vevo_property_get( instance, "in_parameters", id, &p );
|
||||||
|
if( error != VEVO_NO_ERROR )
|
||||||
|
return NULL;
|
||||||
|
void *t = NULL;
|
||||||
|
error = vevo_property_get( p, "parent_template", 0, &t );
|
||||||
|
if( error == VEVO_NO_ERROR )
|
||||||
|
return vevo_property_get_string( t, "name" );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
static char *_get_in_channel_name( void *instance, int id )
|
||||||
|
{
|
||||||
|
void *p = NULL;
|
||||||
|
int error = vevo_property_get( instance, "in_channels", id, &p );
|
||||||
|
if( error != VEVO_NO_ERROR )
|
||||||
|
return NULL;
|
||||||
|
void *t = NULL;
|
||||||
|
error = vevo_property_get( p, "parent_template", 0, &t );
|
||||||
|
if( error == VEVO_NO_ERROR )
|
||||||
|
return vevo_property_get_string( t, "name" );
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void vevosample_ui_get_input_parameter_list( void *sample, int fx_id, const char *window )
|
||||||
|
{
|
||||||
|
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||||
|
fx_slot_t *rel = (fx_slot_t*) sample_get_fx_port_ptr( srd, fx_id);
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( rel->fx_instance != NULL );
|
||||||
|
#endif
|
||||||
|
void *osc_send = veejay_get_osc_sender(srd->user_data );
|
||||||
|
if(!osc_send)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//@ we also update path!
|
||||||
|
char bind_path[128];
|
||||||
|
sprintf(bind_path, "/sample_%d/fx_%d/bind", srd->primary_key,fx_id);
|
||||||
|
|
||||||
|
|
||||||
|
//@ pulldown abused for updatin ! see pulldown_done_update , it calls an update method in uiosc.c
|
||||||
|
void *msg = veejay_message_new_pulldown( osc_send, window, "n/a", "combobox_list_ip", "Input Parameter", bind_path, fx_id, "none" );
|
||||||
|
|
||||||
|
int n = vevo_property_num_elements( rel->fx_instance, "in_parameters" );
|
||||||
|
int i;
|
||||||
|
veejay_msg(0, "Get FX Slot %d of sample %d, with %d parameters",
|
||||||
|
fx_id, srd->primary_key, n );
|
||||||
|
for( i = 0; i < n ; i++ )
|
||||||
|
{
|
||||||
|
char *pname = _get_in_parameter_name( rel->fx_instance, i );
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( pname != NULL );
|
||||||
|
#endif
|
||||||
|
veejay_msg(0, "\t added parameter '%s'", pname );
|
||||||
|
veejay_message_add_argument(
|
||||||
|
osc_send, msg, "s", pname );
|
||||||
|
|
||||||
|
free(pname);
|
||||||
|
}
|
||||||
|
veejay_message_pulldown_done_update(
|
||||||
|
osc_send, msg );
|
||||||
|
}
|
||||||
|
|
||||||
|
void vevosample_ui_get_bind_list( void *sample, const char *window )
|
||||||
|
{
|
||||||
|
int fx_id = 0;
|
||||||
|
int p_num = 0;
|
||||||
|
int dummy = 0;
|
||||||
|
sscanf(window, "SampleBind%dFX%dOP%d",&dummy,&fx_id,&p_num);
|
||||||
|
|
||||||
|
|
||||||
|
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||||
|
fx_slot_t *sl = (fx_slot_t*) sample_get_fx_port_ptr( srd, fx_id);
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( sl->fx_instance != NULL );
|
||||||
|
assert( srd->primary_key == dummy );
|
||||||
|
#endif
|
||||||
|
void *osc_send = veejay_get_osc_sender(srd->user_data );
|
||||||
|
if(!osc_send)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//@ we also update path!
|
||||||
|
char bind_path[128];
|
||||||
|
sprintf(bind_path, "/sample_%d/fx_%d/unbind", srd->primary_key,fx_id);
|
||||||
|
|
||||||
|
|
||||||
|
//@ pulldown abused for updatin ! see pulldown_done_update , it calls an update method in uiosc.c
|
||||||
|
void *msg = veejay_message_new_pulldown( osc_send, window, "n/a", "combobox_release_bind", "Choose Item to release", bind_path, 0, "None" );
|
||||||
|
|
||||||
|
// veejay_message_add_argument(
|
||||||
|
// osc_send, msg, "s", "None" );
|
||||||
|
|
||||||
|
char **items = vevo_list_properties( sl->bind );
|
||||||
|
if(! items )
|
||||||
|
{
|
||||||
|
veejay_message_pulldown_done_update(
|
||||||
|
osc_send, msg );
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int i;
|
||||||
|
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( rel->fx_instance != NULL );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if( n[0] == 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;
|
||||||
|
int error = vevo_property_get( rel->fx_instance, "filter_templ",0 ,&filter_template );
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( error == VEVO_NO_ERROR );
|
||||||
|
#endif
|
||||||
|
char *fxname = vevo_property_get_string( filter_template, "name" );
|
||||||
|
|
||||||
|
char *pname = _get_in_parameter_name( rel->fx_instance, n[2] );
|
||||||
|
char list_item[128];
|
||||||
|
snprintf(list_item, 128, "fx_%d '%s' p%d '%s'",
|
||||||
|
n[1], fxname,n[2], pname );
|
||||||
|
|
||||||
|
veejay_message_add_argument( osc_send, msg, "s", list_item );
|
||||||
|
|
||||||
|
free(fxname);
|
||||||
|
free(pname);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
free(items[i]);
|
||||||
|
}
|
||||||
|
free(items);
|
||||||
|
|
||||||
|
veejay_message_pulldown_done_update(
|
||||||
|
osc_send, msg );
|
||||||
|
}
|
||||||
|
|
||||||
|
static void vevosample_ui_construct_bind_list( void *sample, int k, int p_num, void *dslot, const char *window,
|
||||||
|
const char *fx_frame )
|
||||||
|
{
|
||||||
|
//@ list all binds
|
||||||
|
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||||
|
fx_slot_t *slot = (fx_slot_t*) dslot;
|
||||||
|
void *osc_send = veejay_get_osc_sender(srd->user_data );
|
||||||
|
if(!osc_send)
|
||||||
|
return;
|
||||||
|
|
||||||
|
char bind_path[128];
|
||||||
|
sprintf(bind_path, "/sample_%d/fx_%d/unbind", srd->primary_key,k);
|
||||||
|
|
||||||
|
void *msg = veejay_message_new_pulldown(
|
||||||
|
osc_send, window, fx_frame, "combobox_release_bind", "Choose item to release", bind_path, 0, "None" );
|
||||||
|
|
||||||
|
veejay_message_add_argument( osc_send, msg, "s", "None");
|
||||||
|
|
||||||
|
int i;
|
||||||
|
if(!slot->bind )
|
||||||
|
{
|
||||||
|
veejay_message_pulldown_done(osc_send, msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
char **items = vevo_list_properties( slot->bind );
|
||||||
|
if(! items )
|
||||||
|
{
|
||||||
|
veejay_message_pulldown_done(osc_send, msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
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( rel->fx_instance != NULL );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if( n[0] == 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 );
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( error == VEVO_NO_ERROR );
|
||||||
|
#endif
|
||||||
|
char *fxname = vevo_property_get_string( filter_template, "name" );
|
||||||
|
|
||||||
|
char *pname = _get_in_parameter_name( rel->fx_instance, n[2] );
|
||||||
|
char list_item[128];
|
||||||
|
snprintf(list_item, 128, "fx_%d '%s' p%d '%s'",
|
||||||
|
n[1], fxname, n[2],pname );
|
||||||
|
|
||||||
|
veejay_message_add_argument( osc_send, msg, "s", list_item );
|
||||||
|
|
||||||
|
free(fxname);
|
||||||
|
free(pname);
|
||||||
|
}
|
||||||
|
free(items[i]);
|
||||||
|
}
|
||||||
|
free(items);
|
||||||
|
veejay_message_pulldown_done(osc_send, msg);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void vevosample_ui_construct_fx_bind_window( void *sample, int k, int p_id )
|
||||||
|
{
|
||||||
|
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||||
|
int id = srd->primary_key;
|
||||||
|
void *osc_send = veejay_get_osc_sender(srd->user_data );
|
||||||
|
if(!osc_send)
|
||||||
|
return;
|
||||||
|
fx_slot_t *sl = sample_get_fx_port_ptr( srd, k);
|
||||||
|
if(!sl->fx_instance)
|
||||||
|
return;
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( osc_send != NULL );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int i;
|
||||||
|
char window_title[128];
|
||||||
|
char fx_frame[128];
|
||||||
|
char *pname = _get_out_parameter_name( sl->fx_instance, p_id );
|
||||||
|
void *filter_template = NULL;
|
||||||
|
int error = vevo_property_get( sl->fx_instance, "filter_templ",0 ,&filter_template );
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( error == VEVO_NO_ERROR );
|
||||||
|
#endif
|
||||||
|
char *fxname = vevo_property_get_string( filter_template, "name" );
|
||||||
|
char fx_label[128];
|
||||||
|
char owner[64];
|
||||||
|
sprintf(owner,"SampleBind%dFX%d", id,k );
|
||||||
|
|
||||||
|
snprintf(window_title,128, "Bind output from %s",fxname);
|
||||||
|
snprintf(fx_label,128, "Bind '%s' to", pname );
|
||||||
|
|
||||||
|
char *window = vevosample_ui_new_window( srd, owner, k, window_title, "OP", p_id );
|
||||||
|
|
||||||
|
if(!window)
|
||||||
|
return;
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( sl->fx_instance != NULL );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sprintf(fx_frame, "NewBind%d_%d_%d",k,p_id,id );
|
||||||
|
char bindpath[128];
|
||||||
|
sprintf(bindpath , "/sample_%d/fx_%d/bind", id,k );
|
||||||
|
|
||||||
|
veejay_ui_bundle_add( osc_send, "/create/frame", "sssx", window, fx_frame, fx_label );
|
||||||
|
|
||||||
|
//@ create pulldown with available Slots
|
||||||
|
void *msg = veejay_message_new_pulldown( osc_send, window, fx_frame, "combobox_load_ip", "FX Slot","/veejay/ipreq", 0, "none" );
|
||||||
|
veejay_message_add_argument( osc_send, msg, "s", "None" );
|
||||||
|
|
||||||
|
char list_item[128];
|
||||||
|
for( i = 0;i < SAMPLE_CHAIN_LEN ; i ++ )
|
||||||
|
{
|
||||||
|
fx_slot_t *slot = sample_get_fx_port_ptr( srd, i );
|
||||||
|
if(slot->fx_instance)
|
||||||
|
{
|
||||||
|
void *ft = NULL;
|
||||||
|
int error = vevo_property_get( slot->fx_instance, "filter_templ",0,&ft );
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( error == VEVO_NO_ERROR);
|
||||||
|
#endif
|
||||||
|
char *plug = vevo_property_get_string( ft, "name" );
|
||||||
|
sprintf(list_item, "FX %d %s", i, plug );
|
||||||
|
free(plug);
|
||||||
|
veejay_message_add_argument( osc_send, msg, "s", list_item );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
veejay_message_pulldown_done( osc_send, msg );
|
||||||
|
|
||||||
|
void *msg2 = veejay_message_new_pulldown(
|
||||||
|
osc_send, window, fx_frame, "combobox_list_ip", "Input Parameter", bindpath,0,"none" );
|
||||||
|
veejay_message_add_argument( osc_send, msg2, "s", "none" );
|
||||||
|
veejay_message_pulldown_done(osc_send, msg2);
|
||||||
|
|
||||||
|
sprintf(fx_frame, "NewBindC%d_%d_%d",k,p_id,id );
|
||||||
|
veejay_ui_bundle_add( osc_send, "/create/frame", "sssx", window, fx_frame, "Existing bindings" );
|
||||||
|
|
||||||
|
vevosample_ui_construct_bind_list( sample,k, p_id, sl, window, fx_frame );
|
||||||
|
veejay_ui_bundle_add( osc_send, "/show/window", "sx", window );
|
||||||
|
|
||||||
|
free(fxname);
|
||||||
|
free(pname);
|
||||||
|
free(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
void vevosample_ui_construct_fx_window( void *sample, int k )
|
||||||
|
{
|
||||||
|
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||||
|
int id = srd->primary_key;
|
||||||
|
void *osc_send = veejay_get_osc_sender(srd->user_data );
|
||||||
|
if(!osc_send)
|
||||||
|
return;
|
||||||
|
char window_title[128];
|
||||||
|
char fx_frame[128];
|
||||||
|
char window[128];
|
||||||
|
|
||||||
|
sprintf(window, "Sample%dFX%d", id,k );
|
||||||
|
sprintf(fx_frame, "fx_%d", k);
|
||||||
|
sprintf(window_title, "Sample %d FX slot %d", id,k );
|
||||||
|
|
||||||
|
if( !vevosample_ui_new_window( srd, "Sample", id, window_title, "FX", k ) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
vevosample_ui_construct_fx_contents( sample, k,window, fx_frame );
|
||||||
|
|
||||||
|
veejay_ui_bundle_add( osc_send, "/show/window", "sx", window );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static char * vevosample_ui_new_window( sample_runtime_data *src, const char *window_prefix, const int id, const char *title, const char *window_infix, const int suffix)
|
||||||
|
{
|
||||||
|
|
||||||
|
void *osc_send = veejay_get_osc_sender(src->user_data );
|
||||||
|
if(!osc_send)
|
||||||
|
return NULL;
|
||||||
|
char window[128];
|
||||||
|
if(window_infix)
|
||||||
|
sprintf(window,"%s%d%s%d", window_prefix, id, window_infix, suffix );
|
||||||
|
else
|
||||||
|
sprintf(window, "%s%d", window_prefix, id );
|
||||||
|
veejay_osc_set_window( osc_send , window );
|
||||||
|
veejay_ui_bundle_add( osc_send, "/create/window", "ssx", window, title );
|
||||||
|
return strdup(window);
|
||||||
|
}
|
||||||
|
|
||||||
|
//@ create widget that only type none has
|
||||||
|
static void vevosample_ui_type_none( void *sample, const char *window, const char *frame)
|
||||||
|
{
|
||||||
|
uint64_t end = sample_get_end_pos(sample);
|
||||||
|
uint64_t sta = sample_get_start_pos(sample);
|
||||||
|
char osc_path[128];
|
||||||
|
char tmp_label[128];
|
||||||
|
double ns = end-sta;
|
||||||
|
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||||
|
void *osc_send = veejay_get_osc_sender(srd->user_data );
|
||||||
|
|
||||||
|
int id = srd->primary_key;
|
||||||
|
if(ns > 16 ) ns = 16;
|
||||||
|
|
||||||
|
vevosample_ui_new_frame( sample, window, frame, "Navigation" );
|
||||||
|
|
||||||
|
snprintf(osc_path,128, "/sample_%d/video/goto_start", id );
|
||||||
|
vevosample_ui_new_button( sample,window, frame, "gs", osc_path,"Goto starting position of sample");
|
||||||
|
sprintf(osc_path, "/sample_%d/video/play", id );
|
||||||
|
vevosample_ui_new_button( sample,window, frame, ">", osc_path, "Play forward" );
|
||||||
|
sprintf(osc_path, "/sample_%d/video/pause", id );
|
||||||
|
vevosample_ui_new_button( sample, window, frame, "||", osc_path, "Pause playing" );
|
||||||
|
sprintf(osc_path, "/sample_%d/video/reverse", id );
|
||||||
|
vevosample_ui_new_button( sample, window, frame, "r", osc_path, "Play backward" );
|
||||||
|
sprintf(osc_path, "/sample_%d/video/goto_end", id );
|
||||||
|
vevosample_ui_new_button( sample, window, frame, "ge", osc_path, "Goto ending position of sample" );
|
||||||
|
sprintf(osc_path, "/sample_%d/video/prev_frame", id );
|
||||||
|
vevosample_ui_new_button( sample, window, frame, "pf", osc_path, "Previous frame" );
|
||||||
|
sprintf(osc_path, "/sample_%d/video/next_frame", id );
|
||||||
|
vevosample_ui_new_button( sample, window, frame, "nf", osc_path, "Next frame" );
|
||||||
|
sprintf(osc_path, "/sample_%d/speed", id );
|
||||||
|
vevosample_ui_new_numeric( sample, window, frame, "Speed",
|
||||||
|
-1 * ns, ns ,(double) sample_get_speed(sample),
|
||||||
|
0,0, "HSlider", osc_path, "i", "none" );
|
||||||
|
|
||||||
|
sprintf(frame, "sample%d_videobar", id );
|
||||||
|
vevosample_ui_new_frame( sample,window, frame, "Timeline" );
|
||||||
|
sprintf(osc_path, "/sample_%d/current_pos", id );
|
||||||
|
vevosample_ui_new_numeric( sample, window, frame, "Position",
|
||||||
|
(double) sta, (double) end, (double) sample_get_current_pos(sample),0,0,
|
||||||
|
"HSlider", osc_path, "h","none" );
|
||||||
|
|
||||||
|
|
||||||
|
sprintf(frame, "sample%d_ctrl", id );
|
||||||
|
sprintf(tmp_label, "%s","Settings" );
|
||||||
|
vevosample_ui_new_frame( sample,window, frame, tmp_label );
|
||||||
|
sprintf(osc_path, "/sample_%d/looptype", id );
|
||||||
|
|
||||||
|
void *msg = veejay_message_new_pulldown( osc_send,
|
||||||
|
window, frame,"combobox_looptype_list", "Looptype", osc_path, (double) sample_get_looptype( sample ), "none" );
|
||||||
|
|
||||||
|
veejay_message_add_argument( osc_send, msg, "sss", "None","Normal" , "Bounce" );
|
||||||
|
|
||||||
|
veejay_message_pulldown_done( osc_send, msg );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//@ create widgets for capture type
|
||||||
|
static void vevosample_ui_type_capture( void *sample, const char *window, const char *frame)
|
||||||
|
{
|
||||||
|
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||||
|
int i;
|
||||||
|
char **list = vj_unicap_get_list( srd->data );
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
assert( list != NULL );
|
||||||
|
#endif
|
||||||
|
double min=0.0;
|
||||||
|
double max=0.0;
|
||||||
|
char format[5];
|
||||||
|
double dv = 0;
|
||||||
|
char path[128];
|
||||||
|
int id = srd->primary_key;
|
||||||
|
|
||||||
|
void *osc_send = veejay_get_osc_sender(srd->user_data );
|
||||||
|
|
||||||
|
vevosample_ui_new_frame( sample, window, "capframe", "Settings" );
|
||||||
|
vevosample_ui_new_frame( sample, window, "capframe2", "Settings" );
|
||||||
|
|
||||||
|
for( i = 0; list[i] != NULL ; i++ )
|
||||||
|
{
|
||||||
|
if(vj_unicap_get_range( srd->data, list[i], &min,&max ))
|
||||||
|
{
|
||||||
|
char *tkey = sample_translate_property(srd,list[i]); // translate property
|
||||||
|
|
||||||
|
int type = vevo_property_atom_type( srd->info_port, list[i]);
|
||||||
|
if(type==VEVO_ATOM_TYPE_DOUBLE)
|
||||||
|
sprintf(format, "%s", "d" );
|
||||||
|
else
|
||||||
|
sprintf(format, "%s", "i" );
|
||||||
|
|
||||||
|
sprintf(path, "/sample_%d/%s", id, tkey );
|
||||||
|
|
||||||
|
if( vj_unicap_property_is_menu( srd->data, list[i] ))
|
||||||
|
{
|
||||||
|
vevo_property_get( srd->info_port, list[i],0,&dv );
|
||||||
|
// void *msg = veejay_message_new_pulldown( osc_send,window,"combobox_capframe", "capframe2", list[i], path,dv,"none" );
|
||||||
|
void *msg = veejay_message_new_pulldown( osc_send,window,"capframe2", "combobox_capframe", list[i], path,dv,"none" );
|
||||||
|
|
||||||
|
|
||||||
|
vj_unicap_pack_menu( srd->data, list[i], osc_send, msg );
|
||||||
|
veejay_message_pulldown_done( osc_send, msg );
|
||||||
|
}
|
||||||
|
else if( vj_unicap_property_is_range( srd->data, list[i] ) )
|
||||||
|
{
|
||||||
|
vevosample_ui_new_numeric( sample,window, "capframe",
|
||||||
|
list[i], min,max, (max*0.5), 0,0, "VSlider",
|
||||||
|
path, format, "none" );
|
||||||
|
}
|
||||||
|
free(tkey);
|
||||||
|
}
|
||||||
|
free(list[i]);
|
||||||
|
}
|
||||||
|
free(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void vevosample_ui_type_shared( void *sample, char *window )
|
||||||
|
{
|
||||||
|
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||||
|
int id = srd->primary_key;
|
||||||
|
char osc_path[128];
|
||||||
|
char frame_name[128];
|
||||||
|
void *osc_send = veejay_get_osc_sender(srd->user_data );
|
||||||
|
|
||||||
|
|
||||||
|
sprintf(frame_name, "%s", "fxchain" );
|
||||||
|
|
||||||
|
vevosample_ui_new_frame( sample, window, frame_name, "FX slots" );
|
||||||
|
|
||||||
|
vevosample_ui_new_radiogroup(osc_send, window, frame_name, "fx", "fx", SAMPLE_CHAIN_LEN, 0 );
|
||||||
|
sprintf(frame_name, "%s", "fx_list" );
|
||||||
|
vevosample_ui_new_frame( sample, window, frame_name, "Available plugins" );
|
||||||
|
|
||||||
|
sprintf(osc_path, "/sample_%d/fx_X/set", id );
|
||||||
|
void *msg = veejay_message_new_linked_pulldown( osc_send,
|
||||||
|
window,frame_name,"Plugins", osc_path, "s", "Add plugin to FX slot" );
|
||||||
|
plug_concatenate_all( osc_send, msg );
|
||||||
|
veejay_message_linked_pulldown_done( osc_send, msg );
|
||||||
|
vevosample_ui_new_button( sample, window, frame_name, "clear", "none", "Clear selected FX slot" );
|
||||||
|
|
||||||
|
|
||||||
|
sprintf(frame_name, "%s", "sample_action" );
|
||||||
|
vevosample_ui_new_frame( sample, window, frame_name, "Actions" );
|
||||||
|
sprintf(osc_path, "/sample_%d/rec/start", id );
|
||||||
|
vevosample_ui_new_button( sample,window, frame_name, "rec start", osc_path, "Start recording from sample" );
|
||||||
|
sprintf(osc_path, "/sample_%d/rec/stop", id );
|
||||||
|
vevosample_ui_new_button( sample,window, frame_name, "rec stop", osc_path, "Stop recording from sample" );
|
||||||
|
sprintf(osc_path, "/sample_%d/print", id );
|
||||||
|
vevosample_ui_new_button( sample, window, frame_name, "osc", osc_path, "Print OSC message space" );
|
||||||
|
sprintf(osc_path, "/sample_%d/delete", id );
|
||||||
|
vevosample_ui_new_button( sample, window, frame_name, "destroy", osc_path, "Destry this sample" );
|
||||||
|
|
||||||
|
if(srd->type == VJ_TAG_TYPE_NONE)
|
||||||
|
vevosample_ui_new_button( sample, window, frame_name, "clone", "clone","Copy sample to new sample" );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void vevosample_construct_ui_fx_chain(void *sample)
|
||||||
|
{
|
||||||
|
int k;
|
||||||
|
for( k = 0; k < SAMPLE_CHAIN_LEN ; k ++ )
|
||||||
|
{
|
||||||
|
if( sample_get_fx_status( sample, k ))
|
||||||
|
vevosample_ui_construct_fx_window( sample, k );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char * vevosample_construct_ui(void *sample)
|
||||||
|
{
|
||||||
|
sample_runtime_data *srd = (sample_runtime_data*) sample;
|
||||||
|
char fx_frame[128];
|
||||||
|
char window_title[128];
|
||||||
|
void *osc_send = veejay_get_osc_sender(srd->user_data );
|
||||||
|
|
||||||
|
|
||||||
|
sprintf(window_title, "Sample %d", srd->primary_key );
|
||||||
|
|
||||||
|
char *window = vevosample_ui_new_window( srd, "Sample", srd->primary_key, window_title ,NULL,0);
|
||||||
|
if(!window)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
char tmp_label[128];
|
||||||
|
char osc_path[128];
|
||||||
|
char frame_name[128];
|
||||||
|
sprintf(frame_name, "sample%dactions", srd->primary_key );
|
||||||
|
|
||||||
|
switch(srd->type)
|
||||||
|
{
|
||||||
|
case VJ_TAG_TYPE_NONE:
|
||||||
|
vevosample_ui_type_none( sample, window, frame_name );
|
||||||
|
break;
|
||||||
|
case VJ_TAG_TYPE_CAPTURE:
|
||||||
|
vevosample_ui_type_capture( sample,window,frame_name );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vevosample_ui_type_shared( sample, window );
|
||||||
|
|
||||||
|
veejay_ui_bundle_add( osc_send, "/show/window", "sx", window );
|
||||||
|
|
||||||
|
return window;
|
||||||
|
}
|
||||||
|
|
||||||
94
veejay-ng/vevosample/uifactory.h
Normal file
94
veejay-ng/vevosample/uifactory.h
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2002-2006 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
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef UIFAC
|
||||||
|
#define UIFAC
|
||||||
|
|
||||||
|
//@ returns window name , creates sample
|
||||||
|
char * vevosample_construct_ui(void *sample);
|
||||||
|
//@ create fx chain (all underlying windows)
|
||||||
|
void vevosample_construct_ui_fx_chain(void *sample);
|
||||||
|
|
||||||
|
//@ create window for some fx slot
|
||||||
|
void vevosample_ui_construct_fx_window( void *sample, int k );
|
||||||
|
|
||||||
|
//@ create window for some bind slot
|
||||||
|
void vevosample_ui_construct_fx_bind_window( void *sample, int k , int i);
|
||||||
|
|
||||||
|
void vevosample_ui_new_vframe(
|
||||||
|
void *sample,
|
||||||
|
const char *window,
|
||||||
|
const char *frame,
|
||||||
|
const char *label );
|
||||||
|
|
||||||
|
void vevosample_ui_new_frame(
|
||||||
|
void *sample,
|
||||||
|
const char *window,
|
||||||
|
const char *frame,
|
||||||
|
const char *label );
|
||||||
|
|
||||||
|
void vevosample_ui_new_button(
|
||||||
|
void *sample,
|
||||||
|
const char *window,
|
||||||
|
const char *frame,
|
||||||
|
const char *label,
|
||||||
|
const char *path,
|
||||||
|
const char *tooltip );
|
||||||
|
|
||||||
|
void vevosample_ui_new_label(
|
||||||
|
void *sample,
|
||||||
|
const char *window,
|
||||||
|
const char *frame,
|
||||||
|
const char *label );
|
||||||
|
|
||||||
|
void vevosample_ui_new_numeric(
|
||||||
|
void *sample,
|
||||||
|
const char *window,
|
||||||
|
const char *frame,
|
||||||
|
const char *label,
|
||||||
|
double min,
|
||||||
|
double max,
|
||||||
|
double value,
|
||||||
|
int wrap,
|
||||||
|
int extra,
|
||||||
|
const char *widget_name,
|
||||||
|
const char *path,
|
||||||
|
const char *format,
|
||||||
|
const char *tooltip);
|
||||||
|
|
||||||
|
void vevosample_ui_new_radiogroup(
|
||||||
|
void *osc,
|
||||||
|
const char *window,
|
||||||
|
const char *framename,
|
||||||
|
const char *prefix,
|
||||||
|
const char *label_prefix,
|
||||||
|
int n_buttons,
|
||||||
|
int active_button );
|
||||||
|
|
||||||
|
void vevosample_ui_new_switch(
|
||||||
|
void *sample,
|
||||||
|
const char *window,
|
||||||
|
const char *framename,
|
||||||
|
const char *widget,
|
||||||
|
const char *label,
|
||||||
|
int active,
|
||||||
|
const char *path,
|
||||||
|
const char *tooltip);
|
||||||
|
#endif
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -53,11 +53,12 @@ int sample_open( void *sample, const char *token, int extra_token, sample_video
|
|||||||
int sample_get_frame( void *current_sample, void *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_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_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 );
|
|
||||||
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 );
|
||||||
double 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, double v );
|
void sample_set_fx_alpha( void *data, int fx_entry, double v );
|
||||||
|
int sample_get_fx_status( void *data, int fx_entry );
|
||||||
|
void sample_set_fx_status( void *data, int fx_entry, int status );
|
||||||
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 );
|
||||||
@@ -89,7 +90,7 @@ char *sample_sprintf_port( void *sample );
|
|||||||
int sample_fx_push_in_channel( void *info, int fx_entry, int seq_num, void *frame_info );
|
int sample_fx_push_in_channel( void *info, int fx_entry, int seq_num, void *frame_info );
|
||||||
int sample_fx_push_out_channel(void *info, int fx_entry, int seq_num, void *frame_info );
|
int sample_fx_push_out_channel(void *info, int fx_entry, int seq_num, void *frame_info );
|
||||||
int sample_scan_out_channels( void *data, int fx_entry );
|
int sample_scan_out_channels( void *data, int fx_entry );
|
||||||
void *sample_scan_in_channels( void *data, int fx_entry );
|
void *sample_scan_in_channels( void *data, int fx_entry, int *num );
|
||||||
void *sample_get_fx_port_ptr( void *data, int fx_entry );
|
void *sample_get_fx_port_ptr( void *data, int fx_entry );
|
||||||
void *sample_get_fx_port_channels_ptr( int id, int fx_entry );
|
void *sample_get_fx_port_channels_ptr( int id, int fx_entry );
|
||||||
int sample_get_key_ptr( void *sample );
|
int sample_get_key_ptr( void *sample );
|
||||||
@@ -109,17 +110,17 @@ void sample_send_osc_path( void *sample, void *fx_entry );
|
|||||||
char *sample_describe_param( void *srd, int fx_entry, int p );
|
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[] , ... );
|
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_user_data( void *sample, void *data, int id );
|
||||||
void sample_set_property_from_path( void *sample, const char *path, void *value );
|
void sample_set_property_from_path( void *sample, const char *path,int elements, void *value );
|
||||||
char *sample_property_format_osc( void *sample, const char *path );
|
char *sample_property_format_osc( void *sample, const char *path );
|
||||||
void sample_init_namespace( void *data, void *sample , int id );
|
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[] );
|
int sample_osc_property_calls_event( void *sample, const char *path, char *types, void **argv[] , void *data);
|
||||||
|
|
||||||
typedef void (*vevo_event_f)(void *ptr, const char *path,const char *types, void **argv);
|
typedef void (*vevo_event_f)(void *ptr, const char *path,const char *types, void **argv, void *raw);
|
||||||
int sample_osc_new_sample_event( void *sample,
|
int sample_osc_new_sample_event( void *sample,
|
||||||
const char *key,
|
const char *key,
|
||||||
const char *fmt,
|
const char *fmt,
|
||||||
const char **args,
|
const char **args,
|
||||||
vevo_event_f *func );
|
vevo_event_f *func );
|
||||||
int sample_osc_verify_format( void *vevo_port, char const *types );
|
int sample_osc_verify_format( void *vevo_port, char const *types );
|
||||||
|
void *sample_clone_from( void *info, void *sample, sample_video_info_t *project_settings );
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ static int vj_unicap_scan_enumerate_devices(void *unicap)
|
|||||||
veejay_msg(0, "Failed to open: %s\n", &(ud->device.identifier) );
|
veejay_msg(0, "Failed to open: %s\n", &(ud->device.identifier) );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
unicap_lock_properties( ud->handle );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -88,11 +89,7 @@ static int vj_unicap_scan_enumerate_devices(void *unicap)
|
|||||||
unicap_reenumerate_formats( ud->handle, &format_count );
|
unicap_reenumerate_formats( ud->handle, &format_count );
|
||||||
char *device_name = strdup( ud->device.identifier );
|
char *device_name = strdup( ud->device.identifier );
|
||||||
|
|
||||||
#ifdef STRICT_CHECKING
|
void *device_port = vpn( VEVO_ANONYMOUS_PORT );
|
||||||
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 );
|
char *device_location = strdup( ud->device.device );
|
||||||
|
|
||||||
int error = vevo_property_set( device_port,
|
int error = vevo_property_set( device_port,
|
||||||
@@ -127,6 +124,8 @@ static int vj_unicap_scan_enumerate_devices(void *unicap)
|
|||||||
#ifdef STRICT_CHECKING
|
#ifdef STRICT_CHECKING
|
||||||
assert( error == VEVO_NO_ERROR );
|
assert( error == VEVO_NO_ERROR );
|
||||||
#endif
|
#endif
|
||||||
|
unicap_unlock_properties( ud->handle );
|
||||||
|
|
||||||
unicap_close( ud->handle );
|
unicap_close( ud->handle );
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
@@ -136,16 +135,19 @@ void *vj_unicap_init(void)
|
|||||||
{
|
{
|
||||||
unicap_driver_t *ud = (unicap_driver_t*) vj_malloc(sizeof(unicap_driver_t));
|
unicap_driver_t *ud = (unicap_driver_t*) vj_malloc(sizeof(unicap_driver_t));
|
||||||
memset( ud,0,sizeof(unicap_driver_t));
|
memset( ud,0,sizeof(unicap_driver_t));
|
||||||
#ifdef STRICT_CHECKING
|
ud->device_list = vpn( VEVO_ANONYMOUS_PORT );
|
||||||
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 );
|
ud->num_devices = vj_unicap_scan_enumerate_devices( (void*) ud );
|
||||||
veejay_msg(2, "Found %d capture devices on this system", ud->num_devices);
|
veejay_msg(2, "Found %d capture devices on this system", ud->num_devices);
|
||||||
return ud;
|
return ud;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *vj_unicap_get_devices(void *in)
|
||||||
|
{
|
||||||
|
unicap_driver_t *ud = (unicap_driver_t*) in;
|
||||||
|
return ud->device_list;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void vj_unicap_deinit(void *dud )
|
void vj_unicap_deinit(void *dud )
|
||||||
{
|
{
|
||||||
unicap_driver_t *ud = (unicap_driver_t*) dud;
|
unicap_driver_t *ud = (unicap_driver_t*) dud;
|
||||||
@@ -192,16 +194,104 @@ int vj_unicap_set_property( void *ud, char *key, int atom_type, void *val )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
void vj_unicap_pack_menu( void *ud, char *key , void *osc, void *msg )
|
||||||
|
{
|
||||||
|
unicap_property_t property;
|
||||||
|
unicap_property_t property_spec;
|
||||||
|
int i;
|
||||||
|
unicap_void_property( &property_spec );
|
||||||
|
unicap_void_property( &property );
|
||||||
|
vj_unicap_t *vut = (vj_unicap_t*) ud;
|
||||||
|
unicap_lock_properties( vut->handle );
|
||||||
|
|
||||||
|
for( i = 0; SUCCESS( unicap_enumerate_properties( vut->handle,
|
||||||
|
&property_spec, &property, i ) ); i ++ )
|
||||||
|
{
|
||||||
|
unicap_get_property( vut->handle, &property);
|
||||||
|
if( strcmp( property.identifier, key ) == 0 )
|
||||||
|
{
|
||||||
|
int n = property.menu.menu_item_count;
|
||||||
|
int j;
|
||||||
|
for( j = 0; j < n ; j ++ )
|
||||||
|
{
|
||||||
|
veejay_message_add_argument( osc, msg, "s",
|
||||||
|
property.menu.menu_items[j] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unicap_unlock_properties( vut->handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
int vj_unicap_property_is_menu( void *ud, char *key )
|
||||||
|
{
|
||||||
|
unicap_property_t property;
|
||||||
|
unicap_property_t property_spec;
|
||||||
|
int i;
|
||||||
|
unicap_void_property( &property_spec );
|
||||||
|
unicap_void_property( &property );
|
||||||
|
vj_unicap_t *vut = (vj_unicap_t*) ud;
|
||||||
|
unicap_lock_properties( vut->handle );
|
||||||
|
|
||||||
|
for( i = 0; SUCCESS( unicap_enumerate_properties( vut->handle,
|
||||||
|
&property_spec, &property, i ) ); i ++ )
|
||||||
|
{
|
||||||
|
unicap_get_property( vut->handle, &property);
|
||||||
|
if( strcmp( property.identifier, key ) == 0 )
|
||||||
|
{
|
||||||
|
unicap_unlock_properties( vut->handle);
|
||||||
|
if( property.type == UNICAP_PROPERTY_TYPE_MENU )
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unicap_unlock_properties( vut->handle);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int vj_unicap_property_is_range( void *ud, char *key )
|
||||||
|
{
|
||||||
|
unicap_property_t property;
|
||||||
|
unicap_property_t property_spec;
|
||||||
|
int i;
|
||||||
|
unicap_void_property( &property_spec );
|
||||||
|
unicap_void_property( &property );
|
||||||
|
vj_unicap_t *vut = (vj_unicap_t*) ud;
|
||||||
|
unicap_lock_properties( vut->handle );
|
||||||
|
|
||||||
|
for( i = 0; SUCCESS( unicap_enumerate_properties( vut->handle,
|
||||||
|
&property_spec, &property, i ) ); i ++ )
|
||||||
|
{
|
||||||
|
unicap_get_property( vut->handle, &property);
|
||||||
|
if( strcmp( property.identifier, key ) == 0 )
|
||||||
|
{
|
||||||
|
unicap_unlock_properties( vut->handle);
|
||||||
|
if( property.type == UNICAP_PROPERTY_TYPE_RANGE )
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
unicap_unlock_properties( vut->handle);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int vj_unicap_select_value( void *ud, char *key, int atom_type, void *val )
|
int vj_unicap_select_value( void *ud, char *key, int atom_type, void *val )
|
||||||
{
|
{
|
||||||
unicap_property_t property;
|
unicap_property_t property;
|
||||||
unicap_property_t property_spec;
|
unicap_property_t property_spec;
|
||||||
int i;
|
int i;
|
||||||
unicap_void_property( &property_spec );
|
unicap_void_property( &property_spec );
|
||||||
|
unicap_void_property( &property );
|
||||||
vj_unicap_t *vut = (vj_unicap_t*) ud;
|
vj_unicap_t *vut = (vj_unicap_t*) ud;
|
||||||
|
// memset( &property,0 ,sizeof( unicap_property_t));
|
||||||
|
unicap_lock_properties( vut->handle );
|
||||||
|
|
||||||
for( i = 0; SUCCESS( unicap_enumerate_properties( vut->handle,
|
for( i = 0; SUCCESS( unicap_enumerate_properties( vut->handle,
|
||||||
&property_spec, &property, i ) ); i ++ )
|
&property_spec, &property, i ) ); i ++ )
|
||||||
{
|
{
|
||||||
|
// memset( &property,0 ,sizeof( unicap_property_t));
|
||||||
|
|
||||||
unicap_get_property( vut->handle, &property);
|
unicap_get_property( vut->handle, &property);
|
||||||
if( strcmp( property.identifier, key ) == 0 )
|
if( strcmp( property.identifier, key ) == 0 )
|
||||||
{
|
{
|
||||||
@@ -213,13 +303,19 @@ int vj_unicap_select_value( void *ud, char *key, int atom_type, void *val )
|
|||||||
assert( atom_type == VEVO_ATOM_TYPE_DOUBLE );
|
assert( atom_type == VEVO_ATOM_TYPE_DOUBLE );
|
||||||
#endif
|
#endif
|
||||||
int idx = (int) *( (double*) val );
|
int idx = (int) *( (double*) val );
|
||||||
veejay_msg(0, "To menu item %d",idx);
|
veejay_msg(0, "To menu item %d, cur = '%s', new = '%s'",
|
||||||
strcpy( property.menu_item, property.menu.menu_items[idx] );
|
idx,
|
||||||
|
property.menu_item,
|
||||||
|
property.menu.menu_items[idx] );
|
||||||
|
|
||||||
|
strcpy( property.menu_item, property.menu.menu_items[idx] );
|
||||||
|
|
||||||
unicap_set_property( vut->handle, &property );
|
unicap_set_property( vut->handle, &property );
|
||||||
|
|
||||||
|
|
||||||
veejay_msg(0,"changed menu item %d to %s", n, property.menu_item );
|
veejay_msg(0,"changed menu item %d to %s", idx, property.menu_item );
|
||||||
|
unicap_unlock_properties( vut->handle );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if( property.type == UNICAP_PROPERTY_TYPE_RANGE )
|
if( property.type == UNICAP_PROPERTY_TYPE_RANGE )
|
||||||
@@ -235,10 +331,14 @@ int vj_unicap_select_value( void *ud, char *key, int atom_type, void *val )
|
|||||||
property.value = (double) *((double*) val);
|
property.value = (double) *((double*) val);
|
||||||
unicap_set_property( vut->handle, &property );
|
unicap_set_property( vut->handle, &property );
|
||||||
veejay_msg(0, "Changed range value to %f", property.value );
|
veejay_msg(0, "Changed range value to %f", property.value );
|
||||||
|
unicap_unlock_properties( vut->handle );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unicap_unlock_properties( vut->handle );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,29 +348,39 @@ int vj_unicap_get_range( void *ud, char *key, double *min , double *max )
|
|||||||
unicap_property_t property_spec;
|
unicap_property_t property_spec;
|
||||||
int i;
|
int i;
|
||||||
unicap_void_property( &property_spec );
|
unicap_void_property( &property_spec );
|
||||||
|
unicap_void_property( &property );
|
||||||
vj_unicap_t *vut = (vj_unicap_t*) ud;
|
vj_unicap_t *vut = (vj_unicap_t*) ud;
|
||||||
|
unicap_lock_properties( vut->handle );
|
||||||
|
|
||||||
for( i = 0; SUCCESS( unicap_enumerate_properties( vut->handle,
|
for( i = 0; SUCCESS( unicap_enumerate_properties( vut->handle,
|
||||||
&property_spec, &property, i ) ); i ++ )
|
&property_spec, &property, i ) ); i ++ )
|
||||||
{
|
{
|
||||||
|
// memset( &property,0,sizeof(unicap_property_t));
|
||||||
unicap_get_property( vut->handle, &property);
|
unicap_get_property( vut->handle, &property);
|
||||||
|
|
||||||
if( strcmp( property.identifier, key ) == 0 )
|
if( strcasecmp( property.identifier, key ) == 0 )
|
||||||
continue;
|
{
|
||||||
|
|
||||||
if( property.type == UNICAP_PROPERTY_TYPE_MENU )
|
if( property.type == UNICAP_PROPERTY_TYPE_MENU )
|
||||||
{
|
{
|
||||||
*min = 0.0;
|
*min = 0.0;
|
||||||
*max = (double) property.menu.menu_item_count;
|
*max = (double) property.menu.menu_item_count;
|
||||||
|
unicap_unlock_properties( vut->handle );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if( property.type == UNICAP_PROPERTY_TYPE_RANGE )
|
if( property.type == UNICAP_PROPERTY_TYPE_RANGE )
|
||||||
{
|
{
|
||||||
*min = property.range.min;
|
*min = property.range.min;
|
||||||
*max = property.range.max;
|
*max = property.range.max;
|
||||||
|
unicap_unlock_properties( vut->handle );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
unicap_unlock_properties( vut->handle );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,6 +391,7 @@ char **vj_unicap_get_list( void *ud )
|
|||||||
int i;
|
int i;
|
||||||
unicap_void_property( &property_spec );
|
unicap_void_property( &property_spec );
|
||||||
vj_unicap_t *vut = (vj_unicap_t*) ud;
|
vj_unicap_t *vut = (vj_unicap_t*) ud;
|
||||||
|
unicap_lock_properties( vut->handle );
|
||||||
|
|
||||||
for( i = 0; SUCCESS( unicap_enumerate_properties( vut->handle,
|
for( i = 0; SUCCESS( unicap_enumerate_properties( vut->handle,
|
||||||
&property_spec, &property, i ) ); i ++ )
|
&property_spec, &property, i ) ); i ++ )
|
||||||
@@ -300,6 +411,9 @@ char **vj_unicap_get_list( void *ud )
|
|||||||
res[i] = strdup( property.identifier );
|
res[i] = strdup( property.identifier );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unicap_unlock_properties( vut->handle );
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,6 +425,7 @@ int vj_unicap_get_value( void *ud, char *key, int atom_type, void *value )
|
|||||||
int i;
|
int i;
|
||||||
unicap_void_property( &property_spec );
|
unicap_void_property( &property_spec );
|
||||||
vj_unicap_t *vut = (vj_unicap_t*) ud;
|
vj_unicap_t *vut = (vj_unicap_t*) ud;
|
||||||
|
unicap_lock_properties( vut->handle );
|
||||||
|
|
||||||
for( i = 0; SUCCESS( unicap_enumerate_properties( vut->handle,
|
for( i = 0; SUCCESS( unicap_enumerate_properties( vut->handle,
|
||||||
&property_spec, &property, i ) ); i ++ )
|
&property_spec, &property, i ) ); i ++ )
|
||||||
@@ -333,6 +448,8 @@ int vj_unicap_get_value( void *ud, char *key, int atom_type, void *value )
|
|||||||
{
|
{
|
||||||
double *dval = value;
|
double *dval = value;
|
||||||
*dval = (double) j;
|
*dval = (double) j;
|
||||||
|
unicap_unlock_properties( vut->handle );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -344,9 +461,13 @@ int vj_unicap_get_value( void *ud, char *key, int atom_type, void *value )
|
|||||||
#endif
|
#endif
|
||||||
double *dval = value;
|
double *dval = value;
|
||||||
*dval = property.value;
|
*dval = property.value;
|
||||||
|
unicap_unlock_properties( vut->handle );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unicap_unlock_properties( vut->handle );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,6 +523,7 @@ get_fourcc(char * fourcc)
|
|||||||
int vj_unicap_configure_device( void *ud, int pixel_format, int w, int h )
|
int vj_unicap_configure_device( void *ud, int pixel_format, int w, int h )
|
||||||
{
|
{
|
||||||
vj_unicap_t *vut = (vj_unicap_t*) ud;
|
vj_unicap_t *vut = (vj_unicap_t*) ud;
|
||||||
|
unicap_lock_properties( vut->handle );
|
||||||
|
|
||||||
unicap_void_format( &(vut->format_spec));
|
unicap_void_format( &(vut->format_spec));
|
||||||
|
|
||||||
@@ -455,6 +577,8 @@ int vj_unicap_configure_device( void *ud, int pixel_format, int w, int h )
|
|||||||
{
|
{
|
||||||
veejay_msg(0, "Unable to set video size %d x %d in format %s",
|
veejay_msg(0, "Unable to set video size %d x %d in format %s",
|
||||||
w,h,vut->format.identifier );
|
w,h,vut->format.identifier );
|
||||||
|
unicap_unlock_properties( vut->handle );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
vut->deinterlace = 1;
|
vut->deinterlace = 1;
|
||||||
@@ -482,12 +606,16 @@ int vj_unicap_configure_device( void *ud, int pixel_format, int w, int h )
|
|||||||
if(!vut->rgb)
|
if(!vut->rgb)
|
||||||
{
|
{
|
||||||
veejay_msg(0, "No matching formats found. Camera not supported.");
|
veejay_msg(0, "No matching formats found. Camera not supported.");
|
||||||
|
unicap_unlock_properties( vut->handle );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( !SUCCESS( unicap_set_format( vut->handle, &rgb_format ) ) )
|
if( !SUCCESS( unicap_set_format( vut->handle, &rgb_format ) ) )
|
||||||
{
|
{
|
||||||
veejay_msg(0, "Cannot set size %d x %d or format %s", w,h,rgb_format.identifier);
|
veejay_msg(0, "Cannot set size %d x %d or format %s", w,h,rgb_format.identifier);
|
||||||
|
unicap_unlock_properties( vut->handle );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -514,6 +642,8 @@ int vj_unicap_configure_device( void *ud, int pixel_format, int w, int h )
|
|||||||
if( !SUCCESS( unicap_set_format( vut->handle, &(vut->format) ) ) )
|
if( !SUCCESS( unicap_set_format( vut->handle, &(vut->format) ) ) )
|
||||||
{
|
{
|
||||||
veejay_msg(0, "Cannot set size %d x %d or format %s", w,h,vut->format.identifier);
|
veejay_msg(0, "Cannot set size %d x %d or format %s", w,h,vut->format.identifier);
|
||||||
|
unicap_unlock_properties( vut->handle );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
veejay_msg(2, "Capture size set to %d x %d (%s)", w,h,vut->format.identifier);
|
veejay_msg(2, "Capture size set to %d x %d (%s)", w,h,vut->format.identifier);
|
||||||
@@ -529,6 +659,8 @@ int vj_unicap_configure_device( void *ud, int pixel_format, int w, int h )
|
|||||||
|
|
||||||
vut->buffer.data = vj_malloc( test.size.width * test.size.height * 4 );
|
vut->buffer.data = vj_malloc( test.size.width * test.size.height * 4 );
|
||||||
vut->buffer.buffer_size = (sizeof(unsigned char) * 4 * test.size.width * test.size.height );
|
vut->buffer.buffer_size = (sizeof(unsigned char) * 4 * test.size.width * test.size.height );
|
||||||
|
unicap_unlock_properties( vut->handle );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -550,28 +682,41 @@ int vj_unicap_grab_frame( void *vut, void *slot )
|
|||||||
{
|
{
|
||||||
VJFrame *f = (VJFrame*)slot;
|
VJFrame *f = (VJFrame*)slot;
|
||||||
vj_unicap_t *v = (vj_unicap_t*) vut;
|
vj_unicap_t *v = (vj_unicap_t*) vut;
|
||||||
|
unicap_lock_properties( v->handle );
|
||||||
|
|
||||||
if(!v->active)
|
if(!v->active)
|
||||||
{
|
{
|
||||||
if(!vj_unicap_start_capture( vut, slot ))
|
if(!vj_unicap_start_capture( vut, slot ))
|
||||||
|
{
|
||||||
|
unicap_unlock_properties( v->handle );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 );
|
veejay_msg( 0, "Failed to queue a buffer on device: %s\n", v->device.identifier );
|
||||||
|
unicap_unlock_properties( v->handle );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !SUCCESS( unicap_wait_buffer( v->handle, &(v->returned_buffer )) ) )
|
if( !SUCCESS( unicap_wait_buffer( v->handle, &(v->returned_buffer )) ) )
|
||||||
{
|
{
|
||||||
veejay_msg(0,"Failed to wait for buffer on device: %s\n", v->device.identifier );
|
veejay_msg(0,"Failed to wait for buffer on device: %s\n", v->device.identifier );
|
||||||
|
unicap_unlock_properties( v->handle );
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( v->deinterlace )
|
if( v->deinterlace )
|
||||||
{
|
{
|
||||||
yuv_deinterlace( f, v->buffer.data,v->buffer.data+v->sizes[0],v->buffer.data+v->sizes[0]+
|
yuv_deinterlace( f,
|
||||||
v->sizes[1] );
|
v->buffer.data,
|
||||||
|
v->buffer.data + v->sizes[0],
|
||||||
|
v->buffer.data +v->sizes[0] + v->sizes[1]
|
||||||
|
);
|
||||||
if( v->sampler )
|
if( v->sampler )
|
||||||
chroma_supersample( SSM_422_444, v->sampler, f->data, f->width,f->height );
|
chroma_supersample( SSM_422_444, v->sampler, f->data, f->width,f->height );
|
||||||
}
|
}
|
||||||
@@ -591,6 +736,7 @@ int vj_unicap_grab_frame( void *vut, void *slot )
|
|||||||
util_convertsrc( v->buffer.data, f->width,f->height,f->pixfmt, f->data );
|
util_convertsrc( v->buffer.data, f->width,f->height,f->pixfmt, f->data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
unicap_unlock_properties( v->handle );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,5 +32,7 @@ int vj_unicap_grab_frame( void *vut, void *slot );
|
|||||||
int vj_unicap_stop_capture( void *vut );
|
int vj_unicap_stop_capture( void *vut );
|
||||||
void vj_unicap_free_device( void *vut );
|
void vj_unicap_free_device( void *vut );
|
||||||
|
|
||||||
|
void *vj_unicap_get_devices(void *in);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user