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);
96 #ifndef VOMP_PLATTFORM_MVP
98 OsdVector* osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
101 osdv->updateBackgroundColor(DrawStyle::BLACK);
106 barRegion.y = video->getScreenHeight() - 58; // FIXME, need to be - 1? and below?
107 barRegion.w = video->getScreenWidth();
110 clocksRegion.x = barRegion.x + 140;
111 clocksRegion.y = barRegion.y + 12;
112 clocksRegion.w = 170;
113 clocksRegion.h = getFontHeight();
114 // barBlue.set(0, 0, 150, 150);
115 barBlue.set(0, 0, 0, 128);
123 char* optionWSS = vdr->configLoad("General", "WSS");
126 if (strstr(optionWSS, "Yes")) dowss = true;
129 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Do WSS: %u", dowss);
133 wss.setFormat(video->getFormat());
139 wssRegion.w = video->getScreenWidth();
143 vdisplay.mode=Fullscreen;
144 vdisplay.fallbackMode=Fullscreen;
153 void VVideoRec::preDelete()
155 timers->cancelTimer(this, 1);
156 timers->cancelTimer(this, 2);
160 boxstack->remove(vas);
164 if (vsummary) delete vsummary;
166 if (playing) stopPlay();
169 VVideoRec::~VVideoRec()
171 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Entering vvideorec destructor");
173 video->setDefaultAspect();
175 // kill recInfo in case resumePoint has changed (likely)
176 myRec->dropRecInfo();
177 // FIXME - do this properly - save the resume point back to the server manually and update
178 // rec->recInfo->resumePoint - this will fix the ~10s offset problem as well
180 #ifndef VOMP_PLATTFORM_MVP
182 OsdVector* osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
185 osdv->updateBackgroundColor(DrawStyle::WALLPAPER);
190 void VVideoRec::go(bool resume)
194 startFrameNum = myRec->recInfo->resumePoint;
198 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Starting stream: %s at frame: %lu", myRec->getFileName(), startFrameNum);
199 ULONG lengthFrames = 0;
201 ULLONG lengthBytes = vdr->streamRecording(myRec->getFileName(), &lengthFrames, &isPesRecording);
202 myRec->IsPesRecording = isPesRecording;
205 player->setLengthBytes(lengthBytes);
206 player->setLengthFrames(lengthFrames);
207 player->setStartFrame(startFrameNum);
214 stopPlay(); // clean up
216 if (!vdr->isConnected())
218 Command::getInstance()->connectionLost();
222 Message* m = new Message();
223 m->message = Message::CLOSE_ME;
226 Command::getInstance()->postMessageNoLock(m);
228 VInfo* vi = new VInfo();
229 vi->setSize(400, 150);
231 if (video->getFormat() == Video::PAL)
232 vi->setPosition(170, 200);
234 vi->setPosition(160, 150);
237 vi->setTitleBarOn(0);
238 vi->setOneLiner(tr("Error playing recording"));
242 m->message = Message::ADD_VIEW;
244 m->parameter.num = (ULONG)vi;
245 Command::getInstance()->postMessageNoLock(m);
249 int VVideoRec::handleCommand(int command)
261 case Remote::PLAYPAUSE:
279 if (playing) stopPlay();
290 case Remote::SKIPFORWARD:
293 player->skipForward(60);
296 case Remote::SKIPBACK:
299 player->skipBackward(60);
303 case Remote::FORWARD:
305 player->fastForward();
310 case Remote::REVERSE:
312 player->fastBackward();
318 if (vsummary) removeSummary();
329 if (myRec->hasMarks())
331 // skip to previous mark
332 Log* logger = Log::getInstance();
333 int currentFrame = (player->getCurrentFrameNum()); // get current Frame
334 currentFrame -= 5. * myRec->recInfo->fps; // subtrack 5 seconds, else you cannot skip more than once back ..
336 int prevMark = myRec->getPrevMark(currentFrame); // find previous Frame
339 logger->log("VVideoRec", Log::NOTICE, "jump back from pos %i to mark at %i",currentFrame,prevMark);
340 player->jumpToMark(prevMark);
347 player->skipBackward(10);
353 if (myRec->hasMarks())
356 Log* logger = Log::getInstance();
357 int currentFrame = (player->getCurrentFrameNum());
359 int nextMark = myRec->getNextMark(currentFrame);
363 logger->log("VVideoRec", Log::NOTICE, "jump forward from pos %i to mark at %i",currentFrame,nextMark);
364 player->jumpToMark(nextMark);
371 player->skipForward(10);
378 player->skipBackward(10);
384 player->skipForward(10);
402 if (barShowing) removeBar();
407 case Remote::ZERO: player->jumpToPercent(0); doBar(0); return 2;
408 case Remote::ONE: player->jumpToPercent(10); doBar(0); return 2;
409 case Remote::TWO: player->jumpToPercent(20); doBar(0); return 2;
410 case Remote::THREE: player->jumpToPercent(30); doBar(0); return 2;
411 case Remote::FOUR: player->jumpToPercent(40); doBar(0); return 2;
412 case Remote::FIVE: player->jumpToPercent(50); doBar(0); return 2;
413 case Remote::SIX: player->jumpToPercent(60); doBar(0); return 2;
414 case Remote::SEVEN: player->jumpToPercent(70); doBar(0); return 2;
415 case Remote::EIGHT: player->jumpToPercent(80); doBar(0); return 2;
416 case Remote::NINE: player->jumpToPercent(90); doBar(0); return 2;
418 case Remote::RECORD: player->toggleSubtitles(); return 2;
422 //Don't use RED for anything. It will eventually be recording summary
428 // for testing EPG in NTSC with a NTSC test video
429 Video::getInstance()->setMode(Video::QUARTER);
430 Video::getInstance()->setPosition(170, 5);
431 VEpg* vepg = new VEpg(NULL, 0);
433 BoxStack::getInstance()->add(vepg);
434 BoxStack::getInstance()->update(vepg);
447 void VVideoRec::doTeletext()
454 VTeletextView *vtxv=player->getTeletextDecoder()->getTeletxtView();
456 vtxv= new VTeletextView((player)->getTeletextDecoder(),this,NULL);
457 (player)->getTeletextDecoder()->registerTeletextView(vtxv);
460 vtxv->setSubtitleMode(true);
465 BoxStack::getInstance()->add(vtxv);
467 BoxStack::getInstance()->update(this);
468 BoxStack::getInstance()->update(vtxv);
471 void VVideoRec::processMessage(Message* m)
473 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Message received");
475 if (m->message == Message::MOUSE_LBDOWN)
477 UINT x = (m->parameter.num>>16) - getScreenX();
478 UINT y = (m->parameter.num&0xFFFF) - getScreenY();
482 BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press
484 else if (barRegion.x<=x && barRegion.y<=y && (barRegion.x+barRegion.w)>=x && (barRegion.y+barRegion.h)>=y)
486 int progBarXbase = barRegion.x + 300;
487 if (myRec->hasMarks())
489 MarkList* markList = myRec->getMarkList();
490 MarkList::iterator i;
491 Mark* loopMark = NULL;
494 if (myRec->recInfo->timerEnd > time(NULL))
497 // Work out an approximate length in frames (good to 1s...)
498 lengthFrames = (ULONG)((double)(myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
502 lengthFrames = player->getLengthFrames();
504 for(i = markList->begin(); i != markList->end(); i++)
509 posPix = 302 * loopMark->pos / lengthFrames;
510 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 3, 28, DrawStyle::DANGER);
511 if (x>=barRegion.x + progBarXbase + 2 + posPix
512 && x<=barRegion.x + progBarXbase + 2 + posPix+3
513 && y>=barRegion.y + 12 - 2
514 && y<=barRegion.y + 12 - 2+28)
516 player->jumpToMark(loopMark->pos);
524 if (x>=barRegion.x + progBarXbase + 24
525 && x<=barRegion.x + progBarXbase + 4 + 302
526 && y>=barRegion.y + 12 - 2
527 && y<=barRegion.y + 12 - 2+28)
529 int cx=x-(barRegion.x + progBarXbase + 4);
530 double percent=((double)cx)/302.*100.;
531 player->jumpToPercent(percent);
534 // int progressWidth = 302 * currentFrameNum / lengthFrames;
535 // rectangle(barRegion.x + progBarXbase + 4, barRegion.y + 16, progressWidth, 16, DrawStyle::SELECTHIGHLIGHT);
540 BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press
543 else if (m->from == player)
545 if (m->message != Message::PLAYER_EVENT) return;
546 switch(m->parameter.num)
548 case Player::CONNECTION_LOST: // connection lost detected
550 // I can't handle this, send it to command
551 Message* m2 = new Message();
552 m2->to = Command::getInstance();
553 m2->message = Message::CONNECTION_LOST;
554 Command::getInstance()->postMessageNoLock(m2);
557 case Player::STOP_PLAYBACK:
559 // FIXME Obselete ish - improve this
560 Message* m2 = new Message(); // Must be done after this thread finishes, and must break into master mutex
561 m2->to = Command::getInstance();
562 m2->message = Message::STOP_PLAYBACK;
563 Command::getInstance()->postMessageNoLock(m2);
566 case Player::ASPECT43:
571 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 43");
574 boxstack->update(this, &wssRegion);
579 case Player::ASPECT169:
584 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 169");
587 boxstack->update(this, &wssRegion);
594 else if (m->message == Message::AUDIO_CHANGE_CHANNEL)
596 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received change audio channel to %i", m->parameter.num);
597 player->setAudioChannel(m->parameter.num&0xFFFF,(m->parameter.num&0xFF0000)>> 16,(m->parameter.num&0xFF000000)>> 24 );
599 else if (m->message == Message::SUBTITLE_CHANGE_CHANNEL)
601 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received change subtitle channel to %i", m->parameter.num);
602 int type=((m->parameter.num & 0xFF0000)>>16);
604 case 0x10: { //dvbsubtitle
605 player->setSubtitleChannel((m->parameter.num & 0xFFFF));
606 player->turnSubtitlesOn(true);
607 VTeletextView *vtxt=((Player*)player)->getTeletextDecoder()->getTeletxtView();
608 if (vtxt && vtxt->isInSubtitleMode()) {
609 BoxStack::getInstance()->remove(vtxt);
612 case 0xFF: { //nosubtitles
614 player->turnSubtitlesOn(false);
615 VTeletextView *vtxt=((Player*)player)->getTeletextDecoder()->getTeletxtView();
616 if (vtxt && vtxt->isInSubtitleMode()) {
617 BoxStack::getInstance()->remove(vtxt);
621 case 0x11: { //videotext
622 player->turnSubtitlesOn(false);
624 ((Player*)player)->getTeletextDecoder()->setPage((m->parameter.num & 0xFFFF));
628 BoxStack::getInstance()->update(vas);
630 BoxStack::getInstance()->update(this);
634 else if (m->message == Message::CHILD_CLOSE)
640 if (!barGenHold && !barScanHold && !barVasHold) removeBar();
645 void VVideoRec::stopPlay()
647 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Pre stopPlay");
650 Log::getInstance()->log("VVideoRec", Log::DEBUG, "1");
652 Log::getInstance()->log("VVideoRec", Log::DEBUG, "2");
653 vdr->stopStreaming();
654 Log::getInstance()->log("VVideoRec", Log::DEBUG, "3");
659 if (!vdr->isConnected()) { Command::getInstance()->connectionLost(); return; }
660 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Post stopPlay");
663 void VVideoRec::toggleChopSides()
665 if (video->getTVsize() == Video::ASPECT16X9) return; // Means nothing for 16:9 TVs
667 if (videoMode == Video::NORMAL)
669 videoMode = Video::LETTERBOX;
670 video->setMode(Video::LETTERBOX);
674 videoMode = Video::NORMAL;
675 video->setMode(Video::NORMAL);
679 void VVideoRec::doAudioSelector()
681 int subtitleChannel=player->getCurrentSubtitleChannel();
682 int subtitleType=0x10;
683 if (!(player)->isSubtitlesOn()) {
684 if ((player)->getTeletextDecoder()->getTeletxtView() &&
685 (player)->getTeletextDecoder()->getTeletxtView()->isInSubtitleMode()
687 subtitleChannel=(player)->getTeletextDecoder()->getPage();
691 subtitleType=0xFF; //turnedOff
695 if (player->isPesRecording()) {
696 bool* availableMpegAudioChannels = player->getDemuxerMpegAudioChannels();
697 bool* availableAc3AudioChannels = NULL;
698 bool* availableSubtitleChannels = player->getDemuxerSubtitleChannels();
699 int *availableTTxtpages = player->getTeletxtSubtitlePages();
700 int currentAudioChannel = player->getCurrentAudioChannel();
701 if (Audio::getInstance()->supportsAc3())
703 availableAc3AudioChannels = player->getDemuxerAc3AudioChannels();
706 vas = new VAudioSelector(this, availableMpegAudioChannels, availableAc3AudioChannels, currentAudioChannel,availableSubtitleChannels, availableTTxtpages,
707 subtitleChannel, subtitleType, myRec->recInfo);
710 Channel *temp_channel=player->getDemuxerChannel();
711 // RecInfo *cur_info= myRec->recInfo;
712 /* unsigned char numchan_recinfo = cur_info->numComponents;
713 unsigned char numchan_subtitles_siz = temp_channel.numSPids;
714 ULONG mp_audcounter = 0;
715 ULONG ac3_counter = 0;
716 int dvb_subcounter = 1;*/
719 /*unsigned char type;
722 for (i = 0; i < numchan_recinfo; i++)
725 type = cur_info->types[i];
726 lang = cur_info->languages[i];
727 description = cur_info->descriptions[i];
730 if (cur_info->streams[i] == 2) {
733 case 1: //mpaudio mono
734 case 3: //mpaudio stereo
735 if (mp_audcounter < temp_channel.numAPids) ac = &temp_channel.apids[mp_audcounter];
740 if (ac3_counter < temp_channel.numDPids) ac = &temp_channel.dpids[ac3_counter];
744 } else if (cur_info->streams[i] == 3){
745 if (dvb_subcounter < numchan_subtitles_siz) ac = &temp_channel.spids[dvb_subcounter];
746 } else continue; //neither audio nor subtitle
749 if (description && (strlen(description) > 0))
751 ac->name = new char[strlen(description) + 1];
752 strcpy(ac->name, description);
754 } else if (lang && strlen(lang) > 0)
756 ac->name = new char[strlen(lang) + 1];
757 strcpy(ac->name, lang);
762 for (i=0;i<temp_channel->numAPids;i++) {
763 apid *ac=&temp_channel->apids[i];
764 if (ac->desc[0]==0) {
765 strncpy(ac->desc, tr("unknown"),9);
768 for (i=0;i<temp_channel->numDPids;i++) {
769 apid *ac=&temp_channel->dpids[i];
770 if (ac->desc[0]==0) {
771 strncpy(ac->desc, tr("unknown"),9);
774 for (i=0;i<temp_channel->numSPids;i++) {
775 apid *ac=&temp_channel->spids[i];
776 if (ac->desc[0]==0) {
777 strncpy(ac->desc, tr("unknown"),9);
781 vas = new VAudioSelector(this,temp_channel , (player)->getCurrentAudioChannel(),
782 subtitleType,subtitleChannel,player->getTeletxtSubtitlePages());
783 /* for (i=0;i<temp_channel.numAPids;i++) {
784 apid *ac=&temp_channel.apids[i];
788 for (i=0;i<temp_channel.numDPids;i++) {
789 apid *ac=&temp_channel.dpids[i];
793 for (i=0;i<temp_channel.numSPids;i++) {
794 apid *ac=&temp_channel.spids[i];
801 vas->setBackgroundColour(barBlue);
802 vas->setPosition(0, barRegion.y - 120);
811 boxstack->update(vas);
814 void VVideoRec::doBar(int action_in)
816 if (player->isSubtitlesOn()) clearOSD(); // remove dvbsubtitles
817 player->tellSubtitlesOSDVisible(true);
820 int action = action_in;
828 rectangle(barRegion, barBlue);
830 /* Work out what to display - choices:
837 Specials, informed by parameter
849 w.setPosition(barRegion.x + 66, barRegion.y + 16);
851 UCHAR playerState = 0;
855 if (action == 1) w.nextSymbol = WSymbol::SKIPFORWARD;
856 else if (action == 2) w.nextSymbol = WSymbol::SKIPBACK;
857 else if (action == 3) w.nextSymbol = WSymbol::SKIPFORWARD2;
858 else if (action == 4) w.nextSymbol = WSymbol::SKIPBACK2;
862 playerState = player->getState();
863 if (playerState == Player::S_PAUSE_P) w.nextSymbol = WSymbol::PAUSE;
864 else if (playerState == Player::S_PAUSE_I) w.nextSymbol = WSymbol::PAUSE;
865 else if (playerState == Player::S_FFWD) w.nextSymbol = WSymbol::FFWD;
866 else if (playerState == Player::S_FBWD) w.nextSymbol = WSymbol::FBWD;
867 else w.nextSymbol = WSymbol::PLAY;
872 if ((playerState == Player::S_FFWD) || (playerState == Player::S_FBWD))
874 // draw blips to show how fast the scan is
875 UCHAR scanrate = player->getIScanRate();
879 SNPRINTF(text, 5, "%ux", scanrate);
880 drawText(text, barRegion.x + 102, barRegion.y + 12, DrawStyle::LIGHTTEXT);
886 boxstack->update(this, &barRegion);
888 if (action_in != -1) {
889 timers->cancelTimer(this, 1);
892 if ((playerState == Player::S_FFWD) || (playerState == Player::S_FBWD)) barScanHold = true;
893 else barScanHold = false;
895 if (!barGenHold && !barScanHold && !barVasHold) timers->setTimerD(this, 1, 4);
897 timers->setTimerD(this, 2, 0, 200000000);
901 void VVideoRec::timercall(int clientReference)
903 switch(clientReference)
914 if (!barShowing) break;
915 #ifndef GRADIENT_DRAWING
917 boxstack->update(this, &barRegion);
921 timers->setTimerD(this, 2, 0, 200000000);
927 hmsf VVideoRec::framesToHMSF(ULONG frames)
932 double fps=myRec->recInfo->fps;
933 ret.frames= int(modf((frames + 0.5) / fps, &Seconds) * fps + 1);
934 int s = int(Seconds);
936 ret.minutes = s / 60 % 60;
937 ret.hours = s / 3600;
943 void VVideoRec::drawBarClocks()
947 UCHAR playerState = player->getState();
948 // sticky bar is set if we are in ffwd/fbwd mode
949 // if player has gone to S_PLAY then kill stickyBar, and run doBar(0) which
950 // will repaint all the bar (it will call this function again, but
951 // this section won't run because stickyBarF will then == false)
953 if ((playerState != Player::S_FFWD) && (playerState != Player::S_FBWD))
957 return; // doBar will call this function and do the rest
961 Log* logger = Log::getInstance();
962 logger->log("VVideoRec", Log::DEBUG, "Draw bar clocks");
965 // Blank the area first
966 #ifndef GRADIENT_DRAWING
967 rectangle(barRegion.x + 624, barRegion.y + 12, 60, 30, barBlue);
973 localtime_r(&t, &tms);
974 strftime(timeString, 19, "%H:%M", &tms);
975 drawText(timeString, barRegion.x + 624, barRegion.y + 12, DrawStyle::LIGHTTEXT);
978 #ifndef GRADIENT_DRAWING
979 rectangle(clocksRegion, barBlue);
982 ULONG currentFrameNum = player->getCurrentFrameNum();
984 if (myRec->recInfo->timerEnd > time(NULL))
987 // Work out an approximate length in frames (good to 1s...)
988 lengthFrames =(ULONG) ((double)(myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
992 lengthFrames = player->getLengthFrames();
995 hmsf currentFrameHMSF = framesToHMSF(currentFrameNum);
996 hmsf lengthHMSF = framesToHMSF(lengthFrames);
999 if (currentFrameNum >= lengthFrames)
1001 strcpy(buffer, "-:--:-- / -:--:--");
1005 SNPRINTF(buffer, 99, "%01i:%02i:%02i / %01i:%02i:%02i", currentFrameHMSF.hours, currentFrameHMSF.minutes, currentFrameHMSF.seconds, lengthHMSF.hours, lengthHMSF.minutes, lengthHMSF.seconds);
1006 logger->log("VVideoRec", Log::DEBUG, buffer);
1009 drawText(buffer, clocksRegion.x, clocksRegion.y, DrawStyle::LIGHTTEXT);
1017 // Draw progress bar
1018 int progBarXbase = barRegion.x + 300;
1020 rectangle(barRegion.x + progBarXbase, barRegion.y + 12, 310, 24, DrawStyle::LIGHTTEXT);
1021 rectangle(barRegion.x + progBarXbase + 2, barRegion.y + 14, 306, 20, barBlue);
1023 if (currentFrameNum > lengthFrames) return;
1024 if (lengthFrames == 0) return;
1026 // Draw yellow portion
1027 int progressWidth = 302 * currentFrameNum / lengthFrames;
1028 rectangle(barRegion.x + progBarXbase + 4, barRegion.y + 16, progressWidth, 16, DrawStyle::SELECTHIGHLIGHT);
1030 if (myRec->recInfo->timerEnd > time(NULL)) // if chasing
1032 int nrWidth = (int)(302 * ((double)(lengthFrames - player->getLengthFrames()) / lengthFrames));
1034 Log::getInstance()->log("GVASDF", Log::DEBUG, "Length Frames: %lu", lengthFrames);
1035 Log::getInstance()->log("GVASDF", Log::DEBUG, "Player lf: %lu", player->getLengthFrames());
1036 Log::getInstance()->log("GVASDF", Log::DEBUG, "NR WDITH: %i", nrWidth);
1037 rectangle(barRegion.x + progBarXbase + 4 + 302 - nrWidth, barRegion.y + 16, nrWidth, 16, DrawStyle::RED);
1041 // Now calc position for blips
1043 if (myRec->hasMarks())
1045 // Draw blips where there are cut marks
1046 MarkList* markList = myRec->getMarkList();
1047 MarkList::iterator i;
1048 Mark* loopMark = NULL;
1050 for(i = markList->begin(); i != markList->end(); i++)
1055 logger->log("VVideoRec", Log::DEBUG, "Drawing mark at frame %i", loopMark->pos);
1056 posPix = 302 * loopMark->pos / lengthFrames;
1057 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 3, 28, DrawStyle::DANGER);
1063 // Draw blips where start and end margins probably are
1065 posPix =(int) (302. * myRec->recInfo->fps * ((double)startMargin) /((double) lengthFrames));
1067 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
1068 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
1070 posPix = (int)(302. * ((double)lengthFrames - ((double)endMargin) * myRec->recInfo->fps) / ((double)lengthFrames));
1072 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
1073 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
1077 void VVideoRec::removeBar()
1079 if (!barShowing) return;
1080 timers->cancelTimer(this, 2);
1083 barScanHold = false;
1085 rectangle(barRegion, transparent);
1086 boxstack->update(this, &barRegion);
1087 player->tellSubtitlesOSDVisible(false);
1090 void VVideoRec::doSummary()
1092 clearOSD(); // remove dvbsubtitles
1093 player->tellSubtitlesOSDVisible(true);
1094 vsummary = new VInfo();
1095 vsummary->setTitleText(myRec->getProgName());
1096 vsummary->setBorderOn(1);
1097 vsummary->setExitable();
1098 if (myRec->recInfo->summary) vsummary->setMainText(myRec->recInfo->summary);
1099 else vsummary->setMainText(tr("Summary unavailable"));
1100 if (Video::getInstance()->getFormat() == Video::PAL)
1102 vsummary->setPosition(120, 130);
1106 vsummary->setPosition(110, 90);
1108 vsummary->setSize(510, 270);
1112 BoxStack::getInstance()->update(this);
1115 void VVideoRec::removeSummary()
1123 BoxStack::getInstance()->update(this);
1124 player->tellSubtitlesOSDVisible(false);
1128 void VVideoRec::drawOSDBitmap(UINT posX, UINT posY, const Bitmap& bm, const DisplayRegion& region)
1130 drawBitmap(posX, posY, bm, region);
1132 r.x = posX; r.y = posY; r.w = bm.getWidth(); r.h = bm.getHeight();
1133 boxstack->update(this, &r);
1136 void VVideoRec::clearOSD()
1138 rectangle(area, transparent);
1139 boxstack->update(this, &area);
1142 void VVideoRec::clearOSDArea(UINT posX, UINT posY, UINT width, UINT height, const DisplayRegion& region)
1145 r.x = posX+region.windowx; r.y = posY+region.windowy; r.w = width; r.h = height;
1146 //now convert to our display
1147 float scalex=720.f/((float) (region.framewidth+1));
1148 float scaley=576.f/((float) (region.frameheight+1));
1149 r.x=floor(scalex*((float)r.x));
1150 r.y=floor(scaley*((float)r.y));
1151 r.w=ceil(scalex*((float)r.w))+1.f;
1152 r.h=ceil(scaley*((float)r.h))+1.f;
1154 rectangle(r, transparent);
1155 boxstack->update(this, &r);