Guest
Public paste!

Untitled

By: a guest | Jun 16th, 2010 | Syntax: None | Size: 15.88 KB | Hits: 46 | Expires: Never
Copy text to clipboard
  1. Index: mythtv/libs/libmythtv/NuppelVideoPlayer.cpp
  2. ===================================================================
  3. --- mythtv/libs/libmythtv/NuppelVideoPlayer.cpp (revision 25121)
  4. +++ mythtv/libs/libmythtv/NuppelVideoPlayer.cpp (working copy)
  5. @@ -5134,6 +5134,21 @@
  6.      return false;
  7.  }
  8.  
  9. +bool NuppelVideoPlayer::ToggleVuvuzela()
  10. +{
  11. +    bool ret = false;
  12. +    if (audioOutput)
  13. +        ret = audioOutput->ToggleVuvuzela();
  14. +    if (decoder)
  15. +        decoder->SetDisablePassThrough(ret);
  16. +    return ret;
  17. +}
  18. +
  19. +bool NuppelVideoPlayer::IsVuvuzela()
  20. +{
  21. +    return audioOutput ? audioOutput->IsVuvuzela() : false;
  22. +}
  23. +
  24.  void NuppelVideoPlayer::Zoom(ZoomDirection direction)
  25.  {
  26.      if (videoOutput)
  27. Index: mythtv/libs/libmythtv/avformatdecoder.cpp
  28. ===================================================================
  29. --- mythtv/libs/libmythtv/avformatdecoder.cpp   (revision 25121)
  30. +++ mythtv/libs/libmythtv/avformatdecoder.cpp   (working copy)
  31. @@ -4639,6 +4639,7 @@
  32.      else if (ctx->codec_id == CODEC_ID_DTS)
  33.          passthru = allow_dts_passthru && !internal_vol;
  34.  
  35. +    passthru &= !GetNVP()->IsVuvuzela();
  36.      passthru &= !transcoding && !disable_passthru;
  37.      // Don't know any cards that support spdif clocked at < 44100
  38.      // Some US cable transmissions have 2ch 32k AC-3 streams
  39. Index: mythtv/libs/libmythtv/tv_play.h
  40. ===================================================================
  41. --- mythtv/libs/libmythtv/tv_play.h     (revision 25121)
  42. +++ mythtv/libs/libmythtv/tv_play.h     (working copy)
  43. @@ -436,6 +436,7 @@
  44.                                   const QStringList &actions);
  45.  
  46.      void ToggleUpmix(PlayerContext*);
  47. +    void ToggleVuvuzela(PlayerContext*);
  48.      void ChangeAudioSync(PlayerContext*, int dir, bool allowEdit = true);
  49.      bool AudioSyncHandleAction(PlayerContext*, const QStringList &actions);
  50.  
  51. Index: mythtv/libs/libmythtv/dbcheck.cpp
  52. ===================================================================
  53. --- mythtv/libs/libmythtv/dbcheck.cpp   (revision 25121)
  54. +++ mythtv/libs/libmythtv/dbcheck.cpp   (working copy)
  55. @@ -20,7 +20,7 @@
  56.     mythtv/bindings/python/MythTV/MythStatic.py
  57.  */
  58.  /// This is the DB schema version expected by the running MythTV instance.
  59. -const QString currentDatabaseVersion = "1254";
  60. +const QString currentDatabaseVersion = "1259";
  61.  
  62.  static bool UpdateDBVersionNumber(const QString &newnumber);
  63.  static bool performActualUpdate(
  64. Index: mythtv/libs/libmythtv/NuppelVideoPlayer.h
  65. ===================================================================
  66. --- mythtv/libs/libmythtv/NuppelVideoPlayer.h   (revision 25121)
  67. +++ mythtv/libs/libmythtv/NuppelVideoPlayer.h   (working copy)
  68. @@ -165,6 +165,8 @@
  69.      void ToggleAspectOverride(AspectOverrideMode aspectMode = kAspect_Toggle);
  70.      void ToggleAdjustFill(AdjustFillMode adjustfillMode = kAdjustFill_Toggle);
  71.      bool ToggleUpmix(void);
  72. +    bool ToggleVuvuzela(void);
  73. +    bool IsVuvuzela(void);
  74.  
  75.      // Gets
  76.      QSize   GetVideoBufferSize(void) const    { return video_dim; }
  77. Index: mythtv/libs/libmythtv/tv_play.cpp
  78. ===================================================================
  79. --- mythtv/libs/libmythtv/tv_play.cpp   (revision 25121)
  80. +++ mythtv/libs/libmythtv/tv_play.cpp   (working copy)
  81. @@ -4516,6 +4516,8 @@
  82.          ToggleTimeStretch(ctx);
  83.      else if (has_action("TOGGLEUPMIX", actions))
  84.          ToggleUpmix(ctx);
  85. +    else if (has_action("TOGGLEVUVUZELA", actions))
  86. +        ToggleVuvuzela(ctx);
  87.      else if (has_action("TOGGLESLEEP", actions))
  88.          ToggleSleepTimer(ctx);
  89.      else if (has_action("TOGGLERECORD", actions) && islivetv)
  90. @@ -8286,6 +8288,20 @@
  91.          ctx->nvp->GetOSD()->SetSettingsText(text, 5);
  92.  }
  93.  
  94. +void TV::ToggleVuvuzela(PlayerContext *ctx)
  95. +{
  96. +    if (!ctx->nvp || !ctx->nvp->HasAudioOut())
  97. +        return;
  98. +    QString text;
  99. +    if (ctx->nvp->ToggleVuvuzela())
  100. +        text = tr("Vuvuzela Filter On");
  101. +    else
  102. +        text = tr("Vuvuzela Filter Off");
  103. +
  104. +    if (ctx->nvp->GetOSD() && !browsemode)
  105. +        ctx->nvp->GetOSD()->SetSettingsText(text, 5);
  106. +}
  107. +
  108.  // dir in 10ms jumps
  109.  void TV::ChangeAudioSync(PlayerContext *ctx, int dir, bool allowEdit)
  110.  {
  111. @@ -9949,6 +9965,8 @@
  112.          ToggleTimeStretch(actx);
  113.      else if (action == "TOGGLEUPMIX")
  114.          ToggleUpmix(actx);
  115. +    else if (action == "TOGGLEVUVUZELA")
  116. +        ToggleVuvuzela(actx);
  117.      else if (action.left(13) == "ADJUSTSTRETCH")
  118.      {
  119.          bool floatRead;
  120. @@ -10323,6 +10341,8 @@
  121.          new OSDGenericTree(treeMenu, tr("Adjust Audio Sync"), "TOGGLEAUDIOSYNC");
  122.      else if (category == "TOGGLEUPMIX")
  123.          new OSDGenericTree(treeMenu, tr("Toggle Audio Upmixer"), "TOGGLEUPMIX");
  124. +    else if (category == "TOGGLEVUVUZELA")
  125. +        new OSDGenericTree(treeMenu, tr("Toggle Vuvuzela Filter"), "TOGGLEVUVUZELA");
  126.      else if (category == "TIMESTRETCH")
  127.          FillMenuTimeStretch(ctx, treeMenu);
  128.      else if (category == "VIDEOSCAN")
  129. Index: mythtv/libs/libmythtv/tvosdmenuentry.cpp
  130. ===================================================================
  131. --- mythtv/libs/libmythtv/tvosdmenuentry.cpp    (revision 25121)
  132. +++ mythtv/libs/libmythtv/tvosdmenuentry.cpp    (working copy)
  133. @@ -236,6 +236,12 @@
  134.          "AUDIOSYNC",          1,  1,  1,  1, "Audio Sync"));
  135.      curMenuEntries.append(new TVOSDMenuEntry(
  136.          "TOGGLEUPMIX",        1,  1,  1,  1, "Toggle Upmixer"));
  137. +    if (gContext->GetNumSetting("AdvancedAudioSettings", false) &&
  138. +        gContext->GetNumSetting("VuvuzelaFilter", false))
  139. +    {
  140. +        curMenuEntries.append(new TVOSDMenuEntry(
  141. +            "TOGGLEVUVUZELA", 1,  1,  1,  1, "Toggle Vuvuzela Filter"));
  142. +    }
  143.      curMenuEntries.append(new TVOSDMenuEntry(
  144.          "TIMESTRETCH",        1,  1,  1,  1, "Time Stretch"));
  145.      curMenuEntries.append(new TVOSDMenuEntry(
  146. Index: mythtv/libs/libmyth/audiooutputbase.h
  147. ===================================================================
  148. --- mythtv/libs/libmyth/audiooutputbase.h       (revision 25121)
  149. +++ mythtv/libs/libmyth/audiooutputbase.h       (working copy)
  150. @@ -16,6 +16,7 @@
  151.  
  152.  // MythTV headers
  153.  #include "audiooutput.h"
  154. +#include "audiooutpututil.h"
  155.  #include "samplerate.h"
  156.  #include "mythverbose.h"
  157.  
  158. @@ -44,6 +45,8 @@
  159.      virtual void SetStretchFactor(float factor);
  160.      virtual float GetStretchFactor(void) const;
  161.      virtual bool ToggleUpmix(void);
  162. +    virtual bool ToggleVuvuzela(void);
  163. +    virtual bool IsVuvuzela(void) { return vuvuzela; }
  164.  
  165.      virtual void Reset(void);
  166.  
  167. @@ -230,6 +233,10 @@
  168.      /** main audio buffer */
  169.      unsigned char audiobuffer[kAudioRingBufferSize];
  170.      uint memory_corruption_test4;
  171. +
  172. +    //Vuvuzela filter
  173. +    bool vuvuzela, last_vuvuzela;
  174. +    AudioOutputUtil::Notch *notch_instance;
  175.  };
  176.  
  177.  #endif
  178. Index: mythtv/libs/libmyth/audiooutputbase.cpp
  179. ===================================================================
  180. --- mythtv/libs/libmyth/audiooutputbase.cpp     (revision 25121)
  181. +++ mythtv/libs/libmyth/audiooutputbase.cpp     (working copy)
  182. @@ -13,6 +13,7 @@
  183.  #include "compat.h"
  184.  #include "audiooutputbase.h"
  185.  #include "audiooutputdigitalencoder.h"
  186. +#include "audiooutpututil.h"
  187.  #include "SoundTouch.h"
  188.  #include "freesurround.h"
  189.  
  190. @@ -73,7 +74,9 @@
  191.      memory_corruption_test1(0xdeadbeef),
  192.      memory_corruption_test2(0xdeadbeef),
  193.      memory_corruption_test3(0xdeadbeef),
  194. -    memory_corruption_test4(0xdeadbeef)
  195. +    memory_corruption_test4(0xdeadbeef),
  196. +    vuvuzela(true),            last_vuvuzela(false),
  197. +    notch_instance(NULL)
  198.  {
  199.      // The following are not bzero() because MS Windows doesn't like it.
  200.      memset(&src_data,          0, sizeof(SRC_DATA));
  201. @@ -197,7 +200,17 @@
  202.      return (configured_audio_channels == 6);
  203.  }
  204.  
  205. +bool AudioOutputBase::ToggleVuvuzela(void)
  206. +{
  207. +    vuvuzela = !vuvuzela;
  208. +    const AudioSettings settings(audio_bits, source_audio_channels,
  209. +                                 audio_codec, source_audio_samplerate,
  210. +                                 audio_passthru);
  211. +    Reconfigure(settings);
  212.  
  213. +    return vuvuzela;
  214. +}
  215. +
  216.  void AudioOutputBase::Reconfigure(const AudioSettings &orig_settings)
  217.  {
  218.      AudioSettings settings = orig_settings;
  219. @@ -229,6 +242,7 @@
  220.          settings.samplerate == audio_samplerate && !need_resampler &&
  221.          settings.use_passthru == audio_passthru &&
  222.          lneeds_upmix == needs_upmix &&
  223. +        last_vuvuzela == vuvuzela &&
  224.          laudio_reenc == audio_reenc);
  225.      bool upmix_deps =
  226.          (lsource_audio_channels == source_audio_channels);
  227. @@ -247,6 +261,8 @@
  228.          return;
  229.      }
  230.  
  231. +    last_vuvuzela          = vuvuzela;
  232. +
  233.      KillAudio();
  234.  
  235.      QMutexLocker lock1(&audio_buflock);
  236. @@ -264,6 +280,7 @@
  237.      audio_codec = settings.codec;
  238.      audio_passthru = settings.use_passthru;
  239.      needs_upmix = lneeds_upmix;
  240. +    vuvuzela = last_vuvuzela;
  241.  
  242.      if (audio_bits != 8 && audio_bits != 16)
  243.      {
  244. @@ -341,6 +358,13 @@
  245.          need_resampler = true;
  246.      }
  247.  
  248. +    if (vuvuzela)
  249. +    {
  250. +        VERBOSE(VB_AUDIO, LOC + "Vuvuzela filter enabled. Go Socceroos Go!");
  251. +        if (!notch_instance)
  252. +            notch_instance = new AudioOutputUtil::Notch;
  253. +    }
  254. +
  255.      if (audio_enc)
  256.      {
  257.          VERBOSE(VB_AUDIO, LOC + "Creating AC-3 Encoder");
  258. @@ -497,6 +521,13 @@
  259.      needs_upmix = false;
  260.      audio_enc = false;
  261.  
  262. +    if (notch_instance)
  263. +    {
  264. +        delete notch_instance;
  265. +        notch_instance = NULL;
  266. +    }
  267. +    vuvuzela = false;
  268. +
  269.      CloseDevice();
  270.  
  271.      killAudioLock.unlock();
  272. @@ -790,7 +821,6 @@
  273.              VERBOSE(VB_IMPORTANT, LOC_ERR +
  274.                      QString("Error occurred while resampling audio: %1")
  275.                      .arg(src_strerror(error)));
  276. -
  277.          src_float_to_short_array(src_data.data_out, (short int*)tmp_buff,
  278.                                   src_data.output_frames_gen*audio_channels);
  279.  
  280. @@ -844,7 +874,7 @@
  281.      QMutexLocker lock1(&audio_buflock);
  282.  
  283.      // resample input if necessary
  284. -    if (need_resampler && src_ctx)
  285. +    if ((need_resampler && src_ctx) || (vuvuzela && notch_instance))
  286.      {
  287.          // Convert to floats
  288.          short *buf_ptr = (short*)buffer;
  289. @@ -853,17 +883,47 @@
  290.              src_in[sample] = (float)buf_ptr[sample] / (1.0 * 0x8000);
  291.          }
  292.  
  293. -        src_data.input_frames = samples;
  294. -        src_data.end_of_input = 0;
  295. -        int error = src_process(src_ctx, &src_data);
  296. -        if (error)
  297. -            VERBOSE(VB_IMPORTANT, LOC_ERR +
  298. -                    QString("Error occurred while resampling audio: %1")
  299. -                    .arg(src_strerror(error)));
  300. -        src_float_to_short_array(src_data.data_out, (short int*)tmp_buff,
  301. -                                 src_data.output_frames_gen*audio_channels);
  302. +        if (vuvuzela)
  303. +        {
  304. +            notch_instance->parameters.N = samples * audio_channels;
  305. +            // Notch attenuation
  306. +            notch_instance->parameters.attenuation_dB = 35.0f;
  307. +            
  308. +            // Notch frequency
  309. +            notch_instance->parameters.frequency = 233.0f;
  310. +            AudioOutputUtil::notch_update (*notch_instance, (float)source_audio_samplerate);
  311. +            AudioOutputUtil::notch_execute (*notch_instance, src_in, src_out);
  312. +            notch_instance->parameters.frequency = 466.0f;  // 1st harmonic
  313. +            AudioOutputUtil::notch_update (*notch_instance, (float)source_audio_samplerate);
  314. +            AudioOutputUtil::notch_execute (*notch_instance, src_out, src_in);
  315. +            notch_instance->parameters.frequency = 932.0f;  // 2nd harmonic
  316. +            AudioOutputUtil::notch_update (*notch_instance, (float)source_audio_samplerate);
  317. +            AudioOutputUtil::notch_execute (*notch_instance, src_in, src_out);
  318. +            notch_instance->parameters.frequency = 1864.0f;  // 3rd harmonic
  319. +            AudioOutputUtil::notch_update (*notch_instance, (float)source_audio_samplerate);
  320. +            AudioOutputUtil::notch_execute (*notch_instance, src_out, src_in);
  321. +        }
  322.  
  323. -        _AddSamples(tmp_buff, true, src_data.output_frames_gen, timecode);
  324. +        if (need_resampler)
  325. +        {
  326. +            src_data.input_frames = samples;
  327. +            src_data.end_of_input = 0;
  328. +            int error = src_process(src_ctx, &src_data);
  329. +            if (error)
  330. +                VERBOSE(VB_IMPORTANT, LOC_ERR +
  331. +                        QString("Error occurred while resampling audio: %1")
  332. +                        .arg(src_strerror(error)));
  333. +            src_float_to_short_array(src_data.data_out, (short int*)tmp_buff,
  334. +                                     src_data.output_frames_gen*audio_channels);
  335. +
  336. +            _AddSamples(tmp_buff, true, src_data.output_frames_gen, timecode);
  337. +        }
  338. +        else
  339. +        {
  340. +            src_float_to_short_array(src_in, (short int*)tmp_buff,
  341. +                                     samples * audio_channels);
  342. +            _AddSamples(tmp_buff, true, samples, timecode);
  343. +        }
  344.      }
  345.      else
  346.      {
  347. Index: mythtv/libs/libmyth/libmyth.pro
  348. ===================================================================
  349. --- mythtv/libs/libmyth/libmyth.pro     (revision 25121)
  350. +++ mythtv/libs/libmyth/libmyth.pro     (working copy)
  351. @@ -30,7 +30,7 @@
  352.  HEADERS += audiopulseutil.h
  353.  HEADERS += programinfo.h programlist.h programinfoupdater.h
  354.  HEADERS += recordingtypes.h remoteutil.h
  355. -HEADERS += rawsettingseditor.h
  356. +HEADERS += rawsettingseditor.h audiooutpututil.h
  357.  
  358.  # remove when everything is switched to mythui
  359.  HEADERS += virtualkeyboard_qt.h
  360. @@ -54,7 +54,7 @@
  361.  SOURCES += audiopulseutil.cpp
  362.  SOURCES += programinfo.cpp programlist.cpp programinfoupdater.cpp
  363.  SOURCES += recordingtypes.cpp remoteutil.cpp
  364. -SOURCES += rawsettingseditor.cpp
  365. +SOURCES += rawsettingseditor.cpp audiooutpututil.cpp
  366.  
  367.  # remove when everything is switched to mythui
  368.  SOURCES += virtualkeyboard_qt.cpp
  369. Index: mythtv/libs/libmyth/audiooutput.h
  370. ===================================================================
  371. --- mythtv/libs/libmyth/audiooutput.h   (revision 25121)
  372. +++ mythtv/libs/libmyth/audiooutput.h   (working copy)
  373. @@ -71,6 +71,8 @@
  374.      virtual void bufferOutputData(bool y) = 0;
  375.      virtual int readOutputData(unsigned char *read_buffer, int max_length) = 0;
  376.      virtual bool ToggleUpmix(void) = 0;
  377. +    virtual bool ToggleVuvuzela(void) = 0;
  378. +    virtual bool IsVuvuzela(void) = 0;
  379.  
  380.    protected:
  381.      void Error(const QString &msg);
  382. Index: mythtv/programs/mythfrontend/globalsettings.cpp
  383. ===================================================================
  384. --- mythtv/programs/mythfrontend/globalsettings.cpp     (revision 25121)
  385. +++ mythtv/programs/mythfrontend/globalsettings.cpp     (working copy)
  386. @@ -181,6 +181,17 @@
  387.      return gc;
  388.  }
  389.  
  390. +static HostCheckBox *VuvuzelaFilter()
  391. +{
  392. +    HostCheckBox *gc = new HostCheckBox("VuvuzelaFilter");
  393. +    gc->setLabel(QObject::tr("Enable vuvuzela filter"));
  394. +    gc->setValue(false);
  395. +    gc->setHelpText(QObject::tr("With this option enabled, a dedicated vuvuzela "
  396. +                                "filter option will be accessible in the playback "
  397. +                                "menu"));
  398. +    return gc;
  399. +}
  400. +
  401.  static HostCheckBox *MythControlsVolume()
  402.  {
  403.      HostCheckBox *gc = new HostCheckBox("MythControlsVolume");
  404. @@ -3485,6 +3496,7 @@
  405.      settings2->addChild(srcqualityoverride);
  406.      settings2->addChild(sub3);
  407.      
  408. +    group2->addChild(VuvuzelaFilter());
  409.      group2->addChild(settings2);
  410.      group2->addChild(AggressiveBuffer());
  411.  
  412. Index: mythtv/programs/mythtranscode/transcode.cpp
  413. ===================================================================
  414. --- mythtv/programs/mythtranscode/transcode.cpp (revision 25121)
  415. +++ mythtv/programs/mythtranscode/transcode.cpp (working copy)
  416. @@ -217,7 +217,16 @@
  417.          // Do nothing
  418.          return false;
  419.      }
  420. -
  421. +    virtual bool ToggleVuvuzela(void)
  422. +    {
  423. +        // Do nothing
  424. +        return false;
  425. +    }
  426. +    virtual bool IsVuvuzela(void)
  427. +    {
  428. +        // Do nothing
  429. +        return false;
  430. +    }
  431.      virtual void SetSWVolume(int new_volume, bool save)
  432.      {
  433.          // Do nothing