qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 07/10] Do not use pa_simple PulseAudio API


From: Jan Kiszka
Subject: Re: [Qemu-devel] [PATCH 07/10] Do not use pa_simple PulseAudio API
Date: Mon, 23 Apr 2012 10:55:31 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666

On 2012-04-17 14:32, Marc-André Lureau wrote:
> Unfortunately, pa_simple is a limited API which doesn't let us
> retrieve the associated pa_stream. It is needed to control the volume
> of the stream.
> 
> In v4:
> - add missing braces
> 
> Signed-off-by: Marc-André Lureau <address@hidden>

...

> +
> +static pa_stream *qpa_simple_new (
> +        const char *server,
> +        const char *name,
> +        pa_stream_direction_t dir,
> +        const char *dev,
> +        const char *stream_name,
> +        const pa_sample_spec *ss,
> +        const pa_channel_map *map,
> +        const pa_buffer_attr *attr,
> +        int *rerror)

rerror is not even used in this function...

> +{
> +    paaudio *g = &glob_paaudio;
> +    int r;
> +    pa_stream *stream;
> +
> +    pa_threaded_mainloop_lock (g->mainloop);
> +
> +    stream = pa_stream_new (g->context, name, ss, map);
> +    if (!stream) {
> +        goto fail;
> +    }
> +
> +    pa_stream_set_state_callback (stream, stream_state_cb, g);
> +    pa_stream_set_read_callback (stream, stream_request_cb, g);
> +    pa_stream_set_write_callback (stream, stream_request_cb, g);
> +
> +    if (dir == PA_STREAM_PLAYBACK) {
> +        r = pa_stream_connect_playback (stream, dev, attr,
> +                                        PA_STREAM_INTERPOLATE_TIMING
> +                                        |PA_STREAM_ADJUST_LATENCY
> +                                        |PA_STREAM_AUTO_TIMING_UPDATE, NULL, 
> NULL);
> +    } else {
> +        r = pa_stream_connect_record (stream, dev, attr,
> +                                      PA_STREAM_INTERPOLATE_TIMING
> +                                      |PA_STREAM_ADJUST_LATENCY
> +                                      |PA_STREAM_AUTO_TIMING_UPDATE);
> +    }
> +
> +    if (r < 0) {
> +      goto fail;
> +    }
> +
> +    pa_threaded_mainloop_unlock (g->mainloop);
> +
> +    return stream;
> +
> +fail:
> +    pa_threaded_mainloop_unlock (g->mainloop);
> +
> +    if (stream) {
> +        pa_stream_unref (stream);
> +    }
> +
> +    qpa_logerr (pa_context_errno (g->context),
> +                "stream_new() failed\n");
> +
> +    return NULL;
> +}
> +
>  static int qpa_init_out (HWVoiceOut *hw, struct audsettings *as)
>  {
>      int error;
> @@ -306,24 +534,24 @@ static int qpa_init_out (HWVoiceOut *hw, struct 
> audsettings *as)
>  
>      obt_as.fmt = pa_to_audfmt (ss.format, &obt_as.endianness);
>  
> -    pa->s = pa_simple_new (
> -        conf.server,
> +    pa->stream = qpa_simple_new (
> +        glob_paaudio.server,
>          "qemu",
>          PA_STREAM_PLAYBACK,
> -        conf.sink,
> +        glob_paaudio.sink,
>          "pcm.playback",
>          &ss,
>          NULL,                   /* channel map */
>          &ba,                    /* buffering attributes */
>          &error
>          );
> -    if (!pa->s) {
> +    if (!pa->stream) {
>          qpa_logerr (error, "pa_simple_new for playback failed\n");

...but here (and below) we depend on it to be initialized. This breaks
the build. Please fix.

Thanks,
Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux



reply via email to

[Prev in Thread] Current Thread [Next in Thread]