Ticket #5477: toggleupmixer.diff
File toggleupmixer.diff, 7.9 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/NuppelVideoPlayer.cpp
3724 3730 audio_codec = ac; 3725 3731 } 3726 3732 3733 bool NuppelVideoPlayer::ToggleUpmixer() 3734 { 3735 if (audioOutput) 3736 { 3737 const AudioSettings settings( 3738 audio_bits, audio_channels, audio_samplerate, 3739 audio_passthru, audio_codec); 3740 return audioOutput->ToggleUpmixer(settings); 3741 } 3742 return false; 3743 } 3744 3727 3745 void NuppelVideoPlayer::SetEffDsp(int dsprate) 3728 3746 { 3729 3747 if (audioOutput) -
libs/libmythtv/tv_play.h
239 239 // Used by EPG 240 240 void ChangeVolume(bool up); 241 241 void ToggleMute(void); 242 void ToggleUpmixer(void); 242 243 243 244 public slots: 244 245 void HandleOSDClosed(int osdType); -
libs/libmythtv/NuppelVideoPlayer.h
128 128 void SetAudioParams(int bits, int channels, int samplerate, bool passthru); 129 129 void SetEffDsp(int dsprate); 130 130 void SetAudioCodec(void *ac); 131 bool ToggleUpmixer(); 131 132 132 133 // Sets 133 134 void SetParentWidget(QWidget *widget) { parentWidget = widget; } -
libs/libmythtv/tv_play.cpp
379 380 REG_KEY("TV Playback", "VOLUMEDOWN", "Volume down", "[,{,F10,Volume Down"); 380 381 REG_KEY("TV Playback", "VOLUMEUP", "Volume up", "],},F11,Volume Up"); 381 382 REG_KEY("TV Playback", "MUTE", "Mute", "|,\\,F9,Volume Mute"); 383 REG_KEY("TV Playback", "TOGGLEUPMIXER", "Toggle Upmixer", "F12,Toggle Upmixer"); 382 384 REG_KEY("TV Playback", "TOGGLEPIPMODE", "Toggle Picture-in-Picture mode", 383 385 "V"); 384 386 REG_KEY("TV Playback", "TOGGLEPIPWINDOW", "Toggle active PiP window", "B"); … … 2742 2744 else if (action == "VOLUMEDOWN" || action == "VOLUMEUP" || 2743 2745 action == "STRETCHINC" || action == "STRETCHDEC" || 2744 2746 action == "MUTE" || action == "TOGGLEASPECT" || 2745 action == "TOGGLEFILL" )2747 action == "TOGGLEFILL" || action == "TOGGLEUPMIXER") 2746 2748 { 2747 2749 passThru = 1; 2748 2750 handled = false; … … 2797 2799 else if (action == "VOLUMEDOWN" || action == "VOLUMEUP" || 2798 2800 action == "STRETCHINC" || action == "STRETCHDEC" || 2799 2801 action == "MUTE" || action == "PAUSE" || 2800 action == "CLEAROSD" )2802 action == "CLEAROSD" || action == "TOGGLEUPMIXER") 2801 2803 { 2802 2804 passThru = 1; 2803 2805 handled = false; … … 3364 3366 ChangeVolume(true); 3365 3367 else if (action == "MUTE") 3366 3368 ToggleMute(); 3369 else if (action == "TOGGLEUPMIXER") 3370 ToggleUpmixer(); 3367 3371 else if (action == "STRETCHINC") 3368 3372 ChangeTimeStretch(1); 3369 3373 else if (action == "STRETCHDEC") … … 6143 6149 GetOSD()->SetSettingsText(text, 5); 6144 6150 } 6145 6151 6152 void TV::ToggleUpmixer(void) 6153 { 6154 bool state=nvp->ToggleUpmixer(); 6155 6156 QString text; 6157 6158 if(state) 6159 text = tr("Upmixer enabled"); 6160 else 6161 text = tr("Upmixer disabled"); 6162 6163 if (GetOSD() && !browsemode) 6164 GetOSD()->SetSettingsText(text, 5); 6165 } 6166 6146 6167 void TV::ToggleSleepTimer(void) 6147 6168 { 6148 6169 QString text; -
libs/libmyth/audiooutputbase.h
76 76 /// Audio Buffer Size -- should be divisible by 12,10,8,6,4,2.. 77 77 static const uint kAudioRingBufferSize = 1536000; 78 78 79 virtual bool ToggleUpmixer(const AudioSettings&); 79 80 protected: 80 81 // You need to implement the following functions 81 82 virtual bool OpenDevice(void) = 0; … … 153 154 int source_audio_channels; 154 155 int source_audio_bytes_per_sample; 155 156 bool needs_upmix; 157 bool upmixer_enabled; 156 158 int surround_mode; 157 159 158 160 bool blocking; // do AddSamples calls block? -
libs/libmyth/audiooutputbase.cpp
53 53 source_audio_channels(-1), 54 54 source_audio_bytes_per_sample(0), 55 55 needs_upmix(false), 56 upmixer_enabled(false), 56 57 surround_mode(FreeSurround::SurroundModePassive), 57 58 58 59 blocking(false), … … 223 224 } 224 225 225 226 if ((configured_audio_channels == 6) && 226 !(settings.codec || audio_codec) )227 !(settings.codec || audio_codec) && upmixer_enabled) 227 228 { 228 229 settings.channels = configured_audio_channels; 229 230 lneeds_upmix = true; … … 245 246 return; 246 247 } 247 248 248 if (general_deps && !upmix_deps && lneeds_upmix && upmixer )249 if (general_deps && !upmix_deps && lneeds_upmix && upmixer && upmixer_enabled) 249 250 { 250 251 upmixer->flush(); 251 252 source_audio_channels = lsource_audio_channels; … … 654 655 audio_bytes_per_sample) / audio_stretchfactor); 655 656 } 656 657 657 if (upmixer && needs_upmix )658 if (upmixer && needs_upmix && upmixer_enabled) 658 659 { 659 660 totalbuffer += upmixer->sampleLatency() * audio_bytes_per_sample; 660 661 } … … 700 701 len = (int)ceilf(float(len) * src_data.src_ratio); 701 702 702 703 // include samples in upmix buffer that may be flushed 703 if (needs_upmix && upmixer )704 if (needs_upmix && upmixer && upmixer_enabled) 704 705 len += upmixer->numUnprocessedSamples() * abps; 705 706 706 707 if (pSoundStretch) … … 767 768 len = (int)ceilf(float(len) * src_data.src_ratio); 768 769 769 770 // include samples in upmix buffer that may be flushed 770 if (needs_upmix && upmixer )771 if (needs_upmix && upmixer && upmixer_enabled) 771 772 len += upmixer->numUnprocessedSamples() * abps; 772 773 773 774 if (pSoundStretch) … … 854 855 return len; 855 856 } 856 857 858 bool AudioOutputBase::ToggleUpmixer(const AudioSettings& settings) 859 { 860 upmixer_enabled = !upmixer_enabled; 861 this->Reconfigure(settings); 862 return upmixer_enabled; 863 } 864 857 865 void AudioOutputBase::_AddSamples(void *buffer, bool interleaved, int samples, 858 866 long long timecode) 859 867 { … … 870 878 871 879 VERBOSE(VB_AUDIO+VB_TIMESTAMP, 872 880 LOC + QString("_AddSamples samples=%1 bytes=%2, used=%3, " 873 "free=%4, timecode=%5 needsupmix %6 ")881 "free=%4, timecode=%5 needsupmix %6 upmixer enabled %7") 874 882 .arg(samples) 875 883 .arg(samples * abps) 876 884 .arg(kAudioRingBufferSize-afree).arg(afree).arg(timecode) 877 .arg(needs_upmix) );885 .arg(needs_upmix).arg(upmixer_enabled)); 878 886 879 if (upmixer && needs_upmix )887 if (upmixer && needs_upmix && upmixer_enabled) 880 888 { 881 889 int out_samples = 0; 882 890 int step = (interleaved)?source_audio_channels:1; -
libs/libmyth/audiooutput.h
69 69 virtual void bufferOutputData(bool y) = 0; 70 70 virtual int readOutputData(unsigned char *read_buffer, int max_length) = 0; 71 71 72 virtual bool ToggleUpmixer(const AudioSettings&) = 0; 73 72 74 protected: 73 75 void Error(const QString &msg); 74 76 void Warn(const QString &msg);