summaryrefslogtreecommitdiff
path: root/avmedia
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2011-03-28 10:34:17 +0000
committerMichael Stahl <mst@openoffice.org>2011-03-28 10:34:17 +0000
commit0398365fafa23bd9d8f8548654b7b068ad561ea5 (patch)
treedbc0829129a5db265321e639aa9d61fd43a9a73d /avmedia
parent9823cbf7faac2ef54b29e453a8fd03bb7d987c6b (diff)
solaris11: #i117566#: gstreamer: Sun C++ complains: C callbacks not extern "C"
Diffstat (limited to 'avmedia')
-rw-r--r--avmedia/source/gstreamer/gstframegrabber.cxx3
-rw-r--r--avmedia/source/gstreamer/gstplayer.cxx176
-rw-r--r--avmedia/source/gstreamer/gstplayer.hxx29
3 files changed, 101 insertions, 107 deletions
diff --git a/avmedia/source/gstreamer/gstframegrabber.cxx b/avmedia/source/gstreamer/gstframegrabber.cxx
index bd55e11f8afe..49a6d9695fbc 100644
--- a/avmedia/source/gstreamer/gstframegrabber.cxx
+++ b/avmedia/source/gstreamer/gstframegrabber.cxx
@@ -31,6 +31,9 @@
#include <vcl/graph.hxx>
#include <vcl/bmpacc.hxx>
+#include <string>
+
+
using namespace ::com::sun::star;
namespace avmedia { namespace gst {
diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx
index f082cfc5c513..ba354fe5f274 100644
--- a/avmedia/source/gstreamer/gstplayer.cxx
+++ b/avmedia/source/gstreamer/gstplayer.cxx
@@ -66,6 +66,92 @@ struct GstBusSource : public GSource
{}
};
+
+// -----------------------------------------------------------------------
+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 -
// ---------------
@@ -102,7 +188,7 @@ Player::Player( GString* pURI ) :
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 );
}
}
@@ -573,62 +659,6 @@ bool Player::implInitPlayer()
}
// ------------------------------------------------------------------------------
-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 )
{
@@ -674,26 +704,6 @@ gboolean Player::busCallback( GstBus* /*pBus*/,
}
// ------------------------------------------------------------------------------
-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 )
@@ -824,10 +834,10 @@ gpointer Player::run()
{
static GSourceFuncs aSourceFuncs =
{
- Player::implBusPrepare,
- Player::implBusCheck,
- Player::implBusDispatch,
- Player::implBusFinalize,
+ &lcl_implBusPrepare,
+ &lcl_implBusCheck,
+ &lcl_implBusDispatch,
+ &lcl_implBusFinalize,
NULL,
NULL
};
@@ -842,7 +852,7 @@ gpointer Player::run()
// 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
@@ -853,7 +863,7 @@ gpointer Player::run()
// 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
diff --git a/avmedia/source/gstreamer/gstplayer.hxx b/avmedia/source/gstreamer/gstplayer.hxx
index d751e381258d..0793eaf8caf2 100644
--- a/avmedia/source/gstreamer/gstplayer.hxx
+++ b/avmedia/source/gstreamer/gstplayer.hxx
@@ -149,11 +149,7 @@ public:
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 );
@@ -164,6 +160,10 @@ protected:
virtual GstBusSyncReply handleCreateWindow( GstBus* pBus,
GstMessage* pMsg );
+protected:
+
+ Player( GString* pURI = NULL );
+
void implQuitThread();
bool implInitPlayer();
@@ -180,25 +180,6 @@ private:
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 );