]> git.sesse.net Git - vlc/blob - plugins/dummy/intf_dummy.c
21bd9622a435bb76438d3ecb5c0b6c3cbb0d6498
[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.14 2002/01/29 20:11:18 gbazin 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 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27 #include <stdlib.h>                                      /* malloc(), free() */
28 #include <string.h>
29
30 #include <videolan/vlc.h>
31
32 #include "interface.h"
33
34 /*****************************************************************************
35  * intf_sys_t: description and status of FB interface
36  *****************************************************************************/
37 typedef struct intf_sys_s
38 {
39     /* Prevent malloc(0) */
40     int i_dummy;
41
42 } intf_sys_t;
43
44 /*****************************************************************************
45  * Local prototypes.
46  *****************************************************************************/
47 static int  intf_Probe     ( probedata_t *p_data );
48 static int  intf_Open      ( intf_thread_t *p_intf );
49 static void intf_Close     ( intf_thread_t *p_intf );
50 static void intf_Run       ( intf_thread_t *p_intf );
51
52 /*****************************************************************************
53  * Functions exported as capabilities. They are declared as static so that
54  * we don't pollute the namespace too much.
55  *****************************************************************************/
56 void _M( intf_getfunctions )( function_list_t * p_function_list )
57 {
58     p_function_list->pf_probe = intf_Probe;
59     p_function_list->functions.intf.pf_open  = intf_Open;
60     p_function_list->functions.intf.pf_close = intf_Close;
61     p_function_list->functions.intf.pf_run   = intf_Run;
62 }
63
64 /*****************************************************************************
65  * intf_Probe: probe the interface and return a score
66  *****************************************************************************
67  * This function tries to initialize Gnome and returns a score to the
68  * plugin manager so that it can select the best plugin.
69  *****************************************************************************/
70 static int intf_Probe( probedata_t *p_data )
71 {
72     return( 1 );
73 }
74
75 /*****************************************************************************
76  * intf_Open: initialize dummy interface
77  *****************************************************************************/
78 static int intf_Open( intf_thread_t *p_intf )
79 {
80     /* Allocate instance and initialize some members */
81     p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
82     if( p_intf->p_sys == NULL )
83     {
84         return( 1 );
85     };
86
87     return( 0 );
88 }
89
90 /*****************************************************************************
91  * intf_Close: destroy dummy interface
92  *****************************************************************************/
93 static void intf_Close( intf_thread_t *p_intf )
94 {
95     /* Destroy structure */
96     free( p_intf->p_sys );
97 }
98
99
100 /*****************************************************************************
101  * intf_Run: main loop
102  *****************************************************************************/
103 static void intf_Run( intf_thread_t *p_intf )
104 {
105     while( !p_intf->b_die )
106     {
107         /* Manage core vlc functions through the callback */
108         p_intf->pf_manage( p_intf );
109
110         /* Wait a bit */
111         msleep( INTF_IDLE_SLEEP );
112     }
113 }
114