]> git.sesse.net Git - vlc/blob - plugins/dummy/dummy.c
. autod�tection des plugins
[vlc] / plugins / dummy / dummy.c
1 /*****************************************************************************
2  * dummy.c : dummy plugin for vlc
3  *****************************************************************************
4  * Copyright (C) 2000 VideoLAN
5  *
6  * Authors:
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 /*****************************************************************************
24  * Preamble
25  *****************************************************************************/
26 #include "defs.h"
27
28 #include <stdlib.h>                                      /* malloc(), free() */
29
30 #include "config.h"
31 #include "common.h"                                     /* boolean_t, byte_t */
32 #include "threads.h"
33 #include "mtime.h"
34 #include "tests.h"
35 #include "plugins.h"
36
37 #include "interface.h"
38 #include "audio_output.h"
39 #include "video.h"
40 #include "video_output.h"
41
42 /*****************************************************************************
43  * Exported prototypes
44  *****************************************************************************/
45 static void aout_GetPlugin( p_aout_thread_t p_aout );
46 static void vout_GetPlugin( p_vout_thread_t p_vout );
47 static void intf_GetPlugin( p_intf_thread_t p_intf );
48
49 /* Audio output */
50 int     aout_DummyOpen         ( aout_thread_t *p_aout );
51 int     aout_DummyReset        ( aout_thread_t *p_aout );
52 int     aout_DummySetFormat    ( aout_thread_t *p_aout );
53 int     aout_DummySetChannels  ( aout_thread_t *p_aout );
54 int     aout_DummySetRate      ( aout_thread_t *p_aout );
55 long    aout_DummyGetBufInfo   ( aout_thread_t *p_aout, long l_buffer_info );
56 void    aout_DummyPlaySamples  ( aout_thread_t *p_aout, byte_t *buffer,
57                                  int i_size );
58 void    aout_DummyClose        ( aout_thread_t *p_aout );
59
60 /* Video output */
61 int     vout_DummyCreate       ( vout_thread_t *p_vout, char *psz_display,
62                                  int i_root_window, void *p_data );
63 int     vout_DummyInit         ( p_vout_thread_t p_vout );
64 void    vout_DummyEnd          ( p_vout_thread_t p_vout );
65 void    vout_DummyDestroy      ( p_vout_thread_t p_vout );
66 int     vout_DummyManage       ( p_vout_thread_t p_vout );
67 void    vout_DummyDisplay      ( p_vout_thread_t p_vout );
68 void    vout_DummySetPalette   ( p_vout_thread_t p_vout,
69                                  u16 *red, u16 *green, u16 *blue, u16 *transp );
70
71 /* Interface */
72 int     intf_DummyCreate       ( p_intf_thread_t p_intf );
73 void    intf_DummyDestroy      ( p_intf_thread_t p_intf );
74 void    intf_DummyManage       ( p_intf_thread_t p_intf );
75
76 /*****************************************************************************
77  * GetConfig: get the plugin structure and configuration
78  *****************************************************************************/
79 plugin_info_t * GetConfig( void )
80 {
81     plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
82
83     p_info->psz_name    = "Dummy";
84     p_info->psz_version = VERSION;
85     p_info->psz_author  = "the VideoLAN team <vlc@videolan.org>";
86
87     p_info->aout_GetPlugin = aout_GetPlugin;
88     p_info->vout_GetPlugin = vout_GetPlugin;
89     p_info->intf_GetPlugin = intf_GetPlugin;
90     p_info->yuv_GetPlugin  = NULL;
91
92     /* The dummy plugin always works, but should have low priority */
93     p_info->i_score = 0x1;
94
95     /* If this plugin was requested, score it higher */
96     if( TestMethod( VOUT_METHOD_VAR, "dummy" ) )
97     {
98         p_info->i_score += 0x200;
99     }
100
101     /* If this plugin was requested, score it higher */
102     if( TestMethod( AOUT_METHOD_VAR, "dummy" ) )
103     {
104         p_info->i_score += 0x200;
105     }
106
107
108     return( p_info );
109 }
110
111 /*****************************************************************************
112  * Following functions are only called through the p_info structure
113  *****************************************************************************/
114
115 static void aout_GetPlugin( p_aout_thread_t p_aout )
116 {
117     p_aout->p_sys_open        = aout_DummyOpen;
118     p_aout->p_sys_reset       = aout_DummyReset;
119     p_aout->p_sys_setformat   = aout_DummySetFormat;
120     p_aout->p_sys_setchannels = aout_DummySetChannels;
121     p_aout->p_sys_setrate     = aout_DummySetRate;
122     p_aout->p_sys_getbufinfo  = aout_DummyGetBufInfo;
123     p_aout->p_sys_playsamples = aout_DummyPlaySamples;
124     p_aout->p_sys_close       = aout_DummyClose;
125 }
126
127 static void vout_GetPlugin( p_vout_thread_t p_vout )
128 {
129     p_vout->p_sys_create  = vout_DummyCreate;
130     p_vout->p_sys_init    = vout_DummyInit;
131     p_vout->p_sys_end     = vout_DummyEnd;
132     p_vout->p_sys_destroy = vout_DummyDestroy;
133     p_vout->p_sys_manage  = vout_DummyManage;
134     p_vout->p_sys_display = vout_DummyDisplay;
135 }
136
137 static void intf_GetPlugin( p_intf_thread_t p_intf )
138 {
139     p_intf->p_sys_create  = intf_DummyCreate;
140     p_intf->p_sys_destroy = intf_DummyDestroy;
141     p_intf->p_sys_manage  = intf_DummyManage;
142 }
143