annotate DOCS/tech/libao2.txt @ 29583:c990a2cbfa8d

Fix several more rtsp-related memleaks.
author reimar
date Wed, 02 Sep 2009 10:44:26 +0000
parents 0f1b5b68af32
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6848
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
1 6. libao2: this control audio playing
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
2
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
3 As in libvo (see 5.) also here are some drivers, based on the same API:
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
4
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
5 static int control(int cmd, int arg);
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
6 This is for reading/setting driver-specific and other special parameters.
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
7 Not really used for now.
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
8
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
9 static int init(int rate,int channels,int format,int flags);
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
10 The init of driver, opens device, sets sample rate, channels, sample format
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
11 parameters.
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
12 Sample format: usually AFMT_S16_LE or AFMT_U8, for more definitions see
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
13 dec_audio.c and linux/soundcards.h files!
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
14
29212
eda346733b8c Add missing 'void' to parameterless function declarations.
diego
parents: 20891
diff changeset
15 static void uninit(void);
6848
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
16 Guess what.
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
17 Ok I help: closes the device, not (yet) called when exit.
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
18
29212
eda346733b8c Add missing 'void' to parameterless function declarations.
diego
parents: 20891
diff changeset
19 static void reset(void);
6848
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
20 Resets device. To be exact, it's for deleting buffers' contents,
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
21 so after reset() the previously received stuff won't be output.
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
22 (called if pause or seek)
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
23
29212
eda346733b8c Add missing 'void' to parameterless function declarations.
diego
parents: 20891
diff changeset
24 static int get_space(void);
6848
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
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
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
32
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
33 static int play(void* data,int len,int flags);
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
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
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
43
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 29212
diff changeset
44 static float get_delay(void);
6848
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
45 Returns how long time it will take to play the data currently in the
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
46 output buffer. Be exact, if possible, since the whole timing depends
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
47 on this! In the worst case, return the maximum delay.
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
48
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
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
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
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
4846c53f548d libao2 stuff move dto libao2.txt
arpi
parents:
diff changeset
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().