From 6a8b130c6f90f21e5da9bde1da80409976aa2207 Mon Sep 17 00:00:00 2001 From: Christoph Heinrich Date: Sat, 30 Mar 2024 04:22:12 +0800 Subject: TOOLS/lua/autoload: fix allow extending ext sets from script-opts https://github.com/mpv-player/mpv/commit/4eedb8710cccec719f393216f5f32b74025c7df9 has broken the normal work of this feature with --same_type=yes Co-Authored-by: dyphire --- TOOLS/lua/autoload.lua | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'TOOLS') diff --git a/TOOLS/lua/autoload.lua b/TOOLS/lua/autoload.lua index 7ec6924d31..e0cfeb2997 100644 --- a/TOOLS/lua/autoload.lua +++ b/TOOLS/lua/autoload.lua @@ -73,17 +73,17 @@ function Split (s) return set end -EXTENSIONS_VIDEO = Set { +EXTENSIONS_VIDEO_DEFAULT = Set { '3g2', '3gp', 'avi', 'flv', 'm2ts', 'm4v', 'mj2', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'ogv', 'rmvb', 'webm', 'wmv', 'y4m' } -EXTENSIONS_AUDIO = Set { +EXTENSIONS_AUDIO_DEFAULT = Set { 'aiff', 'ape', 'au', 'flac', 'm4a', 'mka', 'mp3', 'oga', 'ogg', 'ogm', 'opus', 'wav', 'wma' } -EXTENSIONS_IMAGES = Set { +EXTENSIONS_IMAGES_DEFAULT = Set { 'avif', 'bmp', 'gif', 'j2k', 'jp2', 'jpeg', 'jpg', 'jxl', 'png', 'svg', 'tga', 'tif', 'tiff', 'webp' } @@ -97,9 +97,21 @@ split_option_exts(true, true, true) function create_extensions() EXTENSIONS = {} - if o.videos then SetUnion(SetUnion(EXTENSIONS, EXTENSIONS_VIDEO), o.additional_video_exts) end - if o.audio then SetUnion(SetUnion(EXTENSIONS, EXTENSIONS_AUDIO), o.additional_audio_exts) end - if o.images then SetUnion(SetUnion(EXTENSIONS, EXTENSIONS_IMAGES), o.additional_image_exts) end + EXTENSIONS_VIDEO = {} + EXTENSIONS_AUDIO = {} + EXTENSIONS_IMAGES = {} + if o.videos then + SetUnion(SetUnion(EXTENSIONS_VIDEO, EXTENSIONS_VIDEO_DEFAULT), o.additional_video_exts) + SetUnion(EXTENSIONS, EXTENSIONS_VIDEO) + end + if o.audio then + SetUnion(SetUnion(EXTENSIONS_AUDIO, EXTENSIONS_AUDIO_DEFAULT), o.additional_audio_exts) + SetUnion(EXTENSIONS, EXTENSIONS_AUDIO) + end + if o.images then + SetUnion(SetUnion(EXTENSIONS_IMAGES, EXTENSIONS_IMAGES_DEFAULT), o.additional_image_exts) + SetUnion(EXTENSIONS, EXTENSIONS_IMAGES) + end end create_extensions() -- cgit v1.2.3