2002-07-30 17:56:24 +00:00
|
|
|
6. libao2: this control audio playing
|
|
|
|
|
|
|
|
As in libvo (see 5.) also here are some drivers, based on the same API:
|
|
|
|
|
|
|
|
static int control(int cmd, int arg);
|
|
|
|
This is for reading/setting driver-specific and other special parameters.
|
|
|
|
Not really used for now.
|
|
|
|
|
|
|
|
static int init(int rate,int channels,int format,int flags);
|
|
|
|
The init of driver, opens device, sets sample rate, channels, sample format
|
|
|
|
parameters.
|
|
|
|
Sample format: usually AFMT_S16_LE or AFMT_U8, for more definitions see
|
|
|
|
dec_audio.c and linux/soundcards.h files!
|
|
|
|
|
2009-05-04 17:35:26 +00:00
|
|
|
static void uninit(void);
|
2002-07-30 17:56:24 +00:00
|
|
|
Guess what.
|
|
|
|
Ok I help: closes the device, not (yet) called when exit.
|
|
|
|
|
2009-05-04 17:35:26 +00:00
|
|
|
static void reset(void);
|
2002-07-30 17:56:24 +00:00
|
|
|
Resets device. To be exact, it's for deleting buffers' contents,
|
|
|
|
so after reset() the previously received stuff won't be output.
|
|
|
|
(called if pause or seek)
|
|
|
|
|
2009-05-04 17:35:26 +00:00
|
|
|
static int get_space(void);
|
2002-07-30 17:56:24 +00:00
|
|
|
Returns how many bytes can be written into the audio buffer without
|
2006-11-14 05:03:47 +00:00
|
|
|
blocking (making caller process wait). MPlayer occasionally checks the
|
|
|
|
remaining space and tries to fill the buffer with play() if there's free
|
|
|
|
space. The buffer size used should be sane; a buffer that is too small
|
|
|
|
could run empty before MPlayer tries filling it again (normally once per
|
|
|
|
video frame), a buffer that is too big would force MPlayer decode the file
|
|
|
|
far ahead trying to find enough audio data to fill it.
|
2002-07-30 17:56:24 +00:00
|
|
|
|
|
|
|
static int play(void* data,int len,int flags);
|
|
|
|
Plays a bit of audio, which is received throught the "data" memory area, with
|
2006-11-14 05:03:47 +00:00
|
|
|
a size of "len". It has to copy the data, because they can be overwritten
|
|
|
|
after the call is made. Doesn't have to use all the bytes; it has to
|
|
|
|
return the number of bytes used used (copied to buffer). If
|
|
|
|
flags|AOPLAY_FINAL_CHUNK is true then this is the last audio in the file.
|
|
|
|
The purpose of this flag is to tell aos that round down the audio played
|
|
|
|
from "len" to a multiple of some chunksize that this "len" should not be
|
|
|
|
rounded down to 0 or the data will never be played (as MPlayer will never
|
|
|
|
call play() with a larger len).
|
2002-07-30 17:56:24 +00:00
|
|
|
|
2009-07-06 23:26:13 +00:00
|
|
|
static float get_delay(void);
|
2002-07-30 17:56:24 +00:00
|
|
|
Returns how long time it will take to play the data currently in the
|
|
|
|
output buffer. Be exact, if possible, since the whole timing depends
|
|
|
|
on this! In the worst case, return the maximum delay.
|
|
|
|
|
|
|
|
!!! Because the video is synchronized to the audio (card), it's very important
|
2006-11-14 05:03:47 +00:00
|
|
|
!!! that the get_delay function is correctly implemented!
|
2002-07-30 17:56:24 +00:00
|
|
|
|
2006-11-14 05:03:47 +00:00
|
|
|
static void audio_pause(void);
|
|
|
|
Pause playing but do not delete buffered data if possible.
|
2002-07-30 17:56:24 +00:00
|
|
|
|
2006-11-14 05:03:47 +00:00
|
|
|
static void audio_resume(void);
|
2009-07-06 23:26:13 +00:00
|
|
|
Continue playing after audio_pause().
|