My goal is to have full bilingual support in mythtv using the ivtv driver. By that I mean that while watching live tv as well as recordings, I would like to be able to switch languages as I would on a real TV set. I would like to be told whenever a broadcast has two language and have the choice of switching to the second language.
I have a Haupauge PVR 350 card that's perfectly able to handle bilingual broadcasts. However, the driver does not support that.
Bruno Hertz wrote a patch that made it possible to switch languages while watching live TV. It works well, but it's not enough for what I want. See patch in http://www.poptix.net/ivtv/Sep-2003/msg00117.html.
The driver should tell the PVR card to record both channels of a bilingual broadcast in such a way that mythtv would be able to tell that we've got two separate languages, and not just one stereo audio stream. Since version 1, MPEG has had a DUAL stereo mode that means just that: even the audio stream is encoded like STEREO, it is actualy two separate streams. See the discussion on the thread: http://www.poptix.net/ivtv/Mar-2004/msg00311.html
patch | 0.1.9 | date | changes |
bilingual 01 | 0.1.9 patch | 2004-03-21 | ChangeLog |
bilingual 02 | 0.1.9 patch | 2004-04-25 | ChangeLog |
bilingual 03 | 0.1.9 patch | 2004-05-08 | ChangeLog |
Bilingual support is also available in ivtv 0.1.10 prereleases starting with version 0.1.10-pre2-ck65b. The description below applies both to the patch bilingual 03 and to the 0.1.10 pre2 versions.
This patch builds on Bruno's patch to add more extensive bilingual support to ivtv. It starts by completing
the structure returned by the V4L2 ioctl call VIDIOC_G_TUNER. The fields audmode and rxsubchans are now
set according to the specification. This can be seen using test_ioctl
with the new
option -Z
.
VIDIOC_S_TUNER can then be used to change the current audio mode, following what was found in the field rxsubchans set by VIDIOC_G_TUNER.
Starting with patch #2, the MSP 3400 driver has been simplified to make use of the fully automatic recognition of TV standard and stereo mode. This new version of msp3400 should be stabler with newer versions of the chips. It still works with older versions as shipped with old hauppauge cards (bttv).
The main goal of this big change was strange noises I kept hearing with stereo broadcast. This change has mostly fixed this problem (mostly... it still needs tuning). I believe it should eventually make the msp3400 stabler and support any standard the chip itself supports without having to adapt the driver.
With this patch, you choose the stereo/bilingual mode using standard V4L2 calls, which is done with the
argument -z
of test_ioctl
. Here is a list of these flags:
1
(stereo): always play both channels, even if a bilingual broadcast is detected2
(lang2) : play both channels if the broadcast is in stereo and play the second
language if a bilingual broadcast is detected3
(lang1): play both channels if the broadcast is in stereo and play the first
language only if a bilingual broadcast is detected (this is the default)0
(mono): play only one channels, whatever the real broadcast mode is
Try test_ioctl -Z
to see the mode you're in; you'll see something like:
ioctl: VIDIOC_G_TUNER current audio mode : 1 (stereo 1, lang1 3, lang2 2, mono 0) available subchannels: 0xd (stereo 0x2, lang1 0x8, lang2 0x4, mono 0x1)
The above is a bilingual broadcast. I'm currently hearing both languages. The MPEG being written has the DUAL flag set.
With these settings, you choose once the mode you want your TV set to be and leave it that way. This is the way the MSP3400 works, as well as the way most TV sets work.
In stereo mode (test_ioctl -z 1), the ivtv driver will switch the audio flags between STEREO/JOINT and DUAL automatically. This update is done once per second in a special thread. In any other mode, the flag is left to STEREO or JOINT, as specified using test_ioctl -c audio=...
The final goal is to make mythtv act just like a normal tv set, making it possible to switch languages at any time:
patch | 0.14 | 0.15.1 | 0.19 | 0.20 | date | changes |
preliminary | 0.14 patch | 2004-03-21 | ChangeLog | |||
language 01 | 0.14 patch | 2004-05-16 | ChangeLog | |||
language 02 | 0.14 patch | 0.15 patch | 2004-06-13 | ChangeLog | ||
language 03 | 0.15 patch | 2004-06-20 | ChangeLog | |||
language 04 | 0.19 patch | 0.20 patch | 2006-09-17 | ChangeLog |
The following description applies to the latest patch, language 04:
The bilingual/SAP setting in the current profile (right under the audio bitrate setting, on the lang profile configuration screen) must be set to 'Dual' for mythtv to record both languages. By default, it will only record the first language. I recommend you set it to 'Dual' on all your profile.
It is also possible to set it to 'Language II', in which case only the second language will be recorded. This setting can be useful when you want to produce MPEG files that can easily be watched by players without support for dual streams, such as mplayer.
With bilingual/SAP set to 'Dual', when a bilingual broadcast is detected while watching live TV or a recorded program, you can switch languages by pressing the '+' or '-' key (or whatever key corresponds to PREVAUDIO/NEXTAUDIO on your system).
You can also select the language from the menu. Whenever, two audio tracks are available, the menu 'Select Audio Track' appears.
The player remembers the last language that was played after a commercial break.
Note to users of old patches: patches for 0.19 and 0.20 do not require changing the database schema anymore.