summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/input.rst11
-rw-r--r--player/command.c10
2 files changed, 12 insertions, 9 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 1a148589dd..bc1b1abd77 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -2976,15 +2976,8 @@ Property list
For example, ``current-tracks/audio/lang`` returns the current audio track's
language field (the same value as ``track-list/N/lang``).
- A sub-entry is accessible only if a track of that type is actually selected.
- Tracks selected via ``--lavfi-complex`` never appear under this property.
- ``current-tracks`` and ``current-tracks/`` are currently not accessible, and
- will not return anything.
-
- Scripts etc. should not use this. They should use ``track-list``, loop over
- all tracks, and inspect the ``selected`` field to test whether a track is
- selected (or compare the ``id`` field to the ``video`` / ``audio`` etc.
- options).
+ If tracks of the requested type are selected via ``--lavfi-complex``, the
+ first one is returned.
``chapter-list``
List of chapters, current entry marked. Currently, the raw property value
diff --git a/player/command.c b/player/command.c
index 2f17de2cf8..4f0055513d 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2076,6 +2076,16 @@ static int property_current_tracks(void *ctx, struct m_property *prop,
return M_PROPERTY_UNKNOWN;
struct track *t = mpctx->current_track[order][type];
+
+ if (!t && mpctx->lavfi) {
+ for (int n = 0; n < mpctx->num_tracks; n++) {
+ if (mpctx->tracks[n]->type == type && mpctx->tracks[n]->selected) {
+ t = mpctx->tracks[n];
+ break;
+ }
+ }
+ }
+
if (!t)
return M_PROPERTY_UNAVAILABLE;