]> git.sesse.net Git - vlc/blob - src/vlc.c
* ALL: decoders now use a fourcc as a probe value.
[vlc] / src / vlc.c
1 /*****************************************************************************
2  * vlc.c: the vlc player
3  *****************************************************************************
4  * Copyright (C) 1998-2001 VideoLAN
5  * $Id: vlc.c,v 1.7 2002/07/23 00:39:17 sam Exp $
6  *
7  * Authors: Vincent Seguin <seguin@via.ecp.fr>
8  *          Samuel Hocevar <sam@zoy.org>
9  *          Gildas Bazin <gbazin@netcourrier.com>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
24  *****************************************************************************/
25 #include <signal.h>                               /* SIGHUP, SIGINT, SIGKILL */
26 #include <stdio.h>                                              /* fprintf() */
27 #include <stdlib.h>                                  /* putenv(), strtol(),  */
28
29 #include <vlc/vlc.h>
30
31 /*****************************************************************************
32  * main: parse command line, start interface and spawn threads
33  *****************************************************************************/
34 int main(int i_argc, char *ppsz_argv[], char *ppsz_env[])
35 {
36     vlc_error_t err;
37
38 #ifdef SYS_LINUX
39 #   ifdef DEBUG
40     /* Activate malloc checking routines to detect heap corruptions. */
41     putenv( "MALLOC_CHECK_=2" );
42
43     /* Disable the ugly Gnome crash dialog so that we properly segfault */
44     putenv( "GNOME_DISABLE_CRASH_DIALOG=1" );
45 #   endif
46 #endif
47
48     /* Create the vlc structure */
49     err = vlc_create();
50     if( err != VLC_SUCCESS )
51     {
52         return err;
53     }
54
55     /* Initialize vlc */
56     err = vlc_init( i_argc, ppsz_argv );
57     if( err != VLC_SUCCESS )
58     {
59         vlc_destroy();
60         return err;
61     }
62
63     /* Run vlc, in non-blocking mode */
64     err = vlc_run();
65
66     /* Add background interfaces */
67     //{ int i; for( i=10; i--; ) vlc_add_intf( NULL, "dummy", 0 ); }
68     //vlc_add_intf( NULL, "dummy", VLC_FALSE );
69     //vlc_add_intf( NULL, "logger", VLC_FALSE );
70     //vlc_add_intf( NULL, "xosd", VLC_FALSE );
71     //vlc_add_intf( NULL, "gtk", VLC_FALSE );
72     //vlc_add_intf( NULL, "kde", VLC_FALSE );
73     //vlc_add_intf( "rc", VLC_FALSE );
74
75     /* Add a blocking interface and keep the return value */
76     err = vlc_add_intf( NULL, VLC_TRUE );
77
78     /* Finish the interface */
79     vlc_stop();
80
81     /* Finish all threads */
82     vlc_end();
83
84     /* Destroy the vlc structure */
85     vlc_destroy();
86
87     return err;
88 }
89