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