diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-03-22 16:55:49 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-03-22 16:55:49 +0000 |
| commit | d31ed608d0b3801d76728c69b79ff49cbbbdd252 (patch) | |
| tree | cde6f6346faa88958daf243c5714ccb743f7dfad /src | |
| parent | 8bea44586283934c5536d78915f1ce002c1bee6a (diff) | |
| download | qmmp-d31ed608d0b3801d76728c69b79ff49cbbbdd252.tar.gz qmmp-d31ed608d0b3801d76728c69b79ff49cbbbdd252.tar.bz2 qmmp-d31ed608d0b3801d76728c69b79ff49cbbbdd252.zip | |
moved phonon to qmmp plugin pack
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@869 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src')
| -rw-r--r-- | src/plugins/Input/phonon/decoder_phonon.cpp | 219 | ||||
| -rw-r--r-- | src/plugins/Input/phonon/decoder_phonon.h | 103 | ||||
| -rw-r--r-- | src/plugins/Input/phonon/decoderphononfactory.cpp | 109 | ||||
| -rw-r--r-- | src/plugins/Input/phonon/decoderphononfactory.h | 50 | ||||
| -rw-r--r-- | src/plugins/Input/phonon/phonon.pro | 38 |
5 files changed, 0 insertions, 519 deletions
diff --git a/src/plugins/Input/phonon/decoder_phonon.cpp b/src/plugins/Input/phonon/decoder_phonon.cpp deleted file mode 100644 index c6781035b..000000000 --- a/src/plugins/Input/phonon/decoder_phonon.cpp +++ /dev/null @@ -1,219 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by Ilya Kotov * - * forkotov02@hotmail.ru * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#include <qmmp/constants.h> -#include <qmmp/buffer.h> -#include <qmmp/output.h> -#include <qmmp/recycler.h> -#include <qmmp/fileinfo.h> -#include <qmmp/decoderfactory.h> - -#include <QObject> -#include <QBasicTimer> -#include <QFile> -#include <QApplication> -#include <QAction> -#include <QKeyEvent> -#include <QMenu> - -#include "decoder_phonon.h" - - -VideoWindow::VideoWindow(DecoderPhonon *decoder, QWidget *parent) : - Phonon::VideoWidget(parent) -{ - m_decoder = decoder; - //create menu - m_menu = new QMenu (this); - //actions - m_fullScreenAction = new QAction(tr("Full Screen"), this); - m_fullScreenAction->setShortcut(tr("Alt+Return")); - m_fullScreenAction->setCheckable(TRUE); - m_fullScreenAction->setChecked(FALSE); - m_fullScreenAction->setShortcutContext(Qt::WindowShortcut); - connect(m_fullScreenAction, SIGNAL(triggered(bool)), SLOT(changeScreen(bool))); - m_menu->addAction(m_fullScreenAction); - addAction(m_fullScreenAction); - setMouseTracking (FALSE); -} - -void VideoWindow::mouseDoubleClickEvent(QMouseEvent *e) -{ - changeScreen(!isFullScreen()); - Phonon::VideoWidget::mouseDoubleClickEvent(e); -} - -void VideoWindow::closeEvent (QCloseEvent *event) -{ - if (event->spontaneous()) - m_decoder->stop(); - Phonon::VideoWidget::closeEvent(event); -} - -void VideoWindow::mousePressEvent(QMouseEvent *event) -{ - switch ((int) event->button ()) - { - case Qt::LeftButton: - m_pos = event->pos(); - break; - case Qt::RightButton: - m_menu->exec(event->globalPos()); - break; - } - Phonon::VideoWidget::mousePressEvent(event); -} - -void VideoWindow::mouseReleaseEvent(QMouseEvent *event) -{ - Phonon::VideoWidget::mouseReleaseEvent(event); -} - -void VideoWindow::mouseMoveEvent(QMouseEvent *event) -{ - QPoint npos = (event->globalPos() - m_pos + (frameGeometry ().topLeft() - geometry().topLeft())); - move(npos); - Phonon::VideoWidget::mouseMoveEvent(event); -} - - -void VideoWindow::changeScreen(bool fullScreen) -{ - m_fullScreenAction->setChecked(fullScreen); - setFullScreen(fullScreen); - if (!fullScreen) - resize(sizeHint()); -} - - -DecoderPhonon::DecoderPhonon(QObject *parent, DecoderFactory *d, const QString &url) - : Decoder(parent, d) -{ - m_mediaObject = 0; - m_audioOutput = 0; - m_videoWidget = 0; - m_url = url; -} - -DecoderPhonon::~DecoderPhonon() -{ - qDebug("DecoderPhonon::~DecoderPhonon"); - m_videoWidget->hide(); - delete m_videoWidget; -} - -bool DecoderPhonon::initialize() -{ - m_videoWidget = new VideoWindow(this);//Phonon::VideoWidget(); - m_videoWidget->setAspectRatio(Phonon::VideoWidget::AspectRatioAuto); - m_videoWidget->resize(300,200); - m_videoWidget->setWindowTitle("Phonon Plugin"); - m_mediaObject = new Phonon::MediaObject(this); - m_audioOutput = new Phonon::AudioOutput(this); - m_audioOutputPath = Phonon::createPath(m_mediaObject, m_audioOutput); - Phonon::createPath(m_mediaObject, m_videoWidget); - connect(m_mediaObject, SIGNAL(stateChanged(Phonon::State, Phonon::State)), SLOT(updateState(Phonon::State, Phonon::State))); - connect(m_mediaObject, SIGNAL(tick (qint64)), SLOT(updateTime(qint64))); - connect(m_mediaObject, SIGNAL(finished ()), SLOT(finish ())); - m_mediaObject->setTickInterval(1000); - m_mediaObject->clearQueue(); - m_mediaObject->enqueue(Phonon::MediaSource(m_url)); - m_stop = FALSE; - return TRUE; -} - -qint64 DecoderPhonon::lengthInSeconds() -{ - return m_mediaObject->totalTime () / 1000; -} - -void DecoderPhonon::seek(qint64 pos) -{ - m_mediaObject->seek(pos * 1000); -} - -void DecoderPhonon::stop() -{ - m_mediaObject->stop(); - m_videoWidget->close(); - while (m_mediaObject->state() == Phonon::PlayingState) - { - qApp->processEvents(); - usleep(100); - } - StateHandler::instance()->dispatch(Qmmp::Stopped); -} - -void DecoderPhonon::pause() -{ - if (m_mediaObject->state() == Phonon::PausedState) - m_mediaObject->play(); - else if (m_mediaObject->state() == Phonon::PlayingState) - m_mediaObject->pause(); -} - -void DecoderPhonon::setEQ(double bands[10], double preamp) -{ -} - -void DecoderPhonon::setEQEnabled(bool on) -{ -} - -void DecoderPhonon::run() -{ - if (!m_stop) - m_mediaObject->play(); - else - { - //m_mediaObject.stop(); - while (m_mediaObject->state() == Phonon::PlayingState) - { - qApp->processEvents(); - usleep(500); - } - } -} - -void DecoderPhonon::updateState(Phonon::State newstate, Phonon::State) -{ - switch ((int) newstate) - { - case Phonon::PlayingState: - StateHandler::instance()->dispatch(Qmmp::Playing); - m_videoWidget->resize(m_videoWidget->sizeHint()); - m_videoWidget->show(); - break; - case Phonon::PausedState: - StateHandler::instance()->dispatch(Qmmp::Paused); - break; - case Phonon::StoppedState: - //StateHandler::instance()->dispatch(Qmmp::Stopped); - //m_videoWidget->close(); - qApp->processEvents(); - break; - } -} - -void DecoderPhonon::updateTime(qint64 time) -{ - StateHandler::instance()->dispatch(time / 1000, m_mediaObject->totalTime () / 1000, 0, 0, 0, 0); -} - diff --git a/src/plugins/Input/phonon/decoder_phonon.h b/src/plugins/Input/phonon/decoder_phonon.h deleted file mode 100644 index 2af9ccce8..000000000 --- a/src/plugins/Input/phonon/decoder_phonon.h +++ /dev/null @@ -1,103 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by Ilya Kotov * - * forkotov02@hotmail.ru * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ - -#ifndef DECODER_PHONON_H -#define DECODER_PHONON_H - -#include <phonon/phononnamespace.h> -#include <phonon/audiooutput.h> -#include <phonon/seekslider.h> -#include <phonon/mediaobject.h> -#include <phonon/volumeslider.h> -#include <phonon/backendcapabilities.h> -#include <phonon/videowidget.h> -#include <phonon/effect.h> -#include <phonon/effectparameter.h> - -#include <qmmp/decoder.h> -#include <qmmp/statehandler.h> - -class Output; -class QIDevice; -class DecoderPhonon; -class QMenu; - -class VideoWindow : public Phonon::VideoWidget -{ -Q_OBJECT -public: - VideoWindow(DecoderPhonon *decoder, QWidget *parent = 0); - -protected: - void mouseDoubleClickEvent(QMouseEvent *e); - void closeEvent (QCloseEvent *event); - void mousePressEvent(QMouseEvent *event); - void mouseReleaseEvent(QMouseEvent *event); - void mouseMoveEvent(QMouseEvent *event); - -private slots: - void changeScreen(bool fullScreen); - -private: - DecoderPhonon *m_decoder; - QAction *m_fullScreenAction; - QPoint m_pos; - QMenu *m_menu; - QByteArray m_geometry; -}; - - -class DecoderPhonon : public Decoder -{ - Q_OBJECT -public: - DecoderPhonon(QObject *, DecoderFactory *, const QString &url); - virtual ~DecoderPhonon(); - - // Standard Decoder API - bool initialize(); - qint64 lengthInSeconds(); - void seek(qint64); - void stop(); - void pause(); - - // Equalizer - void setEQ(double bands[10], double preamp); - void setEQEnabled(bool on); - -private slots: - void updateState(Phonon::State newstate, Phonon::State oldstate); - void updateTime(qint64 time); - -private: - // thread run function - void run(); - // phonon object - Phonon::MediaObject *m_mediaObject; - Phonon::AudioOutput *m_audioOutput; - Phonon::VideoWidget *m_videoWidget; - Phonon::Path m_audioOutputPath; - bool m_stop; - - QString m_url; -}; - - -#endif // DECODER_PHONON_H diff --git a/src/plugins/Input/phonon/decoderphononfactory.cpp b/src/plugins/Input/phonon/decoderphononfactory.cpp deleted file mode 100644 index 7b089491c..000000000 --- a/src/plugins/Input/phonon/decoderphononfactory.cpp +++ /dev/null @@ -1,109 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008 by Ilya Kotov * - * forkotov02@hotmail.ru * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#include <QtGui> - -#include <phonon/phononnamespace.h> -#include <phonon/audiooutput.h> -#include <phonon/seekslider.h> -#include <phonon/mediaobject.h> -#include <phonon/volumeslider.h> -#include <phonon/backendcapabilities.h> -#include <phonon/videowidget.h> -#include <phonon/effect.h> -#include <phonon/effectparameter.h> - -#include "decoder_phonon.h" -#include "settingsdialog.h" -#include "decoderphononfactory.h" - - -// DecoderPhononFactory - -bool DecoderPhononFactory::supports(const QString &source) const -{ - QStringList filters; - QStringList mimeTypes = Phonon::BackendCapabilities::availableMimeTypes(); - return source.right(4).toLower() == ".avi"; -} - -bool DecoderPhononFactory::canDecode(QIODevice *) const -{ - return FALSE; -} - -const DecoderProperties DecoderPhononFactory::properties() const -{ - DecoderProperties properties; - properties.name = tr("Phonon Plugin"); - properties.shortName = "phonon"; - properties.filter = "*.avi"; - properties.description = tr("Phonon Files"); - //properties.contentType = "application/ogg;audio/x-vorbis+ogg"; - properties.protocols = "file"; - properties.hasAbout = FALSE; - properties.hasSettings = FALSE; - properties.noInput = TRUE; - properties.noOutput = TRUE; - return properties; -} - -Decoder *DecoderPhononFactory::create(QObject *parent, QIODevice *input, - Output *output, const QString &url) -{ - Q_UNUSED(input); - Q_UNUSED(output); - return new DecoderPhonon(parent, this, url); -} - -QList<FileInfo *> DecoderPhononFactory::createPlayList(const QString &fileName, bool useMetaData) -{ - Q_UNUSED(useMetaData); - QList<FileInfo *> info; - info << new FileInfo(fileName); - return info; -} - -QObject* DecoderPhononFactory::showDetails(QWidget *, const QString &) -{ - return 0; -} - -void DecoderPhononFactory::showSettings(QWidget *parent) -{ - /*SettingsDialog *s = new SettingsDialog(parent); - s->show();*/ -} - -void DecoderPhononFactory::showAbout(QWidget *parent) -{ - QMessageBox::about (parent, tr("About Phonon Audio Plugin"), - tr("Qmmp Phonon Audio Plugin")+"\n"+ - tr("Writen by: Ilya Kotov <forkotov02@hotmail.ru>")); -} - -QTranslator *DecoderPhononFactory::createTranslator(QObject *parent) -{ - QTranslator *translator = new QTranslator(parent); - QString locale = QLocale::system().name(); - translator->load(QString(":/phonon_plugin_") + locale); - return translator; -} - -Q_EXPORT_PLUGIN(DecoderPhononFactory) diff --git a/src/plugins/Input/phonon/decoderphononfactory.h b/src/plugins/Input/phonon/decoderphononfactory.h deleted file mode 100644 index 65a100347..000000000 --- a/src/plugins/Input/phonon/decoderphononfactory.h +++ /dev/null @@ -1,50 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2006-2008 by Ilya Kotov * - * forkotov02@hotmail.ru * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - ***************************************************************************/ -#ifndef DECODERPHONONFACTORY_H -#define DECODERPHONONFACTORY_H - -#include <QObject> -#include <QString> -#include <QIODevice> -#include <QWidget> - -#include <qmmp/decoder.h> -#include <qmmp/output.h> -#include <qmmp/decoderfactory.h> -#include <qmmp/fileinfo.h> - -class DecoderPhononFactory : public QObject, DecoderFactory -{ -Q_OBJECT -Q_INTERFACES(DecoderFactory); - -public: - bool supports(const QString &source) const; - bool canDecode(QIODevice *input) const; - const DecoderProperties properties() const; - Decoder *create(QObject *, QIODevice *, Output *, const QString &); - QList<FileInfo *> createPlayList(const QString &fileName, bool useMetaData); - QObject* showDetails(QWidget *parent, const QString &path); - void showSettings(QWidget *parent); - void showAbout(QWidget *parent); - QTranslator *createTranslator(QObject *parent); -}; - -#endif diff --git a/src/plugins/Input/phonon/phonon.pro b/src/plugins/Input/phonon/phonon.pro deleted file mode 100644 index 2da95c88e..000000000 --- a/src/plugins/Input/phonon/phonon.pro +++ /dev/null @@ -1,38 +0,0 @@ -include(../../plugins.pri) - -HEADERS += decoderphononfactory.h \ - decoder_phonon.h - -SOURCES += decoder_phonon.cpp \ - decoderphononfactory.cpp - -TARGET =$$PLUGINS_PREFIX/Input/phonon -QMAKE_CLEAN =$$PLUGINS_PREFIX/Input/libphonon.so - -INCLUDEPATH += ../../../ -CONFIG += release \ -warn_on \ -plugin - -TEMPLATE = lib - -QT += phonon - -QMAKE_LIBDIR += ../../../../lib -LIBS += -lqmmp -L/usr/lib - -#TRANSLATIONS = translations/phonon_plugin_ru.ts -# translations/phonon_plugin_uk_UA.ts -# translations/phonon_plugin_zh_CN.ts -# translations/phonon_plugin_zh_TW.ts -# translations/phonon_plugin_cs.ts -# translations/phonon_plugin_de.ts -#RESOURCES = translations/translations.qrc - -isEmpty(LIB_DIR){ - LIB_DIR = /lib -} -target.path = $$LIB_DIR/qmmp/Input -INSTALLS += target - - |
