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

@@ -12,16 +12,15 @@ official CMA and also offer some features missing in the original one.
#### Implemented features missing in OpenCMA (Yifan Lu CLI application)
* Metadata for PSP savedatas.
* Basic metadata for single songs (album, artist, title).
* Basic metadata for videos (duration, dimensions).
* Basic metadata for photos (dimensions).
* Basic metadata for single songs (album, artist, title, cover art).
* Basic metadata for videos (duration, dimensions, thumbnail).
* Basic metadata for photos (dimensions, thumbnails).
* Easy wireless pairing (show PIN to the user when a Vita is detected).
* Ability to restart the connection if the Vita is reconnected (on test).
* Ability to change the connection mode (usb/wireless) on the fly (on test).
#### TODO:
* Fix remaining bugs with thread synchronizations.
* Implement thumbnails for videos and album art for music.
* Remove wireless/usb switch and allow both to run.
* Folder categories for music/videos.
* SQLite backend for database.
* Fix wireless streaming for music/videos.
@@ -40,7 +39,7 @@ using the wireless streaming feature.
* [VitaMTP](https://github.com/yifanlu/VitaMTP)
* [MediaInfo](http://mediaarea.net/en/MediaInfo)
* [Libav](http://www.libav.org/)
#### Where do I get the source code?

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;
}

View File

@@ -24,7 +24,16 @@ public:
void getVideoMetadata(metadata_t &metadata);
void close();
static void init();
class AvInit
{
public:
AvInit()
{
av_register_all();
}
};
static AvInit init;
private:
void AVFrameToQImage(AVFrame &frame, QImage &image, int width, int height);

View File

@@ -40,7 +40,6 @@ CmaClient::CmaClient(QObject *parent) :
BaseWorker(parent)
{
this_object = this;
AVDecoder::init();
}
int CmaClient::deviceRegistered(const char *deviceid)