Kaydet (Commit) e748d379 authored tarafından Caolán McNamara's avatar Caolán McNamara Kaydeden (comit) Radek Doulik

avmedia-source-gstreamer-*.diff: gstreamer

- Loop the A/V when the loop flag is set; from Caolan.
üst 2eea82e0
...@@ -59,6 +59,7 @@ Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) : ...@@ -59,6 +59,7 @@ Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) :
mpPlaybin( NULL ), mpPlaybin( NULL ),
mbFakeVideo (sal_False ), mbFakeVideo (sal_False ),
mnUnmutedVolume( 0 ), mnUnmutedVolume( 0 ),
mbPlayPending ( false ),
mbMuted( false ), mbMuted( false ),
mbLooping( false ), mbLooping( false ),
mbInitialized( false ), mbInitialized( false ),
...@@ -132,6 +133,9 @@ void Player::processMessage( GstMessage *message ) ...@@ -132,6 +133,9 @@ void Player::processMessage( GstMessage *message )
case GST_MESSAGE_EOS: case GST_MESSAGE_EOS:
//DBG( "EOS, reset state to NULL" ); //DBG( "EOS, reset state to NULL" );
gst_element_set_state( mpPlaybin, GST_STATE_READY ); gst_element_set_state( mpPlaybin, GST_STATE_READY );
mbPlayPending = false;
if (mbLooping)
start();
break; break;
case GST_MESSAGE_STATE_CHANGED: case GST_MESSAGE_STATE_CHANGED:
if( message->src == GST_OBJECT( mpPlaybin ) ) { if( message->src == GST_OBJECT( mpPlaybin ) ) {
...@@ -143,6 +147,9 @@ void Player::processMessage( GstMessage *message ) ...@@ -143,6 +147,9 @@ void Player::processMessage( GstMessage *message )
pendingstate == GST_STATE_VOID_PENDING && pendingstate == GST_STATE_VOID_PENDING &&
mpXOverlay ) mpXOverlay )
gst_x_overlay_expose( mpXOverlay ); gst_x_overlay_expose( mpXOverlay );
if (mbPlayPending)
mbPlayPending = ((newstate == GST_STATE_READY) || (newstate == GST_STATE_PAUSED));
} }
default: default:
break; break;
...@@ -242,6 +249,7 @@ void Player::preparePlaybin( const ::rtl::OUString& rURL, bool bFakeVideo ) ...@@ -242,6 +249,7 @@ void Player::preparePlaybin( const ::rtl::OUString& rURL, bool bFakeVideo )
if( mpPlaybin != NULL ) { if( mpPlaybin != NULL ) {
gst_element_set_state( mpPlaybin, GST_STATE_NULL ); gst_element_set_state( mpPlaybin, GST_STATE_NULL );
mbPlayPending = false;
g_object_unref( mpPlaybin ); g_object_unref( mpPlaybin );
} }
...@@ -273,6 +281,7 @@ bool Player::create( const ::rtl::OUString& rURL ) ...@@ -273,6 +281,7 @@ bool Player::create( const ::rtl::OUString& rURL )
preparePlaybin( rURL, true ); preparePlaybin( rURL, true );
gst_element_set_state( mpPlaybin, GST_STATE_PAUSED ); gst_element_set_state( mpPlaybin, GST_STATE_PAUSED );
mbPlayPending = false;
bRet = true; bRet = true;
} }
...@@ -297,6 +306,7 @@ void SAL_CALL Player::start( ) ...@@ -297,6 +306,7 @@ void SAL_CALL Player::start( )
if( mbInitialized && NULL != mpPlaybin ) if( mbInitialized && NULL != mpPlaybin )
{ {
gst_element_set_state( mpPlaybin, GST_STATE_PLAYING ); gst_element_set_state( mpPlaybin, GST_STATE_PLAYING );
mbPlayPending = true;
} }
} }
...@@ -309,6 +319,7 @@ void SAL_CALL Player::stop( ) ...@@ -309,6 +319,7 @@ void SAL_CALL Player::stop( )
if( mpPlaybin ) if( mpPlaybin )
gst_element_set_state( mpPlaybin, GST_STATE_PAUSED ); gst_element_set_state( mpPlaybin, GST_STATE_PAUSED );
mbPlayPending = false;
DBG( "stop %p", mpPlaybin ); DBG( "stop %p", mpPlaybin );
} }
...@@ -317,10 +328,10 @@ void SAL_CALL Player::stop( ) ...@@ -317,10 +328,10 @@ void SAL_CALL Player::stop( )
sal_Bool SAL_CALL Player::isPlaying() sal_Bool SAL_CALL Player::isPlaying()
throw (uno::RuntimeException) throw (uno::RuntimeException)
{ {
bool bRet = false; bool bRet = mbPlayPending;
// return whether the pipeline is in PLAYING STATE or not // return whether the pipeline is in PLAYING STATE or not
if( mbInitialized && mpPlaybin ) if( !mbPlayPending && mbInitialized && mpPlaybin )
{ {
bRet = GST_STATE_PLAYING == GST_STATE( mpPlaybin ); bRet = GST_STATE_PLAYING == GST_STATE( mpPlaybin );
} }
......
...@@ -93,6 +93,7 @@ private: ...@@ -93,6 +93,7 @@ private:
sal_Bool mbFakeVideo; sal_Bool mbFakeVideo;
gdouble mnUnmutedVolume; gdouble mnUnmutedVolume;
sal_Bool mbPlayPending;
sal_Bool mbMuted; sal_Bool mbMuted;
sal_Bool mbLooping; sal_Bool mbLooping;
sal_Bool mbInitialized; sal_Bool mbInitialized;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment