00001 /* 00002 * vsdl.h 00003 * 00004 * Classes to support video output via SDL 00005 * 00006 * Copyright (c) 1999-2000 Equivalence Pty. Ltd. 00007 * 00008 * The contents of this file are subject to the Mozilla Public License 00009 * Version 1.0 (the "License"); you may not use this file except in 00010 * compliance with the License. You may obtain a copy of the License at 00011 * http://www.mozilla.org/MPL/ 00012 * 00013 * Software distributed under the License is distributed on an "AS IS" 00014 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00015 * the License for the specific language governing rights and limitations 00016 * under the License. 00017 * 00018 * The Original Code is Open H323 Library. 00019 * 00020 * The Initial Developer of the Original Code is Equivalence Pty. Ltd. 00021 * 00022 * Contributor(s): Derek J Smithies (derek@indranet.co.nz) 00023 * 00024 * $Log: vsdl.h,v $ 00025 * Revision 1.11 2006/06/21 04:20:07 csoutheren 00026 * Fixes for VS.net 00027 * 00028 * Revision 1.10 2005/11/30 12:47:37 csoutheren 00029 * Removed tabs, reformatted some code, and changed tags for Doxygen 00030 * 00031 * Revision 1.9 2005/08/09 09:08:08 rjongbloed 00032 * Merged new video code from branch back to the trunk. 00033 * 00034 * Revision 1.8.2.1 2005/07/17 09:26:46 rjongbloed 00035 * Major revisions of the PWLib video subsystem including: 00036 * removal of F suffix on colour formats for vertical flipping, all done with existing bool 00037 * working through use of RGB and BGR formats so now consistent 00038 * cleaning up the plug in system to use virtuals instead of pointers to functions. 00039 * rewrite of SDL to be a plug in compatible video output device. 00040 * extensive enhancement of video test program 00041 * 00042 * Revision 1.8 2005/07/13 12:50:07 csoutheren 00043 * Backported changes from isvo branch 00044 * 00045 * Revision 1.7.8.1 2005/04/25 13:27:26 shorne 00046 * Added support for capture SDL output to redirect to existing surface 00047 * 00048 * Revision 1.7 2004/05/31 01:26:58 dereksmithies 00049 * Fix the "no newline at end of file" warning. 00050 * 00051 * Revision 1.6 2004/05/27 04:47:05 csoutheren 00052 * Added include guard to file 00053 * 00054 * Revision 1.5 2003/12/12 05:11:56 rogerhardiman 00055 * Add SDL support on FreeBSD. Header files live in SDL11 directory 00056 * 00057 * Revision 1.4 2003/05/17 03:20:48 rjongbloed 00058 * Removed need to do strange things with main() function. 00059 * 00060 * Revision 1.3 2003/04/28 14:29:45 craigs 00061 * Started rearranging code 00062 * 00063 * Revision 1.2 2003/04/28 08:44:42 craigs 00064 * Fixed problem with include on linux 00065 * 00066 * Revision 1.1 2003/04/28 07:04:20 craigs 00067 * Initial version from ohphone 00068 * 00069 * Revision 1.8 2003/03/21 00:47:47 dereks 00070 * Remove surplus PTRACE statements. 00071 * 00072 * Revision 1.7 2003/03/20 23:50:41 dereks 00073 * Fixups resulting from the new PVideoOutputDevice class code. 00074 * 00075 * Revision 1.6 2002/12/03 21:45:05 dereks 00076 * Fixes from Walter Whitlock to cure warnings about u_chars. Thanks! 00077 * 00078 * Revision 1.5 2002/06/27 02:17:40 robertj 00079 * Renamed video format 411 to the correct 420P, thanks Mark Cooke 00080 * 00081 * Revision 1.4 2002/04/29 03:51:55 dereks 00082 * Documentation tidy up. Thanks to Walter Whitlock. 00083 * 00084 * Revision 1.3 2002/04/26 03:33:32 dereks 00085 * Major upgrade. All calls to SDL library are now done by one thread. 00086 * 00087 * Revision 1.2 2001/05/25 01:14:44 dereks 00088 * Alter SetFrameSize & OpenWindo to use unsigned variables. Change type of 00089 * other variables to eliminate compiler warnings. 00090 * 00091 * Revision 1.1 2001/03/07 01:47:45 dereks 00092 * Initial release of SDL (Simple DirectMedia Layer, a cross-platform multimedia library), 00093 * a video library code. 00094 * 00095 * 00096 */ 00097 00098 #ifndef _PVSDL 00099 #define _PVSDL 00100 00101 #if P_SDL 00102 00103 #include <ptlib.h> 00104 #if defined(P_FREEBSD) 00105 #include <SDL11/SDL.h> 00106 #else 00107 #include <SDL/SDL.h> 00108 #endif 00109 00110 #include <ptlib/videoio.h> 00111 00112 #undef main 00113 00114 00117 class PVideoOutputDevice_SDL : public PVideoOutputDevice 00118 { 00119 PCLASSINFO(PVideoOutputDevice_SDL, PVideoOutputDevice); 00120 00121 public: 00124 PVideoOutputDevice_SDL(); 00125 00128 ~PVideoOutputDevice_SDL(); 00129 00132 virtual PStringList GetDeviceNames() const; 00133 00136 virtual BOOL Open( 00137 const PString & /*deviceName*/, 00138 BOOL /*startImmediate*/ = TRUE 00139 ); 00140 00143 virtual BOOL Close(); 00144 00147 virtual BOOL IsOpen(); 00148 00159 virtual BOOL SetColourFormat( 00160 const PString & colourFormat 00161 ); 00162 00171 virtual BOOL SetFrameSize( 00172 unsigned width, 00173 unsigned height 00174 ); 00175 00181 virtual PINDEX GetMaxFrameBytes(); 00182 00185 virtual BOOL SetFrameData( 00186 unsigned x, 00187 unsigned y, 00188 unsigned width, 00189 unsigned height, 00190 const BYTE * data, 00191 BOOL endFrame = TRUE 00192 ); 00193 00194 protected: 00195 PDECLARE_NOTIFIER(PThread, PVideoOutputDevice_SDL, SDLThreadMain); 00196 bool InitialiseSDL(); 00197 bool ProcessSDLEvents(); 00198 00199 PThread * sdlThread; 00200 PSyncPoint sdlStarted; 00201 PSyncPointAck sdlStop; 00202 PSyncPointAck adjustSize; 00203 bool updateOverlay; 00204 PMutex mutex; 00205 00206 SDL_Surface * screen; 00207 SDL_Overlay * overlay; 00208 }; 00209 00210 00211 typedef PVideoOutputDevice_SDL PSDLVideoDevice; // Backward compatibility 00212 00213 00214 PWLIB_STATIC_LOAD_PLUGIN(SDL, PVideoOutputDevice); 00215 00216 #endif // P_SDL 00217 00218 #endif 00219