aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmedia/llmediaimplgstreamer.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--linden/indra/llmedia/llmediaimplgstreamer.cpp365
1 files changed, 193 insertions, 172 deletions
diff --git a/linden/indra/llmedia/llmediaimplgstreamer.cpp b/linden/indra/llmedia/llmediaimplgstreamer.cpp
index 5d6a648..d889f6f 100644
--- a/linden/indra/llmedia/llmediaimplgstreamer.cpp
+++ b/linden/indra/llmedia/llmediaimplgstreamer.cpp
@@ -32,7 +32,7 @@
32 32
33#include "llmediaimplgstreamer.h" 33#include "llmediaimplgstreamer.h"
34 34
35#if LL_GSTREAMER_ENABLED 35///#if LL_GSTREAMER_ENABLED
36 36
37extern "C" { 37extern "C" {
38#include <gst/gst.h> 38#include <gst/gst.h>
@@ -49,6 +49,8 @@ extern "C" {
49 49
50#include "llmediaimplgstreamer_syms.h" 50#include "llmediaimplgstreamer_syms.h"
51 51
52#include "llerror.h"
53
52// register this impl with media manager factory 54// register this impl with media manager factory
53static LLMediaImplRegister sLLMediaImplGStreamerReg( "LLMediaImplGStreamer", new LLMediaImplGStreamerMaker() ); 55static LLMediaImplRegister sLLMediaImplGStreamerReg( "LLMediaImplGStreamer", new LLMediaImplGStreamerMaker() );
54 56
@@ -73,12 +75,14 @@ LLMediaImplGStreamer () :
73 mTextureFormatType ( LL_MEDIA_UNSIGNED_INT_8_8_8_8_REV ), 75 mTextureFormatType ( LL_MEDIA_UNSIGNED_INT_8_8_8_8_REV ),
74 mPump ( NULL ), 76 mPump ( NULL ),
75 mPlaybin ( NULL ), 77 mPlaybin ( NULL ),
76 mVideoSink ( NULL ) 78 mVideoSink ( NULL ),
79 mState( GST_STATE_NULL )
77#ifdef LL_GST_SOUNDSINK 80#ifdef LL_GST_SOUNDSINK
78 ,mAudioSink ( NULL ) 81 ,mAudioSink ( NULL )
79#endif // LL_GST_SOUNDSINK 82#endif // LL_GST_SOUNDSINK
80{ 83{
81 DEBUGMSG("constructing media..."); 84 LL_DEBUGS("MediaManager") << "constructing media..." << LL_ENDL;
85 mVolume = -1.0; // XXX Hack to make the vould change happend first time
82 86
83 setMediaDepth(4); 87 setMediaDepth(4);
84 88
@@ -97,13 +101,15 @@ LLMediaImplGStreamer () :
97 return; // error 101 return; // error
98 } 102 }
99 103
100 if (NULL == getenv("LL_GSTREAMER_EXTERNAL")) { 104 if (NULL == getenv("LL_GSTREAMER_EXTERNAL"))
105 {
101 // instantiate and connect a custom video sink 106 // instantiate and connect a custom video sink
107 LL_DEBUGS("MediaManager") << "extrenal video sink..." << LL_ENDL;
102 mVideoSink = 108 mVideoSink =
103 GST_SLVIDEO(llgst_element_factory_make ("private-slvideo", "slvideo")); 109 GST_SLVIDEO(llgst_element_factory_make ("private-slvideo", "slvideo"));
104 if (!mVideoSink) 110 if (!mVideoSink)
105 { 111 {
106 WARNMSG("Could not instantiate private-slvideo element."); 112 LL_WARNS("MediaImpl") << "Could not instantiate private-slvideo element." << LL_ENDL;
107 // todo: cleanup. 113 // todo: cleanup.
108 return; // error 114 return; // error
109 } 115 }
@@ -111,12 +117,13 @@ LLMediaImplGStreamer () :
111 g_object_set(mPlaybin, "video-sink", mVideoSink, NULL); 117 g_object_set(mPlaybin, "video-sink", mVideoSink, NULL);
112 118
113#ifdef LL_GST_SOUNDSINK 119#ifdef LL_GST_SOUNDSINK
120 LL_DEBUGS("MediaManager") << "extrenal audio sink..." << LL_ENDL;
114 // instantiate and connect a custom audio sink 121 // instantiate and connect a custom audio sink
115 mAudioSink = 122 mAudioSink =
116 GST_SLSOUND(llgst_element_factory_make ("private-slsound", "slsound")); 123 GST_SLSOUND(llgst_element_factory_make ("private-slsound", "slsound"));
117 if (!mAudioSink) 124 if (!mAudioSink)
118 { 125 {
119 WARNMSG("Could not instantiate private-slsound element."); 126 LL_WARN("MediaImpl") << "Could not instantiate private-slsound element." << LL_ENDL;
120 // todo: cleanup. 127 // todo: cleanup.
121 return; // error 128 return; // error
122 } 129 }
@@ -149,7 +156,7 @@ int LLMediaImplGStreamer::getTextureFormatInternal() const
149LLMediaImplGStreamer:: 156LLMediaImplGStreamer::
150~LLMediaImplGStreamer () 157~LLMediaImplGStreamer ()
151{ 158{
152 DEBUGMSG("dtor of media..."); 159 LL_DEBUGS("MediaImpl") << ("dtor of media...") << LL_ENDL;
153 unload(); 160 unload();
154} 161}
155 162
@@ -161,36 +168,41 @@ std::string LLMediaImplGStreamer::getVersion()
161 rtn = "[" + sLLMediaImplGStreamerReg.getImplName() + "] - GStreamer 0.10.x"; 168 rtn = "[" + sLLMediaImplGStreamerReg.getImplName() + "] - GStreamer 0.10.x";
162 return rtn; 169 return rtn;
163} 170}
164 171//
172//THIS IS THE METHOD THAT'S BREAKING STUFF
165/////////////////////////////////////////////////////////////////////////////// 173///////////////////////////////////////////////////////////////////////////////
166// (static) super-initialization - called once at application startup 174// (static) super-initialization - called once at application startup
167bool 175bool LLMediaImplGStreamer::startup (LLMediaManagerData* init_data)
168LLMediaImplGStreamer::
169startup ( LLMediaManagerData* init_data )
170{ 176{
171 static bool done_init = false; 177 static bool done_init = false;
172 if (!done_init) 178 if (!done_init)
173 { 179 {
180 // Init the glib type system - we need it.
181 g_type_init();
182
174 // Get symbols! 183 // Get symbols!
175 if (! grab_gst_syms("libgstreamer-0.10.so.0", 184#if LL_WINDOWS
176 "libgstvideo-0.10.so.0", 185 if (! grab_gst_syms("libgstreamer-0.10.dll", "libgstvideo-0.10.dll", "libgstaudio-0.10.dll") )
177 "libgstaudio-0.10.so.0") ) 186#else
187 if (! grab_gst_syms("libgstreamer-0.10.so.0", "libgstvideo-0.10.so.0", "libgstaudio-0.10.so.0") )
178 { 188 {
179 WARNMSG("Couldn't find suitable GStreamer 0.10 support on this system - video playback disabled."); 189 LL_WARNS("MediaImpl") << "Couldn't find suitable GStreamer 0.10 support on this system - video playback disabled." << LL_ENDL;
180 return false; 190 return false;
181 } 191 }
182 192#endif
183 if (llgst_segtrap_set_enabled) 193 if (llgst_segtrap_set_enabled)
184 llgst_segtrap_set_enabled(FALSE); 194 llgst_segtrap_set_enabled(FALSE);
185 else 195 else
186 WARNMSG("gst_segtrap_set_enabled() is not available; Automated crash-reporter may cease to function until next restart."); 196 {
197 LL_WARNS("MediaImpl") << "gst_segtrap_set_enabled() is not available; Automated crash-reporter may cease to function until next restart." << LL_ENDL;
198 }
187 199
188 // Protect against GStreamer resetting the locale, yuck. 200 // Protect against GStreamer resetting the locale, yuck.
189 static std::string saved_locale; 201 static std::string saved_locale;
190 saved_locale = setlocale(LC_ALL, NULL); 202 saved_locale = setlocale(LC_ALL, NULL);
191 if (0 == llgst_init_check(NULL, NULL, NULL)) 203 if (0 == llgst_init_check(NULL, NULL, NULL))
192 { 204 {
193 WARNMSG("GST init failed for unspecified reason."); 205 LL_WARNS("MediaImpl") << "GST init failed for unspecified reason." << LL_ENDL;
194 setlocale(LC_ALL, saved_locale.c_str() ); 206 setlocale(LC_ALL, saved_locale.c_str() );
195 return false; 207 return false;
196 } 208 }
@@ -204,16 +216,13 @@ startup ( LLMediaManagerData* init_data )
204 216
205 done_init = true; 217 done_init = true;
206 } 218 }
207
208 return true; 219 return true;
209} 220}
210 221
211 222
212bool LLMediaImplGStreamer:: 223bool LLMediaImplGStreamer::closedown()
213closedown()
214{ 224{
215 ungrab_gst_syms(); 225 ungrab_gst_syms();
216
217 return true; 226 return true;
218} 227}
219 228
@@ -222,145 +231,164 @@ closedown()
222// 231//
223//#define LL_GST_REPORT_STATE_CHANGES 232//#define LL_GST_REPORT_STATE_CHANGES
224#ifdef LL_GST_REPORT_STATE_CHANGES 233#ifdef LL_GST_REPORT_STATE_CHANGES
225static char* get_gst_state_name(GstState state) 234static const char* get_gst_state_name(GstState state)
226{ 235{
227 switch (state) { 236 switch (state)
228 case GST_STATE_VOID_PENDING: return "VOID_PENDING"; 237 {
229 case GST_STATE_NULL: return "NULL"; 238 case GST_STATE_VOID_PENDING: return "VOID_PENDING";
230 case GST_STATE_READY: return "READY"; 239 case GST_STATE_NULL: return "NULL";
231 case GST_STATE_PAUSED: return "PAUSED"; 240 case GST_STATE_READY: return "READY";
232 case GST_STATE_PLAYING: return "PLAYING"; 241 case GST_STATE_PAUSED: return "PAUSED";
242 case GST_STATE_PLAYING: return "PLAYING";
233 } 243 }
234 return "(unknown)"; 244 return "(unknown)";
235} 245}
236#endif // LL_GST_REPORT_STATE_CHANGES 246#endif // LL_GST_REPORT_STATE_CHANGES
237 247
238//static 248//static
239gboolean 249gboolean LLMediaImplGStreamer::bus_callback(GstBus *bus, GstMessage *message, gpointer data)
240LLMediaImplGStreamer::bus_callback (GstBus *bus,
241 GstMessage *message,
242 gpointer data)
243{ 250{
244 if (GST_MESSAGE_TYPE(message) != GST_MESSAGE_STATE_CHANGED && 251 LL_DEBUGS("MediaCallback") << "Got GST message type: " << LLGST_MESSAGE_TYPE_NAME (message) << LL_ENDL;
245 GST_MESSAGE_TYPE(message) != GST_MESSAGE_BUFFERING)
246 {
247 DEBUGMSG("Got GST message type: %s",
248 LLGST_MESSAGE_TYPE_NAME (message));
249 }
250 else
251 {
252 DEBUGMSG("Got GST message type: %s",
253 LLGST_MESSAGE_TYPE_NAME (message));
254 }
255 252
256 LLMediaImplGStreamer *impl = (LLMediaImplGStreamer*)data; 253 LLMediaImplGStreamer *impl = (LLMediaImplGStreamer*)data;
257 254
258 switch (GST_MESSAGE_TYPE (message)) { 255 switch (GST_MESSAGE_TYPE (message))
259 case GST_MESSAGE_BUFFERING: { 256 {
260 // NEEDS GST 0.10.11+ 257 case GST_MESSAGE_BUFFERING:
261 if (llgst_message_parse_buffering)
262 { 258 {
263 gint percent = 0; 259 // NEEDS GST 0.10.11+
264 llgst_message_parse_buffering(message, &percent); 260 if (llgst_message_parse_buffering)
265 DEBUGMSG("GST buffering: %d%%", percent); 261 {
266 LLMediaEvent event( impl, percent ); 262 gint percent = 0;
267 impl->getEventEmitter().update( &LLMediaObserver::onUpdateProgress, event ); 263 llgst_message_parse_buffering(message, &percent);
268 264 LL_DEBUGS("MediaBuffering") << "GST buffering: " << percent << "%%" << LL_ENDL;
265 LLMediaEvent event( impl, percent );
266 impl->getEventEmitter().update( &LLMediaObserver::onUpdateProgress, event );
267 }
269 } 268 }
270 break; 269 break;
271 } 270 case GST_MESSAGE_STATE_CHANGED:
272 case GST_MESSAGE_STATE_CHANGED: { 271 {
273 GstState old_state; 272 GstState old_state;
274 GstState new_state; 273 GstState new_state;
275 GstState pending_state; 274 GstState pending_state;
276 llgst_message_parse_state_changed(message, 275 llgst_message_parse_state_changed(message,
277 &old_state, 276 &old_state,
278 &new_state, 277 &new_state,
279 &pending_state); 278 &pending_state);
280#ifdef LL_GST_REPORT_STATE_CHANGES 279#ifdef LL_GST_REPORT_STATE_CHANGES
281 // not generally very useful, and rather spammy. 280 // not generally very useful, and rather spammy.
282 DEBUGMSG("state change (old,<new>,pending): %s,<%s>,%s", 281 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;
283 get_gst_state_name(old_state),
284 get_gst_state_name(new_state),
285 get_gst_state_name(pending_state));
286#endif // LL_GST_REPORT_STATE_CHANGES 282#endif // LL_GST_REPORT_STATE_CHANGES
287 283
288 switch (new_state) { 284 switch (new_state)
289 case GST_STATE_VOID_PENDING: 285 {
290 break; 286 case GST_STATE_VOID_PENDING:
291 case GST_STATE_NULL: 287 break;
292 break; 288 case GST_STATE_NULL:
293 case GST_STATE_READY: 289 LL_DEBUGS("MediaImpl") << "State changed to NULL" << LL_ENDL;
294 break; 290 if (impl->getState() == GST_STATE_PLAYING)
295 case GST_STATE_PAUSED: 291 { // We got stoped by gstremer...
296 break; 292 impl->play();
297 case GST_STATE_PLAYING: 293 LL_DEBUGS("MediaImpl") << "Trying to restart." << LL_ENDL;
298 LLMediaEvent event( impl, 100 ); 294 }
299 impl->getEventEmitter().update( &LLMediaObserver::onUpdateProgress, event ); 295 break;
300 // emit an event to say that a media source was loaded 296 case GST_STATE_READY:
301 LLMediaEvent event2( impl ); 297 break;
302 impl->getEventEmitter().update( &LLMediaObserver::onMediaLoaded, event2 ); 298 case GST_STATE_PAUSED:
299 break;
300 case GST_STATE_PLAYING:
301 LLMediaEvent event( impl, 100 );
302 impl->getEventEmitter().update( &LLMediaObserver::onUpdateProgress, event );
303 // emit an event to say that a media source was loaded
304 LLMediaEvent event2( impl );
305 impl->getEventEmitter().update( &LLMediaObserver::onMediaLoaded, event2 );
306 break;
307 }
303 break; 308 break;
304 } 309 }
305 break; 310 case GST_MESSAGE_ERROR:
306 } 311 {
307 case GST_MESSAGE_ERROR: { 312 GError *err = NULL;
308 GError *err = NULL; 313 gchar *debug = NULL;
309 gchar *debug = NULL;
310 314
311 llgst_message_parse_error (message, &err, &debug); 315 llgst_message_parse_error (message, &err, &debug);
312 WARNMSG("GST error: %s", err->message); 316 LL_WARNS("MediaImpl") << "GST Error: " << err->message << LL_ENDL;
313 g_error_free (err); 317 g_error_free (err);
314 g_free (debug); 318 g_free (debug);
315 319
316 impl->addCommand(LLMediaBase::COMMAND_STOP); 320 impl->addCommand(LLMediaBase::COMMAND_STOP);
321 //impl->addCommand(LLMediaBase::COMMAND_START);
317 322
318 break; 323 break;
319 } 324 }
320 case GST_MESSAGE_INFO: { 325 case GST_MESSAGE_INFO:
321 if (llgst_message_parse_info) 326 {
327 if (llgst_message_parse_info)
328 {
329 GError *err = NULL;
330 gchar *debug = NULL;
331
332 llgst_message_parse_info (message, &err, &debug);
333 LL_INFOS("MediaImpl") << "GST info: " << err->message
334 << LL_ENDL;
335 g_error_free (err);
336 g_free (debug);
337 }
338 break;
339 }
340 case GST_MESSAGE_WARNING:
322 { 341 {
323 GError *err = NULL; 342 GError *err = NULL;
324 gchar *debug = NULL; 343 gchar *debug = NULL;
325 344
326 llgst_message_parse_info (message, &err, &debug); 345 llgst_message_parse_warning (message, &err, &debug);
327 INFOMSG("GST info: %s", err->message); 346 LL_WARNS("MediaImpl") << "GST warning: " << err->message
347 << LL_ENDL;
328 g_error_free (err); 348 g_error_free (err);
329 g_free (debug); 349 g_free (debug);
330 }
331 break;
332 }
333 case GST_MESSAGE_WARNING: {
334 GError *err = NULL;
335 gchar *debug = NULL;
336 350
337 llgst_message_parse_warning (message, &err, &debug); 351 break;
338 WARNMSG("GST warning: %s", err->message); 352 }
339 g_error_free (err); 353 case GST_MESSAGE_TAG:
340 g_free (debug);
341
342 break;
343 }
344 case GST_MESSAGE_EOS:
345 /* end-of-stream */
346 DEBUGMSG("GST end-of-stream.");
347 if (impl->isLooping())
348 { 354 {
349 DEBUGMSG("looping media..."); 355#if 0
350 impl->stop(); 356 GstTagList *tag_list;
351 impl->play(); 357 gchar *title;
358 gchar *artist;
359 llgst_message_parse_tag(message, &tag_list);
360 gboolean hazTitle = llgst_tag_list_get_string(tag_list,
361 GST_TAG_TITLE, &title);
362 gboolean hazArtist = llgst_tag_list_get_string(tag_list,
363 GST_TAG_ARTIST, &artist);
364 if(hazTitle)
365 LL_INFOS("MediaInfo") << "Title is " << title << LL_ENDL;
366 if(hazArtist)
367 LL_INFOS("MediaInfo") << "Artist is " << artist << LL_ENDL;
368#endif
369 break;
352 } 370 }
353 else 371 case GST_MESSAGE_EOS:
354 { 372 {
355 // inject a COMMAND_STOP 373 /* end-of-stream */
356 impl->addCommand(LLMediaBase::COMMAND_STOP); 374 LL_DEBUGS("MediaImpl") << "GST end-of-stream." << LL_ENDL;
375 if (impl->isLooping())
376 {
377 LL_DEBUGS("MediaImpl") << "looping media..." << LL_ENDL;
378 impl->stop();
379 impl->play();
380 }
381 else
382 {
383 // inject a COMMAND_STOP
384 impl->addCommand(LLMediaBase::COMMAND_STOP);
385 }
386 break;
387 default:
388 /* unhandled message */
389 break;
357 } 390 }
358 break;
359 default:
360 /* unhandled message */
361 break;
362 } 391 }
363
364 /* we want to be notified again the next time there is a message 392 /* we want to be notified again the next time there is a message
365 * on the bus, so return true (false means we want to stop watching 393 * on the bus, so return true (false means we want to stop watching
366 * for messages on the bus and our callback should not be called again) 394 * for messages on the bus and our callback should not be called again)
@@ -370,11 +398,10 @@ LLMediaImplGStreamer::bus_callback (GstBus *bus,
370 398
371/////////////////////////////////////////////////////////// 399///////////////////////////////////////////////////////////
372// virtual 400// virtual
373bool 401bool LLMediaImplGStreamer::navigateTo (const std::string urlIn)
374LLMediaImplGStreamer::
375navigateTo ( const std::string urlIn )
376{ 402{
377 DEBUGMSG("Setting media URI: %s", urlIn.c_str()); 403 LL_DEBUGS("MediaImpl") << "Setting media URI: " << urlIn.c_str()
404 << LL_ENDL;
378 405
379 if (NULL == mPump 406 if (NULL == mPump
380#ifdef LL_GST_SOUNDSINK 407#ifdef LL_GST_SOUNDSINK
@@ -408,14 +435,13 @@ navigateTo ( const std::string urlIn )
408 435
409/////////////////////////////////////////////////////////////////////////////// 436///////////////////////////////////////////////////////////////////////////////
410// 437//
411bool 438bool LLMediaImplGStreamer::unload()
412LLMediaImplGStreamer::
413unload ()
414{ 439{
415 DEBUGMSG("unloading media..."); 440 LL_DEBUGS("MediaImpl") << "unloading media..." << LL_ENDL;
416 if (mPlaybin) 441 if (mPlaybin)
417 { 442 {
418 llgst_element_set_state (mPlaybin, GST_STATE_NULL); 443 llgst_element_set_state (mPlaybin, GST_STATE_NULL);
444 mState = GST_STATE_NULL;
419 llgst_object_unref (GST_OBJECT (mPlaybin)); 445 llgst_object_unref (GST_OBJECT (mPlaybin));
420 mPlaybin = NULL; 446 mPlaybin = NULL;
421 } 447 }
@@ -439,11 +465,9 @@ unload ()
439 465
440/////////////////////////////////////////////////////////////////////////////// 466///////////////////////////////////////////////////////////////////////////////
441// virtual 467// virtual
442bool 468bool LLMediaImplGStreamer::updateMedia()
443LLMediaImplGStreamer::
444updateMedia ()
445{ 469{
446 DEBUGMSG("updating media..."); 470 //LL_DEBUGS("MediaImpl") << "updating media..." << LL_ENDL;
447 471
448 // sanity check 472 // sanity check
449 if (NULL == mPump 473 if (NULL == mPump
@@ -452,7 +476,7 @@ updateMedia ()
452#endif 476#endif
453 || NULL == mPlaybin) 477 || NULL == mPlaybin)
454 { 478 {
455 DEBUGMSG("dead media..."); 479 LL_DEBUGS("MediaImpl") << "dead media..." << LL_ENDL;
456 return false; 480 return false;
457 } 481 }
458 482
@@ -460,36 +484,33 @@ updateMedia ()
460 switch (nextCommand()) 484 switch (nextCommand())
461 { 485 {
462 case LLMediaBase::COMMAND_START: 486 case LLMediaBase::COMMAND_START:
463 DEBUGMSG("COMMAND_START"); 487 LL_DEBUGS("MediaImpl") << "COMMAND_START" << LL_ENDL;
464 if (getStatus() == LLMediaBase::STATUS_PAUSED || 488 if (getStatus() == LLMediaBase::STATUS_PAUSED ||
465 getStatus() == LLMediaBase::STATUS_NAVIGATING || 489 getStatus() == LLMediaBase::STATUS_NAVIGATING ||
466 getStatus() == LLMediaBase::STATUS_STOPPED) 490 getStatus() == LLMediaBase::STATUS_STOPPED)
467 { 491 {
468 DEBUGMSG("doing COMMAND_START");
469 play(); 492 play();
470 setStatus(LLMediaBase::STATUS_STARTED); 493 setStatus(LLMediaBase::STATUS_STARTED);
471 clearCommand(); 494 clearCommand();
472 } 495 }
473 break; 496 break;
474 case LLMediaBase::COMMAND_STOP: 497 case LLMediaBase::COMMAND_STOP:
475 DEBUGMSG("COMMAND_STOP"); 498 LL_DEBUGS("MediaImpl") << "COMMAND_STOP" << LL_ENDL;
476 DEBUGMSG("doing COMMAND_STOP");
477 stop(); 499 stop();
478 setStatus(LLMediaBase::STATUS_STOPPED); 500 setStatus(LLMediaBase::STATUS_STOPPED);
479 clearCommand(); 501 clearCommand();
480 break; 502 break;
481 case LLMediaBase::COMMAND_PAUSE: 503 case LLMediaBase::COMMAND_PAUSE:
482 DEBUGMSG("COMMAND_PAUSE"); 504 LL_DEBUGS("MediaImpl") << "COMMAND_PAUSE" << LL_ENDL;
483 if (getStatus() == LLMediaBase::STATUS_STARTED) 505 if (getStatus() == LLMediaBase::STATUS_STARTED)
484 { 506 {
485 DEBUGMSG("doing COMMAND_PAUSE");
486 pause(); 507 pause();
487 setStatus(LLMediaBase::STATUS_PAUSED); 508 setStatus(LLMediaBase::STATUS_PAUSED);
488 clearCommand(); 509 clearCommand();
489 } 510 }
490 break; 511 break;
491 default: 512 default:
492 DEBUGMSG("COMMAND_?"); 513 LL_INFOS("MediaImpl") << "Unknown command" << LL_ENDL;
493 clearCommand(); 514 clearCommand();
494 break; 515 break;
495 case LLMediaBase::COMMAND_NONE: 516 case LLMediaBase::COMMAND_NONE:
@@ -507,7 +528,7 @@ updateMedia ()
507 GST_OBJECT_LOCK(mVideoSink); 528 GST_OBJECT_LOCK(mVideoSink);
508 if (mVideoSink->retained_frame_ready) 529 if (mVideoSink->retained_frame_ready)
509 { 530 {
510 DEBUGMSG("NEW FRAME "); 531 LL_DEBUGS("MediaImpl") <<"NEW FRAME " << LL_ENDL;
511 if (mVideoSink->retained_frame_width != getMediaWidth() || 532 if (mVideoSink->retained_frame_width != getMediaWidth() ||
512 mVideoSink->retained_frame_height != getMediaHeight()) 533 mVideoSink->retained_frame_height != getMediaHeight())
513 // *TODO: also check for change in format 534 // *TODO: also check for change in format
@@ -527,8 +548,9 @@ updateMedia ()
527 mTextureFormatType = LL_MEDIA_UNSIGNED_INT_8_8_8_8_REV; 548 mTextureFormatType = LL_MEDIA_UNSIGNED_INT_8_8_8_8_REV;
528 } 549 }
529 mMediaRowbytes = neww * newd; 550 mMediaRowbytes = neww * newd;
530 DEBUGMSG("video container resized to %dx%d", 551 LL_DEBUGS("MediaImpl")
531 neww, newh); 552 << "video container resized to " <<
553 neww <<"x"<< newh << LL_ENDL;
532 554
533 delete[] mediaData; 555 delete[] mediaData;
534 mediaData = new unsigned char[mMediaRowbytes * 556 mediaData = new unsigned char[mMediaRowbytes *
@@ -564,46 +586,41 @@ updateMedia ()
564 586
565/////////////////////////////////////////////////////////////////////////////// 587///////////////////////////////////////////////////////////////////////////////
566// 588//
567bool 589bool LLMediaImplGStreamer::stop()
568LLMediaImplGStreamer::
569stop ()
570{ 590{
571 DEBUGMSG("stopping media..."); 591 LL_DEBUGS("MediaImpl") << "stopping media..." << LL_ENDL;
572 // todo: error-check this? 592 // todo: error-check this?
573 llgst_element_set_state(mPlaybin, GST_STATE_READY); 593 llgst_element_set_state(mPlaybin, GST_STATE_READY);
594 mState = GST_STATE_READY;
574 return true; 595 return true;
575} 596}
576 597
577/////////////////////////////////////////////////////////////////////////////// 598///////////////////////////////////////////////////////////////////////////////
578// 599//
579bool 600bool LLMediaImplGStreamer::play()
580LLMediaImplGStreamer::
581play ()
582{ 601{
583 DEBUGMSG("playing media..."); 602 LL_DEBUGS("MediaImpl") << "playing media..." << LL_ENDL;
584 // todo: error-check this? 603 // todo: error-check this?
585 llgst_element_set_state(mPlaybin, GST_STATE_PLAYING); 604 llgst_element_set_state(mPlaybin, GST_STATE_PLAYING);
605 mState = GST_STATE_PLAYING;
586 return true; 606 return true;
587} 607}
588 608
589/////////////////////////////////////////////////////////////////////////////// 609///////////////////////////////////////////////////////////////////////////////
590// 610//
591bool 611bool LLMediaImplGStreamer::pause()
592LLMediaImplGStreamer::
593pause ()
594{ 612{
595 DEBUGMSG("pausing media..."); 613 LL_DEBUGS("MediaImpl") <<"pausing media..." << LL_ENDL;
596 // todo: error-check this? 614 // todo: error-check this?
597 llgst_element_set_state(mPlaybin, GST_STATE_PAUSED); 615 llgst_element_set_state(mPlaybin, GST_STATE_PAUSED);
616 mState = GST_STATE_PAUSED;
598 return true; 617 return true;
599}; 618};
600 619
601 620
602/////////////////////////////////////////////////////////////////////////////// 621///////////////////////////////////////////////////////////////////////////////
603// virtual 622// virtual
604unsigned char* 623unsigned char* LLMediaImplGStreamer::getMediaData()
605LLMediaImplGStreamer::
606getMediaData ()
607{ 624{
608 return mediaData; 625 return mediaData;
609} 626}
@@ -611,9 +628,7 @@ getMediaData ()
611 628
612/////////////////////////////////////////////////////////////////////////////// 629///////////////////////////////////////////////////////////////////////////////
613// virtual 630// virtual
614bool 631bool LLMediaImplGStreamer::seek(double time)
615LLMediaImplGStreamer::
616seek( double time )
617{ 632{
618 bool success = false; 633 bool success = false;
619 if (mPlaybin) 634 if (mPlaybin)
@@ -624,18 +639,22 @@ seek( double time )
624 GST_SEEK_TYPE_SET, gint64(time*1000000000.0F), 639 GST_SEEK_TYPE_SET, gint64(time*1000000000.0F),
625 GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); 640 GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
626 } 641 }
627 DEBUGMSG("MEDIA SEEK REQUEST to %fsec result was %d", 642 LL_DEBUGS("MediaImpl") << "MEDIA SEEK REQUEST to " << float(time)
628 float(time), int(success)); 643 << "sec result was " << int(success) << LL_ENDL;
629 return success; 644 return success;
630} 645}
631 646
632 647
633/////////////////////////////////////////////////////////////////////////////// 648///////////////////////////////////////////////////////////////////////////////
634// virtual 649// virtual
635bool 650bool LLMediaImplGStreamer::setVolume(float volume)
636LLMediaImplGStreamer::
637setVolume(float volume)
638{ 651{
652 // XXX hack to make volume volume changes less othen
653 // bug in gstreamer 0.10.21
654 if(mVolume == volume)
655 return true;
656
657 LL_DEBUGS("MediaImpl") << "setVolume(" << volume << ") : " << getpid() << LL_ENDL;
639 mVolume = volume; 658 mVolume = volume;
640 if (mPlaybin) 659 if (mPlaybin)
641 { 660 {
@@ -645,4 +664,6 @@ setVolume(float volume)
645 return false; 664 return false;
646} 665}
647 666
648#endif // LL_GSTREAMER_ENABLED 667
668
669///#endif // LL_GSTREAMER_ENABLED