Re: [spice-gtk PATCH v9 2/4] audio: spice-pulse implement async volume-info

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

 



On Tue, Apr 21, 2015 at 05:57:12PM +0200, Victor Toso wrote:
> > > +static void source_output_info_cb(pa_context *context,
> > > +                                  const pa_source_output_info *info,
> > > +                                  int eol,
> > > +                                  void *userdata)
> > > +{
> > > +    struct async_task *task = userdata;
> > > +    SpicePulsePrivate *p = task->pulse->priv;
> > > +    struct stream *pstream = &p->record;
> > > +
> > > +    if (eol) {
> > > +        spice_pulse_complete_async_task(task, NULL);
> > > +        return;
> > > +    }
> > > +
> > > +    pstream->info_updated = TRUE;
> > > +    pstream->info.name = pstream->name;
> > > +    pstream->info.mute = info->mute;
> > > +    pstream->info.channel_map = info->channel_map;
> > > +    pstream->info.volume = info->volume;
> > > +}
> > > +
> > > +static void sink_input_info_cb(pa_context *context,
> > > +                               const pa_sink_input_info *info,
> > > +                               int eol,
> > > +                               void *userdata)
> > > +{
> > > +    struct async_task *task = userdata;
> > > +    SpicePulsePrivate *p = task->pulse->priv;
> > > +    struct stream *pstream = &p->playback;
> > > +
> > > +    if (eol) {
> > > +        spice_pulse_complete_async_task(task, NULL);
> > > +        return;
> > > +    }
> > > +
> > > +    pstream->info_updated = TRUE;
> > > +    pstream->info.name = pstream->name;
> > > +    pstream->info.mute = info->mute;
> > > +    pstream->info.channel_map = info->channel_map;
> > > +    pstream->info.volume = info->volume;
> > > +}
> > 
> > It seems source_output_info_cb/source_output_info_cb could be combined
> > with just
> > struct stream *pstream = (is_playback) ? &p->playback : &p->record;
> > as the difference as is down elsewhere in that patch.
> > 
> 
> Indeed but as they are callbacks I thought it would be better to have
> each function with your callback; also, pa_sink_input_info not equal to
> pa_source_output_info.
> I can have a function to avoid duplication code as I did in the other
> part of the patch as well, do you think it is better?

Ah right, different prototypes. Well, I'd say don't bother. Or add a
small helper to fill pstream->info which could be used 3 times, but I
don't really think that's that useful, the code is fine as it is.

Christophe

Attachment: pgpDEUmR2CTX9.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]