]> git.sesse.net Git - vlc/blob - plugins/dummy/intf_dummy.c
* Ported Glide and MGA plugins to the new module API. MGA never worked,
[vlc] / plugins / dummy / intf_dummy.c
1 /*****************************************************************************
2  * intf_dummy.c: dummy interface plugin
3  *****************************************************************************
4  * Copyright (C) 2000, 2001 VideoLAN
5  *
6  * Authors: Samuel Hocevar <sam@zoy.org>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  * 
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
21  *****************************************************************************/
22
23 #define MODULE_NAME dummy
24 #include "modules_inner.h"
25
26 /*****************************************************************************
27  * Preamble
28  *****************************************************************************/
29 #include "defs.h"
30
31 #include <stdlib.h>                                      /* malloc(), free() */
32
33 #include "config.h"
34 #include "common.h"
35 #include "threads.h"
36 #include "mtime.h"
37 #include "tests.h"
38
39 #include "intf_msg.h"
40 #include "interface.h"
41
42 #include "modules.h"
43
44 #include "main.h"
45
46 /*****************************************************************************
47  * intf_sys_t: description and status of FB interface
48  *****************************************************************************/
49 typedef struct intf_sys_s
50 {
51
52 } intf_sys_t;
53
54 /*****************************************************************************
55  * Local prototypes.
56  *****************************************************************************/
57 static int  intf_Probe     ( probedata_t *p_data );
58 static int  intf_Open      ( intf_thread_t *p_intf );
59 static void intf_Close     ( intf_thread_t *p_intf );
60 static void intf_Run       ( intf_thread_t *p_intf );
61
62 /*****************************************************************************
63  * Functions exported as capabilities. They are declared as static so that
64  * we don't pollute the namespace too much.
65  *****************************************************************************/
66 void _M( intf_getfunctions )( function_list_t * p_function_list )
67 {
68     p_function_list->pf_probe = intf_Probe;
69     p_function_list->functions.intf.pf_open  = intf_Open;
70     p_function_list->functions.intf.pf_close = intf_Close;
71     p_function_list->functions.intf.pf_run   = intf_Run;
72 }
73
74 /*****************************************************************************
75  * intf_Probe: probe the interface and return a score
76  *****************************************************************************
77  * This function tries to initialize Gnome and returns a score to the
78  * plugin manager so that it can select the best plugin.
79  *****************************************************************************/
80 static int intf_Probe( probedata_t *p_data )
81 {
82     if( TestMethod( INTF_METHOD_VAR, "dummy" ) )
83     {
84         return( 999 );
85     }
86
87     return( 1 );
88 }
89
90 /*****************************************************************************
91  * intf_Open: initialize dummy interface
92  *****************************************************************************/
93 static int intf_Open( intf_thread_t *p_intf )
94 {
95     /* Allocate instance and initialize some members */
96     p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
97     if( p_intf->p_sys == NULL )
98     {
99         return( 1 );
100     };
101
102     return( 0 );
103 }
104
105 /*****************************************************************************
106  * intf_Close: destroy dummy interface
107  *****************************************************************************/
108 static void intf_Close( intf_thread_t *p_intf )
109 {
110     /* Destroy structure */
111     free( p_intf->p_sys );
112 }
113
114
115 /*****************************************************************************
116  * intf_Run: main loop
117  *****************************************************************************/
118 static void intf_Run( intf_thread_t *p_intf )
119 {
120     while( !p_intf->b_die )
121     {
122         /* Manage core vlc functions through the callback */
123         p_intf->pf_manage( p_intf );
124
125         /* Wait a bit */
126         msleep( INTF_IDLE_SLEEP );
127     }
128 }
129