Commit 2dad070c authored by Sam Hocevar's avatar Sam Hocevar

* ./src/misc/beos_specific.cpp: BeOS fixes, removed a static variable.

  * ./include/main.h: replaced p_sys with explicit variables because it's
    really much simpler this way. Gildas, will you ever forgive me ? :-)
parent 23379347
......@@ -3,7 +3,7 @@
* Declaration and extern access to global program object.
*****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
* $Id: main.h,v 1.36 2002/06/01 12:31:57 sam Exp $
* $Id: main.h,v 1.37 2002/06/01 14:31:32 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
*
......@@ -78,6 +78,11 @@ struct vlc_s
void ** pp_global_data;
/* Private data */
main_sys_t* p_sys; /* for system specific properties */
#if defined( SYS_BEOS )
vlc_object_t p_appthread;
#elif defined( WIN32 )
SIGNALOBJECTANDWAIT SignalObjectAndWait;
vlc_bool_t b_fast_pthread;
#endif
};
......@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: vlc_common.h,v 1.1 2002/06/01 12:31:58 sam Exp $
* $Id: vlc_common.h,v 1.2 2002/06/01 14:31:32 sam Exp $
*
* Authors: Samuel Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
......@@ -113,9 +113,6 @@ typedef s64 mtime_t;
* Classes declaration
*****************************************************************************/
/* System */
VLC_DECLARE_STRUCT(main_sys)
/* Messages */
VLC_DECLARE_STRUCT(msg_bank)
VLC_DECLARE_STRUCT(msg_subscription)
......@@ -186,7 +183,12 @@ VLC_DECLARE_STRUCT(iso639_lang)
/*****************************************************************************
* OS-specific headers and thread types
*****************************************************************************/
#include "os_specific.h"
#if defined( WIN32 )
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
typedef BOOL (WINAPI *SIGNALOBJECTANDWAIT)( HANDLE, HANDLE, DWORD, BOOL );
#endif
#include "vlc_threads.h"
/*****************************************************************************
......
......@@ -2,7 +2,7 @@
* win32_specific.h: Win32 specific features
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: win32_specific.h,v 1.3 2002/06/01 12:31:58 sam Exp $
* $Id: win32_specific.h,v 1.4 2002/06/01 14:31:32 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -22,20 +22,3 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
typedef BOOL (WINAPI *SIGNALOBJECTANDWAIT)( HANDLE, HANDLE, DWORD, BOOL );
/*****************************************************************************
* main_sys_t: system specific descriptor
*****************************************************************************
* This structure is a system specific descriptor. It describes the Win32
* properties of the program.
*****************************************************************************/
struct main_sys_s
{
SIGNALOBJECTANDWAIT SignalObjectAndWait;
vlc_bool_t b_fast_pthread;
};
......@@ -4,7 +4,7 @@
* and spawns threads.
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
* $Id: libvlc.c,v 1.1 2002/06/01 12:32:01 sam Exp $
* $Id: libvlc.c,v 1.2 2002/06/01 14:31:32 sam Exp $
*
* Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -65,6 +65,7 @@
#endif
#include "vlc_cpu.h" /* CPU detection */
#include "os_specific.h"
#include "netutils.h" /* network_ChannelJoin */
......
......@@ -2,7 +2,7 @@
* beos_init.cpp: Initialization for BeOS specific features
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
* $Id: beos_specific.cpp,v 1.20 2002/06/01 13:52:24 sam Exp $
* $Id: beos_specific.cpp,v 1.21 2002/06/01 14:31:32 sam Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
*
......@@ -39,7 +39,7 @@ extern "C"
class VlcApplication : public BApplication
{
public:
vlc_object_t *p_object;
vlc_object_t *p_this;
VlcApplication(char* );
~VlcApplication();
......@@ -52,7 +52,6 @@ public:
* Static vars
*****************************************************************************/
static char * psz_program_path;
static vlc_object_t * p_appthread;
extern "C"
{
......@@ -67,12 +66,11 @@ static void AppThread( vlc_object_t *p_appthread );
*****************************************************************************/
void system_Init( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[] )
{
p_appthread = vlc_object_create( p_this, sizeof(vlc_object_t) );
p_this->p_vlc->p_appthread =
(vlc_object_t *)vlc_object_create( p_this, sizeof(vlc_object_t) );
/* Create the BApplication thread and wait for initialization */
vlc_thread_create( p_appthread, "app thread", AppThread, 1 );
vlc_object_attach( p_appthread, p_this->p_vlc );
vlc_thread_create( p_this->p_vlc->p_appthread, "app thread", AppThread, 1 );
}
/*****************************************************************************
......@@ -88,13 +86,11 @@ void system_Configure( vlc_object_t * )
*****************************************************************************/
void system_End( vlc_object_t *p_this )
{
vlc_object_unlink_all( p_appthread );
/* Tell the BApplication to die */
be_app->PostMessage( B_QUIT_REQUESTED );
vlc_thread_join( p_appthread );
vlc_object_destroy( p_appthread );
vlc_thread_join( p_this->p_vlc->p_appthread );
vlc_object_destroy( p_this->p_vlc->p_appthread );
free( psz_program_path );
}
......@@ -110,12 +106,15 @@ char * system_GetProgramPath( void )
/* following functions are local */
/*****************************************************************************
* system_AppThread: the BApplication thread.
* AppThread: the BApplication thread.
*****************************************************************************/
static void system_AppThread( void * args )
static void AppThread( vlc_object_t * p_this )
{
VlcApplication *BeApp = new VlcApplication("application/x-vnd.Ink-vlc");
vlc_object_attach( p_this, p_this->p_vlc );
BeApp->p_this = p_this;
BeApp->Run();
vlc_object_unlink_all( p_this );
delete BeApp;
}
......@@ -166,6 +165,6 @@ void VlcApplication::ReadyToRun( )
psz_program_path = strdup( path.Path() );
/* Tell the main thread we are finished initializing the BApplication */
vlc_thread_ready( p_appthread );
vlc_thread_ready( p_this );
}
......@@ -2,7 +2,7 @@
* threads.c : threads implementation for the VideoLAN client
*****************************************************************************
* Copyright (C) 1999, 2000, 2001, 2002 VideoLAN
* $Id: threads.c,v 1.1 2002/06/01 12:32:01 sam Exp $
* $Id: threads.c,v 1.2 2002/06/01 14:31:32 sam Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -173,12 +173,11 @@ int __vlc_mutex_init( vlc_object_t *p_this, vlc_mutex_t *p_mutex )
* function and have a 100% correct vlc_cond_wait() implementation.
* As this function is not available on Win9x, we can use the faster
* CriticalSections */
if( (GetVersion() < 0x80000000) && !p_this->p_vlc->p_sys->b_fast_pthread )
if( (GetVersion() < 0x80000000) && !p_this->p_vlc->b_fast_pthread )
{
/* We are running on NT/2K/XP, we can use SignalObjectAndWait */
p_mutex->mutex = CreateMutex( 0, FALSE, 0 );
p_mutex->SignalObjectAndWait =
p_this->p_vlc->p_sys->SignalObjectAndWait;
p_mutex->SignalObjectAndWait = p_this->p_vlc->SignalObjectAndWait;
return ( p_mutex->mutex ? 0 : 1 );
}
else
......
......@@ -2,7 +2,7 @@
* win32_specific.c: Win32 specific features
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: win32_specific.c,v 1.8 2002/06/01 12:32:02 sam Exp $
* $Id: win32_specific.c,v 1.9 2002/06/01 14:31:32 sam Exp $
*
* Authors: Samuel Hocevar <sam@zoy.org>
* Gildas Bazin <gbazin@netcourrier.com>
......@@ -39,17 +39,9 @@ void system_Init( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[] )
int i_err;
HINSTANCE hInstLib;
/* Allocate structure */
p_this->p_vlc->p_sys = malloc( sizeof( main_sys_t ) );
if( p_this->p_vlc->p_sys == NULL )
{
fprintf( stderr, "error: out of memory\n" );
exit(-1);
}
/* dynamically get the address of SignalObjectAndWait */
hInstLib = LoadLibrary( "kernel32" );
p_this->p_vlc->p_sys->SignalObjectAndWait =
p_this->p_vlc->SignalObjectAndWait =
(SIGNALOBJECTANDWAIT)GetProcAddress( hInstLib, "SignalObjectAndWait" );
/* WinSock Library Init. */
......@@ -68,8 +60,7 @@ void system_Init( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[] )
*****************************************************************************/
void system_Configure( vlc_object_t *p_this )
{
p_this->p_vlc->p_sys->b_fast_pthread = config_GetInt( p_this,
"fast_pthread" );
p_this->p_vlc->b_fast_pthread = config_GetInt( p_this, "fast_pthread" );
}
/*****************************************************************************
......
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