Ejemplo n.º 1
0
QT_BEGIN_NAMESPACE

/*------------------------------------------------------------------------------
|    OpenMAXILPlayerControl::OpenMAXILPlayerControl
+-----------------------------------------------------------------------------*/
OpenMAXILPlayerControl::OpenMAXILPlayerControl(QObject *parent)
   : QMediaPlayerControl(parent)
   , m_ownStream(false)
   , m_seekToStartPending(false)
	, m_pendingSeekPosition(-1)
	, m_texProvider(make_shared<OMX_EGLBufferProvider>())
	, m_mediaProcessor(new OMX_MediaProcessor(m_texProvider))
   , m_renderer(NULL)
{
	logi_debug_func;

   connect(m_mediaProcessor, SIGNAL(stateChanged(OMX_MediaProcessor::OMX_MediaProcessorState)),
           this, SLOT(onStateChanged(OMX_MediaProcessor::OMX_MediaProcessorState)));
	connect(m_mediaProcessor, SIGNAL(mediaStatusChanged(OMX_MediaProcessor::OMX_MediaStatus)),
			  this, SLOT(onMediaStatusChanged(OMX_MediaProcessor::OMX_MediaStatus)));
   connect(m_mediaProcessor, SIGNAL(metadataChanged(QVariantMap)),
			  this, SIGNAL(metaDataChanged(QVariantMap)));
	connect(m_mediaProcessor, SIGNAL(streamLengthChanged(qint64)),
			  this, SIGNAL(durationChanged(qint64)));
}
Ejemplo n.º 2
0
void HTML5FullScreenVideoHandler::enterFullScreen(QMediaPlayer *player)
{
    if (!player)
        return;

    m_videoWidget = new HTML5VideoWidget();
    if (!m_videoWidget)
        return;

    m_videoWidget->setDuration(player->duration() / 1000);

    CAknAppUi* appUi = dynamic_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi());
    if (appUi) {
        m_savedOrientation = appUi->Orientation();
        appUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape);
    }

    m_mediaPlayer = player;
    connect(m_mediaPlayer, SIGNAL(positionChanged(qint64)), m_videoWidget, SLOT(onPositionChanged(qint64)));
    connect(m_mediaPlayer, SIGNAL(durationChanged(qint64)), m_videoWidget, SLOT(setDuration(qint64)));
    connect(m_mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(onPlayerStateChanged(QMediaPlayer::State)));
    connect(m_mediaPlayer, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(onPlayerError(QMediaPlayer::Error)));
    connect(m_mediaPlayer, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(onMediaStatusChanged(QMediaPlayer::MediaStatus)));
    connect(m_videoWidget, SIGNAL(positionChangedByUser(qint64)), m_mediaPlayer, SLOT(setPosition(qint64)));
    connect(m_videoWidget, SIGNAL(closeClicked()), this, SIGNAL(fullScreenClosed()));
    connect(m_videoWidget, SIGNAL(muted(bool)), m_mediaPlayer, SLOT(setMuted(bool)));
    connect(m_videoWidget, SIGNAL(volumeChanged(int)), m_mediaPlayer, SLOT(setVolume(int)));
    connect(m_videoWidget, SIGNAL(pauseClicked()), m_mediaPlayer, SLOT(pause()));
    connect(m_videoWidget, SIGNAL(playClicked()), m_mediaPlayer, SLOT(play()));

    m_mediaPlayer->setVideoOutput(m_videoWidget);

    m_videoWidget->setVolume(m_mediaPlayer->volume());
    m_videoWidget->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    m_videoWidget->showFullScreen();
    m_fullScreen = true;

    // Handle current Media Status and Media Player error.
    onMediaStatusChanged(m_mediaPlayer->mediaStatus());
    onPlayerError(m_mediaPlayer->error());
}
void MusicWidget::initPlayer()
{
    m_player = new QMediaPlayer(this);
    connect(m_player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus))
            ,this, SLOT(onMediaStatusChanged(QMediaPlayer::MediaStatus)));
    connect(m_player, SIGNAL(stateChanged(QMediaPlayer::State)),
            this, SLOT(onStateChanged(QMediaPlayer::State)));
    connect(m_player, SIGNAL(seekableChanged(bool)),
            this, SLOT(onSeekableChanged(bool)));
    connect(m_player, SIGNAL(error(QMediaPlayer::Error)),
            this, SLOT(onError(QMediaPlayer::Error)));
    connect(m_player, SIGNAL(durationChanged(qint64)),
            this, SLOT(onDurationChanged(qint64)));
    connect(m_player, SIGNAL(positionChanged(qint64)),
            this, SLOT(onPositionChanged(qint64)));

    m_playlist = new QMediaPlaylist(this);
    connect(m_playlist, SIGNAL(currentIndexChanged(int)),
            this, SLOT(onCurrentMediaIndexChanged(int)));
    m_player->setPlaylist(m_playlist);

}