mirror of
https://github.com/mpv-player/mpv.git
synced 2025-12-28 05:33:14 +00:00
TOOLS/autocrop.lua: improve enable/disable condition
The previous code tried to disable autocrop for cover-art by testing that track-list/$vid/albumart is false, however, $vid is completely unrelated to the track-list index. It only sometimes succeeded to disable for albumart, by accident, e.g. with one audio track and one video track where $vid==1 and track-list/1 happens to be the video (cover art) track. The new code detects the currently-used video track by finding a track with type=="video" and selected==true. Unlike the previous code, it also works in scenarios with many audio/video/sub tracks. Additionally, autocrop is now enabled also with lavfi-complex, which should be considered an improvement. The previous code implicitly disabled it with lavfi-complex because $vid is nil on such case.
This commit is contained in:
committed by
Avi Halachmi (:avih)
parent
8ace8e8790
commit
075154175d
@@ -102,12 +102,13 @@ function is_enough_time(seconds)
|
||||
end
|
||||
|
||||
function is_cropable()
|
||||
local vid = mp.get_property_native("vid")
|
||||
local is_album = vid and mp.get_property_native(
|
||||
string.format("track-list/%d/albumart", vid)
|
||||
) or false
|
||||
for _, track in pairs(mp.get_property_native('track-list')) do
|
||||
if track.type == 'video' and track.selected then
|
||||
return not track.albumart
|
||||
end
|
||||
end
|
||||
|
||||
return vid and not is_album
|
||||
return false
|
||||
end
|
||||
|
||||
function remove_filter(label)
|
||||
|
||||
Reference in New Issue
Block a user