Commits

ka  committed ed19c86

avmedia101: adjustments for new GStreamer build baseline

  • Participants
  • Parent commits 7125770

Comments (0)

Files changed (3)

File avmedia/source/gstreamer/gstplayer.cxx

 void SAL_CALL Player::setPlaybackLoop( sal_Bool bSet )
      throw( uno::RuntimeException )
 {
-    g_atomic_int_set( &mnLooping, bSet ? 1 : 0 );
+    if( bSet && !isPlaybackLoop() )
+        g_atomic_int_inc( &mnLooping );
+    else if( !bSet && isPlaybackLoop() )
+        g_atomic_int_dec_and_test( &mnLooping );
 }
 
 // ------------------------------------------------------------------------------
 void SAL_CALL Player::setVolumeDB( sal_Int16 nVolumeDB )
      throw( uno::RuntimeException )
 {
-    g_atomic_int_set( &mnVolumeDB, nVolumeDB );
-
     if( implInitPlayer() )
     {
+        g_mutex_lock( mpMutex );
+        mnVolumeDB = nVolumeDB;
+        g_mutex_unlock( mpMutex );
+
         // maximum gain for gstreamer volume is 10
         double fGstVolume = pow( 10.0, static_cast< double >( ::std::min(
                                                                   nVolumeDB, static_cast< sal_Int16 >( 20 ) ) / 20.0 ) );
     {
         // set quit flag to 1 so that the main loop will be quit in idle
         // handler the next time it is called from the thread's main loop
-        g_atomic_int_add( &mnQuit, 1 );
+        g_atomic_int_inc( &mnQuit );
 
         // wait until loop and as such the thread has quit
         g_thread_join( mpThread );
                     // just look for structures having 'video' in their names
                     if( ::std::string( pStructName ).find( "video" ) != ::std::string::npos )
                     {
-                        g_atomic_int_set( &pPlayer->mnIsVideoSource, 1 );
+                        g_atomic_int_inc( &pPlayer->mnIsVideoSource );
 
                         for( gint n = 0, nFields = gst_structure_n_fields( pStruct ); n < nFields; ++n )
                         {
                             if( ( ::std::string( pFieldName ).find( "width" ) != ::std::string::npos ) &&
                                gst_structure_get_int( pStruct, pFieldName, &nValue ) )
                             {
-                                g_atomic_int_set( &pPlayer->mnVideoWidth,
-                                                 ::std::max( (gint) g_atomic_int_get(
-                                                                &pPlayer->mnVideoWidth ), nValue ) );
+                                const gint nDiff = nValue - g_atomic_int_get( &pPlayer->mnVideoWidth );
+                                g_atomic_int_add( &pPlayer->mnVideoWidth, ::std::max( nDiff, 0 ) );
                             }
                             else if( ( ::std::string( pFieldName ).find( "height" ) != ::std::string::npos ) &&
                                     gst_structure_get_int( pStruct, pFieldName, &nValue ) )
                             {
-                                g_atomic_int_set( &pPlayer->mnVideoHeight,
-                                                 ::std::max( g_atomic_int_get( &pPlayer->mnVideoHeight ), nValue ) );
+                                const gint nDiff = nValue - g_atomic_int_get( &pPlayer->mnVideoHeight );
+                                g_atomic_int_add( &pPlayer->mnVideoHeight, ::std::max( nDiff, 0 ) );
                             }
                         }
                     }
         // in case Player::idle() is called again later;
         // the flag should have been set only once within Ctor called from
         // the application thread
-        g_atomic_int_add( &mnQuit, -1 );
+        g_atomic_int_dec_and_test( &mnQuit );
         g_main_loop_quit( mpLoop );
     }
 

File avmedia/source/gstreamer/gstplayer.hxx

 
 #include "gstcommon.hxx"
 #include <glib.h>
+#include <glib/gatomic.h>
+
+// necessary for older GLib versions
+#ifndef G_GNUC_NULL_TERMINATED
+#if __GNUC__ >= 4
+#define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
+#else
+#define G_GNUC_NULL_TERMINATED
+#endif
+#endif
+
+// necessary for older GLib versions
+struct GOptionGroup;
+
 #include <gst/gst.h>
-
 #include "com/sun/star/media/XPlayer.hdl"
 
 namespace avmedia
      throw( ::com::sun::star::uno::RuntimeException );
 
 
-protected: Player( GString* pURI = NULL );
+protected:
+
+    Player( GString* pURI = NULL );
 
     virtual gboolean busCallback( GstBus* pBus,
                                   GstMessage* pMsg );
     }
 
 
-private: Player( const Player& ) {}
+private: 
+    
+    Player( const Player& );
 
-    Player & operator=( const Player& )
-    {
-        return( *this );
-    }
+    Player& operator=( const Player& );
 
     static gboolean implBusPrepare( GSource* pSource,
                                     gint* pTimeout );
 private:
 
     ::avmedia::gst::Window* mpPlayerWindow;
-    volatile gint mnIsVideoSource;
-    volatile gint mnVideoWidth;
-    volatile gint mnVideoHeight;
-    volatile gint mnInitialized;
-    volatile gint mnVolumeDB;
-    volatile gint mnLooping;
-    volatile gint mnQuit;
-    volatile gint mnVideoWindowSet;
+    gint mnIsVideoSource;
+    gint mnVideoWidth;
+    gint mnVideoHeight;
+    gint mnInitialized;
+    gint mnVolumeDB;
+    gint mnLooping;
+    gint mnQuit;
+    gint mnVideoWindowSet;
 };
 }     // namespace gst
 } // namespace avmedia

