/Users/craigcornelius/Projects/SPRING Mac Release 0.2/aviplayer.h

Go to the documentation of this file.
00001 // $Id: aviplayer.h,v 1.4 2006/05/24 16:52:42 sean Exp $ 
00002 // $Copyright: (c)2001 National Biocomputation Center, Stanford University $
00003 
00004 #ifndef Avi_Player_Header
00005 #define Avi_Player_Header
00006 
00007 #ifdef _WIN32
00008 // Windows Includes
00009 #include <windows.h>                                                                                    // Header File For Windows
00010 #include <gl\gl.h>                                                                                              // Header File For The OpenGL32 Library
00011 #include <gl\glu.h>                                                                                             // Header File For The GLu32 Library
00012 
00013 #undef SHORT          // -> Needed before the <vfw.h> include, does not compile otherwise!
00014 #include <vfw.h>                                                                                                // Header File For Video For Windows
00015 
00016 #pragma comment( lib, "opengl32.lib" )                                                  // Search For OpenGL32.lib While Linking
00017 #pragma comment( lib, "glu32.lib" )                                                             // Search For GLu32.lib While Linking
00018 #pragma comment( lib, "vfw32.lib" )                                                             // Search For VFW32.lib While Linking
00019 
00020 #else
00021 // Includes for other than Windows
00022 
00023 // Todo: Currently no video support for other than Windows 
00024 
00025 #endif
00026 
00027 
00028 // AVI Video player (Windows only)
00029 //
00030 // SOURCE:
00031 // Playing AVI Files In OpenGL 
00032 // Jeff Molofee's Lesson 36
00033 // http://nehe.gamedev.net, 2001
00034 //
00035 // UPDATES (C++ adaption):
00036 // Author: Chris (caschwan@gmx.net)
00037 //
00038 class AviPlayer {
00039 
00040 public:
00041 
00042     AviPlayer(char* video, int width, int height);
00043     virtual ~AviPlayer();
00044 
00045     static int debug;
00046     static const char* rcsid;
00047     
00048         virtual void Update();                  // called periodically to update internal video data
00049         virtual void Draw(float x, float y, float width, float height);         // called when in Draw
00050 
00051         bool isRepeatMovie() { return repeatMovie; }
00052         void setRepeatMovie(bool repeat) { repeatMovie = repeat; }
00053 
00054 private:  
00055 
00056 
00057         // User defined methods (Windows)
00058         bool repeatMovie;
00059 #ifdef _WIN32
00060         void OpenAVI(LPCSTR szFile);                                                                    // Opens an AVI file
00061         void GrabAVIFrame(int frame);                                                                   // Grabs an AVI frame
00062         void CloseAVI();                                                                                                // Closes the current AVI file
00063         void flipIt(void* buffer);                                                                              // Flips The Red And Blue Bytes (256x256)
00064 
00065         // User defined variables (Windows)
00066         int                     textureWidth;                                                                           // Texture width in pixels for video
00067         int                     textureHeight;                                                                          // Texture height in pixels for video
00068         int             textureSize;
00069         int                     next;                                                                                           // Used For Animation
00070         int                     frame;                                                                                          // Frame Counter
00071         DWORD           lastTickCount;
00072 
00073         AVISTREAMINFO           psi;                                                                            // Pointer To A Structure Containing Stream Info
00074         PAVISTREAM                      pavi;                                                                           // Handle To An Open Stream
00075         PGETFRAME                       pgf;                                                                            // Pointer To A GetFrame Object
00076         BITMAPINFOHEADER        bmih;                                                                           // Header Information For DrawDibDraw Decoding
00077         long                            lastframe;                                                                      // Last Frame Of The Stream
00078         int                                     width;                                                                          // Video Width
00079         int                                     height;                                                                         // Video Height
00080         char                            *pdata;                                                                         // Pointer To Texture Data
00081         int                                     mpf;                                                                            // Will Hold Rough Milliseconds Per Frame
00082 
00083         GLUquadricObj *quadratic;                                                                               // Storage For Our Quadratic Objects
00084 
00085         HDRAWDIB hdd;                                                                                                   // Handle For Our Dib
00086         HBITMAP hBitmap;                                                                                                // Handle To A Device Dependant Bitmap
00087         HDC hdc;                                                                                                                // Creates A Compatible Device Context
00088         unsigned char* data;                                                                                    // Pointer To Our Resized Image
00089 
00090 #else
00091 
00092 // Todo: Currently no video support for other than Windows 
00093 
00094 #endif  
00095 
00096         
00097 };
00098 
00099 #endif   // Avi_Player_Header

Generated on Thu Aug 30 11:03:13 2007 for SPRING Mac by  doxygen 1.5.3