]> git.sesse.net Git - vlc/blob - plugins/dummy/intf_dummy.c
* Applied patch from Jon Lech Johansen <jon-vl@nanocrew.net> to compile
[vlc] / plugins / dummy / intf_dummy.c
1 /*****************************************************************************
2  * intf_dummy.c: dummy interface plugin
3  *****************************************************************************
4  * Copyright (C) 2000, 2001 VideoLAN
5  * $Id: intf_dummy.c,v 1.9 2001/05/31 01:37:08 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
24 #define MODULE_NAME dummy
25 #include "modules_inner.h"
26
27 /*****************************************************************************
28  * Preamble
29  *****************************************************************************/
30 #include "defs.h"
31
32 #include <stdlib.h>                                      /* malloc(), free() */
33
34 #include "config.h"
35 #include "common.h"
36 #include "threads.h"
37 #include "mtime.h"
38 #include "tests.h"
39
40 #include "intf_msg.h"
41 #include "interface.h"
42
43 #include "modules.h"
44
45 #include "main.h"
46 #include "modules_export.h"
47
48 /*****************************************************************************
49  * intf_sys_t: description and status of FB interface
50  *****************************************************************************/
51 typedef struct intf_sys_s
52 {
53 #if defined( _MSC_VER )
54     int i_dummy;
55 #endif
56 } intf_sys_t;
57
58 /*****************************************************************************
59  * Local prototypes.
60  *****************************************************************************/
61 static int  intf_Probe     ( probedata_t *p_data );
62 static int  intf_Open      ( intf_thread_t *p_intf );
63 static void intf_Close     ( intf_thread_t *p_intf );
64 static void intf_Run       ( intf_thread_t *p_intf );
65
66 /*****************************************************************************
67  * Functions exported as capabilities. They are declared as static so that
68  * we don't pollute the namespace too much.
69  *****************************************************************************/
70 void _M( intf_getfunctions )( function_list_t * p_function_list )
71 {
72     p_function_list->pf_probe = intf_Probe;
73     p_function_list->functions.intf.pf_open  = intf_Open;
74     p_function_list->functions.intf.pf_close = intf_Close;
75     p_function_list->functions.intf.pf_run   = intf_Run;
76 }
77
78 /*****************************************************************************
79  * intf_Probe: probe the interface and return a score
80  *****************************************************************************
81  * This function tries to initialize Gnome and returns a score to the
82  * plugin manager so that it can select the best plugin.
83  *****************************************************************************/
84 static int intf_Probe( probedata_t *p_data )
85 {
86     if( TestMethod( INTF_METHOD_VAR, "dummy" ) )
87     {
88         return( 999 );
89     }
90
91     return( 1 );
92 }
93
94 /*****************************************************************************
95  * intf_Open: initialize dummy interface
96  *****************************************************************************/
97 static int intf_Open( intf_thread_t *p_intf )
98 {
99     /* Allocate instance and initialize some members */
100     p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
101     if( p_intf->p_sys == NULL )
102     {
103         return( 1 );
104     };
105
106     return( 0 );
107 }
108
109 /*****************************************************************************
110  * intf_Close: destroy dummy interface
111  *****************************************************************************/
112 static void intf_Close( intf_thread_t *p_intf )
113 {
114     /* Destroy structure */
115     free( p_intf->p_sys );
116 }
117
118
119 /*****************************************************************************
120  * intf_Run: main loop
121  *****************************************************************************/
122 static void intf_Run( intf_thread_t *p_intf )
123 {
124     while( !p_intf->b_die )
125     {
126         /* Manage core vlc functions through the callback */
127         p_intf->pf_manage( p_intf );
128
129         /* Wait a bit */
130         msleep( INTF_IDLE_SLEEP );
131     }
132 }
133