2 Copyright 2004-2019 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP. If not, see <https://www.gnu.org/licenses/>.
28 #include "playervideorec.h"
29 #include "recording.h"
30 #include "vaudioselector.h"
40 #include "vteletextview.h"
41 #include "messagequeue.h"
43 #include "vvideorec.h"
45 static const char* TAG = "VVideoRec";
47 VVideoRec::VVideoRec(Recording* rec, bool ish264)
49 boxstack = BoxStack::getInstance();
50 vdr = VDR::getInstance();
51 video = Video::getInstance();
52 timers = Timers::getInstance();
56 videoMode = video->getMode();
59 video->seth264mode(ish264);
61 player = new PlayerVideoRec(Control::getInstance(), this, this);
62 player->init(myRec->IsPesRecording,myRec->recInfo->fps);
64 char* cstartMargin = vdr->configLoad("Timers", "Start margin"); // NCONFIG
65 char* cendMargin = vdr->configLoad("Timers", "End margin");
68 startMargin = 300; // 5 mins default
72 startMargin = atoi(cstartMargin) * 60;
73 delete[] cstartMargin;
78 endMargin = 300; // 5 mins default
82 endMargin = atoi(cendMargin) * 60;
86 LogNT::getInstance()->debug(TAG, "SM: {} EM: {}", startMargin, endMargin);
88 setSize(video->getScreenWidth(), video->getScreenHeight());
90 setBackgroundColour(DrawStyle::TRANSPARENT);
92 OsdVector* osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
95 osdv->updateBackgroundColor(DrawStyle::BLACK);
99 barRegion.y = video->getScreenHeight() - 58; // FIXME, need to be - 1? and below?
100 barRegion.w = video->getScreenWidth();
103 clocksRegion.x = barRegion.x + 140;
104 clocksRegion.y = barRegion.y + 12;
105 clocksRegion.w = 170;
106 clocksRegion.h = getFontHeight();
107 // barBlue.set(0, 0, 150, 150);
108 barBlue.set(0, 0, 0, 128);
115 vdisplay.mode=Fullscreen;
116 vdisplay.fallbackMode=Fullscreen;
123 void VVideoRec::preDelete()
125 timers->cancelTimer(this, 1);
126 timers->cancelTimer(this, 2);
130 boxstack->remove(vas);
134 if (vsummary) delete vsummary;
136 if (playing) stopPlay();
139 VVideoRec::~VVideoRec()
141 LogNT::getInstance()->debug(TAG, "Entering vvideorec destructor");
143 video->setDefaultAspect();
145 // kill recInfo in case resumePoint has changed (likely)
146 myRec->dropRecInfo();
147 // FIXME - do this properly - save the resume point back to the server manually and update
148 // rec->recInfo->resumePoint - this will fix the ~10s offset problem as well
150 OsdVector* osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
153 osdv->updateBackgroundColor(DrawStyle::WALLPAPER);
157 void VVideoRec::go(bool resume)
161 startFrameNum = myRec->recInfo->resumePoint;
165 LogNT::getInstance()->debug(TAG, "Starting stream: {} at frame: {}", myRec->getFileName(), startFrameNum);
166 ULONG lengthFrames = 0;
168 ULLONG lengthBytes = vdr->streamRecording(myRec->getFileName(), &lengthFrames, &isPesRecording);
169 myRec->IsPesRecording = isPesRecording;
172 player->setLengthBytes(lengthBytes);
173 player->setLengthFrames(lengthFrames);
174 player->setStartFrame(startFrameNum);
181 stopPlay(); // clean up
183 if (!vdr->isConnected())
185 Control::getInstance()->connectionLost();
189 Message* m = new Message();
190 m->message = Message::CLOSE_ME;
192 m->p_to = Message::BOXSTACK;
193 MessageQueue::getInstance()->postMessage(m);
195 VInfo* vi = new VInfo();
196 vi->setSize(360, 200);
198 if (Video::getInstance()->getFormat() == Video::PAL)
199 vi->setPosition(190, 170);
201 vi->setPosition(180, 120);
202 vi->setOneLiner(tr("Error playing recording"));
205 vi->setTitleBarColour(DrawStyle::DANGER);
210 m->message = Message::ADD_VIEW;
211 m->p_to = Message::BOXSTACK;
212 m->data = reinterpret_cast<void*>(vi);
213 MessageQueue::getInstance()->postMessage(m);
217 int VVideoRec::handleCommand(int command)
226 return BoxStack::COMMAND_HANDLED;
229 case Input::PLAYPAUSE:
233 return BoxStack::COMMAND_HANDLED;
241 return BoxStack::COMMAND_HANDLED;
248 if (playing) stopPlay();
250 return BoxStack::DELETE_ME;
257 return BoxStack::COMMAND_HANDLED;
259 case Input::SKIPFORWARD:
262 player->skipForward(60);
263 return BoxStack::COMMAND_HANDLED;
265 case Input::SKIPBACK:
268 player->skipBackward(60);
269 return BoxStack::COMMAND_HANDLED;
274 player->fastForward();
276 return BoxStack::COMMAND_HANDLED;
281 player->fastBackward();
283 return BoxStack::COMMAND_HANDLED;
287 if (vsummary) removeSummary();
289 return BoxStack::COMMAND_HANDLED;
294 return BoxStack::COMMAND_HANDLED;
298 if (myRec->hasMarks())
300 // skip to previous mark
301 LogNT* logger = LogNT::getInstance();
302 int currentFrame = (player->getCurrentFrameNum()); // get current Frame
303 currentFrame -= static_cast<int>(5 * myRec->recInfo->fps); // subtrack 5 seconds, else you cannot skip more than once back ..
305 int prevMark = myRec->getPrevMark(currentFrame); // find previous Frame
308 logger->info(TAG, "jump back from pos {} to mark at {}",currentFrame,prevMark);
309 player->jumpToMark(prevMark);
316 player->skipBackward(10);
318 return BoxStack::COMMAND_HANDLED;
322 if (myRec->hasMarks())
325 LogNT* logger = LogNT::getInstance();
326 int currentFrame = (player->getCurrentFrameNum());
328 int nextMark = myRec->getNextMark(currentFrame);
332 logger->info(TAG, "jump forward from pos {} to mark at {}", currentFrame,nextMark);
333 player->jumpToMark(nextMark);
340 player->skipForward(10);
342 return BoxStack::COMMAND_HANDLED;
344 case Input::PREVCHANNEL:
346 player->skipBackward(2);
347 return BoxStack::COMMAND_HANDLED;
352 player->skipBackward(10);
353 return BoxStack::COMMAND_HANDLED;
358 player->skipForward(10);
359 return BoxStack::COMMAND_HANDLED;
365 return BoxStack::COMMAND_HANDLED;
373 return BoxStack::COMMAND_HANDLED;
376 if (barShowing) removeBar();
378 return BoxStack::COMMAND_HANDLED;
381 case Input::ZERO: player->jumpToPercent(0); doBar(0); return 2;
382 case Input::ONE: player->jumpToPercent(10); doBar(0); return 2;
383 case Input::TWO: player->jumpToPercent(20); doBar(0); return 2;
384 case Input::THREE: player->jumpToPercent(30); doBar(0); return 2;
385 case Input::FOUR: player->jumpToPercent(40); doBar(0); return 2;
386 case Input::FIVE: player->jumpToPercent(50); doBar(0); return 2;
387 case Input::SIX: player->jumpToPercent(60); doBar(0); return 2;
388 case Input::SEVEN: player->jumpToPercent(70); doBar(0); return 2;
389 case Input::EIGHT: player->jumpToPercent(80); doBar(0); return 2;
390 case Input::NINE: player->jumpToPercent(90); doBar(0); return 2;
392 case Input::RECORD: player->toggleSubtitles(); return BoxStack::COMMAND_HANDLED;
396 //Don't use RED for anything. It will eventually be recording summary
402 // for testing EPG in NTSC with a NTSC test video
403 Video::getInstance()->setMode(Video::QUARTER);
404 Video::getInstance()->setPosition(170, 5);
405 VEpg* vepg = new VEpg(NULL, 0);
407 BoxStack::getInstance()->add(vepg);
408 BoxStack::getInstance()->update(vepg);
411 // return BoxStack::COMMAND_HANDLED;
418 return BoxStack::ABANDON_COMMAND;
421 void VVideoRec::doTeletext()
428 VTeletextView *vtxv=player->getTeletextDecoder()->getTeletxtView();
430 vtxv= new VTeletextView((player)->getTeletextDecoder(),this,NULL);
431 (player)->getTeletextDecoder()->registerTeletextView(vtxv);
434 vtxv->setSubtitleMode(true);
439 BoxStack::getInstance()->add(vtxv);
441 BoxStack::getInstance()->update(this);
442 BoxStack::getInstance()->update(vtxv);
445 void VVideoRec::processMessage(Message* m)
447 LogNT::getInstance()->debug(TAG, "Message received");
449 if (m->message == Message::MOUSE_LBDOWN)
451 UINT x = m->parameter - getScreenX();
452 UINT y = m->tag - getScreenY();
456 BoxStack::getInstance()->handleCommand(Input::OK); //simulate rok press
458 else if (barRegion.x<=x && barRegion.y<=y && (barRegion.x+barRegion.w)>=x && (barRegion.y+barRegion.h)>=y)
460 int progBarXbase = barRegion.x + 300;
461 if (myRec->hasMarks())
463 MarkList* markList = myRec->getMarkList();
464 MarkList::iterator i;
465 Mark* loopMark = NULL;
468 if (myRec->recInfo->timerEnd > time(NULL))
471 // Work out an approximate length in frames (good to 1s...)
472 lengthFrames = static_cast<ULONG>((myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
476 lengthFrames = player->getLengthFrames();
478 for(i = markList->begin(); i != markList->end(); i++)
483 posPix = 302 * loopMark->pos / lengthFrames;
484 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 3, 28, DrawStyle::DANGER);
485 if (x>=barRegion.x + progBarXbase + 2 + posPix
486 && x<=barRegion.x + progBarXbase + 2 + posPix+3
487 && y>=barRegion.y + 12 - 2
488 && y<=barRegion.y + 12 - 2+28)
490 player->jumpToMark(loopMark->pos);
498 if (x>=barRegion.x + progBarXbase + 24
499 && x<=barRegion.x + progBarXbase + 4 + 302
500 && y>=barRegion.y + 12 - 2
501 && y<=barRegion.y + 12 - 2+28)
503 int cx=x-(barRegion.x + progBarXbase + 4);
504 double percent = cx / 302. * 100.;
505 player->jumpToPercent(percent);
508 // int progressWidth = 302 * currentFrameNum / lengthFrames;
509 // rectangle(barRegion.x + progBarXbase + 4, barRegion.y + 16, progressWidth, 16, DrawStyle::SELECTHIGHLIGHT);
514 BoxStack::getInstance()->handleCommand(Input::OK); //simulate rok press
517 else if (m->from == player)
519 if (m->message != Message::PLAYER_EVENT) return;
522 case PlayerVideoRec::CONNECTION_LOST: // connection lost detected
524 // I can't handle this, send it to control
525 Message* m2 = new Message();
526 m2->p_to = Message::CONTROL;
527 m2->message = Message::CONNECTION_LOST;
528 MessageQueue::getInstance()->postMessage(m2);
531 case PlayerVideoRec::STOP_PLAYBACK:
533 // FIXME Obselete ish - improve this
534 Message* m2 = new Message(); // Must be done after this thread finishes, and must break into master mutex
535 m2->p_to = Message::CONTROL;
536 m2->message = Message::STOP_PLAYBACK;
537 MessageQueue::getInstance()->postMessage(m2);
540 case PlayerVideoRec::ASPECT43:
544 case PlayerVideoRec::ASPECT169:
550 else if (m->message == Message::AUDIO_CHANGE_CHANNEL)
552 LogNT::getInstance()->debug(TAG, "Received change audio channel to {}", m->parameter);
553 player->setAudioChannel(m->parameter&0xFFFF,(m->parameter&0xFF0000)>> 16,(m->parameter&0xFF000000)>> 24 );
555 else if (m->message == Message::SUBTITLE_CHANGE_CHANNEL)
557 LogNT::getInstance()->debug(TAG, "Received change subtitle channel to {}", m->parameter);
558 int type=((m->parameter & 0xFF0000)>>16);
560 case 0x10: { //dvbsubtitle
561 player->setSubtitleChannel((m->parameter & 0xFFFF));
562 player->turnSubtitlesOn(true);
563 VTeletextView *vtxt = player->getTeletextDecoder()->getTeletxtView();
564 if (vtxt && vtxt->isInSubtitleMode()) {
565 BoxStack::getInstance()->remove(vtxt);
568 case 0xFF: { //nosubtitles
570 player->turnSubtitlesOn(false);
571 VTeletextView *vtxt = player->getTeletextDecoder()->getTeletxtView();
572 if (vtxt && vtxt->isInSubtitleMode()) {
573 BoxStack::getInstance()->remove(vtxt);
577 case 0x11: { //videotext
578 player->turnSubtitlesOn(false);
580 player->getTeletextDecoder()->setPage((m->parameter & 0xFFFF));
584 BoxStack::getInstance()->update(vas);
586 BoxStack::getInstance()->update(this);
590 else if (m->message == Message::CHILD_CLOSE)
596 if (!barGenHold && !barScanHold && !barVasHold) removeBar();
601 void VVideoRec::stopPlay()
603 LogNT::getInstance()->debug(TAG, "Pre stopPlay");
606 LogNT::getInstance()->debug(TAG, "1");
608 LogNT::getInstance()->debug(TAG, "2");
609 vdr->stopStreaming();
610 LogNT::getInstance()->debug(TAG, "3");
615 if (!vdr->isConnected()) { Control::getInstance()->connectionLost(); return; }
616 LogNT::getInstance()->debug(TAG, "Post stopPlay");
619 void VVideoRec::toggleChopSides()
621 if (video->getTVsize() == Video::ASPECT16X9) return; // Means nothing for 16:9 TVs
623 if (videoMode == Video::NORMAL)
625 videoMode = Video::LETTERBOX;
626 video->setMode(Video::LETTERBOX);
630 videoMode = Video::NORMAL;
631 video->setMode(Video::NORMAL);
635 void VVideoRec::doAudioSelector()
637 int subtitleChannel=player->getCurrentSubtitleChannel();
638 int subtitleType=0x10;
639 if (!(player)->isSubtitlesOn()) {
640 if ((player)->getTeletextDecoder()->getTeletxtView() &&
641 (player)->getTeletextDecoder()->getTeletxtView()->isInSubtitleMode()
643 subtitleChannel=(player)->getTeletextDecoder()->getPage();
647 subtitleType=0xFF; //turnedOff
651 if (player->isPesRecording()) {
652 bool* availableMpegAudioChannels = player->getDemuxerMpegAudioChannels();
653 bool* availableAc3AudioChannels = NULL;
654 bool* availableSubtitleChannels = player->getDemuxerSubtitleChannels();
655 int *availableTTxtpages = player->getTeletxtSubtitlePages();
656 int currentAudioChannel = player->getCurrentAudioChannel();
657 if (Audio::getInstance()->supportsAc3())
659 availableAc3AudioChannels = player->getDemuxerAc3AudioChannels();
662 vas = new VAudioSelector(this, availableMpegAudioChannels, availableAc3AudioChannels, currentAudioChannel,availableSubtitleChannels, availableTTxtpages,
663 subtitleChannel, subtitleType, myRec->recInfo);
666 Channel *temp_channel=player->getDemuxerChannel();
667 // RecInfo *cur_info= myRec->recInfo;
668 /* unsigned char numchan_recinfo = cur_info->numComponents;
669 unsigned char numchan_subtitles_siz = temp_channel.numSPids;
670 ULONG mp_audcounter = 0;
671 ULONG ac3_counter = 0;
672 int dvb_subcounter = 1;*/
675 /*unsigned char type;
678 for (i = 0; i < numchan_recinfo; i++)
681 type = cur_info->types[i];
682 lang = cur_info->languages[i];
683 description = cur_info->descriptions[i];
686 if (cur_info->streams[i] == 2) {
689 case 1: //mpaudio mono
690 case 3: //mpaudio stereo
691 if (mp_audcounter < temp_channel.numAPids) ac = &temp_channel.apids[mp_audcounter];
696 if (ac3_counter < temp_channel.numDPids) ac = &temp_channel.dpids[ac3_counter];
700 } else if (cur_info->streams[i] == 3){
701 if (dvb_subcounter < numchan_subtitles_siz) ac = &temp_channel.spids[dvb_subcounter];
702 } else continue; //neither audio nor subtitle
705 if (description && (strlen(description) > 0))
707 ac->name = new char[strlen(description) + 1];
708 strcpy(ac->name, description);
710 } else if (lang && strlen(lang) > 0)
712 ac->name = new char[strlen(lang) + 1];
713 strcpy(ac->name, lang);
718 for (i=0;i<temp_channel->numAPids;i++) {
719 apid *ac=&temp_channel->apids[i];
720 if (ac->desc[0]==0) {
721 strncpy(ac->desc, tr("unknown"),9);
724 for (i=0;i<temp_channel->numDPids;i++) {
725 apid *ac=&temp_channel->dpids[i];
726 if (ac->desc[0]==0) {
727 strncpy(ac->desc, tr("unknown"),9);
730 for (i=0;i<temp_channel->numSPids;i++) {
731 apid *ac=&temp_channel->spids[i];
732 if (ac->desc[0]==0) {
733 strncpy(ac->desc, tr("unknown"),9);
737 vas = new VAudioSelector(this,temp_channel , (player)->getCurrentAudioChannel(),
738 subtitleType,subtitleChannel,player->getTeletxtSubtitlePages());
739 /* for (i=0;i<temp_channel.numAPids;i++) {
740 apid *ac=&temp_channel.apids[i];
744 for (i=0;i<temp_channel.numDPids;i++) {
745 apid *ac=&temp_channel.dpids[i];
749 for (i=0;i<temp_channel.numSPids;i++) {
750 apid *ac=&temp_channel.spids[i];
757 vas->setBackgroundColour(barBlue);
758 vas->setPosition(0, barRegion.y - 120);
767 boxstack->update(vas);
770 void VVideoRec::doBar(int action_in)
772 // if (player->isSubtitlesOn()) clearOSD(); // remove dvbsubtitles
773 // player->tellSubtitlesOSDVisible(true);
776 int action = action_in;
784 rectangle(barRegion, barBlue);
786 /* Work out what to display - choices:
793 Specials, informed by parameter
805 w.setPosition(barRegion.x + 66, barRegion.y + 16);
807 UCHAR playerState = 0;
811 if (action == 1) w.nextSymbol = WSymbol::SKIPFORWARD;
812 else if (action == 2) w.nextSymbol = WSymbol::SKIPBACK;
813 else if (action == 3) w.nextSymbol = WSymbol::SKIPFORWARD2;
814 else if (action == 4) w.nextSymbol = WSymbol::SKIPBACK2;
818 playerState = player->getState();
819 if (playerState == PlayerVideoRec::S_PAUSE_P) w.nextSymbol = WSymbol::PAUSE;
820 else if (playerState == PlayerVideoRec::S_PAUSE_I) w.nextSymbol = WSymbol::PAUSE;
821 else if (playerState == PlayerVideoRec::S_FFWD) w.nextSymbol = WSymbol::FFWD;
822 else if (playerState == PlayerVideoRec::S_FBWD) w.nextSymbol = WSymbol::FBWD;
823 else w.nextSymbol = WSymbol::PLAY;
828 if ((playerState == PlayerVideoRec::S_FFWD) || (playerState == PlayerVideoRec::S_FBWD))
830 // draw blips to show how fast the scan is
831 UCHAR scanrate = player->getIScanRate();
835 SNPRINTF(text, 5, "%ux", scanrate);
836 drawText(text, barRegion.x + 102, barRegion.y + 12, DrawStyle::LIGHTTEXT);
842 boxstack->update(this, &barRegion);
846 timers->cancelTimer(this, 1);
848 if ((playerState == PlayerVideoRec::S_FFWD) || (playerState == PlayerVideoRec::S_FBWD))
853 if (!barGenHold && !barScanHold && !barVasHold)
854 timers->setTimerD(this, 1, 4);
856 LogNT::getInstance()->debug(TAG, "player state: {}", playerState);
858 if ((playerState == PlayerVideoRec::S_PAUSE_P) || (playerState == PlayerVideoRec::S_PAUSE_I))
859 timers->cancelTimer(this, 2);
861 timers->setTimerD(this, 2, 0, 200000000);
865 void VVideoRec::timercall(int clientReference)
867 switch(clientReference)
878 if (!barShowing) break;
879 #ifndef GRADIENT_DRAWING
881 boxstack->update(this, &barRegion);
885 timers->setTimerD(this, 2, 0, 200000000);
891 void VVideoRec::drawBarClocks()
895 UCHAR playerState = player->getState();
896 // sticky bar is set if we are in ffwd/fbwd mode
897 // if player has gone to S_PLAY then kill stickyBar, and run doBar(0) which
898 // will repaint all the bar (it will call this function again, but
899 // this section won't run because stickyBarF will then == false)
901 if ((playerState != PlayerVideoRec::S_FFWD) && (playerState != PlayerVideoRec::S_FBWD))
905 return; // doBar will call this function and do the rest
909 LogNT* logger = LogNT::getInstance();
910 logger->debug(TAG, "Draw bar clocks");
913 // Blank the area first
914 #ifndef GRADIENT_DRAWING
915 rectangle(barRegion.x + 624, barRegion.y + 12, 60, 30, barBlue);
921 LOCALTIME_R(&t, &tms);
922 strftime(timeString, 19, "%H:%M", &tms);
923 drawText(timeString, barRegion.x + 624, barRegion.y + 12, DrawStyle::LIGHTTEXT);
926 #ifndef GRADIENT_DRAWING
927 rectangle(clocksRegion, barBlue);
930 ULONG currentFrameNum = player->getCurrentFrameNum();
932 if (myRec->recInfo->timerEnd > time(NULL))
935 // Work out an approximate length in frames (good to 1s...)
936 lengthFrames = static_cast<ULONG>((myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
940 lengthFrames = player->getLengthFrames();
943 hmsf currentFrameHMSF = myRec->recInfo->framesToHMSF(currentFrameNum);
944 hmsf lengthHMSF = myRec->recInfo->framesToHMSF(lengthFrames);
947 if (currentFrameNum >= lengthFrames)
949 strcpy(buffer, "-:--:-- / -:--:--");
953 SNPRINTF(buffer, 99, "%01i:%02i:%02i / %01i:%02i:%02i", currentFrameHMSF.hours, currentFrameHMSF.minutes, currentFrameHMSF.seconds, lengthHMSF.hours, lengthHMSF.minutes, lengthHMSF.seconds);
954 logger->debug(TAG, buffer);
957 drawText(buffer, clocksRegion.x, clocksRegion.y, DrawStyle::LIGHTTEXT);
966 int progBarXbase = barRegion.x + 300;
968 rectangle(barRegion.x + progBarXbase, barRegion.y + 12, 310, 24, DrawStyle::LIGHTTEXT);
969 rectangle(barRegion.x + progBarXbase + 2, barRegion.y + 14, 306, 20, barBlue);
971 if (currentFrameNum > lengthFrames) return;
972 if (lengthFrames == 0) return;
974 // Draw yellow portion
975 int progressWidth = 302 * currentFrameNum / lengthFrames;
976 rectangle(barRegion.x + progBarXbase + 4, barRegion.y + 16, progressWidth, 16, DrawStyle::SELECTHIGHLIGHT);
978 if (myRec->recInfo->timerEnd > time(NULL)) // if chasing
980 int nrWidth = 302 * (lengthFrames - player->getLengthFrames()) / lengthFrames;
982 LogNT::getInstance()->debug("GVASDF", "Length Frames: {}", lengthFrames);
983 LogNT::getInstance()->debug("GVASDF", "Player lf: {}", player->getLengthFrames());
984 LogNT::getInstance()->debug("GVASDF", "NR WDITH: {}", nrWidth);
985 rectangle(barRegion.x + progBarXbase + 4 + 302 - nrWidth, barRegion.y + 16, nrWidth, 16, DrawStyle::RED);
989 // Now calc position for blips
991 if (myRec->hasMarks())
993 // Draw blips where there are cut marks
994 MarkList* markList = myRec->getMarkList();
995 MarkList::iterator i;
996 Mark* loopMark = NULL;
998 for(i = markList->begin(); i != markList->end(); i++)
1003 logger->debug(TAG, "Drawing mark at frame {}", loopMark->pos);
1004 posPix = 302 * loopMark->pos / lengthFrames;
1005 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 3, 28, DrawStyle::DANGER);
1011 // Draw blips where start and end margins probably are
1013 posPix = static_cast<int>(302 * startMargin * myRec->recInfo->fps / lengthFrames);
1015 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
1016 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
1018 posPix = static_cast<int>(302 * (lengthFrames - endMargin * myRec->recInfo->fps) / lengthFrames);
1020 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
1021 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
1025 void VVideoRec::removeBar()
1027 if (!barShowing) return;
1028 timers->cancelTimer(this, 2);
1031 barScanHold = false;
1033 rectangle(barRegion, DrawStyle::TRANSPARENT);
1034 boxstack->update(this, &barRegion);
1035 player->tellSubtitlesOSDVisible(false);
1038 void VVideoRec::doSummary()
1040 clearOSD(); // remove dvbsubtitles
1041 player->tellSubtitlesOSDVisible(true);
1042 vsummary = new VInfo();
1043 vsummary->setTitleText(myRec->getProgName());
1044 vsummary->setBorderOn(1);
1045 vsummary->setExitable();
1046 if (myRec->recInfo->summary) vsummary->setMainText(myRec->recInfo->summary);
1047 else vsummary->setMainText(tr("Summary unavailable"));
1048 if (Video::getInstance()->getFormat() == Video::PAL)
1050 vsummary->setPosition(120, 130);
1054 vsummary->setPosition(110, 90);
1056 vsummary->setSize(510, 270);
1060 BoxStack::getInstance()->update(this);
1063 void VVideoRec::removeSummary()
1071 BoxStack::getInstance()->update(this);
1072 player->tellSubtitlesOSDVisible(false);
1076 void VVideoRec::drawOSDBitmap(UINT posX, UINT posY, const Bitmap& bm, const DisplayRegion& region)
1078 drawBitmap(posX, posY, bm, region);
1080 r.x = posX; r.y = posY; r.w = bm.getWidth(); r.h = bm.getHeight();
1081 boxstack->update(this, &r);
1084 void VVideoRec::clearOSD()
1086 rectangle(area, DrawStyle::TRANSPARENT);
1087 boxstack->update(this, &area);
1090 void VVideoRec::clearOSDArea(UINT posX, UINT posY, UINT width, UINT height, const DisplayRegion& region)
1092 Region r(r.x = posX + region.windowx, posY + region.windowy, width, height);
1093 //now convert to our display
1094 float scalex = 720.f / static_cast<float>(region.framewidth + 1);
1095 float scaley = 576.f / static_cast<float>(region.frameheight + 1);
1096 r.x = static_cast<UINT>(floor(scalex * static_cast<float>(r.x)));
1097 r.y = static_cast<UINT>(floor(scaley * static_cast<float>(r.y)));
1098 r.w = static_cast<UINT>(ceil(scalex * static_cast<float>(r.w)) + 1.f);
1099 r.h = static_cast<UINT>(ceil(scaley * static_cast<float>(r.h)) + 1.f);
1101 rectangle(r, DrawStyle::TRANSPARENT);
1102 boxstack->update(this, &r);