2 Copyright 2004-2019 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
31 #include "recording.h"
32 #include "vaudioselector.h"
42 #include "vteletextview.h"
43 #include "vvideorec.h"
45 VVideoRec::VVideoRec(Recording* rec, bool ish264)
47 boxstack = BoxStack::getInstance();
48 vdr = VDR::getInstance();
49 video = Video::getInstance();
50 timers = Timers::getInstance();
54 videoMode = video->getMode();
57 video->seth264mode(ish264);
59 player = new Player(Command::getInstance(), this, this);
60 player->init(myRec->IsPesRecording,myRec->recInfo->fps);
66 char* cstartMargin = vdr->configLoad("Timers", "Start margin");
67 char* cendMargin = vdr->configLoad("Timers", "End margin");
70 startMargin = 300; // 5 mins default
74 startMargin = atoi(cstartMargin) * 60;
75 delete[] cstartMargin;
80 endMargin = 300; // 5 mins default
84 endMargin = atoi(cendMargin) * 60;
88 Log::getInstance()->log("VVideoRec", Log::DEBUG, "SM: %u EM: %u", startMargin, endMargin);
90 setSize(video->getScreenWidth(), video->getScreenHeight());
92 transparent.set(0, 0, 0, 0);
93 setBackgroundColour(transparent);
95 OsdVector* osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
98 osdv->updateBackgroundColor(DrawStyle::BLACK);
102 barRegion.y = video->getScreenHeight() - 58; // FIXME, need to be - 1? and below?
103 barRegion.w = video->getScreenWidth();
106 clocksRegion.x = barRegion.x + 140;
107 clocksRegion.y = barRegion.y + 12;
108 clocksRegion.w = 170;
109 clocksRegion.h = getFontHeight();
110 // barBlue.set(0, 0, 150, 150);
111 barBlue.set(0, 0, 0, 128);
118 vdisplay.mode=Fullscreen;
119 vdisplay.fallbackMode=Fullscreen;
128 void VVideoRec::preDelete()
130 timers->cancelTimer(this, 1);
131 timers->cancelTimer(this, 2);
135 boxstack->remove(vas);
139 if (vsummary) delete vsummary;
141 if (playing) stopPlay();
144 VVideoRec::~VVideoRec()
146 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Entering vvideorec destructor");
148 video->setDefaultAspect();
150 // kill recInfo in case resumePoint has changed (likely)
151 myRec->dropRecInfo();
152 // FIXME - do this properly - save the resume point back to the server manually and update
153 // rec->recInfo->resumePoint - this will fix the ~10s offset problem as well
155 OsdVector* osdv=dynamic_cast<OsdVector*>(Osd::getInstance());
158 osdv->updateBackgroundColor(DrawStyle::WALLPAPER);
162 void VVideoRec::go(bool resume)
166 startFrameNum = myRec->recInfo->resumePoint;
170 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Starting stream: %s at frame: %lu", myRec->getFileName(), startFrameNum);
171 ULONG lengthFrames = 0;
173 ULLONG lengthBytes = vdr->streamRecording(myRec->getFileName(), &lengthFrames, &isPesRecording);
174 myRec->IsPesRecording = isPesRecording;
177 player->setLengthBytes(lengthBytes);
178 player->setLengthFrames(lengthFrames);
179 player->setStartFrame(startFrameNum);
186 stopPlay(); // clean up
188 if (!vdr->isConnected())
190 Command::getInstance()->connectionLost();
194 Message* m = new Message();
195 m->message = Message::CLOSE_ME;
198 Command::getInstance()->postMessageNoLock(m);
200 VInfo* vi = new VInfo();
201 vi->setSize(360, 200);
203 if (Video::getInstance()->getFormat() == Video::PAL)
204 vi->setPosition(190, 170);
206 vi->setPosition(180, 120);
207 vi->setOneLiner(tr("Error playing recording"));
210 vi->setTitleBarColour(DrawStyle::DANGER);
215 m->message = Message::ADD_VIEW;
217 m->parameter.num = (ULONG)vi;
218 Command::getInstance()->postMessageNoLock(m);
222 int VVideoRec::handleCommand(int command)
234 case Remote::PLAYPAUSE:
252 if (playing) stopPlay();
263 case Remote::SKIPFORWARD:
266 player->skipForward(60);
269 case Remote::SKIPBACK:
272 player->skipBackward(60);
276 case Remote::FORWARD:
278 player->fastForward();
283 case Remote::REVERSE:
285 player->fastBackward();
291 if (vsummary) removeSummary();
302 if (myRec->hasMarks())
304 // skip to previous mark
305 Log* logger = Log::getInstance();
306 int currentFrame = (player->getCurrentFrameNum()); // get current Frame
307 currentFrame -= (int)(5. * myRec->recInfo->fps); // subtrack 5 seconds, else you cannot skip more than once back ..
309 int prevMark = myRec->getPrevMark(currentFrame); // find previous Frame
312 logger->log("VVideoRec", Log::NOTICE, "jump back from pos %i to mark at %i",currentFrame,prevMark);
313 player->jumpToMark(prevMark);
320 player->skipBackward(10);
326 if (myRec->hasMarks())
329 Log* logger = Log::getInstance();
330 int currentFrame = (player->getCurrentFrameNum());
332 int nextMark = myRec->getNextMark(currentFrame);
336 logger->log("VVideoRec", Log::NOTICE, "jump forward from pos %i to mark at %i",currentFrame,nextMark);
337 player->jumpToMark(nextMark);
344 player->skipForward(10);
348 case Remote::PREVCHANNEL:
350 player->skipBackward(2);
356 player->skipBackward(10);
362 player->skipForward(10);
380 if (barShowing) removeBar();
385 case Remote::ZERO: player->jumpToPercent(0); doBar(0); return 2;
386 case Remote::ONE: player->jumpToPercent(10); doBar(0); return 2;
387 case Remote::TWO: player->jumpToPercent(20); doBar(0); return 2;
388 case Remote::THREE: player->jumpToPercent(30); doBar(0); return 2;
389 case Remote::FOUR: player->jumpToPercent(40); doBar(0); return 2;
390 case Remote::FIVE: player->jumpToPercent(50); doBar(0); return 2;
391 case Remote::SIX: player->jumpToPercent(60); doBar(0); return 2;
392 case Remote::SEVEN: player->jumpToPercent(70); doBar(0); return 2;
393 case Remote::EIGHT: player->jumpToPercent(80); doBar(0); return 2;
394 case Remote::NINE: player->jumpToPercent(90); doBar(0); return 2;
396 case Remote::RECORD: player->toggleSubtitles(); return 2;
400 //Don't use RED for anything. It will eventually be recording summary
406 // for testing EPG in NTSC with a NTSC test video
407 Video::getInstance()->setMode(Video::QUARTER);
408 Video::getInstance()->setPosition(170, 5);
409 VEpg* vepg = new VEpg(NULL, 0);
411 BoxStack::getInstance()->add(vepg);
412 BoxStack::getInstance()->update(vepg);
425 void VVideoRec::doTeletext()
432 VTeletextView *vtxv=player->getTeletextDecoder()->getTeletxtView();
434 vtxv= new VTeletextView((player)->getTeletextDecoder(),this,NULL);
435 (player)->getTeletextDecoder()->registerTeletextView(vtxv);
438 vtxv->setSubtitleMode(true);
443 BoxStack::getInstance()->add(vtxv);
445 BoxStack::getInstance()->update(this);
446 BoxStack::getInstance()->update(vtxv);
449 void VVideoRec::processMessage(Message* m)
451 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Message received");
453 if (m->message == Message::MOUSE_LBDOWN)
455 UINT x = (m->parameter.num>>16) - getScreenX();
456 UINT y = (m->parameter.num&0xFFFF) - getScreenY();
460 BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press
462 else if (barRegion.x<=x && barRegion.y<=y && (barRegion.x+barRegion.w)>=x && (barRegion.y+barRegion.h)>=y)
464 int progBarXbase = barRegion.x + 300;
465 if (myRec->hasMarks())
467 MarkList* markList = myRec->getMarkList();
468 MarkList::iterator i;
469 Mark* loopMark = NULL;
472 if (myRec->recInfo->timerEnd > time(NULL))
475 // Work out an approximate length in frames (good to 1s...)
476 lengthFrames = (ULONG)((double)(myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
480 lengthFrames = player->getLengthFrames();
482 for(i = markList->begin(); i != markList->end(); i++)
487 posPix = 302 * loopMark->pos / lengthFrames;
488 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 3, 28, DrawStyle::DANGER);
489 if (x>=barRegion.x + progBarXbase + 2 + posPix
490 && x<=barRegion.x + progBarXbase + 2 + posPix+3
491 && y>=barRegion.y + 12 - 2
492 && y<=barRegion.y + 12 - 2+28)
494 player->jumpToMark(loopMark->pos);
502 if (x>=barRegion.x + progBarXbase + 24
503 && x<=barRegion.x + progBarXbase + 4 + 302
504 && y>=barRegion.y + 12 - 2
505 && y<=barRegion.y + 12 - 2+28)
507 int cx=x-(barRegion.x + progBarXbase + 4);
508 double percent=((double)cx)/302.*100.;
509 player->jumpToPercent(percent);
512 // int progressWidth = 302 * currentFrameNum / lengthFrames;
513 // rectangle(barRegion.x + progBarXbase + 4, barRegion.y + 16, progressWidth, 16, DrawStyle::SELECTHIGHLIGHT);
518 BoxStack::getInstance()->handleCommand(Remote::OK); //simulate rok press
521 else if (m->from == player)
523 if (m->message != Message::PLAYER_EVENT) return;
524 switch(m->parameter.num)
526 case Player::CONNECTION_LOST: // connection lost detected
528 // I can't handle this, send it to command
529 Message* m2 = new Message();
530 m2->to = Command::getInstance();
531 m2->message = Message::CONNECTION_LOST;
532 Command::getInstance()->postMessageNoLock(m2);
535 case Player::STOP_PLAYBACK:
537 // FIXME Obselete ish - improve this
538 Message* m2 = new Message(); // Must be done after this thread finishes, and must break into master mutex
539 m2->to = Command::getInstance();
540 m2->message = Message::STOP_PLAYBACK;
541 Command::getInstance()->postMessageNoLock(m2);
544 case Player::ASPECT43:
548 case Player::ASPECT169:
554 else if (m->message == Message::AUDIO_CHANGE_CHANNEL)
556 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received change audio channel to %i", m->parameter.num);
557 player->setAudioChannel(m->parameter.num&0xFFFF,(m->parameter.num&0xFF0000)>> 16,(m->parameter.num&0xFF000000)>> 24 );
559 else if (m->message == Message::SUBTITLE_CHANGE_CHANNEL)
561 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Received change subtitle channel to %i", m->parameter.num);
562 int type=((m->parameter.num & 0xFF0000)>>16);
564 case 0x10: { //dvbsubtitle
565 player->setSubtitleChannel((m->parameter.num & 0xFFFF));
566 player->turnSubtitlesOn(true);
567 VTeletextView *vtxt=((Player*)player)->getTeletextDecoder()->getTeletxtView();
568 if (vtxt && vtxt->isInSubtitleMode()) {
569 BoxStack::getInstance()->remove(vtxt);
572 case 0xFF: { //nosubtitles
574 player->turnSubtitlesOn(false);
575 VTeletextView *vtxt=((Player*)player)->getTeletextDecoder()->getTeletxtView();
576 if (vtxt && vtxt->isInSubtitleMode()) {
577 BoxStack::getInstance()->remove(vtxt);
581 case 0x11: { //videotext
582 player->turnSubtitlesOn(false);
584 ((Player*)player)->getTeletextDecoder()->setPage((m->parameter.num & 0xFFFF));
588 BoxStack::getInstance()->update(vas);
590 BoxStack::getInstance()->update(this);
594 else if (m->message == Message::CHILD_CLOSE)
600 if (!barGenHold && !barScanHold && !barVasHold) removeBar();
605 void VVideoRec::stopPlay()
607 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Pre stopPlay");
610 Log::getInstance()->log("VVideoRec", Log::DEBUG, "1");
612 Log::getInstance()->log("VVideoRec", Log::DEBUG, "2");
613 vdr->stopStreaming();
614 Log::getInstance()->log("VVideoRec", Log::DEBUG, "3");
619 if (!vdr->isConnected()) { Command::getInstance()->connectionLost(); return; }
620 Log::getInstance()->log("VVideoRec", Log::DEBUG, "Post stopPlay");
623 void VVideoRec::toggleChopSides()
625 if (video->getTVsize() == Video::ASPECT16X9) return; // Means nothing for 16:9 TVs
627 if (videoMode == Video::NORMAL)
629 videoMode = Video::LETTERBOX;
630 video->setMode(Video::LETTERBOX);
634 videoMode = Video::NORMAL;
635 video->setMode(Video::NORMAL);
639 void VVideoRec::doAudioSelector()
641 int subtitleChannel=player->getCurrentSubtitleChannel();
642 int subtitleType=0x10;
643 if (!(player)->isSubtitlesOn()) {
644 if ((player)->getTeletextDecoder()->getTeletxtView() &&
645 (player)->getTeletextDecoder()->getTeletxtView()->isInSubtitleMode()
647 subtitleChannel=(player)->getTeletextDecoder()->getPage();
651 subtitleType=0xFF; //turnedOff
655 if (player->isPesRecording()) {
656 bool* availableMpegAudioChannels = player->getDemuxerMpegAudioChannels();
657 bool* availableAc3AudioChannels = NULL;
658 bool* availableSubtitleChannels = player->getDemuxerSubtitleChannels();
659 int *availableTTxtpages = player->getTeletxtSubtitlePages();
660 int currentAudioChannel = player->getCurrentAudioChannel();
661 if (Audio::getInstance()->supportsAc3())
663 availableAc3AudioChannels = player->getDemuxerAc3AudioChannels();
666 vas = new VAudioSelector(this, availableMpegAudioChannels, availableAc3AudioChannels, currentAudioChannel,availableSubtitleChannels, availableTTxtpages,
667 subtitleChannel, subtitleType, myRec->recInfo);
670 Channel *temp_channel=player->getDemuxerChannel();
671 // RecInfo *cur_info= myRec->recInfo;
672 /* unsigned char numchan_recinfo = cur_info->numComponents;
673 unsigned char numchan_subtitles_siz = temp_channel.numSPids;
674 ULONG mp_audcounter = 0;
675 ULONG ac3_counter = 0;
676 int dvb_subcounter = 1;*/
679 /*unsigned char type;
682 for (i = 0; i < numchan_recinfo; i++)
685 type = cur_info->types[i];
686 lang = cur_info->languages[i];
687 description = cur_info->descriptions[i];
690 if (cur_info->streams[i] == 2) {
693 case 1: //mpaudio mono
694 case 3: //mpaudio stereo
695 if (mp_audcounter < temp_channel.numAPids) ac = &temp_channel.apids[mp_audcounter];
700 if (ac3_counter < temp_channel.numDPids) ac = &temp_channel.dpids[ac3_counter];
704 } else if (cur_info->streams[i] == 3){
705 if (dvb_subcounter < numchan_subtitles_siz) ac = &temp_channel.spids[dvb_subcounter];
706 } else continue; //neither audio nor subtitle
709 if (description && (strlen(description) > 0))
711 ac->name = new char[strlen(description) + 1];
712 strcpy(ac->name, description);
714 } else if (lang && strlen(lang) > 0)
716 ac->name = new char[strlen(lang) + 1];
717 strcpy(ac->name, lang);
722 for (i=0;i<temp_channel->numAPids;i++) {
723 apid *ac=&temp_channel->apids[i];
724 if (ac->desc[0]==0) {
725 strncpy(ac->desc, tr("unknown"),9);
728 for (i=0;i<temp_channel->numDPids;i++) {
729 apid *ac=&temp_channel->dpids[i];
730 if (ac->desc[0]==0) {
731 strncpy(ac->desc, tr("unknown"),9);
734 for (i=0;i<temp_channel->numSPids;i++) {
735 apid *ac=&temp_channel->spids[i];
736 if (ac->desc[0]==0) {
737 strncpy(ac->desc, tr("unknown"),9);
741 vas = new VAudioSelector(this,temp_channel , (player)->getCurrentAudioChannel(),
742 subtitleType,subtitleChannel,player->getTeletxtSubtitlePages());
743 /* for (i=0;i<temp_channel.numAPids;i++) {
744 apid *ac=&temp_channel.apids[i];
748 for (i=0;i<temp_channel.numDPids;i++) {
749 apid *ac=&temp_channel.dpids[i];
753 for (i=0;i<temp_channel.numSPids;i++) {
754 apid *ac=&temp_channel.spids[i];
761 vas->setBackgroundColour(barBlue);
762 vas->setPosition(0, barRegion.y - 120);
771 boxstack->update(vas);
774 void VVideoRec::doBar(int action_in)
776 if (player->isSubtitlesOn()) clearOSD(); // remove dvbsubtitles
777 player->tellSubtitlesOSDVisible(true);
780 int action = action_in;
788 rectangle(barRegion, barBlue);
790 /* Work out what to display - choices:
797 Specials, informed by parameter
809 w.setPosition(barRegion.x + 66, barRegion.y + 16);
811 UCHAR playerState = 0;
815 if (action == 1) w.nextSymbol = WSymbol::SKIPFORWARD;
816 else if (action == 2) w.nextSymbol = WSymbol::SKIPBACK;
817 else if (action == 3) w.nextSymbol = WSymbol::SKIPFORWARD2;
818 else if (action == 4) w.nextSymbol = WSymbol::SKIPBACK2;
822 playerState = player->getState();
823 if (playerState == Player::S_PAUSE_P) w.nextSymbol = WSymbol::PAUSE;
824 else if (playerState == Player::S_PAUSE_I) w.nextSymbol = WSymbol::PAUSE;
825 else if (playerState == Player::S_FFWD) w.nextSymbol = WSymbol::FFWD;
826 else if (playerState == Player::S_FBWD) w.nextSymbol = WSymbol::FBWD;
827 else w.nextSymbol = WSymbol::PLAY;
832 if ((playerState == Player::S_FFWD) || (playerState == Player::S_FBWD))
834 // draw blips to show how fast the scan is
835 UCHAR scanrate = player->getIScanRate();
839 SNPRINTF(text, 5, "%ux", scanrate);
840 drawText(text, barRegion.x + 102, barRegion.y + 12, DrawStyle::LIGHTTEXT);
846 boxstack->update(this, &barRegion);
848 if (action_in != -1) {
849 timers->cancelTimer(this, 1);
852 if ((playerState == Player::S_FFWD) || (playerState == Player::S_FBWD)) barScanHold = true;
853 else barScanHold = false;
855 if (!barGenHold && !barScanHold && !barVasHold) timers->setTimerD(this, 1, 4);
857 timers->setTimerD(this, 2, 0, 200000000);
861 void VVideoRec::timercall(int clientReference)
863 switch(clientReference)
874 if (!barShowing) break;
875 #ifndef GRADIENT_DRAWING
877 boxstack->update(this, &barRegion);
881 timers->setTimerD(this, 2, 0, 200000000);
887 void VVideoRec::drawBarClocks()
891 UCHAR playerState = player->getState();
892 // sticky bar is set if we are in ffwd/fbwd mode
893 // if player has gone to S_PLAY then kill stickyBar, and run doBar(0) which
894 // will repaint all the bar (it will call this function again, but
895 // this section won't run because stickyBarF will then == false)
897 if ((playerState != Player::S_FFWD) && (playerState != Player::S_FBWD))
901 return; // doBar will call this function and do the rest
905 Log* logger = Log::getInstance();
906 logger->log("VVideoRec", Log::DEBUG, "Draw bar clocks");
909 // Blank the area first
910 #ifndef GRADIENT_DRAWING
911 rectangle(barRegion.x + 624, barRegion.y + 12, 60, 30, barBlue);
917 LOCALTIME_R(&t, &tms);
918 strftime(timeString, 19, "%H:%M", &tms);
919 drawText(timeString, barRegion.x + 624, barRegion.y + 12, DrawStyle::LIGHTTEXT);
922 #ifndef GRADIENT_DRAWING
923 rectangle(clocksRegion, barBlue);
926 ULONG currentFrameNum = player->getCurrentFrameNum();
928 if (myRec->recInfo->timerEnd > time(NULL))
931 // Work out an approximate length in frames (good to 1s...)
932 lengthFrames =(ULONG) ((double)(myRec->recInfo->timerEnd - myRec->recInfo->timerStart) * myRec->recInfo->fps);
936 lengthFrames = player->getLengthFrames();
939 hmsf currentFrameHMSF = myRec->recInfo->framesToHMSF(currentFrameNum);
940 hmsf lengthHMSF = myRec->recInfo->framesToHMSF(lengthFrames);
943 if (currentFrameNum >= lengthFrames)
945 strcpy(buffer, "-:--:-- / -:--:--");
949 SNPRINTF(buffer, 99, "%01i:%02i:%02i / %01i:%02i:%02i", currentFrameHMSF.hours, currentFrameHMSF.minutes, currentFrameHMSF.seconds, lengthHMSF.hours, lengthHMSF.minutes, lengthHMSF.seconds);
950 logger->log("VVideoRec", Log::DEBUG, buffer);
953 drawText(buffer, clocksRegion.x, clocksRegion.y, DrawStyle::LIGHTTEXT);
962 int progBarXbase = barRegion.x + 300;
964 rectangle(barRegion.x + progBarXbase, barRegion.y + 12, 310, 24, DrawStyle::LIGHTTEXT);
965 rectangle(barRegion.x + progBarXbase + 2, barRegion.y + 14, 306, 20, barBlue);
967 if (currentFrameNum > lengthFrames) return;
968 if (lengthFrames == 0) return;
970 // Draw yellow portion
971 int progressWidth = 302 * currentFrameNum / lengthFrames;
972 rectangle(barRegion.x + progBarXbase + 4, barRegion.y + 16, progressWidth, 16, DrawStyle::SELECTHIGHLIGHT);
974 if (myRec->recInfo->timerEnd > time(NULL)) // if chasing
976 int nrWidth = (int)(302 * ((double)(lengthFrames - player->getLengthFrames()) / lengthFrames));
978 Log::getInstance()->log("GVASDF", Log::DEBUG, "Length Frames: %lu", lengthFrames);
979 Log::getInstance()->log("GVASDF", Log::DEBUG, "Player lf: %lu", player->getLengthFrames());
980 Log::getInstance()->log("GVASDF", Log::DEBUG, "NR WDITH: %i", nrWidth);
981 rectangle(barRegion.x + progBarXbase + 4 + 302 - nrWidth, barRegion.y + 16, nrWidth, 16, DrawStyle::RED);
985 // Now calc position for blips
987 if (myRec->hasMarks())
989 // Draw blips where there are cut marks
990 MarkList* markList = myRec->getMarkList();
991 MarkList::iterator i;
992 Mark* loopMark = NULL;
994 for(i = markList->begin(); i != markList->end(); i++)
999 logger->log("VVideoRec", Log::DEBUG, "Drawing mark at frame %i", loopMark->pos);
1000 posPix = 302 * loopMark->pos / lengthFrames;
1001 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 3, 28, DrawStyle::DANGER);
1007 // Draw blips where start and end margins probably are
1009 posPix =(int) (302. * myRec->recInfo->fps * ((double)startMargin) /((double) lengthFrames));
1011 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
1012 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
1014 posPix = (int)(302. * ((double)lengthFrames - ((double)endMargin) * myRec->recInfo->fps) / ((double)lengthFrames));
1016 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 - 2, 2, 2, DrawStyle::LIGHTTEXT);
1017 rectangle(barRegion.x + progBarXbase + 2 + posPix, barRegion.y + 12 + 24, 2, 2, DrawStyle::LIGHTTEXT);
1021 void VVideoRec::removeBar()
1023 if (!barShowing) return;
1024 timers->cancelTimer(this, 2);
1027 barScanHold = false;
1029 rectangle(barRegion, transparent);
1030 boxstack->update(this, &barRegion);
1031 player->tellSubtitlesOSDVisible(false);
1034 void VVideoRec::doSummary()
1036 clearOSD(); // remove dvbsubtitles
1037 player->tellSubtitlesOSDVisible(true);
1038 vsummary = new VInfo();
1039 vsummary->setTitleText(myRec->getProgName());
1040 vsummary->setBorderOn(1);
1041 vsummary->setExitable();
1042 if (myRec->recInfo->summary) vsummary->setMainText(myRec->recInfo->summary);
1043 else vsummary->setMainText(tr("Summary unavailable"));
1044 if (Video::getInstance()->getFormat() == Video::PAL)
1046 vsummary->setPosition(120, 130);
1050 vsummary->setPosition(110, 90);
1052 vsummary->setSize(510, 270);
1056 BoxStack::getInstance()->update(this);
1059 void VVideoRec::removeSummary()
1067 BoxStack::getInstance()->update(this);
1068 player->tellSubtitlesOSDVisible(false);
1072 void VVideoRec::drawOSDBitmap(UINT posX, UINT posY, const Bitmap& bm, const DisplayRegion& region)
1074 drawBitmap(posX, posY, bm, region);
1076 r.x = posX; r.y = posY; r.w = bm.getWidth(); r.h = bm.getHeight();
1077 boxstack->update(this, &r);
1080 void VVideoRec::clearOSD()
1082 rectangle(area, transparent);
1083 boxstack->update(this, &area);
1086 void VVideoRec::clearOSDArea(UINT posX, UINT posY, UINT width, UINT height, const DisplayRegion& region)
1089 r.x = posX+region.windowx; r.y = posY+region.windowy; r.w = width; r.h = height;
1090 //now convert to our display
1091 float scalex=720.f/((float) (region.framewidth+1));
1092 float scaley=576.f/((float) (region.frameheight+1));
1093 r.x=(UINT)floor(scalex*((float)r.x));
1094 r.y=(UINT)floor(scaley*((float)r.y));
1095 r.w=(UINT)(ceil(scalex*((float)r.w))+1.f);
1096 r.h=(UINT)(ceil(scaley*((float)r.h))+1.f);
1098 rectangle(r, transparent);
1099 boxstack->update(this, &r);