--- /dev/null
+/*\r
+ * GPAC - Multimedia Framework C SDK\r
+ *\r
+ * Copyright (c) Jean Le Feuvre 2000-2005\r
+ * All rights reserved\r
+ *\r
+ * This file is part of GPAC / modules interfaces\r
+ *\r
+ * GPAC is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2, or (at your option)\r
+ * any later version.\r
+ * \r
+ * GPAC is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; see the file COPYING. If not, write to\r
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
+ *\r
+ */\r
+\r
+\r
+/*\r
+\r
+ Note on video driver: this is not a graphics driver, the only thing requested from this driver\r
+ is accessing video memory and performing stretch of YUV and RGB on the backbuffer (bitmap node)\r
+ the graphics driver is a different entity that performs 2D rasterization\r
+\r
+*/\r
+\r
+#ifndef _GF_MODULE_AUDIO_OUT_H_\r
+#define _GF_MODULE_AUDIO_OUT_H_\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+/*include event system*/\r
+#include <gpac/module.h>\r
+\r
+\r
+/*\r
+ Audio hardware output module\r
+*/\r
+\r
+/*interface name and version for audio output*/\r
+#define GF_AUDIO_OUTPUT_INTERFACE GF_4CC('G','A','O', 0x03)\r
+\r
+/*interface returned on query interface*/\r
+typedef struct _audiooutput\r
+{\r
+ /* interface declaration*/\r
+ GF_DECL_MODULE_INTERFACE\r
+\r
+ /*setup system \r
+ Win32: os_handle is HWND\r
+\r
+ if num_buffer is set, the audio driver should work with num_buffers with a total amount of audio data\r
+ equal to total_duration ms\r
+ if not set the driver is free to decide what to do\r
+ */\r
+ GF_Err (*Setup) (struct _audiooutput *aout, void *os_handle, u32 num_buffers, u32 total_duration);\r
+\r
+ /*shutdown system */\r
+ void (*Shutdown) (struct _audiooutput *aout);\r
+\r
+ /*query output frequency available - if the requested sampleRate is not available, the driver shall return the best \r
+ possible sampleRate able to handle NbChannels and NbBitsPerSample - if it doesn't handle the NbChannels\r
+ the internal mixer will do it\r
+ */\r
+ GF_Err (*QueryOutputSampleRate)(struct _audiooutput *aout, u32 *io_desired_samplerate, u32 *io_NbChannels, u32 *io_nbBitsPerSample);\r
+\r
+ /*set output config - if audio is not running, driver must start it\r
+ *SampleRate, *NbChannels, *nbBitsPerSample: \r
+ input: desired value\r
+ output: final values\r
+ channel_cfg is the channels output cfg, eg set of flags as specified in constants.h\r
+ */\r
+ GF_Err (*ConfigureOutput) (struct _audiooutput *aout, u32 *SampleRate, u32 *NbChannels, u32 *nbBitsPerSample, u32 channel_cfg);\r
+\r
+ /*returns total buffer size used in ms. This is needed to compute the min size of audio decoders output*/\r
+ u32 (*GetTotalBufferTime)(struct _audiooutput *aout);\r
+\r
+ /*returns audio delay in ms, eg time delay until written audio data is outputed by the sound card\r
+ This function is only called after ConfigureOuput*/ \r
+ u32 (*GetAudioDelay)(struct _audiooutput *aout);\r
+\r
+ /*set output volume(between 0 and 100) */\r
+ void (*SetVolume) (struct _audiooutput *aout, u32 Volume);\r
+ /*set balance (between 0 and 100, 0=full left, 100=full right)*/\r
+ void (*SetPan) (struct _audiooutput *aout, u32 pan);\r
+ /*freezes soundcard flow - must not be NULL for self threaded\r
+ PlayType: 0: pause, 1: resume, 2: reset HW buffer and play.\r
+ */\r
+ void (*Play) (struct _audiooutput *aout, u32 PlayType);\r
+ /*specifies whether the driver relies on the app to feed data or runs standalone*/\r
+ Bool SelfThreaded;\r
+\r
+ /*if not using private thread, this should perform sleep & fill of HW buffer\r
+ the audio render loop in this case is: while (run) {driver->WriteAudio(); if (reconf) Reconfig();}\r
+ the driver must therefore give back the hand to the renderer as often as possible - the usual way is:\r
+ gf_sleep untill hw data can be written\r
+ write HW data\r
+ return\r
+ */\r
+ void (*WriteAudio)(struct _audiooutput *aout);\r
+\r
+ /*if using private thread the following MUST be provided*/\r
+ void (*SetPriority)(struct _audiooutput *aout, u32 priority);\r
+\r
+ /*your private data handler - should be allocated when creating the interface object*/\r
+ void *opaque;\r
+ \r
+ /*these are assigned by the audio renderer once module is loaded*/\r
+ \r
+ /*fills the buffer with audio data, returns effective bytes written - the rest is filled with 0*/\r
+ u32 (*FillBuffer) (void *audio_renderer, char *buffer, u32 buffer_size);\r
+ void *audio_renderer;\r
+\r
+} GF_AudioOutput;\r
+\r
+\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+\r
+#endif /*_GF_MODULE_AUDIO_OUT_H_*/\r
+\r