Mercurial > mplayer.hg
annotate DOCS/tech/libao2.txt @ 28287:dbebb78dda3c
Add VDPAU hardware accelerated decoding for MPEG1 and MPEG2 which will
be used by MPlayer.
Original patch by NVIDIA corporation.
author | cehoyos |
---|---|
date | Fri, 16 Jan 2009 02:14:25 +0000 |
parents | 5c6111664933 |
children | eda346733b8c |
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 | |
15 static void uninit(); | |
16 Guess what. | |
17 Ok I help: closes the device, not (yet) called when exit. | |
18 | |
19 static void reset(); | |
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 | |
24 static int get_space(); | |
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 |
44 static float get_delay(); | |
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); |
5c6111664933
Update libao2 description, delete completely outdated "audio plugins" part
uau
parents:
16894
diff
changeset
|
56 Continue playing after audio_pause(). |