PTLib  Version 2.12.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vsdl.h
Go to the documentation of this file.
1 /*
2  * vsdl.h
3  *
4  * Classes to support video output via SDL
5  *
6  * Copyright (c) 1999-2000 Equivalence Pty. Ltd.
7  *
8  * The contents of this file are subject to the Mozilla Public License
9  * Version 1.0 (the "License"); you may not use this file except in
10  * compliance with the License. You may obtain a copy of the License at
11  * http://www.mozilla.org/MPL/
12  *
13  * Software distributed under the License is distributed on an "AS IS"
14  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
15  * the License for the specific language governing rights and limitations
16  * under the License.
17  *
18  * The Original Code is Open H323 Library.
19  *
20  * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
21  *
22  * Contributor(s): Derek J Smithies (derek@indranet.co.nz)
23  *
24  * $Revision: 27706 $
25  * $Author: rjongbloed $
26  * $Date: 2012-05-25 18:23:39 +1000 (Fri, 25 May 2012) $
27  */
28 
29 #ifndef PTLIB_VSDL_H
30 #define PTLIB_VSDL_H
31 
32 #if P_SDL
33 
34 #include <ptlib.h>
35 
36 #include <ptlib/videoio.h>
37 
38 
41 class PVideoOutputDevice_SDL : public PVideoOutputDevice
42 {
43  PCLASSINFO(PVideoOutputDevice_SDL, PVideoOutputDevice);
44 
45  public:
48  PVideoOutputDevice_SDL();
49 
52  ~PVideoOutputDevice_SDL();
53 
56  virtual PStringArray GetDeviceNames() const;
57 
60  virtual PBoolean Open(
61  const PString & /*deviceName*/,
62  PBoolean /*startImmediate*/ = true
63  );
64 
67  virtual PBoolean Close();
68 
71  virtual PBoolean IsOpen();
72 
83  virtual PBoolean SetColourFormat(
84  const PString & colourFormat
85  );
86 
95  virtual PBoolean SetFrameSize(
96  unsigned width,
97  unsigned height
98  );
99 
105  virtual PINDEX GetMaxFrameBytes();
106 
109  virtual PBoolean SetFrameData(
110  unsigned x,
111  unsigned y,
112  unsigned width,
113  unsigned height,
114  const BYTE * data,
115  PBoolean endFrame = true
116  );
117 
118  protected:
119  struct SDL_Overlay * m_overlay;
120  PSyncPoint m_operationComplete;
121  unsigned m_x, m_y;
122 
123  private:
124  PString GetTitle() const;
125  void UpdateContent();
126  void CreateOverlay(struct SDL_Surface * surface);
127  void FreeOverlay();
128  void PostEvent(unsigned codei, bool wait);
129 
130  friend class PSDL_Window;
131 };
132 
133 
134 typedef PVideoOutputDevice_SDL PSDLVideoDevice; // Backward compatibility
135 
136 
137 #endif // P_SDL
138 
139 #endif // PTLIB_VSDL_H
140 
141 
142 // End Of File ///////////////////////////////////////////////////////////////