Mercurial > mplayer.hg
annotate libao2/ao_arts.c @ 16946:47c5e9846cd3
ultra simple&slow pp filter, yes yet another spp like filter :)
this one does actually compress&decompress the video at various shifts with lavc while the other spp filters are doing optimized intra only filtering
limitations:
mpeg4 is hardcoded, all options too, pretty trivial to change though, even filtering with non dct codecs like snow could be tried ...
the qscale/qp is only taken fron the first MB of each image and then used for the whole image (would needs some small changes to lavc to let the user set the qscales for the mbs themselfs but iam to lazy ...)
this needs ALOT of cpu time and memory especially at uspp=8 ...
author | michael |
---|---|
date | Tue, 08 Nov 2005 13:15:19 +0000 |
parents | cae0dbeb44bb |
children | f580a7755ac5 |
rev | line source |
---|---|
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
1 /* |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
2 * ao_arts - aRts audio output driver for MPlayer |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
3 * |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
4 * Michele Balistreri <brain87@gmx.net> |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
5 * |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
6 * This driver is distribuited under terms of GPL |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
7 * |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
8 */ |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
9 |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
10 #include <artsc.h> |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
11 #include <stdio.h> |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
12 |
14479 | 13 #include "config.h" |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
14 #include "audio_out.h" |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
15 #include "audio_out_internal.h" |
14245 | 16 #include "libaf/af_format.h" |
14123 | 17 #include "mp_msg.h" |
18 #include "help_mp.h" | |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
19 |
14245 | 20 #define OBTAIN_BITRATE(a) (((a != AF_FORMAT_U8) && (a != AF_FORMAT_S8)) ? 16 : 8) |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
21 |
6807
ae2f3cdcb462
Improved ao_arts delay and buff er handling, patch by Szombathelyi Gy|rgy <gyurco@freemail.hu>
atmos4
parents:
6214
diff
changeset
|
22 /* Feel free to experiment with the following values: */ |
ae2f3cdcb462
Improved ao_arts delay and buff er handling, patch by Szombathelyi Gy|rgy <gyurco@freemail.hu>
atmos4
parents:
6214
diff
changeset
|
23 #define ARTS_PACKETS 10 /* Number of audio packets */ |
ae2f3cdcb462
Improved ao_arts delay and buff er handling, patch by Szombathelyi Gy|rgy <gyurco@freemail.hu>
atmos4
parents:
6214
diff
changeset
|
24 #define ARTS_PACKET_SIZE_LOG2 11 /* Log2 of audio packet size */ |
ae2f3cdcb462
Improved ao_arts delay and buff er handling, patch by Szombathelyi Gy|rgy <gyurco@freemail.hu>
atmos4
parents:
6214
diff
changeset
|
25 |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
26 static arts_stream_t stream; |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
27 |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
28 static ao_info_t info = |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
29 { |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
30 "aRts audio output", |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
31 "arts", |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
32 "Michele Balistreri <brain87@gmx.net>", |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
33 "" |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
34 }; |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
35 |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
36 LIBAO_EXTERN(arts) |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
37 |
9633
12b1790038b0
64bit libao2 fix by Jens Axboe <mplayer-dev@kernel.dk>
alex
parents:
8576
diff
changeset
|
38 static int control(int cmd, void *arg) |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
39 { |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
40 return(CONTROL_UNKNOWN); |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
41 } |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
42 |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
43 static int init(int rate_hz, int channels, int format, int flags) |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
44 { |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
45 int err; |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
46 int frag_spec; |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
47 |
8123
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
6807
diff
changeset
|
48 if( (err=arts_init()) ) { |
13383
c1955840883d
mp_msg transition of unmaintained audio output drivers.
ivo
parents:
12984
diff
changeset
|
49 mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ARTS_CantInit, arts_error_text(err)); |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
50 return 0; |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
51 } |
13383
c1955840883d
mp_msg transition of unmaintained audio output drivers.
ivo
parents:
12984
diff
changeset
|
52 mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_ARTS_ServerConnect); |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
53 |
8576
ed132c268686
- Fix 8-bit sound in arts audio driver (logic in OBTAIN_BITRATE macro was
jkeil
parents:
8123
diff
changeset
|
54 /* |
ed132c268686
- Fix 8-bit sound in arts audio driver (logic in OBTAIN_BITRATE macro was
jkeil
parents:
8123
diff
changeset
|
55 * arts supports 8bit unsigned and 16bit signed sample formats |
ed132c268686
- Fix 8-bit sound in arts audio driver (logic in OBTAIN_BITRATE macro was
jkeil
parents:
8123
diff
changeset
|
56 * (16bit apparently in little endian format, even in the case |
ed132c268686
- Fix 8-bit sound in arts audio driver (logic in OBTAIN_BITRATE macro was
jkeil
parents:
8123
diff
changeset
|
57 * when artsd runs on a big endian cpu). |
ed132c268686
- Fix 8-bit sound in arts audio driver (logic in OBTAIN_BITRATE macro was
jkeil
parents:
8123
diff
changeset
|
58 * |
ed132c268686
- Fix 8-bit sound in arts audio driver (logic in OBTAIN_BITRATE macro was
jkeil
parents:
8123
diff
changeset
|
59 * Unsupported formats are translated to one of these two formats |
ed132c268686
- Fix 8-bit sound in arts audio driver (logic in OBTAIN_BITRATE macro was
jkeil
parents:
8123
diff
changeset
|
60 * using mplayer's audio filters. |
ed132c268686
- Fix 8-bit sound in arts audio driver (logic in OBTAIN_BITRATE macro was
jkeil
parents:
8123
diff
changeset
|
61 */ |
ed132c268686
- Fix 8-bit sound in arts audio driver (logic in OBTAIN_BITRATE macro was
jkeil
parents:
8123
diff
changeset
|
62 switch (format) { |
14245 | 63 case AF_FORMAT_U8: |
64 case AF_FORMAT_S8: | |
65 format = AF_FORMAT_U8; | |
8576
ed132c268686
- Fix 8-bit sound in arts audio driver (logic in OBTAIN_BITRATE macro was
jkeil
parents:
8123
diff
changeset
|
66 break; |
ed132c268686
- Fix 8-bit sound in arts audio driver (logic in OBTAIN_BITRATE macro was
jkeil
parents:
8123
diff
changeset
|
67 default: |
14245 | 68 format = AF_FORMAT_S16_LE; /* artsd always expects little endian?*/ |
8576
ed132c268686
- Fix 8-bit sound in arts audio driver (logic in OBTAIN_BITRATE macro was
jkeil
parents:
8123
diff
changeset
|
69 break; |
ed132c268686
- Fix 8-bit sound in arts audio driver (logic in OBTAIN_BITRATE macro was
jkeil
parents:
8123
diff
changeset
|
70 } |
ed132c268686
- Fix 8-bit sound in arts audio driver (logic in OBTAIN_BITRATE macro was
jkeil
parents:
8123
diff
changeset
|
71 |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
72 ao_data.format = format; |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
73 ao_data.channels = channels; |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
74 ao_data.samplerate = rate_hz; |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
75 ao_data.bps = (rate_hz*channels); |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
76 |
14245 | 77 if(format != AF_FORMAT_U8 && format != AF_FORMAT_S8) |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
78 ao_data.bps*=2; |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
79 |
12984 | 80 stream=arts_play_stream(rate_hz, OBTAIN_BITRATE(format), channels, "MPlayer"); |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
81 |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
82 if(stream == NULL) { |
13383
c1955840883d
mp_msg transition of unmaintained audio output drivers.
ivo
parents:
12984
diff
changeset
|
83 mp_msg(MSGT_AO, MSGL_ERR, MSGTR_AO_ARTS_CantOpenStream); |
6807
ae2f3cdcb462
Improved ao_arts delay and buff er handling, patch by Szombathelyi Gy|rgy <gyurco@freemail.hu>
atmos4
parents:
6214
diff
changeset
|
84 arts_free(); |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
85 return 0; |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
86 } |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
87 |
6807
ae2f3cdcb462
Improved ao_arts delay and buff er handling, patch by Szombathelyi Gy|rgy <gyurco@freemail.hu>
atmos4
parents:
6214
diff
changeset
|
88 /* Set the stream to blocking: it will not block anyway, but it seems */ |
ae2f3cdcb462
Improved ao_arts delay and buff er handling, patch by Szombathelyi Gy|rgy <gyurco@freemail.hu>
atmos4
parents:
6214
diff
changeset
|
89 /* to be working better */ |
ae2f3cdcb462
Improved ao_arts delay and buff er handling, patch by Szombathelyi Gy|rgy <gyurco@freemail.hu>
atmos4
parents:
6214
diff
changeset
|
90 arts_stream_set(stream, ARTS_P_BLOCKING, 1); |
ae2f3cdcb462
Improved ao_arts delay and buff er handling, patch by Szombathelyi Gy|rgy <gyurco@freemail.hu>
atmos4
parents:
6214
diff
changeset
|
91 frag_spec = ARTS_PACKET_SIZE_LOG2 | ARTS_PACKETS << 16; |
ae2f3cdcb462
Improved ao_arts delay and buff er handling, patch by Szombathelyi Gy|rgy <gyurco@freemail.hu>
atmos4
parents:
6214
diff
changeset
|
92 arts_stream_set(stream, ARTS_P_PACKET_SETTINGS, frag_spec); |
ae2f3cdcb462
Improved ao_arts delay and buff er handling, patch by Szombathelyi Gy|rgy <gyurco@freemail.hu>
atmos4
parents:
6214
diff
changeset
|
93 ao_data.buffersize = arts_stream_get(stream, ARTS_P_BUFFER_SIZE); |
13383
c1955840883d
mp_msg transition of unmaintained audio output drivers.
ivo
parents:
12984
diff
changeset
|
94 mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_ARTS_StreamOpen); |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
95 |
13383
c1955840883d
mp_msg transition of unmaintained audio output drivers.
ivo
parents:
12984
diff
changeset
|
96 mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_ARTS_BufferSize, |
6807
ae2f3cdcb462
Improved ao_arts delay and buff er handling, patch by Szombathelyi Gy|rgy <gyurco@freemail.hu>
atmos4
parents:
6214
diff
changeset
|
97 ao_data.buffersize); |
13383
c1955840883d
mp_msg transition of unmaintained audio output drivers.
ivo
parents:
12984
diff
changeset
|
98 mp_msg(MSGT_AO, MSGL_INFO, MSGTR_AO_ARTS_BufferSize, |
6807
ae2f3cdcb462
Improved ao_arts delay and buff er handling, patch by Szombathelyi Gy|rgy <gyurco@freemail.hu>
atmos4
parents:
6214
diff
changeset
|
99 arts_stream_get(stream, ARTS_P_PACKET_SIZE)); |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
100 |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
101 return 1; |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
102 } |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
103 |
12145 | 104 static void uninit(int immed) |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
105 { |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
106 arts_close_stream(stream); |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
107 arts_free(); |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
108 } |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
109 |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
110 static int play(void* data,int len,int flags) |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
111 { |
6807
ae2f3cdcb462
Improved ao_arts delay and buff er handling, patch by Szombathelyi Gy|rgy <gyurco@freemail.hu>
atmos4
parents:
6214
diff
changeset
|
112 return arts_write(stream, data, len); |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
113 } |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
114 |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
115 static void audio_pause() |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
116 { |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
117 } |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
118 |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
119 static void audio_resume() |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
120 { |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
121 } |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
122 |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
123 static void reset() |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
124 { |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
125 } |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
126 |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
127 static int get_space() |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
128 { |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
129 return arts_stream_get(stream, ARTS_P_BUFFER_SPACE); |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
130 } |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
131 |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
132 static float get_delay() |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
133 { |
6807
ae2f3cdcb462
Improved ao_arts delay and buff er handling, patch by Szombathelyi Gy|rgy <gyurco@freemail.hu>
atmos4
parents:
6214
diff
changeset
|
134 return ((float) (ao_data.buffersize - arts_stream_get(stream, |
ae2f3cdcb462
Improved ao_arts delay and buff er handling, patch by Szombathelyi Gy|rgy <gyurco@freemail.hu>
atmos4
parents:
6214
diff
changeset
|
135 ARTS_P_BUFFER_SPACE))) / ((float) ao_data.bps); |
6214
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
136 } |
0398cb49fe5e
aRts audio out support by Michele Balistreri <brain at email.it>
atmos4
parents:
diff
changeset
|
137 |