]> git.sesse.net Git - vlc/blob - include/audio_output.h
* ./modules/audio_output/oss.c: compilation fixes.
[vlc] / include / audio_output.h
1 /*****************************************************************************
2  * audio_output.h : audio output interface
3  *****************************************************************************
4  * Copyright (C) 2002 VideoLAN
5  * $Id: audio_output.h,v 1.53 2002/08/08 00:35:10 sam Exp $
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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
22  *****************************************************************************/
23
24 /*****************************************************************************
25  * audio_sample_format_t
26  *****************************************************************************
27  * This structure defines a format for audio samples.
28  *****************************************************************************/
29 struct audio_sample_format_t
30 {
31     int                 i_format;
32     int                 i_rate;
33     int                 i_channels;
34 };
35
36 #define AOUT_FMT_MU_LAW     0x00000001
37 #define AOUT_FMT_A_LAW      0x00000002
38 #define AOUT_FMT_IMA_ADPCM  0x00000004
39 #define AOUT_FMT_U8         0x00000008
40 #define AOUT_FMT_S16_LE     0x00000010            /* Little endian signed 16 */
41 #define AOUT_FMT_S16_BE     0x00000020               /* Big endian signed 16 */
42 #define AOUT_FMT_S8         0x00000040
43 #define AOUT_FMT_U16_LE     0x00000080                  /* Little endian U16 */
44 #define AOUT_FMT_U16_BE     0x00000100                     /* Big endian U16 */
45 #define AOUT_FMT_A52        0x00000400             /* ATSC A/52 (for SP/DIF) */
46 #define AOUT_FMT_FLOAT32    0x00000800
47 #define AOUT_FMT_FIXED32    0x00001000
48
49 #define AOUT_FMTS_IDENTICAL( p_first, p_second ) (                          \
50     (p_first->i_format == p_second->i_format)                               \
51       && (p_first->i_rate == p_second->i_rate)                              \
52       && (p_first->i_channels == p_second->i_channels                       \
53            || p_first->i_channels == -1 || p_second->i_channels == -1) )
54
55 #ifdef WORDS_BIGENDIAN
56 #   define AOUT_FMT_S16_NE AOUT_FMT_S16_BE
57 #   define AOUT_FMT_U16_NE AOUT_FMT_U16_BE
58 #else
59 #   define AOUT_FMT_S16_NE AOUT_FMT_S16_LE
60 #   define AOUT_FMT_U16_NE AOUT_FMT_U16_LE
61 #endif
62
63 /*****************************************************************************
64  * aout_buffer_t : audio output buffer
65  *****************************************************************************/
66 struct aout_buffer_t
67 {
68     byte_t *                p_buffer;
69     int                     i_alloc_type;
70     size_t                  i_size;
71     int                     i_nb_samples;
72     mtime_t                 start_date, end_date;
73
74     struct aout_buffer_t *  p_next;
75 };
76
77 /*****************************************************************************
78  * Prototypes
79  *****************************************************************************/
80 /* From audio_output.c : */
81 #define aout_NewInstance(a) __aout_NewInstance(VLC_OBJECT(a))
82 VLC_EXPORT( aout_instance_t *, __aout_NewInstance,    ( vlc_object_t * ) );
83 VLC_EXPORT( void,              aout_DeleteInstance, ( aout_instance_t * ) );
84 VLC_EXPORT( aout_buffer_t *, aout_BufferNew, ( aout_instance_t *, aout_input_t *, size_t ) );
85 VLC_EXPORT( void, aout_BufferDelete, ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) );
86 VLC_EXPORT( void, aout_BufferPlay, ( aout_instance_t *, aout_input_t *, aout_buffer_t * ) );
87 VLC_EXPORT( int, aout_FormatToBytes, ( audio_sample_format_t * p_format ) );
88
89 /* From input.c : */
90 #define aout_InputNew(a,b,c) __aout_InputNew(VLC_OBJECT(a),b,c)
91 VLC_EXPORT( aout_input_t *, __aout_InputNew, ( vlc_object_t *, aout_instance_t **, audio_sample_format_t * ) );
92 VLC_EXPORT( void, aout_InputDelete, ( aout_instance_t *, aout_input_t * ) );
93
94 /* From output.c : */
95 VLC_EXPORT( aout_buffer_t *, aout_OutputNextBuffer, ( aout_instance_t *, mtime_t ) );
96