Anonymous avatar Anonymous committed 95df88e

solaris11: #i117566#: gstreamer: Sun C++ complains: C callbacks not extern "C"

Comments (0)

Files changed (3)

avmedia/source/gstreamer/gstframegrabber.cxx

 #include <vcl/graph.hxx>
 #include <vcl/bmpacc.hxx>
 
+#include <string>
+
+
 using namespace ::com::sun::star;
 
 namespace avmedia { namespace gst {

avmedia/source/gstreamer/gstplayer.cxx

     {}
 };
 
+
+// -----------------------------------------------------------------------
+extern "C"
+{
+
+static gpointer
+lcl_implThreadFunc( gpointer pData )
+{
+    return( pData ? static_cast< Player* >( pData )->run() : NULL );
+}
+
+static gboolean
+lcl_implBusCheck( GSource* pSource )
+{
+    GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource );
+
+    return( pBusSource &&
+           GST_IS_BUS( pBusSource->mpBus ) &&
+           gst_bus_have_pending( GST_BUS_CAST( pBusSource->mpBus ) ) );
+}
+
+
+static gboolean
+lcl_implBusPrepare( GSource* pSource, gint* pTimeout )
+{
+    if (pTimeout)
+    {
+        *pTimeout = 0;
+    }
+
+    return lcl_implBusCheck(pSource);
+}
+
+static gboolean
+lcl_implBusDispatch( GSource* pSource,
+                     GSourceFunc /*aCallback*/,
+                     gpointer pData )
+{
+    GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource );
+    gboolean bRet = false;
+
+    if( pData && pBusSource && GST_IS_BUS( pBusSource->mpBus ) )
+    {
+        GstMessage* pMsg = gst_bus_pop( pBusSource->mpBus );
+
+        if( pMsg )
+        {
+            bRet = static_cast< Player* >( pData )->busCallback(
+                        pBusSource->mpBus, pMsg );
+            gst_message_unref( pMsg );
+        }
+    }
+
+    return( bRet );
+}
+
+static void
+lcl_implBusFinalize( GSource* pSource )
+{
+    GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource );
+
+    if( pBusSource && pBusSource->mpBus )
+    {
+        gst_object_unref( pBusSource->mpBus );
+        pBusSource->mpBus = NULL;
+    }
+}
+
+static gboolean
+lcl_implIdleFunc( gpointer pData )
+{
+    return( pData ? static_cast< Player* >( pData )->idle() : true );
+}
+
+static GstBusSyncReply
+lcl_implHandleCreateWindowFunc( GstBus* pBus, GstMessage* pMsg, gpointer pData )
+{
+    return (pData)
+        ? static_cast< Player* >( pData )->handleCreateWindow( pBus, pMsg )
+        : GST_BUS_PASS;
+}
+
+} // extern "C"
+
+
+
 // ---------------
 // - Player -
 // ---------------
         OSL_TRACE( ">>> --------------------------------" );
         OSL_TRACE( ">>> Creating Player object with URL: %s", pURI->str );
 
-        mpThread = g_thread_create( Player::implThreadFunc, this, true, NULL );
+        mpThread = g_thread_create( &lcl_implThreadFunc, this, true, NULL );
     }
 }
 
 }
 
 // ------------------------------------------------------------------------------
-gboolean Player::implBusPrepare( GSource* pSource,
-                                 gint* pTimeout )
-{
-    if( pTimeout )
-    {
-        *pTimeout = 0;
-    }
-
-    return( implBusCheck( pSource ) );
-}
-
-// ------------------------------------------------------------------------------
-gboolean Player::implBusCheck( GSource* pSource )
-{
-    GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource );
-
-    return( pBusSource &&
-           GST_IS_BUS( pBusSource->mpBus ) &&
-           gst_bus_have_pending( GST_BUS_CAST( pBusSource->mpBus ) ) );
-}
-
-// ------------------------------------------------------------------------------
-gboolean Player::implBusDispatch( GSource* pSource,
-                                  GSourceFunc /*aCallback*/,
-                                  gpointer pData )
-{
-    GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource );
-    gboolean bRet = false;
-
-    if( pData && pBusSource && GST_IS_BUS( pBusSource->mpBus ) )
-    {
-        GstMessage* pMsg = gst_bus_pop( pBusSource->mpBus );
-
-        if( pMsg )
-        {
-            bRet = static_cast< Player* >( pData )->busCallback( pBusSource->mpBus, pMsg );
-            gst_message_unref( pMsg );
-        }
-    }
-
-    return( bRet );
-}
-
-// ------------------------------------------------------------------------------
-void Player::implBusFinalize( GSource* pSource )
-{
-    GstBusSource* pBusSource = static_cast< GstBusSource* >( pSource );
-
-    if( pBusSource && pBusSource->mpBus )
-    {
-        gst_object_unref( pBusSource->mpBus );
-        pBusSource->mpBus = NULL;
-    }
-}
-
-// ------------------------------------------------------------------------------
 gboolean Player::busCallback( GstBus* /*pBus*/,
                               GstMessage* pMsg )
 {
 }
 
 // ------------------------------------------------------------------------------
