aboutsummaryrefslogtreecommitdiffhomepage
path: root/sub
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2016-03-07 22:20:51 +0100
committerGravatar wm4 <wm4@nowhere>2016-03-07 22:22:18 +0100
commit5fa45fb5641c95a5dc65faac2087d842333b5425 (patch)
tree0807f5cff191b18427b36ebf5d30de25620ae033 /sub
parentb7617f42d873adceebd3904d906e4eff818240ed (diff)
osd, lua: remove weird OSD scaling
Do not scale OSD mouse input to the ASS OSD script resolution. The original idea of this mechanism was that the user doesn't have to care about the actual resolution of anything, and can just use the OSD resolution consistently. But this made things worse. Remove the implicit scaling, and always use the screen resolution. (Except with --vo=xv, where additional scaling is forced upon everything.) Drop get_osd_resolution(). There is no replacement. Rename get_screen_size() and get_screen_margins() to use "osd" instead of "screen". For anything but --vo=xv these are equivalent, but with --vo=xv the OSD resolution has additional implicit scaling. Add code to osc.lua which emulates the old behavior. Note that none of the changed functions were public API, so implicit breakage of scripts which used it is just going to happen.
Diffstat (limited to 'sub')
-rw-r--r--sub/osd.c15
-rw-r--r--sub/osd.h7
-rw-r--r--sub/osd_dummy.c7
-rw-r--r--sub/osd_libass.c10
4 files changed, 0 insertions, 39 deletions
diff --git a/sub/osd.c b/sub/osd.c
index 81cfb7daa6..a9bc035c73 100644
--- a/sub/osd.c
+++ b/sub/osd.c
@@ -422,21 +422,6 @@ bool osd_query_and_reset_want_redraw(struct osd_state *osd)
return r;
}
-// Scale factor to translate OSD coordinates to what the obj uses internally.
-// osd_coordinates * (sw, sh) = obj_coordinates
-void osd_object_get_scale_factor(struct osd_state *osd, int obj,
- double *sw, double *sh)
-{
- int nw, nh;
- osd_object_get_resolution(osd, obj, &nw, &nh);
- pthread_mutex_lock(&osd->lock);
- int vow = osd->objs[obj]->vo_res.w;
- int voh = osd->objs[obj]->vo_res.h;
- pthread_mutex_unlock(&osd->lock);
- *sw = vow ? nw / (double)vow : 0;
- *sh = voh ? nh / (double)voh : 0;
-}
-
struct mp_osd_res osd_get_vo_res(struct osd_state *osd, int obj)
{
pthread_mutex_lock(&osd->lock);
diff --git a/sub/osd.h b/sub/osd.h
index 4e18ce7f7c..c066b09645 100644
--- a/sub/osd.h
+++ b/sub/osd.h
@@ -190,9 +190,6 @@ void osd_draw_on_image_p(struct osd_state *osd, struct mp_osd_res res,
struct mp_image_params;
struct mp_osd_res osd_res_from_image_params(const struct mp_image_params *p);
-void osd_object_get_scale_factor(struct osd_state *osd, int obj,
- double *sw, double *sh);
-
struct mp_osd_res osd_get_vo_res(struct osd_state *osd, int obj);
void osd_rescale_bitmaps(struct sub_bitmaps *imgs, int frame_w, int frame_h,
@@ -211,8 +208,4 @@ void osd_get_function_sym(char *buffer, size_t buffer_size, int osd_function);
extern const char *const osd_ass_0;
extern const char *const osd_ass_1;
-// defined in backend, but locks if required
-void osd_object_get_resolution(struct osd_state *osd, int obj,
- int *out_w, int *out_h);
-
#endif /* MPLAYER_SUB_H */
diff --git a/sub/osd_dummy.c b/sub/osd_dummy.c
index 5c50569dd6..1982870248 100644
--- a/sub/osd_dummy.c
+++ b/sub/osd_dummy.c
@@ -26,10 +26,3 @@ void osd_object_get_bitmaps(struct osd_state *osd, struct osd_object *obj,
{
*out_imgs = (struct sub_bitmaps) {0};
}
-
-void osd_object_get_resolution(struct osd_state *osd, int obj,
- int *out_w, int *out_h)
-{
- *out_w = 0;
- *out_h = 0;
-}
diff --git a/sub/osd_libass.c b/sub/osd_libass.c
index eed2822380..cd28396746 100644
--- a/sub/osd_libass.c
+++ b/sub/osd_libass.c
@@ -477,13 +477,3 @@ void osd_object_get_bitmaps(struct osd_state *osd, struct osd_object *obj,
&obj->parts_cache, out_imgs);
talloc_steal(obj, obj->parts_cache);
}
-
-void osd_object_get_resolution(struct osd_state *osd, int obj,
- int *out_w, int *out_h)
-{
- pthread_mutex_lock(&osd->lock);
- struct osd_object *osd_obj = osd->objs[obj];
- *out_w = osd_obj->osd_track ? osd_obj->osd_track->PlayResX : 0;
- *out_h = osd_obj->osd_track ? osd_obj->osd_track->PlayResY : 0;
- pthread_mutex_unlock(&osd->lock);
-}