aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJacek Antonelli2009-04-05 23:41:16 -0500
committerJacek Antonelli2009-04-06 00:33:07 -0500
commit15296967b6beec8e6f6c5ff4b7e8c274e5d05dca (patch)
treef6c86080ef8a22d431e29fe321d67b5cf347488c
parentAdded LLGstPlayThread class. (diff)
downloadmeta-impy-15296967b6beec8e6f6c5ff4b7e8c274e5d05dca.zip
meta-impy-15296967b6beec8e6f6c5ff4b7e8c274e5d05dca.tar.gz
meta-impy-15296967b6beec8e6f6c5ff4b7e8c274e5d05dca.tar.bz2
meta-impy-15296967b6beec8e6f6c5ff4b7e8c274e5d05dca.tar.xz
LLMediaImplGStreamer creates new thread for playing.
This keeps the viewer responsive while GStreamer does its thing.
-rw-r--r--ChangeLog.txt7
-rw-r--r--linden/indra/llmedia/llmediaimplgstreamer.cpp27
-rw-r--r--linden/indra/llmedia/llmediaimplgstreamer.h3
3 files changed, 31 insertions, 6 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index d7c4a43..e53364c 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,5 +1,12 @@
12009-04-05 Jacek Antonelli <jacek.antonelli@gmail.com> 12009-04-05 Jacek Antonelli <jacek.antonelli@gmail.com>
2 2
3 * linden/indra/llmedia/llmediaimplgstreamer.cpp:
4 LLMediaImplGStreamer creates new thread for playing.
5 This keeps the viewer responsive while GStreamer does its thing.
6 * linden/indra/llmedia/llmediaimplgstreamer.h:
7 Ditto.
8
9
3 * linden/indra/llmedia/llgstplaythread.cpp: 10 * linden/indra/llmedia/llgstplaythread.cpp:
4 Added LLGstPlayThread class. 11 Added LLGstPlayThread class.
5 * linden/indra/llmedia/llgstplaythread.h: 12 * linden/indra/llmedia/llgstplaythread.h:
diff --git a/linden/indra/llmedia/llmediaimplgstreamer.cpp b/linden/indra/llmedia/llmediaimplgstreamer.cpp
index 2ba33a1..c8f793d 100644
--- a/linden/indra/llmedia/llmediaimplgstreamer.cpp
+++ b/linden/indra/llmedia/llmediaimplgstreamer.cpp
@@ -30,10 +30,12 @@
30 * $/LicenseInfo$ 30 * $/LicenseInfo$
31 */ 31 */
32 32
33#include "llmediaimplgstreamer.h"
34
35///#if LL_GSTREAMER_ENABLED 33///#if LL_GSTREAMER_ENABLED
36 34
35#include "linden_common.h"
36
37#include "llmediaimplgstreamer.h"
38
37extern "C" { 39extern "C" {
38#include <gst/gst.h> 40#include <gst/gst.h>
39#include <gst/gstelement.h> 41#include <gst/gstelement.h>
@@ -43,9 +45,8 @@ extern "C" {
43#include "llmediaimplregister.h" 45#include "llmediaimplregister.h"
44 46
45#include "llmediaimplgstreamervidplug.h" 47#include "llmediaimplgstreamervidplug.h"
48#include "llgstplaythread.h"
46 49
47#include "llerror.h"
48#include "linden_common.h"
49 50
50// register this impl with media manager factory 51// register this impl with media manager factory
51static LLMediaImplRegister sLLMediaImplGStreamerReg( "LLMediaImplGStreamer", new LLMediaImplGStreamerMaker() ); 52static LLMediaImplRegister sLLMediaImplGStreamerReg( "LLMediaImplGStreamer", new LLMediaImplGStreamerMaker() );
@@ -72,7 +73,8 @@ 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 ),
77 mPlayThread ( NULL )
76{ 78{
77 startup( NULL ); // Startup gstreamer if it hasn't been already. 79 startup( NULL ); // Startup gstreamer if it hasn't been already.
78 80
@@ -713,7 +715,20 @@ bool LLMediaImplGStreamer::play()
713 if (!mPlaybin || mState == GST_STATE_NULL) 715 if (!mPlaybin || mState == GST_STATE_NULL)
714 return true; 716 return true;
715 717
716 startPlay(); 718 // Clean up the existing thread, if any.
719 if( mPlayThread != NULL && mPlayThread->isStopped())
720 {
721 delete mPlayThread;
722 mPlayThread = NULL;
723 }
724
725 if( mPlayThread == NULL )
726 {
727 // Make a new thread to start playing. This keeps the viewer
728 // responsive while the stream is resolved and buffered.
729 mPlayThread = new LLGstPlayThread( (LLMediaImplCommon *)this, "GstPlayThread", NULL);
730 mPlayThread->start();
731 }
717 732
718 return true; 733 return true;
719} 734}
diff --git a/linden/indra/llmedia/llmediaimplgstreamer.h b/linden/indra/llmedia/llmediaimplgstreamer.h
index be4b3c0..32e6bd1 100644
--- a/linden/indra/llmedia/llmediaimplgstreamer.h
+++ b/linden/indra/llmedia/llmediaimplgstreamer.h
@@ -48,6 +48,7 @@ extern "C" {
48} 48}
49 49
50#include "llmediaimplgstreamervidplug.h" 50#include "llmediaimplgstreamervidplug.h"
51#include "llgstplaythread.h"
51 52
52class LLMediaManagerData; 53class LLMediaManagerData;
53class LLMediaImplMaker; 54class LLMediaImplMaker;
@@ -124,6 +125,8 @@ class LLMediaImplGStreamer:
124 GstSLVideo *mVideoSink; 125 GstSLVideo *mVideoSink;
125 GstState mState; 126 GstState mState;
126 GstState getState() const { return mState; } 127 GstState getState() const { return mState; }
128
129 LLGstPlayThread *mPlayThread;
127}; 130};
128 131
129class LLMediaImplGStreamerMaker : public LLMediaImplMaker 132class LLMediaImplGStreamerMaker : public LLMediaImplMaker