1
mirror of https://github.com/mpv-player/mpv synced 2024-10-26 07:22:17 +02:00
mpv/sub/osd_state.h
wm4 5a89150a46 player: remove OSD subtitle render path
This was used with --no-sub-ass (aka --no-ass). This option (which is
not yet removed) strips all styling from the subtitles, and renders them
as plaintext only. For some reason, it originally seemed convenient to
reuse all the OSD text rendering code (osd_libass.c). While this was
indeed simple, it had a bad influence on the rest of the code. For
example, it had to decide whether to go through the OSD code path, or
the proper subtitle renderer in sd_ass.c.

Kill the OSD subtitle renderer. Reimplement --no-sub-ass and also
"secondary" subtitles in sd_ass.c. fill_plaintext() contains some rather
minor code duplication with osd_libass.c for setting up a dummy
ASS_Event and escaping the stripped text. Since sd_ass.c already has to
handle "normal" text subtitles, and has code for stripping ASS tags,
this remains all relatively simple.

Remove all the unnecessary crap from the rest of the code.
2015-11-17 01:56:23 +01:00

63 lines
1.2 KiB
C

#ifndef MP_OSD_STATE_H_
#define MP_OSD_STATE_H_
#include <pthread.h>
#include "osd.h"
#define OSD_CONV_CACHE_MAX 4
struct osd_object {
int type; // OSDTYPE_*
bool is_sub;
bool force_redraw;
// OSDTYPE_SUB/OSDTYPE_SUB2/OSDTYPE_OSD/OSDTYPE_EXTERNAL
char *text;
// OSDTYPE_PROGBAR
struct osd_progbar_state progbar_state;
// OSDTYPE_SUB/OSDTYPE_SUB2
struct dec_sub *sub;
// OSDTYPE_EXTERNAL
int external_res_x, external_res_y;
// OSDTYPE_EXTERNAL2
struct sub_bitmaps *external2;
// caches for OSD conversion (internal to render_object())
struct osd_conv_cache *cache[OSD_CONV_CACHE_MAX];
struct sub_bitmaps cached;
// VO cache state
int vo_change_id;
struct mp_osd_res vo_res;
// Internally used by osd_libass.c
struct sub_bitmap *parts_cache;
struct ass_track *osd_track;
struct ass_renderer *osd_render;
struct ass_library *osd_ass_library;
};
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;
};
#endif