Mercurial > mplayer.hg
annotate DOCS/tech/libao2.txt @ 33813:a214da7104e2
Use FFMIN/FFMAX.
author | reimar |
---|---|
date | Sun, 24 Jul 2011 19:10:45 +0000 |
parents | 0f1b5b68af32 |
children |
rev | line source |
---|---|
6848 | 1 6. libao2: this control audio playing |
2 | |
3 As in libvo (see 5.) also here are some drivers, based on the same API: | |
4 | |
5 static int control(int cmd, int arg); | |
6 This is for reading/setting driver-specific and other special parameters. | |
7 Not really used for now. | |
8 | |
9 static int init(int rate,int channels,int format,int flags); | |
10 The init of driver, opens device, sets sample rate, channels, sample format | |
11 parameters. | |
12 Sample format: usually AFMT_S16_LE or AFMT_U8, for more definitions see | |
13 dec_audio.c and linux/soundcards.h files! | |
14 | |
29212
eda346733b8c
Add missing 'void' to parameterless function declarations.
diego
parents:
20891
diff
changeset
|
15 static void uninit(void); |
6848 | 16 Guess what. |
17 Ok I help: closes the device, not (yet) called when exit. | |
18 | |
29212
eda346733b8c
Add missing 'void' to parameterless function declarations.
diego
parents:
20891
diff
changeset
|
19 static void reset(void); |
6848 | 20 Resets device. To be exact, it's for deleting buffers' contents, |
21 so after reset() the previously received stuff won't be output. | |
22 (called if pause or seek) | |
23 | |
29212
eda346733b8c
Add missing 'void' to parameterless function declarations.
diego
parents:
20891
diff
changeset
|
24 static int get_space(void); |
6848 | 25 Returns how many bytes can be written into the audio buffer without |
20891
5c6111664933
Update libao2 description, delete completely outdated "audio plugins" part
uau
parents:
16894
diff
changeset
|
26 blocking (making caller process wait). MPlayer occasionally checks the |
5c6111664933
Update libao2 description, delete completely outdated "audio plugins" part
uau
parents:
16894
diff
changeset
|
27 remaining space and tries to fill the buffer with play() if there's free |
5c6111664933
Update libao2 description, delete completely outdated "audio plugins" part
uau
parents:
16894
diff
changeset
|
28 space. The buffer size used should be sane; a buffer that is too small |
5c6111664933
Update libao2 description, delete completely outdated "audio plugins" part
uau
parents:
16894
diff
changeset
|
29 could run empty before MPlayer tries filling it again (normally once per |
5c6111664933
Update libao2 description, delete completely outdated "audio plugins" part
uau
parents:
16894
diff
changeset
|
30 video frame), a buffer that is too big would force MPlayer decode the file |
5c6111664933
Update libao2 description, delete completely outdated "audio plugins" part
uau
parents:
16894
diff
changeset
|
31 far ahead trying to find enough audio data to fill it. |
6848 | 32 |
33 static int play(void* data,int len,int flags); | |
34 Plays a bit of audio, which is received throught the "data" memory area, with | |
20891
5c6111664933
Update libao2 description, delete completely outdated "audio plugins" part
uau
parents:
16894
diff
changeset
|
35 a size of "len". It has to copy the data, because they can be overwritten |
5c6111664933
Update libao2 description, delete completely outdated "audio plugins" part
uau
parents:
16894
diff
changeset
|
36 after the call is made. Doesn't have to use all the bytes; it has to |
5c6111664933
Update libao2 description, delete completely outdated "audio plugins" part
uau
parents:
16894
diff
changeset
|
37 return the number of bytes used used (copied to buffer). If |
5c6111664933
Update libao2 description, delete completely outdated "audio plugins" part
uau
parents:
16894
diff
changeset
|
38 flags|AOPLAY_FINAL_CHUNK is true then this is the last audio in the file. |
5c6111664933
Update libao2 description, delete completely outdated "audio plugins" part
uau
parents:
16894
diff
changeset
|
39 The purpose of this flag is to tell aos that round down the audio played |
5c6111664933
Update libao2 description, delete completely outdated "audio plugins" part
uau
parents:
16894
diff
changeset
|
40 from "len" to a multiple of some chunksize that this "len" should not be |
5c6111664933
Update libao2 description, delete completely outdated "audio plugins" part
uau
parents:
16894
diff
changeset
|
41 rounded down to 0 or the data will never be played (as MPlayer will never |
5c6111664933
Update libao2 description, delete completely outdated "audio plugins" part
uau
parents:
16894
diff
changeset
|
42 call play() with a larger len). |
6848 | 43 |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
44 static float get_delay(void); |
6848 | 45 Returns how long time it will take to play the data currently in the |
46 output buffer. Be exact, if possible, since the whole timing depends | |
47 on this! In the worst case, return the maximum delay. | |
48 | |
49 !!! Because the video is synchronized to the audio (card), it's very important | |
20891
5c6111664933
Update libao2 description, delete completely outdated "audio plugins" part
uau
parents:
16894
diff
changeset
|
50 !!! that the get_delay function is correctly implemented! |
6848 | 51 |
20891
5c6111664933
Update libao2 description, delete completely outdated "audio plugins" part
uau
parents:
16894
diff
changeset
|
52 static void audio_pause(void); |
5c6111664933
Update libao2 description, delete completely outdated "audio plugins" part
uau
parents:
16894
diff
changeset
|
53 Pause playing but do not delete buffered data if possible. |
6848 | 54 |
20891
5c6111664933
Update libao2 description, delete completely outdated "audio plugins" part
uau
parents:
16894
diff
changeset
|
55 static void audio_resume(void); |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
29212
diff
changeset
|
56 Continue playing after audio_pause(). |