aout_dummy.c 5.48 KB
Newer Older
1 2 3
/*****************************************************************************
 * aout_dummy.c : dummy audio output plugin
 *****************************************************************************
Sam Hocevar's avatar
 
Sam Hocevar committed
4
 * Copyright (C) 2000, 2001 VideoLAN
5
 *
Sam Hocevar's avatar
 
Sam Hocevar committed
6
 * Authors: Samuel Hocevar <sam@zoy.org>
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
 *
 * 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"
Sam Hocevar's avatar
 
Sam Hocevar committed
32
#include "tests.h"
33 34 35 36 37

#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
 * 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 )
{
Sam Hocevar's avatar
 
Sam Hocevar committed
81 82 83 84 85
    if( TestMethod( AOUT_METHOD_VAR, "dummy" ) )
    {
        return( 999 );
    }

Sam Hocevar's avatar
 
Sam Hocevar committed
86 87 88 89 90 91
    /* The dummy plugin always works but give it the lower possible score */
    return( 1 );
}

/*****************************************************************************
 * aout_Open: opens a dummy audio device
92
 *****************************************************************************/
Sam Hocevar's avatar
 
Sam Hocevar committed
93
static int aout_Open( aout_thread_t *p_aout )
94 95
{
    /* Initialize some variables */
96
    p_aout->i_format = AOUT_FORMAT_DEFAULT;
Sam Hocevar's avatar
 
Sam Hocevar committed
97 98 99 100
    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 );
101 102 103 104 105

    return( 0 );
}

/*****************************************************************************
Sam Hocevar's avatar
 
Sam Hocevar committed
106
 * aout_SetFormat: pretends to set the dsp output format
107
 *****************************************************************************/
Sam Hocevar's avatar
 
Sam Hocevar committed
108
static int aout_SetFormat( aout_thread_t *p_aout )
109 110 111 112 113
{
    return( 0 );
}

/*****************************************************************************
Sam Hocevar's avatar
 
Sam Hocevar committed
114
 * aout_GetBufInfo: returns available bytes in buffer
115
 *****************************************************************************/
Sam Hocevar's avatar
 
Sam Hocevar committed
116
static long aout_GetBufInfo( aout_thread_t *p_aout, long l_buffer_limit )
117
{
118
    return( sizeof(s16) * l_buffer_limit + 1 ); /* value big enough to sleep */
119 120 121
}

/*****************************************************************************
Sam Hocevar's avatar
 
Sam Hocevar committed
122
 * aout_Play: pretends to play a sound
123
 *****************************************************************************/
Sam Hocevar's avatar
 
Sam Hocevar committed
124
static void aout_Play( aout_thread_t *p_aout, byte_t *buffer, int i_size )
125
{
126
    ;
127 128 129
}

/*****************************************************************************
Sam Hocevar's avatar
 
Sam Hocevar committed
130
 * aout_Close: closes the dummy audio device
131
 *****************************************************************************/
Sam Hocevar's avatar
 
Sam Hocevar committed
132
static void aout_Close( aout_thread_t *p_aout )
133 134 135 136
{
    ;
}