aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmedia/llmediabase.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llmedia/llmediabase.h265
1 files changed, 0 insertions, 265 deletions
diff --git a/linden/indra/llmedia/llmediabase.h b/linden/indra/llmedia/llmediabase.h
deleted file mode 100644
index 3bcee4e..0000000
--- a/linden/indra/llmedia/llmediabase.h
+++ /dev/null
@@ -1,265 +0,0 @@
1/**
2 * @file llmediabase.h
3 * @author Callum Prentice
4 * @date 2007-10-22 00:00:00
5 * @brief Abstract class that defines LLMedia public interface
6 *
7 * $LicenseInfo:firstyear=2005&license=viewergpl$
8 *
9 * Copyright (c) 2005-2009, Linden Research, Inc.
10 *
11 * Second Life Viewer Source Code
12 * The source code in this file ("Source Code") is provided by Linden Lab
13 * to you under the terms of the GNU General Public License, version 2.0
14 * ("GPL"), unless you have obtained a separate licensing agreement
15 * ("Other License"), formally executed by you and Linden Lab. Terms of
16 * the GPL can be found in doc/GPL-license.txt in this distribution, or
17 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
18 *
19 * There are special exceptions to the terms and conditions of the GPL as
20 * it is applied to this Source Code. View the full text of the exception
21 * in the file doc/FLOSS-exception.txt in this software distribution, or
22 * online at
23 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
24 *
25 * By copying, modifying or distributing this software, you acknowledge
26 * that you have read and understood your obligations described above,
27 * and agree to abide by those obligations.
28 *
29 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
30 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
31 * COMPLETENESS OR PERFORMANCE.
32 * $/LicenseInfo$
33 */
34
35#ifndef LLMEDIABASE_H
36#define LLMEDIABASE_H
37
38#if LL_LLMOZLIB_ENABLED && !defined ( MOZILLA_INTERNAL_API )
39 // Without this, nsTAString.h errors out with:
40 // "Cannot use internal string classes without MOZILLA_INTERNAL_API defined. Use the frozen header nsStringAPI.h instead."
41 // It might be worth our while to figure out if we can use the frozen apis at some point...
42 #define MOZILLA_INTERNAL_API 1
43#endif
44
45#include <string>
46
47class LLMediaObserver;
48class LLMediaImplMakerBase;
49
50class LLMediaBase
51{
52 public:
53 LLMediaBase() {};
54 virtual ~LLMediaBase() {};
55
56 ////////////////////////////////////////////////////////////////////////////////
57 // housekeeping
58
59 // local initialization, called by the media manager when creating a source
60 virtual bool init() = 0;
61
62 // undoes everything init() didm called by the media manager when destroying a source
63 virtual bool reset() = 0;
64
65
66 /* Mirrors GStreamer debug levels. */
67 enum EDebugLevel {
68 DEBUG_LEVEL_NONE = 0,
69 DEBUG_LEVEL_ERROR,
70 DEBUG_LEVEL_WARNING,
71 DEBUG_LEVEL_INFO,
72 DEBUG_LEVEL_DEBUG,
73 DEBUG_LEVEL_LOG,
74 DEBUG_LEVEL_COUNT,
75 };
76
77 /* Set the debug verbosity level. Only implemented for GStreamer. */
78 virtual bool setDebugLevel( EDebugLevel level ) = 0;
79
80 // accessor for MIME type
81 virtual bool setMimeType( const std::string mime_type ) = 0;
82 virtual std::string getMimeType() const = 0;
83
84 // accessor for intial URL. Note that this may have changed under the hood
85 // so pass back the original URL seeded to this impl
86 virtual std::string getMediaURL() const = 0;
87
88 // ask impl for version string
89 virtual std::string getVersion() = 0;
90
91 // set/clear URL to visit when a 404 page is reached
92 virtual bool set404RedirectUrl( std::string redirect_url ) = 0;
93 virtual bool clr404RedirectUrl() = 0;
94
95 // sets the background color of the browser window
96 virtual bool setBackgroundColor( unsigned int red, unsigned int green, unsigned int blue ) const = 0;
97
98 // sets the color of the caret in media impls that have one
99 virtual bool setCaretColor( unsigned int red, unsigned int green, unsigned int blue ) const = 0;
100
101 ////////////////////////////////////////////////////////////////////////////////
102 // media management
103
104 // needs to be called regularly to make media stream update itself
105 virtual bool updateMedia() = 0;
106
107 // allows you to request a change in media width, height - may fail if media doesn't support size change
108 virtual bool setRequestedMediaSize( int media_width, int media_height ) = 0;
109
110 // gets media width (may change throughout lifetime of media stream) - event emitted when media size changed too
111 virtual int getMediaWidth() const = 0;
112
113 // gets media height (may change throughout lifetime of media stream) - event emitted when media size changed too
114 virtual int getMediaHeight() const = 0;
115
116 // allows you to try to explicitly change media depth - may fail if media doesn't support depth change
117 virtual bool setMediaDepth( int media_depth ) = 0;
118
119 // gets media depth (may change throughout lifetime of media stream) - event emitted when media depth changed too
120 virtual int getMediaDepth() const = 0;
121
122 // gets size of media buffer for current frame (might NOT be the same as media width * height * depth)
123 virtual int getMediaBufferSize() const = 0;
124
125 // returns pointer to raw media pixels
126 virtual unsigned char* getMediaData() = 0;
127
128 // returns the size of the data, which may be different that the size of the media
129 virtual int getMediaDataWidth() const = 0;
130 virtual int getMediaDataHeight() const = 0;
131
132 ////////////////////////////////////////////////////////////////////////////////
133 // texture management
134
135 // gets internal format to use for OpenGL texture
136 virtual int getTextureFormatInternal() const = 0;
137
138 // gets primary format to use for OpenGL texture
139 virtual int getTextureFormatPrimary() const = 0;
140
141 // gets format type to use for OpenGL texture
142 virtual int getTextureFormatType() const = 0;
143
144
145
146
147 ////////////////////////////////////////////////////////////////////////////////
148 // audio
149
150 // set/get control volume from media stream if present
151 virtual bool setVolume( float volume ) = 0;
152 virtual float getVolume() const = 0;
153
154
155 ////////////////////////////////////////////////////////////////////////////////
156 // transport control etc.
157 enum ECommand {
158 COMMAND_NONE = 0,
159 COMMAND_STOP = 1,
160 COMMAND_START = 2,
161 COMMAND_PAUSE = 4,
162 COMMAND_BACK = 5,
163 COMMAND_FORWARD = 6
164 };
165 enum EStatus {
166 STATUS_UNKNOWN = 0,
167 STATUS_INITIALIZING = 1,
168 STATUS_NAVIGATING = 2,
169 STATUS_STARTED = 3,
170 STATUS_STOPPED = 4,
171 STATUS_PAUSED = 6,
172 STATUS_RESETTING = 7,
173 STATUS_DEAD = 8
174 };
175 virtual bool addCommand( ECommand cmd ) = 0;
176 virtual bool clearCommand() = 0;
177 virtual bool updateCommand() = 0;
178 virtual EStatus getStatus() = 0;
179 virtual bool seek( double time ) = 0;
180 virtual bool setLooping( bool enable) = 0;
181 virtual bool isLooping() = 0;
182
183 ////////////////////////////////////////////////////////////////////////////////
184 // scaling
185
186 // autoscale means try to scale media to size of texture - may fail if media doesn't support size change
187 virtual bool setAutoScaled( bool auto_scaled ) = 0;
188 virtual bool isAutoScaled() const = 0;
189
190
191 ////////////////////////////////////////////////////////////////////////////////
192 // mouse and keyboard interaction
193 virtual bool mouseDown( int x_pos, int y_pos ) = 0;
194 virtual bool mouseUp( int x_pos, int y_pos ) = 0;
195 virtual bool mouseMove( int x_pos, int y_pos ) = 0;
196 virtual bool keyPress( int key_code ) = 0;
197 virtual bool scrollByLines( int lines ) = 0;
198 virtual bool focus( bool focus ) = 0;
199 virtual bool unicodeInput( unsigned long uni_char ) = 0;
200 virtual bool mouseLeftDoubleClick( int x_pos, int y_pos ) = 0;
201
202
203 ////////////////////////////////////////////////////////////////////////////////
204 // navigation
205 virtual bool navigateTo( const std::string url ) = 0;
206 virtual bool navigateForward() = 0;
207 virtual bool navigateBack() = 0;
208 virtual bool canNavigateForward() = 0;
209 virtual bool canNavigateBack() = 0;
210
211 ////////////////////////////////////////////////////////////////////////////////
212 // caching/cookies
213 virtual bool enableCookies( bool enable ) = 0;
214 virtual bool clearCache() = 0;
215 virtual bool clearCookies() = 0;
216
217 ////////////////////////////////////////////////////////////////////////////////
218 // proxy
219 virtual bool enableProxy(bool enable, std::string proxy_host_name, int proxy_port) = 0;
220
221 ////////////////////////////////////////////////////////////////////////////////
222 // observer interface
223 virtual bool addObserver( LLMediaObserver* subject ) = 0;
224 virtual bool remObserver( LLMediaObserver* subject ) = 0;
225
226 ////////////////////////////////////////////////////////////////////////////////
227 // factory interface
228 virtual void setImplMaker(LLMediaImplMakerBase* impl_maker) = 0;
229
230 ////////////////////////////////////////////////////////////////////////////////
231 // type registry interface
232 virtual bool supportsMediaType(std::string scheme, std::string type) = 0;
233};
234
235//////////////////////////////////////////////////////////////
236// media key codes - (mirroring mozilla's values)
237const unsigned long LL_MEDIA_KEY_BACKSPACE = 0x08;
238const unsigned long LL_MEDIA_KEY_TAB = 0x09;
239const unsigned long LL_MEDIA_KEY_RETURN = 0x0D;
240const unsigned long LL_MEDIA_KEY_PAD_RETURN = 0x0E;
241const unsigned long LL_MEDIA_KEY_ESCAPE = 0x1B;
242const unsigned long LL_MEDIA_KEY_PAGE_UP = 0x21;
243const unsigned long LL_MEDIA_KEY_PAGE_DOWN = 0x22;
244const unsigned long LL_MEDIA_KEY_END = 0x23;
245const unsigned long LL_MEDIA_KEY_HOME = 0x24;
246const unsigned long LL_MEDIA_KEY_LEFT = 0x25;
247const unsigned long LL_MEDIA_KEY_UP = 0x26;
248const unsigned long LL_MEDIA_KEY_RIGHT = 0x27;
249const unsigned long LL_MEDIA_KEY_DOWN = 0x28;
250const unsigned long LL_MEDIA_KEY_INSERT = 0x2D;
251const unsigned long LL_MEDIA_KEY_DELETE = 0x2E;
252
253//////////////////////////////////////////////////////////////
254// media frame buffer types - (mirroring GL values)
255const int LL_MEDIA_UNSIGNED_BYTE = 0x1401;
256const int LL_MEDIA_RGB = 0x1907;
257const int LL_MEDIA_RGBA = 0x1908;
258const int LL_MEDIA_RGB8 = 0x8051;
259const int LL_MEDIA_UNSIGNED_INT_8_8_8_8 = 0x8035;
260const int LL_MEDIA_UNSIGNED_INT_8_8_8_8_REV = 0x8367;
261const int LL_MEDIA_BGR = 0x80E0;
262const int LL_MEDIA_BGRA = 0x80E1;
263
264
265#endif // LLMEDIABASE_H