Vl c список выходных устройств - PullRequest
0 голосов
/ 12 июля 2020
import vlc
import time

Instance = vlc.Instance('--verbose 9')
player = Instance.media_player_new()

output_devices = []
mods = player.audio_output_device_enum()
if mods:
    mod = mods
    while mod:
        mod = mod.contents
        output_devices.append(mod.device)
        mod = mod.next

print(output_devices)

for device in output_devices:
    player.audio_output_device_set(None, device)
    time.sleep(2)


object_methods = [method_name for method_name in dir(player)
                  if callable(getattr(player, method_name))]

for player_method in object_methods:
    if "output" in player_method or "input" in player_method:
        print(player_method)

Вывод:

[b'surround21', b'surround40', b'surround41', b'surround50', b'surround51', b'surround71', b'null', b'samplerate', b'speexrate', b'jack', b'oss', b'pulse', b'upmix', b'vdownmix', b'default', b'hdmi:CARD=NVidia,DEV=0', b'hdmi:CARD=NVidia,DEV=1', b'dmix:CARD=NVidia,DEV=3', b'dmix:CARD=NVidia,DEV=7', b'dsnoop:CARD=NVidia,DEV=3', b'dsnoop:CARD=NVidia,DEV=7', b'hw:CARD=NVidia,DEV=3', b'hw:CARD=NVidia,DEV=7', b'plughw:CARD=NVidia,DEV=3', b'plughw:CARD=NVidia,DEV=7', b'usbstream:CARD=NVidia', b'sysdefault:CARD=PCH', b'front:CARD=PCH,DEV=0', b'surround21:CARD=PCH,DEV=0', b'surround40:CARD=PCH,DEV=0', b'surround41:CARD=PCH,DEV=0', b'surround50:CARD=PCH,DEV=0', b'surround51:CARD=PCH,DEV=0', b'surround71:CARD=PCH,DEV=0', b'dmix:CARD=PCH,DEV=0', b'dmix:CARD=PCH,DEV=2', b'dsnoop:CARD=PCH,DEV=0', b'dsnoop:CARD=PCH,DEV=2', b'hw:CARD=PCH,DEV=0', b'hw:CARD=PCH,DEV=2', b'plughw:CARD=PCH,DEV=0', b'plughw:CARD=PCH,DEV=2', b'usbstream:CARD=PCH']
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
[00005647ed9b9ef0] main audio output debug: restart requested (3)
audio_output_device_enum
audio_output_device_get
audio_output_device_set
audio_output_set
video_set_key_input
video_set_mouse_input

Правильный ли вывод?

Я хочу выбрать устройство ввода и вывода для каждого случая: (пример: MainPlayer, PreviewPlayer)

...