mpv/sub
wm4 e9e883e3b2 video: make OSD/subtitle bitmaps refcounted (sort of)
Making OSD/subtitle bitmaps refcounted was planend a longer time ago,
e.g. the sub_bitmaps.packed field (which refcounts the subtitle bitmap
data) was added in 2016. But nothing benefited much from it, because
struct sub_bitmaps was usually stack allocated, and there was this weird
callback stuff through osd_draw().

Make it possible to get actually refcounted subtitle bitmaps on the OSD
API level. For this, we just copy all subtitle data other than the
bitmaps with sub_bitmaps_copy(). At first, I had planned some fancy
refcount shit, but when that was a big mess and hard to debug and just
boiled to emulating malloc(), I made it a full allocation+copy. This
affects mostly the parts array. With crazy ASS subtitles, this parts
array can get pretty big (thousands of elements or more), in which case
the extra alloc/copy could become performance relevant. But then again
this is just pure bullshit, and I see no need to care. In practice, this
extra work most likely gets drowned out by libass murdering a single
core (while mpv is waiting for it) anyway. So fuck it.

I just wanted this so draw_bmp.c requires only a single call to render
everything. VOs also can benefit from this, because the weird callback
shit isn't necessary anymore (simpler code), but I haven't done anything
about it yet. In general I'd hope this will work towards simplifying the
OSD layer, which is prerequisite for making actual further improvements.

I haven't tested some cases such as the "overlay-add" command. Maybe it
crashes now? Who knows, who cares.

In addition, it might be worthwhile to reduce the code duplication
between all the things that output subtitle bitmaps (with repacking,
image allocation, etc.), but that's orthogonal.
2020-04-26 23:34:32 +02:00
..
ass_mp.c video: make OSD/subtitle bitmaps refcounted (sort of) 2020-04-26 23:34:32 +02:00
ass_mp.h command: extend osd-overlay command with bounds reporting 2020-03-06 18:20:11 +01:00
dec_sub.c video: make OSD/subtitle bitmaps refcounted (sort of) 2020-04-26 23:34:32 +02:00
dec_sub.h video: make OSD/subtitle bitmaps refcounted (sort of) 2020-04-26 23:34:32 +02:00
draw_bmp.c video: make OSD/subtitle bitmaps refcounted (sort of) 2020-04-26 23:34:32 +02:00
draw_bmp.h video: make OSD/subtitle bitmaps refcounted (sort of) 2020-04-26 23:34:32 +02:00
filter_regex.c sub: add an option to filter subtitles by regex 2020-02-16 02:07:24 +01:00
filter_sdh.c sub: make filter_sdh a "proper" filter, allow runtime changes 2020-02-16 02:07:24 +01:00
img_convert.c Replace uses of FFMIN/MAX with MPMIN/MAX 2019-10-31 11:24:20 +01:00
img_convert.h sub: move RGBA scaling to vo_vaapi 2016-07-03 19:32:43 +02:00
lavc_conv.c Remove remains of Libav compatibility 2020-02-16 15:14:55 +01:00
osd.c video: make OSD/subtitle bitmaps refcounted (sort of) 2020-04-26 23:34:32 +02:00
osd.h video: make OSD/subtitle bitmaps refcounted (sort of) 2020-04-26 23:34:32 +02:00
osd_font.otf osc: use custom symbols for window controls 2019-12-11 13:53:10 -08:00
osd_libass.c video: make OSD/subtitle bitmaps refcounted (sort of) 2020-04-26 23:34:32 +02:00
osd_state.h video: make OSD/subtitle bitmaps refcounted (sort of) 2020-04-26 23:34:32 +02:00
sd.h video: make OSD/subtitle bitmaps refcounted (sort of) 2020-04-26 23:34:32 +02:00
sd_ass.c video: make OSD/subtitle bitmaps refcounted (sort of) 2020-04-26 23:34:32 +02:00
sd_lavc.c video: make OSD/subtitle bitmaps refcounted (sort of) 2020-04-26 23:34:32 +02:00