0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00
mpv/sub/osd_state.h
wm4 37cf92c07a sub: change how libass output is converted to RGBA in some cases
This affects VOs (or other code which render OSD) which does not support
the LIBASS format, but only RGBA. Instead of having a converter stage in
osd.c, make mp_ass_packer_pack() output directly in RGBA.

In general, this is work towards refcounted subtitle images.

Although we could keep the "converter" design, doing it this way seems
simpler, at least considering the current situation with only 2 OSD
formats. It also prevents copying & packing the data twice, which will
lead to better performance. (Although I guess this case is not important
at all.)

It also fixes --force-rgba-osd-rendering when used with vo_opengl,
vo_vdpau, and vo_direct3d.
2016-07-03 19:32:31 +02:00

86 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;
bool force_redraw;
// OSDTYPE_OSD
char *text;
// OSDTYPE_OSD
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;
bool want_redraw;
struct MPOpts *opts;
struct mpv_global *global;
struct mp_log *log;
struct mp_draw_sub_cache *draw_cache;
};
void osd_changed_unlocked(struct osd_state *osd, int obj);
#endif