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

Adding methods so that LibVLCpp::MediaPlayer knows what it's playing

parent 2de957bd
......@@ -27,7 +27,7 @@
using namespace LibVLCpp;
Media::Media( const QString& filename )
: m_pixelBuffer( NULL )
: m_pixelBuffer( NULL ), m_fileName( filename )
{
m_internalPtr = libvlc_media_new( *(LibVLCpp::Instance::getInstance()), filename.toLocal8Bit(), m_ex );
CheckVlcppException(m_ex);
......@@ -108,3 +108,7 @@ uchar* Media::getPixelBuffer()
return m_pixelBuffer;
}
const QString& Media::getFileName() const
{
return m_fileName;
}
......@@ -51,6 +51,7 @@ namespace LibVLCpp
void outputInWindow();
void setPixelBuffer( uchar* buffer );
uchar* getPixelBuffer();
const QString& getFileName() const;
private:
......@@ -58,6 +59,7 @@ namespace LibVLCpp
Exception m_ex;
uchar* m_pixelBuffer;
QString m_fileName;
};
}
......
......@@ -27,7 +27,7 @@
using namespace LibVLCpp;
MediaPlayer::MediaPlayer()
MediaPlayer::MediaPlayer() : m_media( NULL )
{
m_internalPtr = libvlc_media_player_new( LibVLCpp::Instance::getInstance()->getInternalPtr(), m_ex );
CheckVlcppException( m_ex );
......@@ -46,7 +46,7 @@ MediaPlayer::MediaPlayer()
libvlc_event_attach( p_em, libvlc_MediaPlayerLengthChanged, callbacks,this,m_ex );
}
MediaPlayer::MediaPlayer( Media* media )
MediaPlayer::MediaPlayer( Media* media ) : m_media( media )
{
m_internalPtr = libvlc_media_player_new_from_media( media->getInternalPtr(), m_ex );
CheckVlcppException( m_ex );
......@@ -259,3 +259,16 @@ bool MediaPlayer::hasVout()
CheckVlcppException( m_ex );
return res;
}
const QString& MediaPlayer::getLoadedFileName() const
{
return m_media->getFileName();
}
QString MediaPlayer::getLoadedMRL()
{
Media::internalPtr media = libvlc_media_player_get_media( m_internalPtr, m_ex );
CheckVlcppException( m_ex );
char* str = libvlc_media_get_mrl( media );
return QString( str );
}
......@@ -60,6 +60,8 @@ namespace LibVLCpp
float getFps();
void nextFrame();
bool hasVout();
const QString& getLoadedFileName() const;
QString getLoadedMRL();
private:
static void callbacks( const libvlc_event_t* event, void* self );
......@@ -67,6 +69,7 @@ namespace LibVLCpp
Exception m_ex;
libvlc_event_manager_t* p_em;
Media* m_media;
signals:
void snapshotTaken();
......
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