aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra
diff options
context:
space:
mode:
authorMcCabe Maxsted2009-03-30 01:56:18 -0700
committerMcCabe Maxsted2009-03-30 01:56:18 -0700
commitb145debcba6af423e990fddea6430ea414a37e06 (patch)
tree9130b84c88d8cbf5823dd83649ecc55984876f62 /linden/indra
parentAdded loading info to log's plugin list, set_gst_plugin_path now compiles for... (diff)
downloadmeta-impy-b145debcba6af423e990fddea6430ea414a37e06.zip
meta-impy-b145debcba6af423e990fddea6430ea414a37e06.tar.gz
meta-impy-b145debcba6af423e990fddea6430ea414a37e06.tar.bz2
meta-impy-b145debcba6af423e990fddea6430ea414a37e06.tar.xz
removed gst_element_get_state
Diffstat (limited to 'linden/indra')
-rw-r--r--linden/indra/llmedia/llmediaimplgstreamer.cpp74
1 files changed, 45 insertions, 29 deletions
diff --git a/linden/indra/llmedia/llmediaimplgstreamer.cpp b/linden/indra/llmedia/llmediaimplgstreamer.cpp
index 3c4d0a0..952e22f 100644
--- a/linden/indra/llmedia/llmediaimplgstreamer.cpp
+++ b/linden/indra/llmedia/llmediaimplgstreamer.cpp
@@ -653,20 +653,23 @@ bool LLMediaImplGStreamer::stop()
653 if (!mPlaybin || mState == GST_STATE_NULL) 653 if (!mPlaybin || mState == GST_STATE_NULL)
654 return true; 654 return true;
655 655
656 GstElement *pipeline = (GstElement *)gst_object_ref(GST_OBJECT(mPlaybin)); 656 GstStateChangeReturn state_change;
657 gst_object_unref(pipeline);
658
659 gst_element_set_state(pipeline, GST_STATE_READY);
660 657
661 if (mState == GST_STATE_PLAYING) 658 state_change = gst_element_set_state(mPlaybin, GST_STATE_READY);
662 mState = GST_STATE_VOID_PENDING;
663 else
664 mState = GST_STATE_READY;
665 659
666 GstStateChangeReturn state_change = gst_element_get_state(mPlaybin, NULL, NULL, GST_MSECOND*5); 660 LL_DEBUGS("MediaImpl") << "result: "
667 LL_DEBUGS("MediaImpl") << "get_state: " << gst_element_state_change_return_get_name(state_change) << LL_ENDL; 661 << gst_element_state_change_return_get_name(state_change) << LL_ENDL;
668 662
669 return true; 663 if (state_change == GST_STATE_CHANGE_FAILURE)
664 {
665 LL_WARNS("MediaImpl") << "could not stop stream!" << LL_ENDL;
666 return false;
667 }
668 else
669 {
670 mState = GST_STATE_READY;
671 return true;
672 }
670} 673}
671 674
672/////////////////////////////////////////////////////////////////////////////// 675///////////////////////////////////////////////////////////////////////////////
@@ -678,25 +681,28 @@ bool LLMediaImplGStreamer::play()
678 if (!mPlaybin || mState == GST_STATE_NULL) 681 if (!mPlaybin || mState == GST_STATE_NULL)
679 return true; 682 return true;
680 683
681 GstElement *pipeline = (GstElement *)gst_object_ref(GST_OBJECT(mPlaybin)); 684 GstStateChangeReturn state_change;
682 gst_object_unref(pipeline); 685
683 686 state_change = gst_element_set_state(mPlaybin, GST_STATE_PLAYING);
684 gst_element_set_state(pipeline, GST_STATE_PLAYING);
685 mState = GST_STATE_PLAYING;
686 /*gst_element_set_state(mPlaybin, GST_STATE_PLAYING);
687 mState = GST_STATE_PLAYING;*/
688 687
689 GstStateChangeReturn state_change = gst_element_get_state(mPlaybin, NULL, NULL, GST_MSECOND*5); 688 LL_DEBUGS("MediaImpl") << "result: "
690 LL_DEBUGS("MediaImpl") << "get_state: " << gst_element_state_change_return_get_name(state_change) << LL_ENDL; 689 << gst_element_state_change_return_get_name(state_change) << LL_ENDL;
691 690
692 // Check to make sure playing was successful. If not, stop. 691 // Check to make sure playing was successful. If not, stop.
692 // NOTE: state_change is almost always GST_STATE_CHANGE_ASYNC
693 if (state_change == GST_STATE_CHANGE_FAILURE) 693 if (state_change == GST_STATE_CHANGE_FAILURE)
694 { 694 {
695 setStatus(LLMediaBase::STATUS_STOPPED); 695 // If failing from a bad stream, go into pending state
696 // (this is stopped at the callback)
697 mState = GST_STATE_VOID_PENDING;
696 stop(); 698 stop();
699 return false;
700 }
701 else
702 {
703 mState = GST_STATE_PLAYING;
704 return true;
697 } 705 }
698
699 return true;
700} 706}
701 707
702/////////////////////////////////////////////////////////////////////////////// 708///////////////////////////////////////////////////////////////////////////////
@@ -708,13 +714,23 @@ bool LLMediaImplGStreamer::pause()
708 if (!mPlaybin || mState == GST_STATE_NULL) 714 if (!mPlaybin || mState == GST_STATE_NULL)
709 return true; 715 return true;
710 716
711 gst_element_set_state(mPlaybin, GST_STATE_PAUSED); 717 GstStateChangeReturn state_change;
712 mState = GST_STATE_PAUSED;
713
714 GstStateChangeReturn state_change = gst_element_get_state(mPlaybin, NULL, NULL, GST_MSECOND*5);
715 LL_DEBUGS("MediaImpl") << "get_state: " << gst_element_state_change_return_get_name(state_change) << LL_ENDL;
716 718
717 return true; 719 state_change = gst_element_set_state(mPlaybin, GST_STATE_PAUSED);
720
721 LL_DEBUGS("MediaImpl") << "result: "
722 << gst_element_state_change_return_get_name(state_change) << LL_ENDL;
723
724 if (state_change == GST_STATE_CHANGE_FAILURE)
725 {
726 LL_WARNS("MediaImpl") << "could not pause stream!" << LL_ENDL;
727 return false;
728 }
729 else
730 {
731 mState = GST_STATE_PAUSED;
732 return true;
733 }
718}; 734};
719 735
720 736