minor update , load capture devices on startup in reloaded

git-svn-id: svn://code.dyne.org/veejay/trunk@812 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
Niels Elburg
2007-02-25 14:09:42 +00:00
parent 20c931c685
commit d99b453050
3 changed files with 45 additions and 53 deletions

View File

@@ -14,10 +14,10 @@
CODENAME: classic 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 :: :: Veejay, a visual instrument for GNU ::

View File

@@ -103,6 +103,7 @@ static int vj_unicap_scan_enumerate_devices(void *unicap)
char key[64]; char key[64];
unicap_void_device(&(ud->device)); unicap_void_device(&(ud->device));
while( SUCCESS( unicap_enumerate_devices( NULL, &(ud->device), i )) ) while( SUCCESS( unicap_enumerate_devices( NULL, &(ud->device), i )) )
{ {
char *device_name = strdup( ud->device.identifier ); char *device_name = strdup( ud->device.identifier );
@@ -153,61 +154,53 @@ char **vj_unicap_get_devices(void *unicap, int *n_dev)
veejay_msg(0, "I didn't find any capture devices"); veejay_msg(0, "I didn't find any capture devices");
return NULL; return NULL;
} }
/*
result = (char**) vj_calloc(sizeof(char*) * (ud->num_devices+1));
unicap_void_device( &(ud->device) ); char **items = vevo_list_properties( ud->device_list );
if(! items )
for( i = 0; i < ud->num_devices; i++ )
{ {
char tmp[1024]; veejay_msg(0, "Empty list of capture devices");
unicap_property_t property; return NULL;
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) ) ) ) int len = 1;
int error = 0;
for ( i = 0; items[i] != NULL ; i ++ )
{ {
veejay_msg(0, "Failed to open: %s (device '%d')\n", &(ud->device.identifier), i ); error = vevo_property_get( ud->device_list,items[i], 0, NULL );
continue; if( error == VEVO_NO_ERROR )
len ++;
} }
unicap_lock_properties( ud->handle );
unicap_void_property( &property ); result = vj_calloc( sizeof(char*) * len );
unicap_void_format( &format ); 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 );
unicap_reenumerate_properties( ud->handle, &property_count ); free(name);
unicap_reenumerate_formats( ud->handle, &format_count ); free(loc);
char *device_name = strdup( ud->device.identifier );
char *device_location = strdup( ud->device.device );
result[j] = strdup(text );
snprintf(tmp,1024, "%03d%s%03d%s", free(text);
strlen( device_name ),
device_name,
strlen( device_location ),
device_location );
result[j] = strdup( tmp );
j++; j++;
free( device_location );
free( device_name );
unicap_unlock_properties( ud->handle );
unicap_close( ud->handle );
} }
free(items[i]);
}
free(items );
*n_dev = j; *n_dev = j;
*/
return result; return result;
} }

View File

@@ -2575,7 +2575,6 @@ void vj_event_send_devicelist( void *ptr, const char format[], va_list ap)
veejay_t *v = (veejay_t*) ptr; veejay_t *v = (veejay_t*) ptr;
char *buf = vj_tag_scan_devices(); char *buf = vj_tag_scan_devices();
veejay_msg(0, "%s",buf);
SEND_MSG( v, buf ); SEND_MSG( v, buf );
free(buf); free(buf);
} }