3 #include "qemu/osdep.h"
4 #include "qemu/module.h"
6 #include "qapi/opts-visitor.h"
8 #include <pulse/pulseaudio.h>
10 #define AUDIO_CAP "pulseaudio"
11 #include "audio_int.h"
12 #include "audio_pt_int.h"
14 typedef struct PAConnection
{
17 QTAILQ_ENTRY(PAConnection
) list
;
19 pa_threaded_mainloop
*mainloop
;
23 static QTAILQ_HEAD(PAConnectionHead
, PAConnection
) pa_conns
=
24 QTAILQ_HEAD_INITIALIZER(pa_conns
);
53 const void *read_data
;
54 size_t read_index
, read_length
;
59 static void qpa_conn_fini(PAConnection
*c
);
61 static void GCC_FMT_ATTR (2, 3) qpa_logerr (int err
, const char *fmt
, ...)
66 AUD_vlog (AUDIO_CAP
, fmt
, ap
);
69 AUD_log (AUDIO_CAP
, "Reason: %s\n", pa_strerror (err
));
72 #ifndef PA_CONTEXT_IS_GOOD
73 static inline int PA_CONTEXT_IS_GOOD(pa_context_state_t x
)
76 x
== PA_CONTEXT_CONNECTING
||
77 x
== PA_CONTEXT_AUTHORIZING
||
78 x
== PA_CONTEXT_SETTING_NAME
||
79 x
== PA_CONTEXT_READY
;
83 #ifndef PA_STREAM_IS_GOOD
84 static inline int PA_STREAM_IS_GOOD(pa_stream_state_t x
)
87 x
== PA_STREAM_CREATING
||
92 #define CHECK_SUCCESS_GOTO(c, rerror, expression, label) \
94 if (!(expression)) { \
96 *(rerror) = pa_context_errno ((c)->context); \
102 #define CHECK_DEAD_GOTO(c, stream, rerror, label) \
104 if (!(c)->context || !PA_CONTEXT_IS_GOOD (pa_context_get_state((c)->context)) || \
105 !(stream) || !PA_STREAM_IS_GOOD (pa_stream_get_state ((stream)))) { \
106 if (((c)->context && pa_context_get_state ((c)->context) == PA_CONTEXT_FAILED) || \
107 ((stream) && pa_stream_get_state ((stream)) == PA_STREAM_FAILED)) { \
109 *(rerror) = pa_context_errno ((c)->context); \
113 *(rerror) = PA_ERR_BADSTATE; \
120 static int qpa_simple_read (PAVoiceIn
*p
, void *data
, size_t length
, int *rerror
)
122 PAConnection
*c
= p
->g
->conn
;
124 pa_threaded_mainloop_lock(c
->mainloop
);
126 CHECK_DEAD_GOTO(c
, p
->stream
, rerror
, unlock_and_fail
);
131 while (!p
->read_data
) {
134 r
= pa_stream_peek (p
->stream
, &p
->read_data
, &p
->read_length
);
135 CHECK_SUCCESS_GOTO(c
, rerror
, r
== 0, unlock_and_fail
);
138 pa_threaded_mainloop_wait(c
->mainloop
);
139 CHECK_DEAD_GOTO(c
, p
->stream
, rerror
, unlock_and_fail
);
145 l
= p
->read_length
< length
? p
->read_length
: length
;
146 memcpy (data
, (const uint8_t *) p
->read_data
+p
->read_index
, l
);
148 data
= (uint8_t *) data
+ l
;
154 if (!p
->read_length
) {
157 r
= pa_stream_drop (p
->stream
);
162 CHECK_SUCCESS_GOTO(c
, rerror
, r
== 0, unlock_and_fail
);
166 pa_threaded_mainloop_unlock(c
->mainloop
);
170 pa_threaded_mainloop_unlock(c
->mainloop
);
174 static int qpa_simple_write (PAVoiceOut
*p
, const void *data
, size_t length
, int *rerror
)
176 PAConnection
*c
= p
->g
->conn
;
178 pa_threaded_mainloop_lock(c
->mainloop
);
180 CHECK_DEAD_GOTO(c
, p
->stream
, rerror
, unlock_and_fail
);
186 while (!(l
= pa_stream_writable_size (p
->stream
))) {
187 pa_threaded_mainloop_wait(c
->mainloop
);
188 CHECK_DEAD_GOTO(c
, p
->stream
, rerror
, unlock_and_fail
);
191 CHECK_SUCCESS_GOTO(c
, rerror
, l
!= (size_t) -1, unlock_and_fail
);
197 r
= pa_stream_write (p
->stream
, data
, l
, NULL
, 0LL, PA_SEEK_RELATIVE
);
198 CHECK_SUCCESS_GOTO(c
, rerror
, r
>= 0, unlock_and_fail
);
200 data
= (const uint8_t *) data
+ l
;
204 pa_threaded_mainloop_unlock(c
->mainloop
);
208 pa_threaded_mainloop_unlock(c
->mainloop
);
212 static void *qpa_thread_out (void *arg
)
214 PAVoiceOut
*pa
= arg
;
215 HWVoiceOut
*hw
= &pa
->hw
;
217 if (audio_pt_lock(&pa
->pt
, __func__
)) {
222 size_t decr
, to_mix
, rpos
;
233 if (audio_pt_wait(&pa
->pt
, __func__
)) {
238 decr
= to_mix
= MIN(pa
->live
, pa
->samples
>> 5);
241 if (audio_pt_unlock(&pa
->pt
, __func__
)) {
247 size_t chunk
= MIN (to_mix
, hw
->samples
- rpos
);
248 struct st_sample
*src
= hw
->mix_buf
+ rpos
;
250 hw
->clip (pa
->pcm_buf
, src
, chunk
);
252 if (qpa_simple_write (pa
, pa
->pcm_buf
,
253 chunk
<< hw
->info
.shift
, &error
) < 0) {
254 qpa_logerr (error
, "pa_simple_write failed\n");
258 rpos
= (rpos
+ chunk
) % hw
->samples
;
262 if (audio_pt_lock(&pa
->pt
, __func__
)) {
272 audio_pt_unlock(&pa
->pt
, __func__
);
276 static size_t qpa_run_out(HWVoiceOut
*hw
, size_t live
)
279 PAVoiceOut
*pa
= (PAVoiceOut
*) hw
;
281 if (audio_pt_lock(&pa
->pt
, __func__
)) {
285 decr
= MIN (live
, pa
->decr
);
287 pa
->live
= live
- decr
;
290 audio_pt_unlock_and_signal(&pa
->pt
, __func__
);
293 audio_pt_unlock(&pa
->pt
, __func__
);
299 static void *qpa_thread_in (void *arg
)
302 HWVoiceIn
*hw
= &pa
->hw
;
304 if (audio_pt_lock(&pa
->pt
, __func__
)) {
309 size_t incr
, to_grab
, wpos
;
320 if (audio_pt_wait(&pa
->pt
, __func__
)) {
325 incr
= to_grab
= MIN(pa
->dead
, pa
->samples
>> 5);
328 if (audio_pt_unlock(&pa
->pt
, __func__
)) {
334 size_t chunk
= MIN (to_grab
, hw
->samples
- wpos
);
335 void *buf
= advance (pa
->pcm_buf
, wpos
);
337 if (qpa_simple_read (pa
, buf
,
338 chunk
<< hw
->info
.shift
, &error
) < 0) {
339 qpa_logerr (error
, "pa_simple_read failed\n");
343 hw
->conv (hw
->conv_buf
+ wpos
, buf
, chunk
);
344 wpos
= (wpos
+ chunk
) % hw
->samples
;
348 if (audio_pt_lock(&pa
->pt
, __func__
)) {
358 audio_pt_unlock(&pa
->pt
, __func__
);
362 static size_t qpa_run_in(HWVoiceIn
*hw
)
364 size_t live
, incr
, dead
;
365 PAVoiceIn
*pa
= (PAVoiceIn
*) hw
;
367 if (audio_pt_lock(&pa
->pt
, __func__
)) {
371 live
= audio_pcm_hw_get_live_in (hw
);
372 dead
= hw
->samples
- live
;
373 incr
= MIN (dead
, pa
->incr
);
375 pa
->dead
= dead
- incr
;
378 audio_pt_unlock_and_signal(&pa
->pt
, __func__
);
381 audio_pt_unlock(&pa
->pt
, __func__
);
386 static pa_sample_format_t
audfmt_to_pa (AudioFormat afmt
, int endianness
)
391 case AUDIO_FORMAT_S8
:
392 case AUDIO_FORMAT_U8
:
393 format
= PA_SAMPLE_U8
;
395 case AUDIO_FORMAT_S16
:
396 case AUDIO_FORMAT_U16
:
397 format
= endianness
? PA_SAMPLE_S16BE
: PA_SAMPLE_S16LE
;
399 case AUDIO_FORMAT_S32
:
400 case AUDIO_FORMAT_U32
:
401 format
= endianness
? PA_SAMPLE_S32BE
: PA_SAMPLE_S32LE
;
404 dolog ("Internal logic error: Bad audio format %d\n", afmt
);
405 format
= PA_SAMPLE_U8
;
411 static AudioFormat
pa_to_audfmt (pa_sample_format_t fmt
, int *endianness
)
415 return AUDIO_FORMAT_U8
;
416 case PA_SAMPLE_S16BE
:
418 return AUDIO_FORMAT_S16
;
419 case PA_SAMPLE_S16LE
:
421 return AUDIO_FORMAT_S16
;
422 case PA_SAMPLE_S32BE
:
424 return AUDIO_FORMAT_S32
;
425 case PA_SAMPLE_S32LE
:
427 return AUDIO_FORMAT_S32
;
429 dolog ("Internal logic error: Bad pa_sample_format %d\n", fmt
);
430 return AUDIO_FORMAT_U8
;
434 static void context_state_cb (pa_context
*c
, void *userdata
)
436 PAConnection
*conn
= userdata
;
438 switch (pa_context_get_state(c
)) {
439 case PA_CONTEXT_READY
:
440 case PA_CONTEXT_TERMINATED
:
441 case PA_CONTEXT_FAILED
:
442 pa_threaded_mainloop_signal(conn
->mainloop
, 0);
445 case PA_CONTEXT_UNCONNECTED
:
446 case PA_CONTEXT_CONNECTING
:
447 case PA_CONTEXT_AUTHORIZING
:
448 case PA_CONTEXT_SETTING_NAME
:
453 static void stream_state_cb (pa_stream
*s
, void * userdata
)
455 PAConnection
*c
= userdata
;
457 switch (pa_stream_get_state (s
)) {
459 case PA_STREAM_READY
:
460 case PA_STREAM_FAILED
:
461 case PA_STREAM_TERMINATED
:
462 pa_threaded_mainloop_signal(c
->mainloop
, 0);
465 case PA_STREAM_UNCONNECTED
:
466 case PA_STREAM_CREATING
:
471 static void stream_request_cb (pa_stream
*s
, size_t length
, void *userdata
)
473 PAConnection
*c
= userdata
;
475 pa_threaded_mainloop_signal(c
->mainloop
, 0);
478 static pa_stream
*qpa_simple_new (
481 pa_stream_direction_t dir
,
483 const pa_sample_spec
*ss
,
484 const pa_channel_map
*map
,
485 const pa_buffer_attr
*attr
,
490 pa_stream_flags_t flags
;
492 pa_threaded_mainloop_lock(c
->mainloop
);
494 stream
= pa_stream_new(c
->context
, name
, ss
, map
);
499 pa_stream_set_state_callback(stream
, stream_state_cb
, c
);
500 pa_stream_set_read_callback(stream
, stream_request_cb
, c
);
501 pa_stream_set_write_callback(stream
, stream_request_cb
, c
);
504 PA_STREAM_INTERPOLATE_TIMING
505 | PA_STREAM_AUTO_TIMING_UPDATE
506 | PA_STREAM_EARLY_REQUESTS
;
509 /* don't move the stream if the user specified a sink/source */
510 flags
|= PA_STREAM_DONT_MOVE
;
513 if (dir
== PA_STREAM_PLAYBACK
) {
514 r
= pa_stream_connect_playback(stream
, dev
, attr
, flags
, NULL
, NULL
);
516 r
= pa_stream_connect_record(stream
, dev
, attr
, flags
);
523 pa_threaded_mainloop_unlock(c
->mainloop
);
528 pa_threaded_mainloop_unlock(c
->mainloop
);
531 pa_stream_unref (stream
);
534 *rerror
= pa_context_errno(c
->context
);
539 static int qpa_init_out(HWVoiceOut
*hw
, struct audsettings
*as
,
545 struct audsettings obt_as
= *as
;
546 PAVoiceOut
*pa
= (PAVoiceOut
*) hw
;
547 paaudio
*g
= pa
->g
= drv_opaque
;
548 AudiodevPaOptions
*popts
= &g
->dev
->u
.pa
;
549 AudiodevPaPerDirectionOptions
*ppdo
= popts
->out
;
550 PAConnection
*c
= g
->conn
;
552 ss
.format
= audfmt_to_pa (as
->fmt
, as
->endianness
);
553 ss
.channels
= as
->nchannels
;
556 ba
.tlength
= pa_usec_to_bytes(ppdo
->latency
, &ss
);
561 obt_as
.fmt
= pa_to_audfmt (ss
.format
, &obt_as
.endianness
);
563 pa
->stream
= qpa_simple_new (
567 ppdo
->has_name
? ppdo
->name
: NULL
,
569 NULL
, /* channel map */
570 &ba
, /* buffering attributes */
574 qpa_logerr (error
, "pa_simple_new for playback failed\n");
578 audio_pcm_init_info (&hw
->info
, &obt_as
);
579 hw
->samples
= pa
->samples
= audio_buffer_samples(
580 qapi_AudiodevPaPerDirectionOptions_base(ppdo
),
581 &obt_as
, ppdo
->buffer_length
);
582 pa
->pcm_buf
= audio_calloc(__func__
, hw
->samples
, 1 << hw
->info
.shift
);
585 dolog("Could not allocate buffer (%zu bytes)\n",
586 hw
->samples
<< hw
->info
.shift
);
590 if (audio_pt_init(&pa
->pt
, qpa_thread_out
, hw
, AUDIO_CAP
, __func__
)) {
597 g_free (pa
->pcm_buf
);
601 pa_stream_unref (pa
->stream
);
608 static int qpa_init_in(HWVoiceIn
*hw
, struct audsettings
*as
, void *drv_opaque
)
613 struct audsettings obt_as
= *as
;
614 PAVoiceIn
*pa
= (PAVoiceIn
*) hw
;
615 paaudio
*g
= pa
->g
= drv_opaque
;
616 AudiodevPaOptions
*popts
= &g
->dev
->u
.pa
;
617 AudiodevPaPerDirectionOptions
*ppdo
= popts
->in
;
618 PAConnection
*c
= g
->conn
;
620 ss
.format
= audfmt_to_pa (as
->fmt
, as
->endianness
);
621 ss
.channels
= as
->nchannels
;
624 ba
.fragsize
= pa_usec_to_bytes(ppdo
->latency
, &ss
);
625 ba
.maxlength
= pa_usec_to_bytes(ppdo
->latency
* 2, &ss
);
629 obt_as
.fmt
= pa_to_audfmt (ss
.format
, &obt_as
.endianness
);
631 pa
->stream
= qpa_simple_new (
635 ppdo
->has_name
? ppdo
->name
: NULL
,
637 NULL
, /* channel map */
638 &ba
, /* buffering attributes */
642 qpa_logerr (error
, "pa_simple_new for capture failed\n");
646 audio_pcm_init_info (&hw
->info
, &obt_as
);
647 hw
->samples
= pa
->samples
= audio_buffer_samples(
648 qapi_AudiodevPaPerDirectionOptions_base(ppdo
),
649 &obt_as
, ppdo
->buffer_length
);
650 pa
->pcm_buf
= audio_calloc(__func__
, hw
->samples
, 1 << hw
->info
.shift
);
653 dolog("Could not allocate buffer (%zu bytes)\n",
654 hw
->samples
<< hw
->info
.shift
);
658 if (audio_pt_init(&pa
->pt
, qpa_thread_in
, hw
, AUDIO_CAP
, __func__
)) {
665 g_free (pa
->pcm_buf
);
669 pa_stream_unref (pa
->stream
);
676 static void qpa_simple_disconnect(PAConnection
*c
, pa_stream
*stream
)
680 pa_threaded_mainloop_lock(c
->mainloop
);
682 * wait until actually connects. workaround pa bug #247
683 * https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/247
685 while (pa_stream_get_state(stream
) == PA_STREAM_CREATING
) {
686 pa_threaded_mainloop_wait(c
->mainloop
);
689 err
= pa_stream_disconnect(stream
);
691 dolog("Failed to disconnect! err=%d\n", err
);
693 pa_stream_unref(stream
);
694 pa_threaded_mainloop_unlock(c
->mainloop
);
697 static void qpa_fini_out (HWVoiceOut
*hw
)
700 PAVoiceOut
*pa
= (PAVoiceOut
*) hw
;
702 audio_pt_lock(&pa
->pt
, __func__
);
704 audio_pt_unlock_and_signal(&pa
->pt
, __func__
);
705 audio_pt_join(&pa
->pt
, &ret
, __func__
);
708 qpa_simple_disconnect(pa
->g
->conn
, pa
->stream
);
712 audio_pt_fini(&pa
->pt
, __func__
);
713 g_free (pa
->pcm_buf
);
717 static void qpa_fini_in (HWVoiceIn
*hw
)
720 PAVoiceIn
*pa
= (PAVoiceIn
*) hw
;
722 audio_pt_lock(&pa
->pt
, __func__
);
724 audio_pt_unlock_and_signal(&pa
->pt
, __func__
);
725 audio_pt_join(&pa
->pt
, &ret
, __func__
);
728 qpa_simple_disconnect(pa
->g
->conn
, pa
->stream
);
732 audio_pt_fini(&pa
->pt
, __func__
);
733 g_free (pa
->pcm_buf
);
737 static int qpa_ctl_out (HWVoiceOut
*hw
, int cmd
, ...)
739 PAVoiceOut
*pa
= (PAVoiceOut
*) hw
;
742 PAConnection
*c
= pa
->g
->conn
;
744 #ifdef PA_CHECK_VERSION /* macro is present in 0.9.16+ */
745 pa_cvolume_init (&v
); /* function is present in 0.9.13+ */
755 sw
= va_arg (ap
, SWVoiceOut
*);
759 v
.values
[0] = ((PA_VOLUME_NORM
- PA_VOLUME_MUTED
) * sw
->vol
.l
) / UINT32_MAX
;
760 v
.values
[1] = ((PA_VOLUME_NORM
- PA_VOLUME_MUTED
) * sw
->vol
.r
) / UINT32_MAX
;
762 pa_threaded_mainloop_lock(c
->mainloop
);
764 op
= pa_context_set_sink_input_volume(c
->context
,
765 pa_stream_get_index (pa
->stream
),
768 qpa_logerr(pa_context_errno(c
->context
),
769 "set_sink_input_volume() failed\n");
771 pa_operation_unref(op
);
774 op
= pa_context_set_sink_input_mute(c
->context
,
775 pa_stream_get_index (pa
->stream
),
776 sw
->vol
.mute
, NULL
, NULL
);
778 qpa_logerr(pa_context_errno(c
->context
),
779 "set_sink_input_mute() failed\n");
781 pa_operation_unref(op
);
784 pa_threaded_mainloop_unlock(c
->mainloop
);
790 static int qpa_ctl_in (HWVoiceIn
*hw
, int cmd
, ...)
792 PAVoiceIn
*pa
= (PAVoiceIn
*) hw
;
795 PAConnection
*c
= pa
->g
->conn
;
797 #ifdef PA_CHECK_VERSION
798 pa_cvolume_init (&v
);
808 sw
= va_arg (ap
, SWVoiceIn
*);
812 v
.values
[0] = ((PA_VOLUME_NORM
- PA_VOLUME_MUTED
) * sw
->vol
.l
) / UINT32_MAX
;
813 v
.values
[1] = ((PA_VOLUME_NORM
- PA_VOLUME_MUTED
) * sw
->vol
.r
) / UINT32_MAX
;
815 pa_threaded_mainloop_lock(c
->mainloop
);
817 op
= pa_context_set_source_output_volume(c
->context
,
818 pa_stream_get_index(pa
->stream
),
821 qpa_logerr(pa_context_errno(c
->context
),
822 "set_source_output_volume() failed\n");
824 pa_operation_unref(op
);
827 op
= pa_context_set_source_output_mute(c
->context
,
828 pa_stream_get_index (pa
->stream
),
829 sw
->vol
.mute
, NULL
, NULL
);
831 qpa_logerr(pa_context_errno(c
->context
),
832 "set_source_output_mute() failed\n");
834 pa_operation_unref (op
);
837 pa_threaded_mainloop_unlock(c
->mainloop
);
843 static int qpa_validate_per_direction_opts(Audiodev
*dev
,
844 AudiodevPaPerDirectionOptions
*pdo
)
846 if (!pdo
->has_buffer_length
) {
847 pdo
->has_buffer_length
= true;
848 pdo
->buffer_length
= 46440;
850 if (!pdo
->has_latency
) {
851 pdo
->has_latency
= true;
852 pdo
->latency
= 15000;
858 static void *qpa_conn_init(const char *server
)
860 PAConnection
*c
= g_malloc0(sizeof(PAConnection
));
861 QTAILQ_INSERT_TAIL(&pa_conns
, c
, list
);
863 c
->mainloop
= pa_threaded_mainloop_new();
868 c
->context
= pa_context_new(pa_threaded_mainloop_get_api(c
->mainloop
),
874 pa_context_set_state_callback(c
->context
, context_state_cb
, c
);
876 if (pa_context_connect(c
->context
, server
, 0, NULL
) < 0) {
877 qpa_logerr(pa_context_errno(c
->context
),
878 "pa_context_connect() failed\n");
882 pa_threaded_mainloop_lock(c
->mainloop
);
884 if (pa_threaded_mainloop_start(c
->mainloop
) < 0) {
885 goto unlock_and_fail
;
889 pa_context_state_t state
;
891 state
= pa_context_get_state(c
->context
);
893 if (state
== PA_CONTEXT_READY
) {
897 if (!PA_CONTEXT_IS_GOOD(state
)) {
898 qpa_logerr(pa_context_errno(c
->context
),
899 "Wrong context state\n");
900 goto unlock_and_fail
;
903 /* Wait until the context is ready */
904 pa_threaded_mainloop_wait(c
->mainloop
);
907 pa_threaded_mainloop_unlock(c
->mainloop
);
911 pa_threaded_mainloop_unlock(c
->mainloop
);
913 AUD_log (AUDIO_CAP
, "Failed to initialize PA context");
918 static void *qpa_audio_init(Audiodev
*dev
)
921 AudiodevPaOptions
*popts
= &dev
->u
.pa
;
925 assert(dev
->driver
== AUDIODEV_DRIVER_PA
);
927 if (!popts
->has_server
) {
932 runtime
= getenv("XDG_RUNTIME_DIR");
936 snprintf(pidfile
, sizeof(pidfile
), "%s/pulse/pid", runtime
);
937 if (stat(pidfile
, &st
) != 0) {
942 if (!qpa_validate_per_direction_opts(dev
, popts
->in
)) {
945 if (!qpa_validate_per_direction_opts(dev
, popts
->out
)) {
949 g
= g_malloc0(sizeof(paaudio
));
950 server
= popts
->has_server
? popts
->server
: NULL
;
954 QTAILQ_FOREACH(c
, &pa_conns
, list
) {
955 if (server
== NULL
|| c
->server
== NULL
?
956 server
== c
->server
:
957 strcmp(server
, c
->server
) == 0) {
963 g
->conn
= qpa_conn_init(server
);
974 static void qpa_conn_fini(PAConnection
*c
)
977 pa_threaded_mainloop_stop(c
->mainloop
);
981 pa_context_disconnect(c
->context
);
982 pa_context_unref(c
->context
);
986 pa_threaded_mainloop_free(c
->mainloop
);
989 QTAILQ_REMOVE(&pa_conns
, c
, list
);
993 static void qpa_audio_fini (void *opaque
)
996 PAConnection
*c
= g
->conn
;
998 if (--c
->refcount
== 0) {
1005 static struct audio_pcm_ops qpa_pcm_ops
= {
1006 .init_out
= qpa_init_out
,
1007 .fini_out
= qpa_fini_out
,
1008 .run_out
= qpa_run_out
,
1009 .ctl_out
= qpa_ctl_out
,
1011 .init_in
= qpa_init_in
,
1012 .fini_in
= qpa_fini_in
,
1013 .run_in
= qpa_run_in
,
1014 .ctl_in
= qpa_ctl_in
1017 static struct audio_driver pa_audio_driver
= {
1019 .descr
= "http://www.pulseaudio.org/",
1020 .init
= qpa_audio_init
,
1021 .fini
= qpa_audio_fini
,
1022 .pcm_ops
= &qpa_pcm_ops
,
1023 .can_be_default
= 1,
1024 .max_voices_out
= INT_MAX
,
1025 .max_voices_in
= INT_MAX
,
1026 .voice_size_out
= sizeof (PAVoiceOut
),
1027 .voice_size_in
= sizeof (PAVoiceIn
),
1028 .ctl_caps
= VOICE_VOLUME_CAP
1031 static void register_audio_pa(void)
1033 audio_driver_register(&pa_audio_driver
);
1035 type_init(register_audio_pa
);