[mythtv-users] dual (bilingual) sound

Petr Stehlik pstehlik at sophics.cz
Wed Nov 30 18:15:43 EST 2005


Michael T. Dean píše v St 30. 11. 2005 v 11:38 -0500:
> >>>works correctly so I assume that one of the stereo channels is set as
> >>>default language channel when the bilingual transmission is detected.
> >>>Now it's up to me to look into xawtv source code to find out which
> >>>channel it is - either left or right, there is no more possibilities.

> This is making me think that there may be some information transmitted 
> in the VBI about the audio.

No idea how it is transmitted. How is transmitted MONO vs STEREO
information? I have just looked into xawtv and tvtime source code for
some time but I can't see anything useful. I see getter and setter
functions for the MONO/STEREO/LANG1/LANG2 - they do work with the V4L
tuner directly.

V4L API defines four different sound encodings:

VIDEO_SOUND_MONO
Mono signal
VIDEO_SOUND_STEREO
Stereo signal (NICAM for TV)
VIDEO_SOUND_LANG1
European TV alternate language 1
VIDEO_SOUND_LANG2
European TV alternate language 2

and kernel bttv driver does this (in VIDIOC_G_TUNER):

if(va.mode & VIDEO_SOUND_STEREO) {
	t->audmode     = V4L2_TUNER_MODE_STEREO;
	t->rxsubchans |= V4L2_TUNER_SUB_STEREO;
}
if(va.mode & VIDEO_SOUND_LANG1) {
	t->audmode    = V4L2_TUNER_MODE_LANG1;
	t->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
}

See, if LANG1 mode is available then subchannels are LANG1 and LANG2,
and default audio mode is set to LANG1. This is the answer. It's all
handled by kernel so user application just have to set the right mode of
tuner, not to play with muting left or right channels.

Wow, I have just found it:

The rx subchannels description says that "Some tuners can report the
audio subprograms received by analyzing audio carriers, pilot tones or
other indicators. The rxsubchans field contains flags defined in Table
4, which are set by the driver to indicate the audio subprograms the
hardware may currently receive."

So the driver does detect the audio type automagically and you just have
to set the audio mode correctly. Now when is the right time to detect
the change? It should be done periodically, most probably. Once per
second? Is there a good place in MythTV where I could try to put such a
code?

http://v4l2spec.bytesex.org/spec-single/v4l2.html#TUNER-MATRIX shows
what happens if the mode is not set correctly.

BTW, this is rather interesting topic. After looking through the xawtv
source code I can't swear that it detects the lang1/2 automagically.
Maybe that MythTV would be the first one on linux platform that would do
that right :-) But then a certain default value would have to be set in
Myth (either record lang1 or lang2 by default) and what if user
preferred the other language in certain recorded programs? Seems to me
like most flexible will be to leave it as it is and then use the mute
left/right channel feature when watching the livetv/recorded program.

Petr




More information about the mythtv-users mailing list