VideoThumbnailer::Private::Private(VideoThumbnailer* const parent) : QObject(parent), createStrip(false), thumbSize(ThumbnailSize::Huge), isReady(false), player(0), probe(0), media(0), errorCount(0), position(0), dd(parent) { player = new QMediaPlayer(this); probe = new QVideoProbe(this); connect(player, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(slotHandlePlayerError())); connect(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(slotMediaStatusChanged(QMediaPlayer::MediaStatus))); connect(probe, SIGNAL(videoFrameProbed(QVideoFrame)), this, SLOT(slotProcessframe(QVideoFrame))); strip = QImage::fromData(sprocket_large_png, sprocket_large_png_len, "PNG"); isReady = true; }
void UniversalPlayer::newMediaPlayer( bool video, bool muted ) { if ( m_player ) delete m_player; // Use Qt media player if ( video ) m_player = new QMediaPlayer( 0, QMediaPlayer::VideoSurface ); else m_player = new QMediaPlayer( 0 ); connect( m_player, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(slotError(QMediaPlayer::Error)) ); connect( m_player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(slotMediaStatusChanged(QMediaPlayer::MediaStatus)) ); if ( !muted ) { connect( pActionHandler, SIGNAL(playerVolumeDown()), this, SLOT(volumeDown()) ); connect( pActionHandler, SIGNAL(playerVolumeUp()), this, SLOT(volumeUp()) ); } else m_player->setMuted( true ); }