Ticket #8631: seek_honors_cutlist_v3.patch
| File seek_honors_cutlist_v3.patch, 25.2 KB (added by , 15 years ago) |
|---|
-
themes/default-wide/osd.xml
352 352 <area>770,10,300,30</area> 353 353 <align>right,top</align> 354 354 </textarea> 355 <textarea name=" timedisplay" from="title">355 <textarea name="fulltimedisplay" from="title"> 356 356 <area>10,50,1060,30</area> 357 357 <align>hcenter,bottom</align> 358 358 </textarea> -
libs/libmythtv/deletemap.h
45 45 bool IsTemporaryMark(uint64_t frame); 46 46 bool HasTemporaryMark(void); 47 47 uint64_t GetLastFrame(uint64_t total); 48 uint64_t TranslatePositionAbsToRel(uint64_t absPosition) { 49 return TranslatePositionAbsToRel(m_deleteMap, absPosition); 50 } 51 uint64_t TranslatePositionRelToAbs(uint64_t relPosition) { 52 return TranslatePositionRelToAbs(m_deleteMap, relPosition); 53 } 54 static uint64_t TranslatePositionAbsToRel(const frm_dir_map_t &deleteMap, 55 uint64_t absPosition); 56 static uint64_t TranslatePositionRelToAbs(const frm_dir_map_t &deleteMap, 57 uint64_t relPosition); 48 58 49 59 void TrackerReset(uint64_t frame, uint64_t total); 50 60 bool TrackerWantsToJump(uint64_t frame, uint64_t total, uint64_t &to); -
libs/libmythtv/tv_play.h
419 419 420 420 bool SeekHandleAction(PlayerContext *actx, const QStringList &actions, 421 421 const bool isDVD); 422 void DoSeek(PlayerContext*, float time, const QString &mesg); 422 void DoSeek(PlayerContext*, float time, const QString &mesg, 423 bool timeIsOffset, bool honorCutlist=true); 423 424 bool DoPlayerSeek(PlayerContext*, float time); 424 425 enum ArbSeekWhence { 425 426 ARBSEEK_SET = 0, … … 427 428 ARBSEEK_FORWARD, 428 429 ARBSEEK_END 429 430 }; 430 void DoArbSeek(PlayerContext*, ArbSeekWhence whence );431 void DoArbSeek(PlayerContext*, ArbSeekWhence whence, bool honorCutlist=true); 431 432 void NormalSpeed(PlayerContext*); 432 433 void ChangeSpeed(PlayerContext*, int direction); 433 434 void ToggleTimeStretch(PlayerContext*); -
libs/libmythtv/mythplayer.h
232 232 virtual long long CalcMaxFFTime(long long ff, bool setjump = true) const; 233 233 long long CalcRWTime(long long rw) const; 234 234 virtual void calcSliderPos(osdInfo &info, bool paddedFields = false); 235 uint64_t TranslatePositionAbsToRel(uint64_t absPosition) { 236 return deleteMap.TranslatePositionAbsToRel(absPosition); 237 } 238 uint64_t TranslatePositionRelToAbs(uint64_t relPosition) { 239 return deleteMap.TranslatePositionRelToAbs(relPosition); 240 } 235 241 236 242 /// Non-const gets 237 243 OSD *GetOSD(void) { return osd; } … … 497 503 void JumpToProgram(void); 498 504 499 505 void calcSliderPosPriv(osdInfo &info, bool paddedFields, 500 int playbackLen, float secsplayed, bool islive); 506 int playbackLen, float secsplayed, bool islive, 507 bool isRaw); 501 508 502 509 protected: 503 510 DecoderBase *decoder; -
libs/libmythtv/mythdvdplayer.cpp
343 343 // DVD playing non-functional under windows for now 344 344 secsplayed = 0.0f; 345 345 #endif 346 calcSliderPosPriv(info, paddedFields, playbackLen, secsplayed, islive); 346 calcSliderPosPriv(info, paddedFields, playbackLen, secsplayed, islive, false); 347 calcSliderPosPriv(info, paddedFields, playbackLen, secsplayed, islive, true); 347 348 } 348 349 349 350 void MythDVDPlayer::SeekForScreenGrab(uint64_t &number, uint64_t frameNum, -
libs/libmythtv/tv_play.cpp
548 548 "Pause"), "P"); 549 549 REG_KEY("TV Playback", "SEEKFFWD", QT_TRANSLATE_NOOP("MythControls", 550 550 "Fast Forward"), "Right"); 551 REG_KEY("TV Playback", "SEEKFFWDNOCUTLIST", QT_TRANSLATE_NOOP("MythControls", 552 "Fast Forward ignoring cutlist"), ""); 551 553 REG_KEY("TV Playback", "SEEKRWND", QT_TRANSLATE_NOOP("MythControls", 552 554 "Rewind"), "Left"); 555 REG_KEY("TV Playback", "SEEKRWNDNOCUTLIST", QT_TRANSLATE_NOOP("MythControls", 556 "Rewind ignoring cutlist"), ""); 553 557 REG_KEY("TV Playback", "ARBSEEK", QT_TRANSLATE_NOOP("MythControls", 554 558 "Arbitrary Seek"), "*"); 559 REG_KEY("TV Playback", "ARBSEEKNOCUTLIST", QT_TRANSLATE_NOOP("MythControls", 560 "Arbitrary Seek ignoring cutlist"), ""); 555 561 REG_KEY("TV Playback", "CHANNELUP", QT_TRANSLATE_NOOP("MythControls", 556 562 "Channel up"), "Up"); 557 563 REG_KEY("TV Playback", "CHANNELDOWN", QT_TRANSLATE_NOOP("MythControls", … … 562 568 "Switch to the previous channel"), "H"); 563 569 REG_KEY("TV Playback", "JUMPFFWD", QT_TRANSLATE_NOOP("MythControls", 564 570 "Jump ahead"), "PgDown"); 571 REG_KEY("TV Playback", "JUMPFFWDNOCUTLIST", QT_TRANSLATE_NOOP("MythControls", 572 "Jump ahead ignoring cutlist"), ""); 565 573 REG_KEY("TV Playback", "JUMPRWND", QT_TRANSLATE_NOOP("MythControls", 566 574 "Jump back"), "PgUp"); 575 REG_KEY("TV Playback", "JUMPRWNDNOCUTLIST", QT_TRANSLATE_NOOP("MythControls", 576 "Jump back ignoring cutlist"), ""); 577 REG_KEY("TV Playback", "INFONOCUTLIST", QT_TRANSLATE_NOOP("MythControls", 578 "Info ignoring cutlist"), ""); 567 579 REG_KEY("TV Playback", "JUMPBKMRK", QT_TRANSLATE_NOOP("MythControls", 568 580 "Jump to bookmark"), "K"); 569 581 REG_KEY("TV Playback", "FFWDSTICKY", QT_TRANSLATE_NOOP("MythControls", … … 3986 3998 ctx->buffer->DVD()->MoveButtonDown(); 3987 3999 } 3988 4000 else if (has_action("LEFT", actions) || 3989 has_action("SEEKRWND", actions)) 4001 has_action("SEEKRWND", actions) || 4002 has_action("SEEKRWNDNOCUTLIST", actions)) 3990 4003 { 3991 4004 ctx->buffer->DVD()->MoveButtonLeft(); 3992 4005 } 3993 4006 else if (has_action("RIGHT", actions) || 3994 has_action("SEEKFFWD", actions)) 4007 has_action("SEEKFFWD", actions) || 4008 has_action("SEEKFFWDNOCUTLIST", actions)) 3995 4009 { 3996 4010 ctx->buffer->DVD()->MoveButtonRight(); 3997 4011 } … … 4092 4106 } 4093 4107 } 4094 4108 } 4095 else if (has_action("JUMPRWND", actions)) 4109 else if (has_action("JUMPRWND", actions) || 4110 has_action("JUMPRWNDNOCUTLIST", actions)) 4096 4111 { 4097 4112 if (isDVD) 4098 4113 DVDJumpBack(ctx); 4099 4114 else if (GetNumChapters(ctx) > 0) 4100 4115 DoJumpChapter(ctx, -1); 4101 4116 else 4102 DoSeek(ctx, -ctx->jumptime * 60, tr("Jump Back")); 4117 DoSeek(ctx, -ctx->jumptime * 60, tr("Jump Back"), 4118 true, has_action("JUMPRWND", actions)); 4103 4119 } 4104 else if (has_action("JUMPFFWD", actions)) 4120 else if (has_action("JUMPFFWD", actions) || 4121 has_action("JUMPFFWDNOCUTLIST", actions)) 4105 4122 { 4106 4123 if (isDVD) 4107 4124 DVDJumpForward(ctx); 4108 4125 else if (GetNumChapters(ctx) > 0) 4109 4126 DoJumpChapter(ctx, 9999); 4110 4127 else 4111 DoSeek(ctx, ctx->jumptime * 60, tr("Jump Ahead")); 4128 DoSeek(ctx, ctx->jumptime * 60, tr("Jump Ahead"), 4129 true, has_action("JUMPFFWD", actions)); 4112 4130 } 4113 4131 else if (has_action("JUMPBKMRK", actions)) 4114 4132 { 4115 4133 ctx->LockDeletePlayer(__FILE__, __LINE__); 4116 long long bookmark = ctx->player->GetBookmark(); 4117 long long curloc = ctx->player->GetFramesPlayed(); 4134 uint64_t bookmark = ctx->player->GetBookmark(); 4118 4135 float mult = 1.0f; 4119 4136 if (ctx->last_framerate) 4120 4137 mult = 1.0f / ctx->last_framerate; 4121 long long seekloc = (long long) ((bookmark - curloc) * mult);4138 float seekloc = ctx->player->TranslatePositionAbsToRel(bookmark) * mult; 4122 4139 ctx->UnlockDeletePlayer(__FILE__, __LINE__); 4123 4140 4124 4141 if (bookmark > ctx->last_framerate) 4125 4142 { 4126 DoSeek(ctx, seekloc, tr("Jump to Bookmark") );4143 DoSeek(ctx, seekloc, tr("Jump to Bookmark"), false); 4127 4144 } 4128 4145 } 4129 4146 else if (has_action("JUMPSTART",actions)) 4130 4147 { 4131 long long seekloc = +1; 4132 ctx->LockDeletePlayer(__FILE__, __LINE__); 4133 if (ctx->player && ctx->last_framerate >= 0.0001f) 4134 { 4135 seekloc = (int64_t) (-1.0 * ctx->player->GetFramesPlayed() / 4136 ctx->last_framerate); 4137 } 4138 ctx->UnlockDeletePlayer(__FILE__, __LINE__); 4139 4140 if (seekloc <= 0) 4141 DoSeek(ctx, seekloc, tr("Jump to Beginning")); 4148 DoSeek(ctx, 0, tr("Jump to Beginning"), false); 4142 4149 } 4143 4150 else if (has_action("CLEAROSD", actions)) 4144 4151 { … … 4285 4292 ChangeTimeStretch(ctx, -1); 4286 4293 else if (has_action("MENU", actions)) 4287 4294 ShowOSDMenu(ctx); 4288 else if (has_action("INFO", actions) )4295 else if (has_action("INFO", actions) || has_action("INFONOCUTLIST", actions)) 4289 4296 { 4290 4297 if (HasQueuedInput()) 4291 4298 { 4292 DoArbSeek(ctx, ARBSEEK_SET );4299 DoArbSeek(ctx, ARBSEEK_SET, !has_action("INFONOCUTLIST", actions)); 4293 4300 } 4294 4301 else 4295 4302 ToggleOSD(ctx, true); … … 4486 4493 else if (GetNumChapters(ctx) > 0) 4487 4494 DoJumpChapter(ctx, -1); 4488 4495 else 4489 DoSeek(ctx, -ctx->jumptime * 60, tr("Jump Back") );4496 DoSeek(ctx, -ctx->jumptime * 60, tr("Jump Back"), true); 4490 4497 } 4491 4498 else if (has_action("CHANNELDOWN", actions)) 4492 4499 { … … 4502 4509 else if (GetNumChapters(ctx) > 0) 4503 4510 DoJumpChapter(ctx, 9999); 4504 4511 else 4505 DoSeek(ctx, ctx->jumptime * 60, tr("Jump Ahead") );4512 DoSeek(ctx, ctx->jumptime * 60, tr("Jump Ahead"), true); 4506 4513 } 4507 4514 else if (has_action("DELETE", actions) && !islivetv) 4508 4515 { … … 4727 4734 ctx->UnlockDeletePlayer(__FILE__, __LINE__); 4728 4735 4729 4736 if (tokens[2] == "BEGINNING") 4730 DoSeek(ctx, -fplay, tr("Jump to Beginning")); 4731 else if (tokens[2] == "FORWARD") 4732 DoSeek(ctx, ctx->fftime, tr("Skip Ahead")); 4733 else if (tokens[2] == "BACKWARD") 4734 DoSeek(ctx, -ctx->rewtime, tr("Skip Back")); 4735 else if ((tokens[2] == "POSITION") && (tokens.size() == 4) && 4737 DoSeek(ctx, 0, tr("Jump to Beginning"), false); 4738 else if (tokens[2] == "FORWARD" || tokens[2] == "FORWARDNOCUTLIST") 4739 DoSeek(ctx, ctx->fftime, tr("Skip Ahead"), true, tokens[2] == "FORWARD"); 4740 else if (tokens[2] == "BACKWARD" || tokens[2] == "BACKWARDNOCUTLIST") 4741 DoSeek(ctx, -ctx->rewtime, tr("Skip Back"), true, tokens[2] == "BACKWARD"); 4742 else if ((tokens[2] == "POSITION" || 4743 tokens[2] == "POSITIONNOCUTLIST") && 4744 (tokens.size() == 4) && 4736 4745 (tokens[3].contains(QRegExp("^\\d+$"))) && 4737 4746 ctx->last_framerate) 4738 4747 { 4739 4748 long long rel_frame = tokens[3].toInt(); 4740 rel_frame -= (long long) (fplay * (1.0 / ctx->last_framerate)),4741 DoSeek(ctx, rel_frame, tr("Jump To"));4749 DoSeek(ctx, rel_frame / ctx->last_framerate, tr("Jump To"), 4750 false, tokens[2] == "POSITION"); 4742 4751 } 4743 4752 } 4744 4753 else if (tokens.size() >= 3 && tokens[1] == "VOLUME") … … 5778 5787 const bool isDVD) 5779 5788 { 5780 5789 const int kRewind = 4, kForward = 8, kSticky = 16, kSlippery = 32, 5781 kRelative = 64, kAbsolute = 128, kWhenceMask = 3; 5790 kRelative = 64, kAbsolute = 128, kIgnoreCutlist = 256, 5791 kWhenceMask = 3; 5782 5792 int flags = 0; 5783 5793 if (has_action("SEEKFFWD", actions)) 5784 5794 flags = ARBSEEK_FORWARD | kForward | kSlippery | kRelative; 5795 else if (has_action("SEEKFFWDNOCUTLIST", actions)) 5796 flags = ARBSEEK_FORWARD | kForward | kSlippery | kRelative | kIgnoreCutlist; 5785 5797 else if (has_action("FFWDSTICKY", actions)) 5786 5798 flags = ARBSEEK_END | kForward | kSticky | kAbsolute; 5787 5799 else if (has_action("RIGHT", actions)) 5788 5800 flags = ARBSEEK_FORWARD | kForward | kSticky | kRelative; 5789 5801 else if (has_action("SEEKRWND", actions)) 5790 5802 flags = ARBSEEK_REWIND | kRewind | kSlippery | kRelative; 5803 else if (has_action("SEEKRWNDNOCUTLIST", actions)) 5804 flags = ARBSEEK_REWIND | kRewind | kSlippery | kRelative | kIgnoreCutlist; 5791 5805 else if (has_action("RWNDSTICKY", actions)) 5792 5806 flags = ARBSEEK_SET | kRewind | kSticky | kAbsolute; 5793 5807 else if (has_action("LEFT", actions)) … … 5798 5812 int direction = (flags & kRewind) ? -1 : 1; 5799 5813 if (HasQueuedInput()) 5800 5814 { 5801 DoArbSeek(actx, static_cast<ArbSeekWhence>(flags & kWhenceMask)); 5815 DoArbSeek(actx, static_cast<ArbSeekWhence>(flags & kWhenceMask), 5816 !(flags & kIgnoreCutlist)); 5802 5817 } 5803 5818 else if (actx->paused) 5804 5819 { … … 5808 5823 direction * (1.001 / actx->last_framerate); 5809 5824 QString message = (flags & kRewind) ? QString(tr("Rewind")) : 5810 5825 QString(tr("Forward")); 5811 DoSeek(actx, time, message );5826 DoSeek(actx, time, message, true, !(flags & kIgnoreCutlist)); 5812 5827 } 5813 5828 } 5814 5829 else if (flags & kSticky) … … 5819 5834 { 5820 5835 if (smartForward) 5821 5836 doSmartForward = true; 5822 DoSeek(actx, -actx->rewtime, tr("Skip Back")); 5837 DoSeek(actx, -actx->rewtime, tr("Skip Back"), 5838 true, !(flags & kIgnoreCutlist)); 5823 5839 } 5824 5840 else 5825 5841 { 5826 5842 if (smartForward & doSmartForward) 5827 DoSeek(actx, actx->rewtime, tr("Skip Ahead")); 5843 DoSeek(actx, actx->rewtime, tr("Skip Ahead"), 5844 true, !(flags & kIgnoreCutlist)); 5828 5845 else 5829 DoSeek(actx, actx->fftime, tr("Skip Ahead")); 5846 DoSeek(actx, actx->fftime, tr("Skip Ahead"), 5847 true, !(flags & kIgnoreCutlist)); 5830 5848 } 5831 5849 return true; 5832 5850 } 5833 5851 5834 void TV::DoSeek(PlayerContext *ctx, float time, const QString &mesg) 5852 void TV::DoSeek(PlayerContext *ctx, float time, const QString &mesg, 5853 bool timeIsOffset, bool honorCutlist) 5835 5854 { 5836 5855 bool limitkeys = false; 5837 5856 … … 5845 5864 keyRepeatTimer.start(); 5846 5865 NormalSpeed(ctx); 5847 5866 time += StopFFRew(ctx); 5867 float framerate = ctx->last_framerate; 5868 uint64_t currentFrameAbs = ctx->player->GetFramesPlayed(); 5869 uint64_t currentFrameRel = honorCutlist ? 5870 ctx->player->TranslatePositionAbsToRel(currentFrameAbs) : 5871 currentFrameAbs; 5872 int64_t desiredFrameRel = (timeIsOffset ? currentFrameRel : 0) + 5873 time * framerate + 0.5; 5874 if (desiredFrameRel < 0) 5875 desiredFrameRel = 0; 5876 uint64_t desiredFrameAbs = honorCutlist ? 5877 ctx->player->TranslatePositionRelToAbs(desiredFrameRel) : 5878 desiredFrameRel; 5879 time = ((int64_t)desiredFrameAbs - (int64_t)currentFrameAbs) / framerate; 5848 5880 DoPlayerSeek(ctx, time); 5849 5881 UpdateOSDSeekMessage(ctx, mesg, kOSDTimeout_Med); 5850 5882 } 5851 5883 } 5852 5884 5853 void TV::DoArbSeek(PlayerContext *ctx, ArbSeekWhence whence )5885 void TV::DoArbSeek(PlayerContext *ctx, ArbSeekWhence whence, bool honorCutlist) 5854 5886 { 5855 5887 bool ok = false; 5856 5888 int seek = GetQueuedInputAsInt(&ok); … … 5861 5893 float time = ((seek / 100) * 3600) + ((seek % 100) * 60); 5862 5894 5863 5895 if (whence == ARBSEEK_FORWARD) 5864 DoSeek(ctx, time, tr("Jump Ahead") );5896 DoSeek(ctx, time, tr("Jump Ahead"), true, honorCutlist); 5865 5897 else if (whence == ARBSEEK_REWIND) 5866 DoSeek(ctx, -time, tr("Jump Back") );5898 DoSeek(ctx, -time, tr("Jump Back"), true, honorCutlist); 5867 5899 else 5868 5900 { 5869 5901 ctx->LockDeletePlayer(__FILE__, __LINE__); … … 5875 5907 if (whence == ARBSEEK_END) 5876 5908 time = (ctx->player->CalcMaxFFTime(LONG_MAX, false) / 5877 5909 ctx->last_framerate) - time; 5878 else5879 time = time - (ctx->player->GetFramesPlayed() - 1) /5880 ctx->last_framerate;5881 5910 ctx->UnlockDeletePlayer(__FILE__, __LINE__); 5882 DoSeek(ctx, time, tr("Jump To") );5911 DoSeek(ctx, time, tr("Jump To"), (whence != ARBSEEK_SET), honorCutlist); 5883 5912 } 5884 5913 } 5885 5914 … … 6815 6844 { 6816 6845 commited = true; 6817 6846 if (HasQueuedInput()) 6847 // XXX Should the cutlist be honored? 6818 6848 DoArbSeek(ctx, ARBSEEK_FORWARD); 6819 6849 } 6820 6850 else if (StateIsLiveTV(GetState(ctx))) … … 11406 11436 uint chapterLength = ctx->buffer->DVD()->GetChapterLength(); 11407 11437 if ((titleLength == chapterLength) && chapterLength > 300) 11408 11438 { 11409 DoSeek(ctx, -ctx->jumptime * 60, tr("Jump Back") );11439 DoSeek(ctx, -ctx->jumptime * 60, tr("Jump Back"), true); 11410 11440 } 11411 11441 else 11412 11442 { … … 11451 11481 (currentTime < (chapterLength - (ctx->jumptime * 60))) && 11452 11482 chapterLength > 300) 11453 11483 { 11454 DoSeek(ctx, ctx->jumptime * 60, tr("Jump Ahead") );11484 DoSeek(ctx, ctx->jumptime * 60, tr("Jump Ahead"), true); 11455 11485 } 11456 11486 else 11457 11487 { -
libs/libmythtv/deletemap.cpp
66 66 } 67 67 } 68 68 69 /** 69 static QString createTimeString(uint64_t frame, uint64_t total, 70 double frame_rate, bool full_resolution) 71 { 72 int secs = (int)(frame / frame_rate); 73 int frames = frame - (int)(secs * frame_rate); 74 int totalSecs = (int)(total / frame_rate); 75 QString timestr; 76 if (totalSecs >= 3600) 77 timestr = QString::number(secs / 3600) + ":"; 78 timestr += QString("%1").arg((secs / 60) % 60, 2, 10, QChar(48)) + 79 QString(":%1").arg(secs % 60, 2, 10, QChar(48)); 80 if (full_resolution) 81 timestr += QString(".%1").arg(frames, 2, 10, QChar(48)); 82 return timestr; 83 } 84 85 /** 70 86 * \brief Show and update the edit mode On Screen Display. The cut regions 71 87 * are only refreshed if the deleteMap has been updated. 72 88 */ … … 84 100 infoMap.detach(); 85 101 ctx->UnlockPlayingInfo(__FILE__, __LINE__); 86 102 87 int secs = (int)(frame / frame_rate);88 int frames = frame - (int)(secs * frame_rate);89 QString timestr = QString::number(secs / 3600) +90 QString(":%1").arg((secs / 60) % 60, 2, 10, QChar(48)) +91 QString(":%1").arg(secs % 60, 2, 10, QChar(48)) +92 QString(".%1").arg(frames, 2, 10, QChar(48));93 94 103 QString cutmarker = " "; 95 104 if (IsInDelete(frame)) 96 105 cutmarker = QObject::tr("cut"); 97 106 107 QString timestr = createTimeString(frame, total, frame_rate, true); 108 uint64_t relTotal = TranslatePositionAbsToRel(total); 109 QString relTimeDisplay = createTimeString(TranslatePositionAbsToRel(frame), 110 relTotal, frame_rate, false); 111 QString relLengthDisplay = createTimeString(relTotal, 112 relTotal, frame_rate, false); 98 113 infoMap["timedisplay"] = timestr; 99 114 infoMap["framedisplay"] = QString::number(frame); 100 115 infoMap["cutindicator"] = cutmarker; 101 116 infoMap["title"] = QObject::tr("Edit"); 102 117 infoMap["seekamount"] = m_seekText;; 118 infoMap["reltimedisplay"] = relTimeDisplay; 119 infoMap["rellengthdisplay"] = relLengthDisplay; 120 infoMap["fulltimedisplay"] = timestr + " (" + 121 QObject::tr("%1 of %2").arg(relTimeDisplay).arg(relLengthDisplay) + ")"; 103 122 104 123 QHash<QString,float> posMap; 105 124 posMap.insert("position", (float)((double)frame/(double)total)); … … 695 714 result = it.key(); 696 715 return result; 697 716 } 717 718 uint64_t DeleteMap::TranslatePositionAbsToRel(const frm_dir_map_t &deleteMap, 719 uint64_t absPosition) 720 { 721 uint64_t subtraction = 0; 722 uint64_t startOfCutRegion = 0; 723 frm_dir_map_t::const_iterator i; 724 bool withinCut = false; 725 bool first = true; 726 for (i = deleteMap.constBegin(); 727 i != deleteMap.constEnd() && i.key() <= absPosition; 728 i++) 729 { 730 if (first) 731 withinCut = (i.value() == MARK_CUT_END); 732 first = false; 733 if (i.value() == MARK_CUT_START && !withinCut) 734 { 735 withinCut = true; 736 startOfCutRegion = i.key(); 737 } 738 else if (i.value() == MARK_CUT_END && withinCut) 739 { 740 withinCut = false; 741 subtraction += (i.key() - startOfCutRegion); 742 } 743 } 744 if (withinCut) 745 subtraction += (absPosition - startOfCutRegion); 746 return absPosition - subtraction; 747 } 748 749 uint64_t DeleteMap::TranslatePositionRelToAbs(const frm_dir_map_t &deleteMap, 750 uint64_t relPosition) 751 { 752 uint64_t addition = 0; 753 uint64_t startOfCutRegion = 0; 754 frm_dir_map_t::const_iterator i; 755 bool withinCut = false; 756 bool first = true; 757 for (i = deleteMap.constBegin(); i != deleteMap.constEnd(); i++) 758 { 759 if (first) 760 withinCut = (i.value() == MARK_CUT_END); 761 first = false; 762 if (i.value() == MARK_CUT_START && !withinCut) 763 { 764 withinCut = true; 765 startOfCutRegion = i.key(); 766 if (relPosition + addition <= startOfCutRegion) 767 break; 768 } 769 else if (i.value() == MARK_CUT_END && withinCut) 770 { 771 withinCut = false; 772 addition += (i.key() - startOfCutRegion); 773 } 774 } 775 return relPosition + addition; 776 } -
libs/libmythtv/mythplayer.cpp
4168 4168 info.values.insert("progbefore", 0); 4169 4169 info.values.insert("progafter", 0); 4170 4170 4171 int playbackLen = totalLength; 4171 int rawPlaybackLen = totalLength; 4172 int playbackLen = deleteMap.TranslatePositionAbsToRel(totalLength * video_frame_rate) / video_frame_rate; 4172 4173 4173 4174 if (livetv && player_ctx->tvchain) 4174 4175 { … … 4186 4187 islive = true; 4187 4188 } 4188 4189 4189 float secsplayed = ((float)framesPlayed / video_frame_rate); 4190 calcSliderPosPriv(info, paddedFields, playbackLen, secsplayed, islive); 4190 float secsplayed = ((float)deleteMap.TranslatePositionAbsToRel(framesPlayed) / video_frame_rate); 4191 calcSliderPosPriv(info, paddedFields, playbackLen, secsplayed, islive, false); 4192 float rawSecsplayed = ((float)framesPlayed / video_frame_rate); 4193 calcSliderPosPriv(info, paddedFields, rawPlaybackLen, rawSecsplayed, islive, true); 4191 4194 } 4192 4195 4193 4196 void MythPlayer::calcSliderPosPriv(osdInfo &info, bool paddedFields, 4194 4197 int playbackLen, float secsplayed, 4195 bool islive )4198 bool islive, bool isRaw) 4196 4199 { 4200 QString rawPrefix = isRaw ? "raw" : ""; 4197 4201 playbackLen = max(playbackLen, 1); 4198 4202 secsplayed = min((float)playbackLen, max(secsplayed, 0.0f)); 4199 4203 4200 info.values["position"] = (int)(1000.0f * (secsplayed / (float)playbackLen)); 4204 info.values[rawPrefix + "position"] = 4205 (int)(1000.0f * (secsplayed / (float)playbackLen)); 4201 4206 4202 4207 int phours = (int)secsplayed / 3600; 4203 4208 int pmins = ((int)secsplayed - phours * 3600) / 60; … … 4246 4251 } 4247 4252 } 4248 4253 4249 info.text[ "description"] = QObject::tr("%1 of %2").arg(text1).arg(text2);4250 info.text[ "playedtime"] = text1;4251 info.text[ "totaltime"] = text2;4252 info.text[ "remainingtime"] = islive ? QString() : text3;4253 info.text[ "behindtime"] = islive ? text3 : QString();4254 info.text[rawPrefix + "description"] = QObject::tr("%1 of %2").arg(text1).arg(text2); 4255 info.text[rawPrefix + "playedtime"] = text1; 4256 info.text[rawPrefix + "totaltime"] = text2; 4257 info.text[rawPrefix + "remainingtime"] = islive ? QString() : text3; 4258 info.text[rawPrefix + "behindtime"] = islive ? text3 : QString(); 4254 4259 } 4255 4260 4256 4261 int MythPlayer::GetNumChapters() -
libs/libmythtv/osd.cpp
313 313 found = true; 314 314 } 315 315 } 316 if (map.contains("rawposition")) 317 { 318 MythUIProgressBar *bar = dynamic_cast<MythUIProgressBar *> (win->GetChild("rawposition")); 319 if (bar) 320 { 321 bar->SetVisible(true); 322 bar->SetStart(0); 323 bar->SetTotal(1000); 324 bar->SetUsed(map.value("rawposition")); 325 found = true; 326 } 327 } 316 328 317 329 if (found) 318 330 SetExpiry(window, timeout);
