Commit d05aaf65 authored by Clement CHAVANCE's avatar Clement CHAVANCE
Browse files

Merge branch 'master' of git@github.com:VLMC/vlmc

parents 28cb7be4 a2980fc1
......@@ -30,6 +30,56 @@ MediaPlayer::MediaPlayer( Media* media, bool playStop /* = true*/ )
{
m_internalPtr = libvlc_media_player_new_from_media( media->getInternalPtr(), m_ex );
m_ex.checkThrow();
p_em = libvlc_media_player_event_manager( m_internalPtr, m_ex );
libvlc_event_attach( p_em, libvlc_MediaPlayerSnapshotTaken, callbacks, this, m_ex );
}
void MediaPlayer::callbacks( const libvlc_event_t* event, void* ptr )
{
MediaPlayer* self = reinterpret_cast<MediaPlayer*>( ptr );
switch ( event->type )
{
// case libvlc_MediaMetaChanged:
// case libvlc_MediaSubItemAdded:
// case libvlc_MediaDurationChanged:
// case libvlc_MediaPreparsedChanged:
// case libvlc_MediaFreed:
// case libvlc_MediaStateChanged:
// case libvlc_MediaPlayerNothingSpecial:
// case libvlc_MediaPlayerOpening:
// case libvlc_MediaPlayerBuffering:
// case libvlc_MediaPlayerPlaying:
// case libvlc_MediaPlayerPaused:
// case libvlc_MediaPlayerStopped:
// case libvlc_MediaPlayerForward:
// case libvlc_MediaPlayerBackward:
// case libvlc_MediaPlayerEndReached:
// case libvlc_MediaPlayerEncounteredError:
// case libvlc_MediaPlayerTimeChanged:
// case libvlc_MediaPlayerPositionChanged:
// case libvlc_MediaPlayerSeekableChanged:
// case libvlc_MediaPlayerPausableChanged:
// case libvlc_MediaListItemAdded:
// case libvlc_MediaListWillAddItem:
// case libvlc_MediaListItemDeleted:
// case libvlc_MediaListWillDeleteItem:
// case libvlc_MediaListViewItemAdded:
// case libvlc_MediaListViewWillAddItem:
// case libvlc_MediaListViewItemDeleted:
// case libvlc_MediaListViewWillDeleteItem:
// case libvlc_MediaListPlayerPlayed:
// case libvlc_MediaListPlayerNextItemSet:
// case libvlc_MediaListPlayerStopped:
// case libvlc_MediaDiscovererStarted:
// case libvlc_MediaDiscovererEnded:
// case libvlc_MediaPlayerTitleChanged:
case libvlc_MediaPlayerSnapshotTaken:
self->emit snapshotTaken();
break;
default:
break;
}
}
void MediaPlayer::play()
......
......@@ -26,6 +26,7 @@
#include "vlc/vlc.h"
#include <QMutex>
#include <QObject>
#include "VLCpp.hpp"
#include "VLCMedia.h"
......@@ -33,8 +34,9 @@
namespace LibVLCpp
{
class MediaPlayer : public Internal< libvlc_media_player_t >
class MediaPlayer : public QObject, public Internal< libvlc_media_player_t >
{
Q_OBJECT
public:
MediaPlayer( Media* media, bool playStop = true );
void play();
......@@ -50,7 +52,13 @@ namespace LibVLCpp
void setDrawable( uint32_t drawable );
private:
static void callbacks( const libvlc_event_t* event, void* self );
Exception m_ex;
libvlc_event_manager_t* p_em;
signals:
void snapshotTaken();
};
}
......
......@@ -31,6 +31,7 @@ Media::Media( const QString& mrl ) : m_mrl( mrl ), m_snapshot( NULL )
{
"-verbose", "3",
"--no-skip-frames",
"--no-audio",
//"--plugin-path", VLC_TREE "/modules",
//"--ignore-config", /* Don't use VLC's config files */
};
......
......@@ -22,11 +22,14 @@
#include "ListViewMediaItem.h"
ListViewMediaItem::ListViewMediaItem( QFileInfo* fInfo, ListViewMediaItem::fType fType, QListWidget* parent, int type ) : QListWidgetItem( parent, type )
ListViewMediaItem::ListViewMediaItem( QFileInfo* fInfo, ListViewMediaItem::fType fType, QListWidget* parent, int type ) :
QListWidgetItem( parent, type )
{
m_fileInfo = fInfo;
m_fileType = fType;
setText( m_fileInfo->baseName() );
//TODO : Replace this by snapshot.
setIcon( QIcon( ":/images/images/vlmc.png" ) );
setText( fInfo->baseName() );
}
ListViewMediaItem::~ListViewMediaItem()
......
......@@ -27,6 +27,7 @@
MediaListWidget::MediaListWidget( QWidget* parent ) : QListWidget( parent )
{
m_svgRenderer = new QSvgRenderer( this );
setIconSize( QSize( 128, 128 ) );
}
void MediaListWidget::setType( ListViewMediaItem::fType fileType )
......
......@@ -20,7 +20,7 @@
<enum>QTabWidget::East</enum>
</property>
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<property name="elideMode">
<enum>Qt::ElideNone</enum>
......@@ -50,6 +50,15 @@
<property name="dragDropMode">
<enum>QAbstractItemView::DragDrop</enum>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
......@@ -73,9 +82,15 @@
<property name="dragDropMode">
<enum>QAbstractItemView::DragDrop</enum>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
......@@ -96,6 +111,15 @@
<property name="dragDropMode">
<enum>QAbstractItemView::DragDrop</enum>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
<property name="uniformItemSizes">
<bool>true</bool>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
......
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