[ffgtk] Adapt to GThread API changes
Milan Crha
mcrha at fedoraproject.org
Fri Nov 4 09:27:11 UTC 2011
commit 9a1e8467e2f35e0a09a41ef955e0fe0e4e4af370
Author: Milan Crha <mcrha at redhat.com>
Date: Fri Nov 4 10:26:50 2011 +0100
Adapt to GThread API changes
ffgtk-0.7.94-g-thread-init.patch | 18 ---
ffgtk-0.7.94-threads-api.patch | 257 ++++++++++++++++++++++++++++++++++++++
ffgtk.spec | 6 +-
3 files changed, 260 insertions(+), 21 deletions(-)
---
diff --git a/ffgtk-0.7.94-threads-api.patch b/ffgtk-0.7.94-threads-api.patch
new file mode 100644
index 0000000..20ad904
--- /dev/null
+++ b/ffgtk-0.7.94-threads-api.patch
@@ -0,0 +1,257 @@
+diff -up ffgtk-0.7.94/ffgtk/audio.c.threads-api ffgtk-0.7.94/ffgtk/audio.c
+--- ffgtk-0.7.94/ffgtk/audio.c.threads-api 2011-05-13 18:45:04.000000000 +0200
++++ ffgtk-0.7.94/ffgtk/audio.c 2011-11-04 09:11:34.760179509 +0100
+@@ -323,5 +323,5 @@ void PlaySound( eCallType nType ) {
+ makeLut( &pnAudioLutIn, &pnAudioLutGenerate );
+ }
+
+- g_thread_create( handleEffect, GINT_TO_POINTER(nType), FALSE, NULL );
++ ffgtk_thread_create( handleEffect, GINT_TO_POINTER(nType) );
+ }
+diff -up ffgtk-0.7.94/ffgtk/callmonitor.c.threads-api ffgtk-0.7.94/ffgtk/callmonitor.c
+--- ffgtk-0.7.94/ffgtk/callmonitor.c.threads-api 2011-05-13 18:45:04.000000000 +0200
++++ ffgtk-0.7.94/ffgtk/callmonitor.c 2011-11-04 09:11:34.761179521 +0100
+@@ -205,7 +205,7 @@ static void loadCallerList( void ) {
+
+ if ( bAllProfiles == TRUE || psCallMonitorProfile == getActiveProfile() ) {
+ nWorkExt++;
+- g_thread_create( updateFaxVoiceBox, NULL, false, NULL );
++ ffgtk_thread_create( updateFaxVoiceBox, NULL );
+ }
+
+ nWorkExt--;
+@@ -401,7 +401,7 @@ static void reloadCallMonitorStart( GtkW
+ freeCallers();
+ }
+
+- g_thread_create( reloadCallMonitor, NULL, false, NULL );
++ ffgtk_thread_create( reloadCallMonitor, NULL );
+
+ while ( bFinished == FALSE ) usleep( 10 );
+ gtk_list_store_clear( psListStore );
+diff -up ffgtk-0.7.94/ffgtk/faxophone/faxophone.c.threads-api ffgtk-0.7.94/ffgtk/faxophone/faxophone.c
+--- ffgtk-0.7.94/ffgtk/faxophone/faxophone.c.threads-api 2011-05-13 18:45:04.000000000 +0200
++++ ffgtk-0.7.94/ffgtk/faxophone/faxophone.c 2011-11-04 09:11:34.762179533 +0100
+@@ -14,6 +14,8 @@
+ #include <faxophone/phone.h>
+ #include <faxophone/isdn-convert.h>
+
++#include "../ffgtk.h"
++
+ /** The current active session */
+ static struct sSession *psSession = NULL;
+ /** Unique connection id */
+@@ -1417,7 +1419,7 @@ static int capiInit( int nController ) {
+ }
+
+ /* start capi transmission loop */
+- g_thread_create( capiLoop, NULL, FALSE, NULL );
++ ffgtk_thread_create( capiLoop, NULL );
+
+ /* ok! */
+ return 0;
+@@ -1435,7 +1437,7 @@ struct sSession *faxophoneInit( struct s
+ if ( psSession == NULL ) {
+ psSession = g_malloc0( sizeof( struct sSession ) );
+
+- psSession -> psIsdnMutex = g_mutex_new();
++ g_mutex_init (&psSession -> psIsdnMutex);
+
+ psSession -> psHandlers = psHandlers;
+
+@@ -1446,8 +1448,6 @@ struct sSession *faxophoneInit( struct s
+ nRet = capiInit( nController );
+ if ( nRet != 0 ) {
+ FopDebug( FOP_DEBUG, "Initialization failed! Error %d!\n", nRet );
+- g_mutex_free( psSession -> psIsdnMutex );
+- psSession -> psIsdnMutex = NULL;
+ g_free( psSession );
+ psSession = NULL;
+
+diff -up ffgtk-0.7.94/ffgtk/faxophone/faxophone.h.threads-api ffgtk-0.7.94/ffgtk/faxophone/faxophone.h
+--- ffgtk-0.7.94/ffgtk/faxophone/faxophone.h.threads-api 2011-11-04 09:12:09.060583002 +0100
++++ ffgtk-0.7.94/ffgtk/faxophone/faxophone.h 2011-11-04 09:46:57.760249625 +0100
+@@ -34,8 +34,8 @@
+ /* max. B-Channels */
+ #define CAPI_BCHANNELS 2
+
+-#define isdnLock() do { g_mutex_lock( psSession -> psIsdnMutex ); } while ( 0 );
+-#define isdnUnlock() do { g_mutex_unlock( psSession -> psIsdnMutex ); } while ( 0 );
++#define isdnLock() do { g_mutex_lock( &psSession -> psIsdnMutex ); } while ( 0 );
++#define isdnUnlock() do { g_mutex_unlock( &psSession -> psIsdnMutex ); } while ( 0 );
+
+ enum eState {
+ STATE_IDLE = 0,
+@@ -98,7 +98,7 @@ struct sSessionHandlers {
+ };
+
+ struct sSession {
+- GMutex *psIsdnMutex;
++ GMutex psIsdnMutex;
+
+ struct sCapiConnection asConnection[ CAPI_CONNECTIONS ];
+ int nApplId;
+diff -up ffgtk-0.7.94/ffgtk/faxophone/phone.c.threads-api ffgtk-0.7.94/ffgtk/faxophone/phone.c
+--- ffgtk-0.7.94/ffgtk/faxophone/phone.c.threads-api 2011-05-13 18:45:04.000000000 +0200
++++ ffgtk-0.7.94/ffgtk/faxophone/phone.c 2011-11-04 09:11:34.806180045 +0100
+@@ -20,6 +20,8 @@
+ #include <speex/speex_echo.h>
+ #include <speex/speex_preprocess.h>
+
++#include "../ffgtk.h"
++
+ /** Speex Echo Cancellation (does not work well at the moment) */
+ //#define SEC 1
+
+@@ -108,7 +110,7 @@ void phoneTransfer( struct sCapiConnecti
+ speex_preprocess_ctl( psPreProcessState, SPEEX_PREPROCESS_SET_DENOISE, &nI );
+ }
+
+- g_thread_create( phoneInputThread, psConnection, FALSE, NULL );
++ ffgtk_thread_create( phoneInputThread, psConnection );
+ }
+
+ /* Clear buffer */
+diff -up ffgtk-0.7.94/ffgtk/fax_phone.c.threads-api ffgtk-0.7.94/ffgtk/fax_phone.c
+--- ffgtk-0.7.94/ffgtk/fax_phone.c.threads-api 2011-05-13 18:45:04.000000000 +0200
++++ ffgtk-0.7.94/ffgtk/fax_phone.c 2011-11-04 09:11:34.807180061 +0100
+@@ -930,7 +930,7 @@ static gpointer startSession( gpointer p
+ * \brief Start faxophone session thread
+ */
+ void InitFaxPhone( void ) {
+- g_thread_create( startSession, NULL, false, NULL );
++ ffgtk_thread_create( startSession, NULL );
+ }
+
+ /**
+diff -up ffgtk-0.7.94/ffgtk/ffgtk.h.threads-api ffgtk-0.7.94/ffgtk/ffgtk.h
+--- ffgtk-0.7.94/ffgtk/ffgtk.h.threads-api 2011-05-13 18:45:04.000000000 +0200
++++ ffgtk-0.7.94/ffgtk/ffgtk.h 2011-11-04 09:11:34.808180075 +0100
+@@ -523,4 +523,10 @@ gboolean has_file_extension( const char
+ void ffgtkLock( void );
+ void ffgtkUnlock( void );
+
++#define ffgtk_thread_create(func, data) G_STMT_START { \
++ GThread *thread = g_thread_new (NULL, func, data); \
++ if (thread) \
++ g_thread_unref (thread); \
++ } G_STMT_END
++
+ #endif
+diff -up ffgtk-0.7.94/ffgtk/main.c.threads-api ffgtk-0.7.94/ffgtk/main.c
+--- ffgtk-0.7.94/ffgtk/main.c.threads-api 2011-11-04 09:11:34.757179474 +0100
++++ ffgtk-0.7.94/ffgtk/main.c 2011-11-04 09:11:34.810180098 +0100
+@@ -176,13 +176,11 @@ int main( int argc, char **argv ) {
+ /* Display version information */
+ Debug( KERN_INFO, "ffgtk %s - %s\n", PACKAGE_VERSION, anSvnRevision );
+
++ g_type_init();
+ /* Initialize thread support */
+- if ( !g_thread_supported() ) {
+- g_thread_init( NULL );
+ #ifdef HAVE_DBUS
+ dbus_g_thread_init();
+ #endif
+- }
+ gdk_threads_init();
+
+ ffgtkInitLock();
+diff -up ffgtk-0.7.94/ffgtk/misc.c.threads-api ffgtk-0.7.94/ffgtk/misc.c
+--- ffgtk-0.7.94/ffgtk/misc.c.threads-api 2011-05-13 18:45:04.000000000 +0200
++++ ffgtk-0.7.94/ffgtk/misc.c 2011-11-04 09:11:34.811180110 +0100
+@@ -1042,7 +1042,7 @@ const char *GFileMonitorEvent2Text( GFil
+ }
+
+ //static int nLocked = 0;
+-static GMutex *psLocked = NULL;
++//static GMutex *psLocked = NULL;
+
+ void ffgtkLock( void ) {
+
+@@ -1067,6 +1067,6 @@ void ffgtkUnlock( void ) {
+ }
+
+ void ffgtkInitLock( void ) {
+- psLocked = g_mutex_new();
++ //psLocked = g_mutex_new();
+ }
+
+diff -up ffgtk-0.7.94/ffgtk/monitor.c.threads-api ffgtk-0.7.94/ffgtk/monitor.c
+--- ffgtk-0.7.94/ffgtk/monitor.c.threads-api 2011-05-13 18:45:04.000000000 +0200
++++ ffgtk-0.7.94/ffgtk/monitor.c 2011-11-04 09:11:34.812180121 +0100
+@@ -807,5 +807,5 @@ gpointer monitor( gpointer data ) {
+ * \brief Starts call monitor thread
+ */
+ void InitMonitor( void ) {
+- g_thread_create( monitor, NULL, false, NULL );
++ ffgtk_thread_create( monitor, NULL );
+ }
+diff -up ffgtk-0.7.94/ffgtk/preferences.c.threads-api ffgtk-0.7.94/ffgtk/preferences.c
+--- ffgtk-0.7.94/ffgtk/preferences.c.threads-api 2011-05-13 18:45:04.000000000 +0200
++++ ffgtk-0.7.94/ffgtk/preferences.c 2011-11-04 09:11:34.814180144 +0100
+@@ -1690,7 +1690,7 @@ static void detectCallback( GtkButton *p
+
+ GTK_FLUSH;
+
+- g_thread_create( detectThread, NULL, false, NULL );
++ ffgtk_thread_create( detectThread, NULL );
+
+ while ( bFinishedPref == FALSE ) GTK_FLUSH;
+
+diff -up ffgtk-0.7.94/ffgtk/profiles.c.threads-api ffgtk-0.7.94/ffgtk/profiles.c
+--- ffgtk-0.7.94/ffgtk/profiles.c.threads-api 2011-05-13 18:45:04.000000000 +0200
++++ ffgtk-0.7.94/ffgtk/profiles.c 2011-11-04 09:11:34.815180156 +0100
+@@ -203,7 +203,7 @@ void setActiveProfile( struct sProfile *
+ freeCallerList();
+
+ if ( callMonitorGetLoadOnStartup( psProfile ) ) {
+- g_thread_create( updateCallList, NULL, false, NULL );
++ ffgtk_thread_create( updateCallList, NULL );
+ //g_idle_add_full( G_PRIORITY_HIGH, ( GSourceFunc ) updateCallList, NULL, NULL );
+ }
+ }
+diff -up ffgtk-0.7.94/ffgtk/router.c.threads-api ffgtk-0.7.94/ffgtk/router.c
+--- ffgtk-0.7.94/ffgtk/router.c.threads-api 2011-05-13 18:45:04.000000000 +0200
++++ ffgtk-0.7.94/ffgtk/router.c 2011-11-04 09:11:34.816180168 +0100
+@@ -430,7 +430,7 @@ static gpointer loadDiversity( gpointer
+ * \brief Starts load diversity thread, called by main()
+ */
+ void DiversityLoad( void ) {
+- g_thread_create( loadDiversity, NULL, false, NULL );
++ ffgtk_thread_create( loadDiversity, NULL );
+ //g_idle_add_full( G_PRIORITY_LOW, loadDiversity, NULL, NULL );
+ }
+
+diff -up ffgtk-0.7.94/ffgtk/server.c.threads-api ffgtk-0.7.94/ffgtk/server.c
+--- ffgtk-0.7.94/ffgtk/server.c.threads-api 2011-05-13 18:45:04.000000000 +0200
++++ ffgtk-0.7.94/ffgtk/server.c 2011-11-04 09:11:34.817180180 +0100
+@@ -122,5 +122,5 @@ gpointer server( gpointer data ) {
+ * \brief Initialize print server thread
+ */
+ void PrintServerInit( void ) {
+- g_thread_create( server, NULL, false, NULL );
++ ffgtk_thread_create( server, NULL );
+ }
+diff -up ffgtk-0.7.94/ffgtk/trayicon.c.threads-api ffgtk-0.7.94/ffgtk/trayicon.c
+--- ffgtk-0.7.94/ffgtk/trayicon.c.threads-api 2011-05-13 18:45:04.000000000 +0200
++++ ffgtk-0.7.94/ffgtk/trayicon.c 2011-11-04 09:11:34.818180192 +0100
+@@ -630,6 +630,6 @@ void TrayIconInit( void ) {
+ recreateAppMenu();
+ #else
+ createTrayIcon();
+- //g_thread_create( updateTooltip, psTrayIcon, false, NULL );
++ //ffgtk_thread_create( updateTooltip, psTrayIcon );
+ #endif
+ }
+diff -up ffgtk-0.7.94/ffgtk/voxplay.c.threads-api ffgtk-0.7.94/ffgtk/voxplay.c
+--- ffgtk-0.7.94/ffgtk/voxplay.c.threads-api 2011-05-13 18:45:04.000000000 +0200
++++ ffgtk-0.7.94/ffgtk/voxplay.c 2011-11-04 09:11:34.819180204 +0100
+@@ -146,7 +146,7 @@ gint PlayVoxFile( gchar *pnFile ) {
+
+ gtk_widget_show_all( GTK_WIDGET( psDialog ) );
+
+- g_thread_create( playbackThread, NULL, FALSE, NULL );
++ ffgtk_thread_create( playbackThread, NULL );
+
+ return 0;
+ }
diff --git a/ffgtk.spec b/ffgtk.spec
index 33590b3..dc0c96d 100644
--- a/ffgtk.spec
+++ b/ffgtk.spec
@@ -9,7 +9,7 @@ Source0: http://www.tabos.org/ffgtk/download/%{name}-%{version}.tar.bz2
Source1: ffgtk-fax.ppd
Source2: ffgtk-README.Fedora
Patch0: ffgtk-use-old-spooler.patch
-Patch1: ffgtk-0.7.94-g-thread-init.patch
+Patch1: ffgtk-0.7.94-threads-api.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -57,7 +57,7 @@ This package contains the gstreamer plugin for ffgtk.
%prep
%setup -q
%patch0 -p1 -b .spooler
-%patch1 -p1 -b .g-thread-init
+%patch1 -p1 -b .threads-api
install -m644 %{SOURCE2} ./README.Fedora
%build
@@ -177,7 +177,7 @@ fi
%changelog
* Fri Nov 04 2011 Milan Crha <mcrha at redhat.com> 0.7.94-9
-- Do not use g_thread_init()
+- Adapt to GThread API changes
* Sun Oct 30 2011 Bruno Wolff III <bruno at wolff.to> - 0.7.94-9
- Rebuild against newer evolution-data-server
More information about the scm-commits
mailing list