mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
sub: uglify OSD code path with locking
Do two things: 1. add locking to struct osd_state 2. make struct osd_state opaque While 1. is somewhat simple, 2. is quite horrible. Lots of code accesses lots of osd_state (and osd_object) members. To make sure everything is accessed synchronously, I prefer making osd_state opaque, even if it means adding pretty dumb accessors. All of this is meant to allow running VO in their own threads. Eventually, VOs will request OSD on their own, which means osd_state will be accessed from foreign threads.
This commit is contained in:
@@ -307,7 +307,7 @@ static void add_subs(struct MPContext *mpctx, struct mp_image *image)
|
||||
.display_par = sar / dar,
|
||||
};
|
||||
|
||||
osd_draw_on_image(mpctx->osd, res, mpctx->osd->vo_pts,
|
||||
osd_draw_on_image(mpctx->osd, res, osd_get_vo_pts(mpctx->osd),
|
||||
OSD_DRAW_SUB_ONLY, image);
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ static struct mp_image *screenshot_get(struct MPContext *mpctx, int mode)
|
||||
{
|
||||
struct mp_image *image = NULL;
|
||||
if (mpctx->video_out && mpctx->video_out->config_ok) {
|
||||
if (mode == MODE_SUBTITLES && mpctx->osd->render_subs_in_filter)
|
||||
if (mode == MODE_SUBTITLES && osd_get_render_subs_in_filter(mpctx->osd))
|
||||
mode = 0;
|
||||
|
||||
struct voctrl_screenshot_args args =
|
||||
@@ -386,7 +386,7 @@ void screenshot_request(struct MPContext *mpctx, int mode, bool each_frame,
|
||||
{
|
||||
screenshot_ctx *ctx = mpctx->screenshot_ctx;
|
||||
|
||||
if (mode == MODE_SUBTITLES && mpctx->osd->render_subs_in_filter)
|
||||
if (mode == MODE_SUBTITLES && osd_get_render_subs_in_filter(mpctx->osd))
|
||||
mode = 0;
|
||||
|
||||
if (each_frame) {
|
||||
|
||||
Reference in New Issue
Block a user