[PATCH 2/2] alsa-ucm: Use playback/capture rate specification from UCM

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

 



On Thu, 2013-08-08 at 09:41 +0300, Tanu Kaskinen wrote:
> On Wed, 2013-08-07 at 23:26 +0530, Arun Raghavan wrote:
> > Add new PlaybackRate/CaptureRate values for UCM that can be used to
> > specify custom rates for devices. This value can either be set on the
> > verb, which makes it apply to all devices, or on the device to override
> > the verb setting.
> > ---
> >  src/modules/alsa/alsa-ucm.c | 29 +++++++++++++++++++++++++++--
> >  src/modules/alsa/alsa-ucm.h |  9 +++++++++
> >  2 files changed, 36 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c
> > index 7f6b9f1..787dc9e 100644
> > --- a/src/modules/alsa/alsa-ucm.c
> > +++ b/src/modules/alsa/alsa-ucm.c
> > @@ -84,10 +84,12 @@ static struct ucm_items item[] = {
> >      {"PlaybackVolume", PA_ALSA_PROP_UCM_PLAYBACK_VOLUME},
> >      {"PlaybackSwitch", PA_ALSA_PROP_UCM_PLAYBACK_SWITCH},
> >      {"PlaybackPriority", PA_ALSA_PROP_UCM_PLAYBACK_PRIORITY},
> > +    {"PlaybackRate", PA_ALSA_PROP_UCM_PLAYBACK_RATE},
> >      {"PlaybackChannels", PA_ALSA_PROP_UCM_PLAYBACK_CHANNELS},
> >      {"CaptureVolume", PA_ALSA_PROP_UCM_CAPTURE_VOLUME},
> >      {"CaptureSwitch", PA_ALSA_PROP_UCM_CAPTURE_SWITCH},
> >      {"CapturePriority", PA_ALSA_PROP_UCM_CAPTURE_PRIORITY},
> > +    {"CaptureRate", PA_ALSA_PROP_UCM_CAPTURE_RATE},
> 
> Are these UCM Value items standardized?

Not yet: http://article.gmane.org/gmane.linux.alsa.devel/111390

> >      {"CaptureChannels", PA_ALSA_PROP_UCM_CAPTURE_CHANNELS},
> >      {"TQ", PA_ALSA_PROP_UCM_QOS},
> >      {NULL, NULL},
> > @@ -256,8 +258,18 @@ static int ucm_get_device_property(
> >          device->capture_channels = 2;
> >      }
> >  
> > -    /* get priority of device */
> > +    /* get rate and priority of device */
> >      if (device->playback_channels) { /* sink device */
> > +        /* get rate */
> > +        if ((value = pa_proplist_gets(device->proplist, PA_ALSA_PROP_UCM_PLAYBACK_RATE)) ||
> > +            (value = pa_proplist_gets(verb->proplist, PA_ALSA_PROP_UCM_PLAYBACK_RATE))) {
> > +            if (pa_atou(value, &ui) == 0 && ui < PA_RATE_MAX) {
> 
> I don't think 0 should be accepted as a valid rate.
> 
> > +                pa_log_debug("UCM playback device %s rate %d", device_name, ui);
> > +                device->playback_rate = ui;
> > +            } else
> > +                pa_log_debug("UCM playback device %s has bad rate %s", device_name, value);
> > +        }
> > +
> >          value = pa_proplist_gets(device->proplist, PA_ALSA_PROP_UCM_PLAYBACK_PRIORITY);
> >          if (value) {
> >              /* get priority from ucm config */
> > @@ -269,6 +281,16 @@ static int ucm_get_device_property(
> >      }
> >  
> >      if (device->capture_channels) { /* source device */
> > +        /* get rate */
> > +        if ((value = pa_proplist_gets(device->proplist, PA_ALSA_PROP_UCM_CAPTURE_RATE)) ||
> > +            (value = pa_proplist_gets(verb->proplist, PA_ALSA_PROP_UCM_CAPTURE_RATE))) {
> > +            if (pa_atou(value, &ui) == 0 && ui < PA_RATE_MAX) {
> > +                pa_log_debug("UCM playback device %s rate %d", device_name, ui);
> 
> Copy-paste error here...
> 
> > +                device->capture_rate = ui;
> > +            } else
> > +                pa_log_debug("UCM playback device %s has bad rate %s", device_name, value);
> 
> ...and here.

I hereby dub this day Arun's-copy-paste-stupidity day. Thanks for
catching these.

-- Arun



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux