00001
00032 #include "linden_common.h"
00033
00034 #include "llmediabase.h"
00035 #include "llmediaimplquicktime.h"
00036 #include "llmediaimplgstreamer.h"
00037
00038 LLMediaBase::LLMediaBase() :
00039 mBufferChangeCount ( 1 ),
00040 mLastBufferChangeCount ( 0 ),
00041 mMediaWidth ( 0 ),
00042 mMediaHeight ( 0 ),
00043 mMediaDepthBytes ( 0 ),
00044 mMediaRowbytes( 0 ),
00045 mTextureWidth ( 0 ),
00046 mTextureHeight ( 0 ),
00047 mTextureDepth ( 0 ),
00048 mTextureFormatInternal ( 0 ),
00049 mTextureFormatPrimary ( 0 ),
00050 mTextureFormatType ( 0 ),
00051 mTextureFormatSwapBytes ( 0 )
00052 {
00053
00054 }
00055
00057
00058 LLMediaBase* LLMediaBase::make( const MediaType mediaTypeIn, S32 width_pixels, S32 height_pixels )
00059 {
00060 #if LL_QUICKTIME_ENABLED
00061 if ( mediaTypeIn == QuickTime )
00062 {
00063 return new LLMediaImplQuickTime ();
00064 }
00065 else
00066 #endif
00067 #if LL_GSTREAMER_ENABLED
00068 if ( mediaTypeIn == QuickTime )
00069 {
00070 return new LLMediaImplGStreamer ();
00071 }
00072 else
00073 #endif
00074
00075 return 0;
00076 }
00077
00079
00080 BOOL
00081 LLMediaBase::
00082 init ()
00083 {
00084
00085 LLMediaEvent event ( 0, "" );
00086 mMediaEventEmitter.update ( &LLMediaObserver::onInit, event );
00087
00088 return TRUE;
00089 }
00090
00092
00093 BOOL
00094 LLMediaBase::
00095 load ( const LLString& urlIn )
00096 {
00097
00098 LLMediaEvent event ( 0, urlIn );
00099 mMediaEventEmitter.update ( &LLMediaObserver::onLoad, event );
00100
00101 return TRUE;
00102 }
00103
00105
00106 BOOL
00107 LLMediaBase::
00108 unload ()
00109 {
00110 LLMediaEvent event ( 0, "" );
00111 mMediaEventEmitter.update ( &LLMediaObserver::onUnload, event );
00112
00113 return TRUE;
00114 }
00115
00117
00118 S32 LLMediaBase::getTextureWidth() const
00119 {
00120 return mTextureWidth;
00121 }
00122
00124
00125 S32 LLMediaBase::getTextureHeight() const
00126 {
00127 return mTextureHeight;
00128 }
00129
00131
00132 S32 LLMediaBase::getTextureDepth() const
00133 {
00134 return mTextureDepth;
00135 }
00136
00138
00139 S32 LLMediaBase::getTextureFormatInternal() const
00140 {
00141 return mTextureFormatInternal;
00142 }
00143
00145
00146 S32 LLMediaBase::getTextureFormatPrimary() const
00147 {
00148 return mTextureFormatPrimary;
00149 }
00150
00152
00153 S32 LLMediaBase::getTextureFormatType() const
00154 {
00155 return mTextureFormatType;
00156 }
00157
00159
00160 S32 LLMediaBase::getTextureFormatSwapBytes() const
00161 {
00162 return mTextureFormatSwapBytes;
00163 }
00164
00166
00167 S32 LLMediaBase::getMediaWidth() const
00168 {
00169 return mMediaWidth;
00170 }
00171
00173
00174 S32 LLMediaBase::getMediaHeight() const
00175 {
00176 return mMediaHeight;
00177 }
00178
00180
00181 S32 LLMediaBase::getMediaDepthBytes() const
00182 {
00183 return mMediaDepthBytes;
00184 }
00185
00187
00188 S32 LLMediaBase::getMediaBufferSize() const
00189 {
00190 if(mMediaRowbytes != 0)
00191 {
00192 return mMediaHeight * mMediaRowbytes;
00193 }
00194
00195 return mMediaWidth * mMediaHeight * mMediaDepthBytes;
00196 };
00197
00199
00200 BOOL LLMediaBase::addMediaObserver( LLMediaObserver* observerIn )
00201 {
00202 return mMediaEventEmitter.addObserver( observerIn );
00203 }
00204
00206
00207 BOOL LLMediaBase::remMediaObserver( LLMediaObserver* observerIn )
00208 {
00209 return mMediaEventEmitter.remObserver( observerIn );
00210 }