Create a static constructor for libav initialization.

This commit is contained in:
codestation
2013-08-19 23:23:19 -04:30
parent 45a8366f9e
commit 0704cfa80a
4 changed files with 17 additions and 14 deletions

View File

@@ -4,6 +4,8 @@
#include <QFile>
#include <QSettings>
AVDecoder::AvInit init;
AVDecoder::AVDecoder() :
pFormatCtx(NULL)
{
@@ -16,14 +18,8 @@ AVDecoder::~AVDecoder()
}
}
void AVDecoder::init()
{
av_register_all();
}
bool AVDecoder::open(const QString filename)
{
if(avformat_open_input(&pFormatCtx, QFile::encodeName(filename).constData(), NULL, NULL) != 0) {
return false;
}