File solenv/config/sdev300.ini

 			LIBRARY_PATH %SYSBASE%/usr/lib
 			MKOUT %PERL% %SOLARENV%/bin/mkout.pl
 			PATHEXTRA %combin%:/usr/bin:/bin:/usr/sbin:/etc:/usr/bin/X11
-			SOLAREXTRAINC -I%SOLAR_STLPATH% -I%SYSBASE%/usr/include -I%SYSBASE%/usr/include/X11
+			SOLAREXTRAINC -I%SOLAR_STLPATH% -I%SYSBASE%/usr/include -I%SYSBASE%/usr/include/X11 -I%SYSBASE%/include
 			SOLAREXTRALIB -L../lib -L%SYSBASE%/usr/X11R6/lib -L%SYSBASE%/usr/lib -L/usr/X11R6/lib  -L%SOLAR_STLLIBPATH%
 			SOLAR_JAVA TRUE
 			ZIPDEP %PERL% %SOLARENV%/bin/zipdep.pl
 			SOLAR_OJDK16PATH %SOLAR_ENV_ROOT%/openjdk-6-b08-linux-i586
 			SO_PACK %SOLAR_ENV_ROOT%/pack/%WORK_STAMP%
 			SRC_ROOT %SOLAR_SOURCE_ROOT%/%WORK_STAMP%/ooo%UPDMINOREXT%
+            PKG_CONFIG_LIBDIR %SOLAR_SYSBASE_ROOT%/usr/lib/pkgconfig
 		}
 		common2
 		{
 			ENABLE_GRAPHITE TRUE
+			ENABLE_GSTREAMER TRUE
             BUILD_TOOLS %SOLARROOT%/bt_linux_libc2.5/%WORK_STAMP%/bin
 			COM GCC
 			COMMON_BUILD_TOOLS %SOLARROOT%$/btools
 			LIBRARY_PATH %SYSBASE%/usr/lib
 			MKOUT %PERL% %SOLARENV%/bin/mkout.pl
 			PATHEXTRA %combin%:/usr/bin:/bin:/usr/sbin:/etc:/usr/bin/X11
-			SOLAREXTRAINC -I%SOLAR_STLPATH% -I%SYSBASE%/usr/include -I%SYSBASE%/usr/include/X11
+			SOLAREXTRAINC -I%SOLAR_STLPATH% -I%SYSBASE%/usr/include -I%SYSBASE%/usr/include/X11 -I%SYSBASE%/include
 			SOLAREXTRALIB -L../lib -L%SYSBASE%/usr/X11R6/lib -L%SYSBASE%/usr/lib -L/usr/X11R6/lib  -L%SOLAR_STLLIBPATH%
 			SOLAR_JAVA TRUE
 			ZIPDEP %PERL% %SOLARENV%/bin/zipdep.pl
 			SRC_ROOT %SOLAR_SOURCE_ROOT%/%WORK_STAMP%/ooo%UPDMINOREXT%
 			USE_SYSTEM_STL YES
 			XAU_LIBS -lXau
+            PKG_CONFIG_LIBDIR %SOLAR_SYSBASE_ROOT%/usr/lib/pkgconfig
 		}
 		common2
 		{
 			ENABLE_GRAPHITE TRUE
+			ENABLE_GSTREAMER TRUE
             BUILD_TOOLS %SOLARROOT%/bt_linux_libc2.32/%WORK_STAMP%/bin
 			COM GCC
 			COMMON_BUILD_TOOLS %SOLARROOT%$/btools