当前位置: 首页>>代码示例>>Python>>正文


Python OrdDict.mixercontrol方法代码示例

本文整理汇总了Python中orddict.OrdDict.mixercontrol方法的典型用法代码示例。如果您正苦于以下问题:Python OrdDict.mixercontrol方法的具体用法?Python OrdDict.mixercontrol怎么用?Python OrdDict.mixercontrol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在orddict.OrdDict的用法示例。


在下文中一共展示了OrdDict.mixercontrol方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ProcessAudio

# 需要导入模块: from orddict import OrdDict [as 别名]
# 或者: from orddict.OrdDict import mixercontrol [as 别名]
    def ProcessAudio(self):
        def _bool(val):
            if val is None:
                return False
            return bool(int(val))

        def _read_file(filename):
            firstline=[]
            try:
                with open(filename,'r') as f:
                        line = f.readline()
                        firstline = line.split()
            except:
                pass
            return firstline
             
            
        def _oss_alsa():
            snd_type = "unknown"
            version = "unknown"
            alsasnd = "/proc/asound/version"
            osssnd = "/dev/sndstat"
            
            if os.path.exists(alsasnd):
                snd_type = "ALSA"
                version = _read_file(alsasnd)[-1].rstrip(".")
                
            elif os.path.exists(osssnd):
                version = _read_file(osssnd)[1]
                snd_type = "OSS"
                
            return snd_type , version

        def _process_search(processname):
            foundit = False
            for line in os.popen("ps xa"):
                fields = line.split()
                pid = fields[0]
                process = fields[4].split("/")
                if processname in process :
                    foundit = True
                    break
            return foundit

        def _jack():
            if _process_search("jackd") or _process_search("jackdbus"):
                foundit = 1
            else:
                foundit = 0
            return foundit

        def _pulse():
            if _process_search("pulseaudio"):
                foundit = 1
            else:
                foundit = 0
            return foundit


        data = OrdDict()
        data.device           = _SETTINGS.AudioOutputDevice
        data.passthrudevice   = _SETTINGS.PassThruOutputDevice
        data.passthruoverride = _bool(_SETTINGS.PassThruDeviceOverride)
        data.stereopcm        = _bool(_SETTINGS.StereoPCM)
        data.sr_override      = _bool(_SETTINGS.Audio48kOverride)
        data.maxchannels      = _SETTINGS.MaxChannels
        data.defaultupmix     = _bool(_SETTINGS.AudioDefaultUpmix)
        data.upmixtype        = _SETTINGS.AudioUpmixType
        p = []
        for k,v in (('AC3PassThru', 'ac3'),         ('DTSPassThru', 'dts'),
                    ('HBRPassthru', 'hbr'),         ('EAC3PassThru', 'eac3'),
                    ('TrueHDPassThru', 'truehd'),   ('DTSHDPassThru', 'dtshd')):
            if _bool(_SETTINGS[k]):
                p.append(v)
        data.passthru         = p
        data.volcontrol       = _bool(_SETTINGS.MythControlsVolume)
        data.mixerdevice      = _SETTINGS.MixerDevice
        data.mixercontrol     = _SETTINGS.MixerControl
        data.jack             = _jack()
        data.pulse            = _pulse()
        data.audio_sys, data.audio_sys_version    = _oss_alsa()
        
        return {'audio': data}
开发者ID:JGunning,项目名称:OpenAOL-TV,代码行数:85,代码来源:data_mythtv.py


注:本文中的orddict.OrdDict.mixercontrol方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。