fix external filenames not working when secondary sid is active
This commit is contained in:
parent
896cfa9a95
commit
9e7623222f
|
@ -194,30 +194,22 @@ end
|
||||||
|
|
||||||
encoder = {}
|
encoder = {}
|
||||||
|
|
||||||
function encoder.get_active_track(track_type)
|
function encoder.get_ext_subs_path()
|
||||||
local track_list = mp.get_property_native('track-list')
|
local track_list = mp.get_property_native('track-list')
|
||||||
for _, track in pairs(track_list) do
|
for _, track in pairs(track_list) do
|
||||||
if track.type == track_type and track.selected == true then
|
if track.type == 'sub' and track.selected == true and track.external == true then
|
||||||
return track
|
return track['external-filename']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function encoder.get_ext_subs_fp()
|
|
||||||
local track = encoder.get_active_track('sub')
|
|
||||||
|
|
||||||
if track and track.external == true then
|
|
||||||
return track['external-filename']
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function encoder.append_embed_subs_args(args)
|
function encoder.append_embed_subs_args(args)
|
||||||
local ext_subs_fp = encoder.get_ext_subs_fp()
|
local ext_subs_path = encoder.get_ext_subs_path()
|
||||||
if ext_subs_fp then
|
if ext_subs_path then
|
||||||
table.insert(args, #args, table.concat { '--sub-files-append=', ext_subs_fp })
|
table.insert(args, #args, table.concat { '--sub-files-append=', ext_subs_path, })
|
||||||
end
|
end
|
||||||
table.insert(args, #args, table.concat { '--sid=', mp.get_property("sid") })
|
table.insert(args, #args, table.concat { '--sid=', ext_subs_path and 'auto' or mp.get_property("sid") })
|
||||||
table.insert(args, #args, table.concat { '--sub-delay=', mp.get_property("sub-delay") })
|
table.insert(args, #args, table.concat { '--sub-delay=', mp.get_property("sub-delay") })
|
||||||
return args
|
return args
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue