summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorGuido Cella <guido@guidocella.xyz>2021-10-14 16:36:57 +0200
committerDudemanguy <random342@airmail.cc>2021-10-14 15:39:07 +0000
commit9954fe01a91494b7b631d50a35e7c1d43b729529 (patch)
tree9ee5492c1d4724fbb9323f0f9d36376fbf3836ec /player
parent00669dabd3f57c4791e463120f73a1566cac2426 (diff)
downloadmpv-9954fe01a91494b7b631d50a35e7c1d43b729529.tar.bz2
mpv-9954fe01a91494b7b631d50a35e7c1d43b729529.tar.xz
player: add track-list/N/image sub-property
This exposes whether a video track is detected as an image, which is useful for profile conditions, property expansion and lavfi-complex. The lavf demuxer sets image to true when the existing check detects an image. When the lavf demuxer fails, the mf one guesses if the file is an image by its extension, so sh->image is set to true when the mf demuxer succeds and there's only one file. The mkv demuxer just sets image to true for any attached picture. The timeline demuxer just copies the value of image from source to destination. This sets image to true for attached pictures, standalone images and images added with !new_stream in EDL playlists, but it is imperfect since you could concatenate multiple images in an EDL playlist (which should be done with the mf demuxer anyway). This is good enough anyway since the comment of the modified function already says it is "Imperfect and arbitrary".
Diffstat (limited to 'player')
-rw-r--r--player/command.c1
-rw-r--r--player/core.h1
-rw-r--r--player/loadfile.c1
3 files changed, 3 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index f2fb031819..2f17de2cf8 100644
--- a/player/command.c
+++ b/player/command.c
@@ -1949,6 +1949,7 @@ static int get_track_entry(int item, int action, void *arg, void *ctx)
.unavailable = !track->lang},
{"audio-channels", SUB_PROP_INT(track_channels(track)),
.unavailable = track_channels(track) <= 0},
+ {"image", SUB_PROP_FLAG(track->image)},
{"albumart", SUB_PROP_FLAG(track->attached_picture)},
{"default", SUB_PROP_FLAG(track->default_track)},
{"forced", SUB_PROP_FLAG(track->forced_track)},
diff --git a/player/core.h b/player/core.h
index 1d5b395b07..b59713721e 100644
--- a/player/core.h
+++ b/player/core.h
@@ -136,6 +136,7 @@ struct track {
char *title;
bool default_track, forced_track, dependent_track;
bool visual_impaired_track, hearing_impaired_track;
+ bool image;
bool attached_picture;
char *lang;
diff --git a/player/loadfile.c b/player/loadfile.c
index 3c0415aed6..51865cf191 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -421,6 +421,7 @@ static struct track *add_stream_track(struct MPContext *mpctx,
.dependent_track = stream->dependent_track,
.visual_impaired_track = stream->visual_impaired_track,
.hearing_impaired_track = stream->hearing_impaired_track,
+ .image = stream->image,
.attached_picture = stream->attached_picture != NULL,
.lang = stream->lang,
.demuxer = demuxer,