]> git.vomp.tv Git - vompclient.git/blob - vvideorec.cc
Un-hardcoded all the colours
[vompclient.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 Player(Command::getInstance());
26   player->init();
27   vdr = VDR::getInstance();
28
29   myRec = rec;
30
31   setDimensions(SCREENHEIGHT, SCREENWIDTH);
32   Colour transparent(0, 0, 0, 0);
33   setBackgroundColour(transparent);
34 }
35
36 VVideoRec::~VVideoRec()
37 {
38   delete player;
39 }
40
41 void VVideoRec::draw()
42 {
43   View::draw();
44 }
45
46 void VVideoRec::go(ULLONG startPosition)
47 {
48   ULLONG recLength = vdr->streamRecording(myRec);
49
50   player->setLength(recLength);
51   player->setPosition(startPosition);
52   player->play();
53 }
54
55 int VVideoRec::handleCommand(int command)
56 {
57   switch(command)
58   {
59     case Remote::PLAY:
60     {
61       player->play(); // do resync
62       return 2;
63     }
64
65     case Remote::STOP:
66     case Remote::BACK:
67     case Remote::MENU:
68     {
69       player->stop();
70       vdr->stopStreaming();
71       return 4;
72     }
73     case Remote::PAUSE:
74     {
75       player->togglePause();
76       return 2;
77     }
78     case Remote::SKIPFORWARD:
79     {
80       player->skipForward(60);
81       return 2;
82     }
83     case Remote::SKIPBACK:
84     {
85       player->skipBackward(60);
86       return 2;
87     }
88     case Remote::FORWARD:
89     {
90       player->toggleFastForward();
91       return 2;
92     }
93     case Remote::YELLOW:
94     {
95       player->skipBackward(10);
96       return 2;
97     }
98     case Remote::BLUE:
99     {
100       player->skipForward(10);
101       return 2;
102     }
103 //    case Remote::REVERSE:
104 //    {
105 //      player->toggleFastBackward();
106 //      return 2;
107 //    }
108
109     case Remote::ZERO: player->jumpToPercent(0); return 2;
110     case Remote::ONE: player->jumpToPercent(10); return 2;
111     case Remote::TWO: player->jumpToPercent(20); return 2;
112     case Remote::THREE: player->jumpToPercent(30); return 2;
113     case Remote::FOUR: player->jumpToPercent(40); return 2;
114     case Remote::FIVE: player->jumpToPercent(50); return 2;
115     case Remote::SIX: player->jumpToPercent(60); return 2;
116     case Remote::SEVEN: player->jumpToPercent(70); return 2;
117     case Remote::EIGHT: player->jumpToPercent(80); return 2;
118     case Remote::NINE: player->jumpToPercent(90); return 2;
119
120   }
121
122   return 1;
123 }