PTLib  Version 2.18.8
 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 
25 #ifndef PTLIB_VSDL_H
26 #define PTLIB_VSDL_H
27 
28 #if P_SDL
29 
30 #include <ptlib.h>
31 
32 #include <ptlib/videoio.h>
33 
34 
37 class PVideoOutputDevice_SDL : public PVideoOutputDevice
38 {
39  PCLASSINFO(PVideoOutputDevice_SDL, PVideoOutputDevice);
40 
41  public:
44  PVideoOutputDevice_SDL();
45 
48  ~PVideoOutputDevice_SDL();
49 
52  virtual PStringArray GetDeviceNames() const;
53  static PStringArray GetOutputDeviceNames();
54 
57  virtual PBoolean Open(
58  const PString & /*deviceName*/,
59  PBoolean /*startImmediate*/ = true
60  );
61 
64  virtual PBoolean Close();
65 
68  virtual PBoolean IsOpen();
69 
80  virtual PBoolean SetColourFormat(
81  const PString & colourFormat
82  );
83 
92  virtual PBoolean SetFrameSize(
93  unsigned width,
94  unsigned height
95  );
96 
99  virtual PBoolean SetFrameData(const FrameData & frameData);
100 
101 #ifdef P_MACOSX
102  virtual bool ApplicationMain();
103 #endif
104 
105  private:
106  struct SDL_Window * m_window;
107  struct SDL_Renderer * m_renderer;
108  struct SDL_Texture * m_texture;
109  PDECLARE_MUTEX( m_texture_mutex);
110  PSyncPoint m_operationComplete;
111 
112  bool InternalOpen();
113  void InternalClose();
114  void InternalSetFrameSize();
115  void InternalSetFrameData();
116  void PostEvent(unsigned code, bool wait);
117 
118  friend class PSDL_System;
119 };
120 
121 
122 typedef PVideoOutputDevice_SDL PSDLVideoDevice; // Backward compatibility
123 
124 
125 #endif // P_SDL
126 
127 #endif // PTLIB_VSDL_H
128 
129 
130 // End Of File ///////////////////////////////////////////////////////////////
#define PCLASSINFO(cls, par)
Declare all the standard PTLib class information.
Definition: object.h:2164
virtual PBoolean Open(const PString &deviceName, PBoolean startImmediate=true)=0
Open the device given the device name.
This is an array collection class of PString objects.
Definition: pstring.h:2365
#define PDECLARE_MUTEX(...)
Definition: mutex.h:200
virtual PBoolean IsOpen()=0
Determine if the device is currently open.
bool PBoolean
Definition: object.h:174
The character string class.
Definition: pstring.h:108
virtual PStringArray GetDeviceNames() const =0
Get a list of all of the drivers available.
virtual PBoolean SetFrameData(const FrameData &frameData)=0
Set a section of the output frame buffer.
virtual PBoolean SetFrameSize(unsigned width, unsigned height)
Set the frame size to be used.
virtual PBoolean SetColourFormat(const PString &colourFormat)
Set the colour format to be used.
virtual PBoolean Close()
Close the device.
Definition: videoio.h:785
This class defines a video output device.
Definition: videoio.h:712
This class defines a thread synchronisation object.
Definition: syncpoint.h:63