diff options
Diffstat (limited to 'osd.lua')
| -rw-r--r-- | osd.lua | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -19,6 +19,10 @@ for k, v in pairs(config.colours) do colours[k] = '{\\c&H' .. tag end +local bgra_file = mp_utils.join_path( + config.tmp_dir, + mp.get_script_name() .. '-' .. mp_utils.getpid() .. '.bgra') + local function draw_rect(x1, y1, x2, y2) return string.format( '{\\p1}m %f %f l %f %f %f %f %f %f{\\p0}', @@ -57,6 +61,16 @@ function osd.new(init) return t end +function mt:destroy() + if self.magick_cmd_id then + mp.abort_async_command(self.magick_cmd_id) + end + + if mp_utils.file_info(bgra_file) then + os.remove(bgra_file) + end +end + function mt:dirty() self.is_dirty = true end @@ -256,7 +270,7 @@ function mt:load_img() self.img.min_h, self.img.min_w, self.img.max_h, self.img.max_w), '-print', '%w %h', - 'tmp.bgra' + bgra_file } print('exec: ' .. mp_utils.to_string(magick_cmd)) self.img.magick_cmd = magick_cmd @@ -289,7 +303,7 @@ function mt:load_img() self.img.cmd = { name = 'overlay-add', id = 0, - file = 'tmp.bgra', + file = bgra_file, w = w, h = h, x = self.img.right - w, |
