]> git.vomp.tv Git - vompclient.git/blob - video.cc
Display channel name, duration, resume point and size on recording info screen
[vompclient.git] / video.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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
19 */
20
21 #include "video.h"
22
23 Video* Video::instance = NULL;
24
25 Video::Video()
26 {
27   if (instance) return;
28   instance = this;
29   initted = 0;
30
31   fdVideo = 0;
32
33   format = 0;
34   connection = 0;
35   aspectRatio = 0;
36   mode = 0;
37   tvsize = 0;
38   parx=1;
39   pary=1;
40
41   screenWidth = 0;
42   screenHeight = 0;
43 }
44
45 Video::~Video()
46 {
47   instance = NULL;
48 }
49
50 Video* Video::getInstance()
51 {
52   return instance;
53 }
54
55 // For legacy implementations
56 bool Video::setVideoDisplay(VideoDisplay display)
57 {
58         VideoMode applyMode=display.mode;
59         if (display.mode==Window || display.mode == None) {
60                 if (display.fallbackMode == None || display.fallbackMode == Window) return false; // No Effect
61                 applyMode=display.fallbackMode;
62         }
63         switch (applyMode) {
64         case Fullscreen: {
65 #ifndef VOMP_PLATTFORM_MVP
66           // Can't run this on a MVP. See vepg.cc ~ line 480
67                 setMode(mode);
68 #endif
69         } break;
70         case Quarter: {
71                 setMode(QUARTER);
72                 setPosition(display.x / 2, display.y / 2);
73         }break;
74         case Eighth: {
75                 setMode(EIGHTH);
76                 setPosition(display.x / 2, display.y / 2);      
77         } break;
78         case Window:
79         case None: return false; break; //Stupid
80         }
81         return true;
82
83 }
84
85 /*
86 void Video::setInstance(Video* inst)
87 {
88   instance=inst;
89 }*/
90
91 /*
92 hmsf Video::framesToHMSF(ULONG frames, double fps)
93 {
94   hmsf ret;
95   / * from vdr *
96   double Seconds;
97   ret.frames= int(modf((frames + 0.5) / fps, &Seconds) * fps + 1);
98   int s = int(Seconds);
99   ret.seconds=s;
100   ret.minutes = s / 60 % 60;
101   ret.hours = s / 3600;
102
103 / *  if (format == NTSC)
104   {
105     ret.hours = frames / 108000;
106     frames %= 108000;
107     ret.minutes = frames / 1800;
108     frames %= 1800;
109     ret.seconds = frames / 30;
110     ret.frames = frames % 30;
111   }
112   else
113   {
114     ret.hours = frames / 90000;
115     frames %= 90000;
116     ret.minutes = frames / 1500;
117     frames %= 1500;
118     ret.seconds = frames / 25;
119     ret.frames = frames % 25;
120   }* /
121   return ret;
122 }*/
123
124 /*
125 UINT Video::getFPS()
126 {
127   if (format == NTSC) return 30;
128   else return 25;
129 }
130 */