Esempio n. 1
0
AudioPlayer::AudioPlayer()
{
	settings.setValue((SettingsKey::VOLUME_KEY), 100);
	if (settings.contains(SettingsKey::VOLUME_KEY)){
		int vol = settings.value(SettingsKey::VOLUME_KEY).toInt();
		sound.setVolume(vol);
		background.setVolume(vol);
	}
	else{
		sound.setVolume(50);
		background.setVolume(50);
		settings.setValue((SettingsKey::VOLUME_KEY), 50);
	}
	if (settings.contains(SettingsKey::MUTE_KEY)){
		mIsMute = settings.value(SettingsKey::MUTE_KEY).toBool();
	}
	else{
		settings.setValue((SettingsKey::MUTE_KEY), 0);
		mIsMute = false;
	}
	path = QDir::currentPath();

	connect(&background, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus))
			, SLOT(handleBackgroundStateChange(QMediaPlayer::MediaStatus)));
	connect(&sound, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus))
			, SLOT(handleSoundStateChange(QMediaPlayer::MediaStatus)));

	background.setMedia(QUrl::fromLocalFile(soundFolder() + "sea.mp3"));
	connect(&background,SIGNAL(stateChanged(QMediaPlayer::State)), SLOT(repeatBackground(QMediaPlayer::State)));

}
QXAMediaPlayerControl::QXAMediaPlayerControl(QXAPlaySession *session, QObject *parent)
   :QMediaPlayerControl(parent), mSession(session)
{
    QT_TRACE_FUNCTION_ENTRY;
    connect(mSession, SIGNAL(mediaChanged(const QMediaContent &)),
            this, SIGNAL(mediaChanged(const QMediaContent& )));
    connect(mSession, SIGNAL(durationChanged(qint64)),
            this, SIGNAL(durationChanged(qint64)));
    connect(mSession, SIGNAL(positionChanged(qint64)),
            this, SIGNAL(positionChanged(qint64)));
    connect(mSession, SIGNAL(stateChanged(QMediaPlayer::State)),
            this, SIGNAL(stateChanged(QMediaPlayer::State)));
    connect(mSession, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
            this, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)));
    connect(mSession, SIGNAL(volumeChanged(int)),
            this, SIGNAL(volumeChanged(int)));
    connect(mSession, SIGNAL(mutedChanged(bool)),
            this, SIGNAL(mutedChanged(bool)));
    connect(mSession, SIGNAL(audioAvailableChanged(bool)),
            this, SIGNAL(audioAvailableChanged(bool)));
    connect(mSession, SIGNAL(videoAvailableChanged(bool)),
            this, SIGNAL(videoAvailableChanged(bool)));
    connect(mSession,SIGNAL(bufferStatusChanged(int)),
            this, SIGNAL(bufferStatusChanged(int)));
    connect(mSession, SIGNAL(seekableChanged(bool)),
            this, SIGNAL(seekableChanged(bool)));
    connect(mSession, SIGNAL(availablePlaybackRangesChanged(const QMediaTimeRange&)),
            this, SIGNAL(availablePlaybackRangesChanged(const QMediaTimeRange&)));
    connect(mSession, SIGNAL(playbackRateChanged(qreal)),
            this, SIGNAL(playbackRateChanged(qreal)));
    connect(mSession, SIGNAL(error(int, const QString &)),
            this, SIGNAL(error(int, const QString &)));
    QT_TRACE_FUNCTION_EXIT;
}
void SMActionVideoNative::connectPlayer()
{

    connect(mediaPlayer, SIGNAL(positionChanged(qint64)), SLOT(positionChanged(qint64)));
    connect(mediaPlayer, SIGNAL(durationChanged(qint64)), SLOT(durationChanged(qint64)));
    connect(mediaPlayer,
            SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
            SLOT(mediaStatusChanged(QMediaPlayer::MediaStatus)));
}
void QGstreamerPlayerControl::setMedia(const QMediaContent &content, QIODevice *stream)
{
    QMediaPlayer::State oldState = m_state;
    m_state = QMediaPlayer::StoppedState;    
    m_session->stop();

    if (m_bufferProgress != -1) {
        m_bufferProgress = -1;
        emit bufferStatusChanged(0);
    }

    if (m_stream) {
        closeFifo();

        disconnect(m_stream, SIGNAL(readyRead()), this, SLOT(writeFifo()));
        m_stream = 0;
    }

    m_currentResource = content;
    m_stream = stream;
    m_seekToStartPending = false;

    QNetworkRequest request;

    if (m_stream) {
        if (m_stream->isReadable() && openFifo()) {
            request = QNetworkRequest(QUrl(QString(QLatin1String("fd://%1")).arg(m_fifoFd[0])));
        }
    } else if (!content.isNull()) {
        request = content.canonicalRequest();
    }

    m_session->load(request);    

    if (m_fifoFd[1] >= 0) {
        m_fifoCanWrite = true;

        writeFifo();
    }

    if (!request.url().isEmpty()) {
        if (m_mediaStatus != QMediaPlayer::LoadingMedia)
            emit mediaStatusChanged(m_mediaStatus = QMediaPlayer::LoadingMedia);
        m_session->pause();
    } else {
        if (m_mediaStatus != QMediaPlayer::NoMedia)
            emit mediaStatusChanged(m_mediaStatus = QMediaPlayer::NoMedia);
        setBufferProgress(0);
    }

    emit mediaChanged(m_currentResource);
    if (m_state != oldState)
        emit stateChanged(m_state);
}
Esempio n. 5
0
QompQtMultimediaPlayer::QompQtMultimediaPlayer() :
	QompPlayer(),
	player_(new QMediaPlayer(this)),
	resolver_(0/*new QompTagLibMetaDataResolver(this)*/),
	watcher_(0)
{
	connect(player_, SIGNAL(positionChanged(qint64)), SIGNAL(currentPositionChanged(qint64)));
	connect(player_, SIGNAL(volumeChanged(int)), SLOT(volumeChanged(int)));
	connect(player_, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged(bool)));
	connect(player_, SIGNAL(durationChanged(qint64)), SIGNAL(currentTuneTotalTimeChanged(qint64)));
	connect(player_, SIGNAL(stateChanged(QMediaPlayer::State)), SLOT(playerStateChanged(QMediaPlayer::State)));
	connect(player_, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), SLOT(mediaStatusChanged(QMediaPlayer::MediaStatus)));

	//connect(resolver_, SIGNAL(tuneUpdated(Tune*)), SIGNAL(tuneDataUpdated(Tune*)), Qt::QueuedConnection);
}
Esempio n. 6
0
GridFrame::GridFrame(QWidget *parent) :
    QFrame(parent)
{
    this->setFocusPolicy(Qt::StrongFocus);
    isPlaying = true;
    timerForGameOver = 1;
    hasLost = false;


    timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(update()));
        timer->start(1000);
        fallingTimer = new QTimer(this);
        connect(fallingTimer,SIGNAL(timeout()), this, SLOT(updateFalling()));

        gameOverSound = new QMediaPlayer;
        gameOverSound->setMedia(QUrl::fromLocalFile(globalPath + "gameOver.mp3"));
        if (!areSoundsOn)
        {
            gameOverSound->setVolume(0);
        }


        music = new QMediaPlayer;
        music->setMedia(QUrl::fromLocalFile(globalPath + currentTheme + ".mp3"));
        music->setVolume(70);
        music->play();
        if (!isMusicOn)
        {
            music->setVolume(0);
        }


        connect(music,SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(replayMusic(QMediaPlayer::MediaStatus)));
}
Esempio n. 7
0
FileInfoDialog::FileInfoDialog(QString adress, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::FileInfoDialog)
{
    ui->setupUi(this);

    fileInfo = new QFileInfo(adress);
    setWindowTitle(tr("Информация о ") + fileInfo->fileName());

    ui->labelDir->setText(fileInfo->absoluteFilePath());
   ui->labelDateSet->setText(QString::number(fileInfo->created().date().day()) +
                                           "." + QString::number(fileInfo->created().date().month()) +
                                           "." + QString::number(fileInfo->created().date().year()));
   ui->labelNameFile->setText(fileInfo->fileName());

   if(fileInfo->size() < 1024)
       ui->labelSizeFile->setText(QString::number(fileInfo->size()) + tr(" Байт"));
   else if(fileInfo->size() >= 1024 && fileInfo->size() < 1024 * 1024)
       ui->labelSizeFile->setText(QString::number((float) fileInfo->size() / 1024) + tr("  КБайт"));
   else if(fileInfo->size() >= 1024*1024 && fileInfo->size() < 1024*1024*1024)
       ui->labelSizeFile->setText(QString::number( ( float) ( fileInfo->size() / 1024 / 1024 ) ) + tr(" МБайт"));
  else if(fileInfo->size() >= 1024*1024*1024 && fileInfo->size() < 1024*1024*1024*1024)
       ui->labelSizeFile->setText(QString::number((float) fileInfo->size() /1024 /1024 / 1024) + tr(" ГБайт"));
   else ui->labelSizeFile->setText(QString::number((float) fileInfo->size() /1024 /1024 / 1024 / 1024) + tr(" ТБайт"));

   mediaPlayer = new QMediaPlayer(this);
   mediaPlayer->setMedia(QUrl::fromLocalFile(adress));
   mediaPlayer->setMuted(true);
   mediaPlayer->play();
   connect(mediaPlayer, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), SLOT(metaDataExtractor(QMediaPlayer::MediaStatus)));
}
void DirectShowPlayerControl::emitPropertyChanges()
{
    int properties = m_updateProperties;
    m_updateProperties = 0;

    if ((properties & ErrorProperty) && m_error != QMediaPlayer::NoError)
        emit error(m_error, m_errorString);

    if (properties & PlaybackRateProperty)
        emit playbackRateChanged(m_playbackRate);

    if (properties & StreamTypesProperty) {
        emit audioAvailableChanged(m_streamTypes & DirectShowPlayerService::AudioStream);
        emit videoAvailableChanged(m_streamTypes & DirectShowPlayerService::VideoStream);
    }

    if (properties & PositionProperty)
        emit positionChanged(m_position);

    if (properties & DurationProperty)
        emit durationChanged(m_duration);

    if (properties & SeekableProperty)
        emit seekableChanged(m_seekable);

    if (properties & StatusProperty)
        emit mediaStatusChanged(m_status);

    if (properties & StateProperty)
        emit stateChanged(m_state);
}
Esempio n. 9
0
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;
}
Esempio n. 10
0
 Player::Player(QWidget *parent)
     : QWidget(parent)
     , videoWidget(0)
     , coverLabel(0)
     , slider(0)
     , audioEndpointSelector(0)
 #ifdef Q_OS_SYMBIAN
