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