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 OsdVector* osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
99 osdv->updateBackgroundColor(DrawStyle::BLACK);
103 barRegion.y = video->getScreenHeight() - 58; // FIXME, need to be - 1? and below?
104 barRegion.w = video->getScreenWidth();
107 clocksRegion.x = barRegion.x + 140;
108 clocksRegion.y = barRegion.y + 12;
109 clocksRegion.w = 170;
110 clocksRegion.h = getFontHeight();
111 // barBlue.set(0, 0, 150, 150);
112 barBlue.set(0, 0, 0, 128);
120 char* optionWSS = vdr->configLoad("General", "WSS");
123 if (strstr(optionWSS, "Yes")) dowss = true;
126 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Do WSS: %u", dowss);
130 wss.setFormat(video->getFormat());
136 wssRegion.w = video->getScreenWidth();
140 vdisplay.mode=Fullscreen;
141 vdisplay.fallbackMode=Fullscreen;
150 void VVideoRec::preDelete()
152 timers->cancelTimer(this, 1);
153 timers->cancelTimer(this, 2);
157 boxstack->remove(vas);
161 if (vsummary) delete vsummary;
163 if (playing) stopPlay();
166 VVideoRec::~VVideoRec()
168 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Entering vvideorec destructor");
170 video->setDefaultAspect();
172 // kill recInfo in case resumePoint has changed (likely)
173 myRec->dropRecInfo();
174 // FIXME - do this properly - save the resume point back to the server manually and update
175 // rec->recInfo->resumePoint - this will fix the ~10s offset problem as well
177 OsdVector* osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
180 osdv->updateBackgroundColor(DrawStyle::WALLPAPER);
184 void VVideoRec::go(bool resume)
188 startFrameNum = myRec->recInfo->resumePoint;
192 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Starting stream: %s at frame: %lu", myRec->getFileName(), startFrameNum);
193 ULONG lengthFrames = 0;
195 ULLONG lengthBytes = vdr->streamRecording(myRec->getFileName(), &lengthFrames, &isPesRecording);
196 myRec->IsPesRecording = isPesRecording;
199 player->setLengthBytes(lengthBytes);
200 player->setLengthFrames(lengthFrames);
201 player->setStartFrame(startFrameNum);
208 stopPlay(); // clean up
210 if (!vdr->isConnected())
212 Command::getInstance()->connectionLost();
216 Message* m = new Message();
217 m->message = Message::CLOSE_ME;
220 Command::getInstance()->postMessageNoLock(m);
222 VInfo* vi = new VInfo();
223 vi->setSize(400, 150);
225 if (video->getFormat() == Video::PAL)
226 vi->setPosition(170, 200);
228 vi->setPosition(160, 150);
231 vi->setTitleBarOn(0);
232 vi->setOneLiner(tr("Error playing recording"));
236 m->message = Message::ADD_VIEW;
238 m->parameter.num = (ULONG)vi;
239 Command::getInstance()->postMessageNoLock(m);
243 int VVideoRec::handleCommand(int command)
255 case Remote::PLAYPAUSE:
273 if (playing) stopPlay();
284 case Remote::SKIPFORWARD:
287 player->skipForward(60);
290 case Remote::SKIPBACK:
293 player->skipBackward(60);
297 case Remote::FORWARD:
299 player->fastForward();
304 case Remote::REVERSE:
306 player->fastBackward();
312 if (vsummary) removeSummary();
323 if (myRec->hasMarks())
325 // skip to previous mark
326 Log* logger = Log::getInstance();
327 int currentFrame = (player->getCurrentFrameNum()); // get current Frame
328 currentFrame -= 5. * myRec->recInfo->fps; // subtrack 5 seconds, else you cannot skip more than once back ..
330 int prevMark = myRec->getPrevMark(currentFrame); // find previous Frame
333 logger->log("VVideoRec", Log::NOTICE, "jump back from pos %i to mark at %i",currentFrame,prevMark);
334 player->jumpToMark(prevMark);
341 player->skipBackward(10);
347 if (myRec->hasMarks())
350 Log* logger = Log::getInstance();
351 int currentFrame = (player->getCurrentFrameNum());
353 int nextMark = myRec->getNextMark(currentFrame);
357 logger->log("VVideoRec", Log::NOTICE, "jump forward from pos %i to mark at %i",currentFrame,nextMark);
358 player->jumpToMark(nextMark);
365 player->skipForward(10);
372 player->skipBackward(10);
378 player->skipForward(10);
396 if (barShowing) removeBar();
401 case Remote::ZERO: player->jumpToPercent(0); doBar(0); return 2;
402 case Remote::ONE: player->jumpToPercent(10); doBar(0); return 2;
403 case Remote::TWO: player->jumpToPercent(20); doBar(0); return 2;
404 case Remote::THREE: player->jumpToPercent(30); doBar(0); return 2;
405 case Remote::FOUR: player->jumpToPercent(40); doBar(0); return 2;
406 case Remote::FIVE: player->jumpToPercent(50); doBar(0); return 2;
407 case Remote::SIX: player->jumpToPercent(60); doBar(0); return 2;
408 case Remote::SEVEN: player->jumpToPercent(70); doBar(0); return 2;
409 case Remote::EIGHT: player->jumpToPercent(80); doBar(0); return 2;
410 case Remote::NINE: player->jumpToPercent(90); doBar(0); return 2;
412 case Remote::RECORD: player->toggleSubtitles(); return 2;
416 //Don't use RED for anything. It will eventually be recording summary
422 // for testing EPG in NTSC with a NTSC test video
423 Video::getInstance()->setMode(Video::QUARTER);
424 Video::getInstance()->setPosition(170, 5);
425 VEpg* vepg = new VEpg(NULL, 0);
427 BoxStack::getInstance()->add(vepg);
428 BoxStack::getInstance()->update(vepg);
441 void VVideoRec::doTeletext()
448 VTeletextView *vtxv=player->getTeletextDecoder()->getTeletxtView();
450 vtxv= new VTeletextView((player)->getTeletextDecoder(),this,NULL);
451 (player)->getTeletextDecoder()->registerTeletextView(vtxv);
454 vtxv->setSubtitleMode(true);
459 BoxStack::getInstance()->add(vtxv);
461 BoxStack::getInstance()->update(this);
462 BoxStack::getInstance()->update(vtxv);
465 void VVideoRec::processMessage(Message* m)
467 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Message received");
469 if (m->message == Message::MOUSE_LBDOWN)
471 UINT x = (m->parameter.num>>16) - getScreenX();
472 UINT y = (m->parameter.num&0xFFFF) - getScreenY();
476 BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press
478 else if (barRegion.x<=x && barRegion.y<=y && (barRegion.x+barRegion.w)>=x && (barRegion.y+barRegion.h)>=y)
480 int progBarXbase = barRegion.x + 300;
481 if (myRec->hasMarks())
483 MarkList* markList = myRec->getMarkList();
484 MarkList::iterator i;
485 Mark* loopMark = NULL;
488 if (myRec->recInfo->timerEnd > time(NULL))
491 // Work out an approximate length in frames (good to 1s...)
492 lengthFrames = (ULONG)((double)(myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
496 lengthFrames = player->getLengthFrames();
498 for(i = markList->begin(); i != markList->end(); i++)
503 posPix = 302 * loopMark->pos / lengthFrames;
504 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 3, 28, DrawStyle::DANGER);
505 if (x>=barRegion.x + progBarXbase + 2 + posPix
506 && x<=barRegion.x + progBarXbase + 2 + posPix+3
507 && y>=barRegion.y + 12 - 2
508 && y<=barRegion.y + 12 - 2+28)
510 player->jumpToMark(loopMark->pos);
518 if (x>=barRegion.x + progBarXbase + 24
519 && x<=barRegion.x + progBarXbase + 4 + 302
520 && y>=barRegion.y + 12 - 2
521 && y<=barRegion.y + 12 - 2+28)
523 int cx=x-(barRegion.x + progBarXbase + 4);
524 double percent=((double)cx)/302.*100.;
525 player->jumpToPercent(percent);
528 // int progressWidth = 302 * currentFrameNum / lengthFrames;
529 // rectangle(barRegion.x + progBarXbase + 4, barRegion.y + 16, progressWidth, 16, DrawStyle::SELECTHIGHLIGHT);
534 BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press
537 else if (m->from == player)
539 if (m->message != Message::PLAYER_EVENT) return;
540 switch(m->parameter.num)
542 case Player::CONNECTION_LOST: // connection lost detected
544 // I can't handle this, send it to command
545 Message* m2 = new Message();
546 m2->to = Command::getInstance();
547 m2->message = Message::CONNECTION_LOST;
548 Command::getInstance()->postMessageNoLock(m2);
551 case Player::STOP_PLAYBACK:
553 // FIXME Obselete ish - improve this
554 Message* m2 = new Message(); // Must be done after this thread finishes, and must break into master mutex
555 m2->to = Command::getInstance();
556 m2->message = Message::STOP_PLAYBACK;
557 Command::getInstance()->postMessageNoLock(m2);
560 case Player::ASPECT43:
565 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 43");
568 boxstack->update(this, &wssRegion);
573 case Player::ASPECT169:
578 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received do WSS 169");
581 boxstack->update(this, &wssRegion);
588 else if (m->message == Message::AUDIO_CHANGE_CHANNEL)
590 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received change audio channel to %i", m->parameter.num);
591 player->setAudioChannel(m->parameter.num&0xFFFF,(m->parameter.num&0xFF0000)>> 16,(m->parameter.num&0xFF000000)>> 24 );
593 else if (m->message == Message::SUBTITLE_CHANGE_CHANNEL)
595 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received change subtitle channel to %i", m->parameter.num);
596 int type=((m->parameter.num & 0xFF0000)>>16);
598 case 0x10: { //dvbsubtitle
599 player->setSubtitleChannel((m->parameter.num & 0xFFFF));
600 player->turnSubtitlesOn(true);
601 VTeletextView *vtxt=((Player*)player)->getTeletextDecoder()->getTeletxtView();
602 if (vtxt && vtxt->isInSubtitleMode()) {
603 BoxStack::getInstance()->remove(vtxt);
606 case 0xFF: { //nosubtitles
608 player->turnSubtitlesOn(false);
609 VTeletextView *vtxt=((Player*)player)->getTeletextDecoder()->getTeletxtView();
610 if (vtxt && vtxt->isInSubtitleMode()) {
611 BoxStack::getInstance()->remove(vtxt);
615 case 0x11: { //videotext
616 player->turnSubtitlesOn(false);
618 ((Player*)player)->getTeletextDecoder()->setPage((m->parameter.num & 0xFFFF));
622 BoxStack::getInstance()->update(vas);
624 BoxStack::getInstance()->update(this);
628 else if (m->message == Message::CHILD_CLOSE)
634 if (!barGenHold && !barScanHold && !barVasHold) removeBar();
639 void VVideoRec::stopPlay()
641 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Pre stopPlay");
644 Log::getInstance()->log("VVideoRec", Log::DEBUG, "1");
646 Log::getInstance()->log("VVideoRec", Log::DEBUG, "2");
647 vdr->stopStreaming();
648 Log::getInstance()->log("VVideoRec", Log::DEBUG, "3");
653 if (!vdr->isConnected()) { Command::getInstance()->connectionLost(); return; }
654 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Post stopPlay");
657 void VVideoRec::toggleChopSides()
659 if (video->getTVsize() == Video::ASPECT16X9) return; // Means nothing for 16:9 TVs
661 if (videoMode == Video::NORMAL)
663 videoMode = Video::LETTERBOX;
664 video->setMode(Video::LETTERBOX);
668 videoMode = Video::NORMAL;
669 video->setMode(Video::NORMAL);
673 void VVideoRec::doAudioSelector()
675 int subtitleChannel=player->getCurrentSubtitleChannel();
676 int subtitleType=0x10;
677 if (!(player)->isSubtitlesOn()) {
678 if ((player)->getTeletextDecoder()->getTeletxtView() &&
679 (player)->getTeletextDecoder()->getTeletxtView()->isInSubtitleMode()
681 subtitleChannel=(player)->getTeletextDecoder()->getPage();
685 subtitleType=0xFF; //turnedOff
689 if (player->isPesRecording()) {
690 bool* availableMpegAudioChannels = player->getDemuxerMpegAudioChannels();
691 bool* availableAc3AudioChannels = NULL;
692 bool* availableSubtitleChannels = player->getDemuxerSubtitleChannels();
693 int *availableTTxtpages = player->getTeletxtSubtitlePages();
694 int currentAudioChannel = player->getCurrentAudioChannel();
695 if (Audio::getInstance()->supportsAc3())
697 availableAc3AudioChannels = player->getDemuxerAc3AudioChannels();
700 vas = new VAudioSelector(this, availableMpegAudioChannels, availableAc3AudioChannels, currentAudioChannel,availableSubtitleChannels, availableTTxtpages,
701 subtitleChannel, subtitleType, myRec->recInfo);
704 Channel *temp_channel=player->getDemuxerChannel();
705 // RecInfo *cur_info= myRec->recInfo;
706 /* unsigned char numchan_recinfo = cur_info->numComponents;
707 unsigned char numchan_subtitles_siz = temp_channel.numSPids;
708 ULONG mp_audcounter = 0;
709 ULONG ac3_counter = 0;
710 int dvb_subcounter = 1;*/
713 /*unsigned char type;
716 for (i = 0; i < numchan_recinfo; i++)
719 type = cur_info->types[i];
720 lang = cur_info->languages[i];
721 description = cur_info->descriptions[i];
724 if (cur_info->streams[i] == 2) {
727 case 1: //mpaudio mono
728 case 3: //mpaudio stereo
729 if (mp_audcounter < temp_channel.numAPids) ac = &temp_channel.apids[mp_audcounter];
734 if (ac3_counter < temp_channel.numDPids) ac = &temp_channel.dpids[ac3_counter];
738 } else if (cur_info->streams[i] == 3){
739 if (dvb_subcounter < numchan_subtitles_siz) ac = &temp_channel.spids[dvb_subcounter];
740 } else continue; //neither audio nor subtitle
743 if (description && (strlen(description) > 0))
745 ac->name = new char[strlen(description) + 1];
746 strcpy(ac->name, description);
748 } else if (lang && strlen(lang) > 0)
750 ac->name = new char[strlen(lang) + 1];
751 strcpy(ac->name, lang);
756 for (i=0;i<temp_channel->numAPids;i++) {
757 apid *ac=&temp_channel->apids[i];
758 if (ac->desc[0]==0) {
759 strncpy(ac->desc, tr("unknown"),9);
762 for (i=0;i<temp_channel->numDPids;i++) {
763 apid *ac=&temp_channel->dpids[i];
764 if (ac->desc[0]==0) {
765 strncpy(ac->desc, tr("unknown"),9);
768 for (i=0;i<temp_channel->numSPids;i++) {
769 apid *ac=&temp_channel->spids[i];
770 if (ac->desc[0]==0) {
771 strncpy(ac->desc, tr("unknown"),9);
775 vas = new VAudioSelector(this,temp_channel , (player)->getCurrentAudioChannel(),
776 subtitleType,subtitleChannel,player->getTeletxtSubtitlePages());
777 /* for (i=0;i<temp_channel.numAPids;i++) {
778 apid *ac=&temp_channel.apids[i];
782 for (i=0;i<temp_channel.numDPids;i++) {
783 apid *ac=&temp_channel.dpids[i];
787 for (i=0;i<temp_channel.numSPids;i++) {
788 apid *ac=&temp_channel.spids[i];
795 vas->setBackgroundColour(barBlue);
796 vas->setPosition(0, barRegion.y - 120);
805 boxstack->update(vas);
808 void VVideoRec::doBar(int action_in)
810 if (player->isSubtitlesOn()) clearOSD(); // remove dvbsubtitles
811 player->tellSubtitlesOSDVisible(true);
814 int action = action_in;
822 rectangle(barRegion, barBlue);
824 /* Work out what to display - choices:
831 Specials, informed by parameter
843 w.setPosition(barRegion.x + 66, barRegion.y + 16);
845 UCHAR playerState = 0;
849 if (action == 1) w.nextSymbol = WSymbol::SKIPFORWARD;
850 else if (action == 2) w.nextSymbol = WSymbol::SKIPBACK;
851 else if (action == 3) w.nextSymbol = WSymbol::SKIPFORWARD2;
852 else if (action == 4) w.nextSymbol = WSymbol::SKIPBACK2;
856 playerState = player->getState();
857 if (playerState == Player::S_PAUSE_P) w.nextSymbol = WSymbol::PAUSE;
858 else if (playerState == Player::S_PAUSE_I) w.nextSymbol = WSymbol::PAUSE;
859 else if (playerState == Player::S_FFWD) w.nextSymbol = WSymbol::FFWD;
860 else if (playerState == Player::S_FBWD) w.nextSymbol = WSymbol::FBWD;
861 else w.nextSymbol = WSymbol::PLAY;
866 if ((playerState == Player::S_FFWD) || (playerState == Player::S_FBWD))
868 // draw blips to show how fast the scan is
869 UCHAR scanrate = player->getIScanRate();
873 SNPRINTF(text, 5, "%ux", scanrate);
874 drawText(text, barRegion.x + 102, barRegion.y + 12, DrawStyle::LIGHTTEXT);
880 boxstack->update(this, &barRegion);
882 if (action_in != -1) {
883 timers->cancelTimer(this, 1);
886 if ((playerState == Player::S_FFWD) || (playerState == Player::S_FBWD)) barScanHold = true;
887 else barScanHold = false;
889 if (!barGenHold && !barScanHold && !barVasHold) timers->setTimerD(this, 1, 4);
891 timers->setTimerD(this, 2, 0, 200000000);
895 void VVideoRec::timercall(int clientReference)
897 switch(clientReference)
908 if (!barShowing) break;
909 #ifndef GRADIENT_DRAWING
911 boxstack->update(this, &barRegion);
915 timers->setTimerD(this, 2, 0, 200000000);
921 hmsf VVideoRec::framesToHMSF(ULONG frames)
926 double fps=myRec->recInfo->fps;
927 ret.frames= int(modf((frames + 0.5) / fps, &Seconds) * fps + 1);
928 int s = int(Seconds);
930 ret.minutes = s / 60 % 60;
931 ret.hours = s / 3600;
937 void VVideoRec::drawBarClocks()
941 UCHAR playerState = player->getState();
942 // sticky bar is set if we are in ffwd/fbwd mode
943 // if player has gone to S_PLAY then kill stickyBar, and run doBar(0) which
944 // will repaint all the bar (it will call this function again, but
945 // this section won't run because stickyBarF will then == false)
947 if ((playerState != Player::S_FFWD) && (playerState != Player::S_FBWD))
951 return; // doBar will call this function and do the rest
955 Log* logger = Log::getInstance();
956 logger->log("VVideoRec", Log::DEBUG, "Draw bar clocks");
959 // Blank the area first
960 #ifndef GRADIENT_DRAWING
961 rectangle(barRegion.x + 624, barRegion.y + 12, 60, 30, barBlue);
967 localtime_r(&t, &tms);
968 strftime(timeString, 19, "%H:%M", &tms);
969 drawText(timeString, barRegion.x + 624, barRegion.y + 12, DrawStyle::LIGHTTEXT);
972 #ifndef GRADIENT_DRAWING
973 rectangle(clocksRegion, barBlue);
976 ULONG currentFrameNum = player->getCurrentFrameNum();
978 if (myRec->recInfo->timerEnd > time(NULL))
981 // Work out an approximate length in frames (good to 1s...)
982 lengthFrames =(ULONG) ((double)(myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
986 lengthFrames = player->getLengthFrames();
989 hmsf currentFrameHMSF = framesToHMSF(currentFrameNum);
990 hmsf lengthHMSF = framesToHMSF(lengthFrames);
993 if (currentFrameNum >= lengthFrames)
995 strcpy(buffer, "-:--:-- / -:--:--");
999 SNPRINTF(buffer, 99, "%01i:%02i:%02i / %01i:%02i:%02i", currentFrameHMSF.hours, currentFrameHMSF.minutes, currentFrameHMSF.seconds, lengthHMSF.hours, lengthHMSF.minutes, lengthHMSF.seconds);
1000 logger->log("VVideoRec", Log::DEBUG, buffer);
1003 drawText(buffer, clocksRegion.x, clocksRegion.y, DrawStyle::LIGHTTEXT);
1011 // Draw progress bar
1012 int progBarXbase = barRegion.x + 300;
1014 rectangle(barRegion.x + progBarXbase, barRegion.y + 12, 310, 24, DrawStyle::LIGHTTEXT);
1015 rectangle(barRegion.x + progBarXbase + 2, barRegion.y + 14, 306, 20, barBlue);
1017 if (currentFrameNum > lengthFrames) return;
1018 if (lengthFrames == 0) return;
1020 // Draw yellow portion
1021 int progressWidth = 302 * currentFrameNum / lengthFrames;
1022 rectangle(barRegion.x + progBarXbase + 4, barRegion.y + 16, progressWidth, 16, DrawStyle::SELECTHIGHLIGHT);
1024 if (myRec->recInfo->timerEnd > time(NULL)) // if chasing
1026 int nrWidth = (int)(302 * ((double)(lengthFrames - player->getLengthFrames()) / lengthFrames));
1028 Log::getInstance()->log("GVASDF", Log::DEBUG, "Length Frames: %lu", lengthFrames);
1029 Log::getInstance()->log("GVASDF", Log::DEBUG, "Player lf: %lu", player->getLengthFrames());
1030 Log::getInstance()->log("GVASDF", Log::DEBUG, "NR WDITH: %i", nrWidth);
1031 rectangle(barRegion.x + progBarXbase + 4 + 302 - nrWidth, barRegion.y + 16, nrWidth, 16, DrawStyle::RED);
1035 // Now calc position for blips
1037 if (myRec->hasMarks())
1039 // Draw blips where there are cut marks
1040 MarkList* markList = myRec->getMarkList();
1041 MarkList::iterator i;
1042 Mark* loopMark = NULL;
1044 for(i = markList->begin(); i != markList->end(); i++)
1049 logger->log("VVideoRec", Log::DEBUG, "Drawing mark at frame %i", loopMark->pos);
1050 posPix = 302 * loopMark->pos / lengthFrames;
1051 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 3, 28, DrawStyle::DANGER);
1057 // Draw blips where start and end margins probably are
1059 posPix =(int) (302. * myRec->recInfo->fps * ((double)startMargin) /((double) lengthFrames));
1061 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
1062 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
1064 posPix = (int)(302. * ((double)lengthFrames - ((double)endMargin) * myRec->recInfo->fps) / ((double)lengthFrames));
1066 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
1067 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
1071 void VVideoRec::removeBar()
1073 if (!barShowing) return;
1074 timers->cancelTimer(this, 2);
1077 barScanHold = false;
1079 rectangle(barRegion, transparent);
1080 boxstack->update(this, &barRegion);
1081 player->tellSubtitlesOSDVisible(false);
1084 void VVideoRec::doSummary()
1086 clearOSD(); // remove dvbsubtitles
1087 player->tellSubtitlesOSDVisible(true);
1088 vsummary = new VInfo();
1089 vsummary->setTitleText(myRec->getProgName());
1090 vsummary->setBorderOn(1);
1091 vsummary->setExitable();
1092 if (myRec->recInfo->summary) vsummary->setMainText(myRec->recInfo->summary);
1093 else vsummary->setMainText(tr("Summary unavailable"));
1094 if (Video::getInstance()->getFormat() == Video::PAL)
1096 vsummary->setPosition(120, 130);
1100 vsummary->setPosition(110, 90);
1102 vsummary->setSize(510, 270);
1106 BoxStack::getInstance()->update(this);
1109 void VVideoRec::removeSummary()
1117 BoxStack::getInstance()->update(this);
1118 player->tellSubtitlesOSDVisible(false);
1122 void VVideoRec::drawOSDBitmap(UINT posX, UINT posY, const Bitmap& bm, const DisplayRegion& region)
1124 drawBitmap(posX, posY, bm, region);
1126 r.x = posX; r.y = posY; r.w = bm.getWidth(); r.h = bm.getHeight();
1127 boxstack->update(this, &r);
1130 void VVideoRec::clearOSD()
1132 rectangle(area, transparent);
1133 boxstack->update(this, &area);
1136 void VVideoRec::clearOSDArea(UINT posX, UINT posY, UINT width, UINT height, const DisplayRegion& region)
1139 r.x = posX+region.windowx; r.y = posY+region.windowy; r.w = width; r.h = height;
1140 //now convert to our display
1141 float scalex=720.f/((float) (region.framewidth+1));
1142 float scaley=576.f/((float) (region.frameheight+1));
1143 r.x=floor(scalex*((float)r.x));
1144 r.y=floor(scaley*((float)r.y));
1145 r.w=ceil(scalex*((float)r.w))+1.f;
1146 r.h=ceil(scaley*((float)r.h))+1.f;
1148 rectangle(r, transparent);
1149 boxstack->update(this, &r);