diff options
author | Guido Cella <guido@guidocella.xyz> | 2021-10-14 16:36:57 +0200 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2021-10-14 15:39:07 +0000 |
commit | 9954fe01a91494b7b631d50a35e7c1d43b729529 (patch) | |
tree | 9ee5492c1d4724fbb9323f0f9d36376fbf3836ec /demux | |
parent | 00669dabd3f57c4791e463120f73a1566cac2426 (diff) | |
download | mpv-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 'demux')
-rw-r--r-- | demux/demux_lavf.c | 1 | ||||
-rw-r--r-- | demux/demux_mf.c | 6 | ||||
-rw-r--r-- | demux/demux_mkv.c | 1 | ||||
-rw-r--r-- | demux/demux_timeline.c | 1 | ||||
-rw-r--r-- | demux/stheader.h | 1 |
5 files changed, 9 insertions, 1 deletions
diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index 1092911f50..942f29e61a 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -714,6 +714,7 @@ static void handle_new_stream(demuxer_t *demuxer, int i) strcmp(priv->avif->name, "image2pipe") == 0 )) { MP_VERBOSE(demuxer, "Assuming this is an image format.\n"); + sh->image = true; sh->codec->fps = priv->mf_fps; } sh->codec->par_w = st->sample_aspect_ratio.num; diff --git a/demux/demux_mf.c b/demux/demux_mf.c index 40f94f4e4e..69fa0fa91c 100644 --- a/demux/demux_mf.c +++ b/demux/demux_mf.c @@ -381,8 +381,12 @@ static int demux_open_mf(demuxer_t *demuxer, enum demux_check check) // create a new video stream header struct sh_stream *sh = demux_alloc_sh_stream(STREAM_VIDEO); - struct mp_codec_params *c = sh->codec; + if (mf->nr_of_files == 1) { + MP_VERBOSE(demuxer, "Assuming this is an image format.\n"); + sh->image = true; + } + struct mp_codec_params *c = sh->codec; c->codec = codec; c->disp_w = 0; c->disp_h = 0; diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c index d07f8fe1e0..b0117f0b6d 100644 --- a/demux/demux_mkv.c +++ b/demux/demux_mkv.c @@ -1300,6 +1300,7 @@ static void add_coverart(struct demuxer *demuxer) sh->attached_picture->pts = 0; talloc_steal(sh, sh->attached_picture); sh->attached_picture->keyframe = true; + sh->image = true; } sh->title = att->name; demux_add_sh_stream(demuxer, sh); diff --git a/demux/demux_timeline.c b/demux/demux_timeline.c index 9b4a049aee..5572fb53bf 100644 --- a/demux/demux_timeline.c +++ b/demux/demux_timeline.c @@ -525,6 +525,7 @@ static void apply_meta(struct sh_stream *dst, struct sh_stream *src) dst->missing_timestamps = src->missing_timestamps; if (src->attached_picture) dst->attached_picture = src->attached_picture; + dst->image = src->image; } // This is mostly for EDL user-defined metadata. diff --git a/demux/stheader.h b/demux/stheader.h index 6be3b16463..8d2129e05b 100644 --- a/demux/stheader.h +++ b/demux/stheader.h @@ -48,6 +48,7 @@ struct sh_stream { bool dependent_track; // container dependent track flag bool visual_impaired_track; // container flag bool hearing_impaired_track;// container flag + bool image; // video stream is an image bool still_image; // video stream contains still images int hls_bitrate; |