]> git.vomp.tv Git - vompclient.git/blob - video.cc
More compiler warning fixes
[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                 setMode(mode);
67         } break;
68         case Quarter: {
69                 setMode(QUARTER);
70                 setPosition(display.x / 2, display.y / 2);
71         }break;
72         case Eighth: {
73                 setMode(EIGHTH);
74                 setPosition(display.x / 2, display.y / 2);      
75         } break;
76         case Window:
77         case None: return false; break; //Stupid
78         }
79         return true;
80
81 }
82
83 /*
84 void Video::setInstance(Video* inst)
85 {
86   instance=inst;
87 }*/
88
89 /*
90 hmsf Video::framesToHMSF(ULONG frames, double fps)
91 {
92   hmsf ret;
93   / * from vdr *
94   double Seconds;
95   ret.frames= int(modf((frames + 0.5) / fps, &Seconds) * fps + 1);
96   int s = int(Seconds);
97   ret.seconds=s;
98   ret.minutes = s / 60 % 60;
99   ret.hours = s / 3600;
100
101 / *  if (format == NTSC)
102   {
103     ret.hours = frames / 108000;
104     frames %= 108000;
105     ret.minutes = frames / 1800;
106     frames %= 1800;
107     ret.seconds = frames / 30;
108     ret.frames = frames % 30;
109   }
110   else
111   {
112     ret.hours = frames / 90000;
113     frames %= 90000;
114     ret.minutes = frames / 1500;
115     frames %= 1500;
116     ret.seconds = frames / 25;
117     ret.frames = frames % 25;
118   }* /
119   return ret;
120 }*/
121
122 /*
123 UINT Video::getFPS()
124 {
125   if (format == NTSC) return 30;
126   else return 25;
127 }
128 */