OSDN Git Service

stop using trunk directory in rectool
[rec10/rec10-git.git] / tstools / DtsEdit / src / gpac / modules / audio_out.h
1 /*\r
2  *                      GPAC - Multimedia Framework C SDK\r
3  *\r
4  *                      Copyright (c) Jean Le Feuvre 2000-2005\r
5  *                                      All rights reserved\r
6  *\r
7  *  This file is part of GPAC / modules interfaces\r
8  *\r
9  *  GPAC is free software; you can redistribute it and/or modify\r
10  *  it under the terms of the GNU Lesser General Public License as published by\r
11  *  the Free Software Foundation; either version 2, or (at your option)\r
12  *  any later version.\r
13  *   \r
14  *  GPAC is distributed in the hope that it will be useful,\r
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
17  *  GNU Lesser General Public License for more details.\r
18  *   \r
19  *  You should have received a copy of the GNU Lesser General Public\r
20  *  License along with this library; see the file COPYING.  If not, write to\r
21  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
22  *\r
23  */\r
24 \r
25 \r
26 /*\r
27 \r
28                 Note on video driver: this is not a graphics driver, the only thing requested from this driver\r
29         is accessing video memory and performing stretch of YUV and RGB on the backbuffer (bitmap node)\r
30         the graphics driver is a different entity that performs 2D rasterization\r
31 \r
32 */\r
33 \r
34 #ifndef _GF_MODULE_AUDIO_OUT_H_\r
35 #define _GF_MODULE_AUDIO_OUT_H_\r
36 \r
37 #ifdef __cplusplus\r
38 extern "C" {\r
39 #endif\r
40 \r
41 /*include event system*/\r
42 #include <gpac/module.h>\r
43 \r
44 \r
45 /*\r
46         Audio hardware output module\r
47 */\r
48 \r
49 /*interface name and version for audio output*/\r
50 #define GF_AUDIO_OUTPUT_INTERFACE               GF_4CC('G','A','O', 0x03)\r
51 \r
52 /*interface returned on query interface*/\r
53 typedef struct _audiooutput\r
54 {\r
55         /* interface declaration*/\r
56         GF_DECL_MODULE_INTERFACE\r
57 \r
58         /*setup system \r
59                 Win32: os_handle is HWND\r
60 \r
61         if num_buffer is set, the audio driver should work with num_buffers with a total amount of audio data\r
62         equal to total_duration ms\r
63         if not set the driver is free to decide what to do\r
64         */\r
65         GF_Err (*Setup) (struct _audiooutput *aout, void *os_handle, u32 num_buffers, u32 total_duration);\r
66 \r
67         /*shutdown system */\r
68         void (*Shutdown) (struct _audiooutput *aout);\r
69 \r
70         /*query output frequency available - if the requested sampleRate is not available, the driver shall return the best \r
71         possible sampleRate able to handle NbChannels and NbBitsPerSample - if it doesn't handle the NbChannels\r
72         the internal mixer will do it\r
73         */\r
74         GF_Err (*QueryOutputSampleRate)(struct _audiooutput *aout, u32 *io_desired_samplerate, u32 *io_NbChannels, u32 *io_nbBitsPerSample);\r
75 \r
76         /*set output config - if audio is not running, driver must start it\r
77         *SampleRate, *NbChannels, *nbBitsPerSample: \r
78                 input: desired value\r
79                 output: final values\r
80         channel_cfg is the channels output cfg, eg set of flags as specified in constants.h\r
81         */\r
82         GF_Err (*ConfigureOutput) (struct _audiooutput *aout, u32 *SampleRate, u32 *NbChannels, u32 *nbBitsPerSample, u32 channel_cfg);\r
83 \r
84         /*returns total buffer size used in ms. This is needed to compute the min size of audio decoders output*/\r
85         u32 (*GetTotalBufferTime)(struct _audiooutput *aout);\r
86 \r
87         /*returns audio delay in ms, eg time delay until written audio data is outputed by the sound card\r
88         This function is only called after ConfigureOuput*/ \r
89         u32 (*GetAudioDelay)(struct _audiooutput *aout);\r
90 \r
91         /*set output volume(between 0 and 100) */\r
92         void (*SetVolume) (struct _audiooutput *aout, u32 Volume);\r
93         /*set balance (between 0 and 100, 0=full left, 100=full right)*/\r
94         void (*SetPan) (struct _audiooutput *aout, u32 pan);\r
95         /*freezes soundcard flow - must not be NULL for self threaded\r
96                 PlayType: 0: pause, 1: resume, 2: reset HW buffer and play.\r
97         */\r
98         void (*Play) (struct _audiooutput *aout, u32 PlayType);\r
99         /*specifies whether the driver relies on the app to feed data or runs standalone*/\r
100         Bool SelfThreaded;\r
101 \r
102         /*if not using private thread, this should perform sleep & fill of HW buffer\r
103                 the audio render loop in this case is: while (run) {driver->WriteAudio(); if (reconf) Reconfig();}\r
104         the driver must therefore give back the hand to the renderer as often as possible - the usual way is:\r
105                 gf_sleep untill hw data can be written\r
106                 write HW data\r
107                 return\r
108         */\r
109         void (*WriteAudio)(struct _audiooutput *aout);\r
110 \r
111         /*if using private thread the following MUST be provided*/\r
112         void (*SetPriority)(struct _audiooutput *aout, u32 priority);\r
113 \r
114         /*your private data handler - should be allocated when creating the interface object*/\r
115         void *opaque;\r
116         \r
117         /*these are assigned by the audio renderer once module is loaded*/\r
118         \r
119         /*fills the buffer with audio data, returns effective bytes written - the rest is filled with 0*/\r
120         u32 (*FillBuffer) (void *audio_renderer, char *buffer, u32 buffer_size);\r
121         void *audio_renderer;\r
122 \r
123 } GF_AudioOutput;\r
124 \r
125 \r
126 \r
127 #ifdef __cplusplus\r
128 }\r
129 #endif\r
130 \r
131 \r
132 #endif  /*_GF_MODULE_AUDIO_OUT_H_*/\r
133 \r