alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@infradead.org>
To: Stas Sergeev <stsp@list.ru>
Cc: Lennart Poettering <lpoetter@redhat.com>,
	linux-media@vger.kernel.org,
	"Nickolay V. Shmyrev" <nshmyrev@yandex.ru>,
	Devin Heitmueller <dheitmueller@kernellabs.com>,
	ALSA devel <alsa-devel@alsa-project.org>
Subject: Re: [patch][saa7134] do not change mute state for capturing audio
Date: Tue, 19 Jul 2011 12:27:38 -0300	[thread overview]
Message-ID: <4E25A26A.2000204@infradead.org> (raw)
In-Reply-To: <4E259B0C.90107@list.ru>

Em 19-07-2011 11:56, Stas Sergeev escreveu:
> 19.07.2011 18:10, Mauro Carvalho Chehab wrote:
>> As this is an USB device, in general, people don't connect the line out
>> pin. So, typically, in order to unmute this particular device for TV, one
>> should unmute both AC97 MONO and AC97 VIDEO, and mute AC97 LINE IN.
>>
>> If the application latter changes to SVideo, the AC97 VIDEO should be
>> muted, and AC97 LINE IN should be unmuted.
> Unless I am missing the point, you need some mixer control
> that will just unmute the "currently-configured things".
> If you can unmute all the right things when an app just
> starts capturing, then you can as well unmute the same
> things by that _single_ mixer control.
> And if the app changes the output to SVideo, as in your
> example, you can first mute everything, and then unmute
> the new lines, but only if the old lines were unmuted.
> IMHO, that logic will not break the existing apps.

That is the current logic, except that we don't create an additional
virtual mixer control like the one you've proposed via ALSA API.

The business logic coded into the Kernel is that, when audio stream is 
started or a different input is selected, the driver checks the
current applicable mute/volumes and sets the pertinent ones to unmute,
muting the others.

Yet, they allow users to manually adjust the volume controls, as someone
may want for example to use the mixer to mix the original TV audio with
a microphone, for example, connected at the LINE IN input that some boards
offer.

Also, some newer devices are coming with the capability of mixing video
inputs (s5p driver recently added a video mixer). It makes sense for
applications that use it, to also allow controlling the audio mixer.

That's basically why we want to expose such controls to userspace: to allow
users to control the audio mixer when they need, for whatever reason.

If I understood PA concepts, its philosophy seems to hide those controls
that aren't meant to be used by the default usecase. As such, it should
not be exposing any mixer/mute at all from a V4L device.

The proper fix seems to make PA to use libmedia_dev[1] to detect what audio
input devices are associated with a V4L board and removing them for the
list of controlled devices by default, eventually allowing the users to add
them again via some configuration parameter.

[1] http://git.linuxtv.org/v4l-utils.git?a=blob;f=utils/libmedia_dev/README

>> Moving such logic to happen at userspace would be very complex, and will
>> break existing applications.
> If this is the case, then how does the simplest
> xawtv's mute/unmute thing works with all these
> boards right now? (not that I have checked it does,
> but I hope so. :)

Xawtv mute/unmute probably needs fix. It uses 3 different API's for that:
V4L2, ALSA and OSS. Most of the logic there is for OSS, witch can be removed
nowadays.

Feel free to submit patches for it.

Yet, as you may be aware of that, the V4L2 API offers a few audio controls 
(volume, mute, balance, bass, treble), that applies to the current 
stream, on the drivers that provide them. So, a video application may opt to
not control the alsa mixers directly, but, instead, use the V4L2 controls.

