summaryrefslogtreecommitdiffstats
path: root/TOOLS/lua/autocrop.lua
diff options
context:
space:
mode:
Diffstat (limited to 'TOOLS/lua/autocrop.lua')
-rw-r--r--TOOLS/lua/autocrop.lua36
1 files changed, 18 insertions, 18 deletions
diff --git a/TOOLS/lua/autocrop.lua b/TOOLS/lua/autocrop.lua
index bf598e8b05..cbc4c252ff 100644
--- a/TOOLS/lua/autocrop.lua
+++ b/TOOLS/lua/autocrop.lua
@@ -42,11 +42,11 @@ function del_filter_if_present(label)
-- error if the filter doesn't exist
local vfs = mp.get_property_native("vf")
for i,vf in pairs(vfs) do
- if vf["label"] == label then
- table.remove(vfs, i)
- mp.set_property_native("vf", vfs)
- return true
- end
+ if vf["label"] == label then
+ table.remove(vfs, i)
+ mp.set_property_native("vf", vfs)
+ return true
+ end
end
return false
end
@@ -65,10 +65,10 @@ function autocrop_start()
-- insert the cropdetect filter
ret=mp.command(
- string.format(
- 'vf add @%s:lavfi=graph="cropdetect=limit=24:round=2:reset=0"',
- cropdetect_label
- )
+ string.format(
+ 'vf add @%s:lavfi=graph="cropdetect=limit=24:round=2:reset=0"',
+ cropdetect_label
+ )
)
-- wait to gather data
timer=mp.add_timeout(detect_seconds, do_crop)
@@ -77,15 +77,15 @@ end
function do_crop()
-- get the metadata
local cropdetect_metadata = mp.get_property_native(
- string.format("vf-metadata/%s", cropdetect_label)
+ string.format("vf-metadata/%s", cropdetect_label)
)
-- use it to crop if its valid
if cropdetect_metadata then
- if cropdetect_metadata["lavfi.cropdetect.w"]
- and cropdetect_metadata["lavfi.cropdetect.h"]
- and cropdetect_metadata["lavfi.cropdetect.x"]
- and cropdetect_metadata["lavfi.cropdetect.y"]
- then
+ if cropdetect_metadata["lavfi.cropdetect.w"]
+ and cropdetect_metadata["lavfi.cropdetect.h"]
+ and cropdetect_metadata["lavfi.cropdetect.x"]
+ and cropdetect_metadata["lavfi.cropdetect.y"]
+ then
mp.command(string.format("vf add @%s:crop=%s:%s:%s:%s",
crop_label,
cropdetect_metadata["lavfi.cropdetect.w"],
@@ -94,9 +94,9 @@ function do_crop()
cropdetect_metadata["lavfi.cropdetect.y"]))
else
mp.msg.error(
- "Got empty crop data. You might need to increase detect_seconds."
- )
- end
+ "Got empty crop data. You might need to increase detect_seconds."
+ )
+ end
else
mp.msg.error(
"No crop data. Was the cropdetect filter successfully inserted?"