This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/tvtime.git tree:

Subject: alsa_stream: Make latency configurable
Author:  Hans de Goede <[email protected]>
Date:    Sat Feb 13 16:47:24 2016 -0200

Signed-off-by: Hans de Goede <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>

 src/tvtime.c     |  2 +-
 src/tvtimeconf.c | 23 ++++++++++++++++++++++-
 src/tvtimeconf.h |  1 +
 3 files changed, 24 insertions(+), 2 deletions(-)

---

http://git.linuxtv.org/cgit.cgi/tvtime.git/commit/?id=cba7d972ae5108ee42ba6c4df7ac8c19a8927865
diff --git a/src/tvtime.c b/src/tvtime.c
index 116c20aa3b8b..e0c5e62e3156 100644
--- a/src/tvtime.c
+++ b/src/tvtime.c
@@ -1257,7 +1257,7 @@ int tvtime_main( rtctimer_t *rtctimer, int read_stdin, 
int realtime,
     /* Setup the ALSA streaming device */
     alsa_thread_startup(config_get_alsa_outputdev( ct ),
                        config_get_alsa_inputdev( ct ),
-                       50,             /* FIXME: Add a var to adjust latency */
+                       config_get_alsa_latency( ct ),
                        stderr, verbose );
 
     /* Setup the speedy calls. */
diff --git a/src/tvtimeconf.c b/src/tvtimeconf.c
index 001351b37e78..b423b88ecce4 100644
--- a/src/tvtimeconf.c
+++ b/src/tvtimeconf.c
@@ -124,6 +124,7 @@ struct config_s
 
     char *alsa_inputdev;
     char *alsa_outputdev;
+    int alsa_latency;
 };
 
 static unsigned int parse_colour( const char *str )
@@ -421,6 +422,9 @@ static void parse_option( config_t *ct, xmlNodePtr node )
             ct->alsa_outputdev = strdup( curval );
         }
 
+       if( !xmlStrcasecmp( name, BAD_CAST "AlsaLatency" ) ) {
+           ct->alsa_latency = atoi( curval );
+       }
     }
 
     if( name ) xmlFree( name );
@@ -717,6 +721,7 @@ static void print_config_usage( char **argv )
               "                                 Examples:\n"
               "                                          hw:0,0\n"
               "                                          disabled\n"), stderr 
);
+    lfputs( _("  -z, --alsalatency=LATENCY  Specifies ALSA loopback latency in 
milli-seconds\n"), stderr );
 }
 
 static void print_scanner_usage( char **argv )
@@ -818,6 +823,7 @@ config_t *config_new( void )
 
     ct->alsa_inputdev = strdup( "hw:1,0" );
     ct->alsa_outputdev = strdup( "default" );
+    ct->alsa_latency = 50;
 
     /* Default key bindings. */
     ct->keymap[ 0 ] = TVTIME_NOCOMMAND;
@@ -1092,6 +1098,7 @@ int config_parse_tvtime_config_command_line( config_t 
*ct, int argc, char **argv
         { "priority", 2, 0, 'R' },
         { "alsainputdev", 2, 0, 'p' },
         { "alsaoutputdev", 2, 0, 'P' },
+       { "alsalatency", 2, 0, 'z' },
         { 0, 0, 0, 0 }
     };
     int option_index = 0;
@@ -1104,7 +1111,7 @@ int config_parse_tvtime_config_command_line( config_t 
*ct, int argc, char **argv
     }
 
     while( (c = getopt_long( argc, argv,
-            "aAhmMF:g:I:d:b:i:c:n:D:f:x:t:Ll:R:p:P",
+           "aAhmMF:g:I:d::b::i::c:n::D:f::x:t::Ll::R::p::P::z::",
             long_options, &option_index )) != -1 ) {
         switch( c ) {
         case 'a': ct->aspect = 1; break;
@@ -1206,6 +1213,13 @@ int config_parse_tvtime_config_command_line( config_t 
*ct, int argc, char **argv
                       ct->alsa_outputdev = strdup( optarg );
                   }
                   break;
+       case 'z': if( !optarg ) {
+                     fprintf( stdout, "AlsaLatency:%d\n",
+                              config_get_alsa_latency( ct ) );
+                 } else {
+                     ct->alsa_latency = atoi( optarg );
+                 }
+                 break;
         default:
             print_config_usage( argv );
             return 0;
@@ -1277,6 +1291,8 @@ int config_parse_tvtime_config_command_line( config_t 
*ct, int argc, char **argv
 
         config_save( ct, "AlsaInputDev", ct->alsa_inputdev );
         config_save( ct, "AlsaOutputDev", ct->alsa_outputdev );
+       snprintf( tempstring, sizeof( tempstring ), "%d", ct->alsa_latency );
+       config_save( ct, "AlsaLatency", tempstring );
     }
 
     return 1;
@@ -1754,3 +1770,8 @@ const char *config_get_alsa_outputdev( config_t *ct )
 {
     return ct->alsa_outputdev;
 }
+
+int config_get_alsa_latency( config_t *ct )
+{
+    return ct->alsa_latency;
+}
diff --git a/src/tvtimeconf.h b/src/tvtimeconf.h
index 030d8850d509..92dc211c47ae 100644
--- a/src/tvtimeconf.h
+++ b/src/tvtimeconf.h
@@ -195,6 +195,7 @@ int config_get_show_taglines( config_t *ct );
 int config_get_square_pixels( config_t *ct );
 const char *config_get_alsa_inputdev( config_t *ct );
 const char *config_get_alsa_outputdev( config_t *ct );
+int config_get_alsa_latency( config_t *ct );
 
 #ifdef __cplusplus
 };

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to