Oleksandr Nelipa
Oleksandr Nelipa

Reputation: 1

Windows Forms OpenFileDialog and LibVLC plugins dll entry point error

I'm using libvlc library. And it works well when I play the video file, that I have chosen in openFileDialog previously. But my goal is streaming video from webcam and previewing it.

I made libvlc show webcam video on the screen, but when i commented out the openFileDialog.Show() line (that I don't need anymore), "Entry point couldn't be found in the library" error dialogs started poping out for every libvlc plugin (that is basicaly a .dll file).

private void btPlay_Click(object sender, EventArgs e)
    {
        /*
        if (openFileDialog1.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            return;
         * */

        CleanUp();

        string pluginPath = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "plugins");

        string[] args = new string[]{
            "--no-qt-error-dialogs",
            "--ignore-config",
            "--quiet",
            "--plugin-path=" + pluginPath
        };

        //LibVlc initialization, that is where ERORR OCCURES
        vlcInst = new VlcInstance(args);

        /*  Input media settings    */

        //VlcMedia media = new VlcMedia(vlcInst, openFileDialog1.FileName);
        VlcMedia media = new VlcMedia(vlcInst, "dshow://");

        LibVlc.libvlc_media_add_option(media.handle, "dshow-vdev=USB2.0 UVC VGA WebCam");
        LibVlc.libvlc_media_add_option(media.handle, "dshow-adev=none");

        /*  Output media settings    */

        string[] outputOptions = new string[] {
            "sout=#duplicate{",
                "dst=",
                    "display",
                ",",
                "dst=",
                    "'",
                        "transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100}",
                        ":http{mux=ffmpeg{mux=flv},dst=:666/}",
                    "'",
            "}"
        };

        LibVlc.libvlc_media_add_option(media.handle, String.Concat(outputOptions));

        streamer = new VlcStreamer(media);

        media.Dispose();

        streamer.Drawable = mediaPanel.Handle;

        streamer.Play();
    }

    private void CleanUp()
    {
        if (streamer != null)
        {
            streamer.Stop();
            streamer.Dispose();
        }
    }

I can't see any relations between OpenFileDialog and libvlc plugins.

What can cause such a problem?

EDITED:

After I skip all error dialogs, program continues working.

Upvotes: 0

Views: 470

Answers (1)

Oleksandr Nelipa
Oleksandr Nelipa

Reputation: 1

When I was using VLC player, it made duplicates of the plugins in "plugin" folder. In my app I used those plugins and was getting errors. After I downloaded and unpacked new instance of the player, I discovered that there were no duplicates of the plugins, so I made a conclusion that the player makes copies of plugins when you launch it first time (didn't test it). When I replaced my plugin folder with new one, all the errors were gone.

Upvotes: 0

Related Questions