]> git.sesse.net Git - vlc/blob - src/audio_output/aout_internal.h
Compile fixes, round 1
[vlc] / src / audio_output / aout_internal.h
1 /*****************************************************************************
2  * aout_internal.h : internal defines for audio output
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 #if defined( __APPLE__ ) || defined( SYS_BSD )
25 #undef HAVE_ALLOCA
26 #endif
27
28 #ifdef HAVE_ALLOCA
29 #   define ALLOCA_TEST( p_alloc, p_new_buffer )                             \
30         if ( (p_alloc)->i_alloc_type == AOUT_ALLOC_STACK )                  \
31         {                                                                   \
32             (p_new_buffer) = alloca( i_alloc_size + sizeof(aout_buffer_t) );\
33             i_alloc_type = AOUT_ALLOC_STACK;                                \
34         }                                                                   \
35         else
36 #else
37 #   define ALLOCA_TEST( p_alloc, p_new_buffer )
38 #endif
39
40 #define aout_BufferAlloc( p_alloc, i_nb_usec, p_previous_buffer,            \
41                           p_new_buffer )                                    \
42     if ( (p_alloc)->i_alloc_type == AOUT_ALLOC_NONE )                       \
43     {                                                                       \
44         (p_new_buffer) = p_previous_buffer;                                 \
45     }                                                                       \
46     else                                                                    \
47     {                                                                       \
48         int i_alloc_size, i_alloc_type;                                     \
49         i_alloc_size = (int)( (uint64_t)(p_alloc)->i_bytes_per_sec          \
50                                             * (i_nb_usec) / 1000000 + 1 );  \
51         ALLOCA_TEST( p_alloc, p_new_buffer )                                \
52         {                                                                   \
53             (p_new_buffer) = malloc( i_alloc_size + sizeof(aout_buffer_t) );\
54             i_alloc_type = AOUT_ALLOC_HEAP;                                 \
55         }                                                                   \
56         if ( p_new_buffer != NULL )                                         \
57         {                                                                   \
58             (p_new_buffer)->i_alloc_type = i_alloc_type;                    \
59             (p_new_buffer)->i_size = i_alloc_size;                          \
60             (p_new_buffer)->p_buffer = (byte_t *)(p_new_buffer)             \
61                                          + sizeof(aout_buffer_t);           \
62             if ( (p_previous_buffer) != NULL )                              \
63             {                                                               \
64                 (p_new_buffer)->start_date =                                \
65                            ((aout_buffer_t *)p_previous_buffer)->start_date;\
66                 (p_new_buffer)->end_date =                                  \
67                            ((aout_buffer_t *)p_previous_buffer)->end_date;  \
68             }                                                               \
69         }                                                                   \
70         /* we'll keep that for a while --Meuuh */                           \
71         /* else printf("%s:%d\n", __FILE__, __LINE__); */                   \
72     }
73
74 /****************************************************************************
75  * Prototypes
76  *****************************************************************************/
77 /* From input.c : */
78 int aout_InputNew( aout_instance_t * p_aout, aout_input_t * p_input );
79 int aout_InputDelete( aout_instance_t * p_aout, aout_input_t * p_input );
80 int aout_InputPlay( aout_instance_t * p_aout, aout_input_t * p_input,
81                     aout_buffer_t * p_buffer );
82
83 /* From filters.c : */
84 int aout_FiltersCreatePipeline ( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int * pi_nb_filters, const audio_sample_format_t * p_input_format, const audio_sample_format_t * p_output_format );
85 void aout_FiltersDestroyPipeline ( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int i_nb_filters );
86 void  aout_FiltersPlay ( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int i_nb_filters, aout_buffer_t ** pp_input_buffer );
87 void aout_FiltersHintBuffers( aout_instance_t * p_aout, aout_filter_t ** pp_filters, int i_nb_filters, aout_alloc_t * p_first_alloc );
88
89 /* From mixer.c : */
90 int aout_MixerNew( aout_instance_t * p_aout );
91 void aout_MixerDelete( aout_instance_t * p_aout );
92 void aout_MixerRun( aout_instance_t * p_aout );
93 int aout_MixerMultiplierSet( aout_instance_t * p_aout, float f_multiplier );
94 int aout_MixerMultiplierGet( aout_instance_t * p_aout, float * pf_multiplier );
95
96 /* From output.c : */
97 int aout_OutputNew( aout_instance_t * p_aout,
98                     audio_sample_format_t * p_format );
99 void aout_OutputPlay( aout_instance_t * p_aout, aout_buffer_t * p_buffer );
100 void aout_OutputDelete( aout_instance_t * p_aout );
101
102
103 /* From common.c : */
104 #define aout_New(a) __aout_New(VLC_OBJECT(a))
105 aout_instance_t * __aout_New ( vlc_object_t * );
106 void aout_Delete ( aout_instance_t * );
107
108 void aout_FifoInit( aout_instance_t *, aout_fifo_t *, uint32_t );
109 mtime_t aout_FifoNextStart( aout_instance_t *, aout_fifo_t * );
110 void aout_FifoPush( aout_instance_t *, aout_fifo_t *, aout_buffer_t * );
111 void aout_FifoSet( aout_instance_t *, aout_fifo_t *, mtime_t );
112 void aout_FifoMoveDates( aout_instance_t *, aout_fifo_t *, mtime_t );
113 void aout_FifoDestroy( aout_instance_t * p_aout, aout_fifo_t * p_fifo );
114 void aout_FormatsPrint( aout_instance_t * p_aout, const char * psz_text, const audio_sample_format_t * p_format1, const audio_sample_format_t * p_format2 );
115
116
117 /* From intf.c :*/
118 int aout_VolumeSoftGet( aout_instance_t *, audio_volume_t * );
119 int aout_VolumeSoftSet( aout_instance_t *, audio_volume_t );
120 int aout_VolumeSoftInfos( aout_instance_t *, audio_volume_t * );
121 int aout_VolumeNoneGet( aout_instance_t *, audio_volume_t * );
122 int aout_VolumeNoneSet( aout_instance_t *, audio_volume_t );
123 int aout_VolumeNoneInfos( aout_instance_t *, audio_volume_t * );
124
125 /* From dec.c */
126 #define aout_DecNew(a, b, c) __aout_DecNew(VLC_OBJECT(a), b, c)
127 aout_input_t * __aout_DecNew( vlc_object_t *, aout_instance_t **, audio_sample_format_t * );
128 int aout_DecDelete ( aout_instance_t *, aout_input_t * );
129 aout_buffer_t * aout_DecNewBuffer( aout_instance_t *, aout_input_t *, size_t );
130 void aout_DecDeleteBuffer( aout_instance_t *, aout_input_t *, aout_buffer_t * );
131 int aout_DecPlay( aout_instance_t *, aout_input_t *, aout_buffer_t * );
132