]> git.sesse.net Git - vlc/blobdiff - src/misc/beos_specific.cpp
mtime: Avoid overflow when using mach_absolute_time().
[vlc] / src / misc / beos_specific.cpp
index 9b7d5023a796eeda49720428ae4584bd9c6eaf63..51c70cf8a8182b9caeb871e1b55dab9c037c16f0 100644 (file)
@@ -37,7 +37,7 @@ extern "C"
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include "../libvlc.h"
 }
 
@@ -71,24 +71,26 @@ private:
 #include "../../modules/gui/beos/MsgVals.h"
 #define REALLY_QUIT 'requ'
 
+static vlc_object_t *p_appthread;
+
 extern "C"
 {
 
 /*****************************************************************************
  * Local prototypes.
  *****************************************************************************/
-static void AppThread( vlc_object_t *p_appthread );
+static void* AppThread( vlc_object_t *p_appthread );
 
 /*****************************************************************************
  * system_Init: create a BApplication object and fill in program path.
  *****************************************************************************/
 void system_Init( libvlc_int_t *p_this, int *pi_argc, const char *ppsz_argv[] )
 {
-    vlc_global()->p_appthread =
+    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( vlc_global()->p_appthread, "app thread", AppThread,
+    vlc_thread_create( p_appthread, "app thread", AppThread,
                        VLC_THREAD_PRIORITY_LOW, true );
 }
 
@@ -107,10 +109,10 @@ void system_End( libvlc_int_t *p_this )
     /* Tell the BApplication to die */
     be_app->PostMessage( REALLY_QUIT );
 
-    vlc_thread_join( vlc_global()->p_appthread );
-    vlc_object_release( vlc_global()->p_appthread );
+    vlc_thread_join( p_appthread );
+    vlc_object_release( p_appthread );
 
-    free( vlc_global()->psz_vlcpath );
+    free( psz_vlcpath );
 }
 
 /* following functions are local */
@@ -118,8 +120,9 @@ void system_End( libvlc_int_t *p_this )
 /*****************************************************************************
  * AppThread: the BApplication thread.
  *****************************************************************************/
-static void AppThread( vlc_object_t * p_this )
+static void* AppThread( vlc_object_t * p_this )
 {
+    int canc = vlc_savecancel ();
     VlcApplication * BeApp =
         new VlcApplication("application/x-vnd.videolan-vlc");
     vlc_object_attach( p_this, p_this->p_libvlc );
@@ -127,6 +130,8 @@ static void AppThread( vlc_object_t * p_this )
     BeApp->Run();
     vlc_object_detach( p_this );
     delete BeApp;
+    vlc_restorecancel (canc);
+    return NULL;
 }
 
 } /* extern "C" */
@@ -177,7 +182,7 @@ void VlcApplication::ReadyToRun( )
     BEntry entry( &info.ref );
     entry.GetPath( &path );
     path.GetParent( &path );
-    vlc_global()->psz_vlcpath = strdup( path.Path() );
+    psz_vlcpath = strdup( path.Path() );
 
     /* Tell the main thread we are finished initializing the BApplication */
     vlc_thread_ready( p_this );
@@ -238,7 +243,7 @@ bool VlcApplication::QuitRequested()
 {
     if( !fReadyToQuit )
     {
-        vlc_object_kill( p_this->p_libvlc );
+        libvlc_Quit( p_this->p_libvlc );
         return false;
     }