diff options
author | Dudemanguy <random342@airmail.cc> | 2022-11-15 15:50:38 -0600 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2022-11-15 23:18:55 +0000 |
commit | bab85944df3ae114a4d411fe7b0f243d4d222222 (patch) | |
tree | d23b46de28710469312984e76f5de1f9b8056a85 /player | |
parent | 0f0520aeca367613d313dbf2e936ea2cacdb35c9 (diff) | |
download | mpv-bab85944df3ae114a4d411fe7b0f243d4d222222.tar.bz2 mpv-bab85944df3ae114a4d411fe7b0f243d4d222222.tar.xz |
player/video: add VOCTRL_CONTENT_TYPE
mpv's core already keeps track of whether or not it thinks a track is an
image. Some VOs (i.e. wayland) would benefit from knowing if what is
currently being displayed is an image or not so add a new VOCTRL that
signals this anytime we load a new file with a VO. Additionally, let's
add a helper enum for signaling the kind of content that is being
displayed. There is now MP_CONTENT_NONE (strictly for force window being
used on a track with no image/video), MP_CONTENT_IMAGE, and
MP_CONTENT_VIDEO. See the next commit for the actual usage of this (with
wayland).
Diffstat (limited to 'player')
-rw-r--r-- | player/core.h | 1 | ||||
-rw-r--r-- | player/misc.c | 14 | ||||
-rw-r--r-- | player/playloop.c | 2 | ||||
-rw-r--r-- | player/video.c | 1 |
4 files changed, 18 insertions, 0 deletions
diff --git a/player/core.h b/player/core.h index c4a75aa25c..916a617832 100644 --- a/player/core.h +++ b/player/core.h @@ -556,6 +556,7 @@ double get_play_end_pts(struct MPContext *mpctx); double get_play_start_pts(struct MPContext *mpctx); bool get_ab_loop_times(struct MPContext *mpctx, double t[2]); void merge_playlist_files(struct playlist *pl); +void update_content_type(struct MPContext *mpctx, struct track *track); void update_vo_playback_state(struct MPContext *mpctx); void update_window_title(struct MPContext *mpctx, bool force); void error_on_track(struct MPContext *mpctx, struct track *track); diff --git a/player/misc.c b/player/misc.c index 80d6e5453a..6f3f98cd49 100644 --- a/player/misc.c +++ b/player/misc.c @@ -169,6 +169,20 @@ void issue_refresh_seek(struct MPContext *mpctx, enum seek_precision min_prec) queue_seek(mpctx, MPSEEK_ABSOLUTE, get_current_time(mpctx), min_prec, 0); } +void update_content_type(struct MPContext *mpctx, struct track *track) +{ + enum mp_content_type content_type; + if (!track || !track->vo_c) { + content_type = MP_CONTENT_NONE; + } else if (track->image) { + content_type = MP_CONTENT_IMAGE; + } else { + content_type = MP_CONTENT_VIDEO; + } + if (mpctx->video_out) + vo_control(mpctx->video_out, VOCTRL_CONTENT_TYPE, (void *)content_type); +} + void update_vo_playback_state(struct MPContext *mpctx) { if (mpctx->video_out && mpctx->video_out->config_ok) { diff --git a/player/playloop.c b/player/playloop.c index 91badf0647..8b0d017f9f 100644 --- a/player/playloop.c +++ b/player/playloop.c @@ -1036,6 +1036,8 @@ int handle_force_window(struct MPContext *mpctx, bool force) }; if (vo_reconfig(vo, &p) < 0) goto err; + struct track *track = mpctx->current_track[0][STREAM_VIDEO]; + update_content_type(mpctx, track); update_screensaver_state(mpctx); vo_set_paused(vo, true); vo_redraw(vo); diff --git a/player/video.c b/player/video.c index 6400979438..f7a31efd7a 100644 --- a/player/video.c +++ b/player/video.c @@ -276,6 +276,7 @@ void reinit_video_chain_src(struct MPContext *mpctx, struct track *track) if (!recreate_video_filters(mpctx)) goto err_out; + update_content_type(mpctx, track); update_screensaver_state(mpctx); vo_set_paused(vo_c->vo, get_internal_paused(mpctx)); |