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();
136 void VVideoRec::preDelete()
138 timers->cancelTimer(this, 1);
139 timers->cancelTimer(this, 2);
143 boxstack->remove(vas);
147 if (vsummary) delete vsummary;
149 if (playing) stopPlay();
152 VVideoRec::~VVideoRec()
154 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Entering vvideorec destructor");
156 video->setDefaultAspect();
158 // kill recInfo in case resumePoint has changed (likely)
159 myRec->dropRecInfo();
160 // FIXME - do this properly - save the resume point back to the server manually and update
161 // rec->recInfo->resumePoint - this will fix the ~10s offset problem as well
164 void VVideoRec::go(bool resume)
168 startFrameNum = myRec->recInfo->resumePoint;
172 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Starting stream: %s at frame: %lu", myRec->getFileName(), startFrameNum);
173 ULONG lengthFrames = 0;
175 ULLONG lengthBytes = vdr->streamRecording(myRec->getFileName(), &lengthFrames, &isPesRecording);
176 myRec->IsPesRecording = isPesRecording;
179 player->setLengthBytes(lengthBytes);
180 player->setLengthFrames(lengthFrames);
181 player->setStartFrame(startFrameNum);
188 stopPlay(); // clean up
190 if (!vdr->isConnected())
192 Command::getInstance()->connectionLost();
196 Message* m = new Message();
197 m->message = Message::CLOSE_ME;
200 Command::getInstance()->postMessageNoLock(m);
202 VInfo* vi = new VInfo();
203 vi->setSize(400, 150);
205 if (video->getFormat() == Video::PAL)
206 vi->setPosition(170, 200);
208 vi->setPosition(160, 150);
211 vi->setTitleBarOn(0);
212 vi->setOneLiner(tr("Error playing recording"));
216 m->message = Message::ADD_VIEW;
218 m->parameter = (ULONG)vi;
219 Command::getInstance()->postMessageNoLock(m);
223 int VVideoRec::handleCommand(int command)
235 case Remote::PLAYPAUSE:
253 if (playing) stopPlay();
264 case Remote::SKIPFORWARD:
267 player->skipForward(60);
270 case Remote::SKIPBACK:
273 player->skipBackward(60);
277 case Remote::FORWARD:
279 player->fastForward();
284 case Remote::REVERSE:
286 player->fastBackward();
292 if (vsummary) removeSummary();
303 if (myRec->hasMarks())
305 // skip to previous mark
306 Log* logger = Log::getInstance();
307 int currentFrame = (player->getCurrentFrameNum()); // get current Frame
308 currentFrame -= 5. * myRec->recInfo->fps; // subtrack 5 seconds, else you cannot skip more than once back ..
310 int prevMark = myRec->getPrevMark(currentFrame); // find previous Frame
313 logger->log("VVideoRec", Log::NOTICE, "jump back from pos %i to mark at %i",currentFrame,prevMark);
314 player->jumpToMark(prevMark);
321 player->skipBackward(10);
327 if (myRec->hasMarks())
330 Log* logger = Log::getInstance();
331 int currentFrame = (player->getCurrentFrameNum());
333 int nextMark = myRec->getNextMark(currentFrame);
337 logger->log("VVideoRec", Log::NOTICE, "jump forward from pos %i to mark at %i",currentFrame,nextMark);
338 player->jumpToMark(nextMark);
345 player->skipForward(10);
352 player->skipBackward(10);
358 player->skipForward(10);
376 if (barShowing) removeBar();
381 case Remote::ZERO: player->jumpToPercent(0); doBar(0); return 2;
382 case Remote::ONE: player->jumpToPercent(10); doBar(0); return 2;
383 case Remote::TWO: player->jumpToPercent(20); doBar(0); return 2;
384 case Remote::THREE: player->jumpToPercent(30); doBar(0); return 2;
385 case Remote::FOUR: player->jumpToPercent(40); doBar(0); return 2;
386 case Remote::FIVE: player->jumpToPercent(50); doBar(0); return 2;
387 case Remote::SIX: player->jumpToPercent(60); doBar(0); return 2;
388 case Remote::SEVEN: player->jumpToPercent(70); doBar(0); return 2;
389 case Remote::EIGHT: player->jumpToPercent(80); doBar(0); return 2;
390 case Remote::NINE: player->jumpToPercent(90); doBar(0); return 2;
392 case Remote::RECORD: player->toggleSubtitles(); return 2;
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);
421 void VVideoRec::doTeletext()
428 VTeletextView *vtxv=player->getTeletextDecoder()->getTeletxtView();
430 vtxv= new VTeletextView((player)->getTeletextDecoder(),this);
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 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Message received");
449 if (m->message == Message::MOUSE_LBDOWN)
451 UINT x = (m->parameter>>16) - getScreenX();
452 UINT y = (m->parameter&0xFFFF) - getScreenY();
456 BoxStack::getInstance()->handleCommand(Remote::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 = (ULONG)((double)(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=((double)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(Remote::OK); //simulate rok press
517 else if (m->from == player)
519 if (m->message != Message::PLAYER_EVENT) return;
522 case Player::CONNECTION_LOST: // connection lost detected
524 // I can't handle this, send it to command
525 Message* m2 = new Message();
526 m2->to = Command::getInstance();
527 m2->message = Message::CONNECTION_LOST;
528 Command::getInstance()->postMessageNoLock(m2);
531 case Player::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->to = Command::getInstance();
536 m2->message = Message::STOP_PLAYBACK;
537 Command::getInstance()->postMessageNoLock(m2);
540 case Player::ASPECT43:
545 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 43");
548 boxstack->update(this, &wssRegion);
553 case Player::ASPECT169:
558 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 169");
561 boxstack->update(this, &wssRegion);
568 else if (m->message == Message::AUDIO_CHANGE_CHANNEL)
570 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received change audio channel to %i", m->parameter);
571 player->setAudioChannel(m->parameter&0xFFFF,(m->parameter&0xFF0000)>> 16,(m->parameter&0xFF000000)>> 24 );
573 else if (m->message == Message::SUBTITLE_CHANGE_CHANNEL)
575 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received change subtitle channel to %i", m->parameter);
576 int type=((m->parameter & 0xFF0000)>>16);
578 case 0x10: { //dvbsubtitle
579 player->setSubtitleChannel((m->parameter & 0xFFFF));
580 player->turnSubtitlesOn(true);
581 VTeletextView *vtxt=((Player*)player)->getTeletextDecoder()->getTeletxtView();
582 if (vtxt && vtxt->isInSubtitleMode()) {
583 BoxStack::getInstance()->remove(vtxt);
586 case 0xFF: { //nosubtitles
588 player->turnSubtitlesOn(false);
589 VTeletextView *vtxt=((Player*)player)->getTeletextDecoder()->getTeletxtView();
590 if (vtxt && vtxt->isInSubtitleMode()) {
591 BoxStack::getInstance()->remove(vtxt);
595 case 0x11: { //videotext
596 player->turnSubtitlesOn(false);
598 ((Player*)player)->getTeletextDecoder()->setPage((m->parameter & 0xFFFF));
602 BoxStack::getInstance()->update(vas);
604 BoxStack::getInstance()->update(this);
608 else if (m->message == Message::CHILD_CLOSE)
614 if (!barGenHold && !barScanHold && !barVasHold) removeBar();
619 void VVideoRec::stopPlay()
621 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Pre stopPlay");
624 Log::getInstance()->log("VVideoRec", Log::DEBUG, "1");
626 Log::getInstance()->log("VVideoRec", Log::DEBUG, "2");
627 vdr->stopStreaming();
628 Log::getInstance()->log("VVideoRec", Log::DEBUG, "3");
633 if (!vdr->isConnected()) { Command::getInstance()->connectionLost(); return; }
634 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Post stopPlay");
637 void VVideoRec::toggleChopSides()
639 if (video->getTVsize() == Video::ASPECT16X9) return; // Means nothing for 16:9 TVs
641 if (videoMode == Video::NORMAL)
643 videoMode = Video::LETTERBOX;
644 video->setMode(Video::LETTERBOX);
648 videoMode = Video::NORMAL;
649 video->setMode(Video::NORMAL);
653 void VVideoRec::doAudioSelector()
655 int subtitleChannel=player->getCurrentSubtitleChannel();
656 int subtitleType=0x10;
657 if (!(player)->isSubtitlesOn()) {
658 if ((player)->getTeletextDecoder()->getTeletxtView() &&
659 (player)->getTeletextDecoder()->getTeletxtView()->isInSubtitleMode()
661 subtitleChannel=(player)->getTeletextDecoder()->getPage();
665 subtitleType=0xFF; //turnedOff
669 if (player->isPesRecording()) {
670 bool* availableMpegAudioChannels = player->getDemuxerMpegAudioChannels();
671 bool* availableAc3AudioChannels = NULL;
672 bool* availableSubtitleChannels = player->getDemuxerSubtitleChannels();
673 int *availableTTxtpages = player->getTeletxtSubtitlePages();
674 int currentAudioChannel = player->getCurrentAudioChannel();
675 if (Audio::getInstance()->supportsAc3())
677 availableAc3AudioChannels = player->getDemuxerAc3AudioChannels();
680 vas = new VAudioSelector(this, availableMpegAudioChannels, availableAc3AudioChannels, currentAudioChannel,availableSubtitleChannels, availableTTxtpages,
681 subtitleChannel, subtitleType, myRec->recInfo);
684 Channel *temp_channel=player->getDemuxerChannel();
685 // RecInfo *cur_info= myRec->recInfo;
686 /* unsigned char numchan_recinfo = cur_info->numComponents;
687 unsigned char numchan_subtitles_siz = temp_channel.numSPids;
688 ULONG mp_audcounter = 0;
689 ULONG ac3_counter = 0;
690 int dvb_subcounter = 1;*/
693 /*unsigned char type;
696 for (i = 0; i < numchan_recinfo; i++)
699 type = cur_info->types[i];
700 lang = cur_info->languages[i];
701 description = cur_info->descriptions[i];
704 if (cur_info->streams[i] == 2) {
707 case 1: //mpaudio mono
708 case 3: //mpaudio stereo
709 if (mp_audcounter < temp_channel.numAPids) ac = &temp_channel.apids[mp_audcounter];
714 if (ac3_counter < temp_channel.numDPids) ac = &temp_channel.dpids[ac3_counter];
718 } else if (cur_info->streams[i] == 3){
719 if (dvb_subcounter < numchan_subtitles_siz) ac = &temp_channel.spids[dvb_subcounter];
720 } else continue; //neither audio nor subtitle
723 if (description && (strlen(description) > 0))
725 ac->name = new char[strlen(description) + 1];
726 strcpy(ac->name, description);
728 } else if (lang && strlen(lang) > 0)
730 ac->name = new char[strlen(lang) + 1];
731 strcpy(ac->name, lang);
736 for (i=0;i<temp_channel->numAPids;i++) {
737 apid *ac=&temp_channel->apids[i];
738 if (ac->desc[0]==0) {
739 strncpy(ac->desc, tr("unknown"),9);
742 for (i=0;i<temp_channel->numDPids;i++) {
743 apid *ac=&temp_channel->dpids[i];
744 if (ac->desc[0]==0) {
745 strncpy(ac->desc, tr("unknown"),9);
748 for (i=0;i<temp_channel->numSPids;i++) {
749 apid *ac=&temp_channel->spids[i];
750 if (ac->desc[0]==0) {
751 strncpy(ac->desc, tr("unknown"),9);
755 vas = new VAudioSelector(this,temp_channel , (player)->getCurrentAudioChannel(),
756 subtitleType,subtitleChannel,player->getTeletxtSubtitlePages());
757 /* for (i=0;i<temp_channel.numAPids;i++) {
758 apid *ac=&temp_channel.apids[i];
762 for (i=0;i<temp_channel.numDPids;i++) {
763 apid *ac=&temp_channel.dpids[i];
767 for (i=0;i<temp_channel.numSPids;i++) {
768 apid *ac=&temp_channel.spids[i];
775 vas->setBackgroundColour(barBlue);
776 vas->setPosition(0, barRegion.y - 120);
785 boxstack->update(vas);
788 void VVideoRec::doBar(int action)
792 rectangle(barRegion, barBlue);
794 /* Work out what to display - choices:
801 Specials, informed by parameter
813 w.setPosition(barRegion.x + 66, barRegion.y + 16);
815 UCHAR playerState = 0;
819 if (action == 1) w.nextSymbol = WSymbol::SKIPFORWARD;
820 else if (action == 2) w.nextSymbol = WSymbol::SKIPBACK;
821 else if (action == 3) w.nextSymbol = WSymbol::SKIPFORWARD2;
822 else if (action == 4) w.nextSymbol = WSymbol::SKIPBACK2;
826 playerState = player->getState();
827 if (playerState == Player::S_PAUSE_P) w.nextSymbol = WSymbol::PAUSE;
828 else if (playerState == Player::S_PAUSE_I) w.nextSymbol = WSymbol::PAUSE;
829 else if (playerState == Player::S_FFWD) w.nextSymbol = WSymbol::FFWD;
830 else if (playerState == Player::S_FBWD) w.nextSymbol = WSymbol::FBWD;
831 else w.nextSymbol = WSymbol::PLAY;
836 if ((playerState == Player::S_FFWD) || (playerState == Player::S_FBWD))
838 // draw blips to show how fast the scan is
839 UCHAR scanrate = player->getIScanRate();
843 SNPRINTF(text, 5, "%ux", scanrate);
844 drawText(text, barRegion.x + 102, barRegion.y + 12, DrawStyle::LIGHTTEXT);
850 boxstack->update(this, &barRegion);
852 timers->cancelTimer(this, 1);
855 if ((playerState == Player::S_FFWD) || (playerState == Player::S_FBWD)) barScanHold = true;
856 else barScanHold = false;
858 if (!barGenHold && !barScanHold && !barVasHold) timers->setTimerD(this, 1, 4);
860 timers->setTimerD(this, 2, 0, 200000000);
863 void VVideoRec::timercall(int clientReference)
865 switch(clientReference)
876 if (!barShowing) break;
878 boxstack->update(this, &barRegion);
880 timers->setTimerD(this, 2, 0, 200000000);
886 hmsf VVideoRec::framesToHMSF(ULONG frames)
891 double fps=myRec->recInfo->fps;
892 ret.frames= int(modf((frames + 0.5) / fps, &Seconds) * fps + 1);
893 int s = int(Seconds);
895 ret.minutes = s / 60 % 60;
896 ret.hours = s / 3600;
902 void VVideoRec::drawBarClocks()
906 UCHAR playerState = player->getState();
907 // sticky bar is set if we are in ffwd/fbwd mode
908 // if player has gone to S_PLAY then kill stickyBar, and run doBar(0) which
909 // will repaint all the bar (it will call this function again, but
910 // this section won't run because stickyBarF will then == false)
912 if ((playerState != Player::S_FFWD) && (playerState != Player::S_FBWD))
916 return; // doBar will call this function and do the rest
920 Log* logger = Log::getInstance();
921 logger->log("VVideoRec", Log::DEBUG, "Draw bar clocks");
924 // Blank the area first
925 rectangle(barRegion.x + 624, barRegion.y + 12, 60, 30, barBlue);
929 struct tm* tms = localtime(&t);
930 strftime(timeString, 19, "%H:%M", tms);
931 drawText(timeString, barRegion.x + 624, barRegion.y + 12, DrawStyle::LIGHTTEXT);
935 rectangle(clocksRegion, barBlue);
937 ULONG currentFrameNum = player->getCurrentFrameNum();
939 if (myRec->recInfo->timerEnd > time(NULL))
942 // Work out an approximate length in frames (good to 1s...)
943 lengthFrames =(ULONG) ((double)(myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
947 lengthFrames = player->getLengthFrames();
950 hmsf currentFrameHMSF = framesToHMSF(currentFrameNum);
951 hmsf lengthHMSF = framesToHMSF(lengthFrames);
954 if (currentFrameNum >= lengthFrames)
956 strcpy(buffer, "-:--:-- / -:--:--");
960 SNPRINTF(buffer, 99, "%01i:%02i:%02i / %01i:%02i:%02i", currentFrameHMSF.hours, currentFrameHMSF.minutes, currentFrameHMSF.seconds, lengthHMSF.hours, lengthHMSF.minutes, lengthHMSF.seconds);
961 logger->log("VVideoRec", Log::DEBUG, buffer);
964 drawText(buffer, clocksRegion.x, clocksRegion.y, DrawStyle::LIGHTTEXT);
973 int progBarXbase = barRegion.x + 300;
975 rectangle(barRegion.x + progBarXbase, barRegion.y + 12, 310, 24, DrawStyle::LIGHTTEXT);
976 rectangle(barRegion.x + progBarXbase + 2, barRegion.y + 14, 306, 20, barBlue);
978 if (currentFrameNum > lengthFrames) return;
979 if (lengthFrames == 0) return;
981 // Draw yellow portion
982 int progressWidth = 302 * currentFrameNum / lengthFrames;
983 rectangle(barRegion.x + progBarXbase + 4, barRegion.y + 16, progressWidth, 16, DrawStyle::SELECTHIGHLIGHT);
985 if (myRec->recInfo->timerEnd > time(NULL)) // if chasing
987 int nrWidth = (int)(302 * ((double)(lengthFrames - player->getLengthFrames()) / lengthFrames));
989 Log::getInstance()->log("GVASDF", Log::DEBUG, "Length Frames: %lu", lengthFrames);
990 Log::getInstance()->log("GVASDF", Log::DEBUG, "Player lf: %lu", player->getLengthFrames());
991 Log::getInstance()->log("GVASDF", Log::DEBUG, "NR WDITH: %i", nrWidth);
992 rectangle(barRegion.x + progBarXbase + 4 + 302 - nrWidth, barRegion.y + 16, nrWidth, 16, DrawStyle::RED);
996 // Now calc position for blips
998 if (myRec->hasMarks())
1000 // Draw blips where there are cut marks
1001 MarkList* markList = myRec->getMarkList();
1002 MarkList::iterator i;
1003 Mark* loopMark = NULL;
1005 for(i = markList->begin(); i != markList->end(); i++)
1010 logger->log("VVideoRec", Log::DEBUG, "Drawing mark at frame %i", loopMark->pos);
1011 posPix = 302 * loopMark->pos / lengthFrames;
1012 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 3, 28, DrawStyle::DANGER);
1018 // Draw blips where start and end margins probably are
1020 posPix =(int) (302. * myRec->recInfo->fps * ((double)startMargin) /((double) lengthFrames));
1022 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
1023 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
1025 posPix = (int)(302. * ((double)lengthFrames - ((double)endMargin) * myRec->recInfo->fps) / ((double)lengthFrames));
1027 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
1028 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
1032 void VVideoRec::removeBar()
1034 if (!barShowing) return;
1035 timers->cancelTimer(this, 2);
1038 barScanHold = false;
1040 rectangle(barRegion, transparent);
1041 boxstack->update(this, &barRegion);
1044 void VVideoRec::doSummary()
1046 vsummary = new VInfo();
1047 vsummary->setTitleText(myRec->getProgName());
1048 vsummary->setBorderOn(1);
1049 vsummary->setExitable();
1050 if (myRec->recInfo->summary) vsummary->setMainText(myRec->recInfo->summary);
1051 else vsummary->setMainText(tr("Summary unavailable"));
1052 if (Video::getInstance()->getFormat() == Video::PAL)
1054 vsummary->setPosition(120, 130);
1058 vsummary->setPosition(110, 90);
1060 vsummary->setSize(510, 270);
1064 BoxStack::getInstance()->update(this);
1067 void VVideoRec::removeSummary()
1075 BoxStack::getInstance()->update(this);
1079 void VVideoRec::drawOSDBitmap(UINT posX, UINT posY, const Bitmap& bm, const DisplayRegion& region)
1081 drawBitmap(posX, posY, bm, region);
1083 r.x = posX; r.y = posY; r.w = bm.getWidth(); r.h = bm.getHeight();
1084 boxstack->update(this, &r);
1087 void VVideoRec::clearOSD()
1089 rectangle(area, transparent);
1090 boxstack->update(this, &area);
1093 void VVideoRec::clearOSDArea(UINT posX, UINT posY, UINT width, UINT height, const DisplayRegion& region)
1096 r.x = posX+region.windowx; r.y = posY+region.windowy; r.w = width; r.h = height;
1097 //now convert to our display
1098 float scalex=720.f/((float) (region.framewidth+1));
1099 float scaley=576.f/((float) (region.frameheight+1));
1100 r.x=floor(scalex*((float)r.x));
1101 r.y=floor(scaley*((float)r.y));
1102 r.w=ceil(scalex*((float)r.w));
1103 r.h=ceil(scaley*((float)r.h));
1105 rectangle(r, transparent);
1106 boxstack->update(this, &r);