2 Copyright 2004-2005 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, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #include "vvideorec.h"
24 #include "vteletextview.h"
34 #include "recording.h"
35 #include "vaudioselector.h"
46 VVideoRec::VVideoRec(Recording* rec, bool ish264)
48 boxstack = BoxStack::getInstance();
49 vdr = VDR::getInstance();
50 video = Video::getInstance();
51 timers = Timers::getInstance();
55 videoMode = video->getMode();
58 video->seth264mode(ish264);
60 player = new Player(Command::getInstance(), this, this);
61 player->init(myRec->IsPesRecording,myRec->recInfo->fps);
67 char* cstartMargin = vdr->configLoad("Timers", "Start margin");
68 char* cendMargin = vdr->configLoad("Timers", "End margin");
71 startMargin = 300; // 5 mins default
75 startMargin = atoi(cstartMargin) * 60;
76 delete[] cstartMargin;
81 endMargin = 300; // 5 mins default
85 endMargin = atoi(cendMargin) * 60;
89 Log::getInstance()->log("VVideoRec", Log::DEBUG, "SM: %u EM: %u", startMargin, endMargin);
91 setSize(video->getScreenWidth(), video->getScreenHeight());
93 transparent.set(0, 0, 0, 0);
94 setBackgroundColour(transparent);
97 barRegion.y = video->getScreenHeight() - 58; // FIXME, need to be - 1? and below?
98 barRegion.w = video->getScreenWidth();
101 clocksRegion.x = barRegion.x + 140;
102 clocksRegion.y = barRegion.y + 12;
103 clocksRegion.w = 170;
104 clocksRegion.h = getFontHeight();
105 // barBlue.set(0, 0, 150, 150);
106 barBlue.set(0, 0, 0, 128);
114 char* optionWSS = vdr->configLoad("General", "WSS");
117 if (strstr(optionWSS, "Yes")) dowss = true;
120 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Do WSS: %u", dowss);
124 wss.setFormat(video->getFormat());
130 wssRegion.w = video->getScreenWidth();
134 vdisplay.mode=Fullscreen;
135 vdisplay.fallbackMode=Fullscreen;
144 void VVideoRec::preDelete()
146 timers->cancelTimer(this, 1);
147 timers->cancelTimer(this, 2);
151 boxstack->remove(vas);
155 if (vsummary) delete vsummary;
157 if (playing) stopPlay();
160 VVideoRec::~VVideoRec()
162 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Entering vvideorec destructor");
164 video->setDefaultAspect();
166 // kill recInfo in case resumePoint has changed (likely)
167 myRec->dropRecInfo();
168 // FIXME - do this properly - save the resume point back to the server manually and update
169 // rec->recInfo->resumePoint - this will fix the ~10s offset problem as well
172 void VVideoRec::go(bool resume)
176 startFrameNum = myRec->recInfo->resumePoint;
180 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Starting stream: %s at frame: %lu", myRec->getFileName(), startFrameNum);
181 ULONG lengthFrames = 0;
183 ULLONG lengthBytes = vdr->streamRecording(myRec->getFileName(), &lengthFrames, &isPesRecording);
184 myRec->IsPesRecording = isPesRecording;
187 player->setLengthBytes(lengthBytes);
188 player->setLengthFrames(lengthFrames);
189 player->setStartFrame(startFrameNum);
196 stopPlay(); // clean up
198 if (!vdr->isConnected())
200 Command::getInstance()->connectionLost();
204 Message* m = new Message();
205 m->message = Message::CLOSE_ME;
208 Command::getInstance()->postMessageNoLock(m);
210 VInfo* vi = new VInfo();
211 vi->setSize(400, 150);
213 if (video->getFormat() == Video::PAL)
214 vi->setPosition(170, 200);
216 vi->setPosition(160, 150);
219 vi->setTitleBarOn(0);
220 vi->setOneLiner(tr("Error playing recording"));
224 m->message = Message::ADD_VIEW;
226 m->parameter.num = (ULONG)vi;
227 Command::getInstance()->postMessageNoLock(m);
231 int VVideoRec::handleCommand(int command)
243 case Remote::PLAYPAUSE:
261 if (playing) stopPlay();
272 case Remote::SKIPFORWARD:
275 player->skipForward(60);
278 case Remote::SKIPBACK:
281 player->skipBackward(60);
285 case Remote::FORWARD:
287 player->fastForward();
292 case Remote::REVERSE:
294 player->fastBackward();
300 if (vsummary) removeSummary();
311 if (myRec->hasMarks())
313 // skip to previous mark
314 Log* logger = Log::getInstance();
315 int currentFrame = (player->getCurrentFrameNum()); // get current Frame
316 currentFrame -= 5. * myRec->recInfo->fps; // subtrack 5 seconds, else you cannot skip more than once back ..
318 int prevMark = myRec->getPrevMark(currentFrame); // find previous Frame
321 logger->log("VVideoRec", Log::NOTICE, "jump back from pos %i to mark at %i",currentFrame,prevMark);
322 player->jumpToMark(prevMark);
329 player->skipBackward(10);
335 if (myRec->hasMarks())
338 Log* logger = Log::getInstance();
339 int currentFrame = (player->getCurrentFrameNum());
341 int nextMark = myRec->getNextMark(currentFrame);
345 logger->log("VVideoRec", Log::NOTICE, "jump forward from pos %i to mark at %i",currentFrame,nextMark);
346 player->jumpToMark(nextMark);
353 player->skipForward(10);
360 player->skipBackward(10);
366 player->skipForward(10);
384 if (barShowing) removeBar();
389 case Remote::ZERO: player->jumpToPercent(0); doBar(0); return 2;
390 case Remote::ONE: player->jumpToPercent(10); doBar(0); return 2;
391 case Remote::TWO: player->jumpToPercent(20); doBar(0); return 2;
392 case Remote::THREE: player->jumpToPercent(30); doBar(0); return 2;
393 case Remote::FOUR: player->jumpToPercent(40); doBar(0); return 2;
394 case Remote::FIVE: player->jumpToPercent(50); doBar(0); return 2;
395 case Remote::SIX: player->jumpToPercent(60); doBar(0); return 2;
396 case Remote::SEVEN: player->jumpToPercent(70); doBar(0); return 2;
397 case Remote::EIGHT: player->jumpToPercent(80); doBar(0); return 2;
398 case Remote::NINE: player->jumpToPercent(90); doBar(0); return 2;
400 case Remote::RECORD: player->toggleSubtitles(); return 2;
404 //Don't use RED for anything. It will eventually be recording summary
410 // for testing EPG in NTSC with a NTSC test video
411 Video::getInstance()->setMode(Video::QUARTER);
412 Video::getInstance()->setPosition(170, 5);
413 VEpg* vepg = new VEpg(NULL, 0);
415 BoxStack::getInstance()->add(vepg);
416 BoxStack::getInstance()->update(vepg);
429 void VVideoRec::doTeletext()
436 VTeletextView *vtxv=player->getTeletextDecoder()->getTeletxtView();
438 vtxv= new VTeletextView((player)->getTeletextDecoder(),this,NULL);
439 (player)->getTeletextDecoder()->registerTeletextView(vtxv);
442 vtxv->setSubtitleMode(true);
447 BoxStack::getInstance()->add(vtxv);
449 BoxStack::getInstance()->update(this);
450 BoxStack::getInstance()->update(vtxv);
453 void VVideoRec::processMessage(Message* m)
455 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Message received");
457 if (m->message == Message::MOUSE_LBDOWN)
459 UINT x = (m->parameter.num>>16) - getScreenX();
460 UINT y = (m->parameter.num&0xFFFF) - getScreenY();
464 BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press
466 else if (barRegion.x<=x && barRegion.y<=y && (barRegion.x+barRegion.w)>=x && (barRegion.y+barRegion.h)>=y)
468 int progBarXbase = barRegion.x + 300;
469 if (myRec->hasMarks())
471 MarkList* markList = myRec->getMarkList();
472 MarkList::iterator i;
473 Mark* loopMark = NULL;
476 if (myRec->recInfo->timerEnd > time(NULL))
479 // Work out an approximate length in frames (good to 1s...)
480 lengthFrames = (ULONG)((double)(myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
484 lengthFrames = player->getLengthFrames();
486 for(i = markList->begin(); i != markList->end(); i++)
491 posPix = 302 * loopMark->pos / lengthFrames;
492 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 3, 28, DrawStyle::DANGER);
493 if (x>=barRegion.x + progBarXbase + 2 + posPix
494 && x<=barRegion.x + progBarXbase + 2 + posPix+3
495 && y>=barRegion.y + 12 - 2
496 && y<=barRegion.y + 12 - 2+28)
498 player->jumpToMark(loopMark->pos);
506 if (x>=barRegion.x + progBarXbase + 24
507 && x<=barRegion.x + progBarXbase + 4 + 302
508 && y>=barRegion.y + 12 - 2
509 && y<=barRegion.y + 12 - 2+28)
511 int cx=x-(barRegion.x + progBarXbase + 4);
512 double percent=((double)cx)/302.*100.;
513 player->jumpToPercent(percent);
516 // int progressWidth = 302 * currentFrameNum / lengthFrames;
517 // rectangle(barRegion.x + progBarXbase + 4, barRegion.y + 16, progressWidth, 16, DrawStyle::SELECTHIGHLIGHT);
522 BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press
525 else if (m->from == player)
527 if (m->message != Message::PLAYER_EVENT) return;
528 switch(m->parameter.num)
530 case Player::CONNECTION_LOST: // connection lost detected
532 // I can't handle this, send it to command
533 Message* m2 = new Message();
534 m2->to = Command::getInstance();
535 m2->message = Message::CONNECTION_LOST;
536 Command::getInstance()->postMessageNoLock(m2);
539 case Player::STOP_PLAYBACK:
541 // FIXME Obselete ish - improve this
542 Message* m2 = new Message(); // Must be done after this thread finishes, and must break into master mutex
543 m2->to = Command::getInstance();
544 m2->message = Message::STOP_PLAYBACK;
545 Command::getInstance()->postMessageNoLock(m2);
548 case Player::ASPECT43:
553 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 43");
556 boxstack->update(this, &wssRegion);
561 case Player::ASPECT169:
566 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 169");
569 boxstack->update(this, &wssRegion);
576 else if (m->message == Message::AUDIO_CHANGE_CHANNEL)
578 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received change audio channel to %i", m->parameter.num);
579 player->setAudioChannel(m->parameter.num&0xFFFF,(m->parameter.num&0xFF0000)>> 16,(m->parameter.num&0xFF000000)>> 24 );
581 else if (m->message == Message::SUBTITLE_CHANGE_CHANNEL)
583 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received change subtitle channel to %i", m->parameter.num);
584 int type=((m->parameter.num & 0xFF0000)>>16);
586 case 0x10: { //dvbsubtitle
587 player->setSubtitleChannel((m->parameter.num & 0xFFFF));
588 player->turnSubtitlesOn(true);
589 VTeletextView *vtxt=((Player*)player)->getTeletextDecoder()->getTeletxtView();
590 if (vtxt && vtxt->isInSubtitleMode()) {
591 BoxStack::getInstance()->remove(vtxt);
594 case 0xFF: { //nosubtitles
596 player->turnSubtitlesOn(false);
597 VTeletextView *vtxt=((Player*)player)->getTeletextDecoder()->getTeletxtView();
598 if (vtxt && vtxt->isInSubtitleMode()) {
599 BoxStack::getInstance()->remove(vtxt);
603 case 0x11: { //videotext
604 player->turnSubtitlesOn(false);
606 ((Player*)player)->getTeletextDecoder()->setPage((m->parameter.num & 0xFFFF));
610 BoxStack::getInstance()->update(vas);
612 BoxStack::getInstance()->update(this);
616 else if (m->message == Message::CHILD_CLOSE)
622 if (!barGenHold && !barScanHold && !barVasHold) removeBar();
627 void VVideoRec::stopPlay()
629 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Pre stopPlay");
632 Log::getInstance()->log("VVideoRec", Log::DEBUG, "1");
634 Log::getInstance()->log("VVideoRec", Log::DEBUG, "2");
635 vdr->stopStreaming();
636 Log::getInstance()->log("VVideoRec", Log::DEBUG, "3");
641 if (!vdr->isConnected()) { Command::getInstance()->connectionLost(); return; }
642 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Post stopPlay");
645 void VVideoRec::toggleChopSides()
647 if (video->getTVsize() == Video::ASPECT16X9) return; // Means nothing for 16:9 TVs
649 if (videoMode == Video::NORMAL)
651 videoMode = Video::LETTERBOX;
652 video->setMode(Video::LETTERBOX);
656 videoMode = Video::NORMAL;
657 video->setMode(Video::NORMAL);
661 void VVideoRec::doAudioSelector()
663 int subtitleChannel=player->getCurrentSubtitleChannel();
664 int subtitleType=0x10;
665 if (!(player)->isSubtitlesOn()) {
666 if ((player)->getTeletextDecoder()->getTeletxtView() &&
667 (player)->getTeletextDecoder()->getTeletxtView()->isInSubtitleMode()
669 subtitleChannel=(player)->getTeletextDecoder()->getPage();
673 subtitleType=0xFF; //turnedOff
677 if (player->isPesRecording()) {
678 bool* availableMpegAudioChannels = player->getDemuxerMpegAudioChannels();
679 bool* availableAc3AudioChannels = NULL;
680 bool* availableSubtitleChannels = player->getDemuxerSubtitleChannels();
681 int *availableTTxtpages = player->getTeletxtSubtitlePages();
682 int currentAudioChannel = player->getCurrentAudioChannel();
683 if (Audio::getInstance()->supportsAc3())
685 availableAc3AudioChannels = player->getDemuxerAc3AudioChannels();
688 vas = new VAudioSelector(this, availableMpegAudioChannels, availableAc3AudioChannels, currentAudioChannel,availableSubtitleChannels, availableTTxtpages,
689 subtitleChannel, subtitleType, myRec->recInfo);
692 Channel *temp_channel=player->getDemuxerChannel();
693 // RecInfo *cur_info= myRec->recInfo;
694 /* unsigned char numchan_recinfo = cur_info->numComponents;
695 unsigned char numchan_subtitles_siz = temp_channel.numSPids;
696 ULONG mp_audcounter = 0;
697 ULONG ac3_counter = 0;
698 int dvb_subcounter = 1;*/
701 /*unsigned char type;
704 for (i = 0; i < numchan_recinfo; i++)
707 type = cur_info->types[i];
708 lang = cur_info->languages[i];
709 description = cur_info->descriptions[i];
712 if (cur_info->streams[i] == 2) {
715 case 1: //mpaudio mono
716 case 3: //mpaudio stereo
717 if (mp_audcounter < temp_channel.numAPids) ac = &temp_channel.apids[mp_audcounter];
722 if (ac3_counter < temp_channel.numDPids) ac = &temp_channel.dpids[ac3_counter];
726 } else if (cur_info->streams[i] == 3){
727 if (dvb_subcounter < numchan_subtitles_siz) ac = &temp_channel.spids[dvb_subcounter];
728 } else continue; //neither audio nor subtitle
731 if (description && (strlen(description) > 0))
733 ac->name = new char[strlen(description) + 1];
734 strcpy(ac->name, description);
736 } else if (lang && strlen(lang) > 0)
738 ac->name = new char[strlen(lang) + 1];
739 strcpy(ac->name, lang);
744 for (i=0;i<temp_channel->numAPids;i++) {
745 apid *ac=&temp_channel->apids[i];
746 if (ac->desc[0]==0) {
747 strncpy(ac->desc, tr("unknown"),9);
750 for (i=0;i<temp_channel->numDPids;i++) {
751 apid *ac=&temp_channel->dpids[i];
752 if (ac->desc[0]==0) {
753 strncpy(ac->desc, tr("unknown"),9);
756 for (i=0;i<temp_channel->numSPids;i++) {
757 apid *ac=&temp_channel->spids[i];
758 if (ac->desc[0]==0) {
759 strncpy(ac->desc, tr("unknown"),9);
763 vas = new VAudioSelector(this,temp_channel , (player)->getCurrentAudioChannel(),
764 subtitleType,subtitleChannel,player->getTeletxtSubtitlePages());
765 /* for (i=0;i<temp_channel.numAPids;i++) {
766 apid *ac=&temp_channel.apids[i];
770 for (i=0;i<temp_channel.numDPids;i++) {
771 apid *ac=&temp_channel.dpids[i];
775 for (i=0;i<temp_channel.numSPids;i++) {
776 apid *ac=&temp_channel.spids[i];
783 vas->setBackgroundColour(barBlue);
784 vas->setPosition(0, barRegion.y - 120);
793 boxstack->update(vas);
796 void VVideoRec::doBar(int action_in)
798 if (player->isSubtitlesOn()) clearOSD(); // remove dvbsubtitles
799 player->tellSubtitlesOSDVisible(true);
802 int action = action_in;
810 rectangle(barRegion, barBlue);
812 /* Work out what to display - choices:
819 Specials, informed by parameter
831 w.setPosition(barRegion.x + 66, barRegion.y + 16);
833 UCHAR playerState = 0;
837 if (action == 1) w.nextSymbol = WSymbol::SKIPFORWARD;
838 else if (action == 2) w.nextSymbol = WSymbol::SKIPBACK;
839 else if (action == 3) w.nextSymbol = WSymbol::SKIPFORWARD2;
840 else if (action == 4) w.nextSymbol = WSymbol::SKIPBACK2;
844 playerState = player->getState();
845 if (playerState == Player::S_PAUSE_P) w.nextSymbol = WSymbol::PAUSE;
846 else if (playerState == Player::S_PAUSE_I) w.nextSymbol = WSymbol::PAUSE;
847 else if (playerState == Player::S_FFWD) w.nextSymbol = WSymbol::FFWD;
848 else if (playerState == Player::S_FBWD) w.nextSymbol = WSymbol::FBWD;
849 else w.nextSymbol = WSymbol::PLAY;
854 if ((playerState == Player::S_FFWD) || (playerState == Player::S_FBWD))
856 // draw blips to show how fast the scan is
857 UCHAR scanrate = player->getIScanRate();
861 SNPRINTF(text, 5, "%ux", scanrate);
862 drawText(text, barRegion.x + 102, barRegion.y + 12, DrawStyle::LIGHTTEXT);
868 boxstack->update(this, &barRegion);
870 if (action_in != -1) {
871 timers->cancelTimer(this, 1);
874 if ((playerState == Player::S_FFWD) || (playerState == Player::S_FBWD)) barScanHold = true;
875 else barScanHold = false;
877 if (!barGenHold && !barScanHold && !barVasHold) timers->setTimerD(this, 1, 4);
879 timers->setTimerD(this, 2, 0, 200000000);
883 void VVideoRec::timercall(int clientReference)
885 switch(clientReference)
896 if (!barShowing) break;
897 #ifndef GRADIENT_DRAWING
899 boxstack->update(this, &barRegion);
903 timers->setTimerD(this, 2, 0, 200000000);
909 hmsf VVideoRec::framesToHMSF(ULONG frames)
914 double fps=myRec->recInfo->fps;
915 ret.frames= int(modf((frames + 0.5) / fps, &Seconds) * fps + 1);
916 int s = int(Seconds);
918 ret.minutes = s / 60 % 60;
919 ret.hours = s / 3600;
925 void VVideoRec::drawBarClocks()
929 UCHAR playerState = player->getState();
930 // sticky bar is set if we are in ffwd/fbwd mode
931 // if player has gone to S_PLAY then kill stickyBar, and run doBar(0) which
932 // will repaint all the bar (it will call this function again, but
933 // this section won't run because stickyBarF will then == false)
935 if ((playerState != Player::S_FFWD) && (playerState != Player::S_FBWD))
939 return; // doBar will call this function and do the rest
943 Log* logger = Log::getInstance();
944 logger->log("VVideoRec", Log::DEBUG, "Draw bar clocks");
947 // Blank the area first
948 #ifndef GRADIENT_DRAWING
949 rectangle(barRegion.x + 624, barRegion.y + 12, 60, 30, barBlue);
954 struct tm* tms = localtime(&t);
955 strftime(timeString, 19, "%H:%M", tms);
956 drawText(timeString, barRegion.x + 624, barRegion.y + 12, DrawStyle::LIGHTTEXT);
959 #ifndef GRADIENT_DRAWING
960 rectangle(clocksRegion, barBlue);
963 ULONG currentFrameNum = player->getCurrentFrameNum();
965 if (myRec->recInfo->timerEnd > time(NULL))
968 // Work out an approximate length in frames (good to 1s...)
969 lengthFrames =(ULONG) ((double)(myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
973 lengthFrames = player->getLengthFrames();
976 hmsf currentFrameHMSF = framesToHMSF(currentFrameNum);
977 hmsf lengthHMSF = framesToHMSF(lengthFrames);
980 if (currentFrameNum >= lengthFrames)
982 strcpy(buffer, "-:--:-- / -:--:--");
986 SNPRINTF(buffer, 99, "%01i:%02i:%02i / %01i:%02i:%02i", currentFrameHMSF.hours, currentFrameHMSF.minutes, currentFrameHMSF.seconds, lengthHMSF.hours, lengthHMSF.minutes, lengthHMSF.seconds);
987 logger->log("VVideoRec", Log::DEBUG, buffer);
990 drawText(buffer, clocksRegion.x, clocksRegion.y, DrawStyle::LIGHTTEXT);
999 int progBarXbase = barRegion.x + 300;
1001 rectangle(barRegion.x + progBarXbase, barRegion.y + 12, 310, 24, DrawStyle::LIGHTTEXT);
1002 rectangle(barRegion.x + progBarXbase + 2, barRegion.y + 14, 306, 20, barBlue);
1004 if (currentFrameNum > lengthFrames) return;
1005 if (lengthFrames == 0) return;
1007 // Draw yellow portion
1008 int progressWidth = 302 * currentFrameNum / lengthFrames;
1009 rectangle(barRegion.x + progBarXbase + 4, barRegion.y + 16, progressWidth, 16, DrawStyle::SELECTHIGHLIGHT);
1011 if (myRec->recInfo->timerEnd > time(NULL)) // if chasing
1013 int nrWidth = (int)(302 * ((double)(lengthFrames - player->getLengthFrames()) / lengthFrames));
1015 Log::getInstance()->log("GVASDF", Log::DEBUG, "Length Frames: %lu", lengthFrames);
1016 Log::getInstance()->log("GVASDF", Log::DEBUG, "Player lf: %lu", player->getLengthFrames());
1017 Log::getInstance()->log("GVASDF", Log::DEBUG, "NR WDITH: %i", nrWidth);
1018 rectangle(barRegion.x + progBarXbase + 4 + 302 - nrWidth, barRegion.y + 16, nrWidth, 16, DrawStyle::RED);
1022 // Now calc position for blips
1024 if (myRec->hasMarks())
1026 // Draw blips where there are cut marks
1027 MarkList* markList = myRec->getMarkList();
1028 MarkList::iterator i;
1029 Mark* loopMark = NULL;
1031 for(i = markList->begin(); i != markList->end(); i++)
1036 logger->log("VVideoRec", Log::DEBUG, "Drawing mark at frame %i", loopMark->pos);
1037 posPix = 302 * loopMark->pos / lengthFrames;
1038 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 3, 28, DrawStyle::DANGER);
1044 // Draw blips where start and end margins probably are
1046 posPix =(int) (302. * myRec->recInfo->fps * ((double)startMargin) /((double) lengthFrames));
1048 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
1049 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
1051 posPix = (int)(302. * ((double)lengthFrames - ((double)endMargin) * myRec->recInfo->fps) / ((double)lengthFrames));
1053 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
1054 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
1058 void VVideoRec::removeBar()
1060 if (!barShowing) return;
1061 timers->cancelTimer(this, 2);
1064 barScanHold = false;
1066 rectangle(barRegion, transparent);
1067 boxstack->update(this, &barRegion);
1068 player->tellSubtitlesOSDVisible(false);
1071 void VVideoRec::doSummary()
1073 clearOSD(); // remove dvbsubtitles
1074 player->tellSubtitlesOSDVisible(true);
1075 vsummary = new VInfo();
1076 vsummary->setTitleText(myRec->getProgName());
1077 vsummary->setBorderOn(1);
1078 vsummary->setExitable();
1079 if (myRec->recInfo->summary) vsummary->setMainText(myRec->recInfo->summary);
1080 else vsummary->setMainText(tr("Summary unavailable"));
1081 if (Video::getInstance()->getFormat() == Video::PAL)
1083 vsummary->setPosition(120, 130);
1087 vsummary->setPosition(110, 90);
1089 vsummary->setSize(510, 270);
1093 BoxStack::getInstance()->update(this);
1096 void VVideoRec::removeSummary()
1104 BoxStack::getInstance()->update(this);
1105 player->tellSubtitlesOSDVisible(false);
1109 void VVideoRec::drawOSDBitmap(UINT posX, UINT posY, const Bitmap& bm, const DisplayRegion& region)
1111 drawBitmap(posX, posY, bm, region);
1113 r.x = posX; r.y = posY; r.w = bm.getWidth(); r.h = bm.getHeight();
1114 boxstack->update(this, &r);
1117 void VVideoRec::clearOSD()
1119 rectangle(area, transparent);
1120 boxstack->update(this, &area);
1123 void VVideoRec::clearOSDArea(UINT posX, UINT posY, UINT width, UINT height, const DisplayRegion& region)
1126 r.x = posX+region.windowx; r.y = posY+region.windowy; r.w = width; r.h = height;
1127 //now convert to our display
1128 float scalex=720.f/((float) (region.framewidth+1));
1129 float scaley=576.f/((float) (region.frameheight+1));
1130 r.x=floor(scalex*((float)r.x));
1131 r.y=floor(scaley*((float)r.y));
1132 r.w=ceil(scalex*((float)r.w))+1.f;
1133 r.h=ceil(scaley*((float)r.h))+1.f;
1135 rectangle(r, transparent);
1136 boxstack->update(this, &r);