]> git.sesse.net Git - vlc/blob - plugins/dummy/aout_dummy.c
* Ported Glide and MGA plugins to the new module API. MGA never worked,
[vlc] / plugins / dummy / aout_dummy.c
1 /*****************************************************************************
2  * aout_dummy.c : dummy audio output 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 "config.h"
32 #include "common.h"                                     /* boolean_t, byte_t */
33 #include "threads.h"
34 #include "mtime.h"
35 #include "tests.h"
36
37 #include "audio_output.h"                                   /* aout_thread_t */
38
39 #include "main.h"
40
41 #include "modules.h"
42
43 /*****************************************************************************
44  * vout_dummy_t: dummy video output method descriptor
45  *****************************************************************************
46  * This structure is part of the video output thread descriptor.
47  * It describes the dummy specific properties of an output thread.
48  *****************************************************************************/
49 typedef struct aout_sys_s
50 {
51
52 } aout_sys_t;
53
54 /*****************************************************************************
55  * Local prototypes.
56  *****************************************************************************/
57 static int     aout_Probe       ( probedata_t *p_data );
58 static int     aout_Open        ( aout_thread_t *p_aout );
59 static int     aout_SetFormat   ( aout_thread_t *p_aout );
60 static long    aout_GetBufInfo  ( aout_thread_t *p_aout, long l_buffer_info );
61 static void    aout_Play        ( aout_thread_t *p_aout,
62                                   byte_t *buffer, int i_size );
63 static void    aout_Close       ( aout_thread_t *p_aout );
64
65 /*****************************************************************************
66  * Functions exported as capabilities. They are declared as static so that
67  * we don't pollute the namespace too much.
68  *****************************************************************************/
69 void _M( aout_getfunctions )( function_list_t * p_function_list )
70 {
71     p_function_list->pf_probe = aout_Probe;
72     p_function_list->functions.aout.pf_open = aout_Open;
73     p_function_list->functions.aout.pf_setformat = aout_SetFormat;
74     p_function_list->functions.aout.pf_getbufinfo = aout_GetBufInfo;
75     p_function_list->functions.aout.pf_play = aout_Play;
76     p_function_list->functions.aout.pf_close = aout_Close;
77 }
78
79 /*****************************************************************************
80  * aout_Probe: probe the audio device and return a score
81  *****************************************************************************/
82 static int aout_Probe( probedata_t *p_data )
83 {
84     if( TestMethod( AOUT_METHOD_VAR, "dummy" ) )
85     {
86         return( 999 );
87     }
88
89     /* The dummy plugin always works but give it the lower possible score */
90     return( 1 );
91 }
92
93 /*****************************************************************************
94  * aout_Open: opens a dummy audio device
95  *****************************************************************************/
96 static int aout_Open( aout_thread_t *p_aout )
97 {
98     /* Initialize some variables */
99     p_aout->i_format = AOUT_FORMAT_DEFAULT;
100     p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR,
101                                                   AOUT_STEREO_DEFAULT );
102     p_aout->l_rate     =     main_GetIntVariable( AOUT_RATE_VAR,
103                                                   AOUT_RATE_DEFAULT );
104
105     return( 0 );
106 }
107
108 /*****************************************************************************
109  * aout_SetFormat: pretends to set the dsp output format
110  *****************************************************************************/
111 static int aout_SetFormat( aout_thread_t *p_aout )
112 {
113     return( 0 );
114 }
115
116 /*****************************************************************************
117  * aout_GetBufInfo: returns available bytes in buffer
118  *****************************************************************************/
119 static long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
120 {
121     return( sizeof(s16) * l_buffer_limit + 1 ); /* value big enough to sleep */
122 }
123
124 /*****************************************************************************
125  * aout_Play: pretends to play a sound
126  *****************************************************************************/
127 static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
128 {
129     ;
130 }
131
132 /*****************************************************************************
133  * aout_Close: closes the dummy audio device
134  *****************************************************************************/
135 static void aout_Close( aout_thread_t *p_aout )
136 {
137     ;
138 }
139