-gboolean Player::implIdleFunc( gpointer pData )
-{
-    return( pData ? static_cast< Player* >( pData )->idle() : true );
-}
-
-// ------------------------------------------------------------------------------
-gpointer Player::implThreadFunc( gpointer pData )
-{
-    return( pData ? static_cast< Player* >( pData )->run() : NULL );
-}
-
-// ------------------------------------------------------------------------------
-GstBusSyncReply Player::implHandleCreateWindowFunc( GstBus* pBus,
-                                                    GstMessage* pMsg,
-                                                    gpointer pData )
-{
-    return( pData ? static_cast< Player* >( pData )->handleCreateWindow( pBus, pMsg ) : GST_BUS_PASS );
-}
-
-// ------------------------------------------------------------------------------
 void Player::implHandleNewElementFunc( GstBin* /* pBin */,
                                        GstElement* pElement,
                                        gpointer pData )
 {
     static GSourceFuncs aSourceFuncs =
     {
-        Player::implBusPrepare,
-        Player::implBusCheck,
-        Player::implBusDispatch,
-        Player::implBusFinalize,
+        &lcl_implBusPrepare,
+        &lcl_implBusCheck,
+        &lcl_implBusDispatch,
+        &lcl_implBusFinalize,
         NULL,
         NULL
     };
 
         // add idle callback
         GSource* pIdleSource = g_idle_source_new();
-        g_source_set_callback( pIdleSource, Player::implIdleFunc, this, NULL );
+        g_source_set_callback( pIdleSource, &lcl_implIdleFunc, this, NULL );
         g_source_attach( pIdleSource, mpContext );
 
         // add bus callback
 
         // add bus sync handler to intercept video window creation for setting our own window
         gst_bus_set_sync_handler( static_cast< GstBusSource* >( pBusSource )->mpBus,
-                                  Player::implHandleCreateWindowFunc, this );
+                                  &lcl_implHandleCreateWindowFunc, this );
 
         // watch for all elements (and pads) that will be added to the playbin,
         // in order to retrieve properties like video width and height

avmedia/source/gstreamer/gstplayer.hxx

     virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
      throw( ::com::sun::star::uno::RuntimeException );
 
-
-protected:
-
-    Player( GString* pURI = NULL );
-
+// these are public because the C callbacks call them
     virtual gboolean busCallback( GstBus* pBus,
                                   GstMessage* pMsg );
 
     virtual GstBusSyncReply handleCreateWindow( GstBus* pBus,
                                                 GstMessage* pMsg );
 
+protected:
+
+    Player( GString* pURI = NULL );
+
     void implQuitThread();
 
     bool implInitPlayer();
 
     Player& operator=( const Player& );
 
-    static gboolean implBusPrepare( GSource* pSource,
-                                    gint* pTimeout );
-
-    static gboolean implBusCheck( GSource* pSource );
-
-    static gboolean implBusDispatch( GSource* pSource,
-                                     GSourceFunc aCallback,
-                                     gpointer pData );
-
-    static void implBusFinalize( GSource* pSource );
-
-    static gboolean implIdleFunc( gpointer pData );
-
-    static gpointer implThreadFunc( gpointer pData );
-
-    static GstBusSyncReply implHandleCreateWindowFunc( GstBus* pBus,
-                                                       GstMessage* pMsg,
-                                                       gpointer pDData );
-
     static void implHandleNewElementFunc( GstBin* pBin,
                                           GstElement* pElement,
                                           gpointer pData );
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.