mpv-player / mpv-player/mpv

Allow cycle of audio devices

Open
#2,398 12 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

core:api core:audio core:option-param-conf meta:feature-request priority:low
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

Currently, the audio output can be changed by writing to the audio-device property, as described in #605. However, to do this, you have to manually look up what your audio device IDs are, and then add them into input.conf manually:

A cycle_values audio-device pulse/alsa_output.pci-0000_00_1e.2.analog-stereo pulse/alsa_output.pci-0000_04_02.0.analog-stereo

…which isn't very clean, and needs reconfiguring every time the sound card setup is changed (such as plugging or removing a USB headset).

Would it be possible to set up cycle to cycle audio-device through the "$ao"/* values? For example, if my audio device options are:

$ mpv --audio-device=help
List of detected audio devices:
  'auto' (Autoselect device)
  'pulse/alsa_output.pci-0000_01_00.1.hdmi-stereo' (Caicos HDMI Audio [Radeon HD 6400 Series] Digital Stereo (HDMI))
  'pulse/alsa_output.pci-0000_04_02.0.analog-stereo' (CT4780 SBLive! Value Analog Stereo)
  'pulse/alsa_output.pci-0000_00_1e.2.analog-stereo' (Built-in Audio Analog Stereo)
  'alsa/iec958:CARD=ICH7,DEV=0' (Intel ICH7, Intel ICH7 - IEC958/IEC958 (S/PDIF) Digital Audio Output)
  'alsa/dmix:CARD=ICH7,DEV=4' (Intel ICH7, Intel ICH7 - IEC958/Direct sample mixing device)
  'alsa/dsnoop:CARD=ICH7,DEV=4' (Intel ICH7, Intel ICH7 - IEC958/Direct sample snooping device)
  'alsa/hw:CARD=ICH7,DEV=4' (Intel ICH7, Intel ICH7 - IEC958/Direct hardware device without any conversions)
  'alsa/plughw:CARD=ICH7,DEV=4' (Intel ICH7, Intel ICH7 - IEC958/Hardware device with all software conversions)
  'alsa/hdmi:CARD=HDMI,DEV=0' (HDA ATI HDMI, HDMI 0/HDMI Audio Output)
  'alsa/dmix:CARD=HDMI,DEV=3' (HDA ATI HDMI, HDMI 0/Direct sample mixing device)
  'alsa/dsnoop:CARD=HDMI,DEV=3' (HDA ATI HDMI, HDMI 0/Direct sample snooping device)
  'alsa/hw:CARD=HDMI,DEV=3' (HDA ATI HDMI, HDMI 0/Direct hardware device without any conversions)
  'alsa/plughw:CARD=HDMI,DEV=3' (HDA ATI HDMI, HDMI 0/Hardware device with all software conversions)
  'alsa/dmix:CARD=Live,DEV=3' (SB Live! Value [CT4780], Multichannel Playback/Direct sample mixing device)
  'alsa/dsnoop:CARD=Live,DEV=3' (SB Live! Value [CT4780], Multichannel Playback/Direct sample snooping device)
  'alsa/hw:CARD=Live,DEV=3' (SB Live! Value [CT4780], Multichannel Playback/Direct hardware device without any conversions)
  'alsa/plughw:CARD=Live,DEV=3' (SB Live! Value [CT4780], Multichannel Playback/Hardware device with all software conversions)
  'oss' (Default)
  'jack' (Default)
$ 

then A cycle audio-device, when using ao_pulse, would bind A to cycle through audio-device values pulse/alsa_output.pci-0000_01_00.1.hdmi-stereo, pulse/alsa_output.pci-0000_04_02.0.analog-stereo, and pulse/alsa_output.pci-0000_00_1e.2.analog-stereo.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the existing cycle command and audio-device property behavior, with the ao_pulse example and input.conf configuration as context. Determine how detected device values are exposed and how cycling selects them; done means A cycle audio-device selects the available PulseAudio devices without manually listing IDs.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
audio-video-rtc
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.