//     , mediaKeysObserver(0)
     , playlistDialog(0)
     , toggleAspectRatio(0)
     , showYoutubeDialog(0)
     , youtubeDialog(0)
 #else
     , colorDialog(0)
 #endif
 {
     player = new QMediaPlayer(this);
     // owned by PlaylistModel
     playlist = new QMediaPlaylist();
     player->setPlaylist(playlist);

     connect(player, SIGNAL(durationChanged(qint64)), SLOT(durationChanged(qint64)));
     connect(player, SIGNAL(positionChanged(qint64)), SLOT(positionChanged(qint64)));
     connect(player, SIGNAL(metaDataChanged()), SLOT(metaDataChanged()));
     connect(playlist, SIGNAL(currentIndexChanged(int)), SLOT(playlistPositionChanged(int)));
     connect(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
             this, SLOT(statusChanged(QMediaPlayer::MediaStatus)));
     connect(player, SIGNAL(bufferStatusChanged(int)), this, SLOT(bufferingProgress(int)));
     connect(player, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(displayErrorMessage()));

     videoWidget = new VideoWidget(this);
     player->setVideoOutput(videoWidget);

     playlistModel = new PlaylistModel(this);
     playlistModel->setPlaylist(playlist);

     playlistView = new QListView(this);
     playlistView->setModel(playlistModel);
     playlistView->setCurrentIndex(playlistModel->index(playlist->currentIndex(), 0));

     connect(playlistView, SIGNAL(activated(QModelIndex)), this, SLOT(jump(QModelIndex)));

     slider = new QSlider(Qt::Horizontal, this);
     slider->setRange(0, player->duration() / 1000);

     connect(slider, SIGNAL(sliderMoved(int)), this, SLOT(seek(int)));

     QMediaService *service = player->service();
     if (service) {
         QMediaControl *control = service->requestControl(QAudioEndpointSelector_iid);
         if (control) {
             audioEndpointSelector = qobject_cast<QAudioEndpointSelector*>(control);
             if (audioEndpointSelector) {
                 connect(audioEndpointSelector, SIGNAL(activeEndpointChanged(const QString&)),
                         this, SLOT(handleAudioOutputChangedSignal(const QString&)));
             } else {
                 service->releaseControl(control);
             }
         }
     }
Esempio n. 11
0
BuzzerLive::BuzzerLive() {
    soundPlayer = new QMediaPlayer();
    inWin = false;
    buzzDir = new QDir("media/buzzer/sounds/");
    mp3Files = buzzDir->entryList(QDir::Files);

    textTimeout = new QTimer;
    textTimeout->setInterval(3000);
    connect(textTimeout, SIGNAL(timeout()), this, SLOT(killText()));

    dTeamName = new QLabel();
    dTeamName->setWordWrap(true);
    dTeamName->setAlignment(Qt::AlignCenter);
    dTeamName->setStyleSheet("margin: 0; padding: 0; background-color: black; color: white; font: 100pt;");

    videoPlayer = new QMediaPlayer();
    videoWidget = new QVideoWidget();
    videoPlayer->setVideoOutput(videoWidget);
    connect(videoPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), this , SLOT(videoStateChanged(QMediaPlayer::State)));
    connect(videoPlayer, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this , SLOT(videoStatusChanged(QMediaPlayer::MediaStatus)));

    layout = new QStackedLayout();
    layout->addWidget(dTeamName);
    layout->addWidget(videoWidget);
    layout->setCurrentWidget(dTeamName);
    connect(layout, SIGNAL(currentChanged(int)), this, SLOT(checkVideoHidden(int)));

    setLayout(layout);
}
Esempio n. 12
0
MusicPlayer::MusicPlayer(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MusicPlayer)
{
    ui->setupUi(this);

    Player = new QMediaPlayer(this);
    PlayList = new QMediaPlaylist;

    connect(Player,SIGNAL(positionChanged(qint64)),this,SLOT(PositionChanged(qint64)));
    connect(ui->LengthSlider,SIGNAL(sliderMoved(int)),this,SLOT(SetPosition(int)));
    connect(Player,SIGNAL(durationChanged(qint64)),this,SLOT(DurationChanged(qint64)));
    connect(Player,SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),this,SLOT(StatusChanged(QMediaPlayer::MediaStatus)));
    connect(ui->VolumeSlider,SIGNAL(valueChanged(int)),this,SLOT(SetVolume(int)));

    connect(ui->button_start,SIGNAL(released()),this,SLOT(Play()));
    connect(ui->button_stop,SIGNAL(released()),this,SLOT(Stop()));

    connect(ui->button_next,SIGNAL(released()),this,SLOT(Next()));
    connect(ui->button_prev,SIGNAL(released()),this,SLOT(Prev()));

    connect(ui->button_add,SIGNAL(released()),this,SLOT(Add()));
    connect(ui->button_remove,SIGNAL(released()),this,SLOT(Remove()));

    connect(ui->playlist,SIGNAL(doubleClicked(QModelIndex)),this,SLOT(PlaySelected(QModelIndex)));

    connect(ui->actionSave,SIGNAL(triggered()),this,SLOT(SavePlayList()));
    connect(ui->actionLoad,SIGNAL(triggered()),this,SLOT(OpenPlayList()));

    Player->setPlaylist(PlayList);

    ui->VolumeSlider->setRange(0,100);
    ui->VolumeSlider->setValue(100);
}
Esempio n. 13
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)));
}
Esempio n. 14
0
void QGstreamerPlayerControl::setBufferProgress(int progress)
{
    if (m_bufferProgress == progress || m_mediaStatus == QMediaPlayer::NoMedia)
        return;

    QMediaPlayer::MediaStatus oldStatus = m_mediaStatus;

    m_bufferProgress = progress;

    if (m_state == QMediaPlayer::StoppedState) {
        m_mediaStatus = QMediaPlayer::LoadedMedia;
    } else {
        if (m_bufferProgress < 100) {
            m_mediaStatus = QMediaPlayer::StalledMedia;
            m_session->pause();
        } else {
            m_mediaStatus = QMediaPlayer::BufferedMedia;
            if (m_state == QMediaPlayer::PlayingState)
                m_session->play();
        }
    }

    if (m_mediaStatus != oldStatus)
        emit mediaStatusChanged(m_mediaStatus);

    emit bufferStatusChanged(m_bufferProgress);
}
Esempio n. 15
0
void BbMediaPlayerControl::setMediaStatus(QMediaPlayer::MediaStatus status)
{
    if (m_mediaStatus != status) {
        m_mediaStatus = status;
        emit mediaStatusChanged(m_mediaStatus);
    }
}
Esempio n. 16
0
Player::Player(  QWidget * parent, Qt::WindowFlags f)
    : QWidget(parent, f)
{
    m_current =NULL;
    last=NULL;

#ifdef REPEAT
    m_repeatCheck = false;
#endif
    m_mediaPlayer = new QMediaPlayer();
    connect(m_mediaPlayer,SIGNAL(stateChanged(QMediaPlayer::State)),this,SLOT(playerStatusChanged(QMediaPlayer::State)));
    connect(m_mediaPlayer,SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),this,SLOT(statusChanged(QMediaPlayer::MediaStatus)));

    connect(m_mediaPlayer,SIGNAL(currentMediaChanged(QMediaContent)),this,SLOT(sourceChanged(QMediaContent)));
    mypreference = Preference_data::getInstance();
    myPlaylist = Playlist::getInstance();
    m_listposition = -1;
    position = 0;
    selectedReadMode = mypreference->getSelectedReadMode();

    setupActions();

    //readSettings();
    setupUi();
    m_seekSlider->setMaximum(0);

}
Esempio n. 17
0
VideoItem::VideoItem(QString fileName, QObject *parent)
{
    this->setParent(parent);

    _fileName = fileName;
    //_videoData = new XMPMetadata(fileName);

    _emitShowTimeEnded = false;

    _player = new QMediaPlayer (this);
    _player->setVideoOutput(this);

    createPanel();

    connect (_player, SIGNAL(positionChanged(qint64)),
             this, SLOT(on_positionChanged(qint64)));
    connect (_player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
             this, SLOT(on_mediaStatusChanged(QMediaPlayer::MediaStatus)));
    connect (this, SIGNAL(nativeSizeChanged(QSizeF)),
             this, SLOT(on_nativeSizeChanged(QSizeF)));
    connect (_player, SIGNAL(stateChanged(QMediaPlayer::State)),
             this, SLOT(on_stateChanged(QMediaPlayer::State)));
    connect (_player, SIGNAL(volumeChanged(int)),
             this, SLOT(on_volumeChanged(int)));
}
void QGstreamerPlayerControl::updateState(QMediaPlayer::State state)
{
    QMediaPlayer::MediaStatus oldStatus = m_mediaStatus;
    QMediaPlayer::State oldState = m_state;

    switch (state) {
    case QMediaPlayer::StoppedState:
        m_state = QMediaPlayer::StoppedState;
        if (m_currentResource.isNull())
            m_mediaStatus = QMediaPlayer::NoMedia;
        else
            m_mediaStatus = QMediaPlayer::LoadingMedia;
        break;

    case QMediaPlayer::PlayingState:
    case QMediaPlayer::PausedState:
        if (m_state == QMediaPlayer::StoppedState) {
            m_mediaStatus = QMediaPlayer::LoadedMedia;
        } else {
            if (m_bufferProgress == -1 || m_bufferProgress == 100)
                m_mediaStatus = QMediaPlayer::BufferedMedia;
        }
        break;
    }

    //EndOfMedia status should be kept, until reset by pause, play or setMedia
    if (oldStatus == QMediaPlayer::EndOfMedia)
        m_mediaStatus = QMediaPlayer::EndOfMedia;

    if (m_state != oldState)
        emit stateChanged(m_state);
    if (m_mediaStatus != oldStatus)
        emit mediaStatusChanged(m_mediaStatus);
}
Esempio n. 19
0
int             main(int argc, char *argv[])
{
    QApplication    a(argc, argv);
    QVideoWidget    *videoOutputWidget = new QVideoWidget();
    QMediaPlayer    *player = new QMediaPlayer();
    QVideoProbe     *probe = new QVideoProbe();
    DemoCoq*        demo = new DemoCoq();
    QTimer*         timer = new QTimer();

    probe->setSource(player);
    player->setMedia(QUrl::fromLocalFile("C:/Users/louis/Desktop/Cinefeel/Video.avi"));

    player->setVideoOutput(videoOutputWidget);

    videoOutputWidget->show();

    player->play();

    demo->connect(timer, SIGNAL(timeout()), SLOT(updateColor()));
    timer->start(1000 / 10);
    demo->addAPIConnector(new APIConnector("192.168.43.254:34000"));
//    demo->addAPIConnector(new APIConnector("192.168.43.254:34000"));
//    demo->addAPIConnector(new APIConnector("192.168.43.254:34000"));
//    demo->addAPIConnector(new APIConnector("192.168.43.254:34000"));
    //demo.launch();

    VideoDebugger   *videoDebugger = new VideoDebugger((QObject *)0, true);
    QObject::connect(player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), videoDebugger, SLOT(mediaCheck(QMediaPlayer::MediaStatus)));
    QObject::connect(probe, SIGNAL(videoFrameProbed(QVideoFrame)), videoDebugger, SLOT(processFrame(QVideoFrame)));
    return a.exec();
}
Esempio n. 20
0
MultimediaWidget::MultimediaWidget(QWidget *parent) : QWidget(parent), ui(new Ui::MultimediaWidget){
  ui->setupUi(this); //load the designer file

  //Add in the special QMultimediaWidgets
  mediaObj = new QMediaPlayer(this);
    mediaObj->setVolume(100);
    mediaObj->setNotifyInterval(500); //only every 1/2 second update
  videoDisplay = new QVideoWidget(this);
    videoDisplay->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
    ui->videoLayout->addWidget(videoDisplay);
    mediaObj->setVideoOutput(videoDisplay);
    videoDisplay->setVisible(false);

  UpdateIcons();
  UpdateText();

  //Connect the special signals/slots for the media object
  connect(mediaObj, SIGNAL(durationChanged(qint64)), this, SLOT(playerDurationChanged(qint64)) );
  connect(mediaObj, SIGNAL(seekableChanged(bool)), ui->playerSlider, SLOT(setEnabled(bool)) );
  connect(mediaObj, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(playerStatusChanged(QMediaPlayer::MediaStatus)) );
  connect(mediaObj, SIGNAL(positionChanged(qint64)), this, SLOT(playerTimeChanged(qint64)) );
  connect(mediaObj, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(playerStateChanged(QMediaPlayer::State)) );
  connect(mediaObj, SIGNAL(videoAvailableChanged(bool)), this, SLOT(playerVideoAvailable(bool)) );
  connect(mediaObj, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(playerError()) );

  //Disable some of the initial states
  ui->tool_player_stop->setEnabled(false); //nothing to stop yet
  ui->tool_player_pause->setVisible(false); //nothing to pause yet
  ui->playerSlider->setEnabled(false); //nothing to seek yet
}
Esempio n. 21
0
SlideShow::SlideShow(QWidget *parent)
    : QMainWindow(parent)
    , imageViewer(0)
    , playlist(0)
    , statusLabel(0)
    , countdownLabel(0)
    , playAction(0)
    , stopAction(0)
{
    imageViewer = new QMediaImageViewer(this);

    connect(imageViewer, SIGNAL(stateChanged(QMediaImageViewer::State)),
            this, SLOT(stateChanged(QMediaImageViewer::State)));
    connect(imageViewer, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)),
            this, SLOT(statusChanged(QMediaImageViewer::MediaStatus)));
    connect(imageViewer, SIGNAL(elapsedTimeChanged(int)), this, SLOT(elapsedTimeChanged(int)));

    playlist = new QMediaPlaylist;
    imageViewer->bind(playlist);

    connect(playlist, SIGNAL(loaded()), this, SLOT(playlistLoaded()));
    connect(playlist, SIGNAL(loadFailed()), this, SLOT(playlistLoadFailed()));

    QVideoWidget *videoWidget = new QVideoWidget;
    imageViewer->setVideoOutput(videoWidget);

    menuBar()->addAction(tr("Open Directory..."), this, SLOT(openDirectory()));
    menuBar()->addAction(tr("Open Playlist..."), this, SLOT(openPlaylist()));

    toolBar = new QToolBar;
    toolBar->setMovable(false);
    toolBar->setFloatable(false);
    toolBar->setEnabled(false);

    toolBar->addAction(
            style()->standardIcon(QStyle::SP_MediaSkipBackward),
            tr("Previous"),
            playlist,
            SLOT(previous()));
    stopAction = toolBar->addAction(
            style()->standardIcon(QStyle::SP_MediaStop), tr("Stop"), imageViewer, SLOT(stop()));
    playAction = toolBar->addAction(
            style()->standardIcon(QStyle::SP_MediaPlay), tr("Play"), this, SLOT(play()));
    toolBar->addAction(
            style()->standardIcon(QStyle::SP_MediaSkipForward), tr("Next"), playlist, SLOT(next()));

    addToolBar(Qt::BottomToolBarArea, toolBar);

    statusLabel = new QLabel(tr("%1 Images").arg(0));
    statusLabel->setAlignment(Qt::AlignCenter);

    countdownLabel = new QLabel;
    countdownLabel->setAlignment(Qt::AlignRight);

    statusBar()->addPermanentWidget(statusLabel, 1);
    statusBar()->addPermanentWidget(countdownLabel);

    setCentralWidget(videoWidget);
}
Esempio n. 22
0
void QGstreamerPlayerControl::processEOS()
{
    m_mediaStatus = QMediaPlayer::EndOfMedia;
    m_state = QMediaPlayer::StoppedState;

    emit stateChanged(m_state);
    emit mediaStatusChanged(m_mediaStatus);
}
    void updateMediaStatus(QMediaPlayer::MediaStatus status, QMediaPlayer::State state)
    {
        m_mediaStatus = status;
        m_state = state;

        emit mediaStatusChanged(m_mediaStatus);
        emit stateChanged(m_state);
    }
