mirror of
https://github.com/mpv-player/mpv
synced 2024-12-20 13:52:10 +00:00
90b968a67a
If a VO is created, but no video is playing (i.e. --force-window is used), then until now no subtitles were shown. This is because VO subtitle display normally depends on video frame timing. If there are no video frames, there can be no subtitles. Change this and add some code to handle this situation specifically. Set a subtitle PTS manually and request VO redrawing manually, which gets the subtitles rendered somehow. This is kind of shaky. The subtitles are essentially sampled at arbitrary times (such as when new audio data is decoded and pushed to the AO, or on user interaction). To make a it slightly more consistent, force a completely arbitrary minimum FPS of 10. Other solutions (such as creating fake video) would be more intrusive or would require VO-level API changes. Fixes #3684.
83 lines
1.4 KiB
C
83 lines
1.4 KiB
C
#ifndef MP_OSD_STATE_H_
|
|
#define MP_OSD_STATE_H_
|
|
|
|
#include <pthread.h>
|
|
|
|
#include "osd.h"
|
|
|
|
enum mp_osdtype {
|
|
OSDTYPE_SUB,
|
|
OSDTYPE_SUB2, // IDs must be numerically successive
|
|
|
|
OSDTYPE_OSD,
|
|
|
|
OSDTYPE_EXTERNAL,
|
|
OSDTYPE_EXTERNAL2,
|
|
|
|
OSDTYPE_COUNT
|
|
};
|
|
|
|
struct ass_state {
|
|
struct mp_log *log;
|
|
struct ass_track *track;
|
|
struct ass_renderer *render;
|
|
struct ass_library *library;
|
|
};
|
|
|
|
struct osd_object {
|
|
int type; // OSDTYPE_*
|
|
bool is_sub;
|
|
|
|
// OSDTYPE_OSD
|
|
bool osd_changed;
|
|
char *text;
|
|
struct osd_progbar_state progbar_state;
|
|
|
|
// OSDTYPE_SUB/OSDTYPE_SUB2
|
|
struct dec_sub *sub;
|
|
|
|
// OSDTYPE_EXTERNAL
|
|
struct osd_external *externals;
|
|
int num_externals;
|
|
|
|
// OSDTYPE_EXTERNAL2
|
|
struct sub_bitmaps *external2;
|
|
|
|
// VO cache state
|
|
int vo_change_id;
|
|
struct mp_osd_res vo_res;
|
|
|
|
// Internally used by osd_libass.c
|
|
bool changed;
|
|
struct ass_state ass;
|
|
struct mp_ass_packer *ass_packer;
|
|
struct ass_image **ass_imgs;
|
|
};
|
|
|
|
struct osd_external {
|
|
void *id;
|
|
char *text;
|
|
int res_x, res_y;
|
|
struct ass_state ass;
|
|
};
|
|
|
|
struct osd_state {
|
|
pthread_mutex_t lock;
|
|
|
|
struct osd_object *objs[MAX_OSD_PARTS];
|
|
|
|
bool render_subs_in_filter;
|
|
double force_video_pts;
|
|
|
|
bool want_redraw;
|
|
bool want_redraw_notification;
|
|
|
|
struct MPOpts *opts;
|
|
struct mpv_global *global;
|
|
struct mp_log *log;
|
|
|
|
struct mp_draw_sub_cache *draw_cache;
|
|
};
|
|
|
|
#endif
|