- Index: mythtv/libs/libmythtv/NuppelVideoPlayer.cpp
- ===================================================================
- --- mythtv/libs/libmythtv/NuppelVideoPlayer.cpp (revision 25121)
- +++ mythtv/libs/libmythtv/NuppelVideoPlayer.cpp (working copy)
- @@ -5134,6 +5134,21 @@
- return false;
- }
- +bool NuppelVideoPlayer::ToggleVuvuzela()
- +{
- + bool ret = false;
- + if (audioOutput)
- + ret = audioOutput->ToggleVuvuzela();
- + if (decoder)
- + decoder->SetDisablePassThrough(ret);
- + return ret;
- +}
- +
- +bool NuppelVideoPlayer::IsVuvuzela()
- +{
- + return audioOutput ? audioOutput->IsVuvuzela() : false;
- +}
- +
- void NuppelVideoPlayer::Zoom(ZoomDirection direction)
- {
- if (videoOutput)
- Index: mythtv/libs/libmythtv/avformatdecoder.cpp
- ===================================================================
- --- mythtv/libs/libmythtv/avformatdecoder.cpp (revision 25121)
- +++ mythtv/libs/libmythtv/avformatdecoder.cpp (working copy)
- @@ -4639,6 +4639,7 @@
- else if (ctx->codec_id == CODEC_ID_DTS)
- passthru = allow_dts_passthru && !internal_vol;
- + passthru &= !GetNVP()->IsVuvuzela();
- passthru &= !transcoding && !disable_passthru;
- // Don't know any cards that support spdif clocked at < 44100
- // Some US cable transmissions have 2ch 32k AC-3 streams
- Index: mythtv/libs/libmythtv/tv_play.h
- ===================================================================
- --- mythtv/libs/libmythtv/tv_play.h (revision 25121)
- +++ mythtv/libs/libmythtv/tv_play.h (working copy)
- @@ -436,6 +436,7 @@
- const QStringList &actions);
- void ToggleUpmix(PlayerContext*);
- + void ToggleVuvuzela(PlayerContext*);
- void ChangeAudioSync(PlayerContext*, int dir, bool allowEdit = true);
- bool AudioSyncHandleAction(PlayerContext*, const QStringList &actions);
- Index: mythtv/libs/libmythtv/dbcheck.cpp
- ===================================================================
- --- mythtv/libs/libmythtv/dbcheck.cpp (revision 25121)
- +++ mythtv/libs/libmythtv/dbcheck.cpp (working copy)
- @@ -20,7 +20,7 @@
- mythtv/bindings/python/MythTV/MythStatic.py
- */
- /// This is the DB schema version expected by the running MythTV instance.
- -const QString currentDatabaseVersion = "1254";
- +const QString currentDatabaseVersion = "1259";
- static bool UpdateDBVersionNumber(const QString &newnumber);
- static bool performActualUpdate(
- Index: mythtv/libs/libmythtv/NuppelVideoPlayer.h
- ===================================================================
- --- mythtv/libs/libmythtv/NuppelVideoPlayer.h (revision 25121)
- +++ mythtv/libs/libmythtv/NuppelVideoPlayer.h (working copy)
- @@ -165,6 +165,8 @@
- void ToggleAspectOverride(AspectOverrideMode aspectMode = kAspect_Toggle);
- void ToggleAdjustFill(AdjustFillMode adjustfillMode = kAdjustFill_Toggle);
- bool ToggleUpmix(void);
- + bool ToggleVuvuzela(void);
- + bool IsVuvuzela(void);
- // Gets
- QSize GetVideoBufferSize(void) const { return video_dim; }
- Index: mythtv/libs/libmythtv/tv_play.cpp
- ===================================================================
- --- mythtv/libs/libmythtv/tv_play.cpp (revision 25121)
- +++ mythtv/libs/libmythtv/tv_play.cpp (working copy)
- @@ -4516,6 +4516,8 @@
- ToggleTimeStretch(ctx);
- else if (has_action("TOGGLEUPMIX", actions))
- ToggleUpmix(ctx);
- + else if (has_action("TOGGLEVUVUZELA", actions))
- + ToggleVuvuzela(ctx);
- else if (has_action("TOGGLESLEEP", actions))
- ToggleSleepTimer(ctx);
- else if (has_action("TOGGLERECORD", actions) && islivetv)
- @@ -8286,6 +8288,20 @@
- ctx->nvp->GetOSD()->SetSettingsText(text, 5);
- }
- +void TV::ToggleVuvuzela(PlayerContext *ctx)
- +{
- + if (!ctx->nvp || !ctx->nvp->HasAudioOut())
- + return;
- + QString text;
- + if (ctx->nvp->ToggleVuvuzela())
- + text = tr("Vuvuzela Filter On");
- + else
- + text = tr("Vuvuzela Filter Off");
- +
- + if (ctx->nvp->GetOSD() && !browsemode)
- + ctx->nvp->GetOSD()->SetSettingsText(text, 5);
- +}
- +
- // dir in 10ms jumps
- void TV::ChangeAudioSync(PlayerContext *ctx, int dir, bool allowEdit)
- {
- @@ -9949,6 +9965,8 @@
- ToggleTimeStretch(actx);
- else if (action == "TOGGLEUPMIX")
- ToggleUpmix(actx);
- + else if (action == "TOGGLEVUVUZELA")
- + ToggleVuvuzela(actx);
- else if (action.left(13) == "ADJUSTSTRETCH")
- {
- bool floatRead;
- @@ -10323,6 +10341,8 @@
- new OSDGenericTree(treeMenu, tr("Adjust Audio Sync"), "TOGGLEAUDIOSYNC");
- else if (category == "TOGGLEUPMIX")
- new OSDGenericTree(treeMenu, tr("Toggle Audio Upmixer"), "TOGGLEUPMIX");
- + else if (category == "TOGGLEVUVUZELA")
- + new OSDGenericTree(treeMenu, tr("Toggle Vuvuzela Filter"), "TOGGLEVUVUZELA");
- else if (category == "TIMESTRETCH")
- FillMenuTimeStretch(ctx, treeMenu);
- else if (category == "VIDEOSCAN")
- Index: mythtv/libs/libmythtv/tvosdmenuentry.cpp
- ===================================================================
- --- mythtv/libs/libmythtv/tvosdmenuentry.cpp (revision 25121)
- +++ mythtv/libs/libmythtv/tvosdmenuentry.cpp (working copy)
- @@ -236,6 +236,12 @@
- "AUDIOSYNC", 1, 1, 1, 1, "Audio Sync"));
- curMenuEntries.append(new TVOSDMenuEntry(
- "TOGGLEUPMIX", 1, 1, 1, 1, "Toggle Upmixer"));
- + if (gContext->GetNumSetting("AdvancedAudioSettings", false) &&
- + gContext->GetNumSetting("VuvuzelaFilter", false))
- + {
- + curMenuEntries.append(new TVOSDMenuEntry(
- + "TOGGLEVUVUZELA", 1, 1, 1, 1, "Toggle Vuvuzela Filter"));
- + }
- curMenuEntries.append(new TVOSDMenuEntry(
- "TIMESTRETCH", 1, 1, 1, 1, "Time Stretch"));
- curMenuEntries.append(new TVOSDMenuEntry(
- Index: mythtv/libs/libmyth/audiooutputbase.h
- ===================================================================
- --- mythtv/libs/libmyth/audiooutputbase.h (revision 25121)
- +++ mythtv/libs/libmyth/audiooutputbase.h (working copy)
- @@ -16,6 +16,7 @@
- // MythTV headers
- #include "audiooutput.h"
- +#include "audiooutpututil.h"
- #include "samplerate.h"
- #include "mythverbose.h"
- @@ -44,6 +45,8 @@
- virtual void SetStretchFactor(float factor);
- virtual float GetStretchFactor(void) const;
- virtual bool ToggleUpmix(void);
- + virtual bool ToggleVuvuzela(void);
- + virtual bool IsVuvuzela(void) { return vuvuzela; }
- virtual void Reset(void);
- @@ -230,6 +233,10 @@
- /** main audio buffer */
- unsigned char audiobuffer[kAudioRingBufferSize];
- uint memory_corruption_test4;
- +
- + //Vuvuzela filter
- + bool vuvuzela, last_vuvuzela;
- + AudioOutputUtil::Notch *notch_instance;
- };
- #endif
- Index: mythtv/libs/libmyth/audiooutputbase.cpp
- ===================================================================
- --- mythtv/libs/libmyth/audiooutputbase.cpp (revision 25121)
- +++ mythtv/libs/libmyth/audiooutputbase.cpp (working copy)
- @@ -13,6 +13,7 @@
- #include "compat.h"
- #include "audiooutputbase.h"
- #include "audiooutputdigitalencoder.h"
- +#include "audiooutpututil.h"
- #include "SoundTouch.h"
- #include "freesurround.h"
- @@ -73,7 +74,9 @@
- memory_corruption_test1(0xdeadbeef),
- memory_corruption_test2(0xdeadbeef),
- memory_corruption_test3(0xdeadbeef),
- - memory_corruption_test4(0xdeadbeef)
- + memory_corruption_test4(0xdeadbeef),
- + vuvuzela(true), last_vuvuzela(false),
- + notch_instance(NULL)
- {
- // The following are not bzero() because MS Windows doesn't like it.
- memset(&src_data, 0, sizeof(SRC_DATA));
- @@ -197,7 +200,17 @@
- return (configured_audio_channels == 6);
- }
- +bool AudioOutputBase::ToggleVuvuzela(void)
- +{
- + vuvuzela = !vuvuzela;
- + const AudioSettings settings(audio_bits, source_audio_channels,
- + audio_codec, source_audio_samplerate,
- + audio_passthru);
- + Reconfigure(settings);
- + return vuvuzela;
- +}
- +
- void AudioOutputBase::Reconfigure(const AudioSettings &orig_settings)
- {
- AudioSettings settings = orig_settings;
- @@ -229,6 +242,7 @@
- settings.samplerate == audio_samplerate && !need_resampler &&
- settings.use_passthru == audio_passthru &&
- lneeds_upmix == needs_upmix &&
- + last_vuvuzela == vuvuzela &&
- laudio_reenc == audio_reenc);
- bool upmix_deps =
- (lsource_audio_channels == source_audio_channels);
- @@ -247,6 +261,8 @@
- return;
- }
- + last_vuvuzela = vuvuzela;
- +
- KillAudio();
- QMutexLocker lock1(&audio_buflock);
- @@ -264,6 +280,7 @@
- audio_codec = settings.codec;
- audio_passthru = settings.use_passthru;
- needs_upmix = lneeds_upmix;
- + vuvuzela = last_vuvuzela;
- if (audio_bits != 8 && audio_bits != 16)
- {
- @@ -341,6 +358,13 @@
- need_resampler = true;
- }
- + if (vuvuzela)
- + {
- + VERBOSE(VB_AUDIO, LOC + "Vuvuzela filter enabled. Go Socceroos Go!");
- + if (!notch_instance)
- + notch_instance = new AudioOutputUtil::Notch;
- + }
- +
- if (audio_enc)
- {
- VERBOSE(VB_AUDIO, LOC + "Creating AC-3 Encoder");
- @@ -497,6 +521,13 @@
- needs_upmix = false;
- audio_enc = false;
- + if (notch_instance)
- + {
- + delete notch_instance;
- + notch_instance = NULL;
- + }
- + vuvuzela = false;
- +
- CloseDevice();
- killAudioLock.unlock();
- @@ -790,7 +821,6 @@
- VERBOSE(VB_IMPORTANT, LOC_ERR +
- QString("Error occurred while resampling audio: %1")
- .arg(src_strerror(error)));
- -
- src_float_to_short_array(src_data.data_out, (short int*)tmp_buff,
- src_data.output_frames_gen*audio_channels);
- @@ -844,7 +874,7 @@
- QMutexLocker lock1(&audio_buflock);
- // resample input if necessary
- - if (need_resampler && src_ctx)
- + if ((need_resampler && src_ctx) || (vuvuzela && notch_instance))
- {
- // Convert to floats
- short *buf_ptr = (short*)buffer;
- @@ -853,17 +883,47 @@
- src_in[sample] = (float)buf_ptr[sample] / (1.0 * 0x8000);
- }
- - src_data.input_frames = samples;
- - src_data.end_of_input = 0;
- - int error = src_process(src_ctx, &src_data);
- - if (error)
- - VERBOSE(VB_IMPORTANT, LOC_ERR +
- - QString("Error occurred while resampling audio: %1")
- - .arg(src_strerror(error)));
- - src_float_to_short_array(src_data.data_out, (short int*)tmp_buff,
- - src_data.output_frames_gen*audio_channels);
- + if (vuvuzela)
- + {
- + notch_instance->parameters.N = samples * audio_channels;
- + // Notch attenuation
- + notch_instance->parameters.attenuation_dB = 35.0f;
- +
- + // Notch frequency
- + notch_instance->parameters.frequency = 233.0f;
- + AudioOutputUtil::notch_update (*notch_instance, (float)source_audio_samplerate);
- + AudioOutputUtil::notch_execute (*notch_instance, src_in, src_out);
- + notch_instance->parameters.frequency = 466.0f; // 1st harmonic
- + AudioOutputUtil::notch_update (*notch_instance, (float)source_audio_samplerate);
- + AudioOutputUtil::notch_execute (*notch_instance, src_out, src_in);
- + notch_instance->parameters.frequency = 932.0f; // 2nd harmonic
- + AudioOutputUtil::notch_update (*notch_instance, (float)source_audio_samplerate);
- + AudioOutputUtil::notch_execute (*notch_instance, src_in, src_out);
- + notch_instance->parameters.frequency = 1864.0f; // 3rd harmonic
- + AudioOutputUtil::notch_update (*notch_instance, (float)source_audio_samplerate);
- + AudioOutputUtil::notch_execute (*notch_instance, src_out, src_in);
- + }
- - _AddSamples(tmp_buff, true, src_data.output_frames_gen, timecode);
- + if (need_resampler)
- + {
- + src_data.input_frames = samples;
- + src_data.end_of_input = 0;
- + int error = src_process(src_ctx, &src_data);
- + if (error)
- + VERBOSE(VB_IMPORTANT, LOC_ERR +
- + QString("Error occurred while resampling audio: %1")
- + .arg(src_strerror(error)));
- + src_float_to_short_array(src_data.data_out, (short int*)tmp_buff,
- + src_data.output_frames_gen*audio_channels);
- +
- + _AddSamples(tmp_buff, true, src_data.output_frames_gen, timecode);
- + }
- + else
- + {
- + src_float_to_short_array(src_in, (short int*)tmp_buff,
- + samples * audio_channels);
- + _AddSamples(tmp_buff, true, samples, timecode);
- + }
- }
- else
- {
- Index: mythtv/libs/libmyth/libmyth.pro
- ===================================================================
- --- mythtv/libs/libmyth/libmyth.pro (revision 25121)
- +++ mythtv/libs/libmyth/libmyth.pro (working copy)
- @@ -30,7 +30,7 @@
- HEADERS += audiopulseutil.h
- HEADERS += programinfo.h programlist.h programinfoupdater.h
- HEADERS += recordingtypes.h remoteutil.h
- -HEADERS += rawsettingseditor.h
- +HEADERS += rawsettingseditor.h audiooutpututil.h
- # remove when everything is switched to mythui
- HEADERS += virtualkeyboard_qt.h
- @@ -54,7 +54,7 @@
- SOURCES += audiopulseutil.cpp
- SOURCES += programinfo.cpp programlist.cpp programinfoupdater.cpp
- SOURCES += recordingtypes.cpp remoteutil.cpp
- -SOURCES += rawsettingseditor.cpp
- +SOURCES += rawsettingseditor.cpp audiooutpututil.cpp
- # remove when everything is switched to mythui
- SOURCES += virtualkeyboard_qt.cpp
- Index: mythtv/libs/libmyth/audiooutput.h
- ===================================================================
- --- mythtv/libs/libmyth/audiooutput.h (revision 25121)
- +++ mythtv/libs/libmyth/audiooutput.h (working copy)
- @@ -71,6 +71,8 @@
- virtual void bufferOutputData(bool y) = 0;
- virtual int readOutputData(unsigned char *read_buffer, int max_length) = 0;
- virtual bool ToggleUpmix(void) = 0;
- + virtual bool ToggleVuvuzela(void) = 0;
- + virtual bool IsVuvuzela(void) = 0;
- protected:
- void Error(const QString &msg);
- Index: mythtv/programs/mythfrontend/globalsettings.cpp
- ===================================================================
- --- mythtv/programs/mythfrontend/globalsettings.cpp (revision 25121)
- +++ mythtv/programs/mythfrontend/globalsettings.cpp (working copy)
- @@ -181,6 +181,17 @@
- return gc;
- }
- +static HostCheckBox *VuvuzelaFilter()
- +{
- + HostCheckBox *gc = new HostCheckBox("VuvuzelaFilter");
- + gc->setLabel(QObject::tr("Enable vuvuzela filter"));
- + gc->setValue(false);
- + gc->setHelpText(QObject::tr("With this option enabled, a dedicated vuvuzela "
- + "filter option will be accessible in the playback "
- + "menu"));
- + return gc;
- +}
- +
- static HostCheckBox *MythControlsVolume()
- {
- HostCheckBox *gc = new HostCheckBox("MythControlsVolume");
- @@ -3485,6 +3496,7 @@
- settings2->addChild(srcqualityoverride);
- settings2->addChild(sub3);
- + group2->addChild(VuvuzelaFilter());
- group2->addChild(settings2);
- group2->addChild(AggressiveBuffer());
- Index: mythtv/programs/mythtranscode/transcode.cpp
- ===================================================================
- --- mythtv/programs/mythtranscode/transcode.cpp (revision 25121)
- +++ mythtv/programs/mythtranscode/transcode.cpp (working copy)
- @@ -217,7 +217,16 @@
- // Do nothing
- return false;
- }
- -
- + virtual bool ToggleVuvuzela(void)
- + {
- + // Do nothing
- + return false;
- + }
- + virtual bool IsVuvuzela(void)
- + {
- + // Do nothing
- + return false;
- + }
- virtual void SetSWVolume(int new_volume, bool save)
- {
- // Do nothing
