History

js: support mp.create_osd_overlay (match 07287262)

The legacy mp.set_osd_ass(...) is still supported (but also still undocumented) as a wrapper for the new mp.create_osd_overlay(...).

Avi Halachmi (:avih) committed 6 years ago

Commit 9f2fda71 parent 5a74bf53 files · +57 −23Browse files

Showing the changes to player/javascript.c (1 of 3 files). Show all

Unified · Split

player/javascript.c+0−23
@@ -732,17 +732,6 @@ static void script_get_time_ms(js_State *J) · 731 unmodified lines
732 js_pushnumber(J, mpv_get_time_us(jclient(J)) / (double)(1000));732 js_pushnumber(J, mpv_get_time_us(jclient(J)) / (double)(1000));
733}733}
734 734
735static void script_set_osd_ass(js_State *J)
736{
737 struct script_ctx *ctx = jctx(J);
738 int res_x = jsL_checkint(J, 1);
739 int res_y = jsL_checkint(J, 2);
740 const char *text = js_tostring(J, 3);
741 //osd_set_external(ctx->mpctx->osd, ctx->client, res_x, res_y, (char *)text);
742 mp_wakeup_core(ctx->mpctx);
743 push_success(J);
744}
745
746// push object with properties names (NULL terminated) with respective vals735// push object with properties names (NULL terminated) with respective vals
747static void push_nums_obj(js_State *J, const char * const names[],736static void push_nums_obj(js_State *J, const char * const names[],
748 const double vals[])737 const double vals[])
@@ -754,16 +743,6 @@ static void push_nums_obj(js_State *J, const char * const names[], · 5 unmodified lines
754 }743 }
755}744}
756 745
757// args: none, return: object with properties width, height, aspect
758static void script_get_osd_size(js_State *J)
759{
760 struct mp_osd_res r = osd_get_vo_res(jctx(J)->mpctx->osd);
761 double ar = 1.0 * r.w / MPMAX(r.h, 1) / (r.display_par ? r.display_par : 1);
762 const char * const names[] = {"width", "height", "aspect", NULL};
763 const double vals[] = {r.w, r.h, ar};
764 push_nums_obj(J, names, vals);
765}
766
767// args: none, return: object with properties top, bottom, left, right746// args: none, return: object with properties top, bottom, left, right
768static void script_get_osd_margins(js_State *J)747static void script_get_osd_margins(js_State *J)
769{748{
@@ -1258,8 +1237,6 @@ static const struct fn_entry main_fns[] = { · 488 unmodified lines
1258 FN_ENTRY(get_wakeup_pipe, 0),1237 FN_ENTRY(get_wakeup_pipe, 0),
1259 FN_ENTRY(_hook_add, 3),1238 FN_ENTRY(_hook_add, 3),
1260 FN_ENTRY(_hook_continue, 1),1239 FN_ENTRY(_hook_continue, 1),
1261 FN_ENTRY(set_osd_ass, 3),
1262 FN_ENTRY(get_osd_size, 0),
1263 FN_ENTRY(get_osd_margins, 0),1240 FN_ENTRY(get_osd_margins, 0),
1264 FN_ENTRY(get_mouse_pos, 0),1241 FN_ENTRY(get_mouse_pos, 0),
1265 FN_ENTRY(input_set_section_mouse_area, 5),1242 FN_ENTRY(input_set_section_mouse_area, 5),

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t