Commit e84db3b0 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Added some methods to Media & OutputMedia

parent de2b7706
......@@ -119,3 +119,14 @@ qint64 Media::getLength()
{
return m_vlcMediaPlayer->getLength();
}
void Media::play()
{
m_vlcMediaPlayer->play();
}
QImage& Media::getImage()
{
return *m_image;
}
......@@ -47,6 +47,7 @@ public:
bool isSeekable();
qint64 getLength();
QImage& getImage();
void play();
private:
LibVLCpp::Media* m_vlcMedia;
......
#include <QtDebug>
#include "OutputMedia.h"
OutputMedia::OutputMedia() : m_pixelBuffer( NULL )
......@@ -24,9 +25,9 @@ OutputMedia::OutputMedia() : m_pixelBuffer( NULL )
char width[64], height[64], lock[64], unlock[64], data[64];
sprintf( width, ":invmem-width=%i", VIDEOWIDTH );
sprintf( height, ":invmem-height=%i", VIDEOHEIGHT );
sprintf( lock, ":invmem-lock: %lld", (long long int)(intptr_t)&OutputMedia::lock );
sprintf( unlock, ":invmem-unlock: %lld", (long long int)(intptr_t)&OutputMedia::unlock );
sprintf( data, ":invmem-data: %lld", (long long int)(intptr_t)m_dataCtx );
sprintf( lock, ":invmem-lock=%lld", (long long int)(intptr_t)&OutputMedia::lock );
sprintf( unlock, ":invmem-unlock=%lld", (long long int)(intptr_t)&OutputMedia::unlock );
sprintf( data, ":invmem-data=%lld", (long long int)(intptr_t)m_dataCtx );
m_vlcMedia->addOption( width );
m_vlcMedia->addOption( height );
......@@ -39,6 +40,7 @@ OutputMedia::OutputMedia() : m_pixelBuffer( NULL )
uchar* OutputMedia::lock( OutputMedia::DataCtx* dataCtx )
{
qDebug() << "Copying into invmem";
dataCtx->mutex->lock();
return dataCtx->outputMedia->m_pixelBuffer;
}
......@@ -48,6 +50,7 @@ void OutputMedia::unlock( OutputMedia::DataCtx* dataCtx )
//FIXME: use class Image to avoid alloc/free...
delete dataCtx->outputMedia->m_pixelBuffer;
dataCtx->mutex->unlock();
qDebug() << "Unlocked invmem";
}
void OutputMedia::setVmem( uchar* pixelBuffer )
......@@ -56,3 +59,8 @@ void OutputMedia::setVmem( uchar* pixelBuffer )
m_pixelBuffer = pixelBuffer;
m_dataCtx->mutex->unlock();
}
void OutputMedia::play()
{
m_vlcMediaPlayer->play();
}
......@@ -41,6 +41,7 @@ public:
static void unlock( OutputMedia::DataCtx* dataCtx );
void setVmem( uchar* pixelBuffer );
void play();
private:
LibVLCpp::Media* m_vlcMedia;
......
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