]> git.sesse.net Git - vlc/blob - modules/misc/dummy/aout.c
e826dc5d69e6bfbf1c27df31211cedafd458b27a
[vlc] / modules / misc / dummy / aout.c
1 /*****************************************************************************
2  * aout_dummy.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  * 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., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * Preamble
26  *****************************************************************************/
27
28 #include <vlc/vlc.h>
29 #include <vlc_aout.h>
30
31 #include "dummy.h"
32
33 #define FRAME_SIZE 2048
34 #define A52_FRAME_NB 1536
35
36 /*****************************************************************************
37  * Local prototypes.
38  *****************************************************************************/
39 static void    Play        ( aout_instance_t * );
40
41 /*****************************************************************************
42  * OpenAudio: open a dummy audio device
43  *****************************************************************************/
44 int E_(OpenAudio) ( vlc_object_t * p_this )
45 {
46     aout_instance_t * p_aout = (aout_instance_t *)p_this;
47
48     p_aout->output.pf_play = Play;
49     aout_VolumeSoftInit( p_aout );
50
51     if ( p_aout->output.output.i_format == VLC_FOURCC('s','p','d','i') )
52     {
53         p_aout->output.i_nb_samples = A52_FRAME_NB;
54         p_aout->output.output.i_bytes_per_frame = AOUT_SPDIF_SIZE;
55         p_aout->output.output.i_frame_length = A52_FRAME_NB;
56     }
57     else
58     {
59         p_aout->output.i_nb_samples = FRAME_SIZE;
60     }
61     return 0;
62 }
63
64 /*****************************************************************************
65  * Play: pretend to play a sound
66  *****************************************************************************/
67 static void Play( aout_instance_t * p_aout )
68 {
69     aout_buffer_t * p_buffer = aout_FifoPop( p_aout, &p_aout->output.fifo );
70     aout_BufferFree( p_buffer );
71 }
72