diff options
Diffstat (limited to 'src/plugins/Input/mpc')
| -rw-r--r-- | src/plugins/Input/mpc/CMakeLists.txt | 86 | ||||
| -rw-r--r-- | src/plugins/Input/mpc/Makefile | 254 | ||||
| -rw-r--r-- | src/plugins/Input/mpc/decoder_mpc.cpp | 386 | ||||
| -rw-r--r-- | src/plugins/Input/mpc/decoder_mpc.h | 80 | ||||
| -rw-r--r-- | src/plugins/Input/mpc/decodermpcfactory.cpp | 95 | ||||
| -rw-r--r-- | src/plugins/Input/mpc/decodermpcfactory.h | 54 | ||||
| -rw-r--r-- | src/plugins/Input/mpc/detailsdialog.cpp | 115 | ||||
| -rw-r--r-- | src/plugins/Input/mpc/detailsdialog.h | 49 | ||||
| -rw-r--r-- | src/plugins/Input/mpc/detailsdialog.ui | 349 | ||||
| -rw-r--r-- | src/plugins/Input/mpc/mpc.pro | 32 | ||||
| -rw-r--r-- | src/plugins/Input/mpc/translations/mpc_plugin_ru.qm | bin | 0 -> 2230 bytes | |||
| -rw-r--r-- | src/plugins/Input/mpc/translations/mpc_plugin_ru.ts | 149 | ||||
| -rw-r--r-- | src/plugins/Input/mpc/translations/translations.qrc | 6 |
13 files changed, 1655 insertions, 0 deletions
diff --git a/src/plugins/Input/mpc/CMakeLists.txt b/src/plugins/Input/mpc/CMakeLists.txt new file mode 100644 index 000000000..dccd6dd6b --- /dev/null +++ b/src/plugins/Input/mpc/CMakeLists.txt @@ -0,0 +1,86 @@ +project(libmpc) + +cmake_minimum_required(VERSION 2.4.0) + + +INCLUDE(UsePkgConfig) +INCLUDE(FindQt4) + +find_package(Qt4 REQUIRED) # find and setup Qt4 for this project +include(${QT_USE_FILE}) + +# 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_BINARY_DIR}/../../../) +link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../../) + +# libmpc and taglib +PKGCONFIG(taglib TAGLIB_INCLUDE_DIR TAGLIB_LINK_DIR TAGLIB_LINK_FLAGS TAGLIB_CFLAGS) + +IF(NOT TAGLIB_LINK_FLAGS) + SET(TAGLIB_LINK_FLAGS -ltag) + SET(TAGLIB_INCLUDE_DIR /usr/include/taglib) + SET(TAGLIB_CFLAGS -I/usr/include/taglib) +ENDIF(NOT TAGLIB_LINK_FLAGS) + +include_directories(${FLAC_INCLUDE_DIR} ${TAGLIB_INCLUDE_DIR}) +link_directories(${FLAC_LINK_DIR} ${TAGLIB_LINK_DIR}) + +ADD_DEFINITIONS(${TAGLIB_CFLAGS}) + + +SET(libmpc_SRCS + decoder_mpc.cpp + decodermpcfactory.cpp + detailsdialog.cpp +) + +SET(libmpc_MOC_HDRS + decodermpcfactory.h + decoder_mpc.h + detailsdialog.h +) + +SET(libmpc_RCCS translations/translations.qrc) + +QT4_ADD_RESOURCES(libmpc_RCC_SRCS ${libmpc_RCCS}) + +QT4_WRAP_CPP(libmpc_MOC_SRCS ${libmpc_MOC_HDRS}) + +# user interface + + +SET(libmpc_UIS + detailsdialog.ui +) + +QT4_WRAP_UI(libmpc_UIS_H ${libmpc_UIS}) +# Don't forget to include output directory, otherwise +# the UI file won't be wrapped! +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +ADD_LIBRARY(mpc SHARED ${libmpc_SRCS} ${libmpc_MOC_SRCS} ${libmpc_UIS_H} + ${libmpc_RCC_SRCS}) +target_link_libraries(mpc ${QT_LIBRARIES} -lqmmp -lmpcdec ${TAGLIB_LINK_FLAGS} ${TAGLIB_CFLAGS}) +install(TARGETS mpc DESTINATION ${LIB_DIR}/qmmp/Input PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ) + +# clean remaining files + +SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES + "CMakeCache.txt;Makefile;cmake_install.cmake" +) + diff --git a/src/plugins/Input/mpc/Makefile b/src/plugins/Input/mpc/Makefile new file mode 100644 index 000000000..7aa3ee7b3 --- /dev/null +++ b/src/plugins/Input/mpc/Makefile @@ -0,0 +1,254 @@ +############################################################################# +# Makefile for building: libmpc.so +# Generated by qmake (2.01a) (Qt 4.3.1) on: Thu Feb 7 14:07:02 2008 +# Project: mpc.pro +# Template: lib +# Command: /usr/local/Trolltech/Qt-4.3.1/bin/qmake -unix -o Makefile mpc.pro +############################################################################# + +####### Compiler, tools and options + +CC = gcc +CXX = g++ +DEFINES = -DQT_NO_DEBUG -DQT_PLUGIN -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED +CFLAGS = -pipe -O2 -I/usr/include/taglib -Wall -W -D_REENTRANT -fPIC $(DEFINES) +CXXFLAGS = -pipe -O2 -I/usr/include/taglib -Wall -W -D_REENTRANT -fPIC $(DEFINES) +INCPATH = -I/usr/local/Trolltech/Qt-4.3.1/mkspecs/linux-g++ -I. -I/usr/local/Trolltech/Qt-4.3.1/include/QtCore -I/usr/local/Trolltech/Qt-4.3.1/include/QtCore -I/usr/local/Trolltech/Qt-4.3.1/include/QtGui -I/usr/local/Trolltech/Qt-4.3.1/include/QtGui -I/usr/local/Trolltech/Qt-4.3.1/include -I../../../qmmp -I.build/moc -I.build/ui +LINK = g++ +LFLAGS = -Wl,-rpath,/usr/local/Trolltech/Qt-4.3.1/lib -shared +LIBS = $(SUBLIBS) -L../../../../lib -L/usr/local/Trolltech/Qt-4.3.1/lib -lqmmp -L/usr/lib -lmpcdec -I/usr/include -ltag -lQtGui -L/usr/local/Trolltech/Qt-4.3.1/lib -L/usr/X11R6/lib -lpng -lSM -lICE -pthread -pthread -lXi -lXrender -lXrandr -lXfixes -lXcursor -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz -lm -pthread -lgthread-2.0 -lglib-2.0 -lrt -ldl -lpthread +AR = ar cqs +RANLIB = +QMAKE = /usr/local/Trolltech/Qt-4.3.1/bin/qmake +TAR = tar -cf +COMPRESS = gzip -9f +COPY = cp -f +SED = sed +COPY_FILE = $(COPY) +COPY_DIR = $(COPY) -r +INSTALL_FILE = install -m 644 -p +INSTALL_DIR = $(COPY_DIR) +INSTALL_PROGRAM = install -m 755 -p +DEL_FILE = rm -f +SYMLINK = ln -sf +DEL_DIR = rmdir +MOVE = mv -f +CHK_DIR_EXISTS= test -d +MKDIR = mkdir -p + +####### Output directory + +OBJECTS_DIR = .build/obj/ + +####### Files + +SOURCES = decoder_mpc.cpp \ + decodermpcfactory.cpp \ + detailsdialog.cpp .build/moc/moc_decodermpcfactory.cpp \ + .build/moc/moc_detailsdialog.cpp +OBJECTS = .build/obj/decoder_mpc.o \ + .build/obj/decodermpcfactory.o \ + .build/obj/detailsdialog.o \ + .build/obj/moc_decodermpcfactory.o \ + .build/obj/moc_detailsdialog.o +DIST = /usr/local/Trolltech/Qt-4.3.1/mkspecs/common/g++.conf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/common/unix.conf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/common/linux.conf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/qconfig.pri \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/qt_functions.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/qt_config.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/exclusive_builds.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/default_pre.prf \ + ../../../../qmmp.pri \ + ../../plugins.pri \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/release.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/default_post.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/link_pkgconfig.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/warn_on.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/qt.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/unix/thread.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/moc.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/resources.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/uic.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/yacc.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/lex.prf \ + mpc.pro +QMAKE_TARGET = mpc +DESTDIR = ../../../../lib/qmmp/Input/ +TARGET = libmpc.so +TARGETD = libmpc.so + +first: all +####### Implicit rules + +.SUFFIXES: .o .c .cpp .cc .cxx .C + +.cpp.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cc.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.cxx.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.C.o: + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<" + +.c.o: + $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<" + +####### Build rules + +all: Makefile ../../../../lib/qmmp/Input/$(TARGET) + +../../../../lib/qmmp/Input/$(TARGET): .build/ui/ui_detailsdialog.h $(OBJECTS) $(SUBLIBS) $(OBJCOMP) + @$(CHK_DIR_EXISTS) ../../../../lib/qmmp/Input/ || $(MKDIR) ../../../../lib/qmmp/Input/ + -$(DEL_FILE) $(TARGET) + $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP) + -$(MOVE) $(TARGET) ../../../../lib/qmmp/Input/ + + + +Makefile: mpc.pro /usr/local/Trolltech/Qt-4.3.1/mkspecs/linux-g++/qmake.conf /usr/local/Trolltech/Qt-4.3.1/mkspecs/common/g++.conf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/common/unix.conf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/common/linux.conf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/qconfig.pri \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/qt_functions.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/qt_config.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/exclusive_builds.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/default_pre.prf \ + ../../../../qmmp.pri \ + ../../plugins.pri \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/release.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/default_post.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/link_pkgconfig.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/warn_on.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/qt.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/unix/thread.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/moc.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/resources.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/uic.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/yacc.prf \ + /usr/local/Trolltech/Qt-4.3.1/mkspecs/features/lex.prf \ + /usr/local/Trolltech/Qt-4.3.1/lib/libQtGui.prl \ + /usr/local/Trolltech/Qt-4.3.1/lib/libQtCore.prl + $(QMAKE) -unix -o Makefile mpc.pro +/usr/local/Trolltech/Qt-4.3.1/mkspecs/common/g++.conf: +/usr/local/Trolltech/Qt-4.3.1/mkspecs/common/unix.conf: +/usr/local/Trolltech/Qt-4.3.1/mkspecs/common/linux.conf: +/usr/local/Trolltech/Qt-4.3.1/mkspecs/qconfig.pri: +/usr/local/Trolltech/Qt-4.3.1/mkspecs/features/qt_functions.prf: +/usr/local/Trolltech/Qt-4.3.1/mkspecs/features/qt_config.prf: +/usr/local/Trolltech/Qt-4.3.1/mkspecs/features/exclusive_builds.prf: +/usr/local/Trolltech/Qt-4.3.1/mkspecs/features/default_pre.prf: +../../../../qmmp.pri: +../../plugins.pri: +/usr/local/Trolltech/Qt-4.3.1/mkspecs/features/release.prf: +/usr/local/Trolltech/Qt-4.3.1/mkspecs/features/default_post.prf: +/usr/local/Trolltech/Qt-4.3.1/mkspecs/features/link_pkgconfig.prf: +/usr/local/Trolltech/Qt-4.3.1/mkspecs/features/warn_on.prf: +/usr/local/Trolltech/Qt-4.3.1/mkspecs/features/qt.prf: +/usr/local/Trolltech/Qt-4.3.1/mkspecs/features/unix/thread.prf: +/usr/local/Trolltech/Qt-4.3.1/mkspecs/features/moc.prf: +/usr/local/Trolltech/Qt-4.3.1/mkspecs/features/resources.prf: +/usr/local/Trolltech/Qt-4.3.1/mkspecs/features/uic.prf: +/usr/local/Trolltech/Qt-4.3.1/mkspecs/features/yacc.prf: +/usr/local/Trolltech/Qt-4.3.1/mkspecs/features/lex.prf: +/usr/local/Trolltech/Qt-4.3.1/lib/libQtGui.prl: +/usr/local/Trolltech/Qt-4.3.1/lib/libQtCore.prl: +qmake: FORCE + @$(QMAKE) -unix -o Makefile mpc.pro + +dist: + @$(CHK_DIR_EXISTS) .build/obj/mpc1.0.0 || $(MKDIR) .build/obj/mpc1.0.0 + $(COPY_FILE) --parents $(SOURCES) $(DIST) .build/obj/mpc1.0.0/ && $(COPY_FILE) --parents decodermpcfactory.h decoder_mpc.h detailsdialog.h .build/obj/mpc1.0.0/ && $(COPY_FILE) --parents decoder_mpc.cpp decodermpcfactory.cpp detailsdialog.cpp .build/obj/mpc1.0.0/ && $(COPY_FILE) --parents detailsdialog.ui .build/obj/mpc1.0.0/ && (cd `dirname .build/obj/mpc1.0.0` && $(TAR) mpc1.0.0.tar mpc1.0.0 && $(COMPRESS) mpc1.0.0.tar) && $(MOVE) `dirname .build/obj/mpc1.0.0`/mpc1.0.0.tar.gz . && $(DEL_FILE) -r .build/obj/mpc1.0.0 + + +clean:compiler_clean + -$(DEL_FILE) $(OBJECTS) + -$(DEL_FILE) ../../../../lib/qmmp/Input/libmpc.so + -$(DEL_FILE) *~ core *.core + + +####### Sub-libraries + +distclean: clean + -$(DEL_FILE) $(TARGET) + -$(DEL_FILE) Makefile + + +mocclean: compiler_moc_header_clean compiler_moc_source_clean + +mocables: compiler_moc_header_make_all compiler_moc_source_make_all + +compiler_moc_header_make_all: .build/moc/moc_decodermpcfactory.cpp .build/moc/moc_detailsdialog.cpp +compiler_moc_header_clean: + -$(DEL_FILE) .build/moc/moc_decodermpcfactory.cpp .build/moc/moc_detailsdialog.cpp +.build/moc/moc_decodermpcfactory.cpp: decodermpcfactory.h + /usr/local/Trolltech/Qt-4.3.1/bin/moc $(DEFINES) $(INCPATH) decodermpcfactory.h -o .build/moc/moc_decodermpcfactory.cpp + +.build/moc/moc_detailsdialog.cpp: .build/ui/ui_detailsdialog.h \ + detailsdialog.h + /usr/local/Trolltech/Qt-4.3.1/bin/moc $(DEFINES) $(INCPATH) detailsdialog.h -o .build/moc/moc_detailsdialog.cpp + +compiler_rcc_make_all: +compiler_rcc_clean: +compiler_image_collection_make_all: qmake_image_collection.cpp +compiler_image_collection_clean: + -$(DEL_FILE) qmake_image_collection.cpp +compiler_moc_source_make_all: +compiler_moc_source_clean: +compiler_uic_make_all: .build/ui/ui_detailsdialog.h +compiler_uic_clean: + -$(DEL_FILE) .build/ui/ui_detailsdialog.h +.build/ui/ui_detailsdialog.h: detailsdialog.ui + /usr/local/Trolltech/Qt-4.3.1/bin/uic detailsdialog.ui -o .build/ui/ui_detailsdialog.h + +compiler_yacc_decl_make_all: +compiler_yacc_decl_clean: +compiler_yacc_impl_make_all: +compiler_yacc_impl_clean: +compiler_lex_make_all: +compiler_lex_clean: +compiler_clean: compiler_moc_header_clean compiler_uic_clean + +####### Compile + +.build/obj/decoder_mpc.o: decoder_mpc.cpp decoder_mpc.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .build/obj/decoder_mpc.o decoder_mpc.cpp + +.build/obj/decodermpcfactory.o: decodermpcfactory.cpp detailsdialog.h \ + .build/ui/ui_detailsdialog.h \ + decoder_mpc.h \ + decodermpcfactory.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .build/obj/decodermpcfactory.o decodermpcfactory.cpp + +.build/obj/detailsdialog.o: detailsdialog.cpp detailsdialog.h \ + .build/ui/ui_detailsdialog.h + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .build/obj/detailsdialog.o detailsdialog.cpp + +.build/obj/moc_decodermpcfactory.o: .build/moc/moc_decodermpcfactory.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .build/obj/moc_decodermpcfactory.o .build/moc/moc_decodermpcfactory.cpp + +.build/obj/moc_detailsdialog.o: .build/moc/moc_detailsdialog.cpp + $(CXX) -c $(CXXFLAGS) $(INCPATH) -o .build/obj/moc_detailsdialog.o .build/moc/moc_detailsdialog.cpp + +####### Install + +install_target: first FORCE + @$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/lib/qmmp/Input/ || $(MKDIR) $(INSTALL_ROOT)/lib/qmmp/Input/ + -$(INSTALL_PROGRAM) "../../../../lib/qmmp/Input/$(TARGET)" "$(INSTALL_ROOT)/lib/qmmp/Input/$(TARGET)" + -strip --strip-unneeded "$(INSTALL_ROOT)/lib/qmmp/Input/$(TARGET)" + +uninstall_target: FORCE + -$(DEL_FILE) "$(INSTALL_ROOT)/lib/qmmp/Input/$(TARGET)" + -$(DEL_DIR) $(INSTALL_ROOT)/lib/qmmp/Input/ + + +install: install_target FORCE + +uninstall: uninstall_target FORCE + +FORCE: + diff --git a/src/plugins/Input/mpc/decoder_mpc.cpp b/src/plugins/Input/mpc/decoder_mpc.cpp new file mode 100644 index 000000000..10591a384 --- /dev/null +++ b/src/plugins/Input/mpc/decoder_mpc.cpp @@ -0,0 +1,386 @@ +/*************************************************************************** + * Copyright (C) 2006 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 <QIODevice> + +#include "constants.h" +#include "buffer.h" +#include "output.h" +#include "recycler.h" + +#include "decoder_mpc.h" + +// this function used from xmms +inline static void copyBuffer(MPC_SAMPLE_FORMAT* pInBuf, char* pOutBuf, unsigned pLength) +{ + unsigned pSize = 16; + int clipMin = -1 << (pSize - 1); + int clipMax = (1 << (pSize - 1)) - 1; + int floatScale = 1 << (pSize - 1); + for (unsigned n = 0; n < 2 * pLength; n++) + { + int val; +#ifdef MPC_FIXED_POINT + val = shiftSigned(pInBuf[n], pSize - MPC_FIXED_POINT_SCALE_SHIFT); +#else + val = (int) (pInBuf[n] * floatScale); +#endif + if (val < clipMin) + val = clipMin; + else if (val > clipMax) + val = clipMax; + unsigned shift = 0; + do + { + pOutBuf[n * 2 + (shift / 8)] = (unsigned char) ((val >> shift) & 0xFF); + shift += 8; + } + while (shift < pSize); + } +} + +// mpc callbacks + +static mpc_int32_t mpc_callback_read (void *data, void *buffer, mpc_int32_t size) +{ + DecoderMPC *dmpc = (DecoderMPC *) data; + qint64 res; + + res = dmpc->input()->read((char *)buffer, size); + + return res; +} + +static mpc_bool_t mpc_callback_seek (void *data, mpc_int32_t offset) +{ + DecoderMPC *dmpc = (DecoderMPC *) data; + + return dmpc->input()->seek(offset); // ? TRUE : FALSE; +} + +static mpc_int32_t mpc_callback_tell (void *data) +{ + DecoderMPC *dmpc = (DecoderMPC *) data; + return dmpc->input()->pos (); +} + +static mpc_bool_t mpc_callback_canseek (void *data) +{ + DecoderMPC *dmpc = (DecoderMPC *) data; + return !dmpc->input()->isSequential () ; +} + +static mpc_int32_t mpc_callback_get_size (void *data) +{ + DecoderMPC *dmpc = (DecoderMPC *) data; + return dmpc->input()->size(); +} + +// Decoder class + +DecoderMPC::DecoderMPC(QObject *parent, DecoderFactory *d, QIODevice *i, Output *o) + : Decoder(parent, d, i, o) +{ + inited = FALSE; + user_stop = FALSE; + stat = 0; + output_buf = 0; + output_bytes = 0; + output_at = 0; + bks = 0; + done = FALSE; + finish = FALSE; + len = 0; + freq = 0; + bitrate = 0; + seekTime = -1.0; + totalTime = 0.0; + chan = 0; + output_size = 0; + m_data = 0; + + + + +} + + +DecoderMPC::~DecoderMPC() +{ + deinit(); + if(data()) + { + delete data(); + m_data = 0; + } + if (output_buf) + delete [] output_buf; + output_buf = 0; +} + + +void DecoderMPC::stop() +{ + user_stop = TRUE; +} + + +void DecoderMPC::flush(bool final) +{ + ulong min = final ? 0 : bks; + + while ((! done && ! finish) && output_bytes > min) + { + output()->recycler()->mutex()->lock (); + + while ((! done && ! finish) && output()->recycler()->full()) + { + mutex()->unlock(); + + output()->recycler()->cond()->wait(output()->recycler()->mutex()); + + mutex()->lock (); + done = user_stop; + } + + if (user_stop || finish) + { + inited = FALSE; + done = TRUE; + } + else + { + output_bytes -= produceSound(output_buf, output_bytes, bitrate, chan); + output_size += bks; + output_at = output_bytes; + } + + if (output()->recycler()->full()) + { + output()->recycler()->cond()->wakeOne(); + } + + output()->recycler()->mutex()->unlock(); + } +} + + +bool DecoderMPC::initialize() +{ + bks = blockSize(); + inited = user_stop = done = finish = FALSE; + len = freq = bitrate = 0; + stat = chan = 0; + output_size = 0; + seekTime = -1.0; + totalTime = 0.0; + + + if (! input()) + { + error("DecoderMPC: cannot initialize. No input."); + + return FALSE; + } + + if (! output_buf) + output_buf = new char[globalBufferSize]; + output_at = 0; + output_bytes = 0; + + if (! input()) + { + error("DecoderMPC: cannot initialize. No input."); + + return FALSE; + } + + if (! output_buf) + output_buf = new char[globalBufferSize]; + output_at = 0; + output_bytes = 0; + + if (! input()->isOpen()) + { + if (! input()->open(QIODevice::ReadOnly)) + { + error("DecoderMPC: cannot open input."); + return FALSE; + } + } + if (!m_data) + { + m_data = new mpc_data; + } + + qDebug("DecoderMPC: setting callbacks"); + m_data->reader.read = mpc_callback_read; + m_data->reader.seek = mpc_callback_seek; + m_data->reader.tell = mpc_callback_tell; + m_data->reader.canseek = mpc_callback_canseek; + m_data->reader.get_size = mpc_callback_get_size; + m_data->reader.data = this; + + mpc_streaminfo_init (&m_data->info); + + if (mpc_streaminfo_read (&m_data->info, &m_data->reader) != ERROR_CODE_OK) + return FALSE; + chan = data()->info.channels; + configure(data()->info.sample_freq, chan, 16, data()->info.bitrate); + + mpc_decoder_setup (&data()->decoder, &data()->reader); + + //mpc_decoder_scale_output (&data()->decoder, 3.0); + + if (!mpc_decoder_initialize (&data()->decoder, &data()->info)) + { + error("DecoderMPC: cannot get info."); + return FALSE; + } + totalTime = mpc_streaminfo_get_length(&data()->info); + inited = TRUE; + qDebug("DecoderMPC: initialize succes"); + return TRUE; +} + + +double DecoderMPC::lengthInSeconds() +{ + if (! inited) + return 0; + + return totalTime; +} + + +void DecoderMPC::seek(double pos) +{ + seekTime = pos; +} + + +void DecoderMPC::deinit() +{ + //FLAC__stream_decoder_finish (data()->decoder); + inited = user_stop = done = finish = FALSE; + len = freq = bitrate = 0; + stat = chan = 0; + output_size = 0; +} + +void DecoderMPC::run() +{ + mpc_uint32_t vbrAcc = 0; + mpc_uint32_t vbrUpd = 0; + mutex()->lock (); + + if (! inited) + { + mutex()->unlock(); + + return; + } + stat = DecoderState::Decoding; + mutex()->unlock(); + { + dispatch(DecoderState ((DecoderState::Type) stat)); + } + + while (! done && ! finish) + { + mutex()->lock (); + // decode + + if (seekTime >= 0.0) + { + mpc_decoder_seek_seconds(&data()->decoder, seekTime); + seekTime = -1.0; + } + MPC_SAMPLE_FORMAT buffer[MPC_DECODER_BUFFER_LENGTH]; + + len = mpc_decoder_decode (&data()->decoder, buffer, &vbrAcc, &vbrUpd); + + copyBuffer(buffer, (char *) (output_buf + output_at), len); + + len = len * 4; + + if (len > 0) + { + bitrate = vbrUpd * data()->info.sample_freq / 1152; + output_at += len; + 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() && ! user_stop) + { + output()->recycler()->cond()->wakeOne(); + mutex()->unlock(); + output()->recycler()->cond()->wait(output()->recycler()->mutex()); + mutex()->lock (); + } + output()->recycler()->mutex()->unlock(); + } + + done = TRUE; + if (! user_stop) + { + finish = TRUE; + } + } + else + { + // error in read + error("DecoderMPC: Error while decoding stream, File appears to be " + "corrupted"); + + finish = TRUE; + } + + mutex()->unlock(); + } + + mutex()->lock (); + + if (finish) + stat = DecoderState::Finished; + else if (user_stop) + stat = DecoderState::Stopped; + + mutex()->unlock(); + + { + dispatch(DecoderState ((DecoderState::Type) stat)); + } + + deinit(); +} diff --git a/src/plugins/Input/mpc/decoder_mpc.h b/src/plugins/Input/mpc/decoder_mpc.h new file mode 100644 index 000000000..3b17b100e --- /dev/null +++ b/src/plugins/Input/mpc/decoder_mpc.h @@ -0,0 +1,80 @@ +/*************************************************************************** + * Copyright (C) 2006 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_mpc_h +#define __decoder_mpc_h + +#include <mpcdec/mpcdec.h> + +#include "decoder.h" + +struct mpc_data +{ + mpc_decoder decoder; + mpc_reader reader; + mpc_streaminfo info; +}; + +class DecoderMPC : public Decoder +{ +public: + DecoderMPC(QObject *, DecoderFactory *, QIODevice *, Output *); + virtual ~DecoderMPC(); + + // Standard Decoder API + bool initialize(); + double lengthInSeconds(); + void seek(double); + void stop(); + + // Equalizer + bool isEQSupported() const { return FALSE; } + void setEQEnabled(bool) { ; } + void setEQGain(int) { ; } + void setEQBands(int[10]) { ; } + + struct mpc_data *data() { return m_data; } + + +private: + // thread run function + void run(); + struct mpc_data *m_data; + // helper functions + void flush(bool = FALSE); + void deinit(); + + bool inited, user_stop; + int stat; + + // output buffer + char *output_buf; + ulong output_bytes, output_at; + + unsigned int bks; + bool done, finish; + long len, freq, bitrate; + int chan; + unsigned long output_size; + double totalTime, seekTime; +}; + + +#endif // __decoder_mpc_h diff --git a/src/plugins/Input/mpc/decodermpcfactory.cpp b/src/plugins/Input/mpc/decodermpcfactory.cpp new file mode 100644 index 000000000..f2874a08d --- /dev/null +++ b/src/plugins/Input/mpc/decodermpcfactory.cpp @@ -0,0 +1,95 @@ +#include <QtGui> +#include <taglib/tag.h> +#include <taglib/fileref.h> + +#include "detailsdialog.h" +#include "decoder_mpc.h" +#include "decodermpcfactory.h" + + +// DecoderMPCFactory + +bool DecoderMPCFactory::supports(const QString &source) const +{ + + return (source.right(4).toLower() == ".mpc"); +} + +bool DecoderMPCFactory::canDecode(QIODevice *) const +{ + return FALSE; +} + +const DecoderProperties DecoderMPCFactory::properties() const +{ + DecoderProperties properties; + properties.name = tr("Musepack Plugin"); + properties.filter = "*.mpc"; + properties.description = tr("Musepack Files"); + //properties.contentType = ; + properties.hasAbout = TRUE; + properties.hasSettings = FALSE; + return properties; +} + +Decoder *DecoderMPCFactory::create(QObject *parent, QIODevice *input, + Output *output) +{ + return new DecoderMPC(parent, this, input, output); +} + +FileTag *DecoderMPCFactory::createTag(const QString &source) +{ + FileTag *ftag = new FileTag(); + + TagLib::FileRef fileRef(source.toLocal8Bit ()); + TagLib::Tag *tag = fileRef.tag(); + + if (tag && !tag->isEmpty()) + { + ftag->setValue(FileTag::ALBUM, + QString::fromUtf8(tag->album().toCString(TRUE)).trimmed()); + ftag->setValue(FileTag::ARTIST, + QString::fromUtf8(tag->artist().toCString(TRUE)).trimmed()); + ftag->setValue(FileTag::COMMENT, + QString::fromUtf8(tag->comment().toCString(TRUE)).trimmed()); + ftag->setValue(FileTag::GENRE, + QString::fromUtf8(tag->genre().toCString(TRUE)).trimmed()); + ftag->setValue(FileTag::TITLE, + QString::fromUtf8(tag->title().toCString(TRUE)).trimmed()); + ftag->setValue(FileTag::YEAR, tag->year()); + ftag->setValue(FileTag::TRACK, tag->track()); + } + + if (fileRef.audioProperties()) + ftag->setValue(FileTag::LENGTH, fileRef.audioProperties()->length()); + + return ftag; +} + +QObject* DecoderMPCFactory::showDetails(QWidget *parent, const QString &path) +{ + DetailsDialog *d = new DetailsDialog(parent, path); + d -> show(); + return d; +} + +void DecoderMPCFactory::showSettings(QWidget *) +{} + +void DecoderMPCFactory::showAbout(QWidget *parent) +{ + QMessageBox::about (parent, tr("About Musepack Audio Plugin"), + tr("Qmmp Musepack Audio Plugin")+"\n"+ + tr("Writen by: Ilya Kotov <forkotov02@hotmail.ru>")); +} + +QTranslator *DecoderMPCFactory::createTranslator(QObject *parent) +{ + QTranslator *translator = new QTranslator(parent); + QString locale = QLocale::system().name(); + translator->load(QString(":/mpc_plugin_") + locale); + return translator; +} + +Q_EXPORT_PLUGIN(DecoderMPCFactory) diff --git a/src/plugins/Input/mpc/decodermpcfactory.h b/src/plugins/Input/mpc/decodermpcfactory.h new file mode 100644 index 000000000..0f8dda55f --- /dev/null +++ b/src/plugins/Input/mpc/decodermpcfactory.h @@ -0,0 +1,54 @@ +/*************************************************************************** + * Copyright (C) 2006 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 DECODERMPCFACTORY_H +#define DECODERMPCFACTORY_H + +#include <QObject> +#include <QString> +#include <QIODevice> +#include <QWidget> + +#include <decoder.h> +#include <output.h> +#include <decoderfactory.h> +#include <filetag.h> + + + + +class DecoderMPCFactory : 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 *); + FileTag *createTag(const QString &source); + 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/mpc/detailsdialog.cpp b/src/plugins/Input/mpc/detailsdialog.cpp new file mode 100644 index 000000000..472046717 --- /dev/null +++ b/src/plugins/Input/mpc/detailsdialog.cpp @@ -0,0 +1,115 @@ +/*************************************************************************** + * Copyright (C) 2007 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 <taglib/tag.h> +#include <taglib/fileref.h> +#include <taglib/mpcfile.h> + +#include <QFile> +#include <QFileInfo> + +#include "detailsdialog.h" + +#define QStringToTString_qt4(s) TagLib::String(s.toUtf8().constData(), TagLib::String::UTF8) + +DetailsDialog::DetailsDialog(QWidget *parent, const QString &path) + : QDialog(parent) +{ + ui.setupUi(this); + setAttribute(Qt::WA_DeleteOnClose); + m_path = path; + setWindowTitle (path.section('/',-1)); + path.section('/',-1); + ui.pathLineEdit->setText(m_path); + if(QFile::exists(m_path)) + { + loadMPCInfo(); + loadTag(); + } +} + + +DetailsDialog::~DetailsDialog() +{} + +void DetailsDialog::loadMPCInfo() +{ + TagLib::MPC::File f (m_path.toLocal8Bit()); + QString text; + text = QString("%1").arg(f.audioProperties()->length()/60); + text +=":"+QString("%1").arg(f.audioProperties()->length()%60,2,10,QChar('0')); + ui.lengthLabel->setText(text); + text = QString("%1").arg(f.audioProperties()->sampleRate()); + ui.sampleRateLabel->setText(text+" "+tr("Hz")); + text = QString("%1").arg(f.audioProperties()->channels()); + ui.channelsLabel->setText(text); + text = QString("%1").arg(f.audioProperties()->bitrate()); + ui.bitrateLabel->setText(text+" "+tr("kbps")); + text = QString("%1").arg(f.audioProperties()->mpcVersion()); + ui.versionLabel->setText(text); + text = QString("%1 "+tr("KB")).arg(f.length()/1024); + ui.fileSizeLabel->setText(text); +} + +void DetailsDialog::loadTag() +{ + TagLib::FileRef f (m_path.toLocal8Bit()); + + if (f.tag()) + { //TODO: load codec name from config + + TagLib::String title = f.tag()->title(); + TagLib::String artist = f.tag()->artist(); + TagLib::String album = f.tag()->album(); + TagLib::String comment = f.tag()->comment(); + TagLib::String genre = f.tag()->genre(); + QString string = QString::fromUtf8(title.toCString(TRUE)).trimmed(); + ui.titleLineEdit->setText(string); + string = QString::fromUtf8(artist.toCString(TRUE)).trimmed(); + ui.artistLineEdit->setText(string); + string = QString::fromUtf8(album.toCString(TRUE)).trimmed(); + ui.albumLineEdit->setText(string); + string = QString::fromUtf8(comment.toCString(TRUE)).trimmed(); + ui.commentLineEdit->setText(string); + string = QString("%1").arg(f.tag()->year()); + ui.yearLineEdit->setText(string); + string = QString("%1").arg(f.tag()->track()); + ui.trackLineEdit->setText(string); + string = QString::fromUtf8(genre.toCString(TRUE)).trimmed(); + ui.genreLineEdit->setText(string); + } + QFileInfo info(m_path); + ui.saveButton->setEnabled(info.isWritable()); + connect(ui.saveButton, SIGNAL(clicked()), SLOT(saveTag())); +} + +void DetailsDialog::saveTag() +{ + TagLib::FileRef f (m_path.toLocal8Bit()); + + f.tag()->setTitle(QStringToTString_qt4(ui.titleLineEdit->text())); + f.tag()->setArtist(QStringToTString_qt4(ui.artistLineEdit->text())); + f.tag()->setAlbum(QStringToTString_qt4(ui.albumLineEdit->text())); + f.tag()->setComment(QStringToTString_qt4(ui.commentLineEdit->text())); + f.tag()->setGenre(QStringToTString_qt4(ui.genreLineEdit->text())); + f.tag()->setYear(ui.yearLineEdit->text().toUInt()); + f.tag()->setTrack(ui.trackLineEdit->text().toUInt()); + + f.save(); +} diff --git a/src/plugins/Input/mpc/detailsdialog.h b/src/plugins/Input/mpc/detailsdialog.h new file mode 100644 index 000000000..70540bda1 --- /dev/null +++ b/src/plugins/Input/mpc/detailsdialog.h @@ -0,0 +1,49 @@ +/*************************************************************************** + * Copyright (C) 2007 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 <QDialog> + +#include "ui_detailsdialog.h" + +/** + @author Ilya Kotov <forkotov02@hotmail.ru> +*/ +class DetailsDialog : public QDialog +{ +Q_OBJECT +public: + DetailsDialog(QWidget *parent = 0, const QString &path = 0); + + ~DetailsDialog(); + +private slots: + void saveTag(); + +private: + void loadMPCInfo(); + void loadTag(); + Ui::DetailsDialog ui; + QString m_path; + +}; + +#endif diff --git a/src/plugins/Input/mpc/detailsdialog.ui b/src/plugins/Input/mpc/detailsdialog.ui new file mode 100644 index 000000000..918dd3abf --- /dev/null +++ b/src/plugins/Input/mpc/detailsdialog.ui @@ -0,0 +1,349 @@ +<ui version="4.0" > + <class>DetailsDialog</class> + <widget class="QDialog" name="DetailsDialog" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>449</width> + <height>375</height> + </rect> + </property> + <property name="windowTitle" > + <string>Details</string> + </property> + <layout class="QGridLayout" > + <property name="margin" > + <number>8</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item rowspan="2" row="1" column="0" colspan="2" > + <widget class="QGroupBox" name="groupBox" > + <property name="minimumSize" > + <size> + <width>175</width> + <height>16</height> + </size> + </property> + <property name="title" > + <string>Musepack Info</string> + </property> + <layout class="QGridLayout" > + <property name="margin" > + <number>8</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="6" column="0" > + <spacer> + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" > + <size> + <width>74</width> + <height>151</height> + </size> + </property> + </spacer> + </item> + <item row="2" column="1" colspan="2" > + <widget class="QLabel" name="fileSizeLabel" > + <property name="text" > + <string>-</string> + </property> + </widget> + </item> + <item row="0" column="0" > + <widget class="QLabel" name="label" > + <property name="text" > + <string>Length:</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="1" colspan="2" > + <widget class="QLabel" name="lengthLabel" > + <property name="text" > + <string>-</string> + </property> + </widget> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="label_3" > + <property name="text" > + <string>Sample rate:</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="1" column="1" colspan="2" > + <widget class="QLabel" name="sampleRateLabel" > + <property name="text" > + <string>-</string> + </property> + </widget> + </item> + <item row="3" column="0" > + <widget class="QLabel" name="label_10" > + <property name="layoutDirection" > + <enum>Qt::LeftToRight</enum> + </property> + <property name="text" > + <string>Channels:</string> + </property> + <property name="textFormat" > + <enum>Qt::PlainText</enum> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="label_5" > + <property name="text" > + <string>File size:</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="4" column="0" > + <widget class="QLabel" name="label_2" > + <property name="text" > + <string>Bitrate:</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="3" column="1" colspan="2" > + <widget class="QLabel" name="channelsLabel" > + <property name="layoutDirection" > + <enum>Qt::LeftToRight</enum> + </property> + <property name="text" > + <string>-</string> + </property> + </widget> + </item> + <item row="4" column="1" colspan="2" > + <widget class="QLabel" name="bitrateLabel" > + <property name="text" > + <string>-</string> + </property> + </widget> + </item> + <item row="5" column="0" > + <widget class="QLabel" name="label_4" > + <property name="text" > + <string>Stream version:</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="5" column="1" colspan="2" > + <widget class="QLabel" name="versionLabel" > + <property name="text" > + <string>-</string> + </property> + </widget> + </item> + </layout> + </widget> + </item> + <item row="0" column="1" colspan="3" > + <widget class="QLineEdit" name="pathLineEdit" > + <property name="readOnly" > + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="0" > + <widget class="QLabel" name="label_28" > + <property name="text" > + <string>File path:</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="2" column="3" > + <widget class="QPushButton" name="pushButton_3" > + <property name="text" > + <string>Close</string> + </property> + </widget> + </item> + <item row="2" column="2" > + <spacer> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" > + <size> + <width>111</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item row="1" column="2" colspan="2" > + <widget class="QGroupBox" name="groupBox_2" > + <property name="sizePolicy" > + <sizepolicy> + <hsizetype>5</hsizetype> + <vsizetype>5</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title" > + <string>Musepack Tag</string> + </property> + <layout class="QGridLayout" > + <property name="margin" > + <number>8</number> + </property> + <property name="spacing" > + <number>6</number> + </property> + <item row="6" column="1" colspan="2" > + <widget class="QPushButton" name="saveButton" > + <property name="enabled" > + <bool>false</bool> + </property> + <property name="text" > + <string>Save</string> + </property> + </widget> + </item> + <item row="4" column="3" > + <widget class="QLineEdit" name="trackLineEdit" /> + </item> + <item row="4" column="2" > + <widget class="QLabel" name="label_26" > + <property name="text" > + <string>Track number:</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="4" column="1" > + <widget class="QLineEdit" name="yearLineEdit" /> + </item> + <item row="4" column="0" > + <widget class="QLabel" name="label_25" > + <property name="text" > + <string>Year:</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="5" column="0" > + <widget class="QLabel" name="label_27" > + <property name="text" > + <string>Genre:</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="3" column="0" > + <widget class="QLabel" name="label_24" > + <property name="text" > + <string>Comment:</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="2" column="0" > + <widget class="QLabel" name="label_23" > + <property name="text" > + <string>Album:</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="1" column="0" > + <widget class="QLabel" name="label_22" > + <property name="text" > + <string>Artist:</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="0" > + <widget class="QLabel" name="label_21" > + <property name="text" > + <string>Title:</string> + </property> + <property name="alignment" > + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item row="0" column="1" colspan="3" > + <widget class="QLineEdit" name="titleLineEdit" /> + </item> + <item row="1" column="1" colspan="3" > + <widget class="QLineEdit" name="artistLineEdit" /> + </item> + <item row="2" column="1" colspan="3" > + <widget class="QLineEdit" name="albumLineEdit" /> + </item> + <item row="3" column="1" colspan="3" > + <widget class="QLineEdit" name="commentLineEdit" /> + </item> + <item row="5" column="1" colspan="2" > + <widget class="QLineEdit" name="genreLineEdit" /> + </item> + </layout> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>pushButton_3</sender> + <signal>clicked()</signal> + <receiver>DetailsDialog</receiver> + <slot>close()</slot> + <hints> + <hint type="sourcelabel" > + <x>623</x> + <y>353</y> + </hint> + <hint type="destinationlabel" > + <x>539</x> + <y>352</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/src/plugins/Input/mpc/mpc.pro b/src/plugins/Input/mpc/mpc.pro new file mode 100644 index 000000000..f1a50683d --- /dev/null +++ b/src/plugins/Input/mpc/mpc.pro @@ -0,0 +1,32 @@ +include(../../plugins.pri) + +FORMS += detailsdialog.ui +HEADERS += decodermpcfactory.h \ + decoder_mpc.h \ + detailsdialog.h +SOURCES += decoder_mpc.cpp \ + decodermpcfactory.cpp \ + detailsdialog.cpp + +TARGET=$$PLUGINS_PREFIX/Input/mpc +QMAKE_CLEAN =$$PLUGINS_PREFIX/Input/libmpc.so + + +INCLUDEPATH += ../../../qmmp +CONFIG += release \ +warn_on \ +plugin \ +link_pkgconfig +TEMPLATE = lib +QMAKE_LIBDIR += ../../../../lib +LIBS += -lqmmp -L/usr/lib -lmpcdec -I/usr/include +PKGCONFIG += taglib +#TRANSLATIONS = translations/mpc_plugin_ru.ts +#RESOURCES = translations/translations.qrc + +isEmpty (LIB_DIR){ +LIB_DIR = /lib +} + +target.path = $$LIB_DIR/qmmp/Input +INSTALLS += target diff --git a/src/plugins/Input/mpc/translations/mpc_plugin_ru.qm b/src/plugins/Input/mpc/translations/mpc_plugin_ru.qm Binary files differnew file mode 100644 index 000000000..0eb8c1533 --- /dev/null +++ b/src/plugins/Input/mpc/translations/mpc_plugin_ru.qm diff --git a/src/plugins/Input/mpc/translations/mpc_plugin_ru.ts b/src/plugins/Input/mpc/translations/mpc_plugin_ru.ts new file mode 100644 index 000000000..53ecd8dc8 --- /dev/null +++ b/src/plugins/Input/mpc/translations/mpc_plugin_ru.ts @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS><TS version="1.1" language="ru"> +<context> + <name>DecoderMPCFactory</name> + <message> + <location filename="../decodermpcfactory.cpp" line="21"/> + <source>Musepack Plugin</source> + <translation>Модуль Musepack</translation> + </message> + <message> + <location filename="../decodermpcfactory.cpp" line="35"/> + <source>Musepack Files</source> + <translation>Файлы Musepack</translation> + </message> + <message> + <location filename="../decodermpcfactory.cpp" line="63"/> + <source>About Musepack Audio Plugin</source> + <translation>Об аудио-модуле Musepack</translation> + </message> + <message> + <location filename="../decodermpcfactory.cpp" line="64"/> + <source>Qmmp Musepack Audio Plugin</source> + <translation>Аудио-модуль Musepack для Qmmp</translation> + </message> + <message> + <location filename="../decodermpcfactory.cpp" line="65"/> + <source>Writen by: Ilya Kotov <forkotov02@hotmail.ru></source> + <translation>Разработчик: Илья Котов <forkotov02@hotmail.ru></translation> + </message> +</context> +<context> + <name>DetailsDialog</name> + <message> + <location filename="../detailsdialog.cpp" line="52"/> + <source>Hz</source> + <translation>Гц</translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="31"/> + <source>Musepack Info</source> + <translation>Информация Musepack</translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="160"/> + <source>-</source> + <translation></translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="63"/> + <source>Length:</source> + <translation>Длительность:</translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="80"/> + <source>Sample rate:</source> + <translation>Дискретизация:</translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="100"/> + <source>Channels:</source> + <translation>Каналов:</translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="113"/> + <source>File size:</source> + <translation>Размер файла:</translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="123"/> + <source>Bitrate:</source> + <translation>Битовая частота:</translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="150"/> + <source>Stream version:</source> + <translation>Версия потока:</translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="177"/> + <source>File path:</source> + <translation>Путь к файлу:</translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="187"/> + <source>Close</source> + <translation>Закрыть</translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="215"/> + <source>Musepack Tag</source> + <translation>Musepack-тег</translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="230"/> + <source>Save</source> + <translation>Сохранить</translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="240"/> + <source>Track number:</source> + <translation>Номер трека:</translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="253"/> + <source>Year:</source> + <translation>Год:</translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="263"/> + <source>Genre:</source> + <translation>Жанр:</translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="273"/> + <source>Comment:</source> + <translation>Комментарий:</translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="283"/> + <source>Album:</source> + <translation>Альбом:</translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="293"/> + <source>Artist:</source> + <translation>Исполнитель:</translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="303"/> + <source>Title:</source> + <translation>Название:</translation> + </message> + <message> + <location filename="../detailsdialog.ui" line="13"/> + <source>Details</source> + <translation>Информация</translation> + </message> + <message> + <location filename="../detailsdialog.cpp" line="56"/> + <source>kbps</source> + <translation>Кб/с</translation> + </message> + <message> + <location filename="../detailsdialog.cpp" line="59"/> + <source>KB</source> + <translation>Кб</translation> + </message> +</context> +</TS> diff --git a/src/plugins/Input/mpc/translations/translations.qrc b/src/plugins/Input/mpc/translations/translations.qrc new file mode 100644 index 000000000..cc88de9ce --- /dev/null +++ b/src/plugins/Input/mpc/translations/translations.qrc @@ -0,0 +1,6 @@ +<!DOCTYPE RCC> +<RCC version="1.0"> + <qresource> + <file>mpc_plugin_ru.qm</file> + </qresource> +</RCC> |
