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: mute: Always keep the videodev and mixer mute in sync Author: Hans de Goede <[email protected]> Date: Sat Feb 13 16:47:26 2016 -0200 This fixes the "m" hotkey for mute not working on cards where there is no mute on the videodev, and fixes the last setting for mute not being properly restored on the next run. Signed-off-by: Hans de Goede <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]> src/commands.c | 15 ++++-------- src/tvtime-scanner.c | 5 +--- src/tvtime.c | 11 ++++----- src/videoinput.c | 66 ++++++++++++++++++++++++++++++---------------------- src/videoinput.h | 4 ++-- 5 files changed, 49 insertions(+), 52 deletions(-) --- http://git.linuxtv.org/cgit.cgi/tvtime.git/commit/?id=a3513d69fdea8a8f8c999b0849a6b5698db044c5 diff --git a/src/commands.c b/src/commands.c index aa14d787be22..53fe94e7ec2a 100644 --- a/src/commands.c +++ b/src/commands.c @@ -3017,20 +3017,12 @@ void commands_handle( commands_t *cmd, int tvtime_cmd, const char *arg ) cmd->change_channel = 1; } else if( cmd->osd ) { tvtime_osd_show_info( cmd->osd ); - } - break; - - case TVTIME_MIXER_TOGGLE_MUTE: - mixer_mute( !mixer->ismute() ); - - if( cmd->osd ) { - tvtime_osd_show_data_bar( cmd->osd, _("Volume"), (mixer->get_volume()) & 0xff ); - } - break; + } + break; case TVTIME_MIXER_UP: - /* If the user increases the volume, drop us out of mute mode. */ + /* If the user increases the volume, drop us out of mute mode. */ if( cmd->vidin && videoinput_get_muted( cmd->vidin ) ) { commands_handle( cmd, TVTIME_TOGGLE_MUTE, 0 ); } @@ -3050,6 +3042,7 @@ void commands_handle( commands_t *cmd, int tvtime_cmd, const char *arg ) } break; + case TVTIME_MIXER_TOGGLE_MUTE: case TVTIME_TOGGLE_MUTE: if( cmd->vidin ) { videoinput_mute( cmd->vidin, !videoinput_get_muted( cmd->vidin ) ); diff --git a/src/tvtime-scanner.c b/src/tvtime-scanner.c index fefae00b1818..371d6681db65 100644 --- a/src/tvtime-scanner.c +++ b/src/tvtime-scanner.c @@ -105,10 +105,7 @@ int main( int argc, char **argv ) return 1; } - vidin = videoinput_new( config_get_v4l_device( cfg ), - config_get_inputwidth( cfg ), - config_get_audio_boost( cfg ), - norm, verbose, error_string ); + vidin = videoinput_new( cfg, norm, verbose, error_string ); if( !vidin ) { station_delete( stationmgr ); config_delete( cfg ); diff --git a/src/tvtime.c b/src/tvtime.c index b6b10173daee..1d079811441b 100644 --- a/src/tvtime.c +++ b/src/tvtime.c @@ -1321,10 +1321,7 @@ int tvtime_main( rtctimer_t *rtctimer, int read_stdin, int realtime, /* Default to a width specified on the command line. */ width = config_get_inputwidth( ct ); - vidin = videoinput_new( config_get_v4l_device( ct ), - config_get_inputwidth( ct ), - config_get_audio_boost( ct ), - norm, verbose, error_string2 ); + vidin = videoinput_new( ct, norm, verbose, error_string2 ); if( !vidin ) { if( asprintf( &error_string, _("Cannot open capture device %s."), @@ -2549,10 +2546,10 @@ int tvtime_main( rtctimer_t *rtctimer, int read_stdin, int realtime, snprintf( number, 6, "%d", mixer->get_unmute_volume() ); config_save( ct, "UnmuteVolume", number ); - snprintf( number, 4, "%d", mixer->ismute() ); - config_save( ct, "Muted", number ); - if( vidin ) { + snprintf( number, 4, "%d", videoinput_get_muted( vidin ) ); + config_save( ct, "Muted", number ); + snprintf( number, 4, "%d", videoinput_get_input_num( vidin ) ); config_save( ct, "V4LInput", number ); diff --git a/src/videoinput.c b/src/videoinput.c index 134a3e421796..11decd816602 100644 --- a/src/videoinput.c +++ b/src/videoinput.c @@ -312,14 +312,19 @@ int videoinput_buffer_invalid( videoinput_t *vidin, int frameid ) return vidin->capbuffers[ frameid ].free; } -videoinput_t *videoinput_new( const char *v4l_device, int capwidth, - int volume, int norm, int verbose, char *error_string ) +videoinput_t *videoinput_new( config_t *cfg, int norm, int verbose, + char *error_string ) { videoinput_t *vidin = malloc( sizeof( videoinput_t ) ); struct v4l2_capability caps_v4l2; struct v4l2_input in; int i; + const char *v4l_device = config_get_v4l_device( cfg ); + int capwidth = config_get_inputwidth( cfg ); + int volume = config_get_audio_boost( cfg ); + int user_muted = config_get_muted( cfg ); + if( capwidth & 1 ) { capwidth -= 1; if( verbose ) { @@ -355,7 +360,7 @@ videoinput_t *videoinput_new( const char *v4l_device, int capwidth, vidin->signal_recover_wait = 0; vidin->signal_acquire_wait = 0; vidin->change_muted = 1; - vidin->user_muted = 0; + vidin->user_muted = user_muted; vidin->hw_muted = 1; vidin->hasaudio = 1; vidin->audiomode = 0; @@ -698,8 +703,13 @@ void videoinput_set_saturation_relative( videoinput_t *vidin, int offset ) } } -static void videoinput_do_mute( videoinput_t *vidin, int mute ) +static void videoinput_do_mute( videoinput_t *vidin ) { + int mute = vidin->user_muted || vidin->change_muted; + + if( mute ) + mixer_mute( 1 ); + if( vidin->hasaudio && mute != vidin->hw_muted ) { struct v4l2_control control; @@ -717,6 +727,9 @@ static void videoinput_do_mute( videoinput_t *vidin, int mute ) } vidin->hw_muted = mute; } + + if( !mute ) + mixer_mute( 0 ); } /* freqKHz is in KHz (duh) */ @@ -736,14 +749,13 @@ void videoinput_set_tuner_freq( videoinput_t *vidin, int freqKHz ) if( !vidin->tunerlow ) { frequency /= 1000; /* switch to MHz */ - } + } - vidin->change_muted = 1; - mixer_mute( 1 ); - videoinput_do_mute( vidin, vidin->user_muted || vidin->change_muted ); - vidin->cur_tuner_state = TUNER_STATE_SIGNAL_DETECTED; - vidin->signal_acquire_wait = SIGNAL_ACQUIRE_DELAY; - vidin->signal_recover_wait = 0; + vidin->change_muted = 1; + videoinput_do_mute( vidin ); + vidin->cur_tuner_state = TUNER_STATE_SIGNAL_DETECTED; + vidin->signal_acquire_wait = SIGNAL_ACQUIRE_DELAY; + vidin->signal_recover_wait = 0; wasstreaming = vidin->is_streaming; @@ -908,26 +920,24 @@ int videoinput_check_for_signal( videoinput_t *vidin, int check_freq_present ) } else { vidin->cur_tuner_state = TUNER_STATE_HAS_SIGNAL; } - default: - if( vidin->change_muted ) { - vidin->change_muted = 0; - videoinput_do_mute( vidin, vidin->user_muted || vidin->change_muted ); - mixer_mute( 0 ); - } - break; - } + default: + if( vidin->change_muted ) { + vidin->change_muted = 0; + videoinput_do_mute( vidin ); + } + break; + } } else { switch( vidin->cur_tuner_state ) { case TUNER_STATE_HAS_SIGNAL: case TUNER_STATE_SIGNAL_DETECTED: - vidin->cur_tuner_state = TUNER_STATE_SIGNAL_LOST; - vidin->signal_recover_wait = SIGNAL_RECOVER_DELAY; - vidin->change_muted = 1; - mixer_mute( 1 ); - videoinput_do_mute( vidin, vidin->user_muted || vidin->change_muted ); - case TUNER_STATE_SIGNAL_LOST: - if( vidin->signal_recover_wait ) { - vidin->signal_recover_wait--; + vidin->cur_tuner_state = TUNER_STATE_SIGNAL_LOST; + vidin->signal_recover_wait = SIGNAL_RECOVER_DELAY; + vidin->change_muted = 1; + videoinput_do_mute( vidin ); + case TUNER_STATE_SIGNAL_LOST: + if( vidin->signal_recover_wait ) { + vidin->signal_recover_wait--; break; } else { vidin->cur_tuner_state = TUNER_STATE_NO_SIGNAL; @@ -960,7 +970,7 @@ void videoinput_switch_pal_secam( videoinput_t *vidin, int norm ) void videoinput_mute( videoinput_t *vidin, int mute ) { vidin->user_muted = mute; - videoinput_do_mute( vidin, vidin->user_muted || vidin->change_muted ); + videoinput_do_mute( vidin ); } int videoinput_get_muted( videoinput_t *vidin ) diff --git a/src/videoinput.h b/src/videoinput.h index 7187deb64155..808896dab68a 100644 --- a/src/videoinput.h +++ b/src/videoinput.h @@ -24,6 +24,7 @@ #else # include <stdint.h> #endif +#include "tvtimeconf.h" #ifdef __cplusplus extern "C" { @@ -108,8 +109,7 @@ const char *videoinput_get_audio_mode_name( videoinput_t *vidin, int mode ); * The verbose flag indicates we should print to stderr when things go * bad, and maybe for some helpful information messages. */ -videoinput_t *videoinput_new( const char *v4l_device, int capwidth, - int volume, int norm, int verbose, +videoinput_t *videoinput_new( config_t *cfg, int norm, int verbose, char *error_string ); /** _______________________________________________ linuxtv-commits mailing list [email protected] http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
