aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmedia/llmediaimplgstreamer.cpp
diff options
context:
space:
mode:
authorMcCabe Maxsted2009-02-20 15:33:07 -0700
committerMcCabe Maxsted2009-02-20 15:33:07 -0700
commit829e1b311f5fdd3c19d812b14cccf1175ddf6dc6 (patch)
tree148792be99dc308a5a95b1b50705e17a81a8565d /linden/indra/llmedia/llmediaimplgstreamer.cpp
parentUpdated GStreamer comments (diff)
downloadmeta-impy-829e1b311f5fdd3c19d812b14cccf1175ddf6dc6.zip
meta-impy-829e1b311f5fdd3c19d812b14cccf1175ddf6dc6.tar.gz
meta-impy-829e1b311f5fdd3c19d812b14cccf1175ddf6dc6.tar.bz2
meta-impy-829e1b311f5fdd3c19d812b14cccf1175ddf6dc6.tar.xz
Added STATUS_DEAD to LLMediaBase
Diffstat (limited to 'linden/indra/llmedia/llmediaimplgstreamer.cpp')
-rw-r--r--linden/indra/llmedia/llmediaimplgstreamer.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/linden/indra/llmedia/llmediaimplgstreamer.cpp b/linden/indra/llmedia/llmediaimplgstreamer.cpp
index b17dbb9..20a1fc3 100644
--- a/linden/indra/llmedia/llmediaimplgstreamer.cpp
+++ b/linden/indra/llmedia/llmediaimplgstreamer.cpp
@@ -395,8 +395,7 @@ bool LLMediaImplGStreamer::navigateTo (const std::string urlIn)
395 LL_DEBUGS("MediaImpl") << "Setting media URI: " << urlIn.c_str() 395 LL_DEBUGS("MediaImpl") << "Setting media URI: " << urlIn.c_str()
396 << LL_ENDL; 396 << LL_ENDL;
397 397
398 if (NULL == mPump 398 if (mPump == NULL || mPlaybin == NULL)
399 || NULL == mPlaybin)
400 { 399 {
401 return false; 400 return false;
402 } 401 }
@@ -415,6 +414,8 @@ bool LLMediaImplGStreamer::navigateTo (const std::string urlIn)
415 llgst_bus_add_watch (bus, bus_callback, this); 414 llgst_bus_add_watch (bus, bus_callback, this);
416 llgst_object_unref (bus); 415 llgst_object_unref (bus);
417 416
417 mState = GST_STATE_READY;
418
418 // navigateTo implicitly plays, too. 419 // navigateTo implicitly plays, too.
419 play(); 420 play();
420 421
@@ -447,6 +448,8 @@ bool LLMediaImplGStreamer::unload()
447 } 448 }
448 449
449 mVideoSink = NULL; 450 mVideoSink = NULL;
451 mState = GST_STATE_NULL;
452 setStatus(LLMediaBase::STATUS_DEAD);
450 453
451 return true; 454 return true;
452} 455}
@@ -458,15 +461,19 @@ bool LLMediaImplGStreamer::updateMedia()
458 //LL_DEBUGS("MediaImpl") << "updating media..." << LL_ENDL; 461 //LL_DEBUGS("MediaImpl") << "updating media..." << LL_ENDL;
459 462
460 // sanity check 463 // sanity check
461 if (NULL == mPump 464 if (mPump == NULL || mPlaybin == NULL)
462 || NULL == mPlaybin)
463 { 465 {
464#ifdef LL_GST_REPORT_STATE_CHANGES 466#ifdef LL_GST_REPORT_STATE_CHANGES
465 LL_DEBUGS("MediaImpl") << "dead media..." << LL_ENDL; 467 LL_DEBUGS("MediaImpl") << "dead media..." << LL_ENDL;
466#endif 468#endif
469 mState = GST_STATE_NULL;
470 setStatus(LLMediaBase::STATUS_DEAD);
467 return false; 471 return false;
468 } 472 }
469 473
474 if (mState == GST_STATE_VOID_PENDING || mState == GST_STATE_NULL)
475 return false;
476
470 // process next outstanding command 477 // process next outstanding command
471 switch (nextCommand()) 478 switch (nextCommand())
472 { 479 {
@@ -579,13 +586,18 @@ bool LLMediaImplGStreamer::stop()
579{ 586{
580 LL_DEBUGS("MediaImpl") << "attempting to stop..." << LL_ENDL; 587 LL_DEBUGS("MediaImpl") << "attempting to stop..." << LL_ENDL;
581 588
582 if (!mPlaybin) return true; 589 if (!mPlaybin || mState == GST_STATE_NULL)
590 return true;
583 591
584 GstElement *pipeline = (GstElement *)llgst_object_ref(GST_OBJECT(mPlaybin)); 592 GstElement *pipeline = (GstElement *)llgst_object_ref(GST_OBJECT(mPlaybin));
585 llgst_object_unref(pipeline); 593 llgst_object_unref(pipeline);
586 594
587 llgst_element_set_state(pipeline, GST_STATE_READY); 595 llgst_element_set_state(pipeline, GST_STATE_READY);
588 mState = GST_STATE_READY; 596
597 if (mState == GST_STATE_PLAYING)
598 mState = GST_STATE_VOID_PENDING;
599 else
600 mState = GST_STATE_READY;
589 601
590 GstStateChangeReturn state_change = llgst_element_get_state(mPlaybin, NULL, NULL, GST_CLOCK_TIME_NONE); 602 GstStateChangeReturn state_change = llgst_element_get_state(mPlaybin, NULL, NULL, GST_CLOCK_TIME_NONE);
591 LL_DEBUGS("MediaImpl") << "get_state: " << state_change << LL_ENDL; 603 LL_DEBUGS("MediaImpl") << "get_state: " << state_change << LL_ENDL;
@@ -599,7 +611,8 @@ bool LLMediaImplGStreamer::play()
599{ 611{
600 LL_DEBUGS("MediaImpl") << "attempting to play..." << LL_ENDL; 612 LL_DEBUGS("MediaImpl") << "attempting to play..." << LL_ENDL;
601 613
602 if (!mPlaybin) return true; 614 if (!mPlaybin || mState == GST_STATE_NULL)
615 return true;
603 616
604 GstElement *pipeline = (GstElement *)llgst_object_ref(GST_OBJECT(mPlaybin)); 617 GstElement *pipeline = (GstElement *)llgst_object_ref(GST_OBJECT(mPlaybin));
605 llgst_object_unref(pipeline); 618 llgst_object_unref(pipeline);
@@ -615,6 +628,7 @@ bool LLMediaImplGStreamer::play()
615 // Check to make sure playing was successful. If not, stop. 628 // Check to make sure playing was successful. If not, stop.
616 if (state_change == GST_STATE_CHANGE_FAILURE) 629 if (state_change == GST_STATE_CHANGE_FAILURE)
617 { 630 {
631 setStatus(LLMediaBase::STATUS_STOPPED);
618 stop(); 632 stop();
619 } 633 }
620 634
@@ -627,7 +641,8 @@ bool LLMediaImplGStreamer::pause()
627{ 641{
628 LL_DEBUGS("MediaImpl") << "attempting to pause..." << LL_ENDL; 642 LL_DEBUGS("MediaImpl") << "attempting to pause..." << LL_ENDL;
629 643
630 if (!mPlaybin) return true; 644 if (!mPlaybin || mState == GST_STATE_NULL)
645 return true;
631 646
632 llgst_element_set_state(mPlaybin, GST_STATE_PAUSED); 647 llgst_element_set_state(mPlaybin, GST_STATE_PAUSED);
633 mState = GST_STATE_PAUSED; 648 mState = GST_STATE_PAUSED;
@@ -675,7 +690,7 @@ bool LLMediaImplGStreamer::setVolume(float volume)
675 if(mVolume == volume) 690 if(mVolume == volume)
676 return true; 691 return true;
677 692
678 LL_DEBUGS("MediaImpl") << "setVolume(" << volume << ") : " << getpid() << LL_ENDL; 693 LL_DEBUGS("MediaImpl") << "setVolume(" << volume << ") : " << getpid() << LL_ENDL;
679 mVolume = volume; 694 mVolume = volume;
680 if (mPlaybin) 695 if (mPlaybin)
681 { 696 {