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.10 2005/11/30 12:47:37 csoutheren 00026 * Removed tabs, reformatted some code, and changed tags for Doxygen 00027 * 00028 * Revision 1.9 2005/08/09 09:08:08 rjongbloed 00029 * Merged new video code from branch back to the trunk. 00030 * 00031 * Revision 1.8.2.1 2005/07/17 09:26:46 rjongbloed 00032 * Major revisions of the PWLib video subsystem including: 00033 * removal of F suffix on colour formats for vertical flipping, all done with existing bool 00034 * working through use of RGB and BGR formats so now consistent 00035 * cleaning up the plug in system to use virtuals instead of pointers to functions. 00036 * rewrite of SDL to be a plug in compatible video output device. 00037 * extensive enhancement of video test program 00038 * 00039 * Revision 1.8 2005/07/13 12:50:07 csoutheren 00040 * Backported changes from isvo branch 00041 * 00042 * Revision 1.7.8.1 2005/04/25 13:27:26 shorne 00043 * Added support for capture SDL output to redirect to existing surface 00044 * 00045 * Revision 1.7 2004/05/31 01:26:58 dereksmithies 00046 * Fix the "no newline at end of file" warning. 00047 * 00048 * Revision 1.6 2004/05/27 04:47:05 csoutheren 00049 * Added include guard to file 00050 * 00051 * Revision 1.5 2003/12/12 05:11:56 rogerhardiman 00052 * Add SDL support on FreeBSD. Header files live in SDL11 directory 00053 * 00054 * Revision 1.4 2003/05/17 03:20:48 rjongbloed 00055 * Removed need to do strange things with main() function. 00056 * 00057 * Revision 1.3 2003/04/28 14:29:45 craigs 00058 * Started rearranging code 00059 * 00060 * Revision 1.2 2003/04/28 08:44:42 craigs 00061 * Fixed problem with include on linux 00062 * 00063 * Revision 1.1 2003/04/28 07:04:20 craigs 00064 * Initial version from ohphone 00065 * 00066 * Revision 1.8 2003/03/21 00:47:47 dereks 00067 * Remove surplus PTRACE statements. 00068 * 00069 * Revision 1.7 2003/03/20 23:50:41 dereks 00070 * Fixups resulting from the new PVideoOutputDevice class code. 00071 * 00072 * Revision 1.6 2002/12/03 21:45:05 dereks 00073 * Fixes from Walter Whitlock to cure warnings about u_chars. Thanks! 00074 * 00075 * Revision 1.5 2002/06/27 02:17:40 robertj 00076 * Renamed video format 411 to the correct 420P, thanks Mark Cooke 00077 * 00078 * Revision 1.4 2002/04/29 03:51:55 dereks 00079 * Documentation tidy up. Thanks to Walter Whitlock. 00080 * 00081 * Revision 1.3 2002/04/26 03:33:32 dereks 00082 * Major upgrade. All calls to SDL library are now done by one thread. 00083 * 00084 * Revision 1.2 2001/05/25 01:14:44 dereks 00085 * Alter SetFrameSize & OpenWindo to use unsigned variables. Change type of 00086 * other variables to eliminate compiler warnings. 00087 * 00088 * Revision 1.1 2001/03/07 01:47:45 dereks 00089 * Initial release of SDL (Simple DirectMedia Layer, a cross-platform multimedia library), 00090 * a video library code. 00091 * 00092 * 00093 */ 00094 00095 #ifndef _PVSDL 00096 #define _PVSDL 00097 00098 #if P_SDL 00099 00100 #include <ptlib.h> 00101 #if defined(P_FREEBSD) 00102 #include <SDL11/SDL.h> 00103 #else 00104 #include <SDL/SDL.h> 00105 #endif 00106 00107 #undef main 00108 00109 00112 class PVideoOutputDevice_SDL : public PVideoOutputDevice 00113 { 00114 PCLASSINFO(PVideoOutputDevice_SDL, PVideoOutputDevice); 00115 00116 public: 00119 PVideoOutputDevice_SDL(); 00120 00123 ~PVideoOutputDevice_SDL(); 00124 00127 virtual PStringList GetDeviceNames() const; 00128 00131 virtual BOOL Open( 00132 const PString & /*deviceName*/, 00133 BOOL /*startImmediate*/ = TRUE 00134 ); 00135 00138 virtual BOOL Close(); 00139 00142 virtual BOOL IsOpen(); 00143 00154 virtual BOOL SetColourFormat( 00155 const PString & colourFormat 00156 ); 00157 00166 virtual BOOL SetFrameSize( 00167 unsigned width, 00168 unsigned height 00169 ); 00170 00176 virtual PINDEX GetMaxFrameBytes(); 00177 00180 virtual BOOL SetFrameData( 00181 unsigned x, 00182 unsigned y, 00183 unsigned width, 00184 unsigned height, 00185 const BYTE * data, 00186 BOOL endFrame = TRUE 00187 ); 00188 00189 protected: 00190 PDECLARE_NOTIFIER(PThread, PVideoOutputDevice_SDL, SDLThreadMain); 00191 bool InitialiseSDL(); 00192 bool ProcessSDLEvents(); 00193 00194 PThread * sdlThread; 00195 PSyncPoint sdlStarted; 00196 PSyncPointAck sdlStop; 00197 PSyncPointAck adjustSize; 00198 bool updateOverlay; 00199 PMutex mutex; 00200 00201 SDL_Surface * screen; 00202 SDL_Overlay * overlay; 00203 }; 00204 00205 00206 typedef PVideoOutputDevice_SDL PSDLVideoDevice; // Backward compatibility 00207 00208 00209 PWLIB_STATIC_LOAD_PLUGIN(SDL, PVideoOutputDevice); 00210 00211 #endif // P_SDL 00212 00213 #endif 00214