aboutsummaryrefslogtreecommitdiffstats
path: root/src/tvtimeconf.c
diff options
context:
space:
mode:
authorDevin Heitmueller <dheitmueller@kernellabs.com>2009-12-27 23:16:47 -0500
committerDevin Heitmueller <dheitmueller@kernellabs.com>2009-12-27 23:16:47 -0500
commit7c1db62277c19dffc4fc77cc5a3af5733e335110 (patch)
tree45ffe1c49612f70074434eb9f3b17b0dcef5dc68 /src/tvtimeconf.c
parentaf27137adc35f92cb11288642afa1a13e2089b81 (diff)
djh - first cut at including support for reading on an ALSA device during playback. Currently only tested with the HVR-950q.
Also, there is currently no GUI option to set the device - users must run "./tvtime-configure --alsainputdev=hw:1,0" and "./tvtime-configure --alsaoutputdev=hw:0,0" to set the input and output devices.
Diffstat (limited to 'src/tvtimeconf.c')
-rw-r--r--src/tvtimeconf.c60
1 files changed, 59 insertions, 1 deletions
diff --git a/src/tvtimeconf.c b/src/tvtimeconf.c
index 4f6a447..5db6325 100644
--- a/src/tvtimeconf.c
+++ b/src/tvtimeconf.c
@@ -120,6 +120,9 @@ struct config_s
char *config_filename;
xmlDocPtr doc;
+
+ char *alsa_inputdev;
+ char *alsa_outputdev;
};
static unsigned int parse_colour( const char *str )
@@ -402,6 +405,17 @@ static void parse_option( config_t *ct, xmlNodePtr node )
if( ct->mixerdev ) free( ct->mixerdev );
ct->mixerdev = strdup( curval );
}
+
+ if( !xmlStrcasecmp( name, BAD_CAST "AlsaInputDev" ) ) {
+ if( ct->alsa_inputdev ) free( ct->alsa_inputdev );
+ ct->alsa_inputdev = strdup( curval );
+ }
+
+ if( !xmlStrcasecmp( name, BAD_CAST "AlsaOutputDev" ) ) {
+ if( ct->alsa_outputdev ) free( ct->alsa_outputdev );
+ ct->alsa_outputdev = strdup( curval );
+ }
+
}
if( name ) xmlFree( name );
@@ -684,6 +698,14 @@ static void print_config_usage( char **argv )
" mic, cd, mix, pcm2, rec, igain, ogain, line1,\n"
" line2, line3, dig1, dig2, dig3, phin, phout,\n"
" video, radio, monitor\n"), stderr );
+ lfputs( _(" -p, --alsainputdev=DEV Specifies an ALSA device to read input on\n"
+ " Examples:\n"
+ " hw:1,0\n"
+ " disabled\n"), stderr );
+ lfputs( _(" -P, --alsaoutputdev=DEV Specifies an ALSA device to write output to\n"
+ " Examples:\n"
+ " hw:0,0\n"
+ " disabled\n"), stderr );
}
static void print_scanner_usage( char **argv )
@@ -782,6 +804,9 @@ config_t *config_new( void )
ct->config_filename = 0;
ct->doc = 0;
+ ct->alsa_inputdev = strdup( "hw:1,0" );
+ ct->alsa_outputdev = strdup( "hw:0,0" );
+
/* Default key bindings. */
ct->keymap[ 0 ] = TVTIME_NOCOMMAND;
ct->keymap[ I_ESCAPE ] = TVTIME_QUIT;
@@ -1038,6 +1063,8 @@ int config_parse_tvtime_config_command_line( config_t *ct, int argc, char **argv
{ "xmltv", 2, 0, 't' },
{ "xmltvlanguage", 2, 0, 'l' },
{ "priority", 2, 0, 'R' },
+ { "alsainputdev", 2, 0, 'p' },
+ { "alsaoutputdev", 2, 0, 'P' },
{ 0, 0, 0, 0 }
};
int option_index = 0;
@@ -1049,7 +1076,8 @@ int config_parse_tvtime_config_command_line( config_t *ct, int argc, char **argv
return 0;
}
- while( (c = getopt_long( argc, argv, "aAhmMF:g:I:d:b:i:c:n:D:f:x:t:l:R:",
+ while( (c = getopt_long( argc, argv,
+ "aAhmMF:g:I:d:b:i:c:n:D:f:x:t:l:R:p:P",
long_options, &option_index )) != -1 ) {
switch( c ) {
case 'a': ct->aspect = 1; break;
@@ -1134,6 +1162,22 @@ int config_parse_tvtime_config_command_line( config_t *ct, int argc, char **argv
ct->priority = atoi( optarg );
}
break;
+ case 'p': if( !optarg ) {
+ fprintf( stdout, "AlsaInputDevice:%s\n",
+ config_get_alsa_inputdev( ct ) );
+ } else {
+ free( ct->alsa_inputdev );
+ ct->alsa_inputdev = strdup( optarg );
+ }
+ break;
+ case 'P': if( !optarg ) {
+ fprintf( stdout, "AlsaOutputDevice:%s\n",
+ config_get_alsa_outputdev( ct ) );
+ } else {
+ free( ct->alsa_outputdev );
+ ct->alsa_outputdev = strdup( optarg );
+ }
+ break;
default:
print_config_usage( argv );
return 0;
@@ -1199,6 +1243,9 @@ int config_parse_tvtime_config_command_line( config_t *ct, int argc, char **argv
snprintf( tempstring, sizeof( tempstring ), "%d", ct->priority );
config_save( ct, "ProcessPriority", tempstring );
+
+ config_save( ct, "AlsaInputDev", ct->alsa_inputdev );
+ config_save( ct, "AlsaOutputDev", ct->alsa_outputdev );
}
return 1;
@@ -1261,6 +1308,8 @@ void config_free_data( config_t *ct )
if( ct->vbidev ) free( ct->vbidev );
if( ct->config_filename ) free( ct->config_filename );
if( ct->deinterlace_method ) free( ct->deinterlace_method );
+ if( ct->alsa_inputdev ) free( ct->alsa_inputdev );
+ if( ct->alsa_outputdev ) free( ct->alsa_outputdev );
}
void config_delete( config_t *ct )
@@ -1661,3 +1710,12 @@ int config_get_square_pixels( config_t *ct )
return ct->squarepixels;
}
+const char *config_get_alsa_inputdev( config_t *ct )
+{
+ return ct->alsa_inputdev;
+}
+
+const char *config_get_alsa_outputdev( config_t *ct )
+{
+ return ct->alsa_outputdev;
+}

Privacy Policy