]> git.vomp.tv Git - vompclient-marten.git/blob - vvideorec.cc
EPG tweaks, EPG made NTSC compatible
[vompclient-marten.git] / vvideorec.cc
1 /*
2     Copyright 2004-2005 Chris Tallon
3
4     This file is part of VOMP.
5
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.
10
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.
15
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 #include "vvideorec.h"
22
23 VVideoRec::VVideoRec(Recording* rec)
24 {
25   player = new PlayerVideo(Command::getInstance(), 1, 0); // say 0 for radio because buffering will work anyway
26   player->init();
27   vdr = VDR::getInstance();
28
29   myRec = rec;
30
31   Video* video = Video::getInstance();
32   create(video->getScreenWidth(), video->getScreenHeight());
33   Colour transparent(0, 0, 0, 0);
34   setBackgroundColour(transparent);
35 }
36
37 VVideoRec::~VVideoRec()
38 {
39   Log::getInstance()->log("VVideoRec", Log::DEBUG, "Pre delete player");
40   delete player;
41   Log::getInstance()->log("VVideoRec", Log::DEBUG, "Post delete player");
42   Video::getInstance()->setDefaultAspect();
43 }
44
45 void VVideoRec::draw()
46 {
47   View::draw();
48 }
49
50 void VVideoRec::go(ULLONG startPosition)
51 {
52   ULLONG recLength = vdr->streamRecording(myRec);
53
54   player->setLength(recLength);
55   player->setPosition(startPosition);
56   player->play();
57 }
58
59 int VVideoRec::handleCommand(int command)
60 {
61   switch(command)
62   {
63     case Remote::PLAY:
64     {
65       player->play(); // do resync
66       return 2;
67     }
68
69     case Remote::STOP:
70     case Remote::BACK:
71     case Remote::MENU:
72     {
73       Log::getInstance()->log("VVideoRec", Log::DEBUG, "Pre player stop");
74       player->stop();
75       vdr->stopStreaming();
76       Log::getInstance()->log("VVideoRec", Log::DEBUG, "Post player stop");
77       return 4;
78     }
79     case Remote::PAUSE:
80     {
81       player->togglePause();
82       return 2;
83     }
84     case Remote::SKIPFORWARD:
85     {
86       player->skipForward(60);
87       return 2;
88     }
89     case Remote::SKIPBACK:
90     {
91       player->skipBackward(60);
92       return 2;
93     }
94     case Remote::FORWARD:
95     {
96       player->toggleFastForward();
97       return 2;
98     }
99     case Remote::YELLOW:
100     {
101       player->skipBackward(10);
102       return 2;
103     }
104     case Remote::BLUE:
105     {
106       player->skipForward(10);
107       return 2;
108     }
109
110 //    case Remote::REVERSE:
111 //    {
112 //      player->toggleFastBackward();
113 //      return 2;
114 //    }
115
116 #ifdef DEV
117     case Remote::RED:
118     {
119       //player->test1();
120
121       /*
122       // for testing EPG in NTSC with a NTSC test video
123       Video::getInstance()->setMode(Video::QUARTER);
124       Video::getInstance()->setPosition(170, 5);
125       VEpg* vepg = new VEpg(NULL, 0);
126       vepg->draw();
127       ViewMan::getInstance()->add(vepg);
128       ViewMan::getInstance()->updateView(vepg);
129       */
130
131       return 2;
132     }
133     case Remote::GREEN:
134     {
135       player->test2();
136       return 2;
137     }
138 #endif
139
140     case Remote::ZERO: player->jumpToPercent(0); return 2;
141     case Remote::ONE: player->jumpToPercent(10); return 2;
142     case Remote::TWO: player->jumpToPercent(20); return 2;
143     case Remote::THREE: player->jumpToPercent(30); return 2;
144     case Remote::FOUR: player->jumpToPercent(40); return 2;
145     case Remote::FIVE: player->jumpToPercent(50); return 2;
146     case Remote::SIX: player->jumpToPercent(60); return 2;
147     case Remote::SEVEN: player->jumpToPercent(70); return 2;
148     case Remote::EIGHT: player->jumpToPercent(80); return 2;
149     case Remote::NINE: player->jumpToPercent(90); return 2;
150
151   }
152
153   return 1;
154 }