[mythtv] Seemingly simple and useful digital audio toggle

Zachary Gleit zlg1 at yahoo.com
Sun Dec 4 16:03:29 UTC 2011


Hi -

Along Christian's lines, I have tried numerous solutions to try to stream via analog (not HDMI) and SPDIF simultaneously.  The problem with the solutions I've tried (when I get them to work) is  that either the simultaneous stream is in stereo (not surround) or, if MythTV detects a surround stream, it only passes through to SPDIF and doesn't play through analog (it'll play through both only if there's a stereo source).

I found Patrick's solution really helpful (there were two syntax errors in his script, but that likely came from cutting and pasting).  My modification is pasted below.  I don't use Myth with a remote control, so I added a menu option to the mainmenu.xml file that runs the script.  It works perfectly.

Thanks a lot.

Zack

#!/usr/bin/python

from MythTV import MythBE

be = MythBE()
db = be.db
hostname = db.gethostname()

print 'Host: %s'%hostname
print '\tAudio device: %s'%db.settings[hostname]['AudioOutputDevice']
print '\tMax Channels: %s'%db.settings[hostname]['MaxChannels']
print '\tDTS: %s    AC3: %s'%(db.settings[hostname]['DTSPassThru'],db.settings[hostname]['AC3PassThru'])

if db.settings[hostname]['AudioOutputDevice']=='ALSA:pulse':
  db.settings[hostname]['AudioOutputDevice']='ALSA:iec958:CARD=Intel,DEV=0'
  db.settings[hostname]['MaxChannels']=u'6'
  db.settings[hostname]['DTSPassThru']=u'1'
  db.settings[hostname]['AC3PassThru']=u'1'
else:
  db.settings[hostname]['AudioOutputDevice']='ALSA:pulse'
  db.settings[hostname]['MaxChannels']=u'2'
  db.settings[hostname]['DTSPassThru']=u'0'
  db.settings[hostname]['AC3PassThru']=u'0'

print 'Host: %s'%hostname
print '\tAudio device: %s'%db.settings[hostname]['AudioOutputDevice']
print '\tMax Channels: %s'%db.settings[hostname]['MaxChannels']
print '\tDTS: %s    AC3: %s'%(db.settings[hostname]['DTSPassThru'],db.settings[hostname]['AC3PassThru'])

be.backendCommand('MESSAGE[]:[]CLEAR_SETTINGS_CACHE')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.mythtv.org/pipermail/mythtv-dev/attachments/20111204/f1a5ae4f/attachment.html 


More information about the mythtv-dev mailing list