Thanks,
Mauro

  reply	other threads:[~2011-07-19 15:27 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4E19D2F7.6060803@list.ru>
     [not found] ` <4E1E05AC.2070002@infradead.org>
     [not found]   ` <4E1E0A1D.6000604@list.ru>
     [not found]     ` <4E1E1571.6010400@infradead.org>
     [not found]       ` <4E1E8108.3060305@list.ru>
     [not found]         ` <4E1F9A25.1020208@infradead.org>
2011-07-17  9:44           ` [patch][saa7134] do not change mute state for capturing audio Stas Sergeev
2011-07-17 11:51             ` Mauro Carvalho Chehab
2011-07-17 12:24               ` Stas Sergeev
2011-07-18 23:16               ` Lennart Poettering
2011-07-19  6:31                 ` Stas Sergeev
2011-07-19 12:25                   ` Lennart Poettering
2011-07-19 13:00                 ` Mauro Carvalho Chehab
2011-07-19 13:13                   ` [alsa-devel] " Lennart Poettering
2011-07-19 13:49                   ` Stas Sergeev
2011-07-19 14:10                     ` Mauro Carvalho Chehab
2011-07-19 14:56                       ` Stas Sergeev
2011-07-19 15:27                         ` Mauro Carvalho Chehab [this message]
2011-07-19 15:50                           ` Stas Sergeev
2011-07-19 18:06                             ` Mauro Carvalho Chehab
2011-07-19 18:38                               ` Stas Sergeev
2011-07-19 19:29                                 ` Mauro Carvalho Chehab
2011-07-19 21:57                                   ` Stas Sergeev
2011-07-20  0:55                                     ` Mauro Carvalho Chehab
2011-07-20  5:28                                       ` Stas Sergeev
2011-07-20 10:32                                         ` Mauro Carvalho Chehab
2011-07-20 10:41                                           ` Mauro Carvalho Chehab
2011-07-20 10:45                                           ` Stas Sergeev
2011-07-20 10:48                                             ` Mauro Carvalho Chehab
2011-07-20 10:55                                               ` Stas Sergeev
     [not found]                                               ` <4E292BED.60108@list.ru>
     [not found]                                                 ` <4E296D00.9040608@infradead.org>
     [not found]                                                   ` <4E296F6C.9080107@list.ru>
     [not found]                                                     ` <4E2971D4.1060109@infradead.org>
     [not found]                                                       ` <4E29738F.7040605@list.ru>
     [not found]                                                         ` <4E297505.7090307@infradead.org>
     [not found]                                                           ` <4E29E02A.1020402@list.ru>
     [not found]                                                           ` <4E29E02A .1020402@list.ru>
     [not found]                                                             ` <4E2A23C7.3040209@infradead.org>
     [not found]                                                               ` <4E2A7BF0.8080606@list.ru>
     [not found]                                                                 ` <4E2AC742.8020407@infradead.org>
     [not found]                                                                   ` <4E2ACAAD.4050602@list.ru>
     [not found]                                                                     ` <4E2AE40F.7030108@infradead.org>
     [not found]                                                                       ` <4E2C5A35.9030404@list.ru>
     [not found]                                                                         ` <4E2C6638.2040707@infrade ad.org>
2011-07-24 18:36                                                                         ` Mauro Carvalho Chehab
2011-07-24 19:00                                                                           ` Stas Sergeev
2011-07-25 11:15                                                                           ` Stas Sergeev
2011-09-18 15:18                                                                           ` Stas Sergeev
2011-09-24 10:57                                                                             ` Mauro Carvalho Chehab
2011-09-24 11:12                                                                               ` Stas Sergeev
2011-09-24 12:12                                                                                 ` Mauro Carvalho Chehab
2011-09-24 12:36                                                                                   ` Stas Sergeev
2011-09-24 12:48                                                                                     ` Mauro Carvalho Chehab
2011-09-24 13:20                                                                                       ` Stas Sergeev
2011-09-24 15:09                                                                                         ` Mauro Carvalho Chehab
2011-09-24 15:51                                                                                           ` Stas Sergeev
2011-12-03 20:40                                                                                       ` Stas Sergeev
2011-09-24 12:05                                                                             ` Mauro Carvalho Chehab
2011-09-24 12:33                                                                               ` Stas Sergeev
2011-09-24 12:46                                                                                 ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E25A26A.2000204@infradead.org \
    --to=mchehab@infradead.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=dheitmueller@kernellabs.com \
    --cc=linux-media@vger.kernel.org \
    --cc=lpoetter@redhat.com \
    --cc=nshmyrev@yandex.ru \
    --cc=stsp@list.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).