diff options
author | McCabe Maxsted | 2009-02-26 18:24:14 -0700 |
---|---|---|
committer | McCabe Maxsted | 2009-02-26 18:24:14 -0700 |
commit | 635bf84bd76978d762d8ee193c991a7dbbab23d6 (patch) | |
tree | 69176a1ddf7ff7462421e9b2a7f0b45fa93aa229 /linden | |
parent | Fixed copy_win_libs (diff) | |
parent | get_state shows name info (diff) | |
download | meta-impy-635bf84bd76978d762d8ee193c991a7dbbab23d6.zip meta-impy-635bf84bd76978d762d8ee193c991a7dbbab23d6.tar.gz meta-impy-635bf84bd76978d762d8ee193c991a7dbbab23d6.tar.bz2 meta-impy-635bf84bd76978d762d8ee193c991a7dbbab23d6.tar.xz |
merged in last working media changes
Diffstat (limited to 'linden')
-rw-r--r-- | linden/indra/llaudio/audioengine.cpp | 65 | ||||
-rw-r--r-- | linden/indra/llaudio/audioengine.h | 6 | ||||
-rw-r--r-- | linden/indra/llmedia/llmediabase.h | 3 | ||||
-rw-r--r-- | linden/indra/llmedia/llmediaimplgstreamer.cpp | 107 | ||||
-rw-r--r-- | linden/indra/llmedia/llmediaimplgstreamer.h | 3 | ||||
-rw-r--r-- | linden/indra/llmedia/llmediaimplgstreamer_syms_raw.inc | 4 | ||||
-rw-r--r-- | linden/indra/newview/llfloaterabout.cpp | 10 | ||||
-rw-r--r-- | linden/indra/newview/lloverlaybar.cpp | 8 |
8 files changed, 136 insertions, 70 deletions
diff --git a/linden/indra/llaudio/audioengine.cpp b/linden/indra/llaudio/audioengine.cpp index da9bcba..400e938 100644 --- a/linden/indra/llaudio/audioengine.cpp +++ b/linden/indra/llaudio/audioengine.cpp | |||
@@ -45,6 +45,8 @@ | |||
45 | #include "llassetstorage.h" | 45 | #include "llassetstorage.h" |
46 | 46 | ||
47 | #include "llmediamanager.h" | 47 | #include "llmediamanager.h" |
48 | #include "llmediabase.h" | ||
49 | #include "llmediaimplcommon.h" | ||
48 | 50 | ||
49 | // necessary for grabbing sounds from sim (implemented in viewer) | 51 | // necessary for grabbing sounds from sim (implemented in viewer) |
50 | extern void request_sound(const LLUUID &sound_guid); | 52 | extern void request_sound(const LLUUID &sound_guid); |
@@ -101,6 +103,8 @@ void LLAudioEngine::setDefaults() | |||
101 | 103 | ||
102 | for (U32 i = 0; i < LLAudioEngine::AUDIO_TYPE_COUNT; i++) | 104 | for (U32 i = 0; i < LLAudioEngine::AUDIO_TYPE_COUNT; i++) |
103 | mSecondaryGain[i] = 1.0f; | 105 | mSecondaryGain[i] = 1.0f; |
106 | |||
107 | mStatus = LLMediaBase::STATUS_UNKNOWN; | ||
104 | } | 108 | } |
105 | 109 | ||
106 | 110 | ||
@@ -168,6 +172,14 @@ void LLAudioEngine::shutdown() | |||
168 | } | 172 | } |
169 | 173 | ||
170 | 174 | ||
175 | //////////////////////////////////////////////////////////////////////////////// | ||
176 | // virtual (derives from LLMediaBase) | ||
177 | LLMediaBase::EStatus LLAudioEngine::getStatus() | ||
178 | { | ||
179 | return mStatus; | ||
180 | } | ||
181 | |||
182 | |||
171 | // virtual | 183 | // virtual |
172 | void LLAudioEngine::startInternetStream(const std::string& url) | 184 | void LLAudioEngine::startInternetStream(const std::string& url) |
173 | { | 185 | { |
@@ -179,27 +191,39 @@ void LLAudioEngine::startInternetStream(const std::string& url) | |||
179 | if (mgr) | 191 | if (mgr) |
180 | { | 192 | { |
181 | mInternetStreamMedia = mgr->createSourceFromMimeType(LLURI(url).scheme(), "audio/mpeg"); // assumes that whatever media implementation supports mp3 also supports vorbis. | 193 | mInternetStreamMedia = mgr->createSourceFromMimeType(LLURI(url).scheme(), "audio/mpeg"); // assumes that whatever media implementation supports mp3 also supports vorbis. |
182 | LL_INFOS("AudioEngine") << "mInternetStreamMedia is now " << mInternetStreamMedia << llendl; | 194 | //LL_INFOS("AudioEngine") << "mInternetStreamMedia is now " << mInternetStreamMedia << llendl; |
183 | } | 195 | } |
184 | } | 196 | } |
185 | 197 | ||
186 | if(!mInternetStreamMedia) | 198 | if(!mInternetStreamMedia) |
187 | return; | 199 | return; |
200 | |||
201 | // Check for a dead stream, just in case | ||
202 | if(getStatus() == LLMediaBase::STATUS_DEAD) | ||
203 | { | ||
204 | mInternetStreamURL.clear(); | ||
205 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); | ||
206 | mInternetStreamMedia->updateMedia(); | ||
207 | stopInternetStream(); | ||
208 | return; | ||
209 | } | ||
188 | 210 | ||
189 | if (!url.empty()) { | 211 | if (!url.empty()) |
212 | { | ||
190 | LL_INFOS("AudioEngine") << "Starting internet stream: " << url << llendl; | 213 | LL_INFOS("AudioEngine") << "Starting internet stream: " << url << llendl; |
191 | mInternetStreamURL = url; | 214 | mInternetStreamURL = url; |
192 | mInternetStreamMedia->navigateTo ( url ); | 215 | mInternetStreamMedia->navigateTo ( url ); |
193 | LL_INFOS("AudioEngine") << "Playing....." << llendl; | 216 | LL_INFOS("AudioEngine") << "Playing....." << llendl; |
194 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_START); | 217 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_START); |
195 | mInternetStreamMedia->updateMedia(); | 218 | mInternetStreamMedia->updateMedia(); |
196 | } else { | 219 | } |
220 | else | ||
221 | { | ||
197 | LL_INFOS("AudioEngine") << "setting stream to NULL"<< llendl; | 222 | LL_INFOS("AudioEngine") << "setting stream to NULL"<< llendl; |
198 | mInternetStreamURL.clear(); | 223 | mInternetStreamURL.clear(); |
199 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); | 224 | mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP); |
200 | mInternetStreamMedia->updateMedia(); | 225 | mInternetStreamMedia->updateMedia(); |
201 | } | 226 | } |
202 | //#endif | ||
203 | } | 227 | } |
204 | 228 | ||
205 | // virtual | 229 | // virtual |
@@ -207,9 +231,10 @@ void LLAudioEngine::stopInternetStream() | |||
207 | { | 231 | { |
208 | LL_INFOS("AudioEngine") << "entered stopInternetStream()" << llendl; | 232 | LL_INFOS("AudioEngine") << "entered stopInternetStream()" << llendl; |
209 | 233 | ||
210 | if(mInternetStreamMedia) | 234 | if(mInternetStreamMedia) |
211 | { | 235 | { |
212 | if( ! mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP)){ | 236 | if(!mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_STOP)) |
237 | { | ||
213 | LL_INFOS("AudioEngine") << "attempting to stop stream failed!" << llendl; | 238 | LL_INFOS("AudioEngine") << "attempting to stop stream failed!" << llendl; |
214 | } | 239 | } |
215 | mInternetStreamMedia->updateMedia(); | 240 | mInternetStreamMedia->updateMedia(); |
@@ -219,29 +244,6 @@ void LLAudioEngine::stopInternetStream() | |||
219 | } | 244 | } |
220 | 245 | ||
221 | // virtual | 246 | // virtual |
222 | void LLAudioEngine::pauseInternetStream(int pause) | ||
223 | { | ||
224 | LL_INFOS("AudioEngine") << "entered pauseInternetStream()" << llendl; | ||
225 | |||
226 | if(!mInternetStreamMedia) | ||
227 | return; | ||
228 | |||
229 | if(pause) | ||
230 | { | ||
231 | if(! mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_PAUSE)) | ||
232 | { | ||
233 | LL_INFOS("AudioEngine") << "attempting to pause stream failed!" << llendl; | ||
234 | } | ||
235 | } else { | ||
236 | if(! mInternetStreamMedia->addCommand(LLMediaBase::COMMAND_START)) | ||
237 | { | ||
238 | LL_INFOS("AudioEngine") << "attempting to unpause stream failed!" << llendl; | ||
239 | } | ||
240 | } | ||
241 | mInternetStreamMedia->updateMedia(); | ||
242 | } | ||
243 | |||
244 | // virtual | ||
245 | void LLAudioEngine::updateInternetStream() | 247 | void LLAudioEngine::updateInternetStream() |
246 | { | 248 | { |
247 | if (mInternetStreamMedia) | 249 | if (mInternetStreamMedia) |
@@ -259,11 +261,6 @@ int LLAudioEngine::isInternetStreamPlaying() | |||
259 | return 1; // Active and playing | 261 | return 1; // Active and playing |
260 | } | 262 | } |
261 | 263 | ||
262 | if (mInternetStreamMedia->getStatus() == LLMediaBase::STATUS_PAUSED) | ||
263 | { | ||
264 | return 2; // paused | ||
265 | } | ||
266 | |||
267 | return 0; // Stopped | 264 | return 0; // Stopped |
268 | } | 265 | } |
269 | 266 | ||
diff --git a/linden/indra/llaudio/audioengine.h b/linden/indra/llaudio/audioengine.h index 15cb35f..878a96a 100644 --- a/linden/indra/llaudio/audioengine.h +++ b/linden/indra/llaudio/audioengine.h | |||
@@ -45,6 +45,8 @@ | |||
45 | #include "llframetimer.h" | 45 | #include "llframetimer.h" |
46 | #include "llassettype.h" | 46 | #include "llassettype.h" |
47 | 47 | ||
48 | #include "llmediabase.h" | ||
49 | |||
48 | class LLMediaBase; | 50 | class LLMediaBase; |
49 | 51 | ||
50 | const F32 LL_WIND_UPDATE_INTERVAL = 0.1f; | 52 | const F32 LL_WIND_UPDATE_INTERVAL = 0.1f; |
@@ -153,13 +155,13 @@ public: | |||
153 | // Internet stream methods | 155 | // Internet stream methods |
154 | virtual void startInternetStream(const std::string& url); | 156 | virtual void startInternetStream(const std::string& url); |
155 | virtual void stopInternetStream(); | 157 | virtual void stopInternetStream(); |
156 | virtual void pauseInternetStream(int pause); | ||
157 | virtual void updateInternetStream(); | 158 | virtual void updateInternetStream(); |
158 | virtual int isInternetStreamPlaying(); | 159 | virtual int isInternetStreamPlaying(); |
159 | virtual void getInternetStreamInfo(char* artist, char* title); | 160 | virtual void getInternetStreamInfo(char* artist, char* title); |
160 | // use a value from 0.0 to 1.0, inclusive | 161 | // use a value from 0.0 to 1.0, inclusive |
161 | virtual void setInternetStreamGain(F32 vol); | 162 | virtual void setInternetStreamGain(F32 vol); |
162 | virtual const std::string& getInternetStreamURL(); | 163 | virtual const std::string& getInternetStreamURL(); |
164 | virtual LLMediaBase::EStatus getStatus(); | ||
163 | 165 | ||
164 | // For debugging usage | 166 | // For debugging usage |
165 | virtual LLVector3 getListenerPos(); | 167 | virtual LLVector3 getListenerPos(); |
@@ -246,6 +248,8 @@ protected: | |||
246 | 248 | ||
247 | LLFrameTimer mWindUpdateTimer; | 249 | LLFrameTimer mWindUpdateTimer; |
248 | 250 | ||
251 | LLMediaBase::EStatus mStatus; | ||
252 | |||
249 | private: | 253 | private: |
250 | void setDefaults(); | 254 | void setDefaults(); |
251 | LLMediaBase *mInternetStreamMedia; | 255 | LLMediaBase *mInternetStreamMedia; |
diff --git a/linden/indra/llmedia/llmediabase.h b/linden/indra/llmedia/llmediabase.h index dad02ca..b5b9420 100644 --- a/linden/indra/llmedia/llmediabase.h +++ b/linden/indra/llmedia/llmediabase.h | |||
@@ -153,7 +153,8 @@ class LLMediaBase | |||
153 | STATUS_STARTED = 3, | 153 | STATUS_STARTED = 3, |
154 | STATUS_STOPPED = 4, | 154 | STATUS_STOPPED = 4, |
155 | STATUS_PAUSED = 6, | 155 | STATUS_PAUSED = 6, |
156 | STATUS_RESETTING = 7 | 156 | STATUS_RESETTING = 7, |
157 | STATUS_DEAD = 8 | ||
157 | }; | 158 | }; |
158 | virtual bool addCommand( ECommand cmd ) = 0; | 159 | virtual bool addCommand( ECommand cmd ) = 0; |
159 | virtual bool clearCommand() = 0; | 160 | virtual bool clearCommand() = 0; |
diff --git a/linden/indra/llmedia/llmediaimplgstreamer.cpp b/linden/indra/llmedia/llmediaimplgstreamer.cpp index bae8ad9..ece3fb0 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer.cpp +++ b/linden/indra/llmedia/llmediaimplgstreamer.cpp | |||
@@ -36,6 +36,7 @@ | |||
36 | 36 | ||
37 | extern "C" { | 37 | extern "C" { |
38 | #include <gst/gst.h> | 38 | #include <gst/gst.h> |
39 | #include <gst/gstelement.h> | ||
39 | } | 40 | } |
40 | 41 | ||
41 | #include "llmediamanager.h" | 42 | #include "llmediamanager.h" |
@@ -72,7 +73,7 @@ LLMediaImplGStreamer () : | |||
72 | mPump ( NULL ), | 73 | mPump ( NULL ), |
73 | mPlaybin ( NULL ), | 74 | mPlaybin ( NULL ), |
74 | mVideoSink ( NULL ), | 75 | mVideoSink ( NULL ), |
75 | mState( GST_STATE_NULL ) | 76 | mState( GST_STATE_NULL ) |
76 | { | 77 | { |
77 | LL_DEBUGS("MediaManager") << "constructing media..." << LL_ENDL; | 78 | LL_DEBUGS("MediaManager") << "constructing media..." << LL_ENDL; |
78 | mVolume = -1.0; // XXX Hack to make the vould change happend first time | 79 | mVolume = -1.0; // XXX Hack to make the vould change happend first time |
@@ -94,12 +95,14 @@ LLMediaImplGStreamer () : | |||
94 | return; // error | 95 | return; // error |
95 | } | 96 | } |
96 | 97 | ||
97 | if (NULL == getenv("LL_GSTREAMER_EXTERNAL")) | 98 | if (NULL == getenv("LL_GSTREAMER_EXTERNAL")) |
98 | { | 99 | { |
99 | // instantiate and connect a custom video sink | 100 | // instantiate and connect a custom video sink |
100 | LL_DEBUGS("MediaManager") << "extrenal video sink..." << LL_ENDL; | 101 | LL_DEBUGS("MediaManager") << "extrenal video sink..." << LL_ENDL; |
102 | |||
103 | // Plays inworld instead of in external player | ||
101 | mVideoSink = | 104 | mVideoSink = |
102 | GST_SLVIDEO(llgst_element_factory_make ("private-slvideo", "slvideo")); | 105 | GST_SLVIDEO(llgst_element_factory_make ("private-slvideo", "slvideo")); |
103 | if (!mVideoSink) | 106 | if (!mVideoSink) |
104 | { | 107 | { |
105 | LL_WARNS("MediaImpl") << "Could not instantiate private-slvideo element." << LL_ENDL; | 108 | LL_WARNS("MediaImpl") << "Could not instantiate private-slvideo element." << LL_ENDL; |
@@ -142,12 +145,14 @@ LLMediaImplGStreamer:: | |||
142 | // virtual | 145 | // virtual |
143 | std::string LLMediaImplGStreamer::getVersion() | 146 | std::string LLMediaImplGStreamer::getVersion() |
144 | { | 147 | { |
145 | std::string rtn; | 148 | guint major, minor, micro, nano; |
146 | rtn = "[" + sLLMediaImplGStreamerReg.getImplName() + "] - GStreamer 0.10.x"; | 149 | llgst_version(&major, &minor, µ, &nano); |
147 | return rtn; | 150 | std::string version = llformat("%d.%d.%d.%d",major,minor,micro,nano); |
151 | return version; | ||
148 | } | 152 | } |
153 | |||
149 | // | 154 | // |
150 | //THIS IS THE METHOD THAT'S BREAKING STUFF | 155 | // STARTUP |
151 | /////////////////////////////////////////////////////////////////////////////// | 156 | /////////////////////////////////////////////////////////////////////////////// |
152 | // (static) super-initialization - called once at application startup | 157 | // (static) super-initialization - called once at application startup |
153 | bool LLMediaImplGStreamer::startup (LLMediaManagerData* init_data) | 158 | bool LLMediaImplGStreamer::startup (LLMediaManagerData* init_data) |
@@ -161,6 +166,10 @@ bool LLMediaImplGStreamer::startup (LLMediaManagerData* init_data) | |||
161 | // Get symbols! | 166 | // Get symbols! |
162 | #if LL_WINDOWS | 167 | #if LL_WINDOWS |
163 | if (! grab_gst_syms("libgstreamer-0.10.dll", "libgstvideo-0.10.dll", "libgstaudio-0.10.dll") ) | 168 | if (! grab_gst_syms("libgstreamer-0.10.dll", "libgstvideo-0.10.dll", "libgstaudio-0.10.dll") ) |
169 | { | ||
170 | LL_WARNS("MediaImpl") << "Couldn't find suitable GStreamer 0.10 support on this system - video playback disabled." << LL_ENDL; | ||
171 | return false; | ||
172 | } | ||
164 | #else | 173 | #else |
165 | if (! grab_gst_syms("libgstreamer-0.10.so.0", "libgstvideo-0.10.so.0", "libgstaudio-0.10.so.0") ) | 174 | if (! grab_gst_syms("libgstreamer-0.10.so.0", "libgstvideo-0.10.so.0", "libgstaudio-0.10.so.0") ) |
166 | { | 175 | { |
@@ -180,7 +189,7 @@ bool LLMediaImplGStreamer::startup (LLMediaManagerData* init_data) | |||
180 | saved_locale = setlocale(LC_ALL, NULL); | 189 | saved_locale = setlocale(LC_ALL, NULL); |
181 | if (0 == llgst_init_check(NULL, NULL, NULL)) | 190 | if (0 == llgst_init_check(NULL, NULL, NULL)) |
182 | { | 191 | { |
183 | LL_WARNS("MediaImpl") << "GST init failed for unspecified reason." << LL_ENDL; | 192 | LL_WARNS("MediaImpl") << "GStreamer library failed to initialize and load standard plugins." << LL_ENDL; |
184 | setlocale(LC_ALL, saved_locale.c_str() ); | 193 | setlocale(LC_ALL, saved_locale.c_str() ); |
185 | return false; | 194 | return false; |
186 | } | 195 | } |
@@ -204,6 +213,7 @@ bool LLMediaImplGStreamer::closedown() | |||
204 | 213 | ||
205 | /////////////////////////////////////////////////////////////////////////////// | 214 | /////////////////////////////////////////////////////////////////////////////// |
206 | // | 215 | // |
216 | // Uncomment the line below to enable spammy debug data. | ||
207 | //#define LL_GST_REPORT_STATE_CHANGES | 217 | //#define LL_GST_REPORT_STATE_CHANGES |
208 | #ifdef LL_GST_REPORT_STATE_CHANGES | 218 | #ifdef LL_GST_REPORT_STATE_CHANGES |
209 | static const char* get_gst_state_name(GstState state) | 219 | static const char* get_gst_state_name(GstState state) |
@@ -269,7 +279,8 @@ gboolean LLMediaImplGStreamer::bus_callback(GstBus *bus, GstMessage *message, gp | |||
269 | LL_DEBUGS("MediaImpl") << "State changed to NULL" << LL_ENDL; | 279 | LL_DEBUGS("MediaImpl") << "State changed to NULL" << LL_ENDL; |
270 | #endif | 280 | #endif |
271 | if (impl->getState() == GST_STATE_PLAYING) | 281 | if (impl->getState() == GST_STATE_PLAYING) |
272 | { // We got stoped by gstremer... | 282 | { |
283 | // Stream was probably dropped, trying to restart | ||
273 | impl->play(); | 284 | impl->play(); |
274 | #ifdef LL_GST_REPORT_STATE_CHANGES | 285 | #ifdef LL_GST_REPORT_STATE_CHANGES |
275 | LL_DEBUGS("MediaImpl") << "Trying to restart." << LL_ENDL; | 286 | LL_DEBUGS("MediaImpl") << "Trying to restart." << LL_ENDL; |
@@ -384,8 +395,7 @@ bool LLMediaImplGStreamer::navigateTo (const std::string urlIn) | |||
384 | LL_DEBUGS("MediaImpl") << "Setting media URI: " << urlIn.c_str() | 395 | LL_DEBUGS("MediaImpl") << "Setting media URI: " << urlIn.c_str() |
385 | << LL_ENDL; | 396 | << LL_ENDL; |
386 | 397 | ||
387 | if (NULL == mPump | 398 | if (mPump == NULL || mPlaybin == NULL) |
388 | || NULL == mPlaybin) | ||
389 | { | 399 | { |
390 | return false; | 400 | return false; |
391 | } | 401 | } |
@@ -394,7 +404,6 @@ bool LLMediaImplGStreamer::navigateTo (const std::string urlIn) | |||
394 | 404 | ||
395 | // set URI | 405 | // set URI |
396 | g_object_set (G_OBJECT (mPlaybin), "uri", urlIn.c_str(), NULL); | 406 | g_object_set (G_OBJECT (mPlaybin), "uri", urlIn.c_str(), NULL); |
397 | //g_object_set (G_OBJECT (mPlaybin), "uri", "file:///tmp/movie", NULL); | ||
398 | 407 | ||
399 | // get playbin's bus - perhaps this can/should be done in ctor | 408 | // get playbin's bus - perhaps this can/should be done in ctor |
400 | GstBus *bus = llgst_pipeline_get_bus (GST_PIPELINE (mPlaybin)); | 409 | GstBus *bus = llgst_pipeline_get_bus (GST_PIPELINE (mPlaybin)); |
@@ -405,6 +414,8 @@ bool LLMediaImplGStreamer::navigateTo (const std::string urlIn) | |||
405 | llgst_bus_add_watch (bus, bus_callback, this); | 414 | llgst_bus_add_watch (bus, bus_callback, this); |
406 | llgst_object_unref (bus); | 415 | llgst_object_unref (bus); |
407 | 416 | ||
417 | mState = GST_STATE_READY; | ||
418 | |||
408 | // navigateTo implicitly plays, too. | 419 | // navigateTo implicitly plays, too. |
409 | play(); | 420 | play(); |
410 | 421 | ||
@@ -437,6 +448,8 @@ bool LLMediaImplGStreamer::unload() | |||
437 | } | 448 | } |
438 | 449 | ||
439 | mVideoSink = NULL; | 450 | mVideoSink = NULL; |
451 | mState = GST_STATE_NULL; | ||
452 | setStatus(LLMediaBase::STATUS_DEAD); | ||
440 | 453 | ||
441 | return true; | 454 | return true; |
442 | } | 455 | } |
@@ -448,15 +461,19 @@ bool LLMediaImplGStreamer::updateMedia() | |||
448 | //LL_DEBUGS("MediaImpl") << "updating media..." << LL_ENDL; | 461 | //LL_DEBUGS("MediaImpl") << "updating media..." << LL_ENDL; |
449 | 462 | ||
450 | // sanity check | 463 | // sanity check |
451 | if (NULL == mPump | 464 | if (mPump == NULL || mPlaybin == NULL) |
452 | || NULL == mPlaybin) | ||
453 | { | 465 | { |
454 | #ifdef LL_GST_REPORT_STATE_CHANGES | 466 | #ifdef LL_GST_REPORT_STATE_CHANGES |
455 | LL_DEBUGS("MediaImpl") << "dead media..." << LL_ENDL; | 467 | LL_DEBUGS("MediaImpl") << "dead media..." << LL_ENDL; |
456 | #endif | 468 | #endif |
469 | mState = GST_STATE_NULL; | ||
470 | setStatus(LLMediaBase::STATUS_DEAD); | ||
457 | return false; | 471 | return false; |
458 | } | 472 | } |
459 | 473 | ||
474 | if (mState == GST_STATE_VOID_PENDING || mState == GST_STATE_NULL) | ||
475 | return false; | ||
476 | |||
460 | // process next outstanding command | 477 | // process next outstanding command |
461 | switch (nextCommand()) | 478 | switch (nextCommand()) |
462 | { | 479 | { |
@@ -567,10 +584,24 @@ bool LLMediaImplGStreamer::updateMedia() | |||
567 | // | 584 | // |
568 | bool LLMediaImplGStreamer::stop() | 585 | bool LLMediaImplGStreamer::stop() |
569 | { | 586 | { |
570 | LL_DEBUGS("MediaImpl") << "stopping media..." << LL_ENDL; | 587 | LL_DEBUGS("MediaImpl") << "attempting to stop..." << LL_ENDL; |
571 | // todo: error-check this? | 588 | |
572 | llgst_element_set_state(mPlaybin, GST_STATE_READY); | 589 | if (!mPlaybin || mState == GST_STATE_NULL) |
573 | mState = GST_STATE_READY; | 590 | return true; |
591 | |||
592 | GstElement *pipeline = (GstElement *)llgst_object_ref(GST_OBJECT(mPlaybin)); | ||
593 | llgst_object_unref(pipeline); | ||
594 | |||
595 | llgst_element_set_state(pipeline, GST_STATE_READY); | ||
596 | |||
597 | if (mState == GST_STATE_PLAYING) | ||
598 | mState = GST_STATE_VOID_PENDING; | ||
599 | else | ||
600 | mState = GST_STATE_READY; | ||
601 | |||
602 | GstStateChangeReturn state_change = llgst_element_get_state(mPlaybin, NULL, NULL, GST_CLOCK_TIME_NONE); | ||
603 | LL_DEBUGS("MediaImpl") << "get_state: " << llgst_element_state_change_return_get_name(state_change) << LL_ENDL; | ||
604 | |||
574 | return true; | 605 | return true; |
575 | } | 606 | } |
576 | 607 | ||
@@ -578,10 +609,29 @@ bool LLMediaImplGStreamer::stop() | |||
578 | // | 609 | // |
579 | bool LLMediaImplGStreamer::play() | 610 | bool LLMediaImplGStreamer::play() |
580 | { | 611 | { |
581 | LL_DEBUGS("MediaImpl") << "playing media..." << LL_ENDL; | 612 | LL_DEBUGS("MediaImpl") << "attempting to play..." << LL_ENDL; |
582 | // todo: error-check this? | 613 | |
583 | llgst_element_set_state(mPlaybin, GST_STATE_PLAYING); | 614 | if (!mPlaybin || mState == GST_STATE_NULL) |
615 | return true; | ||
616 | |||
617 | GstElement *pipeline = (GstElement *)llgst_object_ref(GST_OBJECT(mPlaybin)); | ||
618 | llgst_object_unref(pipeline); | ||
619 | |||
620 | llgst_element_set_state(pipeline, GST_STATE_PLAYING); | ||
584 | mState = GST_STATE_PLAYING; | 621 | mState = GST_STATE_PLAYING; |
622 | /*llgst_element_set_state(mPlaybin, GST_STATE_PLAYING); | ||
623 | mState = GST_STATE_PLAYING;*/ | ||
624 | |||
625 | GstStateChangeReturn state_change = llgst_element_get_state(mPlaybin, NULL, NULL, GST_CLOCK_TIME_NONE); | ||
626 | LL_DEBUGS("MediaImpl") << "get_state: " << llgst_element_state_change_return_get_name(state_change) << LL_ENDL; | ||
627 | |||
628 | // Check to make sure playing was successful. If not, stop. | ||
629 | if (state_change == GST_STATE_CHANGE_FAILURE) | ||
630 | { | ||
631 | setStatus(LLMediaBase::STATUS_STOPPED); | ||
632 | stop(); | ||
633 | } | ||
634 | |||
585 | return true; | 635 | return true; |
586 | } | 636 | } |
587 | 637 | ||
@@ -589,10 +639,17 @@ bool LLMediaImplGStreamer::play() | |||
589 | // | 639 | // |
590 | bool LLMediaImplGStreamer::pause() | 640 | bool LLMediaImplGStreamer::pause() |
591 | { | 641 | { |
592 | LL_DEBUGS("MediaImpl") <<"pausing media..." << LL_ENDL; | 642 | LL_DEBUGS("MediaImpl") << "attempting to pause..." << LL_ENDL; |
593 | // todo: error-check this? | 643 | |
644 | if (!mPlaybin || mState == GST_STATE_NULL) | ||
645 | return true; | ||
646 | |||
594 | llgst_element_set_state(mPlaybin, GST_STATE_PAUSED); | 647 | llgst_element_set_state(mPlaybin, GST_STATE_PAUSED); |
595 | mState = GST_STATE_PAUSED; | 648 | mState = GST_STATE_PAUSED; |
649 | |||
650 | GstStateChangeReturn state_change = llgst_element_get_state(mPlaybin, NULL, NULL, GST_CLOCK_TIME_NONE); | ||
651 | LL_DEBUGS("MediaImpl") << "get_state: " << llgst_element_state_change_return_get_name(state_change) << LL_ENDL; | ||
652 | |||
596 | return true; | 653 | return true; |
597 | }; | 654 | }; |
598 | 655 | ||
@@ -628,12 +685,12 @@ bool LLMediaImplGStreamer::seek(double time) | |||
628 | // virtual | 685 | // virtual |
629 | bool LLMediaImplGStreamer::setVolume(float volume) | 686 | bool LLMediaImplGStreamer::setVolume(float volume) |
630 | { | 687 | { |
631 | // XXX hack to make volume volume changes less othen | 688 | // XXX hack to make volume volume changes less othen |
632 | // bug in gstreamer 0.10.21 | 689 | // bug in gstreamer 0.10.21 |
633 | if(mVolume == volume) | 690 | if(mVolume == volume) |
634 | return true; | 691 | return true; |
635 | 692 | ||
636 | LL_DEBUGS("MediaImpl") << "setVolume(" << volume << ") : " << getpid() << LL_ENDL; | 693 | LL_DEBUGS("MediaImpl") << "setVolume(" << volume << ") : " << getpid() << LL_ENDL; |
637 | mVolume = volume; | 694 | mVolume = volume; |
638 | if (mPlaybin) | 695 | if (mPlaybin) |
639 | { | 696 | { |
diff --git a/linden/indra/llmedia/llmediaimplgstreamer.h b/linden/indra/llmedia/llmediaimplgstreamer.h index 5b493ad..dec970a 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer.h +++ b/linden/indra/llmedia/llmediaimplgstreamer.h | |||
@@ -74,7 +74,7 @@ class LLMediaImplGStreamer: | |||
74 | /* virtual */ int getTextureFormatType() const; | 74 | /* virtual */ int getTextureFormatType() const; |
75 | /* virtual */ int getTextureFormatInternal() const; | 75 | /* virtual */ int getTextureFormatInternal() const; |
76 | /* virtual */ bool seek( double time ); | 76 | /* virtual */ bool seek( double time ); |
77 | /* virtual */ bool setVolume( float volume ); | 77 | /* virtual */ bool setVolume( float volume ); |
78 | 78 | ||
79 | LLMediaEmitter< LLMediaObserver > getEventEmitter() const {return mEventEmitter;}; | 79 | LLMediaEmitter< LLMediaObserver > getEventEmitter() const {return mEventEmitter;}; |
80 | 80 | ||
@@ -84,6 +84,7 @@ class LLMediaImplGStreamer: | |||
84 | bool pause(); | 84 | bool pause(); |
85 | bool stop(); | 85 | bool stop(); |
86 | bool play(); | 86 | bool play(); |
87 | |||
87 | static gboolean bus_callback (GstBus *bus, | 88 | static gboolean bus_callback (GstBus *bus, |
88 | GstMessage *message, | 89 | GstMessage *message, |
89 | gpointer data); | 90 | gpointer data); |
diff --git a/linden/indra/llmedia/llmediaimplgstreamer_syms_raw.inc b/linden/indra/llmedia/llmediaimplgstreamer_syms_raw.inc index e17a7a0..0d0d764 100644 --- a/linden/indra/llmedia/llmediaimplgstreamer_syms_raw.inc +++ b/linden/indra/llmedia/llmediaimplgstreamer_syms_raw.inc | |||
@@ -7,7 +7,9 @@ LL_GST_SYM(true, gst_message_parse_error, void, GstMessage *message, GError **ge | |||
7 | LL_GST_SYM(true, gst_message_parse_warning, void, GstMessage *message, GError **gerror, gchar **debug); | 7 | LL_GST_SYM(true, gst_message_parse_warning, void, GstMessage *message, GError **gerror, gchar **debug); |
8 | LL_GST_SYM(true, gst_message_parse_state_changed, void, GstMessage *message, GstState *oldstate, GstState *newstate, GstState *pending); | 8 | LL_GST_SYM(true, gst_message_parse_state_changed, void, GstMessage *message, GstState *oldstate, GstState *newstate, GstState *pending); |
9 | LL_GST_SYM(true, gst_element_set_state, GstStateChangeReturn, GstElement *element, GstState state); | 9 | LL_GST_SYM(true, gst_element_set_state, GstStateChangeReturn, GstElement *element, GstState state); |
10 | LL_GST_SYM(true, gst_element_get_state, GstStateChangeReturn, GstElement *element, GstState *state, GstState *pending, GstClockTime timeout); | ||
10 | LL_GST_SYM(true, gst_object_unref, void, gpointer object); | 11 | LL_GST_SYM(true, gst_object_unref, void, gpointer object); |
12 | LL_GST_SYM(true, gst_object_ref, gpointer, gpointer object); | ||
11 | LL_GST_SYM(true, gst_object_get_type, GType, void); | 13 | LL_GST_SYM(true, gst_object_get_type, GType, void); |
12 | LL_GST_SYM(true, gst_pipeline_get_type, GType, void); | 14 | LL_GST_SYM(true, gst_pipeline_get_type, GType, void); |
13 | LL_GST_SYM(true, gst_pipeline_get_bus, GstBus*, GstPipeline *pipeline); | 15 | LL_GST_SYM(true, gst_pipeline_get_bus, GstBus*, GstPipeline *pipeline); |
@@ -35,6 +37,8 @@ LL_GST_SYM(true, gst_value_get_fraction_numerator, gint, const GValue *value); | |||
35 | LL_GST_SYM(true, gst_value_get_fraction_denominator, gint, const GValue *value); | 37 | LL_GST_SYM(true, gst_value_get_fraction_denominator, gint, const GValue *value); |
36 | LL_GST_SYM(true, gst_structure_get_name, G_CONST_RETURN gchar *, const GstStructure *structure); | 38 | LL_GST_SYM(true, gst_structure_get_name, G_CONST_RETURN gchar *, const GstStructure *structure); |
37 | LL_GST_SYM(true, gst_element_seek, bool, GstElement *, gdouble, GstFormat, GstSeekFlags, GstSeekType, gint64, GstSeekType, gint64); | 39 | LL_GST_SYM(true, gst_element_seek, bool, GstElement *, gdouble, GstFormat, GstSeekFlags, GstSeekType, gint64, GstSeekType, gint64); |
40 | LL_GST_SYM(true, gst_version, void, guint *major, guint *minor, guint *micro, guint *nano); | ||
41 | LL_GST_SYM(true, gst_element_state_change_return_get_name, const gchar *, GstStateChangeReturn state_ret); | ||
38 | 42 | ||
39 | // optional symbols to grab | 43 | // optional symbols to grab |
40 | LL_GST_SYM(false, gst_segtrap_set_enabled, void, gboolean enabled); | 44 | LL_GST_SYM(false, gst_segtrap_set_enabled, void, gboolean enabled); |
diff --git a/linden/indra/newview/llfloaterabout.cpp b/linden/indra/newview/llfloaterabout.cpp index 4953410..aeca4b5 100644 --- a/linden/indra/newview/llfloaterabout.cpp +++ b/linden/indra/newview/llfloaterabout.cpp | |||
@@ -42,6 +42,7 @@ | |||
42 | #include "llcurl.h" | 42 | #include "llcurl.h" |
43 | #include "llimagej2c.h" | 43 | #include "llimagej2c.h" |
44 | #include "audioengine.h" | 44 | #include "audioengine.h" |
45 | #include "llmediaimplgstreamer.h" | ||
45 | 46 | ||
46 | #include "llviewertexteditor.h" | 47 | #include "llviewertexteditor.h" |
47 | #include "llviewercontrol.h" | 48 | #include "llviewercontrol.h" |
@@ -208,6 +209,15 @@ LLFloaterAbout::LLFloaterAbout() | |||
208 | LLMediaManager *mgr = LLMediaManager::getInstance(); | 209 | LLMediaManager *mgr = LLMediaManager::getInstance(); |
209 | if (mgr) | 210 | if (mgr) |
210 | { | 211 | { |
212 | LLMediaBase *gstreamer = new LLMediaImplGStreamer(); | ||
213 | if (gstreamer) | ||
214 | { | ||
215 | support.append("GStreamer Version: "); | ||
216 | support.append( gstreamer->getVersion() ); | ||
217 | support.append("\n"); | ||
218 | } | ||
219 | delete gstreamer; | ||
220 | |||
211 | LLMediaBase *media_source = mgr->createSourceFromMimeType("http", "text/html"); | 221 | LLMediaBase *media_source = mgr->createSourceFromMimeType("http", "text/html"); |
212 | if (media_source) | 222 | if (media_source) |
213 | { | 223 | { |
diff --git a/linden/indra/newview/lloverlaybar.cpp b/linden/indra/newview/lloverlaybar.cpp index 80cac14..a4eedbb 100644 --- a/linden/indra/newview/lloverlaybar.cpp +++ b/linden/indra/newview/lloverlaybar.cpp | |||
@@ -391,14 +391,6 @@ void LLOverlayBar::toggleMusicPlay(void*) | |||
391 | } | 391 | } |
392 | } | 392 | } |
393 | } | 393 | } |
394 | //else | ||
395 | //{ | ||
396 | // gOverlayBar->mMusicState = PAUSED; // desired state | ||
397 | // if (gAudiop) | ||
398 | // { | ||
399 | // gAudiop->pauseInternetStream(1); | ||
400 | // } | ||
401 | //} | ||
402 | else | 394 | else |
403 | { | 395 | { |
404 | gOverlayBar->mMusicState = STOPPED; // desired state | 396 | gOverlayBar->mMusicState = STOPPED; // desired state |