Commit 66a5b2de authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

More c++ binding...

Added a tiny class for image handling
Added a Media class that will be the entrypoint for most of the timeline video
stuff
Code cleaning / reorganisation

Sorry for the big svn-like commit :p
parent dc1973ec
......@@ -20,10 +20,12 @@ public:
{
return this->_pixelsData;
}
QImage& getImage()
{
return *(this->_image);
}
private:
QImage* _image;
uchar* _pixelsData;
......
......@@ -8,7 +8,6 @@ Media::Media(Instance* instance, const QString& filename) : _instance(*instance)
{
this->_internalPtr = libvlc_media_new(this->_instance, filename.toLocal8Bit(), this->_ex);
this->_ex.checkThrow();
// this->_pixelBuffer = new uchar[VIDEOHEIGHT * VIDEOWIDTH * 4];
}
Media::~Media()
......@@ -18,6 +17,14 @@ Media::~Media()
delete this->_dataCtx;
}
Media::DataCtx* Media::buildDataCtx()
{
Media::DataCtx* dataCtx = new Media::DataCtx;
dataCtx->mutex = new QMutex();
dataCtx->media = this;
return dataCtx;
}
void Media::addOption(const char* opt)
{
libvlc_media_add_option(this->_internalPtr, opt, this->_ex);
......
......@@ -39,6 +39,8 @@ namespace LibVLCpp
uchar* getPixelBuffer();
private:
DataCtx* buildDataCtx();
Exception _ex;
Instance& _instance;
DataCtx* _dataCtx;
......
......@@ -8,7 +8,6 @@
#include "VLCpp.hpp"
#include "VLCMedia.h"
#include "VLCException.h"
#include "VLCEventManager.h"
namespace LibVLCpp
{
......@@ -25,11 +24,9 @@ namespace LibVLCpp
void takeSnapshot(char* outputFile, unsigned int width, unsigned int heigth);
int isPlaying();
int isSeekable();
//FIXME: private
//static void eventPlayingCallback(const EventManager::Event*, void* data);
private: public:
private:
Exception _ex;
// EventManager* _evMgr;
bool _isReady;
};
}
......
#include <QtDebug>
#include "Media.h"
Media::Media(const QString& mrl) : _mrl(mrl), _snapshot(NULL)
......@@ -60,7 +61,7 @@ void Media::lock(LibVLCpp::Media::DataCtx* ctx, void **renderPtr)
void Media::unlock(LibVLCpp::Media::DataCtx* ctx)
{
// qDebug() << "frame just rendered";
// qDebug() << "frame just rendered";
ctx->mutex->unlock();
}
......@@ -96,4 +97,3 @@ qint64 Media::getLength()
{
return this->_vlcMediaPlayer->getLength();
}
......@@ -18,24 +18,21 @@ public:
static void lock(LibVLCpp::Media::DataCtx* dataCtx, void **pp_ret);
static void unlock(LibVLCpp::Media::DataCtx* dataCtx);
QImage* takeSnapshot(unsigned int width, unsigned int heigth);
QImage* takeSnapshot(unsigned int width, unsigned int heigth);
QImage& getImage();
//FIXME into bool
int isPlaying();
int isSeekable();
qint64 getLength();
QImage& getImage();
//FIXME
private: public:
private:
LibVLCpp::Media* _vlcMedia;
LibVLCpp::MediaPlayer* _vlcMediaPlayer;
LibVLCpp::Instance* _instance;
QString _mrl;
QImage* _snapshot;
uchar* _pixelBuffer;
QImage* _image;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment