/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package in.swapnilbhoite.projects.subtitlestudio.vlc;

import java.util.ArrayList;
import uk.co.caprica.vlcj.discovery.NativeDiscovery;
import uk.co.caprica.vlcj.filter.VideoFileFilter;
import uk.co.caprica.vlcj.runtime.RuntimeUtil;
import uk.co.caprica.vlcj.runtime.windows.WindowsRuntimeUtil;

/**
 *
 * @author Swapnil Bhoite
 */
public class VlcSdkImplementation implements VlcSdk {

    private VlcPlayer vlcPlayer;
    private String[] options;

    private VlcSdkImplementation() {
        ArrayList<String> optionsList = new ArrayList<String>();
        optionsList.add("--no-plugins-cache");
        optionsList.add("--no-video-title-show");
        optionsList.add("--no-snapshot-preview");
        if (RuntimeUtil.isWindows()) {
            optionsList.add("--plugin-path=" + WindowsRuntimeUtil.getVlcInstallDir() + "\\plugins");
            com.sun.jna.NativeLibrary.addSearchPath("libvlc", WindowsRuntimeUtil.getVlcInstallDir());
        } else {
            optionsList.add("--plugin-path=/home/linux/vlc/lib");
            com.sun.jna.NativeLibrary.addSearchPath("libvlc", "/home/linux/vlc/lib");
            optionsList.add("--plugin-path=" + System.getProperty("user.home") + "/.vlcj");
        }
        options = optionsList.toArray(new String[optionsList.size()]);

        new NativeDiscovery().discover();
    }

    public static synchronized VlcSdkImplementation getInstance() {
        return LazyLoader.instance;
    }

    @Override
    public VlcPlayer getVlcPlayer() {
        if (vlcPlayer == null) {
            vlcPlayer = new VlcPlayerImplementation(options);
        }
        return vlcPlayer;
    }

    @Override
    public void setOptions(String[] options) {
        this.options = options;
    }

    @Override
    public String[] getSupportedFileExtensions() {
        return new VideoFileFilter().getExtensions();
    }

    private static class LazyLoader {

        private static VlcSdkImplementation instance = new VlcSdkImplementation();
    }

}

@@ -367,117 +367,8 @@
 ter;
-%0Aimport uk.co.caprica.vlcj.runtime.RuntimeUtil;%0Aimport uk.co.caprica.vlcj.runtime.windows.WindowsRuntimeUtil;
 %0A%0A/*
@@ -774,521 +774,8 @@
 %22);%0A
-        if (RuntimeUtil.isWindows()) %7B%0A            optionsList.add(%22--plugin-path=%22 + WindowsRuntimeUtil.getVlcInstallDir() + %22%5C%5Cplugins%22);%0A            com.sun.jna.NativeLibrary.addSearchPath(%22libvlc%22, WindowsRuntimeUtil.getVlcInstallDir());%0A        %7D else %7B%0A            optionsList.add(%22--plugin-path=/home/linux/vlc/lib%22);%0A            com.sun.jna.NativeLibrary.addSearchPath(%22libvlc%22, %22/home/linux/vlc/lib%22);%0A            optionsList.add(%22--plugin-path=%22 + System.getProperty(%22user.home%22) + %22/.vlcj%22);%0A        %7D%0A
     

Remove deprecated option "plugin-path" in vlcj sdk