Ticket #3476: mergecomm.diff

File mergecomm.diff, 2.9 KB (added by Neil Garratt <ngarratt@…>, 14 years ago)
  • libs/libmythtv/NuppelVideoPlayer.cpp

     
    57155715    }
    57165716}
    57175717
     5718void NuppelVideoPlayer::MergeShortCommercials(void)
     5719{
     5720    double maxMerge = gContext->GetNumSetting("MergeShortCommBreaks", 0) *
     5721                       video_frame_rate;
     5722    if (maxMerge > 0)
     5723    {
     5724        long long lastFrame = commBreakIter.key();
     5725        ++commBreakIter;
     5726        while ((commBreakIter != commBreakMap.end()) &&
     5727               (commBreakIter.key() - lastFrame < maxMerge)) {
     5728            ++commBreakIter;
     5729        }
     5730        --commBreakIter;
     5731    }
     5732}
     5733
    57185734void NuppelVideoPlayer::AutoCommercialSkip(void)
    57195735{
    57205736    if (((time(NULL) - lastSkipTime) <= 2) ||
     
    57465762                    .arg(framesPlayed).arg(commBreakIter.key()));
    57475763
    57485764            ++commBreakIter;
     5765
     5766            MergeShortCommercials();
     5767           
    57495768            if (commBreakIter == commBreakMap.end())
    57505769            {
    57515770                VERBOSE(VB_COMMFLAG, LOC + "AutoCommercialSkip(), at "
     
    59525971        }
    59535972    }
    59545973
     5974    if (direction > 0)
     5975        MergeShortCommercials();
     5976
    59555977    if (osd)
    59565978    {
    59575979        int skipped_seconds = (int)((commBreakIter.key() -
  • libs/libmythtv/NuppelVideoPlayer.h

     
    453453    void SkipCommercialsByBlanks(void);
    454454    bool DoSkipCommercials(int direction);
    455455    void AutoCommercialSkip(void);
     456    void MergeShortCommercials(void);
    456457
    457458    // Private edit stuff
    458459    void SaveCutList(void);
  • programs/mythfrontend/globalsettings.cpp

     
    518518    return bs;
    519519}
    520520
     521static GlobalSpinBox *MergeShortCommBreaks()
     522{
     523    GlobalSpinBox *bs = new GlobalSpinBox("MergeShortCommBreaks", 0, 3600, 5);
     524    bs->setLabel(QObject::tr("Merge short commercial breaks (in seconds)"));
     525    bs->setHelpText(QObject::tr("Treat consecutive commercial breaks shorter "
     526                    "than this as one break when skipping forward. Useful if "
     527                    "you have to skip a few times during breaks. Applies to "
     528                    "automatic skipping as well. Set to 0 to disable."));
     529    bs->setValue(0);
     530    return bs;
     531}
    521532
    522533static GlobalSpinBox *AutoExpireExtraSpace()
    523534{
     
    35753586    comms->addChild(CommRewindAmount());
    35763587    comms->addChild(CommNotifyAmount());
    35773588    comms->addChild(MaximumCommercialSkip());
     3589    comms->addChild(MergeShortCommBreaks());
    35783590    comms->addChild(CommSkipAllBlanks());
    35793591    addChild(comms);