mirror of
https://github.com/mpv-player/mpv
synced 2025-02-15 19:47:32 +00:00
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).
This commit is contained in:
parent
0f0520aeca
commit
bab85944df
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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);
|
||||
|
@ -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));
|
||||
|
@ -95,6 +95,8 @@ enum mp_voctrl {
|
||||
|
||||
VOCTRL_SET_CURSOR_VISIBILITY, // bool*
|
||||
|
||||
VOCTRL_CONTENT_TYPE, // enum mp_content_type*
|
||||
|
||||
VOCTRL_KILL_SCREENSAVER,
|
||||
VOCTRL_RESTORE_SCREENSAVER,
|
||||
|
||||
@ -129,6 +131,13 @@ enum mp_voctrl {
|
||||
VOCTRL_EXTERNAL_RESIZE,
|
||||
};
|
||||
|
||||
// Helper to expose what kind of content is curently playing to the VO.
|
||||
enum mp_content_type {
|
||||
MP_CONTENT_NONE, // used for force-window
|
||||
MP_CONTENT_IMAGE,
|
||||
MP_CONTENT_VIDEO,
|
||||
};
|
||||
|
||||
#define VO_TRUE true
|
||||
#define VO_FALSE false
|
||||
#define VO_ERROR -1
|
||||
|
Loading…
Reference in New Issue
Block a user