Ticket #5477: toggleupmixer_v2_trunk@18320.diff

File toggleupmixer_v2_trunk@18320.diff, 8.0 KB (added by Markus Schulz <msc@…>, 16 years ago)

my latest trunk (18320) version

  • mythtv/libs/libmythtv/NuppelVideoPlayer.cpp

     
    37533753    audio_codec = ac;
    37543754}
    37553755
     3756bool NuppelVideoPlayer::ToggleUpmixer()
     3757{
     3758    if (audioOutput)
     3759    {
     3760        const AudioSettings settings(
     3761                audio_bits, audio_channels, audio_samplerate,
     3762                audio_passthru, audio_codec);
     3763        return audioOutput->ToggleUpmixer(settings);
     3764    }
     3765    return false;
     3766}
     3767
    37563768void NuppelVideoPlayer::SetEffDsp(int dsprate)
    37573769{
    37583770    if (audioOutput)
  • mythtv/libs/libmythtv/tv_play.h

     
    239239    // Used by EPG
    240240    void ChangeVolume(bool up);
    241241    void ToggleMute(void);
     242    void ToggleUpmixer(void);
    242243
    243244    // Used for UDPNotify
    244245    bool HasUDPNotifyEvent(void) const;
  • mythtv/libs/libmythtv/tv_play.cpp

     
    380380    REG_KEY("TV Playback", "VOLUMEDOWN", "Volume down", "[,{,F10,Volume Down");
    381381    REG_KEY("TV Playback", "VOLUMEUP",   "Volume up",   "],},F11,Volume Up");
    382382    REG_KEY("TV Playback", "MUTE",       "Mute",        "|,\\,F9,Volume Mute");
     383    REG_KEY("TV Playback", "TOGGLEUPMIXER",       "Toggle Upmixer",        "F12,Toggle Upmixer");
    383384    REG_KEY("TV Playback", "TOGGLEPIPMODE", "Toggle Picture-in-Picture mode",
    384385            "V");
    385386    REG_KEY("TV Playback", "TOGGLEPIPWINDOW", "Toggle active PiP window", "B");
     
    27682769            else if (action == "VOLUMEDOWN" || action == "VOLUMEUP" ||
    27692770                     action == "STRETCHINC" || action == "STRETCHDEC" ||
    27702771                     action == "MUTE"       || action == "TOGGLEASPECT" ||
    2771                      action == "TOGGLEFILL" )
     2772                     action == "TOGGLEFILL" || action == "TOGGLEUPMIXER")
    27722773            {
    27732774                passThru = 1;
    27742775                handled = false;
     
    28232824            else if (action == "VOLUMEDOWN" || action == "VOLUMEUP" ||
    28242825                     action == "STRETCHINC" || action == "STRETCHDEC" ||
    28252826                     action == "MUTE" || action == "PAUSE" ||
    2826                      action == "CLEAROSD")
     2827                     action == "CLEAROSD" || action == "TOGGLEUPMIXER")
    28272828            {
    28282829                passThru = 1;
    28292830                handled = false;
     
    33903391            ChangeVolume(true);
    33913392        else if (action == "MUTE")
    33923393            ToggleMute();
     3394        else if (action == "TOGGLEUPMIXER")
     3395            ToggleUpmixer();
    33933396        else if (action == "STRETCHINC")
    33943397            ChangeTimeStretch(1);
    33953398        else if (action == "STRETCHDEC")
     
    61776180        GetOSD()->SetSettingsText(text, 5);
    61786181}
    61796182
     6183void TV::ToggleUpmixer(void)
     6184{
     6185    bool state=nvp->ToggleUpmixer();
     6186
     6187    QString text;
     6188
     6189    if(state)
     6190        text = tr("Upmixer enabled");
     6191    else
     6192        text = tr("Upmixer disabled");
     6193
     6194    if (GetOSD() && !browsemode)
     6195        GetOSD()->SetSettingsText(text, 5);
     6196}
     6197
    61806198void TV::ToggleSleepTimer(void)
    61816199{
    61826200    QString text;
     
    73947412
    73957413    if (HandleTrackAction(action))
    73967414        ;
     7415    else if (action == "TOGGLEUPMIXER")
     7416        ToggleUpmixer();
    73977417    else if (action == "TOGGLEMANUALZOOM")
    73987418        SetManualZoom(true);
    73997419    else if (action == "TOGGLESTRETCH")
     
    76347654                QString("TOGGLEPICCONTROLS%1").arg(i));
    76357655        }
    76367656    }
     7657    new OSDGenericTree(treeMenu, tr("Toggle Upmixer"), "TOGGLEUPMIXER");
    76377658
    76387659    new OSDGenericTree(treeMenu, tr("Manual Zoom Mode"), "TOGGLEMANUALZOOM");
    76397660
  • mythtv/libs/libmythtv/NuppelVideoPlayer.h

     
    127127    void SetAudioParams(int bits, int channels, int samplerate, bool passthru);
    128128    void SetEffDsp(int dsprate);
    129129    void SetAudioCodec(void *ac);
     130    bool ToggleUpmixer();
    130131
    131132    // Sets
    132133    void SetParentWidget(QWidget *widget)     { parentWidget = widget; }
  • mythtv/libs/libmyth/audiooutputbase.h

     
    7777    /// Audio Buffer Size -- should be divisible by 12,10,8,6,4,2..
    7878    static const uint kAudioRingBufferSize   = 1536000;
    7979
     80    virtual bool ToggleUpmixer(const AudioSettings&);
    8081 protected:
    8182    // You need to implement the following functions
    8283    virtual bool OpenDevice(void) = 0;
     
    157158    int source_audio_channels;
    158159    int source_audio_bytes_per_sample;
    159160    bool needs_upmix;
     161    bool upmixer_enabled;
    160162    int surround_mode;
    161163
    162164    bool blocking; // do AddSamples calls block?
  • mythtv/libs/libmyth/audiooutputbase.cpp

     
    5050    source_audio_channels(-1),
    5151    source_audio_bytes_per_sample(0),
    5252    needs_upmix(false),
     53    upmixer_enabled(false),
    5354    surround_mode(FreeSurround::SurroundModePassive),
    5455
    5556    blocking(false),
     
    194195    int lsource_audio_channels = settings.channels;
    195196    bool lneeds_upmix = false;
    196197
     198    if (!upmixer_enabled)
     199        configured_audio_channels = settings.channels;
     200    else
     201        configured_audio_channels = gContext->GetNumSetting("MaxChannels", 2);
     202
    197203    if (settings.codec)
    198204    {
    199205        lcodec_id = ((AVCodecContext*)settings.codec)->codec_id;
     
    818824    return len;
    819825}
    820826
     827bool AudioOutputBase::ToggleUpmixer(const AudioSettings& settings)
     828{
     829    upmixer_enabled = !upmixer_enabled;
     830    this->Reconfigure(settings);
     831    return upmixer_enabled;
     832}
     833
    821834void AudioOutputBase::_AddSamples(void *buffer, bool interleaved, int samples,
    822835                                  long long timecode)
    823836{
     
    834847
    835848    VERBOSE(VB_AUDIO+VB_TIMESTAMP,
    836849            LOC + QString("_AddSamples samples=%1 bytes=%2, used=%3, "
    837                           "free=%4, timecode=%5 needsupmix %6")
     850                          "free=%4, timecode=%5 needsupmix %6 upmixer enabled %7")
    838851            .arg(samples)
    839852            .arg(samples * abps)
    840853            .arg(kAudioRingBufferSize-afree).arg(afree).arg(timecode)
    841             .arg(needs_upmix));
     854            .arg(needs_upmix).arg(upmixer_enabled));
    842855
    843856    if (upmixer && needs_upmix)
    844857    {
  • mythtv/libs/libmyth/audiooutput.h

     
    6969    virtual void bufferOutputData(bool y) = 0;
    7070    virtual int readOutputData(unsigned char *read_buffer, int max_length) = 0;
    7171
     72    virtual bool ToggleUpmixer(const AudioSettings&) = 0;
     73
    7274  protected:
    7375    void Error(const QString &msg);
    7476    void Warn(const QString &msg);
  • mythtv/programs/mythtranscode/transcode.cpp

     
    166166        // Do nothing
    167167        return;
    168168    }
     169    virtual bool ToggleUpmixer(const AudioSettings&)
     170    {
     171        return false;
     172    };
    169173
    170174    virtual int GetAudiotime(void)
    171175    {