From 7a3c89bf2d71b74a8edbc39ec1264c68307cc888 Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Fri, 9 Oct 2009 20:01:12 +0000 Subject: added engine api, enabled mplayer plugin git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1296 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/CMakeLists.txt | 1 + src/plugins/Engines/CMakeLists.txt | 5 + src/plugins/Engines/Engines.pro | 4 + src/plugins/Engines/mplayer/CMakeLists.txt | 66 ++++ src/plugins/Engines/mplayer/mplayer.pro | 34 ++ src/plugins/Engines/mplayer/mplayerengine.cpp | 262 ++++++++++++++ src/plugins/Engines/mplayer/mplayerengine.h | 83 +++++ .../Engines/mplayer/mplayerenginefactory.cpp | 96 +++++ src/plugins/Engines/mplayer/mplayerenginefactory.h | 49 +++ .../Engines/mplayer/mplayermetadatamodel.cpp | 106 ++++++ src/plugins/Engines/mplayer/mplayermetadatamodel.h | 38 ++ src/plugins/Engines/mplayer/settingsdialog.cpp | 69 ++++ src/plugins/Engines/mplayer/settingsdialog.h | 46 +++ src/plugins/Engines/mplayer/settingsdialog.ui | 141 ++++++++ .../mplayer/translations/mplayer_plugin_cs.ts | 187 ++++++++++ .../mplayer/translations/mplayer_plugin_de.ts | 187 ++++++++++ .../mplayer/translations/mplayer_plugin_it.ts | 187 ++++++++++ .../mplayer/translations/mplayer_plugin_lt.ts | 187 ++++++++++ .../mplayer/translations/mplayer_plugin_pl.ts | 187 ++++++++++ .../mplayer/translations/mplayer_plugin_ru.ts | 187 ++++++++++ .../mplayer/translations/mplayer_plugin_tr.ts | 187 ++++++++++ .../mplayer/translations/mplayer_plugin_uk_UA.ts | 187 ++++++++++ .../mplayer/translations/mplayer_plugin_zh_CN.ts | 187 ++++++++++ .../mplayer/translations/mplayer_plugin_zh_TW.ts | 187 ++++++++++ .../Engines/mplayer/translations/translations.qrc | 15 + src/plugins/Input/CMakeLists.txt | 5 - src/plugins/Input/cue/cueparser.cpp | 5 +- src/plugins/Input/flac/cueparser.cpp | 4 +- src/plugins/Input/mplayer/CMakeLists.txt | 67 ---- src/plugins/Input/mplayer/decoder_mplayer.cpp | 221 ------------ src/plugins/Input/mplayer/decoder_mplayer.h | 81 ----- .../Input/mplayer/decodermplayerfactory.cpp | 108 ------ src/plugins/Input/mplayer/decodermplayerfactory.h | 50 --- src/plugins/Input/mplayer/detailsdialog.cpp | 107 ------ src/plugins/Input/mplayer/detailsdialog.h | 43 --- src/plugins/Input/mplayer/detailsdialog.ui | 390 --------------------- src/plugins/Input/mplayer/mplayer.pro | 45 --- src/plugins/Input/mplayer/settingsdialog.cpp | 69 ---- src/plugins/Input/mplayer/settingsdialog.h | 46 --- src/plugins/Input/mplayer/settingsdialog.ui | 141 -------- .../mplayer/translations/mplayer_plugin_cs.ts | 187 ---------- .../mplayer/translations/mplayer_plugin_de.ts | 187 ---------- .../mplayer/translations/mplayer_plugin_it.ts | 187 ---------- .../mplayer/translations/mplayer_plugin_lt.ts | 187 ---------- .../mplayer/translations/mplayer_plugin_pl.ts | 187 ---------- .../mplayer/translations/mplayer_plugin_ru.ts | 187 ---------- .../mplayer/translations/mplayer_plugin_tr.ts | 187 ---------- .../mplayer/translations/mplayer_plugin_uk_UA.ts | 187 ---------- .../mplayer/translations/mplayer_plugin_zh_CN.ts | 187 ---------- .../mplayer/translations/mplayer_plugin_zh_TW.ts | 187 ---------- .../Input/mplayer/translations/translations.qrc | 15 - src/plugins/Input/wavpack/cueparser.cpp | 6 +- src/plugins/plugins.pro | 3 +- src/qmmp/CMakeLists.txt | 2 + src/qmmp/abstractengine.cpp | 42 +++ src/qmmp/abstractengine.h | 29 +- src/qmmp/decoder.cpp | 43 --- src/qmmp/decoder.h | 15 - src/qmmp/enginefactory.h | 4 + src/qmmp/metadatamanager.cpp | 116 ++++++ src/qmmp/metadatamanager.h | 67 ++++ src/qmmp/qmmp.pro | 6 +- src/qmmp/qmmpaudioengine.cpp | 21 +- src/qmmp/qmmpaudioengine.h | 1 + src/qmmp/soundcore.cpp | 75 +++- src/qmmp/soundcore.h | 4 +- src/qmmpui/detailsdialog.cpp | 21 +- src/qmmpui/fileloader.cpp | 12 +- src/qmmpui/mediaplayer.cpp | 1 + src/qmmpui/playlistitem.cpp | 4 +- src/qmmpui/playlistmodel.cpp | 7 +- src/ui/mainwindow.cpp | 6 +- 72 files changed, 3271 insertions(+), 3366 deletions(-) create mode 100644 src/plugins/Engines/CMakeLists.txt create mode 100644 src/plugins/Engines/Engines.pro create mode 100644 src/plugins/Engines/mplayer/CMakeLists.txt create mode 100644 src/plugins/Engines/mplayer/mplayer.pro create mode 100644 src/plugins/Engines/mplayer/mplayerengine.cpp create mode 100644 src/plugins/Engines/mplayer/mplayerengine.h create mode 100644 src/plugins/Engines/mplayer/mplayerenginefactory.cpp create mode 100644 src/plugins/Engines/mplayer/mplayerenginefactory.h create mode 100644 src/plugins/Engines/mplayer/mplayermetadatamodel.cpp create mode 100644 src/plugins/Engines/mplayer/mplayermetadatamodel.h create mode 100644 src/plugins/Engines/mplayer/settingsdialog.cpp create mode 100644 src/plugins/Engines/mplayer/settingsdialog.h create mode 100644 src/plugins/Engines/mplayer/settingsdialog.ui create mode 100644 src/plugins/Engines/mplayer/translations/mplayer_plugin_cs.ts create mode 100644 src/plugins/Engines/mplayer/translations/mplayer_plugin_de.ts create mode 100644 src/plugins/Engines/mplayer/translations/mplayer_plugin_it.ts create mode 100644 src/plugins/Engines/mplayer/translations/mplayer_plugin_lt.ts create mode 100644 src/plugins/Engines/mplayer/translations/mplayer_plugin_pl.ts create mode 100644 src/plugins/Engines/mplayer/translations/mplayer_plugin_ru.ts create mode 100644 src/plugins/Engines/mplayer/translations/mplayer_plugin_tr.ts create mode 100644 src/plugins/Engines/mplayer/translations/mplayer_plugin_uk_UA.ts create mode 100644 src/plugins/Engines/mplayer/translations/mplayer_plugin_zh_CN.ts create mode 100644 src/plugins/Engines/mplayer/translations/mplayer_plugin_zh_TW.ts create mode 100644 src/plugins/Engines/mplayer/translations/translations.qrc delete mode 100644 src/plugins/Input/mplayer/CMakeLists.txt delete mode 100644 src/plugins/Input/mplayer/decoder_mplayer.cpp delete mode 100644 src/plugins/Input/mplayer/decoder_mplayer.h delete mode 100644 src/plugins/Input/mplayer/decodermplayerfactory.cpp delete mode 100644 src/plugins/Input/mplayer/decodermplayerfactory.h delete mode 100644 src/plugins/Input/mplayer/detailsdialog.cpp delete mode 100644 src/plugins/Input/mplayer/detailsdialog.h delete mode 100644 src/plugins/Input/mplayer/detailsdialog.ui delete mode 100644 src/plugins/Input/mplayer/mplayer.pro delete mode 100644 src/plugins/Input/mplayer/settingsdialog.cpp delete mode 100644 src/plugins/Input/mplayer/settingsdialog.h delete mode 100644 src/plugins/Input/mplayer/settingsdialog.ui delete mode 100644 src/plugins/Input/mplayer/translations/mplayer_plugin_cs.ts delete mode 100644 src/plugins/Input/mplayer/translations/mplayer_plugin_de.ts delete mode 100644 src/plugins/Input/mplayer/translations/mplayer_plugin_it.ts delete mode 100644 src/plugins/Input/mplayer/translations/mplayer_plugin_lt.ts delete mode 100644 src/plugins/Input/mplayer/translations/mplayer_plugin_pl.ts delete mode 100644 src/plugins/Input/mplayer/translations/mplayer_plugin_ru.ts delete mode 100644 src/plugins/Input/mplayer/translations/mplayer_plugin_tr.ts delete mode 100644 src/plugins/Input/mplayer/translations/mplayer_plugin_uk_UA.ts delete mode 100644 src/plugins/Input/mplayer/translations/mplayer_plugin_zh_CN.ts delete mode 100644 src/plugins/Input/mplayer/translations/mplayer_plugin_zh_TW.ts delete mode 100644 src/plugins/Input/mplayer/translations/translations.qrc create mode 100644 src/qmmp/metadatamanager.cpp create mode 100644 src/qmmp/metadatamanager.h (limited to 'src') diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 00eabaad5..4f4c53f03 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -7,3 +7,4 @@ add_subdirectory(PlaylistFormats) add_subdirectory(CommandLineOptions) add_subdirectory(FileDialogs) add_subdirectory(Transports) +add_subdirectory(Engines) \ No newline at end of file diff --git a/src/plugins/Engines/CMakeLists.txt b/src/plugins/Engines/CMakeLists.txt new file mode 100644 index 000000000..636972563 --- /dev/null +++ b/src/plugins/Engines/CMakeLists.txt @@ -0,0 +1,5 @@ +SET(USE_MPLAYER TRUE CACHE BOOL "enable/disable mplayer support") + +IF(USE_MPLAYER) +add_subdirectory(mplayer) +ENDIF(USE_MPLAYER) diff --git a/src/plugins/Engines/Engines.pro b/src/plugins/Engines/Engines.pro new file mode 100644 index 000000000..1dddcfd5d --- /dev/null +++ b/src/plugins/Engines/Engines.pro @@ -0,0 +1,4 @@ +include(../../../qmmp.pri) + +SUBDIRS += mplayer +TEMPLATE = subdirs diff --git a/src/plugins/Engines/mplayer/CMakeLists.txt b/src/plugins/Engines/mplayer/CMakeLists.txt new file mode 100644 index 000000000..1dea9477b --- /dev/null +++ b/src/plugins/Engines/mplayer/CMakeLists.txt @@ -0,0 +1,66 @@ +project(libmplayer) + +cmake_minimum_required(VERSION 2.4.7) + +if(COMMAND cmake_policy) +cmake_policy(SET CMP0003 NEW) +endif(COMMAND cmake_policy) + + +# qt plugin +ADD_DEFINITIONS( -Wall ) +ADD_DEFINITIONS(${QT_DEFINITIONS}) +ADD_DEFINITIONS(-DQT_PLUGIN) +ADD_DEFINITIONS(-DQT_NO_DEBUG) +ADD_DEFINITIONS(-DQT_SHARED) +ADD_DEFINITIONS(-DQT_THREAD) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +SET(QT_INCLUDES + ${QT_INCLUDES} + ${CMAKE_CURRENT_BINARY_DIR}/../../../ +) + +# libqmmp +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../) +link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../../qmmp) + + +SET(libmplayer_SRCS + mplayerenginefactory.cpp + mplayerengine.cpp + mplayermetadatamodel.cpp + settingsdialog.cpp +) + +SET(libmplayer_MOC_HDRS + mplayerenginefactory.h + mplayerengine.h + mplayermetadatamodel.h + settingsdialog.h +) + +SET(libmplayer_RCCS translations/translations.qrc) + +QT4_ADD_RESOURCES(libmplayer_RCC_SRCS ${libmplayer_RCCS}) + +QT4_WRAP_CPP(libmplayer_MOC_SRCS ${libmplayer_MOC_HDRS}) + +# user interface + + +SET(libmplayer_UIS + settingsdialog.ui +) + +QT4_WRAP_UI(libmplayer_UIS_H ${libmplayer_UIS}) +# Don't forget to include output directory, otherwise +# the UI file won't be wrapped! +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +ADD_LIBRARY(mplayer MODULE ${libmplayer_SRCS} ${libmplayer_MOC_SRCS} ${libmplayer_RCC_SRCS} ${libmplayer_UIS_H}) +add_dependencies(mplayer qmmp) +target_link_libraries(mplayer ${QT_LIBRARIES} -lqmmp) +install(TARGETS mplayer DESTINATION ${LIB_DIR}/qmmp/Engines) + diff --git a/src/plugins/Engines/mplayer/mplayer.pro b/src/plugins/Engines/mplayer/mplayer.pro new file mode 100644 index 000000000..dbcde014d --- /dev/null +++ b/src/plugins/Engines/mplayer/mplayer.pro @@ -0,0 +1,34 @@ +include(../../plugins.pri) +HEADERS += mplayerenginefactory.h \ + mplayerengine.h \ + settingsdialog.h \ + mplayermetadatamodel.h +SOURCES += mplayerengine.cpp \ + mplayerenginefactory.cpp \ + settingsdialog.cpp \ + mplayermetadatamodel.cpp +TARGET = $$PLUGINS_PREFIX/Engines/mplayer +QMAKE_CLEAN = $$PLUGINS_PREFIX/Engines/libmplayer.so +INCLUDEPATH += ../../../ +CONFIG += release \ + warn_on \ + plugin +TEMPLATE = lib +QMAKE_LIBDIR += ../../../../lib +LIBS += -lqmmp \ + -L/usr/lib +TRANSLATIONS = translations/mplayer_plugin_ru.ts \ + translations/mplayer_plugin_uk_UA.ts \ + translations/mplayer_plugin_zh_CN.ts \ + translations/mplayer_plugin_zh_TW.ts \ + translations/mplayer_plugin_cs.ts \ + translations/mplayer_plugin_pl.ts \ + translations/mplayer_plugin_de.ts \ + translations/mplayer_plugin_it.ts \ + translations/mplayer_plugin_tr.ts \ + translations/mplayer_plugin_lt.ts +RESOURCES = translations/translations.qrc +isEmpty(LIB_DIR):LIB_DIR = /lib +target.path = $$LIB_DIR/qmmp/Input +INSTALLS += target +FORMS += settingsdialog.ui diff --git a/src/plugins/Engines/mplayer/mplayerengine.cpp b/src/plugins/Engines/mplayer/mplayerengine.cpp new file mode 100644 index 000000000..33a2c69ae --- /dev/null +++ b/src/plugins/Engines/mplayer/mplayerengine.cpp @@ -0,0 +1,262 @@ +/*************************************************************************** + * Copyright (C) 2008-2009 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "mplayerengine.h" + +#define MPLAYER_DEBUG + +static QRegExp rx_av("^[AV]: *([0-9,:.-]+)"); +static QRegExp rx_pause("^(.*)=(.*)PAUSE(.*)"); +static QRegExp rx_end("^(.*)End of file(.*)"); +static QRegExp rx_quit("^(.*)Quit(.*)"); +static QRegExp rx_audio("^AUDIO: *([0-9,.]+) *Hz.*([0-9,.]+) *ch.*([0-9]+).* ([0-9,.]+) *kbit.*"); + + +FileInfo *MplayerInfo::createFileInfo(const QString &path) +{ + QRegExp rx_id_length("^ID_LENGTH=([0-9,.]+)*"); + QStringList args; + args << "-slave"; + args << "-identify"; + args << "-frames"; + args << "0"; + args << "-vo"; + args << "null"; + args << "-ao"; + args << "null"; + args << path; + QProcess mplayer_process; + mplayer_process.start("mplayer", args); + mplayer_process.waitForFinished(); + QString str = QString::fromLocal8Bit(mplayer_process.readAll()).trimmed(); + FileInfo *info = new FileInfo(path); + QStringList lines = str.split("\n"); + foreach(QString line, lines) + { + if (rx_id_length.indexIn(line) > -1) + info->setLength((qint64) rx_id_length.cap(1).toDouble()); + } +#ifdef MPLAYER_DEBUG + qDebug("%s",qPrintable(str)); +#endif + return info; +} + +QStringList MplayerInfo::filters() +{ + QStringList filters; + filters << "*.avi" << "*.mpg" << "*.mpeg" << "*.divx" << "*.qt" << "*.mov" << "*.wmv" << "*.asf" + << "*.flv" << "*.3gp" << "*.mkv"; + return filters; +} + +MplayerEngine::MplayerEngine(QObject *parent) + : AbstractEngine(parent) +{ + //m_url = url; + m_bitrate = 0; + m_samplerate = 0; + m_channels = 0; + m_bitsPerSample = 0; + m_length = 0; + m_currentTime = 0; + m_process = new QProcess(this); + connect(m_process, SIGNAL(readyReadStandardOutput()), SLOT(readStdOut())); +} + +MplayerEngine::~MplayerEngine() +{ + qDebug("%s",__FUNCTION__); + m_process->close(); +} + +bool MplayerEngine::play() +{ + if(m_process->state() != QProcess::NotRunning) + return FALSE; + startMplayerProcess(); + return TRUE; +} + +bool MplayerEngine::enqueue(InputSource *source) +{ + QString url = source->url(); + QStringList filters = MplayerInfo::filters(); + bool supports = FALSE; + foreach(QString filter, filters) + { + QRegExp regexp(filter, Qt::CaseInsensitive, QRegExp::Wildcard); + supports = regexp.exactMatch(source->url()); + if(supports) + break; + } + if(!supports) + return FALSE; + source->deleteLater(); + if(m_process->state() == QProcess::NotRunning) + m_url = url; + else + m_files.enqueue(url); + return TRUE; +} + +bool MplayerEngine::initialize() +{ + FileInfo *info = MplayerInfo::createFileInfo(m_url); + m_length = info->length(); + delete info; + m_args.clear(); + m_args << "-slave"; + QSettings settings(Qmmp::configFile(), QSettings::IniFormat); + QString ao_str = settings.value("mplayer/ao","default").toString(); + QString vo_str = settings.value("mplayer/vo","default").toString(); + if (ao_str != "default") + m_args << "ao=" + ao_str; + if (vo_str != "default") + m_args << "vo=" + vo_str; + + if (settings.value("autosync", FALSE).toBool()) + m_args << QString("-autosync %1").arg(settings.value("autosync_factor", 100).toInt()); + + m_args << m_url; + return TRUE; +} + +qint64 MplayerEngine::totalTime() +{ + return m_length * 1000; +} + +void MplayerEngine::seek(qint64 pos) +{ + if (m_process->state() == QProcess::Running) + m_process->write(QString("seek %1 \n").arg(pos/1000 - m_currentTime).toLocal8Bit ()); +} + +void MplayerEngine::stop() +{ + if (m_process->state() == QProcess::Running) + { + m_process->write("quit\n"); + m_process->waitForFinished(1500); + } + StateHandler::instance()->dispatch(Qmmp::Stopped); + m_files.clear(); + m_url.clear(); +} + +void MplayerEngine::pause() +{ + m_process->write("pause\n"); +} + +void MplayerEngine::setEQ(double bands[10], double preamp) +{ + Q_UNUSED(bands[10]); + Q_UNUSED(preamp); +} + +void MplayerEngine::setEQEnabled(bool on) +{ + Q_UNUSED(on); +} + +void MplayerEngine::readStdOut() +{ + QString line = QString::fromLocal8Bit(m_process->readAll ()).trimmed(); + QStringList lines = line.split("\n"); + foreach(line, lines) + { + if (rx_av.indexIn(line) > -1) + { + StateHandler::instance()->dispatch(Qmmp::Playing); + m_currentTime = (qint64) rx_av.cap(1).toDouble(); + StateHandler::instance()->dispatch(m_currentTime * 1000, + m_bitrate, + m_samplerate, + m_bitsPerSample, + m_channels); + } + else if (rx_pause.indexIn(line) > -1) + { + StateHandler::instance()->dispatch(Qmmp::Paused); + } + else if (rx_end.indexIn(line) > -1) + { + if (m_process->state() == QProcess::Running) + m_process->waitForFinished(3500); + emit playbackFinished(); + if(!m_files.isEmpty()) + { + StateHandler::instance()->dispatch(Qmmp::Stopped); + m_url = m_files.dequeue(); + startMplayerProcess(); + } + else + { + StateHandler::instance()->dispatch(Qmmp::Stopped); + return; + } + } + else if (rx_quit.indexIn(line) > -1) + { + if (m_process->state() == QProcess::Running) + m_process->waitForFinished(1500); + StateHandler::instance()->dispatch(Qmmp::Stopped); + } + else if (rx_audio.indexIn(line) > -1) + { + m_samplerate = rx_audio.cap(1).toInt(); + m_channels = rx_audio.cap(2).toInt(); + m_bitsPerSample = rx_audio.cap(3).toDouble(); + m_bitrate = rx_audio.cap(4).toDouble(); + } +#ifdef MPLAYER_DEBUG + else + qDebug("%s",qPrintable(line)); +#endif + } +} + +void MplayerEngine::startMplayerProcess() +{ + initialize(); + m_process->start ("mplayer", m_args); + StateHandler::instance()->dispatch(Qmmp::Playing); + FileInfo *info = MplayerInfo::createFileInfo(m_url); + StateHandler::instance()->dispatch(info->metaData()); + delete info; +} diff --git a/src/plugins/Engines/mplayer/mplayerengine.h b/src/plugins/Engines/mplayer/mplayerengine.h new file mode 100644 index 000000000..cc6b12d16 --- /dev/null +++ b/src/plugins/Engines/mplayer/mplayerengine.h @@ -0,0 +1,83 @@ +/*************************************************************************** + * Copyright (C) 2008-2009 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 MPLAYERENGINE_H +#define MPLAYERENGINE_H + +#include +#include +#include +#include + +class Output; +class QIDevice; +class DecoderPhonon; +class QMenu; +class QProcess; +class FileInfo; +class InputSource; + +class MplayerInfo +{ +public: + static FileInfo *createFileInfo(const QString &path); + static QStringList filters(); +}; + +class MplayerEngine : public AbstractEngine +{ + Q_OBJECT +public: + MplayerEngine(QObject *parent); + virtual ~MplayerEngine(); + + // Engine API + bool play(); + bool enqueue(InputSource *source); + bool initialize(); + qint64 totalTime(); + void seek(qint64); + void stop(); + void pause(); + + // Equalizer + void setEQ(double bands[10], double preamp); + void setEQEnabled(bool on); + +private slots: + void readStdOut(); + void startMplayerProcess(); + +private: + int mplayer_pipe[2]; + QString m_url; + QStringList m_args; + QProcess *m_process; + int m_bitrate; + int m_samplerate; + int m_channels; + int m_bitsPerSample; + qint64 m_currentTime; + qint64 m_length; + QQueue m_files; +}; + + +#endif // MPLAYERENGINE_H diff --git a/src/plugins/Engines/mplayer/mplayerenginefactory.cpp b/src/plugins/Engines/mplayer/mplayerenginefactory.cpp new file mode 100644 index 000000000..33ca2e4cf --- /dev/null +++ b/src/plugins/Engines/mplayer/mplayerenginefactory.cpp @@ -0,0 +1,96 @@ +/*************************************************************************** + * Copyright (C) 2008-2009 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 + +#include "mplayermetadatamodel.h" +#include "settingsdialog.h" +#include "mplayerengine.h" +#include "mplayerenginefactory.h" + + +// MplayerEngineFactory + +const EngineProperties MplayerEngineFactory::properties() const +{ + EngineProperties properties; + properties.name = tr("Mplayer Plugin"); + properties.shortName = "mplayer"; + properties.filter = MplayerInfo::filters().join(" "); + properties.description = tr("Video Files"); + //properties.contentType = "application/ogg;audio/x-vorbis+ogg"; + properties.protocols = "file"; + properties.hasAbout = TRUE; + properties.hasSettings = TRUE; + return properties; +} + +bool MplayerEngineFactory::supports(const QString &source) const +{ + QStringList filters = MplayerInfo::filters(); + foreach(QString filter, filters) + { + QRegExp regexp(filter, Qt::CaseInsensitive, QRegExp::Wildcard); + if (regexp.exactMatch(source)) + return TRUE; + } + return FALSE; +} + +AbstractEngine *MplayerEngineFactory::create(QObject *parent) +{ + return new MplayerEngine(parent); +} + +QList MplayerEngineFactory::createPlayList(const QString &fileName, bool useMetaData) +{ + Q_UNUSED(useMetaData); + QList info; + info << MplayerInfo::createFileInfo(fileName); + return info; +} + +MetaDataModel* MplayerEngineFactory::createMetaDataModel(const QString &path, QObject *parent) +{ + return new MplayerMetaDataModel(path, parent); +} + +void MplayerEngineFactory::showSettings(QWidget *parent) +{ + SettingsDialog *s = new SettingsDialog(parent); + s->show(); +} + +void MplayerEngineFactory::showAbout(QWidget *parent) +{ + QMessageBox::about (parent, tr("About MPlayer Plugin"), + tr("Qmmp MPlayer Plugin")+"\n"+ + tr("This plugin uses MPlayer as backend")+"\n"+ + tr("Writen by: Ilya Kotov ")); +} + +QTranslator *MplayerEngineFactory::createTranslator(QObject *parent) +{ + QTranslator *translator = new QTranslator(parent); + QString locale = Qmmp::systemLanguageID(); + translator->load(QString(":/mplayer_plugin_") + locale); + return translator; +} + +Q_EXPORT_PLUGIN(MplayerEngineFactory) diff --git a/src/plugins/Engines/mplayer/mplayerenginefactory.h b/src/plugins/Engines/mplayer/mplayerenginefactory.h new file mode 100644 index 000000000..4c43b15a2 --- /dev/null +++ b/src/plugins/Engines/mplayer/mplayerenginefactory.h @@ -0,0 +1,49 @@ +/*************************************************************************** + * Copyright (C) 2006-2009 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 MPLAYERENGINEFACTORY_H +#define MPLAYERENGINEFACTORY_H + +#include +#include +#include +#include + +#include +#include +#include +#include + +class MplayerEngineFactory : public QObject, EngineFactory +{ +Q_OBJECT +Q_INTERFACES(EngineFactory); + +public: + const EngineProperties properties() const; + bool supports(const QString &source) const; + AbstractEngine *create(QObject *parent = 0); + QList createPlayList(const QString &fileName, bool useMetaData); + MetaDataModel* createMetaDataModel(const QString &path, QObject *parent = 0); + void showSettings(QWidget *parent); + void showAbout(QWidget *parent); + QTranslator *createTranslator(QObject *parent); +}; + +#endif diff --git a/src/plugins/Engines/mplayer/mplayermetadatamodel.cpp b/src/plugins/Engines/mplayer/mplayermetadatamodel.cpp new file mode 100644 index 000000000..7aa8b3e3a --- /dev/null +++ b/src/plugins/Engines/mplayer/mplayermetadatamodel.cpp @@ -0,0 +1,106 @@ +/*************************************************************************** + * Copyright (C) 2009 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 +#include +#include +#include +#include "mplayermetadatamodel.h" + +MplayerMetaDataModel::MplayerMetaDataModel(const QString &path, QObject *parent) : MetaDataModel(parent) +{ + m_path = path; +} + +MplayerMetaDataModel::~MplayerMetaDataModel() +{} + +QHash MplayerMetaDataModel::audioProperties() +{ + QHash vp; + QHash ap; + ap.insert(tr("Size"), QString("%1 ").arg(QFileInfo(m_path).size ()/1024)+tr("KB")); + //regular expressions + QRegExp rx_id_length("^ID_LENGTH=([0-9,.]+)*"); + QRegExp rx_id_demuxer("^ID_DEMUXER=(.*)"); + QRegExp rx_id_video_bitrate("^ID_VIDEO_BITRATE=([0-9,.]+)*"); + QRegExp rx_id_width("^ID_VIDEO_WIDTH=([0-9,.]+)*"); + QRegExp rx_id_height("^ID_VIDEO_HEIGHT=([0-9,.]+)*"); + QRegExp rx_id_video_format("^ID_VIDEO_FORMAT=(.*)"); + QRegExp rx_id_video_fps("^ID_VIDEO_FPS=([0-9,.]+)*"); + QRegExp rx_id_video_codec("^ID_VIDEO_CODEC=(.*)"); + QRegExp rx_id_video_aspect("^ID_VIDEO_ASPECT=([0-9,.]+)*"); + QRegExp rx_id_audio_bitrate("^ID_AUDIO_BITRATE=([0-9,.]+)*"); + QRegExp rx_id_audio_rate("^ID_AUDIO_RATE=([0-9,.]+)*"); + QRegExp rx_id_audio_nch("^ID_AUDIO_NCH=([0-9,.]+)*"); + QRegExp rx_id_audio_codec("^ID_AUDIO_CODEC=(.*)"); + //prepare and start mplayer process + QStringList args; + args << "-slave"; + args << "-identify"; + args << "-frames"; + args << "0"; + args << "-vo"; + args << "null"; + args << "-ao"; + args << "null"; + args << m_path; + QProcess mplayer_process; + mplayer_process.start("mplayer", args); + mplayer_process.waitForFinished(); + QString str = QString::fromLocal8Bit(mplayer_process.readAll()).trimmed(); + QStringList lines = str.split("\n"); + int height = 0, width = 0; + //mplayer std output parsing + foreach(QString line, lines) + { + //general info + if (rx_id_length.indexIn(line) > -1) + ap.insert(tr("Length"),rx_id_length.cap(1)); //TODO use hh:mm:ss format + else if (rx_id_demuxer.indexIn(line) > -1) + ap.insert(tr("Demuxer"), rx_id_demuxer.cap(1)); + //video info + else if (rx_id_video_format.indexIn(line) > -1) + ap.insert(tr("Video format"), rx_id_video_format.cap(1)); + else if (rx_id_video_fps.indexIn(line) > -1) + ap.insert(tr("FPS"), rx_id_video_fps.cap(1)); + else if (rx_id_video_codec.indexIn(line) > -1) + ap.insert(tr("Video codec"), rx_id_video_codec.cap(1)); + else if (rx_id_video_aspect.indexIn(line) > -1) + ap.insert(tr("Aspect ratio"),rx_id_video_aspect.cap(1)); + else if (rx_id_video_bitrate.indexIn(line) > -1) + ap.insert(tr("Video bitrate"), rx_id_video_bitrate.cap(1)); + else if (rx_id_width.indexIn(line) > -1) + width = rx_id_width.cap(1).toInt(); + else if (rx_id_height.indexIn(line) > -1) + height = rx_id_height.cap(1).toInt(); + //audio info + else if (rx_id_audio_codec.indexIn(line) > -1) + ap.insert(tr("Audio codec"),rx_id_audio_codec.cap(1)); + else if (rx_id_audio_rate.indexIn(line) > -1) + ap.insert(tr("Sample rate"), rx_id_audio_rate.cap(1)); + else if (rx_id_audio_bitrate.indexIn(line) > -1) + ap.insert(tr("Audio bitrate"), rx_id_audio_bitrate.cap(1)); + else if (rx_id_audio_nch.indexIn(line) > -1) + ap.insert(tr("Channels"), rx_id_audio_nch.cap(1)); + } + vp.insert(tr("Resolution"), QString("%1x%2").arg(width).arg(height)); + return ap; +} diff --git a/src/plugins/Engines/mplayer/mplayermetadatamodel.h b/src/plugins/Engines/mplayer/mplayermetadatamodel.h new file mode 100644 index 000000000..3cfe4662c --- /dev/null +++ b/src/plugins/Engines/mplayer/mplayermetadatamodel.h @@ -0,0 +1,38 @@ +/*************************************************************************** + * Copyright (C) 2009 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 MPLAYERMETADATAMODEL_H +#define MPLAYERMETADATAMODEL_H + +#include + +class MplayerMetaDataModel : public MetaDataModel +{ +Q_OBJECT +public: + MplayerMetaDataModel(const QString &path, QObject *parent); + ~MplayerMetaDataModel(); + QHash audioProperties(); + +private: + QString m_path; +}; + +#endif // MPLAYERMETADATAMODEL_H diff --git a/src/plugins/Engines/mplayer/settingsdialog.cpp b/src/plugins/Engines/mplayer/settingsdialog.cpp new file mode 100644 index 000000000..029890eb1 --- /dev/null +++ b/src/plugins/Engines/mplayer/settingsdialog.cpp @@ -0,0 +1,69 @@ +/*************************************************************************** + * Copyright (C) 2009 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 + +#include + +#include "settingsdialog.h" + +SettingsDialog::SettingsDialog(QWidget *parent) + : QDialog(parent) +{ + ui.setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + ui.videoComboBox->addItem(tr("default")); + ui.videoComboBox->addItem("xv"); + ui.videoComboBox->addItem("x11"); + ui.videoComboBox->addItem("gl"); + ui.videoComboBox->addItem("gl2"); + ui.videoComboBox->addItem("dga"); + ui.videoComboBox->addItem("sdl"); + ui.videoComboBox->addItem("null"); + ui.audioComboBox->addItem(tr("default")); + ui.audioComboBox->addItem("oss"); + ui.audioComboBox->addItem("alsa"); + ui.audioComboBox->addItem("pulse"); + ui.audioComboBox->addItem("jack"); + ui.audioComboBox->addItem("nas"); + ui.audioComboBox->addItem("null"); + QSettings settings(Qmmp::configFile(), QSettings::IniFormat); + settings.beginGroup("mplayer"); + ui.audioComboBox->setEditText(settings.value("ao","default").toString().replace("default", tr("default"))); + ui.videoComboBox->setEditText(settings.value("vo","default").toString().replace("default", tr("default"))); + ui.autoSyncCheckBox->setChecked(settings.value("autosync", FALSE).toBool()); + ui.syncFactorSpinBox->setValue(settings.value("autosync_factor", 100).toInt()); + settings.endGroup(); +} + + +SettingsDialog::~SettingsDialog() +{} + +void SettingsDialog::accept() +{ + QSettings settings(Qmmp::configFile(), QSettings::IniFormat); + settings.beginGroup("mplayer"); + settings.setValue("ao",ui.audioComboBox->currentText().replace(tr("default"), "default")); + settings.setValue("vo",ui.videoComboBox->currentText().replace(tr("default"), "default")); + settings.setValue("autosync",ui.autoSyncCheckBox->isChecked()); + settings.setValue("autosync_factor",ui.syncFactorSpinBox->value()); + settings.endGroup(); + QDialog::accept(); +} diff --git a/src/plugins/Engines/mplayer/settingsdialog.h b/src/plugins/Engines/mplayer/settingsdialog.h new file mode 100644 index 000000000..9ba56bce8 --- /dev/null +++ b/src/plugins/Engines/mplayer/settingsdialog.h @@ -0,0 +1,46 @@ +/*************************************************************************** + * Copyright (C) 2009 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 SETTINGSDIALOG_H +#define SETTINGSDIALOG_H + +#include + +#include "ui_settingsdialog.h" + +/** + @author Ilya Kotov +*/ +class SettingsDialog : public QDialog +{ +Q_OBJECT +public: + SettingsDialog(QWidget *parent = 0); + + ~SettingsDialog(); + + +public slots: + virtual void accept(); + +private: + Ui::SettingsDialog ui; +}; + +#endif diff --git a/src/plugins/Engines/mplayer/settingsdialog.ui b/src/plugins/Engines/mplayer/settingsdialog.ui new file mode 100644 index 000000000..86dbfe8f6 --- /dev/null +++ b/src/plugins/Engines/mplayer/settingsdialog.ui @@ -0,0 +1,141 @@ + + + SettingsDialog + + + + 0 + 0 + 259 + 143 + + + + MPlayer Settings + + + + 6 + + + 6 + + + 6 + + + + + Video: + + + + + + + true + + + + + + + Audio: + + + + + + + true + + + + + + + Audio/video auto synchronization + + + true + + + + + + + Synchronization factor: + + + + + + + 0 + + + 999 + + + + + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + buttonBox + accepted() + SettingsDialog + accept() + + + 205 + 136 + + + 20 + 76 + + + + + buttonBox + rejected() + SettingsDialog + reject() + + + 208 + 136 + + + 40 + 81 + + + + + autoSyncCheckBox + toggled(bool) + syncFactorSpinBox + setEnabled(bool) + + + 216 + 67 + + + 237 + 96 + + + + + diff --git a/src/plugins/Engines/mplayer/translations/mplayer_plugin_cs.ts b/src/plugins/Engines/mplayer/translations/mplayer_plugin_cs.ts new file mode 100644 index 000000000..26f09d606 --- /dev/null +++ b/src/plugins/Engines/mplayer/translations/mplayer_plugin_cs.ts @@ -0,0 +1,187 @@ + + + + + DecoderMplayerFactory + + + Mplayer Plugin + Modul MPlayer + + + + Video Files + Videosoubory + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + Autor: Ilja Kotov <forkotov02@hotmail.ru> + + + + About MPlayer Plugin + O modulu MPlayer + + + + Qmmp MPlayer Plugin + Modul Qmmp MPlayer + + + + This plugin uses MPlayer as backend + Tento modul používá jako backend MPlayer + + + + DetailsDialog + + + KB + KB + + + + + + + + + + + + + + + + - + - + + + + Sample rate: + Vzorkovací frekvence: + + + + Close + Zavřít + + + + File path: + Cesta k souboru: + + + + Size: + Velikost: + + + + Demuxer: + Demultiplexor: + + + + Length: + Délka: + + + + Video + Obraz + + + + Resolution: + Rozlišení: + + + + + Bitrate: + Datový tok: + + + + Format: + Formát: + + + + FPS: + FPS: + + + + + Codec: + Kodek: + + + + Aspect ratio: + Poměr stran: + + + + Audio + Zvuk + + + + Channels: + Kanály: + + + + Details + Podrobnosti + + + + General information + Obecné informace + + + + SettingsDialog + + + + + + + + default + výchozí + + + + MPlayer Settings + Nastavení MPlayer + + + + Video: + Video: + + + + Audio: + Audio: + + + + Audio/video auto synchronization + Automatická A/V synchronizace + + + + Synchronization factor: + Synchronizační faktor: + + + diff --git a/src/plugins/Engines/mplayer/translations/mplayer_plugin_de.ts b/src/plugins/Engines/mplayer/translations/mplayer_plugin_de.ts new file mode 100644 index 000000000..2f029c38b --- /dev/null +++ b/src/plugins/Engines/mplayer/translations/mplayer_plugin_de.ts @@ -0,0 +1,187 @@ + + + + + DecoderMplayerFactory + + + Mplayer Plugin + MPlayer-Modul + + + + Video Files + Videodateien + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + Autor: Ilya Kotov <forkotov02@hotmail.ru> + + + + About MPlayer Plugin + Über MPlayer-Modul + + + + Qmmp MPlayer Plugin + Qmmp MPlayer-Modul + + + + This plugin uses MPlayer as backend + Dieses Modul nutzt MPlayer als Backend + + + + DetailsDialog + + + KB + KB + + + + + + + + + + + + + + + + - + - + + + + Sample rate: + Abtastrate: + + + + Close + Schließen + + + + File path: + Dateipfad: + + + + Size: + Größe: + + + + Demuxer: + Demuxer: + + + + Length: + Länge: + + + + Video + Video + + + + Resolution: + Auflösung: + + + + + Bitrate: + Bitrate: + + + + Format: + Format: + + + + FPS: + FPS: + + + + + Codec: + Codec: + + + + Aspect ratio: + Seitenverhältnis: + + + + Audio + Audio + + + + Channels: + Kanäle: + + + + Details + Details + + + + General information + Allgemeine Informationen + + + + SettingsDialog + + + + + + + + default + Standard + + + + MPlayer Settings + Einstellungen MPlayer-Modul + + + + Video: + Video: + + + + Audio: + Audio: + + + + Audio/video auto synchronization + Autom. Audio/Video-Synchronisation + + + + Synchronization factor: + Synchronisationsfaktor: + + + diff --git a/src/plugins/Engines/mplayer/translations/mplayer_plugin_it.ts b/src/plugins/Engines/mplayer/translations/mplayer_plugin_it.ts new file mode 100644 index 000000000..f405e4505 --- /dev/null +++ b/src/plugins/Engines/mplayer/translations/mplayer_plugin_it.ts @@ -0,0 +1,187 @@ + + + + + DecoderMplayerFactory + + + Mplayer Plugin + Modulo MPlayer + + + + Video Files + Documenti video + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + Autore: Ilya Kotov <forkotov02@hotmail.ru> + + + + About MPlayer Plugin + Info sul modulo MPlayer + + + + Qmmp MPlayer Plugin + Modulo MPlayer per Qmmp + + + + This plugin uses MPlayer as backend + Modulo che usa MPlayer come Backend + + + + DetailsDialog + + + KB + KB + + + + + + + + + + + + + + + + - + - + + + + Sample rate: + Campionamento: + + + + Close + Chiudi + + + + File path: + File: + + + + Size: + Dimensione: + + + + Demuxer: + Demuxer: + + + + Length: + Durata: + + + + Video + Video + + + + Resolution: + Risoluzione: + + + + + Bitrate: + Bitrate: + + + + Format: + Formato: + + + + FPS: + FPS: + + + + + Codec: + Codec: + + + + Aspect ratio: + Ratio visualizzazione: + + + + Audio + Audio + + + + Channels: + Canali: + + + + Details + Dettagli + + + + General information + Informazioni generali + + + + SettingsDialog + + + + + + + + default + Default + + + + MPlayer Settings + Impostazioni MPlayer + + + + Video: + Video: + + + + Audio: + Audio: + + + + Audio/video auto synchronization + sincronizzazione audio/video + + + + Synchronization factor: + Fattore di sincronizzazione + + + diff --git a/src/plugins/Engines/mplayer/translations/mplayer_plugin_lt.ts b/src/plugins/Engines/mplayer/translations/mplayer_plugin_lt.ts new file mode 100644 index 000000000..87d1c6b33 --- /dev/null +++ b/src/plugins/Engines/mplayer/translations/mplayer_plugin_lt.ts @@ -0,0 +1,187 @@ + + + + + DecoderMplayerFactory + + + Mplayer Plugin + MPlayer įskiepis + + + + Video Files + Video bylos + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + Sukūrė: Ilya Kotov <forkotov02@hotmail.ru> + + + + About MPlayer Plugin + Apie MPlayer Qmmp įskiepį + + + + Qmmp MPlayer Plugin + Qmmp MPlayer įskiepis + + + + This plugin uses MPlayer as backend + Šis įskiepis naudoja Mplayer video grojimui + + + + DetailsDialog + + + Close + Užverti + + + + + + + + + + + + + + + + - + - + + + + Sample rate: + Sample rate: + + + + File path: + Bylos kelias: + + + + KB + KB + + + + Size: + Dydis: + + + + Demuxer: + Demuxer: + + + + Length: + Ilgis: + + + + Video + Video + + + + Resolution: + Rezoliucija: + + + + + Bitrate: + Bitrate: + + + + Format: + Tipas: + + + + FPS: + FPS: + + + + + Codec: + Kodėkas: + + + + Aspect ratio: + Aspect ratio: + + + + Audio + Аudio + + + + Channels: + Kanalai: + + + + Details + Informacija + + + + General information + Bendra informacija + + + + SettingsDialog + + + + + + + + default + Numatytas + + + + MPlayer Settings + MPlayer nustatymai + + + + Video: + Video: + + + + Audio: + Аudio: + + + + Audio/video auto synchronization + Audio/Video automatinė sinchronizacija + + + + Synchronization factor: + Sinchronizacijos: + + + diff --git a/src/plugins/Engines/mplayer/translations/mplayer_plugin_pl.ts b/src/plugins/Engines/mplayer/translations/mplayer_plugin_pl.ts new file mode 100644 index 000000000..fadc08ecc --- /dev/null +++ b/src/plugins/Engines/mplayer/translations/mplayer_plugin_pl.ts @@ -0,0 +1,187 @@ + + + + + DecoderMplayerFactory + + + Mplayer Plugin + Wtyczka Mplayer + + + + Video Files + Pliki wideo + + + + About MPlayer Plugin + O wtyczce Mplayer + + + + Qmmp MPlayer Plugin + Wtyczka Mplayer dla Qmmp + + + + This plugin uses MPlayer as backend + Ta wtyczka używa Mplayer do odtwarzania + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + Autor: Ilya Kotov <forkotov02@hotmail.ru> + + + + DetailsDialog + + + KB + + + + + Details + Szczegóły + + + + General information + Ogólne informacje + + + + File path: + Ścieżka do pliku: + + + + Size: + Rozmiar: + + + + + + + + + + + + + + + + - + + + + + Demuxer: + Demuxer: + + + + Length: + Długość: + + + + Video + Wideo + + + + Resolution: + Rozdzielczość: + + + + + Bitrate: + + + + + Format: + Format: + + + + FPS: + Klatek na sek.: + + + + + Codec: + Kodek: + + + + Aspect ratio: + Format obrazu: + + + + Audio + Dźwięk + + + + Sample rate: + Próbkowanie: + + + + Channels: + Kanały: + + + + Close + Zamknij + + + + SettingsDialog + + + + + + + + default + domyślne + + + + MPlayer Settings + Ustawienia Mplayer + + + + Video: + Wideo: + + + + Audio: + Dźwięk: + + + + Audio/video auto synchronization + Auto synchronizacja audio/wideo + + + + Synchronization factor: + Współczynnik synchro: + + + diff --git a/src/plugins/Engines/mplayer/translations/mplayer_plugin_ru.ts b/src/plugins/Engines/mplayer/translations/mplayer_plugin_ru.ts new file mode 100644 index 000000000..b4169c849 --- /dev/null +++ b/src/plugins/Engines/mplayer/translations/mplayer_plugin_ru.ts @@ -0,0 +1,187 @@ + + + + + DecoderMplayerFactory + + + Mplayer Plugin + Модуль MPlayer + + + + Video Files + Файлы видео + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + Разработчик: Илья Котов <forkotov02@hotmail.ru> + + + + About MPlayer Plugin + О модуле MPlayer для Qmmp + + + + Qmmp MPlayer Plugin + Модуль поддержки MPlayer для Qmmp + + + + This plugin uses MPlayer as backend + В этом модуле для воспроизведения используется Mplayer + + + + DetailsDialog + + + Close + Закрыть + + + + + + + + + + + + + + + + - + - + + + + Sample rate: + Дискретизация: + + + + File path: + Путь к файлу: + + + + KB + КБ + + + + Size: + Размер: + + + + Demuxer: + Демультиплексор: + + + + Length: + Длительность: + + + + Video + Видео + + + + Resolution: + Разрешение: + + + + + Bitrate: + Битовая частота: + + + + Format: + Формат: + + + + FPS: + Частота кадров: + + + + + Codec: + Кодек: + + + + Aspect ratio: + Соотношение сторон: + + + + Audio + Аудио + + + + Channels: + Каналов: + + + + Details + Информация + + + + General information + Общая информация + + + + SettingsDialog + + + + + + + + default + по умолчанию + + + + MPlayer Settings + Настройки MPlayer + + + + Video: + Видео: + + + + Audio: + Аудио: + + + + Audio/video auto synchronization + Автоматическая синхронизация аудио/видео + + + + Synchronization factor: + Фактор синхронизации: + + + diff --git a/src/plugins/Engines/mplayer/translations/mplayer_plugin_tr.ts b/src/plugins/Engines/mplayer/translations/mplayer_plugin_tr.ts new file mode 100644 index 000000000..f1ba30cb0 --- /dev/null +++ b/src/plugins/Engines/mplayer/translations/mplayer_plugin_tr.ts @@ -0,0 +1,187 @@ + + + + + DecoderMplayerFactory + + + Mplayer Plugin + Mplayer Eklentisi + + + + Video Files + Video Dosyaları + + + + About MPlayer Plugin + MPlayer Eklentisi Hakkında + + + + Qmmp MPlayer Plugin + Qmmp MPlayer Eklentisi + + + + This plugin uses MPlayer as backend + Bu eklenti arka uç olarak MPlayer kullanır + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + Yazan: Ilya Kotov <forkotov02@hotmail.ru> + + + + DetailsDialog + + + KB + KB + + + + Details + Detaylar + + + + General information + Genel Bilgiler + + + + File path: + Dosya konumu: + + + + Size: + Boyut: + + + + + + + + + + + + + + + + - + - + + + + Demuxer: + Çözümleyici: + + + + Length: + Uzunluk: + + + + Video + Video + + + + Resolution: + Çözünürlük: + + + + + Bitrate: + Bit oranı: + + + + Format: + Biçim: + + + + FPS: + FPS: + + + + + Codec: + Kodek: + + + + Aspect ratio: + En-boy oranı: + + + + Audio + Ses + + + + Sample rate: + Örnekleme oranı: + + + + Channels: + Kanallar: + + + + Close + Kapat + + + + SettingsDialog + + + + + + + + default + öntanımlı + + + + MPlayer Settings + MPlayer Ayarları + + + + Video: + Video: + + + + Audio: + Ses: + + + + Audio/video auto synchronization + Ses/video otomatik senkronizasyon + + + + Synchronization factor: + Senkronizasyon faktörü: + + + diff --git a/src/plugins/Engines/mplayer/translations/mplayer_plugin_uk_UA.ts b/src/plugins/Engines/mplayer/translations/mplayer_plugin_uk_UA.ts new file mode 100644 index 000000000..95a95ccb6 --- /dev/null +++ b/src/plugins/Engines/mplayer/translations/mplayer_plugin_uk_UA.ts @@ -0,0 +1,187 @@ + + + + + DecoderMplayerFactory + + + Mplayer Plugin + Модуль Mplayer + + + + Video Files + Відео файли + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + Розробник: Ілля Котов <forkotov02@hotmail.ru> + + + + About MPlayer Plugin + Про модуль Mplayer + + + + Qmmp MPlayer Plugin + Модуль Mplayer для Qmmp + + + + This plugin uses MPlayer as backend + Цей модуль використовує MPlayer як бекенд + + + + DetailsDialog + + + Close + Закрити + + + + + + + + + + + + + + + + - + - + + + + Sample rate: + Дискретизація: + + + + File path: + Шлях до файлу: + + + + KB + Кб + + + + Size: + Розмір: + + + + Demuxer: + Демультиплексор: + + + + Length: + Тривалість: + + + + Video + Відео + + + + Resolution: + Роздільність: + + + + + Bitrate: + Бітрейт: + + + + Format: + Формат: + + + + FPS: + Кадрів в секунду: + + + + + Codec: + Кодек: + + + + Aspect ratio: + Співвідношення: + + + + Audio + Аудіо + + + + Channels: + Канали: + + + + Details + Детально + + + + General information + Головна інформація + + + + SettingsDialog + + + + + + + + default + за умовчанням + + + + MPlayer Settings + Налаштування MPlayer + + + + Video: + Відео: + + + + Audio: + Аудіо: + + + + Audio/video auto synchronization + Автоматична синхронізація аудіо/відео + + + + Synchronization factor: + Фактор синхронізації: + + + diff --git a/src/plugins/Engines/mplayer/translations/mplayer_plugin_zh_CN.ts b/src/plugins/Engines/mplayer/translations/mplayer_plugin_zh_CN.ts new file mode 100644 index 000000000..a20be020d --- /dev/null +++ b/src/plugins/Engines/mplayer/translations/mplayer_plugin_zh_CN.ts @@ -0,0 +1,187 @@ + + + + + DecoderMplayerFactory + + + Mplayer Plugin + Mplayer 插件 + + + + Video Files + 视频文件 + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + 作者:Ilya Kotov <forkotov02@hotmail.ru> + + + + About MPlayer Plugin + 关于 MPlayer 插件 + + + + Qmmp MPlayer Plugin + Qmmp MPlayer 插件 + + + + This plugin uses MPlayer as backend + 此插件使用 MPlayer 后端 + + + + DetailsDialog + + + Close + 关闭 + + + + + + + + + + + + + + + + - + - + + + + Sample rate: + 取样率: + + + + File path: + 文件路径: + + + + KB + KB + + + + Size: + 大小: + + + + Demuxer: + 流分离: + + + + Length: + 长度: + + + + Video + 视频 + + + + Resolution: + 分辨率: + + + + + Bitrate: + 位速率: + + + + Format: + 格式: + + + + FPS: + FPS: + + + + + Codec: + 编解码器: + + + + Aspect ratio: + 宽高比: + + + + Audio + 音频 + + + + Channels: + 声音通道: + + + + Details + 详细资料 + + + + General information + 常规信息 + + + + SettingsDialog + + + + + + + + default + 默认 + + + + MPlayer Settings + Mplayer 设置 + + + + Video: + 视频: + + + + Audio: + 音频: + + + + Audio/video auto synchronization + 音频/视频自动同步 + + + + Synchronization factor: + 同步系数: + + + diff --git a/src/plugins/Engines/mplayer/translations/mplayer_plugin_zh_TW.ts b/src/plugins/Engines/mplayer/translations/mplayer_plugin_zh_TW.ts new file mode 100644 index 000000000..66c75d389 --- /dev/null +++ b/src/plugins/Engines/mplayer/translations/mplayer_plugin_zh_TW.ts @@ -0,0 +1,187 @@ + + + + + DecoderMplayerFactory + + + Mplayer Plugin + Mplayer 插件 + + + + Video Files + 視頻檔案 + + + + Writen by: Ilya Kotov <forkotov02@hotmail.ru> + 作者:Ilya Kotov <forkotov02@hotmail.ru> + + + + About MPlayer Plugin + 關於 Mplayer 插件 + + + + Qmmp MPlayer Plugin + Qmmp Mplayer 插件 + + + + This plugin uses MPlayer as backend + 此插件使用 Mplayer 後端 + + + + DetailsDialog + + + Close + 關閉 + + + + + + + + + + + + + + + + - + - + + + + Sample rate: + 取樣率: + + + + File path: + 檔案路徑: + + + + KB + KB + + + + Size: + 大小: + + + + Demuxer: + 流分離: + + + + Length: + 長度: + + + + Video + 視頻 + + + + Resolution: + 分辨率: + + + + + Bitrate: + 位速率: + + + + Format: + 格式: + + + + FPS: + FPS: + + + + + Codec: + 編解碼器: + + + + Aspect ratio: + 寬高比: + + + + Audio + 聲訊 + + + + Channels: + 音頻通道: + + + + Details + 詳細資料 + + + + General information + 常規資訊 + + + + SettingsDialog + + + + + + + + default + 預設 + + + + MPlayer Settings + Mplayer 設置 + + + + Video: + 視頻: + + + + Audio: + 聲訊: + + + + Audio/video auto synchronization + 音頻/視頻自動同步 + + + + Synchronization factor: + 同步系數: + + + diff --git a/src/plugins/Engines/mplayer/translations/translations.qrc b/src/plugins/Engines/mplayer/translations/translations.qrc new file mode 100644 index 000000000..7a98c5a7f --- /dev/null +++ b/src/plugins/Engines/mplayer/translations/translations.qrc @@ -0,0 +1,15 @@ + + + + mplayer_plugin_it.qm + mplayer_plugin_ru.qm + mplayer_plugin_uk_UA.qm + mplayer_plugin_zh_CN.qm + mplayer_plugin_zh_TW.qm + mplayer_plugin_pl.qm + mplayer_plugin_cs.qm + mplayer_plugin_de.qm + mplayer_plugin_tr.qm + mplayer_plugin_lt.qm + + diff --git a/src/plugins/Input/CMakeLists.txt b/src/plugins/Input/CMakeLists.txt index b6cb405d5..2d2ca0a49 100644 --- a/src/plugins/Input/CMakeLists.txt +++ b/src/plugins/Input/CMakeLists.txt @@ -11,7 +11,6 @@ SET(USE_WAVPACK TRUE CACHE BOOL "enable/disable wavpack plugin") SET(USE_MODPLUG TRUE CACHE BOOL "enable/disable modplug plugin") SET(USE_AAC TRUE CACHE BOOL "enable/disable aac plugin") SET(USE_CUE TRUE CACHE BOOL "enable/disable cue plugin") -#SET(USE_MPLAYER TRUE CACHE BOOL "enable/disable mplayer support") SET(USE_CDA TRUE CACHE BOOL "enable/disable cd audio support") pkg_check_modules(TAGLIB taglib) @@ -56,10 +55,6 @@ IF(USE_CUE) add_subdirectory(cue) ENDIF(USE_CUE) -IF(USE_MPLAYER) -#add_subdirectory(mplayer) -ENDIF(USE_MPLAYER) - IF(USE_CDA) add_subdirectory(cdaudio) ENDIF(USE_CDA) diff --git a/src/plugins/Input/cue/cueparser.cpp b/src/plugins/Input/cue/cueparser.cpp index b6fb8594d..ba4305bfc 100644 --- a/src/plugins/Input/cue/cueparser.cpp +++ b/src/plugins/Input/cue/cueparser.cpp @@ -25,6 +25,7 @@ #include #include +#include #include "cueparser.h" @@ -113,7 +114,7 @@ CUEParser::CUEParser(const QString &fileName) m_infoList[i].setLength(m_infoList[i+1].length() - m_infoList[i].length()); else { - QList f_list = Decoder::createPlayList(m_files[i], FALSE); + QList f_list = MetaDataManager::instance()->createPlayList(m_files[i], FALSE); qint64 l = f_list.isEmpty() ? 0 : f_list.at(0)->length() * 1000; if (l > m_infoList[i].length()) m_infoList[i].setLength(l - m_infoList[i].length()); @@ -123,7 +124,7 @@ CUEParser::CUEParser(const QString &fileName) } //calculate last item length - QList f_list = Decoder::createPlayList(m_filePath, FALSE); + QList f_list = MetaDataManager::instance()->createPlayList(m_filePath, FALSE); qint64 l = f_list.isEmpty() ? 0 : f_list.at(0)->length() * 1000; if (l > m_infoList.last().length()) m_infoList.last().setLength(l - m_infoList.last().length()); diff --git a/src/plugins/Input/flac/cueparser.cpp b/src/plugins/Input/flac/cueparser.cpp index 20bf94ec7..75b538bcf 100644 --- a/src/plugins/Input/flac/cueparser.cpp +++ b/src/plugins/Input/flac/cueparser.cpp @@ -21,7 +21,7 @@ #include #include -#include +#include #include "cueparser.h" @@ -94,7 +94,7 @@ CUEParser::CUEParser(const QByteArray &array, const QString &fileName) for (int i = 0; i < m_infoList.size() - 1; ++i) m_infoList[i].setLength(m_infoList[i+1].length() - m_infoList[i].length()); //calculate last item length - QList f_list = Decoder::createPlayList(m_filePath, FALSE); + QList f_list = MetaDataManager::instance()->createPlayList(m_filePath, FALSE); qint64 l = f_list.isEmpty() ? 0 : f_list.at(0)->length() * 1000; if (l > m_infoList.last().length()) m_infoList.last().setLength(l - m_infoList.last().length()); diff --git a/src/plugins/Input/mplayer/CMakeLists.txt b/src/plugins/Input/mplayer/CMakeLists.txt deleted file mode 100644 index 2b87c27c7..000000000 --- a/src/plugins/Input/mplayer/CMakeLists.txt +++ /dev/null @@ -1,67 +0,0 @@ -project(libmplayer) - -cmake_minimum_required(VERSION 2.4.7) - -if(COMMAND cmake_policy) -cmake_policy(SET CMP0003 NEW) -endif(COMMAND cmake_policy) - - -# qt plugin -ADD_DEFINITIONS( -Wall ) -ADD_DEFINITIONS(${QT_DEFINITIONS}) -ADD_DEFINITIONS(-DQT_PLUGIN) -ADD_DEFINITIONS(-DQT_NO_DEBUG) -ADD_DEFINITIONS(-DQT_SHARED) -ADD_DEFINITIONS(-DQT_THREAD) - -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -SET(QT_INCLUDES - ${QT_INCLUDES} - ${CMAKE_CURRENT_BINARY_DIR}/../../../ -) - -# libqmmp -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../) -link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../../qmmp) - - -SET(libmplayer_SRCS - decoder_mplayer.cpp - decodermplayerfactory.cpp - detailsdialog.cpp - settingsdialog.cpp -) - -SET(libmplayer_MOC_HDRS - decodermplayerfactory.h - decoder_mplayer.h - detailsdialog.h - settingsdialog.h -) - -SET(libmplayer_RCCS translations/translations.qrc) - -QT4_ADD_RESOURCES(libmplayer_RCC_SRCS ${libmplayer_RCCS}) - -QT4_WRAP_CPP(libmplayer_MOC_SRCS ${libmplayer_MOC_HDRS}) - -# user interface - - -SET(libmplayer_UIS - settingsdialog.ui - detailsdialog.ui -) - -QT4_WRAP_UI(libmplayer_UIS_H ${libmplayer_UIS}) -# Don't forget to include output directory, otherwise -# the UI file won't be wrapped! -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -ADD_LIBRARY(mplayer MODULE ${libmplayer_SRCS} ${libmplayer_MOC_SRCS} ${libmplayer_RCC_SRCS} ${libmplayer_UIS_H}) -add_dependencies(mplayer qmmp) -target_link_libraries(mplayer ${QT_LIBRARIES} -lqmmp) -install(TARGETS mplayer DESTINATION ${LIB_DIR}/qmmp/Input) - diff --git a/src/plugins/Input/mplayer/decoder_mplayer.cpp b/src/plugins/Input/mplayer/decoder_mplayer.cpp deleted file mode 100644 index 862bc3c90..000000000 --- a/src/plugins/Input/mplayer/decoder_mplayer.cpp +++ /dev/null @@ -1,221 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008-2009 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 -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "decoder_mplayer.h" - -#define MPLAYER_DEBUG - -static QRegExp rx_av("^[AV]: *([0-9,:.-]+)"); -static QRegExp rx_pause("^(.*)=(.*)PAUSE(.*)"); -static QRegExp rx_end("^(.*)End of file(.*)"); -static QRegExp rx_quit("^(.*)Quit(.*)"); -static QRegExp rx_audio("^AUDIO: *([0-9,.]+) *Hz.*([0-9,.]+) *ch.*([0-9]+).* ([0-9,.]+) *kbit.*"); - - -FileInfo *MplayerInfo::createFileInfo(const QString &path) -{ - QRegExp rx_id_length("^ID_LENGTH=([0-9,.]+)*"); - QStringList args; - args << "-slave"; - args << "-identify"; - args << "-frames"; - args << "0"; - args << "-vo"; - args << "null"; - args << "-ao"; - args << "null"; - args << path; - QProcess mplayer_process; - mplayer_process.start("mplayer", args); - mplayer_process.waitForFinished(); - QString str = QString::fromLocal8Bit(mplayer_process.readAll()).trimmed(); - FileInfo *info = new FileInfo(path); - QStringList lines = str.split("\n"); - foreach(QString line, lines) - { - if (rx_id_length.indexIn(line) > -1) - info->setLength((qint64) rx_id_length.cap(1).toDouble()); - } -#ifdef MPLAYER_DEBUG - qDebug("%s",qPrintable(str)); -#endif - return info; -} - -QStringList MplayerInfo::filters() -{ - QStringList filters; - filters << "*.avi" << "*.mpg" << "*.mpeg" << "*.divx" << "*.qt" << "*.mov" << "*.wmv" << "*.asf" - << "*.flv" << "*.3gp" << "*.mkv"; - return filters; -} - -DecoderMplayer::DecoderMplayer(QObject *parent, DecoderFactory *d, const QString &url) - : Decoder(parent, d) -{ - m_url = url; - m_bitrate = 0; - m_samplerate = 0; - m_channels = 0; - m_bitsPerSample = 0; - m_length = 0; - m_currentTime = 0; - m_process = new QProcess(this); -} - -DecoderMplayer::~DecoderMplayer() -{ - qDebug("%s",__FUNCTION__); - m_process->close(); -} - -bool DecoderMplayer::initialize() -{ - FileInfo *info = MplayerInfo::createFileInfo(m_url); - m_length = info->length(); - delete info; - m_args.clear(); - m_args << "-slave"; - QSettings settings(Qmmp::configFile(), QSettings::IniFormat); - QString ao_str = settings.value("mplayer/ao","default").toString(); - QString vo_str = settings.value("mplayer/vo","default").toString(); - if (ao_str != "default") - m_args << "ao=" + ao_str; - if (vo_str != "default") - m_args << "vo=" + vo_str; - - if (settings.value("autosync", FALSE).toBool()) - m_args << QString("-autosync %1").arg(settings.value("autosync_factor", 100).toInt()); - - m_args << m_url; - connect(m_process, SIGNAL(readyReadStandardOutput()), SLOT(readStdOut())); - return TRUE; -} - -qint64 DecoderMplayer::totalTime() -{ - return m_length * 1000; -} - -void DecoderMplayer::seek(qint64 pos) -{ - if (m_process->state() == QProcess::Running) - m_process->write(QString("seek %1 \n").arg(pos/1000 - m_currentTime).toLocal8Bit ()); -} - -void DecoderMplayer::stop() -{ - if (m_process->state() == QProcess::Running) - { - m_process->write("quit\n"); - m_process->waitForFinished(1500); - } - StateHandler::instance()->dispatch(Qmmp::Stopped); -} - -void DecoderMplayer::pause() -{ - m_process->write("pause\n"); -} - -void DecoderMplayer::setEQ(double bands[10], double preamp) -{ - Q_UNUSED(bands[10]); - Q_UNUSED(preamp); -} - -void DecoderMplayer::setEQEnabled(bool on) -{ - Q_UNUSED(on); -} - -void DecoderMplayer::run() -{ - QMetaObject::invokeMethod(this, "startMplayerProcess"); - StateHandler::instance()->dispatch(Qmmp::Playing); -} - -void DecoderMplayer::readStdOut() -{ - QString line = QString::fromLocal8Bit(m_process->readAll ()).trimmed(); - QStringList lines = line.split("\n"); - foreach(line, lines) - { - if (rx_av.indexIn(line) > -1) - { - StateHandler::instance()->dispatch(Qmmp::Playing); - m_currentTime = (qint64) rx_av.cap(1).toDouble(); - StateHandler::instance()->dispatch(m_currentTime * 1000, - m_bitrate, - m_samplerate, - m_bitsPerSample, - m_channels); - } - else if (rx_pause.indexIn(line) > -1) - { - StateHandler::instance()->dispatch(Qmmp::Paused); - } - else if (rx_end.indexIn(line) > -1) - { - if (m_process->state() == QProcess::Running) - m_process->waitForFinished(1500); - finish(); - } - else if (rx_quit.indexIn(line) > -1) - { - if (m_process->state() == QProcess::Running) - m_process->waitForFinished(1500); - StateHandler::instance()->dispatch(Qmmp::Stopped); - } - else if (rx_audio.indexIn(line) > -1) - { - m_samplerate = rx_audio.cap(1).toInt(); - m_channels = rx_audio.cap(2).toInt(); - m_bitsPerSample = rx_audio.cap(3).toDouble(); - m_bitrate = rx_audio.cap(4).toDouble(); - } -#ifdef MPLAYER_DEBUG - else - qDebug("%s",qPrintable(line)); -#endif - } -} - -void DecoderMplayer::startMplayerProcess() -{ - m_process->start ("mplayer", m_args); -} diff --git a/src/plugins/Input/mplayer/decoder_mplayer.h b/src/plugins/Input/mplayer/decoder_mplayer.h deleted file mode 100644 index 38d47e629..000000000 --- a/src/plugins/Input/mplayer/decoder_mplayer.h +++ /dev/null @@ -1,81 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008-2009 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_MPLAYER_H -#define DECODER_MPLAYER_H - -#include -#include - -class Output; -class QIDevice; -class DecoderPhonon; -class QMenu; -class QProcess; - - -class MplayerInfo -{ -public: - static FileInfo *createFileInfo(const QString &path); - static QStringList filters(); -}; - - - -class DecoderMplayer : public Decoder -{ - Q_OBJECT -public: - DecoderMplayer(QObject *, DecoderFactory *, const QString &url); - virtual ~DecoderMplayer(); - - // Standard Decoder API - bool initialize(); - qint64 totalTime(); - void seek(qint64); - void stop(); - void pause(); - - // Equalizer - void setEQ(double bands[10], double preamp); - void setEQEnabled(bool on); - -private slots: - void readStdOut(); - void startMplayerProcess(); - -private: - // thread run function - void run(); - int mplayer_pipe[2]; - QString m_url; - QStringList m_args; - QProcess *m_process; - int m_bitrate; - int m_samplerate; - int m_channels; - int m_bitsPerSample; - qint64 m_currentTime; - qint64 m_length; -}; - - -#endif // DECODER_MPLAYER_H diff --git a/src/plugins/Input/mplayer/decodermplayerfactory.cpp b/src/plugins/Input/mplayer/decodermplayerfactory.cpp deleted file mode 100644 index 15db7cd34..000000000 --- a/src/plugins/Input/mplayer/decodermplayerfactory.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2008-2009 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 - -#include "detailsdialog.h" -#include "settingsdialog.h" -#include "decoder_mplayer.h" -#include "decodermplayerfactory.h" - - -// DecoderMplayerFactory - -bool DecoderMplayerFactory::supports(const QString &source) const -{ - QStringList filters = MplayerInfo::filters(); - foreach(QString filter, filters) - { - QRegExp regexp(filter, Qt::CaseInsensitive, QRegExp::Wildcard); - if (regexp.exactMatch(source)) - return TRUE; - } - return FALSE; -} - -bool DecoderMplayerFactory::canDecode(QIODevice *) const -{ - return FALSE; -} - -const DecoderProperties DecoderMplayerFactory::properties() const -{ - DecoderProperties properties; - properties.name = tr("Mplayer Plugin"); - properties.shortName = "mplayer"; - properties.filter = MplayerInfo::filters().join(" "); - properties.description = tr("Video Files"); - //properties.contentType = "application/ogg;audio/x-vorbis+ogg"; - properties.protocols = "file"; - properties.hasAbout = TRUE; - properties.hasSettings = TRUE; - properties.noInput = TRUE; - properties.noOutput = TRUE; - return properties; -} - -Decoder *DecoderMplayerFactory::create(QObject *parent, QIODevice *input, - Output *output, const QString &url) -{ - Q_UNUSED(input); - Q_UNUSED(output); - return new DecoderMplayer(parent, this, url); -} - -QList DecoderMplayerFactory::createPlayList(const QString &fileName, bool useMetaData) -{ - Q_UNUSED(useMetaData); - QList info; - info << MplayerInfo::createFileInfo(fileName); - return info; -} - -QObject* DecoderMplayerFactory::showDetails(QWidget *parent, const QString &path) -{ - DetailsDialog *d = new DetailsDialog(path, parent); - d->show(); - return d; -} - -void DecoderMplayerFactory::showSettings(QWidget *parent) -{ - SettingsDialog *s = new SettingsDialog(parent); - s->show(); -} - -void DecoderMplayerFactory::showAbout(QWidget *parent) -{ - QMessageBox::about (parent, tr("About MPlayer Plugin"), - tr("Qmmp MPlayer Plugin")+"\n"+ - tr("This plugin uses MPlayer as backend")+"\n"+ - tr("Writen by: Ilya Kotov ")); -} - -QTranslator *DecoderMplayerFactory::createTranslator(QObject *parent) -{ - QTranslator *translator = new QTranslator(parent); - QString locale = Qmmp::systemLanguageID(); - translator->load(QString(":/mplayer_plugin_") + locale); - return translator; -} - -Q_EXPORT_PLUGIN(DecoderMplayerFactory) diff --git a/src/plugins/Input/mplayer/decodermplayerfactory.h b/src/plugins/Input/mplayer/decodermplayerfactory.h deleted file mode 100644 index a752d5a43..000000000 --- a/src/plugins/Input/mplayer/decodermplayerfactory.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 DECODERMPLAYERFACTORY_H -#define DECODERMPLAYERFACTORY_H - -#include -#include -#include -#include - -#include -#include -#include -#include - -class DecoderMplayerFactory : 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 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/mplayer/detailsdialog.cpp b/src/plugins/Input/mplayer/detailsdialog.cpp deleted file mode 100644 index b541c1162..000000000 --- a/src/plugins/Input/mplayer/detailsdialog.cpp +++ /dev/null @@ -1,107 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 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 -#include -#include - -#include "detailsdialog.h" - -DetailsDialog::DetailsDialog(const QString &path, QWidget *parent) - : QDialog(parent) -{ - ui.setupUi(this); - setAttribute(Qt::WA_DeleteOnClose); - ui.pathLineEdit->setText(path); - ui.sizeLabel->setText(QString("%1 ").arg(QFileInfo(path).size ()/1024)+tr("KB")); - setWindowTitle(QFileInfo(path).fileName()); - //regular expressions - QRegExp rx_id_length("^ID_LENGTH=([0-9,.]+)*"); - QRegExp rx_id_demuxer("^ID_DEMUXER=(.*)"); - QRegExp rx_id_video_bitrate("^ID_VIDEO_BITRATE=([0-9,.]+)*"); - QRegExp rx_id_width("^ID_VIDEO_WIDTH=([0-9,.]+)*"); - QRegExp rx_id_height("^ID_VIDEO_HEIGHT=([0-9,.]+)*"); - QRegExp rx_id_video_format("^ID_VIDEO_FORMAT=(.*)"); - QRegExp rx_id_video_fps("^ID_VIDEO_FPS=([0-9,.]+)*"); - QRegExp rx_id_video_codec("^ID_VIDEO_CODEC=(.*)"); - QRegExp rx_id_video_aspect("^ID_VIDEO_ASPECT=([0-9,.]+)*"); - QRegExp rx_id_audio_bitrate("^ID_AUDIO_BITRATE=([0-9,.]+)*"); - QRegExp rx_id_audio_rate("^ID_AUDIO_RATE=([0-9,.]+)*"); - QRegExp rx_id_audio_nch("^ID_AUDIO_NCH=([0-9,.]+)*"); - QRegExp rx_id_audio_codec("^ID_AUDIO_CODEC=(.*)"); - //prepare and start mplayer process - QStringList args; - args << "-slave"; - args << "-identify"; - args << "-frames"; - args << "0"; - args << "-vo"; - args << "null"; - args << "-ao"; - args << "null"; - args << path; - QProcess mplayer_process; - mplayer_process.start("mplayer", args); - mplayer_process.waitForFinished(); - QString str = QString::fromLocal8Bit(mplayer_process.readAll()).trimmed(); - QStringList lines = str.split("\n"); - int height = 0, width = 0; - //mplayer std output parsing - foreach(QString line, lines) - { - //general info - if (rx_id_length.indexIn(line) > -1) - ui.lengthLabel->setText(rx_id_length.cap(1)); //TODO use hh:mm:ss format - else if (rx_id_demuxer.indexIn(line) > -1) - ui.demuxerLabel->setText(rx_id_demuxer.cap(1)); - //video info - else if (rx_id_video_format.indexIn(line) > -1) - ui.videoFormatLabel->setText(rx_id_video_format.cap(1)); - else if (rx_id_video_fps.indexIn(line) > -1) - ui.fpsLabel->setText(rx_id_video_fps.cap(1)); - else if (rx_id_video_codec.indexIn(line) > -1) - ui.videoCodecLabel->setText(rx_id_video_codec.cap(1)); - else if (rx_id_video_aspect.indexIn(line) > -1) - ui. ratioLabel->setText(rx_id_video_aspect.cap(1)); - else if (rx_id_video_bitrate.indexIn(line) > -1) - ui.videoBitrateLabel->setText(rx_id_video_bitrate.cap(1)); - else if (rx_id_width.indexIn(line) > -1) - width = rx_id_width.cap(1).toInt(); - else if (rx_id_height.indexIn(line) > -1) - height = rx_id_height.cap(1).toInt(); - //audio info - else if (rx_id_audio_codec.indexIn(line) > -1) - ui.audioCodecLabel->setText(rx_id_audio_codec.cap(1)); - else if (rx_id_audio_rate.indexIn(line) > -1) - ui.sampleRateLabel->setText(rx_id_audio_rate.cap(1)); - else if (rx_id_audio_bitrate.indexIn(line) > -1) - ui.audioBitrateLabel->setText(rx_id_audio_bitrate.cap(1)); - else if (rx_id_audio_nch.indexIn(line) > -1) - ui.channelsLabel->setText(rx_id_audio_nch.cap(1)); - } - ui.resolutionLabel->setText(QString("%1x%2").arg(width).arg(height)); -} - - -DetailsDialog::~DetailsDialog() -{ -} - - diff --git a/src/plugins/Input/mplayer/detailsdialog.h b/src/plugins/Input/mplayer/detailsdialog.h deleted file mode 100644 index 0d4af20a7..000000000 --- a/src/plugins/Input/mplayer/detailsdialog.h +++ /dev/null @@ -1,43 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 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 DETAILSDIALOG_H -#define DETAILSDIALOG_H - -#include - -#include "ui_detailsdialog.h" - -/** - @author Ilya Kotov -*/ -class DetailsDialog : public QDialog -{ - Q_OBJECT -public: - DetailsDialog(const QString &path, QWidget *parent = 0); - - ~DetailsDialog(); - -private: - Ui::DetailsDialog ui; - -}; - -#endif diff --git a/src/plugins/Input/mplayer/detailsdialog.ui b/src/plugins/Input/mplayer/detailsdialog.ui deleted file mode 100644 index 37358df2b..000000000 --- a/src/plugins/Input/mplayer/detailsdialog.ui +++ /dev/null @@ -1,390 +0,0 @@ - - DetailsDialog - - - - 0 - 0 - 415 - 351 - - - - Details - - - - 5 - - - 9 - - - 5 - - - 5 - - - - - General information - - - - - - File path: - - - - - - - true - - - - - - - Size: - - - - - - - - - - - - - - - Demuxer: - - - - - - - - - - - - - - - Length: - - - - - - - - - - - - - - - - - - - 0 - 0 - - - - Video - - - - - - - 0 - 0 - - - - Resolution: - - - - - - - - 0 - 0 - - - - - - - - - - - - - 0 - 0 - - - - Bitrate: - - - - - - - - - - - - - - - - 0 - 0 - - - - Format: - - - - - - - - - - - - - - - - 0 - 0 - - - - FPS: - - - - - - - - - - - - - - - - 0 - 0 - - - - Codec: - - - - - - - - - - - - - - - - 0 - 0 - - - - Aspect ratio: - - - - - - - - - - - - - - - - - - Audio - - - - - - - 0 - 0 - - - - Codec: - - - - - - - - 0 - 0 - - - - - - - - - - - - - 0 - 0 - - - - Sample rate: - - - - - - - - - - - - - - - - 0 - 0 - - - - Bitrate: - - - - - - - - - - - - - - - - 0 - 0 - - - - Channels: - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 37 - - - - - - - - - - - 0 - - - - - Qt::Horizontal - - - - 330 - 24 - - - - - - - - Close - - - - - - - - - - - closeButton - clicked() - DetailsDialog - accept() - - - 381 - 334 - - - 23 - 324 - - - - - diff --git a/src/plugins/Input/mplayer/mplayer.pro b/src/plugins/Input/mplayer/mplayer.pro deleted file mode 100644 index 4be7bbd50..000000000 --- a/src/plugins/Input/mplayer/mplayer.pro +++ /dev/null @@ -1,45 +0,0 @@ -include(../../plugins.pri) - -HEADERS += decodermplayerfactory.h \ - decoder_mplayer.h \ - detailsdialog.h \ - settingsdialog.h - -SOURCES += decoder_mplayer.cpp \ - decodermplayerfactory.cpp \ - detailsdialog.cpp \ - settingsdialog.cpp - -TARGET =$$PLUGINS_PREFIX/Input/mplayer -QMAKE_CLEAN =$$PLUGINS_PREFIX/Input/libmplayer.so - -INCLUDEPATH += ../../../ -CONFIG += release \ -warn_on \ -plugin - -TEMPLATE = lib - -QMAKE_LIBDIR += ../../../../lib -LIBS += -lqmmp -L/usr/lib - -TRANSLATIONS = translations/mplayer_plugin_ru.ts \ - translations/mplayer_plugin_uk_UA.ts \ - translations/mplayer_plugin_zh_CN.ts \ - translations/mplayer_plugin_zh_TW.ts \ - translations/mplayer_plugin_cs.ts \ - translations/mplayer_plugin_pl.ts \ - translations/mplayer_plugin_de.ts \ - translations/mplayer_plugin_it.ts \ - translations/mplayer_plugin_tr.ts \ - translations/mplayer_plugin_lt.ts -RESOURCES = translations/translations.qrc - -isEmpty(LIB_DIR){ - LIB_DIR = /lib -} -target.path = $$LIB_DIR/qmmp/Input -INSTALLS += target - -FORMS += detailsdialog.ui \ - settingsdialog.ui diff --git a/src/plugins/Input/mplayer/settingsdialog.cpp b/src/plugins/Input/mplayer/settingsdialog.cpp deleted file mode 100644 index 029890eb1..000000000 --- a/src/plugins/Input/mplayer/settingsdialog.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 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 - -#include - -#include "settingsdialog.h" - -SettingsDialog::SettingsDialog(QWidget *parent) - : QDialog(parent) -{ - ui.setupUi(this); - setAttribute(Qt::WA_DeleteOnClose); - ui.videoComboBox->addItem(tr("default")); - ui.videoComboBox->addItem("xv"); - ui.videoComboBox->addItem("x11"); - ui.videoComboBox->addItem("gl"); - ui.videoComboBox->addItem("gl2"); - ui.videoComboBox->addItem("dga"); - ui.videoComboBox->addItem("sdl"); - ui.videoComboBox->addItem("null"); - ui.audioComboBox->addItem(tr("default")); - ui.audioComboBox->addItem("oss"); - ui.audioComboBox->addItem("alsa"); - ui.audioComboBox->addItem("pulse"); - ui.audioComboBox->addItem("jack"); - ui.audioComboBox->addItem("nas"); - ui.audioComboBox->addItem("null"); - QSettings settings(Qmmp::configFile(), QSettings::IniFormat); - settings.beginGroup("mplayer"); - ui.audioComboBox->setEditText(settings.value("ao","default").toString().replace("default", tr("default"))); - ui.videoComboBox->setEditText(settings.value("vo","default").toString().replace("default", tr("default"))); - ui.autoSyncCheckBox->setChecked(settings.value("autosync", FALSE).toBool()); - ui.syncFactorSpinBox->setValue(settings.value("autosync_factor", 100).toInt()); - settings.endGroup(); -} - - -SettingsDialog::~SettingsDialog() -{} - -void SettingsDialog::accept() -{ - QSettings settings(Qmmp::configFile(), QSettings::IniFormat); - settings.beginGroup("mplayer"); - settings.setValue("ao",ui.audioComboBox->currentText().replace(tr("default"), "default")); - settings.setValue("vo",ui.videoComboBox->currentText().replace(tr("default"), "default")); - settings.setValue("autosync",ui.autoSyncCheckBox->isChecked()); - settings.setValue("autosync_factor",ui.syncFactorSpinBox->value()); - settings.endGroup(); - QDialog::accept(); -} diff --git a/src/plugins/Input/mplayer/settingsdialog.h b/src/plugins/Input/mplayer/settingsdialog.h deleted file mode 100644 index 9ba56bce8..000000000 --- a/src/plugins/Input/mplayer/settingsdialog.h +++ /dev/null @@ -1,46 +0,0 @@ -/*************************************************************************** - * Copyright (C) 2009 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 SETTINGSDIALOG_H -#define SETTINGSDIALOG_H - -#include - -#include "ui_settingsdialog.h" - -/** - @author Ilya Kotov -*/ -class SettingsDialog : public QDialog -{ -Q_OBJECT -public: - SettingsDialog(QWidget *parent = 0); - - ~SettingsDialog(); - - -public slots: - virtual void accept(); - -private: - Ui::SettingsDialog ui; -}; - -#endif diff --git a/src/plugins/Input/mplayer/settingsdialog.ui b/src/plugins/Input/mplayer/settingsdialog.ui deleted file mode 100644 index 86dbfe8f6..000000000 --- a/src/plugins/Input/mplayer/settingsdialog.ui +++ /dev/null @@ -1,141 +0,0 @@ - - - SettingsDialog - - - - 0 - 0 - 259 - 143 - - - - MPlayer Settings - - - - 6 - - - 6 - - - 6 - - - - - Video: - - - - - - - true - - - - - - - Audio: - - - - - - - true - - - - - - - Audio/video auto synchronization - - - true - - - - - - - Synchronization factor: - - - - - - - 0 - - - 999 - - - - - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - - buttonBox - accepted() - SettingsDialog - accept() - - - 205 - 136 - - - 20 - 76 - - - - - buttonBox - rejected() - SettingsDialog - reject() - - - 208 - 136 - - - 40 - 81 - - - - - autoSyncCheckBox - toggled(bool) - syncFactorSpinBox - setEnabled(bool) - - - 216 - 67 - - - 237 - 96 - - - - - diff --git a/src/plugins/Input/mplayer/translations/mplayer_plugin_cs.ts b/src/plugins/Input/mplayer/translations/mplayer_plugin_cs.ts deleted file mode 100644 index 26f09d606..000000000 --- a/src/plugins/Input/mplayer/translations/mplayer_plugin_cs.ts +++ /dev/null @@ -1,187 +0,0 @@ - - - - - DecoderMplayerFactory - - - Mplayer Plugin - Modul MPlayer - - - - Video Files - Videosoubory - - - - Writen by: Ilya Kotov <forkotov02@hotmail.ru> - Autor: Ilja Kotov <forkotov02@hotmail.ru> - - - - About MPlayer Plugin - O modulu MPlayer - - - - Qmmp MPlayer Plugin - Modul Qmmp MPlayer - - - - This plugin uses MPlayer as backend - Tento modul používá jako backend MPlayer - - - - DetailsDialog - - - KB - KB - - - - - - - - - - - - - - - - - - - - - - - Sample rate: - Vzorkovací frekvence: - - - - Close - Zavřít - - - - File path: - Cesta k souboru: - - - - Size: - Velikost: - - - - Demuxer: - Demultiplexor: - - - - Length: - Délka: - - - - Video - Obraz - - - - Resolution: - Rozlišení: - - - - - Bitrate: - Datový tok: - - - - Format: - Formát: - - - - FPS: - FPS: - - - - - Codec: - Kodek: - - - - Aspect ratio: - Poměr stran: - - - - Audio - Zvuk - - - - Channels: - Kanály: - - - - Details - Podrobnosti - - - - General information - Obecné informace - - - - SettingsDialog - - - - - - - - default - výchozí - - - - MPlayer Settings - Nastavení MPlayer - - - - Video: - Video: - - - - Audio: - Audio: - - - - Audio/video auto synchronization - Automatická A/V synchronizace - - - - Synchronization factor: - Synchronizační faktor: - - - diff --git a/src/plugins/Input/mplayer/translations/mplayer_plugin_de.ts b/src/plugins/Input/mplayer/translations/mplayer_plugin_de.ts deleted file mode 100644 index 2f029c38b..000000000 --- a/src/plugins/Input/mplayer/translations/mplayer_plugin_de.ts +++ /dev/null @@ -1,187 +0,0 @@ - - - - - DecoderMplayerFactory - - - Mplayer Plugin - MPlayer-Modul - - - - Video Files - Videodateien - - - - Writen by: Ilya Kotov <forkotov02@hotmail.ru> - Autor: Ilya Kotov <forkotov02@hotmail.ru> - - - - About MPlayer Plugin - Über MPlayer-Modul - - - - Qmmp MPlayer Plugin - Qmmp MPlayer-Modul - - - - This plugin uses MPlayer as backend - Dieses Modul nutzt MPlayer als Backend - - - - DetailsDialog - - - KB - KB - - - - - - - - - - - - - - - - - - - - - - - Sample rate: - Abtastrate: - - - - Close - Schließen - - - - File path: - Dateipfad: - - - - Size: - Größe: - - - - Demuxer: - Demuxer: - - - - Length: - Länge: - - - - Video - Video - - - - Resolution: - Auflösung: - - - - - Bitrate: - Bitrate: - - - - Format: - Format: - - - - FPS: - FPS: - - - - - Codec: - Codec: - - - - Aspect ratio: - Seitenverhältnis: - - - - Audio - Audio - - - - Channels: - Kanäle: - - - - Details - Details - - - - General information - Allgemeine Informationen - - - - SettingsDialog - - - - - - - - default - Standard - - - - MPlayer Settings - Einstellungen MPlayer-Modul - - - - Video: - Video: - - - - Audio: - Audio: - - - - Audio/video auto synchronization - Autom. Audio/Video-Synchronisation - - - - Synchronization factor: - Synchronisationsfaktor: - - - diff --git a/src/plugins/Input/mplayer/translations/mplayer_plugin_it.ts b/src/plugins/Input/mplayer/translations/mplayer_plugin_it.ts deleted file mode 100644 index f405e4505..000000000 --- a/src/plugins/Input/mplayer/translations/mplayer_plugin_it.ts +++ /dev/null @@ -1,187 +0,0 @@ - - - - - DecoderMplayerFactory - - - Mplayer Plugin - Modulo MPlayer - - - - Video Files - Documenti video - - - - Writen by: Ilya Kotov <forkotov02@hotmail.ru> - Autore: Ilya Kotov <forkotov02@hotmail.ru> - - - - About MPlayer Plugin - Info sul modulo MPlayer - - - - Qmmp MPlayer Plugin - Modulo MPlayer per Qmmp - - - - This plugin uses MPlayer as backend - Modulo che usa MPlayer come Backend - - - - DetailsDialog - - - KB - KB - - - - - - - - - - - - - - - - - - - - - - - Sample rate: - Campionamento: - - - - Close - Chiudi - - - - File path: - File: - - - - Size: - Dimensione: - - - - Demuxer: - Demuxer: - - - - Length: - Durata: - - - - Video - Video - - - - Resolution: - Risoluzione: - - - - - Bitrate: - Bitrate: - - - - Format: - Formato: - - - - FPS: - FPS: - - - - - Codec: - Codec: - - - - Aspect ratio: - Ratio visualizzazione: - - - - Audio - Audio - - - - Channels: - Canali: - - - - Details - Dettagli - - - - General information - Informazioni generali - - - - SettingsDialog - - - - - - - - default - Default - - - - MPlayer Settings - Impostazioni MPlayer - - - - Video: - Video: - - - - Audio: - Audio: - - - - Audio/video auto synchronization - sincronizzazione audio/video - - - - Synchronization factor: - Fattore di sincronizzazione - - - diff --git a/src/plugins/Input/mplayer/translations/mplayer_plugin_lt.ts b/src/plugins/Input/mplayer/translations/mplayer_plugin_lt.ts deleted file mode 100644 index 87d1c6b33..000000000 --- a/src/plugins/Input/mplayer/translations/mplayer_plugin_lt.ts +++ /dev/null @@ -1,187 +0,0 @@ - - - - - DecoderMplayerFactory - - - Mplayer Plugin - MPlayer įskiepis - - - - Video Files - Video bylos - - - - Writen by: Ilya Kotov <forkotov02@hotmail.ru> - Sukūrė: Ilya Kotov <forkotov02@hotmail.ru> - - - - About MPlayer Plugin - Apie MPlayer Qmmp įskiepį - - - - Qmmp MPlayer Plugin - Qmmp MPlayer įskiepis - - - - This plugin uses MPlayer as backend - Šis įskiepis naudoja Mplayer video grojimui - - - - DetailsDialog - - - Close - Užverti - - - - - - - - - - - - - - - - - - - - - - - Sample rate: - Sample rate: - - - - File path: - Bylos kelias: - - - - KB - KB - - - - Size: - Dydis: - - - - Demuxer: - Demuxer: - - - - Length: - Ilgis: - - - - Video - Video - - - - Resolution: - Rezoliucija: - - - - - Bitrate: - Bitrate: - - - - Format: - Tipas: - - - - FPS: - FPS: - - - - - Codec: - Kodėkas: - - - - Aspect ratio: - Aspect ratio: - - - - Audio - Аudio - - - - Channels: - Kanalai: - - - - Details - Informacija - - - - General information - Bendra informacija - - - - SettingsDialog - - - - - - - - default - Numatytas - - - - MPlayer Settings - MPlayer nustatymai - - - - Video: - Video: - - - - Audio: - Аudio: - - - - Audio/video auto synchronization - Audio/Video automatinė sinchronizacija - - - - Synchronization factor: - Sinchronizacijos: - - - diff --git a/src/plugins/Input/mplayer/translations/mplayer_plugin_pl.ts b/src/plugins/Input/mplayer/translations/mplayer_plugin_pl.ts deleted file mode 100644 index fadc08ecc..000000000 --- a/src/plugins/Input/mplayer/translations/mplayer_plugin_pl.ts +++ /dev/null @@ -1,187 +0,0 @@ - - - - - DecoderMplayerFactory - - - Mplayer Plugin - Wtyczka Mplayer - - - - Video Files - Pliki wideo - - - - About MPlayer Plugin - O wtyczce Mplayer - - - - Qmmp MPlayer Plugin - Wtyczka Mplayer dla Qmmp - - - - This plugin uses MPlayer as backend - Ta wtyczka używa Mplayer do odtwarzania - - - - Writen by: Ilya Kotov <forkotov02@hotmail.ru> - Autor: Ilya Kotov <forkotov02@hotmail.ru> - - - - DetailsDialog - - - KB - - - - - Details - Szczegóły - - - - General information - Ogólne informacje - - - - File path: - Ścieżka do pliku: - - - - Size: - Rozmiar: - - - - - - - - - - - - - - - - - - - - - - Demuxer: - Demuxer: - - - - Length: - Długość: - - - - Video - Wideo - - - - Resolution: - Rozdzielczość: - - - - - Bitrate: - - - - - Format: - Format: - - - - FPS: - Klatek na sek.: - - - - - Codec: - Kodek: - - - - Aspect ratio: - Format obrazu: - - - - Audio - Dźwięk - - - - Sample rate: - Próbkowanie: - - - - Channels: - Kanały: - - - - Close - Zamknij - - - - SettingsDialog - - - - - - - - default - domyślne - - - - MPlayer Settings - Ustawienia Mplayer - - - - Video: - Wideo: - - - - Audio: - Dźwięk: - - - - Audio/video auto synchronization - Auto synchronizacja audio/wideo - - - - Synchronization factor: - Współczynnik synchro: - - - diff --git a/src/plugins/Input/mplayer/translations/mplayer_plugin_ru.ts b/src/plugins/Input/mplayer/translations/mplayer_plugin_ru.ts deleted file mode 100644 index b4169c849..000000000 --- a/src/plugins/Input/mplayer/translations/mplayer_plugin_ru.ts +++ /dev/null @@ -1,187 +0,0 @@ - - - - - DecoderMplayerFactory - - - Mplayer Plugin - Модуль MPlayer - - - - Video Files - Файлы видео - - - - Writen by: Ilya Kotov <forkotov02@hotmail.ru> - Разработчик: Илья Котов <forkotov02@hotmail.ru> - - - - About MPlayer Plugin - О модуле MPlayer для Qmmp - - - - Qmmp MPlayer Plugin - Модуль поддержки MPlayer для Qmmp - - - - This plugin uses MPlayer as backend - В этом модуле для воспроизведения используется Mplayer - - - - DetailsDialog - - - Close - Закрыть - - - - - - - - - - - - - - - - - - - - - - - Sample rate: - Дискретизация: - - - - File path: - Путь к файлу: - - - - KB - КБ - - - - Size: - Размер: - - - - Demuxer: - Демультиплексор: - - - - Length: - Длительность: - - - - Video - Видео - - - - Resolution: - Разрешение: - - - - - Bitrate: - Битовая частота: - - - - Format: - Формат: - - - - FPS: - Частота кадров: - - - - - Codec: - Кодек: - - - - Aspect ratio: - Соотношение сторон: - - - - Audio - Аудио - - - - Channels: - Каналов: - - - - Details - Информация - - - - General information - Общая информация - - - - SettingsDialog - - - - - - - - default - по умолчанию - - - - MPlayer Settings - Настройки MPlayer - - - - Video: - Видео: - - - - Audio: - Аудио: - - - - Audio/video auto synchronization - Автоматическая синхронизация аудио/видео - - - - Synchronization factor: - Фактор синхронизации: - - - diff --git a/src/plugins/Input/mplayer/translations/mplayer_plugin_tr.ts b/src/plugins/Input/mplayer/translations/mplayer_plugin_tr.ts deleted file mode 100644 index f1ba30cb0..000000000 --- a/src/plugins/Input/mplayer/translations/mplayer_plugin_tr.ts +++ /dev/null @@ -1,187 +0,0 @@ - - - - - DecoderMplayerFactory - - - Mplayer Plugin - Mplayer Eklentisi - - - - Video Files - Video Dosyaları - - - - About MPlayer Plugin - MPlayer Eklentisi Hakkında - - - - Qmmp MPlayer Plugin - Qmmp MPlayer Eklentisi - - - - This plugin uses MPlayer as backend - Bu eklenti arka uç olarak MPlayer kullanır - - - - Writen by: Ilya Kotov <forkotov02@hotmail.ru> - Yazan: Ilya Kotov <forkotov02@hotmail.ru> - - - - DetailsDialog - - - KB - KB - - - - Details - Detaylar - - - - General information - Genel Bilgiler - - - - File path: - Dosya konumu: - - - - Size: - Boyut: - - - - - - - - - - - - - - - - - - - - - - - Demuxer: - Çözümleyici: - - - - Length: - Uzunluk: - - - - Video - Video - - - - Resolution: - Çözünürlük: - - - - - Bitrate: - Bit oranı: - - - - Format: - Biçim: - - - - FPS: - FPS: - - - - - Codec: - Kodek: - - - - Aspect ratio: - En-boy oranı: - - - - Audio - Ses - - - - Sample rate: - Örnekleme oranı: - - - - Channels: - Kanallar: - - - - Close - Kapat - - - - SettingsDialog - - - - - - - - default - öntanımlı - - - - MPlayer Settings - MPlayer Ayarları - - - - Video: - Video: - - - - Audio: - Ses: - - - - Audio/video auto synchronization - Ses/video otomatik senkronizasyon - - - - Synchronization factor: - Senkronizasyon faktörü: - - - diff --git a/src/plugins/Input/mplayer/translations/mplayer_plugin_uk_UA.ts b/src/plugins/Input/mplayer/translations/mplayer_plugin_uk_UA.ts deleted file mode 100644 index 95a95ccb6..000000000 --- a/src/plugins/Input/mplayer/translations/mplayer_plugin_uk_UA.ts +++ /dev/null @@ -1,187 +0,0 @@ - - - - - DecoderMplayerFactory - - - Mplayer Plugin - Модуль Mplayer - - - - Video Files - Відео файли - - - - Writen by: Ilya Kotov <forkotov02@hotmail.ru> - Розробник: Ілля Котов <forkotov02@hotmail.ru> - - - - About MPlayer Plugin - Про модуль Mplayer - - - - Qmmp MPlayer Plugin - Модуль Mplayer для Qmmp - - - - This plugin uses MPlayer as backend - Цей модуль використовує MPlayer як бекенд - - - - DetailsDialog - - - Close - Закрити - - - - - - - - - - - - - - - - - - - - - - - Sample rate: - Дискретизація: - - - - File path: - Шлях до файлу: - - - - KB - Кб - - - - Size: - Розмір: - - - - Demuxer: - Демультиплексор: - - - - Length: - Тривалість: - - - - Video - Відео - - - - Resolution: - Роздільність: - - - - - Bitrate: - Бітрейт: - - - - Format: - Формат: - - - - FPS: - Кадрів в секунду: - - - - - Codec: - Кодек: - - - - Aspect ratio: - Співвідношення: - - - - Audio - Аудіо - - - - Channels: - Канали: - - - - Details - Детально - - - - General information - Головна інформація - - - - SettingsDialog - - - - - - - - default - за умовчанням - - - - MPlayer Settings - Налаштування MPlayer - - - - Video: - Відео: - - - - Audio: - Аудіо: - - - - Audio/video auto synchronization - Автоматична синхронізація аудіо/відео - - - - Synchronization factor: - Фактор синхронізації: - - - diff --git a/src/plugins/Input/mplayer/translations/mplayer_plugin_zh_CN.ts b/src/plugins/Input/mplayer/translations/mplayer_plugin_zh_CN.ts deleted file mode 100644 index a20be020d..000000000 --- a/src/plugins/Input/mplayer/translations/mplayer_plugin_zh_CN.ts +++ /dev/null @@ -1,187 +0,0 @@ - - - - - DecoderMplayerFactory - - - Mplayer Plugin - Mplayer 插件 - - - - Video Files - 视频文件 - - - - Writen by: Ilya Kotov <forkotov02@hotmail.ru> - 作者:Ilya Kotov <forkotov02@hotmail.ru> - - - - About MPlayer Plugin - 关于 MPlayer 插件 - - - - Qmmp MPlayer Plugin - Qmmp MPlayer 插件 - - - - This plugin uses MPlayer as backend - 此插件使用 MPlayer 后端 - - - - DetailsDialog - - - Close - 关闭 - - - - - - - - - - - - - - - - - - - - - - - Sample rate: - 取样率: - - - - File path: - 文件路径: - - - - KB - KB - - - - Size: - 大小: - - - - Demuxer: - 流分离: - - - - Length: - 长度: - - - - Video - 视频 - - - - Resolution: - 分辨率: - - - - - Bitrate: - 位速率: - - - - Format: - 格式: - - - - FPS: - FPS: - - - - - Codec: - 编解码器: - - - - Aspect ratio: - 宽高比: - - - - Audio - 音频 - - - - Channels: - 声音通道: - - - - Details - 详细资料 - - - - General information - 常规信息 - - - - SettingsDialog - - - - - - - - default - 默认 - - - - MPlayer Settings - Mplayer 设置 - - - - Video: - 视频: - - - - Audio: - 音频: - - - - Audio/video auto synchronization - 音频/视频自动同步 - - - - Synchronization factor: - 同步系数: - - - diff --git a/src/plugins/Input/mplayer/translations/mplayer_plugin_zh_TW.ts b/src/plugins/Input/mplayer/translations/mplayer_plugin_zh_TW.ts deleted file mode 100644 index 66c75d389..000000000 --- a/src/plugins/Input/mplayer/translations/mplayer_plugin_zh_TW.ts +++ /dev/null @@ -1,187 +0,0 @@ - - - - - DecoderMplayerFactory - - - Mplayer Plugin - Mplayer 插件 - - - - Video Files - 視頻檔案 - - - - Writen by: Ilya Kotov <forkotov02@hotmail.ru> - 作者:Ilya Kotov <forkotov02@hotmail.ru> - - - - About MPlayer Plugin - 關於 Mplayer 插件 - - - - Qmmp MPlayer Plugin - Qmmp Mplayer 插件 - - - - This plugin uses MPlayer as backend - 此插件使用 Mplayer 後端 - - - - DetailsDialog - - - Close - 關閉 - - - - - - - - - - - - - - - - - - - - - - - Sample rate: - 取樣率: - - - - File path: - 檔案路徑: - - - - KB - KB - - - - Size: - 大小: - - - - Demuxer: - 流分離: - - - - Length: - 長度: - - - - Video - 視頻 - - - - Resolution: - 分辨率: - - - - - Bitrate: - 位速率: - - - - Format: - 格式: - - - - FPS: - FPS: - - - - - Codec: - 編解碼器: - - - - Aspect ratio: - 寬高比: - - - - Audio - 聲訊 - - - - Channels: - 音頻通道: - - - - Details - 詳細資料 - - - - General information - 常規資訊 - - - - SettingsDialog - - - - - - - - default - 預設 - - - - MPlayer Settings - Mplayer 設置 - - - - Video: - 視頻: - - - - Audio: - 聲訊: - - - - Audio/video auto synchronization - 音頻/視頻自動同步 - - - - Synchronization factor: - 同步系數: - - - diff --git a/src/plugins/Input/mplayer/translations/translations.qrc b/src/plugins/Input/mplayer/translations/translations.qrc deleted file mode 100644 index 7a98c5a7f..000000000 --- a/src/plugins/Input/mplayer/translations/translations.qrc +++ /dev/null @@ -1,15 +0,0 @@ - - - - mplayer_plugin_it.qm - mplayer_plugin_ru.qm - mplayer_plugin_uk_UA.qm - mplayer_plugin_zh_CN.qm - mplayer_plugin_zh_TW.qm - mplayer_plugin_pl.qm - mplayer_plugin_cs.qm - mplayer_plugin_de.qm - mplayer_plugin_tr.qm - mplayer_plugin_lt.qm - - diff --git a/src/plugins/Input/wavpack/cueparser.cpp b/src/plugins/Input/wavpack/cueparser.cpp index 41190be4b..cf63e41a1 100644 --- a/src/plugins/Input/wavpack/cueparser.cpp +++ b/src/plugins/Input/wavpack/cueparser.cpp @@ -20,9 +20,7 @@ #include #include - -#include - +#include #include "cueparser.h" CUEParser::CUEParser(const QByteArray &array, const QString &fileName) @@ -94,7 +92,7 @@ CUEParser::CUEParser(const QByteArray &array, const QString &fileName) for (int i = 0; i < m_infoList.size() - 1; ++i) m_infoList[i].setLength(m_infoList[i+1].length() - m_infoList[i].length()); //calculate last item length - QList f_list = Decoder::createPlayList(m_filePath, FALSE); + QList f_list = MetaDataManager::instance()->createPlayList(m_filePath, FALSE); qint64 l = f_list.isEmpty() ? 0 : f_list.at(0)->length() * 1000; if (l > m_infoList.last().length()) m_infoList.last().setLength(l - m_infoList.last().length()); diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index dfa993d89..17c618685 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -2,7 +2,8 @@ SUBDIRS += Input \ Output \ General \ Visual \ - Transports + Transports \ + Engines unix:SUBDIRS += Effect \ PlaylistFormats \ diff --git a/src/qmmp/CMakeLists.txt b/src/qmmp/CMakeLists.txt index 3af5a05c3..5e8b9f767 100644 --- a/src/qmmp/CMakeLists.txt +++ b/src/qmmp/CMakeLists.txt @@ -52,6 +52,7 @@ SET(libqmmp_SRCS inputsource.cpp fileinputsource.cpp emptyinputsource.cpp + metadatamanager.cpp ) SET(libqmmp_MOC_HDRS @@ -81,6 +82,7 @@ SET(libqmmp_MOC_HDRS fileinputsource.h emptyinputsource.h enginefactory.h + metadatamanager.h ) SET(libqmmp_DEVEL_HDRS diff --git a/src/qmmp/abstractengine.cpp b/src/qmmp/abstractengine.cpp index e8c7c309a..6b74ba3f9 100644 --- a/src/qmmp/abstractengine.cpp +++ b/src/qmmp/abstractengine.cpp @@ -95,3 +95,45 @@ QList *AbstractEngine::factories() checkFactories(); return m_factories; } + +EngineFactory *AbstractEngine::findByPath(const QString& source) +{ + checkFactories(); + foreach(EngineFactory *fact, *m_factories) + { + if (fact->supports(source) && isEnabled(fact)) + return fact; + } + return 0; +} + +void AbstractEngine::setEnabled(EngineFactory* factory, bool enable) +{ + checkFactories(); + if (!m_factories->contains(factory)) + return; + + QString name = factory->properties().shortName; + QSettings settings (Qmmp::configFile(), QSettings::IniFormat ); + QStringList disabledList = settings.value("Engine/disabled_plugins").toStringList(); + + if (enable) + disabledList.removeAll(name); + else + { + if (!disabledList.contains(name)) + disabledList << name; + } + settings.setValue("Engine/disabled_plugins", disabledList); +} + +bool AbstractEngine::isEnabled(EngineFactory* factory) +{ + checkFactories(); + if (!m_factories->contains(factory)) + return FALSE; + QString name = factory->properties().shortName; + QSettings settings ( Qmmp::configFile(), QSettings::IniFormat ); + QStringList disabledList = settings.value("Engine/disabled_plugins").toStringList(); + return !disabledList.contains(name); +} diff --git a/src/qmmp/abstractengine.h b/src/qmmp/abstractengine.h index 2f4bc2004..ae0e599dd 100644 --- a/src/qmmp/abstractengine.h +++ b/src/qmmp/abstractengine.h @@ -25,10 +25,11 @@ #include #include #include +#include "enginefactory.h" class QIODevice; class InputSource; -class EngineFactory; + /*! * @author Ilya Kotov @@ -49,6 +50,11 @@ public: * Subclass should reimplement this function. */ virtual qint64 totalTime() = 0; + /*! + * Starts playback. Returns \b true if playback has been started successful, + * otherwise returns \b false. + */ + virtual bool play() = 0; /*! * Requests a seek to the time \b time indicated, specified in milliseconds. */ @@ -83,6 +89,21 @@ public: * Returns a list of decoder factories. */ static QList *factories(); + /*! + * Returns EngineFactory pointer which supports file \b path or 0 if file \b path is unsupported + */ + static EngineFactory *findByPath(const QString &path); + /*! + * Sets whether the engine is enabled. + * @param factory Engine plugin factory. + * @param enable Plugin enable state (\b true - enable, \b false - disable) + */ + static void setEnabled(EngineFactory* factory, bool enable = TRUE); + /*! + * Returns \b true if engine is enabled, otherwise returns \b false + * @param factory Engine plugin factory. + */ + static bool isEnabled(EngineFactory* factory); signals: /*! @@ -90,12 +111,6 @@ signals: */ void playbackFinished(); -protected: - /*! - * The starting point for the decoding thread. - */ - virtual void run() = 0; - private: QMutex m_mutex; QWaitCondition m_waitCondition; diff --git a/src/qmmp/decoder.cpp b/src/qmmp/decoder.cpp index 61d166099..f054fff91 100644 --- a/src/qmmp/decoder.cpp +++ b/src/qmmp/decoder.cpp @@ -225,49 +225,6 @@ bool Decoder::isEnabled(DecoderFactory* factory) return !disabledList.contains(name); } -QList Decoder::createPlayList(const QString &fileName, bool useMetaData) -{ - QList list; - DecoderFactory *fact = 0; - - if (QFile::exists(fileName)) //is it file? - fact = Decoder::findByPath(fileName); - - if (fact) - list << fact->createPlayList(fileName, useMetaData); - else if (QUrl(fileName).scheme() == "http") - list << new FileInfo(fileName); //create empty FileInfo for stream TODO transports support - //append path if it is empty - foreach(FileInfo *info, list) - { - if (info->path().isEmpty()) - info->setPath(fileName); - } - return list; -} - -QStringList Decoder::filters() -{ - checkFactories(); - QStringList filters; - foreach(DecoderFactory *fact, *m_factories) - if (isEnabled(fact) && !fact->properties().filter.isEmpty()) - filters << fact->properties().description + " (" + fact->properties().filter + ")"; - return filters; -} - -QStringList Decoder::nameFilters() -{ - checkFactories(); - QStringList filters; - for (int i=0; isize(); ++i) - { - if (isEnabled(m_factories->at(i))) - filters << m_factories->at(i)->properties().filter.split(" ", QString::SkipEmptyParts); - } - return filters; -} - QList *Decoder::factories() { checkFactories(); diff --git a/src/qmmp/decoder.h b/src/qmmp/decoder.h index 4d16faa6a..485d86479 100644 --- a/src/qmmp/decoder.h +++ b/src/qmmp/decoder.h @@ -87,21 +87,6 @@ public: * Returns DecoderFactory pointer which supports \b url or \b 0 if \b url is not supported. */ static DecoderFactory *findByURL(const QUrl &url); - /*! - * Extracts metadata and audio information from file \b path and returns a list of FileInfo items. - * One file may contain several playlist items (for example: cda disk or flac with embedded cue) - * @param path Source file path. - * @param useMetaData Metadata usage (\b true - use, \b - do not use) - */ - static QList createPlayList(const QString &path, bool useMetaData = TRUE); - /*! - * Returns a list of file name filters with description, i.e. "MPEG Files (*.mp3 *.mpg)" - */ - static QStringList filters(); - /*! - * Returns a list of file name filters, i.e. "*.mp3 *.mpg" - */ - static QStringList nameFilters(); /*! * Returns a list of decoder factories. */ diff --git a/src/qmmp/enginefactory.h b/src/qmmp/enginefactory.h index dc38ac46a..e24c056c0 100644 --- a/src/qmmp/enginefactory.h +++ b/src/qmmp/enginefactory.h @@ -63,6 +63,10 @@ public: * Object destructor. */ virtual ~EngineFactory() {} + /*! + * Returns \b true if plugin supports \b source, otherwise returns \b false + */ + virtual bool supports(const QString &source) const = 0; /*! * Returns general plugin properties. */ diff --git a/src/qmmp/metadatamanager.cpp b/src/qmmp/metadatamanager.cpp new file mode 100644 index 000000000..756fb8b02 --- /dev/null +++ b/src/qmmp/metadatamanager.cpp @@ -0,0 +1,116 @@ +/*************************************************************************** + * Copyright (C) 2009 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 "decoder.h" +#include "decoderfactory.h" +#include "abstractengine.h" +#include "inputsource.h" +#include "metadatamanager.h" + +MetaDataManager* MetaDataManager::m_instance = 0; + +MetaDataManager::MetaDataManager() +{ + if(m_instance) + qFatal("MetaDataManager is already created"); + m_instance = this; + m_decoderFactories = Decoder::factories(); + m_engineFactories = AbstractEngine::factories(); + m_inputSourceFactories = InputSource::factories(); +} + +MetaDataManager::~MetaDataManager() +{ + m_instance = 0; +} + +QList MetaDataManager::createPlayList(const QString &fileName, bool useMetaData) +{ + QList list; + DecoderFactory *fact = 0; + EngineFactory *efact = 0; + + if (!fileName.contains("://")) //local file + { + if((fact = Decoder::findByPath(fileName))) + return fact->createPlayList(fileName, useMetaData); + else if((efact = AbstractEngine::findByPath(fileName))) + return efact->createPlayList(fileName, useMetaData); + return list; + } + else + { + QString p = fileName.section("://",0,0); + QStringList protocols; + foreach(InputSourceFactory *f, *m_inputSourceFactories) + { + protocols << f->properties().protocols.split(" ", QString::SkipEmptyParts); + } + if(protocols.contains(p)) + list << new FileInfo(fileName); + } + + return list; +} + +QStringList MetaDataManager::filters() +{ + QStringList filters; + foreach(DecoderFactory *fact, *m_decoderFactories) + { + if (Decoder::isEnabled(fact) && !fact->properties().filter.isEmpty()) + filters << fact->properties().description + " (" + fact->properties().filter + ")"; + } + foreach(EngineFactory *fact, *m_engineFactories) + { + if (AbstractEngine::isEnabled(fact) && !fact->properties().filter.isEmpty()) + filters << fact->properties().description + " (" + fact->properties().filter + ")"; + } + return filters; +} + +QStringList MetaDataManager::nameFilters() +{ + QStringList filters; + foreach(DecoderFactory *fact, *m_decoderFactories) + { + if (Decoder::isEnabled(fact)) + filters << fact->properties().filter.split(" ", QString::SkipEmptyParts); + } + foreach(EngineFactory *fact, *m_engineFactories) + { + if (AbstractEngine::isEnabled(fact)) + filters << fact->properties().filter.split(" ", QString::SkipEmptyParts); + } + return filters; +} + +MetaDataManager *MetaDataManager::instance() +{ + if(!m_instance) + new MetaDataManager(); + return m_instance; +} + +void MetaDataManager::destroy() +{ + if(m_instance) + delete m_instance; +} diff --git a/src/qmmp/metadatamanager.h b/src/qmmp/metadatamanager.h new file mode 100644 index 000000000..826b71b52 --- /dev/null +++ b/src/qmmp/metadatamanager.h @@ -0,0 +1,67 @@ +/*************************************************************************** + * Copyright (C) 2009 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 METADATAMANAGER_H +#define METADATAMANAGER_H + +#include +#include +#include "fileinfo.h" + +class DecoderFactory; +class EngineFactory; +class InputSourceFactory; +/*! + * @author Ilya Kotov + */ +class MetaDataManager +{ +public: + MetaDataManager(); + ~MetaDataManager(); + /*! + * Extracts metadata and audio information from file \b path and returns a list of FileInfo items. + * One file may contain several playlist items (for example: cda disk or flac with embedded cue) + * @param path Source file path. + * @param useMetaData Metadata usage (\b true - use, \b - do not use) + */ + QList createPlayList(const QString &path, bool useMetaData = TRUE); + /*! + * Returns a list of file name filters with description, i.e. "MPEG Files (*.mp3 *.mpg)" + */ + QStringList filters(); + /*! + * Returns a list of file name filters, i.e. "*.mp3 *.mpg" + */ + QStringList nameFilters(); + /*! + * Returns a pointer to the MetaDataManager instance. + */ + static MetaDataManager* instance(); + static void destroy(); + +private: + QList *m_decoderFactories; + QList *m_engineFactories; + QList *m_inputSourceFactories; + static MetaDataManager* m_instance; +}; + +#endif // METADATAMANAGER_H diff --git a/src/qmmp/qmmp.pro b/src/qmmp/qmmp.pro index 64283c851..a88480b85 100644 --- a/src/qmmp/qmmp.pro +++ b/src/qmmp/qmmp.pro @@ -27,7 +27,8 @@ HEADERS += recycler.h \ fileinputsource.h \ emptyinputsource.h \ inputsourcefactory.h \ - enginefactory.h + enginefactory.h \ + metadatamanager.h SOURCES += recycler.cpp \ decoder.cpp \ output.cpp \ @@ -48,7 +49,8 @@ SOURCES += recycler.cpp \ audioparameters.cpp \ inputsource.cpp \ fileinputsource.cpp \ - emptyinputsource.cpp + emptyinputsource.cpp \ + metadatamanager.cpp FORMS += unix:TARGET = ../../lib/qmmp win32:TARGET = ../../../bin/qmmp diff --git a/src/qmmp/qmmpaudioengine.cpp b/src/qmmp/qmmpaudioengine.cpp index 02f1bb67b..36debe448 100644 --- a/src/qmmp/qmmpaudioengine.cpp +++ b/src/qmmp/qmmpaudioengine.cpp @@ -29,6 +29,7 @@ #include "decoderfactory.h" #include "inputsource.h" #include "qmmpaudioengine.h" +#include "metadatamanager.h" extern "C" @@ -75,6 +76,18 @@ void QmmpAudioEngine::reset() m_next = FALSE; } +bool QmmpAudioEngine::play() +{ + if(isRunning() || m_decoders.isEmpty() || (m_output && m_output->isRunning())) + return FALSE; + if(m_output) + delete m_output; + if(!(m_output = createOutput(m_decoders.head()))) + return FALSE; + start(); + return TRUE; +} + bool QmmpAudioEngine::enqueue(InputSource *source) { mutex()->lock(); @@ -107,11 +120,6 @@ bool QmmpAudioEngine::enqueue(InputSource *source) delete decoder; return FALSE; } - if(!m_output) - { - if(!(m_output = createOutput(decoder))) - return FALSE; - } m_decoders.enqueue(decoder); m_inputs.insert(decoder, source); source->setParent(this); @@ -431,6 +439,7 @@ void QmmpAudioEngine::run() m_next = FALSE; if (m_finish) finish(); + m_output->recycler()->cond()->wakeAll(); mutex()->unlock(); } @@ -481,7 +490,7 @@ void QmmpAudioEngine::sendMetaData() QString url = m_inputs.value(m_decoder)->url(); if (QFile::exists(url)) //send metadata for local files only { - QList list = Decoder::createPlayList(url, TRUE); + QList list = MetaDataManager::instance()->createPlayList(url, TRUE); if (!list.isEmpty()) { StateHandler::instance()->dispatch(list[0]->metaData()); diff --git a/src/qmmp/qmmpaudioengine.h b/src/qmmp/qmmpaudioengine.h index f6bc3432d..e83bda490 100644 --- a/src/qmmp/qmmpaudioengine.h +++ b/src/qmmp/qmmpaudioengine.h @@ -42,6 +42,7 @@ public: QmmpAudioEngine(QObject *parent); ~QmmpAudioEngine(); + bool play(); bool enqueue(InputSource *source); qint64 totalTime(); void seek(qint64 time); diff --git a/src/qmmp/soundcore.cpp b/src/qmmp/soundcore.cpp index 2165202b2..66ec5bfcd 100644 --- a/src/qmmp/soundcore.cpp +++ b/src/qmmp/soundcore.cpp @@ -30,7 +30,8 @@ #include "statehandler.h" #include "inputsource.h" #include "volumecontrol.h" - +#include "enginefactory.h" +#include "metadatamanager.h" #include "soundcore.h" SoundCore *SoundCore::m_instance = 0; @@ -48,6 +49,7 @@ SoundCore::SoundCore(QObject *parent) m_vis = 0; m_parentWidget = 0; m_engine = 0; + m_pendingEngine = 0; for (int i = 1; i < 10; ++i) m_bands[i] = 0; m_handler = new StateHandler(this); @@ -58,6 +60,7 @@ SoundCore::SoundCore(QObject *parent) connect(m_handler, SIGNAL(channelsChanged(int)), SIGNAL(channelsChanged(int))); connect(m_handler, SIGNAL(metaDataChanged ()), SIGNAL(metaDataChanged ())); connect(m_handler, SIGNAL(stateChanged (Qmmp::State)), SIGNAL(stateChanged(Qmmp::State))); + connect(m_handler, SIGNAL(stateChanged (Qmmp::State)), SLOT(startPendingEngine())); connect(m_handler, SIGNAL(aboutToFinish()), SIGNAL(aboutToFinish())); m_volumeControl = VolumeControl::create(this); connect(m_volumeControl, SIGNAL(volumeChanged(int, int)), SIGNAL(volumeChanged(int, int))); @@ -67,12 +70,16 @@ SoundCore::SoundCore(QObject *parent) SoundCore::~SoundCore() { stop(); + MetaDataManager::destroy(); } bool SoundCore::play(const QString &source, bool queue) { if(!queue) + { stop(); + qApp->processEvents(QEventLoop::ExcludeUserInputEvents); + } InputSource *s = InputSource::create(source, this); m_pendingSources.append(s); @@ -92,10 +99,15 @@ void SoundCore::stop() m_source.clear(); if(m_engine) m_engine->stop(); + qDeleteAll(m_pendingSources); + m_pendingSources.clear(); + if(m_pendingEngine) + delete m_pendingEngine; + m_pendingEngine = 0; //update VolumeControl delete m_volumeControl; m_volumeControl = VolumeControl::create(this); - connect(m_volumeControl, SIGNAL(volumeChanged(int, int)), SIGNAL(volumeChanged(int, int))); + connect(m_volumeControl, SIGNAL(volumeChanged(int, int)), SIGNAL(volumeChanged(int, int))); } void SoundCore::pause() @@ -167,8 +179,6 @@ void SoundCore::setSoftwareVolume(bool b) connect(m_volumeControl, SIGNAL(volumeChanged(int, int)), SIGNAL(volumeChanged(int, int))); if (m_engine) m_engine->mutex()->unlock(); - qDeleteAll(m_pendingSources); - m_pendingSources.clear(); } bool SoundCore::softwareVolume() @@ -230,17 +240,70 @@ bool SoundCore::enqueue(InputSource *s) if(m_engine->enqueue(s)) { m_source = s->url(); - m_engine->start(); + if(state() == Qmmp::Stopped) + m_engine->play(); } else { - s->deleteLater(); + //current engine doesn't support this stream, trying to find another + AbstractEngine *engine = new QmmpAudioEngine(this); //internal engine + if(!engine->enqueue(s)) + { + engine->deleteLater(); + engine = 0; + } + + if(!engine) + { + QList factories = *AbstractEngine::factories(); + foreach(EngineFactory *f, *AbstractEngine::factories()) + { + engine = f->create(this); //engine plugin + if(!engine->enqueue(s)) + { + engine->deleteLater(); + engine = 0; + } + } + } + + if(!engine) //unsupported file format + { + s->deleteLater(); + return FALSE; + } + connect(engine, SIGNAL(playbackFinished()), SIGNAL(finished())); + if (m_handler->state() == Qmmp::Playing || m_handler->state() == Qmmp::Paused) + { + if(m_pendingEngine) + m_pendingEngine->deleteLater(); + m_pendingEngine = engine; + } + else + { + m_engine->deleteLater(); + m_engine = engine; + m_engine->play(); + m_pendingEngine = 0; + } return FALSE; } return TRUE; } +void SoundCore::startPendingEngine() +{ + if(state() == Qmmp::Stopped && m_pendingEngine) + { + if(m_engine) + delete m_engine; + m_engine = m_pendingEngine; + m_pendingEngine = 0; + m_engine->play(); + } +} + SoundCore* SoundCore::instance() { return m_instance; diff --git a/src/qmmp/soundcore.h b/src/qmmp/soundcore.h index 538a84f6e..0eb6b1cd3 100644 --- a/src/qmmp/soundcore.h +++ b/src/qmmp/soundcore.h @@ -125,7 +125,7 @@ public slots: void setVolume(int left, int right); /*! * This function plays file or stream with the given path \p source. - * Returns \b true if playback started successful or source is not a local file, + * Returns \b true if playback has been started successful or source is not a local file, * otherwise returns \b false. Useful for invalid files skipping. */ bool play(const QString &source, bool queue = FALSE); @@ -202,6 +202,7 @@ signals: private slots: bool enqueue(InputSource *); + void startPendingEngine(); private: Decoder* m_decoder; @@ -220,6 +221,7 @@ private: StateHandler *m_handler; VolumeControl *m_volumeControl; AbstractEngine *m_engine; + AbstractEngine *m_pendingEngine; QList m_pendingSources; }; diff --git a/src/qmmpui/detailsdialog.cpp b/src/qmmpui/detailsdialog.cpp index e5b0e0fc5..6b5aa7032 100644 --- a/src/qmmpui/detailsdialog.cpp +++ b/src/qmmpui/detailsdialog.cpp @@ -23,10 +23,12 @@ #include #include +#include #include #include #include #include +#include #include "abstractplaylistitem.h" #include "tageditor.h" #include "detailsdialog.h" @@ -46,9 +48,13 @@ DetailsDialog::DetailsDialog(AbstractPlaylistItem *item, QWidget *parent) if(QFile::exists(item->url())) { + //TODO implement this inside MetaDataManager DecoderFactory *fact = Decoder::findByPath(item->url()); + EngineFactory *fact2 = AbstractEngine::findByPath(item->url()); if(fact) m_metaDataModel = fact->createMetaDataModel(item->url(), this); + else if (fact2) + m_metaDataModel = fact2->createMetaDataModel(item->url(), this); else return; @@ -75,7 +81,7 @@ DetailsDialog::~DetailsDialog() void DetailsDialog::printInfo() { - QList flist = Decoder::createPlayList(m_path, TRUE); + QList flist = MetaDataManager::instance()->createPlayList(m_path, TRUE); QMap metaData; if(!flist.isEmpty() && QFile::exists(m_item->url())) metaData = flist.at(0)->metaData(); @@ -105,11 +111,14 @@ void DetailsDialog::printInfo() } QHash ap = m_metaDataModel->audioProperties(); //line - formattedText.append(""); - formattedText.append(""); - formattedText.append("
"); - formattedText.append(""); - formattedText.append(""); + if(formattedText.trimmed() != "") + { + formattedText.append(""); + formattedText.append(""); + formattedText.append(""); + } foreach(QString key, ap.keys()) formattedText += formatRow(key, ap.value(key)); diff --git a/src/qmmpui/fileloader.cpp b/src/qmmpui/fileloader.cpp index ee300e2c4..74c4edc1f 100644 --- a/src/qmmpui/fileloader.cpp +++ b/src/qmmpui/fileloader.cpp @@ -17,8 +17,8 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ -#include +#include #include "fileloader.h" #include "playlistsettings.h" #include "playlistitem.h" @@ -26,7 +26,7 @@ FileLoader::FileLoader(QObject *parent) : QThread(parent),m_files_to_load(),m_directory() { - m_filters = Decoder::nameFilters(); + m_filters = MetaDataManager::instance()->nameFilters(); m_finished = false; } @@ -41,10 +41,10 @@ void FileLoader::addFiles(const QStringList &files) { if (files.isEmpty ()) return; - + bool use_meta = PlaylistSettings::instance()->useMetadata(); foreach(QString s, files) { - QList playList = Decoder::createPlayList(s, PlaylistSettings::instance()->useMetadata()); + QList playList = MetaDataManager::instance()->createPlayList(s, use_meta); foreach(FileInfo *info, playList) emit newPlayListItem(new PlayListItem(info)); if (m_finished) return; @@ -59,11 +59,11 @@ void FileLoader::addDirectory(const QString& s) dir.setFilter(QDir::Files | QDir::Hidden | QDir::NoSymLinks); dir.setSorting(QDir::Name); QFileInfoList l = dir.entryInfoList(m_filters); + bool use_meta = PlaylistSettings::instance()->useMetadata(); for (int i = 0; i < l.size(); ++i) { QFileInfo fileInfo = l.at(i); - playList = Decoder::createPlayList(fileInfo.absoluteFilePath (), - PlaylistSettings::instance()->useMetadata()); + playList = MetaDataManager::instance()->createPlayList(fileInfo.absoluteFilePath (), use_meta); foreach(FileInfo *info, playList) emit newPlayListItem(new PlayListItem(info)); if (m_finished) return; diff --git a/src/qmmpui/mediaplayer.cpp b/src/qmmpui/mediaplayer.cpp index 43038724e..0170fc650 100644 --- a/src/qmmpui/mediaplayer.cpp +++ b/src/qmmpui/mediaplayer.cpp @@ -204,6 +204,7 @@ void MediaPlayer::updateNextUrl() { m_core->play(m_model->nextItem()->url(), TRUE); m_nextUrl = m_model->nextItem()->url(); + qDebug("next url"); } else m_nextUrl.clear(); diff --git a/src/qmmpui/playlistitem.cpp b/src/qmmpui/playlistitem.cpp index d76ba16cc..21bc2fc1a 100644 --- a/src/qmmpui/playlistitem.cpp +++ b/src/qmmpui/playlistitem.cpp @@ -20,7 +20,7 @@ #include #include -#include +#include #include "playlistsettings.h" #include "playlistitem.h" @@ -90,7 +90,7 @@ void PlayListItem::updateTags() delete m_info; m_info = 0; } - QList list = Decoder::createPlayList(url()); + QList list = MetaDataManager::instance()->createPlayList(url()); if(!list.isEmpty() && !list.at(0)->path().contains("://")) { m_info = list.at(0); diff --git a/src/qmmpui/playlistmodel.cpp b/src/qmmpui/playlistmodel.cpp index 3428c0390..cdc407174 100644 --- a/src/qmmpui/playlistmodel.cpp +++ b/src/qmmpui/playlistmodel.cpp @@ -32,7 +32,7 @@ #include -#include +#include #include #include "playlistparser.h" @@ -453,7 +453,8 @@ void PlayListModel::addFile(const QString& path) { if (path.isEmpty()) return; - QList playList = Decoder::createPlayList(path, PlaylistSettings::instance()->useMetadata()); + QList playList = + MetaDataManager::instance()->createPlayList(path, PlaylistSettings::instance()->useMetadata()); foreach(FileInfo *info, playList) emit load(new PlayListItem(info)); @@ -997,7 +998,7 @@ void PlayListModel::clearInvalidItems() foreach(PlayListItem *item, m_items) { if(!item->url().contains("://") && - !(QFile::exists(item->url()) && Decoder::supports(item->url()))) + !(QFile::exists(item->url())))// && Decoder::supports(item->url()))) removeItem(item); } } diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 197ae8745..872c02d09 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -296,8 +297,9 @@ void MainWindow::addDir() void MainWindow::addFile() { QStringList filters; - filters << tr("All Supported Bitstreams")+" (" + Decoder::nameFilters().join (" ") +")"; - filters << Decoder::filters(); + filters << tr("All Supported Bitstreams")+" (" + + MetaDataManager::instance()->nameFilters().join (" ") +")"; + filters << MetaDataManager::instance()->filters(); FileDialog::popup(this, FileDialog::AddDirsFiles, &m_lastDir, m_playListModel, SLOT(addFileList(const QStringList&)), tr("Select one or more files to open"), filters.join(";;")); -- cgit v1.2.3-13-gbd6f
"); + formattedText.append("
"); + formattedText.append("