From d99b453050b96f818d2390e29f824e677c8cb0e7 Mon Sep 17 00:00:00 2001 From: Niels Elburg Date: Sun, 25 Feb 2007 14:09:42 +0000 Subject: [PATCH] minor update , load capture devices on startup in reloaded git-svn-id: svn://code.dyne.org/veejay/trunk@812 eb8d1916-c9e9-0310-b8de-cf0c9472ead5 --- veejay-current/README | 4 +- veejay-current/libstream/vj-unicap.c | 93 +++++++++++++--------------- veejay-current/veejay/vj-event.c | 1 - 3 files changed, 45 insertions(+), 53 deletions(-) diff --git a/veejay-current/README b/veejay-current/README index 7d67adf2..f953bcf0 100644 --- a/veejay-current/README +++ b/veejay-current/README @@ -14,10 +14,10 @@ CODENAME: classic - 0.9.23 + 0.9.25 - 2006/2007 - release date Feb. 12 2007 + 2006/2007 - release date Feb. 24 2007 ======================================= :: Veejay, a visual instrument for GNU :: diff --git a/veejay-current/libstream/vj-unicap.c b/veejay-current/libstream/vj-unicap.c index ef221ec3..c4808e91 100644 --- a/veejay-current/libstream/vj-unicap.c +++ b/veejay-current/libstream/vj-unicap.c @@ -102,6 +102,7 @@ static int vj_unicap_scan_enumerate_devices(void *unicap) unicap_driver_t *ud = (unicap_driver_t*) unicap; char key[64]; unicap_void_device(&(ud->device)); + while( SUCCESS( unicap_enumerate_devices( NULL, &(ud->device), i )) ) { @@ -153,61 +154,53 @@ char **vj_unicap_get_devices(void *unicap, int *n_dev) veejay_msg(0, "I didn't find any capture devices"); return NULL; } -/* - result = (char**) vj_calloc(sizeof(char*) * (ud->num_devices+1)); - unicap_void_device( &(ud->device) ); - - for( i = 0; i < ud->num_devices; i++ ) + char **items = vevo_list_properties( ud->device_list ); + if(! items ) { - char tmp[1024]; - unicap_property_t property; - unicap_format_t format; - int property_count = 0; - int format_count = 0; - - if( !SUCCESS( unicap_enumerate_devices( NULL, &(ud->device), i))) - { - veejay_msg(0, "Failed to get information for device '%s'", ud->device.identifier ); - continue; - } - - if( !SUCCESS( unicap_open( &(ud->handle), &(ud->device) ) ) ) - { - veejay_msg(0, "Failed to open: %s (device '%d')\n", &(ud->device.identifier), i ); - continue; - } - unicap_lock_properties( ud->handle ); - - unicap_void_property( &property ); - unicap_void_format( &format ); - - - unicap_reenumerate_properties( ud->handle, &property_count ); - unicap_reenumerate_formats( ud->handle, &format_count ); - char *device_name = strdup( ud->device.identifier ); - char *device_location = strdup( ud->device.device ); - - - snprintf(tmp,1024, "%03d%s%03d%s", - strlen( device_name ), - device_name, - strlen( device_location ), - device_location ); - - result[j] = strdup( tmp ); - j++; - - free( device_location ); - free( device_name ); - - unicap_unlock_properties( ud->handle ); - - unicap_close( ud->handle ); + veejay_msg(0, "Empty list of capture devices"); + return NULL; } + + int len = 1; + int error = 0; + for ( i = 0; items[i] != NULL ; i ++ ) + { + error = vevo_property_get( ud->device_list,items[i], 0, NULL ); + if( error == VEVO_NO_ERROR ) + len ++; + } + + result = vj_calloc( sizeof(char*) * len ); + for( i = 0; items[i] != NULL ; i ++ ) + { + void *port = NULL; + error = vevo_property_get( ud->device_list, items[i], 0, &port ); + if( error == VEVO_NO_ERROR ) + { + size_t name_len = vevo_property_element_size( port, "name", 0 ); + char *name = (char*) vj_calloc( name_len ); + vevo_property_get( port, "name",0,&name ); + name_len = vevo_property_element_size( port, "device", 0 ); + char *loc = (char*) vj_calloc( name_len ); + vevo_property_get( port, "device", 0, &loc ); + int new_len = strlen(loc) + strlen(name) + 8; + + char *text = vj_calloc( new_len ); + snprintf(text, new_len, "%03d%s%03d%s",strlen(name), name,strlen(loc), loc ); + + free(name); + free(loc); + + result[j] = strdup(text ); + free(text); + j++; + } + free(items[i]); + } + free(items ); *n_dev = j; -*/ return result; } diff --git a/veejay-current/veejay/vj-event.c b/veejay-current/veejay/vj-event.c index d4012310..0641c1d7 100644 --- a/veejay-current/veejay/vj-event.c +++ b/veejay-current/veejay/vj-event.c @@ -2575,7 +2575,6 @@ void vj_event_send_devicelist( void *ptr, const char format[], va_list ap) veejay_t *v = (veejay_t*) ptr; char *buf = vj_tag_scan_devices(); - veejay_msg(0, "%s",buf); SEND_MSG( v, buf ); free(buf); }