summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorGuido Cella <guido@guidocella.xyz>2021-09-15 21:33:47 +0200
committerDudemanguy <random342@airmail.cc>2021-10-15 15:11:00 +0000
commite16d0dd15d447921c34528df2a363e6afbb8288b (patch)
tree7d5a0ea80a8df1c902d7d430995a5cb844df8430 /player
parent9954fe01a91494b7b631d50a35e7c1d43b729529 (diff)
downloadmpv-e16d0dd15d447921c34528df2a363e6afbb8288b.tar.bz2
mpv-e16d0dd15d447921c34528df2a363e6afbb8288b.tar.xz
command: with lavfi-complex, make current-tracks return the first one
This behavior is more convenient and allows profile conditions like: [video] profile-cond=get('current-tracks/video/image') == false [image] profile-cond=get('current-tracks/video/image') Otherwise, these profiles have to be manually applied and restored in a script. The note about discouraging the use of current-tracks in scripts is removed, because it makes people avoid using this convenient property. It was added in 720bcd79d03 without leaving an explanation of why you shouldn't use it, and the only reason seems to be that it doesn't work with lavfi-complex, but this commit changes that.
Diffstat (limited to 'player')
-rw-r--r--player/command.c10
1 files changed, 10 insertions, 0 deletions
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;