~guidocella/mpv-image-config

753b615c6736f42b7077cb317bbb5e956e86ff12 — Guido Cella 7 months ago 5f56f57
allow different dimensions in double-page-mode
1 files changed, 3 insertions(+), 6 deletions(-)

M scripts/image-bindings.lua
M scripts/image-bindings.lua => scripts/image-bindings.lua +3 -6
@@ 146,15 146,12 @@ mp.register_script_message('double-page-mode', function()
    mp.commandv('video-add', previous, 'auto')
    local track_list = mp.get_property_native('track-list')

    local graph = '[vid1] [vid2] hstack [vo]'
    if track_list[1]['demux-w'] ~= track_list[2]['demux-w'] or track_list[1]['demux-h'] ~= track_list[2]['demux-h'] then
        mp.command('video-remove 2')
        local error = 'The 2 images must have the same dimensions.'
        mp.msg.error(error)
        mp.osd_message(error)
        return
        graph = '[vid2] scale=' .. track_list[1]['demux-w'] .. ':' .. track_list[1]['demux-h'] .. ' [vid2-scaled]; [vid1] [vid2-scaled] hstack [vo]'
    end

    mp.set_property('lavfi-complex', '[vid1] [vid2] hstack [vo]')
    mp.set_property('lavfi-complex', graph)

    is_intial_callback = true
    mp.observe_property('playlist-pos', nil, undo_lavfi_complex)