aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmedia/llmediabase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/llmedia/llmediabase.cpp')
-rw-r--r--linden/indra/llmedia/llmediabase.cpp198
1 files changed, 198 insertions, 0 deletions
diff --git a/linden/indra/llmedia/llmediabase.cpp b/linden/indra/llmedia/llmediabase.cpp
new file mode 100644
index 0000000..a27fd34
--- /dev/null
+++ b/linden/indra/llmedia/llmediabase.cpp
@@ -0,0 +1,198 @@
1/**
2 * @file llmediabase.cpp
3 * @brief LLMedia support - base class
4 *
5 * Copyright (c) 2005-2007, Linden Research, Inc.
6 *
7 * The source code in this file ("Source Code") is provided by Linden Lab
8 * to you under the terms of the GNU General Public License, version 2.0
9 * ("GPL"), unless you have obtained a separate licensing agreement
10 * ("Other License"), formally executed by you and Linden Lab. Terms of
11 * the GPL can be found in doc/GPL-license.txt in this distribution, or
12 * online at http://secondlife.com/developers/opensource/gplv2
13 *
14 * There are special exceptions to the terms and conditions of the GPL as
15 * it is applied to this Source Code. View the full text of the exception
16 * in the file doc/FLOSS-exception.txt in this software distribution, or
17 * online at http://secondlife.com/developers/opensource/flossexception
18 *
19 * By copying, modifying or distributing this software, you acknowledge
20 * that you have read and understood your obligations described above,
21 * and agree to abide by those obligations.
22 *
23 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
24 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
25 * COMPLETENESS OR PERFORMANCE.
26 */
27
28#include "linden_common.h"
29
30#include "llmediabase.h"
31#include "llmediaimplquicktime.h"
32
33LLMediaBase::LLMediaBase() :
34 mBufferChangeCount ( 1 ),
35 mLastBufferChangeCount ( 0 ),
36 mMediaWidth ( 0 ),
37 mMediaHeight ( 0 ),
38 mMediaDepthBytes ( 0 ),
39 mMediaRowbytes( 0 ),
40 mTextureWidth ( 0 ),
41 mTextureHeight ( 0 ),
42 mTextureDepth ( 0 ),
43 mTextureFormatInternal ( 0 ),
44 mTextureFormatPrimary ( 0 ),
45 mTextureFormatType ( 0 ),
46 mTextureFormatSwapBytes ( 0 )
47{
48
49}
50
51///////////////////////////////////////////////////////////////////////////////
52// factory method based on explicit media type
53LLMediaBase* LLMediaBase::make( const MediaType mediaTypeIn, S32 width_pixels, S32 height_pixels )
54{
55#if LL_QUICKTIME_ENABLED
56 if ( mediaTypeIn == QuickTime )
57 {
58 return new LLMediaImplQuickTime ();
59 }
60 else
61#endif
62
63 return 0;
64}
65
66///////////////////////////////////////////////////////////////////////////////
67//
68BOOL
69LLMediaBase::
70init ()
71{
72 // build event and emit it
73 LLMediaEvent event ( 0, "" );
74 mMediaEventEmitter.update ( &LLMediaObserver::onInit, event );
75
76 return TRUE;
77}
78
79///////////////////////////////////////////////////////////////////////////////
80//
81BOOL
82LLMediaBase::
83load ( const LLString& urlIn )
84{
85 // build event and emit it
86 LLMediaEvent event ( 0, urlIn );
87 mMediaEventEmitter.update ( &LLMediaObserver::onLoad, event );
88
89 return TRUE;
90}
91
92///////////////////////////////////////////////////////////////////////////////
93//
94BOOL
95LLMediaBase::
96unload ()
97{
98 LLMediaEvent event ( 0, "" );
99 mMediaEventEmitter.update ( &LLMediaObserver::onUnload, event );
100
101 return TRUE;
102}
103
104///////////////////////////////////////////////////////////////////////////////
105//
106S32 LLMediaBase::getTextureWidth() const
107{
108 return mTextureWidth;
109}
110
111///////////////////////////////////////////////////////////////////////////////
112//
113S32 LLMediaBase::getTextureHeight() const
114{
115 return mTextureHeight;
116}
117
118///////////////////////////////////////////////////////////////////////////////
119//
120S32 LLMediaBase::getTextureDepth() const
121{
122 return mTextureDepth;
123}
124
125///////////////////////////////////////////////////////////////////////////////
126//
127S32 LLMediaBase::getTextureFormatInternal() const
128{
129 return mTextureFormatInternal;
130}
131
132///////////////////////////////////////////////////////////////////////////////
133//
134S32 LLMediaBase::getTextureFormatPrimary() const
135{
136 return mTextureFormatPrimary;
137}
138
139///////////////////////////////////////////////////////////////////////////////
140//
141S32 LLMediaBase::getTextureFormatType() const
142{
143 return mTextureFormatType;
144}
145
146///////////////////////////////////////////////////////////////////////////////
147//
148S32 LLMediaBase::getTextureFormatSwapBytes() const
149{
150 return mTextureFormatSwapBytes;
151}
152
153///////////////////////////////////////////////////////////////////////////////
154//
155S32 LLMediaBase::getMediaWidth() const
156{
157 return mMediaWidth;
158}
159
160///////////////////////////////////////////////////////////////////////////////
161//
162S32 LLMediaBase::getMediaHeight() const
163{
164 return mMediaHeight;
165}
166
167///////////////////////////////////////////////////////////////////////////////
168//
169S32 LLMediaBase::getMediaDepthBytes() const
170{
171 return mMediaDepthBytes;
172}
173
174///////////////////////////////////////////////////////////////////////////////
175//
176S32 LLMediaBase::getMediaBufferSize() const
177{
178 if(mMediaRowbytes != 0)
179 {
180 return mMediaHeight * mMediaRowbytes;
181 }
182
183 return mMediaWidth * mMediaHeight * mMediaDepthBytes;
184};
185
186///////////////////////////////////////////////////////////////////////////////
187//
188BOOL LLMediaBase::addMediaObserver( LLMediaObserver* observerIn )
189{
190 return mMediaEventEmitter.addObserver( observerIn );
191}
192
193///////////////////////////////////////////////////////////////////////////////
194//
195BOOL LLMediaBase::remMediaObserver( LLMediaObserver* observerIn )
196{
197 return mMediaEventEmitter.remObserver( observerIn );
198}