QT_BEGIN_NAMESPACE

QSoundEffectPrivate::QSoundEffectPrivate(QObject* parent):
    QObject(parent),
    m_loopCount(1),
    m_runningCount(0),
    m_player(0),
    m_status(QSoundEffect::Null),
    m_playing(false)
{
    m_player = new QMediaPlayer(this, QMediaPlayer::LowLatency);
    connect(m_player, SIGNAL(stateChanged(QMediaPlayer::State)), SLOT(stateChanged(QMediaPlayer::State)));
    connect(m_player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), SLOT(mediaStatusChanged(QMediaPlayer::MediaStatus)));
    connect(m_player, SIGNAL(error(QMediaPlayer::Error)), SLOT(error(QMediaPlayer::Error)));
    connect(m_player, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged()));
    connect(m_player, SIGNAL(volumeChanged(int)), SIGNAL(volumeChanged()));
}
Esempio n. 25
0
MyPlayer::MyPlayer()
{
    playerState = NOMUSIC;
    connect(&player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(playNext(QMediaPlayer::MediaStatus)));
    connect(&player, SIGNAL(durationChanged(qint64)), this, SIGNAL(durationChanged(qint64)));
    connect(&player, SIGNAL(durationChanged(qint64)), this, SLOT(musicChanged()));
    connect(&player, SIGNAL(positionChanged(qint64)), this, SIGNAL(positionChanged(qint64)));
    connect(this, SIGNAL(playerStateChanged(int)), this, SLOT(stateChanged(int)));
}
void QGstreamerPlayerControl::setPosition(qint64 pos)
{
    if (m_mediaStatus == QMediaPlayer::EndOfMedia) {
        m_mediaStatus = QMediaPlayer::LoadedMedia;
        emit mediaStatusChanged(m_mediaStatus);
    }

    if (m_session->seek(pos))
        m_seekToStartPending = false;
}
    void setMedia(const QMediaContent &media, QIODevice *)
    {
        m_media = media;

        m_mediaStatus = m_media.isNull()
                ? QMediaPlayer::NoMedia
                : QMediaPlayer::LoadingMedia;

        emit mediaChanged(m_media);
        emit mediaStatusChanged(m_mediaStatus);
    }
