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 15:06:38 -0300	[thread overview]
Message-ID: <4E25C7AE.5020503@infradead.org> (raw)
In-Reply-To: <4E25A7C2.3050609@list.ru>

Em 19-07-2011 12:50, Stas Sergeev escreveu:
> 19.07.2011 19:27, Mauro Carvalho Chehab wrote:
>>> 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.
> Unless I am mistaken, this control is usually called a
> "Master Playback Switch" in the alsa world.

No, you're mistaken: on most boards, you have only one volume control/switch,
for capture. So, it would be a "master capture switch", but I don't think
that there's such alsa "generic" volume control. Even in the case where
you have a volume control for the LINE OUT pin[1], in general, you also need to
unmute the capture, so, it would be a "master capture and LINE OUT switch",
and, for sure alsa currently not provide anything like that.

> So, am I right that the only problem is that it is not
> exported to the user by some drivers right now?

No, you're mistaken again. Such "master capture and LINE OUT switch" type of control
_is_exported_ via the V4L2 API as V4L2_CID_AUDIO_MUTE. 

> And, if it is made exported, what will still prevent us
> from dropping the auto-unmute stuff?

Some applications like mplayer don't use V4L2_CID_AUDIO_MUTE to unmute a video
device. They assume the current behavior that starting video also unmutes audio.
(mplayer is not symmetric with regard to the usage of this control, as it uses
V4L2_CID_AUDIO_MUTE to mute the device after the end of a capture).

So, changing the logic at the drivers will break existing applications.

It should be noticed that the alsa module is only enabled on devices that
provides PCM output via the PCI or USB bus. 

On the other hand, the V4L2_CID_AUDIO_MUTE control is available for all 
devices that are capable of muting/unmuting the audio. That's why V4L
applications rely on it, instead of using alsa mixers.

I dunno what's your specific saa7134 device model, but, from what I 
understood, instead of using the PCM output, you're using the LINE OUT pin. 

It is probably doable to split the mute control for the LINE OUT pin from the
mute control of the PCM capture. Such patch would make sense, as the alsa
capture doesn't need to touch at the line out pin, but the patch should
let V4L2_CID_AUDIO_MUTE control to affect both LINE OUT and PCM capture
mutes, otherwise applications will break.

>> 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.
> In this case, I think, the alsa mixer control should just
> mirror the one of the v4l2 for the most cases. Maybe
> for some boards they can actually do the different things -
> doesn't matter right now though.

We need a solution that works for both simple and complex devices.

-

[1] IMHO, "LINE OUT" pin doesn't fit very well on playback/capture concept.
The capture volume/switch controls the A/D circuits for capture, while
the playblack controls the D/A circuits. However, the LINE OUT pin gets
audio from the captured data, and doesn't allow to direct any other PCM
data into the D/A. So, it is not a "complete" playback type of control.
So, it won't fit at the "Master Playback Switch" type.

Cheers,
Mauro

  reply	other threads:[~2011-07-19 18:06 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
2011-07-19 15:50                           ` Stas Sergeev
2011-07-19 18:06                             ` Mauro Carvalho Chehab [this message]
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=4E25C7AE.5020503@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).