libvlc_new (0, NULL); segmentation fault
Asked Answered
O

2

2

I have a problem when I use this line :

   vlcInstance = libvlc_new(0, NULL);

vlcInstance is declare in my header:

  libvlc_media_player_t *vlcPlayer;

I am using Qt 5.0.1 and I have this error:

The inferior stopped because it received a signal from the Operating System.

Signal name : SIGSEGV Signal meaning : Segmentation fault

Can anyone help me?

Outhaul answered 25/7, 2013 at 9:47 Comment(3)
Latest Qt Creator version is currently 2.8.0, do you mean Qt version? Can you precise the version number (5.x.x)? Did you try with Qt 4.8?Alternately
I had Qt Creator 5.1 I will try with 4.8 thank you for your answer :)Outhaul
5.0.1 sorry for my mistakeOuthaul
A
1

I am using Qt Creator 2.7.2 with QT 5.1.0 on 64-bit Kubuntu 13.04. I'm also using vlc-2.2.0-git.

I created a new QT project.

I added this to the new project file (change your vlc paths as needed):

INCLUDEPATH += /home/linux/vlc/install/include
LIBS += -L"/home/linux/vlc/install/lib" -lvlc

bare-bones main.cpp (including your code that apparently segfaults):

#include <QtDebug>

#include "vlc/libvlc.h"
#include "vlc/libvlc_media.h"
#include "vlc/libvlc_media_player.h"

int main(int argc, char *argv[]) {
    qDebug() << "Starting...";

    libvlc_instance_t* p_instance = libvlc_new(0, NULL);
    qDebug() << "p_instance" << p_instance;

    if (p_instance) {
        libvlc_media_player_t *p_media_player = libvlc_media_player_new(p_instance);
        qDebug() << "p_media_player" << p_media_player;

        if (p_media_player) {
            libvlc_media_player_release(p_media_player);
        }

        libvlc_free(p_instance);
    }

    qDebug() << "Exit normally";
}

This runs just fine for me, no segfault:

Starting... 
p_instance 0x19140f0 
p_media_player 0x19da6d8 
Exit normally
Ariosto answered 3/8, 2013 at 11:48 Comment(0)
H
2

Had the same problem on Windows with a simple program linked against prebuilt static lib from the VLC distribution. The solution was just to copy the .dll files and the plugins folder from the VLC distribution root to application folder.

Heathheathberry answered 26/4, 2015 at 12:49 Comment(1)
I discovered - on Wndows, using Visual Studio - that the same worked for me just now (i.e., copy the root folder of VLC player's installation, in to your debug/release folder of your VC++ project.). This root folder has all the folder structures and config files necessary in order for libVLC to Initialise.Admiral
A
1

I am using Qt Creator 2.7.2 with QT 5.1.0 on 64-bit Kubuntu 13.04. I'm also using vlc-2.2.0-git.

I created a new QT project.

I added this to the new project file (change your vlc paths as needed):

INCLUDEPATH += /home/linux/vlc/install/include
LIBS += -L"/home/linux/vlc/install/lib" -lvlc

bare-bones main.cpp (including your code that apparently segfaults):

#include <QtDebug>

#include "vlc/libvlc.h"
#include "vlc/libvlc_media.h"
#include "vlc/libvlc_media_player.h"

int main(int argc, char *argv[]) {
    qDebug() << "Starting...";

    libvlc_instance_t* p_instance = libvlc_new(0, NULL);
    qDebug() << "p_instance" << p_instance;

    if (p_instance) {
        libvlc_media_player_t *p_media_player = libvlc_media_player_new(p_instance);
        qDebug() << "p_media_player" << p_media_player;

        if (p_media_player) {
            libvlc_media_player_release(p_media_player);
        }

        libvlc_free(p_instance);
    }

    qDebug() << "Exit normally";
}

This runs just fine for me, no segfault:

Starting... 
p_instance 0x19140f0 
p_media_player 0x19da6d8 
Exit normally
Ariosto answered 3/8, 2013 at 11:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.