Ticket #7772: mythtv-audiosync-0.22.patch

File mythtv-audiosync-0.22.patch, 4.2 KB (added by joepadmiraal, 16 years ago)

Made the patch 0.22 (r23324) compatible

  • libs/libmythtv/NuppelVideoPlayer.cpp

     
    300300    text_size = 8 * (sizeof(teletextsubtitle) + VT_WIDTH);
    301301    for (int i = 0; i < MAXTBUFFER; i++)
    302302        txtbuffers[i].buffer = new unsigned char[text_size + 1];
     303
     304    // Read the global audio sync (lipsync) settings
     305    db_audio_sync = gContext->GetNumSettingOnHost(
     306            "AudioSync", gContext->GetHostName(), 0);
     307
     308    VERBOSE(VB_IMPORTANT, LOC_ERR + QString("Saved audio timecode offset of %1").arg(db_audio_sync));
     309    SaveAudioTimecodeOffset(db_audio_sync);
    303310}
    304311
    305312NuppelVideoPlayer::~NuppelVideoPlayer(void)
     
    49024909    if (savedAudioTimecodeOffset)
    49034910    {
    49044911        tc_wrap[TC_AUDIO] = savedAudioTimecodeOffset;
    4905         savedAudioTimecodeOffset = 0;
     4912        //savedAudioTimecodeOffset = 0;
    49064913    }
    49074914
    49084915    SetPrebuffering(true);
  • libs/libmythtv/NuppelVideoPlayer.h

     
    807807    bool       decode_extra_audio;
    808808    float      m_stored_audio_stretchfactor;
    809809    bool       audio_paused;
     810    long long  db_audio_sync;
    810811
    811812    // Audio warping stuff
    812813    bool       usevideotimebase;
  • libs/libmythtv/tv_play.cpp

     
    81108110// dir in 10ms jumps
    81118111void TV::ChangeAudioSync(PlayerContext *ctx, int dir, bool allowEdit)
    81128112{
    8113     long long newval;
     8113    long long newval = 0;
    81148114
    81158115    ctx->LockDeleteNVP(__FILE__, __LINE__);
    81168116    if (!ctx->nvp)
     
    81198119        return;
    81208120    }
    81218121
     8122    VERBOSE(VB_PLAYBACK, LOC + QString("ChangeAudioSync (%1, %2)")
     8123            .arg(audiosyncBaseline)
     8124            .arg(audiosyncAdjustment));
     8125
    81228126    if (!audiosyncAdjustment && LONG_LONG_MIN == audiosyncBaseline)
    81238127        audiosyncBaseline = ctx->nvp->GetAudioTimecodeOffset();
    81248128
     8129    VERBOSE(VB_PLAYBACK, LOC + QString("ChangeAudioSync (%1, %2, %3)")
     8130            .arg(audiosyncBaseline)
     8131            .arg(audiosyncAdjustment)
     8132            .arg(dir));
     8133
    81258134    audiosyncAdjustment = allowEdit;
    81268135
    81278136    if (dir == 1000000)
     
    81368145                 audiosyncBaseline;
    81378146        audiosyncBaseline = ctx->nvp->GetAudioTimecodeOffset();
    81388147    }
    8139     else
     8148    else if (dir != 0)
    81408149    {
    81418150        newval = ctx->nvp->AdjustAudioTimecodeOffset(dir*10) -
    81428151                 audiosyncBaseline;
    81438152    }
     8153
     8154    VERBOSE(VB_PLAYBACK, LOC + QString("ChangeAudioSync - newval: %1")
     8155            .arg(newval));
     8156
    81448157    ctx->UnlockDeleteNVP(__FILE__, __LINE__);
    81458158
    81468159    OSD *osd = GetOSDLock(ctx);
    81478160    if (osd && !browsemode)
    81488161    {
    8149         QString text = QString(" %1 ms").arg(newval);
     8162        QString text = QString(" %1 ms (+ %2 ms)").arg(newval).arg(audiosyncBaseline);
    81508163        int val = (int)newval;
    81518164        if (dir == 1000000 || dir == -1000000)
    81528165        {
  • programs/mythfrontend/globalsettings.cpp

     
    27012701
    27022702static HostCheckBox *UseFixedWindowSize()
    27032703{
    2704 {
    27052704    HostCheckBox *gc = new HostCheckBox("UseFixedWindowSize");
    27062705    gc->setLabel(QObject::tr("Use fixed window size"));
    27072706    gc->setValue(true);
     
    27102709                        "window can be resized"));
    27112710    return gc;
    27122711}
     2712
     2713static HostSpinBox *AudioSync()
     2714{
     2715    HostSpinBox *gs = new HostSpinBox("AudioSync", -1600, 1600, 8, true);
     2716    gs->setLabel(QObject::tr("Audio sync offset"));
     2717    gs->setValue(0);
     2718    gs->setHelpText(QObject::tr("The global offset for audio synchronization (Lipsync)"));
     2719    return gs;
    27132720}
    27142721
    27152722
     
    34203427        setUseLabel(false);
    34213428
    34223429        addChild(AudioOutputDevice());
     3430        addChild(AudioSync());
    34233431        addChild(PassThroughOutputDevice());
    34243432
    34253433        addChild(MaxAudioChannels());