aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2009-01-05 15:13:35 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2009-01-05 15:13:35 +0000
commit0853e9b69df86182c572eccd671b3097cf348f72 (patch)
tree2df1568a4d84ec75db58dbb996a6d2e6fa7535af
parentecc490d2a4df5fda33034a7fb87b35bf11745dd5 (diff)
downloadqmmp-0853e9b69df86182c572eccd671b3097cf348f72.tar.gz
qmmp-0853e9b69df86182c572eccd671b3097cf348f72.tar.bz2
qmmp-0853e9b69df86182c572eccd671b3097cf348f72.zip
cd audio plugin
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@732 90c681e8-e032-0410-971d-27865f9a5e38
-rw-r--r--CMakeLists.txt1
-rw-r--r--qmmp.pri1
-rw-r--r--src/plugins/Input/CMakeLists.txt5
-rw-r--r--src/plugins/Input/Input.pro7
-rw-r--r--src/plugins/Input/cdaudio/CMakeLists.txt64
-rw-r--r--src/plugins/Input/cdaudio/cdaudio.pro38
-rw-r--r--src/plugins/Input/cdaudio/decoder_cdaudio.cpp392
-rw-r--r--src/plugins/Input/cdaudio/decoder_cdaudio.h80
-rw-r--r--src/plugins/Input/cdaudio/decodercdaudiofactory.cpp101
-rw-r--r--src/plugins/Input/cdaudio/decodercdaudiofactory.h53
-rw-r--r--src/plugins/Input/cdaudio/settingsdialog.cpp62
-rw-r--r--src/plugins/Input/cdaudio/settingsdialog.h47
-rw-r--r--src/plugins/Input/cdaudio/settingsdialog.ui161
-rw-r--r--src/plugins/Input/cdaudio/translations/cdaudio_plugin_cs.ts59
-rw-r--r--src/plugins/Input/cdaudio/translations/cdaudio_plugin_de.ts59
-rw-r--r--src/plugins/Input/cdaudio/translations/cdaudio_plugin_ru.ts59
-rw-r--r--src/plugins/Input/cdaudio/translations/cdaudio_plugin_uk_UA.ts59
-rw-r--r--src/plugins/Input/cdaudio/translations/cdaudio_plugin_zh_CN.ts59
-rw-r--r--src/plugins/Input/cdaudio/translations/cdaudio_plugin_zh_TW.ts59
-rw-r--r--src/plugins/Input/cdaudio/translations/translations.qrc11
-rw-r--r--src/qmmp/decoder.cpp18
-rw-r--r--src/ui/addurldialog.cpp26
22 files changed, 1402 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7cc12f54c..cd64c05fb 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -89,6 +89,7 @@ PRINT_SUMMARY ("WMA support ......................." USE_FFMPEG FFMPEG_FOUND)
PRINT_SUMMARY ("AAC support ......................." USE_AAC FAAD_FOUND)
PRINT_SUMMARY ("CUE sheet support ................." USE_CUE 1)
PRINT_SUMMARY ("Mplayer support...................." USE_MPLAYER 1)
+PRINT_SUMMARY ("CD Audio support..................." USE_CDA CDIO_FOUND)
MESSAGE("")
MESSAGE("Output Plugins:")
diff --git a/qmmp.pri b/qmmp.pri
index ec689fa68..4b5a206b4 100644
--- a/qmmp.pri
+++ b/qmmp.pri
@@ -23,3 +23,4 @@ CONFIG += PULSE_AUDIO_PLUGIN
CONFIG += ALSA_PLUGIN
CONFIG += AAC_PLUGIN
CONFIG += MPLAYER_PLUGIN
+CONFIG += CDAUDIO_PLUGIN
diff --git a/src/plugins/Input/CMakeLists.txt b/src/plugins/Input/CMakeLists.txt
index dd30de45c..af4d85ef0 100644
--- a/src/plugins/Input/CMakeLists.txt
+++ b/src/plugins/Input/CMakeLists.txt
@@ -12,6 +12,7 @@ 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)
@@ -58,3 +59,7 @@ ENDIF(USE_CUE AND TAGLIB_FOUND)
IF(USE_MPLAYER)
add_subdirectory(mplayer)
ENDIF(USE_MPLAYER)
+
+IF(USE_CDA)
+add_subdirectory(cdaudio)
+ENDIF(USE_CDA)
diff --git a/src/plugins/Input/Input.pro b/src/plugins/Input/Input.pro
index 207aa15d8..8235306ea 100644
--- a/src/plugins/Input/Input.pro
+++ b/src/plugins/Input/Input.pro
@@ -44,3 +44,10 @@ contains(CONFIG, MPLAYER_PLUGIN){
message(* Mplayer plugin enabled *)
message(**************************)
}
+
+contains(CONFIG, CDAUDIO_PLUGIN){
+ SUBDIRS += cdaudio
+ message(***************************)
+ message(* CD Audio plugin enabled *)
+ message(***************************)
+}
diff --git a/src/plugins/Input/cdaudio/CMakeLists.txt b/src/plugins/Input/cdaudio/CMakeLists.txt
new file mode 100644
index 000000000..695a9304e
--- /dev/null
+++ b/src/plugins/Input/cdaudio/CMakeLists.txt
@@ -0,0 +1,64 @@
+project(libcdaudio)
+
+cmake_minimum_required(VERSION 2.4.7)
+
+if(COMMAND cmake_policy)
+ cmake_policy(SET CMP0003 NEW)
+ cmake_policy(SET CMP0005 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})
+
+# libqmmp
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../)
+link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../../qmmp)
+
+# libcdaudio
+pkg_check_modules(CDIO libcdio libcdio_cdda libcdio_paranoia)
+
+include_directories(${CDIO_INCLUDE_DIRS})
+link_directories(${CDIO_LIBRARY_DIRS})
+
+SET(libcdaudio_SRCS
+ decoder_cdaudio.cpp
+ decodercdaudiofactory.cpp
+ settingsdialog.cpp
+)
+
+SET(libcdaudio_MOC_HDRS
+ settingsdialog.h
+ decodercdaudiofactory.h
+ decoder_cdaudio.h
+)
+
+SET(libcdaudio_RCCS translations/translations.qrc)
+
+QT4_ADD_RESOURCES(libcdaudio_RCC_SRCS ${libcdaudio_RCCS})
+
+QT4_WRAP_CPP(libcdaudio_MOC_SRCS ${libcdaudio_MOC_HDRS})
+
+# user interface
+
+SET(libcdaudio_UIS
+ settingsdialog.ui
+)
+
+QT4_WRAP_UI(libcdaudio_UIS_H ${libcdaudio_UIS})
+# Don't forget to include output directory, otherwise
+# the UI file won't be wrapped!
+include_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+IF(CDIO_FOUND)
+ADD_LIBRARY(cdaudio SHARED ${libcdaudio_SRCS} ${libcdaudio_MOC_SRCS} ${libcdaudio_UIS_H} ${libcdaudio_RCC_SRCS})
+add_dependencies(cdaudio qmmp)
+target_link_libraries(cdaudio ${QT_LIBRARIES} -lqmmp ${CDIO_LDFLAGS} ${CDIO_CFLAGS})
+install(TARGETS cdaudio DESTINATION ${LIB_DIR}/qmmp/Input)
+ENDIF(CDIO_FOUND)
diff --git a/src/plugins/Input/cdaudio/cdaudio.pro b/src/plugins/Input/cdaudio/cdaudio.pro
new file mode 100644
index 000000000..83d581a43
--- /dev/null
+++ b/src/plugins/Input/cdaudio/cdaudio.pro
@@ -0,0 +1,38 @@
+include(../../plugins.pri)
+
+HEADERS += decodercdaudiofactory.h \
+ decoder_cdaudio.h \
+ settingsdialog.h
+SOURCES += decoder_cdaudio.cpp \
+ decodercdaudiofactory.cpp \
+ settingsdialog.cpp
+
+TARGET =$$PLUGINS_PREFIX/Input/cdaudio
+QMAKE_CLEAN =$$PLUGINS_PREFIX/Input/libcdaudio.so
+
+
+INCLUDEPATH += ../../../
+CONFIG += release \
+warn_on \
+plugin \
+link_pkgconfig
+TEMPLATE = lib
+QMAKE_LIBDIR += ../../../../lib
+LIBS += -lqmmp -L/usr/lib -I/usr/include
+PKGCONFIG += libcdio libcdio_cdda libcdio_paranoia
+TRANSLATIONS = translations/cdaudio_plugin_ru.ts \
+ translations/cdaudio_plugin_uk_UA.ts \
+ translations/cdaudio_plugin_zh_CN.ts \
+ translations/cdaudio_plugin_zh_TW.ts \
+ translations/cdaudio_plugin_cs.ts \
+ translations/cdaudio_plugin_de.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/Input/cdaudio/decoder_cdaudio.cpp b/src/plugins/Input/cdaudio/decoder_cdaudio.cpp
new file mode 100644
index 000000000..5c1792249
--- /dev/null
+++ b/src/plugins/Input/cdaudio/decoder_cdaudio.cpp
@@ -0,0 +1,392 @@
+/***************************************************************************
+ * 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 <QObject>
+#include <QRegExp>
+#include <QSettings>
+
+#include <cdio/cdtext.h>
+#include <cdio/track.h>
+#include <cdio/cdda.h>
+#include <cdio/audio.h>
+#include <cdio/sector.h>
+#include <cdio/cd_types.h>
+#include <cdio/logging.h>
+
+#include <qmmp/constants.h>
+#include <qmmp/buffer.h>
+#include <qmmp/output.h>
+#include <qmmp/recycler.h>
+
+#define CDDA_SECTORS 8
+
+#include "decoder_cdaudio.h"
+
+static void log_handler (cdio_log_level_t level, const char message[])
+{
+ QString str = QString::fromLocal8Bit(message).trimmed();
+ switch (level)
+ {
+ case CDIO_LOG_DEBUG:
+ qDebug("DecoderCDAudio: cdio message: %s (level=debug)", qPrintable(str));
+ case CDIO_LOG_INFO:
+ qDebug("DecoderCDAudio: cdio message: %s (level=info)", qPrintable(str));
+ return;
+ default:
+ qWarning("DecoderCDAudio: cdio message: %s (level=error)", qPrintable(str));
+ }
+}
+
+// Decoder class
+
+DecoderCDAudio::DecoderCDAudio(QObject *parent, DecoderFactory *d, const QString &url, Output *o)
+ : Decoder(parent, d, o)
+{
+ m_inited = FALSE;
+ m_user_stop = FALSE;
+ m_output_buf = 0;
+ m_output_bytes = 0;
+ m_output_at = 0;
+ m_bks = 0;
+ m_done = FALSE;
+ m_finish = FALSE;
+ m_bitrate = 0;
+ m_seekTime = -1.0;
+ m_totalTime = 0.0;
+ m_first_sector = -1;
+ m_last_sector = -1;
+ m_current_sector = -1;
+ m_url = url;
+ m_cdio = 0;
+}
+
+
+DecoderCDAudio::~DecoderCDAudio()
+{
+ deinit();
+ if (m_output_buf)
+ delete [] m_output_buf;
+ m_output_buf = 0;
+}
+
+QList <CDATrack> DecoderCDAudio::generateTrackList()
+{
+ //read settings
+ QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
+ int cd_speed = settings.value("cdaudio/speed", 0).toInt();
+ bool use_cd_text = settings.value("cdaudio/cdtext", TRUE).toBool();
+ QList <CDATrack> tracks;
+ cdio_log_set_handler(log_handler); //setup cdio log handler
+ char **cd_drives = cdio_get_devices_with_cap(0, CDIO_FS_AUDIO, TRUE); //get drive list with CDA disks
+ CdIo_t *cdio = 0;
+ // open first audio capable cd drive
+ if (cd_drives && *cd_drives)
+ {
+ cdio = cdio_open_cd(*cd_drives);
+ if (!cdio)
+ {
+ qWarning("DecoderCDAudio: failed to open CD.");
+ return tracks;
+ }
+ qDebug("DecoderCDAudio: found cd audio capable drive \"%s\"", *cd_drives);
+ }
+ else
+ {
+ qWarning("DecoderCDAudio: unable to find cd audio drive.");
+ return tracks;
+ }
+ if (cd_drives && *cd_drives) //free device list
+ cdio_free_device_list(cd_drives);
+
+ if (cd_speed)
+ {
+ qDebug("DecoderCDAudio: setting drive speed to %dX.", cd_speed);
+ if (cdio_set_speed(cdio, 1) != DRIVER_OP_SUCCESS)
+ qWarning("DecoderCDAudio: unable to set drive speed to %dX.", cd_speed);
+ }
+
+ cdrom_drive_t *pcdrom_drive = cdio_cddap_identify_cdio(cdio, 1, 0); //create paranoya CD-ROM object
+ //get first and last track numbers
+ int first_track_number = cdio_get_first_track_num(pcdrom_drive->p_cdio);
+ int last_track_number = cdio_get_last_track_num(pcdrom_drive->p_cdio);
+
+ if ((first_track_number == CDIO_INVALID_TRACK) || (last_track_number == CDIO_INVALID_TRACK))
+ {
+ qWarning("DecoderCDAudio: invalid first (last) track number.");
+ cdio_destroy(cdio);
+ cdio = 0;
+ return tracks;
+ }
+ //fill track list
+ for (int i = first_track_number; i <= last_track_number; ++i)
+ {
+ CDATrack t;
+ t.first_sector = cdio_get_track_lsn(pcdrom_drive->p_cdio, i);
+ t.last_sector = cdio_get_track_last_lsn(pcdrom_drive->p_cdio, i);
+ t.info.setLength((t.last_sector - t.first_sector +1) / 75);
+ t.info.setMetaData(Qmmp::TRACK, i);
+ t.info.setPath(QString("cdda:///track%1.cda").arg(i, 2, 10, QChar('0')));
+ if ((t.first_sector == CDIO_INVALID_LSN) || (t.last_sector== CDIO_INVALID_LSN))
+ {
+ qWarning("DecoderCDAudio: invalid stard(end) lsn for the track %d.", i);
+ tracks.clear();
+ cdio_destroy(cdio);
+ cdio = 0;
+ return tracks;
+ }
+ //cd text
+ cdtext_t *cdtext = use_cd_text ? cdio_get_cdtext(pcdrom_drive->p_cdio, i) : 0;
+ if (cdtext && cdtext->field[CDTEXT_TITLE])
+ {
+ t.info.setMetaData(Qmmp::TITLE, QString::fromLocal8Bit(cdtext->field[CDTEXT_TITLE]));
+ t.info.setMetaData(Qmmp::ARTIST, QString::fromLocal8Bit(cdtext->field[CDTEXT_PERFORMER]));
+ t.info.setMetaData(Qmmp::GENRE, QString::fromLocal8Bit(cdtext->field[CDTEXT_GENRE]));
+ }
+ else
+ t.info.setMetaData(Qmmp::TITLE, QString("CDA Track %1").arg(i, 2, 10, QChar('0')));
+ tracks << t;
+ }
+ qDebug("DecoderCDAudio: found %d audio tracks", tracks.size());
+ cdio_destroy(cdio);
+ cdio = 0;
+ return tracks;
+}
+
+qint64 DecoderCDAudio::calculateTrackLength(lsn_t startlsn, lsn_t endlsn)
+{
+ return ((endlsn - startlsn + 1) * 1000) / 75;
+}
+
+void DecoderCDAudio::stop()
+{
+ m_user_stop = TRUE;
+}
+
+
+void DecoderCDAudio::flush(bool final)
+{
+ ulong min = final ? 0 : m_bks;
+
+ while ((! m_done && ! m_finish) && m_output_bytes > min)
+ {
+ output()->recycler()->mutex()->lock ();
+
+ while ((! m_done && ! m_finish) && output()->recycler()->full())
+ {
+ mutex()->unlock();
+ output()->recycler()->cond()->wait(output()->recycler()->mutex());
+ mutex()->lock ();
+ m_done = m_user_stop;
+ }
+
+ if (m_user_stop || m_finish)
+ {
+ m_inited = FALSE;
+ m_done = TRUE;
+ }
+ else
+ {
+ m_output_bytes -= produceSound(m_output_buf, m_output_bytes, m_bitrate, 2);
+ m_output_at = m_output_bytes;
+ }
+
+ if (output()->recycler()->full())
+ output()->recycler()->cond()->wakeOne();
+
+ output()->recycler()->mutex()->unlock();
+ }
+}
+
+
+bool DecoderCDAudio::initialize()
+{
+ m_bks = Buffer::size();
+ m_inited = m_user_stop = m_done = m_finish = FALSE;
+ m_bitrate = 0;
+ m_seekTime = -1.0;
+ m_totalTime = 0.0;
+ int track_number = -1;
+ //extract track from url
+ QRegExp rx_cdda("^cdda\\:///track([0-9]+)\\.cda");
+ if (rx_cdda.indexIn(m_url) > -1)
+ track_number = rx_cdda.cap(1).toInt();
+ else
+ {
+ qWarning("DecoderCDAudio: invalid url: %s", qPrintable(m_url));
+ return FALSE;
+ }
+ if (!m_output_buf) //output buffer
+ m_output_buf = new char[globalBufferSize];
+ QList <CDATrack> tracks = DecoderCDAudio::generateTrackList(); //generate track list
+ if (tracks.isEmpty())
+ {
+ qWarning("DecoderCDAudio: initialize failed");
+ return FALSE;
+ }
+ //find track by number
+ int track_at = -1;
+ for (int i = 0; i < tracks.size(); ++i)
+ if (tracks[i].info.metaData(Qmmp::TRACK).toInt() == track_number)
+ {
+ track_at = i;
+ break;
+ }
+ if (track_at < 0)
+ {
+ qWarning("DecoderCDAudio: invalid track number");
+ return FALSE;
+ }
+ char **cd_drives = cdio_get_devices_with_cap(0, CDIO_FS_AUDIO, TRUE); //get drive list with CDA disks
+ // open first audio capable cd drive
+ if (cd_drives && *cd_drives)
+ {
+ m_cdio = cdio_open_cd(*cd_drives);
+ if (!m_cdio)
+ {
+ qWarning("DecoderCDAudio: failed to open CD.");
+ return FALSE;
+ }
+ qDebug("DecoderCDAudio: found cd audio capable drive \"%s\"", *cd_drives);
+ }
+ else
+ {
+ qWarning("DecoderCDAudio: unable to find cd audio drive.");
+ return FALSE;
+ }
+ if (cd_drives && *cd_drives) //free device list
+ cdio_free_device_list(cd_drives);
+
+ configure(44100, 2, 16);
+ m_bitrate = 1411;
+ m_totalTime = tracks[track_at].info.length();
+ m_first_sector = tracks[track_at].first_sector;
+ m_current_sector = tracks[track_at].first_sector;
+ m_last_sector = tracks[track_at].last_sector;
+ m_inited = TRUE;
+ qDebug("DecoderCDAudio: initialize succes");
+ return TRUE;
+}
+
+
+qint64 DecoderCDAudio::lengthInSeconds()
+{
+ if (! m_inited)
+ return 0;
+
+ return m_totalTime;
+}
+
+
+void DecoderCDAudio::seek(qint64 pos)
+{
+ m_seekTime = pos;
+}
+
+
+void DecoderCDAudio::deinit()
+{
+ m_inited = m_user_stop = m_done = m_finish = FALSE;
+ m_bitrate = 0;
+ if (m_cdio)
+ {
+ cdio_destroy(m_cdio);
+ m_cdio = 0;
+ }
+}
+
+void DecoderCDAudio::run()
+{
+ long len = 0;
+ mutex()->lock ();
+ if (!m_inited)
+ {
+ mutex()->unlock();
+ return;
+ }
+ mutex()->unlock();
+
+ while (!m_done && !m_finish)
+ {
+ mutex()->lock ();
+
+ if (m_seekTime >= 0.0)
+ {
+ m_current_sector = m_first_sector + m_seekTime * 75;
+ m_seekTime = -1.0;
+ }
+
+ lsn_t secorts_to_read = qMin(CDDA_SECTORS, (m_last_sector - m_current_sector + 1));
+ if (secorts_to_read <= 0)
+ len = 0;
+ else
+ {
+ if (cdio_read_audio_sectors(m_cdio, m_output_buf + m_output_at,
+ m_current_sector, secorts_to_read) != DRIVER_OP_SUCCESS)
+ len = -1;
+ else
+ {
+ len = secorts_to_read * CDIO_CD_FRAMESIZE_RAW;
+ m_current_sector += secorts_to_read;
+ }
+ }
+ if (len > 0)
+ {
+ m_output_at += len;
+ m_output_bytes += len;
+
+ if (output())
+ flush();
+ }
+ else if (len == 0)
+ {
+ flush(TRUE);
+
+ if (output())
+ {
+ output()->recycler()->mutex()->lock ();
+ // end of stream
+ while (! output()->recycler()->empty() && ! m_user_stop)
+ {
+ output()->recycler()->cond()->wakeOne();
+ mutex()->unlock();
+ output()->recycler()->cond()->wait(output()->recycler()->mutex());
+ mutex()->lock ();
+ }
+ output()->recycler()->mutex()->unlock();
+ }
+ m_done = TRUE;
+ m_finish = !m_user_stop;
+ }
+ else
+ {
+ qWarning("DecoderCDAudio: Error while decoding stream, disk to be corrupted");
+ m_finish = TRUE;
+ }
+ mutex()->unlock();
+ }
+ mutex()->lock ();
+
+ if (m_finish)
+ finish();
+
+ mutex()->unlock();
+ deinit();
+}
diff --git a/src/plugins/Input/cdaudio/decoder_cdaudio.h b/src/plugins/Input/cdaudio/decoder_cdaudio.h
new file mode 100644
index 000000000..b0e4da792
--- /dev/null
+++ b/src/plugins/Input/cdaudio/decoder_cdaudio.h
@@ -0,0 +1,80 @@
+/***************************************************************************
+ * 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 DECODER_CDAUIDO_H
+#define DECODER_CDAUIDO_H
+
+#include <sys/types.h>
+#include <cdio/cdio.h>
+
+#include <qmmp/decoder.h>
+
+class CDATrack
+{
+public:
+ CDATrack()
+ {
+ first_sector = 0;
+ last_sector = 0;
+ }
+
+ FileInfo info;
+ lsn_t first_sector;
+ lsn_t last_sector;
+};
+
+class DecoderCDAudio : public Decoder
+{
+public:
+ DecoderCDAudio(QObject *, DecoderFactory *, const QString &url, Output *);
+ virtual ~DecoderCDAudio();
+
+ static QList <CDATrack> generateTrackList();
+ static qint64 calculateTrackLength(lsn_t startlsn, lsn_t endlsn);
+
+ // Standard Decoder API
+ bool initialize();
+ qint64 lengthInSeconds();
+ void seek(qint64);
+ void stop();
+
+private:
+ // thread run function
+ void run();
+ // helper functions
+ void flush(bool = FALSE);
+ void deinit();
+ // libcdio variables
+ lsn_t m_first_sector;
+ lsn_t m_last_sector;
+ lsn_t m_current_sector;
+ CdIo_t *m_cdio;
+ // output buffer
+ char *m_output_buf;
+ ulong m_output_bytes, m_output_at;
+ //other variables
+ bool m_inited, m_user_stop, m_done, m_finish;
+ QString m_url;
+ unsigned int m_bks;
+ quint64 m_bitrate;
+ qint64 m_totalTime, m_seekTime;
+};
+
+#endif // DECODER_CDAUIDO_H
diff --git a/src/plugins/Input/cdaudio/decodercdaudiofactory.cpp b/src/plugins/Input/cdaudio/decodercdaudiofactory.cpp
new file mode 100644
index 000000000..d46170b49
--- /dev/null
+++ b/src/plugins/Input/cdaudio/decodercdaudiofactory.cpp
@@ -0,0 +1,101 @@
+/***************************************************************************
+ * 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 <QtGui>
+
+#include <cdio/version.h>
+#include "settingsdialog.h"
+#include "decoder_cdaudio.h"
+#include "decodercdaudiofactory.h"
+
+
+// DecoderCDAudioFactory
+
+bool DecoderCDAudioFactory::supports(const QString &source) const
+{
+ return source == "/" || source.endsWith(".cda");
+}
+
+bool DecoderCDAudioFactory::canDecode(QIODevice *) const
+{
+ return FALSE;
+}
+
+const DecoderProperties DecoderCDAudioFactory::properties() const
+{
+ DecoderProperties properties;
+ properties.name = tr("CD Audio Plugin");
+ properties.shortName = "cdaudio";
+ properties.protocols = "cdda";
+ properties.hasAbout = TRUE;
+ properties.noInput = TRUE;
+ properties.hasSettings = TRUE;
+ return properties;
+}
+
+Decoder *DecoderCDAudioFactory::create(QObject *parent, QIODevice *input,
+ Output *output, const QString &url)
+{
+ Q_UNUSED(input);
+ return new DecoderCDAudio(parent, this, url, output);
+}
+
+QList<FileInfo *> DecoderCDAudioFactory::createPlayList(const QString &fileName, bool useMetaData)
+{
+ Q_UNUSED(fileName);
+ Q_UNUSED(useMetaData);
+ QList <FileInfo*> list;
+ QList <CDATrack> tracks = DecoderCDAudio::generateTrackList();
+ foreach(CDATrack t, tracks)
+ list << new FileInfo(t.info);
+ return list;
+}
+
+QObject* DecoderCDAudioFactory::showDetails(QWidget *parent, const QString &path)
+{
+ Q_UNUSED(parent);
+ Q_UNUSED(path);
+ return 0;
+}
+
+void DecoderCDAudioFactory::showSettings(QWidget *parent)
+{
+ SettingsDialog *d = new SettingsDialog(parent);
+ d->show();
+}
+
+void DecoderCDAudioFactory::showAbout(QWidget *parent)
+{
+ QMessageBox::about (parent, tr("About CD Audio Plugin"),
+ tr("Qmmp CD Audio Plugin")+"\n"+
+ tr("Compiled against libcdio-")+CDIO_VERSION+"\n"+
+ tr("Writen by: Ilya Kotov <forkotov02@hotmail.ru>")+"\n"+
+ tr("Usage: open cdda:/// using Add URL dialog or command line"));
+}
+
+QTranslator *DecoderCDAudioFactory::createTranslator(QObject *parent)
+{
+ QTranslator *translator = new QTranslator(parent);
+ QString locale = QLocale::system().name();
+ translator->load(QString(":/cdaudio_plugin_") + locale);
+ return translator;
+}
+
+Q_EXPORT_PLUGIN(DecoderCDAudioFactory)
diff --git a/src/plugins/Input/cdaudio/decodercdaudiofactory.h b/src/plugins/Input/cdaudio/decodercdaudiofactory.h
new file mode 100644
index 000000000..bc4cce48d
--- /dev/null
+++ b/src/plugins/Input/cdaudio/decodercdaudiofactory.h
@@ -0,0 +1,53 @@
+/***************************************************************************
+ * 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 DECODERCDAUDIOFACTORY_H
+#define DECODERCDAUDIOFACTORY_H
+
+#include <QObject>
+#include <QString>
+#include <QIODevice>
+#include <QWidget>
+
+#include <qmmp/decoder.h>
+#include <qmmp/output.h>
+#include <qmmp/decoderfactory.h>
+#include <qmmp/fileinfo.h>
+
+
+
+
+class DecoderCDAudioFactory : public QObject, DecoderFactory
+{
+ Q_OBJECT
+ Q_INTERFACES(DecoderFactory);
+
+public:
+ bool supports(const QString &source) const;
+ bool canDecode(QIODevice *input) const;
+ const DecoderProperties properties() const;
+ Decoder *create(QObject *, QIODevice *, Output *, const QString &);
+ QList<FileInfo *> createPlayList(const QString &fileName, bool useMetaData);
+ QObject* showDetails(QWidget *parent, const QString &path);
+ void showSettings(QWidget *parent);
+ void showAbout(QWidget *parent);
+ QTranslator *createTranslator(QObject *parent);
+};
+
+#endif
diff --git a/src/plugins/Input/cdaudio/settingsdialog.cpp b/src/plugins/Input/cdaudio/settingsdialog.cpp
new file mode 100644
index 000000000..dcafbeed4
--- /dev/null
+++ b/src/plugins/Input/cdaudio/settingsdialog.cpp
@@ -0,0 +1,62 @@
+/***************************************************************************
+ * 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 <QTextCodec>
+#include <QSettings>
+
+#include <qmmp/qmmp.h>
+
+#include "settingsdialog.h"
+
+SettingsDialog::SettingsDialog(QWidget *parent)
+ : QDialog(parent)
+{
+ ui.setupUi(this);
+ setAttribute(Qt::WA_DeleteOnClose);
+ QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
+ settings.beginGroup("cdaudio");
+ ui.deviceLineEdit->setText(settings.value("device").toString());
+ ui.deviceCheckBox->setChecked(!ui.deviceLineEdit->text().isEmpty());
+ int speed = settings.value("speed", 0).toInt();
+ ui.speedCheckBox->setChecked(speed > 0);
+ ui.speedSpinBox->setValue(speed);
+ ui.cdtextCheckBox->setChecked(settings.value("cdtext", TRUE).toBool());
+ settings.endGroup();
+}
+
+
+SettingsDialog::~SettingsDialog()
+{}
+
+void SettingsDialog::accept()
+{
+ QSettings settings(Qmmp::configFile(), QSettings::IniFormat);
+ settings.beginGroup("cdaudio");
+ if(ui.deviceCheckBox->isChecked())
+ settings.setValue("device", ui.deviceLineEdit->text());
+ else
+ settings.remove("device");
+ if(ui.speedCheckBox->isChecked())
+ settings.setValue("speed", ui.speedSpinBox->value());
+ else
+ settings.setValue("speed", 0);
+ settings.setValue("cdtext", ui.cdtextCheckBox->isChecked());
+ settings.endGroup();
+ QDialog::accept();
+}
diff --git a/src/plugins/Input/cdaudio/settingsdialog.h b/src/plugins/Input/cdaudio/settingsdialog.h
new file mode 100644
index 000000000..df030cc1d
--- /dev/null
+++ b/src/plugins/Input/cdaudio/settingsdialog.h
@@ -0,0 +1,47 @@
+/***************************************************************************
+ * 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 <QDialog>
+
+#include "ui_settingsdialog.h"
+
+/**
+ @author Ilya Kotov <forkotov02@hotmail.ru>
+*/
+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/cdaudio/settingsdialog.ui b/src/plugins/Input/cdaudio/settingsdialog.ui
new file mode 100644
index 000000000..811657420
--- /dev/null
+++ b/src/plugins/Input/cdaudio/settingsdialog.ui
@@ -0,0 +1,161 @@
+<ui version="4.0" >
+ <class>SettingsDialog</class>
+ <widget class="QDialog" name="SettingsDialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>261</width>
+ <height>128</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>CD Audio Plugin Settings</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout" >
+ <property name="leftMargin" >
+ <number>6</number>
+ </property>
+ <property name="topMargin" >
+ <number>9</number>
+ </property>
+ <property name="rightMargin" >
+ <number>6</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>6</number>
+ </property>
+ <item row="0" column="0" >
+ <widget class="QCheckBox" name="deviceCheckBox" >
+ <property name="text" >
+ <string>Override device:</string>
+ </property>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QLineEdit" name="deviceLineEdit" />
+ </item>
+ <item row="1" column="0" >
+ <widget class="QCheckBox" name="speedCheckBox" >
+ <property name="text" >
+ <string>Limid cd speed:</string>
+ </property>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QSpinBox" name="speedSpinBox" >
+ <property name="minimum" >
+ <number>1</number>
+ </property>
+ <property name="maximum" >
+ <number>48</number>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QCheckBox" name="cdtextCheckBox" >
+ <property name="text" >
+ <string>Use cd-text</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="2" >
+ <layout class="QHBoxLayout" name="horizontalLayout" >
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>144</width>
+ <height>30</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox" >
+ <property name="standardButtons" >
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>SettingsDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>253</x>
+ <y>118</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>95</x>
+ <y>53</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>SettingsDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>253</x>
+ <y>118</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>130</x>
+ <y>63</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>deviceCheckBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>deviceLineEdit</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>84</x>
+ <y>17</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>151</x>
+ <y>17</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>speedCheckBox</sender>
+ <signal>toggled(bool)</signal>
+ <receiver>speedSpinBox</receiver>
+ <slot>setEnabled(bool)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>99</x>
+ <y>42</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>134</x>
+ <y>45</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/src/plugins/Input/cdaudio/translations/cdaudio_plugin_cs.ts b/src/plugins/Input/cdaudio/translations/cdaudio_plugin_cs.ts
new file mode 100644
index 000000000..d73956450
--- /dev/null
+++ b/src/plugins/Input/cdaudio/translations/cdaudio_plugin_cs.ts
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS><TS version="1.1">
+<context>
+ <name>DecoderCDAudioFactory</name>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="45"/>
+ <source>CD Audio Plugin</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="87"/>
+ <source>About CD Audio Plugin</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="88"/>
+ <source>Qmmp CD Audio Plugin</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="89"/>
+ <source>Compiled against libcdio-</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="90"/>
+ <source>Writen by: Ilya Kotov &lt;forkotov02@hotmail.ru&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="91"/>
+ <source>Usage: open cdda:/// using Add URL dialog or command line</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>SettingsDialog</name>
+ <message>
+ <location filename="../settingsdialog.ui" line="13"/>
+ <source>CD Audio Plugin Settings</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../settingsdialog.ui" line="31"/>
+ <source>Override device:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../settingsdialog.ui" line="44"/>
+ <source>Limid cd speed:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../settingsdialog.ui" line="64"/>
+ <source>Use cd-text</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/src/plugins/Input/cdaudio/translations/cdaudio_plugin_de.ts b/src/plugins/Input/cdaudio/translations/cdaudio_plugin_de.ts
new file mode 100644
index 000000000..d73956450
--- /dev/null
+++ b/src/plugins/Input/cdaudio/translations/cdaudio_plugin_de.ts
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS><TS version="1.1">
+<context>
+ <name>DecoderCDAudioFactory</name>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="45"/>
+ <source>CD Audio Plugin</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="87"/>
+ <source>About CD Audio Plugin</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="88"/>
+ <source>Qmmp CD Audio Plugin</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="89"/>
+ <source>Compiled against libcdio-</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="90"/>
+ <source>Writen by: Ilya Kotov &lt;forkotov02@hotmail.ru&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="91"/>
+ <source>Usage: open cdda:/// using Add URL dialog or command line</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>SettingsDialog</name>
+ <message>
+ <location filename="../settingsdialog.ui" line="13"/>
+ <source>CD Audio Plugin Settings</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../settingsdialog.ui" line="31"/>
+ <source>Override device:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../settingsdialog.ui" line="44"/>
+ <source>Limid cd speed:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../settingsdialog.ui" line="64"/>
+ <source>Use cd-text</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/src/plugins/Input/cdaudio/translations/cdaudio_plugin_ru.ts b/src/plugins/Input/cdaudio/translations/cdaudio_plugin_ru.ts
new file mode 100644
index 000000000..d73956450
--- /dev/null
+++ b/src/plugins/Input/cdaudio/translations/cdaudio_plugin_ru.ts
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS><TS version="1.1">
+<context>
+ <name>DecoderCDAudioFactory</name>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="45"/>
+ <source>CD Audio Plugin</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="87"/>
+ <source>About CD Audio Plugin</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="88"/>
+ <source>Qmmp CD Audio Plugin</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="89"/>
+ <source>Compiled against libcdio-</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="90"/>
+ <source>Writen by: Ilya Kotov &lt;forkotov02@hotmail.ru&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="91"/>
+ <source>Usage: open cdda:/// using Add URL dialog or command line</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>SettingsDialog</name>
+ <message>
+ <location filename="../settingsdialog.ui" line="13"/>
+ <source>CD Audio Plugin Settings</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../settingsdialog.ui" line="31"/>
+ <source>Override device:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../settingsdialog.ui" line="44"/>
+ <source>Limid cd speed:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../settingsdialog.ui" line="64"/>
+ <source>Use cd-text</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/src/plugins/Input/cdaudio/translations/cdaudio_plugin_uk_UA.ts b/src/plugins/Input/cdaudio/translations/cdaudio_plugin_uk_UA.ts
new file mode 100644
index 000000000..d73956450
--- /dev/null
+++ b/src/plugins/Input/cdaudio/translations/cdaudio_plugin_uk_UA.ts
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS><TS version="1.1">
+<context>
+ <name>DecoderCDAudioFactory</name>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="45"/>
+ <source>CD Audio Plugin</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="87"/>
+ <source>About CD Audio Plugin</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="88"/>
+ <source>Qmmp CD Audio Plugin</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="89"/>
+ <source>Compiled against libcdio-</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="90"/>
+ <source>Writen by: Ilya Kotov &lt;forkotov02@hotmail.ru&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="91"/>
+ <source>Usage: open cdda:/// using Add URL dialog or command line</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>SettingsDialog</name>
+ <message>
+ <location filename="../settingsdialog.ui" line="13"/>
+ <source>CD Audio Plugin Settings</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../settingsdialog.ui" line="31"/>
+ <source>Override device:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../settingsdialog.ui" line="44"/>
+ <source>Limid cd speed:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../settingsdialog.ui" line="64"/>
+ <source>Use cd-text</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/src/plugins/Input/cdaudio/translations/cdaudio_plugin_zh_CN.ts b/src/plugins/Input/cdaudio/translations/cdaudio_plugin_zh_CN.ts
new file mode 100644
index 000000000..d73956450
--- /dev/null
+++ b/src/plugins/Input/cdaudio/translations/cdaudio_plugin_zh_CN.ts
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS><TS version="1.1">
+<context>
+ <name>DecoderCDAudioFactory</name>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="45"/>
+ <source>CD Audio Plugin</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="87"/>
+ <source>About CD Audio Plugin</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="88"/>
+ <source>Qmmp CD Audio Plugin</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="89"/>
+ <source>Compiled against libcdio-</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="90"/>
+ <source>Writen by: Ilya Kotov &lt;forkotov02@hotmail.ru&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="91"/>
+ <source>Usage: open cdda:/// using Add URL dialog or command line</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>SettingsDialog</name>
+ <message>
+ <location filename="../settingsdialog.ui" line="13"/>
+ <source>CD Audio Plugin Settings</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../settingsdialog.ui" line="31"/>
+ <source>Override device:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../settingsdialog.ui" line="44"/>
+ <source>Limid cd speed:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../settingsdialog.ui" line="64"/>
+ <source>Use cd-text</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/src/plugins/Input/cdaudio/translations/cdaudio_plugin_zh_TW.ts b/src/plugins/Input/cdaudio/translations/cdaudio_plugin_zh_TW.ts
new file mode 100644
index 000000000..d73956450
--- /dev/null
+++ b/src/plugins/Input/cdaudio/translations/cdaudio_plugin_zh_TW.ts
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS><TS version="1.1">
+<context>
+ <name>DecoderCDAudioFactory</name>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="45"/>
+ <source>CD Audio Plugin</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="87"/>
+ <source>About CD Audio Plugin</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="88"/>
+ <source>Qmmp CD Audio Plugin</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="89"/>
+ <source>Compiled against libcdio-</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="90"/>
+ <source>Writen by: Ilya Kotov &lt;forkotov02@hotmail.ru&gt;</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../decodercdaudiofactory.cpp" line="91"/>
+ <source>Usage: open cdda:/// using Add URL dialog or command line</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>SettingsDialog</name>
+ <message>
+ <location filename="../settingsdialog.ui" line="13"/>
+ <source>CD Audio Plugin Settings</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../settingsdialog.ui" line="31"/>
+ <source>Override device:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../settingsdialog.ui" line="44"/>
+ <source>Limid cd speed:</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <location filename="../settingsdialog.ui" line="64"/>
+ <source>Use cd-text</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+</TS>
diff --git a/src/plugins/Input/cdaudio/translations/translations.qrc b/src/plugins/Input/cdaudio/translations/translations.qrc
new file mode 100644
index 000000000..8e2dc0484
--- /dev/null
+++ b/src/plugins/Input/cdaudio/translations/translations.qrc
@@ -0,0 +1,11 @@
+<!DOCTYPE RCC>
+<RCC version="1.0">
+ <qresource>
+ <file>cdaudio_plugin_ru.qm</file>
+ <file>cdaudio_plugin_uk_UA.qm</file>
+ <file>cdaudio_plugin_zh_CN.qm</file>
+ <file>cdaudio_plugin_zh_TW.qm</file>
+ <file>cdaudio_plugin_cs.qm</file>
+ <file>cdaudio_plugin_de.qm</file>
+ </qresource>
+</RCC>
diff --git a/src/qmmp/decoder.cpp b/src/qmmp/decoder.cpp
index 84c23f2e5..d3706590e 100644
--- a/src/qmmp/decoder.cpp
+++ b/src/qmmp/decoder.cpp
@@ -414,15 +414,17 @@ bool Decoder::isEnabled(DecoderFactory* factory)
QList <FileInfo *> Decoder::createPlayList(const QString &fileName, bool useMetaData)
{
QList <FileInfo *> list;
+ DecoderFactory *fact = 0;
+
if (QFile::exists(fileName)) //is it file?
- {
- DecoderFactory *fact = Decoder::findByPath(fileName);
- if (fact)
- list << fact->createPlayList(fileName, useMetaData);
- }
- else
- //TODO do this according supported protocols
- list << new FileInfo(fileName); //create empty FileInfo for stream
+ fact = Decoder::findByPath(fileName);
+ else if (fileName.contains("://")) //looks like url
+ fact = Decoder::findByURL(QUrl(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)
{
diff --git a/src/ui/addurldialog.cpp b/src/ui/addurldialog.cpp
index 61ba12eb5..38aa3cab3 100644
--- a/src/ui/addurldialog.cpp
+++ b/src/ui/addurldialog.cpp
@@ -86,21 +86,25 @@ void AddUrlDialog::accept( )
if (!urlComboBox->currentText().isEmpty())
{
QString s = urlComboBox->currentText();
- if (!s.startsWith("http://"))
+ if (!s.startsWith("http://") && !s.contains("://"))
s.prepend("http://");
m_history.removeAll(s);
m_history.prepend(s);
- PlaylistFormat* prs = PlaylistParser::instance()->findByPath(s);
- if (prs)
- {
- //download playlist;
- QUrl url(s);
- m_http->setHost(url.host(), url.port(80));
- m_http->get(url.path());
- addButton->setEnabled(FALSE);
- return;
+
+ if (s.startsWith("http://"))
+ { //try to download playlist
+ PlaylistFormat* prs = PlaylistParser::instance()->findByPath(s);
+ if (prs)
+ {
+ //download playlist;
+ QUrl url(s);
+ m_http->setHost(url.host(), url.port(80));
+ m_http->get(url.path());
+ addButton->setEnabled(FALSE);
+ return;
+ }
}
- m_model->addFile(s);
+ m_model->addFile(s); //TODO fix interface freezes
}
QDialog::accept();
}