Esempio n. 28
0
void QAndroidMediaPlayerControl::setMediaStatus(QMediaPlayer::MediaStatus status)
{
    if (mCurrentMediaStatus == status)
        return;

    if (status == QMediaPlayer::NoMedia || status == QMediaPlayer::InvalidMedia)
        Q_EMIT durationChanged(0);

    mCurrentMediaStatus = status;
    Q_EMIT mediaStatusChanged(mCurrentMediaStatus);
}
Esempio n. 29
0
MusicModel::MusicModel(QString const & token, QString const & user, QObject *parent) :
    QAbstractListModel(parent)
{
    connect(&networkManager, SIGNAL(finished(QNetworkReply*)), SLOT(parseReply(QNetworkReply*)));
    this -> token = token;
    this -> user = user;

    player.setNotifyInterval(1000);
    connect(&player, SIGNAL(positionChanged(qint64)), SLOT(positionchanged(qint64)));
    connect(&player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), SLOT(statechangde(QMediaPlayer::MediaStatus)));
    updateFiles();}
Esempio n. 30
0
 void setMedia(const QMediaContent &content, QIODevice *stream)
 {
     _stream = stream;
     _media = content;
     if (_state != QMediaPlayer::StoppedState) {
         _mediaStatus = _media.isNull() ? QMediaPlayer::NoMedia : QMediaPlayer::LoadingMedia;
         emit stateChanged(_state = QMediaPlayer::StoppedState);
         emit mediaStatusChanged(_mediaStatus);
     }
     emit mediaChanged(_media = content);
 }