Commit dc4cad8f authored by Sam Hocevar's avatar Sam Hocevar

  * Got rid of the sleep() hack in beos_specific.cpp
  * Fixed a segfault when launched without argument under Darwin.
parent e0e2dcdd
# ChangeLog for vlc #===================#
# ================= # ChangeLog for vlc #
#===================#
HEAD HEAD
* Got rid of the sleep() hack in beos_specific.cpp
* Fixed a segfault when launched without argument under Darwin.
* Fix for Darwin program path handling. * Fix for Darwin program path handling.
0.2.71 0.2.71
...@@ -883,7 +886,7 @@ Tue, 22 Aug 2000 01:31:58 +0200 ...@@ -883,7 +886,7 @@ Tue, 22 Aug 2000 01:31:58 +0200
* temporarily got rid of vlc.channels. * temporarily got rid of vlc.channels.
* added notice in debian/control about unencrypted DVDs. * added notice in debian/control about unencrypted DVDs.
* fixed PowerPC .deb build. * fixed PowerPC .deb build.
0.1.99g 0.1.99g
Wed, 16 Aug 2000 01:07:14 +0200 Wed, 16 Aug 2000 01:07:14 +0200
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* and spawn threads. * and spawn threads.
***************************************************************************** *****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN * Copyright (C) 1998, 1999, 2000 VideoLAN
* $Id: main.c,v 1.85 2001/04/12 01:52:45 sam Exp $ * $Id: main.c,v 1.86 2001/04/14 07:41:20 sam Exp $
* *
* Authors: Vincent Seguin <seguin@via.ecp.fr> * Authors: Vincent Seguin <seguin@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org> * Samuel Hocevar <sam@zoy.org>
...@@ -542,8 +542,8 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -542,8 +542,8 @@ static int GetConfiguration( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
/* When vlc.app is run by double clicking in Mac OS X, the 2nd arg /* When vlc.app is run by double clicking in Mac OS X, the 2nd arg
* is the PSN - process serial number (a unique PID-ish thingie) * is the PSN - process serial number (a unique PID-ish thingie)
* still ok for real Darwin & when run from command line */ * still ok for real Darwin & when run from command line */
if ( strncmp( ppsz_argv[ 1 ] , "-psn" , 4) == 0 ) if ( (*pi_argc > 1) && (strncmp( ppsz_argv[ 1 ] , "-psn" , 4 ) == 0) )
/* for example -psn_0_9306113 */ /* for example -psn_0_9306113 */
{ {
/* GDMF!... I can't do this or else the MacOSX window server will /* GDMF!... I can't do this or else the MacOSX window server will
* not pick up the PSN and not register the app and we crash... * not pick up the PSN and not register the app and we crash...
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* beos_init.cpp: Initialization for BeOS specific features * beos_init.cpp: Initialization for BeOS specific features
***************************************************************************** *****************************************************************************
* Copyright (C) 1999, 2000 VideoLAN * Copyright (C) 1999, 2000 VideoLAN
* $Id: beos_specific.cpp,v 1.8 2001/04/12 08:24:30 sam Exp $ * $Id: beos_specific.cpp,v 1.9 2001/04/14 07:41:20 sam Exp $
* *
* Authors: Jean-Marc Dressler <polux@via.ecp.fr> * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* *
...@@ -26,7 +26,8 @@ ...@@ -26,7 +26,8 @@
#include <Roster.h> #include <Roster.h>
#include <Path.h> #include <Path.h>
#include <stdio.h> #include <stdio.h>
#include <malloc.h> #include <string.h> /* strdup() */
#include <malloc.h> /* free() */
extern "C" extern "C"
{ {
...@@ -36,55 +37,126 @@ extern "C" ...@@ -36,55 +37,126 @@ extern "C"
} }
#include "beos_specific.h" #include "beos_specific.h"
/*****************************************************************************
* The VlcApplication class
*****************************************************************************/
class VlcApplication : public BApplication
{
public:
VlcApplication(char* );
~VlcApplication();
void ReadyToRun();
};
/***************************************************************************** /*****************************************************************************
* Static vars * Static vars
*****************************************************************************/ *****************************************************************************/
static vlc_thread_t beos_app_thread; static vlc_thread_t app_thread;
static char * psz_program_path; static vlc_mutex_t app_lock;
static vlc_cond_t app_wait;
static char *psz_program_path;
extern "C" extern "C"
{ {
void system_AppThread( void * args ) /*****************************************************************************
{ * Local prototypes.
BApplication * BeApp = new BApplication("application/x-VLC"); *****************************************************************************/
BeApp->Run(); static void system_AppThread( void * args );
delete BeApp;
}
/*****************************************************************************
* system_Create: create a BApplication object and fill in program path.
*****************************************************************************/
void system_Create( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) void system_Create( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
{ {
int i_lenght; /* Prepare the lock/wait before launching the BApplication thread */
BPath path; vlc_mutex_init( &app_lock );
app_info info; vlc_cond_init( &app_wait );
vlc_mutex_lock( &app_lock );
be_app = NULL;
vlc_thread_create( &beos_app_thread, "app thread", (vlc_thread_func_t)system_AppThread, 0 ); /* Create the BApplication thread */
while( be_app == NULL ) vlc_thread_create( &app_thread, "app thread",
msleep( 5000 ); (vlc_thread_func_t)system_AppThread, 0 );
be_app->GetAppInfo(&info); /* Wait for the application to be initialized */
BEntry entry(&info.ref); vlc_cond_wait( &app_wait, &app_lock );
entry.GetPath(&path); vlc_mutex_unlock( &app_lock );
path.GetParent(&path);
i_lenght = strlen( path.Path() ); /* Destroy the locks */
psz_program_path = (char*) malloc( i_lenght+1 ); /* XXX */ vlc_mutex_destroy( &app_lock );
strcpy( psz_program_path, path.Path() ); vlc_cond_destroy( &app_wait );
} }
/*****************************************************************************
* system_Destroy: destroy the BApplication object.
*****************************************************************************/
void system_Destroy( void ) void system_Destroy( void )
{ {
free( psz_program_path ); /* XXX */ free( psz_program_path );
/* Tell the BApplication to die */
be_app->PostMessage( B_QUIT_REQUESTED ); be_app->PostMessage( B_QUIT_REQUESTED );
vlc_thread_join( beos_app_thread ); vlc_thread_join( app_thread );
} }
/*****************************************************************************
* system_GetProgramPath: get the full path to the program.
*****************************************************************************/
char * system_GetProgramPath( void ) char * system_GetProgramPath( void )
{ {
return( psz_program_path ); return( psz_program_path );
} }
/* following functions are local */
/*****************************************************************************
* system_AppThread: the BApplication thread.
*****************************************************************************/
static void system_AppThread( void * args )
{
VlcApplication *BeApp = new VlcApplication("application/x-vnd.Ink-vlc");
BeApp->Run();
delete BeApp;
}
} /* extern "C" */ } /* extern "C" */
/*****************************************************************************
* VlcApplication: application constructor
*****************************************************************************/
VlcApplication::VlcApplication( char * psz_mimetype )
:BApplication( psz_mimetype )
{
/* Nothing to do, we use the default constructor */
}
/*****************************************************************************
* ~VlcApplication: application destructor
*****************************************************************************/
VlcApplication::~VlcApplication( )
{
/* Nothing to do, we use the default destructor */
}
/*****************************************************************************
* ~ReadyToRun: called when the BApplication is initialized
*****************************************************************************/
void VlcApplication::ReadyToRun( )
{
BPath path;
app_info info;
/* Get the program path */
be_app->GetAppInfo( &info );
BEntry entry( &info.ref );
entry.GetPath( &path );
path.GetParent( &path );
psz_program_path = strdup( path.Path() );
/* Tell the main thread we are finished initializing the BApplication */
vlc_mutex_lock( &app_lock );
vlc_cond_signal( &app_wait );
vlc_mutex_unlock( &app_lock );
}
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* darwin_specific.c: Darwin specific features * darwin_specific.c: Darwin specific features
***************************************************************************** *****************************************************************************
* Copyright (C) 2001 VideoLAN * Copyright (C) 2001 VideoLAN
* $Id: darwin_specific.c,v 1.2 2001/04/13 14:33:22 sam Exp $ * $Id: darwin_specific.c,v 1.3 2001/04/14 07:41:20 sam Exp $
* *
* Authors: Samuel Hocevar <sam@zoy.org> * Authors: Samuel Hocevar <sam@zoy.org>
* *
...@@ -36,6 +36,9 @@ ...@@ -36,6 +36,9 @@
*****************************************************************************/ *****************************************************************************/
static char * psz_program_path; static char * psz_program_path;
/*****************************************************************************
* system_Create: fill in program path.
*****************************************************************************/
void system_Create( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) void system_Create( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
{ {
char i_dummy; char i_dummy;
...@@ -48,23 +51,29 @@ void system_Create( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] ) ...@@ -48,23 +51,29 @@ void system_Create( int *pi_argc, char *ppsz_argv[], char *ppsz_env[] )
for( ; *p_char ; ) for( ; *p_char ; )
{ {
if( *p_char == '/' ) if( *p_char == '/' )
{ {
*p_oldchar = '/'; *p_oldchar = '/';
*p_char = '\0'; *p_char = '\0';
p_oldchar = p_char; p_oldchar = p_char;
} }
p_char++; p_char++;
} }
return; return;
} }
/*****************************************************************************
* system_Destroy: free the program path.
*****************************************************************************/
void system_Destroy( void ) void system_Destroy( void )
{ {
free( psz_program_path ); free( psz_program_path );
} }
/*****************************************************************************
* system_GetProgramPath: get the full path to the program.
*****************************************************************************/
char * system_GetProgramPath( void ) char * system_GetProgramPath( void )
{ {
return( psz_program_path ); return( psz_program_path );
......
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