1 /*****************************************************************************
2 * aout_dummy.c : dummy audio output plugin
3 *****************************************************************************
4 * Copyright (C) 2000, 2001 VideoLAN
5 * $Id: aout_dummy.c,v 1.11 2001/05/30 17:03:12 sam Exp $
7 * Authors: Samuel Hocevar <sam@zoy.org>
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.
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.
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 *****************************************************************************/
24 #define MODULE_NAME dummy
25 #include "modules_inner.h"
27 /*****************************************************************************
29 *****************************************************************************/
33 #include "common.h" /* boolean_t, byte_t */
38 #include "audio_output.h" /* aout_thread_t */
43 #include "modules_export.h"
45 /*****************************************************************************
46 * vout_dummy_t: dummy video output method descriptor
47 *****************************************************************************
48 * This structure is part of the video output thread descriptor.
49 * It describes the dummy specific properties of an output thread.
50 *****************************************************************************/
51 typedef struct aout_sys_s
56 /*****************************************************************************
58 *****************************************************************************/
59 static int aout_Probe ( probedata_t *p_data );
60 static int aout_Open ( aout_thread_t *p_aout );
61 static int aout_SetFormat ( aout_thread_t *p_aout );
62 static long aout_GetBufInfo ( aout_thread_t *p_aout, long l_buffer_info );
63 static void aout_Play ( aout_thread_t *p_aout,
64 byte_t *buffer, int i_size );
65 static void aout_Close ( aout_thread_t *p_aout );
67 /*****************************************************************************
68 * Functions exported as capabilities. They are declared as static so that
69 * we don't pollute the namespace too much.
70 *****************************************************************************/
71 void _M( aout_getfunctions )( function_list_t * p_function_list )
73 p_function_list->pf_probe = aout_Probe;
74 p_function_list->functions.aout.pf_open = aout_Open;
75 p_function_list->functions.aout.pf_setformat = aout_SetFormat;
76 p_function_list->functions.aout.pf_getbufinfo = aout_GetBufInfo;
77 p_function_list->functions.aout.pf_play = aout_Play;
78 p_function_list->functions.aout.pf_close = aout_Close;
81 /*****************************************************************************
82 * aout_Probe: probe the audio device and return a score
83 *****************************************************************************/
84 static int aout_Probe( probedata_t *p_data )
86 if( TestMethod( AOUT_METHOD_VAR, "dummy" ) )
91 /* The dummy plugin always works but give it the lower possible score */
95 /*****************************************************************************
96 * aout_Open: opens a dummy audio device
97 *****************************************************************************/
98 static int aout_Open( aout_thread_t *p_aout )
100 /* Initialize some variables */
101 p_aout->i_format = AOUT_FORMAT_DEFAULT;
102 p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR,
103 AOUT_STEREO_DEFAULT );
104 p_aout->l_rate = main_GetIntVariable( AOUT_RATE_VAR,
110 /*****************************************************************************
111 * aout_SetFormat: pretends to set the dsp output format
112 *****************************************************************************/
113 static int aout_SetFormat( aout_thread_t *p_aout )
118 /*****************************************************************************
119 * aout_GetBufInfo: returns available bytes in buffer
120 *****************************************************************************/
121 static long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
123 return( sizeof(s16) * l_buffer_limit + 1 ); /* value big enough to sleep */
126 /*****************************************************************************
127 * aout_Play: pretends to play a sound
128 *****************************************************************************/
129 static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
134 /*****************************************************************************
135 * aout_Close: closes the dummy audio device
136 *****************************************************************************/
137 static void aout_Close( aout_thread_t *p_aout )