aout_dummy.c 5.26 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/*****************************************************************************
 * aout_dummy.c : dummy audio output plugin
 *****************************************************************************
 * Copyright (C) 2000 VideoLAN
 *
 * Authors:
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
 *****************************************************************************/

/*****************************************************************************
 * Preamble
 *****************************************************************************/
#include "defs.h"

#include "config.h"
#include "common.h"                                     /* boolean_t, byte_t */
#include "threads.h"
#include "mtime.h"
#include "plugins.h"

#include "audio_output.h"                                   /* aout_thread_t */

#include "main.h"

Sam Hocevar's avatar
   
Sam Hocevar committed
38
39
#include "modules.h"

40
41
42
43
44
45
46
47
48
49
50
51
/*****************************************************************************
 * vout_dummy_t: dummy video output method descriptor
 *****************************************************************************
 * This structure is part of the video output thread descriptor.
 * It describes the dummy specific properties of an output thread.
 *****************************************************************************/
typedef struct aout_sys_s
{

} aout_sys_t;

/*****************************************************************************
Sam Hocevar's avatar
   
Sam Hocevar committed
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
 * Local prototypes.
 *****************************************************************************/
static int     aout_Probe       ( probedata_t *p_data );
static int     aout_Open        ( aout_thread_t *p_aout );
static int     aout_SetFormat   ( aout_thread_t *p_aout );
static long    aout_GetBufInfo  ( aout_thread_t *p_aout, long l_buffer_info );
static void    aout_Play        ( aout_thread_t *p_aout,
                                  byte_t *buffer, int i_size );
static void    aout_Close       ( aout_thread_t *p_aout );

/*****************************************************************************
 * Functions exported as capabilities. They are declared as static so that
 * we don't pollute the namespace too much.
 *****************************************************************************/
void aout_getfunctions( function_list_t * p_function_list )
{
    p_function_list->pf_probe = aout_Probe;
    p_function_list->functions.aout.pf_open = aout_Open;
    p_function_list->functions.aout.pf_setformat = aout_SetFormat;
    p_function_list->functions.aout.pf_getbufinfo = aout_GetBufInfo;
    p_function_list->functions.aout.pf_play = aout_Play;
    p_function_list->functions.aout.pf_close = aout_Close;
}

/*****************************************************************************
 * aout_Probe: probe the audio device and return a score
 *****************************************************************************/
static int aout_Probe( probedata_t *p_data )
{
    /* The dummy plugin always works but give it the lower possible score */
    return( 1 );
}

/*****************************************************************************
 * aout_Open: opens a dummy audio device
87
 *****************************************************************************/
Sam Hocevar's avatar
   
Sam Hocevar committed
88
static int aout_Open( aout_thread_t *p_aout )
89
90
{
    /* Initialize some variables */
91
    p_aout->i_format = AOUT_FORMAT_DEFAULT;
92
93
94
95
96
97
98
    p_aout->i_channels = 1 + main_GetIntVariable( AOUT_STEREO_VAR, AOUT_STEREO_DEFAULT );
    p_aout->l_rate     = main_GetIntVariable( AOUT_RATE_VAR, AOUT_RATE_DEFAULT );

    return( 0 );
}

/*****************************************************************************
Sam Hocevar's avatar
   
Sam Hocevar committed
99
 * aout_SetFormat: pretends to set the dsp output format
100
 *****************************************************************************/
Sam Hocevar's avatar
   
Sam Hocevar committed
101
static int aout_SetFormat( aout_thread_t *p_aout )
102
103
104
105
106
{
    return( 0 );
}

/*****************************************************************************
Sam Hocevar's avatar
   
Sam Hocevar committed
107
 * aout_GetBufInfo: returns available bytes in buffer
108
 *****************************************************************************/
Sam Hocevar's avatar
   
Sam Hocevar committed
109
static long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
110
{
111
    return( sizeof(s16) * l_buffer_limit + 1 ); /* value big enough to sleep */
112
113
114
}

/*****************************************************************************
Sam Hocevar's avatar
   
Sam Hocevar committed
115
 * aout_Play: pretends to play a sound
116
 *****************************************************************************/
Sam Hocevar's avatar
   
Sam Hocevar committed
117
static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
118
{
119
    ;
120
121
122
}

/*****************************************************************************
Sam Hocevar's avatar
   
Sam Hocevar committed
123
 * aout_Close: closes the dummy audio device
124
 *****************************************************************************/
Sam Hocevar's avatar
   
Sam Hocevar committed
125
static void aout_Close( aout_thread_t *p_aout )
126
127
128
129
{
    ;
}