Dierk Walter
Dierk Walter

Reputation: 1

Segmentation fault in a very simple qt app that uses ffmpeg

I'm quite new on C++ and QT, but I did manage to set up my environment to compile and link against ffmpeg (I downloaded and installed this Version "Qt 5.1.1 for Windows 32-bit (MinGW 4.8, OpenGL, 666 MB)" and the latest ffmpeg shared libs (FFmpeg 32-bit Shared Versions, FFmpeg 32-bit Dev Versions from http://ffmpeg.zeranoe.com/builds/)

I have this simple app:

#include "frmmain.h"
#include "ui_frmmain.h"


#define __STDC_CONSTANT_MACROS
namespace ffmpeg
{
    extern "C"
    {
        #include <libavcodec/avcodec.h>
        #include <libavformat/avformat.h>
    }
}

frmMain::frmMain(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::frmMain)
{
    ui->setupUi(this);

    ffmpeg::avcodec_register_all();
    ffmpeg::AVFormatContext *pFormatCtx;

    if ((ffmpeg::avformat_open_input(&pFormatCtx,"d:\\1.wmv" , NULL, NULL)) < 0)
    {
        printf("could not open the file");
    }

}

frmMain::~frmMain()
{
    delete ui;
}

The build process runns with no errors, but if I debug the project I get an Segmentation fault

If I run the project it just crashes without any message.

Any ideas what I'm doing wrong?

Thanks in advance

Upvotes: 0

Views: 413

Answers (1)

szatmary
szatmary

Reputation: 31110

easy one :)

ffmpeg::AVFormatContext *pFormatCtx = NULL;

Upvotes: 2

Related Questions