aout.c 2.93 KB
Newer Older
1
/*****************************************************************************
sebastien's avatar
Typo  
sebastien committed
2
 * aout.c : dummy audio output plugin
3
 *****************************************************************************
4
 * Copyright (C) 2002 the VideoLAN team
5
 * $Id$
6
 *
7
 * Authors: Christophe Massiot <massiot@via.ecp.fr>
8 9 10 11 12
 *
 * 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.
13
 *
14 15 16 17 18 19 20
 * 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
dionoea's avatar
dionoea committed
21
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 23 24 25 26 27
 *****************************************************************************/

/*****************************************************************************
 * Preamble
 *****************************************************************************/

28 29 30 31
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

32
#include <vlc_common.h>
zorglub's avatar
zorglub committed
33
#include <vlc_aout.h>
34
#include <vlc_cpu.h>
35

zorglub's avatar
zorglub committed
36 37
#include "dummy.h"

38
#define FRAME_SIZE 2048
39
#define A52_FRAME_NB 1536
40

41 42 43
/*****************************************************************************
 * Local prototypes.
 *****************************************************************************/
44
static void    Play        ( audio_output_t * );
45 46

/*****************************************************************************
47
 * OpenAudio: open a dummy audio device
48
 *****************************************************************************/
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
49
int OpenAudio ( vlc_object_t * p_this )
50
{
51
    audio_output_t * p_aout = (audio_output_t *)p_this;
52

53 54
    p_aout->pf_play = Play;
    p_aout->pf_pause = NULL;
55
    p_aout->pf_flush = NULL;
56
    aout_VolumeSoftInit( p_aout );
57

58
    if( AOUT_FMT_NON_LINEAR( &p_aout->format )
59
     && var_InheritBool( p_this, "spdif" ) )
60
    {
61 62 63
        p_aout->format.i_format = VLC_CODEC_SPDIFL;
        p_aout->format.i_bytes_per_frame = AOUT_SPDIF_SIZE;
        p_aout->format.i_frame_length = A52_FRAME_NB;
64 65
    }
    else
66 67
        p_aout->format.i_format = HAVE_FPU ? VLC_CODEC_FL32 : VLC_CODEC_S16N;
    p_aout->i_nb_samples = A52_FRAME_NB;
68 69 70 71 72

    /* Create the variable for the audio-device */
    var_Create( p_aout, "audio-device", VLC_VAR_INTEGER | VLC_VAR_HASCHOICE );

    return VLC_SUCCESS;
73 74 75
}

/*****************************************************************************
76
 * Play: pretend to play a sound
77
 *****************************************************************************/
78
static void Play( audio_output_t * p_aout )
79
{
80
    aout_buffer_t * p_buffer = aout_FifoPop( &p_aout->fifo );
81
    aout_BufferFree( p_buffer );
82 83
}