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 VVideoRec::VVideoRec(Recording* rec, bool ish264)
47 boxstack = BoxStack::getInstance();
48 vdr = VDR::getInstance();
49 video = Video::getInstance();
50 timers = Timers::getInstance();
54 videoMode = video->getMode();
57 video->seth264mode(ish264);
59 player = new PlayerVideoRec(Control::getInstance(), this, this);
60 player->init(myRec->IsPesRecording,myRec->recInfo->fps);
62 char* cstartMargin = vdr->configLoad("Timers", "Start margin");
63 char* cendMargin = vdr->configLoad("Timers", "End margin");
66 startMargin = 300; // 5 mins default
70 startMargin = atoi(cstartMargin) * 60;
71 delete[] cstartMargin;
76 endMargin = 300; // 5 mins default
80 endMargin = atoi(cendMargin) * 60;
84 Log::getInstance()->log("VVideoRec", Log::DEBUG, "SM: %u EM: %u", startMargin, endMargin);
86 setSize(video->getScreenWidth(), video->getScreenHeight());
88 transparent.set(0, 0, 0, 0);
89 setBackgroundColour(transparent);
91 OsdVector* osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
94 osdv->updateBackgroundColor(DrawStyle::BLACK);
98 barRegion.y = video->getScreenHeight() - 58; // FIXME, need to be - 1? and below?
99 barRegion.w = video->getScreenWidth();
102 clocksRegion.x = barRegion.x + 140;
103 clocksRegion.y = barRegion.y + 12;
104 clocksRegion.w = 170;
105 clocksRegion.h = getFontHeight();
106 // barBlue.set(0, 0, 150, 150);
107 barBlue.set(0, 0, 0, 128);
114 vdisplay.mode=Fullscreen;
115 vdisplay.fallbackMode=Fullscreen;
122 void VVideoRec::preDelete()
124 timers->cancelTimer(this, 1);
125 timers->cancelTimer(this, 2);
129 boxstack->remove(vas);
133 if (vsummary) delete vsummary;
135 if (playing) stopPlay();
138 VVideoRec::~VVideoRec()
140 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Entering vvideorec destructor");
142 video->setDefaultAspect();
144 // kill recInfo in case resumePoint has changed (likely)
145 myRec->dropRecInfo();
146 // FIXME - do this properly - save the resume point back to the server manually and update
147 // rec->recInfo->resumePoint - this will fix the ~10s offset problem as well
149 OsdVector* osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
152 osdv->updateBackgroundColor(DrawStyle::WALLPAPER);
156 void VVideoRec::go(bool resume)
160 startFrameNum = myRec->recInfo->resumePoint;
164 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Starting stream: %s at frame: %lu", myRec->getFileName(), startFrameNum);
165 ULONG lengthFrames = 0;
167 ULLONG lengthBytes = vdr->streamRecording(myRec->getFileName(), &lengthFrames, &isPesRecording);
168 myRec->IsPesRecording = isPesRecording;
171 player->setLengthBytes(lengthBytes);
172 player->setLengthFrames(lengthFrames);
173 player->setStartFrame(startFrameNum);
180 stopPlay(); // clean up
182 if (!vdr->isConnected())
184 Control::getInstance()->connectionLost();
188 Message* m = new Message();
189 m->message = Message::CLOSE_ME;
191 m->p_to = Message::BOXSTACK;
192 MessageQueue::getInstance()->postMessage(m);
194 VInfo* vi = new VInfo();
195 vi->setSize(360, 200);
197 if (Video::getInstance()->getFormat() == Video::PAL)
198 vi->setPosition(190, 170);
200 vi->setPosition(180, 120);
201 vi->setOneLiner(tr("Error playing recording"));
204 vi->setTitleBarColour(DrawStyle::DANGER);
209 m->message = Message::ADD_VIEW;
210 m->p_to = Message::BOXSTACK;
211 m->data = reinterpret_cast<void*>(vi);
212 MessageQueue::getInstance()->postMessage(m);
216 int VVideoRec::handleCommand(int command)
228 case Input::PLAYPAUSE:
247 if (playing) stopPlay();
258 case Input::SKIPFORWARD:
261 player->skipForward(60);
264 case Input::SKIPBACK:
267 player->skipBackward(60);
273 player->fastForward();
280 player->fastBackward();
286 if (vsummary) removeSummary();
297 if (myRec->hasMarks())
299 // skip to previous mark
300 Log* logger = Log::getInstance();
301 int currentFrame = (player->getCurrentFrameNum()); // get current Frame
302 currentFrame -= (int)(5. * myRec->recInfo->fps); // subtrack 5 seconds, else you cannot skip more than once back ..
304 int prevMark = myRec->getPrevMark(currentFrame); // find previous Frame
307 logger->log("VVideoRec", Log::NOTICE, "jump back from pos %i to mark at %i",currentFrame,prevMark);
308 player->jumpToMark(prevMark);
315 player->skipBackward(10);
321 if (myRec->hasMarks())
324 Log* logger = Log::getInstance();
325 int currentFrame = (player->getCurrentFrameNum());
327 int nextMark = myRec->getNextMark(currentFrame);
331 logger->log("VVideoRec", Log::NOTICE, "jump forward from pos %i to mark at %i",currentFrame,nextMark);
332 player->jumpToMark(nextMark);
339 player->skipForward(10);
343 case Input::PREVCHANNEL:
345 player->skipBackward(2);
351 player->skipBackward(10);
357 player->skipForward(10);
375 if (barShowing) removeBar();
380 case Input::ZERO: player->jumpToPercent(0); doBar(0); return 2;
381 case Input::ONE: player->jumpToPercent(10); doBar(0); return 2;
382 case Input::TWO: player->jumpToPercent(20); doBar(0); return 2;
383 case Input::THREE: player->jumpToPercent(30); doBar(0); return 2;
384 case Input::FOUR: player->jumpToPercent(40); doBar(0); return 2;
385 case Input::FIVE: player->jumpToPercent(50); doBar(0); return 2;
386 case Input::SIX: player->jumpToPercent(60); doBar(0); return 2;
387 case Input::SEVEN: player->jumpToPercent(70); doBar(0); return 2;
388 case Input::EIGHT: player->jumpToPercent(80); doBar(0); return 2;
389 case Input::NINE: player->jumpToPercent(90); doBar(0); return 2;
391 case Input::RECORD: player->toggleSubtitles(); return 2;
395 //Don't use RED for anything. It will eventually be recording summary
401 // for testing EPG in NTSC with a NTSC test video
402 Video::getInstance()->setMode(Video::QUARTER);
403 Video::getInstance()->setPosition(170, 5);
404 VEpg* vepg = new VEpg(NULL, 0);
406 BoxStack::getInstance()->add(vepg);
407 BoxStack::getInstance()->update(vepg);
420 void VVideoRec::doTeletext()
427 VTeletextView *vtxv=player->getTeletextDecoder()->getTeletxtView();
429 vtxv= new VTeletextView((player)->getTeletextDecoder(),this,NULL);
430 (player)->getTeletextDecoder()->registerTeletextView(vtxv);
433 vtxv->setSubtitleMode(true);
438 BoxStack::getInstance()->add(vtxv);
440 BoxStack::getInstance()->update(this);
441 BoxStack::getInstance()->update(vtxv);
444 void VVideoRec::processMessage(Message* m)
446 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Message received");
448 if (m->message == Message::MOUSE_LBDOWN)
450 UINT x = (m->parameter>>16) - getScreenX();
451 UINT y = (m->parameter&0xFFFF) - getScreenY();
455 BoxStack::getInstance()->handleCommand(Input::OK); //simulate rok press
457 else if (barRegion.x<=x && barRegion.y<=y && (barRegion.x+barRegion.w)>=x && (barRegion.y+barRegion.h)>=y)
459 int progBarXbase = barRegion.x + 300;
460 if (myRec->hasMarks())
462 MarkList* markList = myRec->getMarkList();
463 MarkList::iterator i;
464 Mark* loopMark = NULL;
467 if (myRec->recInfo->timerEnd > time(NULL))
470 // Work out an approximate length in frames (good to 1s...)
471 lengthFrames = (ULONG)((double)(myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
475 lengthFrames = player->getLengthFrames();
477 for(i = markList->begin(); i != markList->end(); i++)
482 posPix = 302 * loopMark->pos / lengthFrames;
483 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 3, 28, DrawStyle::DANGER);
484 if (x>=barRegion.x + progBarXbase + 2 + posPix
485 && x<=barRegion.x + progBarXbase + 2 + posPix+3
486 && y>=barRegion.y + 12 - 2
487 && y<=barRegion.y + 12 - 2+28)
489 player->jumpToMark(loopMark->pos);
497 if (x>=barRegion.x + progBarXbase + 24
498 && x<=barRegion.x + progBarXbase + 4 + 302
499 && y>=barRegion.y + 12 - 2
500 && y<=barRegion.y + 12 - 2+28)
502 int cx=x-(barRegion.x + progBarXbase + 4);
503 double percent=((double)cx)/302.*100.;
504 player->jumpToPercent(percent);
507 // int progressWidth = 302 * currentFrameNum / lengthFrames;
508 // rectangle(barRegion.x + progBarXbase + 4, barRegion.y + 16, progressWidth, 16, DrawStyle::SELECTHIGHLIGHT);
513 BoxStack::getInstance()->handleCommand(Input::OK); //simulate rok press
516 else if (m->from == player)
518 if (m->message != Message::PLAYER_EVENT) return;
521 case PlayerVideoRec::CONNECTION_LOST: // connection lost detected
523 // I can't handle this, send it to control
524 Message* m2 = new Message();
525 m2->p_to = Message::CONTROL;
526 m2->message = Message::CONNECTION_LOST;
527 MessageQueue::getInstance()->postMessage(m2);
530 case PlayerVideoRec::STOP_PLAYBACK:
532 // FIXME Obselete ish - improve this
533 Message* m2 = new Message(); // Must be done after this thread finishes, and must break into master mutex
534 m2->p_to = Message::CONTROL;
535 m2->message = Message::STOP_PLAYBACK;
536 MessageQueue::getInstance()->postMessage(m2);
539 case PlayerVideoRec::ASPECT43:
543 case PlayerVideoRec::ASPECT169:
549 else if (m->message == Message::AUDIO_CHANGE_CHANNEL)
551 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received change audio channel to %i", m->parameter);
552 player->setAudioChannel(m->parameter&0xFFFF,(m->parameter&0xFF0000)>> 16,(m->parameter&0xFF000000)>> 24 );
554 else if (m->message == Message::SUBTITLE_CHANGE_CHANNEL)
556 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received change subtitle channel to %i", m->parameter);
557 int type=((m->parameter & 0xFF0000)>>16);
559 case 0x10: { //dvbsubtitle
560 player->setSubtitleChannel((m->parameter & 0xFFFF));
561 player->turnSubtitlesOn(true);
562 VTeletextView *vtxt = player->getTeletextDecoder()->getTeletxtView();
563 if (vtxt && vtxt->isInSubtitleMode()) {
564 BoxStack::getInstance()->remove(vtxt);
567 case 0xFF: { //nosubtitles
569 player->turnSubtitlesOn(false);
570 VTeletextView *vtxt = player->getTeletextDecoder()->getTeletxtView();
571 if (vtxt && vtxt->isInSubtitleMode()) {
572 BoxStack::getInstance()->remove(vtxt);
576 case 0x11: { //videotext
577 player->turnSubtitlesOn(false);
579 player->getTeletextDecoder()->setPage((m->parameter & 0xFFFF));
583 BoxStack::getInstance()->update(vas);
585 BoxStack::getInstance()->update(this);
589 else if (m->message == Message::CHILD_CLOSE)
595 if (!barGenHold && !barScanHold && !barVasHold) removeBar();
600 void VVideoRec::stopPlay()
602 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Pre stopPlay");
605 Log::getInstance()->log("VVideoRec", Log::DEBUG, "1");
607 Log::getInstance()->log("VVideoRec", Log::DEBUG, "2");
608 vdr->stopStreaming();
609 Log::getInstance()->log("VVideoRec", Log::DEBUG, "3");
614 if (!vdr->isConnected()) { Control::getInstance()->connectionLost(); return; }
615 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Post stopPlay");
618 void VVideoRec::toggleChopSides()
620 if (video->getTVsize() == Video::ASPECT16X9) return; // Means nothing for 16:9 TVs
622 if (videoMode == Video::NORMAL)
624 videoMode = Video::LETTERBOX;
625 video->setMode(Video::LETTERBOX);
629 videoMode = Video::NORMAL;
630 video->setMode(Video::NORMAL);
634 void VVideoRec::doAudioSelector()
636 int subtitleChannel=player->getCurrentSubtitleChannel();
637 int subtitleType=0x10;
638 if (!(player)->isSubtitlesOn()) {
639 if ((player)->getTeletextDecoder()->getTeletxtView() &&
640 (player)->getTeletextDecoder()->getTeletxtView()->isInSubtitleMode()
642 subtitleChannel=(player)->getTeletextDecoder()->getPage();
646 subtitleType=0xFF; //turnedOff
650 if (player->isPesRecording()) {
651 bool* availableMpegAudioChannels = player->getDemuxerMpegAudioChannels();
652 bool* availableAc3AudioChannels = NULL;
653 bool* availableSubtitleChannels = player->getDemuxerSubtitleChannels();
654 int *availableTTxtpages = player->getTeletxtSubtitlePages();
655 int currentAudioChannel = player->getCurrentAudioChannel();
656 if (Audio::getInstance()->supportsAc3())
658 availableAc3AudioChannels = player->getDemuxerAc3AudioChannels();
661 vas = new VAudioSelector(this, availableMpegAudioChannels, availableAc3AudioChannels, currentAudioChannel,availableSubtitleChannels, availableTTxtpages,
662 subtitleChannel, subtitleType, myRec->recInfo);
665 Channel *temp_channel=player->getDemuxerChannel();
666 // RecInfo *cur_info= myRec->recInfo;
667 /* unsigned char numchan_recinfo = cur_info->numComponents;
668 unsigned char numchan_subtitles_siz = temp_channel.numSPids;
669 ULONG mp_audcounter = 0;
670 ULONG ac3_counter = 0;
671 int dvb_subcounter = 1;*/
674 /*unsigned char type;
677 for (i = 0; i < numchan_recinfo; i++)
680 type = cur_info->types[i];
681 lang = cur_info->languages[i];
682 description = cur_info->descriptions[i];
685 if (cur_info->streams[i] == 2) {
688 case 1: //mpaudio mono
689 case 3: //mpaudio stereo
690 if (mp_audcounter < temp_channel.numAPids) ac = &temp_channel.apids[mp_audcounter];
695 if (ac3_counter < temp_channel.numDPids) ac = &temp_channel.dpids[ac3_counter];
699 } else if (cur_info->streams[i] == 3){
700 if (dvb_subcounter < numchan_subtitles_siz) ac = &temp_channel.spids[dvb_subcounter];
701 } else continue; //neither audio nor subtitle
704 if (description && (strlen(description) > 0))
706 ac->name = new char[strlen(description) + 1];
707 strcpy(ac->name, description);
709 } else if (lang && strlen(lang) > 0)
711 ac->name = new char[strlen(lang) + 1];
712 strcpy(ac->name, lang);
717 for (i=0;i<temp_channel->numAPids;i++) {
718 apid *ac=&temp_channel->apids[i];
719 if (ac->desc[0]==0) {
720 strncpy(ac->desc, tr("unknown"),9);
723 for (i=0;i<temp_channel->numDPids;i++) {
724 apid *ac=&temp_channel->dpids[i];
725 if (ac->desc[0]==0) {
726 strncpy(ac->desc, tr("unknown"),9);
729 for (i=0;i<temp_channel->numSPids;i++) {
730 apid *ac=&temp_channel->spids[i];
731 if (ac->desc[0]==0) {
732 strncpy(ac->desc, tr("unknown"),9);
736 vas = new VAudioSelector(this,temp_channel , (player)->getCurrentAudioChannel(),
737 subtitleType,subtitleChannel,player->getTeletxtSubtitlePages());
738 /* for (i=0;i<temp_channel.numAPids;i++) {
739 apid *ac=&temp_channel.apids[i];
743 for (i=0;i<temp_channel.numDPids;i++) {
744 apid *ac=&temp_channel.dpids[i];
748 for (i=0;i<temp_channel.numSPids;i++) {
749 apid *ac=&temp_channel.spids[i];
756 vas->setBackgroundColour(barBlue);
757 vas->setPosition(0, barRegion.y - 120);
766 boxstack->update(vas);
769 void VVideoRec::doBar(int action_in)
771 // if (player->isSubtitlesOn()) clearOSD(); // remove dvbsubtitles
772 // player->tellSubtitlesOSDVisible(true);
775 int action = action_in;
783 rectangle(barRegion, barBlue);
785 /* Work out what to display - choices:
792 Specials, informed by parameter
804 w.setPosition(barRegion.x + 66, barRegion.y + 16);
806 UCHAR playerState = 0;
810 if (action == 1) w.nextSymbol = WSymbol::SKIPFORWARD;
811 else if (action == 2) w.nextSymbol = WSymbol::SKIPBACK;
812 else if (action == 3) w.nextSymbol = WSymbol::SKIPFORWARD2;
813 else if (action == 4) w.nextSymbol = WSymbol::SKIPBACK2;
817 playerState = player->getState();
818 if (playerState == PlayerVideoRec::S_PAUSE_P) w.nextSymbol = WSymbol::PAUSE;
819 else if (playerState == PlayerVideoRec::S_PAUSE_I) w.nextSymbol = WSymbol::PAUSE;
820 else if (playerState == PlayerVideoRec::S_FFWD) w.nextSymbol = WSymbol::FFWD;
821 else if (playerState == PlayerVideoRec::S_FBWD) w.nextSymbol = WSymbol::FBWD;
822 else w.nextSymbol = WSymbol::PLAY;
827 if ((playerState == PlayerVideoRec::S_FFWD) || (playerState == PlayerVideoRec::S_FBWD))
829 // draw blips to show how fast the scan is
830 UCHAR scanrate = player->getIScanRate();
834 SNPRINTF(text, 5, "%ux", scanrate);
835 drawText(text, barRegion.x + 102, barRegion.y + 12, DrawStyle::LIGHTTEXT);
841 boxstack->update(this, &barRegion);
845 timers->cancelTimer(this, 1);
847 if ((playerState == PlayerVideoRec::S_FFWD) || (playerState == PlayerVideoRec::S_FBWD))
852 if (!barGenHold && !barScanHold && !barVasHold)
853 timers->setTimerD(this, 1, 4);
855 Log::getInstance()->log("VVideoRec", Log::DEBUG, "player state: %i", playerState);
857 if ((playerState == PlayerVideoRec::S_PAUSE_P) || (playerState == PlayerVideoRec::S_PAUSE_I))
858 timers->cancelTimer(this, 2);
860 timers->setTimerD(this, 2, 0, 200000000);
864 void VVideoRec::timercall(int clientReference)
866 switch(clientReference)
877 if (!barShowing) break;
878 #ifndef GRADIENT_DRAWING
880 boxstack->update(this, &barRegion);
884 timers->setTimerD(this, 2, 0, 200000000);
890 void VVideoRec::drawBarClocks()
894 UCHAR playerState = player->getState();
895 // sticky bar is set if we are in ffwd/fbwd mode
896 // if player has gone to S_PLAY then kill stickyBar, and run doBar(0) which
897 // will repaint all the bar (it will call this function again, but
898 // this section won't run because stickyBarF will then == false)
900 if ((playerState != PlayerVideoRec::S_FFWD) && (playerState != PlayerVideoRec::S_FBWD))
904 return; // doBar will call this function and do the rest
908 Log* logger = Log::getInstance();
909 logger->log("VVideoRec", Log::DEBUG, "Draw bar clocks");
912 // Blank the area first
913 #ifndef GRADIENT_DRAWING
914 rectangle(barRegion.x + 624, barRegion.y + 12, 60, 30, barBlue);
920 LOCALTIME_R(&t, &tms);
921 strftime(timeString, 19, "%H:%M", &tms);
922 drawText(timeString, barRegion.x + 624, barRegion.y + 12, DrawStyle::LIGHTTEXT);
925 #ifndef GRADIENT_DRAWING
926 rectangle(clocksRegion, barBlue);
929 ULONG currentFrameNum = player->getCurrentFrameNum();
931 if (myRec->recInfo->timerEnd > time(NULL))
934 // Work out an approximate length in frames (good to 1s...)
935 lengthFrames =(ULONG) ((double)(myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
939 lengthFrames = player->getLengthFrames();
942 hmsf currentFrameHMSF = myRec->recInfo->framesToHMSF(currentFrameNum);
943 hmsf lengthHMSF = myRec->recInfo->framesToHMSF(lengthFrames);
946 if (currentFrameNum >= lengthFrames)
948 strcpy(buffer, "-:--:-- / -:--:--");
952 SNPRINTF(buffer, 99, "%01i:%02i:%02i / %01i:%02i:%02i", currentFrameHMSF.hours, currentFrameHMSF.minutes, currentFrameHMSF.seconds, lengthHMSF.hours, lengthHMSF.minutes, lengthHMSF.seconds);
953 logger->log("VVideoRec", Log::DEBUG, buffer);
956 drawText(buffer, clocksRegion.x, clocksRegion.y, DrawStyle::LIGHTTEXT);
965 int progBarXbase = barRegion.x + 300;
967 rectangle(barRegion.x + progBarXbase, barRegion.y + 12, 310, 24, DrawStyle::LIGHTTEXT);
968 rectangle(barRegion.x + progBarXbase + 2, barRegion.y + 14, 306, 20, barBlue);
970 if (currentFrameNum > lengthFrames) return;
971 if (lengthFrames == 0) return;
973 // Draw yellow portion
974 int progressWidth = 302 * currentFrameNum / lengthFrames;
975 rectangle(barRegion.x + progBarXbase + 4, barRegion.y + 16, progressWidth, 16, DrawStyle::SELECTHIGHLIGHT);
977 if (myRec->recInfo->timerEnd > time(NULL)) // if chasing
979 int nrWidth = (int)(302 * ((double)(lengthFrames - player->getLengthFrames()) / lengthFrames));
981 Log::getInstance()->log("GVASDF", Log::DEBUG, "Length Frames: %lu", lengthFrames);
982 Log::getInstance()->log("GVASDF", Log::DEBUG, "Player lf: %lu", player->getLengthFrames());
983 Log::getInstance()->log("GVASDF", Log::DEBUG, "NR WDITH: %i", nrWidth);
984 rectangle(barRegion.x + progBarXbase + 4 + 302 - nrWidth, barRegion.y + 16, nrWidth, 16, DrawStyle::RED);
988 // Now calc position for blips
990 if (myRec->hasMarks())
992 // Draw blips where there are cut marks
993 MarkList* markList = myRec->getMarkList();
994 MarkList::iterator i;
995 Mark* loopMark = NULL;
997 for(i = markList->begin(); i != markList->end(); i++)
1002 logger->log("VVideoRec", Log::DEBUG, "Drawing mark at frame %i", loopMark->pos);
1003 posPix = 302 * loopMark->pos / lengthFrames;
1004 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 3, 28, DrawStyle::DANGER);
1010 // Draw blips where start and end margins probably are
1012 posPix =(int) (302. * myRec->recInfo->fps * ((double)startMargin) /((double) lengthFrames));
1014 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
1015 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
1017 posPix = (int)(302. * ((double)lengthFrames - ((double)endMargin) * myRec->recInfo->fps) / ((double)lengthFrames));
1019 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
1020 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
1024 void VVideoRec::removeBar()
1026 if (!barShowing) return;
1027 timers->cancelTimer(this, 2);
1030 barScanHold = false;
1032 rectangle(barRegion, transparent);
1033 boxstack->update(this, &barRegion);
1034 player->tellSubtitlesOSDVisible(false);
1037 void VVideoRec::doSummary()
1039 clearOSD(); // remove dvbsubtitles
1040 player->tellSubtitlesOSDVisible(true);
1041 vsummary = new VInfo();
1042 vsummary->setTitleText(myRec->getProgName());
1043 vsummary->setBorderOn(1);
1044 vsummary->setExitable();
1045 if (myRec->recInfo->summary) vsummary->setMainText(myRec->recInfo->summary);
1046 else vsummary->setMainText(tr("Summary unavailable"));
1047 if (Video::getInstance()->getFormat() == Video::PAL)
1049 vsummary->setPosition(120, 130);
1053 vsummary->setPosition(110, 90);
1055 vsummary->setSize(510, 270);
1059 BoxStack::getInstance()->update(this);
1062 void VVideoRec::removeSummary()
1070 BoxStack::getInstance()->update(this);
1071 player->tellSubtitlesOSDVisible(false);
1075 void VVideoRec::drawOSDBitmap(UINT posX, UINT posY, const Bitmap& bm, const DisplayRegion& region)
1077 drawBitmap(posX, posY, bm, region);
1079 r.x = posX; r.y = posY; r.w = bm.getWidth(); r.h = bm.getHeight();
1080 boxstack->update(this, &r);
1083 void VVideoRec::clearOSD()
1085 rectangle(area, transparent);
1086 boxstack->update(this, &area);
1089 void VVideoRec::clearOSDArea(UINT posX, UINT posY, UINT width, UINT height, const DisplayRegion& region)
1092 r.x = posX+region.windowx; r.y = posY+region.windowy; r.w = width; r.h = height;
1093 //now convert to our display
1094 float scalex=720.f/((float) (region.framewidth+1));
1095 float scaley=576.f/((float) (region.frameheight+1));
1096 r.x=(UINT)floor(scalex*((float)r.x));
1097 r.y=(UINT)floor(scaley*((float)r.y));
1098 r.w=(UINT)(ceil(scalex*((float)r.w))+1.f);
1099 r.h=(UINT)(ceil(scaley*((float)r.h))+1.f);
1101 rectangle(r, transparent);
1102 boxstack->update(this, &r);