本文整理汇总了C++中phonon::MediaObject类的典型用法代码示例。如果您正苦于以下问题:C++ MediaObject类的具体用法?C++ MediaObject怎么用?C++ MediaObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MediaObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetMetadata
QVariantMap TrackListDBusHandler::GetMetadata(int position)
{
QVariantMap ret;
if (position < 0 || position > m_tracks.size()-1) {
return ret;
}
//FIXME: ugly and slow
Phonon::MediaObject mediaObject;
mediaObject.setCurrentSource(m_tracks[position]);
QMultiMap<QString, QString> stringMap = mediaObject.metaData();
QMultiMap<QString, QString>::const_iterator i = stringMap.constBegin();
while (i != stringMap.constEnd()) {
bool number = false;
int value = i.value().toInt(&number);
//tracknumber always string, according to MPRIS spec
if (number && (i.key().toLower() != "tracknumber")) {
ret[i.key().toLower()] = value;
} else {
ret[i.key().toLower()] = QVariant(i.value());
}
++i;
}
ret["time"] = mediaObject.totalTime()/1000;
ret["location"] = mediaObject.currentSource().url().toString();
return ret;
}
示例2: setDir
void APlayer::setDir(QString path)
{
old = 0;
m_media->clear();
w_folderContents->clear();
while (QTreeWidgetItem *item = w_folderContents->takeTopLevelItem(0))
{
delete item;
}
path += "/";
QDir dir(path);
QStringList files = dir.entryList(QStringList() << "*.mp3" << "*.ogg" << "*.wav" << "*.wma",
QDir::Files | QDir::NoDotAndDotDot,
QDir::Name);
QString f = path + "%2";
Phonon::MediaObject media;
foreach (QString file, files)
{
QString filepath = f.arg(file);
media.setCurrentSource(filepath);
QMap <QString,QString> metaData = media.metaData();
QStringList metaList;
metaList << metaData.value("ARTIST")
<< metaData.value("TITLE")
<< metaData.value("ALBUM")
<< metaData.value("DATE");
qDebug() << metaList;
if (metaList[0].isEmpty())
metaList[0] = file;
QTreeWidgetItem *item = new QTreeWidgetItem(metaList);
item->setData(0, Qt::UserRole, filepath);
w_folderContents->addTopLevelItem(item);
}
示例3: main
int main(int argv, char **args)
{
QApplication app(argv, args);
app.setApplicationName("Audio effect tester");
Phonon::MediaObject *mediaObject = new Phonon::MediaObject;
mediaObject->setCurrentSource(QString("/home/gvatteka/Music/Lumme-Badloop.ogg"));
Phonon::AudioOutput *audioOutput =
new Phonon::AudioOutput(Phonon::MusicCategory);
//! [0]
QList<Phonon::EffectDescription> effectDescriptions =
Phonon::BackendCapabilities::availableAudioEffects();
Phonon::EffectDescription effectDescription = effectDescriptions.at(4);
Phonon::Path path = Phonon::createPath(mediaObject, audioOutput);
//! [1]
Phonon::Effect *effect = new Phonon::Effect(effectDescription);
path.insertEffect(effect);
//! [0]
Phonon::EffectWidget *effectWidget = new Phonon::EffectWidget(effect);
effectWidget->show();
//! [1]
mediaObject->play();
effectWidget->setWindowTitle("Effect Name: " + effectDescription.name());
app.exec();
}
示例4: updateTicker
void UBGraphicsVideoItemDelegate::updateTicker(qint64 time)
{
Phonon::MediaObject* media = delegated()->mediaObject();
mVideoControl->totalTimeChanged(media->totalTime());
mVideoControl->updateTicker(time);
}
示例5: updatePlayPauseState
void UBGraphicsVideoItemDelegate::updatePlayPauseState()
{
Phonon::MediaObject* media = delegated()->mediaObject();
if (media->state() == Phonon::PlayingState)
mPlayPauseButton->setFileName(":/images/pause.svg");
else
mPlayPauseButton->setFileName(":/images/play.svg");
}
示例6: seekBack
void PlayerManager::seekBack()
{
Phonon::MediaObject *mediaObject = m_media[m_curOutputPath];
const qint64 total = mediaObject->totalTime();
const qint64 newtime = mediaObject->currentTime() - total / 100;
const qint64 seekTo = qMax(qint64(0), newtime);
stopCrossfade();
mediaObject->seek(seekTo);
emit seeked(seekTo);
}
示例7: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
qDebug() << Phonon::BackendCapabilities::availableMimeTypes();
Phonon::MediaObject *music = Phonon::createPlayer(Phonon::MusicCategory,
Phonon::MediaSource("../myPhonon1/mysong.mp3"));
music->setParent(this);
music->play();
}
示例8: stop
void VideoWidget::stop()
{
Phonon::MediaObject* mo = player->media0bject();
if (mo->state() == Phonon::PausedState)
{
mo->seek(0);
mo->stop();
}
else
{
mo->stop();
}
}
示例9: playSound
void SoundEditWidget::playSound()
{
if (!mHasSound) {
return;
}
Phonon::MediaObject *player = Phonon::createPlayer(Phonon::NotificationCategory);
QBuffer *soundData = new QBuffer(player);
soundData->setData(mSound);
player->setCurrentSource(soundData);
player->setParent(this);
connect(player, &Phonon::MediaObject::finished, player, &Phonon::MediaObject::deleteLater);
player->play();
}
示例10: playSound
void SoundEditWidget::playSound()
{
if ( !mHasSound ) {
return;
}
#ifndef Q_OS_WINCE
Phonon::MediaObject* player = Phonon::createPlayer( Phonon::NotificationCategory );
QBuffer* soundData = new QBuffer( player );
soundData->setData( mSound );
player->setCurrentSource( soundData );
player->setParent( this );
connect( player, SIGNAL(finished()), player, SLOT(deleteLater()) );
player->play();
#endif
}
示例11: findSubtitles
void FindSubtitles::findSubtitles() {
Phonon::MediaObject * mediaObject = quarkPlayer().currentMediaObject();
if (mediaObject) {
Phonon::MediaSource source = mediaObject->currentSource();
QString fileName(source.fileName());
static FindSubtitlesWindow * findSubtitlesWindow = NULL;
if (!findSubtitlesWindow) {
findSubtitlesWindow = new FindSubtitlesWindow(MainWindowFactory::mainWindow());
connect(findSubtitlesWindow, SIGNAL(subtitleDownloaded(const QString &)),
SLOT(loadSubtitle(const QString &)));
}
findSubtitlesWindow->setMovieFileName(fileName);
findSubtitlesWindow->setLanguage(Config::instance().language());
findSubtitlesWindow->show();
}
}
示例12: playSoundStr
void AudioPlayer::playSoundStr(const QString &file) {
if (aboutToTerminate)
return;
for (std::vector<Phonon::MediaObject *>::iterator iter = soundVec.begin();
iter != soundVec.end(); ++iter) {
Phonon::MediaObject * prevSoundEffect = (*iter);
switch (prevSoundEffect->state()) {
case Phonon::StoppedState:
case Phonon::PausedState:
prevSoundEffect->clear();
prevSoundEffect->setCurrentSource(file);
prevSoundEffect->play();
return;
default:
break;
}
}
Phonon::MediaObject * soundEffect = Phonon::createPlayer(
Phonon::MusicCategory, file);
soundEffect->play();
soundVec.push_back(soundEffect);
printDebug(
"<font color=red><b>Notice: </b></font>AudioPlayer::playSoundStr: creating new MediaObject, current MediaObject count = "
+ QString::number(static_cast<unsigned>(soundVec.size())));
return;
}
示例13: getVideoInformation
void Video::getVideoInformation()
{
QFileInfo fileInfo(videoPath);
videoName = fileInfo.fileName();
Phonon::MediaObject mediaObject;
mediaObject.setCurrentSource(videoPath);
// TODO: This doesn't work. Media needs to be loaded
qint64 totalMs = mediaObject.totalTime();
qint64 totSeconds = totalMs / 1000;
qint64 seconds = totSeconds % 60;
qint64 totMinutes = totSeconds / 60;
qint64 minutes = totMinutes % 60;
qint64 hours = totMinutes / 60;
videoTotalTime = QTime(hours, minutes, seconds);
qDebug() << videoTotalTime;
}
示例14: image
game::MainWindow::MainWindow(QWidget *parent) :
QWidget(parent),
m_width(1000),
m_height(800),
m_status(false),
m_frame_count(0),
m_i(0),
m_j(0),
m_next_cell(0),
m_clock_frame_count(0),
m_anim_end(false),
m_clock_start(false),
m_clock_x_cord(0),
m_animation_state(false)
{
QImage image(".\\res\\back_3.png");
m_game_width = image.width();
m_game_height = image.height();
setFixedSize(m_width, m_height);
m_click_coords.first = 0;
m_click_coords.second = 0;
setWindowFlags( Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
m_area_x0_coordinate = (this->width() - image.width())/2;
m_area_y0_coordinate = (this->height() - image.height())/2;
m_r = new game::graphic_engine::game_process(m_area_x0_coordinate, m_area_y0_coordinate, image.width()/*+30*/, image.height()/*+30*/, 57);
Phonon::MediaObject* mediaobject = new Phonon::MediaObject(this);
Phonon::AudioOutput *audio = new Phonon::AudioOutput(this);
assert(mediaobject != 0);
QString filename(".//res//music//Casino Ambiance Music.wav");
mediaobject->setCurrentSource(filename);
Phonon::createPath(mediaobject,audio);
mediaobject->play();
QPixmap pixmap(".\\res\\background.png");
QPalette palette;
palette.setBrush(/*this->backgroundRole()*/QPalette::Background, QBrush(pixmap));
this->setPalette(palette);
m_timer = new QTimer(this);
m_timer_clock = new QTimer(this);
connect(m_timer, SIGNAL(timeout()), this, SLOT(animate()));
connect(m_timer_clock, SIGNAL(timeout()), this, SLOT(animate_clock()));
m_timer->start(5);
m_timer_clock->start(60);
}
示例15: main
int main(int argv, char **args)
{
QApplication app(argv, args);
//![0]
Phonon::MediaObject *moo = new Phonon::MediaObject;;
Phonon::AudioOutput *device = new Phonon::AudioOutput;
Phonon::createPath(moo, device);
moo->setCurrentSource(QString("/home/gvatteka/Music/Lumme-Badloop.ogg"));
Phonon::SeekSlider *slider = new Phonon::SeekSlider;
slider->setMediaObject(moo);
slider->show();
moo->play();
//![0]
app.exec();
}