aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmedia
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-x[-rw-r--r--]linden/indra/llmath/llsdutil_math.h (renamed from linden/indra/llmedia/llmediaimplexample2.h)76
-rw-r--r--linden/indra/llmedia/CMakeLists.txt81
-rw-r--r--linden/indra/llmedia/llgstplaythread.cpp54
-rw-r--r--linden/indra/llmedia/llgstplaythread.h62
-rw-r--r--linden/indra/llmedia/llmediabase.h265
-rw-r--r--linden/indra/llmedia/llmediaemitter.h104
-rw-r--r--linden/indra/llmedia/llmediaimplcommon.cpp552
-rw-r--r--linden/indra/llmedia/llmediaimplcommon.h164
-rw-r--r--linden/indra/llmedia/llmediaimplexample1.cpp231
-rw-r--r--linden/indra/llmedia/llmediaimplexample2.cpp198
-rw-r--r--linden/indra/llmedia/llmediaimplfactory.cpp105
-rw-r--r--linden/indra/llmedia/llmediaimplfactory.h100
-rw-r--r--linden/indra/llmedia/llmediaimplgstreamer.cpp928
-rw-r--r--linden/indra/llmedia/llmediaimplgstreamer.h164
-rw-r--r--linden/indra/llmedia/llmediaimplllmozlib.cpp624
-rw-r--r--linden/indra/llmedia/llmediaimplllmozlib.h127
-rw-r--r--linden/indra/llmedia/llmediaimplquicktime.cpp657
-rw-r--r--linden/indra/llmedia/llmediaimplquicktime.h112
-rw-r--r--linden/indra/llmedia/llmediamanager.cpp295
-rw-r--r--linden/indra/llmedia/llmediamanager.h127
-rw-r--r--linden/indra/llmedia/llmediaobserver.h116
-rwxr-xr-x[-rw-r--r--]linden/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.cpp (renamed from linden/indra/llmedia/llmediaimplgstreamervidplug.cpp)170
-rwxr-xr-x[-rw-r--r--]linden/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.h (renamed from linden/indra/llmedia/llmediaimplgstreamervidplug.h)23
-rw-r--r--linden/indra/newview/llpanellandaudio.h (renamed from linden/indra/llmedia/llmediaimplregister.h)49
-rw-r--r--linden/indra/newview/llviewermediaobserver.h (renamed from linden/indra/llmedia/llmediaimplexample1.h)66
25 files changed, 255 insertions, 5195 deletions
diff --git a/linden/indra/llmedia/llmediaimplexample2.h b/linden/indra/llmath/llsdutil_math.h
index 6a4f80b..5b64942 100644..100755
--- a/linden/indra/llmedia/llmediaimplexample2.h
+++ b/linden/indra/llmath/llsdutil_math.h
@@ -1,10 +1,12 @@
1/** 1/**
2 * @file llmediaimplexample2.h 2 * @file llsdutil_math.h
3 * @brief Example 2 of a media impl concrete class 3 * @author Brad
4 * @date 2009-05-19
5 * @brief Utility classes, functions, etc, for using structured data with math classes.
4 * 6 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$ 7 * $LicenseInfo:firstyear=2009&license=viewergpl$
6 * 8 *
7 * Copyright (c) 2007-2009, Linden Research, Inc. 9 * Copyright (c) 2009-2010, Linden Research, Inc.
8 * 10 *
9 * Second Life Viewer Source Code 11 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 12 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -30,47 +32,39 @@
30 * $/LicenseInfo$ 32 * $/LicenseInfo$
31 */ 33 */
32 34
33#ifndef LLMEDIAIMPLEXAMPLE2_H 35#ifndef LL_LLSDUTIL_MATH_H
34#define LLMEDIAIMPLEXAMPLE2_H 36#define LL_LLSDUTIL_MATH_H
35 37
36#include "llmediaimplcommon.h" 38class LL_COMMON_API LLSD;
37#include "llmediaimplfactory.h"
38 39
39class LLMediaManagerData; 40// vector3
40class LLMediaImplMaker; 41class LLVector3;
42LLSD ll_sd_from_vector3(const LLVector3& vec);
43LLVector3 ll_vector3_from_sd(const LLSD& sd, S32 start_index = 0);
41 44
42class LLMediaImplExample2 : 45// vector4
43 public LLMediaImplCommon 46class LLVector4;
44{ 47LLSD ll_sd_from_vector4(const LLVector4& vec);
45 public: 48LLVector4 ll_vector4_from_sd(const LLSD& sd, S32 start_index = 0);
46 LLMediaImplExample2();
47 49
48 static bool startup( LLMediaManagerData* init_data ); 50// vector3d (double)
49 static bool closedown(); 51class LLVector3d;
52LLSD ll_sd_from_vector3d(const LLVector3d& vec);
53LLVector3d ll_vector3d_from_sd(const LLSD& sd, S32 start_index = 0);
50 54
51 /* virtual */ bool init(); 55// vector2
52 /* virtual */ bool navigateTo( const std::string url ); 56class LLVector2;
53 /* virtual */ bool load( const std::string url ); 57LLSD ll_sd_from_vector2(const LLVector2& vec);
54 /* virtual */ std::string getVersion(); 58LLVector2 ll_vector2_from_sd(const LLSD& sd);
55 /* virtual */ bool updateMedia();
56 /* virtual */ unsigned char* getMediaData();
57 /* virtual */ bool reset();
58 /* virtual */ bool setRequestedMediaSize( int width, int height );
59 59
60 private: 60// Quaternion
61 unsigned char* mMediaPixels; 61class LLQuaternion;
62 int mXpos; 62LLSD ll_sd_from_quaternion(const LLQuaternion& quat);
63 int mYpos; 63LLQuaternion ll_quaternion_from_sd(const LLSD& sd);
64};
65 64
66class LLMediaImplExample2Maker : public LLMediaImplMaker 65// color4
67{ 66class LLColor4;
68 public: 67LLSD ll_sd_from_color4(const LLColor4& c);
69 LLMediaImplExample2Maker(); 68LLColor4 ll_color4_from_sd(const LLSD& sd);
70 LLMediaImplExample2* create()
71 {
72 return new LLMediaImplExample2();
73 }
74};
75 69
76#endif // LLMEDIAIMPLEXAMPLE2_H 70#endif // LL_LLSDUTIL_MATH_H
diff --git a/linden/indra/llmedia/CMakeLists.txt b/linden/indra/llmedia/CMakeLists.txt
deleted file mode 100644
index f3c8e30..0000000
--- a/linden/indra/llmedia/CMakeLists.txt
+++ /dev/null
@@ -1,81 +0,0 @@
1# -*- cmake -*-
2
3project(llmedia)
4
5include(00-Common)
6include(LLAudio)
7include(LLCommon)
8include(LLImage)
9include(LLMath)
10include(LLMedia)
11include(LLMessage)
12include(LLWindow)
13include(Mozlib)
14
15include_directories(
16 ${GSTREAMER_INCLUDE_DIRS}
17 ${GSTREAMER_PLUGINS_BASE_INCLUDE_DIRS}
18 ${GSTREAMER_VIDEO_INCLUDE_DIRS}
19 ${LLAUDIO_INCLUDE_DIRS}
20 ${LLCOMMON_INCLUDE_DIRS}
21 ${LLIMAGE_INCLUDE_DIRS}
22 ${LLMATH_INCLUDE_DIRS}
23 ${LLMESSAGE_INCLUDE_DIRS}
24 ${LLWINDOW_INCLUDE_DIRS}
25 )
26
27set(llmedia_SOURCE_FILES
28 llmediaimplcommon.cpp
29 llmediaimplexample1.cpp
30 llmediaimplexample2.cpp
31 llmediaimplfactory.cpp
32 llmediamanager.cpp
33 llmediaimplgstreamer.cpp
34 llmediaimplgstreamervidplug.cpp
35 llgstplaythread.cpp
36 )
37
38set(llmedia_HEADER_FILES
39 CMakeLists.txt
40
41 llmediabase.h
42 llmediaemitter.h
43 llmediaimplcommon.h
44 llmediaimplexample1.h
45 llmediaimplexample2.h
46 llmediaimplfactory.h
47 llmediaimplregister.h
48 llmediamanager.h
49 llmediaobserver.h
50 llmediaimplgstreamer.h
51 llmediaimplgstreamervidplug.h
52 llgstplaythread.h
53 )
54
55 # Work around a bad interaction between broken gstreamer headers and
56 # g++ 4.3's increased strictness.
57
58 if (${CXX_VERSION} MATCHES "4.[23]")
59 set_source_files_properties(llmediaimplgstreamervidplug.cpp PROPERTIES
60 COMPILE_FLAGS -Wno-error=write-strings)
61 endif (${CXX_VERSION} MATCHES "4.[23]")
62
63if (MOZLIB)
64 list(APPEND llmedia_SOURCE_FILES llmediaimplllmozlib.cpp)
65
66 list(APPEND llmedia_HEADER_FILES llmediaimplllmozlib.h)
67endif (MOZLIB)
68
69set_source_files_properties(${llmedia_HEADER_FILES}
70 PROPERTIES HEADER_FILE_ONLY TRUE)
71
72list(APPEND llmedia_SOURCE_FILES ${llmedia_HEADER_FILES})
73
74add_library (llmedia ${llmedia_SOURCE_FILES})
75target_link_libraries(
76 llmedia
77 ${GSTREAMER_LIBRARIES}
78 ${GSTREAMER_PLUGINS_BASE_LIBRARIES}
79 ${GSTREAMER_VIDEO_LIBRARIES}
80 ${QUICKTIME_LIBRARY}
81 )
diff --git a/linden/indra/llmedia/llgstplaythread.cpp b/linden/indra/llmedia/llgstplaythread.cpp
deleted file mode 100644
index 152f9d9..0000000
--- a/linden/indra/llmedia/llgstplaythread.cpp
+++ /dev/null
@@ -1,54 +0,0 @@
1/**
2 * @file llgstplaythread.cpp
3 * @author Jacek Antonelli
4 * @brief GStreamer playback management thread class
5 *
6 * $LicenseInfo:firstyear=2009&license=viewergpl$
7 *
8 * Copyright (c) 2009, Jacek Antonelli
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of version 2 of the GNU General Public
12 * License as published by the Free Software Foundation. Terms of
13 * the GPL can be found in doc/GPL-license.txt in this distribution, or
14 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
15 *
16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 *
30 * $/LicenseInfo$
31 */
32
33#include "llgstplaythread.h"
34#include "llmediaimplgstreamer.h"
35
36LLGstPlayThread::
37LLGstPlayThread( LLMediaImplCommon *impl,
38 const std::string& name, apr_pool_t *poolp ):
39 LLThread( name, poolp ),
40 mMediaImpl( impl )
41{
42}
43
44
45LLGstPlayThread::~LLGstPlayThread()
46{
47}
48
49
50// virtual
51void LLGstPlayThread::run()
52{
53 ((LLMediaImplGStreamer *)mMediaImpl)->startPlay();
54}
diff --git a/linden/indra/llmedia/llgstplaythread.h b/linden/indra/llmedia/llgstplaythread.h
deleted file mode 100644
index c3c36a7..0000000
--- a/linden/indra/llmedia/llgstplaythread.h
+++ /dev/null
@@ -1,62 +0,0 @@
1/**
2 * @file llgstplaythread.h
3 * @author Jacek Antonelli
4 * @brief GStreamer playback management thread class
5 *
6 * $LicenseInfo:firstyear=2009&license=viewergpl$
7 *
8 * Copyright (c) 2009, Jacek Antonelli
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of version 2 of the GNU General Public
12 * License as published by the Free Software Foundation. Terms of
13 * the GPL can be found in doc/GPL-license.txt in this distribution, or
14 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
15 *
16 * There are special exceptions to the terms and conditions of the GPL as
17 * it is applied to this Source Code. View the full text of the exception
18 * in the file doc/FLOSS-exception.txt in this software distribution, or
19 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
20 *
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 *
30 * $/LicenseInfo$
31 */
32
33
34#ifndef LL_LLGSTPLAYTHREAD_H
35#define LL_LLGSTPLAYTHREAD_H
36
37#include "linden_common.h"
38
39#include "llthread.h"
40#include "llmediaimplcommon.h"
41
42class LLGstPlayThread: public LLThread
43{
44 public:
45
46 LLGstPlayThread( LLMediaImplCommon *impl,
47 const std::string& name, apr_pool_t *poolp );
48
49 ~LLGstPlayThread();
50
51 virtual void run();
52
53 private:
54
55 // Actually, this will really only be an LLMediaImplGStreamer.
56 // But we have to jump through some hoops to mutual pointer-holding.
57 // There may be a better way, but I don't have the motivation to find it.
58 LLMediaImplCommon *mMediaImpl;
59};
60
61
62#endif // LL_LLGSTPLAYTHREAD_H
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
diff --git a/linden/indra/llmedia/llmediaemitter.h b/linden/indra/llmedia/llmediaemitter.h
deleted file mode 100644
index ef3caeb..0000000
--- a/linden/indra/llmedia/llmediaemitter.h
+++ /dev/null
@@ -1,104 +0,0 @@
1/**
2 * @file llmediaemitter.h
3 * @author Callum Prentice
4 * @date 2007-10-22 00:00:00
5 * @brief Manages and emits events to observers
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 LLMEDIAEMITTER_H
36#define LLMEDIAEMITTER_H
37
38#include <list>
39#include <algorithm>
40#include <typeinfo>
41
42///////////////////////////////////////////////////////////////////////////////
43//
44template< class T >
45class LLMediaEmitter
46{
47 public:
48 LLMediaEmitter() { };
49 ~LLMediaEmitter() { };
50
51 typedef typename T::EventType EventType;
52 typedef std::list< T* > ObserverContainer;
53 typedef void( T::*observerMethod )( const EventType& );
54
55 ///////////////////////////////////////////////////////////////////////////////
56 //
57 bool addObserver( T* observer_in )
58 {
59 if ( ! observer_in )
60 return false;
61
62 if ( std::find( observers.begin(), observers.end(), observer_in) != observers.end() )
63 return false;
64
65 observers.push_back( observer_in );
66
67 return true;
68 };
69
70 ///////////////////////////////////////////////////////////////////////////////
71 //
72 bool remObserver( T* observer_in )
73 {
74 if ( ! observer_in )
75 return false;
76
77 observers.remove( observer_in );
78 observers.remove( observer_in );
79 observers.remove( observer_in );
80
81
82
83 return true;
84 };
85
86 ///////////////////////////////////////////////////////////////////////////////
87 //
88 void update( observerMethod method, const EventType& msgIn )
89 {
90 typename std::list< T* >::iterator iter = observers.begin();
91
92 while( iter != observers.end() )
93 {
94 ( ( *iter )->*method )( msgIn );
95
96 ++iter;
97 };
98 };
99
100 protected:
101 ObserverContainer observers;
102};
103
104#endif // LLMEDIAEMITTER_H
diff --git a/linden/indra/llmedia/llmediaimplcommon.cpp b/linden/indra/llmedia/llmediaimplcommon.cpp
deleted file mode 100644
index 166e86d..0000000
--- a/linden/indra/llmedia/llmediaimplcommon.cpp
+++ /dev/null
@@ -1,552 +0,0 @@
1/**
2 * @file llmediaimplcommon.cpp
3 * @brief Common impl functionality
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#include "llmediaimplcommon.h"
34#include "llmediaemitter.h"
35#include "llmediaimplfactory.h"
36#include "llmediaobserver.h"
37
38#ifdef WIN32
39 // platform specific includes needed before OpenGL header
40 #include <windows.h>
41 #include <GL/gl.h>
42#elif defined(__APPLE__)
43 // framework-style include path when building on the Mac.
44 #include <OpenGL/gl.h>
45#else // Assume this is linux
46 // Linux, MESA headers, but not necessarily assuming MESA runtime.
47 // quotes so we get libraries/.../GL/ version
48 #include "GL/gl.h"
49#endif
50
51////////////////////////////////////////////////////////////////////////////////
52// virtual (derives from LLMediaBase)
53LLMediaImplCommon::LLMediaImplCommon() :
54 mMimeType( std::string() ),
55 mInitialURL( std::string() ),
56 mImplMaker( NULL ),
57 mAutoScaled( false ),
58 mMediaWidth( 0 ),
59 mMediaPrevWidth( 0 ),
60 mMediaHeight( 0 ),
61 mMediaPrevHeight( 0 ),
62 mMediaDepth( 0 ),
63 mMediaPrevDepth( 0 ),
64 mMediaRowSpan( 0 ),
65 mMediaRequestedWidth( 0 ),
66 mMediaRequestedHeight( 0 ),
67 mCommand( LLMediaBase::COMMAND_NONE ),
68 mStatus( LLMediaBase::STATUS_UNKNOWN ),
69 mVolume( 0 ),
70 mLooping( false ),
71 mDebugLevel( LLMediaBase::DEBUG_LEVEL_NONE )
72{
73}
74
75////////////////////////////////////////////////////////////////////////////////
76// virtual (derives from LLMediaBase)
77LLMediaImplCommon::~LLMediaImplCommon()
78{
79}
80
81////////////////////////////////////////////////////////////////////////////////
82// virtual (derives from LLMediaBase)
83bool LLMediaImplCommon::init()
84{
85 return false;
86}
87
88////////////////////////////////////////////////////////////////////////////////
89// virtual (derives from LLMediaBase)
90bool LLMediaImplCommon::reset()
91{
92 return false;
93}
94
95////////////////////////////////////////////////////////////////////////////////
96// virtual (derives from LLMediaBase)
97bool LLMediaImplCommon::setDebugLevel( LLMediaBase::EDebugLevel level )
98{
99 mDebugLevel = level;
100
101 return true;
102}
103
104////////////////////////////////////////////////////////////////////////////////
105// virtual (derives from LLMediaBase)
106bool LLMediaImplCommon::setMimeType( const std::string mime_type )
107{
108 mMimeType = mime_type;
109
110 return true;
111}
112
113////////////////////////////////////////////////////////////////////////////////
114// virtual (derives from LLMediaBase)
115std::string LLMediaImplCommon::getMimeType() const
116{
117 return mMimeType;
118}
119
120////////////////////////////////////////////////////////////////////////////////
121// virtual (derives from LLMediaBase)
122std::string LLMediaImplCommon::getMediaURL() const
123{
124 return mInitialURL;
125}
126
127////////////////////////////////////////////////////////////////////////////////
128// virtual (derives from LLMediaBase)
129std::string LLMediaImplCommon::getVersion()
130{
131 return std::string( "" );
132}
133
134////////////////////////////////////////////////////////////////////////////////
135// virtual (derives from LLMediaBase)
136bool LLMediaImplCommon::set404RedirectUrl( std::string redirect_url )
137{
138 return true;
139}
140
141////////////////////////////////////////////////////////////////////////////////
142// virtual (derives from LLMediaBase)
143bool LLMediaImplCommon::clr404RedirectUrl()
144{
145 return true;
146}
147
148////////////////////////////////////////////////////////////////////////////////
149// virtual (derives from LLMediaBase)
150bool LLMediaImplCommon::setBackgroundColor( unsigned int red, unsigned int green, unsigned int blue ) const
151{
152 return true;
153}
154
155////////////////////////////////////////////////////////////////////////////////
156// virtual (derives from LLMediaBase)
157bool LLMediaImplCommon::setCaretColor( unsigned int red, unsigned int green, unsigned int blue ) const
158{
159 return true;
160}
161
162////////////////////////////////////////////////////////////////////////////////
163// virtual (derives from LLMediaBase)
164bool LLMediaImplCommon::updateMedia()
165{
166 return false;
167}
168
169////////////////////////////////////////////////////////////////////////////////
170// virtual (derives from LLMediaBase)
171unsigned char* LLMediaImplCommon::getMediaData()
172{
173 return 0;
174}
175
176////////////////////////////////////////////////////////////////////////////////
177// virtual (derives from LLMediaBase)
178int LLMediaImplCommon::getMediaDataWidth() const
179{
180 return getMediaWidth();
181}
182
183////////////////////////////////////////////////////////////////////////////////
184// virtual (derives from LLMediaBase)
185int LLMediaImplCommon::getMediaDataHeight() const
186{
187 return getMediaHeight();
188}
189
190
191////////////////////////////////////////////////////////////////////////////////
192// virtual (derives from LLMediaBase)
193bool LLMediaImplCommon::setMediaSize( int media_width, int media_height )
194{
195 // if nothing changed, don't do anything
196 if ( ( mMediaWidth == media_width ) &&
197 ( mMediaHeight == media_height ) )
198 return false;
199
200 // save old values so we can tell elsewhere if media size has changed
201 mMediaPrevWidth = mMediaWidth;
202 mMediaPrevHeight = mMediaHeight;
203
204 mMediaWidth = media_width;
205 mMediaHeight = media_height;
206
207 // only fire an event if the width changed
208 LLMediaEvent event( this );
209 mEventEmitter.update( &LLMediaObserver::onMediaSizeChange, event );
210
211 return true;
212}
213
214////////////////////////////////////////////////////////////////////////////////
215// virtual (derives from LLMediaBase)
216int LLMediaImplCommon::getMediaWidth() const
217{
218 return mMediaWidth;
219}
220
221
222////////////////////////////////////////////////////////////////////////////////
223// virtual (derives from LLMediaBase)
224int LLMediaImplCommon::getMediaHeight() const
225{
226 return mMediaHeight;
227}
228
229////////////////////////////////////////////////////////////////////////////////
230// virtual (derives from LLMediaBase)
231bool LLMediaImplCommon::setRequestedMediaSize(int width, int height)
232{
233 mMediaRequestedWidth = width;
234 mMediaRequestedHeight = height;
235
236 return true;
237}
238
239////////////////////////////////////////////////////////////////////////////////
240// virtual (derives from LLMediaBase)
241bool LLMediaImplCommon::setMediaDepth( int media_depth )
242{
243 // if nothing changed, don't do anything
244 if ( mMediaDepth == media_depth )
245 return false;
246
247 // save old values so we can tell elsewhere if media size has changed
248 mMediaPrevDepth = mMediaDepth;
249 mMediaDepth = media_depth;
250
251 // update value of rowspan too since it's based on media width & depth
252 mMediaRowSpan = mMediaWidth * mMediaDepth;
253
254 // only fire an event if the depth changed
255 //LLMediaEvent event( this );
256 //mEventEmitter.update( &LLMediaObserver::onMediaSizeChange, event );
257
258 return true;
259}
260
261////////////////////////////////////////////////////////////////////////////////
262// virtual (derives from LLMediaBase)
263int LLMediaImplCommon::getMediaDepth() const
264{
265 return mMediaDepth;
266}
267
268////////////////////////////////////////////////////////////////////////////////
269// virtual (derives from LLMediaBase)
270int LLMediaImplCommon::getMediaBufferSize() const
271{
272 return mMediaRowSpan * mMediaHeight;
273}
274
275////////////////////////////////////////////////////////////////////////////////
276// virtual (derives from LLMediaBase)
277int LLMediaImplCommon::getTextureFormatInternal() const
278{
279 return LL_MEDIA_RGB;
280}
281
282////////////////////////////////////////////////////////////////////////////////
283// virtual (derives from LLMediaBase)
284int LLMediaImplCommon::getTextureFormatPrimary() const
285{
286 return LL_MEDIA_RGB;
287}
288
289////////////////////////////////////////////////////////////////////////////////
290// virtual (derives from LLMediaBase)
291int LLMediaImplCommon::getTextureFormatType() const
292{
293 return LL_MEDIA_UNSIGNED_BYTE;
294}
295
296////////////////////////////////////////////////////////////////////////////////
297// virtual (derives from LLMediaBase)
298bool LLMediaImplCommon::setVolume( float volume )
299{
300 mVolume = volume;
301
302 return true;
303}
304
305////////////////////////////////////////////////////////////////////////////////
306// virtual (derives from LLMediaBase)
307float LLMediaImplCommon::getVolume() const
308{
309 return mVolume;
310}
311
312////////////////////////////////////////////////////////////////////////////////
313// virtual (derives from LLMediaBase)
314bool LLMediaImplCommon::addCommand( LLMediaBase::ECommand cmd )
315{
316 // eventually will be a std::queue so you can add multiple commands
317 mCommand = cmd;
318
319 return true;
320}
321
322////////////////////////////////////////////////////////////////////////////////
323// virtual (derives from LLMediaBase)
324bool LLMediaImplCommon::clearCommand()
325{
326 // eventually will be a std::queue so you can add multiple commands
327 mCommand = LLMediaBase::COMMAND_NONE;
328
329 return true;
330}
331
332////////////////////////////////////////////////////////////////////////////////
333// virtual (derives from LLMediaBase)
334bool LLMediaImplCommon::updateCommand()
335{
336 if ( nextCommand() == LLMediaBase::COMMAND_START )
337 {
338 setStatus( LLMediaBase::STATUS_STARTED );
339 clearCommand();
340 };
341
342 if ( nextCommand() == LLMediaBase::COMMAND_STOP )
343 {
344 setStatus( LLMediaBase::STATUS_STOPPED );
345 clearCommand();
346 };
347
348 if ( nextCommand() == LLMediaBase::COMMAND_PAUSE )
349 {
350 setStatus( LLMediaBase::STATUS_PAUSED );
351 clearCommand();
352 };
353
354 return true;
355}
356
357////////////////////////////////////////////////////////////////////////////////
358// non-virtual (only impls use this)
359LLMediaBase::ECommand LLMediaImplCommon::nextCommand()
360{
361 return mCommand;
362}
363
364////////////////////////////////////////////////////////////////////////////////
365// virtual (derives from LLMediaBase)
366LLMediaBase::EStatus LLMediaImplCommon::getStatus()
367{
368 return mStatus;
369}
370
371////////////////////////////////////////////////////////////////////////////////
372// non-virtual (only impls set this)
373bool LLMediaImplCommon::setStatus( LLMediaBase::EStatus status )
374{
375 mStatus = status;
376
377 return true;
378}
379
380////////////////////////////////////////////////////////////////////////////////
381// virtual (derives from LLMediaBase)
382bool LLMediaImplCommon::seek( double time )
383{
384 return false;
385}
386
387////////////////////////////////////////////////////////////////////////////////
388// virtual (derives from LLMediaBase)
389bool LLMediaImplCommon::navigateTo( const std::string url )
390{
391 return false;
392}
393
394////////////////////////////////////////////////////////////////////////////////
395// virtual (derives from LLMediaBase)
396bool LLMediaImplCommon::setAutoScaled( bool auto_scaled )
397{
398 mAutoScaled = auto_scaled;
399
400 return true;
401}
402
403////////////////////////////////////////////////////////////////////////////////
404// virtual (derives from LLMediaBase)
405bool LLMediaImplCommon::isAutoScaled() const
406{
407 return mAutoScaled;
408}
409
410////////////////////////////////////////////////////////////////////////////////
411// virtual (derives from LLMediaBase)
412bool LLMediaImplCommon::mouseDown( int x_pos, int y_pos )
413{
414 return false;
415}
416
417////////////////////////////////////////////////////////////////////////////////
418// virtual (derives from LLMediaBase)
419bool LLMediaImplCommon::mouseUp( int x_pos, int y_pos )
420{
421 return false;
422}
423
424////////////////////////////////////////////////////////////////////////////////
425// virtual (derives from LLMediaBase)
426bool LLMediaImplCommon::mouseMove( int x_pos, int y_pos )
427{
428 return false;
429}
430
431////////////////////////////////////////////////////////////////////////////////
432// virtual (derives from LLMediaBase)
433bool LLMediaImplCommon::keyPress( int key_code )
434{
435 return false;
436}
437
438////////////////////////////////////////////////////////////////////////////////
439// virtual (derives from LLMediaBase)
440bool LLMediaImplCommon::scrollByLines( int lines )
441{
442 return false;
443}
444
445////////////////////////////////////////////////////////////////////////////////
446// virtual (derives from LLMediaBase)
447bool LLMediaImplCommon::focus( bool focus )
448{
449 return false;
450}
451
452////////////////////////////////////////////////////////////////////////////////
453// virtual (derives from LLMediaBase)
454bool LLMediaImplCommon::unicodeInput( unsigned long uni_char )
455{
456 return false;
457}
458
459////////////////////////////////////////////////////////////////////////////////
460// virtual (derives from LLMediaBase)
461bool LLMediaImplCommon::mouseLeftDoubleClick( int x_pos, int y_pos )
462{
463 return false;
464}
465
466////////////////////////////////////////////////////////////////////////////////
467// virtual (derives from LLMediaBase)
468bool LLMediaImplCommon::navigateForward()
469{
470 return false;
471}
472
473////////////////////////////////////////////////////////////////////////////////
474// virtual (derives from LLMediaBase)
475bool LLMediaImplCommon::navigateBack()
476{
477 return false;
478}
479
480////////////////////////////////////////////////////////////////////////////////
481// virtual (derives from LLMediaBase)
482bool LLMediaImplCommon::canNavigateForward()
483{
484 return false;
485}
486
487////////////////////////////////////////////////////////////////////////////////
488// virtual (derives from LLMediaBase)
489bool LLMediaImplCommon::canNavigateBack()
490{
491 return false;
492}
493
494////////////////////////////////////////////////////////////////////////////////
495// virtual (derives from LLMediaBase)
496bool LLMediaImplCommon::enableCookies( bool enable )
497{
498 return false;
499}
500
501////////////////////////////////////////////////////////////////////////////////
502// virtual (derives from LLMediaBase)
503bool LLMediaImplCommon::clearCache()
504{
505 return false;
506}
507
508////////////////////////////////////////////////////////////////////////////////
509// virtual (derives from LLMediaBase)
510bool LLMediaImplCommon::clearCookies()
511{
512 return false;
513}
514
515////////////////////////////////////////////////////////////////////////////////
516// virtual (derives from LLMediaBase)
517bool LLMediaImplCommon::enableProxy(bool enable, std::string proxy_host_name, int proxy_port)
518{
519 return false;
520}
521////////////////////////////////////////////////////////////////////////////////
522//
523bool LLMediaImplCommon::addObserver( LLMediaObserver* subject )
524{
525 return mEventEmitter.addObserver( subject );
526}
527
528////////////////////////////////////////////////////////////////////////////////
529//
530bool LLMediaImplCommon::remObserver( LLMediaObserver* subject )
531{
532 return mEventEmitter.remObserver( subject );
533}
534
535////////////////////////////////////////////////////////////////////////////////
536//
537void LLMediaImplCommon::setImplMaker(LLMediaImplMakerBase* impl_maker)
538{
539 mImplMaker = impl_maker;
540}
541////////////////////////////////////////////////////////////////////////////////
542//
543bool LLMediaImplCommon::supportsMediaType(std::string scheme, std::string type)
544{
545 int idx1 = type.find("/");
546 int len = (idx1 == std::string::npos) ? 0 : idx1;
547 std::string category = type.substr(0,len);
548
549 return mImplMaker->supportsScheme(scheme) ||
550 mImplMaker->supportsMimeType(type) ||
551 mImplMaker->supportsMimeTypeCategory(category);
552}
diff --git a/linden/indra/llmedia/llmediaimplcommon.h b/linden/indra/llmedia/llmediaimplcommon.h
deleted file mode 100644
index 845429c..0000000
--- a/linden/indra/llmedia/llmediaimplcommon.h
+++ /dev/null
@@ -1,164 +0,0 @@
1/**
2 * @file llmediaimplcommon.h
3 * @brief Common impl functionality
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#ifndef LLMEDIAIMPLCOMMON_H
34#define LLMEDIAIMPLCOMMON_H
35
36#include "llmediabase.h"
37#include "llmediaemitter.h"
38#include "llmediaobserver.h"
39
40#include <string>
41
42class LLMediaImplMakerBase;
43
44class LLMediaImplCommon :
45 public LLMediaBase
46{
47 public:
48 LLMediaImplCommon();
49 virtual ~LLMediaImplCommon();
50
51 ////////////////////////////////////////////////////////////////////////////////
52 // begin: default implementation of the abstract interface
53 // see llmediabase.h for documentation
54
55 // housekeeping
56 virtual bool init();
57 virtual bool reset();
58 virtual bool setDebugLevel( LLMediaBase::EDebugLevel level );
59 virtual bool setMimeType( const std::string url );
60 virtual std::string getMimeType() const;
61 virtual std::string getMediaURL() const;
62 virtual std::string getVersion();
63 virtual bool set404RedirectUrl( std::string redirect_url );
64 virtual bool clr404RedirectUrl();
65 virtual bool setBackgroundColor( unsigned int red, unsigned int green, unsigned int blue ) const;
66 virtual bool setCaretColor( unsigned int red, unsigned int green, unsigned int blue ) const;
67
68 // media management
69 virtual bool updateMedia();
70 virtual bool setRequestedMediaSize( int width, int height );
71 virtual int getMediaWidth() const;
72 virtual int getMediaHeight() const;
73 virtual int getMediaDepth() const;
74 virtual int getMediaBufferSize() const;
75 virtual unsigned char* getMediaData();
76 virtual int getMediaDataWidth() const;
77 virtual int getMediaDataHeight() const;
78
79 // texture management
80 virtual int getTextureFormatInternal() const;
81 virtual int getTextureFormatPrimary() const;
82 virtual int getTextureFormatType() const;
83
84 // audio
85 virtual bool setVolume( float volume );
86 virtual float getVolume() const;
87
88 // transport control
89 virtual bool addCommand( ECommand cmd );
90 virtual bool clearCommand();
91 virtual bool updateCommand();
92 LLMediaBase::ECommand nextCommand();
93 virtual LLMediaBase::EStatus getStatus();
94 bool setStatus( LLMediaBase::EStatus status );
95
96 virtual bool seek( double time );
97 virtual bool setLooping(bool enable) { mLooping = enable; return true; }
98 virtual bool isLooping() { return mLooping; }
99 virtual bool navigateTo( const std::string url );
100
101 // scaling
102 virtual bool setAutoScaled( bool auto_scaled );
103 virtual bool isAutoScaled() const;
104
105 // mouse and keyboard interaction
106 virtual bool mouseDown( int x_pos, int y_pos );
107 virtual bool mouseUp( int x_pos, int y_pos );
108 virtual bool mouseMove( int x_pos, int y_pos );
109 virtual bool keyPress( int key_code );
110 virtual bool scrollByLines( int lines );
111 virtual bool focus( bool focus );
112 virtual bool unicodeInput( unsigned long uni_char );
113 virtual bool mouseLeftDoubleClick( int x_pos, int y_pos );
114
115 // navigation
116 virtual bool navigateForward();
117 virtual bool navigateBack();
118 virtual bool canNavigateForward();
119 virtual bool canNavigateBack();
120
121 // caching/cookies
122 virtual bool enableCookies( bool enable );
123 virtual bool clearCache();
124 virtual bool clearCookies();
125
126 virtual bool enableProxy(bool enable, std::string proxy_host_name, int proxy_port);
127
128 // observer interface
129 bool addObserver( LLMediaObserver* subject );
130 bool remObserver( LLMediaObserver* subject );
131
132 // type registry interface
133 void setImplMaker(LLMediaImplMakerBase* impl_maker);
134 bool supportsMediaType(std::string scheme, std::string type);
135
136 protected:
137 virtual bool setMediaSize( int width, int height );
138 virtual bool setMediaDepth( int media_depth );
139
140 LLMediaEmitter< LLMediaObserver > mEventEmitter;
141
142 // Back pointer to the construction object, which is used to discover types handled
143 // by the Impl, and meta data associated with the Impl.
144 LLMediaImplMakerBase* mImplMaker;
145 std::string mMimeType;
146 std::string mInitialURL;
147 bool mAutoScaled;
148 int mMediaWidth;
149 int mMediaPrevWidth;
150 int mMediaHeight;
151 int mMediaPrevHeight;
152 int mMediaDepth;
153 int mMediaPrevDepth;
154 int mMediaRowSpan;
155 int mMediaRequestedWidth;
156 int mMediaRequestedHeight;
157 float mVolume;
158 LLMediaBase::ECommand mCommand;
159 LLMediaBase::EStatus mStatus;
160 bool mLooping;
161 LLMediaBase::EDebugLevel mDebugLevel;
162};
163
164#endif // LLMEDIAIMPLCOMMON_H
diff --git a/linden/indra/llmedia/llmediaimplexample1.cpp b/linden/indra/llmedia/llmediaimplexample1.cpp
deleted file mode 100644
index fe7b7e2..0000000
--- a/linden/indra/llmedia/llmediaimplexample1.cpp
+++ /dev/null
@@ -1,231 +0,0 @@
1/**
2 * @file llmediaimplexample1.cpp
3 * @brief Example 1 of a media impl concrete class
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#include "llmediaimplexample1.h"
34#include "llmediaimplregister.h"
35
36#include <cstring>
37
38// register this impl with media manager factory
39static LLMediaImplRegister sLLMediaImplExample1Reg( "LLMediaImplExample1", new LLMediaImplExample1Maker() );
40
41#include <iostream>
42
43#include <time.h>
44
45///////////////////////////////////////////////////////////////////////////////
46//
47LLMediaImplExample1Maker::LLMediaImplExample1Maker()
48{
49 // Register to handle the scheme
50 mSchema.push_back( "example1" );
51}
52
53///////////////////////////////////////////////////////////////////////////////
54//
55LLMediaImplExample1::LLMediaImplExample1() :
56 mMediaPixels( 0 )
57{
58 setRequestedMediaSize( 400, 200 );
59 setMediaDepth( 3 );
60
61 srand( (unsigned int)(time( NULL )) );
62}
63
64////////////////////////////////////////////////////////////////////////////////
65// (static) super-initialization - called once at application startup
66bool LLMediaImplExample1::startup( LLMediaManagerData* init_data )
67{
68 return true;
69}
70
71////////////////////////////////////////////////////////////////////////////////
72// (static) super-uninitialization - called once at application closedown
73bool LLMediaImplExample1::closedown()
74{
75 return true;
76}
77
78////////////////////////////////////////////////////////////////////////////////
79// virtual
80bool LLMediaImplExample1::init()
81{
82 int buffer_size = getMediaBufferSize();
83
84 mMediaPixels = new unsigned char[ buffer_size ];
85
86 memset( mMediaPixels, 0xAA, buffer_size );
87
88 return true;
89}
90
91////////////////////////////////////////////////////////////////////////////////
92// virtual
93bool LLMediaImplExample1::navigateTo( const std::string url )
94{
95 std::cout << "LLMediaImplExample1::navigateTo" << std::endl;
96
97 setStatus( LLMediaBase::STATUS_NAVIGATING );
98
99 // force a size change event for new URL
100 LLMediaEvent event( this );
101 mEventEmitter.update( &LLMediaObserver::onMediaSizeChange, event );
102
103 return true;
104}
105
106////////////////////////////////////////////////////////////////////////////////
107// virtual
108std::string LLMediaImplExample1::getVersion()
109{
110 std::string version_string = "[" + sLLMediaImplExample1Reg.getImplName() + "] - " + "1.0.0.0";
111
112 return version_string;
113}
114
115////////////////////////////////////////////////////////////////////////////////
116// virtual
117bool LLMediaImplExample1::updateMedia()
118{
119 if ( mMediaPixels && getStatus() == LLMediaBase::STATUS_STARTED )
120 {
121 // first time - make sure it's a few seconds back so first update happens immediately
122 static time_t t = time( 0 ) - 4;
123
124 // selected time period elapsed (1 second)
125 if ( time( 0 ) - t > 1 )
126 {
127 // display checkerboard
128 const int num_squares = rand() % 20 + 4;
129 int sqr1_r = rand() % 0x80;
130 int sqr1_g = rand() % 0x80;
131 int sqr1_b = rand() % 0x80;
132 int sqr2_r = rand() % 0x80;
133 int sqr2_g = rand() % 0x80;
134 int sqr2_b = rand() % 0x80;
135
136 for ( int y1 = 0; y1 < num_squares; ++y1 )
137 {
138 for ( int x1 = 0; x1 < num_squares; ++x1 )
139 {
140 int px_start = getMediaWidth() * x1 / num_squares;
141 int px_end = ( getMediaWidth() * ( x1 + 1 ) ) / num_squares;
142 int py_start = getMediaHeight() * y1 / num_squares;
143 int py_end = ( getMediaHeight() * ( y1 + 1 ) ) / num_squares;
144
145 for( int y2 = py_start; y2 < py_end; ++y2 )
146 {
147 for( int x2 = px_start; x2 < px_end; ++x2 )
148 {
149 int rowspan = getMediaWidth() * getMediaDepth();
150
151 if ( ( y1 % 2 ) ^ ( x1 % 2 ) )
152 {
153 mMediaPixels[ y2 * rowspan + x2 * getMediaDepth() + 0 ] = sqr1_r;
154 mMediaPixels[ y2 * rowspan + x2 * getMediaDepth() + 1 ] = sqr1_g;
155 mMediaPixels[ y2 * rowspan + x2 * getMediaDepth() + 2 ] = sqr1_b;
156 }
157 else
158 {
159 mMediaPixels[ y2 * rowspan + x2 * getMediaDepth() + 0 ] = sqr2_r;
160 mMediaPixels[ y2 * rowspan + x2 * getMediaDepth() + 1 ] = sqr2_g;
161 mMediaPixels[ y2 * rowspan + x2 * getMediaDepth() + 2 ] = sqr2_b;
162 };
163 };
164 };
165 };
166 };
167
168 // emit an event to say that something in the media stream changed
169 LLMediaEvent event( this );
170 mEventEmitter.update( &LLMediaObserver::onMediaContentsChange, event );
171
172 // reset time
173 t = time( 0 );
174
175 return true;
176 };
177 };
178
179 // update the command (e.g. transport controls) state
180 updateCommand();
181
182 return false;
183}
184
185////////////////////////////////////////////////////////////////////////////////
186// virtual
187unsigned char* LLMediaImplExample1::getMediaData()
188{
189 return mMediaPixels;
190}
191
192////////////////////////////////////////////////////////////////////////////////
193// virtual
194bool LLMediaImplExample1::reset()
195{
196 if ( mMediaPixels )
197 {
198 delete [] mMediaPixels;
199 };
200
201 return true;
202}
203
204////////////////////////////////////////////////////////////////////////////////
205// virtual
206bool LLMediaImplExample1::mouseMove( int x_pos, int y_pos )
207{
208 if ( mMediaPixels && getStatus() == LLMediaBase::STATUS_STARTED )
209 {
210 int base_pos = x_pos * getMediaDepth() + y_pos * getMediaDepth() * getMediaWidth();
211 // example: write a bright pixel to the display when we move the mouse
212 mMediaPixels[ base_pos + 0 ] = rand() % 0x80 + 0x80;
213 mMediaPixels[ base_pos + 1 ] = rand() % 0x80 + 0x80;
214 mMediaPixels[ base_pos + 2 ] = rand() % 0x80 + 0x80;
215
216 // emit an event to say that something in the media stream changed
217 LLMediaEvent event( this );
218 mEventEmitter.update( &LLMediaObserver::onMediaContentsChange, event );
219 };
220
221 return true;
222}
223
224
225////////////////////////////////////////////////////////////////////////////////
226// virtual
227bool LLMediaImplExample1::setRequestedMediaSize( int width, int height )
228{
229 // we accept any size:
230 return setMediaSize(width, height);
231}
diff --git a/linden/indra/llmedia/llmediaimplexample2.cpp b/linden/indra/llmedia/llmediaimplexample2.cpp
deleted file mode 100644
index 7590e19..0000000
--- a/linden/indra/llmedia/llmediaimplexample2.cpp
+++ /dev/null
@@ -1,198 +0,0 @@
1/**
2 * @file llmediaimplexample2.cpp
3 * @brief Example 2 of a media impl concrete class
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#include "llmediaimplexample2.h"
34#include "llmediaimplregister.h"
35
36#include <cstring>
37
38// register this impl with media manager factory
39static LLMediaImplRegister sLLMediaImplExample2Reg( "LLMediaImplExample2", new LLMediaImplExample2Maker() );
40
41#include <iostream>
42#include <time.h>
43
44///////////////////////////////////////////////////////////////////////////////
45//
46LLMediaImplExample2Maker::LLMediaImplExample2Maker()
47{
48 // Register to handle the scheme
49 mSchema.push_back( "example2." );
50}
51
52///////////////////////////////////////////////////////////////////////////////
53//
54LLMediaImplExample2::LLMediaImplExample2() :
55 mMediaPixels( 0 )
56{
57 setRequestedMediaSize( 500, 500 );
58 setMediaDepth( 3 );
59
60 mXpos = ( getMediaWidth() / 2 ) + rand() % ( getMediaWidth() / 16 ) - ( getMediaWidth() / 32 );
61 mYpos = ( getMediaHeight() / 2 ) + rand() % ( getMediaHeight() / 16 ) - ( getMediaHeight() / 32 );
62
63 srand( (unsigned int)(time( NULL )) );
64}
65
66////////////////////////////////////////////////////////////////////////////////
67// (static) super-initialization - called once at application startup
68bool LLMediaImplExample2::startup( LLMediaManagerData* init_data )
69{
70 return true;
71}
72
73////////////////////////////////////////////////////////////////////////////////
74// (static) super-uninitialization - called once at application closedown
75bool LLMediaImplExample2::closedown()
76{
77 return true;
78}
79
80////////////////////////////////////////////////////////////////////////////////
81// virtual
82bool LLMediaImplExample2::init()
83{
84 int buffer_size = getMediaBufferSize();
85
86 mMediaPixels = new unsigned char[ buffer_size ];
87
88 memset( mMediaPixels, 0x00, buffer_size );
89
90 return true;
91}
92
93////////////////////////////////////////////////////////////////////////////////
94// virtual
95bool LLMediaImplExample2::navigateTo( const std::string url )
96{
97 std::cout << "LLMediaImplExample2::navigateTo" << std::endl;
98
99 setStatus( LLMediaBase::STATUS_NAVIGATING );
100
101 // force a size change event for new URL
102 LLMediaEvent event( this );
103 mEventEmitter.update( &LLMediaObserver::onMediaSizeChange, event );
104
105 return true;
106}
107
108////////////////////////////////////////////////////////////////////////////////
109// virtual
110std::string LLMediaImplExample2::getVersion()
111{
112 std::string version_string = "[" + sLLMediaImplExample2Reg.getImplName() + "] - " + "1.0.0.0";
113
114 return version_string;
115}
116
117////////////////////////////////////////////////////////////////////////////////
118// virtual
119bool LLMediaImplExample2::updateMedia()
120{
121 if ( mMediaPixels && getStatus() == LLMediaBase::STATUS_STARTED )
122 {
123 static int x_inc = rand() % 5 + 2;
124 static int y_inc = rand() % 5 + 2;
125 int block_size = 32;
126
127 for( int y = 0; y < block_size; ++y )
128 {
129 for( int x = 0; x < block_size; ++x )
130 {
131 int rowspan = getMediaWidth() * getMediaDepth();
132 mMediaPixels[ ( mXpos + x ) * getMediaDepth() + ( mYpos + y ) * rowspan + 0 ] = 0;
133 mMediaPixels[ ( mXpos + x ) * getMediaDepth() + ( mYpos + y ) * rowspan + 1 ] = 0;
134 mMediaPixels[ ( mXpos + x ) * getMediaDepth() + ( mYpos + y ) * rowspan + 2 ] = 0;
135 };
136 };
137
138 if ( mXpos + x_inc < 0 || mXpos + x_inc >= getMediaWidth() - block_size )
139 x_inc =- x_inc;
140
141 if ( mYpos + y_inc < 0 || mYpos + y_inc >= getMediaHeight() - block_size )
142 y_inc =- y_inc;
143
144 mXpos += x_inc;
145 mYpos += y_inc;
146
147 unsigned char col_r = rand() % 0xff;
148 unsigned char col_g = rand() % 0xff;
149 unsigned char col_b = rand() % 0xff;
150
151 for( int y = 0; y < block_size; ++y )
152 {
153 for( int x = 0; x < block_size; ++x )
154 {
155 int rowspan = getMediaWidth() * getMediaDepth();
156 mMediaPixels[ ( mXpos + x ) * getMediaDepth() + ( mYpos + y ) * rowspan + 0 ] = col_r;
157 mMediaPixels[ ( mXpos + x ) * getMediaDepth() + ( mYpos + y ) * rowspan + 1 ] = col_g;
158 mMediaPixels[ ( mXpos + x ) * getMediaDepth() + ( mYpos + y ) * rowspan + 2 ] = col_b;
159 };
160 };
161
162 // emit an event to say that something in the media stream changed
163 LLMediaEvent event( this );
164 mEventEmitter.update( &LLMediaObserver::onMediaContentsChange, event );
165 };
166
167 // update the command (e.g. transport controls) state
168 updateCommand();
169
170 return false;
171}
172
173////////////////////////////////////////////////////////////////////////////////
174// virtual
175unsigned char* LLMediaImplExample2::getMediaData()
176{
177 return mMediaPixels;
178}
179
180////////////////////////////////////////////////////////////////////////////////
181// virtual
182bool LLMediaImplExample2::reset()
183{
184 if ( mMediaPixels )
185 {
186 delete [] mMediaPixels;
187 };
188
189 return true;
190}
191
192////////////////////////////////////////////////////////////////////////////////
193// virtual
194bool LLMediaImplExample2::setRequestedMediaSize( int width, int height )
195{
196 // we accept any size:
197 return setMediaSize(width, height);
198}
diff --git a/linden/indra/llmedia/llmediaimplfactory.cpp b/linden/indra/llmedia/llmediaimplfactory.cpp
deleted file mode 100644
index c5d098f..0000000
--- a/linden/indra/llmedia/llmediaimplfactory.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
1/**
2 * @file llmediaimplfactory.cpp
3 * @brief Creates media impls that have registered themselves with LLMediaRegster
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#include "llmediaimplfactory.h"
34
35#include <iostream>
36
37LLMediaImplFactory* LLMediaImplFactory::sInstance = NULL;
38
39///////////////////////////////////////////////////////////////////////////////
40// static
41LLMediaImplFactory* LLMediaImplFactory::getInstance()
42{
43 if ( ! sInstance )
44 sInstance = new LLMediaImplFactory();
45
46 return sInstance;
47}
48
49///////////////////////////////////////////////////////////////////////////////
50//
51void LLMediaImplFactory::registerImpl( const std::string& impl_name, LLMediaImplMakerBase* impl_maker )
52{
53 mNameImplMakerContainer.insert( name_impl_maker_container_t::value_type( impl_name, impl_maker ) );
54}
55
56///////////////////////////////////////////////////////////////////////////////
57//
58LLMediaImplMakerBase* LLMediaImplFactory::getImplMaker( const std::string& scheme, const std::string& type )
59{
60 name_impl_maker_container_t::const_iterator iter;
61 name_impl_maker_container_t::const_iterator begin = mNameImplMakerContainer.begin();
62 name_impl_maker_container_t::const_iterator end = mNameImplMakerContainer.end();
63
64 for(iter = begin; iter != end; ++iter)
65 {
66 if(( *iter->second ).supportsScheme(scheme))
67 {
68 return ( iter->second );
69 }
70 }
71
72 for(iter = begin; iter != end; ++iter)
73 {
74 if(( *iter->second ).supportsMimeType(type))
75 {
76 return ( iter->second );
77 }
78 }
79 int idx1 = type.find("/");
80 int len = (idx1 == std::string::npos) ? 0 : idx1;
81 std::string category = type.substr(0,len);
82 for(iter = begin; iter != end; ++iter)
83 {
84 if(( *iter->second ).supportsMimeTypeCategory(category))
85 {
86 return ( iter->second );
87 }
88 }
89
90 return NULL;
91};
92
93///////////////////////////////////////////////////////////////////////////////
94//
95LLMediaImplMakerBase* LLMediaImplFactory::getImplMaker( const std::string& impl_name )
96{
97 name_impl_maker_container_t::const_iterator found = mNameImplMakerContainer.find( impl_name );
98
99 if ( found == mNameImplMakerContainer.end() )
100 {
101 return NULL;
102 };
103
104 return found->second;
105}
diff --git a/linden/indra/llmedia/llmediaimplfactory.h b/linden/indra/llmedia/llmediaimplfactory.h
deleted file mode 100644
index 93a7cc1..0000000
--- a/linden/indra/llmedia/llmediaimplfactory.h
+++ /dev/null
@@ -1,100 +0,0 @@
1/**
2 * @file llmediaimplfactory.h
3 * @brief Creates media impls that have registered themselves with LLMediaRegster
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#ifndef LLMEDIAIMPLFACTORY_H
34#define LLMEDIAIMPLFACTORY_H
35
36#include <algorithm>
37#include <map>
38#include <string>
39#include <vector>
40
41#include "llmediabase.h"
42
43///////////////////////////////////////////////////////////////////////////////
44//
45class LLMediaImplMakerBase
46{
47 public:
48 virtual bool supportsScheme(std::string scheme) = 0;
49 virtual bool supportsMimeType(std::string type) = 0;
50 virtual bool supportsMimeTypeCategory(std::string category) = 0;
51 virtual LLMediaBase* create() = 0;
52 virtual ~LLMediaImplMakerBase() {};
53
54 protected:
55 typedef std::vector <std::string> vector_impl_registry_t;
56 vector_impl_registry_t mSchema;
57 vector_impl_registry_t mMimeTypes;
58 vector_impl_registry_t mMimeTypeCategories;
59};
60
61///////////////////////////////////////////////////////////////////////////////
62//
63class LLMediaImplMaker : public LLMediaImplMakerBase
64{
65 public:
66 bool supportsScheme(std::string scheme)
67 {
68 vector_impl_registry_t::iterator found = std::find(mSchema.begin(), mSchema.end(), scheme);
69 return found != mSchema.end();
70 }
71 bool supportsMimeType(std::string type)
72 {
73 vector_impl_registry_t::iterator found = std::find(mMimeTypes.begin(), mMimeTypes.end(), type);
74 return found != mMimeTypes.end();
75 }
76 bool supportsMimeTypeCategory(std::string category)
77 {
78 vector_impl_registry_t::iterator found = std::find(mMimeTypeCategories.begin(), mMimeTypeCategories.end(), category);
79 return found != mMimeTypeCategories.end();
80 }
81};
82
83///////////////////////////////////////////////////////////////////////////////
84//
85class LLMediaImplFactory
86{
87 public:
88 static LLMediaImplFactory* getInstance();
89 void registerImpl( const std::string& impl_name, LLMediaImplMakerBase* impl_maker );
90 LLMediaImplMakerBase* getImplMaker( const std::string& scheme, const std::string& type );
91 LLMediaImplMakerBase* getImplMaker( const std::string& impl_name);
92
93 private:
94 typedef std::map< std::string, LLMediaImplMakerBase* > name_impl_maker_container_t;
95 name_impl_maker_container_t mNameImplMakerContainer;
96
97 static LLMediaImplFactory* sInstance;
98};
99
100#endif // LLMEDIAIMPLFACTORY_H
diff --git a/linden/indra/llmedia/llmediaimplgstreamer.cpp b/linden/indra/llmedia/llmediaimplgstreamer.cpp
deleted file mode 100644
index 7af9c9a..0000000
--- a/linden/indra/llmedia/llmediaimplgstreamer.cpp
+++ /dev/null
@@ -1,928 +0,0 @@
1/**
2 * @file llmediaimplgstreamer.cpp
3 * @author Tofu Linden
4 * @brief implementation that supports various media through GStreamer.
5 *
6 * $LicenseInfo:firstyear=2007&license=viewergpl$
7 *
8 * Copyright (c) 2007-2009, Linden Research, Inc.
9 *
10 * Second Life Viewer Source Code
11 * The source code in this file ("Source Code") is provided by Linden Lab
12 * to you under the terms of the GNU General Public License, version 2.0
13 * ("GPL"), unless you have obtained a separate licensing agreement
14 * ("Other License"), formally executed by you and Linden Lab. Terms of
15 * the GPL can be found in doc/GPL-license.txt in this distribution, or
16 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
17 *
18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33///#if LL_GSTREAMER_ENABLED
34
35#if LL_WINDOWS
36 // GStreamer 0.10.22 - gstutils.h - conversion from 'guint64' to 'guint8'.
37 // This was an intentional change to make GStreamer more threadsafe, and
38 // is okay. Delete this bit if GStreamer ever gets more VS-friendly -- McCabe
39 #pragma warning(disable : 4244)
40#endif
41
42#include "linden_common.h"
43#include "llmediaimplgstreamer.h"
44
45extern "C" {
46#include <gst/gst.h>
47#include <gst/gstelement.h>
48}
49
50#if LL_WINDOWS
51 #pragma warning(default : 4244)
52#include <direct.h>
53#include <stdlib.h>
54#endif
55
56#include "llmediamanager.h"
57#include "llmediaimplregister.h"
58
59#include "llmediaimplgstreamervidplug.h"
60#include "llgstplaythread.h"
61
62
63#if LL_DARWIN
64#include <CoreFoundation/CoreFoundation.h> // For CF functions used in set_gst_plugin_path
65#endif
66
67// register this impl with media manager factory
68static LLMediaImplRegister sLLMediaImplGStreamerReg( "LLMediaImplGStreamer", new LLMediaImplGStreamerMaker() );
69
70LLMediaImplGStreamerMaker::LLMediaImplGStreamerMaker()
71{
72 // Register to handle the scheme
73 mSchema.push_back( "rtsp" );
74 mSchema.push_back( "rtmp" );
75
76 // Register to handle the category
77 mMimeTypeCategories.push_back( "video" );
78 mMimeTypeCategories.push_back( "audio" );
79}
80
81///////////////////////////////////////////////////////////////////////////////
82//
83LLMediaImplGStreamer::
84LLMediaImplGStreamer () :
85 mediaData ( NULL ),
86 mMediaRowbytes ( 1 ),
87 mTextureFormatPrimary ( LL_MEDIA_BGRA ),
88 mTextureFormatType ( LL_MEDIA_UNSIGNED_INT_8_8_8_8_REV ),
89 mPump ( NULL ),
90 mPlaybin ( NULL ),
91 mVideoSink ( NULL ),
92 mLastTitle ( "" ),
93 mState( GST_STATE_NULL ),
94 mPlayThread ( NULL )
95{
96 startup( NULL ); // Startup gstreamer if it hasn't been already.
97
98 LL_DEBUGS("MediaManager") << "constructing media..." << LL_ENDL;
99 mVolume = -1.0; // XXX Hack to make the vould change happend first time
100
101 setMediaDepth(4);
102
103 // Create a pumpable main-loop for this media
104 mPump = g_main_loop_new (NULL, FALSE);
105 if (!mPump)
106 {
107 return; // error
108 }
109
110 // instantiate a playbin element to do the hard work
111 mPlaybin = gst_element_factory_make ("playbin", "play");
112 if (!mPlaybin)
113 {
114 // todo: cleanup pump
115 return; // error
116 }
117
118 if (NULL == getenv("LL_GSTREAMER_EXTERNAL"))
119 {
120 // instantiate and connect a custom video sink
121 LL_DEBUGS("MediaManager") << "extrenal video sink..." << LL_ENDL;
122
123 // Plays inworld instead of in external player
124 mVideoSink =
125 GST_SLVIDEO(gst_element_factory_make ("private-slvideo", "slvideo"));
126 if (!mVideoSink)
127 {
128 LL_WARNS("MediaImpl") << "Could not instantiate private-slvideo element." << LL_ENDL;
129 // todo: cleanup.
130 return; // error
131 }
132
133 g_object_set(mPlaybin, "video-sink", mVideoSink, (void*)NULL);
134 }
135}
136
137// virtual
138int LLMediaImplGStreamer::getTextureFormatPrimary() const
139{
140 return mTextureFormatPrimary;
141}
142
143// virtual
144int LLMediaImplGStreamer::getTextureFormatType() const
145{
146 return mTextureFormatType;
147}
148
149// virtual
150int LLMediaImplGStreamer::getTextureFormatInternal() const
151{
152 return LL_MEDIA_RGB8;
153}
154
155///////////////////////////////////////////////////////////////////////////////
156//
157LLMediaImplGStreamer::
158~LLMediaImplGStreamer ()
159{
160 LL_DEBUGS("MediaImpl") << ("dtor of media...") << LL_ENDL;
161 unload();
162}
163
164////////////////////////////////////////////////////////////////////////////////
165// virtual
166std::string LLMediaImplGStreamer::getVersion()
167{
168 guint major, minor, micro, nano;
169 gst_version(&major, &minor, &micro, &nano);
170 std::string version = llformat("%d.%d.%d.%d",major,minor,micro,nano);
171 return version;
172}
173
174//
175// STARTUP
176///////////////////////////////////////////////////////////////////////////////
177// (static) super-initialization - called once at application startup
178bool LLMediaImplGStreamer::startup (LLMediaManagerData* init_data)
179{
180 static bool done_init = false;
181 if (!done_init)
182 {
183 // Init the glib type system - we need it.
184 g_type_init();
185
186 set_gst_plugin_path();
187
188 // Protect against GStreamer resetting the locale, yuck.
189 static std::string saved_locale;
190 saved_locale = setlocale(LC_ALL, NULL);
191 if (0 == gst_init_check(NULL, NULL, NULL))
192 {
193 LL_WARNS("MediaImpl") << "GStreamer library failed to initialize and load standard plugins." << LL_ENDL;
194 setlocale(LC_ALL, saved_locale.c_str() );
195 return false;
196 }
197 setlocale(LC_ALL, saved_locale.c_str() );
198
199 // Set up logging facilities
200 gst_debug_remove_log_function( gst_debug_log_default );
201 gst_debug_add_log_function( gstreamer_log, NULL );
202
203 // Init our custom plugins - only really need do this once.
204 gst_slvideo_init_class();
205
206
207 // List the plugins GStreamer can find
208 LL_DEBUGS("MediaImpl") << "Found GStreamer plugins:" << LL_ENDL;
209 GList *list;
210 GstRegistry *registry = gst_registry_get_default();
211 std::string loaded = "";
212 for (list = gst_registry_get_plugin_list(registry);
213 list != NULL;
214 list = g_list_next(list))
215 {
216 GstPlugin *list_plugin = (GstPlugin *)list->data;
217 (bool)gst_plugin_is_loaded(list_plugin) ? loaded = "Yes" : loaded = "No";
218 LL_DEBUGS("MediaImpl") << gst_plugin_get_name(list_plugin) << ", loaded? " << loaded << LL_ENDL;
219 }
220 gst_plugin_list_free(list);
221
222
223 done_init = true;
224 }
225 return true;
226}
227
228
229void LLMediaImplGStreamer::set_gst_plugin_path()
230{
231 // Linux sets GST_PLUGIN_PATH in wrapper.sh, not here.
232#if LL_WINDOWS || LL_DARWIN
233
234 std::string imp_dir = "";
235
236 // Get the current working directory:
237#if LL_WINDOWS
238 char* raw_dir;
239 raw_dir = _getcwd(NULL,0);
240 if( raw_dir != NULL )
241 {
242 imp_dir = std::string( raw_dir );
243 }
244#elif LL_DARWIN
245 CFBundleRef main_bundle = CFBundleGetMainBundle();
246 if( main_bundle != NULL )
247 {
248 CFURLRef bundle_url = CFBundleCopyBundleURL( main_bundle );
249 if( bundle_url != NULL )
250 {
251 #ifndef MAXPATHLEN
252 #define MAXPATHLEN 1024
253 #endif
254 char raw_dir[MAXPATHLEN];
255 if( CFURLGetFileSystemRepresentation( bundle_url, true, (UInt8 *)raw_dir, MAXPATHLEN) )
256 {
257 imp_dir = std::string( raw_dir ) + "/Contents/MacOS/";
258 }
259 CFRelease(bundle_url);
260 }
261 }
262#endif
263
264 if( imp_dir == "" )
265 {
266 LL_WARNS("MediaImpl") << "Could not get application directory, not setting GST_PLUGIN_PATH."
267 << LL_ENDL;
268 return;
269 }
270
271 LL_DEBUGS("MediaImpl") << "Imprudence is installed at "
272 << imp_dir << LL_ENDL;
273
274 // ":" on Mac and 'Nix, ";" on Windows
275 std::string separator = G_SEARCHPATH_SEPARATOR_S;
276
277 // Grab the current path, if it's set.
278 std::string old_plugin_path = "";
279 char *old_path = getenv("GST_PLUGIN_PATH");
280 if(old_path == NULL)
281 {
282 LL_DEBUGS("MediaImpl") << "Did not find user-set GST_PLUGIN_PATH."
283 << LL_ENDL;
284 }
285 else
286 {
287 old_plugin_path = separator + std::string( old_path );
288 }
289
290
291 // Search both Imprudence and Imprudence\lib\gstreamer-plugins.
292 // But we also want to search the path the user has set, if any.
293 std::string plugin_path =
294#if LL_WINDOWS
295 imp_dir + "\\lib\\gstreamer-plugins" +
296#elif LL_DARWIN
297 imp_dir + separator +
298 imp_dir + "/../Resources/lib/gstreamer-plugins" +
299#endif
300 old_plugin_path;
301
302 int put_result;
303
304 // Place GST_PLUGIN_PATH in the environment settings
305#if LL_WINDOWS
306 put_result = _putenv_s( "GST_PLUGIN_PATH", (char*)plugin_path.c_str() );
307#elif LL_DARWIN
308 put_result = setenv( "GST_PLUGIN_PATH", (char*)plugin_path.c_str(), 1 );
309#endif
310
311 if( put_result == -1 )
312 {
313 LL_WARNS("MediaImpl") << "Setting GST_PLUGIN_PATH failed!" << LL_ENDL;
314 }
315 else
316 {
317 LL_DEBUGS("MediaImpl") << "GST_PLUGIN_PATH set to "
318 << getenv("GST_PLUGIN_PATH") << LL_ENDL;
319 }
320
321 // Don't load system plugins. We only want to use ours, to avoid conflicts.
322#if LL_WINDOWS
323 put_result = _putenv_s( "GST_PLUGIN_SYSTEM_PATH", "" );
324#elif LL_DARWIN
325 put_result = setenv( "GST_PLUGIN_SYSTEM_PATH", "", 1 );
326#endif
327
328 if( put_result == -1 )
329 {
330 LL_WARNS("MediaImpl") << "Setting GST_PLUGIN_SYSTEM_PATH=\"\" failed!"
331 << LL_ENDL;
332 }
333
334#endif // LL_WINDOWS || LL_DARWIN
335}
336
337
338void LLMediaImplGStreamer::gstreamer_log(GstDebugCategory *category,
339 GstDebugLevel level,
340 const gchar *file,
341 const gchar *function,
342 gint line,
343 GObject *object,
344 GstDebugMessage *message,
345 gpointer data)
346{
347 std::stringstream log(std::stringstream::out);
348
349 // Log format example:
350 //
351 // GST_ELEMENT_PADS: removing pad 'sink' (in gstelement.c:757:gst_element_remove_pad)
352 //
353 log << gst_debug_category_get_name( category ) << ": "
354 << gst_debug_message_get(message) << " "
355 << "(in " << file << ":" << line << ":" << function << ")";
356
357 switch( level )
358 {
359 case GST_LEVEL_ERROR:
360 LL_WARNS("MediaImpl") << "(ERROR) " << log.str() << LL_ENDL;
361 break;
362 case GST_LEVEL_WARNING:
363 LL_WARNS("MediaImpl") << log.str() << LL_ENDL;
364 break;
365 case GST_LEVEL_DEBUG:
366 LL_DEBUGS("MediaImpl") << log.str() << LL_ENDL;
367 break;
368 case GST_LEVEL_INFO:
369 LL_INFOS("MediaImpl") << log.str() << LL_ENDL;
370 break;
371 default:
372 // Do nothing.
373 break;
374 }
375}
376
377
378bool LLMediaImplGStreamer::closedown()
379{
380 return true;
381}
382
383
384bool LLMediaImplGStreamer::setDebugLevel( LLMediaBase::EDebugLevel level )
385{
386 // Do parent class stuff.
387 LLMediaImplCommon::setDebugLevel(level);
388
389 // Set GStreamer verbosity.
390 gst_debug_set_default_threshold( (GstDebugLevel)level );
391
392 return true;
393}
394
395
396///////////////////////////////////////////////////////////////////////////////
397//
398// Uncomment the line below to enable spammy debug data.
399//#define LL_GST_REPORT_STATE_CHANGES
400#ifdef LL_GST_REPORT_STATE_CHANGES
401static const char* get_gst_state_name(GstState state)
402{
403 switch (state)
404 {
405 case GST_STATE_VOID_PENDING: return "VOID_PENDING";
406 case GST_STATE_NULL: return "NULL";
407 case GST_STATE_READY: return "READY";
408 case GST_STATE_PAUSED: return "PAUSED";
409 case GST_STATE_PLAYING: return "PLAYING";
410 }
411 return "(unknown)";
412}
413#endif // LL_GST_REPORT_STATE_CHANGES
414
415//static
416gboolean LLMediaImplGStreamer::bus_callback(GstBus *bus, GstMessage *message, gpointer data)
417{
418#ifdef LL_GST_REPORT_STATE_CHANGES
419 LL_DEBUGS("MediaCallback") << "Got GST message type: " << GST_MESSAGE_TYPE_NAME (message) << LL_ENDL;
420#endif
421
422 LLMediaImplGStreamer *impl = (LLMediaImplGStreamer*)data;
423
424 switch (GST_MESSAGE_TYPE (message))
425 {
426 case GST_MESSAGE_BUFFERING:
427 {
428 gint percent = 0;
429 gst_message_parse_buffering(message, &percent);
430#ifdef LL_GST_REPORT_STATE_CHANGES
431 LL_DEBUGS("MediaBuffering") << "GST buffering: " << percent << "%%" << LL_ENDL;
432#endif
433 LLMediaEvent event( impl, percent );
434 impl->getEventEmitter().update( &LLMediaObserver::onUpdateProgress, event );
435 }
436 break;
437 case GST_MESSAGE_STATE_CHANGED:
438 {
439 GstState old_state;
440 GstState new_state;
441 GstState pending_state;
442 gst_message_parse_state_changed(message,
443 &old_state,
444 &new_state,
445 &pending_state);
446#ifdef LL_GST_REPORT_STATE_CHANGES
447 // not generally very useful, and rather spammy.
448 LL_DEBUGS("MediaState") << "GST state change (old,<new>,pending): "<< get_gst_state_name(old_state) << ",<" << get_gst_state_name(new_state) << ">," << get_gst_state_name(pending_state) << LL_ENDL;
449#endif // LL_GST_REPORT_STATE_CHANGES
450
451 switch (new_state)
452 {
453 case GST_STATE_VOID_PENDING:
454 break;
455 case GST_STATE_NULL:
456#ifdef LL_GST_REPORT_STATE_CHANGES
457 LL_DEBUGS("MediaImpl") << "State changed to NULL" << LL_ENDL;
458#endif
459 if (impl->getState() == GST_STATE_PLAYING)
460 {
461 // Stream was probably dropped, trying to restart
462 impl->play();
463#ifdef LL_GST_REPORT_STATE_CHANGES
464 LL_DEBUGS("MediaImpl") << "Trying to restart." << LL_ENDL;
465#endif
466 }
467 break;
468 case GST_STATE_READY:
469 break;
470 case GST_STATE_PAUSED:
471 break;
472 case GST_STATE_PLAYING:
473 //impl->mLastTitle = "";
474
475 LLMediaEvent event( impl, 100 );
476 impl->getEventEmitter().update( &LLMediaObserver::onUpdateProgress, event );
477 // emit an event to say that a media source was loaded
478 LLMediaEvent event2( impl );
479 impl->getEventEmitter().update( &LLMediaObserver::onMediaLoaded, event2 );
480 break;
481 }
482 break;
483 }
484 case GST_MESSAGE_ERROR:
485 {
486 GError *err = NULL;
487 gchar *debug = NULL;
488
489 gst_message_parse_error (message, &err, &debug);
490 LL_WARNS("MediaImpl") << "GST Error: " << err->message << LL_ENDL;
491 g_error_free (err);
492 g_free (debug);
493
494 impl->addCommand(LLMediaBase::COMMAND_STOP);
495 //impl->addCommand(LLMediaBase::COMMAND_START);
496
497 break;
498 }
499 case GST_MESSAGE_INFO:
500 {
501 GError *err = NULL;
502 gchar *debug = NULL;
503
504 gst_message_parse_info (message, &err, &debug);
505 LL_INFOS("MediaImpl") << "GST info: " << err->message
506 << LL_ENDL;
507 g_error_free (err);
508 g_free (debug);
509 break;
510 }
511 case GST_MESSAGE_WARNING:
512 {
513 GError *err = NULL;
514 gchar *debug = NULL;
515
516 gst_message_parse_warning (message, &err, &debug);
517 LL_WARNS("MediaImpl") << "GST warning: " << err->message
518 << LL_ENDL;
519 g_error_free (err);
520 g_free (debug);
521
522 break;
523 }
524 case GST_MESSAGE_TAG:
525 {
526 GstTagList *new_tags;
527
528 gst_message_parse_tag( message, &new_tags );
529
530 gchar *title;
531
532 if ( gst_tag_list_get_string(new_tags, GST_TAG_TITLE, &title) )
533 {
534 LL_INFOS("MediaInfo") << "Title: " << title << LL_ENDL;
535 std::string newtitle(title);
536 gst_tag_list_free(new_tags);
537
538 if ( newtitle != impl->mLastTitle && newtitle != "" )
539 {
540 impl->mLastTitle = newtitle;
541 LLMediaEvent event( impl, impl->mLastTitle );
542 impl->getEventEmitter().update( &LLMediaObserver::onMediaTitleChange, event );
543 }
544
545 g_free(title);
546 }
547
548 break;
549 }
550 case GST_MESSAGE_EOS:
551 {
552 /* end-of-stream */
553 LL_DEBUGS("MediaImpl") << "GST end-of-stream." << LL_ENDL;
554 if (impl->isLooping())
555 {
556 LL_DEBUGS("MediaImpl") << "looping media..." << LL_ENDL;
557 impl->stop();
558 impl->play();
559 }
560 else
561 {
562 // inject a COMMAND_STOP
563 impl->addCommand(LLMediaBase::COMMAND_STOP);
564 }
565 break;
566 }
567 default:
568 /* unhandled message */
569 break;
570 }
571 /* we want to be notified again the next time there is a message
572 * on the bus, so return true (false means we want to stop watching
573 * for messages on the bus and our callback should not be called again)
574 */
575 return TRUE;
576}
577
578///////////////////////////////////////////////////////////
579// virtual
580bool LLMediaImplGStreamer::navigateTo (const std::string urlIn)
581{
582 LL_DEBUGS("MediaImpl") << "Setting media URI: " << urlIn.c_str()
583 << LL_ENDL;
584
585 if (mPump == NULL || mPlaybin == NULL)
586 {
587 return false;
588 }
589
590 setStatus( LLMediaBase::STATUS_NAVIGATING );
591
592 // set URI
593 g_object_set (G_OBJECT (mPlaybin), "uri", urlIn.c_str(), (void*)NULL);
594
595 // get playbin's bus - perhaps this can/should be done in ctor
596 GstBus *bus = gst_pipeline_get_bus (GST_PIPELINE (mPlaybin));
597 if (!bus)
598 {
599 return false;
600 }
601 gst_bus_add_watch (bus, bus_callback, this);
602 gst_object_unref (bus);
603
604 mState = GST_STATE_READY;
605
606 return true;
607}
608
609///////////////////////////////////////////////////////////////////////////////
610//
611bool LLMediaImplGStreamer::unload()
612{
613 LL_DEBUGS("MediaImpl") << "unloading media..." << LL_ENDL;
614 if (mPlaybin)
615 {
616 gst_element_set_state (mPlaybin, GST_STATE_NULL);
617 mState = GST_STATE_NULL;
618 gst_object_unref (GST_OBJECT (mPlaybin));
619 mPlaybin = NULL;
620 }
621
622 if (mPump)
623 {
624 g_main_loop_quit(mPump);
625 mPump = NULL;
626 }
627
628 if (mediaData)
629 {
630 delete [] mediaData;
631 mediaData = NULL;
632 }
633
634 mVideoSink = NULL;
635 mState = GST_STATE_NULL;
636 setStatus(LLMediaBase::STATUS_UNKNOWN);
637
638 return true;
639}
640
641///////////////////////////////////////////////////////////////////////////////
642// virtual
643bool LLMediaImplGStreamer::updateMedia()
644{
645 //LL_DEBUGS("MediaImpl") << "updating media..." << LL_ENDL;
646
647 // sanity check
648 if (mPump == NULL || mPlaybin == NULL)
649 {
650#ifdef LL_GST_REPORT_STATE_CHANGES
651 LL_DEBUGS("MediaImpl") << "dead media..." << LL_ENDL;
652#endif
653 mState = GST_STATE_NULL;
654 setStatus(LLMediaBase::STATUS_DEAD);
655 return false;
656 }
657
658 if (mState == GST_STATE_VOID_PENDING || mState == GST_STATE_NULL)
659 return false;
660
661 // process next outstanding command
662 switch (nextCommand())
663 {
664 case LLMediaBase::COMMAND_START:
665 LL_DEBUGS("MediaImpl") << "COMMAND_START" << LL_ENDL;
666 if (getStatus() == LLMediaBase::STATUS_PAUSED ||
667 getStatus() == LLMediaBase::STATUS_NAVIGATING ||
668 getStatus() == LLMediaBase::STATUS_STOPPED)
669 {
670 play();
671 setStatus(LLMediaBase::STATUS_STARTED);
672 clearCommand();
673 }
674 break;
675 case LLMediaBase::COMMAND_STOP:
676 LL_DEBUGS("MediaImpl") << "COMMAND_STOP" << LL_ENDL;
677 stop();
678 setStatus(LLMediaBase::STATUS_STOPPED);
679 clearCommand();
680 break;
681 case LLMediaBase::COMMAND_PAUSE:
682 LL_DEBUGS("MediaImpl") << "COMMAND_PAUSE" << LL_ENDL;
683 if (getStatus() == LLMediaBase::STATUS_STARTED)
684 {
685 pause();
686 setStatus(LLMediaBase::STATUS_PAUSED);
687 clearCommand();
688 }
689 break;
690 default:
691 LL_INFOS("MediaImpl") << "Unknown command" << LL_ENDL;
692 clearCommand();
693 break;
694 case LLMediaBase::COMMAND_NONE:
695 break;
696 }
697
698 // deal with results
699 if (g_main_context_pending(g_main_loop_get_context(mPump)))
700 {
701 g_main_context_iteration(g_main_loop_get_context(mPump), FALSE);
702 }
703
704 if (mVideoSink)
705 {
706 GST_OBJECT_LOCK(mVideoSink);
707 if (mVideoSink->retained_frame_ready)
708 {
709#ifdef LL_GST_REPORT_STATE_CHANGES
710 LL_DEBUGS("MediaImpl") <<"NEW FRAME " << LL_ENDL;
711#endif
712 if (mVideoSink->retained_frame_width != getMediaWidth() ||
713 mVideoSink->retained_frame_height != getMediaHeight())
714 // *TODO: also check for change in format
715 {
716 // just resize containe
717 int neww = mVideoSink->retained_frame_width;
718 int newh = mVideoSink->retained_frame_height;
719 int newd = SLVPixelFormatBytes[mVideoSink->retained_frame_format];
720 if (SLV_PF_RGBX == mVideoSink->retained_frame_format)
721 {
722 mTextureFormatPrimary = LL_MEDIA_RGBA;
723 mTextureFormatType = LL_MEDIA_UNSIGNED_INT_8_8_8_8_REV;
724 }
725 else
726 {
727 mTextureFormatPrimary = LL_MEDIA_BGRA;
728 mTextureFormatType = LL_MEDIA_UNSIGNED_INT_8_8_8_8_REV;
729 }
730 mMediaRowbytes = neww * newd;
731 LL_DEBUGS("MediaImpl")
732 << "video container resized to " <<
733 neww <<"x"<< newh << LL_ENDL;
734
735 delete[] mediaData;
736 mediaData = new unsigned char[mMediaRowbytes *
737 newh];
738
739 GST_OBJECT_UNLOCK(mVideoSink);
740
741 setMediaDepth(newd);
742 setMediaSize(neww, newh);
743 return true;
744 }
745
746 // we're gonna totally consume this frame - reset 'ready' flag
747 mVideoSink->retained_frame_ready = FALSE;
748 memcpy(mediaData, mVideoSink->retained_frame_data,
749 mMediaRowbytes * getMediaHeight());
750
751 GST_OBJECT_UNLOCK(mVideoSink);
752 LLMediaEvent event( this );
753 mEventEmitter.update( &LLMediaObserver::onMediaContentsChange, event );
754 return true;
755 }
756 else
757 {
758 // nothing to do yet.
759 GST_OBJECT_UNLOCK(mVideoSink);
760 return true;
761 }
762 }
763
764 return true;
765}
766
767///////////////////////////////////////////////////////////////////////////////
768//
769bool LLMediaImplGStreamer::stop()
770{
771 LL_DEBUGS("MediaImpl") << "attempting to stop..." << LL_ENDL;
772
773 if (!mPlaybin || mState == GST_STATE_NULL)
774 return true;
775
776 GstStateChangeReturn state_change;
777
778 state_change = gst_element_set_state(mPlaybin, GST_STATE_READY);
779
780 LL_DEBUGS("MediaImpl") << gst_element_state_change_return_get_name(state_change) << LL_ENDL;
781
782 if (state_change == GST_STATE_CHANGE_FAILURE)
783 {
784 LL_WARNS("MediaImpl") << "could not stop stream!" << LL_ENDL;
785 return false;
786 }
787 else
788 {
789 // Going into pending after play keeps dead streams from looping
790 (mState == GST_STATE_PLAYING) ? (mState = GST_STATE_VOID_PENDING) : (mState = GST_STATE_READY);
791 return true;
792 }
793}
794
795///////////////////////////////////////////////////////////////////////////////
796//
797bool LLMediaImplGStreamer::play()
798{
799 LL_DEBUGS("MediaImpl") << "attempting to play..." << LL_ENDL;
800
801 if (!mPlaybin || mState == GST_STATE_NULL)
802 return true;
803
804
805 if( getState() == GST_STATE_PLAYING )
806 {
807 LL_DEBUGS("MediaImpl") << "... but already playing." << LL_ENDL;
808 return true;
809 }
810
811 // Clean up the existing thread, if any.
812 if( mPlayThread != NULL && mPlayThread->isStopped())
813 {
814 delete mPlayThread;
815 mPlayThread = NULL;
816 }
817
818 if( mPlayThread == NULL )
819 {
820 // Make a new thread to start playing. This keeps the viewer
821 // responsive while the stream is resolved and buffered.
822 mPlayThread = new LLGstPlayThread( (LLMediaImplCommon *)this, "GstPlayThread", NULL);
823 mPlayThread->start();
824 }
825
826 return true;
827}
828
829
830void LLMediaImplGStreamer::startPlay()
831{
832 GstStateChangeReturn state_change;
833
834 state_change = gst_element_set_state(mPlaybin, GST_STATE_PLAYING);
835 mState = GST_STATE_PLAYING;
836
837 LL_DEBUGS("MediaImpl") << gst_element_state_change_return_get_name(state_change) << LL_ENDL;
838
839 // Check to make sure playing was successful. If not, stop.
840 // NOTE: state_change is almost always GST_STATE_CHANGE_ASYNC
841 if (state_change == GST_STATE_CHANGE_FAILURE)
842 {
843 // If failing from a bad stream, go into an unknown
844 // state to stop bus_callback from looping back.
845 // We also force a stop in case the operations don't sync
846 setStatus(LLMediaBase::STATUS_UNKNOWN);
847 stop();
848 }
849}
850
851///////////////////////////////////////////////////////////////////////////////
852//
853bool LLMediaImplGStreamer::pause()
854{
855 LL_DEBUGS("MediaImpl") << "attempting to pause..." << LL_ENDL;
856
857 if (!mPlaybin || mState == GST_STATE_NULL)
858 return true;
859
860 GstStateChangeReturn state_change;
861
862 state_change = gst_element_set_state(mPlaybin, GST_STATE_PAUSED);
863
864 LL_DEBUGS("MediaImpl") << gst_element_state_change_return_get_name(state_change) << LL_ENDL;
865
866 if (state_change == GST_STATE_CHANGE_FAILURE)
867 {
868 LL_WARNS("MediaImpl") << "could not pause stream!" << LL_ENDL;
869 return false;
870 }
871 else
872 {
873 mState = GST_STATE_PAUSED;
874 return true;
875 }
876};
877
878
879///////////////////////////////////////////////////////////////////////////////
880// virtual
881unsigned char* LLMediaImplGStreamer::getMediaData()
882{
883 return mediaData;
884}
885
886
887///////////////////////////////////////////////////////////////////////////////
888// virtual
889bool LLMediaImplGStreamer::seek(double time)
890{
891 bool success = false;
892 if (mPlaybin)
893 {
894 success = gst_element_seek(mPlaybin, 1.0F, GST_FORMAT_TIME,
895 GstSeekFlags(GST_SEEK_FLAG_FLUSH |
896 GST_SEEK_FLAG_KEY_UNIT),
897 GST_SEEK_TYPE_SET, gint64(time*1000000000.0F),
898 GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
899 }
900 LL_DEBUGS("MediaImpl") << "MEDIA SEEK REQUEST to " << float(time)
901 << "sec result was " << int(success) << LL_ENDL;
902 return success;
903}
904
905
906///////////////////////////////////////////////////////////////////////////////
907// virtual
908bool LLMediaImplGStreamer::setVolume(float volume)
909{
910 // we try to only update volume as conservatively as
911 // possible, as many gst-plugins-base versions up to at least
912 // November 2008 have critical race-conditions in setting volume - sigh
913 if (mVolume == volume)
914 return true; // nothing to do, everything's fine
915
916 mVolume = volume;
917 if (mPlaybin)
918 {
919 g_object_set(mPlaybin, "volume", mVolume, (void*)NULL);
920 return true;
921 }
922
923 return false;
924}
925
926
927
928///#endif // LL_GSTREAMER_ENABLED
diff --git a/linden/indra/llmedia/llmediaimplgstreamer.h b/linden/indra/llmedia/llmediaimplgstreamer.h
deleted file mode 100644
index 8d2e756..0000000
--- a/linden/indra/llmedia/llmediaimplgstreamer.h
+++ /dev/null
@@ -1,164 +0,0 @@
1/**
2 * @file llmediaimplgstreamer.h
3 * @author Tofu Linden
4 * @brief implementation that supports media playback via GStreamer.
5 *
6 * $LicenseInfo:firstyear=2007&license=viewergpl$
7 *
8 * Copyright (c) 2007-2009, Linden Research, Inc.
9 *
10 * Second Life Viewer Source Code
11 * The source code in this file ("Source Code") is provided by Linden Lab
12 * to you under the terms of the GNU General Public License, version 2.0
13 * ("GPL"), unless you have obtained a separate licensing agreement
14 * ("Other License"), formally executed by you and Linden Lab. Terms of
15 * the GPL can be found in doc/GPL-license.txt in this distribution, or
16 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
17 *
18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33// header guard
34#ifndef llmediaimplgstreamer_h
35#define llmediaimplgstreamer_h
36
37#include "llmediaimplcommon.h"
38#include "llmediaimplfactory.h"
39
40///#if LL_GSTREAMER_ENABLED
41
42extern "C" {
43#include <gst/gst.h>
44}
45
46#include <stdio.h>
47#include "apr_pools.h"
48#include "apr_dso.h"
49
50
51#include "llmediaimplgstreamervidplug.h"
52#include "llgstplaythread.h"
53
54class LLMediaManagerData;
55class LLMediaImplMaker;
56
57///////////////////////////////////////////////////////////////////////////
58class LLMediaImplGStreamer:
59 public LLMediaImplCommon
60{
61 friend class LLGstPlayThread;
62
63 public:
64 LLMediaImplGStreamer ();
65 virtual ~LLMediaImplGStreamer ();
66
67 ////////////////////////////////////////////////////////
68 // implementation of the media public interface
69
70 static bool startup( LLMediaManagerData* init_data );
71 static bool closedown();
72
73 // Sets GST_PLUGIN_PATH env var for GStreamer.
74 static void set_gst_plugin_path();
75
76 /* virtual */ bool setDebugLevel( LLMediaBase::EDebugLevel level );
77
78 // Function given to GStreamer for handling debug messages
79 static void gstreamer_log(GstDebugCategory *category,
80 GstDebugLevel level,
81 const gchar *file,
82 const gchar *function,
83 gint line,
84 GObject *object,
85 GstDebugMessage *message,
86 gpointer data)
87#if __GNUC__
88 // recommended by the gstreamer docs
89 G_GNUC_NO_INSTRUMENT
90#endif
91 ;
92
93 /* virtual */ std::string getVersion();
94 /* virtual */ bool navigateTo( const std::string url );
95 /* virtual */ bool updateMedia();
96 /* virtual */ unsigned char* getMediaData();
97 /* virtual */ int getTextureFormatPrimary() const;
98 /* virtual */ int getTextureFormatType() const;
99 /* virtual */ int getTextureFormatInternal() const;
100 /* virtual */ bool seek( double time );
101 /* virtual */ bool setVolume( float volume );
102
103 LLMediaEmitter< LLMediaObserver > getEventEmitter() const {return mEventEmitter;};
104
105 protected:
106
107 void startPlay();
108
109
110 private:
111
112 // misc
113 bool unload();
114 bool pause();
115 bool stop();
116 bool play();
117
118 static gboolean bus_callback (GstBus *bus,
119 GstMessage *message,
120 gpointer data);
121
122 unsigned char* mediaData;
123 int mMediaRowbytes;
124 int mTextureFormatPrimary;
125 int mTextureFormatType;
126
127 // GStreamer-specific
128 GMainLoop *mPump; // event pump for this media
129 GstElement *mPlaybin;
130 GstSLVideo *mVideoSink;
131 std::string mLastTitle;
132 GstState mState;
133 GstState getState() const { return mState; }
134
135 LLGstPlayThread *mPlayThread;
136};
137
138class LLMediaImplGStreamerMaker : public LLMediaImplMaker
139{
140 public:
141 LLMediaImplGStreamerMaker();
142 LLMediaImplGStreamer* create()
143 {
144 return new LLMediaImplGStreamer();
145 }
146};
147
148/////////////////////////////////////////////////////////////////////////
149// Debug/Info/Warning macros.
150#define STDERRMSG(...) do{\
151 fprintf(stderr, "%s:%d: ", __FUNCTION__, __LINE__);\
152 fprintf(stderr, __VA_ARGS__);\
153 fputc('\n',stderr);\
154 }while(0)
155#define NULLMSG(...) do{}while(0)
156
157#define DEBUGMSG NULLMSG
158#define INFOMSG STDERRMSG
159#define WARNMSG STDERRMSG
160/////////////////////////////////////////////////////////////////////////
161
162///#endif // LL_GSTREAMER_ENABLED
163
164#endif // llmediaimplgstreamer_h
diff --git a/linden/indra/llmedia/llmediaimplllmozlib.cpp b/linden/indra/llmedia/llmediaimplllmozlib.cpp
deleted file mode 100644
index 5b4b02e..0000000
--- a/linden/indra/llmedia/llmediaimplllmozlib.cpp
+++ /dev/null
@@ -1,624 +0,0 @@
1/**
2 * @file llmediaimplllmozlib.cpp
3 * @brief Example 2 of a media impl concrete class
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#include "llmediaimplllmozlib.h"
34
35#if LL_LLMOZLIB_ENABLED
36
37#include "llmediaimplregister.h"
38#include "llmediamanager.h"
39
40#ifdef WIN32
41 // platform specific includes needed before OpenGL header
42 #include <windows.h>
43 #include <GL/gl.h>
44#elif defined(__APPLE__)
45 // framework-style include path when building on the Mac.
46 #include <OpenGL/gl.h>
47#else // Assume this is linux
48 // Linux, MESA headers, but not necessarily assuming MESA runtime.
49 // quotes so we get libraries/.../GL/ version
50 #include "GL/gl.h"
51#endif
52
53
54#include <locale.h>
55
56
57#include <iostream>
58
59// register this impl with media manager factory
60static LLMediaImplRegister sLLMediaImplLLMozLibReg( "LLMediaImplLLMozLib", new LLMediaImplLLMozLibMaker() );
61
62///////////////////////////////////////////////////////////////////////////////
63//
64LLMediaImplLLMozLibMaker::LLMediaImplLLMozLibMaker()
65{
66 // Register to handle the mime category
67 mMimeTypes.push_back( "image/svg+xml" );
68 mMimeTypeCategories.push_back( "text" );
69#if !LL_QUICKTIME_ENABLED
70 mMimeTypeCategories.push_back( "image" );
71#endif
72}
73
74///////////////////////////////////////////////////////////////////////////////
75//
76LLMediaImplLLMozLib::LLMediaImplLLMozLib() :
77 mBrowserWindowWidth( 800 ),
78 mBrowserWindowHeight( 600 ),
79 mMediaDataWidth( 0 ),
80 mMediaDataHeight( 0 ),
81 mWindowId( 0 ),
82 mNeedsUpdate( false )
83{
84 setRequestedMediaSize( mBrowserWindowWidth, mBrowserWindowHeight );
85
86 setMediaDepth( 4 );
87}
88
89////////////////////////////////////////////////////////////////////////////////
90// (static) super-initialization - called once at application startup
91bool LLMediaImplLLMozLib::startup( LLMediaManagerData* init_data )
92{
93
94 // Yuck, Mozilla's GTK callbacks play with the locale - push/pop
95 // the locale to protect it, as exotic/non-C locales
96 // causes our code lots of general critical weirdness
97 // and crashness. (SL-35450)
98 static std::string saved_locale;
99 saved_locale = setlocale(LC_ALL, NULL);
100
101
102 bool result = LLMozLib::getInstance()->init( init_data->getBrowserApplicationDir(),
103 init_data->getBrowserComponentDir(),
104 init_data->getBrowserProfileDir(),
105 init_data->getBrowserParentWindow() );
106
107
108 setlocale(LC_ALL, saved_locale.c_str() );
109
110
111 return result;
112}
113
114////////////////////////////////////////////////////////////////////////////////
115// (static) super-uninitialization - called once at application closedown
116bool LLMediaImplLLMozLib::closedown()
117{
118 // name discrepancy - this reset actually shuts down LLMozLib
119 LLMozLib::getInstance()->reset();
120
121 return true;
122}
123
124////////////////////////////////////////////////////////////////////////////////
125// (static)
126bool LLMediaImplLLMozLib::setBrowserUserAgent(std::string user_agent)
127{
128 // append special string to the embedded browser user agent string
129 LLMozLib::getInstance()->setBrowserAgentId(user_agent);
130 return true;
131}
132
133////////////////////////////////////////////////////////////////////////////////
134// virtual
135bool LLMediaImplLLMozLib::init()
136{
137 // if mWindowId is non-0, it's we already called init() and shouldn't call it again
138 // (::reset() will zero this value)
139 if ( mWindowId )
140 return false;
141
142#if defined(LL_LINUX) || defined(WIN32)
143 static std::string saved_locale;
144 saved_locale = setlocale(LC_ALL, NULL);
145#endif // defined(LL_LINUX) || defined(WIN32)
146
147 mWindowId = LLMozLib::getInstance()->createBrowserWindow( mBrowserWindowWidth, mBrowserWindowHeight );
148
149 LLMozLib::getInstance()->setSize( mWindowId, mBrowserWindowWidth, mBrowserWindowHeight );
150
151 LLMozLib::getInstance()->setBackgroundColor( mWindowId, 0x00, 0x00, 0x00 );
152
153 LLMozLib::getInstance()->addObserver( mWindowId, this );
154
155 // plugins only work with some client-side hackery and they cause
156 // exception handling issues (DEV-10020) so we turn them off
157 LLMozLib::getInstance()->enablePlugins( false );
158
159 // second life client needs the bitmap flipped
160 LLMozLib::getInstance()->flipWindow( mWindowId, true );
161
162 // set media depth now we have created a browser window and know what it is
163 setMediaDepth( LLMozLib::getInstance()->getBrowserDepth( mWindowId ) );
164
165#if defined(LL_LINUX) || defined(WIN32)
166 setlocale(LC_ALL, saved_locale.c_str() );
167#endif // defined(LL_LINUX) || defined(WIN32)
168
169 return true;
170}
171
172////////////////////////////////////////////////////////////////////////////////
173// virtual
174std::string LLMediaImplLLMozLib::getVersion()
175{
176 std::string version_string = "[" + sLLMediaImplLLMozLibReg.getImplName() + "] - " + LLMozLib::getInstance()->getVersion();
177
178 return version_string;
179}
180
181////////////////////////////////////////////////////////////////////////////////
182// virtual
183bool LLMediaImplLLMozLib::set404RedirectUrl( std::string redirect_url )
184{
185 return LLMozLib::getInstance()->set404RedirectUrl( mWindowId, redirect_url );
186}
187
188////////////////////////////////////////////////////////////////////////////////
189// virtual
190
191bool LLMediaImplLLMozLib::clr404RedirectUrl()
192{
193 return LLMozLib::getInstance()->clr404RedirectUrl( mWindowId );
194}
195
196////////////////////////////////////////////////////////////////////////////////
197// virtual
198bool LLMediaImplLLMozLib::setBackgroundColor( unsigned int red, unsigned int green, unsigned int blue ) const
199{
200 return LLMozLib::getInstance()->setBackgroundColor( mWindowId, red, green, blue );
201}
202
203////////////////////////////////////////////////////////////////////////////////
204// virtual
205bool LLMediaImplLLMozLib::setCaretColor( unsigned int red, unsigned int green, unsigned int blue ) const
206{
207 return LLMozLib::getInstance()->setCaretColor( mWindowId, red, green, blue );
208}
209
210////////////////////////////////////////////////////////////////////////////////
211// virtual
212bool LLMediaImplLLMozLib::navigateTo( const std::string url )
213{
214 // pass url to llmozlib
215 LLMozLib::getInstance()->navigateTo( mWindowId, url );
216
217 // emit event with size change to kick things off
218 LLMediaEvent event( this );
219 mEventEmitter.update( &LLMediaObserver::onMediaSizeChange, event );
220
221 // not that useful right now but maybe later
222 return true;
223}
224
225////////////////////////////////////////////////////////////////////////////////
226// virtual
227bool LLMediaImplLLMozLib::updateMedia()
228{
229 if ( getStatus() == LLMediaBase::STATUS_STARTED )
230 {
231 // if flag set, the page changed and we need to update
232 if ( mNeedsUpdate )
233 {
234 // snap browser pixels
235 LLMozLib::getInstance()->grabBrowserWindow( mWindowId );
236
237 // update media width - rendering the page can change it
238 mMediaDataWidth = LLMozLib::getInstance()->getBrowserRowSpan( mWindowId ) / getMediaDepth();
239 mMediaDataHeight = LLMozLib::getInstance()->getBrowserHeight( mWindowId );
240
241 // emit an event to say that something in the media stream changed
242 LLMediaEvent event( this );
243 mEventEmitter.update( &LLMediaObserver::onMediaContentsChange, event );
244
245 // flag that we've done the update and one isn't needed next frame
246 mNeedsUpdate = false;
247 };
248 };
249
250 // update the state (e.g. transport controls) state
251 updateState();
252
253 return false;
254}
255
256////////////////////////////////////////////////////////////////////////////////
257//
258bool LLMediaImplLLMozLib::updateState()
259{
260 if ( nextCommand() == LLMediaBase::COMMAND_START )
261 {
262 setStatus( LLMediaBase::STATUS_STARTED );
263 clearCommand();
264 };
265
266 if ( nextCommand() == LLMediaBase::COMMAND_STOP )
267 {
268 setStatus( LLMediaBase::STATUS_STOPPED );
269 clearCommand();
270 };
271
272 if ( nextCommand() == LLMediaBase::COMMAND_BACK )
273 {
274 setStatus( LLMediaBase::STATUS_STARTED );
275 LLMozLib::getInstance()->navigateBack( mWindowId );
276 clearCommand();
277 };
278
279 if ( nextCommand() == LLMediaBase::COMMAND_FORWARD )
280 {
281 setStatus( LLMediaBase::STATUS_STARTED );
282 LLMozLib::getInstance()->navigateForward( mWindowId );
283 clearCommand();
284 };
285
286 return true;
287}
288
289////////////////////////////////////////////////////////////////////////////////
290// virtual
291void LLMediaImplLLMozLib::onPageChanged( const EventType& eventIn )
292{
293 // force an update when the contents of the page changes
294 mNeedsUpdate = true;
295}
296
297////////////////////////////////////////////////////////////////////////////////
298// virtual
299void LLMediaImplLLMozLib::onClickLinkHref( const EventType& eventIn )
300{
301 LLMediaEvent event( this, eventIn.getStringValue(), eventIn.getStringValue2() );
302 mEventEmitter.update( &LLMediaObserver::onClickLinkHref, event );
303}
304
305////////////////////////////////////////////////////////////////////////////////
306// virtual
307void LLMediaImplLLMozLib::onClickLinkNoFollow( const EventType& eventIn )
308{
309 LLMediaEvent event( this, eventIn.getStringValue() );
310 mEventEmitter.update( &LLMediaObserver::onClickLinkNoFollow, event );
311}
312
313////////////////////////////////////////////////////////////////////////////////
314// virtual
315void LLMediaImplLLMozLib::onUpdateProgress( const EventType& eventIn )
316{
317 LLMediaEvent event( this, eventIn.getIntValue() );
318 mEventEmitter.update( &LLMediaObserver::onUpdateProgress, event );
319}
320
321////////////////////////////////////////////////////////////////////////////////
322// virtual
323void LLMediaImplLLMozLib::onStatusTextChange( const EventType& eventIn )
324{
325 LLMediaEvent event( this, eventIn.getStringValue() );
326 mEventEmitter.update( &LLMediaObserver::onStatusTextChange, event );
327}
328
329////////////////////////////////////////////////////////////////////////////////
330// virtual
331void LLMediaImplLLMozLib::onLocationChange( const EventType& eventIn )
332{
333 LLMediaEvent event( this, eventIn.getEventUri() );
334 mEventEmitter.update( &LLMediaObserver::onLocationChange, event );
335}
336
337////////////////////////////////////////////////////////////////////////////////
338// virtual
339void LLMediaImplLLMozLib::onNavigateBegin( const EventType& eventIn )
340{
341 LLMediaEvent event( this, eventIn.getEventUri() );
342 mEventEmitter.update( &LLMediaObserver::onNavigateBegin, event );
343}
344
345////////////////////////////////////////////////////////////////////////////////
346// virtual
347void LLMediaImplLLMozLib::onNavigateComplete( const EventType& eventIn )
348{
349 // force an update when the page is finished
350 mNeedsUpdate = true;
351
352 // pass in url and HTML response code (200/404 etc.)
353 LLMediaEvent event( this, eventIn.getEventUri(), eventIn.getIntValue() );
354 mEventEmitter.update( &LLMediaObserver::onNavigateComplete, event );
355}
356
357////////////////////////////////////////////////////////////////////////////////
358// virtual
359unsigned char* LLMediaImplLLMozLib::getMediaData()
360{
361 return (unsigned char*)LLMozLib::getInstance()->getBrowserWindowPixels( mWindowId );
362}
363
364// helper func to compute size of media data
365bool LLMediaImplLLMozLib::recomputeSizes()
366{
367 int new_width = mMediaRequestedWidth;
368 int new_height = mMediaRequestedHeight;
369
370 if (new_width < 0)
371 new_width = 512;
372
373 if (new_height < 0)
374 new_height = 512;
375
376 if (mAutoScaled)
377 {
378 new_width = LLMediaManager::textureWidthFromMediaWidth( new_width );
379 new_height = LLMediaManager::textureHeightFromMediaHeight( new_height );
380 }
381
382 bool status = LLMozLib::getInstance()->setSize( mWindowId, new_width, new_height );
383
384 if (status)
385 setMediaSize(new_width, new_height);
386
387 return status;
388}
389
390
391////////////////////////////////////////////////////////////////////////////////
392// virtual
393int LLMediaImplLLMozLib::getMediaDataWidth() const
394{
395 return mMediaDataWidth;
396}
397
398////////////////////////////////////////////////////////////////////////////////
399// virtual
400int LLMediaImplLLMozLib::getMediaDataHeight() const
401{
402 return mMediaDataHeight;
403}
404
405////////////////////////////////////////////////////////////////////////////////
406// virtual
407bool LLMediaImplLLMozLib::setRequestedMediaSize(int width, int height)
408{
409 LLMediaImplCommon::setRequestedMediaSize(width, height);
410
411 return recomputeSizes();
412}
413
414////////////////////////////////////////////////////////////////////////////////
415// virtual
416bool LLMediaImplLLMozLib::setAutoScaled( bool auto_scaled )
417{
418 LLMediaImplCommon::setAutoScaled(auto_scaled);
419
420 return recomputeSizes();
421}
422
423
424////////////////////////////////////////////////////////////////////////////////
425// virtual
426int LLMediaImplLLMozLib::getTextureFormatPrimary() const
427{
428#if defined(__APPLE__) || defined(MACOSX)
429 return GL_BGRA_EXT;
430#else
431 return LLMozLib::getInstance()->getBrowserDepth( mWindowId ) == 3 ? GL_BGR_EXT : GL_BGRA_EXT;
432#endif
433}
434
435////////////////////////////////////////////////////////////////////////////////
436// virtual
437int LLMediaImplLLMozLib::getTextureFormatType() const
438{
439#if defined(__APPLE__) || defined(MACOSX)
440 #ifdef __BIG_ENDIAN__
441 return GL_UNSIGNED_INT_8_8_8_8_REV;
442 #else
443 return GL_UNSIGNED_INT_8_8_8_8;
444 #endif
445#else
446 return GL_UNSIGNED_BYTE;
447#endif
448}
449
450////////////////////////////////////////////////////////////////////////////////
451// virtual
452bool LLMediaImplLLMozLib::mouseDown( int x_pos, int y_pos )
453{
454 return LLMozLib::getInstance()->mouseDown( mWindowId, x_pos, y_pos );
455}
456
457////////////////////////////////////////////////////////////////////////////////
458// virtual
459bool LLMediaImplLLMozLib::mouseUp( int x_pos, int y_pos )
460{
461 LLMozLib::getInstance()->mouseUp( mWindowId, x_pos, y_pos );
462
463 // this seems better than sending focus on mouse down (still need to improve this)
464 LLMozLib::getInstance()->focusBrowser( mWindowId, true );
465
466 return true;
467}
468
469////////////////////////////////////////////////////////////////////////////////
470// virtual
471bool LLMediaImplLLMozLib::mouseMove( int x_pos, int y_pos )
472{
473 return LLMozLib::getInstance()->mouseMove( mWindowId, x_pos, y_pos );
474}
475
476////////////////////////////////////////////////////////////////////////////////
477// virtual
478bool LLMediaImplLLMozLib::keyPress( int key_code )
479{
480 // We don't have to deal with printable characters here - they should
481 // go through handleUnicodeChar(). This table could be more complete
482 // than it is, but I think this covers all of the important
483 // non-printables.
484
485 unsigned long moz_key;
486
487 switch(key_code)
488 {
489 case LL_MEDIA_KEY_BACKSPACE:
490 moz_key = LL_DOM_VK_BACK_SPACE; break;
491 case LL_MEDIA_KEY_TAB:
492 moz_key = LL_DOM_VK_TAB; break;
493 case LL_MEDIA_KEY_RETURN:
494 moz_key = LL_DOM_VK_RETURN; break;
495 case LL_MEDIA_KEY_PAD_RETURN:
496 moz_key = LL_DOM_VK_ENTER; break;
497 case LL_MEDIA_KEY_ESCAPE:
498 moz_key = LL_DOM_VK_ESCAPE; break;
499 case LL_MEDIA_KEY_PAGE_UP:
500 moz_key = LL_DOM_VK_PAGE_UP; break;
501 case LL_MEDIA_KEY_PAGE_DOWN:
502 moz_key = LL_DOM_VK_PAGE_DOWN; break;
503 case LL_MEDIA_KEY_END:
504 moz_key = LL_DOM_VK_END; break;
505 case LL_MEDIA_KEY_HOME:
506 moz_key = LL_DOM_VK_HOME; break;
507 case LL_MEDIA_KEY_LEFT:
508 moz_key = LL_DOM_VK_LEFT; break;
509 case LL_MEDIA_KEY_UP:
510 moz_key = LL_DOM_VK_UP; break;
511 case LL_MEDIA_KEY_RIGHT:
512 moz_key = LL_DOM_VK_RIGHT; break;
513 case LL_MEDIA_KEY_DOWN:
514 moz_key = LL_DOM_VK_DOWN; break;
515 case LL_MEDIA_KEY_INSERT:
516 moz_key = LL_DOM_VK_INSERT; break;
517 case LL_MEDIA_KEY_DELETE:
518 moz_key = LL_DOM_VK_DELETE; break;
519
520 default:
521 return false; // don't know how to map this key.
522 }
523
524 return LLMozLib::getInstance()->keyPress( mWindowId, moz_key );
525}
526
527////////////////////////////////////////////////////////////////////////////////
528// virtual
529bool LLMediaImplLLMozLib::scrollByLines( int lines )
530{
531 return LLMozLib::getInstance()->scrollByLines(mWindowId, lines);
532}
533
534////////////////////////////////////////////////////////////////////////////////
535// virtual
536bool LLMediaImplLLMozLib::focus( bool focus )
537{
538 return LLMozLib::getInstance()->focusBrowser(mWindowId, focus);
539}
540
541////////////////////////////////////////////////////////////////////////////////
542// virtual
543bool LLMediaImplLLMozLib::unicodeInput( unsigned long uni_char )
544{
545 return LLMozLib::getInstance()->unicodeInput(mWindowId, uni_char);
546}
547
548////////////////////////////////////////////////////////////////////////////////
549// virtual
550bool LLMediaImplLLMozLib::mouseLeftDoubleClick( int x_pos, int y_pos )
551{
552 return LLMozLib::getInstance()->mouseLeftDoubleClick( mWindowId, x_pos, y_pos );
553}
554
555////////////////////////////////////////////////////////////////////////////////
556// virtual
557bool LLMediaImplLLMozLib::navigateForward()
558{
559 return LLMozLib::getInstance()->navigateForward(mWindowId);
560}
561
562////////////////////////////////////////////////////////////////////////////////
563// virtual
564bool LLMediaImplLLMozLib::navigateBack()
565{
566 return LLMozLib::getInstance()->navigateBack(mWindowId);
567}
568
569////////////////////////////////////////////////////////////////////////////////
570// virtual
571bool LLMediaImplLLMozLib::canNavigateForward()
572{
573 return LLMozLib::getInstance()->canNavigateForward(mWindowId);
574}
575
576////////////////////////////////////////////////////////////////////////////////
577// virtual
578bool LLMediaImplLLMozLib::canNavigateBack()
579{
580 return LLMozLib::getInstance()->canNavigateBack(mWindowId);
581}
582
583////////////////////////////////////////////////////////////////////////////////
584// virtual
585bool LLMediaImplLLMozLib::enableCookies(bool enable)
586{
587 return LLMozLib::getInstance()->enableCookies(enable);
588}
589
590////////////////////////////////////////////////////////////////////////////////
591// virtual
592bool LLMediaImplLLMozLib::enableProxy(bool enable, std::string proxy_host_name, int proxy_port)
593{
594 return LLMozLib::getInstance()->enableProxy(enable, proxy_host_name, proxy_port);
595}
596
597////////////////////////////////////////////////////////////////////////////////
598// virtual
599bool LLMediaImplLLMozLib::clearCache()
600{
601 return LLMozLib::getInstance()->clearCache();
602}
603
604////////////////////////////////////////////////////////////////////////////////
605// virtual
606bool LLMediaImplLLMozLib::clearCookies()
607{
608 return LLMozLib::getInstance()->clearAllCookies();
609}
610
611////////////////////////////////////////////////////////////////////////////////
612// virtual
613bool LLMediaImplLLMozLib::reset()
614{
615 LLMozLib::getInstance()->remObserver( mWindowId, this );
616
617 LLMozLib::getInstance()->destroyBrowserWindow( mWindowId );
618
619 mWindowId = 0;
620
621 return true;
622}
623
624#endif // LL_LLMOZLIB_ENABLED
diff --git a/linden/indra/llmedia/llmediaimplllmozlib.h b/linden/indra/llmedia/llmediaimplllmozlib.h
deleted file mode 100644
index f71300e..0000000
--- a/linden/indra/llmedia/llmediaimplllmozlib.h
+++ /dev/null
@@ -1,127 +0,0 @@
1/**
2 * @file llmediaimplllmozlib.cpp
3 * @brief Example 2 of a media impl concrete class
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#ifndef LLMEDIAIMPLLLMOZLIB_H
34#define LLMEDIAIMPLLLMOZLIB_H
35
36#include "llmediaimplcommon.h"
37#include "llmediaimplfactory.h"
38
39#if LL_LLMOZLIB_ENABLED
40
41#include "llmozlib2.h"
42
43class LLMediaManagerData;
44
45class LLMediaImplLLMozLib :
46 public LLMediaImplCommon,
47 public LLEmbeddedBrowserWindowObserver
48{
49 public:
50 LLMediaImplLLMozLib();
51
52 static bool startup( LLMediaManagerData* init_data );
53 static bool closedown();
54
55 // Update the user-agent string reported when the browser requests
56 // web page, because we need to include the Second Life version
57 // and skin name (which can change without restarts).
58 // Must be called after startup().
59 static bool setBrowserUserAgent(std::string user_agent);
60
61 /* virtual */ bool init();
62 /* virtual */ std::string getVersion();
63 /* virtual */ bool set404RedirectUrl( std::string redirect_url );
64 /* virtual */ bool clr404RedirectUrl();
65 /* virtual */ bool setBackgroundColor( unsigned int red, unsigned int green, unsigned int blue ) const;
66 /* virtual */ bool setCaretColor( unsigned int red, unsigned int green, unsigned int blue ) const;
67 /* virtual */ bool navigateTo( const std::string url );
68 /* virtual */ bool updateMedia();
69 /* virtual */ unsigned char* getMediaData();
70 /* virtual */ int getMediaDataWidth() const;
71 /* virtual */ int getMediaDataHeight() const;
72 /* virtual */ bool setRequestedMediaSize(int width, int height);
73 /* virtual */ bool setAutoScaled( bool auto_scaled );
74 /* virtual */ int getTextureFormatPrimary() const;
75 /* virtual */ int getTextureFormatType() const;
76 /* virtual */ bool mouseDown( int x_pos, int y_pos );
77 /* virtual */ bool mouseUp( int x_pos, int y_pos );
78 /* virtual */ bool mouseMove( int x_pos, int y_pos );
79 /* virtual */ bool keyPress( int key_code );
80 /* virtual */ bool scrollByLines( int lines );
81 /* virtual */ bool focus( bool focus );
82 /* virtual */ bool unicodeInput( unsigned long uni_char );
83 /* virtual */ bool mouseLeftDoubleClick( int x_pos, int y_pos );
84 /* virtual */ bool navigateForward();
85 /* virtual */ bool navigateBack();
86 /* virtual */ bool canNavigateForward();
87 /* virtual */ bool canNavigateBack();
88 /* virtual */ bool enableCookies(bool enable);
89 /* virtual */ bool enableProxy(bool enable, std::string proxy_host_name, int proxy_port);
90 /* virtual */ bool clearCache();
91 /* virtual */ bool clearCookies();
92 /* virtual */ bool reset();
93
94 // LLMozLib observerables
95 virtual void onNavigateBegin( const EventType& eventIn );
96 virtual void onNavigateComplete( const EventType& eventIn );
97 virtual void onUpdateProgress( const EventType& eventIn );
98 virtual void onPageChanged( const EventType& eventIn );
99 virtual void onStatusTextChange( const EventType& eventIn );
100 virtual void onLocationChange( const EventType& eventIn );
101 virtual void onClickLinkHref( const EventType& eventIn );
102 virtual void onClickLinkNoFollow( const EventType& eventIn );
103
104 private:
105 bool recomputeSizes();
106 int mWindowId;
107 int mBrowserWindowWidth;
108 int mBrowserWindowHeight;
109 int mMediaDataWidth;
110 int mMediaDataHeight;
111 bool mNeedsUpdate;
112 bool updateState();
113};
114
115// The maker class
116class LLMediaImplLLMozLibMaker : public LLMediaImplMaker
117{
118 public:
119 LLMediaImplLLMozLibMaker();
120 LLMediaImplLLMozLib* create()
121 {
122 return new LLMediaImplLLMozLib();
123 }
124};
125#endif // LL_LLMOZLIB_ENABLED
126
127#endif // LLMEDIAIMPLLLMOZLIB_H
diff --git a/linden/indra/llmedia/llmediaimplquicktime.cpp b/linden/indra/llmedia/llmediaimplquicktime.cpp
deleted file mode 100644
index 76cacee..0000000
--- a/linden/indra/llmedia/llmediaimplquicktime.cpp
+++ /dev/null
@@ -1,657 +0,0 @@
1/**
2 * @file llmediaimplquicktime.cpp
3 * @brief QuickTime media impl concrete class
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#include "llmediaimplquicktime.h"
34
35#if LL_QUICKTIME_ENABLED
36
37#include "llmediamanager.h"
38#include "llmediaimplregister.h"
39
40#if LL_WINDOWS
41#include <windows.h>
42#endif
43
44#include <iostream>
45#include <sstream>
46
47// register this impl with media manager factory
48static LLMediaImplRegister sLLMediaImplQuickTimeReg( "LLMediaImplQuickTime", new LLMediaImplQuickTimeMaker() );
49
50///////////////////////////////////////////////////////////////////////////////
51//
52LLMediaImplQuickTimeMaker::LLMediaImplQuickTimeMaker()
53{
54 // Register to handle the scheme
55 mSchema.push_back( "rtsp" );
56
57 // Register to handle the category
58 mMimeTypeCategories.push_back( "video" );
59 mMimeTypeCategories.push_back( "audio" );
60 mMimeTypeCategories.push_back( "image" );
61}
62
63///////////////////////////////////////////////////////////////////////////////
64//
65LLMediaImplQuickTime::LLMediaImplQuickTime() :
66 mMovieHandle( 0 ),
67 mGWorldHandle( 0 ),
68 mMovieController( 0 ),
69 mMinWidth( 32 ),
70 mMaxWidth( 2048 ),
71 mMinHeight( 32 ),
72 mMaxHeight( 2048 ),
73 mCurVolume( 0 )
74{
75}
76
77///////////////////////////////////////////////////////////////////////////////
78//
79LLMediaImplQuickTime::~LLMediaImplQuickTime()
80{
81 unload();
82}
83
84////////////////////////////////////////////////////////////////////////////////
85// (static) super-initialization - called once at application startup
86bool LLMediaImplQuickTime::startup( LLMediaManagerData* init_data )
87{
88#ifdef WIN32
89 if ( InitializeQTML( 0L ) != noErr )
90 {
91 return false;
92 };
93#endif
94
95 EnterMovies();
96
97 return true;
98}
99
100////////////////////////////////////////////////////////////////////////////////
101// (static) super-uninitialization - called once at application closedown
102bool LLMediaImplQuickTime::closedown()
103{
104 ExitMovies();
105
106#ifdef WIN32
107 TerminateQTML();
108#endif
109
110 return true;
111}
112
113////////////////////////////////////////////////////////////////////////////////
114// private
115bool LLMediaImplQuickTime::load( const std::string url )
116{
117 if ( url.empty() )
118 return false;
119
120 //In case std::string::c_str() makes a copy of the url data,
121 //make sure there is memory to hold it before allocating memory for handle.
122 //if fails, NewHandleClear(...) should return NULL.
123 const char* url_string = url.c_str() ;
124 Handle handle = NewHandleClear( ( Size )( url.length() + 1 ) );
125 if ( NULL == handle )
126 return false;
127 if(noErr != MemError() || NULL == *handle)
128 {
129 return false ;
130 }
131
132 BlockMove( url_string, *handle, ( Size )( url.length() + 1 ) );
133
134 //std::cout << "LLMediaImplQuickTime::load( " << url << " )" << std::endl;
135
136 // TODO: supposed to use NewMovieFromDataParams now
137 OSErr err = NewMovieFromDataRef( &mMovieHandle, newMovieActive | newMovieDontInteractWithUser | newMovieAsyncOK | newMovieIdleImportOK, nil, handle, URLDataHandlerSubType );
138 DisposeHandle( handle );
139 if ( noErr != err )
140 return false;
141
142 // do pre-roll actions (typically fired for streaming movies but not always)
143 PrePrerollMovie( mMovieHandle, 0, GetMoviePreferredRate( mMovieHandle ), moviePrePrerollCompleteCallback, ( void * )this );
144
145 // get movie rect (and check for min/max)
146 Rect movie_rect;
147 setMovieBoxEnhanced( &movie_rect );
148
149 // make a new movie controller
150 mMovieController = NewMovieController( mMovieHandle, &movie_rect, mcNotVisible | mcTopLeftMovie );
151
152#if defined(__APPLE__) || defined(MACOSX)
153 setMediaDepth( 4 );
154#else
155 setMediaDepth( 3 );
156#endif
157
158 // tell manager about the media size
159 setMediaSize( movie_rect.right - movie_rect.left, movie_rect.bottom - movie_rect.top);
160
161 // movie controller
162 MCSetActionFilterWithRefCon( mMovieController, mcActionFilterCallBack, ( long )this );
163
164 SetMoviePlayHints( mMovieHandle, hintsAllowDynamicResize, hintsAllowDynamicResize );
165
166 // function that gets called when a frame is drawn
167 SetMovieDrawingCompleteProc( mMovieHandle, movieDrawingCallWhenChanged, movieDrawingCompleteCallback, ( long )this );
168
169 // emit an event to say that a media source was loaded
170 LLMediaEvent event( this );
171 mEventEmitter.update( &LLMediaObserver::onMediaLoaded, event );
172
173 // set up inital state
174 sizeChanged();
175
176 return true;
177}
178
179////////////////////////////////////////////////////////////////////////////////
180// virtual
181std::string LLMediaImplQuickTime::getVersion()
182{
183 long version;
184 Gestalt( gestaltQuickTimeVersion, &version );
185
186 std::ostringstream codec( "" );
187 codec << "[";
188 codec << sLLMediaImplQuickTimeReg.getImplName();
189 codec << "] - ";
190 codec << "QuickTime: " << std::hex << version;
191
192 return codec.str();
193}
194
195////////////////////////////////////////////////////////////////////////////////
196// virtual
197bool LLMediaImplQuickTime::navigateTo( const std::string url )
198{
199 // tell engine what we're doing
200 setStatus( LLMediaBase::STATUS_NAVIGATING );
201
202 // remove the movie we were looking at
203 unload();
204
205 // load the new one (no real 'go to this url' function in QT)
206 load( url );
207
208 return true;
209}
210
211////////////////////////////////////////////////////////////////////////////////
212// virtual
213bool LLMediaImplQuickTime::sizeChanged()
214{
215 if ( ! mMovieHandle )
216 return false;
217
218 // sanitize size of movie
219 Rect movie_rect;
220 setMovieBoxEnhanced( &movie_rect );
221
222 // we need this later
223 int width = ( movie_rect.right - movie_rect.left );
224 int height = ( movie_rect.bottom - movie_rect.top );
225
226 std::cout << "LLMEDIA> size changed to " << width << " x " << height << std::endl;
227
228 setMediaSize( width, height );
229
230 // media depth won't change
231 int depth_bits = getMediaDepth() * 8;
232
233 GWorldPtr old_gworld_handle = mGWorldHandle;
234
235 if (old_gworld_handle)
236 {
237 GWorldFlags result = UpdateGWorld( &mGWorldHandle, depth_bits, &movie_rect, NULL, NULL, 0 );
238 if ( gwFlagErr == result )
239 {
240 // TODO: unrecoverable?? throw exception? return something?
241 return false;
242 }
243 }
244 else
245 {
246 OSErr result = NewGWorld( &mGWorldHandle, depth_bits, &movie_rect, NULL, NULL, keepLocal | pixelsLocked );
247 if ( noErr != result )
248 {
249 // ATODO: unrecoverable?? throw exception? return something?
250 return false;
251 }
252
253 // clear memory in GWorld to avoid random screen visual fuzz from uninitialized texture data
254 if ( mGWorldHandle )
255 {
256 PixMapHandle pix_map_handle = GetGWorldPixMap( mGWorldHandle );
257 unsigned char* ptr = ( unsigned char* )GetPixBaseAddr( pix_map_handle );
258 memset( ptr, 0x00, height * QTGetPixMapHandleRowBytes( pix_map_handle ) );
259 }
260 }
261
262 // point movie at GWorld if it's new
263 if ( mMovieHandle && ! old_gworld_handle )
264 {
265 SetMovieGWorld( mMovieHandle, mGWorldHandle, GetGWorldDevice ( mGWorldHandle ) );
266 }
267
268 // update movie controller
269 if ( mMovieController )
270 {
271 MCSetControllerPort( mMovieController, mGWorldHandle );
272 MCPositionController( mMovieController, &movie_rect, &movie_rect,
273 mcTopLeftMovie | mcPositionDontInvalidate );
274 MCMovieChanged( mMovieController, mMovieHandle );
275 }
276
277 // Emit event with size change so the calling app knows about it too
278 LLMediaEvent event( this );
279 mEventEmitter.update( &LLMediaObserver::onMediaSizeChange, event );
280
281 return true;
282}
283
284////////////////////////////////////////////////////////////////////////////////
285// static
286Boolean LLMediaImplQuickTime::mcActionFilterCallBack( MovieController mc, short action, void *params, long ref )
287{
288 Boolean result = false;
289
290 LLMediaImplQuickTime* self = ( LLMediaImplQuickTime* )ref;
291
292 switch( action )
293 {
294 // handle window resizing
295 case mcActionControllerSizeChanged:
296 self->sizeChanged();
297 break;
298
299 // Block any movie controller actions that open URLs.
300 case mcActionLinkToURL:
301 case mcActionGetNextURL:
302 case mcActionLinkToURLExtended:
303 // Prevent the movie controller from handling the message
304 result = true;
305 break;
306
307 default:
308 break;
309 };
310
311 return result;
312}
313
314////////////////////////////////////////////////////////////////////////////////
315// private
316bool LLMediaImplQuickTime::unload()
317{
318 if ( mMovieHandle )
319 {
320 StopMovie( mMovieHandle );
321 if ( mMovieController )
322 {
323 MCMovieChanged( mMovieController, mMovieHandle );
324 };
325 };
326
327 if ( mMovieController )
328 {
329 MCSetActionFilterWithRefCon( mMovieController, NULL, (long)this );
330 DisposeMovieController( mMovieController );
331 mMovieController = NULL;
332 };
333
334 if ( mMovieHandle )
335 {
336 SetMovieDrawingCompleteProc( mMovieHandle, movieDrawingCallWhenChanged, nil, ( long )this );
337 DisposeMovie ( mMovieHandle );
338 mMovieHandle = NULL;
339 };
340
341 if ( mGWorldHandle )
342 {
343 DisposeGWorld( mGWorldHandle );
344 mGWorldHandle = NULL;
345 };
346
347 return true;
348}
349
350////////////////////////////////////////////////////////////////////////////////
351// static
352OSErr LLMediaImplQuickTime::movieDrawingCompleteCallback( Movie call_back_movie, long ref )
353{
354 LLMediaImplQuickTime* self = ( LLMediaImplQuickTime* )ref;
355
356 // IMPORTANT: typically, a consumer who is observing this event will set a flag
357 // when this event is fired then render later. Be aware that the media stream
358 // can change during this period - dimensions, depth, format etc.
359 LLMediaEvent event( self );
360 self->mEventEmitter.update( &LLMediaObserver::onMediaContentsChange, event );
361
362 return noErr;
363}
364
365////////////////////////////////////////////////////////////////////////////////
366// static
367void LLMediaImplQuickTime::moviePrePrerollCompleteCallback( Movie movie, OSErr preroll_err, void *ref )
368{
369 LLMediaImplQuickTime* self = ( LLMediaImplQuickTime* )ref;
370
371 LLMediaEvent event( self );
372 self->mEventEmitter.update( &LLMediaObserver::onMediaPreroll, event );
373}
374
375///////////////////////////////////////////////////////////////////////////////
376// used for stop / loop
377void LLMediaImplQuickTime::rewind()
378{
379 GoToBeginningOfMovie ( mMovieHandle );
380
381 MCMovieChanged( mMovieController, mMovieHandle );
382}
383
384////////////////////////////////////////////////////////////////////////////////
385//
386bool LLMediaImplQuickTime::processState()
387{
388 // start stream
389 if ( nextCommand() == LLMediaBase::COMMAND_START )
390 {
391 // valid when we are in these states
392 if ( getStatus() == LLMediaBase::STATUS_NAVIGATING|| getStatus() == LLMediaBase::STATUS_STOPPED || getStatus() == LLMediaBase::STATUS_PAUSED )
393 {
394 // it appears that the movie must be in a loaded state before we do this command
395 if ( GetMovieLoadState( mMovieHandle ) >= kMovieLoadStatePlaythroughOK )
396 {
397 MCDoAction( mMovieController, mcActionPrerollAndPlay, (void*)GetMoviePreferredRate( mMovieHandle ) );
398
399 MCDoAction( mMovieController, mcActionSetVolume, (void*)mCurVolume );
400
401 setStatus( LLMediaBase::STATUS_STARTED );
402
403 clearCommand();
404 }
405 }
406 }
407 else
408 if ( nextCommand() == LLMediaBase::COMMAND_STOP )
409 {
410 // valid when we are in these states
411 if ( getStatus() == LLMediaBase::STATUS_NAVIGATING || getStatus() == LLMediaBase::STATUS_STARTED || getStatus() == LLMediaBase::STATUS_PAUSED )
412 {
413 // it appears that the movie must be in a loaded state before we do this command
414 if ( GetMovieLoadState( mMovieHandle ) >= kMovieLoadStatePlaythroughOK )
415 {
416 // stop playing
417 Fixed rate = X2Fix( 0.0 );
418 MCDoAction( mMovieController, mcActionPlay, (void*)rate );
419
420 // go back to start
421 rewind();
422
423 setStatus( LLMediaBase::STATUS_STOPPED );
424 clearCommand();
425 };
426 };
427 }
428 else
429 if ( nextCommand() == LLMediaBase::COMMAND_PAUSE )
430 {
431 // valid when we are in these states
432 if ( getStatus() == LLMediaBase::STATUS_NAVIGATING || getStatus() == LLMediaBase::STATUS_STARTED || getStatus() == LLMediaBase::STATUS_STOPPED )
433 {
434 // it appears that the movie must be in a loaded state before we do this command
435 if ( GetMovieLoadState( mMovieHandle ) >= kMovieLoadStatePlaythroughOK )
436 {
437 // stop playing
438 Fixed rate = X2Fix( 0.0 );
439 MCDoAction( mMovieController, mcActionPlay, (void*)rate );
440
441 setStatus( LLMediaBase::STATUS_PAUSED );
442 clearCommand();
443 };
444 };
445 };
446
447 return true;
448}
449
450////////////////////////////////////////////////////////////////////////////////
451// virtual
452bool LLMediaImplQuickTime::setMovieBoxEnhanced( Rect* rect )
453{
454 // get movie rect
455 GetMovieNaturalBoundsRect( mMovieHandle, rect );
456
457 int natural_width = ( rect->right - rect->left );
458 int natural_height = ( rect->bottom - rect->top );
459
460 int width = natural_width;
461 int height = natural_height;
462
463 // if the user has requested a specific size, use it:
464 if ((mMediaRequestedWidth != 0) && (mMediaRequestedHeight != 0))
465 {
466 width = mMediaRequestedWidth;
467 height = mMediaRequestedHeight;
468 }
469
470 // if the user has requested, resize media to exactly fit texture
471 if (mAutoScaled)
472 {
473 width = LLMediaManager::textureWidthFromMediaWidth( width );
474 height = LLMediaManager::textureHeightFromMediaHeight( height );
475 }
476
477 // make sure it falls in valid range
478 if ( width < mMinWidth )
479 width = mMinWidth;
480
481 if ( width > mMaxWidth )
482 width = mMaxWidth;
483
484 if ( height < mMinHeight )
485 height = mMinHeight;
486
487 if ( height > mMaxHeight )
488 height = mMaxHeight;
489
490
491 // scale movie to fit rect and invert vertically to match opengl image format
492 MatrixRecord transform;
493 SetIdentityMatrix( &transform ); // transforms are additive so start from identify matrix
494 double scaleX = (double) width / natural_width;
495 double scaleY = -1.0 * (double) height / natural_height;
496 double centerX = width / 2.0;
497 double centerY = height / 2.0;
498 ScaleMatrix( &transform, X2Fix ( scaleX ), X2Fix ( scaleY ), X2Fix ( centerX ), X2Fix ( centerY ) );
499 SetMovieMatrix( mMovieHandle, &transform );
500
501 // return the new rect
502 rect->right = width;
503 rect->bottom = height;
504 rect->left = 0;
505 rect->top = 0;
506
507 return true;
508}
509
510////////////////////////////////////////////////////////////////////////////////
511// virtual
512bool LLMediaImplQuickTime::updateMedia()
513{
514 if ( ! mMovieHandle )
515 return false;
516
517 if ( ! mMovieController )
518 return false;
519
520 if ( ! mGWorldHandle )
521 return false;
522
523 // service QuickTime
524 MoviesTask( mMovieHandle, 0 );
525 MCIdle( mMovieController );
526
527 // update state machine (deals with transport controls for example)
528 processState();
529
530 // special code for looping - need to rewind at the end of the movie
531
532 if ( isLooping() )
533 {
534 // QT call to see if we are at the end - can't do with controller
535 if ( IsMovieDone( mMovieHandle ) )
536 {
537 // go back to start
538 rewind();
539
540 // kick off new play
541 MCDoAction( mMovieController, mcActionPrerollAndPlay, (void*)GetMoviePreferredRate( mMovieHandle ) );
542
543 // set the volume
544 MCDoAction( mMovieController, mcActionSetVolume, (void*)mCurVolume );
545 }
546 }
547
548 return true;
549}
550
551////////////////////////////////////////////////////////////////////////////////
552// virtual
553unsigned char* LLMediaImplQuickTime::getMediaData()
554{
555 unsigned char* ptr = NULL;
556
557 if ( mGWorldHandle )
558 {
559 PixMapHandle pix_map_handle = GetGWorldPixMap( mGWorldHandle );
560
561 ptr = ( unsigned char* )GetPixBaseAddr( pix_map_handle );
562 };
563
564 return ptr;
565}
566
567////////////////////////////////////////////////////////////////////////////////
568// virtual
569int LLMediaImplQuickTime::getMediaDataWidth() const
570{
571 if ( mGWorldHandle )
572 {
573 int depth = getMediaDepth();
574
575 if (depth < 1)
576 depth = 1;
577
578 // ALWAYS use the row bytes from the PixMap if we have a GWorld because
579 // sometimes it's not the same as mMediaDepth * mMediaWidth !
580 PixMapHandle pix_map_handle = GetGWorldPixMap( mGWorldHandle );
581 return QTGetPixMapHandleRowBytes( pix_map_handle ) / depth;
582 }
583 else
584 {
585 return LLMediaImplCommon::getMediaDataWidth();
586 }
587}
588
589////////////////////////////////////////////////////////////////////////////////
590// virtual
591int LLMediaImplQuickTime::getTextureFormatPrimary() const
592{
593#if defined(__APPLE__) || defined(MACOSX)
594 return LL_MEDIA_BGRA;
595#else
596 return LL_MEDIA_RGB;
597#endif
598}
599
600////////////////////////////////////////////////////////////////////////////////
601// virtual
602int LLMediaImplQuickTime::getTextureFormatType() const
603{
604#if defined(__APPLE__) || defined(MACOSX)
605 #ifdef __BIG_ENDIAN__
606 return LL_MEDIA_UNSIGNED_INT_8_8_8_8_REV;
607 #else
608 return LL_MEDIA_UNSIGNED_INT_8_8_8_8;
609 #endif
610#else
611 return LL_MEDIA_UNSIGNED_BYTE;
612#endif
613}
614
615////////////////////////////////////////////////////////////////////////////////
616// virtual
617bool LLMediaImplQuickTime::seek( double time )
618{
619 if ( mMovieController )
620 {
621 TimeRecord when;
622 when.scale = GetMovieTimeScale( mMovieHandle );
623 when.base = 0;
624
625 // 'time' is in (floating point) seconds. The timebase time will be in 'units', where
626 // there are 'scale' units per second.
627 SInt64 raw_time = ( SInt64 )( time * (double)( when.scale ) );
628
629 when.value.hi = ( SInt32 )( raw_time >> 32 );
630 when.value.lo = ( SInt32 )( ( raw_time & 0x00000000FFFFFFFF ) );
631
632 MCDoAction( mMovieController, mcActionGoToTime, &when );
633
634 return true;
635 }
636
637 return false;
638}
639
640////////////////////////////////////////////////////////////////////////////////
641// virtual
642bool LLMediaImplQuickTime::setVolume( float volume )
643{
644 mCurVolume = (short)(volume * ( double ) 0x100 );
645
646 if ( mMovieController )
647 {
648 MCDoAction( mMovieController, mcActionSetVolume, (void*)mCurVolume );
649
650 return true;
651 }
652
653 return false;
654}
655
656#endif // _3DNOW_InstructionExtensions/ LL_QUICKTIME_ENABLED
657
diff --git a/linden/indra/llmedia/llmediaimplquicktime.h b/linden/indra/llmedia/llmediaimplquicktime.h
deleted file mode 100644
index d4e1db8..0000000
--- a/linden/indra/llmedia/llmediaimplquicktime.h
+++ /dev/null
@@ -1,112 +0,0 @@
1/**
2 * @file llmediaimplquicktime.h
3 * @brief QuickTime media impl concrete class
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#ifndef LLMEDIAIMPLQUICKTIME_H
34#define LLMEDIAIMPLQUICKTIME_H
35
36#include "llmediaimplcommon.h"
37#include "llmediaimplfactory.h"
38
39#if LL_QUICKTIME_ENABLED
40
41#include <string>
42
43// QuickTime includes
44#if defined(__APPLE__)
45 #include <QuickTime/QuickTime.h>
46#elif defined(WIN32)
47 #include "MacTypes.h"
48 #include "QTML.h"
49 #include "Movies.h"
50 #include "QDoffscreen.h"
51 #include "FixMath.h"
52#endif
53
54class LLMediaManagerData;
55
56class LLMediaImplQuickTime :
57 public LLMediaImplCommon
58{
59 public:
60 LLMediaImplQuickTime();
61 virtual ~LLMediaImplQuickTime();
62
63 static bool startup( LLMediaManagerData* init_data );
64 static bool closedown();
65
66 /* virtual */ std::string getVersion();
67 /* virtual */ bool navigateTo( const std::string url );
68 /* virtual */ bool updateMedia();
69 /* virtual */ unsigned char* getMediaData();
70 /* virtual */ int getMediaDataWidth() const;
71 /* virtual */ int getTextureFormatPrimary() const;
72 /* virtual */ int getTextureFormatType() const;
73 /* virtual */ bool seek( double time );
74 /* virtual */ bool setVolume( float volume );
75
76 bool sizeChanged();
77
78 private:
79 static OSErr movieDrawingCompleteCallback( Movie call_back_movie, long ref );
80 static Boolean mcActionFilterCallBack( MovieController mc, short action, void *params, long ref );
81 static void moviePrePrerollCompleteCallback( Movie movie, OSErr preroll_err, void *refcon );
82
83 bool load( const std::string url );
84 bool unload();
85 void rewind();
86 bool processState();
87 bool setMovieBoxEnhanced( Rect* rect );
88
89 Movie mMovieHandle;
90 GWorldPtr mGWorldHandle;
91 ComponentInstance mMovieController;
92 const int mMinWidth;
93 const int mMaxWidth;
94 const int mMinHeight;
95 const int mMaxHeight;
96 int mCurVolume;
97};
98
99// The maker class
100class LLMediaImplQuickTimeMaker : public LLMediaImplMaker
101{
102 public:
103 LLMediaImplQuickTimeMaker();
104 LLMediaImplQuickTime* create()
105 {
106 return new LLMediaImplQuickTime();
107 }
108};
109
110#endif // LL_QUICKTIME_ENABLED
111
112#endif // LLMEDIAIMPLQUICKTIME_H
diff --git a/linden/indra/llmedia/llmediamanager.cpp b/linden/indra/llmedia/llmediamanager.cpp
deleted file mode 100644
index 48da808..0000000
--- a/linden/indra/llmedia/llmediamanager.cpp
+++ /dev/null
@@ -1,295 +0,0 @@
1/**
2 * @file llmediamanager.cpp
3 * @brief Manages instances of media impls
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#include "llmediamanager.h"
34
35#if LL_WINDOWS
36 // GStreamer 0.10.22 - gstutils.h - conversion from 'guint64' to 'guint8'.
37 // This was an intentional change to make GStreamer more threadsafe, and
38 // is okay. Delete this bit if GStreamer ever gets more VS-friendly -- McCabe
39 #pragma warning(disable : 4244)
40#endif
41#include "llmediaimplgstreamer.h"
42#if LL_WINDOWS
43 #pragma warning(default : 4244)
44#endif
45
46#include "llmediaimplfactory.h"
47
48#include "llmediaimplexample1.h"
49#include "llmediaimplexample2.h"
50#include "llmediaimplquicktime.h"
51
52#if LL_LLMOZLIB_ENABLED
53# include "llmediaimplllmozlib.h"
54#endif
55
56#include "llerror.h"
57LLMediaManager* LLMediaManager::sInstance = 0;
58
59
60////////////////////////////////////////////////////////////////////////////////
61// (private)
62LLMediaManager::LLMediaManager()
63{
64}
65
66////////////////////////////////////////////////////////////////////////////////
67LLMediaManager::~LLMediaManager()
68{
69}
70
71////////////////////////////////////////////////////////////////////////////////
72// Early initialization for web browser for the viewer, so we can show
73// the login screen and defer initialization of QuickTime, etc. JC
74// (static)
75void LLMediaManager::initBrowser( LLMediaManagerData* init_data )
76{
77 if ( ! sInstance )
78 sInstance = new LLMediaManager();
79
80#if LL_LLMOZLIB_ENABLED
81 LLMediaImplLLMozLib::startup( init_data );
82#endif // LL_LLMOZLIB_ENABLED
83}
84
85////////////////////////////////////////////////////////////////////////////////
86// (static)
87void LLMediaManager::initClass( LLMediaManagerData* init_data )
88{
89 if ( ! sInstance )
90 sInstance = new LLMediaManager();
91
92 LL_DEBUGS("MediaManager") << "LLMediaManager::initClass" << LL_ENDL;
93 // Initialize impl classes here - this breaks the encapsulation model
94 // but some of the initialization takes a long time and we only want to
95 // do it once at app startup before any of the impls have been created
96 // Each impl provides a static startup method that does any initialization
97 // which takes a significant amount of time.
98 LLMediaImplExample1::startup( init_data );
99 LLMediaImplExample2::startup( init_data );
100
101#if LL_QUICKTIME_ENABLED
102 LL_DEBUGS("MediaManager") << "LLMediaManager::initClass: starting quicktime." << LL_ENDL;
103 LLMediaImplQuickTime::startup( init_data );
104#endif // LL_QUICKTIME_ENABLED
105
106///#if LL_GSTREAMER_ENABLED
107 LL_DEBUGS("MediaManager") << "LLMediaManager::initClass: starting gstreamer" << LL_ENDL;
108 LLMediaImplGStreamer::startup( init_data );
109///#endif // LL_GSTREAMER_ENABLED
110}
111
112////////////////////////////////////////////////////////////////////////////////
113// (static)
114void LLMediaManager::updateClass()
115{
116 if (!sInstance) return;
117
118 media_impl_container_t::iterator it
119 = sInstance->mMediaImplContainer.begin();
120 media_impl_container_t::iterator end
121 = sInstance->mMediaImplContainer.end();
122 for ( ; it != end; ++it )
123 {
124 LLMediaBase* impl = *it;
125 impl->updateMedia();
126 }
127}
128
129////////////////////////////////////////////////////////////////////////////////
130// (static)
131void LLMediaManager::cleanupClass()
132{
133 // Uninitialize impl classes here - this breaks the encapsulation model
134 // but some of the uninitialization takes a long time and we only want to
135 // do it once at app startup before any of the impls have been created.
136 // Each impl provides a static closedown method that does any uninitialization
137 // which takes a significant amount of time.
138 LLMediaImplExample1::closedown();
139 LLMediaImplExample2::closedown();
140
141#if LL_LLMOZLIB_ENABLED
142 LLMediaImplLLMozLib::closedown();
143#endif // LL_LLMOZLIB_ENABLED
144
145#if LL_QUICKTIME_ENABLED
146 LLMediaImplQuickTime::closedown();
147#endif // LL_QUICKTIME_ENABLED
148
149///#if LL_GSTREAMER_ENABLED
150 LLMediaImplGStreamer::closedown();
151///#endif // LL_QUICKTIME_ENABLED
152
153 if ( sInstance )
154 delete sInstance;
155
156 sInstance = 0;
157}
158
159////////////////////////////////////////////////////////////////////////////////
160// (static)
161LLMediaManager* LLMediaManager::getInstance()
162{
163 return sInstance;
164}
165
166////////////////////////////////////////////////////////////////////////////////
167// (static)
168void LLMediaManager::setBrowserUserAgent(std::string user_agent)
169{
170#if LL_LLMOZLIB_ENABLED
171 // *HACK: Breaks encapsulation model, as initClass does above. JC
172 LLMediaImplLLMozLib::setBrowserUserAgent(user_agent);
173#endif // LL_LLMOZLIB_ENABLED
174}
175
176////////////////////////////////////////////////////////////////////////////////
177//
178LLMediaBase* LLMediaManager::createSourceFromMimeType( std::string scheme, std::string mime_type )
179{
180
181 LLMediaImplMakerBase* impl_maker = LLMediaImplFactory::getInstance()->getImplMaker( scheme, mime_type );
182
183 // If an impl maker is return it means this media type is supported
184 if ( impl_maker )
185 {
186 LLMediaBase* media_impl = impl_maker->create();
187 if( media_impl )
188 {
189 media_impl->setImplMaker( impl_maker );
190 std::pair< media_impl_container_t::iterator, bool > result =
191 mMediaImplContainer.insert( media_impl );
192
193 if ( result.second )
194 {
195 media_impl->setMimeType( mime_type );
196
197 media_impl->init();
198
199 return media_impl;
200 };
201 };
202 };
203
204 return 0;
205}
206
207////////////////////////////////////////////////////////////////////////////////
208//
209bool LLMediaManager::destroySource( LLMediaBase* media_impl )
210{
211 media_impl_container_t::iterator iter =
212 mMediaImplContainer.find( media_impl );
213
214 if ( iter != mMediaImplContainer.end() )
215 {
216 if ( *iter )
217 {
218 ( *iter)->reset();
219
220 delete ( *iter );
221
222 mMediaImplContainer.erase( iter );
223
224 return true;
225 };
226 };
227
228 return false;
229}
230
231////////////////////////////////////////////////////////////////////////////////
232//
233bool LLMediaManager::addMimeTypeImplNameMap( std::string mime_type, std::string impl_name )
234{
235 std::pair< mime_type_impl_name_container_t::iterator, bool > result =
236 mMimeTypeImplNameContainer.insert( std::make_pair( mime_type, impl_name ) );
237
238 return result.second;
239}
240
241////////////////////////////////////////////////////////////////////////////////
242//
243std::string LLMediaManager::getImplNameFromMimeType( std::string mime_type )
244{
245 mime_type_impl_name_container_t::iterator iter =
246 mMimeTypeImplNameContainer.find( mime_type );
247
248 if ( iter != mMimeTypeImplNameContainer.end() )
249 {
250 return ( *iter ).second;
251 }
252 else
253 {
254 return std::string( "" );
255 };
256}
257////////////////////////////////////////////////////////////////////////////////
258//
259bool LLMediaManager::supportsMediaType( const std::string& impl_name, const std::string& scheme, const std::string& mime_type )
260{
261 LLMediaImplMakerBase* impl_maker = LLMediaImplFactory::getInstance()->getImplMaker( impl_name );
262 if( impl_maker )
263 {
264 int idx1 = mime_type.find("/");
265 int len = (idx1 == std::string::npos) ? 0 : idx1;
266 std::string category = mime_type.substr(0,len);
267
268 return impl_maker->supportsScheme(scheme) ||
269 impl_maker->supportsMimeType(mime_type) ||
270 impl_maker->supportsMimeTypeCategory(category);
271 }
272 return false;
273}
274
275// static
276int LLMediaManager::textureWidthFromMediaWidth( int media_width )
277{
278 int texture_width = 1;
279 while ( texture_width < media_width )
280 {
281 texture_width <<= 1;
282 };
283 return texture_width;
284}
285
286// static
287int LLMediaManager::textureHeightFromMediaHeight( int media_height )
288{
289 int texture_height = 1;
290 while ( texture_height < media_height )
291 {
292 texture_height <<= 1;
293 };
294 return texture_height;
295}
diff --git a/linden/indra/llmedia/llmediamanager.h b/linden/indra/llmedia/llmediamanager.h
deleted file mode 100644
index dc832d5..0000000
--- a/linden/indra/llmedia/llmediamanager.h
+++ /dev/null
@@ -1,127 +0,0 @@
1/**
2 * @file llmediamanager.h
3 * @brief Manages instances of media impls
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#ifndef LLMEDIAMANAGER_H
34#define LLMEDIAMANAGER_H
35
36#include <map>
37#include <set>
38
39#include "llmediaimplcommon.h"
40
41////////////////////////////////////////////////////////////////////////////////
42//
43class LLMediaManagerData
44{
45 public:
46 LLMediaManagerData() :
47 mBrowserParentWindow( 0 ),
48 mBrowserProfileDir( "" ),
49 mBrowserProfileName ( "" )
50 { };
51
52 void setBrowserApplicationDir( const std::string& browser_application_dir ) { mBrowserApplicationDir = browser_application_dir; };
53 std::string& getBrowserApplicationDir() { return mBrowserApplicationDir; };
54
55 void setBrowserComponentDir( const std::string& browser_component_dir ) { mBrowserComponentDir = browser_component_dir; };
56 std::string& getBrowserComponentDir() { return mBrowserComponentDir; };
57
58 void setBrowserParentWindow( void* browser_parent_window ) { mBrowserParentWindow = browser_parent_window; };
59 void* getBrowserParentWindow() { return mBrowserParentWindow; };
60
61 void setBrowserProfileDir( const std::string& browser_profile_dir ) { mBrowserProfileDir = browser_profile_dir; };
62 std::string& getBrowserProfileDir() { return mBrowserProfileDir; };
63
64 void setBrowserProfileName( const std::string& browser_profile_name ) { mBrowserProfileName = browser_profile_name; };
65 std::string& getBrowserProfileName() { return mBrowserProfileName; };
66
67 private:
68 void* mBrowserParentWindow;
69 std::string mBrowserProfileDir;
70 std::string mBrowserProfileName;
71 std::string mBrowserApplicationDir;
72 std::string mBrowserComponentDir;
73};
74
75////////////////////////////////////////////////////////////////////////////////
76//
77class LLMediaManager
78{
79 public:
80 virtual ~LLMediaManager();
81
82 // Special case early init for just web browser component
83 // so we can show login screen. See .cpp file for details. JC
84 static void initBrowser( LLMediaManagerData* init_data );
85
86 static void initClass( LLMediaManagerData* init_data );
87 static void cleanupClass();
88 static LLMediaManager* getInstance();
89
90 // We append the skin name to the browser user agent string, so
91 // we need to change it while the app is running, not just at
92 // init time.
93 // Must be called after initClass() above.
94 // *HACK: Breaks encapsulation model. JC
95 static void setBrowserUserAgent(std::string user_agent);
96
97 // Calls update on all media sources
98 static void updateClass();
99
100 // Given an URL and mime_type, construct/destroy a playback engine for
101 // it (a "media impl").
102 LLMediaBase* createSourceFromMimeType( std::string scheme, std::string mime_type );
103 bool destroySource( LLMediaBase* media_impl );
104
105 // mime type to impl mapping functions
106 bool addMimeTypeImplNameMap( std::string mime_type, std::string impl_name );
107 std::string getImplNameFromMimeType( std::string mime_type );
108
109 // Name accessor for querying type support
110 bool supportsMediaType( const std::string& impl_name, const std::string& scheme, const std::string& mime_type );
111
112 // convenience functions for getting suggested texture sizes to hold various size media
113 static int textureWidthFromMediaWidth( int media_width );
114 static int textureHeightFromMediaHeight( int media_height );
115
116 private:
117 LLMediaManager();
118 static LLMediaManager* sInstance;
119
120 typedef std::set< LLMediaBase* > media_impl_container_t;
121 media_impl_container_t mMediaImplContainer;
122
123 typedef std::map< std::string, std::string > mime_type_impl_name_container_t;
124 mime_type_impl_name_container_t mMimeTypeImplNameContainer;
125};
126
127#endif // LLMEDIAMANAGER_H
diff --git a/linden/indra/llmedia/llmediaobserver.h b/linden/indra/llmedia/llmediaobserver.h
deleted file mode 100644
index ab8d755..0000000
--- a/linden/indra/llmedia/llmediaobserver.h
+++ /dev/null
@@ -1,116 +0,0 @@
1/**
2 * @file llmediaobserver.h
3 * @brief Derrive from this class and override methods to observe events from emitter class
4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 *
7 * Copyright (c) 2007-2009, Linden Research, Inc.
8 *
9 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab
11 * to you under the terms of the GNU General Public License, version 2.0
12 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
16 *
17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
22 *
23 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above,
25 * and agree to abide by those obligations.
26 *
27 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$
31 */
32
33#ifndef LLMEDIAEOBSERVER_H
34#define LLMEDIAEOBSERVER_H
35
36class LLMediaBase;
37
38class LLMediaEvent
39{
40 public:
41 LLMediaEvent( LLMediaBase* subject ) :
42 mSubject( subject ), mIntValue(-1)
43 {
44 };
45
46 LLMediaEvent( LLMediaBase* subject, std::string in ) :
47 mSubject( subject ), mIntValue(-1), mStringValue(in)
48 {
49 };
50
51 LLMediaEvent( LLMediaBase* subject, std::string string_in, std::string string_ex_in ) :
52 mSubject( subject ), mIntValue(-1), mStringValue(string_in), mStringValueEx(string_ex_in)
53 {
54 };
55
56 LLMediaEvent( LLMediaBase* subject, std::string string_in, int int_in ) :
57 mSubject( subject ), mIntValue(int_in), mStringValue(string_in)
58 {
59 };
60
61 LLMediaEvent( LLMediaBase* subject, int in ) :
62 mSubject( subject ), mIntValue(in)
63 {
64 };
65
66 virtual ~LLMediaEvent() { }
67
68 LLMediaBase* getSubject() const
69 {
70 return mSubject;
71 };
72
73 int getIntValue() const
74 {
75 return mIntValue;
76 }
77
78 std::string getStringValue() const
79 {
80 return mStringValue;
81 }
82
83 std::string getStringValueEx() const
84 {
85 return mStringValueEx;
86 }
87
88 private:
89 LLMediaBase* mSubject;
90 int mIntValue;
91 std::string mStringValue;
92 std::string mStringValueEx;
93};
94
95class LLMediaObserver
96{
97 public:
98 virtual ~LLMediaObserver() {}
99
100 typedef LLMediaEvent EventType;
101 virtual void onMediaPreroll( const EventType& event_in ) { }
102 virtual void onMediaLoaded( const EventType& event_in ) { }
103 virtual void onMediaSizeChange( const EventType& event_in ) { }
104 virtual void onMediaContentsChange( const EventType& event_in ) { }
105 virtual void onMediaStatusTextChange( const EventType& event_in ) { }
106 virtual void onMediaTitleChange( const EventType &event_in ) { }
107 virtual void onNavigateBegin( const EventType& event_in ) { }
108 virtual void onNavigateComplete( const EventType& event_in ) { }
109 virtual void onUpdateProgress( const EventType& event_in ) { }
110 virtual void onStatusTextChange( const EventType& event_in ) { }
111 virtual void onLocationChange( const EventType& event_in ) { }
112 virtual void onClickLinkHref( const EventType& event_in ) { }
113 virtual void onClickLinkNoFollow( const EventType& event_in ) { }
114};
115
116#endif // LLMEDIAEOBSERVER_H
diff --git a/linden/indra/llmedia/llmediaimplgstreamervidplug.cpp b/linden/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.cpp
index f2c0e88..e194bf7 100644..100755
--- a/linden/indra/llmedia/llmediaimplgstreamervidplug.cpp
+++ b/linden/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.cpp
@@ -2,9 +2,10 @@
2 * @file llmediaimplgstreamervidplug.h 2 * @file llmediaimplgstreamervidplug.h
3 * @brief Video-consuming static GStreamer plugin for gst-to-LLMediaImpl 3 * @brief Video-consuming static GStreamer plugin for gst-to-LLMediaImpl
4 * 4 *
5 * @cond
5 * $LicenseInfo:firstyear=2007&license=viewergpl$ 6 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 * 7 *
7 * Copyright (c) 2007-2009, Linden Research, Inc. 8 * Copyright (c) 2007-2010, Linden Research, Inc.
8 * 9 *
9 * Second Life Viewer Source Code 10 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 11 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -12,13 +13,13 @@
12 * ("GPL"), unless you have obtained a separate licensing agreement 13 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of 14 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or 15 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 16 * online at http://secondlife.com/developers/opensource/gplv2
16 * 17 *
17 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at 21 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * http://secondlife.com/developers/opensource/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -28,9 +29,11 @@
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 29 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE. 30 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$ 31 * $/LicenseInfo$
32 *
33 * @endcond
31 */ 34 */
32 35
33///#if LL_GSTREAMER_ENABLED 36#if LL_GSTREAMER010_ENABLED
34 37
35#include "linden_common.h" 38#include "linden_common.h"
36 39
@@ -38,17 +41,18 @@
38#include <gst/video/video.h> 41#include <gst/video/video.h>
39#include <gst/video/gstvideosink.h> 42#include <gst/video/gstvideosink.h>
40 43
41#include "llthread.h" 44#include "llmediaimplgstreamertriviallogging.h"
45// #include "llthread.h"
42 46
43#include "llmediaimplgstreamervidplug.h" 47#include "llmediaimplgstreamervidplug.h"
44 48
45GST_DEBUG_CATEGORY_STATIC (gst_slvideo_debug); 49GST_DEBUG_CATEGORY_STATIC (gst_slvideo_debug);
46#define GST_CAT_DEFAULT gst_slvideo_debug 50#define GST_CAT_DEFAULT gst_slvideo_debug
47 51
48/* Filter signals and args */ 52/* Filter signals and args *//*
49enum 53enum
50{ 54{
51 /* FILL ME */ 55 *//* FILL ME *//*
52 LAST_SIGNAL 56 LAST_SIGNAL
53}; 57};
54 58
@@ -59,9 +63,13 @@ enum
59 63
60#define SLV_SIZECAPS ", width=(int){1,2,4,8,16,32,64,128,256,512,1024}, height=(int){1,2,4,8,16,32,64,128,256,512,1024} " 64#define SLV_SIZECAPS ", width=(int){1,2,4,8,16,32,64,128,256,512,1024}, height=(int){1,2,4,8,16,32,64,128,256,512,1024} "
61#define SLV_ALLCAPS GST_VIDEO_CAPS_RGBx SLV_SIZECAPS ";" GST_VIDEO_CAPS_BGRx SLV_SIZECAPS 65#define SLV_ALLCAPS GST_VIDEO_CAPS_RGBx SLV_SIZECAPS ";" GST_VIDEO_CAPS_BGRx SLV_SIZECAPS
66*/
67
68#define SLV_SIZECAPS ", width=(int)[1,2048], height=(int)[1,2048] "
69#define SLV_ALLCAPS GST_VIDEO_CAPS_RGBx SLV_SIZECAPS
62 70
63static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ( 71static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE (
64 "sink", 72 (gchar*)"sink",
65 GST_PAD_SINK, 73 GST_PAD_SINK,
66 GST_PAD_ALWAYS, 74 GST_PAD_ALWAYS,
67 GST_STATIC_CAPS (SLV_ALLCAPS) 75 GST_STATIC_CAPS (SLV_ALLCAPS)
@@ -115,11 +123,10 @@ gst_slvideo_show_frame (GstBaseSink * bsink, GstBuffer * buf)
115 123
116 slvideo = GST_SLVIDEO(bsink); 124 slvideo = GST_SLVIDEO(bsink);
117 125
118#if 0 126 DEBUGMSG("transferring a frame of %dx%d <- %p (%d)",
119 fprintf(stderr, "\n\ntransferring a frame of %dx%d <- %p (%d)\n\n", 127 slvideo->width, slvideo->height, GST_BUFFER_DATA(buf),
120 slvideo->width, slvideo->height, GST_BUFFER_DATA(buf), 128 slvideo->format);
121 slvideo->format); 129
122#endif
123 if (GST_BUFFER_DATA(buf)) 130 if (GST_BUFFER_DATA(buf))
124 { 131 {
125 // copy frame and frame info into neutral territory 132 // copy frame and frame info into neutral territory
@@ -214,12 +221,13 @@ gst_slvideo_set_caps (GstBaseSink * bsink, GstCaps * caps)
214{ 221{
215 GstSLVideo *filter; 222 GstSLVideo *filter;
216 GstStructure *structure; 223 GstStructure *structure;
217 GstCaps *intersection; 224// GstCaps *intersection;
218 225
219 GST_DEBUG ("set caps with %" GST_PTR_FORMAT, caps); 226 GST_DEBUG ("set caps with %" GST_PTR_FORMAT, caps);
220 227
221 filter = GST_SLVIDEO(bsink); 228 filter = GST_SLVIDEO(bsink);
222 229
230/*
223 intersection = gst_caps_intersect (filter->caps, caps); 231 intersection = gst_caps_intersect (filter->caps, caps);
224 if (gst_caps_is_empty (intersection)) 232 if (gst_caps_is_empty (intersection))
225 { 233 {
@@ -227,7 +235,7 @@ gst_slvideo_set_caps (GstBaseSink * bsink, GstCaps * caps)
227 return FALSE; 235 return FALSE;
228 } 236 }
229 gst_caps_unref(intersection); 237 gst_caps_unref(intersection);
230 238*/
231 int width = 0; 239 int width = 0;
232 int height = 0; 240 int height = 0;
233 gboolean ret; 241 gboolean ret;
@@ -242,6 +250,10 @@ gst_slvideo_set_caps (GstBaseSink * bsink, GstCaps * caps)
242 if (!ret) 250 if (!ret)
243 return FALSE; 251 return FALSE;
244 252
253 INFOMSG("** filter caps set with width=%d, height=%d", width, height);
254
255 GST_OBJECT_LOCK(filter);
256
245 filter->width = width; 257 filter->width = width;
246 filter->height = height; 258 filter->height = height;
247 filter->fps_n = gst_value_get_fraction_numerator(fps); 259 filter->fps_n = gst_value_get_fraction_numerator(fps);
@@ -256,8 +268,12 @@ gst_slvideo_set_caps (GstBaseSink * bsink, GstCaps * caps)
256 filter->par_n = 1; 268 filter->par_n = 1;
257 filter->par_d = 1; 269 filter->par_d = 1;
258 } 270 }
271
259 GST_VIDEO_SINK_WIDTH(filter) = width; 272 GST_VIDEO_SINK_WIDTH(filter) = width;
260 GST_VIDEO_SINK_HEIGHT(filter) = height; 273 GST_VIDEO_SINK_HEIGHT(filter) = height;
274
275 // crufty lump - we *always* accept *only* RGBX now.
276 /*
261 277
262 filter->format = SLV_PF_UNKNOWN; 278 filter->format = SLV_PF_UNKNOWN;
263 if (0 == strcmp(gst_structure_get_name(structure), 279 if (0 == strcmp(gst_structure_get_name(structure),
@@ -282,7 +298,12 @@ gst_slvideo_set_caps (GstBaseSink * bsink, GstCaps * caps)
282 filter->format = SLV_PF_BGRX; 298 filter->format = SLV_PF_BGRX;
283 //fprintf(stderr, "\n\nPIXEL FORMAT BGR\n\n"); 299 //fprintf(stderr, "\n\nPIXEL FORMAT BGR\n\n");
284 } 300 }
285 } 301
302 }*/
303
304 filter->format = SLV_PF_RGBX;
305
306 GST_OBJECT_UNLOCK(filter);
286 307
287 return TRUE; 308 return TRUE;
288} 309}
@@ -317,6 +338,97 @@ gst_slvideo_stop (GstBaseSink * bsink)
317} 338}
318 339
319 340
341static GstFlowReturn
342gst_slvideo_buffer_alloc (GstBaseSink * bsink, guint64 offset, guint size,
343 GstCaps * caps, GstBuffer ** buf)
344{
345 gint width, height;
346 GstStructure *structure = NULL;
347 GstSLVideo *slvideo;
348 slvideo = GST_SLVIDEO(bsink);
349
350 // caps == requested caps
351 // we can ignore these and reverse-negotiate our preferred dimensions with
352 // the peer if we like - we need to do this to obey dynamic resize requests
353 // flowing in from the app.
354 structure = gst_caps_get_structure (caps, 0);
355 if (!gst_structure_get_int(structure, "width", &width) ||
356 !gst_structure_get_int(structure, "height", &height))
357 {
358 GST_WARNING_OBJECT (slvideo, "no width/height in caps %" GST_PTR_FORMAT, caps);
359 return GST_FLOW_NOT_NEGOTIATED;
360 }
361
362 GstBuffer *newbuf = gst_buffer_new();
363 bool made_bufferdata_ptr = false;
364#define MAXDEPTHHACK 4
365
366 GST_OBJECT_LOCK(slvideo);
367 if (slvideo->resize_forced_always) // app is giving us a fixed size to work with
368 {
369 gint slwantwidth, slwantheight;
370 slwantwidth = slvideo->resize_try_width;
371 slwantheight = slvideo->resize_try_height;
372
373 if (slwantwidth != width ||
374 slwantheight != height)
375 {
376 // don't like requested caps, we will issue our own suggestion - copy
377 // the requested caps but substitute our own width and height and see
378 // if our peer is happy with that.
379
380 GstCaps *desired_caps;
381 GstStructure *desired_struct;
382 desired_caps = gst_caps_copy (caps);
383 desired_struct = gst_caps_get_structure (desired_caps, 0);
384
385 GValue value = {0};
386 g_value_init(&value, G_TYPE_INT);
387 g_value_set_int(&value, slwantwidth);
388 gst_structure_set_value (desired_struct, "width", &value);
389 g_value_unset(&value);
390 g_value_init(&value, G_TYPE_INT);
391 g_value_set_int(&value, slwantheight);
392 gst_structure_set_value (desired_struct, "height", &value);
393
394 if (gst_pad_peer_accept_caps (GST_VIDEO_SINK_PAD (slvideo),
395 desired_caps))
396 {
397 // todo: re-use buffers from a pool?
398 // todo: set MALLOCDATA to null, set DATA to point straight to shm?
399
400 // peer likes our cap suggestion
401 DEBUGMSG("peer loves us :)");
402 GST_BUFFER_SIZE(newbuf) = slwantwidth * slwantheight * MAXDEPTHHACK;
403 GST_BUFFER_MALLOCDATA(newbuf) = (guint8*)g_malloc(GST_BUFFER_SIZE(newbuf));
404 GST_BUFFER_DATA(newbuf) = GST_BUFFER_MALLOCDATA(newbuf);
405 gst_buffer_set_caps (GST_BUFFER_CAST(newbuf), desired_caps);
406
407 made_bufferdata_ptr = true;
408 } else {
409 // peer hates our cap suggestion
410 INFOMSG("peer hates us :(");
411 gst_caps_unref(desired_caps);
412 }
413 }
414 }
415
416 GST_OBJECT_UNLOCK(slvideo);
417
418 if (!made_bufferdata_ptr) // need to fallback to malloc at original size
419 {
420 GST_BUFFER_SIZE(newbuf) = width * height * MAXDEPTHHACK;
421 GST_BUFFER_MALLOCDATA(newbuf) = (guint8*)g_malloc(GST_BUFFER_SIZE(newbuf));
422 GST_BUFFER_DATA(newbuf) = GST_BUFFER_MALLOCDATA(newbuf);
423 gst_buffer_set_caps (GST_BUFFER_CAST(newbuf), caps);
424 }
425
426 *buf = GST_BUFFER_CAST(newbuf);
427
428 return GST_FLOW_OK;
429}
430
431
320/* initialize the plugin's class */ 432/* initialize the plugin's class */
321static void 433static void
322gst_slvideo_class_init (GstSLVideoClass * klass) 434gst_slvideo_class_init (GstSLVideoClass * klass)
@@ -338,7 +450,7 @@ gst_slvideo_class_init (GstSLVideoClass * klass)
338#define LLGST_DEBUG_FUNCPTR(p) (p) 450#define LLGST_DEBUG_FUNCPTR(p) (p)
339 gstbasesink_class->get_caps = LLGST_DEBUG_FUNCPTR (gst_slvideo_get_caps); 451 gstbasesink_class->get_caps = LLGST_DEBUG_FUNCPTR (gst_slvideo_get_caps);
340 gstbasesink_class->set_caps = LLGST_DEBUG_FUNCPTR( gst_slvideo_set_caps); 452 gstbasesink_class->set_caps = LLGST_DEBUG_FUNCPTR( gst_slvideo_set_caps);
341 //gstbasesink_class->buffer_alloc=LLGST_DEBUG_FUNCPTR(gst_slvideo_buffer_alloc); 453 gstbasesink_class->buffer_alloc=LLGST_DEBUG_FUNCPTR(gst_slvideo_buffer_alloc);
342 //gstbasesink_class->get_times = LLGST_DEBUG_FUNCPTR (gst_slvideo_get_times); 454 //gstbasesink_class->get_times = LLGST_DEBUG_FUNCPTR (gst_slvideo_get_times);
343 gstbasesink_class->preroll = LLGST_DEBUG_FUNCPTR (gst_slvideo_show_frame); 455 gstbasesink_class->preroll = LLGST_DEBUG_FUNCPTR (gst_slvideo_show_frame);
344 gstbasesink_class->render = LLGST_DEBUG_FUNCPTR (gst_slvideo_show_frame); 456 gstbasesink_class->render = LLGST_DEBUG_FUNCPTR (gst_slvideo_show_frame);
@@ -350,7 +462,7 @@ gst_slvideo_class_init (GstSLVideoClass * klass)
350#undef LLGST_DEBUG_FUNCPTR 462#undef LLGST_DEBUG_FUNCPTR
351} 463}
352 464
353 465/*
354static void 466static void
355gst_slvideo_update_caps (GstSLVideo * slvideo) 467gst_slvideo_update_caps (GstSLVideo * slvideo)
356{ 468{
@@ -363,7 +475,7 @@ gst_slvideo_update_caps (GstSLVideo * slvideo)
363 475
364 gst_caps_replace (&slvideo->caps, caps); 476 gst_caps_replace (&slvideo->caps, caps);
365} 477}
366 478*/
367 479
368/* initialize the new element 480/* initialize the new element
369 * instantiate pads and add them to element 481 * instantiate pads and add them to element
@@ -374,6 +486,7 @@ static void
374gst_slvideo_init (GstSLVideo * filter, 486gst_slvideo_init (GstSLVideo * filter,
375 GstSLVideoClass * gclass) 487 GstSLVideoClass * gclass)
376{ 488{
489 filter->caps = NULL;
377 filter->width = -1; 490 filter->width = -1;
378 filter->height = -1; 491 filter->height = -1;
379 492
@@ -385,9 +498,14 @@ gst_slvideo_init (GstSLVideo * filter,
385 filter->retained_frame_width = filter->width; 498 filter->retained_frame_width = filter->width;
386 filter->retained_frame_height = filter->height; 499 filter->retained_frame_height = filter->height;
387 filter->retained_frame_format = SLV_PF_UNKNOWN; 500 filter->retained_frame_format = SLV_PF_UNKNOWN;
501 GstCaps *caps = gst_caps_from_string (SLV_ALLCAPS);
502 gst_caps_replace (&filter->caps, caps);
503 filter->resize_forced_always = false;
504 filter->resize_try_width = -1;
505 filter->resize_try_height = -1;
388 GST_OBJECT_UNLOCK(filter); 506 GST_OBJECT_UNLOCK(filter);
389 507
390 gst_slvideo_update_caps(filter); 508 //gst_slvideo_update_caps(filter);
391} 509}
392 510
393static void 511static void
@@ -421,7 +539,7 @@ gst_slvideo_get_property (GObject * object, guint prop_id,
421static gboolean 539static gboolean
422plugin_init (GstPlugin * plugin) 540plugin_init (GstPlugin * plugin)
423{ 541{
424 //fprintf(stderr, "\n\n\nPLUGIN INIT\n\n\n"); 542 DEBUGMSG("PLUGIN INIT");
425 543
426 GST_DEBUG_CATEGORY_INIT (gst_slvideo_debug, (gchar*)"private-slvideo-plugin", 544 GST_DEBUG_CATEGORY_INIT (gst_slvideo_debug, (gchar*)"private-slvideo-plugin",
427 0, (gchar*)"Second Life Video Sink"); 545 0, (gchar*)"Second Life Video Sink");
@@ -430,6 +548,12 @@ plugin_init (GstPlugin * plugin)
430 GST_RANK_NONE, GST_TYPE_SLVIDEO); 548 GST_RANK_NONE, GST_TYPE_SLVIDEO);
431} 549}
432 550
551/* this is the structure that gstreamer looks for to register plugins
552 */
553/* NOTE: Can't rely upon GST_PLUGIN_DEFINE_STATIC to self-register, since
554 some g++ versions buggily avoid __attribute__((constructor)) functions -
555 so we provide an explicit plugin init function.
556 */
433 557
434void gst_slvideo_init_class (void) 558void gst_slvideo_init_class (void)
435{ 559{
@@ -445,4 +569,4 @@ void gst_slvideo_init_class (void)
445 (const gchar *)"http://www.secondlife.com/" ); 569 (const gchar *)"http://www.secondlife.com/" );
446} 570}
447 571
448///#endif // LL_GSTREAMER_ENABLED 572#endif // LL_GSTREAMER010_ENABLED
diff --git a/linden/indra/llmedia/llmediaimplgstreamervidplug.h b/linden/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.h
index 3a984a9..5e8c72c 100644..100755
--- a/linden/indra/llmedia/llmediaimplgstreamervidplug.h
+++ b/linden/indra/media_plugins/gstreamer010/llmediaimplgstreamervidplug.h
@@ -2,9 +2,10 @@
2 * @file llmediaimplgstreamervidplug.h 2 * @file llmediaimplgstreamervidplug.h
3 * @brief Video-consuming static GStreamer plugin for gst-to-LLMediaImpl 3 * @brief Video-consuming static GStreamer plugin for gst-to-LLMediaImpl
4 * 4 *
5 * @cond
5 * $LicenseInfo:firstyear=2007&license=viewergpl$ 6 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 * 7 *
7 * Copyright (c) 2007-2009, Linden Research, Inc. 8 * Copyright (c) 2007-2010, Linden Research, Inc.
8 * 9 *
9 * Second Life Viewer Source Code 10 * Second Life Viewer Source Code
10 * The source code in this file ("Source Code") is provided by Linden Lab 11 * The source code in this file ("Source Code") is provided by Linden Lab
@@ -12,13 +13,13 @@
12 * ("GPL"), unless you have obtained a separate licensing agreement 13 * ("GPL"), unless you have obtained a separate licensing agreement
13 * ("Other License"), formally executed by you and Linden Lab. Terms of 14 * ("Other License"), formally executed by you and Linden Lab. Terms of
14 * the GPL can be found in doc/GPL-license.txt in this distribution, or 15 * the GPL can be found in doc/GPL-license.txt in this distribution, or
15 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 16 * online at http://secondlife.com/developers/opensource/gplv2
16 * 17 *
17 * There are special exceptions to the terms and conditions of the GPL as 18 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 19 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 20 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at 21 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception 22 * http://secondlife.com/developers/opensource/flossexception
22 * 23 *
23 * By copying, modifying or distributing this software, you acknowledge 24 * By copying, modifying or distributing this software, you acknowledge
24 * that you have read and understood your obligations described above, 25 * that you have read and understood your obligations described above,
@@ -28,18 +29,20 @@
28 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, 29 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
29 * COMPLETENESS OR PERFORMANCE. 30 * COMPLETENESS OR PERFORMANCE.
30 * $/LicenseInfo$ 31 * $/LicenseInfo$
32 *
33 * @endcond
31 */ 34 */
32 35
33#ifndef __GST_SLVIDEO_H__ 36#ifndef __GST_SLVIDEO_H__
34#define __GST_SLVIDEO_H__ 37#define __GST_SLVIDEO_H__
35 38
36///#if LL_GSTREAMER_ENABLED 39#if LL_GSTREAMER010_ENABLED
37 40
38extern "C" { 41extern "C" {
39#include <gst/gst.h> 42#include <gst/gst.h>
40#include <gst/video/video.h> 43#include <gst/video/video.h>
41#include <gst/video/gstvideosink.h> 44#include <gst/video/gstvideosink.h>
42#include <glib/gthread.h> 45// #include <glib/gthread.h>
43} 46}
44 47
45G_BEGIN_DECLS 48G_BEGIN_DECLS
@@ -85,9 +88,13 @@ struct _GstSLVideo
85 // when the retained frame is updated.) 88 // when the retained frame is updated.)
86 bool retained_frame_ready; // new frame ready since flag last reset. (*TODO: could get the writer to wait on a semaphore instead of having the reader poll, potentially making dropped frames somewhat cheaper.) 89 bool retained_frame_ready; // new frame ready since flag last reset. (*TODO: could get the writer to wait on a semaphore instead of having the reader poll, potentially making dropped frames somewhat cheaper.)
87 unsigned char* retained_frame_data; 90 unsigned char* retained_frame_data;
88 int retained_frame_allocbytes; 91 int retained_frame_allocbytes;
89 int retained_frame_width, retained_frame_height; 92 int retained_frame_width, retained_frame_height;
90 SLVPixelFormat retained_frame_format; 93 SLVPixelFormat retained_frame_format;
94 // sticky resize info
95 bool resize_forced_always;
96 int resize_try_width;
97 int resize_try_height;
91}; 98};
92 99
93struct _GstSLVideoClass 100struct _GstSLVideoClass
@@ -101,6 +108,6 @@ void gst_slvideo_init_class (void);
101 108
102G_END_DECLS 109G_END_DECLS
103 110
104///#endif // LL_GSTREAMER_ENABLED 111#endif // LL_GSTREAMER010_ENABLED
105 112
106#endif /* __GST_SLVIDEO_H__ */ 113#endif /* __GST_SLVIDEO_H__ */
diff --git a/linden/indra/llmedia/llmediaimplregister.h b/linden/indra/newview/llpanellandaudio.h
index 5191274..3d5d633 100644
--- a/linden/indra/llmedia/llmediaimplregister.h
+++ b/linden/indra/newview/llpanellandaudio.h
@@ -1,6 +1,7 @@
1/** 1/**
2 * @file llmediaimplregister.h 2 * @file llpanellandaudio.h
3 * @brief Allow impls to register themselves with the impl factory 3 * @brief Allows configuration of "audio" for a land parcel.
4 *
4 * 5 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$ 6 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 * 7 *
@@ -30,31 +31,33 @@
30 * $/LicenseInfo$ 31 * $/LicenseInfo$
31 */ 32 */
32 33
33#ifndef LLIMEDIAIMPLREGISTER_H 34#ifndef LLPANELLANDAUDIO_H
34#define LLIMEDIAIMPLREGISTER_H 35#define LLPANELLANDAUDIO_H
35 36
36#include <string> 37#include "lllineeditor.h"
38#include "llpanel.h"
39#include "llparcelselection.h"
40#include "lluifwd.h" // widget pointer types
37 41
38#include "llmediaimplfactory.h" 42class LLPanelLandAudio
39 43 : public LLPanel
40///////////////////////////////////////////////////////////////////////////////
41//
42class LLMediaImplRegister
43{ 44{
44 public: 45public:
45 LLMediaImplRegister( std::string impl_name, LLMediaImplMaker* impl_maker ) : 46 LLPanelLandAudio(LLSafeHandle<LLParcelSelection>& parcelp);
46 mImplName( impl_name ) 47 /*virtual*/ ~LLPanelLandAudio();
47 { 48 /*virtual*/ BOOL postBuild();
48 LLMediaImplFactory::getInstance()->registerImpl( impl_name, impl_maker ); 49 void refresh();
49 }; 50
51private:
52 static void onCommitAny(LLUICtrl* ctrl, void *userdata);
50 53
51 std::string getImplName() 54private:
52 { 55 LLCheckBoxCtrl* mCheckSoundLocal;
53 return mImplName; 56 LLRadioGroup* mRadioVoiceChat;
54 }; 57 LLLineEditor* mMusicURLEdit;
58 LLCheckBoxCtrl* mMusicUrlCheck;
55 59
56 private: 60 LLSafeHandle<LLParcelSelection>& mParcel;
57 std::string mImplName;
58}; 61};
59 62
60#endif // LLIMEDIAIMPLREGISTER_H 63#endif
diff --git a/linden/indra/llmedia/llmediaimplexample1.h b/linden/indra/newview/llviewermediaobserver.h
index 1b90e93..6667f98 100644
--- a/linden/indra/llmedia/llmediaimplexample1.h
+++ b/linden/indra/newview/llviewermediaobserver.h
@@ -1,6 +1,6 @@
1/** 1/**
2 * @file llmediaimplexample1.h 2 * @file llviewermediaobserver.h
3 * @brief Example 1 of a media impl concrete class 3 * @brief Methods to override to catch events from LLViewerMedia class
4 * 4 *
5 * $LicenseInfo:firstyear=2007&license=viewergpl$ 5 * $LicenseInfo:firstyear=2007&license=viewergpl$
6 * 6 *
@@ -30,44 +30,42 @@
30 * $/LicenseInfo$ 30 * $/LicenseInfo$
31 */ 31 */
32 32
33#ifndef LLMEDIAIMPLEXAMPLE1_H 33#ifndef LLVIEWERMEDIAOBSERVER_H
34#define LLMEDIAIMPLEXAMPLE1_H 34#define LLVIEWERMEDIAOBSERVER_H
35 35
36#include "llmediaimplcommon.h" 36#include "llpluginclassmediaowner.h"
37#include "llmediaimplfactory.h"
38 37
39class LLMediaManagerData; 38class LLViewerMediaEventEmitter;
40 39
41class LLMediaImplExample1 : 40class LLViewerMediaObserver : public LLPluginClassMediaOwner
42 public LLMediaImplCommon
43{ 41{
44 public: 42public:
45 LLMediaImplExample1(); 43 virtual ~LLViewerMediaObserver();
44
45private:
46 // Emitters will manage this list in addObserver/remObserver.
47 friend class LLViewerMediaEventEmitter;
48 std::list<LLViewerMediaEventEmitter *> mEmitters;
49};
46 50
47 static bool startup( LLMediaManagerData* init_data );
48 static bool closedown();
49 51
50 /* virtual */ bool init(); 52#if 0
51 /* virtual */ bool navigateTo( const std::string url ); 53 // Classes that inherit from LLViewerMediaObserver should add this to their class declaration:
52 /* virtual */ bool updateMedia(); 54
53 /* virtual */ std::string getVersion(); 55 // inherited from LLViewerMediaObserver
54 /* virtual */ unsigned char* getMediaData(); 56 /*virtual*/ void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
55 /* virtual */ bool reset(); 57
56 /* virtual */ bool mouseMove( int x_pos, int y_pos ); 58 /* and will probably need to add this to their cpp file:
57 /* virtual */ bool setRequestedMediaSize( int width, int height );
58 59
59 private: 60 #include "llpluginclassmedia.h"
60 unsigned char* mMediaPixels;
61};
62 61
63class LLMediaImplExample1Maker : public LLMediaImplMaker 62 */
64{ 63
65 public: 64 // The list of events is in llpluginclassmediaowner.h
66 LLMediaImplExample1Maker(); 65
67 LLMediaImplExample1* create() 66
68 { 67#endif
69 return new LLMediaImplExample1(); 68
70 } 69
71}; 70#endif // LLVIEWERMEDIAOBSERVER_H
72 71
73#endif // LLMEDIAIMPLEXAMPLE1_H