我对C ++和QT很新,但我确实设置了我的环境来编译和链接ffmpeg(我下载并安装了这个版本“Qt 5.1.1 for Windows 32-bit(MinGW 4.8,OpenGL) ,666 MB)“和最新的ffmpeg共享库(FFmpeg 32位共享版本,来自http://ffmpeg.zeranoe.com/builds/的FFmpeg 32位开发版本)
我有这个简单的应用程序:
#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;
}
构建过程运行没有错误,但如果我调试项目,我会收到分段错误
如果我运行该项目,它只会在没有任何消息的情况下崩溃。
任何想法我做错了什么?
提前致谢
答案 0 :(得分:2)
简单的一个:)
ffmpeg::AVFormatContext *pFormatCtx = NULL;