]> git.sesse.net Git - vlc/blob - src/misc/darwin_specific.c
* ALL: the first libvlc commit.
[vlc] / src / misc / darwin_specific.c
1 /*****************************************************************************
2  * darwin_specific.c: Darwin specific features 
3  *****************************************************************************
4  * Copyright (C) 2001 VideoLAN
5  * $Id: darwin_specific.c,v 1.10 2002/06/01 12:32:01 sam Exp $
6  *
7  * Authors: Samuel Hocevar <sam@zoy.org>
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 <string.h>                                              /* strdup() */
24 #include <stdlib.h>                                                /* free() */
25
26 #include <vlc/vlc.h>
27
28 /*****************************************************************************
29  * Static vars
30  *****************************************************************************/
31 static char * psz_program_path;
32
33 /*****************************************************************************
34  * system_Init: fill in program path.
35  *****************************************************************************/
36 void system_Init( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[] )
37 {
38     char i_dummy;
39     char *p_char, *p_oldchar = &i_dummy;
40
41     /* Get the full program path and name */
42     p_char = psz_program_path = strdup( ppsz_argv[ 0 ] );
43
44     /* Remove trailing program name */
45     for( ; *p_char ; )
46     {
47         if( *p_char == '/' )
48         {
49             *p_oldchar = '/';
50             *p_char = '\0';
51             p_oldchar = p_char;
52         }
53
54         p_char++;
55     }
56
57     /* Run the interface with a real-time priority too */
58     {
59         struct sched_param param;
60         param.sched_priority = 10;
61         if (pthread_setschedparam(pthread_self(), SCHED_RR, &param))  
62         {
63             intf_ErrMsg("pthread_setschedparam failed");
64         }
65     }
66 }
67
68 /*****************************************************************************
69  * system_Configure: check for system specific configuration options.
70  *****************************************************************************/
71 void system_Configure( vlc_object_t *p_this )
72 {
73
74 }
75
76 /*****************************************************************************
77  * system_End: free the program path.
78  *****************************************************************************/
79 void system_End( vlc_object_t * )
80 {
81     free( psz_program_path );
82 }
83
84 /*****************************************************************************
85  * system_GetProgramPath: get the full path to the program.
86  *****************************************************************************/
87 char * system_GetProgramPath( void )
88 {
89     return( psz_program_path );
90 }
91