]> git.sesse.net Git - vlc/blob - src/misc/beos_specific.cpp
Language & Inteface support for BeOS interface
[vlc] / src / misc / beos_specific.cpp
1 /*****************************************************************************
2  * beos_init.cpp: Initialization for BeOS specific features 
3  *****************************************************************************
4  * Copyright (C) 1999, 2000 VideoLAN
5  * $Id: beos_specific.cpp,v 1.6 2001/03/25 17:09:14 richards Exp $
6  *
7  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  * 
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23 #include "defs.h"
24
25 #include <Application.h>
26 #include <Roster.h>
27 #include <Path.h>
28 #include <stdio.h>
29 #include <malloc.h>
30
31 extern "C"
32 {
33 #include "common.h"
34 #include "threads.h"
35 #include "mtime.h"
36 }
37 #include "beos_specific.h"
38
39
40
41 /*****************************************************************************
42  * Static vars
43  *****************************************************************************/
44 static vlc_thread_t beos_app_thread;
45 static char * psz_beos_program_path;
46
47
48 extern "C"
49 {
50
51 void beos_AppThread( void * args )
52 {
53     BApplication * BeApp = new BApplication("application/x-VLC");
54     BeApp->Run();
55     delete BeApp;
56 }
57
58 void beos_Create( void )
59 {
60     int i_lenght;
61     BPath path;
62     app_info info; 
63     
64     be_app = NULL;
65     vlc_thread_create( &beos_app_thread, "app thread", (vlc_thread_func_t)beos_AppThread, 0 );
66     while( be_app == NULL )
67         msleep( 5000 );
68     
69     be_app->GetAppInfo(&info); 
70     BEntry entry(&info.ref); 
71     entry.GetPath(&path); 
72     path.GetParent(&path);
73     i_lenght = strlen( path.Path() );
74     psz_beos_program_path = (char*) malloc( i_lenght+1 ); /* XXX */
75     strcpy( psz_beos_program_path, path.Path() );
76 }
77
78 void beos_Destroy( void )
79 {
80     free( psz_beos_program_path ); /* XXX */
81     be_app->PostMessage( B_QUIT_REQUESTED );
82     vlc_thread_join( beos_app_thread );
83 }
84
85 char * beos_GetProgramPath( void )
86 {
87     return( psz_beos_program_path );
88 }
89
90 } /* extern "C" */