]> git.sesse.net Git - vlc/blob - src/misc/beos_specific.cpp
Portage du client sous BeOS. Il manque encore l'audio mais �a marche.
[vlc] / src / misc / beos_specific.cpp
1 /*****************************************************************************
2  * beos_init.cpp: Initialization for BeOS specific features 
3  *****************************************************************************
4  * Copyright (C) 1999, 2000 VideoLAN
5  *
6  * Authors:
7  * Jean-Marc Dressler
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 GNU
17  * General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public
20  * License along with this program; if not, write to the
21  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22  * Boston, MA 02111-1307, USA.
23  *****************************************************************************/
24 #include "defs.h"
25
26 #include <Application.h>
27 #include <Roster.h>
28 #include <Path.h>
29 #include <stdio.h>
30 #include <malloc.h>
31
32 extern "C"
33 {
34 #include "common.h"
35 #include "threads.h"
36 #include "mtime.h"
37 }
38 #include "beos_specific.h"
39
40
41
42 /*****************************************************************************
43  * Static vars
44  *****************************************************************************/
45 static vlc_thread_t beos_app_thread;
46 static char * psz_beos_program_path;
47
48
49 extern "C"
50 {
51
52 void beos_AppThread( void * args )
53 {
54     BApplication * BeApp = new BApplication("application/x-VLC");
55     BeApp->Run();
56     delete BeApp;
57 }
58
59 void beos_Init( void )
60 {
61     int i_lenght;
62     BPath path;
63     app_info info; 
64     
65     vlc_thread_create( &beos_app_thread, "app thread", (vlc_thread_func_t)beos_AppThread, 0 );
66     msleep( 100000 );
67     // FIXME: we need to verify that be_app is initialized and the msleep is not enough
68     //        but the following code does not work as it should and I have no good
69     //        solution at the moment.
70     //while( be_app == NULL )
71     //    msleep( 5000 );
72     
73     be_app->GetAppInfo(&info); 
74     BEntry entry(&info.ref); 
75     entry.GetPath(&path); 
76     path.GetParent(&path);
77     i_lenght = strlen( path.Path() );
78     psz_beos_program_path = (char*) malloc( i_lenght+1 ); /* XXX */
79     strcpy( psz_beos_program_path, path.Path() );
80 }
81
82 void beos_Clean( void )
83 {
84     free( psz_beos_program_path ); /* XXX */
85     be_app->PostMessage( B_QUIT_REQUESTED );
86     vlc_thread_join( beos_app_thread );
87 }
88
89 char * beos_GetProgramPath( void )
90 {
91     return( psz_beos_program_path );
92 }
93
94 } /* extern "C" */