summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/interface-changes.rst1
-rw-r--r--DOCS/man/input.rst5
-rw-r--r--player/command.c8
3 files changed, 14 insertions, 0 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst
index f2afaf595f..cfd248b1e4 100644
--- a/DOCS/interface-changes.rst
+++ b/DOCS/interface-changes.rst
@@ -20,6 +20,7 @@ Interface changes
::
--- mpv 0.10.0 will be released ---
+ - add ``track-list/N/audio-channels`` property
- change --screenshot-tag-colorspace default value
- add --stretch-image-subs-to-screen
- add "playlist/N/title" property
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 775b45d9e9..e46d802888 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -1574,6 +1574,10 @@ Property list
``track-list/N/lang``
Track language as identified by the file. Not always available.
+ ``track-list/N/audio-channels``
+ For audio tracks, the number of audio channels in the audio stream.
+ Not always accurate (depends on container hints). Not always available.
+
``track-list/N/albumart``
``yes`` if this is a video track that consists of a single picture,
``no`` or unavailable otherwise. This is used for video tracks that are
@@ -1622,6 +1626,7 @@ Property list
"src-id" MPV_FORMAT_INT64
"title" MPV_FORMAT_STRING
"lang" MPV_FORMAT_STRING
+ "audio-channels" MPV_FORMAT_INT64
"albumart" MPV_FORMAT_FLAG
"default" MPV_FORMAT_FLAG
"forced" MPV_FORMAT_FLAG
diff --git a/player/command.c b/player/command.c
index 0f3e455929..ad87a6314f 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1861,6 +1861,12 @@ static int property_switch_track_ff(void *ctx, struct m_property *prop,
return mp_property_generic_option(mpctx, prop, action, arg);
}
+static int track_channels(struct track *track)
+{
+ return track->stream && track->stream->audio
+ ? track->stream->audio->channels.num : 0;
+}
+
static int get_track_entry(int item, int action, void *arg, void *ctx)
{
struct MPContext *mpctx = ctx;
@@ -1878,6 +1884,8 @@ static int get_track_entry(int item, int action, void *arg, void *ctx)
.unavailable = !track->title},
{"lang", SUB_PROP_STR(track->lang),
.unavailable = !track->lang},
+ {"audio-channels", SUB_PROP_INT(track_channels(track)),
+ .unavailable = track_channels(track) <= 0},
{"albumart", SUB_PROP_FLAG(track->attached_picture)},
{"default", SUB_PROP_FLAG(track->default_track)},
{"forced", SUB_PROP_FLAG(track->forced_track)},