00001 #include <MPEG/MPEGVideoDrv.h> 00002 #include <MPEG/MPEGAudioDrv.h> 00003 #include <MPEG/MPEGSystemDrv.h> 00004 00005 class CLVideoDrv : public MPEGVideoDrv 00006 { 00007 public: 00008 CLVideoDrv(CL_Target* target) 00009 { 00010 this->target = target; 00011 } 00012 00013 virtual unsigned int BitsPerPixel() 00014 { 00015 return target->get_depth(); 00016 } 00017 00018 virtual unsigned int GetBytesPerPixel() 00019 { 00020 return target->get_bytes_per_pixel(); 00021 } 00022 00023 virtual unsigned int GetRedMask() 00024 { 00025 return target->get_red_mask(); 00026 } 00027 00028 virtual unsigned int GetGreenMask() 00029 { 00030 return target->get_green_mask(); 00031 } 00032 00033 virtual unsigned int GetBlueMask() 00034 { 00035 return target->get_blue_mask(); 00036 } 00037 00038 virtual unsigned int GetPitch() 00039 { 00040 return target->get_pitch(); 00041 } 00042 00043 virtual void* GetPixels() 00044 { 00045 return target->get_data(); 00046 } 00047 00048 virtual bool Lock() 00049 { 00050 target->lock(); 00051 return true; 00052 } 00053 00054 virtual bool Unlock() 00055 { 00056 target->unlock(); 00057 return true; 00058 } 00059 00060 private: 00061 CL_Target* target; 00062 }; 00063 00064 00065 class CLThreadDrv : public MPEGThreadDrv 00066 { 00067 public: 00068 CLThreadDrv(int (*fn)(void *), void *data) 00069 { 00070 thread = CL_Thread::create(fn, data); 00071 thread->run(); 00072 } 00073 00074 virtual ~CLThreadDrv() 00075 { 00076 delete thread; 00077 } 00078 00079 static CLThreadDrv* Create(int (*fn)(void *), void *data) 00080 { 00081 return new CLThreadDrv(fn, data); 00082 } 00083 00084 virtual int Wait() 00085 { 00086 thread->wait(); 00087 return true; 00088 } 00089 private: 00090 CL_Thread* thread; 00091 }; 00092 00093 00094 class CLMutexDrv : public MPEGMutexDrv 00095 { 00096 public: 00097 CLMutexDrv() 00098 { 00099 mutex = CL_Mutex::create(); 00100 } 00101 00102 virtual ~CLMutexDrv() 00103 { 00104 delete mutex; 00105 } 00106 00107 static CLMutexDrv* Create() 00108 { 00109 return new CLMutexDrv; 00110 } 00111 00112 virtual void Lock() 00113 { 00114 mutex->enter(); 00115 } 00116 virtual void Unlock() 00117 { 00118 mutex->leave(); 00119 } 00120 00121 private: 00122 CL_Mutex* mutex; 00123 }; 00124 00125 00126 class CLSystemDrv : public MPEGSystemDrv 00127 { 00128 public: 00129 static unsigned long GetTime() 00130 { 00131 return CL_System::get_time(); 00132 } 00133 static void Delay(unsigned long time_millis) 00134 { 00135 CL_System::sleep(time_millis); 00136 } 00137 static int SwapBE32(int i) 00138 { 00139 // FIXME!!! 00140 return i; 00141 } 00142 };
1.2.6 written by Dimitri van Heesch,
© 1997-2001