Ticket #880: maxskip.patch

File maxskip.patch, 3.2 KB (added by mythtv@…, 14 years ago)

proposed patch

  • libs/libmythtv/NuppelVideoPlayer.h

     
    517517    QMap<long long, int>::Iterator deleteIter;
    518518    QMap<long long, int>::Iterator blankIter;
    519519    QMap<long long, int>::Iterator commBreakIter;
     520    QDateTime   lastIgnoredManualSkip;
    520521
    521522    // Playback (output) speed control
    522523    /// Lock for next_play_speed and next_normal_speed
  • libs/libmythtv/NuppelVideoPlayer.cpp

     
    174174    commnotifyamount = gContext->GetNumSetting("CommNotifyAmount",0);
    175175    m_DeintSetting   = gContext->GetNumSetting("Deinterlace", 0);
    176176
     177    lastIgnoredManualSkip = QDateTime::currentDateTime().addSecs(-10);
     178
    177179    bzero(&txtbuffers, sizeof(txtbuffers));
    178180    bzero(&tc_lastval, sizeof(tc_lastval));
    179181    bzero(&tc_wrap,    sizeof(tc_wrap));
     
    45304532    {
    45314533        int skipped_seconds = (int)((commBreakIter.key() -
    45324534                framesPlayed) / video_frame_rate);
     4535        int maxskip = gContext->GetNumSetting("MaximumCommercialSkip", 3600);
    45334536        QString skipTime;
    45344537        skipTime.sprintf("%d:%02d", skipped_seconds / 60,
    45354538                         abs(skipped_seconds) % 60);
    45364539        struct StatusPosInfo posInfo;
    45374540        calcSliderPos(posInfo);
     4541        if (lastIgnoredManualSkip.secsTo(QDateTime::currentDateTime()) > 3 &&
     4542                (skipped_seconds >= maxskip || -skipped_seconds >= maxskip))
     4543        {
     4544            osd->ShowStatus(posInfo, false,
     4545                            QObject::tr("Too Far %1").arg(skipTime), 2);
     4546            commBreakMapLock.unlock();
     4547            lastIgnoredManualSkip = QDateTime::currentDateTime();
     4548            return false;
     4549        }
    45384550        osd->ShowStatus(posInfo, false,
    45394551                        QObject::tr("Skip %1").arg(skipTime), 2);
    45404552    }
  • programs/mythfrontend/globalsettings.cpp

     
    499499    return gs;
    500500}
    501501
     502static GlobalSpinBox *MaximumCommercialSkip()
     503{
     504    GlobalSpinBox *bs = new GlobalSpinBox("MaximumCommercialSkip", 0, 3600, 10);
     505    bs->setLabel(QObject::tr("Maximum commercial skip"));
     506    bs->setHelpText(QObject::tr("MythTV will discourage manual commercial "
     507                    "skips longer, in seconds, than this.  Skips longer than "
     508                    "this require two skip requests.  Automatic commercial "
     509                    "skipping is not affected by this limit."));
     510    bs->setValue(3600);
     511    return bs;
     512}
     513
     514
    502515static GlobalSpinBox *AutoExpireExtraSpace()
    503516{
    504517    GlobalSpinBox *bs = new GlobalSpinBox("AutoExpireExtraSpace", 0, 200, 1);
     
    30433056    comms->addChild(AutoCommercialSkip());
    30443057    comms->addChild(CommRewindAmount());
    30453058    comms->addChild(CommNotifyAmount());
     3059    comms->addChild(MaximumCommercialSkip());
    30463060    comms->addChild(CommSkipAllBlanks());
    30473061    addChild(comms);
    30483062