void NPlaybackEngineGStreamer::setMedia(const QString &file) { qreal vol = m_oldVolume; if (!m_crossfading) stop(); if (file.isEmpty()) { stop(); emit mediaChanged(m_currentMedia = ""); return; } if (!QFile(file).exists()) { fail(); emit message(QMessageBox::Warning, file, "No such file or directory"); return; } gchar *uri = g_filename_to_uri(QFileInfo(file).absoluteFilePath().toUtf8().constData(), NULL, NULL); if (uri) m_currentMedia = file; g_object_set(m_playbin, "uri", uri, NULL); emit mediaChanged(m_currentMedia); if (vol != -1) setVolume(vol); }
void LastFmService::init() { m_currentTrack = 0; bool enable = SETTINGS()->_useLastFmScrobbler; Debug::debug() << " [LastFmService] init enable " << enable; disconnect(Engine::instance(), 0,this, 0); /* load settings */ QSettings settings(UTIL::CONFIGFILE,QSettings::IniFormat,this); settings.beginGroup("Scrobbler"); LastFm::GLOBAL::username = settings.value("username", QString()).toString(); LastFm::GLOBAL::session_key = settings.value("key", QString()).toString(); LastFm::GLOBAL::api_key = "b3717637c18071e1619e92ee2c3eb0f8"; LastFm::GLOBAL::secret_key = "8192599d44d34b27c520d597d34f3714"; settings.endGroup(); if( enable && isAuthenticated() ) { connect(Engine::instance(), SIGNAL(engineStateChanged()), this, SLOT(slot_state_changed())); connect(Engine::instance(), SIGNAL(mediaChanged()), this, SLOT(slot_track_changed())); } /* change status for send love action */ ACTIONS()->value(LASTFM_LOVE)->setEnabled(enable); ACTIONS()->value(LASTFM_LOVE_NOW_PLAYING)->setEnabled(enable); }
void QMediaImageViewer::setMedia(const QMediaContent &media) { Q_D(QMediaImageViewer); if (d->playlist && d->playlist->currentMedia() != media) { disconnect(d->playlist, SIGNAL(currentMediaChanged(QMediaContent)), this, SLOT(_q_playlistMediaChanged(QMediaContent))); disconnect(d->playlist, SIGNAL(destroyed()), this, SLOT(_q_playlistDestroyed())); d->playlist = 0; } d->media = media; if (d->timer.isActive()) { d->pauseTime = 0; d->timer.stop(); removePropertyWatch("elapsedTime"); emit elapsedTimeChanged(0); } if (d->state != QMediaImageViewer::StoppedState) emit stateChanged(d->state = QMediaImageViewer::StoppedState); d->viewerControl->showMedia(d->media); emit mediaChanged(d->media); }
void MusicCoreMPlayer::setRadioMedia(const QString &data) { emit mediaChanged(data); QStringList arguments; arguments << "-slave" << "-quiet" << "-vo" << "directx:noaccel" << data; connect(m_process, SIGNAL(readyReadStandardOutput()), SLOT(dataRecieve())); m_process->start(MAKE_PLAYER_AL, arguments); }
QMediaPlayer::QMediaPlayer(QObject *parent, QMediaPlayer::Flags flags, QMediaServiceProvider *provider): QMediaObject(*new QMediaPlayerPrivate, parent, playerService(flags,provider)) { Q_D(QMediaPlayer); d->provider = provider; if (d->service == 0) { d->error = ServiceMissingError; } else { d->control = qobject_cast<QMediaPlayerControl*>(d->service->requestControl(QMediaPlayerControl_iid)); d->playlistSourceControl = qobject_cast<QMediaPlaylistSourceControl*>(d->service->requestControl(QMediaPlaylistSourceControl_iid)); d->networkAccessControl = qobject_cast<QMediaNetworkAccessControl*>(d->service->requestControl(QMediaNetworkAccessControl_iid)); if (d->control != 0) { connect(d->control, SIGNAL(mediaChanged(QMediaContent)), SIGNAL(mediaChanged(QMediaContent))); connect(d->control, SIGNAL(stateChanged(QMediaPlayer::State)), SLOT(_q_stateChanged(QMediaPlayer::State))); connect(d->control, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), SLOT(_q_mediaStatusChanged(QMediaPlayer::MediaStatus))); connect(d->control, SIGNAL(error(int,QString)), SLOT(_q_error(int,QString))); connect(d->control, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64))); connect(d->control, SIGNAL(positionChanged(qint64)), SIGNAL(positionChanged(qint64))); connect(d->control, SIGNAL(audioAvailableChanged(bool)), SIGNAL(audioAvailableChanged(bool))); connect(d->control, SIGNAL(videoAvailableChanged(bool)), SIGNAL(videoAvailableChanged(bool))); connect(d->control, SIGNAL(volumeChanged(int)), SIGNAL(volumeChanged(int))); connect(d->control, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged(bool))); connect(d->control, SIGNAL(seekableChanged(bool)), SIGNAL(seekableChanged(bool))); connect(d->control, SIGNAL(playbackRateChanged(qreal)), SIGNAL(playbackRateChanged(qreal))); connect(d->control, SIGNAL(bufferStatusChanged(int)), SIGNAL(bufferStatusChanged(int))); if (d->control->state() == PlayingState) addPropertyWatch("position"); if (d->control->mediaStatus() == StalledMedia || d->control->mediaStatus() == BufferingMedia) addPropertyWatch("bufferStatus"); } if (d->networkAccessControl != 0) { connect(d->networkAccessControl, SIGNAL(configurationChanged(QNetworkConfiguration)), this, SIGNAL(networkConfigurationChanged(QNetworkConfiguration))); } }
void NPlaybackEngineGStreamer::fail() { if (!m_crossfading) // avoid thread deadlock stop(); else m_crossfading = false; emit mediaChanged(m_currentMedia = ""); emit failed(); emit stateChanged(m_oldState = N::PlaybackStopped); }
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); }
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); }
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); }
/*------------------------------------------------------------------------------ | OpenMAXILPlayerControl::setMediaInt +-----------------------------------------------------------------------------*/ void OpenMAXILPlayerControl::setMediaInt(const QMediaContent& mediaContent) { log_debug_func; m_mediaProcessor->stop(); m_textureData = NULL; if (!m_mediaProcessor->setFilename(mediaContent.canonicalUrl().toString(), m_textureData)) return; m_currentResource = mediaContent; emit mediaChanged(mediaContent); }
/*------------------------------------------------------------------------------ | OpenMAXILPlayerControl::setMediaInt +-----------------------------------------------------------------------------*/ void OpenMAXILPlayerControl::setMediaInt(const QMediaContent& mediaContent) { LOG_DEBUG(LOG_TAG, "%s", Q_FUNC_INFO); m_mediaProcessor->stop(); m_textureData = NULL; if (!m_mediaProcessor->setFilename(mediaContent.canonicalUrl().toString(), m_textureData)) return; m_currentResource = mediaContent; emit mediaChanged(mediaContent); }
void VideoControl::openFileDialog() { QFileDialog dialog(this); dialog.setFileMode(QFileDialog::ExistingFiles ); dialog.setViewMode(QFileDialog::Detail); dialog.setNameFilter("MP4 File(*.mp4)"); if(dialog.exec()) { emit mediaChanged(dialog.selectedFiles().first()); } }
void DirectShowPlayerControl::setMedia(const QMediaContent &media, QIODevice *stream) { m_media = media; m_stream = stream; m_updateProperties &= PlaybackRateProperty; m_service->load(media, stream); emit mediaChanged(m_media); emitPropertyChanges(); }
void QDeclarativeMediaBase::setObject(QObject *object) { m_qmlObject = object; if ((m_mediaProvider = QMediaServiceProvider::defaultServiceProvider()) != 0) { if ((m_mediaService = m_mediaProvider->requestService(Q_MEDIASERVICE_MEDIAPLAYER)) != 0) { m_playerControl = qobject_cast<QMediaPlayerControl *>( m_mediaService->requestControl(QMediaPlayerControl_iid)); m_metaDataControl = qobject_cast<QMetaDataReaderControl *>( m_mediaService->requestControl(QMetaDataReaderControl_iid)); m_mediaObject = new QDeclarativeMediaBaseObject(m_mediaService); } } if (m_playerControl) { QObject::connect(m_playerControl, SIGNAL(stateChanged(QMediaPlayer::State)), object, SLOT(_q_statusChanged())); QObject::connect(m_playerControl, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), object, SLOT(_q_statusChanged())); QObject::connect(m_playerControl, SIGNAL(mediaChanged(QMediaContent)), object, SIGNAL(sourceChanged())); QObject::connect(m_playerControl, SIGNAL(durationChanged(qint64)), object, SIGNAL(durationChanged())); QObject::connect(m_playerControl, SIGNAL(positionChanged(qint64)), object, SIGNAL(positionChanged())); QObject::connect(m_playerControl, SIGNAL(volumeChanged(int)), object, SIGNAL(volumeChanged())); QObject::connect(m_playerControl, SIGNAL(mutedChanged(bool)), object, SIGNAL(mutedChanged())); QObject::connect(m_playerControl, SIGNAL(bufferStatusChanged(int)), object, SIGNAL(bufferProgressChanged())); QObject::connect(m_playerControl, SIGNAL(seekableChanged(bool)), object, SIGNAL(seekableChanged())); QObject::connect(m_playerControl, SIGNAL(playbackRateChanged(qreal)), object, SIGNAL(playbackRateChanged())); QObject::connect(m_playerControl, SIGNAL(error(int,QString)), object, SLOT(_q_error(int,QString))); m_animation = new QDeclarativeMediaBaseAnimation(this); m_error = QMediaPlayer::NoError; } else { m_playerControl = new QDeclarativeMediaBasePlayerControl(object); } if (!m_metaDataControl) m_metaDataControl = new QDeclarativeMediaBaseMetaDataControl(object); m_metaData.reset(new QDeclarativeMediaMetaData(m_metaDataControl)); QObject::connect(m_metaDataControl, SIGNAL(metaDataChanged()), m_metaData.data(), SIGNAL(metaDataChanged())); }
QT_BEGIN_NAMESPACE QAndroidMediaService::QAndroidMediaService(QObject *parent) : QMediaService(parent) , mVideoRendererControl(0) { mMediaControl = new QAndroidMediaPlayerControl; mMetadataControl = new QAndroidMetaDataReaderControl; connect(mMediaControl, SIGNAL(mediaChanged(QMediaContent)), mMetadataControl, SLOT(onMediaChanged(QMediaContent))); connect(mMediaControl, SIGNAL(metaDataUpdated()), mMetadataControl, SLOT(onUpdateMetaData())); }
/*------------------------------------------------------------------------------ | OpenMAXILPlayerControl::setMedia +-----------------------------------------------------------------------------*/ void OpenMAXILPlayerControl::setMedia(const QMediaContent& content, QIODevice* stream) { Q_UNUSED(stream); log_debug_func; logi_debug("Media: %s.", qPrintable(content.canonicalUrl().toString())); logi_debug("setMedia thread is: %p.", ((unsigned int)QThread::currentThread())); if (!m_mediaProcessor->setFilename(content.canonicalUrl().toString())) return; m_currentResource = content; emit mediaChanged(content); }
/* ******************************************************************************** * * * Class HistoManager * * * ******************************************************************************** */ HistoManager::HistoManager() { INSTANCE = this; //! set Info resolver m_player = Engine::instance(); connect(m_player, SIGNAL(mediaChanged()), this, SLOT(addEntry())); m_timer = new QTimer(); connect(m_timer, SIGNAL(timeout()), this, SLOT(addToDatabase())); //! check database histo table checkHisto(); }
void NPlaybackEngineVlc::setMedia(const QString &file) { stop(); if (file.isEmpty()) return; if (!QFile(file).exists()) { emit message(QMessageBox::Warning, file, "No such file or directory"); emit mediaChanged(""); emit failed(); return; } libvlc_media_t *media = libvlc_media_player_get_media(m_mediaPlayer); if (media) libvlc_media_release(media); libvlc_media_t *mediaDescriptor = libvlc_media_new_path(m_vlcInstance, file.toUtf8()); if (mediaDescriptor) libvlc_media_player_set_media(m_mediaPlayer, mediaDescriptor); emit mediaChanged(file); }
void MFPlayerControl::setMedia(const QMediaContent &media, QIODevice *stream) { if (m_state != QMediaPlayer::StoppedState) { changeState(QMediaPlayer::StoppedState); m_session->stop(true); refreshState(); } m_media = media; m_stream = stream; resetAudioVideoAvailable(); handleDurationUpdate(-1); handleSeekableUpdate(false); m_session->load(media, stream); emit mediaChanged(m_media); }
void MusicCoreMPlayer::setVideoMedia(const QString &data, int winId) { QStringList arguments; arguments << "-slave" << "-quiet" << "-wid"; arguments << QString::number(winId); #ifdef Q_OS_WIN arguments << "-vo" << "direct3d" << data; #else arguments << "-vo" << "x11" << data; #endif emit mediaChanged(data); m_process->setProcessChannelMode(QProcess::MergedChannels); connect(m_process, SIGNAL(readyReadStandardOutput()), SLOT(durationRecieve())); m_process->write("get_time_length\n"); m_process->start(MAKE_PLAYER_AL, arguments); }
void QWmpPlaylist::mediaChangeEvent(IDispatch *dispatch) { IWMPMedia *media = 0; if (dispatch && dispatch->QueryInterface( __uuidof(IWMPMedia), reinterpret_cast<void **>(&media)) == S_OK) { VARIANT_BOOL isMember = VARIANT_FALSE; if (media->isMemberOf(m_playlist, &isMember) == S_OK && isMember) { int index = QWmpMetaData::value(media, QAutoBStr(L"PlaylistIndex")).toInt(); if (index >= 0) emit mediaChanged(index, index); } media->Release(); } }
void QDeclarativeAudio::classBegin() { m_player = new QMediaPlayer(this); connect(m_player, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(_q_statusChanged())); connect(m_player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(_q_statusChanged())); connect(m_player, SIGNAL(mediaChanged(QMediaContent)), this, SIGNAL(sourceChanged())); connect(m_player, SIGNAL(durationChanged(qint64)), this, SIGNAL(durationChanged())); connect(m_player, SIGNAL(positionChanged(qint64)), this, SIGNAL(positionChanged())); connect(m_player, SIGNAL(volumeChanged(int)), this, SIGNAL(volumeChanged())); connect(m_player, SIGNAL(mutedChanged(bool)), this, SIGNAL(mutedChanged())); connect(m_player, SIGNAL(bufferStatusChanged(int)), this, SIGNAL(bufferProgressChanged())); connect(m_player, SIGNAL(seekableChanged(bool)), this, SIGNAL(seekableChanged())); connect(m_player, SIGNAL(playbackRateChanged(qreal)), this, SIGNAL(playbackRateChanged())); connect(m_player, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(_q_error(QMediaPlayer::Error))); connect(m_player, SIGNAL(audioAvailableChanged(bool)), this, SIGNAL(hasAudioChanged())); connect(m_player, SIGNAL(videoAvailableChanged(bool)), this, SIGNAL(hasVideoChanged())); m_error = m_player->availability() == QMultimedia::ServiceMissing ? QMediaPlayer::ServiceMissingError : QMediaPlayer::NoError; connect(m_player, SIGNAL(availabilityChanged(QMultimedia::AvailabilityStatus)), this, SLOT(_q_availabilityChanged(QMultimedia::AvailabilityStatus))); m_metaData.reset(new QDeclarativeMediaMetaData(m_player)); connect(m_player, SIGNAL(metaDataChanged()), m_metaData.data(), SIGNAL(metaDataChanged())); emit mediaObjectChanged(); }
void QWmpPlaylist::currentPlaylistChangeEvent(WMPPlaylistChangeEventType change) { Q_UNUSED(change); long count = 0; if (m_playlist && m_playlist->get_count(&count) == S_OK && count > 0) { if (count > m_count) { emit mediaAboutToBeInserted(m_count, count - 1); m_count = count; emit mediaInserted(count, m_count - 1); } else if (count < m_count) { emit mediaAboutToBeRemoved(count, m_count - 1); m_count = count; emit mediaRemoved(count, m_count - 1); } } if (m_count > 0) emit mediaChanged(0, m_count - 1); }
// Set new media list. Return true if changed bool SDPSession::setMedia(ObjList* media) { if (media == m_rtpMedia) return false; DDebug(m_parser,DebugAll,"SDPSession::setMedia(%p) [%p]",media,this); ObjList* tmp = m_rtpMedia; m_rtpMedia = media; bool chg = m_rtpMedia != 0; if (tmp) { chg = false; for (ObjList* o = tmp->skipNull(); o; o = o->skipNext()) { SDPMedia* m = static_cast<SDPMedia*>(o->get()); if (media && m->sameAs(static_cast<SDPMedia*>((*media)[*m]),m_parser->ignorePort())) continue; chg = true; mediaChanged(*m); } TelEngine::destruct(tmp); } return chg; }
void QAndroidMediaPlayerControl::setMedia(const QMediaContent &mediaContent, QIODevice *stream) { mMediaContent = mediaContent; mMediaStream = stream; const QString uri = mediaContent.canonicalUrl().toString(); if (!uri.isEmpty()) mMediaPlayer->setDataSource(uri); else setMediaStatus(QMediaPlayer::NoMedia); Q_EMIT mediaChanged(mMediaContent); resetBufferingProgress(); // reset some properties setAudioAvailable(false); setVideoAvailable(false); setSeekable(true); }
void QAndroidMediaPlayerControl::setMedia(const QMediaContent &mediaContent, QIODevice *stream) { mMediaContent = mediaContent; mMediaStream = stream; if (mVideoOutput && !mMediaPlayer->display()) { // if a video output is set but the video texture is not ready, delay loading the media // since it can cause problems on some hardware mPendingSetMedia = true; return; } const QUrl url = mediaContent.canonicalUrl(); QString mediaPath; if (url.scheme() == QLatin1String("qrc")) { const QString path = url.toString().mid(3); mTempFile.reset(QTemporaryFile::createNativeFile(path)); if (!mTempFile.isNull()) mediaPath = QLatin1String("file://") + mTempFile->fileName(); } else { mediaPath = url.toString(); } if (!mediaPath.isEmpty()) mMediaPlayer->setDataSource(mediaPath); else setMediaStatus(QMediaPlayer::NoMedia); Q_EMIT mediaChanged(mMediaContent); resetBufferingProgress(); // reset some properties setAudioAvailable(false); setVideoAvailable(false); setSeekable(true); }
void BbMediaPlayerControl::setMedia(const QMediaContent &media, QIODevice *stream) { Q_UNUSED(stream); // not supported stop(); detach(); m_media = media; emit mediaChanged(m_media); // Slight hack: With MediaPlayer QtQuick elements that have autoPlay set to true, playback // would start before the QtQuick canvas is propagated to all elements, and therefore our // video output would not work. Therefore, delay actually playing the media a bit so that the // canvas is ready. // The mmrenderer doesn't allow to attach video outputs after playing has started, otherwise // this would be unnecessary. if (!m_media.isNull()) { setMediaStatus(QMediaPlayer::LoadingMedia); m_loadingTimer.start(); // singleshot timer to continueLoadMedia() } else { continueLoadMedia(); // still needed, as it will update the media status and clear metadata } }
void MediaPlayer::setMedia(QString file) { //qDebug() << "MediaPlayer::setMedia" << file; if (vlcMediaPlayer) { //libvlc_event_attach (libvlc_event_manager_t *p_event_manager, libvlc_event_type_t i_event_type, libvlc_callback_t f_callback, void *user_data) libvlc_event_manager_t *manager = libvlc_media_player_event_manager(vlcMediaPlayer); libvlc_event_manager_t *mediamanager = libvlc_media_event_manager(vlcMedia); //libvlc_event_detach(mediamanager,libvlc_MediaStateChanged,&callback,this); /* libvlc_MediaPlayerNothingSpecial libvlc_MediaPlayerOpening libvlc_MediaPlayerBuffering libvlc_MediaPlayerPlaying libvlc_MediaPlayerPaused libvlc_MediaPlayerStopped libvlc_MediaPlayerForward libvlc_MediaPlayerBackward libvlc_MediaPlayerEndReached libvlc_MediaPlayerEncounteredError libvlc_MediaPlayerTimeChanged libvlc_MediaPlayerPositionChanged libvlc_MediaPlayerSeekableChanged libvlc_MediaPlayerPausableChanged libvlc_MediaPlayerTitleChanged libvlc_MediaPlayerSnapshotTaken libvlc_MediaPlayerLengthChanged */ libvlc_event_detach(manager,libvlc_MediaPlayerOpening,&callback,this); libvlc_event_detach(manager,libvlc_MediaPlayerBuffering,&callback,this); libvlc_event_detach(manager,libvlc_MediaPlayerPlaying,&callback,this); libvlc_event_detach(manager,libvlc_MediaPlayerStopped,&callback,this); libvlc_event_detach(manager,libvlc_MediaPlayerPaused,&callback,this); libvlc_event_detach(manager,libvlc_MediaPlayerForward,&callback,this); libvlc_event_detach(manager,libvlc_MediaPlayerBackward,&callback,this); libvlc_event_detach(manager,libvlc_MediaPlayerEndReached,&callback,this); libvlc_event_detach(manager,libvlc_MediaPlayerEncounteredError,&callback,this); libvlc_event_detach(manager,libvlc_MediaPlayerTimeChanged,&callback,this); //libvlc_event_detach(manager,libvlc_MediaPlayerPositionChanged,&callback,this); libvlc_event_detach(manager,libvlc_MediaPlayerSeekableChanged,&callback,this); libvlc_event_detach(manager,libvlc_MediaPlayerPausableChanged,&callback,this); libvlc_event_detach(manager,libvlc_MediaPlayerTitleChanged,&callback,this); libvlc_event_detach(manager,libvlc_MediaPlayerSnapshotTaken,&callback,this); libvlc_event_detach(manager,libvlc_MediaPlayerLengthChanged,&callback,this); libvlc_media_release(vlcMedia); libvlc_media_player_stop(vlcMediaPlayer); libvlc_media_player_release(vlcMediaPlayer); vlcMediaPlayer = 0; vlcMedia = 0; } //This little bs code is brought to you by the dolts from vlc and Qt. Qt's QDir dosen't return //native path seperators nicely, and VLC won't accept anything but native. #ifdef Q_OS_WIN32 vlcMedia = libvlc_media_new_path(vlcInstance,file.replace("/","\\").toAscii()); #else #ifdef Q_OS_LINUX vlcMedia = libvlc_media_new_path(vlcInstance,file.toAscii()); #endif #endif vlcMediaPlayer = libvlc_media_player_new_from_media(vlcMedia); libvlc_media_parse(vlcMedia); libvlc_event_manager_t *manager = libvlc_media_player_event_manager(vlcMediaPlayer); libvlc_event_attach(manager,libvlc_MediaPlayerOpening,&callback,this); libvlc_event_attach(manager,libvlc_MediaPlayerBuffering,&callback,this); libvlc_event_attach(manager,libvlc_MediaPlayerPlaying,&callback,this); libvlc_event_attach(manager,libvlc_MediaPlayerStopped,&callback,this); libvlc_event_attach(manager,libvlc_MediaPlayerPaused,&callback,this); libvlc_event_attach(manager,libvlc_MediaPlayerForward,&callback,this); libvlc_event_attach(manager,libvlc_MediaPlayerBackward,&callback,this); libvlc_event_attach(manager,libvlc_MediaPlayerEndReached,&callback,this); libvlc_event_attach(manager,libvlc_MediaPlayerEncounteredError,&callback,this); libvlc_event_attach(manager,libvlc_MediaPlayerTimeChanged,&callback,this); //libvlc_event_attach(manager,libvlc_MediaPlayerPositionChanged,&callback,this); libvlc_event_attach(manager,libvlc_MediaPlayerSeekableChanged,&callback,this); libvlc_event_attach(manager,libvlc_MediaPlayerPausableChanged,&callback,this); libvlc_event_attach(manager,libvlc_MediaPlayerTitleChanged,&callback,this); libvlc_event_attach(manager,libvlc_MediaPlayerSnapshotTaken,&callback,this); libvlc_event_attach(manager,libvlc_MediaPlayerLengthChanged,&callback,this); //libvlc_event_manager_t *mediamanager = libvlc_media_event_manager(vlcMedia); //libvlc_event_attach(mediamanager,libvlc_MediaStateChanged,&callback,this); emit mediaChanged(); }
void CasparDevice::sendNotification() { switch (AmcpDevice::command) { case AmcpDevice::CLS: { emit responseChanged(AmcpDevice::response.at(0), *this); AmcpDevice::response.removeFirst(); // First post is the header, 200 CLS OK. QList<CasparMedia> items; foreach (QString response, AmcpDevice::response) { QString name = response.split("\" ").at(0); name.replace("\\", "/"); if (name.startsWith("\"")) name.remove(0, 1); if (name.endsWith("\"")) name.remove(name.length() - 1, 1); QString type = response.split("\" ").at(1).trimmed().split(" ").at(0); QString timecode; if (response.split("\" ").at(1).trimmed().split(" ").count() > 5) { // Format: // "AMB" MOVIE 6445960 20121101160514 643 1/60 // "CG1080I50" MOVIE 6159792 20121101150514 264 1/25 // "GO1080P25" MOVIE 16694084 20121101150514 445 1/25 // "WIPE" MOVIE 1268784 20121101150514 31 1/25 QString totalFrames = response.split("\" ").at(1).trimmed().split(" ").at(4); QString timebase = response.split("\" ").at(1).trimmed().split(" ").at(5); int frames = totalFrames.toInt(); int fps = timebase.split("/").at(1).toInt(); double time = frames * (1.0 / fps); timecode = convertToTimecode(time, fps); } items.push_back(CasparMedia(name, type, timecode)); } emit mediaChanged(items, *this); break; } case AmcpDevice::TLS: { emit responseChanged(AmcpDevice::response.at(0), *this); AmcpDevice::response.removeFirst(); // First post is the header, 200 TLS OK. QList<CasparTemplate> items; foreach (QString response, AmcpDevice::response) { QString name = response.split("\" ").at(0); name.replace("\\", "/"); if (name.startsWith("\"")) name.remove(0, 1); if (name.endsWith("\"")) name.remove(name.length() - 1, 1); items.push_back(CasparTemplate(name)); } emit templateChanged(items, *this); break; }
void EnginePhonon::slot_on_media_change() { Debug::debug() << "[EnginePhonon] -> slot_on_media_change"; if( m_nextMediaItem ) { Debug::debug() << "[EnginePhonon] -> slot_on_media_change: next media item from queue"; MEDIA::registerTrackPlaying(m_currentMediaItem, false); m_currentMediaItem = MEDIA::TrackPtr(m_nextMediaItem); m_nextMediaItem = MEDIA::TrackPtr(0); } if(!m_currentMediaItem) { Debug::error() << "[EnginePhonon] -> no media set"; //stop(); return; } else if ( (m_currentMediaItem->type() == TYPE_TRACK) && (SETTINGS()->_replaygain != SETTING::ReplayGainOff ) ) { if( !m_preamp ) { m_preamp = new Phonon::VolumeFaderEffect( this ); m_phononPath.insertEffect( m_preamp ); } qreal gain, peak; if ( SETTINGS()->_replaygain != SETTING::AlbumReplayGain ) { gain = m_currentMediaItem->trackGain; peak = m_currentMediaItem->trackPeak; } else { gain = m_currentMediaItem->albumGain; peak = m_currentMediaItem->albumPeak; } if ( gain + peak > 0.0 ) { Debug::debug() << "[EnginePhonon] -> slot_on_media_change Gain of" << gain << "would clip at absolute peak of" << gain + peak; gain -= gain + peak; } Debug::debug() << "[EnginePhonon] -> slot_on_media_change Using gain of" << gain << "with relative peak of" << peak; // we calculate the volume change ourselves, because m_preamp->setVolumeDecibel is // a little confused about minus signs m_preamp->setVolume( exp( gain * log10over20 ) ); m_preamp->fadeTo( exp( gain * log10over20 ), 0 ); } else if( m_preamp ) { //Debug::debug() << "[EnginePhonon] reset preamp"; m_preamp->setVolume( 1.0 ); m_preamp->fadeTo( 1.0, 0 ); } /* register track change */ update_total_time(); MEDIA::registerTrackPlaying(m_currentMediaItem, true); emit mediaChanged(); }