command: extend osd-overlay command with bounds reporting

This is more or less a minimal hack to make _some_ text measurement
functionality available to scripts. Since libass does not support such a
thing, this simply uses the bounding box of the rendered text.

This is far from ideal. Problems include:
- using a bitmap bounding box
- additional memory waste and/or flushing caches
- dependency on window size
- odd small deviations with different window sizes (run osd-test.lua and
  resize the window after each timer update; the bounding boxes aren't
  adjusted in an overly useful way)
- inability to query the size _after_ actual rendering

But I guess it's a start. Since I'm aware that it's crap, add a threat
to the manpage that this may be changed/removed again. For now, I'm
interested whether anyone will have use for it in its current form, as
it's an often requested feature.
This commit is contained in:
wm4
2020-03-06 18:20:11 +01:00
parent c6822b853d
commit 7a76b577d8
10 changed files with 161 additions and 8 deletions

View File

@@ -209,6 +209,9 @@ struct osd_external_ass {
char *data;
int res_x, res_y;
int z;
bool hidden;
double *out_rc; // hack to pass boundary rect, [x0, y0, x1, y1]
};
// defined in osd_libass.c and osd_dummy.c