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