./PaxHeaders.4329/soundkonverter-2.1.20000644000000000000000000000012012441312477014344 xustar0030 mtime=1418040639.956801135 20 atime=1358274329 30 ctime=1418040695.181717195 ./soundkonverter-2.1.2/0000755000175000001440000000000012441312477015421 5ustar00danielusers00000000000000./soundkonverter-2.1.2/PaxHeaders.4329/README0000644000000000000000000000013212076525023015301 xustar0030 mtime=1358604819.201806279 30 atime=1358604819.201806279 30 ctime=1418040695.110717313 ./soundkonverter-2.1.2/README0000644000175000001440000003157312076525023016307 0ustar00danielusers00000000000000 soundKonverter is a frontend to various audio converters. The key features are: - Audio conversion - ReplayGain calculation - CD ripping Reading and writing tags and covers is supported for many formats, so they are preserved when converting files. The following backends and formats are supported: Encoders/Decoders: Encode: Decode: faac (aac,m4a) (aac,m4a) ffmpeg (ogg vorbis,mp3,flac,wma,aac,m4a,ac3,alac,mp2,amr nb) (ogg vorbis,mp3,flac,wma,aac,ac3,alac,mp2,sad,als,amr nb,amr wb,ape,speex,m4a,mp1,musepack,shorten,tta,wavpack,ra,3gp,rm,avi,mkv,ogv,mpeg,mov,mp4,flv,wmv,rv) flac (flac) (flac) lame (mp3) (mp2,mp3) mplayer (ogg vorbis,mp3,flac,wma,aac,ac3,alac,mp2,sad,als,amr nb,amr wb,ape,speex,m4a,mp1,musepack,shorten,tta,wavpack,ra,3gp,rm,avi,mkv,ogv,mpeg,mov,mp4,flv,wmv,rv) neroaac (m4a) (m4a) timidity (midi,mod) fluidsynth (midi,mod) vorbistools (ogg vorbis) (ogg vorbis) twolame (mp2) musepack (musepack) (musepack) flake (flac) mac (ape) (ape) shorten (shorten) (shorten) wavpack (wavpack) (wavpack) ttaenc (tta) (tta) opustools (opus) (opus) speex (speex) (speex) sox (ogg vorbis,mp3,flac,mp2,8svx,aiff,amr nb,amr wb) (ogg vorbis,mp3,flac,mp2,8svx,aiff,amr nb,amr wb) Filters: sox (sample rate, sample size, channels, normalize, bass, treble) ReplayGain calculators: aacgain (aac,mp3) metaflac (flac) mp3gain (mp3) vorbisgain (ogg vorbis) wvgain (wavpack) mpcgain (musepack) CD rippers: cdparanoia If you try to convert a file that is not supported, soundKonverter will tell you which backend you need to install. soundKonverter has nothing to do with the soundconverter project, the very similar name is just an unfortunate coincident. Websites: https://github.com/HessiJames/soundkonverter http://kde-apps.org/content/show.php?content=29024 Feature list: ============= - Convert audio files between many formats - Change sample rate and sample size during conversion - Apply effects like normalize during conversion - Convert the audio stream from video files to audio files - Convert multiple files at once - Calculate ReplayGain for many formats - ReplayGain tool for calculating and removing ReplayGain tags - Calculate ReplayGain for multiple files or file stets at once - Conversion and ReplayGain calculation is very scalable, the conversion of 100000 files or more is not a problem - Copy tags and covers when converting files (note: for ogg/METADATA_BLOCK_PICTURE, flac and asf/wma files, taglib 1.7 or higher is needed) - Rip multiple audio CDs at once - Retrieve audio CD information from CDDB and MusicBrainz - Easy to use, just choose a file format and a quality level - Detailed control, if you want to choose the conversion settings in more detail, simply switch to the "detailed" tab - Manage your preferred conversion options with profiles - Contextual help, e.g. if you don't know what the speex format is, just click on the "info" button next to it. Or if you want to add a file that isn't supported, soundKonverter will tell you how to enable the format if possible. - Possibility to configure which backend shall be used for which codec - or let soundKonverter optimize that for you. Every time you install or remove backends soundKonverter will suggest optimizations if possible. - Possibility to integrate soundKonverter in other applications or scripts by using its command line interface Installation: ============= This section describes install soundKonverter from its sources. If you prefer to use precompiled packages have a look at the corresponding section below. First you should make sure that all dependencies are installed. soundKonverter will need the following packages to compile: kde development packages version 4.4 or higher taglib development package version 1.4 or higher cdparanoia development package libkcddb (sometimes kdemultimedia) development package gettext-tools cmake All dependencies - and whether they are fulfilled - should be shown when running cmake. Then open a console and change to the soundKonverter source directory and execute the following commands: mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` .. make sudo make install In order to compile soundKonverter with debug information the commands will look like this: mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` -DCMAKE_BUILD_TYPE=debugfull .. make sudo make install Note: `kde4-config --prefix` should return the installation path of kde. On some systems you might need to use kde-config. Or you can just define a path by yourself, "/usr" will be fine for most systems. For installing soundKonverter to your home directory see Building Amarok Locally at: http://amarok.kde.org/wiki/2.0_Development_HowTo Un-Installation: ================ For uninstalling soundKonverter, open a console and change to the soundKonverter build directory. (If you followed the instructions above it's the directory named "build" in the soundKonverter source directory.) Then execute one of the following commands: sudo make uninstall or sudo xargs rm < install_manifest.txt In order to remove the soundKonverter configuration and kde integration, run the following commands: rm `kde4-config --localprefix`share/config/soundkonverterrc rm -r `kde4-config --localprefix`share/apps/soundkonverter rm `kde4-config --localprefix`share/kde4/services/ServiceMenus/add_replaygain_with_soundkonverter.desktop rm `kde4-config --localprefix`share/kde4/services/ServiceMenus/convert_with_soundkonverter.desktop this will - depending on the location of your local kde directory - result in something like: rm ~/.kde4/share/config/soundkonverterrc rm -r ~/.kde4/share/apps/soundkonverter rm ~/.kde4/share/kde4/services/ServiceMenus/add_replaygain_with_soundkonverter.desktop rm ~/.kde4/share/kde4/services/ServiceMenus/convert_with_soundkonverter.desktop Precompiled packages: ===================== You can find soundKonverter packages for various distributions with a nice download interface and some instructions at: http://software.opensuse.org/download.html?project=home:HessiJames&package=soundkonverter openSUSE users should either add the following installation source to yast: http://download.opensuse.org/repositories/home:/HessiJames/ eg.: http://download.opensuse.org/repositories/home:/HessiJames/openSUSE_12.2 for openSUSE 12.2. Or add the KDE:Extra repository (includes a lot more KDE applications). eg.: http://download.opensuse.org/repositories/KDE:/Extra/openSUSE_12.2 for openSUSE 12.2 More information about openSUSE KDE repositories: http://en.opensuse.org/KDE_repositories Ubuntu/Debian Packages are also available at http://download.opensuse.org/repositories/home:/HessiJames The packages in the xUbuntu repositories are suitable for Ubuntu as well as for all its derivatives (like Kubuntu). Quick installation guide: Open the application launcher, start a terminal and enter the following commands (each line is one command, execute them by hitting [enter]): sudo -i wget http://download.opensuse.org/repositories/home:HessiJames/xUbuntu_12.04/Release.key apt-key add - < Release.key rm Release.key echo 'deb http://download.opensuse.org/repositories/home:HessiJames/xUbuntu_12.04/ /' >> /etc/apt/sources.list apt-get update apt-get install soundkonverter Packages for distributions other than openSUSE and Ubuntu are not tested, so please tell me if something is wrong with them. If your distribution is not listed here, you should start an internet search, there might be precompiled packages for your distribution provided by somebody else. But make sure the source is trustworthy of course...! Git repository: =============== For everybody who is interested, there is a git repository at https://github.com/HessiJames/soundkonverter In order to obtain the source code from the git repository you need to install "git" and execute the following commands: initialize local git repository: git clone git://github.com/HessiJames/soundkonverter.git update repository: git pull Reporting bugs - please report every bug you find, that's the only way I can fix it: ==================================================================================== You can either leave a comment at http://kde-apps.org/content/show.php?content=29024 or write me a mail to hessijames@gmail.com but the best way is to create a bug report/ask a question at https://bugs.launchpad.net/soundkonverter Some tips for creating a useful bug report: Include the version number of soundKonverter you are using: Click "Help" in the menu bar and select "About soundKonverter...", a new window will open and the version number will be shown at the top. If you have problems converting a file, please follow these steps: 1. Try to convert the file. 2. Then open the "Log Viewer" by clicking on "Conversion" in the menu bar and selecting "View logs...". The Log Viewer will now open in a new window. 3. By default the Log Viewer will show the log of the soundKonverter application, sending me this log won't hurt. 4. But the more important log is the log for the file you just tried to convert in step 1. To see that log, click on the combo box (drop down box) at the top of the Log Viewer window and select the file. 5. To save a log to a file, click on the "Save to file..." button on the bottom of the Log Viewer. 6. Attach latter or both log files to your bug report. In case soundKonverter crashes and you can't save the conversion log file, you can make soundKonverter write log files directly to the hard drive. (disabled by default for performance reasons.) You can find this option in the advanced tab of the configuration dialog. In case of a crash: After soundKonverter has crashed a new window should appear. It's KDE's crash handler and it has two tabs. Click on the tab "Developer information" and wait a few seconds until the crash has been analyzed. You will see three stars at the top right corner indicating how useful the crash report is. If all three stars are filled your crash report is very useful otherwise it might not help. If you don't have three filled stars you can install some additional developer information. a) If you are running openSUSE you can install soundKonverter via the open build service. It is available at the KDE:Extra and the home:HessiJames repositories. In addition to the soundkonverter package these repositories also contain a soundkonverter-debuginfo package which you have to install. It contains additional developer information. After installing the soundkonverter-debuginfo package you can go back to the crash handler window and click on the "reload" button. All these steps should actually happen automatically after hitting the "install missting debug symbols" button. b) If you have installed soundKonverter from its sources you will have to compile it with debug information enabled. Have a look at the "Installation" section above. After you installed soundKonverter with debug information enabled you will have to close the crash handler window and try to reproduce the crash. c) If you are running an operating system other than openSUSE and have installed soundKonverter via a software repository chances are you can simply click on the "install missing debug symbols" button and the additional developer information get installed automatically. But I haven't tested it. In order to reproduce a crash try doing the exact same thing you did when the crash occurred. If you managed to get a useful crash report you can either directly send it to me by clicking on the "Report problems or wishes" button or even better you can copy the generated information and create a new bug report at https://bugs.launchpad.net/soundkonverter and paste them there. Participating: ============== Translations: If you would like to translate soundKonverter to your native language you can request a new translation at https://www.transifex.net/projects/p/soundkonverter Patches: You can very easily fork the current code with github. You can then work in your forked version and request a pull. Have a look at: https://github.com/HessiJames/soundkonverter ./soundkonverter-2.1.2/PaxHeaders.4329/codecoptimizations.h0000644000000000000000000000013212076525023020501 xustar0030 mtime=1358604819.202806278 30 atime=1358604819.202806278 30 ctime=1418040695.110717313 ./soundkonverter-2.1.2/codecoptimizations.h0000644000175000001440000000211412076525023021474 0ustar00danielusers00000000000000 #ifndef CODECOPTIMIZATIONS_H #define CODECOPTIMIZATIONS_H #include class QRadioButton; /** * @short Shows a message box with suggestions for optimizing the backend order * @author Daniel Faust * @version 1.0 */ class CodecOptimizations : public KDialog { Q_OBJECT public: struct Optimization { QString codecName; enum Mode { Encode, Decode, ReplayGain } mode; QString currentBackend; QString betterBackend; enum Solution { Fix, Ignore, Undecided } solution; }; /** Default Constructor */ CodecOptimizations( const QList& optimizationList, QWidget *parent=0, Qt::WFlags f=0 ); /** Default Destructor */ ~CodecOptimizations(); private: QList optimizationList; QList solutionFixButtons; private slots: void okClicked(); signals: void solutions( const QList& solutions ); }; #endif // CODECOPTIMIZATIONS_H ./soundkonverter-2.1.2/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000013212441312442017154 xustar0030 mtime=1418040610.306840485 30 atime=1418040610.305840486 30 ctime=1418040695.114717305 ./soundkonverter-2.1.2/CMakeLists.txt0000755000175000001440000000717412441312442020165 0ustar00danielusers00000000000000project(soundkonverter) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules) find_package(KDE4 REQUIRED) include(KDE4Defaults) find_package(Cdparanoia REQUIRED) find_package(Kcddb REQUIRED) set(TAGLIB_MIN_VERSION "1.4") find_package(Taglib REQUIRED) include_directories(${KDE4_INCLUDES} ${QT_INCLUDES} ${TAGLIB_INCLUDES} ${CDPARANOIA_INCLUDE_DIR}) # all the warnings about constructions set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") # strict ISO C and ISO C++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") # implicit conversions # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wconversion") # implicit conversions from signed to unsigned # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wsign-conversion") add_subdirectory(plugins) include(MacroOptionalAddSubdirectory) macro_optional_add_subdirectory( po ) set(soundkonvertercore_SRCS core/backendplugin.cpp core/conversionoptions.cpp core/codecwidget.cpp core/codecplugin.cpp core/filterplugin.cpp core/replaygainplugin.cpp core/ripperplugin.cpp ) kde4_add_library(soundkonvertercore SHARED ${soundkonvertercore_SRCS}) target_link_libraries(soundkonvertercore ${KDE4_KDEUI_LIBS} ${KDE4_KFILE_LIBS} ${KDE4_KIO_LIBS}) install(TARGETS soundkonvertercore DESTINATION ${LIB_INSTALL_DIR}) set(soundkonverter_SRCS configdialog/configdialog.cpp configdialog/configpagebase.cpp configdialog/configgeneralpage.cpp configdialog/configbackendspage.cpp configdialog/configadvancedpage.cpp configdialog/configcoverartpage.cpp metadata/tagengine.cpp metadata/MetaReplayGain.cpp opener/fileopener.cpp opener/diropener.cpp opener/cdopener.cpp opener/urlopener.cpp opener/playlistopener.cpp replaygainscanner/replaygainscanner.cpp replaygainscanner/replaygainfilelist.cpp replaygainscanner/replaygainfilelistitem.cpp replaygainscanner/replaygainprocessor.cpp global.cpp main.cpp soundkonverter.cpp soundkonverterapp.cpp soundkonverterview.cpp codecproblems.cpp codecoptimizations.cpp combobutton.cpp config.cpp conversionoptionsmanager.cpp convert.cpp convertitem.cpp filelist.cpp filelistitem.cpp logger.cpp logviewer.cpp options.cpp optionssimple.cpp optionsdetailed.cpp optionseditor.cpp optionslayer.cpp pluginloader.cpp progressindicator.cpp outputdirectory.cpp aboutplugins.cpp ) kde4_add_executable(soundkonverter ${soundkonverter_SRCS}) target_link_libraries(soundkonverter ${KDE4_KDEUI_LIBS} ${KDE4_KFILE_LIBS} ${KDE4_KIO_LIBS} ${KDE4_SOLID_LIBRARY} ${KDE4_PHONON_LIBS} ${TAGLIB_LIBRARIES} kcddb ${CDPARANOIA_LIBRARIES} soundkonvertercore) install(TARGETS soundkonverter DESTINATION ${BIN_INSTALL_DIR}) install(FILES soundkonverter.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) install(FILES soundkonverterui.rc DESTINATION ${DATA_INSTALL_DIR}/soundkonverter) install(FILES soundkonverter_codecplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) install(FILES soundkonverter_filterplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) install(FILES soundkonverter_replaygainplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) install(FILES soundkonverter_ripperplugin.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR}) install(FILES soundkonverter-rip-audiocd.desktop DESTINATION ${DATA_INSTALL_DIR}/solid/actions) add_subdirectory(icons) add_subdirectory(images) macro_display_feature_log() # uninstall target configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY) add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) ./soundkonverter-2.1.2/PaxHeaders.4329/soundkonverter.desktop0000644000000000000000000000013112303347604021103 xustar0029 mtime=1393414020.00014782 30 atime=1392132835.180797518 30 ctime=1418040695.107717316 ./soundkonverter-2.1.2/soundkonverter.desktop0000755000175000001440000000327712303347604022115 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Name=soundKonverter Exec=soundkonverter %U Icon=soundkonverter Type=Application GenericName=Audio file converter, CD ripper and Replay Gain tool GenericName[ca]=Convertidor d'arxius d'àudio, extractor de CD i eina Replay Gain GenericName[cs]=Převaděč zvukových souborů, vytahovač stop z CD a nástroj na vyrovnání hlasitosti přehrávaných skladeb GenericName[de]=Audio-Datei Konverter, CD Ripper und Replay Gain Werkzeug GenericName[es]=Conversor de archivos de audio, extractor de CD y herramienta Replay Gain GenericName[et]=Helifailide teisendaja, CD-rippija ja helitugevuse parandustööriist GenericName[fr]=Convertisseur de fichiers audio, extracteur de CD et outil de Replay Gain GenericName[hu]=Audiofájl-konverter, CD-beolvasó és hangerő-korrekciós eszköz GenericName[it]=Convertitore di file audio, estrattore di CD e strumento Replay Gain GenericName[pt]=Conversor de áudio, extração de CD e análise Replay Gain GenericName[pt_BR]=Conversor de arquivo de áudio, extração de CD e ferramenta Replay Gain GenericName[ro]=Convertor de fișiere audio, uneltă de extras CD-uri si aplicat Replay Gain GenericName[ru]=Аудиоконвертер, CD-риппер и инструмент выравнивания громкости GenericName[sl]=Pretvornik zvočni datotek, zajemalnik CD-jev in orodje za jakost predvajanja GenericName[sv]=Ljudfilkonverterare, CD-rippare och Replay Gain-verktyg GenericName[zh_CN]=音频文件转换器,CD抓轨,回放增益工具 GenericName[zh_TW]=音樂格式轉換、CD 擷取、播放增益工具 Terminal=false Categories=AudioVideo;Audio;AudioVideoEditing;KDE; X-DocPath=https://github.com/HessiJames/soundkonverter/wiki ./soundkonverter-2.1.2/PaxHeaders.4329/soundkonverter-rip-audiocd.desktop0000644000000000000000000000013212303347604023302 xustar0030 mtime=1393414020.154148468 30 atime=1392132835.180797518 30 ctime=1418040695.106717318 ./soundkonverter-2.1.2/soundkonverter-rip-audiocd.desktop0000644000175000001440000000201012303347604024270 0ustar00danielusers00000000000000[Desktop Entry] X-KDE-Solid-Predicate=OpticalDisc.availableContent & 'Audio' Type=Service Actions=Rip X-KDE-Priority=TopLevel [Desktop Action Rip] Name=Rip Audio CD with soundKonverter Name[ca]=Extreure CD d'àudio amb soundKonverter Name[cs]=Vytáhněte skladby z CD za pomoci soundKonverteru Name[de]=Audio-CD mit soundKonverter auslesen Name[es]=Extraer audio CD con soundKonverter Name[et]=Ripi audio-CD soundKonverteriga Name[fr]=Extraire le CD avec soundKonverter Name[hu]=Audio CD beolvasása a soundKonverterrel Name[it]=Estrai CD audio con soundKonverter Name[pt]=Extrair um CD áudio com o soundKonverter Name[pt_BR]=Extrair um CD de áudio com o soundKonverter Name[ro]=Extrage CD audio cu soundKonverter Name[ru]=Извлечь аудиоданные с CD с помощью soundKonverter Name[sl]=Zajemi zvočni CD s soundKonverter-jem Name[sv]=Rippa ljud CD med soundKonverter Name[zh_CN]=使用 soundKonverter 抓轨CD Name[zh_TW]=用 soundKonverter 擷取音樂CD Icon=soundkonverter Exec=soundkonverter --rip %d ./soundkonverter-2.1.2/PaxHeaders.4329/convert.h0000644000000000000000000000013212316305467016257 xustar0030 mtime=1396280119.371336483 30 atime=1396280119.370336479 30 ctime=1418040695.113717307 ./soundkonverter-2.1.2/convert.h0000644000175000001440000001007412316305467017256 0ustar00danielusers00000000000000 #ifndef CONVERT_H #define CONVERT_H #include "filelistitem.h" #include #include #include #include #include class BackendPlugin; class CDManager; class Config; class ConvertItem; class FileList; class Logger; class KJob; /** * @short The conversion engine * @author Daniel Faust */ class Convert : public QObject { Q_OBJECT public: Convert( Config *_config, FileList *_fileList, Logger *_logger, QObject *parent ); ~Convert(); void cleanUp(); private: /** Copy the file with the file list item @p item to a temporary directory and download if necessary */ void get( ConvertItem *item ); /** Convert the file */ void convert( ConvertItem *item ); /** Apply a filter to the file after it has been decoded in convert() */ void convertNextBackend( ConvertItem *item ); /** Calculate replaygain tags of the file with the convert item @p item */ void replaygain( ConvertItem *item ); /** Write the tags of the file with the convert item @p item */ void writeTags( ConvertItem *item ); // /** Run the userscript for the convert item @p item */ // void executeUserScript( ConvertItem *item ); /** Decide, what to do next with out item @p item */ void executeNextStep( ConvertItem *item ); /** Make another try for @p item */ void executeSameStep( ConvertItem *item ); /** Remove item @p item and emit the state @p state */ void remove( ConvertItem *item, FileListItem::ReturnCode returnCode = FileListItem::Succeeded ); /** holds all active files */ QList items; /** holds all items that are waiting for album gain QMap< album name,convert items list > */ QMap< QString, QList > albumGainItems; Config *config; CDManager* cdManager; FileList *fileList; Logger* logger; QMap usedOutputNames; QStringList activeVorbisGainDirectories; // vorbisgain creates temporary files with the fixed name "vorbisgain.tmp", so it must run only once per directory (https://github.com/HessiJames/soundkonverter/issues/12) struct LogQueue { int id; BackendPlugin *plugin; QStringList messages; }; QList pluginLogQueue; QTimer updateTimer; private slots: /** The file is being moved */ void kioJobProgress( KJob *job, unsigned long percent ); /** The file has been moved */ void kioJobFinished( KJob *job ); /** Get the process' output */ void processOutput(); /** The process has exited */ void processExit( int exitCode, QProcess::ExitStatus exitStatus ); /** A plugin has finished converting a file */ void pluginProcessFinished( int id, int exitCode ); /** A plugin has something to log */ void pluginLog( int id, const QString& message ); /** sums up the progresses of all processes and sends it to the ProgressIndicator */ void updateProgress(); public slots: // connected to FileList /** Add a new @p item to the item list and start */ void add( FileListItem *fileListItem ); /** Stop the item with the file list item @p item in the item list and remove it */ void kill( FileListItem *fileListItem ); /** the file list item @p item will get removed */ void itemRemoved( FileListItem *fileListItem ); /** Change the process priorities */ // void priorityChanged( int ); signals: // connected to FileList /** The conversion of an item has finished and the state is reported */ void finished( FileListItem *fileListItem, FileListItem::ReturnCode returnCode, bool waitingForAlbumGain = false ); /** The next track from the device can be ripped while the track is being encoded */ void rippingFinished( const QString& device ); // connected to Logger /** Tell the logger that the process has finished */ void finishedProcess( int id, bool succeeded, bool waitingForAlbumGain = false ); // connected to ProgressIndicator void updateTime( float timeProgress ); void timeFinished( float timeDelta ); }; #endif // CONVERT_H ./soundkonverter-2.1.2/PaxHeaders.4329/plugins0000644000000000000000000000012012203641422016014 xustar0030 mtime=1376731922.174548846 20 atime=1358274329 30 ctime=1418040695.167717219 ./soundkonverter-2.1.2/plugins/0000755000175000001440000000000012203641422017071 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_replaygain_vorbisgain0000644000000000000000000000012012076525023025550 xustar0030 mtime=1358604819.253806417 20 atime=1358274330 30 ctime=1418040695.155717238 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_vorbisgain/0000755000175000001440000000000012076525023026625 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_vorbisgain/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006211726605551030400 xustar0020 atime=1308763307 30 ctime=1418040695.155717238 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_vorbisgain/CMakeLists.txt0000755000175000001440000000124211726605551031375 0ustar00danielusers00000000000000project(soundkonverter_replaygain_vorbisgain) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_replaygain_vorbisgain_SRCS soundkonverter_replaygain_vorbisgain.cpp ) kde4_add_plugin(soundkonverter_replaygain_vorbisgain ${soundkonverter_replaygain_vorbisgain_SRCS}) target_link_libraries(soundkonverter_replaygain_vorbisgain ${KDE4_KDEUI_LIBS} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_replaygain_vorbisgain DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_replaygain_vorbisgain.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_vorbisgain/PaxHeaders.4329/vorbisreplaygain0000644000000000000000000000006211200043671031125 xustar0020 atime=1416311950 30 ctime=1418040695.155717238 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_vorbisgain/vorbisreplaygainglobal.h0000644000175000001440000000011411200043671033523 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "Vorbis Gain" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_vorbisgain/PaxHeaders.4329/soundkonverter_r0000644000000000000000000000025411271067053031171 xustar00122 path=./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_vorbisgain/soundkonverter_replaygain_vorbisgain.desktop 20 atime=1308601627 30 ctime=1418040695.155717238 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_vorbisgain/soundkonverter_replaygain_vorbis0000755000175000001440000000057011271067053035444 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter vorbisgain plugin X-KDE-Library=soundkonverter_replaygain_vorbisgain ServiceTypes=soundKonverter/ReplayGainPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_replaygain_vorbisgain X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_vorbisgain/PaxHeaders.4329/soundkonverter_r0000644000000000000000000000025012076525023031165 xustar00118 path=./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_vorbisgain/soundkonverter_replaygain_vorbisgain.cpp 20 atime=1418040443 30 ctime=1418040695.155717238 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_vorbisgain/soundkonverter_replaygain_vorbis0000755000175000001440000001131512076525023035443 0ustar00danielusers00000000000000 #include "vorbisreplaygainglobal.h" #include "soundkonverter_replaygain_vorbisgain.h" soundkonverter_replaygain_vorbisgain::soundkonverter_replaygain_vorbisgain( QObject *parent, const QStringList& args ) : ReplayGainPlugin( parent ) { Q_UNUSED(args) binaries["vorbisgain"] = ""; allCodecs += "ogg vorbis"; } soundkonverter_replaygain_vorbisgain::~soundkonverter_replaygain_vorbisgain() {} QString soundkonverter_replaygain_vorbisgain::name() { return global_plugin_name; } QList soundkonverter_replaygain_vorbisgain::codecTable() { QList table; ReplayGainPipe newPipe; newPipe.codecName = "ogg vorbis"; newPipe.rating = 100; newPipe.enabled = ( binaries["vorbisgain"] != "" ); newPipe.problemInfo = standardMessage( "replygain_codec,backend", "ogg vorbis", "vorbisgain" ) + "\n" + standardMessage( "install_opensource_backend", "vorbisgain" ); table.append( newPipe ); return table; } bool soundkonverter_replaygain_vorbisgain::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_replaygain_vorbisgain::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_replaygain_vorbisgain::hasInfo() { return false; } void soundkonverter_replaygain_vorbisgain::showInfo( QWidget *parent ) { Q_UNUSED(parent) } unsigned int soundkonverter_replaygain_vorbisgain::apply( const KUrl::List& fileList, ReplayGainPlugin::ApplyMode mode ) { if( fileList.count() <= 0 ) return BackendPlugin::UnknownError; ReplayGainPluginItem *newItem = new ReplayGainPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->data.fileCount = fileList.count(); QStringList command; command += binaries["vorbisgain"]; if( mode == ReplayGainPlugin::Add ) { command += "--album"; command += "--fast"; } else if( mode == ReplayGainPlugin::Force ) { command += "--album"; } else { command += "--clean"; } foreach( const KUrl file, fileList ) { command += "\"" + escapeUrl(file) + "\""; } newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } // float soundkonverter_replaygain_vorbisgain::parseOutput( const QString& output, BackendPluginItem *backendItem ) TODO ogg replaygain fix float soundkonverter_replaygain_vorbisgain::parseOutput( const QString& output, ReplayGainPluginItem *replayGainItem ) { float progress = -1; // -12.14 dB | 46927 | 0.25 | 11599 | 03 - Sugar.ogg // 59% - 04 - Suggestions.ogg QRegExp regApply("(\\d+)%"); if( output.contains(regApply) ) { progress = (float)regApply.cap(1).toInt(); } if( progress == -1 ) return -1; if( !replayGainItem ) return progress; if( progress > 90 && replayGainItem->data.lastFileProgress <= 90 ) { replayGainItem->data.processedFiles++; } replayGainItem->data.lastFileProgress = progress; int processedFiles = replayGainItem->data.processedFiles; if( progress > 90 ) processedFiles--; return float( processedFiles * 100 + progress ) / replayGainItem->data.fileCount; } float soundkonverter_replaygain_vorbisgain::parseOutput( const QString& output ) { return parseOutput( output, 0 ); } void soundkonverter_replaygain_vorbisgain::processOutput() { ReplayGainPluginItem *pluginItem; float progress; for( int i=0; iprocess == QObject::sender() ) { const QString output = backendItems.at(i)->process->readAllStandardOutput().data(); pluginItem = qobject_cast(backendItems.at(i)); progress = parseOutput( output, pluginItem ); if( progress == -1 && !output.simplified().isEmpty() ) emit log( backendItems.at(i)->id, output ); if( progress > backendItems.at(i)->progress ) backendItems.at(i)->progress = progress; return; } } } #include "soundkonverter_replaygain_vorbisgain.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_vorbisgain/PaxHeaders.4329/soundkonverter_r0000644000000000000000000000031612076525023031170 xustar00116 path=./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_vorbisgain/soundkonverter_replaygain_vorbisgain.h 30 mtime=1358604819.253806417 30 atime=1358604819.253806417 30 ctime=1418040695.155717238 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_vorbisgain/soundkonverter_replaygain_vorbis0000755000175000001440000000224512076525023035445 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_REPLAYGAIN_VORBISGAIN_H #define SOUNDKONVERTER_REPLAYGAIN_VORBISGAIN_H #include "../../core/replaygainplugin.h" #include class ConversionOptions; class soundkonverter_replaygain_vorbisgain : public ReplayGainPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_replaygain_vorbisgain( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_replaygain_vorbisgain(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); unsigned int apply( const KUrl::List& fileList, ApplyMode mode = Add ); float parseOutput( const QString& output, ReplayGainPluginItem *replayGainItem ); float parseOutput( const QString& output ); private slots: /** Get the process' output */ void processOutput(); }; K_EXPORT_SOUNDKONVERTER_REPLAYGAIN( vorbisgain, soundkonverter_replaygain_vorbisgain ) #endif // _SOUNDKONVERTER_REPLAYGAIN_VORBISGAIN_H_ ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_ripper_cdparanoia0000644000000000000000000000012012310065734024653 xustar0030 mtime=1394633692.662040691 20 atime=1358274330 30 ctime=1418040695.156717236 ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_cdparanoia/0000755000175000001440000000000012310065734025730 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_ripper_cdparanoia/PaxHeaders.4329/soundkonverter_rippe0000644000000000000000000000024411271067021031145 xustar00114 path=./soundkonverter-2.1.2/plugins/soundkonverter_ripper_cdparanoia/soundkonverter_ripper_cdparanoia.desktop 20 atime=1308601627 30 ctime=1418040695.156717236 ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_cdparanoia/soundkonverter_ripper_cdparanoia.des0000755000175000001440000000055411271067021035262 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter cdparanoia plugin X-KDE-Library=soundkonverter_ripper_cdparanoia ServiceTypes=soundKonverter/RipperPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_ripper_cdparanoia X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_cdparanoia/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006211726605536027507 xustar0020 atime=1308763307 30 ctime=1418040695.156717236 ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_cdparanoia/CMakeLists.txt0000755000175000001440000000120211726605536030500 0ustar00danielusers00000000000000project(soundkonverter_ripper_cdparanoia) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_ripper_cdparanoia_SRCS soundkonverter_ripper_cdparanoia.cpp ) kde4_add_plugin(soundkonverter_ripper_cdparanoia ${soundkonverter_ripper_cdparanoia_SRCS}) target_link_libraries(soundkonverter_ripper_cdparanoia ${KDE4_KDEUI_LIBS} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_ripper_cdparanoia DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_ripper_cdparanoia.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_cdparanoia/PaxHeaders.4329/cdparanoiaripperglob0000644000000000000000000000006211271064043031044 xustar0020 atime=1416311951 30 ctime=1418040695.156717236 ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_cdparanoia/cdparanoiaripperglobal.h0000644000175000001440000000011311271064043032575 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "cdparanoia" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_cdparanoia/PaxHeaders.4329/soundkonverter_rippe0000644000000000000000000000006212310065734031147 xustar0020 atime=1418040446 30 ctime=1418040695.156717236 ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_cdparanoia/soundkonverter_ripper_cdparanoia.cpp0000755000175000001440000002757412310065734035310 0ustar00danielusers00000000000000 #include "cdparanoiaripperglobal.h" #include "soundkonverter_ripper_cdparanoia.h" #include #include #include #include #include #include #include #include #include soundkonverter_ripper_cdparanoia::soundkonverter_ripper_cdparanoia( QObject *parent, const QStringList& args ) : RipperPlugin( parent ) { Q_UNUSED(args) binaries["cdparanoia"] = ""; KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); forceReadSpeed = group.readEntry( "forceReadSpeed", 0 ); forceEndianness = group.readEntry( "forceEndianness", 0 ); maximumRetries = group.readEntry( "maximumRetries", 20 ); enableParanoia = group.readEntry( "enableParanoia", true ); enableExtraParanoia = group.readEntry( "enableExtraParanoia", true ); } soundkonverter_ripper_cdparanoia::~soundkonverter_ripper_cdparanoia() {} QString soundkonverter_ripper_cdparanoia::name() { return global_plugin_name; } QList soundkonverter_ripper_cdparanoia::codecTable() { QList table; ConversionPipeTrunk newTrunk; newTrunk.codecFrom = "audio cd"; newTrunk.codecTo = "wav"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["cdparanoia"] != "" ); newTrunk.data.canRipEntireCd = true; newTrunk.problemInfo = i18n( "In order to rip audio cds per track or to a single file, you need to install 'cdparanoia'.\n'cdparanoia' is usually shipped with your distribution, the package name can vary." ); table.append( newTrunk ); return table; } bool soundkonverter_ripper_cdparanoia::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return true; } void soundkonverter_ripper_cdparanoia::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) if( !configDialog.data() ) { configDialog = new KDialog( parent ); configDialog.data()->setCaption( i18n("Configure %1").arg(global_plugin_name) ); configDialog.data()->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Default ); QWidget *configDialogWidget = new QWidget( configDialog.data() ); QVBoxLayout *configDialogBox = new QVBoxLayout( configDialogWidget ); QHBoxLayout *configDialogBox0 = new QHBoxLayout(); configDialogForceReadSpeedCheckBox = new QCheckBox( i18n("Force read speed:"), configDialogWidget ); configDialogBox0->addWidget( configDialogForceReadSpeedCheckBox ); configDialogForceReadSpeedSpinBox = new QSpinBox( configDialogWidget ); configDialogForceReadSpeedSpinBox->setRange(1, 64); configDialogForceReadSpeedSpinBox->setSuffix(" x"); configDialogBox0->addWidget( configDialogForceReadSpeedSpinBox ); configDialogBox->addLayout( configDialogBox0 ); connect( configDialogForceReadSpeedCheckBox, SIGNAL( stateChanged(int) ), this, SLOT( configDialogForceReadSpeedChanged(int) ) ); QHBoxLayout *configDialogBox1 = new QHBoxLayout(); QLabel *configDialogForceEndiannessLabel = new QLabel( i18nc("Byte-Order", "Endianness:"), configDialogWidget ); configDialogBox1->addWidget( configDialogForceEndiannessLabel ); configDialogForceEndiannessComboBox = new QComboBox( configDialogWidget ); configDialogForceEndiannessComboBox->addItem( "Auto" ); configDialogForceEndiannessComboBox->addItem( "Little endian" ); configDialogForceEndiannessComboBox->addItem( "Big endian" ); configDialogBox1->addWidget( configDialogForceEndiannessComboBox ); configDialogBox->addLayout( configDialogBox1 ); QHBoxLayout *configDialogBox2 = new QHBoxLayout(); QLabel *configDialogMaximumRetriesLabel = new QLabel( i18n("Maximum read retries:"), configDialogWidget ); configDialogBox2->addWidget( configDialogMaximumRetriesLabel ); configDialogMaximumRetriesSpinBox = new QSpinBox( configDialogWidget ); configDialogMaximumRetriesSpinBox->setRange(0, 100); configDialogBox2->addWidget( configDialogMaximumRetriesSpinBox ); configDialogBox->addLayout( configDialogBox2 ); QHBoxLayout *configDialogBox3 = new QHBoxLayout( configDialogWidget ); configDialogEnableParanoiaCheckBox = new QCheckBox( i18n("Enable paranoia"), configDialogWidget ); configDialogBox3->addWidget( configDialogEnableParanoiaCheckBox ); configDialogBox->addLayout( configDialogBox3 ); QHBoxLayout *configDialogBox4 = new QHBoxLayout( configDialogWidget ); configDialogEnableExtraParanoiaCheckBox = new QCheckBox( i18n("Enable extra paranoia"), configDialogWidget ); configDialogBox4->addWidget( configDialogEnableExtraParanoiaCheckBox ); configDialogBox->addLayout( configDialogBox4 ); configDialog.data()->setMainWidget( configDialogWidget ); connect( configDialog.data(), SIGNAL( okClicked() ), this, SLOT( configDialogSave() ) ); connect( configDialog.data(), SIGNAL( defaultClicked() ), this, SLOT( configDialogDefault() ) ); } configDialogForceReadSpeedCheckBox->setChecked( forceReadSpeed > 0 ); configDialogForceReadSpeedSpinBox->setValue( forceReadSpeed ); configDialogForceEndiannessComboBox->setCurrentIndex( forceEndianness ); configDialogMaximumRetriesSpinBox->setValue( maximumRetries ); configDialogEnableParanoiaCheckBox->setChecked( enableParanoia ); configDialogEnableExtraParanoiaCheckBox->setChecked( enableExtraParanoia ); configDialogForceReadSpeedChanged( configDialogForceReadSpeedCheckBox->checkState() ); configDialog.data()->show(); } void soundkonverter_ripper_cdparanoia::configDialogForceReadSpeedChanged( int state ) { if( configDialog.data() ) { configDialogForceReadSpeedSpinBox->setEnabled( state == Qt::Checked ); } } void soundkonverter_ripper_cdparanoia::configDialogSave() { if( configDialog.data() ) { forceReadSpeed = configDialogForceReadSpeedCheckBox->isChecked() ? configDialogForceReadSpeedSpinBox->value() : 0; forceEndianness = configDialogForceEndiannessComboBox->currentIndex(); maximumRetries = configDialogMaximumRetriesSpinBox->value(); enableParanoia = configDialogEnableParanoiaCheckBox->isChecked(); enableExtraParanoia = configDialogEnableExtraParanoiaCheckBox->isChecked(); KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); group.writeEntry( "forceReadSpeed", forceReadSpeed ); group.writeEntry( "forceEndianness", forceEndianness ); group.writeEntry( "maximumRetries", maximumRetries ); group.writeEntry( "enableParanoia", enableParanoia ); group.writeEntry( "enableExtraParanoia", enableExtraParanoia ); configDialog.data()->deleteLater(); } } void soundkonverter_ripper_cdparanoia::configDialogDefault() { if( configDialog.data() ) { configDialogForceReadSpeedCheckBox->setChecked( false ); configDialogForceReadSpeedSpinBox->setValue( 1 ); configDialogForceEndiannessComboBox->setCurrentIndex( 0 ); configDialogMaximumRetriesSpinBox->setValue( 20 ); configDialogEnableParanoiaCheckBox->setChecked( true ); configDialogEnableExtraParanoiaCheckBox->setChecked( true ); } } bool soundkonverter_ripper_cdparanoia::hasInfo() { return false; } void soundkonverter_ripper_cdparanoia::showInfo( QWidget *parent ) { Q_UNUSED(parent) } unsigned int soundkonverter_ripper_cdparanoia::rip( const QString& device, int track, int tracks, const KUrl& outputFile ) { QStringList command; command += binaries["cdparanoia"]; command += "--stderr-progress"; command += "--force-cdrom-device"; command += device; if( forceReadSpeed > 0 ) { command += "--force-read-speed"; command += QString::number(forceReadSpeed); } if( forceEndianness == 1 ) { command += "--force-cdrom-little-endian"; } else if( forceEndianness == 2 ) { command += "--force-cdrom-big-endian"; } command += "--never-skip=" + QString::number(maximumRetries); if( !enableExtraParanoia ) { if( !enableParanoia ) { command += "--disable-paranoia"; } else { command += "--disable-extra-paranoia"; } } else if( !enableParanoia ) { command += "--disable-paranoia"; } if( track > 0 ) { command += QString::number(track); } else { command += "1-" + QString::number(tracks); } command += "\"" + outputFile.toLocalFile() + "\""; RipperPluginItem *newItem = new RipperPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_ripper_cdparanoia::ripCommand( const QString& device, int track, int tracks, const KUrl& outputFile ) { Q_UNUSED(device) Q_UNUSED(track) Q_UNUSED(tracks) Q_UNUSED(outputFile) return QStringList(); } float soundkonverter_ripper_cdparanoia::parseOutput( const QString& output, int *fromSector, int *toSector ) { // Ripping from sector 0 (track 1 [0:00.00]) // to sector 16361 (track 1 [3:38.11]) // ##: -2 [wrote] @ 19242887\n if( output.contains("sector") ) { if( fromSector && output.contains("from sector") ) { QString data = output; data.remove( 0, data.indexOf("from sector") + 11 ); data = data.left( data.indexOf("(") ); data = data.simplified(); *fromSector = data.toInt(); } if( toSector && output.contains("to sector") ) { QString data = output; data.remove( 0, data.indexOf("to sector") + 9 ); data = data.left( data.indexOf("(") ); data = data.simplified(); *toSector = data.toInt(); } return -1; } if( output == "" || !output.contains("@") ) return -1; if( !output.contains("[wrote] @") ) return 0; QString data = output; data.remove( 0, data.indexOf("[wrote] @") + 9 ); data = data.left( data.indexOf("\n") ); data = data.simplified(); return data.toFloat() / 1176; } float soundkonverter_ripper_cdparanoia::parseOutput( const QString& output ) { return parseOutput( output, 0, 0 ); } void soundkonverter_ripper_cdparanoia::processOutput() { RipperPluginItem *pluginItem; float progress; for( int i=0; iprocess == QObject::sender() ) { QString output = backendItems.at(i)->process->readAllStandardOutput().data(); pluginItem = qobject_cast(backendItems.at(i)); progress = parseOutput( output, &pluginItem->data.fromSector, &pluginItem->data.toSector ); if( progress == -1 && !output.simplified().isEmpty() ) logOutput( backendItems.at(i)->id, output ); progress = (progress-pluginItem->data.fromSector) * 100 / (pluginItem->data.toSector-pluginItem->data.fromSector); if( progress > backendItems.at(i)->progress ) backendItems.at(i)->progress = progress; return; } } } #include "soundkonverter_ripper_cdparanoia.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_cdparanoia/PaxHeaders.4329/soundkonverter_rippe0000644000000000000000000000013212230771131031141 xustar0030 mtime=1382281817.560396192 30 atime=1382281817.560396192 30 ctime=1418040695.156717236 ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_cdparanoia/soundkonverter_ripper_cdparanoia.h0000755000175000001440000000373012230771131034735 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_RIPPER_CDPARANOIA_H #define SOUNDKONVERTER_RIPPER_CDPARANOIA_H #include "../../core/ripperplugin.h" #include #include #include #include class KDialog; class QCheckBox; class QComboBox; class QSpinBox; class soundkonverter_ripper_cdparanoia : public RipperPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_ripper_cdparanoia( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_ripper_cdparanoia(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); unsigned int rip( const QString& device, int track, int tracks, const KUrl& outputFile ); QStringList ripCommand( const QString& device, int track, int tracks, const KUrl& outputFile ); float parseOutput( const QString& output, int *fromSector, int *toSector ); float parseOutput( const QString& output ); private slots: /** Get the process' output */ void processOutput(); private: QWeakPointer configDialog; QCheckBox *configDialogForceReadSpeedCheckBox; QSpinBox *configDialogForceReadSpeedSpinBox; QComboBox *configDialogForceEndiannessComboBox; QSpinBox *configDialogMaximumRetriesSpinBox; QCheckBox *configDialogEnableParanoiaCheckBox; QCheckBox *configDialogEnableExtraParanoiaCheckBox; int configVersion; int forceReadSpeed; int forceEndianness; int maximumRetries; bool enableParanoia; bool enableExtraParanoia; private slots: void configDialogForceReadSpeedChanged( int state ); void configDialogSave(); void configDialogDefault(); }; K_EXPORT_SOUNDKONVERTER_RIPPER( cdparanoia, soundkonverter_ripper_cdparanoia ) #endif // SOUNDKONVERTER_RIPPER_CDPARANOIA_H ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_filter_sox0000644000000000000000000000013212276433677023372 xustar0030 mtime=1392129983.986103354 30 atime=1358604819.247806401 30 ctime=1418040695.162717227 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/0000755000175000001440000000000012276433677024444 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/PaxHeaders.4329/soxcodecwidget.h0000644000000000000000000000013212076525023026614 xustar0030 mtime=1358604819.249806407 30 atime=1358604819.249806407 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/soxcodecwidget.h0000644000175000001440000000263012076525023027612 0ustar00danielusers00000000000000 #ifndef SOXCODECWIDGET_H #define SOXCODECWIDGET_H #include "../../core/codecwidget.h" class QCheckBox; class QSlider; class QSpinBox; class QDoubleSpinBox; class QLabel; class KComboBox; class KLineEdit; class SoxCodecWidget : public CodecWidget { Q_OBJECT public: SoxCodecWidget(); ~SoxCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *_options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: // flac QLabel *lCompressionLevel; QSlider *sCompressionLevel; QSpinBox *iCompressionLevel; // mp2, mp3 and ogg vorbis QLabel *lMode; KComboBox *cMode; QLabel *lQuality; QSlider *sQuality; QDoubleSpinBox *dQuality; // amr nb and amr wb QLabel *lBitratePreset; KComboBox *cBitratePreset; QCheckBox *cCmdArguments; KLineEdit *lCmdArguments; QString currentFormat; // holds the current output file format private slots: void compressionLevelSliderChanged( int quality ); void compressionLevelSpinBoxChanged( int quality ); void modeChanged( int mode ); void qualitySliderChanged( int quality ); void qualitySpinBoxChanged( double quality ); }; #endif // SOXCODECWIDGET_H ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000013212076525023026170 xustar0030 mtime=1358604819.248806404 30 atime=1358604819.248806404 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/CMakeLists.txt0000755000175000001440000000127212076525023027172 0ustar00danielusers00000000000000project(soundkonverter_filter_sox) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_filter_sox_SRCS soundkonverter_filter_sox.cpp soxfilteroptions.cpp soxcodecwidget.cpp soxfilterwidget.cpp soxeffectwidget.cpp ) kde4_add_plugin(soundkonverter_filter_sox ${soundkonverter_filter_sox_SRCS}) target_link_libraries(soundkonverter_filter_sox ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_filter_sox DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_filter_sox.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/PaxHeaders.4329/soundkonverter_filter_sox.h0000644000000000000000000000013212076525023031127 xustar0030 mtime=1358604819.248806404 30 atime=1358604819.248806404 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/soundkonverter_filter_sox.h0000755000175000001440000000435712076525023032140 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_FILTER_SOX_H #define SOUNDKONVERTER_FILTER_SOX_H #include "../../core/filterplugin.h" #include #include class FilterOptions; class KDialog; class KComboBox; class soundkonverter_filter_sox : public FilterPlugin { Q_OBJECT public: struct SoxCodecData { QString codecName; QString soxCodecName; bool external; bool experimental; bool enabled; }; /** Default Constructor */ soundkonverter_filter_sox( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_filter_sox(); QString name(); int version(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); FilterWidget *newFilterWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output ); FilterOptions *filterOptionsFromXml( QDomElement filterOptions ); private: QList codecList; QWeakPointer infoProcess; QString infoProcessOutputData; QWeakPointer configDialog; KComboBox *configDialogSamplingRateQualityComboBox; int configVersion; QString samplingRateQuality; bool experimentalEffectsEnabled; QDateTime soxLastModified; QSet soxCodecList; QString soxCodecName( const QString& codecName ); private slots: void configDialogSave(); void configDialogDefault(); void infoProcessOutput(); void infoProcessExit( int exitCode, QProcess::ExitStatus exitStatus ); }; K_EXPORT_SOUNDKONVERTER_FILTER( sox, soundkonverter_filter_sox ) #endif // SOUNDKONVERTER_FILTER_SOX_H ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/PaxHeaders.4329/soxfilterwidget.cpp0000644000000000000000000000006212276433677027400 xustar0020 atime=1397391138 30 ctime=1418040695.162717227 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/soxfilterwidget.cpp0000644000175000001440000001706712276433677030406 0ustar00danielusers00000000000000 #include "soxfilterglobal.h" #include "soxfilterwidget.h" #include "soxeffectwidget.h" #include "soxfilteroptions.h" #include #include #include #include #include #include SoxFilterWidget::SoxFilterWidget() : FilterWidget() { const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); int gridRow = 0; QGridLayout *grid = new QGridLayout( this ); grid->setMargin( 0 ); // set up filter options selection QHBoxLayout *box1 = new QHBoxLayout(); grid->addLayout( box1, gridRow++, 0 ); chSampleRate = new QCheckBox( i18n("Sample rate:"), this ); connect( chSampleRate, SIGNAL(toggled(bool)), SIGNAL(optionsChanged()) ); box1->addWidget( chSampleRate ); cSampleRate = new KComboBox( this ); cSampleRate->addItem( "8000 Hz" ); cSampleRate->addItem( "11025 Hz" ); cSampleRate->addItem( "12000 Hz" ); cSampleRate->addItem( "16000 Hz" ); cSampleRate->addItem( "22050 Hz" ); cSampleRate->addItem( "24000 Hz" ); cSampleRate->addItem( "32000 Hz" ); cSampleRate->addItem( "44100 Hz" ); cSampleRate->addItem( "48000 Hz" ); cSampleRate->setCurrentIndex( 7 ); cSampleRate->setEditable( true ); cSampleRate->setEnabled( false ); connect( cSampleRate, SIGNAL(activated(int)), SIGNAL(optionsChanged()) ); box1->addWidget( cSampleRate ); connect( chSampleRate, SIGNAL(toggled(bool)), cSampleRate, SLOT(setEnabled(bool)) ); box1->addSpacing( fontHeight ); chSampleSize = new QCheckBox( i18n("Sample size:"), this ); connect( chSampleSize, SIGNAL(toggled(bool)), SIGNAL(optionsChanged()) ); box1->addWidget( chSampleSize ); cSampleSize = new KComboBox( this ); cSampleSize->addItem( "8 bit" ); cSampleSize->addItem( "16 bit" ); cSampleSize->addItem( "24 bit" ); cSampleSize->addItem( "32 bit" ); cSampleSize->setCurrentIndex( 1 ); cSampleSize->setEditable( true ); cSampleSize->setEnabled( false ); box1->addWidget( cSampleSize ); connect( chSampleSize, SIGNAL(toggled(bool)), cSampleSize, SLOT(setEnabled(bool)) ); box1->addSpacing( fontHeight ); chChannels = new QCheckBox( i18n("Channels:"), this ); connect( chChannels, SIGNAL(toggled(bool)), SIGNAL(optionsChanged()) ); box1->addWidget( chChannels ); cChannels = new KComboBox( this ); cChannels->addItem( i18n("Mono") ); cChannels->addItem( i18n("Stereo") ); cChannels->setEnabled( false ); box1->addWidget( cChannels ); connect( chChannels, SIGNAL(toggled(bool)), cChannels, SLOT(setEnabled(bool)) ); box1->addStretch(); effectWidgetsBox = new QVBoxLayout(); grid->addLayout( effectWidgetsBox, gridRow++, 0 ); SoxEffectWidget *effectWidget = new SoxEffectWidget( this ); effectWidget->setAddButtonShown( true ); effectWidget->setRemoveButtonShown( false ); connect( effectWidget, SIGNAL(addEffectWidgetClicked()), this, SLOT(addEffectWidgetClicked()) ); connect( effectWidget, SIGNAL(removeEffectWidgetClicked(SoxEffectWidget*)), this, SLOT(removeEffectWidgetClicked(SoxEffectWidget*)) ); effectWidgetsBox->addWidget( effectWidget ); effectWidgets.append( effectWidget ); } SoxFilterWidget::~SoxFilterWidget() {} FilterOptions* SoxFilterWidget::currentFilterOptions() { bool valid = false; SoxFilterOptions *options = new SoxFilterOptions(); if( chSampleRate->isChecked() ) { options->data.sampleRate = cSampleRate->currentText().replace(" Hz","").toInt(); valid = true; } else { options->data.sampleRate = 0; } if( chSampleSize->isChecked() ) { options->data.sampleSize = cSampleSize->currentText().replace(" bit","").toInt(); valid = true; } else { options->data.sampleSize = 0; } if( chChannels->isChecked() ) { options->data.channels = cChannels->currentIndex() + 1; valid = true; } else { options->data.channels = 0; } foreach( SoxEffectWidget *effectWidget, effectWidgets ) { const SoxFilterOptions::EffectData data = effectWidget->currentEffectOptions(); if( data.effectName != i18n("Disabled") ) { options->data.effects.append( data ); valid = true; } } if( valid ) { return options; } else { return 0; } } bool SoxFilterWidget::setCurrentFilterOptions( FilterOptions *_options ) { // reset effect widgets for( int i=1; iremoveWidget( effectWidgets.at(i) ); effectWidgets.at(i)->deleteLater(); effectWidgets.removeAt( i ); i--; } if( !effectWidgets.isEmpty() && effectWidgets.last() ) // really should always be true { SoxFilterOptions::EffectData effectData; effectWidgets.last()->setEffectOptions( effectData ); effectWidgets.last()->setAddButtonShown( true ); if( effectWidgets.count() == 1 ) effectWidgets.last()->setRemoveButtonShown( false ); } if( !_options ) { chSampleRate->setChecked( false ); chSampleSize->setChecked( false ); chChannels->setChecked( false ); return true; } if( _options->pluginName != global_plugin_name ) return false; SoxFilterOptions *options = dynamic_cast(_options); chSampleRate->setChecked( options->data.sampleRate > 0 ); if( options->data.sampleRate > 0 ) { cSampleRate->setCurrentItem( QString::number(options->data.sampleRate) + " Hz" ); } chSampleSize->setChecked( options->data.sampleSize > 0 ); if( options->data.sampleSize > 0 ) { cSampleSize->setCurrentItem( QString::number(options->data.sampleSize) + " bit" ); } chChannels->setChecked( options->data.channels > 0 ); if( options->data.channels > 0 ) { cChannels->setCurrentIndex( options->data.channels - 1 ); } bool first = true; foreach( const SoxFilterOptions::EffectData effectData, options->data.effects ) { if( !first ) addEffectWidgetClicked(); effectWidgets.last()->setEffectOptions( effectData ); first = false; } return true; } void SoxFilterWidget::addEffectWidgetClicked() { if( !effectWidgets.isEmpty() && effectWidgets.last() ) // really should alway be true { effectWidgets.last()->setAddButtonShown( false ); effectWidgets.last()->setRemoveButtonShown( true ); } SoxEffectWidget *effectWidget = new SoxEffectWidget( this ); effectWidget->setAddButtonShown( true ); effectWidget->setRemoveButtonShown( true ); connect( effectWidget, SIGNAL(addEffectWidgetClicked()), this, SLOT(addEffectWidgetClicked()) ); connect( effectWidget, SIGNAL(removeEffectWidgetClicked(SoxEffectWidget*)), this, SLOT(removeEffectWidgetClicked(SoxEffectWidget*)) ); effectWidgetsBox->addWidget( effectWidget ); effectWidgets.append( effectWidget ); } void SoxFilterWidget::removeEffectWidgetClicked( SoxEffectWidget *widget ) { if( !widget ) return; const int index = effectWidgets.indexOf( widget ); if( index != -1 ) { effectWidgetsBox->removeWidget( widget ); widget->deleteLater(); effectWidgets.removeAt( index ); } if( !effectWidgets.isEmpty() && effectWidgets.last() ) // really should alway be true { effectWidgets.last()->setAddButtonShown( true ); if( effectWidgets.count() == 1 ) effectWidgets.last()->setRemoveButtonShown( false ); } } ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/PaxHeaders.4329/soxfilteroptions.h0000644000000000000000000000013012076525023027232 xustar0029 mtime=1358604819.25080641 29 atime=1358604819.25080641 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/soxfilteroptions.h0000644000175000001440000000124712076525023030235 0ustar00danielusers00000000000000 #ifndef SOXFILTEROPTIONS_H #define SOXFILTEROPTIONS_H #include "../../core/conversionoptions.h" class SoxFilterOptions : public FilterOptions { public: SoxFilterOptions(); ~SoxFilterOptions(); bool equals( FilterOptions *_other ); QDomElement toXml( QDomDocument document, const QString elementName ); bool fromXml( QDomElement filterOptions ); struct EffectData { QString effectName; QVariantList data; }; struct Data { int sampleRate; // 0 if disabled int sampleSize; // 0 if disabled short channels; // 0 if disabled QList effects; } data; }; #endif // SOXFILTEROPTIONS_H ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/PaxHeaders.4329/soundkonverter_filter_sox.c0000644000000000000000000000006212276145051031125 xustar0020 atime=1418040443 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/soundkonverter_filter_sox.cpp0000755000175000001440000004426412276145051032475 0ustar00danielusers00000000000000 #include "soxfilterglobal.h" #include "soundkonverter_filter_sox.h" #include "../../core/conversionoptions.h" #include "soxfilteroptions.h" #include "soxfilterwidget.h" #include "soxcodecwidget.h" #include #include #include #include #include #include soundkonverter_filter_sox::soundkonverter_filter_sox( QObject *parent, const QStringList& args ) : FilterPlugin( parent ) { Q_UNUSED(args) binaries["sox"] = ""; KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); configVersion = group.readEntry( "configVersion", 0 ); samplingRateQuality = group.readEntry( "samplingRateQuality", "high" ); experimentalEffectsEnabled = group.readEntry( "experimentalEffectsEnabled", false ); soxLastModified = group.readEntry( "soxLastModified", QDateTime() ); soxCodecList = group.readEntry( "codecList", QStringList() ).toSet(); SoxCodecData data; // 8svx aif aifc aiff aiffc al amb amr-nb amr-wb anb au avr awb caf cdda cdr cvs cvsd cvu dat dvms f32 f4 f64 f8 fap flac fssd gsm gsrt hcom htk ima ircam la lpc lpc10 lu mat mat4 mat5 maud mp2 mp3 nist ogg paf prc pvf raw s1 s16 s2 s24 s3 s32 s4 s8 sb sd2 sds sf sl sln smp snd sndfile sndr sndt sou sox sph sw txw u1 u16 u2 u24 u3 u32 u4 u8 ub ul uw vms voc vorbis vox w64 wav wavpcm wv wve xa xi // todo // al amb anb au avr awb caf cdda cdr cvs cvsd cvu dat dvms f32 f4 f64 f8 fap fssd gsm gsrt hcom htk ima ircam la lpc lpc10 lu mat mat4 mat5 maud nist ogg paf prc pvf raw s1 s16 s2 s24 s3 s32 s4 s8 sb sd2 sds sf sl sln smp snd sndfile sndr sndt sou sox sph sw txw u1 u16 u2 u24 u3 u32 u4 u8 ub ul uw vms voc vox w64 wavpcm wv wve xa xi // WARNING enabled codecs need to be rescanned everytime new codecs are added here -> increase plugin version data.codecName = "wav"; data.soxCodecName = "wav"; data.external = false; data.experimental = false; codecList.append( data ); data.codecName = "flac"; data.soxCodecName = "flac"; data.external = true; data.experimental = false; codecList.append( data ); data.codecName = "ogg vorbis"; data.soxCodecName = "vorbis"; data.external = true; data.experimental = false; codecList.append( data ); data.codecName = "mp2"; data.soxCodecName = "mp2"; data.external = true; data.experimental = false; codecList.append( data ); data.codecName = "mp3"; data.soxCodecName = "mp3"; data.external = true; data.experimental = false; codecList.append( data ); data.codecName = "amr nb"; data.soxCodecName = "amr-nb"; data.external = true; data.experimental = false; codecList.append( data ); data.codecName = "amr wb"; data.soxCodecName = "amr-wb"; data.external = true; data.experimental = false; codecList.append( data ); data.codecName = "8svx"; data.soxCodecName = "8svx"; data.external = false; data.experimental = false; codecList.append( data ); data.codecName = "aiff"; data.soxCodecName = "aiff"; // aiff has meta data, aif not data.external = false; data.experimental = false; codecList.append( data ); // sox only supports uncompressed aiff-c // data.codecName = "aiff-c"; // data.soxCodecName = "aifc"; // data.external = false; // data.experimental = false; // codecList.append( data ); for( int i=0; i soundkonverter_filter_sox::codecTable() { QList table; if( !binaries["sox"].isEmpty() ) { QFileInfo soxInfo( binaries["sox"] ); if( soxInfo.lastModified() > soxLastModified || configVersion < version() ) { infoProcess = new KProcess(); infoProcess.data()->setOutputChannelMode( KProcess::MergedChannels ); connect( infoProcess.data(), SIGNAL(readyRead()), this, SLOT(infoProcessOutput()) ); connect( infoProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(infoProcessExit(int,QProcess::ExitStatus)) ); QStringList command; command += binaries["sox"]; command += "--help"; infoProcess.data()->clearProgram(); infoProcess.data()->setShellCommand( command.join(" ") ); infoProcess.data()->start(); infoProcess.data()->waitForFinished( 3000 ); } } for( int i=0; isetCaption( i18n("Configure %1").arg(global_plugin_name) ); configDialog.data()->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Default ); QWidget *configDialogWidget = new QWidget( configDialog.data() ); QHBoxLayout *configDialogBox = new QHBoxLayout( configDialogWidget ); QLabel *configDialogSamplingRateQualityLabel = new QLabel( i18n("Sample rate change quality:"), configDialogWidget ); configDialogBox->addWidget( configDialogSamplingRateQualityLabel ); configDialogSamplingRateQualityComboBox = new KComboBox( configDialogWidget ); configDialogSamplingRateQualityComboBox->addItem( i18n("Quick"), "quick" ); configDialogSamplingRateQualityComboBox->addItem( i18n("Low"), "low" ); configDialogSamplingRateQualityComboBox->addItem( i18n("Medium"), "medium" ); configDialogSamplingRateQualityComboBox->addItem( i18n("High"), "high" ); configDialogSamplingRateQualityComboBox->addItem( i18n("Very high"), "very high" ); configDialogBox->addWidget( configDialogSamplingRateQualityComboBox ); configDialog.data()->setMainWidget( configDialogWidget ); connect( configDialog.data(), SIGNAL( okClicked() ), this, SLOT( configDialogSave() ) ); connect( configDialog.data(), SIGNAL( defaultClicked() ), this, SLOT( configDialogDefault() ) ); } configDialogSamplingRateQualityComboBox->setCurrentIndex( configDialogSamplingRateQualityComboBox->findData(samplingRateQuality) ); configDialog.data()->show(); } void soundkonverter_filter_sox::configDialogSave() { if( configDialog.data() ) { samplingRateQuality = configDialogSamplingRateQualityComboBox->itemData( configDialogSamplingRateQualityComboBox->currentIndex() ).toString(); KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); group.writeEntry( "samplingRateQuality", samplingRateQuality ); configDialog.data()->deleteLater(); } } void soundkonverter_filter_sox::configDialogDefault() { if( configDialog.data() ) { configDialogSamplingRateQualityComboBox->setCurrentIndex( configDialogSamplingRateQualityComboBox->findData("high") ); } } bool soundkonverter_filter_sox::hasInfo() { return false; } void soundkonverter_filter_sox::showInfo( QWidget *parent ) { Q_UNUSED(parent) } FilterWidget *soundkonverter_filter_sox::newFilterWidget() { SoxFilterWidget *widget = new SoxFilterWidget(); if( lastUsedFilterOptions ) { widget->setCurrentFilterOptions( lastUsedFilterOptions ); delete lastUsedFilterOptions; lastUsedFilterOptions = 0; } return qobject_cast(widget); } CodecWidget *soundkonverter_filter_sox::newCodecWidget() { SoxCodecWidget *widget = new SoxCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_filter_sox::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { QStringList command = convertCommand( inputFile, outputFile, inputCodec, outputCodec, _conversionOptions, tags, replayGain ); if( command.isEmpty() ) return BackendPlugin::UnknownError; FilterPluginItem *newItem = new FilterPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_filter_sox::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED( tags ); Q_UNUSED( replayGain ); if( !_conversionOptions ) return QStringList(); ConversionOptions *conversionOptions = _conversionOptions; QStringList command; SoxFilterOptions *filterOptions = 0; foreach( FilterOptions *_filterOptions, conversionOptions->filterOptions ) { if( _filterOptions->pluginName == global_plugin_name ) filterOptions = dynamic_cast(_filterOptions); } command += binaries["sox"]; command += "--no-glob"; if( conversionOptions->pluginName == name() ) { command += conversionOptions->cmdArguments; } if( inputFile.isEmpty() || inputCodec == "amr nb" ) // NOTE sox expects anb as extension for amr nb files { command += "--type"; command += soxCodecName(inputCodec); } command += "\"" + escapeUrl(inputFile) + "\""; if( filterOptions && filterOptions->data.sampleSize ) { command += "--bits"; command += QString::number(filterOptions->data.sampleSize); } if( filterOptions && filterOptions->data.channels ) { command += "--channels"; command += QString::number(filterOptions->data.channels); } if( outputCodec == "flac" && ( conversionOptions->pluginName == global_plugin_name || conversionOptions->pluginName == "FLAC" ) ) { command += "--compression"; command += QString::number(conversionOptions->compressionLevel); } else if( outputCodec == "ogg vorbis" && ( conversionOptions->pluginName == global_plugin_name || conversionOptions->pluginName == "Vorbis Tools" ) ) { command += "--compression"; command += QString::number(conversionOptions->quality); } else if( outputCodec == "mp2" ) { command += "--compression"; command += QString::number(conversionOptions->bitrate); } else if( outputCodec == "mp3" && ( conversionOptions->pluginName == global_plugin_name || conversionOptions->pluginName == "lame" ) ) { command += "--compression"; QString compressionLevel = QString::number(conversionOptions->compressionLevel); if( compressionLevel == "0" ) compressionLevel = "01"; if( conversionOptions->qualityMode == ConversionOptions::Quality ) { command += "-" + QString::number(conversionOptions->quality) + "." + compressionLevel; } else if( conversionOptions->qualityMode == ConversionOptions::Bitrate ) { command += QString::number(conversionOptions->bitrate) + "." + compressionLevel; } } else if( outputCodec == "amr nb" && conversionOptions->pluginName == global_plugin_name ) { command += "--compression"; command += QString::number(conversionOptions->quality); } else if( outputCodec == "amr wb" && conversionOptions->pluginName == global_plugin_name ) { command += "--compression"; command += QString::number(conversionOptions->quality); } if( outputFile.isEmpty() || outputCodec == "amr nb" ) // NOTE sox expects anb as extension for amr nb files { command += "--type"; command += soxCodecName(outputCodec); } command += "\"" + escapeUrl(outputFile) + "\""; if( filterOptions && filterOptions->data.sampleRate ) { command += "rate"; if( samplingRateQuality == "quick" ) command += "-q"; else if( samplingRateQuality == "low" ) command += "-l"; else if( samplingRateQuality == "medium" ) command += "-m"; else if( samplingRateQuality == "high" ) command += "-h"; else if( samplingRateQuality == "very high" ) command += "-v"; command += QString::number(filterOptions->data.sampleRate); } if( filterOptions ) { foreach( const SoxFilterOptions::EffectData effectData, filterOptions->data.effects ) { if( effectData.effectName == "norm" || effectData.effectName == "bass" || effectData.effectName == "treble" ) { command += effectData.effectName; command += QString::number(effectData.data.at(0).toDouble()); } } } return command; } float soundkonverter_filter_sox::parseOutput( const QString& output ) { Q_UNUSED( output ); // // 01-Unknown.wav: 98% complete, ratio=0,479 // encode // // 01-Unknown.wav: 27% complete // decode // // QRegExp regEnc("(\\d+)% complete"); // if( output.contains(regEnc) ) // { // return (float)regEnc.cap(1).toInt(); // } // return -1; } FilterOptions *soundkonverter_filter_sox::filterOptionsFromXml( QDomElement filterOptions ) { SoxFilterOptions *options = new SoxFilterOptions(); options->fromXml( filterOptions ); return options; } QString soundkonverter_filter_sox::soxCodecName( const QString& codecName ) { foreach( SoxCodecData data, codecList ) { if( data.codecName == codecName ) return data.soxCodecName; } return codecName; } void soundkonverter_filter_sox::infoProcessOutput() { infoProcessOutputData.append( infoProcess.data()->readAllStandardOutput().data() ); } void soundkonverter_filter_sox::infoProcessExit( int exitCode, QProcess::ExitStatus exitStatus ) { Q_UNUSED(exitStatus) Q_UNUSED(exitCode) QRegExp formatsReg("AUDIO FILE FORMATS: ([^\n]*)"); if( infoProcessOutputData.contains(formatsReg) ) { const QStringList formats = formatsReg.cap(1).split(" ",QString::SkipEmptyParts); soxCodecList.clear(); for( int i=0; igroup( "Plugin-"+name() ); group.writeEntry( "configVersion", version() ); group.writeEntry( "soxLastModified", soxLastModified ); group.writeEntry( "codecList", soxCodecList.toList() ); } infoProcessOutputData.clear(); infoProcess.data()->deleteLater(); } #include "soundkonverter_filter_sox.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/PaxHeaders.4329/soxcodecwidget.cpp0000644000000000000000000000006212276433306027155 xustar0020 atime=1416311950 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/soxcodecwidget.cpp0000644000175000001440000004642712276433306030165 0ustar00danielusers00000000000000 #include "soxfilterglobal.h" #include "soxcodecwidget.h" #include "../../core/conversionoptions.h" #include #include #include #include #include #include #include #include #include #include // TODO clean up use of modeChanged() SoxCodecWidget::SoxCodecWidget() : CodecWidget(), currentFormat( "" ) { QGridLayout *grid = new QGridLayout( this ); grid->setContentsMargins( 0, 0, 0, 0 ); // set up encoding options selection QHBoxLayout *topBox = new QHBoxLayout(); grid->addLayout( topBox, 0, 0 ); // flac lCompressionLevel = new QLabel( i18n("Compression level:"), this ); topBox->addWidget( lCompressionLevel ); sCompressionLevel = new QSlider( Qt::Horizontal, this ); sCompressionLevel->setRange( 0, 8 ); sCompressionLevel->setSingleStep( 1 ); sCompressionLevel->setPageStep( 1 ); connect( sCompressionLevel, SIGNAL(valueChanged(int)), this, SLOT(compressionLevelSliderChanged(int)) ); connect( sCompressionLevel, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( sCompressionLevel ); iCompressionLevel = new QSpinBox( this ); iCompressionLevel->setRange( 0, 8 ); iCompressionLevel->setSingleStep( 1 ); iCompressionLevel->setFixedWidth( iCompressionLevel->sizeHint().width() ); connect( iCompressionLevel, SIGNAL(valueChanged(int)), this, SLOT(compressionLevelSpinBoxChanged(int)) ); connect( iCompressionLevel, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( iCompressionLevel ); iCompressionLevel->setValue( 5 ); // mp2, mp3 and ogg vorbis lMode = new QLabel( i18n("Mode:"), this ); topBox->addWidget( lMode ); cMode = new KComboBox( this ); cMode->addItem( i18n("Quality") ); cMode->addItem( i18n("Bitrate") ); connect( cMode, SIGNAL(activated(int)), this, SLOT(modeChanged(int)) ); connect( cMode, SIGNAL(activated(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( cMode ); lQuality = new QLabel( i18n("Quality:"), this ); topBox->addWidget( lQuality ); sQuality = new QSlider( Qt::Horizontal, this ); connect( sQuality, SIGNAL(valueChanged(int)), this, SLOT(qualitySliderChanged(int)) ); connect( sQuality, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( sQuality ); dQuality = new QDoubleSpinBox( this ); dQuality->setRange( 8, 320 ); dQuality->setSuffix( " kbps" ); dQuality->setFixedWidth( dQuality->sizeHint().width() ); connect( dQuality, SIGNAL(valueChanged(double)), this, SLOT(qualitySpinBoxChanged(double)) ); connect( dQuality, SIGNAL(valueChanged(double)), SIGNAL(optionsChanged()) ); topBox->addWidget( dQuality ); // amr nb and amr wb lBitratePreset = new QLabel( i18n("Bitrate:"), this ); topBox->addWidget( lBitratePreset ); cBitratePreset = new KComboBox( this ); cBitratePreset->addItem( "00.00 kbps" ); topBox->addWidget( cBitratePreset ); topBox->addStretch(); // cmd arguments box QHBoxLayout *cmdArgumentsBox = new QHBoxLayout(); grid->addLayout( cmdArgumentsBox, 1, 0 ); cCmdArguments = new QCheckBox( i18n("Additional encoder arguments:"), this ); cmdArgumentsBox->addWidget( cCmdArguments ); lCmdArguments = new KLineEdit( this ); lCmdArguments->setEnabled( false ); cmdArgumentsBox->addWidget( lCmdArguments ); connect( cCmdArguments, SIGNAL(toggled(bool)), lCmdArguments, SLOT(setEnabled(bool)) ); grid->setRowStretch( 2, 1 ); modeChanged( 0 ); } SoxCodecWidget::~SoxCodecWidget() {} ConversionOptions *SoxCodecWidget::currentConversionOptions() { ConversionOptions *options = new ConversionOptions(); if( currentFormat == "wav" || currentFormat == "aiff" || currentFormat == "flac" ) { options->qualityMode = ConversionOptions::Lossless; options->compressionLevel = iCompressionLevel->value(); } else if( currentFormat == "mp2" ) { options->qualityMode = ConversionOptions::Bitrate; options->bitrate = dQuality->value(); options->bitrateMode = ConversionOptions::Cbr; } else if( currentFormat == "mp3" ) { if( cMode->currentText() == i18n("Quality") ) { options->qualityMode = ConversionOptions::Quality; options->quality = dQuality->value(); } else { options->qualityMode = ConversionOptions::Bitrate; options->bitrate = dQuality->value(); options->bitrateMode = ConversionOptions::Cbr; } } else if( currentFormat == "ogg vorbis" ) { options->qualityMode = ConversionOptions::Quality; options->quality = dQuality->value(); } else if( currentFormat == "amr nb" || currentFormat == "amr wb" ) { options->qualityMode = ConversionOptions::Quality; options->quality = cBitratePreset->itemData( cBitratePreset->currentIndex() ).toInt(); } options->cmdArguments = cCmdArguments->isChecked() ? lCmdArguments->text() : ""; return options; } bool SoxCodecWidget::setCurrentConversionOptions( ConversionOptions *_options ) { if( !_options || _options->pluginName != global_plugin_name ) return false; ConversionOptions *options = _options; if( currentFormat == "wav" || currentFormat == "aiff" || currentFormat == "flac" ) { iCompressionLevel->setValue( options->compressionLevel ); } else if( currentFormat == "mp2" ) { dQuality->setValue( options->bitrate ); } else if( currentFormat == "mp3" ) { if( options->qualityMode == ConversionOptions::Quality ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); dQuality->setValue( options->quality ); } else { cMode->setCurrentIndex( 1 ); modeChanged( 1 ); dQuality->setValue( options->bitrate ); } } else if( currentFormat == "ogg vorbis" ) { dQuality->setValue( options->quality ); } else if( currentFormat == "amr nb" || currentFormat == "amr wb" ) { cBitratePreset->setCurrentIndex( cBitratePreset->findData(options->quality) ); } cCmdArguments->setChecked( !options->cmdArguments.isEmpty() ); if( !options->cmdArguments.isEmpty() ) lCmdArguments->setText( options->cmdArguments ); else lCmdArguments->clear(); return true; } void SoxCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; if( currentFormat == "flac" ) { lCompressionLevel->show(); sCompressionLevel->show(); iCompressionLevel->show(); sCompressionLevel->setToolTip( i18n("Compression level from %1 to %2 where %2 is the best compression.\nThe better the compression, the slower the conversion but the smaller the file size and vice versa.", 0, 8) ); iCompressionLevel->setToolTip( i18n("Compression level from %1 to %2 where %2 is the best compression.\nThe better the compression, the slower the conversion but the smaller the file size and vice versa.", 0, 8) ); lMode->hide(); cMode->hide(); lQuality->hide(); sQuality->hide(); dQuality->hide(); lBitratePreset->hide(); cBitratePreset->hide(); } else if( currentFormat == "mp2" ) { lCompressionLevel->hide(); sCompressionLevel->hide(); iCompressionLevel->hide(); lMode->hide(); cMode->hide(); lQuality->show(); lQuality->setText( i18n("Bitrate:") ); sQuality->show(); dQuality->show(); sQuality->setRange( 32, 384 ); sQuality->setSingleStep( 8 ); dQuality->setRange( 32, 384 ); dQuality->setSingleStep( 1 ); dQuality->setDecimals( 0 ); dQuality->setSuffix( " kbps" ); sQuality->setValue( 160 ); dQuality->setValue( 160 ); sQuality->setToolTip( "" ); dQuality->setToolTip( "" ); lBitratePreset->hide(); cBitratePreset->hide(); } else if( currentFormat == "mp3" ) { lCompressionLevel->hide(); sCompressionLevel->hide(); iCompressionLevel->hide(); lMode->show(); cMode->show(); lQuality->hide(); sQuality->show(); dQuality->show(); modeChanged( 0 ); lBitratePreset->hide(); cBitratePreset->hide(); } else if( currentFormat == "ogg vorbis" ) { lCompressionLevel->hide(); sCompressionLevel->hide(); iCompressionLevel->hide(); lMode->hide(); cMode->hide(); lQuality->show(); lQuality->setText( i18n("Quality:") ); sQuality->show(); dQuality->show(); sQuality->setRange( -100, 1000 ); sQuality->setSingleStep( 50 ); dQuality->setRange( -1, 10 ); dQuality->setSingleStep( 0.01 ); dQuality->setDecimals( 2 ); dQuality->setSuffix( "" ); sQuality->setValue( 400 ); dQuality->setValue( 4.0 ); sQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", -1, 10) ); dQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", -1, 10) ); lBitratePreset->hide(); cBitratePreset->hide(); } else if( currentFormat == "amr nb" ) { lCompressionLevel->hide(); sCompressionLevel->hide(); iCompressionLevel->hide(); lMode->hide(); cMode->hide(); lQuality->hide(); sQuality->hide(); dQuality->hide(); lBitratePreset->show(); cBitratePreset->show(); cBitratePreset->clear(); cBitratePreset->addItem( "4.75 kbps", 0 ); cBitratePreset->addItem( "5.15 kbps", 1 ); cBitratePreset->addItem( "5.9 kbps", 2 ); cBitratePreset->addItem( "6.7 kbps", 3 ); cBitratePreset->addItem( "7.4 kbps", 4 ); cBitratePreset->addItem( "7.95 kbps", 5 ); cBitratePreset->addItem( "10.2 kbps", 6 ); cBitratePreset->addItem( "12.2 kbps", 7 ); } else if( currentFormat == "amr wb" ) { lCompressionLevel->hide(); sCompressionLevel->hide(); iCompressionLevel->hide(); lMode->hide(); cMode->hide(); lQuality->hide(); sQuality->hide(); dQuality->hide(); lBitratePreset->show(); cBitratePreset->show(); cBitratePreset->clear(); cBitratePreset->addItem( "6.6 kbps", 0 ); cBitratePreset->addItem( "8.85 kbps", 1 ); cBitratePreset->addItem( "12.65 kbps", 2 ); cBitratePreset->addItem( "14.25 kbps", 3 ); cBitratePreset->addItem( "15.85 kbps", 4 ); cBitratePreset->addItem( "18.25 kbps", 5 ); cBitratePreset->addItem( "19.85 kbps", 6 ); cBitratePreset->addItem( "23.05 kbps", 7 ); cBitratePreset->addItem( "23.85 kbps", 8 ); } else if( currentFormat == "wav" || currentFormat == "8svx" || currentFormat == "aiff" ) { lCompressionLevel->hide(); sCompressionLevel->hide(); iCompressionLevel->hide(); lMode->hide(); cMode->hide(); lQuality->hide(); sQuality->hide(); dQuality->hide(); lBitratePreset->hide(); cBitratePreset->hide(); } } QString SoxCodecWidget::currentProfile() { if( currentFormat == "wav" || currentFormat == "aiff" || currentFormat == "flac" ) { return i18n("Lossless"); } else if( currentFormat == "mp2" ) { if( dQuality->value() == 64 ) { return i18n("Very low"); } else if( dQuality->value() == 128 ) { return i18n("Low"); } else if( dQuality->value() == 160 ) { return i18n("Medium"); } else if( dQuality->value() == 240 ) { return i18n("High"); } else if( dQuality->value() == 320 ) { return i18n("Very high"); } } else if( currentFormat == "mp3" ) { if( cMode->currentIndex() == 0 && dQuality->value() == 6 ) { return i18n("Very low"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 5 ) { return i18n("Low"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 4 ) { return i18n("Medium"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 3 ) { return i18n("High"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 2 ) { return i18n("Very high"); } } else if( currentFormat == "ogg vorbis" ) { if( dQuality->value() == 2 ) { return i18n("Very low"); } else if( dQuality->value() == 3 ) { return i18n("Low"); } else if( dQuality->value() == 4 ) { return i18n("Medium"); } else if( dQuality->value() == 5 ) { return i18n("High"); } else if( dQuality->value() == 6 ) { return i18n("Very high"); } } // amr nb, amr wb, 8svx return i18n("User defined"); } bool SoxCodecWidget::setCurrentProfile( const QString& profile ) { cCmdArguments->setChecked( false ); lCmdArguments->clear(); if( profile == i18n("Very low") ) { if( currentFormat == "mp2" ) { sQuality->setValue( 64 ); dQuality->setValue( 64 ); return true; } else if( currentFormat == "mp3" ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 6 ); dQuality->setValue( 6 ); return true; } else if( currentFormat == "ogg vorbis" ) { sQuality->setValue( 200 ); dQuality->setValue( 2 ); return true; } } else if( profile == i18n("Low") ) { if( currentFormat == "mp2" ) { sQuality->setValue( 128 ); dQuality->setValue( 128 ); return true; } else if( currentFormat == "mp3" ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 5 ); dQuality->setValue( 5 ); return true; } else if( currentFormat == "ogg vorbis" ) { sQuality->setValue( 300 ); dQuality->setValue( 3 ); return true; } } else if( profile == i18n("Medium") ) { if( currentFormat == "mp2" ) { sQuality->setValue( 160 ); dQuality->setValue( 160 ); return true; } else if( currentFormat == "mp3" ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 4 ); dQuality->setValue( 4 ); return true; } else if( currentFormat == "ogg vorbis" ) { sQuality->setValue( 400 ); dQuality->setValue( 4 ); return true; } } else if( profile == i18n("High") ) { if( currentFormat == "mp2" ) { sQuality->setValue( 240 ); dQuality->setValue( 240 ); return true; } else if( currentFormat == "mp3" ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 5 ); dQuality->setValue( 5 ); return true; } else if( currentFormat == "ogg vorbis" ) { sQuality->setValue( 500 ); dQuality->setValue( 5 ); return true; } } else if( profile == i18n("Very high") ) { if( currentFormat == "mp2" ) { sQuality->setValue( 320 ); dQuality->setValue( 320 ); return true; } else if( currentFormat == "mp3" ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 2 ); dQuality->setValue( 2 ); return true; } else if( currentFormat == "ogg vorbis" ) { sQuality->setValue( 600 ); dQuality->setValue( 6 ); return true; } } else if( profile == i18n("Lossless") ) { if( currentFormat == "wav" || currentFormat == "aiff" || currentFormat == "flac" ) { return true; } } return false; } int SoxCodecWidget::currentDataRate() // TODO { int dataRate; if( currentFormat == "wav" ) { dataRate = 10590000; } else { dataRate = 6400000; } return dataRate; } void SoxCodecWidget::compressionLevelSliderChanged( int quality ) { iCompressionLevel->setValue( quality ); } void SoxCodecWidget::compressionLevelSpinBoxChanged( int quality ) { sCompressionLevel->setValue( quality ); } void SoxCodecWidget::modeChanged( int mode ) { if( mode == 0 ) { sQuality->setRange( 0, 9 ); sQuality->setSingleStep( 1 ); dQuality->setRange( 0, 9 ); dQuality->setSingleStep( 1 ); dQuality->setDecimals( 0 ); dQuality->setSuffix( "" ); sQuality->setValue( 5 ); dQuality->setValue( 5 ); //dQuality->setValue( qualityForBitrate(dQuality->value()) ); //qualitySpinBoxChanged( dQuality->value() ); sQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", 9, 0) ); dQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", 9, 0) ); } else { sQuality->setRange( 8, 320 ); sQuality->setSingleStep( 8 ); dQuality->setRange( 8, 320 ); dQuality->setSingleStep( 1 ); dQuality->setDecimals( 0 ); dQuality->setSuffix( " kbps" ); sQuality->setValue( 160 ); dQuality->setValue( 160 ); //dQuality->setValue( bitrateForQuality(dQuality->value()) ); //qualitySpinBoxChanged( dQuality->value() ); sQuality->setToolTip( "" ); dQuality->setToolTip( "" ); } } void SoxCodecWidget::qualitySliderChanged( int quality ) { double value; if( currentFormat == "ogg vorbis" ) value = double(quality)/100.0; else if( currentFormat == "mp3" && cMode->currentIndex() == 0 ) value = 9 - quality; else value = quality; dQuality->setValue( value ); } void SoxCodecWidget::qualitySpinBoxChanged( double quality ) { int value; if( currentFormat == "ogg vorbis" ) value = round(quality*100.0); else if( currentFormat == "mp3" && cMode->currentIndex() == 0 ) value = 9 - quality; else value = quality; sQuality->setValue( value ); } ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/PaxHeaders.4329/soxeffectwidget.h0000644000000000000000000000013012076525023026771 xustar0029 mtime=1358604819.25080641 29 atime=1358604819.25080641 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/soxeffectwidget.h0000644000175000001440000000170312076525023027771 0ustar00danielusers00000000000000 #ifndef SOXEFFECTWIDGET_H #define SOXEFFECTWIDGET_H #include "../../core/codecwidget.h" #include "soxfilteroptions.h" class KComboBox; class KPushButton; class QHBoxLayout; class SoxEffectWidget : public QWidget { Q_OBJECT public: SoxEffectWidget( QWidget *parent = 0 ); ~SoxEffectWidget(); void setRemoveButtonShown( bool shown ); void setAddButtonShown( bool shown ); SoxFilterOptions::EffectData currentEffectOptions(); bool setEffectOptions( SoxFilterOptions::EffectData effectData ); private: KComboBox *cEffect; QHBoxLayout *widgetsBox; QList widgets; KPushButton *pRemove; KPushButton *pAdd; private slots: void removeClicked(); void effectChanged( int index ); void normalizeVolumeChanged( double value ); signals: void addEffectWidgetClicked(); void removeEffectWidgetClicked( SoxEffectWidget *widget ); void optionsChanged(); }; #endif // SOXEFFECTWIDGET_H ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/PaxHeaders.4329/soxfilterglobal.h0000644000000000000000000000013012076525023026777 xustar0029 mtime=1358604819.25080641 29 atime=1358604819.25080641 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/soxfilterglobal.h0000644000175000001440000000014412076525023027775 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "SoX" #define global_plugin_version 1 #endif ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/PaxHeaders.4329/soxfilteroptions.cpp0000644000000000000000000000013012076525023027565 xustar0029 mtime=1358604819.25080641 29 atime=1358604819.25080641 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/soxfilteroptions.cpp0000644000175000001440000001027112076525023030565 0ustar00danielusers00000000000000 #include "soxfilterglobal.h" #include "soxfilteroptions.h" #include "../../core/conversionoptions.h" SoxFilterOptions::SoxFilterOptions() { pluginName = global_plugin_name; } SoxFilterOptions::~SoxFilterOptions() {} bool SoxFilterOptions::equals( FilterOptions *_other ) { if( !_other || _other->pluginName!=pluginName ) return false; if( !FilterOptions::equals( _other ) ) return false; SoxFilterOptions *other = dynamic_cast(_other); if( !other ) return false; if( data.sampleRate != other->data.sampleRate ) return false; if( data.sampleSize != other->data.sampleSize ) return false; if( data.channels != other->data.channels ) return false; QStringList effects; foreach( EffectData effectData, data.effects ) { effects.append( effectData.effectName ); } effects.sort(); QStringList other_effects; foreach( EffectData otherEffectData, other->data.effects ) { other_effects.append( otherEffectData.effectName ); } other_effects.sort(); if( effects == other_effects ) { foreach( const EffectData effectData, data.effects ) { foreach( const EffectData otherEffectData, other->data.effects ) { if( otherEffectData.effectName == effectData.effectName ) { if( otherEffectData.data != effectData.data ) return false; break; } } } } else { return false; } return true; } QDomElement SoxFilterOptions::toXml( QDomDocument document, const QString elementName ) { QDomElement filterOptions = FilterOptions::toXml( document, elementName ); filterOptions.setAttribute("sampleRate",data.sampleRate); filterOptions.setAttribute("sampleSize",data.sampleSize); filterOptions.setAttribute("channels",data.channels); int i = 0; foreach( const EffectData effectData, data.effects ) { if( effectData.effectName == i18n("Disabled") ) continue; QDomElement effectElement = document.createElement("effect"+QString::number(i++)); effectElement.setAttribute("name",effectData.effectName); if( effectData.effectName == "norm" ) { if( !effectData.data.isEmpty() ) effectElement.setAttribute("normalizeVolume",effectData.data.at(0).toDouble()); } else if( effectData.effectName == "bass" ) { if( !effectData.data.isEmpty() ) effectElement.setAttribute("bassGain",effectData.data.at(0).toDouble()); } else if( effectData.effectName == "treble" ) { if( !effectData.data.isEmpty() ) effectElement.setAttribute("trebleGain",effectData.data.at(0).toDouble()); } filterOptions.appendChild(effectElement); } return filterOptions; } bool SoxFilterOptions::fromXml( QDomElement filterOptions ) { FilterOptions::fromXml( filterOptions ); data.sampleRate = filterOptions.attribute("sampleRate").toInt(); data.sampleSize = filterOptions.attribute("sampleSize").toInt(); data.channels = filterOptions.attribute("channels").toInt(); for( QDomNode node = filterOptions.firstChild(); !node.isNull(); node = node.nextSibling() ) { if( node.nodeName().startsWith("effect") ) { QDomElement effectElement = node.toElement(); SoxFilterOptions::EffectData effectData; effectData.effectName = effectElement.attribute("name"); if( effectData.effectName == "norm" ) { effectData.data.append( effectElement.attribute("normalizeVolume").toDouble() ); } else if( effectData.effectName == "bass" ) { effectData.data.append( effectElement.attribute("bassGain").toDouble() ); } else if( effectData.effectName == "treble" ) { effectData.data.append( effectElement.attribute("trebleGain").toDouble() ); } data.effects.append( effectData ); } } return true; } ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/PaxHeaders.4329/soxeffectwidget.cpp0000644000000000000000000000006212076525023027330 xustar0020 atime=1382275323 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/soxeffectwidget.cpp0000644000175000001440000002134412076525023030327 0ustar00danielusers00000000000000 #include "soxfilterglobal.h" #include "soxeffectwidget.h" #include #include #include #include #include #include #include SoxEffectWidget::SoxEffectWidget( QWidget *parent ) : QWidget( parent ) { QHBoxLayout *box = new QHBoxLayout( this ); box->setMargin( 0 ); QLabel *lEffect = new QLabel( i18n("Effect:") ); box->addWidget( lEffect ); cEffect = new KComboBox( this ); connect( cEffect, SIGNAL(activated(int)), this, SLOT(effectChanged(int)) ); cEffect->addItem( i18n("Disabled") ); // cEffect->addItem( "allpass" ); // cEffect->addItem( "band" ); // cEffect->addItem( "bandpass" ); // cEffect->addItem( "bandreject" ); cEffect->addItem( "bass" ); // cEffect->addItem( "bend" ); // cEffect->addItem( "biquad" ); // cEffect->addItem( "chorus" ); // cEffect->addItem( "channels" ); // cEffect->addItem( "compand" ); // cEffect->addItem( "contrast" ); // cEffect->addItem( "dcshift" ); // cEffect->addItem( "deemph" ); // cEffect->addItem( "delay" ); // cEffect->addItem( "dither" ); // // cEffect1->addItem( "divide" ); // experimental // cEffect->addItem( "downsample" ); // cEffect->addItem( "earwax" ); // cEffect->addItem( "echo" ); // cEffect->addItem( "echos" ); // cEffect->addItem( "equalizer" ); // cEffect->addItem( "fade" ); // cEffect->addItem( "fir" ); // // cEffect1->addItem( "firfit" ); // experimental // cEffect->addItem( "flanger" ); // cEffect->addItem( "gain" ); // cEffect->addItem( "highpass" ); // cEffect->addItem( "hilbert" ); // // cEffect1->addItem( "input" ); // libSoX-only // cEffect->addItem( "ladspa" ); // cEffect->addItem( "loudness" ); // cEffect->addItem( "lowpass" ); // cEffect->addItem( "mcompand" ); // // cEffect1->addItem( "mixer" ); // deprecated // cEffect->addItem( "noiseprof" ); // cEffect->addItem( "noisered" ); cEffect->addItem( "norm" ); // cEffect->addItem( "oops" ); // // cEffect1->addItem( "output" ); // libSoX-only // cEffect->addItem( "overdrive" ); // cEffect->addItem( "pad" ); // cEffect->addItem( "phaser" ); // cEffect->addItem( "pitch" ); // cEffect->addItem( "rate" ); // cEffect->addItem( "remix" ); // cEffect->addItem( "repeat" ); // cEffect->addItem( "reverb" ); // cEffect->addItem( "reverse" ); // cEffect->addItem( "riaa" ); // cEffect->addItem( "silence" ); // cEffect->addItem( "sinc" ); // cEffect->addItem( "spectrogram" ); // cEffect->addItem( "speed" ); // cEffect->addItem( "splice" ); // cEffect->addItem( "stat" ); // cEffect->addItem( "stats" ); // cEffect->addItem( "stretch" ); // cEffect->addItem( "swap" ); // cEffect->addItem( "synth" ); // cEffect->addItem( "tempo" ); cEffect->addItem( "treble" ); // cEffect->addItem( "tremolo" ); // cEffect->addItem( "trim" ); // cEffect->addItem( "upsample" ); // cEffect->addItem( "vad" ); // cEffect->addItem( "vol" ); box->addWidget( cEffect ); widgetsBox = new QHBoxLayout(); box->addLayout( widgetsBox ); box->addStretch(); pRemove = new KPushButton( KIcon("list-remove"), i18n("Remove"), this ); pRemove->setToolTip( i18n("Remove this effect") ); box->addWidget( pRemove ); connect( pRemove, SIGNAL(clicked()), this, SLOT(removeClicked()) ); pAdd = new KPushButton( KIcon("list-add"), i18n("Add"), this ); pAdd->setToolTip( i18n("Add another effect") ); box->addWidget( pAdd ); connect( pAdd, SIGNAL(clicked()), SIGNAL(addEffectWidgetClicked()) ); pAdd->setEnabled( false ); } SoxEffectWidget::~SoxEffectWidget() {} void SoxEffectWidget::setAddButtonShown( bool shown ) { pAdd->setShown( shown ); } void SoxEffectWidget::setRemoveButtonShown( bool shown ) { pRemove->setShown( shown ); } void SoxEffectWidget::removeClicked() { emit removeEffectWidgetClicked( this ); } void SoxEffectWidget::effectChanged( int index ) { const QString effect = cEffect->itemText( index ); foreach( QWidget *widget, widgets ) { widgetsBox->removeWidget( widget ); widget->deleteLater(); } widgets.clear(); cEffect->setToolTip( "" ); if( effect == "norm" ) { cEffect->setToolTip( i18n("Normalize:\nChange the volume so all files have the same loudness") ); QDoubleSpinBox *dNormalizeVolume = new QDoubleSpinBox( this ); dNormalizeVolume->setRange( -99, 99 ); dNormalizeVolume->setSuffix( " " + i18nc("decibel","dB") ); connect( dNormalizeVolume, SIGNAL(valueChanged(double)), this, SLOT(normalizeVolumeChanged(double)) ); connect( dNormalizeVolume, SIGNAL(valueChanged(double)), SIGNAL(optionsChanged()) ); widgetsBox->addWidget( dNormalizeVolume ); dNormalizeVolume->setValue( 0 ); dNormalizeVolume->setPrefix( "+" ); widgets.append( (QWidget*)dNormalizeVolume ); } else if( effect == "bass" ) { cEffect->setToolTip( i18n("Bass:\nAmplify the low frequencies") ); QDoubleSpinBox *dBassGain = new QDoubleSpinBox( this ); dBassGain->setRange( -99, 99 ); dBassGain->setSuffix( " " + i18nc("decibel","dB") ); connect( dBassGain, SIGNAL(valueChanged(double)), SIGNAL(optionsChanged()) ); widgetsBox->addWidget( dBassGain ); dBassGain->setValue( 0 ); widgets.append( (QWidget*)dBassGain ); } else if( effect == "treble" ) { cEffect->setToolTip( i18n("Treble:\nAmplify the high frequencies") ); QDoubleSpinBox *dTrebleGain = new QDoubleSpinBox( this ); dTrebleGain->setRange( -99, 99 ); dTrebleGain->setSuffix( " " + i18nc("decibel","dB") ); connect( dTrebleGain, SIGNAL(valueChanged(double)), SIGNAL(optionsChanged()) ); widgetsBox->addWidget( dTrebleGain ); dTrebleGain->setValue( 0 ); widgets.append( (QWidget*)dTrebleGain ); } pAdd->setEnabled( cEffect->currentText() != i18n("Disabled") ); } SoxFilterOptions::EffectData SoxEffectWidget::currentEffectOptions() { SoxFilterOptions::EffectData effectData; const QString effect = cEffect->currentText(); effectData.effectName = effect; if( effect == "norm" ) { if( widgets.isEmpty() ) return effectData; QDoubleSpinBox *dNormalizeVolume = qobject_cast(widgets.at(0)); if( !dNormalizeVolume ) return effectData; effectData.data.append( dNormalizeVolume->value() ); } else if( effect == "bass" ) { if( widgets.isEmpty() ) return effectData; QDoubleSpinBox *dBassGain = qobject_cast(widgets.at(0)); if( !dBassGain ) return effectData; effectData.data.append( dBassGain->value() ); } else if( effect == "treble" ) { if( widgets.isEmpty() ) return effectData; QDoubleSpinBox *dTrebleGain = qobject_cast(widgets.at(0)); if( !dTrebleGain ) return effectData; effectData.data.append( dTrebleGain->value() ); } return effectData; } bool SoxEffectWidget::setEffectOptions( SoxFilterOptions::EffectData effectData ) { int index = cEffect->findText( effectData.effectName ); if( index == -1 ) index = 0; cEffect->setCurrentIndex( index ); effectChanged( index ); if( effectData.effectName == "norm" ) { if( widgets.isEmpty() ) return false; QDoubleSpinBox *dNormalizeVolume = qobject_cast(widgets.at(0)); if( !dNormalizeVolume ) return false; dNormalizeVolume->setValue( effectData.data.at(0).toDouble() ); } else if( effectData.effectName == "bass" ) { if( widgets.isEmpty() ) return false; QDoubleSpinBox *dBassGain = qobject_cast(widgets.at(0)); if( !dBassGain ) return false; dBassGain->setValue( effectData.data.at(0).toDouble() ); } else if( effectData.effectName == "treble" ) { if( widgets.isEmpty() ) return false; QDoubleSpinBox *dTrebleGain = qobject_cast(widgets.at(0)); if( !dTrebleGain ) return false; dTrebleGain->setValue( effectData.data.at(0).toDouble() ); } return true; } void SoxEffectWidget::normalizeVolumeChanged( double value ) { if( widgets.isEmpty() ) return; QDoubleSpinBox *dNormalizeVolume = qobject_cast(widgets.at(0)); if( !dNormalizeVolume ) return; if( value >= 0 ) dNormalizeVolume->setPrefix( "+" ); else dNormalizeVolume->setPrefix( "" ); } ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/PaxHeaders.4329/soundkonverter_filter_sox.d0000644000000000000000000000013212076525023031123 xustar0030 mtime=1358604819.248806404 30 atime=1358604819.248806404 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/soundkonverter_filter_sox.desktop0000755000175000001440000000052712076525023033355 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter sox Plugin X-KDE-Library=soundkonverter_filter_sox ServiceTypes=soundKonverter/FilterPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_filter_sox X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/PaxHeaders.4329/soxfilterwidget.h0000644000000000000000000000013212076525023027024 xustar0030 mtime=1358604819.251806412 30 atime=1358604819.251806412 30 ctime=1418040695.162717227 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_sox/soxfilterwidget.h0000644000175000001440000000142612076525023030024 0ustar00danielusers00000000000000 #ifndef SOXFILTERWIDGET_H #define SOXFILTERWIDGET_H #include "../../core/codecwidget.h" class SoxEffectWidget; class QCheckBox; class KComboBox; class QVBoxLayout; class SoxFilterWidget : public FilterWidget { Q_OBJECT public: SoxFilterWidget(); ~SoxFilterWidget(); FilterOptions *currentFilterOptions(); bool setCurrentFilterOptions( FilterOptions *_options ); private: QCheckBox *chSampleSize; KComboBox *cSampleSize; QCheckBox *chSampleRate; KComboBox *cSampleRate; QCheckBox *chChannels; KComboBox *cChannels; QVBoxLayout *effectWidgetsBox; QList effectWidgets; private slots: void addEffectWidgetClicked(); void removeEffectWidgetClicked( SoxEffectWidget *widget ); }; #endif // SOXFILTERWIDGET_H ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_mplayer0000644000000000000000000000012012076525023024000 xustar0030 mtime=1358604819.233806363 20 atime=1358274330 30 ctime=1418040695.165717222 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mplayer/0000755000175000001440000000000012076525023025055 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_mplayer/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000013012076525023026616 xustar0029 mtime=1358604819.23280636 29 atime=1358604819.23280636 30 ctime=1418040695.165717222 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mplayer/CMakeLists.txt0000755000175000001440000000116612076525023027624 0ustar00danielusers00000000000000project(soundkonverter_codec_mplayer) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_mplayer_SRCS soundkonverter_codec_mplayer.cpp ) kde4_add_plugin(soundkonverter_codec_mplayer ${soundkonverter_codec_mplayer_SRCS}) target_link_libraries(soundkonverter_codec_mplayer ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_mplayer DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_mplayer.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mplayer/PaxHeaders.4329/soundkonverter_codec_mpl0000644000000000000000000000006211404710577031106 xustar0020 atime=1308601627 30 ctime=1418040695.165717222 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mplayer/soundkonverter_codec_mplayer.desktop0000755000175000001440000000054011404710577034434 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter MPlayer Plugin X-KDE-Library=soundkonverter_codec_mplayer ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_mplayer X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mplayer/PaxHeaders.4329/soundkonverter_codec_mpl0000644000000000000000000000006212076525023031102 xustar0020 atime=1418040450 30 ctime=1418040695.165717222 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mplayer/soundkonverter_codec_mplayer.cpp0000755000175000001440000001306612076525023033550 0ustar00danielusers00000000000000 #include "mplayercodecglobal.h" #include "soundkonverter_codec_mplayer.h" #include "../../core/conversionoptions.h" soundkonverter_codec_mplayer::soundkonverter_codec_mplayer( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["mplayer"] = ""; } soundkonverter_codec_mplayer::~soundkonverter_codec_mplayer() {} QString soundkonverter_codec_mplayer::name() { return global_plugin_name; } QList soundkonverter_codec_mplayer::codecTable() { QList table; /// decode fromCodecs += "wav"; fromCodecs += "ogg vorbis"; fromCodecs += "mp3"; fromCodecs += "flac"; fromCodecs += "wma"; fromCodecs += "aac"; fromCodecs += "ac3"; fromCodecs += "m4a/alac"; fromCodecs += "mp2"; fromCodecs += "als"; fromCodecs += "amr nb"; fromCodecs += "amr wb"; fromCodecs += "ape"; fromCodecs += "speex"; fromCodecs += "m4a/aac"; fromCodecs += "mp1"; fromCodecs += "musepack"; fromCodecs += "shorten"; fromCodecs += "tta"; fromCodecs += "wavpack"; fromCodecs += "ra"; fromCodecs += "sad"; /// containers fromCodecs += "3gp"; fromCodecs += "rm"; /// video fromCodecs += "avi"; fromCodecs += "mkv"; fromCodecs += "ogv"; fromCodecs += "mpeg"; fromCodecs += "mov"; fromCodecs += "mp4"; fromCodecs += "flv"; fromCodecs += "wmv"; fromCodecs += "rv"; /// encode toCodecs += "wav"; for( int i=0; i codecs; codecs += QSet::fromList(fromCodecs); codecs += QSet::fromList(toCodecs); allCodecs = codecs.toList(); return table; } bool soundkonverter_codec_mplayer::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_codec_mplayer::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_codec_mplayer::hasInfo() { return false; } void soundkonverter_codec_mplayer::showInfo( QWidget *parent ) { Q_UNUSED(parent) } CodecWidget *soundkonverter_codec_mplayer::newCodecWidget() { return 0; } unsigned int soundkonverter_codec_mplayer::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { const QStringList command = convertCommand( inputFile, outputFile, inputCodec, outputCodec, _conversionOptions, tags, replayGain ); if( command.isEmpty() ) return BackendPlugin::UnknownError; CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_mplayer::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(_conversionOptions) Q_UNUSED(tags) Q_UNUSED(replayGain) if( outputFile.isEmpty() ) return QStringList(); QStringList command; if( outputCodec == "wav" ) { command += binaries["mplayer"]; command += "-ao"; command += "pcm:file=\"" + escapeUrl(outputFile) + "\""; command += "-vc"; command += "null"; command += "-vo"; command += "null"; command += "\"" + escapeUrl(inputFile) + "\""; } return command; } float soundkonverter_codec_mplayer::parseOutput( const QString& output ) { // decoding audio // A: 921.7 (15:21.7) of 2260.0 (37:40.0) 0.4% // decoding video // A:19743.6 V:19743.6 A-V: 0.016 ct: -0.506 491/491 0% 0% 0.6% 237 0 QRegExp regAudio("A:\\s+(\\d+\\.\\d)\\s+\\(.*\\)\\s+of\\s+(\\d+\\.\\d)\\s+\\(.*\\)"); if( output.contains(regAudio) ) { return regAudio.cap(1).toFloat()/regAudio.cap(2).toFloat()*100.0f; } QRegExp regVideo("A:\\s*\\d+\\.\\d\\s+V:\\s*\\d+\\.\\d"); if( output.contains(regVideo) ) { return 0; } if( output.contains("Too many buffered pts") ) { return 0; } // no encoding // TODO error handling return -1; } #include "soundkonverter_codec_mplayer.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mplayer/PaxHeaders.4329/soundkonverter_codec_mpl0000644000000000000000000000013212076525023031100 xustar0030 mtime=1358604819.233806363 30 atime=1358604819.233806363 30 ctime=1418040695.165717222 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mplayer/soundkonverter_codec_mplayer.h0000755000175000001440000000261412076525023033212 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_MPLAYER_H #define SOUNDKONVERTER_CODEC_MPLAYER_H #include "../../core/codecplugin.h" class ConversionOptions; class soundkonverter_codec_mplayer : public CodecPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_codec_mplayer( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_mplayer(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& format ); void showConfigDialog( ActionType action, const QString& format, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output ); private: QStringList fromCodecs; QStringList toCodecs; QMap codecMap; }; K_EXPORT_SOUNDKONVERTER_CODEC( mplayer, soundkonverter_codec_mplayer ) #endif // SOUNDKONVERTER_CODEC_MPLAYER_H ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mplayer/PaxHeaders.4329/mplayercodecglobal.h0000644000000000000000000000006211404710337030061 xustar0020 atime=1308671512 30 ctime=1418040695.165717222 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mplayer/mplayercodecglobal.h0000644000175000001440000000011011404710337031044 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "MPlayer" #endif ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_flake0000644000000000000000000000012012276433306023415 xustar0030 mtime=1392129734.905244324 20 atime=1358274330 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flake/0000755000175000001440000000000012276433306024472 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_flake/PaxHeaders.4329/soundkonverter_codec_flake0000644000000000000000000000006212276145051031006 xustar0020 atime=1398102755 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flake/soundkonverter_codec_flake.cpp0000755000175000001440000001022612276145051032566 0ustar00danielusers00000000000000 #include "flakecodecglobal.h" #include "soundkonverter_codec_flake.h" #include "../../core/conversionoptions.h" #include "flakecodecwidget.h" soundkonverter_codec_flake::soundkonverter_codec_flake( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["flake"] = ""; allCodecs += "flac"; allCodecs += "wav"; } soundkonverter_codec_flake::~soundkonverter_codec_flake() {} QString soundkonverter_codec_flake::name() { return global_plugin_name; } QList soundkonverter_codec_flake::codecTable() { QList table; ConversionPipeTrunk newTrunk; newTrunk.codecFrom = "wav"; newTrunk.codecTo = "flac"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["flake"] != "" ); newTrunk.problemInfo = standardMessage( "encode_codec,backend", "flac", "flake" ) + "\n" + standardMessage( "install_website_backend,url", "flake", "http://flake-enc.sourceforge.net" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); return table; } bool soundkonverter_codec_flake::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_codec_flake::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_codec_flake::hasInfo() { return false; } void soundkonverter_codec_flake::showInfo( QWidget *parent ) { Q_UNUSED(parent) // info.description = i18n("Flake is an alternative flac encoder.\nFor more information see: http://flake-enc.sourceforge.net"); } CodecWidget *soundkonverter_codec_flake::newCodecWidget() { FlakeCodecWidget *widget = new FlakeCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_codec_flake::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { QStringList command = convertCommand( inputFile, outputFile, inputCodec, outputCodec, _conversionOptions, tags, replayGain ); if( command.isEmpty() ) return BackendPlugin::UnknownError; CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_flake::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(tags) Q_UNUSED(replayGain) if( !_conversionOptions ) return QStringList(); QStringList command; ConversionOptions *conversionOptions = _conversionOptions; if( outputCodec == "flac" ) { command += binaries["flake"]; if( conversionOptions->pluginName == global_plugin_name ) { command += "-"+QString::number((int)conversionOptions->compressionLevel); command += conversionOptions->cmdArguments; } command += "\"" + escapeUrl(inputFile) + "\""; command += "-o"; command += "\"" + escapeUrl(outputFile) + "\""; } return command; } float soundkonverter_codec_flake::parseOutput( const QString& output ) { // progress: 6% | ratio: 0.556 | bitrate: 784.4 kbps QRegExp regEnc("progress:\\s+(\\d+)%"); if( output.contains(regEnc) ) { return (float)regEnc.cap(1).toInt(); } return -1; } #include "soundkonverter_codec_flake.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flake/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006211726605703026240 xustar0020 atime=1308763306 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flake/CMakeLists.txt0000755000175000001440000000117611726605703027243 0ustar00danielusers00000000000000project(soundkonverter_codec_flake) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_flake_SRCS soundkonverter_codec_flake.cpp flakecodecwidget.cpp ) kde4_add_plugin(soundkonverter_codec_flake ${soundkonverter_codec_flake_SRCS}) target_link_libraries(soundkonverter_codec_flake ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_flake DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_flake.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flake/PaxHeaders.4329/soundkonverter_codec_flake0000644000000000000000000000006211440646653031014 xustar0020 atime=1308601627 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flake/soundkonverter_codec_flake.desktop0000755000175000001440000000053211440646653033462 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter Flake Plugin X-KDE-Library=soundkonverter_codec_flake ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_flake X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flake/PaxHeaders.4329/soundkonverter_codec_flake0000644000000000000000000000013212076525023031003 xustar0030 mtime=1358604819.227806346 30 atime=1358604819.227806346 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flake/soundkonverter_codec_flake.h0000755000175000001440000000244312076525023032234 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_FLAKE_H #define SOUNDKONVERTER_CODEC_FLAKE_H #include "../../core/codecplugin.h" class ConversionOptions; class soundkonverter_codec_flake : public CodecPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_codec_flake( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_flake(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output ); }; K_EXPORT_SOUNDKONVERTER_CODEC( flake, soundkonverter_codec_flake ) #endif // _SOUNDKONVERTER_CODEC_FLAKE_H_ ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flake/PaxHeaders.4329/flakecodecglobal.h0000644000000000000000000000006211440644622027106 xustar0020 atime=1416311950 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flake/flakecodecglobal.h0000644000175000001440000000010611440644622030076 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "Flake" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flake/PaxHeaders.4329/flakecodecwidget.cpp0000644000000000000000000000006212276433306027467 xustar0020 atime=1418040443 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flake/flakecodecwidget.cpp0000644000175000001440000001347612276433306030475 0ustar00danielusers00000000000000 #include "flakecodecglobal.h" #include "flakecodecwidget.h" #include "../../core/conversionoptions.h" #include #include #include #include #include #include #include FlakeCodecWidget::FlakeCodecWidget() : CodecWidget(), currentFormat( "flac" ) { QGridLayout *grid = new QGridLayout( this ); grid->setContentsMargins( 0, 0, 0, 0 ); // set up encoding options selection QHBoxLayout *topBox = new QHBoxLayout(); grid->addLayout( topBox, 0, 0 ); QLabel *lCompressionLevel = new QLabel( i18n("Compression level:"), this ); topBox->addWidget( lCompressionLevel ); sCompressionLevel = new QSlider( Qt::Horizontal, this ); sCompressionLevel->setRange( 0, 12 ); sCompressionLevel->setSingleStep( 1 ); sCompressionLevel->setPageStep( 1 ); // sQuality->setTickPosition( QSlider::TicksBelow ); // sQuality->setFixedWidth( sQuality->sizeHint().width() ); connect( sCompressionLevel, SIGNAL(valueChanged(int)), this, SLOT(compressionLevelSliderChanged(int)) ); connect( sCompressionLevel, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( sCompressionLevel ); iCompressionLevel = new QSpinBox( this ); iCompressionLevel->setRange( 0, 12 ); iCompressionLevel->setSingleStep( 1 ); iCompressionLevel->setFixedWidth( iCompressionLevel->sizeHint().width() ); // dQuality->setFixedHeight( cMode->minimumSizeHint().height() ); connect( iCompressionLevel, SIGNAL(valueChanged(int)), this, SLOT(compressionLevelSpinBoxChanged(int)) ); connect( iCompressionLevel, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( iCompressionLevel ); topBox->addStretch(); // cmd arguments box QHBoxLayout *cmdArgumentsBox = new QHBoxLayout(); grid->addLayout( cmdArgumentsBox, 1, 0 ); cCmdArguments = new QCheckBox( i18n("Additional encoder arguments:"), this ); cmdArgumentsBox->addWidget( cCmdArguments ); lCmdArguments = new KLineEdit( this ); lCmdArguments->setEnabled( false ); const QString toolTip = "[-p #]\tPadding bytes to put in header (default: 4096)\n" // "[-0 ... -12]\tCompression level (default: 5)\n" // "\t\t0 = -b 1152 -t 1 -l 2,2 -m 0 -r 4,4 -s 0\n" // "\t\t1 = -b 1152 -t 1 -l 3,4 -m 1 -r 2,2 -s 1\n" // "\t\t2 = -b 1152 -t 1 -l 2,4 -m 1 -r 3 -s 1\n" // "\t\t3 = -b 4608 -t 2 -l 6 -m 1 -r 3 -s 1\n" // "\t\t4 = -b 4608 -t 2 -l 8 -m 1 -r 3 -s 1\n" // "\t\t5 = -b 4608 -t 2 -l 8 -m 1 -r 6 -s 1\n" // "\t\t6 = -b 4608 -t 2 -l 8 -m 2 -r 8 -s 1\n" // "\t\t7 = -b 4608 -t 2 -l 8 -m 3 -r 8 -s 1\n" // "\t\t8 = -b 4608 -t 2 -l 12 -m 3 -r 8 -s 1\n" // "\t\t9 = -b 4608 -t 2 -l 12 -m 6 -r 8 -s 1\n" // "\t\t10 = -b 4608 -t 2 -l 12 -m 5 -r 8 -s 1\n" // "\t\t11 = -b 4608 -t 2 -l 32 -m 6 -r 8 -s 1\n" // "\t\t12 = -b 4608 -t 2 -l 32 -m 5 -r 8 -s 1\n" "[-b #]\tBlock size [16 - 65535] (default: 4608)\n" "[-t #]\tPrediction type\n" "\t\t0 = no prediction / verbatim\n" "\t\t1 = fixed prediction\n" "\t\t2 = Levinson-Durbin recursion (default)\n" "[-l #[,#]]\tPrediction order {max} or {min},{max} (default: 1,8)\n" "[-m #]\tPrediction order selection method\n" "\t\t0 = maximum\n" "\t\t1 = estimate (default)\n" "\t\t2 = 2-level\n" "\t\t3 = 4-level\n" "\t\t4 = 8-level\n" "\t\t5 = full search\n" "\t\t6 = log search\n" "[-r #[,#]]\tRice partition order {max} or {min},{max} (default: 0,6)\n" "[-s #]\tStereo decorrelation method\n" "\t\t0 = independent L+R channels\n" "\t\t1 = mid-side (default)\n" "[-v #]\tVariable block size\n" "\t\t0 = fixed (default)\n" "\t\t1 = variable, method 1\n" "\t\t2 = variable, method 2"; lCmdArguments->setToolTip( toolTip ); cmdArgumentsBox->addWidget( lCmdArguments ); connect( cCmdArguments, SIGNAL(toggled(bool)), lCmdArguments, SLOT(setEnabled(bool)) ); grid->setRowStretch( 2, 1 ); iCompressionLevel->setValue( 5 ); } FlakeCodecWidget::~FlakeCodecWidget() {} ConversionOptions *FlakeCodecWidget::currentConversionOptions() { ConversionOptions *options = new ConversionOptions(); options->qualityMode = ConversionOptions::Lossless; options->compressionLevel = iCompressionLevel->value(); if( cCmdArguments->isChecked() ) options->cmdArguments = lCmdArguments->text(); else options->cmdArguments = ""; return options; } bool FlakeCodecWidget::setCurrentConversionOptions( ConversionOptions *_options ) { if( !_options || _options->pluginName != global_plugin_name ) return false; ConversionOptions *options = _options; iCompressionLevel->setValue( options->compressionLevel ); cCmdArguments->setChecked( !options->cmdArguments.isEmpty() ); if( !options->cmdArguments.isEmpty() ) lCmdArguments->setText( options->cmdArguments ); return true; } void FlakeCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; setEnabled( currentFormat != "wav" ); } QString FlakeCodecWidget::currentProfile() { return i18n("Lossless"); } bool FlakeCodecWidget::setCurrentProfile( const QString& profile ) { return profile == i18n("Lossless"); } int FlakeCodecWidget::currentDataRate() { int dataRate; if( currentFormat == "wav" ) { dataRate = 10590000; } else { dataRate = 6400000; } return dataRate; } void FlakeCodecWidget::compressionLevelSliderChanged( int quality ) { iCompressionLevel->setValue( quality ); } void FlakeCodecWidget::compressionLevelSpinBoxChanged( int quality ) { sCompressionLevel->setValue( quality ); } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flake/PaxHeaders.4329/flakecodecwidget.h0000644000000000000000000000013212076525023027126 xustar0030 mtime=1358604819.226806344 30 atime=1358604819.226806344 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flake/flakecodecwidget.h0000644000175000001440000000165312076525023030130 0ustar00danielusers00000000000000 #ifndef FLAKECODECWIDGET_H #define FLAKECODECWIDGET_H #include "../../core/codecwidget.h" class KComboBox; class QSlider; class QSpinBox; class QCheckBox; class KLineEdit; class FlakeCodecWidget : public CodecWidget { Q_OBJECT public: FlakeCodecWidget(); ~FlakeCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *_options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: QSlider *sCompressionLevel; QSpinBox *iCompressionLevel; QCheckBox *cCmdArguments; KLineEdit *lCmdArguments; QString currentFormat; // holds the current output file format private slots: void compressionLevelSliderChanged( int quality ); void compressionLevelSpinBoxChanged( int quality ); }; #endif // FLAKECODECWIDGET_H ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_libav0000644000000000000000000000011712276433306023436 xustar0030 mtime=1392129734.821244023 20 atime=1359637235 29 ctime=1418040695.15471724 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_libav/0000755000175000001440000000000012276433306024505 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_libav/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000012012102465502026234 xustar0030 mtime=1359637314.295019755 20 atime=1308763306 30 ctime=1418040695.153717241 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_libav/CMakeLists.txt0000755000175000001440000000117612102465502027244 0ustar00danielusers00000000000000project(soundkonverter_codec_libav) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_libav_SRCS soundkonverter_codec_libav.cpp libavcodecwidget.cpp ) kde4_add_plugin(soundkonverter_codec_libav ${soundkonverter_codec_libav_SRCS}) target_link_libraries(soundkonverter_codec_libav ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_libav DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_libav.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_libav/PaxHeaders.4329/soundkonverter_codec_libav0000644000000000000000000000006212276145051031034 xustar0020 atime=1398102755 30 ctime=1418040695.153717241 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_libav/soundkonverter_codec_libav.cpp0000755000175000001440000004742312276145051032625 0ustar00danielusers00000000000000 #include "libavcodecglobal.h" #include "soundkonverter_codec_libav.h" #include "libavcodecwidget.h" #include "../../core/conversionoptions.h" #include "../../metadata/tagengine.h" #include #include #include #include #include // TODO check for decoders at runtime, too soundkonverter_codec_libav::soundkonverter_codec_libav( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["avconv"] = ""; KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); configVersion = group.readEntry( "configVersion", 0 ); experimentalCodecsEnabled = group.readEntry( "experimentalCodecsEnabled", false ); libavVersionMajor = group.readEntry( "libavVersionMajor", 0 ); libavVersionMinor = group.readEntry( "libavVersionMinor", 0 ); libavLastModified = group.readEntry( "libavLastModified", QDateTime() ); libavCodecList = group.readEntry( "codecList", QStringList() ).toSet(); CodecData data; LibavCodecData libavData; // WARNING enabled codecs need to be rescanned everytime new codecs are added here -> increase plugin version data.libavCodecList.clear(); data.codecName = "wav"; libavData.name = "wav"; libavData.external = false; libavData.experimental = false; data.libavCodecList.append( libavData ); codecList.append( data ); data.libavCodecList.clear(); data.codecName = "ogg vorbis"; libavData.name = "libvorbis"; libavData.external = true; libavData.experimental = false; data.libavCodecList.append( libavData ); libavData.name = "vorbis"; libavData.external = true; // ? libavData.experimental = true; data.libavCodecList.append( libavData ); codecList.append( data ); // data.libavCodecList.clear(); // data.codecName = "opus"; // libavData.name = "opus"; // libavData.external = true; // libavData.experimental = false; // data.libavCodecList.append( libavData ); // codecList.append( data ); data.libavCodecList.clear(); data.codecName = "mp3"; libavData.name = "libmp3lame"; libavData.external = true; libavData.experimental = false; data.libavCodecList.append( libavData ); libavData.name = "mp3"; libavData.external = true; libavData.experimental = false; data.libavCodecList.append( libavData ); codecList.append( data ); data.libavCodecList.clear(); data.codecName = "flac"; libavData.name = "flac"; libavData.external = false; libavData.experimental = false; data.libavCodecList.append( libavData ); codecList.append( data ); data.libavCodecList.clear(); data.codecName = "wma"; libavData.name = "wmav2"; libavData.external = false; libavData.experimental = false; data.libavCodecList.append( libavData ); libavData.name = "wmav1"; libavData.external = false; libavData.experimental = false; data.libavCodecList.append( libavData ); codecList.append( data ); data.libavCodecList.clear(); data.codecName = "aac"; libavData.name = "libfaac"; libavData.external = true; libavData.experimental = false; data.libavCodecList.append( libavData ); libavData.name = "aac"; libavData.external = false; libavData.experimental = true; data.libavCodecList.append( libavData ); codecList.append( data ); data.libavCodecList.clear(); data.codecName = "m4a/aac"; libavData.name = "libfaac"; libavData.external = true; libavData.experimental = false; data.libavCodecList.append( libavData ); libavData.name = "aac"; libavData.external = false; libavData.experimental = true; data.libavCodecList.append( libavData ); codecList.append( data ); data.libavCodecList.clear(); data.codecName = "ac3"; libavData.name = "ac3"; libavData.external = false; libavData.experimental = false; data.libavCodecList.append( libavData ); codecList.append( data ); data.libavCodecList.clear(); data.codecName = "m4a/alac"; libavData.name = "alac"; libavData.external = false; libavData.experimental = false; data.libavCodecList.append( libavData ); codecList.append( data ); data.libavCodecList.clear(); data.codecName = "mp2"; libavData.name = "mp2"; libavData.external = false; libavData.experimental = false; data.libavCodecList.append( libavData ); codecList.append( data ); data.libavCodecList.clear(); data.codecName = "amr nb"; libavData.name = "libopencore_amrnb"; libavData.external = true; libavData.experimental = false; data.libavCodecList.append( libavData ); libavData.name = "amr_nb"; libavData.external = true; libavData.experimental = false; data.libavCodecList.append( libavData ); codecList.append( data ); // codecMap["sonic"] = "sonic"; // codecMap["sonic lossless"] = "sonicls"; // codecMap["real audio 1"] = "real_144"; // codecMap["e-ac3"] = "eac3"; for( int i=0; i soundkonverter_codec_libav::codecTable() { QList table; QStringList fromCodecs; QStringList toCodecs; /// decode fromCodecs += "wav"; fromCodecs += "ogg vorbis"; // fromCodecs += "opus"; fromCodecs += "mp3"; fromCodecs += "flac"; fromCodecs += "wma"; fromCodecs += "aac"; fromCodecs += "ac3"; fromCodecs += "m4a/alac"; fromCodecs += "mp2"; // fromCodecs += "sonic"; // fromCodecs += "sonic lossless"; fromCodecs += "als"; fromCodecs += "amr nb"; fromCodecs += "amr wb"; fromCodecs += "ape"; // fromCodecs += "e-ac3"; fromCodecs += "speex"; fromCodecs += "m4a/aac"; fromCodecs += "mp1"; fromCodecs += "musepack"; fromCodecs += "shorten"; // fromCodecs += "mlp"; // fromCodecs += "truehd"; // fromCodecs += "truespeech"; fromCodecs += "tta"; fromCodecs += "wavpack"; fromCodecs += "ra"; fromCodecs += "sad"; /// containers fromCodecs += "3gp"; fromCodecs += "rm"; /// video fromCodecs += "avi"; fromCodecs += "mkv"; fromCodecs += "ogv"; fromCodecs += "mpeg"; fromCodecs += "mov"; fromCodecs += "mp4"; fromCodecs += "flv"; fromCodecs += "wmv"; fromCodecs += "rv"; /// encode if( !binaries["avconv"].isEmpty() ) { QFileInfo libavInfo( binaries["avconv"] ); if( libavInfo.lastModified() > libavLastModified || configVersion < version() ) { infoProcess = new KProcess(); infoProcess.data()->setOutputChannelMode( KProcess::MergedChannels ); connect( infoProcess.data(), SIGNAL(readyRead()), this, SLOT(infoProcessOutput()) ); connect( infoProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(infoProcessExit(int,QProcess::ExitStatus)) ); QStringList command; command += binaries["avconv"]; command += "-codecs"; infoProcess.data()->clearProgram(); infoProcess.data()->setShellCommand( command.join(" ") ); infoProcess.data()->start(); infoProcess.data()->waitForFinished( 3000 ); } } for( int i=0; i codecs; codecs += QSet::fromList(fromCodecs); codecs += QSet::fromList(toCodecs); allCodecs = codecs.toList(); return table; } bool soundkonverter_codec_libav::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return true; } void soundkonverter_codec_libav::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) if( !configDialog.data() ) { configDialog = new KDialog( parent ); configDialog.data()->setCaption( i18n("Configure %1").arg(global_plugin_name) ); configDialog.data()->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Default ); QWidget *configDialogWidget = new QWidget( configDialog.data() ); QHBoxLayout *configDialogBox = new QHBoxLayout( configDialogWidget ); configDialogExperimantalCodecsEnabledCheckBox = new QCheckBox( i18n("Enable experimental codecs"), configDialogWidget ); configDialogBox->addWidget( configDialogExperimantalCodecsEnabledCheckBox ); configDialog.data()->setMainWidget( configDialogWidget ); connect( configDialog.data(), SIGNAL( okClicked() ), this, SLOT( configDialogSave() ) ); connect( configDialog.data(), SIGNAL( defaultClicked() ), this, SLOT( configDialogDefault() ) ); } configDialogExperimantalCodecsEnabledCheckBox->setChecked( experimentalCodecsEnabled ); configDialog.data()->show(); } void soundkonverter_codec_libav::configDialogSave() { if( configDialog.data() ) { const bool old_experimentalCodecsEnabled = experimentalCodecsEnabled; experimentalCodecsEnabled = configDialogExperimantalCodecsEnabledCheckBox->isChecked(); KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); group.writeEntry( "experimentalCodecsEnabled", experimentalCodecsEnabled ); if( experimentalCodecsEnabled != old_experimentalCodecsEnabled ) { KMessageBox::information( configDialog.data(), i18n("Please restart soundKonverter in order to activate the changes.") ); } configDialog.data()->deleteLater(); } } void soundkonverter_codec_libav::configDialogDefault() { if( configDialog.data() ) { configDialogExperimantalCodecsEnabledCheckBox->setChecked( false ); } } bool soundkonverter_codec_libav::hasInfo() { return false; } void soundkonverter_codec_libav::showInfo( QWidget *parent ) { Q_UNUSED(parent) } CodecWidget *soundkonverter_codec_libav::newCodecWidget() { LibavCodecWidget *widget = new LibavCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_codec_libav::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(tags) Q_UNUSED(replayGain) QStringList command; ConversionOptions *conversionOptions = _conversionOptions; if( outputCodec != "wav" ) { command += binaries["avconv"]; command += "-i"; command += "\"" + escapeUrl(inputFile) + "\""; for( int i=0; ibitrate) + "k"; } if( conversionOptions->pluginName == name() ) { command += conversionOptions->cmdArguments; } command += "\"" + escapeUrl(outputFile) + "\""; } else { command += binaries["avconv"]; command += "-i"; command += "\"" + escapeUrl(inputFile) + "\""; command += "\"" + escapeUrl(outputFile) + "\""; } CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); if( tags ) newItem->data.length = tags->length; newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_libav::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputFile) Q_UNUSED(outputFile) Q_UNUSED(inputCodec) Q_UNUSED(outputCodec) Q_UNUSED(_conversionOptions) Q_UNUSED(tags) Q_UNUSED(replayGain) return QStringList(); } float soundkonverter_codec_libav::parseOutput( const QString& output, int *length ) { // Duration: 00:02:16.50, start: 0.000000, bitrate: 1411 kb/s // size= 2445kB time=158.31 bitrate= 169.3kbits/s QRegExp regLength("Duration: (\\d{2}):(\\d{2}):(\\d{2})\\.(\\d{2})"); if( length && output.contains(regLength) ) { *length = regLength.cap(1).toInt()*3600 + regLength.cap(2).toInt()*60 + regLength.cap(3).toInt(); } QRegExp reg1("time=(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d{2})"); QRegExp reg2("time=(\\d+)\\.\\d"); if( output.contains(reg1) ) { return reg1.cap(1).toInt()*3600 + reg1.cap(2).toInt()*60 + reg1.cap(3).toInt(); } else if( output.contains(reg2) ) { return reg2.cap(1).toInt(); } // TODO error handling // Error while decoding stream #0.0 return -1; } float soundkonverter_codec_libav::parseOutput( const QString& output ) { return parseOutput( output, 0 ); } void soundkonverter_codec_libav::processOutput() { for( int i=0; iprocess == QObject::sender() ) { const QString output = backendItems.at(i)->process->readAllStandardOutput().data(); CodecPluginItem *pluginItem = qobject_cast(backendItems.at(i)); float progress = parseOutput( output, &pluginItem->data.length ); if( progress == -1 && !output.simplified().isEmpty() ) logOutput( backendItems.at(i)->id, output ); progress = progress * 100 / pluginItem->data.length; if( progress > backendItems.at(i)->progress ) backendItems.at(i)->progress = progress; return; } } } void soundkonverter_codec_libav::infoProcessOutput() { infoProcessOutputData.append( infoProcess.data()->readAllStandardOutput().data() ); } void soundkonverter_codec_libav::infoProcessExit( int exitCode, QProcess::ExitStatus exitStatus ) { Q_UNUSED(exitStatus) Q_UNUSED(exitCode) QRegExp regVersion("libav version (\\d+)\\.(\\d+) "); if( infoProcessOutputData.contains( regVersion ) ) { libavVersionMajor = regVersion.cap(1).toInt(); libavVersionMinor = regVersion.cap(2).toInt(); } libavCodecList.clear(); for( int i=0; igroup( "Plugin-"+name() ); group.writeEntry( "configVersion", version() ); group.writeEntry( "libavVersionMajor", libavVersionMajor ); group.writeEntry( "libavVersionMinor", libavVersionMinor ); group.writeEntry( "libavLastModified", libavLastModified ); group.writeEntry( "codecList", libavCodecList.toList() ); infoProcessOutputData.clear(); infoProcess.data()->deleteLater(); } #include "soundkonverter_codec_libav.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_codec_libav/PaxHeaders.4329/soundkonverter_codec_libav0000644000000000000000000000011712102465770031036 xustar0030 mtime=1359637496.640813869 20 atime=1358604819 29 ctime=1418040695.15471724 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_libav/soundkonverter_codec_libav.h0000755000175000001440000000452012102465770032262 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_FFMPEG_H #define SOUNDKONVERTER_CODEC_FFMPEG_H #include "../../core/codecplugin.h" #include #include class ConversionOptions; class KDialog; class QCheckBox; class soundkonverter_codec_libav : public CodecPlugin { Q_OBJECT public: struct LibavCodecData { QString name; bool external; bool experimental; }; struct CodecData { QString codecName; QList libavCodecList; LibavCodecData currentLibavCodec; }; /** Default Constructor */ soundkonverter_codec_libav( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_libav(); QString name(); int version(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output, int *length ); float parseOutput( const QString& output ); private: QList codecList; QWeakPointer infoProcess; QString infoProcessOutputData; QWeakPointer configDialog; QCheckBox *configDialogExperimantalCodecsEnabledCheckBox; int configVersion; bool experimentalCodecsEnabled; int libavVersionMajor; int libavVersionMinor; QDateTime libavLastModified; QSet libavCodecList; private slots: /** Get the process' output */ void processOutput(); void configDialogSave(); void configDialogDefault(); void infoProcessOutput(); void infoProcessExit( int exitCode, QProcess::ExitStatus exitStatus ); }; K_EXPORT_SOUNDKONVERTER_CODEC( libav, soundkonverter_codec_libav ) #endif // _SOUNDKONVERTER_CODEC_FFMPEG_H_ ./soundkonverter-2.1.2/plugins/soundkonverter_codec_libav/PaxHeaders.4329/libavcodecwidget.h0000644000000000000000000000011712102465757027166 xustar0030 mtime=1359637487.000771907 20 atime=1358604819 29 ctime=1418040695.15471724 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_libav/libavcodecwidget.h0000644000175000001440000000170612102465757030164 0ustar00danielusers00000000000000 #ifndef FFMPEGCODECWIDGET_H #define FFMPEGCODECWIDGET_H #include "../../core/codecwidget.h" class QLabel; class QSlider; class QSpinBox; class QCheckBox; class KComboBox; class KLineEdit; class LibavCodecWidget : public CodecWidget { Q_OBJECT public: LibavCodecWidget(); ~LibavCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *_options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: QLabel *lBitrate; QSlider *sBitrate; QSpinBox *iBitrate; KComboBox *cBitrate; QCheckBox *cCmdArguments; KLineEdit *lCmdArguments; QString currentFormat; // holds the current output file format private slots: void qualitySliderChanged( int bitrate ); void qualitySpinBoxChanged( int bitrate ); }; #endif // FFMPEGCODECWIDGET_H./soundkonverter-2.1.2/plugins/soundkonverter_codec_libav/PaxHeaders.4329/soundkonverter_codec_libav0000644000000000000000000000011712102467270031033 xustar0030 mtime=1359638200.094871009 20 atime=1308601627 29 ctime=1418040695.15471724 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_libav/soundkonverter_codec_libav.desktop0000755000175000001440000000053212102467270033500 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter libav Plugin X-KDE-Library=soundkonverter_codec_libav ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_libav X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_codec_libav/PaxHeaders.4329/libavcodecglobal.h0000644000000000000000000000006212102474164027132 xustar0020 atime=1416311951 30 ctime=1418040695.153717241 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_libav/libavcodecglobal.h0000644000175000001440000000021412102474164030122 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "libav" #endif #ifndef global_plugin_version #define global_plugin_version 2 #endif ./soundkonverter-2.1.2/plugins/soundkonverter_codec_libav/PaxHeaders.4329/libavcodecwidget.cpp0000644000000000000000000000006212276433306027515 xustar0020 atime=1418040445 30 ctime=1418040695.153717241 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_libav/libavcodecwidget.cpp0000644000175000001440000002214112276433306030510 0ustar00danielusers00000000000000 #include "libavcodecglobal.h" #include "libavcodecwidget.h" #include "../../core/conversionoptions.h" #include #include #include #include #include #include #include #include #include LibavCodecWidget::LibavCodecWidget() : CodecWidget(), currentFormat( "ogg vorbis" ) { QGridLayout *grid = new QGridLayout( this ); grid->setContentsMargins( 0, 0, 0, 0 ); // set up encoding options selection QHBoxLayout *topBox = new QHBoxLayout(); grid->addLayout( topBox, 0, 0 ); lBitrate = new QLabel( i18n("Bitrate:"), this ); topBox->addWidget( lBitrate ); sBitrate = new QSlider( Qt::Horizontal, this ); sBitrate->setRange( 8, 320 ); sBitrate->setValue( 160 ); connect( sBitrate, SIGNAL(valueChanged(int)), this, SLOT(qualitySliderChanged(int)) ); connect( sBitrate, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( sBitrate ); iBitrate = new QSpinBox( this ); iBitrate->setRange( 8, 320 ); iBitrate->setValue( 160 ); iBitrate->setSuffix( " kbps" ); iBitrate->setFixedWidth( iBitrate->sizeHint().width() ); connect( iBitrate, SIGNAL(valueChanged(int)), this, SLOT(qualitySpinBoxChanged(int)) ); connect( iBitrate, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( iBitrate ); cBitrate = new KComboBox( this ); cBitrate->addItem( "32 kbps" ); cBitrate->addItem( "40 kbps" ); cBitrate->addItem( "48 kbps" ); cBitrate->addItem( "56 kbps" ); cBitrate->addItem( "64 kbps" ); cBitrate->addItem( "80 kbps" ); cBitrate->addItem( "96 kbps" ); cBitrate->addItem( "112 kbps" ); cBitrate->addItem( "128 kbps" ); cBitrate->addItem( "160 kbps" ); cBitrate->addItem( "192 kbps" ); cBitrate->addItem( "224 kbps" ); cBitrate->addItem( "256 kbps" ); cBitrate->addItem( "320 kbps" ); cBitrate->addItem( "384 kbps" ); cBitrate->addItem( "448 kbps" ); cBitrate->addItem( "512 kbps" ); cBitrate->addItem( "576 kbps" ); cBitrate->addItem( "640 kbps" ); cBitrate->setCurrentIndex( 10 ); cBitrate->hide(); connect( cBitrate, SIGNAL(activated(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( cBitrate ); topBox->addStretch(); // cmd arguments box QHBoxLayout *cmdArgumentsBox = new QHBoxLayout(); grid->addLayout( cmdArgumentsBox, 1, 0 ); cCmdArguments = new QCheckBox( i18n("Additional encoder arguments:"), this ); cmdArgumentsBox->addWidget( cCmdArguments ); lCmdArguments = new KLineEdit( this ); lCmdArguments->setEnabled( false ); cmdArgumentsBox->addWidget( lCmdArguments ); connect( cCmdArguments, SIGNAL(toggled(bool)), lCmdArguments, SLOT(setEnabled(bool)) ); grid->setRowStretch( 2, 1 ); } LibavCodecWidget::~LibavCodecWidget() {} ConversionOptions *LibavCodecWidget::currentConversionOptions() { ConversionOptions *options = new ConversionOptions(); options->qualityMode = ConversionOptions::Bitrate; if( currentFormat == "ac3" ) options->bitrate = cBitrate->currentText().replace(" kbps","").toInt(); else options->bitrate = iBitrate->value(); options->quality = -1000; options->bitrateMode = ConversionOptions::Cbr; if( cCmdArguments->isChecked() ) options->cmdArguments = lCmdArguments->text(); else options->cmdArguments = ""; return options; } bool LibavCodecWidget::setCurrentConversionOptions( ConversionOptions *_options ) { if( !_options || _options->pluginName != global_plugin_name ) return false; ConversionOptions *options = _options; if( currentFormat == "ac3" ) cBitrate->setCurrentIndex( cBitrate->findText(QString::number(options->bitrate)+" kbps") ); else iBitrate->setValue( options->bitrate ); cCmdArguments->setChecked( !options->cmdArguments.isEmpty() ); if( !options->cmdArguments.isEmpty() ) lCmdArguments->setText( options->cmdArguments ); return true; } void LibavCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; if( currentFormat == "wav" ) { lBitrate->hide(); sBitrate->hide(); iBitrate->hide(); cBitrate->hide(); cCmdArguments->hide(); lCmdArguments->hide(); } else if( currentFormat == "flac" || currentFormat == "m4a/alac" ) { lBitrate->hide(); sBitrate->hide(); iBitrate->hide(); cBitrate->hide(); cCmdArguments->show(); lCmdArguments->show(); } else if( currentFormat == "ac3" ) { lBitrate->show(); sBitrate->hide(); iBitrate->hide(); cBitrate->show(); cCmdArguments->show(); lCmdArguments->show(); } else { lBitrate->show(); sBitrate->show(); iBitrate->show(); cBitrate->hide(); cCmdArguments->show(); lCmdArguments->show(); } if( currentFormat == "mp2" ) { sBitrate->setRange( 32, 384 ); iBitrate->setRange( 32, 384 ); } else { sBitrate->setRange( 8, 320 ); iBitrate->setRange( 8, 320 ); } } QString LibavCodecWidget::currentProfile() { if( currentFormat == "wav" || currentFormat == "flac" || currentFormat == "m4a/alac" ) { return i18n("Lossless"); } else if( currentFormat == "amr nb" || currentFormat == "speex" ) { return i18n("User defined"); } else if( currentFormat == "ac3" ) { if( cBitrate->currentText() == "64 kbps" ) { return i18n("Very low"); } else if( cBitrate->currentText() == "128 kbps" ) { return i18n("Low"); } else if( cBitrate->currentText() == "192 kbps" ) { return i18n("Medium"); } else if( cBitrate->currentText() == "320 kbps" ) { return i18n("High"); } else if( cBitrate->currentText() == "640 kbps" ) { return i18n("Very high"); } } else { if( iBitrate->value() == 64 ) { return i18n("Very low"); } else if( iBitrate->value() == 128 ) { return i18n("Low"); } else if( iBitrate->value() == 160 ) { return i18n("Medium"); } else if( iBitrate->value() == 240 ) { return i18n("High"); } else if( iBitrate->value() == 320 ) { return i18n("Very high"); } } return i18n("User defined"); } bool LibavCodecWidget::setCurrentProfile( const QString& profile ) { if( profile == i18n("Very low") ) { if( currentFormat == "ac3" ) { cBitrate->setCurrentIndex( cBitrate->findText("64 kbps") ); } else { sBitrate->setValue( 64 ); iBitrate->setValue( 64 ); } cCmdArguments->setChecked( false ); return true; } else if( profile == i18n("Low") ) { if( currentFormat == "ac3" ) { cBitrate->setCurrentIndex( cBitrate->findText("128 kbps") ); } else { sBitrate->setValue( 128 ); iBitrate->setValue( 128 ); } cCmdArguments->setChecked( false ); return true; } else if( profile == i18n("Medium") ) { if( currentFormat == "ac3" ) { cBitrate->setCurrentIndex( cBitrate->findText("192 kbps") ); } else { sBitrate->setValue( 160 ); iBitrate->setValue( 160 ); } cCmdArguments->setChecked( false ); return true; } else if( profile == i18n("High") ) { if( currentFormat == "ac3" ) { cBitrate->setCurrentIndex( cBitrate->findText("320 kbps") ); } else { sBitrate->setValue( 240 ); iBitrate->setValue( 240 ); } cCmdArguments->setChecked( false ); return true; } else if( profile == i18n("Very high") ) { if( currentFormat == "ac3" ) { cBitrate->setCurrentIndex( cBitrate->findText("640 kbps") ); } else { sBitrate->setValue( 320 ); iBitrate->setValue( 320 ); } cCmdArguments->setChecked( false ); return true; } return false; } int LibavCodecWidget::currentDataRate() { int dataRate; if( currentFormat == "wav" ) { dataRate = 10590000; } else if( currentFormat == "flac" || currentFormat == "m4a/alac" ) { dataRate = 6520000; } else if( currentFormat == "ac3" ) { dataRate = cBitrate->currentText().replace(" kbps","").toInt()/8*60*1000; } else { dataRate = iBitrate->value()/8*60*1000; } return dataRate; } void LibavCodecWidget::qualitySliderChanged( int bitrate ) { iBitrate->setValue( bitrate ); } void LibavCodecWidget::qualitySpinBoxChanged( int bitrate ) { sBitrate->setValue( bitrate ); } ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006111635146242020645 xustar0020 atime=1316276673 29 ctime=1418040695.16071723 ./soundkonverter-2.1.2/plugins/CMakeLists.txt0000644000175000001440000000032411635146242021640 0ustar00danielusers00000000000000file(GLOB _plugins *) foreach(_current_plugin ${_plugins}) if(IS_DIRECTORY ${_current_plugin}) add_subdirectory(${_current_plugin}) endif(IS_DIRECTORY ${_current_plugin}) endforeach(_current_plugin) ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_opustools0000644000000000000000000000013112276433700024402 xustar0030 mtime=1392129984.015103446 30 atime=1358604819.235806368 29 ctime=1418040695.16071723 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_opustools/0000755000175000001440000000000012276433700025455 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_opustools/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000012712076525023027222 xustar0029 mtime=1358604819.23680637 29 atime=1358604819.23680637 29 ctime=1418040695.16071723 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_opustools/CMakeLists.txt0000755000175000001440000000130412076525023030214 0ustar00danielusers00000000000000project(soundkonverter_codec_opustools) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_opustools_SRCS soundkonverter_codec_opustools.cpp opustoolscodecwidget.cpp opustoolsconversionoptions.cpp ) kde4_add_plugin(soundkonverter_codec_opustools ${soundkonverter_codec_opustools_SRCS}) target_link_libraries(soundkonverter_codec_opustools ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_opustools DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_opustools.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_opustools/PaxHeaders.4329/soundkonverter_codec_o0000644000000000000000000000006112276145051031146 xustar0020 atime=1418040445 29 ctime=1418040695.16071723 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_opustools/soundkonverter_codec_opustools.cpp0000755000175000001440000001732212276145051034544 0ustar00danielusers00000000000000 #include "opustoolscodecglobal.h" #include "soundkonverter_codec_opustools.h" #include "../../core/conversionoptions.h" #include "opustoolscodecwidget.h" #include "opustoolsconversionoptions.h" #include #include #include soundkonverter_codec_opustools::soundkonverter_codec_opustools( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["opusenc"] = ""; binaries["opusdec"] = ""; allCodecs += "opus"; allCodecs += "wav"; KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); configVersion = group.readEntry( "configVersion", 0 ); uncoupledChannels = group.readEntry( "uncoupledChannels", false ); } soundkonverter_codec_opustools::~soundkonverter_codec_opustools() {} QString soundkonverter_codec_opustools::name() { return global_plugin_name; } QList soundkonverter_codec_opustools::codecTable() { QList table; ConversionPipeTrunk newTrunk; newTrunk.codecFrom = "wav"; newTrunk.codecTo = "opus"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["opusenc"] != "" ); newTrunk.problemInfo = standardMessage( "encode_codec,backend", "opus", "opusenc" ) + "\n" + i18n( "'%1' is usually in the package '%2' which should be shipped with your distribution.", QString("opusenc"), QString("opus-tools") ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "opus"; newTrunk.codecTo = "wav"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["opusdec"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "opus", "opusdec" ) + "\n" + i18n( "'%1' is usually in the package '%2' which should be shipped with your distribution.", QString("opusdec"), QString("opus-tools") ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); return table; } bool soundkonverter_codec_opustools::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return true; } void soundkonverter_codec_opustools::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) if( !configDialog.data() ) { configDialog = new KDialog( parent ); configDialog.data()->setCaption( i18n("Configure %1").arg(global_plugin_name) ); configDialog.data()->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Default ); QWidget *configDialogWidget = new QWidget( configDialog.data() ); QVBoxLayout *configDialogBox = new QVBoxLayout( configDialogWidget ); configDialogUncoupledChannelsCheckBox = new QCheckBox( i18n("Uncoupled channels"), configDialogWidget ); configDialogUncoupledChannelsCheckBox->setToolTip( i18n("Use one mono stream per channel") ); configDialogBox->addWidget( configDialogUncoupledChannelsCheckBox ); configDialog.data()->setMainWidget( configDialogWidget ); connect( configDialog.data(), SIGNAL( okClicked() ), this, SLOT( configDialogSave() ) ); connect( configDialog.data(), SIGNAL( defaultClicked() ), this, SLOT( configDialogDefault() ) ); } configDialogUncoupledChannelsCheckBox->setChecked( uncoupledChannels ); configDialog.data()->show(); } void soundkonverter_codec_opustools::configDialogSave() { if( configDialog.data() ) { uncoupledChannels = configDialogUncoupledChannelsCheckBox->isChecked(); KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); group.writeEntry( "uncoupledChannels", uncoupledChannels ); configDialog.data()->deleteLater(); } } void soundkonverter_codec_opustools::configDialogDefault() { if( configDialog.data() ) { configDialogUncoupledChannelsCheckBox->setChecked( false ); } } bool soundkonverter_codec_opustools::hasInfo() { return false; } void soundkonverter_codec_opustools::showInfo( QWidget *parent ) { Q_UNUSED(parent) } CodecWidget *soundkonverter_codec_opustools::newCodecWidget() { OpusToolsCodecWidget *widget = new OpusToolsCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_codec_opustools::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { QStringList command = convertCommand( inputFile, outputFile, inputCodec, outputCodec, _conversionOptions, tags, replayGain ); if( command.isEmpty() ) return BackendPlugin::UnknownError; CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_opustools::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(tags) Q_UNUSED(replayGain) if( !_conversionOptions ) return QStringList(); QStringList command; ConversionOptions *conversionOptions = _conversionOptions; OpusToolsConversionOptions *opusToolsConversionOptions = 0; if( conversionOptions->pluginName == name() ) { opusToolsConversionOptions = static_cast(conversionOptions); } if( outputCodec == "opus" ) { command += binaries["opusenc"]; command += "--bitrate"; if( opusToolsConversionOptions ) { command += QString::number(opusToolsConversionOptions->data.floatBitrate); } else { command += QString::number(conversionOptions->bitrate); } if( conversionOptions->bitrateMode == ConversionOptions::Abr ) { command += "--vbr"; } else if( conversionOptions->bitrateMode == ConversionOptions::Cbr ) { command += "--hard-cbr"; } // TODO --comp Encoding computational complexity (0-10, default: 10) if( uncoupledChannels ) { command += "--uncoupled"; } command += "\"" + escapeUrl(inputFile) + "\""; command += "\"" + escapeUrl(outputFile) + "\""; } else { command += binaries["opusdec"]; if( outputFile.isEmpty() ) { command += "--quiet"; } command += "\"" + escapeUrl(inputFile) + "\""; command += "\"" + escapeUrl(outputFile) + "\""; } return command; } float soundkonverter_codec_opustools::parseOutput( const QString& output ) { Q_UNUSED(output) // [|] 00:00:30.66 15.3x realtime, 309.3kbit/s return -1; } ConversionOptions *soundkonverter_codec_opustools::conversionOptionsFromXml( QDomElement conversionOptions, QList *filterOptionsElements ) { OpusToolsConversionOptions *options = new OpusToolsConversionOptions(); options->fromXml( conversionOptions, filterOptionsElements ); return options; } #include "soundkonverter_codec_opustools.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_codec_opustools/PaxHeaders.4329/opustoolscodecwidget.c0000644000000000000000000000006112276433700031076 xustar0020 atime=1416311951 29 ctime=1418040695.16071723 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_opustools/opustoolscodecwidget.cpp0000644000175000001440000001361412276433700032437 0ustar00danielusers00000000000000 #include "opustoolscodecglobal.h" #include "opustoolscodecwidget.h" #include "../../core/conversionoptions.h" #include "opustoolsconversionoptions.h" #include #include #include #include #include #include #include #include #include OpusToolsCodecWidget::OpusToolsCodecWidget() : CodecWidget(), currentFormat( "opus" ) { const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); QGridLayout *grid = new QGridLayout( this ); grid->setContentsMargins( 0, 0, 0, 0 ); // set up encoding options selection QHBoxLayout *topBox = new QHBoxLayout(); grid->addLayout( topBox, 0, 0 ); sQuality = new QSlider( Qt::Horizontal, this ); sQuality->setRange( 600, 51200 ); sQuality->setSingleStep( 100 ); sQuality->setValue( 16000 ); connect( sQuality, SIGNAL(valueChanged(int)), this, SLOT(qualitySliderChanged(int)) ); connect( sQuality, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( sQuality ); dQuality = new QDoubleSpinBox( this ); dQuality->setRange( 6, 512 ); dQuality->setSingleStep( 1 ); dQuality->setDecimals( 2 ); dQuality->setSuffix( " kbps" ); dQuality->setValue( 160 ); dQuality->setFixedWidth( dQuality->sizeHint().width() ); connect( dQuality, SIGNAL(valueChanged(double)), this, SLOT(qualitySpinBoxChanged(double)) ); connect( dQuality, SIGNAL(valueChanged(double)), SIGNAL(optionsChanged()) ); topBox->addWidget( dQuality ); topBox->addSpacing( fontHeight ); QLabel *lBitrateMode = new QLabel( i18n("Bitrate mode:"), this ); topBox->addWidget( lBitrateMode ); cBitrateMode = new KComboBox( this ); cBitrateMode->addItem( i18n("Average") ); cBitrateMode->addItem( i18n("Constant") ); cBitrateMode->setCurrentIndex( 0 ); cBitrateMode->setFixedWidth( cBitrateMode->sizeHint().width() ); connect( cBitrateMode, SIGNAL(activated(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( cBitrateMode ); topBox->addStretch(); grid->setRowStretch( 1, 1 ); } OpusToolsCodecWidget::~OpusToolsCodecWidget() {} // TODO optimize int OpusToolsCodecWidget::bitrateForQuality( double quality ) { return quality*100/3; } // TODO optimize double OpusToolsCodecWidget::qualityForBitrate( int bitrate ) { return (double)bitrate*3/100; } ConversionOptions *OpusToolsCodecWidget::currentConversionOptions() { OpusToolsConversionOptions *options = new OpusToolsConversionOptions(); options->qualityMode = ConversionOptions::Bitrate; options->bitrate = (int)dQuality->value(); options->data.floatBitrate = dQuality->value(); options->quality = qualityForBitrate( options->bitrate ); options->bitrateMode = ( cBitrateMode->currentText()==i18n("Average") ) ? ConversionOptions::Abr : ConversionOptions::Cbr; return options; } bool OpusToolsCodecWidget::setCurrentConversionOptions( ConversionOptions *_options ) { if( !_options ) return false; ConversionOptions *options = _options; OpusToolsConversionOptions *opusToolsOptions = 0; if( options->pluginName == global_plugin_name ) { opusToolsOptions = static_cast(options); } if( opusToolsOptions ) dQuality->setValue( opusToolsOptions->data.floatBitrate ); else dQuality->setValue( options->bitrate ); if( options->bitrateMode == ConversionOptions::Abr ) cBitrateMode->setCurrentIndex( cBitrateMode->findText(i18n("Average")) ); else cBitrateMode->setCurrentIndex( cBitrateMode->findText(i18n("Constant")) ); return true; } void OpusToolsCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; setEnabled( currentFormat != "wav" ); } QString OpusToolsCodecWidget::currentProfile() { if( currentFormat == "wav" ) { return i18n("Lossless"); } else if( dQuality->value() == 80 ) { return i18n("Very low"); } else if( dQuality->value() == 128 ) { return i18n("Low"); } else if( dQuality->value() == 192 ) { return i18n("Medium"); } else if( dQuality->value() == 240 ) { return i18n("High"); } else if( dQuality->value() == 320 ) { return i18n("Very high"); } return i18n("User defined"); } bool OpusToolsCodecWidget::setCurrentProfile( const QString& profile ) { if( profile == i18n("Very low") ) { sQuality->setValue( 8000 ); dQuality->setValue( 80 ); cBitrateMode->setCurrentIndex( 0 ); return true; } else if( profile == i18n("Low") ) { sQuality->setValue( 12800 ); dQuality->setValue( 128 ); cBitrateMode->setCurrentIndex( 0 ); return true; } else if( profile == i18n("Medium") ) { sQuality->setValue( 19200 ); dQuality->setValue( 192 ); cBitrateMode->setCurrentIndex( 0 ); return true; } else if( profile == i18n("High") ) { sQuality->setValue( 24000 ); dQuality->setValue( 240 ); cBitrateMode->setCurrentIndex( 0 ); return true; } else if( profile == i18n("Very high") ) { sQuality->setValue( 32000 ); dQuality->setValue( 320 ); cBitrateMode->setCurrentIndex( 0 ); return true; } return false; } int OpusToolsCodecWidget::currentDataRate() { int dataRate; if( currentFormat == "wav" ) { dataRate = 10590000; } else { dataRate = dQuality->value()/8*60*1000; } return dataRate; } void OpusToolsCodecWidget::qualitySliderChanged( int quality ) { dQuality->setValue( double(quality)/100.0 ); } void OpusToolsCodecWidget::qualitySpinBoxChanged( double quality ) { sQuality->setValue( round(quality*100.0) ); } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_opustools/PaxHeaders.4329/opustoolsconversionopt0000644000000000000000000000006112076525023031302 xustar0020 atime=1397391139 29 ctime=1418040695.16071723 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_opustools/opustoolsconversionoptions.cpp0000644000175000001440000000310012076525023033742 0ustar00danielusers00000000000000 #include "opustoolscodecglobal.h" #include "opustoolsconversionoptions.h" OpusToolsConversionOptions::OpusToolsConversionOptions() : ConversionOptions() { pluginName = global_plugin_name; } OpusToolsConversionOptions::~OpusToolsConversionOptions() {} bool OpusToolsConversionOptions::equals( ConversionOptions *_other ) { if( !_other || _other->pluginName!=pluginName ) return false; OpusToolsConversionOptions *other = dynamic_cast(_other); return ( equalsBasics(_other) && equalsFilters(_other) && data.floatBitrate == other->data.floatBitrate ); } QDomElement OpusToolsConversionOptions::toXml( QDomDocument document ) { QDomElement conversionOptions = ConversionOptions::toXml( document ); QDomElement encodingOptions = conversionOptions.elementsByTagName("encodingOptions").at(0).toElement(); QDomElement data = document.createElement("data"); data.setAttribute("floatBitrate",OpusToolsConversionOptions::data.floatBitrate); encodingOptions.appendChild(data); return conversionOptions; } bool OpusToolsConversionOptions::fromXml( QDomElement conversionOptions, QList *filterOptionsElements ) { ConversionOptions::fromXml( conversionOptions, filterOptionsElements ); QDomElement encodingOptions = conversionOptions.elementsByTagName("encodingOptions").at(0).toElement(); QDomElement data = encodingOptions.elementsByTagName("data").at(0).toElement(); OpusToolsConversionOptions::data.floatBitrate = data.attribute("floatBitrate").toFloat(); return true; } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_opustools/PaxHeaders.4329/opustoolsconversionopt0000644000000000000000000000013112076525023031300 xustar0030 mtime=1358604819.238806376 30 atime=1358604819.238806376 29 ctime=1418040695.16071723 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_opustools/opustoolsconversionoptions.h0000644000175000001440000000105012076525023033411 0ustar00danielusers00000000000000 #ifndef OPUSTOOLSCONVERSIONOPTIONS_H #define OPUSTOOLSCONVERSIONOPTIONS_H #include "../../core/conversionoptions.h" class OpusToolsConversionOptions : public ConversionOptions { public: OpusToolsConversionOptions(); ~OpusToolsConversionOptions(); bool equals( ConversionOptions *_other ); QDomElement toXml( QDomDocument document ); bool fromXml( QDomElement conversionOptions, QList *filterOptionsElements = 0 ); struct Data { float floatBitrate; } data; }; #endif // OPUSTOOLSCONVERSIONOPTIONS_H./soundkonverter-2.1.2/plugins/soundkonverter_codec_opustools/PaxHeaders.4329/opustoolscodecglobal.h0000644000000000000000000000012712076525023031061 xustar0029 mtime=1358604819.23680637 29 atime=1358604819.23680637 29 ctime=1418040695.16071723 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_opustools/opustoolscodecglobal.h0000644000175000001440000000011312076525023032045 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "Opus Tools" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_codec_opustools/PaxHeaders.4329/soundkonverter_codec_o0000644000000000000000000000013112076525023031143 xustar0030 mtime=1358604819.238806376 30 atime=1358604819.238806376 29 ctime=1418040695.16071723 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_opustools/soundkonverter_codec_opustools.desktop0000755000175000001440000000054712076525023035433 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter Opus Tools Plugin X-KDE-Library=soundkonverter_codec_opustools ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_opustools X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_codec_opustools/PaxHeaders.4329/opustoolscodecwidget.h0000644000000000000000000000013012076525023031076 xustar0030 mtime=1358604819.237806373 29 atime=1358604819.23680637 29 ctime=1418040695.16071723 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_opustools/opustoolscodecwidget.h0000644000175000001440000000170712076525023032102 0ustar00danielusers00000000000000 #ifndef OPUSTOOLSCODECWIDGET_H #define OPUSTOOLSCODECWIDGET_H #include "../../core/codecwidget.h" class QSlider; class QDoubleSpinBox; class KComboBox; class OpusToolsCodecWidget : public CodecWidget { Q_OBJECT public: OpusToolsCodecWidget(); ~OpusToolsCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *_options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: QSlider *sQuality; QDoubleSpinBox *dQuality; KComboBox *cBitrateMode; QString currentFormat; // holds the current output file format int bitrateForQuality( double quality ); double qualityForBitrate( int bitrate ); private slots: void qualitySliderChanged( int quality ); void qualitySpinBoxChanged( double quality ); }; #endif // OPUSTOOLSCODECWIDGET_H./soundkonverter-2.1.2/plugins/soundkonverter_codec_opustools/PaxHeaders.4329/soundkonverter_codec_o0000644000000000000000000000013112076525023031143 xustar0030 mtime=1358604819.239806379 30 atime=1358604819.239806379 29 ctime=1418040695.16071723 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_opustools/soundkonverter_codec_opustools.h0000755000175000001440000000334512076525023034210 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_OPUSTOOLS_H #define SOUNDKONVERTER_CODEC_OPUSTOOLS_H #include "../../core/codecplugin.h" #include class ConversionOptions; class KDialog; class QCheckBox; class soundkonverter_codec_opustools : public CodecPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_codec_opustools( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_opustools(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output ); ConversionOptions *conversionOptionsFromXml( QDomElement conversionOptions, QList *filterOptionsElements = 0 ); private: QWeakPointer configDialog; QCheckBox *configDialogUncoupledChannelsCheckBox; int configVersion; bool uncoupledChannels; private slots: void configDialogSave(); void configDialogDefault(); }; K_EXPORT_SOUNDKONVERTER_CODEC( opustools, soundkonverter_codec_opustools ) #endif // SOUNDKONVERTER_CODEC_OPUSTOOLS_H ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_speex0000644000000000000000000000012012276433306023457 xustar0030 mtime=1392129734.600243229 20 atime=1358274330 30 ctime=1418040695.162717227 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_speex/0000755000175000001440000000000012276433306024534 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_speex/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006211726605635026306 xustar0020 atime=1306662474 30 ctime=1418040695.162717227 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_speex/CMakeLists.txt0000755000175000001440000000117611726605635027311 0ustar00danielusers00000000000000project(soundkonverter_codec_speex) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_speex_SRCS soundkonverter_codec_speex.cpp speexcodecwidget.cpp ) kde4_add_plugin(soundkonverter_codec_speex ${soundkonverter_codec_speex_SRCS}) target_link_libraries(soundkonverter_codec_speex ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_speex DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_speex.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_speex/PaxHeaders.4329/speexcodecwidget.h0000644000000000000000000000013212076525023027232 xustar0030 mtime=1358604819.240806382 30 atime=1358604819.240806382 30 ctime=1418040695.162717227 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_speex/speexcodecwidget.h0000644000175000001440000000173612076525023030236 0ustar00danielusers00000000000000 #ifndef SPEEXCODECWIDGET_H #define SPEEXCODECWIDGET_H #include "../../core/codecwidget.h" class KComboBox; class QSlider; class QDoubleSpinBox; // class QCheckBox; class SpeexCodecWidget : public CodecWidget { Q_OBJECT public: SpeexCodecWidget(); ~SpeexCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *_options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: KComboBox *cMode; QSlider *sQuality; QDoubleSpinBox *dQuality; QString currentFormat; // holds the current output file format int bitrateForQuality( double quality ); double qualityForBitrate( int bitrate ); private slots: void modeChanged( int mode ); void qualitySliderChanged( int quality ); void qualitySpinBoxChanged( double quality ); }; #endif // SPEEXCODECWIDGET_H./soundkonverter-2.1.2/plugins/soundkonverter_codec_speex/PaxHeaders.4329/speexcodecwidget.cpp0000644000000000000000000000006212276433306027573 xustar0020 atime=1416311950 30 ctime=1418040695.162717227 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_speex/speexcodecwidget.cpp0000644000175000001440000001264312276433306030574 0ustar00danielusers00000000000000 #include "speexcodecglobal.h" #include "speexcodecwidget.h" #include "../../core/conversionoptions.h" // #include #include #include #include #include #include #include // #include #include SpeexCodecWidget::SpeexCodecWidget() : CodecWidget(), currentFormat( "speex" ) { QGridLayout *grid = new QGridLayout( this ); grid->setContentsMargins( 0, 0, 0, 0 ); // set up encoding options selection QHBoxLayout *topBox = new QHBoxLayout(); grid->addLayout( topBox, 0, 0 ); QLabel *lMode = new QLabel( i18n("Mode:"), this ); topBox->addWidget( lMode ); cMode = new KComboBox( this ); cMode->addItem( i18n("Quality") ); cMode->addItem( i18n("Bitrate") ); connect( cMode, SIGNAL(activated(int)), this, SLOT(modeChanged(int)) ); connect( cMode, SIGNAL(activated(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( cMode ); sQuality = new QSlider( Qt::Horizontal, this ); connect( sQuality, SIGNAL(valueChanged(int)), this, SLOT(qualitySliderChanged(int)) ); connect( sQuality, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( sQuality ); dQuality = new QDoubleSpinBox( this ); dQuality->setRange( 8, 160 ); dQuality->setSuffix( " kbps" ); dQuality->setFixedWidth( dQuality->sizeHint().width() ); connect( dQuality, SIGNAL(valueChanged(double)), this, SLOT(qualitySpinBoxChanged(double)) ); connect( dQuality, SIGNAL(valueChanged(double)), SIGNAL(optionsChanged()) ); topBox->addWidget( dQuality ); topBox->addStretch(); QHBoxLayout *midBox = new QHBoxLayout(); grid->addLayout( midBox, 1, 0 ); midBox->addStretch(); grid->setRowStretch( 2, 1 ); modeChanged( 0 ); } SpeexCodecWidget::~SpeexCodecWidget() {} // TODO optimize int SpeexCodecWidget::bitrateForQuality( double quality ) { return quality*100/3; } // TODO optimize double SpeexCodecWidget::qualityForBitrate( int bitrate ) { return (double)bitrate*3/100; } ConversionOptions *SpeexCodecWidget::currentConversionOptions() { ConversionOptions *options = new ConversionOptions(); if( cMode->currentText()==i18n("Quality") ) { options->qualityMode = ConversionOptions::Quality; options->quality = dQuality->value(); options->bitrate = bitrateForQuality( options->quality ); options->bitrateMode = ConversionOptions::Vbr; } else { options->qualityMode = ConversionOptions::Bitrate; options->bitrate = dQuality->value(); options->quality = qualityForBitrate( options->bitrate ); options->bitrateMode = ConversionOptions::Abr; } return options; } bool SpeexCodecWidget::setCurrentConversionOptions( ConversionOptions *_options ) { if( !_options || _options->pluginName != global_plugin_name ) return false; ConversionOptions *options = _options; if( options->qualityMode == ConversionOptions::Quality ) { cMode->setCurrentIndex( cMode->findText(i18n("Quality")) ); modeChanged( cMode->currentIndex() ); dQuality->setValue( options->quality ); } else { cMode->setCurrentIndex( cMode->findText(i18n("Bitrate")) ); modeChanged( cMode->currentIndex() ); dQuality->setValue( options->bitrate ); } return true; } void SpeexCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; setEnabled( currentFormat != "wav" ); } QString SpeexCodecWidget::currentProfile() { return i18n("User defined"); } bool SpeexCodecWidget::setCurrentProfile( const QString& profile ) { return profile == i18n("User defined"); } int SpeexCodecWidget::currentDataRate() { int dataRate; if( currentFormat == "wav" ) { dataRate = 10590000; } return dataRate; } void SpeexCodecWidget::modeChanged( int mode ) { if( mode == 0 ) { sQuality->setRange( 0, 10 ); sQuality->setSingleStep( 1 ); dQuality->setRange( 0, 10 ); dQuality->setSingleStep( 1 ); dQuality->setDecimals( 0 ); dQuality->setSuffix( "" ); sQuality->setValue( 8 ); dQuality->setValue( 8 ); // dQuality->setValue( qualityForBitrate(dQuality->value()) ); // qualitySpinBoxChanged( dQuality->value() ); sQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", 0, 10) ); dQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", 0, 10) ); } else { sQuality->setRange( 8, 160 ); sQuality->setSingleStep( 8 ); dQuality->setRange( 8, 160 ); dQuality->setSingleStep( 8 ); dQuality->setDecimals( 0 ); dQuality->setSuffix( " kbps" ); sQuality->setValue( 64 ); dQuality->setValue( 64 ); // dQuality->setValue( bitrateForQuality(dQuality->value()) ); // qualitySpinBoxChanged( dQuality->value() ); sQuality->setToolTip( "" ); dQuality->setToolTip( "" ); } } void SpeexCodecWidget::qualitySliderChanged( int quality ) { dQuality->setValue( quality ); } void SpeexCodecWidget::qualitySpinBoxChanged( double quality ) { sQuality->setValue( quality ); } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_speex/PaxHeaders.4329/speexcodecglobal.h0000644000000000000000000000006211441446045027212 xustar0020 atime=1418040444 30 ctime=1418040695.162717227 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_speex/speexcodecglobal.h0000644000175000001440000000010611441446045030202 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "Speex" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_codec_speex/PaxHeaders.4329/soundkonverter_codec_speex0000644000000000000000000000006212276145051031112 xustar0020 atime=1398102755 30 ctime=1418040695.162717227 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_speex/soundkonverter_codec_speex.cpp0000755000175000001440000001113612276145051032673 0ustar00danielusers00000000000000 #include "speexcodecglobal.h" #include "soundkonverter_codec_speex.h" #include "../../core/conversionoptions.h" #include "speexcodecwidget.h" soundkonverter_codec_speex::soundkonverter_codec_speex( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["speexenc"] = ""; binaries["speexdec"] = ""; allCodecs += "speex"; allCodecs += "wav"; } soundkonverter_codec_speex::~soundkonverter_codec_speex() {} QString soundkonverter_codec_speex::name() { return global_plugin_name; } QList soundkonverter_codec_speex::codecTable() { QList table; ConversionPipeTrunk newTrunk; newTrunk.codecFrom = "wav"; newTrunk.codecTo = "speex"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["speexenc"] != "" ); newTrunk.problemInfo = standardMessage( "encode_codec,backend", "speex", "speex" ) + "\n" + standardMessage( "install_opensource_backend", "speex" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "speex"; newTrunk.codecTo = "wav"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["speexdec"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "speex", "speex" ) + "\n" + standardMessage( "install_opensource_backend", "speex" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); return table; } bool soundkonverter_codec_speex::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_codec_speex::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_codec_speex::hasInfo() { return false; } void soundkonverter_codec_speex::showInfo( QWidget *parent ) { Q_UNUSED(parent) } CodecWidget *soundkonverter_codec_speex::newCodecWidget() { SpeexCodecWidget *widget = new SpeexCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_codec_speex::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { const QStringList command = convertCommand( inputFile, outputFile, inputCodec, outputCodec, _conversionOptions, tags, replayGain ); if( command.isEmpty() ) return BackendPlugin::UnknownError; CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_speex::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(tags) Q_UNUSED(replayGain) if( !_conversionOptions ) return QStringList(); QStringList command; ConversionOptions *conversionOptions = _conversionOptions; if( outputCodec == "speex" ) { command += binaries["speexenc"]; if( conversionOptions->qualityMode == ConversionOptions::Quality ) { command += "--vbr"; command += "--quality"; command += QString::number(conversionOptions->quality); } else if( conversionOptions->qualityMode == ConversionOptions::Bitrate ) { command += "--abr"; command += QString::number(conversionOptions->bitrate*1000); } command += "\"" + escapeUrl(inputFile) + "\""; command += "\"" + escapeUrl(outputFile) + "\""; } else { command += binaries["speexdec"]; command += "\"" + escapeUrl(inputFile) + "\""; command += "\"" + escapeUrl(outputFile) + "\""; } return command; } float soundkonverter_codec_speex::parseOutput( const QString& output ) { Q_UNUSED(output) // no output return -1; } #include "soundkonverter_codec_speex.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_codec_speex/PaxHeaders.4329/soundkonverter_codec_speex0000644000000000000000000000013212076525023031107 xustar0030 mtime=1358604819.240806382 30 atime=1358604819.240806382 30 ctime=1418040695.162717227 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_speex/soundkonverter_codec_speex.h0000755000175000001440000000244012076525023032335 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_SPEEX_H #define SOUNDKONVERTER_CODEC_SPEEX_H #include "../../core/codecplugin.h" class ConversionOptions; class soundkonverter_codec_speex : public CodecPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_codec_speex( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_speex(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output ); }; K_EXPORT_SOUNDKONVERTER_CODEC( speex, soundkonverter_codec_speex ) #endif // SOUNDKONVERTER_CODEC_SPEEX_H ./soundkonverter-2.1.2/plugins/soundkonverter_codec_speex/PaxHeaders.4329/soundkonverter_codec_speex0000644000000000000000000000006211441445460031112 xustar0020 atime=1306662474 30 ctime=1418040695.162717227 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_speex/soundkonverter_codec_speex.desktop0000755000175000001440000000054111441445460033560 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter Vorbis Tools Plugin X-KDE-Library=soundkonverter_codec_speex ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_speex X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_replaygain_metaflac0000644000000000000000000000012012076525023025161 xustar0030 mtime=1358604819.252806414 20 atime=1358274330 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_metaflac/0000755000175000001440000000000012076525023026236 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_metaflac/PaxHeaders.4329/soundkonverter_rep0000644000000000000000000000031212076525023031122 xustar00112 path=./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_metaflac/soundkonverter_replaygain_metaflac.h 30 mtime=1358604819.252806414 30 atime=1358604819.252806414 30 ctime=1418040695.162717227 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_metaflac/soundkonverter_replaygain_metaflac0000755000175000001440000000176212076525023035331 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_REPLAYGAIN_METAFLAC_H #define SOUNDKONVERTER_REPLAYGAIN_METAFLAC_H #include "../../core/replaygainplugin.h" #include class ConversionOptions; class soundkonverter_replaygain_metaflac : public ReplayGainPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_replaygain_metaflac( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_replaygain_metaflac(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); unsigned int apply( const KUrl::List& fileList, ApplyMode mode = Add ); float parseOutput( const QString& output ); }; K_EXPORT_SOUNDKONVERTER_REPLAYGAIN( metaflac, soundkonverter_replaygain_metaflac ) #endif // _SOUNDKONVERTER_REPLAYGAIN_METAFLAC_H_ ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_metaflac/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006211726605575030017 xustar0020 atime=1308763307 30 ctime=1418040695.162717227 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_metaflac/CMakeLists.txt0000755000175000001440000000122211726605575031012 0ustar00danielusers00000000000000project(soundkonverter_replaygain_metaflac) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_replaygain_metaflac_SRCS soundkonverter_replaygain_metaflac.cpp ) kde4_add_plugin(soundkonverter_replaygain_metaflac ${soundkonverter_replaygain_metaflac_SRCS}) target_link_libraries(soundkonverter_replaygain_metaflac ${KDE4_KDEUI_LIBS} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_replaygain_metaflac DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_replaygain_metaflac.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_metaflac/PaxHeaders.4329/soundkonverter_rep0000644000000000000000000000024412076525023031126 xustar00114 path=./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_metaflac/soundkonverter_replaygain_metaflac.cpp 20 atime=1418040442 30 ctime=1418040695.162717227 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_metaflac/soundkonverter_replaygain_metaflac0000755000175000001440000000567012076525023035333 0ustar00danielusers00000000000000 #include "flacreplaygainglobal.h" #include "soundkonverter_replaygain_metaflac.h" soundkonverter_replaygain_metaflac::soundkonverter_replaygain_metaflac( QObject *parent, const QStringList& args ) : ReplayGainPlugin( parent ) { Q_UNUSED(args) binaries["metaflac"] = ""; allCodecs += "flac"; } soundkonverter_replaygain_metaflac::~soundkonverter_replaygain_metaflac() {} QString soundkonverter_replaygain_metaflac::name() { return global_plugin_name; } QList soundkonverter_replaygain_metaflac::codecTable() { QList table; ReplayGainPipe newPipe; newPipe.codecName = "flac"; newPipe.rating = 100; newPipe.enabled = ( binaries["metaflac"] != "" ); newPipe.problemInfo = standardMessage( "replygain_codec,backend", "flac", "metaflac" ) + "\n" + i18n( "'%1' is usually in the package '%2' which should be shipped with your distribution.", QString("metaflac"), QString("flac") ); table.append( newPipe ); return table; } bool soundkonverter_replaygain_metaflac::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_replaygain_metaflac::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_replaygain_metaflac::hasInfo() { return false; } void soundkonverter_replaygain_metaflac::showInfo( QWidget *parent ) { Q_UNUSED(parent) } unsigned int soundkonverter_replaygain_metaflac::apply( const KUrl::List& fileList, ReplayGainPlugin::ApplyMode mode ) { if( fileList.count() <= 0 ) return BackendPlugin::UnknownError; ReplayGainPluginItem *newItem = new ReplayGainPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); QStringList command; command += binaries["metaflac"]; if( mode == ReplayGainPlugin::Add || mode == ReplayGainPlugin::Force ) { command += "--add-replay-gain"; } else { command += "--remove-replay-gain"; } foreach( const KUrl file, fileList ) { command += "\"" + escapeUrl(file) + "\""; } newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } float soundkonverter_replaygain_metaflac::parseOutput( const QString& output ) { Q_UNUSED(output) // metaflac doesn't provide any progress data return -1; } #include "soundkonverter_replaygain_metaflac.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_metaflac/PaxHeaders.4329/soundkonverter_rep0000644000000000000000000000025011377742701031132 xustar00118 path=./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_metaflac/soundkonverter_replaygain_metaflac.desktop 20 atime=1308601627 30 ctime=1418040695.162717227 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_metaflac/soundkonverter_replaygain_metaflac0000755000175000001440000000056211377742701035335 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter metaflac plugin X-KDE-Library=soundkonverter_replaygain_metaflac ServiceTypes=soundKonverter/ReplayGainPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_replaygain_metaflac X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_metaflac/PaxHeaders.4329/flacreplaygainglob0000644000000000000000000000006211773075463031026 xustar0020 atime=1387113149 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_metaflac/flacreplaygainglobal.h0000644000175000001440000000011111773075463032555 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "Metaflac" #endif ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_fluidsynth0000644000000000000000000000012012276442334024525 xustar0030 mtime=1392133340.452583707 20 atime=1358274330 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_fluidsynth/0000755000175000001440000000000012276442334025602 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_fluidsynth/PaxHeaders.4329/fluidsynthcodecwidget0000644000000000000000000000006212076525023031120 xustar0020 atime=1367657017 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_fluidsynth/fluidsynthcodecwidget.cpp0000644000175000001440000000225612076525023032701 0ustar00danielusers00000000000000 #include "fluidsynthcodecglobal.h" #include "fluidsynthcodecwidget.h" #include "../../core/conversionoptions.h" #include FluidsynthCodecWidget::FluidsynthCodecWidget() : CodecWidget(), currentFormat( "midi" ) {} FluidsynthCodecWidget::~FluidsynthCodecWidget() {} ConversionOptions *FluidsynthCodecWidget::currentConversionOptions() { ConversionOptions *options = new ConversionOptions(); return options; } bool FluidsynthCodecWidget::setCurrentConversionOptions( ConversionOptions *_options ) { if( !_options || _options->pluginName != global_plugin_name ) return false; return true; } void FluidsynthCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; setEnabled( currentFormat != "wav" ); } QString FluidsynthCodecWidget::currentProfile() { return i18n("Lossless"); } bool FluidsynthCodecWidget::setCurrentProfile( const QString& profile ) { return profile == i18n("Lossless"); } int FluidsynthCodecWidget::currentDataRate() { int dataRate; if( currentFormat == "wav" ) { dataRate = 10590000; } return dataRate; } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_fluidsynth/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006211603060115027331 xustar0020 atime=1309420388 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_fluidsynth/CMakeLists.txt0000644000175000001440000000127411603060115030330 0ustar00danielusers00000000000000project(soundkonverter_codec_fluidsynth) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_fluidsynth_SRCS soundkonverter_codec_fluidsynth.cpp fluidsynthcodecwidget.cpp ) kde4_add_plugin(soundkonverter_codec_fluidsynth ${soundkonverter_codec_fluidsynth_SRCS}) target_link_libraries(soundkonverter_codec_fluidsynth ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_fluidsynth DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_fluidsynth.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_fluidsynth/PaxHeaders.4329/soundkonverter_codec_0000644000000000000000000000013212076525023031107 xustar0030 mtime=1358604819.228806348 30 atime=1358604819.228806348 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_fluidsynth/soundkonverter_codec_fluidsynth.h0000644000175000001440000000307512076525023034451 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_FLUIDSYNTH_H #define SOUNDKONVERTER_CODEC_FLUIDSYNTH_H #include "../../core/codecplugin.h" #include #include class ConversionOptions; class KDialog; class KUrlRequester; class soundkonverter_codec_fluidsynth : public CodecPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_codec_fluidsynth( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_fluidsynth(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& format ); void showConfigDialog( ActionType action, const QString& format, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output ); private: QWeakPointer configDialog; KUrlRequester *configDialogSoundFontUrlRequester; KUrl soundFontFile; private slots: void configDialogSave(); }; K_EXPORT_SOUNDKONVERTER_CODEC( fluidsynth, soundkonverter_codec_fluidsynth ) #endif // SOUNDKONVERTER_CODEC_FLUIDSYNTH_H ./soundkonverter-2.1.2/plugins/soundkonverter_codec_fluidsynth/PaxHeaders.4329/soundkonverter_codec_0000644000000000000000000000024211603025544031107 xustar00112 path=./soundkonverter-2.1.2/plugins/soundkonverter_codec_fluidsynth/soundkonverter_codec_fluidsynth.desktop 20 atime=1309420388 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_fluidsynth/soundkonverter_codec_fluidsynth.deskt0000644000175000001440000000055111603025544035326 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter Fluidsynth Plugin X-KDE-Library=soundkonverter_codec_fluidsynth ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_fluidsynth X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_codec_fluidsynth/PaxHeaders.4329/fluidsynthcodecglobal0000644000000000000000000000006211603043354031072 xustar0020 atime=1418040447 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_fluidsynth/fluidsynthcodecglobal.h0000644000175000001440000000011311603043354032306 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "FluidSynth" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_codec_fluidsynth/PaxHeaders.4329/fluidsynthcodecwidget0000644000000000000000000000013212076525023031116 xustar0030 mtime=1358604819.228806348 30 atime=1358604819.228806348 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_fluidsynth/fluidsynthcodecwidget.h0000644000175000001440000000117112076525023032341 0ustar00danielusers00000000000000 #ifndef FLUIDSYNTHCODECWIDGET_H #define FLUIDSYNTHCODECWIDGET_H #include "../../core/codecwidget.h" class FluidsynthCodecWidget : public CodecWidget { Q_OBJECT public: FluidsynthCodecWidget(); ~FluidsynthCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *_options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: QString currentFormat; // holds the current output file format }; #endif // FLUIDSYNTHCODECWIDGET_H ./soundkonverter-2.1.2/plugins/soundkonverter_codec_fluidsynth/PaxHeaders.4329/soundkonverter_codec_0000644000000000000000000000006212276442334031116 xustar0020 atime=1397391137 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_fluidsynth/soundkonverter_codec_fluidsynth.cpp0000644000175000001440000001513112276442334035005 0ustar00danielusers00000000000000 #include "fluidsynthcodecglobal.h" #include "soundkonverter_codec_fluidsynth.h" #include "../../core/conversionoptions.h" #include "fluidsynthcodecwidget.h" #include #include #include #include #include soundkonverter_codec_fluidsynth::soundkonverter_codec_fluidsynth( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["fluidsynth"] = ""; allCodecs += "midi"; allCodecs += "mod"; allCodecs += "wav"; KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); soundFontFile = group.readEntry( "soundFontFile", KUrl() ); } soundkonverter_codec_fluidsynth::~soundkonverter_codec_fluidsynth() {} QString soundkonverter_codec_fluidsynth::name() { return global_plugin_name; } QList soundkonverter_codec_fluidsynth::codecTable() { QList table; ConversionPipeTrunk newTrunk; newTrunk.codecFrom = "midi"; newTrunk.codecTo = "wav"; newTrunk.rating = 90; newTrunk.enabled = ( binaries["fluidsynth"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "midi", "fluidsynth" ) + "\n" + standardMessage( "install_opensource_backend", "fluidsynth" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "mod"; newTrunk.codecTo = "wav"; newTrunk.rating = 90; newTrunk.enabled = ( binaries["fluidsynth"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "mod", "fluidsynth" ) + "\n" + standardMessage( "install_opensource_backend", "fluidsynth" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); return table; } bool soundkonverter_codec_fluidsynth::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return true; } void soundkonverter_codec_fluidsynth::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) if( !configDialog.data() ) { const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); configDialog = new KDialog( parent ); configDialog.data()->setCaption( i18n("Configure %1").arg(global_plugin_name) ); configDialog.data()->setButtons( KDialog::Ok | KDialog::Cancel ); QWidget *configDialogWidget = new QWidget( configDialog.data() ); QHBoxLayout *configDialogBox = new QHBoxLayout( configDialogWidget ); QLabel *configDialogSoundFontLabel = new QLabel( i18n("Use SoundFont file:"), configDialogWidget ); configDialogSoundFontLabel->setToolTip( i18n("In order to convert the midi data to a wave form you need a SoundFont which maps the midi data to sound effects.\nHave a look at %1 in order to get SoundFont files.",QString("http://sourceforge.net/apps/trac/fluidsynth/wiki/SoundFont")) ); configDialogBox->addWidget( configDialogSoundFontLabel ); configDialogSoundFontUrlRequester = new KUrlRequester( configDialogWidget ); configDialogSoundFontUrlRequester->setMinimumWidth( 30*fontHeight ); configDialogBox->addWidget( configDialogSoundFontUrlRequester ); configDialog.data()->setMainWidget( configDialogWidget ); connect( configDialog.data(), SIGNAL( okClicked() ), this, SLOT( configDialogSave() ) ); } configDialogSoundFontUrlRequester->setUrl( soundFontFile ); configDialog.data()->show(); } void soundkonverter_codec_fluidsynth::configDialogSave() { if( configDialog.data() ) { soundFontFile = configDialogSoundFontUrlRequester->url().toLocalFile(); KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); group.writeEntry( "soundFontFile", soundFontFile ); configDialog.data()->deleteLater(); } } bool soundkonverter_codec_fluidsynth::hasInfo() { return false; } void soundkonverter_codec_fluidsynth::showInfo( QWidget *parent ) { Q_UNUSED(parent) } CodecWidget *soundkonverter_codec_fluidsynth::newCodecWidget() { FluidsynthCodecWidget *widget = new FluidsynthCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_codec_fluidsynth::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { if( soundFontFile.isEmpty() ) { emit log( 1000, i18n("FluidSynth is not configured, yet. You need to set a SoundFont file.") ); return BackendPlugin::BackendNeedsConfiguration; } const QStringList command = convertCommand( inputFile, outputFile, inputCodec, outputCodec, _conversionOptions, tags, replayGain ); if( command.isEmpty() ) { return BackendPlugin::UnknownError; } CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_fluidsynth::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(_conversionOptions) Q_UNUSED(tags) Q_UNUSED(replayGain) if( soundFontFile.isEmpty() ) return QStringList(); if( outputFile.isEmpty() ) return QStringList(); QStringList command; if( outputCodec == "wav" ) { command += binaries["fluidsynth"]; command += "-l"; command += "--fast-render"; command += "\"" + escapeUrl(outputFile) + "\""; command += "\"" + escapeUrl(soundFontFile) + "\""; command += "\"" + escapeUrl(inputFile) + "\""; } return command; } float soundkonverter_codec_fluidsynth::parseOutput( const QString& output ) { Q_UNUSED(output) // no output return -1; } #include "soundkonverter_codec_fluidsynth.moc" ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_ripper_icedax0000644000000000000000000000013112203641422024004 xustar0029 mtime=1376731922.17554885 30 atime=1376731922.174548846 30 ctime=1418040695.167717219 ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_icedax/0000755000175000001440000000000012203641422025057 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_ripper_icedax/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000013112203641422026621 xustar0029 mtime=1376731922.17554885 30 atime=1376731922.174548846 30 ctime=1418040695.167717219 ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_icedax/CMakeLists.txt0000755000175000001440000000114212203641422027620 0ustar00danielusers00000000000000project(soundkonverter_ripper_icedax) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_ripper_icedax_SRCS soundkonverter_ripper_icedax.cpp ) kde4_add_plugin(soundkonverter_ripper_icedax ${soundkonverter_ripper_icedax_SRCS}) target_link_libraries(soundkonverter_ripper_icedax ${KDE4_KDEUI_LIBS} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_ripper_icedax DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_ripper_icedax.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_icedax/PaxHeaders.4329/icedaxripperglobal.h0000644000000000000000000000006212203641422030075 xustar0020 atime=1418040449 30 ctime=1418040695.167717219 ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_icedax/icedaxripperglobal.h0000644000175000001440000000010712203641422031066 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "icedax" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_icedax/PaxHeaders.4329/soundkonverter_ripper_ic0000644000000000000000000000006212203641422031133 xustar0020 atime=1387113702 30 ctime=1418040695.167717219 ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_icedax/soundkonverter_ripper_icedax.cpp0000755000175000001440000001100212203641422033546 0ustar00danielusers00000000000000 #include "icedaxripperglobal.h" #include "soundkonverter_ripper_icedax.h" #include soundkonverter_ripper_icedax::soundkonverter_ripper_icedax( QObject *parent, const QStringList& args ) : RipperPlugin( parent ) { Q_UNUSED(args) binaries["icedax"] = ""; } soundkonverter_ripper_icedax::~soundkonverter_ripper_icedax() {} QString soundkonverter_ripper_icedax::name() { return global_plugin_name; } QList soundkonverter_ripper_icedax::codecTable() { QList table; ConversionPipeTrunk newTrunk; newTrunk.codecFrom = "audio cd"; newTrunk.codecTo = "wav"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["icedax"] != "" ); newTrunk.data.canRipEntireCd = true; newTrunk.problemInfo = i18n( "In order to rip audio cds per track or to a single file, you need to install 'icedax'.\n'icedax' is usually shipped with your distribution, the package name can vary." ); table.append( newTrunk ); return table; } bool soundkonverter_ripper_icedax::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_ripper_icedax::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_ripper_icedax::hasInfo() { return false; } void soundkonverter_ripper_icedax::showInfo( QWidget *parent ) { Q_UNUSED(parent) } unsigned int soundkonverter_ripper_icedax::rip( const QString& device, int track, int tracks, const KUrl& outputFile ) { QStringList command; command += binaries["icedax"]; command += "-g"; command += "-D"; command += device; if( track > 0 ) { command += "-t "+QString::number(track); } else { command += "-t 1+" + QString::number(tracks); } command += "\"" + outputFile.toLocalFile() + "\""; RipperPluginItem *newItem = new RipperPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->data.fileCount = ( track > 0 ) ? 1 : tracks; newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_ripper_icedax::ripCommand( const QString& device, int track, int tracks, const KUrl& outputFile ) { Q_UNUSED(device) Q_UNUSED(track) Q_UNUSED(tracks) Q_UNUSED(outputFile) return QStringList(); } float soundkonverter_ripper_icedax::parseOutput( const QString& output, RipperPluginItem *ripperItem ) { float progress = -1; QString data = output; data = data.left( data.lastIndexOf("%") ); if( data.lastIndexOf("%") >= 0 ) data = data.remove( 0, data.lastIndexOf("%") ); data = data.simplified(); progress = data.toFloat(); if( !ripperItem ) return progress; if( progress > 90 && ripperItem->data.lastFileProgress <= 90 ) { ripperItem->data.processedFiles++; } ripperItem->data.lastFileProgress = progress; int processedFiles = ripperItem->data.processedFiles; if( progress > 90 ) processedFiles--; return float( processedFiles * 100 + progress ) / ripperItem->data.fileCount; } float soundkonverter_ripper_icedax::parseOutput( const QString& output) { return parseOutput( output, 0 ); } void soundkonverter_ripper_icedax::processOutput() { for( int i=0; iprocess == QObject::sender() ) { QString output = backendItems.at(i)->process->readAllStandardOutput().data(); RipperPluginItem *pluginItem = qobject_cast(backendItems.at(i)); float progress = parseOutput( output, pluginItem ); if( progress == -1 && !output.simplified().isEmpty() ) logOutput( backendItems.at(i)->id, output ); if( progress > backendItems.at(i)->progress ) backendItems.at(i)->progress = progress; return; } } } #include "soundkonverter_ripper_icedax.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_icedax/PaxHeaders.4329/soundkonverter_ripper_ic0000644000000000000000000000013012203641422031127 xustar0029 mtime=1376731922.17554885 29 atime=1376731922.17554885 30 ctime=1418040695.167717219 ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_icedax/soundkonverter_ripper_icedax.desktop0000755000175000001440000000053612203641422034447 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter icedax plugin X-KDE-Library=soundkonverter_ripper_icedax ServiceTypes=soundKonverter/RipperPlugin X-KDE-PluginInfo-Author=Volker Härtel X-KDE-PluginInfo-Email=cyberbeat@gmx.de X-KDE-PluginInfo-Name=soundkonverter_ripper_icedax X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_icedax/PaxHeaders.4329/soundkonverter_ripper_ic0000644000000000000000000000013012203641422031127 xustar0029 mtime=1376731922.17554885 29 atime=1376731922.17554885 30 ctime=1418040695.167717219 ./soundkonverter-2.1.2/plugins/soundkonverter_ripper_icedax/soundkonverter_ripper_icedax.h0000755000175000001440000000233012203641422033217 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_RIPPER_ICEDAX_H #define SOUNDKONVERTER_RIPPER_ICEDAX_H #include "../../core/ripperplugin.h" #include #include #include class soundkonverter_ripper_icedax : public RipperPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_ripper_icedax( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_ripper_icedax(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); unsigned int rip( const QString& device, int track, int tracks, const KUrl& outputFile ); QStringList ripCommand( const QString& device, int track, int tracks, const KUrl& outputFile ); float parseOutput( const QString& output, RipperPluginItem *ripperItem ); float parseOutput( const QString& output ); private slots: /** Get the process' output */ void processOutput(); }; K_EXPORT_SOUNDKONVERTER_RIPPER( icedax, soundkonverter_ripper_icedax ) #endif // SOUNDKONVERTER_RIPPER_ICEDAX_H ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_flac0000644000000000000000000000012012276433306023240 xustar0030 mtime=1392129734.669243477 20 atime=1358274330 30 ctime=1418040695.155717238 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flac/0000755000175000001440000000000012276433306024315 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_flac/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006111726605707026066 xustar0020 atime=1308763306 29 ctime=1418040695.15471724 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flac/CMakeLists.txt0000755000175000001440000000116511726605707027070 0ustar00danielusers00000000000000project(soundkonverter_codec_flac) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_flac_SRCS soundkonverter_codec_flac.cpp flaccodecwidget.cpp ) kde4_add_plugin(soundkonverter_codec_flac ${soundkonverter_codec_flac_SRCS}) target_link_libraries(soundkonverter_codec_flac ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_flac DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_flac.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flac/PaxHeaders.4329/soundkonverter_codec_flac.h0000644000000000000000000000013112076525023030676 xustar0030 mtime=1358604819.226806344 30 atime=1358604819.226806344 29 ctime=1418040695.15471724 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flac/soundkonverter_codec_flac.h0000755000175000001440000000243312076525023031701 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_FLAC_H #define SOUNDKONVERTER_CODEC_FLAC_H #include "../../core/codecplugin.h" class ConversionOptions; class soundkonverter_codec_flac : public CodecPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_codec_flac( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_flac(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output ); }; K_EXPORT_SOUNDKONVERTER_CODEC( flac, soundkonverter_codec_flac ) #endif // _SOUNDKONVERTER_CODEC_FLAC_H_ ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flac/PaxHeaders.4329/soundkonverter_codec_flac.c0000644000000000000000000000006212276145051030675 xustar0020 atime=1418040445 30 ctime=1418040695.155717238 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flac/soundkonverter_codec_flac.cpp0000755000175000001440000001135012276145051032233 0ustar00danielusers00000000000000 #include "flaccodecglobal.h" #include "soundkonverter_codec_flac.h" #include "../../core/conversionoptions.h" #include "flaccodecwidget.h" soundkonverter_codec_flac::soundkonverter_codec_flac( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["flac"] = ""; allCodecs += "flac"; allCodecs += "wav"; } soundkonverter_codec_flac::~soundkonverter_codec_flac() {} QString soundkonverter_codec_flac::name() { return global_plugin_name; } QList soundkonverter_codec_flac::codecTable() { QList table; ConversionPipeTrunk newTrunk; newTrunk.codecFrom = "wav"; newTrunk.codecTo = "flac"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["flac"] != "" ); newTrunk.problemInfo = standardMessage( "encode_codec,backend", "flac", "flac" ) + "\n" + standardMessage( "install_opensource_backend", "flac" ); newTrunk.data.hasInternalReplayGain = true; table.append( newTrunk ); newTrunk.codecFrom = "flac"; newTrunk.codecTo = "wav"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["flac"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "flac", "flac" ) + "\n" + standardMessage( "install_opensource_backend", "flac" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); return table; } bool soundkonverter_codec_flac::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_codec_flac::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_codec_flac::hasInfo() { return false; } void soundkonverter_codec_flac::showInfo( QWidget *parent ) { Q_UNUSED(parent) } CodecWidget *soundkonverter_codec_flac::newCodecWidget() { FlacCodecWidget *widget = new FlacCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_codec_flac::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { QStringList command = convertCommand( inputFile, outputFile, inputCodec, outputCodec, _conversionOptions, tags, replayGain ); if( command.isEmpty() ) return BackendPlugin::UnknownError; CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_flac::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(tags) if( !_conversionOptions ) return QStringList(); if( inputFile.isEmpty() ) return QStringList(); QStringList command; ConversionOptions *conversionOptions = _conversionOptions; if( outputCodec == "flac" ) { command += binaries["flac"]; command += "-V"; if( conversionOptions->pluginName == global_plugin_name ) { command += "--compression-level-"+QString::number((int)conversionOptions->compressionLevel); } if( conversionOptions->replaygain && replayGain ) { command += "--replay-gain"; } command += "\"" + escapeUrl(inputFile) + "\""; command += "-o"; command += "\"" + escapeUrl(outputFile) + "\""; } else { command += binaries["flac"]; command += "-d"; command += "\"" + escapeUrl(inputFile) + "\""; command += "-o"; command += "\"" + escapeUrl(outputFile) + "\""; } return command; } float soundkonverter_codec_flac::parseOutput( const QString& output ) { // 01-Unknown.wav: 98% complete, ratio=0,479 // encode // 01-Unknown.wav: 27% complete // decode QRegExp regEnc("(\\d+)% complete"); if( output.contains(regEnc) ) { return (float)regEnc.cap(1).toInt(); } return -1; } #include "soundkonverter_codec_flac.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flac/PaxHeaders.4329/flaccodecwidget.h0000644000000000000000000000013112076525023026573 xustar0030 mtime=1358604819.226806344 30 atime=1358604819.226806344 29 ctime=1418040695.15471724 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flac/flaccodecwidget.h0000644000175000001440000000150712076525023027574 0ustar00danielusers00000000000000 #ifndef FLACCODECWIDGET_H #define FLACCODECWIDGET_H #include "../../core/codecwidget.h" class KComboBox; class QSlider; class QSpinBox; class FlacCodecWidget : public CodecWidget { Q_OBJECT public: FlacCodecWidget(); ~FlacCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *_options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: QSlider *sCompressionLevel; QSpinBox *iCompressionLevel; QString currentFormat; // holds the current output file format private slots: void compressionLevelSliderChanged( int quality ); void compressionLevelSpinBoxChanged( int quality ); }; #endif // FLACCODECWIDGET_H ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flac/PaxHeaders.4329/soundkonverter_codec_flac.d0000644000000000000000000000006211377743311030702 xustar0020 atime=1308601627 30 ctime=1418040695.155717238 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flac/soundkonverter_codec_flac.desktop0000755000175000001440000000052711377743311033132 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter Flac Plugin X-KDE-Library=soundkonverter_codec_flac ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_flac X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flac/PaxHeaders.4329/flaccodecglobal.h0000644000000000000000000000006211377725702026564 xustar0020 atime=1416311950 30 ctime=1418040695.155717238 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flac/flaccodecglobal.h0000644000175000001440000000010511377725702027553 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "FLAC" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flac/PaxHeaders.4329/flaccodecwidget.cpp0000644000000000000000000000013212276433306027133 xustar0030 mtime=1392129734.668243474 30 atime=1392129734.668243474 30 ctime=1418040695.155717238 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_flac/flaccodecwidget.cpp0000644000175000001440000000707212276433306030136 0ustar00danielusers00000000000000 #include "flaccodecglobal.h" #include "flaccodecwidget.h" #include "../../core/conversionoptions.h" #include #include #include #include #include FlacCodecWidget::FlacCodecWidget() : CodecWidget(), currentFormat( "flac" ) { QGridLayout *grid = new QGridLayout( this ); grid->setContentsMargins( 0, 0, 0, 0 ); // set up encoding options selection QHBoxLayout *topBox = new QHBoxLayout(); grid->addLayout( topBox, 0, 0 ); QLabel *lCompressionLevel = new QLabel( i18n("Compression level:"), this ); topBox->addWidget( lCompressionLevel ); sCompressionLevel = new QSlider( Qt::Horizontal, this ); sCompressionLevel->setRange( 0, 8 ); sCompressionLevel->setSingleStep( 1 ); sCompressionLevel->setPageStep( 1 ); // sQuality->setTickPosition( QSlider::TicksBelow ); // sQuality->setFixedWidth( sQuality->sizeHint().width() ); connect( sCompressionLevel, SIGNAL(valueChanged(int)), this, SLOT(compressionLevelSliderChanged(int)) ); connect( sCompressionLevel, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( sCompressionLevel ); sCompressionLevel->setToolTip( i18n("Compression level from %1 to %2 where %2 is the best compression.\nThe better the compression, the slower the conversion but the smaller the file size and vice versa.", 0, 8) ); iCompressionLevel = new QSpinBox( this ); iCompressionLevel->setRange( 0, 8 ); iCompressionLevel->setSingleStep( 1 ); iCompressionLevel->setFixedWidth( iCompressionLevel->sizeHint().width() ); // dQuality->setFixedHeight( cMode->minimumSizeHint().height() ); connect( iCompressionLevel, SIGNAL(valueChanged(int)), this, SLOT(compressionLevelSpinBoxChanged(int)) ); connect( iCompressionLevel, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( iCompressionLevel ); iCompressionLevel->setToolTip( i18n("Compression level from %1 to %2 where %2 is the best compression.\nThe better the compression, the slower the conversion but the smaller the file size and vice versa.", 0, 8) ); topBox->addStretch(); grid->setRowStretch( 1, 1 ); iCompressionLevel->setValue( 5 ); } FlacCodecWidget::~FlacCodecWidget() {} ConversionOptions *FlacCodecWidget::currentConversionOptions() { ConversionOptions *options = new ConversionOptions(); options->qualityMode = ConversionOptions::Lossless; options->compressionLevel = iCompressionLevel->value(); return options; } bool FlacCodecWidget::setCurrentConversionOptions( ConversionOptions *_options ) { if( !_options || _options->pluginName != global_plugin_name ) return false; ConversionOptions *options = _options; iCompressionLevel->setValue( options->compressionLevel ); return true; } void FlacCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; setEnabled( currentFormat != "wav" ); } QString FlacCodecWidget::currentProfile() { return i18n("Lossless"); } bool FlacCodecWidget::setCurrentProfile( const QString& profile ) { return profile == i18n("Lossless"); } int FlacCodecWidget::currentDataRate() { int dataRate; if( currentFormat == "wav" ) { dataRate = 10590000; } else { dataRate = 6400000; } return dataRate; } void FlacCodecWidget::compressionLevelSliderChanged( int quality ) { iCompressionLevel->setValue( quality ); } void FlacCodecWidget::compressionLevelSpinBoxChanged( int quality ) { sCompressionLevel->setValue( quality ); } ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_replaygain_aacgain0000644000000000000000000000012012441312442024763 xustar0030 mtime=1418040610.313840476 20 atime=1358274330 30 ctime=1418040695.159717232 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_aacgain/0000755000175000001440000000000012441312442026040 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_aacgain/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006211726605602027615 xustar0020 atime=1308763307 30 ctime=1418040695.159717232 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_aacgain/CMakeLists.txt0000755000175000001440000000121211726605602030607 0ustar00danielusers00000000000000project(soundkonverter_replaygain_aacgain) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_replaygain_aacgain_SRCS soundkonverter_replaygain_aacgain.cpp ) kde4_add_plugin(soundkonverter_replaygain_aacgain ${soundkonverter_replaygain_aacgain_SRCS}) target_link_libraries(soundkonverter_replaygain_aacgain ${KDE4_KDEUI_LIBS} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_replaygain_aacgain DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_replaygain_aacgain.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_aacgain/PaxHeaders.4329/aacreplaygainglobal0000644000000000000000000000006211773075463030771 xustar0020 atime=1416311951 30 ctime=1418040695.159717232 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_aacgain/aacreplaygainglobal.h0000644000175000001440000000011111773075463032203 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "AAC Gain" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_aacgain/PaxHeaders.4329/soundkonverter_repl0000644000000000000000000000031212441312442031100 xustar00112 path=./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_aacgain/soundkonverter_replaygain_aacgain.cpp 30 mtime=1418040610.313840476 30 atime=1418040610.313840476 30 ctime=1418040695.159717232 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_aacgain/soundkonverter_replaygain_aacgain.c0000755000175000001440000002213012441312442035153 0ustar00danielusers00000000000000 #include "aacreplaygainglobal.h" #include "soundkonverter_replaygain_aacgain.h" #include #include #include #include #include AacGainPluginItem::AacGainPluginItem( QObject *parent ) : ReplayGainPluginItem( parent ) {} AacGainPluginItem::~AacGainPluginItem() {} soundkonverter_replaygain_aacgain::soundkonverter_replaygain_aacgain( QObject *parent, const QStringList& args ) : ReplayGainPlugin( parent ) { Q_UNUSED(args) binaries["aacgain"] = ""; allCodecs += "m4v"; allCodecs += "mp3"; KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); tagMode = group.readEntry( "tagMode", 0 ); modifyAudioStream = group.readEntry( "modifyAudioStream", true ); } soundkonverter_replaygain_aacgain::~soundkonverter_replaygain_aacgain() {} QString soundkonverter_replaygain_aacgain::name() { return global_plugin_name; } QList soundkonverter_replaygain_aacgain::codecTable() { QList table; ReplayGainPipe newPipe; newPipe.codecName = "m4a/aac"; newPipe.rating = 100; newPipe.enabled = ( binaries["aacgain"] != "" ); newPipe.problemInfo = standardMessage( "replygain_codec,backend", "m4a/aac", "aacgain" ) + "\n" + standardMessage( "install_patented_backend", "aacgain" ); table.append( newPipe ); newPipe.codecName = "mp3"; newPipe.rating = 95; newPipe.enabled = ( binaries["aacgain"] != "" ); newPipe.problemInfo = standardMessage( "replygain_codec,backend", "mp3", "aacgain" ) + "\n" + standardMessage( "install_patented_backend", "aacgain" ); table.append( newPipe ); return table; } bool soundkonverter_replaygain_aacgain::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return true; } void soundkonverter_replaygain_aacgain::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) if( !configDialog.data() ) { configDialog = new KDialog( parent ); configDialog.data()->setCaption( i18n("Configure %1").arg(global_plugin_name) ); configDialog.data()->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Default ); QWidget *configDialogWidget = new QWidget( configDialog.data() ); QVBoxLayout *configDialogBox = new QVBoxLayout( configDialogWidget ); QHBoxLayout *configDialogBox1 = new QHBoxLayout(); QLabel *configDialogTagModeLabel = new QLabel( i18n("Use tag format:"), configDialogWidget ); configDialogBox1->addWidget( configDialogTagModeLabel ); configDialogTagModeComboBox = new QComboBox( configDialogWidget ); configDialogTagModeComboBox->addItem( "APE" ); configDialogTagModeComboBox->addItem( "ID3v2" ); configDialogBox1->addWidget( configDialogTagModeComboBox ); configDialogBox->addLayout( configDialogBox1 ); QHBoxLayout *configDialogBox2 = new QHBoxLayout(); configDialogModifyAudioStreamCheckBox = new QCheckBox( i18n("Modify audio stream"), configDialogWidget ); configDialogModifyAudioStreamCheckBox->setToolTip( i18n("Write gain adjustments directly into the encoded data. That way the adjustment works with all mp3 players.\nUndoing the changes is still possible since correction data will be written as well.") ); configDialogBox2->addWidget( configDialogModifyAudioStreamCheckBox ); configDialogBox->addLayout( configDialogBox2 ); configDialog.data()->setMainWidget( configDialogWidget ); connect( configDialog.data(), SIGNAL( okClicked() ), this, SLOT( configDialogSave() ) ); connect( configDialog.data(), SIGNAL( defaultClicked() ), this, SLOT( configDialogDefault() ) ); } configDialogTagModeComboBox->setCurrentIndex( tagMode ); configDialogModifyAudioStreamCheckBox->setChecked( modifyAudioStream ); configDialog.data()->show(); } void soundkonverter_replaygain_aacgain::configDialogSave() { if( configDialog.data() ) { tagMode = configDialogTagModeComboBox->currentIndex(); modifyAudioStream = configDialogModifyAudioStreamCheckBox->isChecked(); KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); group.writeEntry( "tagMode", tagMode ); group.writeEntry( "modifyAudioStream", modifyAudioStream ); configDialog.data()->deleteLater(); } } void soundkonverter_replaygain_aacgain::configDialogDefault() { if( configDialog.data() ) { configDialogTagModeComboBox->setCurrentIndex( 0 ); configDialogModifyAudioStreamCheckBox->setChecked( true ); } } bool soundkonverter_replaygain_aacgain::hasInfo() { return false; } void soundkonverter_replaygain_aacgain::showInfo( QWidget *parent ) { Q_UNUSED(parent) } unsigned int soundkonverter_replaygain_aacgain::apply( const KUrl::List& fileList, ReplayGainPlugin::ApplyMode mode ) { if( fileList.count() <= 0 ) return BackendPlugin::UnknownError; AacGainPluginItem *newItem = new AacGainPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); QStringList command; command += binaries["aacgain"]; command += "-k"; if( mode == ReplayGainPlugin::Add ) { if( modifyAudioStream ) { command += "-a"; } connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); } else if( mode == ReplayGainPlugin::Force ) { if( modifyAudioStream ) { command += "-a"; } command += "-s"; command += "r"; connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); } else { command += "-u"; connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(undoProcessExit(int,QProcess::ExitStatus)) ); newItem->undoFileList = fileList; } if( mode == ReplayGainPlugin::Add || mode == ReplayGainPlugin::Force ) { if( tagMode == 0 ) { // APE tags command += "-s"; command += "a"; } else { // ID3v2 tags command += "-s"; command += "i"; } } foreach( const KUrl file, fileList ) { command += "\"" + escapeUrl(file) + "\""; } newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } void soundkonverter_replaygain_aacgain::undoProcessExit( int exitCode, QProcess::ExitStatus exitStatus ) { Q_UNUSED(exitCode) Q_UNUSED(exitStatus) AacGainPluginItem *item = 0; for( int i=0; iprocess == QObject::sender() ) { item = (AacGainPluginItem*)backendItems.at(i); break; } } if( !item ) return; if( item->undoFileList.count() <= 0 ) return; if( item->process ) item->process->deleteLater(); item->process = new KProcess( item ); item->process->setOutputChannelMode( KProcess::MergedChannels ); connect( item->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( item->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); QStringList command; command += binaries["aacgain"]; command += "-s"; command += "d"; foreach( const KUrl file, item->undoFileList ) { command += "\"" + escapeUrl(file) + "\""; } item->process->clearProgram(); item->process->setShellCommand( command.join(" ") ); item->process->start(); logCommand( item->id, command.join(" ") ); } float soundkonverter_replaygain_aacgain::parseOutput( const QString& output ) { // 9% of 45218064 bytes analyzed // [1/10] 32% of 13066690 bytes analyzed float progress = -1.0f; QRegExp reg1("\\[(\\d+)/(\\d+)\\] (\\d+)%"); QRegExp reg2("(\\d+)%"); if( output.contains(reg1) ) { float fraction = 1.0f/reg1.cap(2).toInt(); progress = 100*(reg1.cap(1).toInt()-1)*fraction + reg1.cap(3).toInt()*fraction; } else if( output.contains(reg2) ) { progress = reg2.cap(1).toInt(); } // Applying mp3 gain change of -6 to /home/user/file.mp3... // Undoing mp3gain changes (6,6) to /home/user/file.mp3... // Deleting tag info of /home/user/file.mp3... QRegExp reg3("[Applying mp3 gain change|Undoing mp3gain changes|Deleting tag info]"); if( progress == -1 && output.contains(reg3) ) { progress = 0.0f; } return progress; } #include "soundkonverter_replaygain_aacgain.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_aacgain/PaxHeaders.4329/soundkonverter_repl0000644000000000000000000000013212441312442031100 xustar0030 mtime=1418040610.313840476 30 atime=1418040610.313840476 30 ctime=1418040695.159717232 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_aacgain/soundkonverter_replaygain_aacgain.h0000755000175000001440000000316412441312442035166 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_REPLAYGAIN_AACGAIN_H #define SOUNDKONVERTER_REPLAYGAIN_AACGAIN_H #include "../../core/replaygainplugin.h" #include #include class ConversionOptions; class KDialog; class QComboBox; class QCheckBox; class AacGainPluginItem : public ReplayGainPluginItem { Q_OBJECT public: AacGainPluginItem( QObject *parent=0 ); ~AacGainPluginItem(); KUrl::List undoFileList; }; class soundkonverter_replaygain_aacgain : public ReplayGainPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_replaygain_aacgain( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_replaygain_aacgain(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); unsigned int apply( const KUrl::List& fileList, ApplyMode mode = Add ); float parseOutput( const QString& output ); private: QWeakPointer configDialog; QComboBox *configDialogTagModeComboBox; QCheckBox *configDialogModifyAudioStreamCheckBox; int tagMode; bool modifyAudioStream; private slots: /** The undo process has exited */ virtual void undoProcessExit( int exitCode, QProcess::ExitStatus exitStatus ); void configDialogSave(); void configDialogDefault(); }; K_EXPORT_SOUNDKONVERTER_REPLAYGAIN( aacgain, soundkonverter_replaygain_aacgain ) #endif // _SOUNDKONVERTER_REPLAYGAIN_AACGAIN_H_ ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_aacgain/PaxHeaders.4329/soundkonverter_repl0000644000000000000000000000024611375521755031124 xustar00116 path=./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_aacgain/soundkonverter_replaygain_aacgain.desktop 20 atime=1308601627 30 ctime=1418040695.159717232 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_aacgain/soundkonverter_replaygain_aacgain.d0000755000175000001440000000055711375521755035203 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter aacgain plugin X-KDE-Library=soundkonverter_replaygain_aacgain ServiceTypes=soundKonverter/ReplayGainPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_replaygain_aacgain X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_wavpack0000644000000000000000000000011712276433306023775 xustar0030 mtime=1392129734.782243883 20 atime=1358274330 29 ctime=1418040695.16671722 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_wavpack/0000755000175000001440000000000012276433306025044 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_wavpack/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006111726605607026614 xustar0020 atime=1308763306 29 ctime=1418040695.16671722 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_wavpack/CMakeLists.txt0000755000175000001440000000122011726605607027606 0ustar00danielusers00000000000000project(soundkonverter_codec_wavpack) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_wavpack_SRCS soundkonverter_codec_wavpack.cpp wavpackcodecwidget.cpp ) kde4_add_plugin(soundkonverter_codec_wavpack ${soundkonverter_codec_wavpack_SRCS}) target_link_libraries(soundkonverter_codec_wavpack ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_wavpack DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_wavpack.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_wavpack/PaxHeaders.4329/wavpackcodecwidget.cpp0000644000000000000000000000006112276433306030412 xustar0020 atime=1416311949 29 ctime=1418040695.16671722 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_wavpack/wavpackcodecwidget.cpp0000644000175000001440000000576012276433306031416 0ustar00danielusers00000000000000 #include "wavpackcodecglobal.h" #include "wavpackcodecwidget.h" #include "../../core/conversionoptions.h" #include #include #include #include #include #include WavPackCodecWidget::WavPackCodecWidget() : CodecWidget(), currentFormat( "wavpack" ) { QGridLayout *grid = new QGridLayout( this ); grid->setContentsMargins( 0, 0, 0, 0 ); // set up encoding options selection QHBoxLayout *topBox = new QHBoxLayout(); grid->addLayout( topBox, 0, 0 ); QLabel *lCompressionLevel = new QLabel( i18n("Compression level:"), this ); topBox->addWidget( lCompressionLevel ); cCompressionLevel = new KComboBox( this ); cCompressionLevel->addItem( i18n("Fast") ); cCompressionLevel->addItem( i18n("Normal") ); cCompressionLevel->addItem( i18n("High quality") ); cCompressionLevel->addItem( i18n("Very high quality") ); topBox->addWidget( cCompressionLevel ); topBox->addStretch(); // cmd arguments box QHBoxLayout *cmdArgumentsBox = new QHBoxLayout(); grid->addLayout( cmdArgumentsBox, 1, 0 ); cCmdArguments = new QCheckBox( i18n("Additional encoder arguments:"), this ); cmdArgumentsBox->addWidget( cCmdArguments ); lCmdArguments = new KLineEdit( this ); lCmdArguments->setEnabled( false ); cmdArgumentsBox->addWidget( lCmdArguments ); connect( cCmdArguments, SIGNAL(toggled(bool)), lCmdArguments, SLOT(setEnabled(bool)) ); grid->setRowStretch( 2, 1 ); cCompressionLevel->setCurrentIndex( 1 ); } WavPackCodecWidget::~WavPackCodecWidget() {} ConversionOptions *WavPackCodecWidget::currentConversionOptions() { ConversionOptions *options = new ConversionOptions(); options->qualityMode = ConversionOptions::Lossless; options->compressionLevel = cCompressionLevel->currentIndex(); if( cCmdArguments->isChecked() ) options->cmdArguments = lCmdArguments->text(); else options->cmdArguments = ""; return options; } bool WavPackCodecWidget::setCurrentConversionOptions( ConversionOptions *_options ) { if( !_options || _options->pluginName != global_plugin_name ) return false; ConversionOptions *options = _options; cCompressionLevel->setCurrentIndex( options->compressionLevel ); cCmdArguments->setChecked( !options->cmdArguments.isEmpty() ); if( !options->cmdArguments.isEmpty() ) lCmdArguments->setText( options->cmdArguments ); return true; } void WavPackCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; setEnabled( currentFormat != "wav" ); } QString WavPackCodecWidget::currentProfile() { return i18n("Lossless"); } bool WavPackCodecWidget::setCurrentProfile( const QString& profile ) { return profile == i18n("Lossless"); } int WavPackCodecWidget::currentDataRate() { int dataRate; if( currentFormat == "wav" ) { dataRate = 10590000; } else { dataRate = 6400000; } return dataRate; } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_wavpack/PaxHeaders.4329/soundkonverter_codec_wav0000644000000000000000000000012712276145051031075 xustar0029 mtime=1392036393.17052903 29 atime=1392036393.17052903 29 ctime=1418040695.16671722 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_wavpack/soundkonverter_codec_wavpack.cpp0000755000175000001440000001234412276145051033515 0ustar00danielusers00000000000000 #include "wavpackcodecglobal.h" #include "soundkonverter_codec_wavpack.h" #include "../../core/conversionoptions.h" #include "wavpackcodecwidget.h" soundkonverter_codec_wavpack::soundkonverter_codec_wavpack( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["wavpack"] = ""; binaries["wvunpack"] = ""; allCodecs += "wavpack"; allCodecs += "wav"; } soundkonverter_codec_wavpack::~soundkonverter_codec_wavpack() {} QString soundkonverter_codec_wavpack::name() { return global_plugin_name; } QList soundkonverter_codec_wavpack::codecTable() { QList table; ConversionPipeTrunk newTrunk; newTrunk.codecFrom = "wav"; newTrunk.codecTo = "wavpack"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["wavpack"] != "" ); newTrunk.problemInfo = standardMessage( "encode_codec,backend", "wavpack", "wavpack" ) + "\n" + standardMessage( "install_website_backend,url", "wavpack", "http://www.wavpack.com" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "wavpack"; newTrunk.codecTo = "wav"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["wvunpack"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "wavpack", "wvunpack" ) + "\n" + i18n( "'%1' is usually in the package '%2' which you can download at %3", QString("wvunpack"), QString("wavpack"), QString("http://www.wavpack.com") ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); return table; } bool soundkonverter_codec_wavpack::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_codec_wavpack::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_codec_wavpack::hasInfo() { return false; } void soundkonverter_codec_wavpack::showInfo( QWidget *parent ) { Q_UNUSED(parent) } CodecWidget *soundkonverter_codec_wavpack::newCodecWidget() { WavPackCodecWidget *widget = new WavPackCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_codec_wavpack::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { QStringList command = convertCommand( inputFile, outputFile, inputCodec, outputCodec, _conversionOptions, tags, replayGain ); if( command.isEmpty() ) return BackendPlugin::UnknownError; CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_wavpack::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(tags) Q_UNUSED(replayGain) if( !_conversionOptions ) return QStringList(); QStringList command; ConversionOptions *conversionOptions = _conversionOptions; if( outputCodec == "wavpack" ) { command += binaries["wavpack"]; if( conversionOptions->pluginName == global_plugin_name ) { switch( (int)conversionOptions->compressionLevel ) { case 0: { command += "-f"; break; } case 2: { command += "-h"; break; } case 3: { command += "-hh"; break; } } command += conversionOptions->cmdArguments; } if( inputFile.isEmpty() ) { command += "--raw-pcm"; } command += "\"" + escapeUrl(inputFile) + "\""; command += "-o"; command += "\"" + escapeUrl(outputFile) + "\""; } else { command += binaries["wvunpack"]; command += "\"" + escapeUrl(inputFile) + "\""; command += "-o"; command += "\"" + escapeUrl(outputFile) + "\""; } return command; } float soundkonverter_codec_wavpack::parseOutput( const QString& output ) { // creating test.wv, 58% done... // restoring test.wv.wav, 31% done... QRegExp reg("\\s+(\\d+)% done"); if( output.contains(reg) ) { return (float)reg.cap(1).toInt(); } return -1; } #include "soundkonverter_codec_wavpack.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_codec_wavpack/PaxHeaders.4329/wavpackcodecwidget.h0000644000000000000000000000013112076525023030051 xustar0030 mtime=1358604819.245806395 30 atime=1358604819.245806395 29 ctime=1418040695.16671722 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_wavpack/wavpackcodecwidget.h0000644000175000001440000000137212076525023031052 0ustar00danielusers00000000000000 #ifndef WAVPACKCODECWIDGET_H #define WAVPACKCODECWIDGET_H #include "../../core/codecwidget.h" class KComboBox; class QCheckBox; class KLineEdit; class WavPackCodecWidget : public CodecWidget { Q_OBJECT public: WavPackCodecWidget(); ~WavPackCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *_options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: KComboBox *cCompressionLevel; QCheckBox *cCmdArguments; KLineEdit *lCmdArguments; QString currentFormat; // holds the current output file format }; #endif // WAVPACKCODECWIDGET_H ./soundkonverter-2.1.2/plugins/soundkonverter_codec_wavpack/PaxHeaders.4329/soundkonverter_codec_wav0000644000000000000000000000006111440753432031072 xustar0020 atime=1308601627 29 ctime=1418040695.16671722 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_wavpack/soundkonverter_codec_wavpack.desktop0000755000175000001440000000054011440753432034377 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter WavPack Plugin X-KDE-Library=soundkonverter_codec_wavpack ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_wavpack X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_codec_wavpack/PaxHeaders.4329/wavpackcodecglobal.h0000644000000000000000000000006111440753432030031 xustar0020 atime=1418040446 29 ctime=1418040695.16671722 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_wavpack/wavpackcodecglobal.h0000644000175000001440000000011011440753432031015 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "WavPack" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_codec_wavpack/PaxHeaders.4329/soundkonverter_codec_wav0000644000000000000000000000013112076525023031067 xustar0030 mtime=1358604819.245806395 30 atime=1358604819.245806395 29 ctime=1418040695.16671722 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_wavpack/soundkonverter_codec_wavpack.h0000755000175000001440000000246312076525023033162 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_WAVPACK_H #define SOUNDKONVERTER_CODEC_WAVPACK_H #include "../../core/codecplugin.h" class ConversionOptions; class soundkonverter_codec_wavpack : public CodecPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_codec_wavpack( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_wavpack(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output ); }; K_EXPORT_SOUNDKONVERTER_CODEC( wavpack, soundkonverter_codec_wavpack ) #endif // _SOUNDKONVERTER_CODEC_WAVPACK_H_ ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_twolame0000644000000000000000000000011712276433306024011 xustar0030 mtime=1392129734.687243542 20 atime=1358274330 29 ctime=1418040695.15471724 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_twolame/0000755000175000001440000000000012276433306025060 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_twolame/PaxHeaders.4329/twolamecodecwidget.cpp0000644000000000000000000000006112276433306030442 xustar0020 atime=1418040446 29 ctime=1418040695.15471724 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_twolame/twolamecodecwidget.cpp0000644000175000001440000001756612276433306031455 0ustar00danielusers00000000000000 #include "twolamecodecglobal.h" #include "twolamecodecwidget.h" #include "../../core/conversionoptions.h" #include #include #include #include #include #include // #include #include // TODO calibrate quality profiles TwoLameCodecWidget::TwoLameCodecWidget() : CodecWidget(), currentFormat( "mp2" ) { QGridLayout *grid = new QGridLayout( this ); grid->setContentsMargins( 0, 0, 0, 0 ); // top box ---------------------------------------- QHBoxLayout *topBox = new QHBoxLayout(); grid->addLayout( topBox, 0, 0 ); QLabel *lMode = new QLabel( i18n("Mode:"), this ); topBox->addWidget( lMode ); cMode = new KComboBox( this ); cMode->addItem( i18n("Quality") ); cMode->addItem( i18n("Bitrate") ); connect( cMode, SIGNAL(activated(int)), this, SLOT(modeChanged(int)) ); connect( cMode, SIGNAL(activated(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( cMode ); sQuality = new QSlider( Qt::Horizontal, this ); sQuality->setRange( 32, 384 ); connect( sQuality, SIGNAL(valueChanged(int)), this, SLOT(qualitySliderChanged(int)) ); connect( sQuality, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( sQuality ); iQuality = new QSpinBox( this ); iQuality->setRange( 32, 384 ); iQuality->setSuffix( " kbps" ); iQuality->setFixedWidth( iQuality->sizeHint().width() ); connect( iQuality, SIGNAL(valueChanged(int)), this, SLOT(qualitySpinBoxChanged(int)) ); connect( iQuality, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( iQuality ); topBox->addStretch(); // cmd arguments box QHBoxLayout *cmdArgumentsBox = new QHBoxLayout(); grid->addLayout( cmdArgumentsBox, 1, 0 ); cCmdArguments = new QCheckBox( i18n("Additional encoder arguments:"), this ); cmdArgumentsBox->addWidget( cCmdArguments ); lCmdArguments = new KLineEdit( this ); lCmdArguments->setEnabled( false ); cmdArgumentsBox->addWidget( lCmdArguments ); connect( cCmdArguments, SIGNAL(toggled(bool)), lCmdArguments, SLOT(setEnabled(bool)) ); grid->setRowStretch( 2, 1 ); modeChanged( 0 ); } TwoLameCodecWidget::~TwoLameCodecWidget() {} // TODO optimize int TwoLameCodecWidget::bitrateForQuality( int quality ) { return 384+(quality-50)*383/100; } // TODO optimize int TwoLameCodecWidget::qualityForBitrate( int bitrate ) { return (bitrate-384)*100/384+50; } ConversionOptions *TwoLameCodecWidget::currentConversionOptions() { ConversionOptions *options = new ConversionOptions(); if( cMode->currentText() == i18n("Quality") ) { options->qualityMode = ConversionOptions::Quality; options->quality = iQuality->value(); options->bitrate = bitrateForQuality( options->quality ); options->bitrateMode = ConversionOptions::Vbr; } else { options->qualityMode = ConversionOptions::Bitrate; options->bitrate = iQuality->value(); options->quality = qualityForBitrate( options->bitrate ); options->bitrateMode = ConversionOptions::Cbr; } if( cCmdArguments->isChecked() ) options->cmdArguments = lCmdArguments->text(); else options->cmdArguments = ""; return options; } bool TwoLameCodecWidget::setCurrentConversionOptions( ConversionOptions *options ) { if( !options || options->pluginName != global_plugin_name ) return false; if( options->qualityMode == ConversionOptions::Quality ) { cMode->setCurrentIndex( cMode->findText(i18n("Quality")) ); modeChanged( cMode->currentIndex() ); iQuality->setValue( options->quality ); } else { cMode->setCurrentIndex( cMode->findText(i18n("Bitrate")) ); modeChanged( cMode->currentIndex() ); iQuality->setValue( options->bitrate ); } cCmdArguments->setChecked( !options->cmdArguments.isEmpty() ); if( !options->cmdArguments.isEmpty() ) lCmdArguments->setText( options->cmdArguments ); return true; } void TwoLameCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; setEnabled( currentFormat != "wav" ); } QString TwoLameCodecWidget::currentProfile() { if( currentFormat == "wav" ) { return i18n("Lossless"); } else if( cMode->currentIndex() == 0 && iQuality->value() == -25 ) { return i18n("Very low"); } else if( cMode->currentIndex() == 0 && iQuality->value() == -10 ) { return i18n("Low"); } else if( cMode->currentIndex() == 0 && iQuality->value() == 5 ) { return i18n("Medium"); } else if( cMode->currentIndex() == 0 && iQuality->value() == 20 ) { return i18n("High"); } else if( cMode->currentIndex() == 0 && iQuality->value() == 35 ) { return i18n("Very high"); } return i18n("User defined"); } bool TwoLameCodecWidget::setCurrentProfile( const QString& profile ) { if( profile == i18n("Very low") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( -25 ); iQuality->setValue( -25 ); cCmdArguments->setChecked( false ); return true; } else if( profile == i18n("Low") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( -10 ); iQuality->setValue( -10 ); cCmdArguments->setChecked( false ); return true; } else if( profile == i18n("Medium") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 5 ); iQuality->setValue( 5 ); cCmdArguments->setChecked( false ); return true; } else if( profile == i18n("High") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 20 ); iQuality->setValue( 20 ); cCmdArguments->setChecked( false ); return true; } else if( profile == i18n("Very high") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 35 ); iQuality->setValue( 35 ); cCmdArguments->setChecked( false ); return true; } return false; } int TwoLameCodecWidget::currentDataRate() { int dataRate; if( currentFormat == "wav" ) { dataRate = 10590000; } else { if( cMode->currentIndex() == 0 ) { dataRate = 1440000 + iQuality->value()*28800; // TODO calc properly } else { dataRate = iQuality->value()/8*60*1000; } } return dataRate; } void TwoLameCodecWidget::modeChanged( int mode ) { if( mode == 0 ) { sQuality->setRange( -50, 50 ); sQuality->setSingleStep( 5 ); iQuality->setRange( -50, 50 ); iQuality->setSingleStep( 5 ); iQuality->setSuffix( "" ); sQuality->setValue( 5 ); iQuality->setValue( 5 ); sQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", -50, 50) ); iQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", -50, 50) ); } else { sQuality->setRange( 32, 384 ); sQuality->setSingleStep( 8 ); iQuality->setRange( 32, 384 ); iQuality->setSingleStep( 8 ); iQuality->setSuffix( " kbps" ); sQuality->setValue( 160 ); iQuality->setValue( 160 ); iQuality->setToolTip( i18n("Bitrate") ); sQuality->setToolTip( "" ); iQuality->setToolTip( "" ); } } void TwoLameCodecWidget::qualitySliderChanged( int quality ) { iQuality->setValue( quality ); } void TwoLameCodecWidget::qualitySpinBoxChanged( int quality ) { sQuality->setValue( quality ); } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_twolame/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006111726605617026631 xustar0020 atime=1308763306 29 ctime=1418040695.15471724 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_twolame/CMakeLists.txt0000755000175000001440000000122011726605617027623 0ustar00danielusers00000000000000project(soundkonverter_codec_twolame) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_twolame_SRCS soundkonverter_codec_twolame.cpp twolamecodecwidget.cpp ) kde4_add_plugin(soundkonverter_codec_twolame ${soundkonverter_codec_twolame_SRCS}) target_link_libraries(soundkonverter_codec_twolame ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_twolame DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_twolame.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_twolame/PaxHeaders.4329/soundkonverter_codec_two0000644000000000000000000000012712076525023031124 xustar0029 mtime=1358604819.24380639 29 atime=1358604819.24380639 29 ctime=1418040695.15471724 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_twolame/soundkonverter_codec_twolame.h0000755000175000001440000000250312076525023033205 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_TWOLAME_H #define SOUNDKONVERTER_CODEC_TWOLAME_H #include "../../core/codecplugin.h" #include class ConversionOptions; class soundkonverter_codec_twolame : public CodecPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_codec_twolame( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_twolame(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output ); }; K_EXPORT_SOUNDKONVERTER_CODEC( twolame, soundkonverter_codec_twolame ) #endif // _SOUNDKONVERTER_CODEC_TWOLAME_H_ ./soundkonverter-2.1.2/plugins/soundkonverter_codec_twolame/PaxHeaders.4329/twolamecodecglobal.h0000644000000000000000000000006111440655205030060 xustar0020 atime=1398102755 29 ctime=1418040695.15471724 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_twolame/twolamecodecglobal.h0000644000175000001440000000011011440655205031044 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "twolame" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_codec_twolame/PaxHeaders.4329/twolamecodecwidget.h0000644000000000000000000000012712076525023030106 xustar0029 mtime=1358604819.24380639 29 atime=1358604819.24380639 29 ctime=1418040695.15471724 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_twolame/twolamecodecwidget.h0000644000175000001440000000217212076525023031101 0ustar00danielusers00000000000000 #ifndef TWOLAMECODECWIDGET_H #define TWOLAMECODECWIDGET_H #include "../../core/codecwidget.h" #include class KComboBox; class QSpinBox; class QCheckBox; class QLabel; class QSlider; class KLineEdit; class TwoLameCodecWidget : public CodecWidget { Q_OBJECT public: TwoLameCodecWidget(); ~TwoLameCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: // user defined options KComboBox *cMode; QSpinBox *iQuality; QSlider *sQuality; QCheckBox *cCmdArguments; KLineEdit *lCmdArguments; QString currentFormat; // holds the current output file format int bitrateForQuality( int quality ); int qualityForBitrate( int bitrate ); private slots: // user defined options void modeChanged( int mode ); void qualitySliderChanged( int quality ); void qualitySpinBoxChanged( int quality ); }; #endif // TWOLAMECODECWIDGET_H./soundkonverter-2.1.2/plugins/soundkonverter_codec_twolame/PaxHeaders.4329/soundkonverter_codec_two0000644000000000000000000000006111440655361031124 xustar0020 atime=1308601626 29 ctime=1418040695.15471724 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_twolame/soundkonverter_codec_twolame.desktop0000755000175000001440000000054011440655361034431 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter TwoLame Plugin X-KDE-Library=soundkonverter_codec_twolame ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_twolame X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_codec_twolame/PaxHeaders.4329/soundkonverter_codec_two0000644000000000000000000000006112276145051031122 xustar0020 atime=1416311951 29 ctime=1418040695.15471724 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_twolame/soundkonverter_codec_twolame.cpp0000755000175000001440000001432612276145051033547 0ustar00danielusers00000000000000 #include "twolamecodecglobal.h" #include "soundkonverter_codec_twolame.h" #include "twolamecodecwidget.h" #include #include #include #include #include #include #include #include #include #include soundkonverter_codec_twolame::soundkonverter_codec_twolame( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["twolame"] = ""; allCodecs += "mp2"; allCodecs += "wav"; } soundkonverter_codec_twolame::~soundkonverter_codec_twolame() {} QString soundkonverter_codec_twolame::name() { return global_plugin_name; } QList soundkonverter_codec_twolame::codecTable() { QList table; ConversionPipeTrunk newTrunk; newTrunk.codecFrom = "wav"; newTrunk.codecTo = "mp2"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["twolame"] != "" ); newTrunk.problemInfo = standardMessage( "encode_codec,backend", "mp2", "twolame" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); return table; } bool soundkonverter_codec_twolame::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_codec_twolame::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) // KDialog *dialog = new KDialog( parent ); // dialog->setCaption( i18n("Configure %1").arg(global_plugin_name) ); // dialog->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Apply ); // QWidget *widget = new QWidget( dialog ); // dialog->setMainWidget( widget ); // connect( dialog, SIGNAL( applyClicked() ), widget, SLOT( save() ) ); // connect( dialog, SIGNAL( okClicked() ), widget, SLOT( save() ) ); // connect( widget, SIGNAL( changed( bool ) ), dialog, SLOT( enableButtonApply( bool ) ) ); // dialog->enableButtonApply( false ); // dialog->show(); } bool soundkonverter_codec_twolame::hasInfo() { return true; } void soundkonverter_codec_twolame::showInfo( QWidget *parent ) { KDialog *dialog = new KDialog( parent ); dialog->setCaption( i18n("About %1").arg(global_plugin_name) ); dialog->setButtons( KDialog::Ok ); QLabel *widget = new QLabel( dialog ); widget->setText( i18n("TwoLame is a free MP2 encoder.\nYou can get it at: http://www.twolame.org") ); dialog->setMainWidget( widget ); dialog->enableButtonApply( false ); dialog->show(); } CodecWidget *soundkonverter_codec_twolame::newCodecWidget() { TwoLameCodecWidget *widget = new TwoLameCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_codec_twolame::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { QStringList command = convertCommand( inputFile, outputFile, inputCodec, outputCodec, _conversionOptions, tags, replayGain ); if( command.isEmpty() ) return BackendPlugin::UnknownError; CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_twolame::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(tags) Q_UNUSED(replayGain) if( !_conversionOptions ) return QStringList(); QStringList command; ConversionOptions *conversionOptions = _conversionOptions; if( outputCodec == "mp2" ) { command += binaries["twolame"]; if( inputFile.isEmpty() ) { command += "-r"; } if( conversionOptions->qualityMode == ConversionOptions::Quality ) { command += "-V"; command += QString::number(conversionOptions->quality); } else if( conversionOptions->qualityMode == ConversionOptions::Bitrate ) { command += "-b"; command += QString::number(conversionOptions->bitrate); } if( conversionOptions->pluginName == name() ) { command += conversionOptions->cmdArguments; } command += "\"" + escapeUrl(inputFile) + "\""; command += "\"" + escapeUrl(outputFile) + "\""; } return command; } float soundkonverter_codec_twolame::parseOutput( const QString& output ) { // decoding // Frame# 1398/8202 256 kbps L R (...) // encoding // \r 3600/3696 (97%)| 0:05/ 0:05| 0:05/ 0:05| 18.190x| 0:00 QString data = output; QString frame, count; if( output.contains("Frame#") ) { data.remove( 0, data.indexOf("Frame#")+7 ); frame = data.left( data.indexOf("/") ); data.remove( 0, data.indexOf("/")+1 ); count = data.left( data.indexOf(" ") ); return frame.toFloat()/count.toFloat()*100.0f; } if( output.contains("%") ) { frame = data.left( data.indexOf("/") ); frame.remove( 0, frame.lastIndexOf(" ")+1 ); data.remove( 0, data.indexOf("/")+1 ); count = data.left( data.indexOf(" ") ); return frame.toFloat()/count.toFloat()*100.0f; } /*if( output.contains("%") ) { data.remove( 0, data.indexOf("(")+1 ); data.remove( data.indexOf("%"), data.length()-data.indexOf("%") ); return data.toFloat(); }*/ return -1; } #include "soundkonverter_codec_twolame.moc" ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_vorbistools0000644000000000000000000000012012276433700024716 xustar0030 mtime=1392129984.041103529 20 atime=1358274330 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_vorbistools/0000755000175000001440000000000012276433700025773 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_vorbistools/PaxHeaders.4329/soundkonverter_codec0000644000000000000000000000006212276145051031147 xustar0020 atime=1418040446 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_vorbistools/soundkonverter_codec_vorbistools.cpp0000755000175000001440000001321512276145051035375 0ustar00danielusers00000000000000 #include "vorbistoolscodecglobal.h" #include "soundkonverter_codec_vorbistools.h" #include "../../core/conversionoptions.h" #include "vorbistoolscodecwidget.h" soundkonverter_codec_vorbistools::soundkonverter_codec_vorbistools( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["oggenc"] = ""; binaries["oggdec"] = ""; allCodecs += "ogg vorbis"; allCodecs += "wav"; } soundkonverter_codec_vorbistools::~soundkonverter_codec_vorbistools() {} QString soundkonverter_codec_vorbistools::name() { return global_plugin_name; } QList soundkonverter_codec_vorbistools::codecTable() { QList table; ConversionPipeTrunk newTrunk; newTrunk.codecFrom = "wav"; newTrunk.codecTo = "ogg vorbis"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["oggenc"] != "" ); newTrunk.problemInfo = standardMessage( "encode_codec,backend", "ogg vorbis", "oggenc" ) + "\n" + i18n( "'%1' is usually in the package '%2' which should be shipped with your distribution.", QString("oggenc"), QString("vorbis-tools") ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "ogg vorbis"; newTrunk.codecTo = "wav"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["oggdec"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "ogg vorbis", "oggdec" ) + "\n" + i18n( "'%1' is usually in the package '%2' which should be shipped with your distribution.", QString("oggdec"), QString("vorbis-tools") ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); return table; } bool soundkonverter_codec_vorbistools::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_codec_vorbistools::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_codec_vorbistools::hasInfo() { return false; } void soundkonverter_codec_vorbistools::showInfo( QWidget *parent ) { Q_UNUSED(parent) } CodecWidget *soundkonverter_codec_vorbistools::newCodecWidget() { VorbisToolsCodecWidget *widget = new VorbisToolsCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_codec_vorbistools::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { QStringList command = convertCommand( inputFile, outputFile, inputCodec, outputCodec, _conversionOptions, tags, replayGain ); if( command.isEmpty() ) return BackendPlugin::UnknownError; CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_vorbistools::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(tags) Q_UNUSED(replayGain) if( !_conversionOptions ) return QStringList(); QStringList command; ConversionOptions *conversionOptions = _conversionOptions; if( outputCodec == "ogg vorbis" ) { command += binaries["oggenc"]; // if( inputFile.isEmpty() ) // { // command += "--raw"; // } if( conversionOptions->qualityMode == ConversionOptions::Quality ) { command += "-q"; command += QString::number(conversionOptions->quality); } else if( conversionOptions->qualityMode == ConversionOptions::Bitrate ) { if( conversionOptions->bitrateMode == ConversionOptions::Abr ) { command += "-b"; command += QString::number(conversionOptions->bitrate); } else if( conversionOptions->bitrateMode == ConversionOptions::Cbr ) { command += "--managed"; command += "-b"; command += QString::number(conversionOptions->bitrate); } } command += "\"" + escapeUrl(inputFile) + "\""; command += "-o"; command += "\"" + escapeUrl(outputFile) + "\""; } else { command += binaries["oggdec"]; if( outputFile.isEmpty() ) { command += "-Q"; } command += "\"" + escapeUrl(inputFile) + "\""; command += "-o"; command += "\"" + escapeUrl(outputFile) + "\""; } return command; } float soundkonverter_codec_vorbistools::parseOutput( const QString& output ) { // [ 99.5%] if( output == "" || !output.contains("%") || output.contains("error",Qt::CaseInsensitive) ) return -1; QString data = output; data.remove( 0, data.indexOf("[")+1 ); data = data.left( data.indexOf("%") ); return data.toFloat(); } #include "soundkonverter_codec_vorbistools.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_codec_vorbistools/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006211726605613027543 xustar0020 atime=1308763306 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_vorbistools/CMakeLists.txt0000755000175000001440000000126411726605613030544 0ustar00danielusers00000000000000project(soundkonverter_codec_vorbistools) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_vorbistools_SRCS soundkonverter_codec_vorbistools.cpp vorbistoolscodecwidget.cpp ) kde4_add_plugin(soundkonverter_codec_vorbistools ${soundkonverter_codec_vorbistools_SRCS}) target_link_libraries(soundkonverter_codec_vorbistools ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_vorbistools DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_vorbistools.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_vorbistools/PaxHeaders.4329/vorbistoolscodecwidg0000644000000000000000000000006212276433700031161 xustar0020 atime=1397391139 30 ctime=1418040695.157717235 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_vorbistools/vorbistoolscodecwidget.cpp0000644000175000001440000002164712276433700033300 0ustar00danielusers00000000000000 #include "vorbistoolscodecglobal.h" #include "vorbistoolscodecwidget.h" #include "../../core/conversionoptions.h" #include #include #include #include #include #include #include #include #include VorbisToolsCodecWidget::VorbisToolsCodecWidget() : CodecWidget(), currentFormat( "ogg vorbis" ) { const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); QGridLayout *grid = new QGridLayout( this ); grid->setContentsMargins( 0, 0, 0, 0 ); // set up encoding options selection QHBoxLayout *topBox = new QHBoxLayout(); grid->addLayout( topBox, 0, 0 ); QLabel *lMode = new QLabel( i18n("Mode:"), this ); topBox->addWidget( lMode ); cMode = new KComboBox( this ); cMode->addItem( i18n("Quality") ); cMode->addItem( i18n("Bitrate") ); connect( cMode, SIGNAL(activated(int)), this, SLOT(modeChanged(int)) ); connect( cMode, SIGNAL(activated(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( cMode ); sQuality = new QSlider( Qt::Horizontal, this ); connect( sQuality, SIGNAL(valueChanged(int)), this, SLOT(qualitySliderChanged(int)) ); connect( sQuality, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( sQuality ); dQuality = new QDoubleSpinBox( this ); dQuality->setRange( 8, 320 ); dQuality->setSuffix( " kbps" ); dQuality->setFixedWidth( dQuality->sizeHint().width() ); connect( dQuality, SIGNAL(valueChanged(double)), this, SLOT(qualitySpinBoxChanged(double)) ); connect( dQuality, SIGNAL(valueChanged(double)), SIGNAL(optionsChanged()) ); topBox->addWidget( dQuality ); topBox->addSpacing( fontHeight ); QLabel *lBitrateMode = new QLabel( i18n("Bitrate mode:"), this ); topBox->addWidget( lBitrateMode ); cBitrateMode = new KComboBox( this ); cBitrateMode->addItem( i18n("Variable") ); cBitrateMode->addItem( i18n("Average") ); cBitrateMode->addItem( i18n("Constant") ); cBitrateMode->setFixedWidth( cBitrateMode->sizeHint().width() ); connect( cBitrateMode, SIGNAL(activated(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( cBitrateMode ); topBox->addStretch(); grid->setRowStretch( 1, 1 ); modeChanged( 0 ); } VorbisToolsCodecWidget::~VorbisToolsCodecWidget() {} // TODO optimize int VorbisToolsCodecWidget::bitrateForQuality( double quality ) { return quality*100/3; } // TODO optimize double VorbisToolsCodecWidget::qualityForBitrate( int bitrate ) { return (double)bitrate*3/100; } ConversionOptions *VorbisToolsCodecWidget::currentConversionOptions() { ConversionOptions *options = new ConversionOptions(); if( cMode->currentText()==i18n("Quality") ) { options->qualityMode = ConversionOptions::Quality; options->quality = dQuality->value(); options->bitrate = bitrateForQuality( options->quality ); options->bitrateMode = ConversionOptions::Vbr; } else { options->qualityMode = ConversionOptions::Bitrate; options->bitrate = dQuality->value(); options->quality = qualityForBitrate( options->bitrate ); options->bitrateMode = ( cBitrateMode->currentText()==i18n("Average") ) ? ConversionOptions::Abr : ConversionOptions::Cbr; } return options; } bool VorbisToolsCodecWidget::setCurrentConversionOptions( ConversionOptions *_options ) { if( !_options || _options->pluginName != global_plugin_name ) return false; ConversionOptions *options = _options; if( options->qualityMode == ConversionOptions::Quality ) { cMode->setCurrentIndex( cMode->findText(i18n("Quality")) ); modeChanged( cMode->currentIndex() ); dQuality->setValue( options->quality ); cBitrateMode->setCurrentIndex( cBitrateMode->findText(i18n("Variable")) ); } else { cMode->setCurrentIndex( cMode->findText(i18n("Bitrate")) ); modeChanged( cMode->currentIndex() ); dQuality->setValue( options->bitrate ); if( options->bitrateMode == ConversionOptions::Abr ) cBitrateMode->setCurrentIndex( cBitrateMode->findText(i18n("Average")) ); else cBitrateMode->setCurrentIndex( cBitrateMode->findText(i18n("Constant")) ); } return true; } void VorbisToolsCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; setEnabled( currentFormat != "wav" ); } QString VorbisToolsCodecWidget::currentProfile() { if( currentFormat == "wav" ) { return i18n("Lossless"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 2.0 ) { return i18n("Very low"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 3.0 ) { return i18n("Low"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 4.0 ) { return i18n("Medium"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 5.0 ) { return i18n("High"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 6.0 ) { return i18n("Very high"); } return i18n("User defined"); } bool VorbisToolsCodecWidget::setCurrentProfile( const QString& profile ) { if( profile == i18n("Very low") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 200 ); dQuality->setValue( 2.0 ); cBitrateMode->setCurrentIndex( 0 ); return true; } else if( profile == i18n("Low") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 300 ); dQuality->setValue( 3.0 ); cBitrateMode->setCurrentIndex( 0 ); return true; } else if( profile == i18n("Medium") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 400 ); dQuality->setValue( 4.0 ); cBitrateMode->setCurrentIndex( 0 ); return true; } else if( profile == i18n("High") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 500 ); dQuality->setValue( 5.0 ); cBitrateMode->setCurrentIndex( 0 ); return true; } else if( profile == i18n("Very high") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 600 ); dQuality->setValue( 6.0 ); cBitrateMode->setCurrentIndex( 0 ); return true; } return false; } int VorbisToolsCodecWidget::currentDataRate() { int dataRate; if( currentFormat == "wav" ) { dataRate = 10590000; } else { if( cMode->currentIndex() == 0 ) { dataRate = 500000 + dQuality->value()*150000; if( dQuality->value() > 7 ) dataRate += (dQuality->value()-7)*250000; if( dQuality->value() > 9 ) dataRate += (dQuality->value()-9)*800000; } else { dataRate = dQuality->value()/8*60*1000; } } return dataRate; } void VorbisToolsCodecWidget::modeChanged( int mode ) { if( mode == 0 ) { sQuality->setRange( -100, 1000 ); sQuality->setSingleStep( 50 ); dQuality->setRange( -1, 10 ); dQuality->setSingleStep( 0.01 ); dQuality->setDecimals( 2 ); dQuality->setSuffix( "" ); sQuality->setValue( 400 ); dQuality->setValue( 4.0 ); // dQuality->setValue( qualityForBitrate(dQuality->value()) ); // qualitySpinBoxChanged( dQuality->value() ); sQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", -1, 10) ); dQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", -1, 10) ); cBitrateMode->clear(); cBitrateMode->addItem( i18n("Variable") ); cBitrateMode->setEnabled( false ); } else { sQuality->setRange( 800, 32000 ); sQuality->setSingleStep( 800 ); dQuality->setRange( 8, 320 ); dQuality->setSingleStep( 1 ); dQuality->setDecimals( 0 ); dQuality->setSuffix( " kbps" ); sQuality->setValue( 16000 ); dQuality->setValue( 160 ); // dQuality->setValue( bitrateForQuality(dQuality->value()) ); // qualitySpinBoxChanged( dQuality->value() ); sQuality->setToolTip( "" ); dQuality->setToolTip( "" ); cBitrateMode->clear(); cBitrateMode->addItem( i18n("Average") ); cBitrateMode->addItem( i18n("Constant") ); cBitrateMode->setEnabled( true ); } } void VorbisToolsCodecWidget::qualitySliderChanged( int quality ) { dQuality->setValue( double(quality)/100.0 ); } void VorbisToolsCodecWidget::qualitySpinBoxChanged( double quality ) { sQuality->setValue( round(quality*100.0) ); } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_vorbistools/PaxHeaders.4329/soundkonverter_codec0000644000000000000000000000013212076525023031144 xustar0030 mtime=1358604819.244806392 30 atime=1358604819.244806392 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_vorbistools/soundkonverter_codec_vorbistools.h0000755000175000001440000000252012076525023035036 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_VORBISTOOLS_H #define SOUNDKONVERTER_CODEC_VORBISTOOLS_H #include "../../core/codecplugin.h" class ConversionOptions; class soundkonverter_codec_vorbistools : public CodecPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_codec_vorbistools( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_vorbistools(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output ); }; K_EXPORT_SOUNDKONVERTER_CODEC( vorbistools, soundkonverter_codec_vorbistools ) #endif // SOUNDKONVERTER_CODEC_VORBISTOOLS_H ./soundkonverter-2.1.2/plugins/soundkonverter_codec_vorbistools/PaxHeaders.4329/vorbistoolscodecwidg0000644000000000000000000000013212076525023031155 xustar0030 mtime=1358604819.244806392 30 atime=1358604819.244806392 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_vorbistools/vorbistoolscodecwidget.h0000644000175000001440000000205512076525023032733 0ustar00danielusers00000000000000 #ifndef VORBISTOOLSCODECWIDGET_H #define VORBISTOOLSCODECWIDGET_H #include "../../core/codecwidget.h" class KComboBox; class QSlider; class QDoubleSpinBox; class QCheckBox; // class QLabel; class VorbisToolsCodecWidget : public CodecWidget { Q_OBJECT public: VorbisToolsCodecWidget(); ~VorbisToolsCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *_options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: KComboBox *cMode; QSlider *sQuality; QDoubleSpinBox *dQuality; KComboBox *cBitrateMode; QString currentFormat; // holds the current output file format int bitrateForQuality( double quality ); double qualityForBitrate( int bitrate ); private slots: void modeChanged( int mode ); void qualitySliderChanged( int quality ); void qualitySpinBoxChanged( double quality ); }; #endif // VORBISTOOLSCODECWIDGET_H./soundkonverter-2.1.2/plugins/soundkonverter_codec_vorbistools/PaxHeaders.4329/soundkonverter_codec0000644000000000000000000000024411404672724031155 xustar00114 path=./soundkonverter-2.1.2/plugins/soundkonverter_codec_vorbistools/soundkonverter_codec_vorbistools.desktop 20 atime=1308601627 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_vorbistools/soundkonverter_codec_vorbistools.des0000755000175000001440000000055511404672724035375 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter Vorbis Tools Plugin X-KDE-Library=soundkonverter_codec_vorbistools ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_vorbistools X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_codec_vorbistools/PaxHeaders.4329/vorbistoolscodecglob0000644000000000000000000000006211773075463031163 xustar0020 atime=1366995186 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_vorbistools/vorbistoolscodecglobal.h0000644000175000001440000000011511773075463032716 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "Vorbis Tools" #endif ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_shorten0000644000000000000000000000011712276433306024023 xustar0030 mtime=1392129734.889244267 20 atime=1358274330 29 ctime=1418040695.16671722 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_shorten/0000755000175000001440000000000012276433306025072 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_shorten/PaxHeaders.4329/soundkonverter_codec_sho0000644000000000000000000000006211441376651031122 xustar0020 atime=1308601627 30 ctime=1418040695.165717222 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_shorten/soundkonverter_codec_shorten.desktop0000755000175000001440000000054011441376651034460 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter Shorten Plugin X-KDE-Library=soundkonverter_codec_shorten ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_shorten X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_codec_shorten/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006211726605644026644 xustar0020 atime=1308763307 30 ctime=1418040695.165717222 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_shorten/CMakeLists.txt0000755000175000001440000000122011726605644027635 0ustar00danielusers00000000000000project(soundkonverter_codec_shorten) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_shorten_SRCS soundkonverter_codec_shorten.cpp shortencodecwidget.cpp ) kde4_add_plugin(soundkonverter_codec_shorten ${soundkonverter_codec_shorten_SRCS}) target_link_libraries(soundkonverter_codec_shorten ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_shorten DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_shorten.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_shorten/PaxHeaders.4329/shortencodecglobal.h0000644000000000000000000000006211773075463030120 xustar0020 atime=1416311950 30 ctime=1418040695.165717222 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_shorten/shortencodecglobal.h0000644000175000001440000000011011773075463031103 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "Shorten" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_codec_shorten/PaxHeaders.4329/shortencodecwidget.cpp0000644000000000000000000000006212276433306030467 xustar0020 atime=1398102755 30 ctime=1418040695.165717222 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_shorten/shortencodecwidget.cpp0000644000175000001440000000436412276433306031471 0ustar00danielusers00000000000000 #include "shortencodecglobal.h" #include "shortencodecwidget.h" #include "../../core/conversionoptions.h" #include #include #include #include ShortenCodecWidget::ShortenCodecWidget() : CodecWidget(), currentFormat( "shorten" ) { QGridLayout *grid = new QGridLayout( this ); grid->setContentsMargins( 0, 0, 0, 0 ); // cmd arguments box QHBoxLayout *cmdArgumentsBox = new QHBoxLayout(); grid->addLayout( cmdArgumentsBox, 1, 0 ); cCmdArguments = new QCheckBox( i18n("Additional encoder arguments:"), this ); cmdArgumentsBox->addWidget( cCmdArguments ); lCmdArguments = new KLineEdit( this ); lCmdArguments->setEnabled( false ); cmdArgumentsBox->addWidget( lCmdArguments ); connect( cCmdArguments, SIGNAL(toggled(bool)), lCmdArguments, SLOT(setEnabled(bool)) ); grid->setRowStretch( 2, 1 ); } ShortenCodecWidget::~ShortenCodecWidget() {} ConversionOptions *ShortenCodecWidget::currentConversionOptions() { ConversionOptions *options = new ConversionOptions(); options->qualityMode = ConversionOptions::Lossless; if( cCmdArguments->isChecked() ) options->cmdArguments = lCmdArguments->text(); else options->cmdArguments = ""; return options; } bool ShortenCodecWidget::setCurrentConversionOptions( ConversionOptions *_options ) { if( !_options || _options->pluginName != global_plugin_name ) return false; ConversionOptions *options = _options; cCmdArguments->setChecked( !options->cmdArguments.isEmpty() ); if( !options->cmdArguments.isEmpty() ) lCmdArguments->setText( options->cmdArguments ); return true; } void ShortenCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; setEnabled( currentFormat != "wav" ); } QString ShortenCodecWidget::currentProfile() { return i18n("Lossless"); } bool ShortenCodecWidget::setCurrentProfile( const QString& profile ) { return profile == i18n("Lossless"); } int ShortenCodecWidget::currentDataRate() { int dataRate; if( currentFormat == "wav" ) { dataRate = 10590000; } else { dataRate = 6400000; } return dataRate; } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_shorten/PaxHeaders.4329/soundkonverter_codec_sho0000644000000000000000000000006212276145051031115 xustar0020 atime=1418040445 30 ctime=1418040695.165717222 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_shorten/soundkonverter_codec_shorten.cpp0000755000175000001440000001067212276145051033573 0ustar00danielusers00000000000000 #include "shortencodecglobal.h" #include "soundkonverter_codec_shorten.h" #include "../../core/conversionoptions.h" #include "shortencodecwidget.h" soundkonverter_codec_shorten::soundkonverter_codec_shorten( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["shorten"] = ""; allCodecs += "shorten"; allCodecs += "wav"; } soundkonverter_codec_shorten::~soundkonverter_codec_shorten() {} QString soundkonverter_codec_shorten::name() { return global_plugin_name; } QList soundkonverter_codec_shorten::codecTable() { QList table; ConversionPipeTrunk newTrunk; newTrunk.codecFrom = "wav"; newTrunk.codecTo = "shorten"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["shorten"] != "" ); newTrunk.problemInfo = standardMessage( "encode_codec,backend", "shorten", "shorten" ) + "\n" + standardMessage( "install_website_backend,url", "shorten", "http://etree.org/shnutils/shorten/" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "shorten"; newTrunk.codecTo = "wav"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["shorten"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "shorten", "shorten" ) + "\n" + standardMessage( "install_website_backend,url", "shorten", "http://etree.org/shnutils/shorten/" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); return table; } bool soundkonverter_codec_shorten::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_codec_shorten::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_codec_shorten::hasInfo() { return false; } void soundkonverter_codec_shorten::showInfo( QWidget *parent ) { Q_UNUSED(parent) } CodecWidget *soundkonverter_codec_shorten::newCodecWidget() { ShortenCodecWidget *widget = new ShortenCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_codec_shorten::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { QStringList command = convertCommand( inputFile, outputFile, inputCodec, outputCodec, _conversionOptions, tags, replayGain ); if( command.isEmpty() ) return BackendPlugin::UnknownError; CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_shorten::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(tags) Q_UNUSED(replayGain) if( !_conversionOptions ) return QStringList(); QStringList command; ConversionOptions *conversionOptions = _conversionOptions; if( outputCodec == "shorten" ) { command += binaries["shorten"]; if( conversionOptions->pluginName == global_plugin_name ) { command += conversionOptions->cmdArguments; } command += "\"" + escapeUrl(inputFile) + "\""; command += "\"" + escapeUrl(outputFile) + "\""; } else { command += binaries["shorten"]; command += "-x"; command += "\"" + escapeUrl(inputFile) + "\""; command += "\"" + escapeUrl(outputFile) + "\""; } return command; } float soundkonverter_codec_shorten::parseOutput( const QString& output ) { Q_UNUSED(output) // no output provided return -1; } #include "soundkonverter_codec_shorten.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_codec_shorten/PaxHeaders.4329/shortencodecwidget.h0000644000000000000000000000013212076525023030126 xustar0030 mtime=1358604819.239806379 30 atime=1358604819.239806379 30 ctime=1418040695.165717222 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_shorten/shortencodecwidget.h0000644000175000001440000000130712076525023031124 0ustar00danielusers00000000000000 #ifndef SHORTENCODECWIDGET_H #define SHORTENCODECWIDGET_H #include "../../core/codecwidget.h" class QCheckBox; class KLineEdit; class ShortenCodecWidget : public CodecWidget { Q_OBJECT public: ShortenCodecWidget(); ~ShortenCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *_options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: QCheckBox *cCmdArguments; KLineEdit *lCmdArguments; QString currentFormat; // holds the current output file format }; #endif // SHORTENCODECWIDGET_H ./soundkonverter-2.1.2/plugins/soundkonverter_codec_shorten/PaxHeaders.4329/soundkonverter_codec_sho0000644000000000000000000000013212076525023031112 xustar0030 mtime=1358604819.240806382 30 atime=1358604819.240806382 30 ctime=1418040695.165717222 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_shorten/soundkonverter_codec_shorten.h0000755000175000001440000000246312076525023033236 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_SHORTEN_H #define SOUNDKONVERTER_CODEC_SHORTEN_H #include "../../core/codecplugin.h" class ConversionOptions; class soundkonverter_codec_shorten : public CodecPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_codec_shorten( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_shorten(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output ); }; K_EXPORT_SOUNDKONVERTER_CODEC( shorten, soundkonverter_codec_shorten ) #endif // _SOUNDKONVERTER_CODEC_SHORTEN_H_ ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_lame0000644000000000000000000000012012276433306023251 xustar0030 mtime=1392129734.764243818 20 atime=1358274330 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_lame/0000755000175000001440000000000012276433306024326 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_lame/PaxHeaders.4329/lamecodecwidget.h0000644000000000000000000000013212076525023026616 xustar0030 mtime=1358604819.229806351 30 atime=1358604819.229806351 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_lame/lamecodecwidget.h0000644000175000001440000000311712076525023027615 0ustar00danielusers00000000000000 #ifndef LAMECODECWIDGET_H #define LAMECODECWIDGET_H #include "../../core/codecwidget.h" #include class KComboBox; class QSpinBox; class QCheckBox; class QLabel; class QSlider; class KLineEdit; class LameCodecWidget : public CodecWidget { Q_OBJECT public: LameCodecWidget(); ~LameCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *_options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: // preset selection KComboBox *cPreset; QSpinBox *iPresetBitrate; QCheckBox *cPresetBitrateCbr; QCheckBox *cPresetFast; // user defined options QGroupBox *userdefinedBox; KComboBox *cMode; QSpinBox *iQuality; QSlider *sQuality; KComboBox *cBitrateMode; QSlider *sCompressionLevel; QSpinBox *iCompressionLevel; QCheckBox *cCmdArguments; KLineEdit *lCmdArguments; QString currentFormat; // holds the current output file format int bitrateForQuality( int quality ); int qualityForBitrate( int bitrate ); private slots: // presets void presetChanged( const QString& preset ); void presetBitrateChanged( int bitrate ); // user defined options void modeChanged( int mode ); void qualitySliderChanged( int quality ); void qualitySpinBoxChanged( int quality ); void compressionLevelSliderChanged( int quality ); void compressionLevelSpinBoxChanged( int quality ); }; #endif // LAMECODECWIDGET_H./soundkonverter-2.1.2/plugins/soundkonverter_codec_lame/PaxHeaders.4329/lamecodecwidget.cpp0000644000000000000000000000013212276433306027155 xustar0030 mtime=1392129734.763243815 30 atime=1392129734.763243815 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_lame/lamecodecwidget.cpp0000644000175000001440000004450512276433306030162 0ustar00danielusers00000000000000 #include "lamecodecglobal.h" #include "lamecodecwidget.h" #include "lameconversionoptions.h" #include #include #include #include #include #include #include #include #include LameCodecWidget::LameCodecWidget() : CodecWidget(), currentFormat( "mp3" ) { const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); QGridLayout *grid = new QGridLayout( this ); grid->setContentsMargins( 0, 0, 0, 0 ); // set up preset selection QHBoxLayout *presetBox = new QHBoxLayout(); grid->addLayout( presetBox, 0, 0 ); QLabel *lPreset = new QLabel( i18n("Preset:"), this ); presetBox->addWidget( lPreset ); cPreset = new KComboBox( this ); cPreset->addItem( i18nc("Backend profile","Medium") ); cPreset->addItem( i18nc("Backend profile","Standard") ); cPreset->addItem( i18nc("Backend profile","Extreme") ); cPreset->addItem( i18nc("Backend profile","Insane") ); cPreset->addItem( i18n("Specify bitrate") ); cPreset->addItem( i18n("User defined") ); connect( cPreset, SIGNAL(activated(const QString&)), this, SLOT(presetChanged(const QString&)) ); connect( cPreset, SIGNAL(activated(int)), SIGNAL(optionsChanged()) ); presetBox->addWidget( cPreset ); // cPreset->setToolTip( i18n("Either use one of lames's presets or your own settings.") ); iPresetBitrate = new QSpinBox( this ); iPresetBitrate->setRange( 8, 320 ); iPresetBitrate->setSuffix( " kbps" ); iPresetBitrate->setValue( 192 ); connect( iPresetBitrate, SIGNAL(valueChanged(int)), this, SLOT(presetBitrateChanged(int)) ); connect( iPresetBitrate, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); presetBox->addWidget( iPresetBitrate ); cPresetBitrateCbr = new QCheckBox( i18n("cbr"), this ); connect( cPresetBitrateCbr, SIGNAL(toggled(bool)), SIGNAL(optionsChanged()) ); presetBox->addWidget( cPresetBitrateCbr ); cPresetBitrateCbr->setToolTip( i18n("Encode using a constant bitrate.\nOnly works with 80, 96, 112, 128, 160, 192, 224, 256 and 320 kbps") ); presetBox->addSpacing( fontHeight ); cPresetFast = new QCheckBox( i18n("Fast encoding"), this ); connect( cPresetFast, SIGNAL(toggled(bool)), SIGNAL(optionsChanged()) ); presetBox->addWidget( cPresetFast ); cPresetFast->setToolTip( i18n("Use a faster encoding algorithm (results in a slightly lower output quality).") ); presetBox->addStretch(); // set up user defined options userdefinedBox = new QGroupBox( /*i18n("User defined"),*/ this ); grid->addWidget( userdefinedBox, 1, 0 ); QVBoxLayout *userdefinedBoxLayout = new QVBoxLayout(); userdefinedBox->setLayout( userdefinedBoxLayout ); // top box ---------------------------------------- QHBoxLayout *userdefinedTopBox = new QHBoxLayout(); userdefinedBoxLayout->addLayout( userdefinedTopBox ); QLabel *lMode = new QLabel( i18n("Mode:"), userdefinedBox ); userdefinedTopBox->addWidget( lMode ); cMode = new KComboBox( userdefinedBox ); cMode->addItem( i18n("Quality") ); cMode->addItem( i18n("Bitrate") ); connect( cMode, SIGNAL(activated(int)), this, SLOT(modeChanged(int)) ); connect( cMode, SIGNAL(activated(int)), SIGNAL(optionsChanged()) ); userdefinedTopBox->addWidget( cMode ); sQuality = new QSlider( Qt::Horizontal, userdefinedBox ); sQuality->setRange( 8, 320 ); connect( sQuality, SIGNAL(valueChanged(int)), this, SLOT(qualitySliderChanged(int)) ); connect( sQuality, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); userdefinedTopBox->addWidget( sQuality ); iQuality = new QSpinBox( userdefinedBox ); iQuality->setRange( 8, 320 ); iQuality->setSuffix( " kbps" ); iQuality->setFixedWidth( iQuality->sizeHint().width() ); connect( iQuality, SIGNAL(valueChanged(int)), this, SLOT(qualitySpinBoxChanged(int)) ); connect( iQuality, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); userdefinedTopBox->addWidget( iQuality ); userdefinedTopBox->addSpacing( fontHeight ); QLabel *lBitrateMode = new QLabel( i18n("Bitrate mode:"), this ); userdefinedTopBox->addWidget( lBitrateMode ); cBitrateMode = new KComboBox( this ); cBitrateMode->addItem( i18n("Variable") ); cBitrateMode->addItem( i18n("Average") ); cBitrateMode->addItem( i18n("Constant") ); cBitrateMode->setFixedWidth( cBitrateMode->sizeHint().width() ); connect( cBitrateMode, SIGNAL(activated(int)), SIGNAL(optionsChanged()) ); userdefinedTopBox->addWidget( cBitrateMode ); userdefinedTopBox->addStretch(); // bottom box QHBoxLayout *bottomBox = new QHBoxLayout(); grid->addLayout( bottomBox, 2, 0 ); QLabel *lCompressionLevel = new QLabel( i18n("Compression level:"), this ); bottomBox->addWidget( lCompressionLevel ); sCompressionLevel = new QSlider( Qt::Horizontal, this ); sCompressionLevel->setRange( 0, 9 ); sCompressionLevel->setSingleStep( 1 ); sCompressionLevel->setPageStep( 1 ); connect( sCompressionLevel, SIGNAL(valueChanged(int)), this, SLOT(compressionLevelSliderChanged(int)) ); connect( sCompressionLevel, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); bottomBox->addWidget( sCompressionLevel ); sCompressionLevel->setToolTip( i18n("Compression level from %1 to %2 where %2 is the best compression.\nThe better the compression, the slower the conversion but the smaller the file size and vice versa.\nA value of %3 is recommended.", 9, 0, 2) ); iCompressionLevel = new QSpinBox( this ); iCompressionLevel->setRange( 0, 9 ); iCompressionLevel->setSingleStep( 1 ); iCompressionLevel->setFixedWidth( iCompressionLevel->sizeHint().width() ); connect( iCompressionLevel, SIGNAL(valueChanged(int)), this, SLOT(compressionLevelSpinBoxChanged(int)) ); connect( iCompressionLevel, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); bottomBox->addWidget( iCompressionLevel ); iCompressionLevel->setToolTip( i18n("Compression level from %1 to %2 where %2 is the best compression.\nThe better the compression, the slower the conversion but the smaller the file size and vice versa.\nA value of %3 is recommended.", 9, 0, 2) ); bottomBox->addSpacing( fontHeight ); cCmdArguments = new QCheckBox( i18n("Additional encoder arguments:"), this ); bottomBox->addWidget( cCmdArguments ); lCmdArguments = new KLineEdit( this ); lCmdArguments->setEnabled( false ); bottomBox->addWidget( lCmdArguments ); connect( cCmdArguments, SIGNAL(toggled(bool)), lCmdArguments, SLOT(setEnabled(bool)) ); grid->setRowStretch( 3, 1 ); presetChanged( cPreset->currentText() ); modeChanged( 0 ); iCompressionLevel->setValue( 2 ); } LameCodecWidget::~LameCodecWidget() {} // TODO optimize int LameCodecWidget::bitrateForQuality( int quality ) { return 320-quality*32; } // TODO optimize int LameCodecWidget::qualityForBitrate( int bitrate ) { return (320-bitrate)/32; } ConversionOptions *LameCodecWidget::currentConversionOptions() { LameConversionOptions *options = new LameConversionOptions(); options->data.preset = (LameConversionOptions::Data::Preset)cPreset->currentIndex(); options->data.presetBitrate = iPresetBitrate->value(); options->data.presetBitrateCbr = cPresetBitrateCbr->isEnabled() && cPresetBitrateCbr->isChecked(); options->data.presetFast = cPresetFast->isEnabled() && cPresetFast->isChecked(); if( cMode->currentText() == i18n("Quality") ) { options->qualityMode = ConversionOptions::Quality; options->quality = iQuality->value(); options->bitrate = bitrateForQuality( options->quality ); } else { options->qualityMode = ConversionOptions::Bitrate; options->bitrate = iQuality->value(); options->quality = qualityForBitrate( options->bitrate ); options->bitrateMode = ( cBitrateMode->currentText()==i18n("Average") ) ? ConversionOptions::Abr : ConversionOptions::Cbr; } options->compressionLevel = iCompressionLevel->value(); options->cmdArguments = cCmdArguments->isChecked() ? lCmdArguments->text() : ""; return options; } bool LameCodecWidget::setCurrentConversionOptions( ConversionOptions *_options ) { if( !_options || _options->pluginName != global_plugin_name ) return false; LameConversionOptions *options = static_cast(_options); cPreset->setCurrentIndex( (int)options->data.preset ); presetChanged( cPreset->currentText() ); iPresetBitrate->setValue( options->data.presetBitrate ); cPresetBitrateCbr->setChecked( options->data.presetBitrateCbr ); cPresetFast->setChecked( options->data.presetFast ); if( options->qualityMode == ConversionOptions::Quality ) { cMode->setCurrentIndex( cMode->findText(i18n("Quality")) ); modeChanged( cMode->currentIndex() ); iQuality->setValue( options->quality ); cBitrateMode->setCurrentIndex( cBitrateMode->findText(i18n("Variable")) ); } else { cMode->setCurrentIndex( cMode->findText(i18n("Bitrate")) ); modeChanged( cMode->currentIndex() ); iQuality->setValue( options->bitrate ); if( options->bitrateMode == ConversionOptions::Abr ) cBitrateMode->setCurrentIndex( cBitrateMode->findText(i18n("Average")) ); else cBitrateMode->setCurrentIndex( cBitrateMode->findText(i18n("Constant")) ); } iCompressionLevel->setValue( options->compressionLevel ); cCmdArguments->setChecked( !options->cmdArguments.isEmpty() ); if( !options->cmdArguments.isEmpty() ) lCmdArguments->setText( options->cmdArguments ); else lCmdArguments->clear(); return true; } void LameCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; setEnabled( currentFormat != "wav" ); } QString LameCodecWidget::currentProfile() { if( currentFormat == "wav" ) { return i18n("Lossless"); } else if( cPreset->currentIndex() == 5 && cMode->currentIndex() == 0 && iQuality->value() == 6 ) { return i18n("Very low"); } else if( cPreset->currentIndex() == 5 && cMode->currentIndex() == 0 && iQuality->value() == 5 ) { return i18n("Low"); } else if( cPreset->currentIndex() == 5 && cMode->currentIndex() == 0 && iQuality->value() == 4 ) { return i18n("Medium"); } else if( cPreset->currentIndex() == 5 && cMode->currentIndex() == 0 && iQuality->value() == 3 ) { return i18n("High"); } else if( cPreset->currentIndex() == 5 && cMode->currentIndex() == 0 && iQuality->value() == 2 ) { return i18n("Very high"); } return i18n("User defined"); } bool LameCodecWidget::setCurrentProfile( const QString& profile ) { cCmdArguments->setChecked( false ); lCmdArguments->clear(); if( profile == i18n("Very low") ) { cPreset->setCurrentIndex( 5 ); presetChanged( cPreset->currentText() ); cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 6 ); iQuality->setValue( 6 ); cBitrateMode->setCurrentIndex( 0 ); return true; } else if( profile == i18n("Low") ) { cPreset->setCurrentIndex( 5 ); presetChanged( cPreset->currentText() ); cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 5 ); iQuality->setValue( 5 ); cBitrateMode->setCurrentIndex( 0 ); return true; } else if( profile == i18n("Medium") ) { cPreset->setCurrentIndex( 5 ); presetChanged( cPreset->currentText() ); cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 4 ); iQuality->setValue( 4 ); cBitrateMode->setCurrentIndex( 0 ); return true; } else if( profile == i18n("High") ) { cPreset->setCurrentIndex( 5 ); presetChanged( cPreset->currentText() ); cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 3 ); iQuality->setValue( 3 ); cBitrateMode->setCurrentIndex( 0 ); return true; } else if( profile == i18n("Very high") ) { cPreset->setCurrentIndex( 5 ); presetChanged( cPreset->currentText() ); cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 2 ); iQuality->setValue( 2 ); cBitrateMode->setCurrentIndex( 0 ); return true; } return false; } int LameCodecWidget::currentDataRate() { int dataRate = 0; if( currentFormat == "wav" ) { dataRate = 10590000; } else { if( cPreset->currentIndex() == 0 ) { dataRate = 1090000; } else if( cPreset->currentIndex() == 1 ) { dataRate = 1140000; } else if( cPreset->currentIndex() == 2 ) { dataRate = 1400000; } else if( cPreset->currentIndex() == 3 ) { dataRate = 2360000; } else if( cPreset->currentIndex() == 4 ) { dataRate = iPresetBitrate->value()/8*60*1000; } else if( cPreset->currentIndex() == 5 ) { if( cMode->currentIndex() == 0 ) { dataRate = 1500000 - iQuality->value()*100000; } else { dataRate = iQuality->value()/8*60*1000; } } if( cPresetFast->isEnabled() && cPresetFast->isChecked() ) { dataRate *= 1.1f; } } return dataRate; } void LameCodecWidget::presetChanged( const QString& preset ) { cPreset->setToolTip( "" ); if( preset == i18nc("Backend profile","Medium") ) { iPresetBitrate->setEnabled( false ); cPresetFast->setEnabled( true ); userdefinedBox->setEnabled( false ); cPreset->setToolTip( i18n("This preset should provide near transparency to most people on most music (~150 kbps abr).") ); } else if( preset == i18nc("Backend profile","Standard") ) { iPresetBitrate->setEnabled( false ); cPresetFast->setEnabled( true ); userdefinedBox->setEnabled( false ); cPreset->setToolTip( i18n("This preset should generally be transparent to most people on most music\nand is already quite high in quality (~230 kbps abr).") ); } else if( preset == i18nc("Backend profile","Extreme") ) { iPresetBitrate->setEnabled( false ); cPresetFast->setEnabled( true ); userdefinedBox->setEnabled( false ); cPreset->setToolTip( i18n("If you have extremely good hearing and similar equipment, this preset will generally provide\nslightly higher quality than the standard mode (~280 kbps abr).") ); } else if( preset == i18nc("Backend profile","Insane") ) { iPresetBitrate->setEnabled( false ); cPresetFast->setEnabled( false ); userdefinedBox->setEnabled( false ); cPreset->setToolTip( i18n("This preset will usually be overkill for most people and most situations, but if you must have\nthe absolute highest quality with no regard to filesize, this is the way to go (320 kbps cbr).") ); } else if( preset == i18n("Specify bitrate") ) { iPresetBitrate->setEnabled( true ); cPresetFast->setEnabled( false ); userdefinedBox->setEnabled( false ); } else // "User defined" { iPresetBitrate->setEnabled( false ); cPresetFast->setEnabled( false ); userdefinedBox->setEnabled( true ); } presetBitrateChanged( iPresetBitrate->value() ); } void LameCodecWidget::presetBitrateChanged( int bitrate ) { if( iPresetBitrate->isEnabled() && ( bitrate == 80 || bitrate == 96 || bitrate == 112 || bitrate == 128 || bitrate == 160 || bitrate == 192 || bitrate == 224 || bitrate == 256 || bitrate == 320 ) ) { cPresetBitrateCbr->setEnabled( true ); } else { cPresetBitrateCbr->setEnabled( false ); } } void LameCodecWidget::modeChanged( int mode ) { if( mode == 0 ) { sQuality->setRange( 0, 9 ); // sQuality->setTickInterval( 100 ); sQuality->setSingleStep( 1 ); iQuality->setRange( 0, 9 ); iQuality->setSingleStep( 1 ); iQuality->setSuffix( "" ); sQuality->setValue( 5 ); iQuality->setValue( 5 ); // dQuality->setValue( qualityForBitrate(dQuality->value()) ); // qualitySpinBoxChanged( dQuality->value() ); sQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", 9, 0) ); iQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", 9, 0) ); cBitrateMode->clear(); cBitrateMode->addItem( i18n("Variable") ); cBitrateMode->setEnabled( false ); } else { sQuality->setRange( 8, 320 ); // sQuality->setTickInterval( 800 ); sQuality->setSingleStep( 8 ); iQuality->setRange( 8, 320 ); iQuality->setSingleStep( 1 ); iQuality->setSuffix( " kbps" ); sQuality->setValue( 160 ); iQuality->setValue( 160 ); // dQuality->setValue( bitrateForQuality(dQuality->value()) ); // qualitySpinBoxChanged( dQuality->value() ); sQuality->setToolTip( "" ); iQuality->setToolTip( "" ); cBitrateMode->clear(); cBitrateMode->addItem( i18n("Average") ); cBitrateMode->addItem( i18n("Constant") ); cBitrateMode->setEnabled( true ); } } void LameCodecWidget::qualitySliderChanged( int quality ) { if( cMode->currentText() == i18n("Quality") ) { iQuality->setValue( 9 - quality ); } else { iQuality->setValue( quality ); } } void LameCodecWidget::qualitySpinBoxChanged( int quality ) { if( cMode->currentText() == i18n("Quality") ) { sQuality->setValue( 9 - quality ); } else { sQuality->setValue( quality ); } } void LameCodecWidget::compressionLevelSliderChanged( int quality ) { iCompressionLevel->setValue( 9 - quality ); } void LameCodecWidget::compressionLevelSpinBoxChanged( int quality ) { sCompressionLevel->setValue( 9 - quality ); } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_lame/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006211726605673026102 xustar0020 atime=1308763306 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_lame/CMakeLists.txt0000755000175000001440000000122211726605673027075 0ustar00danielusers00000000000000project(soundkonverter_codec_lame) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_lame_SRCS soundkonverter_codec_lame.cpp lameconversionoptions.cpp lamecodecwidget.cpp ) kde4_add_plugin(soundkonverter_codec_lame ${soundkonverter_codec_lame_SRCS}) target_link_libraries(soundkonverter_codec_lame ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_lame DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_lame.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_lame/PaxHeaders.4329/soundkonverter_codec_lame.c0000644000000000000000000000006212276145051030717 xustar0020 atime=1398102755 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_lame/soundkonverter_codec_lame.cpp0000755000175000001440000003250312276145051032260 0ustar00danielusers00000000000000 #include "lamecodecglobal.h" #include "soundkonverter_codec_lame.h" #include "lameconversionoptions.h" #include "lamecodecwidget.h" #include #include #include #include #include #include #include #include #include #include soundkonverter_codec_lame::soundkonverter_codec_lame( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["lame"] = ""; allCodecs += "mp3"; allCodecs += "mp2"; allCodecs += "wav"; KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); configVersion = group.readEntry( "configVersion", 0 ); stereoMode = group.readEntry( "stereoMode", "automatic" ); } soundkonverter_codec_lame::~soundkonverter_codec_lame() {} QString soundkonverter_codec_lame::name() { return global_plugin_name; } QList soundkonverter_codec_lame::codecTable() { QList table; ConversionPipeTrunk newTrunk; newTrunk.codecFrom = "wav"; newTrunk.codecTo = "mp3"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["lame"] != "" ); newTrunk.problemInfo = standardMessage( "encode_codec,backend", "mp3", "lame" ) + "\n" + standardMessage( "install_patented_backend", "lame" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "mp3"; newTrunk.codecTo = "wav"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["lame"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "mp3", "lame" ) + "\n" + standardMessage( "install_patented_backend", "lame" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "mp3"; newTrunk.codecTo = "mp3"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["lame"] != "" ); newTrunk.problemInfo = standardMessage( "transcode_codec,backend", "mp3", "lame" ) + "\n" + standardMessage( "install_patented_backend", "lame" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "mp2"; newTrunk.codecTo = "wav"; newTrunk.rating = 70; newTrunk.enabled = ( binaries["lame"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "mp2", "lame" ) + "\n" + standardMessage( "install_patented_backend", "lame" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "mp2"; newTrunk.codecTo = "mp3"; newTrunk.rating = 70; newTrunk.enabled = ( binaries["lame"] != "" ); newTrunk.problemInfo = standardMessage( "transcode_codec,backend", "mp2/mp3", "lame" ) + "\n" + standardMessage( "install_patented_backend", "lame" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); return table; } bool soundkonverter_codec_lame::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return true; } void soundkonverter_codec_lame::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) if( !configDialog.data() ) { configDialog = new KDialog( parent ); configDialog.data()->setCaption( i18n("Configure %1").arg(global_plugin_name) ); configDialog.data()->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Default ); QWidget *configDialogWidget = new QWidget( configDialog.data() ); QHBoxLayout *configDialogBox = new QHBoxLayout( configDialogWidget ); QLabel *configDialogStereoModeLabel = new QLabel( i18n("Stereo mode:"), configDialogWidget ); configDialogBox->addWidget( configDialogStereoModeLabel ); configDialogStereoModeComboBox = new KComboBox( configDialogWidget ); configDialogStereoModeComboBox->addItem( i18n("Automatic"), "automatic" ); configDialogStereoModeComboBox->addItem( i18n("Joint Stereo"), "joint stereo" ); configDialogStereoModeComboBox->addItem( i18n("Simple Stereo"), "simple stereo" ); configDialogStereoModeComboBox->addItem( i18n("Forced Joint Stereo"), "forced joint stereo" ); configDialogStereoModeComboBox->addItem( i18n("Dual Mono"), "dual mono" ); configDialogBox->addWidget( configDialogStereoModeComboBox ); configDialog.data()->setMainWidget( configDialogWidget ); connect( configDialog.data(), SIGNAL( okClicked() ), this, SLOT( configDialogSave() ) ); connect( configDialog.data(), SIGNAL( defaultClicked() ), this, SLOT( configDialogDefault() ) ); } configDialogStereoModeComboBox->setCurrentIndex( configDialogStereoModeComboBox->findData(stereoMode) ); configDialog.data()->show(); } void soundkonverter_codec_lame::configDialogSave() { if( configDialog.data() ) { stereoMode = configDialogStereoModeComboBox->itemData( configDialogStereoModeComboBox->currentIndex() ).toString(); KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); group.writeEntry( "stereoMode", stereoMode ); configDialog.data()->deleteLater(); } } void soundkonverter_codec_lame::configDialogDefault() { if( configDialog.data() ) { configDialogStereoModeComboBox->setCurrentIndex( configDialogStereoModeComboBox->findData("automatic") ); } } bool soundkonverter_codec_lame::hasInfo() { return true; } void soundkonverter_codec_lame::showInfo( QWidget *parent ) { KDialog *dialog = new KDialog( parent ); dialog->setCaption( i18n("About %1").arg(global_plugin_name) ); dialog->setButtons( KDialog::Ok ); QLabel *widget = new QLabel( dialog ); widget->setText( i18n("LAME is a free high quality MP3 encoder.\nYou can get it at: http://lame.sourceforge.net") ); dialog->setMainWidget( widget ); dialog->enableButtonApply( false ); dialog->show(); } CodecWidget *soundkonverter_codec_lame::newCodecWidget() { LameCodecWidget *widget = new LameCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_codec_lame::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { QStringList command = convertCommand( inputFile, outputFile, inputCodec, outputCodec, _conversionOptions, tags, replayGain ); if( command.isEmpty() ) return BackendPlugin::UnknownError; CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_lame::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(tags) Q_UNUSED(replayGain) if( !_conversionOptions ) return QStringList(); if( inputFile.isEmpty() ) return QStringList(); QStringList command; ConversionOptions *conversionOptions = _conversionOptions; LameConversionOptions *lameConversionOptions = 0; if( conversionOptions->pluginName == name() ) { lameConversionOptions = static_cast(conversionOptions); } if( outputCodec == "mp3" ) { command += binaries["lame"]; command += "--nohist"; command += "--pad-id3v2"; if( conversionOptions->pluginName == name() ) { command += "-q"; command += QString::number((int)conversionOptions->compressionLevel); } // if( conversionOptions->replaygain && replayGain ) // { // command += "--replaygain-accurate"; // } // else // { // command += "--noreplaygain"; // } if( conversionOptions->pluginName != name() || !conversionOptions->cmdArguments.contains("replaygain") ) { command += "--noreplaygain"; } if( lameConversionOptions && lameConversionOptions->data.preset != LameConversionOptions::Data::UserDefined ) { command += "--preset"; if( lameConversionOptions->data.presetFast ) { command += "fast"; } if( lameConversionOptions->data.preset == LameConversionOptions::Data::Medium ) { command += "medium"; } else if( lameConversionOptions->data.preset == LameConversionOptions::Data::Standard ) { command += "standard"; } else if( lameConversionOptions->data.preset == LameConversionOptions::Data::Extreme ) { command += "extreme"; } else if( lameConversionOptions->data.preset == LameConversionOptions::Data::Insane ) { command += "insane"; } else if( lameConversionOptions->data.preset == LameConversionOptions::Data::SpecifyBitrate ) { if( lameConversionOptions->data.presetBitrateCbr ) { command += "cbr"; } command += QString::number(lameConversionOptions->data.presetBitrate); } } else { if( conversionOptions->qualityMode == ConversionOptions::Quality ) { if( conversionOptions->pluginName != name() || !conversionOptions->cmdArguments.contains("--vbr-old") ) { command += "--vbr-new"; } command += "-V"; command += QString::number(conversionOptions->quality); } else if( conversionOptions->qualityMode == ConversionOptions::Bitrate ) { if( conversionOptions->bitrateMode == ConversionOptions::Abr ) { command += "--abr"; command += QString::number(conversionOptions->bitrate); } else if( conversionOptions->bitrateMode == ConversionOptions::Cbr ) { command += "--cbr"; command += "-b"; command += QString::number(conversionOptions->bitrate); } } } if( stereoMode != "automatic" ) { command += "-m"; if( stereoMode == "joint stereo" ) { command += "j"; } else if( stereoMode == "simple stereo" ) { command += "s"; } else if( stereoMode == "forced joint stereo" ) { command += "f"; } else if( stereoMode == "dual mono" ) { command += "d"; } } if( conversionOptions->pluginName == name() ) { command += conversionOptions->cmdArguments; } command += "\"" + escapeUrl(inputFile) + "\""; command += "\"" + escapeUrl(outputFile) + "\""; } else { command += binaries["lame"]; command += "--decode"; command += "\"" + escapeUrl(inputFile) + "\""; command += "\"" + escapeUrl(outputFile) + "\""; } return command; } float soundkonverter_codec_lame::parseOutput( const QString& output ) { // decoding // Frame# 1398/8202 256 kbps L R (...) // encoding // \r 3600/3696 (97%)| 0:05/ 0:05| 0:05/ 0:05| 18.190x| 0:00 QString data = output; QString frame, count; if( output.contains("Frame#") ) { data.remove( 0, data.indexOf("Frame#")+7 ); frame = data.left( data.indexOf("/") ); data.remove( 0, data.indexOf("/")+1 ); count = data.left( data.indexOf(" ") ); return frame.toFloat()/count.toFloat()*100.0f; } if( output.contains("%") ) { frame = data.left( data.indexOf("/") ); frame.remove( 0, frame.lastIndexOf(" ")+1 ); data.remove( 0, data.indexOf("/")+1 ); count = data.left( data.indexOf(" ") ); return frame.toFloat()/count.toFloat()*100.0f; } /*if( output.contains("%") ) { data.remove( 0, data.indexOf("(")+1 ); data.remove( data.indexOf("%"), data.length()-data.indexOf("%") ); return data.toFloat(); }*/ return -1; } ConversionOptions *soundkonverter_codec_lame::conversionOptionsFromXml( QDomElement conversionOptions, QList *filterOptionsElements ) { LameConversionOptions *options = new LameConversionOptions(); options->fromXml( conversionOptions, filterOptionsElements ); return options; } #include "soundkonverter_codec_lame.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_codec_lame/PaxHeaders.4329/lameconversionoptions.cpp0000644000000000000000000000006212076525023030473 xustar0020 atime=1416311949 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_lame/lameconversionoptions.cpp0000644000175000001440000000502712076525023031472 0ustar00danielusers00000000000000 #include "lamecodecglobal.h" #include "lameconversionoptions.h" LameConversionOptions::LameConversionOptions() : ConversionOptions() { pluginName = global_plugin_name; } LameConversionOptions::~LameConversionOptions() {} bool LameConversionOptions::equals( ConversionOptions *_other ) { if( !_other || _other->pluginName!=pluginName ) return false; LameConversionOptions *other = dynamic_cast(_other); if( data.preset==other->data.preset && data.preset==Data::UserDefined ) { return ConversionOptions::equals(_other); } else if( data.preset==other->data.preset && data.preset==Data::SpecifyBitrate ) { return ( equalsBasics(_other) && equalsFilters(_other) && data.presetBitrate==other->data.presetBitrate && data.presetBitrateCbr==other->data.presetBitrateCbr && data.presetFast==other->data.presetFast ); } else if( data.preset==other->data.preset ) { return ( equalsBasics(_other) && equalsFilters(_other) && data.presetFast==other->data.presetFast ); } else { return false; } } QDomElement LameConversionOptions::toXml( QDomDocument document ) { QDomElement conversionOptions = ConversionOptions::toXml( document ); QDomElement encodingOptions = conversionOptions.elementsByTagName("encodingOptions").at(0).toElement(); QDomElement data = document.createElement("data"); data.setAttribute("preset",LameConversionOptions::data.preset); data.setAttribute("presetBitrate",LameConversionOptions::data.presetBitrate); data.setAttribute("presetBitrateCbr",LameConversionOptions::data.presetBitrateCbr); data.setAttribute("presetFast",LameConversionOptions::data.presetFast); encodingOptions.appendChild(data); return conversionOptions; } bool LameConversionOptions::fromXml( QDomElement conversionOptions, QList *filterOptionsElements ) { ConversionOptions::fromXml( conversionOptions, filterOptionsElements ); QDomElement encodingOptions = conversionOptions.elementsByTagName("encodingOptions").at(0).toElement(); QDomElement data = encodingOptions.elementsByTagName("data").at(0).toElement(); LameConversionOptions::data.preset = (Data::Preset)data.attribute("preset").toInt(); LameConversionOptions::data.presetBitrate = data.attribute("presetBitrate").toInt(); LameConversionOptions::data.presetBitrateCbr = data.attribute("presetBitrateCbr").toInt(); LameConversionOptions::data.presetFast = data.attribute("presetFast").toInt(); return true; } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_lame/PaxHeaders.4329/soundkonverter_codec_lame.h0000644000000000000000000000013212076525023030721 xustar0030 mtime=1358604819.230806354 30 atime=1358604819.230806354 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_lame/soundkonverter_codec_lame.h0000755000175000001440000000330412076525023031721 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_LAME_H #define SOUNDKONVERTER_CODEC_LAME_H #include "../../core/codecplugin.h" #include #include class ConversionOptions; class KDialog; class KComboBox; class soundkonverter_codec_lame : public CodecPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_codec_lame( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_lame(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output ); ConversionOptions *conversionOptionsFromXml( QDomElement conversionOptions, QList *filterOptionsElements = 0 ); private: QWeakPointer configDialog; KComboBox *configDialogStereoModeComboBox; int configVersion; QString stereoMode; private slots: void configDialogSave(); void configDialogDefault(); }; K_EXPORT_SOUNDKONVERTER_CODEC( lame, soundkonverter_codec_lame ) #endif // _SOUNDKONVERTER_CODEC_LAME_H_ ./soundkonverter-2.1.2/plugins/soundkonverter_codec_lame/PaxHeaders.4329/lameconversionoptions.h0000644000000000000000000000013212076525023030136 xustar0030 mtime=1358604819.230806354 30 atime=1358604819.230806354 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_lame/lameconversionoptions.h0000644000175000001440000000141012076525023031127 0ustar00danielusers00000000000000 #ifndef LAMECONVERSIONOPTIONS_H #define LAMECONVERSIONOPTIONS_H #include "../../core/conversionoptions.h" class LameConversionOptions : public ConversionOptions { public: LameConversionOptions(); ~LameConversionOptions(); bool equals( ConversionOptions *_other ); QDomElement toXml( QDomDocument document ); bool fromXml( QDomElement conversionOptions, QList *filterOptionsElements = 0 ); struct Data { enum Preset { Medium = 0, Standard = 1, Extreme = 2, Insane = 3, SpecifyBitrate = 4, UserDefined = 5 } preset; int presetBitrate; bool presetBitrateCbr; bool presetFast; } data; }; #endif // LAMECONVERSIONOPTIONS_H./soundkonverter-2.1.2/plugins/soundkonverter_codec_lame/PaxHeaders.4329/lamecodecglobal.h0000644000000000000000000000006211017026701026566 xustar0020 atime=1418040442 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_lame/lamecodecglobal.h0000644000175000001440000000010511017026701027555 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "lame" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_codec_lame/PaxHeaders.4329/soundkonverter_codec_lame.d0000644000000000000000000000006210764724042030723 xustar0020 atime=1308601626 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_lame/soundkonverter_codec_lame.desktop0000755000175000001440000000052710764724042033153 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter Lame Plugin X-KDE-Library=soundkonverter_codec_lame ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_lame X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_faac0000644000000000000000000000011712303361555023230 xustar0029 mtime=1393419117.73573359 20 atime=1358274330 30 ctime=1418040695.159717232 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_faac/0000755000175000001440000000000012303361555024277 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_faac/PaxHeaders.4329/soundkonverter_codec_faac.h0000644000000000000000000000013212303361454030650 xustar0030 mtime=1393419052.731474765 30 atime=1393419052.730474761 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_faac/soundkonverter_codec_faac.h0000755000175000001440000000317612303361454031657 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_FAAC_H #define SOUNDKONVERTER_CODEC_FAAC_H #include "../../core/codecplugin.h" #include #include class ConversionOptions; class soundkonverter_codec_faac : public CodecPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_codec_faac( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_faac(); QString name(); int version(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output ); private: QWeakPointer infoProcess; QString infoProcessOutputData; int configVersion; QDateTime faacLastModified; bool faacHasMp4Support; private slots: void infoProcessOutput(); void infoProcessExit( int exitCode, QProcess::ExitStatus exitStatus ); }; K_EXPORT_SOUNDKONVERTER_CODEC( faac, soundkonverter_codec_faac ) #endif // _SOUNDKONVERTER_CODEC_FAAC_H_ ./soundkonverter-2.1.2/plugins/soundkonverter_codec_faac/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006211726605441026047 xustar0020 atime=1308763306 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_faac/CMakeLists.txt0000755000175000001440000000116511726605441027050 0ustar00danielusers00000000000000project(soundkonverter_codec_faac) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_faac_SRCS soundkonverter_codec_faac.cpp faaccodecwidget.cpp ) kde4_add_plugin(soundkonverter_codec_faac ${soundkonverter_codec_faac_SRCS}) target_link_libraries(soundkonverter_codec_faac ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_faac DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_faac.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_faac/PaxHeaders.4329/faaccodecglobal.h0000644000000000000000000000006212303356726026532 xustar0020 atime=1416311950 30 ctime=1418040695.159717232 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_faac/faaccodecglobal.h0000644000175000001440000000021312303356726027521 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "FAAC" #endif #ifndef global_plugin_version #define global_plugin_version 1 #endif ./soundkonverter-2.1.2/plugins/soundkonverter_codec_faac/PaxHeaders.4329/soundkonverter_codec_faac.d0000644000000000000000000000006211374506670030656 xustar0020 atime=1308601627 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_faac/soundkonverter_codec_faac.desktop0000755000175000001440000000052711374506670033106 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter FAAC Plugin X-KDE-Library=soundkonverter_codec_faac ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_faac X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_codec_faac/PaxHeaders.4329/faaccodecwidget.cpp0000644000000000000000000000006212276433306027107 xustar0020 atime=1398102755 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_faac/faaccodecwidget.cpp0000644000175000001440000001617712276433306030116 0ustar00danielusers00000000000000 #include "faaccodecglobal.h" #include "faaccodecwidget.h" #include "../../core/conversionoptions.h" #include #include #include #include #include #include FaacCodecWidget::FaacCodecWidget() : CodecWidget(), currentFormat( "m4a/aac" ) { QGridLayout *grid = new QGridLayout( this ); grid->setContentsMargins( 0, 0, 0, 0 ); // set up encoding options selection QHBoxLayout *topBox = new QHBoxLayout(); grid->addLayout( topBox, 0, 0 ); QLabel *lMode = new QLabel( i18n("Mode:"), this ); topBox->addWidget( lMode ); cMode = new KComboBox( this ); cMode->addItem( i18n("Quality") ); cMode->addItem( i18n("Bitrate") ); connect( cMode, SIGNAL(activated(int)), this, SLOT(modeChanged(int)) ); connect( cMode, SIGNAL(activated(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( cMode ); sQuality = new QSlider( Qt::Horizontal, this ); connect( sQuality, SIGNAL(valueChanged(int)), this, SLOT(qualitySliderChanged(int)) ); connect( sQuality, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( sQuality ); dQuality = new QSpinBox( this ); dQuality->setRange( 8, 320 ); dQuality->setSuffix( " kbps" ); dQuality->setFixedWidth( dQuality->sizeHint().width() ); connect( dQuality, SIGNAL(valueChanged(int)), this, SLOT(qualitySpinBoxChanged(int)) ); connect( dQuality, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( dQuality ); topBox->addStretch(); grid->setRowStretch( 1, 1 ); modeChanged( 0 ); } FaacCodecWidget::~FaacCodecWidget() {} // TODO optimize int FaacCodecWidget::bitrateForQuality( int quality ) { return quality*100/3; } // TODO optimize int FaacCodecWidget::qualityForBitrate( int bitrate ) { return bitrate*3/100; } ConversionOptions *FaacCodecWidget::currentConversionOptions() { ConversionOptions *options = new ConversionOptions(); if( cMode->currentText()==i18n("Quality") ) { options->qualityMode = ConversionOptions::Quality; options->quality = dQuality->value(); options->bitrate = bitrateForQuality( options->quality ); } else { options->qualityMode = ConversionOptions::Bitrate; options->bitrate = dQuality->value(); options->quality = qualityForBitrate( options->bitrate ); } return options; } bool FaacCodecWidget::setCurrentConversionOptions( ConversionOptions *_options ) { if( !_options || _options->pluginName != global_plugin_name ) return false; ConversionOptions *options = _options; if( options->qualityMode == ConversionOptions::Quality ) { cMode->setCurrentIndex( cMode->findText(i18n("Quality")) ); modeChanged( cMode->currentIndex() ); dQuality->setValue( options->quality ); } else { cMode->setCurrentIndex( cMode->findText(i18n("Bitrate")) ); modeChanged( cMode->currentIndex() ); dQuality->setValue( options->bitrate ); } return true; } void FaacCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; setEnabled( currentFormat != "wav" ); } QString FaacCodecWidget::currentProfile() { if( currentFormat == "wav" ) { return i18n("Lossless"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 60 ) { return i18n("Very low"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 80 ) { return i18n("Low"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 100 ) { return i18n("Medium"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 140 ) { return i18n("High"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 180 ) { return i18n("Very high"); } return i18n("User defined"); } bool FaacCodecWidget::setCurrentProfile( const QString& profile ) { if( profile == i18n("Very low") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 60 ); dQuality->setValue( 60 ); return true; } else if( profile == i18n("Low") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 80 ); dQuality->setValue( 80 ); return true; } else if( profile == i18n("Medium") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 100 ); dQuality->setValue( 100 ); return true; } else if( profile == i18n("High") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 140 ); dQuality->setValue( 140 ); return true; } else if( profile == i18n("Very high") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 180 ); dQuality->setValue( 180 ); return true; } return false; } int FaacCodecWidget::currentDataRate() { int dataRate; if( currentFormat == "wav" ) { dataRate = 10590000; } else { // TODO calculate data rate for faac dataRate = 0; } return dataRate; } void FaacCodecWidget::modeChanged( int mode ) { if( mode == 0 ) { sQuality->setRange( 10, 500 ); // sQuality->setTickInterval( 100 ); sQuality->setSingleStep( 10 ); dQuality->setRange( 10, 500 ); dQuality->setSingleStep( 1 ); dQuality->setSuffix( "" ); sQuality->setValue( 100 ); dQuality->setValue( 100 ); // dQuality->setValue( qualityForBitrate(dQuality->value()) ); // qualitySpinBoxChanged( dQuality->value() ); sQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", 10, 500) ); dQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", 10, 500) ); // cBitrateMode->clear(); // cBitrateMode->addItem( i18n("Variable") ); // cBitrateMode->setEnabled( false ); } else { sQuality->setRange( 60, 152 ); // max. value 152 kbps/stereo with a 16 kHz cutoff sQuality->setSingleStep( 8 ); dQuality->setRange( 60, 152 ); dQuality->setSingleStep( 1 ); dQuality->setSuffix( " kbps" ); sQuality->setValue( 128 ); dQuality->setValue( 128 ); // dQuality->setValue( bitrateForQuality(dQuality->value()) ); // qualitySpinBoxChanged( dQuality->value() ); sQuality->setToolTip( "" ); dQuality->setToolTip( "" ); // cBitrateMode->clear(); // cBitrateMode->addItem( i18n("Average") ); // cBitrateMode->addItem( i18n("Constant") ); // cBitrateMode->setEnabled( true ); } } void FaacCodecWidget::qualitySliderChanged( int quality ) { dQuality->setValue( quality ); } void FaacCodecWidget::qualitySpinBoxChanged( int quality ) { sQuality->setValue( quality ); } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_faac/PaxHeaders.4329/soundkonverter_codec_faac.c0000644000000000000000000000006212303361555030647 xustar0020 atime=1418040441 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_faac/soundkonverter_codec_faac.cpp0000755000175000001440000002110512303361555032204 0ustar00danielusers00000000000000 #include "faaccodecglobal.h" #include "soundkonverter_codec_faac.h" #include "../../core/conversionoptions.h" #include "faaccodecwidget.h" #include #include soundkonverter_codec_faac::soundkonverter_codec_faac( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["faac"] = ""; binaries["faad"] = ""; KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); configVersion = group.readEntry( "configVersion", 0 ); faacLastModified = group.readEntry( "faacLastModified", QDateTime() ); faacHasMp4Support = group.readEntry( "faacHasMp4Support", true ); allCodecs += "aac"; allCodecs += "m4a/aac"; allCodecs += "mp4"; allCodecs += "wav"; } soundkonverter_codec_faac::~soundkonverter_codec_faac() {} QString soundkonverter_codec_faac::name() { return global_plugin_name; } int soundkonverter_codec_faac::version() { return global_plugin_version; } QList soundkonverter_codec_faac::codecTable() { QList table; ConversionPipeTrunk newTrunk; if( !binaries["faac"].isEmpty() ) { QFileInfo faacInfo( binaries["faac"] ); if( faacInfo.lastModified() > faacLastModified || configVersion < version() ) { infoProcess = new KProcess(); infoProcess.data()->setOutputChannelMode( KProcess::MergedChannels ); connect( infoProcess.data(), SIGNAL(readyRead()), this, SLOT(infoProcessOutput()) ); connect( infoProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(infoProcessExit(int,QProcess::ExitStatus)) ); QStringList command; command += binaries["faac"]; command += "--help"; infoProcess.data()->clearProgram(); infoProcess.data()->setShellCommand( command.join(" ") ); infoProcess.data()->start(); infoProcess.data()->waitForFinished( 3000 ); } } newTrunk.codecFrom = "wav"; newTrunk.codecTo = "aac"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["faac"] != "" ); newTrunk.problemInfo = standardMessage( "encode_codec,backend", "aac", "faac" ) + "\n" + standardMessage( "install_patented_backend", "faac" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "wav"; newTrunk.codecTo = "m4a/aac"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["faac"] != "" && faacHasMp4Support ); if( binaries["faad"] != "" && !faacHasMp4Support ) { newTrunk.problemInfo = i18n("Compile faac with MP4 support."); } else { newTrunk.problemInfo = standardMessage( "encode_codec,backend", "m4a/aac", "faac" ) + "\n" + standardMessage( "install_patented_backend", "faac" ); } newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "aac"; newTrunk.codecTo = "wav"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["faad"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "aac", "faac" ) + "\n" + standardMessage( "install_patented_backend", "faac" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "m4a/aac"; newTrunk.codecTo = "wav"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["faad"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "m4a/aac", "faac" ) + "\n" + standardMessage( "install_patented_backend", "faac" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "mp4"; newTrunk.codecTo = "wav"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["faad"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "mp4", "faac" ) + "\n" + standardMessage( "install_patented_backend", "faac" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); return table; } bool soundkonverter_codec_faac::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_codec_faac::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_codec_faac::hasInfo() { return false; } void soundkonverter_codec_faac::showInfo( QWidget *parent ) { Q_UNUSED(parent) } CodecWidget *soundkonverter_codec_faac::newCodecWidget() { FaacCodecWidget *widget = new FaacCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_codec_faac::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { QStringList command = convertCommand( inputFile, outputFile, inputCodec, outputCodec, _conversionOptions, tags, replayGain ); if( command.isEmpty() ) return BackendPlugin::UnknownError; CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_faac::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(tags) Q_UNUSED(replayGain) if( !_conversionOptions ) return QStringList(); QStringList command; ConversionOptions *conversionOptions = _conversionOptions; if( outputCodec == "aac" || outputCodec == "m4a/aac" ) { command += binaries["faac"]; if( conversionOptions->qualityMode == ConversionOptions::Quality ) { command += "-q"; command += QString::number(conversionOptions->quality); } else if( conversionOptions->qualityMode == ConversionOptions::Bitrate ) { command += "-b"; command += QString::number(conversionOptions->bitrate); } if( outputCodec == "m4a/aac" ) { command += "-w"; // Wrap AAC data in MP4 container } command += "-o"; command += "\"" + escapeUrl(outputFile) + "\""; command += "\"" + escapeUrl(inputFile) + "\""; } else { command += binaries["faad"]; command += "-o"; command += "\"" + escapeUrl(outputFile) + "\""; command += "\"" + escapeUrl(inputFile) + "\""; } return command; } float soundkonverter_codec_faac::parseOutput( const QString& output ) { // 9397/9397 (100%)| 136.1 | 9.1/9.1 | 23.92x | 0.0 QRegExp regEnc("(\\d+)/(\\d+)"); if( output.contains(regEnc) ) { return (float)regEnc.cap(1).toInt()*100/regEnc.cap(2).toInt(); } // 15% decoding xxx QRegExp regDec("(\\d+)%"); if( output.contains(regDec) ) { return (float)regDec.cap(1).toInt(); } return -1; } void soundkonverter_codec_faac::infoProcessOutput() { infoProcessOutputData.append( infoProcess.data()->readAllStandardOutput().data() ); } void soundkonverter_codec_faac::infoProcessExit( int exitCode, QProcess::ExitStatus exitStatus ) { Q_UNUSED(exitStatus) Q_UNUSED(exitCode) if( infoProcessOutputData.contains("MP4 support unavailable", Qt::CaseInsensitive) ) { faacHasMp4Support = false; } else { faacHasMp4Support = true; } QFileInfo ffmpegInfo( binaries["faac"] ); faacLastModified = ffmpegInfo.lastModified(); KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); group.writeEntry( "configVersion", version() ); group.writeEntry( "faacLastModified", faacLastModified ); group.writeEntry( "faacHasMp4Support", faacHasMp4Support ); infoProcessOutputData.clear(); infoProcess.data()->deleteLater(); } #include "soundkonverter_codec_faac.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_codec_faac/PaxHeaders.4329/faaccodecwidget.h0000644000000000000000000000013212076525023026546 xustar0030 mtime=1358604819.224806338 30 atime=1358604819.224806338 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_faac/faaccodecwidget.h0000644000175000001440000000166012076525023027546 0ustar00danielusers00000000000000 #ifndef FAACCODECWIDGET_H #define FAACCODECWIDGET_H #include "../../core/codecwidget.h" class KComboBox; class QSlider; class QSpinBox; class FaacCodecWidget : public CodecWidget { Q_OBJECT public: FaacCodecWidget(); ~FaacCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *_options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: KComboBox *cMode; QSlider *sQuality; QSpinBox *dQuality; QString currentFormat; // holds the current output file format int bitrateForQuality( int quality ); int qualityForBitrate( int bitrate ); private slots: void modeChanged( int mode ); void qualitySliderChanged( int quality ); void qualitySpinBoxChanged( int quality ); }; #endif // FAACCODECWIDGET_H ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_replaygain_mp3gain0000644000000000000000000000011712441312442024744 xustar0030 mtime=1418040610.314840475 20 atime=1358274330 29 ctime=1418040695.16071723 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_mp3gain/0000755000175000001440000000000012441312442026013 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_mp3gain/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006111726605563027575 xustar0020 atime=1308763307 29 ctime=1418040695.16071723 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_mp3gain/CMakeLists.txt0000755000175000001440000000121211726605563030570 0ustar00danielusers00000000000000project(soundkonverter_replaygain_mp3gain) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_replaygain_mp3gain_SRCS soundkonverter_replaygain_mp3gain.cpp ) kde4_add_plugin(soundkonverter_replaygain_mp3gain ${soundkonverter_replaygain_mp3gain_SRCS}) target_link_libraries(soundkonverter_replaygain_mp3gain ${KDE4_KDEUI_LIBS} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_replaygain_mp3gain DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_replaygain_mp3gain.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_mp3gain/PaxHeaders.4329/soundkonverter_repl0000644000000000000000000000031112441312442031052 xustar00112 path=./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_mp3gain/soundkonverter_replaygain_mp3gain.cpp 30 mtime=1418040610.314840475 30 atime=1418040610.314840475 29 ctime=1418040695.16071723 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_mp3gain/soundkonverter_replaygain_mp3gain.c0000755000175000001440000002142112441312442035103 0ustar00danielusers00000000000000 #include "mp3replaygainglobal.h" #include "soundkonverter_replaygain_mp3gain.h" #include #include #include #include #include Mp3GainPluginItem::Mp3GainPluginItem( QObject *parent ) : ReplayGainPluginItem( parent ) {} Mp3GainPluginItem::~Mp3GainPluginItem() {} soundkonverter_replaygain_mp3gain::soundkonverter_replaygain_mp3gain( QObject *parent, const QStringList& args ) : ReplayGainPlugin( parent ) { Q_UNUSED(args) binaries["mp3gain"] = ""; allCodecs += "mp3"; KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); tagMode = group.readEntry( "tagMode", 0 ); modifyAudioStream = group.readEntry( "modifyAudioStream", true ); } soundkonverter_replaygain_mp3gain::~soundkonverter_replaygain_mp3gain() {} QString soundkonverter_replaygain_mp3gain::name() { return global_plugin_name; } QList soundkonverter_replaygain_mp3gain::codecTable() { QList table; ReplayGainPipe newPipe; newPipe.codecName = "mp3"; newPipe.rating = 100; newPipe.enabled = ( binaries["mp3gain"] != "" ); newPipe.problemInfo = standardMessage( "replygain_codec,backend", "mp3", "mp3gain" ) + "\n" + standardMessage( "install_patented_backend", "mp3gain" ); table.append( newPipe ); return table; } bool soundkonverter_replaygain_mp3gain::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return true; } void soundkonverter_replaygain_mp3gain::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) if( !configDialog.data() ) { configDialog = new KDialog( parent ); configDialog.data()->setCaption( i18n("Configure %1").arg(global_plugin_name) ); configDialog.data()->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Default ); QWidget *configDialogWidget = new QWidget( configDialog.data() ); QVBoxLayout *configDialogBox = new QVBoxLayout( configDialogWidget ); QHBoxLayout *configDialogBox1 = new QHBoxLayout(); QLabel *configDialogTagModeLabel = new QLabel( i18n("Use tag format:"), configDialogWidget ); configDialogBox1->addWidget( configDialogTagModeLabel ); configDialogTagModeComboBox = new QComboBox( configDialogWidget ); configDialogTagModeComboBox->addItem( "APE" ); configDialogTagModeComboBox->addItem( "ID3v2" ); configDialogBox1->addWidget( configDialogTagModeComboBox ); configDialogBox->addLayout( configDialogBox1 ); QHBoxLayout *configDialogBox2 = new QHBoxLayout(); configDialogModifyAudioStreamCheckBox = new QCheckBox( i18n("Modify audio stream"), configDialogWidget ); configDialogModifyAudioStreamCheckBox->setToolTip( i18n("Write gain adjustments directly into the encoded data. That way the adjustment works with all mp3 players.\nUndoing the changes is still possible since correction data will be written as well.") ); configDialogBox2->addWidget( configDialogModifyAudioStreamCheckBox ); configDialogBox->addLayout( configDialogBox2 ); configDialog.data()->setMainWidget( configDialogWidget ); connect( configDialog.data(), SIGNAL( okClicked() ), this, SLOT( configDialogSave() ) ); connect( configDialog.data(), SIGNAL( defaultClicked() ), this, SLOT( configDialogDefault() ) ); } configDialogTagModeComboBox->setCurrentIndex( tagMode ); configDialogModifyAudioStreamCheckBox->setChecked( modifyAudioStream ); configDialog.data()->show(); } void soundkonverter_replaygain_mp3gain::configDialogSave() { if( configDialog.data() ) { tagMode = configDialogTagModeComboBox->currentIndex(); modifyAudioStream = configDialogModifyAudioStreamCheckBox->isChecked(); KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); group.writeEntry( "tagMode", tagMode ); group.writeEntry( "modifyAudioStream", modifyAudioStream ); configDialog.data()->deleteLater(); } } void soundkonverter_replaygain_mp3gain::configDialogDefault() { if( configDialog.data() ) { configDialogTagModeComboBox->setCurrentIndex( 0 ); configDialogModifyAudioStreamCheckBox->setChecked( true ); } } bool soundkonverter_replaygain_mp3gain::hasInfo() { return false; } void soundkonverter_replaygain_mp3gain::showInfo( QWidget *parent ) { Q_UNUSED(parent) } unsigned int soundkonverter_replaygain_mp3gain::apply( const KUrl::List& fileList, ReplayGainPlugin::ApplyMode mode ) { if( fileList.count() <= 0 ) return BackendPlugin::UnknownError; Mp3GainPluginItem *newItem = new Mp3GainPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); QStringList command; command += binaries["mp3gain"]; command += "-k"; if( mode == ReplayGainPlugin::Add ) { if( modifyAudioStream ) { command += "-a"; } connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); } else if( mode == ReplayGainPlugin::Force ) { if( modifyAudioStream ) { command += "-a"; } command += "-s"; command += "r"; connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); } else { command += "-u"; connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(undoProcessExit(int,QProcess::ExitStatus)) ); newItem->undoFileList = fileList; } if( mode == ReplayGainPlugin::Add || mode == ReplayGainPlugin::Force ) { if( tagMode == 0 ) { // APE tags command += "-s"; command += "a"; } else { // ID3v2 tags command += "-s"; command += "i"; } } foreach( const KUrl file, fileList ) { command += "\"" + escapeUrl(file) + "\""; } newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } void soundkonverter_replaygain_mp3gain::undoProcessExit( int exitCode, QProcess::ExitStatus exitStatus ) { Q_UNUSED(exitCode) Q_UNUSED(exitStatus) Mp3GainPluginItem *item = 0; for( int i=0; iprocess == QObject::sender() ) { item = (Mp3GainPluginItem*)backendItems.at(i); break; } } if( !item ) return; if( item->undoFileList.count() <= 0 ) return; if( item->process ) item->process->deleteLater(); item->process = new KProcess( item ); item->process->setOutputChannelMode( KProcess::MergedChannels ); connect( item->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( item->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); QStringList command; command += binaries["mp3gain"]; command += "-s"; command += "d"; foreach( const KUrl file, item->undoFileList ) { command += "\"" + escapeUrl(file) + "\""; } item->process->clearProgram(); item->process->setShellCommand( command.join(" ") ); item->process->start(); logCommand( item->id, command.join(" ") ); } float soundkonverter_replaygain_mp3gain::parseOutput( const QString& output ) { // 9% of 45218064 bytes analyzed // [1/10] 32% of 13066690 bytes analyzed float progress = -1.0f; QRegExp reg1("\\[(\\d+)/(\\d+)\\] (\\d+)%"); QRegExp reg2("(\\d+)%"); if( output.contains(reg1) ) { float fraction = 1.0f/reg1.cap(2).toInt(); progress = 100*(reg1.cap(1).toInt()-1)*fraction + reg1.cap(3).toInt()*fraction; } else if( output.contains(reg2) ) { progress = reg2.cap(1).toInt(); } // Applying mp3 gain change of -6 to /home/user/file.mp3... // Undoing mp3gain changes (6,6) to /home/user/file.mp3... // Deleting tag info of /home/user/file.mp3... QRegExp reg3("[Applying mp3 gain change|Undoing mp3gain changes|Deleting tag info]"); if( progress == -1 && output.contains(reg3) ) { progress = 0.0f; } return progress; } #include "soundkonverter_replaygain_mp3gain.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_mp3gain/PaxHeaders.4329/soundkonverter_repl0000644000000000000000000000013112441312442031052 xustar0030 mtime=1418040610.314840475 30 atime=1418040610.314840475 29 ctime=1418040695.16071723 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_mp3gain/soundkonverter_replaygain_mp3gain.h0000755000175000001440000000316312441312442035113 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_REPLAYGAIN_MP3GAIN_H #define SOUNDKONVERTER_REPLAYGAIN_MP3GAIN_H #include "../../core/replaygainplugin.h" #include #include class ConversionOptions; class KDialog; class QComboBox; class QCheckBox; class Mp3GainPluginItem : public ReplayGainPluginItem { Q_OBJECT public: Mp3GainPluginItem( QObject *parent=0 ); ~Mp3GainPluginItem(); KUrl::List undoFileList; }; class soundkonverter_replaygain_mp3gain : public ReplayGainPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_replaygain_mp3gain( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_replaygain_mp3gain(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); unsigned int apply( const KUrl::List& fileList, ApplyMode mode = Add ); float parseOutput( const QString& output ); private: QWeakPointer configDialog; QComboBox *configDialogTagModeComboBox; QCheckBox *configDialogModifyAudioStreamCheckBox; int tagMode; bool modifyAudioStream; private slots: /** The undo process has exited */ virtual void undoProcessExit( int exitCode, QProcess::ExitStatus exitStatus ); void configDialogSave(); void configDialogDefault(); }; K_EXPORT_SOUNDKONVERTER_REPLAYGAIN( mp3gain, soundkonverter_replaygain_mp3gain ) #endif // _SOUNDKONVERTER_REPLAYGAIN_MP3GAIN_H_ ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_mp3gain/PaxHeaders.4329/mp3replaygainglobal0000644000000000000000000000006111314457616030711 xustar0020 atime=1418040445 29 ctime=1418040695.16071723 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_mp3gain/mp3replaygainglobal.h0000644000175000001440000000011111314457616032124 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "Mp3 Gain" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_mp3gain/PaxHeaders.4329/soundkonverter_repl0000644000000000000000000000024511314457756031100 xustar00116 path=./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_mp3gain/soundkonverter_replaygain_mp3gain.desktop 20 atime=1308601627 29 ctime=1418040695.16071723 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_mp3gain/soundkonverter_replaygain_mp3gain.d0000755000175000001440000000055711314457756035133 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter mp3gain plugin X-KDE-Library=soundkonverter_replaygain_mp3gain ServiceTypes=soundKonverter/ReplayGainPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_replaygain_mp3gain X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_musepack0000644000000000000000000000012012276433700024141 xustar0030 mtime=1392129984.063103599 20 atime=1358274330 30 ctime=1418040695.157717235 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_musepack/0000755000175000001440000000000012276433700025216 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_musepack/PaxHeaders.4329/soundkonverter_codec_mu0000644000000000000000000000006211441643247031076 xustar0020 atime=1308601627 30 ctime=1418040695.156717236 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_musepack/soundkonverter_codec_musepack.desktop0000755000175000001440000000054311441643247034735 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter MusePack Plugin X-KDE-Library=soundkonverter_codec_musepack ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_musepack X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_codec_musepack/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006211726605655026774 xustar0020 atime=1308763307 30 ctime=1418040695.156717236 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_musepack/CMakeLists.txt0000755000175000001440000000127211726605655027774 0ustar00danielusers00000000000000project(soundkonverter_codec_musepack) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_musepack_SRCS soundkonverter_codec_musepack.cpp musepackcodecwidget.cpp musepackconversionoptions.cpp ) kde4_add_plugin(soundkonverter_codec_musepack ${soundkonverter_codec_musepack_SRCS}) target_link_libraries(soundkonverter_codec_musepack ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_musepack DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_musepack.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_musepack/PaxHeaders.4329/musepackcodecwidget.h0000644000000000000000000000013212076525023030402 xustar0030 mtime=1358604819.233806363 30 atime=1358604819.233806363 30 ctime=1418040695.156717236 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_musepack/musepackcodecwidget.h0000644000175000001440000000233212076525023031377 0ustar00danielusers00000000000000 #ifndef MUSEPACKCODECWIDGET_H #define MUSEPACKCODECWIDGET_H #include "../../core/codecwidget.h" class KComboBox; class KLineEdit; class QSlider; class QDoubleSpinBox; class QGroupBox; class QCheckBox; class MusePackCodecWidget : public CodecWidget { Q_OBJECT public: MusePackCodecWidget(); ~MusePackCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *_options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: // preset selection KComboBox *cPreset; // user defined options QGroupBox *userdefinedBox; QSlider *sQuality; QDoubleSpinBox *dQuality; QCheckBox *cCmdArguments; KLineEdit *lCmdArguments; QString currentFormat; // holds the current output file format int bitrateForQuality( double quality ); double qualityForBitrate( int bitrate ); private slots: // presets void presetChanged( const QString& preset ); // user defined options void qualitySliderChanged( int quality ); void qualitySpinBoxChanged( double quality ); }; #endif // MUSEPACKCODECWIDGET_H./soundkonverter-2.1.2/plugins/soundkonverter_codec_musepack/PaxHeaders.4329/musepackcodecwidget.cpp0000644000000000000000000000006212276433700030741 xustar0020 atime=1398102755 30 ctime=1418040695.157717235 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_musepack/musepackcodecwidget.cpp0000644000175000001440000002340412276433700031737 0ustar00danielusers00000000000000 #include "musepackcodecglobal.h" #include "musepackcodecwidget.h" #include "musepackconversionoptions.h" #include #include #include #include #include #include #include #include #include #include #include MusePackCodecWidget::MusePackCodecWidget() : CodecWidget(), currentFormat( "musepack" ) { const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); QGridLayout *grid = new QGridLayout( this ); grid->setContentsMargins( 0, 0, 0, 0 ); // set up preset selection QHBoxLayout *presetBox = new QHBoxLayout(); grid->addLayout( presetBox, 0, 0 ); QLabel *lPreset = new QLabel( i18n("Preset:"), this ); presetBox->addWidget( lPreset ); cPreset = new KComboBox( this ); cPreset->addItem( i18nc("Backend profile","Telephone") ); cPreset->addItem( i18nc("Backend profile","Thumb") ); cPreset->addItem( i18nc("Backend profile","Radio") ); cPreset->addItem( i18nc("Backend profile","Standard") ); cPreset->addItem( i18nc("Backend profile","Extreme") ); cPreset->addItem( i18nc("Backend profile","Insane") ); cPreset->addItem( i18nc("Backend profile","Braindead") ); cPreset->addItem( i18n("User defined") ); cPreset->setCurrentIndex( 3 ); cPreset->setToolTip( i18n("Either use one of MusePacks's presets or your own settings.") ); connect( cPreset, SIGNAL(activated(const QString&)), this, SLOT(presetChanged(const QString&)) ); connect( cPreset, SIGNAL(activated(int)), SIGNAL(optionsChanged()) ); presetBox->addWidget( cPreset ); presetBox->addStretch(); // set up user defined options userdefinedBox = new QGroupBox( /*i18n("User defined"),*/ this ); grid->addWidget( userdefinedBox, 1, 0 ); QVBoxLayout *userdefinedBoxLayout = new QVBoxLayout(); userdefinedBox->setLayout( userdefinedBoxLayout ); // top box ---------------------------------------- QHBoxLayout *userdefinedTopBox = new QHBoxLayout(); userdefinedBoxLayout->addLayout( userdefinedTopBox ); QLabel *lQuality = new QLabel( i18n("Quality"), userdefinedBox ); userdefinedTopBox->addWidget( lQuality ); userdefinedTopBox->addSpacing( 0.5*fontHeight ); sQuality = new QSlider( Qt::Horizontal, userdefinedBox ); sQuality->setRange( 0, 1000 ); sQuality->setSingleStep( 100 ); sQuality->setValue( 500 ); connect( sQuality, SIGNAL(valueChanged(int)), this, SLOT(qualitySliderChanged(int)) ); connect( sQuality, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); userdefinedTopBox->addWidget( sQuality ); sQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", 0, 10) ); dQuality = new QDoubleSpinBox( userdefinedBox ); dQuality->setRange( 0, 10 ); dQuality->setSingleStep( 1 ); dQuality->setValue( 5 ); dQuality->setFixedWidth( dQuality->sizeHint().width() ); connect( dQuality, SIGNAL(valueChanged(double)), this, SLOT(qualitySpinBoxChanged(double)) ); connect( dQuality, SIGNAL(valueChanged(double)), SIGNAL(optionsChanged()) ); userdefinedTopBox->addWidget( dQuality ); dQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", 0, 10) ); userdefinedTopBox->addStretch(); // cmd arguments box QHBoxLayout *cmdArgumentsBox = new QHBoxLayout(); grid->addLayout( cmdArgumentsBox, 2, 0 ); cCmdArguments = new QCheckBox( i18n("Additional encoder arguments:"), this ); cmdArgumentsBox->addWidget( cCmdArguments ); lCmdArguments = new KLineEdit( this ); lCmdArguments->setEnabled( false ); cmdArgumentsBox->addWidget( lCmdArguments ); connect( cCmdArguments, SIGNAL(toggled(bool)), lCmdArguments, SLOT(setEnabled(bool)) ); grid->setRowStretch( 3, 1 ); presetChanged( cPreset->currentText() ); } MusePackCodecWidget::~MusePackCodecWidget() {} // TODO optimize int MusePackCodecWidget::bitrateForQuality( double quality ) { return quality*100/3; } // TODO optimize double MusePackCodecWidget::qualityForBitrate( int bitrate ) { return (double)bitrate*3/100; } ConversionOptions *MusePackCodecWidget::currentConversionOptions() { MusePackConversionOptions *options = new MusePackConversionOptions(); options->data.preset = (MusePackConversionOptions::Data::Preset)cPreset->currentIndex(); options->qualityMode = ConversionOptions::Quality; options->quality = dQuality->value(); options->bitrate = bitrateForQuality( options->quality ); options->bitrateMode = ConversionOptions::Vbr; return options; } bool MusePackCodecWidget::setCurrentConversionOptions( ConversionOptions *_options ) { if( !_options || _options->pluginName != global_plugin_name ) return false; MusePackConversionOptions *options = static_cast(_options); cPreset->setCurrentIndex( (int)options->data.preset ); presetChanged( cPreset->currentText() ); dQuality->setValue( options->quality ); cCmdArguments->setChecked( !options->cmdArguments.isEmpty() ); if( !options->cmdArguments.isEmpty() ) lCmdArguments->setText( options->cmdArguments ); return true; } void MusePackCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; setEnabled( currentFormat != "wav" ); } QString MusePackCodecWidget::currentProfile() { if( currentFormat == "wav" ) { return i18n("Lossless"); } else if( cPreset->currentIndex() == 7 && dQuality->value() == 3.0 ) { return i18n("Very low"); } else if( cPreset->currentIndex() == 7 && dQuality->value() == 4.0 ) { return i18n("Low"); } else if( cPreset->currentIndex() == 7 && dQuality->value() == 5.0 ) { return i18n("Medium"); } else if( cPreset->currentIndex() == 7 && dQuality->value() == 6.0 ) { return i18n("High"); } else if( cPreset->currentIndex() == 7 && dQuality->value() == 7.0 ) { return i18n("Very high"); } return i18n("User defined"); } bool MusePackCodecWidget::setCurrentProfile( const QString& profile ) { if( profile == i18n("Very low") ) { cPreset->setCurrentIndex( 7 ); presetChanged( cPreset->currentText() ); sQuality->setValue( 300 ); dQuality->setValue( 3.0 ); cCmdArguments->setChecked( false ); return true; } else if( profile == i18n("Low") ) { cPreset->setCurrentIndex( 7 ); presetChanged( cPreset->currentText() ); sQuality->setValue( 400 ); dQuality->setValue( 4.0 ); cCmdArguments->setChecked( false ); return true; } else if( profile == i18n("Medium") ) { cPreset->setCurrentIndex( 7 ); presetChanged( cPreset->currentText() ); sQuality->setValue( 500 ); dQuality->setValue( 5.0 ); cCmdArguments->setChecked( false ); return true; } else if( profile == i18n("High") ) { cPreset->setCurrentIndex( 7 ); presetChanged( cPreset->currentText() ); sQuality->setValue( 600 ); dQuality->setValue( 6.0 ); cCmdArguments->setChecked( false ); return true; } else if( profile == i18n("Very high") ) { cPreset->setCurrentIndex( 7 ); presetChanged( cPreset->currentText() ); sQuality->setValue( 700 ); dQuality->setValue( 7.0 ); cCmdArguments->setChecked( false ); return true; } return false; } int MusePackCodecWidget::currentDataRate() { int dataRate; if( currentFormat == "wav" ) { dataRate = 10590000; } else { // dataRate = 500000 + dQuality->value()*150000; // if( dQuality->value() > 7 ) dataRate += (dQuality->value()-7)*250000; // if( dQuality->value() > 9 ) dataRate += (dQuality->value()-9)*800000; dataRate = 0; } return dataRate; } void MusePackCodecWidget::presetChanged( const QString& preset ) { cPreset->setToolTip( "" ); if( preset == i18nc("Backend profile","Telephone") ) { userdefinedBox->setEnabled( false ); cPreset->setToolTip( i18n("low quality (~60 kbps abr).") ); } else if( preset == i18nc("Backend profile","Thumb") ) { userdefinedBox->setEnabled( false ); cPreset->setToolTip( i18n("low/medium quality (~90 kbps abr).") ); } else if( preset == i18nc("Backend profile","Radio") ) { userdefinedBox->setEnabled( false ); cPreset->setToolTip( i18n("medium quality (~130 kbps abr).") ); } else if( preset == i18nc("Backend profile","Standard") ) { userdefinedBox->setEnabled( false ); cPreset->setToolTip( i18n("high quality (~180 kbps abr).") ); } else if( preset == i18nc("Backend profile","Extreme") ) { userdefinedBox->setEnabled( false ); cPreset->setToolTip( i18n("excellent quality (~210 kbps abr).") ); } else if( preset == i18nc("Backend profile","Insane") ) { userdefinedBox->setEnabled( false ); cPreset->setToolTip( i18n("excellent quality (~240 kbps abr).") ); } else if( preset == i18nc("Backend profile","Braindead") ) { userdefinedBox->setEnabled( false ); cPreset->setToolTip( i18n("excellent quality (~270 kbps abr).") ); } else // "User defined" { userdefinedBox->setEnabled( true ); } } void MusePackCodecWidget::qualitySliderChanged( int quality ) { dQuality->setValue( double(quality)/100.0 ); } void MusePackCodecWidget::qualitySpinBoxChanged( double quality ) { sQuality->setValue( round(quality*100.0) ); } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_musepack/PaxHeaders.4329/soundkonverter_codec_mu0000644000000000000000000000013212076525023031070 xustar0030 mtime=1358604819.234806366 30 atime=1358604819.234806366 30 ctime=1418040695.156717236 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_musepack/soundkonverter_codec_musepack.h0000755000175000001440000000312512076525023033506 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_MUSEPACK_H #define SOUNDKONVERTER_CODEC_MUSEPACK_H #include "../../core/codecplugin.h" class ConversionOptions; class soundkonverter_codec_musepack : public CodecPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_codec_musepack( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_musepack(); QString name(); /** search for the backend binaries in the given directories */ virtual void scanForBackends( const QStringList& directoryList = QStringList() ); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output ); ConversionOptions *conversionOptionsFromXml( QDomElement conversionOptions, QList *filterOptionsElements = 0 ); }; K_EXPORT_SOUNDKONVERTER_CODEC( musepack, soundkonverter_codec_musepack ) #endif // SOUNDKONVERTER_CODEC_MUSEPACK_H ./soundkonverter-2.1.2/plugins/soundkonverter_codec_musepack/PaxHeaders.4329/musepackcodecglobal.h0000644000000000000000000000006211773075463030374 xustar0020 atime=1366995186 30 ctime=1418040695.156717236 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_musepack/musepackcodecglobal.h0000644000175000001440000000011111773075463031360 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "MusePack" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_codec_musepack/PaxHeaders.4329/musepackconversionoptio0000644000000000000000000000013212076525023031133 xustar0030 mtime=1358604819.234806366 30 atime=1358604819.234806366 30 ctime=1418040695.156717236 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_musepack/musepackconversionoptions.h0000644000175000001440000000137112076525023032721 0ustar00danielusers00000000000000 #ifndef MUSEPACKCONVERSIONOPTIONS_H #define MUSEPACKCONVERSIONOPTIONS_H #include "../../core/conversionoptions.h" class MusePackConversionOptions : public ConversionOptions { public: MusePackConversionOptions(); ~MusePackConversionOptions(); bool equals( ConversionOptions *_other ); QDomElement toXml( QDomDocument document ); bool fromXml( QDomElement conversionOptions, QList *filterOptionsElements = 0 ); struct Data { enum Preset { Telephone = 0, Thumb = 1, Radio = 2, Standard = 3, Extreme = 4, Insane = 5, Braindead = 6, UserDefined = 7 } preset; } data; }; #endif // MUSEPACKCONVERSIONOPTIONS_H./soundkonverter-2.1.2/plugins/soundkonverter_codec_musepack/PaxHeaders.4329/musepackconversionoptio0000644000000000000000000000013212076525023031133 xustar0030 mtime=1358604819.234806366 30 atime=1358604819.233806363 30 ctime=1418040695.156717236 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_musepack/musepackconversionoptions.cpp0000644000175000001440000000335012076525023033253 0ustar00danielusers00000000000000 #include "musepackcodecglobal.h" #include "musepackconversionoptions.h" MusePackConversionOptions::MusePackConversionOptions() : ConversionOptions() { pluginName = global_plugin_name; } MusePackConversionOptions::~MusePackConversionOptions() {} bool MusePackConversionOptions::equals( ConversionOptions *_other ) { if( !_other || _other->pluginName!=pluginName ) return false; MusePackConversionOptions *other = dynamic_cast(_other); if( data.preset==other->data.preset && data.preset==Data::UserDefined ) { return ConversionOptions::equals(_other); } else if( data.preset==other->data.preset ) { return ( equalsBasics(_other) && equalsFilters(_other) ); } else { return false; } } QDomElement MusePackConversionOptions::toXml( QDomDocument document ) { QDomElement conversionOptions = ConversionOptions::toXml( document ); QDomElement encodingOptions = conversionOptions.elementsByTagName("encodingOptions").at(0).toElement(); QDomElement data = document.createElement("data"); data.setAttribute("preset",MusePackConversionOptions::data.preset); encodingOptions.appendChild(data); return conversionOptions; } bool MusePackConversionOptions::fromXml( QDomElement conversionOptions, QList *filterOptionsElements ) { ConversionOptions::fromXml( conversionOptions, filterOptionsElements ); QDomElement encodingOptions = conversionOptions.elementsByTagName("encodingOptions").at(0).toElement(); QDomElement data = encodingOptions.elementsByTagName("data").at(0).toElement(); MusePackConversionOptions::data.preset = (Data::Preset)data.attribute("preset").toInt(); return true; } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_musepack/PaxHeaders.4329/soundkonverter_codec_mu0000644000000000000000000000006212276145051031073 xustar0020 atime=1418040446 30 ctime=1418040695.156717236 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_musepack/soundkonverter_codec_musepack.cpp0000755000175000001440000002023012276145051034036 0ustar00danielusers00000000000000 #include "musepackcodecglobal.h" #include "soundkonverter_codec_musepack.h" #include "musepackconversionoptions.h" #include "musepackcodecwidget.h" #include #include soundkonverter_codec_musepack::soundkonverter_codec_musepack( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["mppenc"] = ""; binaries["mppdec"] = ""; allCodecs += "musepack"; allCodecs += "wav"; } soundkonverter_codec_musepack::~soundkonverter_codec_musepack() {} QString soundkonverter_codec_musepack::name() { return global_plugin_name; } void soundkonverter_codec_musepack::scanForBackends( const QStringList& directoryList ) { binaries["mppenc"] = KStandardDirs::findExe( "mppenc" ); // sv7 if( binaries["mppenc"].isEmpty() ) binaries["mppenc"] = KStandardDirs::findExe( "mpcenc" ); // sv8 if( binaries["mppenc"].isEmpty() ) { for( QList::const_iterator b = directoryList.begin(); b != directoryList.end(); ++b ) { if( QFile::exists((*b) + "/mppenc") ) { binaries["mppenc"] = (*b) + "/mppenc"; break; } else if( QFile::exists((*b) + "/mpcenc") ) { binaries["mppenc"] = (*b) + "/mpcenc"; break; } } } binaries["mppdec"] = KStandardDirs::findExe( "mppdec" ); // sv7 if( binaries["mppdec"].isEmpty() ) binaries["mppdec"] = KStandardDirs::findExe( "mpcdec" ); // sv8 if( binaries["mppdec"].isEmpty() ) { for( QList::const_iterator b = directoryList.begin(); b != directoryList.end(); ++b ) { if( QFile::exists((*b) + "/mppdec") ) { binaries["mppdec"] = (*b) + "/mppdec"; break; } else if( QFile::exists((*b) + "/mpcdec") ) { binaries["mppdec"] = (*b) + "/mpcdec"; break; } } } } QList soundkonverter_codec_musepack::codecTable() { QList table; ConversionPipeTrunk newTrunk; newTrunk.codecFrom = "wav"; newTrunk.codecTo = "musepack"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["mppenc"] != "" ); newTrunk.problemInfo = standardMessage( "encode_codec,backend", "musepack", "mppenc" ) + "\n" + standardMessage( "install_website_backend,url", "mppenc", "http://www.musepack.net" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "musepack"; newTrunk.codecTo = "wav"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["mppdec"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "musepack", "mppdec" ) + "\n" + standardMessage( "install_website_backend,url", "mppdec", "http://www.musepack.net" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); return table; } bool soundkonverter_codec_musepack::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_codec_musepack::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_codec_musepack::hasInfo() { return false; } void soundkonverter_codec_musepack::showInfo( QWidget *parent ) { Q_UNUSED(parent) } CodecWidget *soundkonverter_codec_musepack::newCodecWidget() { MusePackCodecWidget *widget = new MusePackCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_codec_musepack::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { QStringList command = convertCommand( inputFile, outputFile, inputCodec, outputCodec, _conversionOptions, tags, replayGain ); if( command.isEmpty() ) return BackendPlugin::UnknownError; CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_musepack::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(tags) Q_UNUSED(replayGain) if( !_conversionOptions ) return QStringList(); QStringList command; ConversionOptions *conversionOptions = _conversionOptions; MusePackConversionOptions *musepackConversionOptions = 0; if( conversionOptions->pluginName == name() ) { musepackConversionOptions = static_cast(conversionOptions); } if( outputCodec == "musepack" ) { command += binaries["mppenc"]; if( musepackConversionOptions && musepackConversionOptions->data.preset != MusePackConversionOptions::Data::UserDefined ) { if( musepackConversionOptions->data.preset == MusePackConversionOptions::Data::Telephone ) { command += "--telephone"; } else if( musepackConversionOptions->data.preset == MusePackConversionOptions::Data::Thumb ) { command += "--thumb"; } else if( musepackConversionOptions->data.preset == MusePackConversionOptions::Data::Radio ) { command += "--radio"; } else if( musepackConversionOptions->data.preset == MusePackConversionOptions::Data::Standard ) { command += "--standard"; } else if( musepackConversionOptions->data.preset == MusePackConversionOptions::Data::Extreme ) { command += "--extreme"; } else if( musepackConversionOptions->data.preset == MusePackConversionOptions::Data::Insane ) { command += "--insane"; } else if( musepackConversionOptions->data.preset == MusePackConversionOptions::Data::Braindead ) { command += "--braindead"; } } else { command += "--quality"; command += QString::number(conversionOptions->quality); } if( conversionOptions->pluginName == name() ) { command += conversionOptions->cmdArguments; } command += "\"" + escapeUrl(inputFile) + "\""; command += "\"" + escapeUrl(outputFile) + "\""; } else { command += binaries["mppdec"]; command += "\"" + escapeUrl(inputFile) + "\""; command += "\"" + escapeUrl(outputFile) + "\""; } return command; } float soundkonverter_codec_musepack::parseOutput( const QString& output ) { // sv7 // 47.4 143.7 kbps 23.92x 1:43.3 3:38.1 0:04.3 0:09.1 0:04.8 // sv8 // 37.5 // 171.2 kbps // 23.03x // 0:36.1 // 1:36.5 // 0:01.5 // 0:04.1 // 0:02.6 QRegExp reg("(\\d+\\.\\d)\\s+\\d+\\.\\d kbps"); if( output.contains(reg) ) { return reg.cap(1).toFloat(); } return -1; } ConversionOptions *soundkonverter_codec_musepack::conversionOptionsFromXml( QDomElement conversionOptions, QList *filterOptionsElements ) { MusePackConversionOptions *options = new MusePackConversionOptions(); options->fromXml( conversionOptions, filterOptionsElements ); return options; } #include "soundkonverter_codec_musepack.moc" ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_mac0000644000000000000000000000012012276433306023073 xustar0030 mtime=1392129734.839244087 20 atime=1358274330 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mac/0000755000175000001440000000000012276433306024150 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_mac/PaxHeaders.4329/soundkonverter_codec_mac.des0000644000000000000000000000006211440746150030713 xustar0020 atime=1308601627 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mac/soundkonverter_codec_mac.desktop0000755000175000001440000000052411440746150032610 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter Mac Plugin X-KDE-Library=soundkonverter_codec_mac ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_mac X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mac/PaxHeaders.4329/soundkonverter_codec_mac.h0000644000000000000000000000013012076525023030363 xustar0029 mtime=1358604819.23280636 29 atime=1358604819.23280636 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mac/soundkonverter_codec_mac.h0000755000175000001440000000242312076525023031366 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_MAC_H #define SOUNDKONVERTER_CODEC_MAC_H #include "../../core/codecplugin.h" class ConversionOptions; class soundkonverter_codec_mac : public CodecPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_codec_mac( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_mac(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output ); }; K_EXPORT_SOUNDKONVERTER_CODEC( mac, soundkonverter_codec_mac ) #endif // _SOUNDKONVERTER_CODEC_MAC_H_ ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mac/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006211726605666025726 xustar0020 atime=1308763306 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mac/CMakeLists.txt0000755000175000001440000000115411726605666026725 0ustar00danielusers00000000000000project(soundkonverter_codec_mac) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_mac_SRCS soundkonverter_codec_mac.cpp maccodecwidget.cpp ) kde4_add_plugin(soundkonverter_codec_mac ${soundkonverter_codec_mac_SRCS}) target_link_libraries(soundkonverter_codec_mac ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_mac DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_mac.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mac/PaxHeaders.4329/maccodecglobal.h0000644000000000000000000000006211440746150026241 xustar0020 atime=1367657013 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mac/maccodecglobal.h0000644000175000001440000000010411440746150027227 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "Mac" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mac/PaxHeaders.4329/soundkonverter_codec_mac.cpp0000644000000000000000000000006212276145051030723 xustar0020 atime=1418040443 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mac/soundkonverter_codec_mac.cpp0000755000175000001440000001103412276145051031720 0ustar00danielusers00000000000000 #include "maccodecglobal.h" #include "soundkonverter_codec_mac.h" #include "../../core/conversionoptions.h" #include "maccodecwidget.h" soundkonverter_codec_mac::soundkonverter_codec_mac( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["mac"] = ""; allCodecs += "ape"; allCodecs += "wav"; } soundkonverter_codec_mac::~soundkonverter_codec_mac() {} QString soundkonverter_codec_mac::name() { return global_plugin_name; } QList soundkonverter_codec_mac::codecTable() { QList table; ConversionPipeTrunk newTrunk; newTrunk.codecFrom = "wav"; newTrunk.codecTo = "ape"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["mac"] != "" ); newTrunk.problemInfo = standardMessage( "encode_codec,backend", "ape", "mac" ) + "\n" + standardMessage( "install_website_backend,url", "mac", "http://www.monkeysaudio.com" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "ape"; newTrunk.codecTo = "wav"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["mac"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "ape", "mac" ) + "\n" + standardMessage( "install_website_backend,url", "mac", "http://www.monkeysaudio.com" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); return table; } bool soundkonverter_codec_mac::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_codec_mac::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_codec_mac::hasInfo() { return false; } void soundkonverter_codec_mac::showInfo( QWidget *parent ) { Q_UNUSED(parent) } CodecWidget *soundkonverter_codec_mac::newCodecWidget() { MacCodecWidget *widget = new MacCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_codec_mac::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(tags) Q_UNUSED(replayGain) if( !_conversionOptions ) return BackendPlugin::UnknownError; QStringList command; ConversionOptions *conversionOptions = _conversionOptions; if( outputCodec == "ape" ) { command += binaries["mac"]; command += "\"" + escapeUrl(inputFile) + "\""; command += "\"" + escapeUrl(outputFile) + "\""; if( conversionOptions->pluginName == global_plugin_name ) { command += "-c"+QString::number((int)conversionOptions->compressionLevel); } } else { command += binaries["mac"]; command += "\"" + escapeUrl(inputFile) + "\""; command += "\"" + escapeUrl(outputFile) + "\""; command += "-d"; } if( command.isEmpty() ) return BackendPlugin::UnknownError; CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_mac::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputFile) Q_UNUSED(outputFile) Q_UNUSED(inputCodec) Q_UNUSED(outputCodec) Q_UNUSED(_conversionOptions) Q_UNUSED(tags) Q_UNUSED(replayGain) return QStringList(); } float soundkonverter_codec_mac::parseOutput( const QString& output ) { // Progress: 55.2% (1.0 seconds remaining, 1.2 seconds total) QRegExp regEnc("Progress:\\s+(\\d+.\\d)%"); if( output.contains(regEnc) ) { return regEnc.cap(1).toFloat(); } return -1; } #include "soundkonverter_codec_mac.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mac/PaxHeaders.4329/maccodecwidget.cpp0000644000000000000000000000006212276433306026623 xustar0020 atime=1416311950 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mac/maccodecwidget.cpp0000644000175000001440000000722612276433306027625 0ustar00danielusers00000000000000 #include "maccodecglobal.h" #include "maccodecwidget.h" #include "../../core/conversionoptions.h" #include #include #include #include #include #include #include MacCodecWidget::MacCodecWidget() : CodecWidget(), currentFormat( "ape" ) { QGridLayout *grid = new QGridLayout( this ); grid->setContentsMargins( 0, 0, 0, 0 ); // set up encoding options selection QHBoxLayout *topBox = new QHBoxLayout(); grid->addLayout( topBox, 0, 0 ); QLabel *lCompressionLevel = new QLabel( i18n("Compression level:"), this ); topBox->addWidget( lCompressionLevel ); sCompressionLevel = new QSlider( Qt::Horizontal, this ); sCompressionLevel->setRange( 1, 5 ); sCompressionLevel->setSingleStep( 1 ); sCompressionLevel->setPageStep( 1 ); // sQuality->setTickPosition( QSlider::TicksBelow ); // sQuality->setFixedWidth( sQuality->sizeHint().width() ); connect( sCompressionLevel, SIGNAL(valueChanged(int)), this, SLOT(compressionLevelSliderChanged(int)) ); connect( sCompressionLevel, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( sCompressionLevel ); sCompressionLevel->setToolTip( i18n("Compression level from %1 to %2 where %2 is the best compression.\nThe better the compression, the slower the conversion but the smaller the file size and vice versa.", 1000, 5000) ); iCompressionLevel = new QSpinBox( this ); iCompressionLevel->setRange( 1, 5 ); iCompressionLevel->setSingleStep( 1 ); iCompressionLevel->setSuffix( "000" ); iCompressionLevel->setFixedWidth( iCompressionLevel->sizeHint().width() ); // dQuality->setFixedHeight( cMode->minimumSizeHint().height() ); connect( iCompressionLevel, SIGNAL(valueChanged(int)), this, SLOT(compressionLevelSpinBoxChanged(int)) ); connect( iCompressionLevel, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( iCompressionLevel ); iCompressionLevel->setToolTip( i18n("Compression level from %1 to %2 where %2 is the best compression.\nThe better the compression, the slower the conversion but the smaller the file size and vice versa.", 1000, 5000) ); topBox->addStretch(); grid->setRowStretch( 1, 1 ); iCompressionLevel->setValue( 2 ); } MacCodecWidget::~MacCodecWidget() {} ConversionOptions *MacCodecWidget::currentConversionOptions() { ConversionOptions *options = new ConversionOptions(); options->qualityMode = ConversionOptions::Lossless; options->compressionLevel = iCompressionLevel->value()*1000; return options; } bool MacCodecWidget::setCurrentConversionOptions( ConversionOptions *_options ) { if( !_options || _options->pluginName != global_plugin_name ) return false; ConversionOptions *options = _options; iCompressionLevel->setValue( options->compressionLevel/1000 ); return true; } void MacCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; setEnabled( currentFormat != "wav" ); } QString MacCodecWidget::currentProfile() { return i18n("Lossless"); } bool MacCodecWidget::setCurrentProfile( const QString& profile ) { return profile == i18n("Lossless"); } int MacCodecWidget::currentDataRate() { int dataRate; if( currentFormat == "wav" ) { dataRate = 10590000; } else { dataRate = 6400000; } return dataRate; } void MacCodecWidget::compressionLevelSliderChanged( int quality ) { iCompressionLevel->setValue( quality ); } void MacCodecWidget::compressionLevelSpinBoxChanged( int quality ) { sCompressionLevel->setValue( quality ); } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mac/PaxHeaders.4329/maccodecwidget.h0000644000000000000000000000013212076525023026262 xustar0030 mtime=1358604819.231806357 30 atime=1358604819.231806357 30 ctime=1418040695.163717225 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_mac/maccodecwidget.h0000644000175000001440000000154312076525023027262 0ustar00danielusers00000000000000 #ifndef MACCODECWIDGET_H #define MACCODECWIDGET_H #include "../../core/codecwidget.h" class KComboBox; class QSlider; class QSpinBox; class QCheckBox; class KLineEdit; class MacCodecWidget : public CodecWidget { Q_OBJECT public: MacCodecWidget(); ~MacCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *_options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: QSlider *sCompressionLevel; QSpinBox *iCompressionLevel; QString currentFormat; // holds the current output file format private slots: void compressionLevelSliderChanged( int quality ); void compressionLevelSpinBoxChanged( int quality ); }; #endif // MACCODECWIDGET_H ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_ffmpeg0000644000000000000000000000012012276433306023577 xustar0030 mtime=1392129734.724243675 20 atime=1358274330 30 ctime=1418040695.156717236 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ffmpeg/0000755000175000001440000000000012276433306024654 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_ffmpeg/PaxHeaders.4329/soundkonverter_codec_ffmp0000644000000000000000000000006212276145051031036 xustar0020 atime=1418040447 30 ctime=1418040695.155717238 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ffmpeg/soundkonverter_codec_ffmpeg.cpp0000755000175000001440000004772412276145051033147 0ustar00danielusers00000000000000 #include "ffmpegcodecglobal.h" #include "soundkonverter_codec_ffmpeg.h" #include "ffmpegcodecwidget.h" #include "../../core/conversionoptions.h" #include "../../metadata/tagengine.h" #include #include #include #include #include // TODO check for decoders at runtime, too soundkonverter_codec_ffmpeg::soundkonverter_codec_ffmpeg( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["ffmpeg"] = ""; KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); configVersion = group.readEntry( "configVersion", 0 ); experimentalCodecsEnabled = group.readEntry( "experimentalCodecsEnabled", false ); ffmpegVersionMajor = group.readEntry( "ffmpegVersionMajor", 0 ); ffmpegVersionMinor = group.readEntry( "ffmpegVersionMinor", 0 ); ffmpegLastModified = group.readEntry( "ffmpegLastModified", QDateTime() ); ffmpegCodecList = group.readEntry( "codecList", QStringList() ).toSet(); CodecData data; FFmpegCodecData ffmpegData; // WARNING enabled codecs need to be rescanned everytime new codecs are added here -> increase plugin version data.ffmpegCodecList.clear(); data.codecName = "wav"; ffmpegData.name = "wav"; ffmpegData.external = false; ffmpegData.experimental = false; data.ffmpegCodecList.append( ffmpegData ); codecList.append( data ); data.ffmpegCodecList.clear(); data.codecName = "ogg vorbis"; ffmpegData.name = "libvorbis"; ffmpegData.external = true; ffmpegData.experimental = false; data.ffmpegCodecList.append( ffmpegData ); ffmpegData.name = "vorbis"; ffmpegData.external = true; // ? ffmpegData.experimental = true; data.ffmpegCodecList.append( ffmpegData ); codecList.append( data ); // data.ffmpegCodecList.clear(); // data.codecName = "opus"; // ffmpegData.name = "opus"; // ffmpegData.external = true; // ffmpegData.experimental = false; // data.ffmpegCodecList.append( ffmpegData ); // codecList.append( data ); data.ffmpegCodecList.clear(); data.codecName = "mp3"; ffmpegData.name = "libmp3lame"; ffmpegData.external = true; ffmpegData.experimental = false; data.ffmpegCodecList.append( ffmpegData ); ffmpegData.name = "mp3"; ffmpegData.external = true; ffmpegData.experimental = false; data.ffmpegCodecList.append( ffmpegData ); codecList.append( data ); data.ffmpegCodecList.clear(); data.codecName = "flac"; ffmpegData.name = "flac"; ffmpegData.external = false; ffmpegData.experimental = false; data.ffmpegCodecList.append( ffmpegData ); codecList.append( data ); data.ffmpegCodecList.clear(); data.codecName = "wma"; ffmpegData.name = "wmav2"; ffmpegData.external = false; ffmpegData.experimental = false; data.ffmpegCodecList.append( ffmpegData ); ffmpegData.name = "wmav1"; ffmpegData.external = false; ffmpegData.experimental = false; data.ffmpegCodecList.append( ffmpegData ); codecList.append( data ); data.ffmpegCodecList.clear(); data.codecName = "aac"; ffmpegData.name = "libfaac"; ffmpegData.external = true; ffmpegData.experimental = false; data.ffmpegCodecList.append( ffmpegData ); ffmpegData.name = "aac"; ffmpegData.external = false; ffmpegData.experimental = true; data.ffmpegCodecList.append( ffmpegData ); codecList.append( data ); data.ffmpegCodecList.clear(); data.codecName = "m4a/aac"; ffmpegData.name = "libfaac"; ffmpegData.external = true; ffmpegData.experimental = false; data.ffmpegCodecList.append( ffmpegData ); ffmpegData.name = "aac"; ffmpegData.external = false; ffmpegData.experimental = true; data.ffmpegCodecList.append( ffmpegData ); codecList.append( data ); data.ffmpegCodecList.clear(); data.codecName = "ac3"; ffmpegData.name = "ac3"; ffmpegData.external = false; ffmpegData.experimental = false; data.ffmpegCodecList.append( ffmpegData ); codecList.append( data ); data.ffmpegCodecList.clear(); data.codecName = "m4a/alac"; ffmpegData.name = "alac"; ffmpegData.external = false; ffmpegData.experimental = false; data.ffmpegCodecList.append( ffmpegData ); codecList.append( data ); data.ffmpegCodecList.clear(); data.codecName = "mp2"; ffmpegData.name = "mp2"; ffmpegData.external = false; ffmpegData.experimental = false; data.ffmpegCodecList.append( ffmpegData ); codecList.append( data ); data.ffmpegCodecList.clear(); data.codecName = "amr nb"; ffmpegData.name = "libopencore_amrnb"; ffmpegData.external = true; ffmpegData.experimental = false; data.ffmpegCodecList.append( ffmpegData ); ffmpegData.name = "amr_nb"; ffmpegData.external = true; ffmpegData.experimental = false; data.ffmpegCodecList.append( ffmpegData ); codecList.append( data ); // codecMap["sonic"] = "sonic"; // codecMap["sonic lossless"] = "sonicls"; // codecMap["real audio 1"] = "real_144"; // codecMap["e-ac3"] = "eac3"; for( int i=0; i soundkonverter_codec_ffmpeg::codecTable() { QList table; QStringList fromCodecs; QStringList toCodecs; /// decode fromCodecs += "wav"; fromCodecs += "ogg vorbis"; // fromCodecs += "opus"; fromCodecs += "mp3"; fromCodecs += "flac"; fromCodecs += "wma"; fromCodecs += "aac"; fromCodecs += "ac3"; fromCodecs += "m4a/alac"; fromCodecs += "mp2"; // fromCodecs += "sonic"; // fromCodecs += "sonic lossless"; fromCodecs += "als"; fromCodecs += "amr nb"; fromCodecs += "amr wb"; fromCodecs += "ape"; // fromCodecs += "e-ac3"; fromCodecs += "speex"; fromCodecs += "m4a/aac"; fromCodecs += "mp1"; fromCodecs += "musepack"; fromCodecs += "shorten"; // fromCodecs += "mlp"; // fromCodecs += "truehd"; // fromCodecs += "truespeech"; fromCodecs += "tta"; fromCodecs += "wavpack"; fromCodecs += "ra"; fromCodecs += "sad"; /// containers fromCodecs += "3gp"; fromCodecs += "rm"; /// video fromCodecs += "avi"; fromCodecs += "mkv"; fromCodecs += "ogv"; fromCodecs += "mpeg"; fromCodecs += "mov"; fromCodecs += "mp4"; fromCodecs += "flv"; fromCodecs += "wmv"; fromCodecs += "rv"; /// encode if( !binaries["ffmpeg"].isEmpty() ) { QFileInfo ffmpegInfo( binaries["ffmpeg"] ); if( ffmpegInfo.lastModified() > ffmpegLastModified || configVersion < version() ) { infoProcess = new KProcess(); infoProcess.data()->setOutputChannelMode( KProcess::MergedChannels ); connect( infoProcess.data(), SIGNAL(readyRead()), this, SLOT(infoProcessOutput()) ); connect( infoProcess.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(infoProcessExit(int,QProcess::ExitStatus)) ); QStringList command; command += binaries["ffmpeg"]; command += "-codecs"; infoProcess.data()->clearProgram(); infoProcess.data()->setShellCommand( command.join(" ") ); infoProcess.data()->start(); infoProcess.data()->waitForFinished( 3000 ); } } for( int i=0; i codecs; codecs += QSet::fromList(fromCodecs); codecs += QSet::fromList(toCodecs); allCodecs = codecs.toList(); return table; } bool soundkonverter_codec_ffmpeg::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return true; } void soundkonverter_codec_ffmpeg::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) if( !configDialog.data() ) { configDialog = new KDialog( parent ); configDialog.data()->setCaption( i18n("Configure %1").arg(global_plugin_name) ); configDialog.data()->setButtons( KDialog::Ok | KDialog::Cancel | KDialog::Default ); QWidget *configDialogWidget = new QWidget( configDialog.data() ); QHBoxLayout *configDialogBox = new QHBoxLayout( configDialogWidget ); configDialogExperimantalCodecsEnabledCheckBox = new QCheckBox( i18n("Enable experimental codecs"), configDialogWidget ); configDialogBox->addWidget( configDialogExperimantalCodecsEnabledCheckBox ); configDialog.data()->setMainWidget( configDialogWidget ); connect( configDialog.data(), SIGNAL( okClicked() ), this, SLOT( configDialogSave() ) ); connect( configDialog.data(), SIGNAL( defaultClicked() ), this, SLOT( configDialogDefault() ) ); } configDialogExperimantalCodecsEnabledCheckBox->setChecked( experimentalCodecsEnabled ); configDialog.data()->show(); } void soundkonverter_codec_ffmpeg::configDialogSave() { if( configDialog.data() ) { const bool old_experimentalCodecsEnabled = experimentalCodecsEnabled; experimentalCodecsEnabled = configDialogExperimantalCodecsEnabledCheckBox->isChecked(); KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "Plugin-"+name() ); group.writeEntry( "experimentalCodecsEnabled", experimentalCodecsEnabled ); if( experimentalCodecsEnabled != old_experimentalCodecsEnabled ) { KMessageBox::information( configDialog.data(), i18n("Please restart soundKonverter in order to activate the changes.") ); } configDialog.data()->deleteLater(); } } void soundkonverter_codec_ffmpeg::configDialogDefault() { if( configDialog.data() ) { configDialogExperimantalCodecsEnabledCheckBox->setChecked( false ); } } bool soundkonverter_codec_ffmpeg::hasInfo() { return false; } void soundkonverter_codec_ffmpeg::showInfo( QWidget *parent ) { Q_UNUSED(parent) } CodecWidget *soundkonverter_codec_ffmpeg::newCodecWidget() { FFmpegCodecWidget *widget = new FFmpegCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_codec_ffmpeg::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(tags) Q_UNUSED(replayGain) QStringList command; ConversionOptions *conversionOptions = _conversionOptions; if( outputCodec != "wav" ) { command += binaries["ffmpeg"]; command += "-i"; command += "\"" + escapeUrl(inputFile) + "\""; for( int i=0; ibitrate) + "k"; } if( conversionOptions->pluginName == name() ) { command += conversionOptions->cmdArguments; } command += "\"" + escapeUrl(outputFile) + "\""; } else { command += binaries["ffmpeg"]; command += "-i"; command += "\"" + escapeUrl(inputFile) + "\""; command += "\"" + escapeUrl(outputFile) + "\""; } CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); if( tags ) newItem->data.length = tags->length; newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_ffmpeg::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputFile) Q_UNUSED(outputFile) Q_UNUSED(inputCodec) Q_UNUSED(outputCodec) Q_UNUSED(_conversionOptions) Q_UNUSED(tags) Q_UNUSED(replayGain) return QStringList(); } float soundkonverter_codec_ffmpeg::parseOutput( const QString& output, int *length ) { // Duration: 00:02:16.50, start: 0.000000, bitrate: 1411 kb/s // size= 2445kB time=00:01:58.31 bitrate= 169.3kbits/s QRegExp regLength("Duration: (\\d{2}):(\\d{2}):(\\d{2})\\.(\\d{2})"); if( length && output.contains(regLength) ) { *length = regLength.cap(1).toInt()*3600 + regLength.cap(2).toInt()*60 + regLength.cap(3).toInt(); } QRegExp reg1("time=(\\d{2}):(\\d{2}):(\\d{2})\\.(\\d{2})"); QRegExp reg2("time=(\\d+)\\.\\d"); if( output.contains(reg1) ) { return reg1.cap(1).toInt()*3600 + reg1.cap(2).toInt()*60 + reg1.cap(3).toInt(); } else if( output.contains(reg2) ) { return reg2.cap(1).toInt(); } // TODO error handling // Error while decoding stream #0.0 return -1; } float soundkonverter_codec_ffmpeg::parseOutput( const QString& output ) { return parseOutput( output, 0 ); } void soundkonverter_codec_ffmpeg::processOutput() { for( int i=0; iprocess == QObject::sender() ) { const QString output = backendItems.at(i)->process->readAllStandardOutput().data(); CodecPluginItem *pluginItem = qobject_cast(backendItems.at(i)); float progress = parseOutput( output, &pluginItem->data.length ); if( progress == -1 && !output.simplified().isEmpty() ) logOutput( backendItems.at(i)->id, output ); progress = progress * 100 / pluginItem->data.length; if( progress > backendItems.at(i)->progress ) backendItems.at(i)->progress = progress; return; } } } void soundkonverter_codec_ffmpeg::infoProcessOutput() { infoProcessOutputData.append( infoProcess.data()->readAllStandardOutput().data() ); } void soundkonverter_codec_ffmpeg::infoProcessExit( int exitCode, QProcess::ExitStatus exitStatus ) { Q_UNUSED(exitStatus) Q_UNUSED(exitCode) QRegExp regVersion("ffmpeg version (\\d+)\\.(\\d+) "); if( infoProcessOutputData.contains( regVersion ) ) { ffmpegVersionMajor = regVersion.cap(1).toInt(); ffmpegVersionMinor = regVersion.cap(2).toInt(); } ffmpegCodecList.clear(); for( int i=0; igroup( "Plugin-"+name() ); group.writeEntry( "configVersion", version() ); group.writeEntry( "ffmpegVersionMajor", ffmpegVersionMajor ); group.writeEntry( "ffmpegVersionMinor", ffmpegVersionMinor ); group.writeEntry( "ffmpegLastModified", ffmpegLastModified ); group.writeEntry( "codecList", ffmpegCodecList.toList() ); infoProcessOutputData.clear(); infoProcess.data()->deleteLater(); } #include "soundkonverter_codec_ffmpeg.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ffmpeg/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006211726605714026424 xustar0020 atime=1308763306 30 ctime=1418040695.156717236 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ffmpeg/CMakeLists.txt0000755000175000001440000000120711726605714027422 0ustar00danielusers00000000000000project(soundkonverter_codec_ffmpeg) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_ffmpeg_SRCS soundkonverter_codec_ffmpeg.cpp ffmpegcodecwidget.cpp ) kde4_add_plugin(soundkonverter_codec_ffmpeg ${soundkonverter_codec_ffmpeg_SRCS}) target_link_libraries(soundkonverter_codec_ffmpeg ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_ffmpeg DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_ffmpeg.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ffmpeg/PaxHeaders.4329/ffmpegcodecglobal.h0000644000000000000000000000006212102473772027454 xustar0020 atime=1367657025 30 ctime=1418040695.155717238 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ffmpeg/ffmpegcodecglobal.h0000644000175000001440000000021512102473772030445 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "FFmpeg" #endif #ifndef global_plugin_version #define global_plugin_version 2 #endif ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ffmpeg/PaxHeaders.4329/soundkonverter_codec_ffmp0000644000000000000000000000006210764724046031045 xustar0020 atime=1308601627 30 ctime=1418040695.156717236 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ffmpeg/soundkonverter_codec_ffmpeg.desktop0000755000175000001440000000053510764724046034032 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter FFmpeg Plugin X-KDE-Library=soundkonverter_codec_ffmpeg ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_ffmpeg X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ffmpeg/PaxHeaders.4329/ffmpegcodecwidget.cpp0000644000000000000000000000013212276433306030031 xustar0030 mtime=1392129734.723243671 30 atime=1392129734.723243671 30 ctime=1418040695.155717238 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ffmpeg/ffmpegcodecwidget.cpp0000644000175000001440000002215712276433306031035 0ustar00danielusers00000000000000 #include "ffmpegcodecglobal.h" #include "ffmpegcodecwidget.h" #include "../../core/conversionoptions.h" #include #include #include #include #include #include #include #include #include FFmpegCodecWidget::FFmpegCodecWidget() : CodecWidget(), currentFormat( "ogg vorbis" ) { QGridLayout *grid = new QGridLayout( this ); grid->setContentsMargins( 0, 0, 0, 0 ); // set up encoding options selection QHBoxLayout *topBox = new QHBoxLayout(); grid->addLayout( topBox, 0, 0 ); lBitrate = new QLabel( i18n("Bitrate:"), this ); topBox->addWidget( lBitrate ); sBitrate = new QSlider( Qt::Horizontal, this ); sBitrate->setRange( 8, 320 ); sBitrate->setValue( 160 ); connect( sBitrate, SIGNAL(valueChanged(int)), this, SLOT(qualitySliderChanged(int)) ); connect( sBitrate, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( sBitrate ); iBitrate = new QSpinBox( this ); iBitrate->setRange( 8, 320 ); iBitrate->setValue( 160 ); iBitrate->setSuffix( " kbps" ); iBitrate->setFixedWidth( iBitrate->sizeHint().width() ); connect( iBitrate, SIGNAL(valueChanged(int)), this, SLOT(qualitySpinBoxChanged(int)) ); connect( iBitrate, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( iBitrate ); cBitrate = new KComboBox( this ); cBitrate->addItem( "32 kbps" ); cBitrate->addItem( "40 kbps" ); cBitrate->addItem( "48 kbps" ); cBitrate->addItem( "56 kbps" ); cBitrate->addItem( "64 kbps" ); cBitrate->addItem( "80 kbps" ); cBitrate->addItem( "96 kbps" ); cBitrate->addItem( "112 kbps" ); cBitrate->addItem( "128 kbps" ); cBitrate->addItem( "160 kbps" ); cBitrate->addItem( "192 kbps" ); cBitrate->addItem( "224 kbps" ); cBitrate->addItem( "256 kbps" ); cBitrate->addItem( "320 kbps" ); cBitrate->addItem( "384 kbps" ); cBitrate->addItem( "448 kbps" ); cBitrate->addItem( "512 kbps" ); cBitrate->addItem( "576 kbps" ); cBitrate->addItem( "640 kbps" ); cBitrate->setCurrentIndex( 10 ); cBitrate->hide(); connect( cBitrate, SIGNAL(activated(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( cBitrate ); topBox->addStretch(); // cmd arguments box QHBoxLayout *cmdArgumentsBox = new QHBoxLayout(); grid->addLayout( cmdArgumentsBox, 1, 0 ); cCmdArguments = new QCheckBox( i18n("Additional encoder arguments:"), this ); cmdArgumentsBox->addWidget( cCmdArguments ); lCmdArguments = new KLineEdit( this ); lCmdArguments->setEnabled( false ); cmdArgumentsBox->addWidget( lCmdArguments ); connect( cCmdArguments, SIGNAL(toggled(bool)), lCmdArguments, SLOT(setEnabled(bool)) ); grid->setRowStretch( 2, 1 ); } FFmpegCodecWidget::~FFmpegCodecWidget() {} ConversionOptions *FFmpegCodecWidget::currentConversionOptions() { ConversionOptions *options = new ConversionOptions(); options->qualityMode = ConversionOptions::Bitrate; if( currentFormat == "ac3" ) options->bitrate = cBitrate->currentText().replace(" kbps","").toInt(); else options->bitrate = iBitrate->value(); options->quality = -1000; options->bitrateMode = ConversionOptions::Cbr; if( cCmdArguments->isChecked() ) options->cmdArguments = lCmdArguments->text(); else options->cmdArguments = ""; return options; } bool FFmpegCodecWidget::setCurrentConversionOptions( ConversionOptions *_options ) { if( !_options || _options->pluginName != global_plugin_name ) return false; ConversionOptions *options = _options; if( currentFormat == "ac3" ) cBitrate->setCurrentIndex( cBitrate->findText(QString::number(options->bitrate)+" kbps") ); else iBitrate->setValue( options->bitrate ); cCmdArguments->setChecked( !options->cmdArguments.isEmpty() ); if( !options->cmdArguments.isEmpty() ) lCmdArguments->setText( options->cmdArguments ); return true; } void FFmpegCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; if( currentFormat == "wav" ) { lBitrate->hide(); sBitrate->hide(); iBitrate->hide(); cBitrate->hide(); cCmdArguments->hide(); lCmdArguments->hide(); } else if( currentFormat == "flac" || currentFormat == "m4a/alac" ) { lBitrate->hide(); sBitrate->hide(); iBitrate->hide(); cBitrate->hide(); cCmdArguments->show(); lCmdArguments->show(); } else if( currentFormat == "ac3" ) { lBitrate->show(); sBitrate->hide(); iBitrate->hide(); cBitrate->show(); cCmdArguments->show(); lCmdArguments->show(); } else { lBitrate->show(); sBitrate->show(); iBitrate->show(); cBitrate->hide(); cCmdArguments->show(); lCmdArguments->show(); } if( currentFormat == "mp2" ) { sBitrate->setRange( 32, 384 ); iBitrate->setRange( 32, 384 ); } else { sBitrate->setRange( 8, 320 ); iBitrate->setRange( 8, 320 ); } } QString FFmpegCodecWidget::currentProfile() { if( currentFormat == "wav" || currentFormat == "flac" || currentFormat == "m4a/alac" ) { return i18n("Lossless"); } else if( currentFormat == "amr nb" || currentFormat == "speex" ) { return i18n("User defined"); } else if( currentFormat == "ac3" ) { if( cBitrate->currentText() == "64 kbps" ) { return i18n("Very low"); } else if( cBitrate->currentText() == "128 kbps" ) { return i18n("Low"); } else if( cBitrate->currentText() == "192 kbps" ) { return i18n("Medium"); } else if( cBitrate->currentText() == "320 kbps" ) { return i18n("High"); } else if( cBitrate->currentText() == "640 kbps" ) { return i18n("Very high"); } } else { if( iBitrate->value() == 64 ) { return i18n("Very low"); } else if( iBitrate->value() == 128 ) { return i18n("Low"); } else if( iBitrate->value() == 160 ) { return i18n("Medium"); } else if( iBitrate->value() == 240 ) { return i18n("High"); } else if( iBitrate->value() == 320 ) { return i18n("Very high"); } } return i18n("User defined"); } bool FFmpegCodecWidget::setCurrentProfile( const QString& profile ) { if( profile == i18n("Very low") ) { if( currentFormat == "ac3" ) { cBitrate->setCurrentIndex( cBitrate->findText("64 kbps") ); } else { sBitrate->setValue( 64 ); iBitrate->setValue( 64 ); } cCmdArguments->setChecked( false ); return true; } else if( profile == i18n("Low") ) { if( currentFormat == "ac3" ) { cBitrate->setCurrentIndex( cBitrate->findText("128 kbps") ); } else { sBitrate->setValue( 128 ); iBitrate->setValue( 128 ); } cCmdArguments->setChecked( false ); return true; } else if( profile == i18n("Medium") ) { if( currentFormat == "ac3" ) { cBitrate->setCurrentIndex( cBitrate->findText("192 kbps") ); } else { sBitrate->setValue( 160 ); iBitrate->setValue( 160 ); } cCmdArguments->setChecked( false ); return true; } else if( profile == i18n("High") ) { if( currentFormat == "ac3" ) { cBitrate->setCurrentIndex( cBitrate->findText("320 kbps") ); } else { sBitrate->setValue( 240 ); iBitrate->setValue( 240 ); } cCmdArguments->setChecked( false ); return true; } else if( profile == i18n("Very high") ) { if( currentFormat == "ac3" ) { cBitrate->setCurrentIndex( cBitrate->findText("640 kbps") ); } else { sBitrate->setValue( 320 ); iBitrate->setValue( 320 ); } cCmdArguments->setChecked( false ); return true; } return false; } int FFmpegCodecWidget::currentDataRate() { int dataRate; if( currentFormat == "wav" ) { dataRate = 10590000; } else if( currentFormat == "flac" || currentFormat == "m4a/alac" ) { dataRate = 6520000; } else if( currentFormat == "ac3" ) { dataRate = cBitrate->currentText().replace(" kbps","").toInt()/8*60*1000; } else { dataRate = iBitrate->value()/8*60*1000; } return dataRate; } void FFmpegCodecWidget::qualitySliderChanged( int bitrate ) { iBitrate->setValue( bitrate ); } void FFmpegCodecWidget::qualitySpinBoxChanged( int bitrate ) { sBitrate->setValue( bitrate ); } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ffmpeg/PaxHeaders.4329/soundkonverter_codec_ffmp0000644000000000000000000000013212076525023031033 xustar0030 mtime=1358604819.225806341 30 atime=1358604819.225806341 30 ctime=1418040695.155717238 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ffmpeg/soundkonverter_codec_ffmpeg.h0000755000175000001440000000453612076525023032605 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_FFMPEG_H #define SOUNDKONVERTER_CODEC_FFMPEG_H #include "../../core/codecplugin.h" #include #include class ConversionOptions; class KDialog; class QCheckBox; class soundkonverter_codec_ffmpeg : public CodecPlugin { Q_OBJECT public: struct FFmpegCodecData { QString name; bool external; bool experimental; }; struct CodecData { QString codecName; QList ffmpegCodecList; FFmpegCodecData currentFFmpegCodec; }; /** Default Constructor */ soundkonverter_codec_ffmpeg( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_ffmpeg(); QString name(); int version(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output, int *length ); float parseOutput( const QString& output ); private: QList codecList; QWeakPointer infoProcess; QString infoProcessOutputData; QWeakPointer configDialog; QCheckBox *configDialogExperimantalCodecsEnabledCheckBox; int configVersion; bool experimentalCodecsEnabled; int ffmpegVersionMajor; int ffmpegVersionMinor; QDateTime ffmpegLastModified; QSet ffmpegCodecList; private slots: /** Get the process' output */ void processOutput(); void configDialogSave(); void configDialogDefault(); void infoProcessOutput(); void infoProcessExit( int exitCode, QProcess::ExitStatus exitStatus ); }; K_EXPORT_SOUNDKONVERTER_CODEC( ffmpeg, soundkonverter_codec_ffmpeg ) #endif // _SOUNDKONVERTER_CODEC_FFMPEG_H_ ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ffmpeg/PaxHeaders.4329/ffmpegcodecwidget.h0000644000000000000000000000013212076525023027472 xustar0030 mtime=1358604819.224806338 30 atime=1358604819.224806338 30 ctime=1418040695.156717236 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ffmpeg/ffmpegcodecwidget.h0000644000175000001440000000171112076525023030467 0ustar00danielusers00000000000000 #ifndef FFMPEGCODECWIDGET_H #define FFMPEGCODECWIDGET_H #include "../../core/codecwidget.h" class QLabel; class QSlider; class QSpinBox; class QCheckBox; class KComboBox; class KLineEdit; class FFmpegCodecWidget : public CodecWidget { Q_OBJECT public: FFmpegCodecWidget(); ~FFmpegCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *_options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: QLabel *lBitrate; QSlider *sBitrate; QSpinBox *iBitrate; KComboBox *cBitrate; QCheckBox *cCmdArguments; KLineEdit *lCmdArguments; QString currentFormat; // holds the current output file format private slots: void qualitySliderChanged( int bitrate ); void qualitySpinBoxChanged( int bitrate ); }; #endif // FFMPEGCODECWIDGET_H./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_ttaenc0000644000000000000000000000011712276433306023617 xustar0029 mtime=1392129734.58124316 20 atime=1358274330 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ttaenc/0000755000175000001440000000000012276433306024666 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_ttaenc/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006211726605624026436 xustar0020 atime=1308763306 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ttaenc/CMakeLists.txt0000755000175000001440000000120711726605624027434 0ustar00danielusers00000000000000project(soundkonverter_codec_ttaenc) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_ttaenc_SRCS soundkonverter_codec_ttaenc.cpp ttaenccodecwidget.cpp ) kde4_add_plugin(soundkonverter_codec_ttaenc ${soundkonverter_codec_ttaenc_SRCS}) target_link_libraries(soundkonverter_codec_ttaenc ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_ttaenc DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_ttaenc.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ttaenc/PaxHeaders.4329/ttaenccodecwidget.h0000644000000000000000000000013212076525023027516 xustar0030 mtime=1358604819.242806388 30 atime=1358604819.242806388 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ttaenc/ttaenccodecwidget.h0000644000175000001440000000127312076525023030516 0ustar00danielusers00000000000000 #ifndef FLACCODECWIDGET_H #define FLACCODECWIDGET_H #include "../../core/codecwidget.h" class QCheckBox; class KLineEdit; class TTAEncCodecWidget : public CodecWidget { Q_OBJECT public: TTAEncCodecWidget(); ~TTAEncCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *_options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: QCheckBox *cCmdArguments; KLineEdit *lCmdArguments; QString currentFormat; // holds the current output file format }; #endif // FLACCODECWIDGET_H ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ttaenc/PaxHeaders.4329/soundkonverter_codec_ttae0000644000000000000000000000013212076525023031052 xustar0030 mtime=1358604819.242806388 30 atime=1358604819.242806388 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ttaenc/soundkonverter_codec_ttaenc.h0000755000175000001440000000245312076525023032625 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_TTAENC_H #define SOUNDKONVERTER_CODEC_TTAENC_H #include "../../core/codecplugin.h" class ConversionOptions; class soundkonverter_codec_ttaenc : public CodecPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_codec_ttaenc( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_ttaenc(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output ); }; K_EXPORT_SOUNDKONVERTER_CODEC( ttaenc, soundkonverter_codec_ttaenc ) #endif // _SOUNDKONVERTER_CODEC_TTAENC_H_ ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ttaenc/PaxHeaders.4329/soundkonverter_codec_ttae0000644000000000000000000000006212276145051031055 xustar0020 atime=1397391137 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ttaenc/soundkonverter_codec_ttaenc.cpp0000755000175000001440000001067712276145051033170 0ustar00danielusers00000000000000 #include "ttaenccodecglobal.h" #include "soundkonverter_codec_ttaenc.h" #include "../../core/conversionoptions.h" #include "ttaenccodecwidget.h" soundkonverter_codec_ttaenc::soundkonverter_codec_ttaenc( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["ttaenc"] = ""; allCodecs += "tta"; allCodecs += "wav"; } soundkonverter_codec_ttaenc::~soundkonverter_codec_ttaenc() {} QString soundkonverter_codec_ttaenc::name() { return global_plugin_name; } QList soundkonverter_codec_ttaenc::codecTable() { QList table; ConversionPipeTrunk newTrunk; newTrunk.codecFrom = "wav"; newTrunk.codecTo = "tta"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["ttaenc"] != "" ); newTrunk.problemInfo = standardMessage( "encode_codec,backend", "tta", "ttaenc" ) + "\n" + standardMessage( "install_opensource_backend", "ttaenc" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "tta"; newTrunk.codecTo = "wav"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["ttaenc"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "tta", "ttaenc" ) + "\n" + standardMessage( "install_opensource_backend", "ttaenc" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); return table; } bool soundkonverter_codec_ttaenc::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_codec_ttaenc::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_codec_ttaenc::hasInfo() { return false; } void soundkonverter_codec_ttaenc::showInfo( QWidget *parent ) { Q_UNUSED(parent) } CodecWidget *soundkonverter_codec_ttaenc::newCodecWidget() { TTAEncCodecWidget *widget = new TTAEncCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_codec_ttaenc::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { QStringList command = convertCommand( inputFile, outputFile, inputCodec, outputCodec, _conversionOptions, tags, replayGain ); if( command.isEmpty() ) return BackendPlugin::UnknownError; CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_ttaenc::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(tags) Q_UNUSED(replayGain) if( !_conversionOptions ) return QStringList(); if( inputFile.isEmpty() ) return QStringList(); QStringList command; ConversionOptions *conversionOptions = _conversionOptions; if( outputCodec == "tta" ) { command += binaries["ttaenc"]; command += "-e"; if( conversionOptions->pluginName == global_plugin_name ) { command += conversionOptions->cmdArguments; } command += "-o"; command += "\"" + escapeUrl(outputFile) + "\""; command += "\"" + escapeUrl(inputFile) + "\""; } else { command += binaries["ttaenc"]; command += "-d"; command += "-o"; command += "\"" + escapeUrl(outputFile) + "\""; command += "\"" + escapeUrl(inputFile) + "\""; } return command; } float soundkonverter_codec_ttaenc::parseOutput( const QString& output ) { Q_UNUSED(output) // no output provided return -1; } #include "soundkonverter_codec_ttaenc.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ttaenc/PaxHeaders.4329/ttaenccodecwidget.cpp0000644000000000000000000000013012276433306030053 xustar0029 mtime=1392129734.57824315 29 atime=1392129734.57824315 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ttaenc/ttaenccodecwidget.cpp0000644000175000001440000000434412276433306031057 0ustar00danielusers00000000000000 #include "ttaenccodecglobal.h" #include "ttaenccodecwidget.h" #include "../../core/conversionoptions.h" #include #include #include #include TTAEncCodecWidget::TTAEncCodecWidget() : CodecWidget(), currentFormat( "tta" ) { QGridLayout *grid = new QGridLayout( this ); grid->setContentsMargins( 0, 0, 0, 0 ); // cmd arguments box QHBoxLayout *cmdArgumentsBox = new QHBoxLayout(); grid->addLayout( cmdArgumentsBox, 1, 0 ); cCmdArguments = new QCheckBox( i18n("Additional encoder arguments:"), this ); cmdArgumentsBox->addWidget( cCmdArguments ); lCmdArguments = new KLineEdit( this ); lCmdArguments->setEnabled( false ); cmdArgumentsBox->addWidget( lCmdArguments ); connect( cCmdArguments, SIGNAL(toggled(bool)), lCmdArguments, SLOT(setEnabled(bool)) ); grid->setRowStretch( 2, 1 ); } TTAEncCodecWidget::~TTAEncCodecWidget() {} ConversionOptions *TTAEncCodecWidget::currentConversionOptions() { ConversionOptions *options = new ConversionOptions(); options->qualityMode = ConversionOptions::Lossless; if( cCmdArguments->isChecked() ) options->cmdArguments = lCmdArguments->text(); else options->cmdArguments = ""; return options; } bool TTAEncCodecWidget::setCurrentConversionOptions( ConversionOptions *_options ) { if( !_options || _options->pluginName != global_plugin_name ) return false; ConversionOptions *options = _options; cCmdArguments->setChecked( !options->cmdArguments.isEmpty() ); if( !options->cmdArguments.isEmpty() ) lCmdArguments->setText( options->cmdArguments ); return true; } void TTAEncCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; setEnabled( currentFormat != "wav" ); } QString TTAEncCodecWidget::currentProfile() { return i18n("Lossless"); } bool TTAEncCodecWidget::setCurrentProfile( const QString& profile ) { return profile == i18n("Lossless"); } int TTAEncCodecWidget::currentDataRate() { int dataRate; if( currentFormat == "wav" ) { dataRate = 10590000; } else { dataRate = 6400000; } return dataRate; } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ttaenc/PaxHeaders.4329/ttaenccodecglobal.h0000644000000000000000000000006211773075463027510 xustar0020 atime=1418040447 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ttaenc/ttaenccodecglobal.h0000644000175000001440000000011011773075463030473 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "TTA Enc" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ttaenc/PaxHeaders.4329/soundkonverter_codec_ttae0000644000000000000000000000006211723707255031063 xustar0020 atime=1308601627 30 ctime=1418040695.158717233 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_ttaenc/soundkonverter_codec_ttaenc.desktop0000755000175000001440000000053611723707255034056 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter TTA Enc Plugin X-KDE-Library=soundkonverter_codec_ttaenc ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_ttaenc X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_replaygain_musepack0000644000000000000000000000011712076525023025223 xustar0030 mtime=1358604819.253806417 20 atime=1358274330 29 ctime=1418040695.16671722 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_musepack/0000755000175000001440000000000012076525023026272 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_musepack/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006111726605555030050 xustar0020 atime=1308763307 29 ctime=1418040695.16671722 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_musepack/CMakeLists.txt0000755000175000001440000000126211726605555031050 0ustar00danielusers00000000000000project(soundkonverter_replaygain_musepackgain) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_replaygain_musepackgain_SRCS soundkonverter_replaygain_musepackgain.cpp ) kde4_add_plugin(soundkonverter_replaygain_musepackgain ${soundkonverter_replaygain_musepackgain_SRCS}) target_link_libraries(soundkonverter_replaygain_musepackgain ${KDE4_KDEUI_LIBS} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_replaygain_musepackgain DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_replaygain_musepackgain.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_musepack/PaxHeaders.4329/soundkonverter_rep0000644000000000000000000000025311441644134031162 xustar00122 path=./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_musepack/soundkonverter_replaygain_musepackgain.desktop 20 atime=1308601627 29 ctime=1418040695.16671722 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_musepack/soundkonverter_replaygain_musepack0000755000175000001440000000060611441644134035415 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter MusePack Replay Gain plugin X-KDE-Library=soundkonverter_replaygain_musepackgain ServiceTypes=soundKonverter/ReplayGainPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_replaygain_musepackgain X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_musepack/PaxHeaders.4329/soundkonverter_rep0000644000000000000000000000024712076525023031165 xustar00118 path=./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_musepack/soundkonverter_replaygain_musepackgain.cpp 20 atime=1393418064 29 ctime=1418040695.16671722 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_musepack/soundkonverter_replaygain_musepack0000755000175000001440000000737412076525023035426 0ustar00danielusers00000000000000 #include "musepackreplaygainglobal.h" #include "soundkonverter_replaygain_musepackgain.h" #include #include soundkonverter_replaygain_musepackgain::soundkonverter_replaygain_musepackgain( QObject *parent, const QStringList& args ) : ReplayGainPlugin( parent ) { Q_UNUSED(args) binaries["replaygain"] = ""; allCodecs += "musepack"; } soundkonverter_replaygain_musepackgain::~soundkonverter_replaygain_musepackgain() {} QString soundkonverter_replaygain_musepackgain::name() { return global_plugin_name; } void soundkonverter_replaygain_musepackgain::scanForBackends( const QStringList& directoryList ) { binaries["replaygain"] = KStandardDirs::findExe( "replaygain" ); // sv7 if( binaries["replaygain"].isEmpty() ) binaries["replaygain"] = KStandardDirs::findExe( "mpcgain" ); // sv8 if( binaries["replaygain"].isEmpty() ) { for( QList::const_iterator b = directoryList.begin(); b != directoryList.end(); ++b ) { if( QFile::exists((*b) + "/replaygain") ) { binaries["replaygain"] = (*b) + "/replaygain"; break; } else if( QFile::exists((*b) + "/mpcgain") ) { binaries["replaygain"] = (*b) + "/mpcgain"; break; } } } } QList soundkonverter_replaygain_musepackgain::codecTable() { QList table; ReplayGainPipe newPipe; newPipe.codecName = "musepack"; newPipe.rating = 100; newPipe.enabled = ( binaries["replaygain"] != "" ); newPipe.problemInfo = standardMessage( "replygain_codec,backend", "musepack", "replaygain" ) + "\n" + standardMessage( "install_website_backend,url", "replaygain", "http://www.musepack.net" ); table.append( newPipe ); return table; } bool soundkonverter_replaygain_musepackgain::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_replaygain_musepackgain::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_replaygain_musepackgain::hasInfo() { return false; } void soundkonverter_replaygain_musepackgain::showInfo( QWidget *parent ) { Q_UNUSED(parent) } unsigned int soundkonverter_replaygain_musepackgain::apply( const KUrl::List& fileList, ReplayGainPlugin::ApplyMode mode ) { if( fileList.count() <= 0 ) return BackendPlugin::UnknownError; if( mode == ReplayGainPlugin::Remove ) return BackendPlugin::FeatureNotSupported; // NOTE mpc gain does not support removing Replay Gain tags ReplayGainPluginItem *newItem = new ReplayGainPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); QStringList command; command += binaries["replaygain"]; foreach( const KUrl file, fileList ) { command += "\"" + escapeUrl(file) + "\""; } newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } float soundkonverter_replaygain_musepackgain::parseOutput( const QString& output ) { Q_UNUSED(output) // no progress provided return -1; } #include "soundkonverter_replaygain_musepackgain.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_musepack/PaxHeaders.4329/musepackreplaygain0000644000000000000000000000006111773075463031120 xustar0020 atime=1418040446 29 ctime=1418040695.16671722 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_musepack/musepackreplaygainglobal.h0000644000175000001440000000011611773075463033521 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "Musepack Gain" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_musepack/PaxHeaders.4329/soundkonverter_rep0000644000000000000000000000031512076525023031161 xustar00116 path=./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_musepack/soundkonverter_replaygain_musepackgain.h 30 mtime=1358604819.253806417 30 atime=1358604819.253806417 29 ctime=1418040695.16671722 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_musepack/soundkonverter_replaygain_musepack0000755000175000001440000000225512076525023035417 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_REPLAYGAIN_MUSEPACKGAIN_H #define SOUNDKONVERTER_REPLAYGAIN_MUSEPACKGAIN_H #include "../../core/replaygainplugin.h" #include class ConversionOptions; class soundkonverter_replaygain_musepackgain : public ReplayGainPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_replaygain_musepackgain( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_replaygain_musepackgain(); QString name(); /** search for the backend binaries in the given directories */ virtual void scanForBackends( const QStringList& directoryList = QStringList() ); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); unsigned int apply( const KUrl::List& fileList, ApplyMode mode = Add ); float parseOutput( const QString& output ); }; K_EXPORT_SOUNDKONVERTER_REPLAYGAIN( musepackgain, soundkonverter_replaygain_musepackgain ) #endif // _SOUNDKONVERTER_REPLAYGAIN_MUSEPACKGAIN_H_ ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_replaygain_wvgain0000644000000000000000000000011712076525023024706 xustar0029 mtime=1358604819.25480642 20 atime=1358274330 30 ctime=1418040695.157717235 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_wvgain/0000755000175000001440000000000012076525023025755 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_wvgain/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006211726605544027532 xustar0020 atime=1308763307 30 ctime=1418040695.157717235 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_wvgain/CMakeLists.txt0000755000175000001440000000120211726605544030523 0ustar00danielusers00000000000000project(soundkonverter_replaygain_wvgain) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_replaygain_wvgain_SRCS soundkonverter_replaygain_wvgain.cpp ) kde4_add_plugin(soundkonverter_replaygain_wvgain ${soundkonverter_replaygain_wvgain_SRCS}) target_link_libraries(soundkonverter_replaygain_wvgain ${KDE4_KDEUI_LIBS} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_replaygain_wvgain DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_replaygain_wvgain.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_wvgain/PaxHeaders.4329/wvreplaygainglobal.h0000644000000000000000000000006211441370226031022 xustar0020 atime=1418040445 30 ctime=1418040695.157717235 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_wvgain/wvreplaygainglobal.h0000644000175000001440000000011011441370226032005 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "Wv Gain" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_wvgain/PaxHeaders.4329/soundkonverter_repla0000644000000000000000000000006212076525023031160 xustar0020 atime=1416311950 30 ctime=1418040695.157717235 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_wvgain/soundkonverter_replaygain_wvgain.cpp0000755000175000001440000000606112076525023035345 0ustar00danielusers00000000000000 #include "wvreplaygainglobal.h" #include "soundkonverter_replaygain_wvgain.h" soundkonverter_replaygain_wvgain::soundkonverter_replaygain_wvgain( QObject *parent, const QStringList& args ) : ReplayGainPlugin( parent ) { Q_UNUSED(args) binaries["wvgain"] = ""; allCodecs += "wavpack"; } soundkonverter_replaygain_wvgain::~soundkonverter_replaygain_wvgain() {} QString soundkonverter_replaygain_wvgain::name() { return global_plugin_name; } QList soundkonverter_replaygain_wvgain::codecTable() { QList table; ReplayGainPipe newPipe; newPipe.codecName = "wavpack"; newPipe.rating = 100; newPipe.enabled = ( binaries["wvgain"] != "" ); newPipe.problemInfo = standardMessage( "replaygain_codec,backend", "wavpack", "wvgain" ) + "\n" + i18n( "'%1' is usually in the package '%2' which you can download at %3", QString("wvgain"), QString("wavpack"), QString("http://www.wavpack.com") ); table.append( newPipe ); return table; } bool soundkonverter_replaygain_wvgain::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_replaygain_wvgain::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_replaygain_wvgain::hasInfo() { return false; } void soundkonverter_replaygain_wvgain::showInfo( QWidget *parent ) { Q_UNUSED(parent) } unsigned int soundkonverter_replaygain_wvgain::apply( const KUrl::List& fileList, ReplayGainPlugin::ApplyMode mode ) { if( fileList.count() <= 0 ) return BackendPlugin::UnknownError; ReplayGainPluginItem *newItem = new ReplayGainPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); QStringList command; command += binaries["wvgain"]; if( mode == ReplayGainPlugin::Add ) { command += "-a"; command += "-n"; } else if( mode == ReplayGainPlugin::Force ) { command += "-a"; } else { command += "-c"; } foreach( const KUrl file, fileList ) { command += "\"" + escapeUrl(file) + "\""; } newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } float soundkonverter_replaygain_wvgain::parseOutput( const QString& output ) { // analyzing test.wv, 35% done... QRegExp reg("\\s+(\\d+)% done"); if( output.contains(reg) ) { return (float)reg.cap(1).toInt(); } return -1; } #include "soundkonverter_replaygain_wvgain.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_wvgain/PaxHeaders.4329/soundkonverter_repla0000644000000000000000000000013012076525023031154 xustar0029 mtime=1358604819.25480642 29 atime=1358604819.25480642 30 ctime=1418040695.157717235 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_wvgain/soundkonverter_replaygain_wvgain.h0000755000175000001440000000174212076525023035013 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_REPLAYGAIN_WVGAIN_H #define SOUNDKONVERTER_REPLAYGAIN_WVGAIN_H #include "../../core/replaygainplugin.h" #include class ConversionOptions; class soundkonverter_replaygain_wvgain : public ReplayGainPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_replaygain_wvgain( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_replaygain_wvgain(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); unsigned int apply( const KUrl::List& fileList, ApplyMode mode = Add ); float parseOutput( const QString& output ); }; K_EXPORT_SOUNDKONVERTER_REPLAYGAIN( wvgain, soundkonverter_replaygain_wvgain ) #endif // _SOUNDKONVERTER_REPLAYGAIN_WVGAIN_H_ ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_wvgain/PaxHeaders.4329/soundkonverter_repla0000644000000000000000000000024411441370014031153 xustar00114 path=./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_wvgain/soundkonverter_replaygain_wvgain.desktop 20 atime=1308601627 30 ctime=1418040695.157717235 ./soundkonverter-2.1.2/plugins/soundkonverter_replaygain_wvgain/soundkonverter_replaygain_wvgain.des0000755000175000001440000000055411441370014035330 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter wvgain plugin X-KDE-Library=soundkonverter_replaygain_wvgain ServiceTypes=soundKonverter/ReplayGainPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_replaygain_wvgain X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_timidity0000644000000000000000000000011712276145051024172 xustar0029 mtime=1392036393.17052903 20 atime=1358274330 30 ctime=1418040695.165717222 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_timidity/0000755000175000001440000000000012276145051025241 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_timidity/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006211726605631027012 xustar0020 atime=1308763306 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_timidity/CMakeLists.txt0000755000175000001440000000123111726605631030005 0ustar00danielusers00000000000000project(soundkonverter_codec_timidity) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_timidity_SRCS soundkonverter_codec_timidity.cpp timiditycodecwidget.cpp ) kde4_add_plugin(soundkonverter_codec_timidity ${soundkonverter_codec_timidity_SRCS}) target_link_libraries(soundkonverter_codec_timidity ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_timidity DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_timidity.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_timidity/PaxHeaders.4329/timiditycodecglobal.h0000644000000000000000000000006211773075463030444 xustar0020 atime=1366995186 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_timidity/timiditycodecglobal.h0000644000175000001440000000011311773075463031432 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "TiMidity++" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_codec_timidity/PaxHeaders.4329/soundkonverter_codec_ti0000644000000000000000000000006211404674443031116 xustar0020 atime=1308601627 30 ctime=1418040695.165717222 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_timidity/soundkonverter_codec_timidity.desktop0000755000175000001440000000054511404674443035010 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter TiMidity++ Plugin X-KDE-Library=soundkonverter_codec_timidity ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_timidity X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_codec_timidity/PaxHeaders.4329/timiditycodecwidget.h0000644000000000000000000000013212076525023030452 xustar0030 mtime=1358604819.241806385 30 atime=1358604819.241806385 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_timidity/timiditycodecwidget.h0000644000175000001440000000115512076525023031451 0ustar00danielusers00000000000000 #ifndef TIMIDITYCODECWIDGET_H #define TIMIDITYCODECWIDGET_H #include "../../core/codecwidget.h" class TimidityCodecWidget : public CodecWidget { Q_OBJECT public: TimidityCodecWidget(); ~TimidityCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *_options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: QString currentFormat; // holds the current output file format }; #endif // TIMIDITYCODECWIDGET_H ./soundkonverter-2.1.2/plugins/soundkonverter_codec_timidity/PaxHeaders.4329/timiditycodecwidget.cpp0000644000000000000000000000006212076525023031007 xustar0020 atime=1416311950 30 ctime=1418040695.165717222 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_timidity/timiditycodecwidget.cpp0000644000175000001440000000222612076525023032004 0ustar00danielusers00000000000000 #include "timiditycodecglobal.h" #include "timiditycodecwidget.h" #include "../../core/conversionoptions.h" #include TimidityCodecWidget::TimidityCodecWidget() : CodecWidget(), currentFormat( "midi" ) {} TimidityCodecWidget::~TimidityCodecWidget() {} ConversionOptions *TimidityCodecWidget::currentConversionOptions() { ConversionOptions *options = new ConversionOptions(); return options; } bool TimidityCodecWidget::setCurrentConversionOptions( ConversionOptions *_options ) { if( !_options || _options->pluginName != global_plugin_name ) return false; return true; } void TimidityCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; setEnabled( currentFormat != "wav" ); } QString TimidityCodecWidget::currentProfile() { return i18n("Lossless"); } bool TimidityCodecWidget::setCurrentProfile( const QString& profile ) { return profile == i18n("Lossless"); } int TimidityCodecWidget::currentDataRate() { int dataRate; if( currentFormat == "wav" ) { dataRate = 10590000; } return dataRate; } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_timidity/PaxHeaders.4329/soundkonverter_codec_ti0000644000000000000000000000006212276145051031112 xustar0020 atime=1418040443 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_timidity/soundkonverter_codec_timidity.cpp0000755000175000001440000001000512276145051034105 0ustar00danielusers00000000000000 #include "timiditycodecglobal.h" #include "soundkonverter_codec_timidity.h" #include "../../core/conversionoptions.h" #include "timiditycodecwidget.h" soundkonverter_codec_timidity::soundkonverter_codec_timidity( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["timidity"] = ""; allCodecs += "midi"; allCodecs += "mod"; allCodecs += "wav"; } soundkonverter_codec_timidity::~soundkonverter_codec_timidity() {} QString soundkonverter_codec_timidity::name() { return global_plugin_name; } QList soundkonverter_codec_timidity::codecTable() { QList table; ConversionPipeTrunk newTrunk; newTrunk.codecFrom = "midi"; newTrunk.codecTo = "wav"; newTrunk.rating = 90; newTrunk.enabled = ( binaries["timidity"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "midi", "timidity" ) + "\n" + standardMessage( "install_opensource_backend", "timidity" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "mod"; newTrunk.codecTo = "wav"; newTrunk.rating = 90; newTrunk.enabled = ( binaries["timidity"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "mod", "timidity" ) + "\n" + standardMessage( "install_opensource_backend", "timidity" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); return table; } bool soundkonverter_codec_timidity::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_codec_timidity::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_codec_timidity::hasInfo() { return false; } void soundkonverter_codec_timidity::showInfo( QWidget *parent ) { Q_UNUSED(parent) } CodecWidget *soundkonverter_codec_timidity::newCodecWidget() { TimidityCodecWidget *widget = new TimidityCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_codec_timidity::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { QStringList command = convertCommand( inputFile, outputFile, inputCodec, outputCodec, _conversionOptions, tags, replayGain ); if( command.isEmpty() ) return BackendPlugin::UnknownError; CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_timidity::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(_conversionOptions) Q_UNUSED(tags) Q_UNUSED(replayGain) QStringList command; if( outputCodec == "wav" ) { command += binaries["timidity"]; command += "-Ow"; command += "-o"; command += "\"" + escapeUrl(outputFile) + "\""; command += "\"" + escapeUrl(inputFile) + "\""; } return command; } float soundkonverter_codec_timidity::parseOutput( const QString& output ) { Q_UNUSED(output) // no output return -1; } #include "soundkonverter_codec_timidity.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_codec_timidity/PaxHeaders.4329/soundkonverter_codec_ti0000644000000000000000000000013212076525023031107 xustar0030 mtime=1358604819.241806385 30 atime=1358604819.241806385 30 ctime=1418040695.164717223 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_timidity/soundkonverter_codec_timidity.h0000755000175000001440000000246212076525023033561 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_TIMIDITY_H #define SOUNDKONVERTER_CODEC_TIMIDITY_H #include "../../core/codecplugin.h" class ConversionOptions; class soundkonverter_codec_timidity : public CodecPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_codec_timidity( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_timidity(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& format ); void showConfigDialog( ActionType action, const QString& format, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output ); }; K_EXPORT_SOUNDKONVERTER_CODEC( timidity, soundkonverter_codec_timidity ) #endif // SOUNDKONVERTER_CODEC_TIMIDITY_H ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_aften0000644000000000000000000000012012276433306023430 xustar0030 mtime=1392129734.803243958 20 atime=1358274330 30 ctime=1418040695.157717235 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_aften/0000755000175000001440000000000012276433306024505 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_aften/PaxHeaders.4329/soundkonverter_codec_aften0000644000000000000000000000006211626454025031036 xustar0020 atime=1308601627 30 ctime=1418040695.157717235 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_aften/soundkonverter_codec_aften.desktop0000755000175000001440000000053211626454025033504 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter Aften Plugin X-KDE-Library=soundkonverter_codec_aften ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_aften X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_codec_aften/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006211626453745026261 xustar0020 atime=1308763306 30 ctime=1418040695.157717235 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_aften/CMakeLists.txt0000755000175000001440000000117611626453745027264 0ustar00danielusers00000000000000project(soundkonverter_codec_aften) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_aften_SRCS soundkonverter_codec_aften.cpp aftencodecwidget.cpp ) kde4_add_plugin(soundkonverter_codec_aften ${soundkonverter_codec_aften_SRCS}) target_link_libraries(soundkonverter_codec_aften ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_aften DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_aften.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_aften/PaxHeaders.4329/aftencodecwidget.cpp0000644000000000000000000000013212276433306027513 xustar0030 mtime=1392129734.801243951 30 atime=1392129734.801243951 30 ctime=1418040695.157717235 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_aften/aftencodecwidget.cpp0000644000175000001440000001677712276433306030532 0ustar00danielusers00000000000000 #include "aftencodecglobal.h" #include "aftencodecwidget.h" #include "../../core/conversionoptions.h" #include #include #include #include #include #include AftenCodecWidget::AftenCodecWidget() : CodecWidget(), currentFormat( "ac3" ) { QGridLayout *grid = new QGridLayout( this ); grid->setContentsMargins( 0, 0, 0, 0 ); // set up encoding options selection QHBoxLayout *topBox = new QHBoxLayout(); grid->addLayout( topBox, 0, 0 ); QLabel *lMode = new QLabel( i18n("Mode:"), this ); topBox->addWidget( lMode ); cMode = new KComboBox( this ); cMode->addItem( i18n("Quality") ); cMode->addItem( i18n("Bitrate") ); connect( cMode, SIGNAL(activated(int)), this, SLOT(modeChanged(int)) ); connect( cMode, SIGNAL(activated(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( cMode ); sQuality = new QSlider( Qt::Horizontal, this ); sQuality->setRange( 0, 1023 ); sQuality->setSingleStep( 10 ); connect( sQuality, SIGNAL(valueChanged(int)), this, SLOT(qualitySliderChanged(int)) ); connect( sQuality, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( sQuality ); sQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", 0, 1023) ); dQuality = new QSpinBox( this ); dQuality->setRange( 0, 1023 ); dQuality->setSingleStep( 1 ); dQuality->setSuffix( "" ); dQuality->setFixedWidth( dQuality->sizeHint().width() ); connect( dQuality, SIGNAL(valueChanged(int)), this, SLOT(qualitySpinBoxChanged(int)) ); connect( dQuality, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( dQuality ); dQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", 0, 1023) ); cBitrate = new KComboBox( this ); cBitrate->addItem( "32 kbps" ); cBitrate->addItem( "40 kbps" ); cBitrate->addItem( "48 kbps" ); cBitrate->addItem( "56 kbps" ); cBitrate->addItem( "64 kbps" ); cBitrate->addItem( "80 kbps" ); cBitrate->addItem( "96 kbps" ); cBitrate->addItem( "112 kbps" ); cBitrate->addItem( "128 kbps" ); cBitrate->addItem( "160 kbps" ); cBitrate->addItem( "192 kbps" ); cBitrate->addItem( "224 kbps" ); cBitrate->addItem( "256 kbps" ); cBitrate->addItem( "320 kbps" ); cBitrate->addItem( "384 kbps" ); cBitrate->addItem( "448 kbps" ); cBitrate->addItem( "512 kbps" ); cBitrate->addItem( "576 kbps" ); cBitrate->addItem( "640 kbps" ); cBitrate->hide(); connect( cBitrate, SIGNAL(activated(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( cBitrate ); topBox->addStretch(); grid->setRowStretch( 1, 1 ); modeChanged( 0 ); } AftenCodecWidget::~AftenCodecWidget() {} // TODO optimize !!! int AftenCodecWidget::bitrateForQuality( int quality ) { return quality*100/3; } // TODO optimize !!! int AftenCodecWidget::qualityForBitrate( int bitrate ) { return bitrate*3/100; } ConversionOptions *AftenCodecWidget::currentConversionOptions() { ConversionOptions *options = new ConversionOptions(); if( cMode->currentText()==i18n("Quality") ) { options->qualityMode = ConversionOptions::Quality; options->quality = dQuality->value(); options->bitrate = bitrateForQuality( options->quality ); } else { options->qualityMode = ConversionOptions::Bitrate; options->bitrate = cBitrate->currentText().replace(" kbps","").toInt(); options->quality = qualityForBitrate( cBitrate->currentText().replace(" kbps","").toInt() ); } return options; } bool AftenCodecWidget::setCurrentConversionOptions( ConversionOptions *_options ) { if( !_options || _options->pluginName != global_plugin_name ) return false; ConversionOptions *options = _options; if( options->qualityMode == ConversionOptions::Quality ) { cMode->setCurrentIndex( cMode->findText(i18n("Quality")) ); modeChanged( cMode->currentIndex() ); dQuality->setValue( options->quality ); } else { cMode->setCurrentIndex( cMode->findText(i18n("Bitrate")) ); modeChanged( cMode->currentIndex() ); cBitrate->setCurrentIndex( cBitrate->findText(QString::number(options->bitrate)+" kbps") ); } return true; } void AftenCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; setEnabled( currentFormat != "wav" ); } // TODO optimize !!! QString AftenCodecWidget::currentProfile() { if( currentFormat == "wav" ) { return i18n("Lossless"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 60 ) { return i18n("Very low"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 80 ) { return i18n("Low"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 100 ) { return i18n("Medium"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 140 ) { return i18n("High"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 180 ) { return i18n("Very high"); } return i18n("User defined"); } // TODO optimize !!! bool AftenCodecWidget::setCurrentProfile( const QString& profile ) { if( profile == i18n("Very low") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 60 ); dQuality->setValue( 60 ); return true; } else if( profile == i18n("Low") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 80 ); dQuality->setValue( 80 ); return true; } else if( profile == i18n("Medium") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 100 ); dQuality->setValue( 100 ); return true; } else if( profile == i18n("High") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 140 ); dQuality->setValue( 140 ); return true; } else if( profile == i18n("Very high") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 180 ); dQuality->setValue( 180 ); return true; } return false; } int AftenCodecWidget::currentDataRate() { int dataRate; if( currentFormat == "wav" ) { dataRate = 10590000; } else { dataRate = 6400000; } return dataRate; } void AftenCodecWidget::modeChanged( int mode ) { if( mode == 0 ) { sQuality->setValue( 240 ); dQuality->setValue( 240 ); // dQuality->setValue( qualityForBitrate(dQuality->value()) ); // qualitySpinBoxChanged( dQuality->value() ); sQuality->show(); dQuality->show(); cBitrate->hide(); } else { cBitrate->setCurrentIndex( cBitrate->findText("192 kbps") ); // dQuality->setValue( bitrateForQuality(dQuality->value()) ); // qualitySpinBoxChanged( dQuality->value() ); sQuality->hide(); dQuality->hide(); cBitrate->show(); } } void AftenCodecWidget::qualitySliderChanged( int quality ) { dQuality->setValue( quality ); } void AftenCodecWidget::qualitySpinBoxChanged( int quality ) { sQuality->setValue( quality ); } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_aften/PaxHeaders.4329/soundkonverter_codec_aften0000644000000000000000000000013212076525023031031 xustar0030 mtime=1358604819.223806335 30 atime=1358604819.223806335 30 ctime=1418040695.157717235 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_aften/soundkonverter_codec_aften.h0000755000175000001440000000244312076525023032262 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_AFTEN_H #define SOUNDKONVERTER_CODEC_AFTEN_H #include "../../core/codecplugin.h" class ConversionOptions; class soundkonverter_codec_aften : public CodecPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_codec_aften( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_aften(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output ); }; K_EXPORT_SOUNDKONVERTER_CODEC( aften, soundkonverter_codec_aften ) #endif // _SOUNDKONVERTER_CODEC_AFTEN_H_ ./soundkonverter-2.1.2/plugins/soundkonverter_codec_aften/PaxHeaders.4329/soundkonverter_codec_aften0000644000000000000000000000006212276145051031034 xustar0020 atime=1418040445 30 ctime=1418040695.157717235 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_aften/soundkonverter_codec_aften.cpp0000755000175000001440000001074512276145051032622 0ustar00danielusers00000000000000 #include "aftencodecglobal.h" #include "soundkonverter_codec_aften.h" #include "../../core/conversionoptions.h" #include "aftencodecwidget.h" soundkonverter_codec_aften::soundkonverter_codec_aften( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["aften"] = ""; allCodecs += "ac3"; allCodecs += "wav"; } soundkonverter_codec_aften::~soundkonverter_codec_aften() {} QString soundkonverter_codec_aften::name() { return global_plugin_name; } QList soundkonverter_codec_aften::codecTable() { QList table; ConversionPipeTrunk newTrunk; newTrunk.codecFrom = "wav"; newTrunk.codecTo = "ac3"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["aften"] != "" ); newTrunk.problemInfo = standardMessage( "encode_codec,backend", "ac3", "aften" ) + "\n" + standardMessage( "install_opensource_backend", "aften" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "ac3"; newTrunk.codecTo = "wav"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["aften"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "ac3", "aften" ) + "\n" + standardMessage( "install_opensource_backend", "aften" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); return table; } bool soundkonverter_codec_aften::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_codec_aften::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_codec_aften::hasInfo() { return false; } void soundkonverter_codec_aften::showInfo( QWidget *parent ) { Q_UNUSED(parent) } CodecWidget *soundkonverter_codec_aften::newCodecWidget() { AftenCodecWidget *widget = new AftenCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_codec_aften::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { const QStringList command = convertCommand( inputFile, outputFile, inputCodec, outputCodec, _conversionOptions, tags, replayGain ); if( command.isEmpty() ) return BackendPlugin::UnknownError; CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_aften::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(tags) Q_UNUSED(replayGain) if( !_conversionOptions ) return QStringList(); QStringList command; ConversionOptions *conversionOptions = _conversionOptions; if( outputCodec == "ac3" ) { command += binaries["aften"]; if( conversionOptions->qualityMode == ConversionOptions::Quality ) { command += "-q"; command += QString::number(conversionOptions->quality); } else if( conversionOptions->qualityMode == ConversionOptions::Bitrate ) { command += "-b"; command += QString::number(conversionOptions->bitrate); } command += "\"" + escapeUrl(inputFile) + "\""; command += "\"" + escapeUrl(outputFile) + "\""; } return command; } float soundkonverter_codec_aften::parseOutput( const QString& output ) { // progress: 59% | q: 269.7 | bw: 44.0 | bitrate: 192.0 kbps QRegExp reg("progress:\\s+(\\d+)%"); if( output.contains(reg) ) { return (float)reg.cap(1).toInt(); } return -1; } #include "soundkonverter_codec_aften.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_codec_aften/PaxHeaders.4329/aftencodecwidget.h0000644000000000000000000000013212076525023027154 xustar0030 mtime=1358604819.223806335 30 atime=1358604819.223806335 30 ctime=1418040695.157717235 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_aften/aftencodecwidget.h0000644000175000001440000000171712076525023030157 0ustar00danielusers00000000000000 #ifndef AFTENCODECWIDGET_H #define AFTENCODECWIDGET_H #include "../../core/codecwidget.h" class KComboBox; class QSlider; class QSpinBox; class AftenCodecWidget : public CodecWidget { Q_OBJECT public: AftenCodecWidget(); ~AftenCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *_options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: KComboBox *cMode; QSlider *sQuality; QSpinBox *dQuality; KComboBox *cBitrate; QString currentFormat; // holds the current output file format int bitrateForQuality( int quality ); int qualityForBitrate( int bitrate ); private slots: void modeChanged( int mode ); void qualitySliderChanged( int quality ); void qualitySpinBoxChanged( int quality ); }; #endif // AFTENCODECWIDGET_H ./soundkonverter-2.1.2/plugins/soundkonverter_codec_aften/PaxHeaders.4329/aftencodecglobal.h0000644000000000000000000000006211626453772027146 xustar0020 atime=1308671512 30 ctime=1418040695.157717235 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_aften/aftencodecglobal.h0000644000175000001440000000010611626453772030136 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "Aften" #endif ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_filter_normalize0000644000000000000000000000013212276433306024546 xustar0030 mtime=1392129734.917244367 30 atime=1358604819.245806395 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/0000755000175000001440000000000012276433306025620 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000013212076525023027357 xustar0030 mtime=1358604819.246806398 30 atime=1358604819.246806398 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/CMakeLists.txt0000755000175000001440000000131112076525023030353 0ustar00danielusers00000000000000project(soundkonverter_filter_normalize) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_filter_normalize_SRCS soundkonverter_filter_normalize.cpp normalizefilteroptions.cpp normalizefilterwidget.cpp ) kde4_add_plugin(soundkonverter_filter_normalize ${soundkonverter_filter_normalize_SRCS}) target_link_libraries(soundkonverter_filter_normalize ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_filter_normalize DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_filter_normalize.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/PaxHeaders.4329/normalizefilteroption0000644000000000000000000000013212076525023031201 xustar0030 mtime=1358604819.246806398 30 atime=1358604819.246806398 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/normalizefilteroptions.h0000644000175000001440000000075612076525023032617 0ustar00danielusers00000000000000 #ifndef NORMALIZEFILTEROPTIONS_H #define NORMALIZEFILTEROPTIONS_H #include "../../core/conversionoptions.h" class NormalizeFilterOptions : public FilterOptions { public: NormalizeFilterOptions(); ~NormalizeFilterOptions(); bool equals( FilterOptions *_other ); QDomElement toXml( QDomDocument document, const QString elementName ); bool fromXml( QDomElement filterOptions ); struct Data { bool normalize; } data; }; #endif // NORMALIZEFILTEROPTIONS_H ./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/PaxHeaders.4329/normalizefilterglobal0000644000000000000000000000013212076525023031131 xustar0030 mtime=1358604819.246806398 30 atime=1358604819.246806398 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/normalizefilterglobal.h0000644000175000001440000000011212076525023032346 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "normalize" #endif ./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/PaxHeaders.4329/normalizefilterwidget0000644000000000000000000000013212276433306031160 xustar0030 mtime=1392129734.916244364 30 atime=1392129734.916244364 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/normalizefilterwidget.cpp0000644000175000001440000000277212276433306032746 0ustar00danielusers00000000000000 #include "normalizefilterglobal.h" #include "normalizefilterwidget.h" #include "normalizefilteroptions.h" #include #include #include #include NormalizeFilterWidget::NormalizeFilterWidget() : FilterWidget() { QGridLayout *grid = new QGridLayout( this ); grid->setContentsMargins( 0, 0, 0, 0 ); // set up encoding options selection QHBoxLayout *topBox = new QHBoxLayout(); grid->addLayout( topBox, 0, 0 ); cNormalize = new QCheckBox( i18n("Normalize"), this ); connect( cNormalize, SIGNAL(toggled(bool)), SIGNAL(optionsChanged()) ); topBox->addWidget( cNormalize ); topBox->addStretch(); grid->setRowStretch( 1, 1 ); cNormalize->setChecked( false ); } NormalizeFilterWidget::~NormalizeFilterWidget() {} FilterOptions* NormalizeFilterWidget::currentFilterOptions() { if( cNormalize->isChecked() ) { NormalizeFilterOptions *options = new NormalizeFilterOptions(); options->data.normalize = cNormalize->isChecked(); return options; } else { return 0; } } bool NormalizeFilterWidget::setCurrentFilterOptions( FilterOptions *_options ) { if( !_options ) { cNormalize->setChecked( false ); return true; } if( _options->pluginName != global_plugin_name ) return false; NormalizeFilterOptions *options = dynamic_cast(_options); cNormalize->setChecked( options->data.normalize ); return true; } ./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/PaxHeaders.4329/normalizefilterwidget0000644000000000000000000000013212076525023031154 xustar0030 mtime=1358604819.246806398 30 atime=1358604819.246806398 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/normalizefilterwidget.h0000644000175000001440000000066112076525023032402 0ustar00danielusers00000000000000 #ifndef NORMALIZEFILTERWIDGET_H #define NORMALIZEFILTERWIDGET_H #include "../../core/codecwidget.h" class QCheckBox; class NormalizeFilterWidget : public FilterWidget { Q_OBJECT public: NormalizeFilterWidget(); ~NormalizeFilterWidget(); FilterOptions *currentFilterOptions(); bool setCurrentFilterOptions( FilterOptions *_options ); private: QCheckBox *cNormalize; }; #endif // NORMALIZEFILTERWIDGET_H ./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/PaxHeaders.4329/soundkonverter_filter0000644000000000000000000000013112201420416031164 xustar0030 mtime=1376133390.394827207 30 atime=1376133390.394827207 29 ctime=1418040695.16071723 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/soundkonverter_filter_normalize.h0000755000175000001440000000266312201420416034502 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_FILTER_NORMALIZE_H #define SOUNDKONVERTER_FILTER_NORMALIZE_H #include "../../core/filterplugin.h" class FilterOptions; class soundkonverter_filter_normalize : public FilterPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_filter_normalize( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_filter_normalize(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); FilterWidget *newFilterWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output ); FilterOptions *filterOptionsFromXml( QDomElement filterOptions ); }; K_EXPORT_SOUNDKONVERTER_FILTER( normalize, soundkonverter_filter_normalize ) #endif // SOUNDKONVERTER_FILTER_NORMALIZE_H ./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/PaxHeaders.4329/normalizefilteroption0000644000000000000000000000006212076525023031203 xustar0020 atime=1398102755 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/normalizefilteroptions.cpp0000644000175000001440000000202212076525023033136 0ustar00danielusers00000000000000 #include "normalizefilterglobal.h" #include "normalizefilteroptions.h" #include "../../core/conversionoptions.h" NormalizeFilterOptions::NormalizeFilterOptions() { pluginName = global_plugin_name; } NormalizeFilterOptions::~NormalizeFilterOptions() {} bool NormalizeFilterOptions::equals( FilterOptions *_other ) { if( !_other || _other->pluginName!=pluginName ) return false; NormalizeFilterOptions *other = dynamic_cast(_other); return ( FilterOptions::equals( _other ) && data.normalize == other->data.normalize ); } QDomElement NormalizeFilterOptions::toXml( QDomDocument document, const QString elementName ) { QDomElement filterOptions = FilterOptions::toXml( document,elementName ); filterOptions.setAttribute("normalize",data.normalize); return filterOptions; } bool NormalizeFilterOptions::fromXml( QDomElement filterOptions ) { FilterOptions::fromXml( filterOptions ); data.normalize = filterOptions.attribute("normalize").toInt(); return true; } ./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/PaxHeaders.4329/soundkonverter_filter0000644000000000000000000000031212076525023031177 xustar00112 path=./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/soundkonverter_filter_normalize.desktop 30 mtime=1358604819.247806401 30 atime=1358604819.247806401 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/soundkonverter_filter_normalize.deskt0000755000175000001440000000055112076525023035371 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter normalize Plugin X-KDE-Library=soundkonverter_filter_normalize ServiceTypes=soundKonverter/FilterPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_filter_normalize X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/PaxHeaders.4329/soundkonverter_filter0000644000000000000000000000006212276145051031202 xustar0020 atime=1418040446 30 ctime=1418040695.161717228 ./soundkonverter-2.1.2/plugins/soundkonverter_filter_normalize/soundkonverter_filter_normalize.cpp0000755000175000001440000001201712276145051035042 0ustar00danielusers00000000000000 #include "normalizefilterglobal.h" #include "soundkonverter_filter_normalize.h" #include "../../core/conversionoptions.h" #include "normalizefilteroptions.h" #include "normalizefilterwidget.h" #include soundkonverter_filter_normalize::soundkonverter_filter_normalize( QObject *parent, const QStringList& args ) : FilterPlugin( parent ) { Q_UNUSED(args) binaries["normalize"] = ""; allCodecs += "wav"; } soundkonverter_filter_normalize::~soundkonverter_filter_normalize() {} QString soundkonverter_filter_normalize::name() { return global_plugin_name; } QList soundkonverter_filter_normalize::codecTable() { QList table; ConversionPipeTrunk newTrunk; newTrunk.codecFrom = "wav"; newTrunk.codecTo = "wav"; newTrunk.rating = 100; newTrunk.enabled = ( binaries["normalize"] != "" ); newTrunk.problemInfo = standardMessage( "filter,backend", "normalize", "normalize" ) + "\n" + standardMessage( "install_opensource_backend", "normalize" ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); return table; } bool soundkonverter_filter_normalize::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_filter_normalize::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_filter_normalize::hasInfo() { return false; } void soundkonverter_filter_normalize::showInfo( QWidget *parent ) { Q_UNUSED(parent) } FilterWidget *soundkonverter_filter_normalize::newFilterWidget() { NormalizeFilterWidget *widget = new NormalizeFilterWidget(); if( lastUsedFilterOptions ) { widget->setCurrentFilterOptions( lastUsedFilterOptions ); delete lastUsedFilterOptions; lastUsedFilterOptions = 0; } return qobject_cast(widget); } CodecWidget *soundkonverter_filter_normalize::newCodecWidget() { // CodecWidget *widget = new CodecWidget(); // return qobject_cast(widget); return 0; } unsigned int soundkonverter_filter_normalize::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { QStringList command = convertCommand( inputFile, outputFile, inputCodec, outputCodec, _conversionOptions, tags, replayGain ); if( command.isEmpty() ) return BackendPlugin::UnknownError; FilterPluginItem *newItem = new FilterPluginItem( this ); newItem->id = lastId++; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_filter_normalize::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED( inputCodec ); Q_UNUSED( outputCodec ); Q_UNUSED( tags ); Q_UNUSED( replayGain ); if( !_conversionOptions ) return QStringList(); if( inputFile.isEmpty() || outputFile.isEmpty() ) return QStringList(); QStringList command; foreach( FilterOptions *_filterOptions,_conversionOptions->filterOptions ) { if( _filterOptions->pluginName == global_plugin_name ) { NormalizeFilterOptions *filterOptions = dynamic_cast(_filterOptions); if( filterOptions->data.normalize ) { command += binaries["normalize"]; command += "\"" + escapeUrl(outputFile) + "\""; if( !command.isEmpty() ) QFile::copy( inputFile.toLocalFile(), outputFile.toLocalFile() ); } } } return command; } float soundkonverter_filter_normalize::parseOutput( const QString& output ) { Q_UNUSED( output ); // // 01-Unknown.wav: 98% complete, ratio=0,479 // encode // // 01-Unknown.wav: 27% complete // decode // // QRegExp regEnc("(\\d+)% complete"); // if( output.contains(regEnc) ) // { // return (float)regEnc.cap(1).toInt(); // } // return -1; } FilterOptions *soundkonverter_filter_normalize::filterOptionsFromXml( QDomElement filterOptions ) { NormalizeFilterOptions *options = new NormalizeFilterOptions(); options->fromXml( filterOptions ); return options; } #include "soundkonverter_filter_normalize.moc" ./soundkonverter-2.1.2/plugins/PaxHeaders.4329/soundkonverter_codec_neroaac0000644000000000000000000000012012276433700023741 xustar0030 mtime=1392129984.086103673 20 atime=1358274330 30 ctime=1418040695.159717232 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_neroaac/0000755000175000001440000000000012276433700025016 5ustar00danielusers00000000000000./soundkonverter-2.1.2/plugins/soundkonverter_codec_neroaac/PaxHeaders.4329/CMakeLists.txt0000644000000000000000000000006211726605650026567 xustar0020 atime=1308763306 30 ctime=1418040695.159717232 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_neroaac/CMakeLists.txt0000755000175000001440000000122011726605650027560 0ustar00danielusers00000000000000project(soundkonverter_codec_neroaac) find_package(KDE4 REQUIRED) include (KDE4Defaults) include_directories( ${KDE4_INCLUDES} ${QT_INCLUDES} ) set(soundkonverter_codec_neroaac_SRCS soundkonverter_codec_neroaac.cpp neroaaccodecwidget.cpp ) kde4_add_plugin(soundkonverter_codec_neroaac ${soundkonverter_codec_neroaac_SRCS}) target_link_libraries(soundkonverter_codec_neroaac ${KDE4_KDEUI_LIBS} ${QT_QTXML_LIBRARY} soundkonvertercore ) ########### install files ############### install(TARGETS soundkonverter_codec_neroaac DESTINATION ${PLUGIN_INSTALL_DIR}) install(FILES soundkonverter_codec_neroaac.desktop DESTINATION ${SERVICES_INSTALL_DIR}) ./soundkonverter-2.1.2/plugins/soundkonverter_codec_neroaac/PaxHeaders.4329/soundkonverter_codec_ner0000644000000000000000000000006212276145051031036 xustar0020 atime=1418040449 30 ctime=1418040695.159717232 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_neroaac/soundkonverter_codec_neroaac.cpp0000755000175000001440000001621012276145051033441 0ustar00danielusers00000000000000 #include "neroaaccodecglobal.h" #include "soundkonverter_codec_neroaac.h" #include "neroaaccodecwidget.h" #include "../../core/conversionoptions.h" #include "../../metadata/tagengine.h" // NeroAAC is a propritary implementation of an aac encoder that claims to reach a better quality then faac.\nYou can download it at http://www.nero.com/enu/downloads-nerodigital-nero-aac-codec.php soundkonverter_codec_neroaac::soundkonverter_codec_neroaac( QObject *parent, const QStringList& args ) : CodecPlugin( parent ) { Q_UNUSED(args) binaries["neroAacEnc"] = ""; binaries["neroAacDec"] = ""; allCodecs += "m4a/aac"; allCodecs += "mp4"; allCodecs += "wav"; } soundkonverter_codec_neroaac::~soundkonverter_codec_neroaac() {} QString soundkonverter_codec_neroaac::name() { return global_plugin_name; } QList soundkonverter_codec_neroaac::codecTable() { QList table; ConversionPipeTrunk newTrunk; newTrunk.codecFrom = "wav"; newTrunk.codecTo = "m4a/aac"; newTrunk.rating = 90; newTrunk.enabled = ( binaries["neroAacEnc"] != "" ); newTrunk.problemInfo = standardMessage( "encode_codec,backend", "m4a/aac", "neroAacEnc" ) + "\n" + i18n( "You can download '%1' at '%2' after entering an email address.", QString("neroAacEnc"), QString("http://www.nero.com/enu/downloads-nerodigital-nero-aac-codec.php") ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "m4a/aac"; newTrunk.codecTo = "wav"; newTrunk.rating = 90; newTrunk.enabled = ( binaries["neroAacDec"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "m4a/aac", "neroAacDec" ) + "\n" + i18n( "You can download '%1' at '%2' after entering an email address.", QString("neroAacDec"), QString("http://www.nero.com/enu/downloads-nerodigital-nero-aac-codec.php") ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); newTrunk.codecFrom = "mp4"; newTrunk.codecTo = "wav"; newTrunk.rating = 90; newTrunk.enabled = ( binaries["neroAacDec"] != "" ); newTrunk.problemInfo = standardMessage( "decode_codec,backend", "mp4", "neroAacDec" ) + "\n" + i18n( "You can download '%1' at '%2' after entering an email address.", QString("neroAacDec"), QString("http://www.nero.com/enu/downloads-nerodigital-nero-aac-codec.php") ); newTrunk.data.hasInternalReplayGain = false; table.append( newTrunk ); return table; } bool soundkonverter_codec_neroaac::isConfigSupported( ActionType action, const QString& codecName ) { Q_UNUSED(action) Q_UNUSED(codecName) return false; } void soundkonverter_codec_neroaac::showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ) { Q_UNUSED(action) Q_UNUSED(codecName) Q_UNUSED(parent) } bool soundkonverter_codec_neroaac::hasInfo() { return false; } void soundkonverter_codec_neroaac::showInfo( QWidget *parent ) { Q_UNUSED(parent) } CodecWidget *soundkonverter_codec_neroaac::newCodecWidget() { NeroaacCodecWidget *widget = new NeroaacCodecWidget(); return qobject_cast(widget); } unsigned int soundkonverter_codec_neroaac::convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { QStringList command = convertCommand( inputFile, outputFile, inputCodec, outputCodec, _conversionOptions, tags, replayGain ); if( command.isEmpty() ) return BackendPlugin::UnknownError; CodecPluginItem *newItem = new CodecPluginItem( this ); newItem->id = lastId++; newItem->data.length = tags ? tags->length : 200; newItem->process = new KProcess( newItem ); newItem->process->setOutputChannelMode( KProcess::MergedChannels ); connect( newItem->process, SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( newItem->process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); newItem->process->clearProgram(); newItem->process->setShellCommand( command.join(" ") ); newItem->process->start(); logCommand( newItem->id, command.join(" ") ); backendItems.append( newItem ); return newItem->id; } QStringList soundkonverter_codec_neroaac::convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags, bool replayGain ) { Q_UNUSED(inputCodec) Q_UNUSED(tags) Q_UNUSED(replayGain) if( !_conversionOptions ) return QStringList(); QStringList command; ConversionOptions *conversionOptions = _conversionOptions; if( outputCodec == "m4a/aac" ) { command += binaries["neroAacEnc"]; if( conversionOptions->qualityMode == ConversionOptions::Quality ) { command += "-q"; command += QString::number(conversionOptions->quality); } else if( conversionOptions->qualityMode == ConversionOptions::Bitrate ) { if( conversionOptions->bitrateMode == ConversionOptions::Abr ) { command += "-br"; command += QString::number(conversionOptions->bitrate*1000); } else if( conversionOptions->bitrateMode == ConversionOptions::Cbr ) { command += "-cbr"; command += QString::number(conversionOptions->bitrate*1000); } } command += "-if"; command += "\"" + escapeUrl(inputFile) + "\""; command += "-of"; command += "\"" + escapeUrl(outputFile) + "\""; } else { command += binaries["neroAacDec"]; command += "-if"; command += "\"" + escapeUrl(inputFile) + "\""; command += "-of"; command += "\"" + escapeUrl(outputFile) + "\""; } return command; } float soundkonverter_codec_neroaac::parseOutput( const QString& output, int length ) { if( length == 0 ) return -1; // Processed 218 seconds... QRegExp regEnc("Processed (\\d+) seconds"); if( output.contains(regEnc) ) { return (float)regEnc.cap(1).toInt()*100/length; } // no output when decoding return -1; } float soundkonverter_codec_neroaac::parseOutput( const QString& output ) { return parseOutput( output, 0 ); } void soundkonverter_codec_neroaac::processOutput() { CodecPluginItem *pluginItem; float progress; for( int i=0; iprocess == QObject::sender() ) { QString output = backendItems.at(i)->process->readAllStandardOutput().data(); pluginItem = qobject_cast(backendItems.at(i)); progress = parseOutput( output, pluginItem->data.length ); if( progress == -1 && !output.simplified().isEmpty() ) logOutput( backendItems.at(i)->id, output ); if( progress > backendItems.at(i)->progress ) backendItems.at(i)->progress = progress; return; } } } #include "soundkonverter_codec_neroaac.moc" ./soundkonverter-2.1.2/plugins/soundkonverter_codec_neroaac/PaxHeaders.4329/soundkonverter_codec_ner0000644000000000000000000000006211374526761031047 xustar0020 atime=1308601627 30 ctime=1418040695.159717232 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_neroaac/soundkonverter_codec_neroaac.desktop0000755000175000001440000000054111374526761034341 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Type=Service Name=soundKonverter Nero AAC Plugin X-KDE-Library=soundkonverter_codec_neroaac ServiceTypes=soundKonverter/CodecPlugin X-KDE-PluginInfo-Author=Daniel Faust X-KDE-PluginInfo-Email=hessijames@gmail.com X-KDE-PluginInfo-Name=soundkonverter_codec_neroaac X-KDE-PluginInfo-Version=1.0 X-KDE-PluginInfo-License=GPL ./soundkonverter-2.1.2/plugins/soundkonverter_codec_neroaac/PaxHeaders.4329/neroaaccodecwidget.h0000644000000000000000000000013212076525023030002 xustar0030 mtime=1358604819.235806368 30 atime=1358604819.235806368 30 ctime=1418040695.159717232 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_neroaac/neroaaccodecwidget.h0000644000175000001440000000176312076525023031006 0ustar00danielusers00000000000000 #ifndef NEROAACCODECWIDGET_H #define NEROAACCODECWIDGET_H #include "../../core/codecwidget.h" class KComboBox; class QSlider; class QDoubleSpinBox; class NeroaacCodecWidget : public CodecWidget { Q_OBJECT public: NeroaacCodecWidget(); ~NeroaacCodecWidget(); ConversionOptions *currentConversionOptions(); bool setCurrentConversionOptions( ConversionOptions *_options ); void setCurrentFormat( const QString& format ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); int currentDataRate(); private: KComboBox *cMode; QSlider *sQuality; QDoubleSpinBox *dQuality; KComboBox *cBitrateMode; QString currentFormat; // holds the current output file format int bitrateForQuality( double quality ); double qualityForBitrate( int bitrate ); private slots: void modeChanged( int mode ); void qualitySliderChanged( int quality ); void qualitySpinBoxChanged( double quality ); }; #endif // NEROAACCODECWIDGET_H./soundkonverter-2.1.2/plugins/soundkonverter_codec_neroaac/PaxHeaders.4329/soundkonverter_codec_ner0000644000000000000000000000013212076525023031033 xustar0030 mtime=1358604819.235806368 30 atime=1358604819.235806368 30 ctime=1418040695.159717232 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_neroaac/soundkonverter_codec_neroaac.h0000755000175000001440000000267412076525023033116 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTER_CODEC_NEROAAC_H #define SOUNDKONVERTER_CODEC_NEROAAC_H #include "../../core/codecplugin.h" class ConversionOptions; class soundkonverter_codec_neroaac : public CodecPlugin { Q_OBJECT public: /** Default Constructor */ soundkonverter_codec_neroaac( QObject *parent, const QStringList& args ); /** Default Destructor */ ~soundkonverter_codec_neroaac(); QString name(); QList codecTable(); bool isConfigSupported( ActionType action, const QString& codecName ); void showConfigDialog( ActionType action, const QString& codecName, QWidget *parent ); bool hasInfo(); void showInfo( QWidget *parent ); CodecWidget *newCodecWidget(); unsigned int convert( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); QStringList convertCommand( const KUrl& inputFile, const KUrl& outputFile, const QString& inputCodec, const QString& outputCodec, ConversionOptions *_conversionOptions, TagData *tags = 0, bool replayGain = false ); float parseOutput( const QString& output, int length ); float parseOutput( const QString& output ); private slots: /** Get the process' output */ void processOutput(); }; K_EXPORT_SOUNDKONVERTER_CODEC( neroaac, soundkonverter_codec_neroaac ) #endif // _SOUNDKONVERTER_CODEC_NEROAAC_H_ ./soundkonverter-2.1.2/plugins/soundkonverter_codec_neroaac/PaxHeaders.4329/neroaaccodecwidget.cpp0000644000000000000000000000013012276433700030335 xustar0029 mtime=1392129984.08510367 29 atime=1392129984.08510367 30 ctime=1418040695.159717232 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_neroaac/neroaaccodecwidget.cpp0000644000175000001440000002405712276433700031344 0ustar00danielusers00000000000000 #include "neroaaccodecglobal.h" #include "neroaaccodecwidget.h" #include "../../core/conversionoptions.h" #include #include #include #include #include #include #include #include #include #include NeroaacCodecWidget::NeroaacCodecWidget() : CodecWidget(), currentFormat( "m4a/aac" ) { const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); QGridLayout *grid = new QGridLayout( this ); grid->setContentsMargins( 0, 0, 0, 0 ); // set up encoding options selection QHBoxLayout *topBox = new QHBoxLayout(); grid->addLayout( topBox, 0, 0 ); QLabel *lMode = new QLabel( i18n("Mode:"), this ); topBox->addWidget( lMode ); cMode = new KComboBox( this ); cMode->addItem( i18n("Quality") ); cMode->addItem( i18n("Bitrate") ); connect( cMode, SIGNAL(activated(int)), this, SLOT(modeChanged(int)) ); connect( cMode, SIGNAL(activated(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( cMode ); sQuality = new QSlider( Qt::Horizontal, this ); // sQuality->setTickPosition( QSlider::TicksBelow ); // sQuality->setFixedWidth( sQuality->sizeHint().width() ); connect( sQuality, SIGNAL(valueChanged(int)), this, SLOT(qualitySliderChanged(int)) ); connect( sQuality, SIGNAL(valueChanged(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( sQuality ); dQuality = new QDoubleSpinBox( this ); dQuality->setRange( 8, 320 ); dQuality->setSuffix( " kbps" ); dQuality->setFixedWidth( dQuality->sizeHint().width() ); // dQuality->setFixedHeight( cMode->minimumSizeHint().height() ); connect( dQuality, SIGNAL(valueChanged(double)), this, SLOT(qualitySpinBoxChanged(double)) ); connect( dQuality, SIGNAL(valueChanged(double)), SIGNAL(optionsChanged()) ); topBox->addWidget( dQuality ); topBox->addSpacing( fontHeight ); QLabel *lBitrateMode = new QLabel( i18n("Bitrate mode:"), this ); topBox->addWidget( lBitrateMode ); cBitrateMode = new KComboBox( this ); cBitrateMode->addItem( i18n("Variable") ); cBitrateMode->addItem( i18n("Average") ); cBitrateMode->addItem( i18n("Constant") ); cBitrateMode->setFixedWidth( cBitrateMode->sizeHint().width() ); connect( cBitrateMode, SIGNAL(activated(int)), SIGNAL(optionsChanged()) ); topBox->addWidget( cBitrateMode ); topBox->addStretch(); grid->setRowStretch( 1, 1 ); modeChanged( 0 ); } NeroaacCodecWidget::~NeroaacCodecWidget() {} // TODO optimize int NeroaacCodecWidget::bitrateForQuality( double quality ) { return quality*100/3; } // TODO optimize double NeroaacCodecWidget::qualityForBitrate( int bitrate ) { return (double)bitrate*3/100; } ConversionOptions *NeroaacCodecWidget::currentConversionOptions() { ConversionOptions *options = new ConversionOptions(); if( cMode->currentText()==i18n("Quality") ) { options->qualityMode = ConversionOptions::Quality; options->quality = dQuality->value(); options->bitrate = bitrateForQuality( options->quality ); options->bitrateMode = ConversionOptions::Vbr; } else { options->qualityMode = ConversionOptions::Bitrate; options->bitrate = dQuality->value(); options->quality = qualityForBitrate( options->bitrate ); options->bitrateMode = ( cBitrateMode->currentText()==i18n("Average") ) ? ConversionOptions::Abr : ConversionOptions::Cbr; } return options; } bool NeroaacCodecWidget::setCurrentConversionOptions( ConversionOptions *_options ) { if( !_options || _options->pluginName != global_plugin_name ) return false; ConversionOptions *options = _options; if( options->qualityMode == ConversionOptions::Quality ) { cMode->setCurrentIndex( cMode->findText(i18n("Quality")) ); modeChanged( cMode->currentIndex() ); dQuality->setValue( options->quality ); cBitrateMode->setCurrentIndex( cBitrateMode->findText(i18n("Variable")) ); } else { cMode->setCurrentIndex( cMode->findText(i18n("Bitrate")) ); modeChanged( cMode->currentIndex() ); dQuality->setValue( options->bitrate ); if( options->bitrateMode == ConversionOptions::Abr ) cBitrateMode->setCurrentIndex( cBitrateMode->findText(i18n("Average")) ); else cBitrateMode->setCurrentIndex( cBitrateMode->findText(i18n("Constant")) ); } return true; } void NeroaacCodecWidget::setCurrentFormat( const QString& format ) { if( currentFormat == format ) return; currentFormat = format; setEnabled( currentFormat != "wav" ); } QString NeroaacCodecWidget::currentProfile() { if( currentFormat == "wav" ) { return i18n("Lossless"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 0.3 ) { return i18n("Very low"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 0.4 ) { return i18n("Low"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 0.5 ) { return i18n("Medium"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 0.6 ) { return i18n("High"); } else if( cMode->currentIndex() == 0 && dQuality->value() == 0.7 ) { return i18n("Very high"); } return i18n("User defined"); } bool NeroaacCodecWidget::setCurrentProfile( const QString& profile ) { if( profile == i18n("Very low") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 60 ); dQuality->setValue( 60 ); cBitrateMode->setCurrentIndex( 0 ); // chChannels->setChecked( true ); // chSamplerate->setChecked( true ); // cSamplerate->setCurrentIndex( 4 ); return true; } else if( profile == i18n("Low") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 80 ); dQuality->setValue( 80 ); cBitrateMode->setCurrentIndex( 0 ); // chChannels->setChecked( false ); // chSamplerate->setChecked( true ); // cSamplerate->setCurrentIndex( 4 ); return true; } else if( profile == i18n("Medium") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 100 ); dQuality->setValue( 100 ); cBitrateMode->setCurrentIndex( 0 ); // chChannels->setChecked( false ); // chSamplerate->setChecked( false ); return true; } else if( profile == i18n("High") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 120 ); dQuality->setValue( 120 ); cBitrateMode->setCurrentIndex( 0 ); // chChannels->setChecked( false ); // chSamplerate->setChecked( false ); return true; } else if( profile == i18n("Very high") ) { cMode->setCurrentIndex( 0 ); modeChanged( 0 ); sQuality->setValue( 140 ); dQuality->setValue( 140 ); cBitrateMode->setCurrentIndex( 0 ); // chChannels->setChecked( false ); // chSamplerate->setChecked( false ); return true; } return false; } int NeroaacCodecWidget::currentDataRate() { int dataRate; if( currentFormat == "wav" ) { dataRate = 10590000; } else { if( cMode->currentIndex() == 0 ) { dataRate = 500000 + dQuality->value()*150000; if( dQuality->value() > 7 ) dataRate += (dQuality->value()-7)*250000; if( dQuality->value() > 9 ) dataRate += (dQuality->value()-9)*800000; } else { dataRate = dQuality->value()/8*60*1000; } // if( chChannels->isChecked() ) // { // dataRate *= 0.9f; // } // if( chSamplerate->isChecked() && cSamplerate->currentText().replace(" Hz","").toInt() <= 22050 ) // { // dataRate *= 0.9f; // } } return dataRate; } void NeroaacCodecWidget::modeChanged( int mode ) { if( mode == 0 ) { sQuality->setRange( 0, 100 ); sQuality->setSingleStep( 5 ); dQuality->setRange( 0, 1 ); dQuality->setSingleStep( 0.01 ); dQuality->setDecimals( 2 ); dQuality->setSuffix( "" ); sQuality->setValue( 50 ); dQuality->setValue( 0.5 ); // dQuality->setValue( qualityForBitrate(dQuality->value()) ); // qualitySpinBoxChanged( dQuality->value() ); sQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", 0, 1) ); dQuality->setToolTip( i18n("Quality level from %1 to %2 where %2 is the highest quality.\nThe higher the quality, the bigger the file size and vice versa.", 0, 1) ); cBitrateMode->clear(); cBitrateMode->addItem( i18n("Variable") ); cBitrateMode->setEnabled( false ); } else { sQuality->setRange( 1600, 40000 ); sQuality->setSingleStep( 1600 ); dQuality->setRange( 16, 400 ); dQuality->setSingleStep( 1 ); dQuality->setDecimals( 0 ); dQuality->setSuffix( " kbps" ); sQuality->setValue( 16000 ); dQuality->setValue( 160 ); // dQuality->setValue( bitrateForQuality(dQuality->value()) ); // qualitySpinBoxChanged( dQuality->value() ); sQuality->setToolTip( "" ); dQuality->setToolTip( "" ); cBitrateMode->clear(); cBitrateMode->addItem( i18n("Average") ); cBitrateMode->addItem( i18n("Constant") ); cBitrateMode->setEnabled( true ); } } void NeroaacCodecWidget::qualitySliderChanged( int quality ) { dQuality->setValue( double(quality)/100 ); } void NeroaacCodecWidget::qualitySpinBoxChanged( double quality ) { sQuality->setValue( round(quality*100) ); } // void NeroaacCodecWidget::channelsToggled( bool enabled ) // { // cChannels->setEnabled( enabled ); // } // void NeroaacCodecWidget::samplerateToggled( bool enabled ) // { // cSamplerate->setEnabled( enabled ); // } ./soundkonverter-2.1.2/plugins/soundkonverter_codec_neroaac/PaxHeaders.4329/neroaaccodecglobal.h0000644000000000000000000000006211374527057027772 xustar0020 atime=1398102755 30 ctime=1418040695.159717232 ./soundkonverter-2.1.2/plugins/soundkonverter_codec_neroaac/neroaaccodecglobal.h0000644000175000001440000000011111374527057030756 0ustar00danielusers00000000000000 #ifndef global_plugin_name #define global_plugin_name "Nero AAC" #endif ./soundkonverter-2.1.2/PaxHeaders.4329/filelistitem.h0000644000000000000000000000013212441312442017257 xustar0030 mtime=1418040610.311840478 30 atime=1418040610.311840478 30 ctime=1418040695.113717307 ./soundkonverter-2.1.2/filelistitem.h0000644000175000001440000000524112441312442020256 0ustar00danielusers00000000000000 #ifndef FILELISTITEM_H #define FILELISTITEM_H #include "metadata/tagengine.h" #include #include #include #include #include /** @author Daniel Faust */ class FileListItem : public QTreeWidgetItem { public: enum State { WaitingForConversion, Ripping, Converting, ApplyingReplayGain, WaitingForAlbumGain, ApplyingAlbumGain, Stopped }; // code values will be displayed in the log files enum ReturnCode { Succeeded = 0, SucceededWithProblems = 1, StoppedByUser = 2, Skipped = 3, BackendNeedsConfiguration = 4, DiscFull = 5, Failed = 6 }; FileListItem( QTreeWidget *parent ); FileListItem( QTreeWidget *parent, QTreeWidgetItem *after ); ~FileListItem(); int conversionOptionsId; TagData *tags; // we need to instruct the tagengine to read the tags from the file! // and the user can change them! KUrl url; // the original input file path name // KUrl outputUrl; // if the user wants to change the output directory/file name per file QString codecName; // the codec name of the input file State state; // is this item being converted or ripper or etc. ReturnCode returnCode; // what's the return code of the conversion bool local; // is this a local file? int track; // the number of the track, if it is on an audio cd // if it is lower than 0, it isn't an audio cd track at all int tracks; // the total amount of tracks on the cd QString device; // the device of the audio cd float length; // the length of the track, used for the calculation of the progress bar QString notifyCommand; // execute this command, when the file is converted (%i=input file, %o=output file) int logId; // the id the item is registered at the logger with, 0 if the conversion hasn't started yet QWeakPointer lInfo; // a pointer to button to show additional information (e.g. error log). if no butotn shall be shown the pointer must be 0 }; class FileListItemDelegate : public QItemDelegate { public: FileListItemDelegate( QObject *parent = 0 ); virtual void paint( QPainter *painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const; }; #endif ./soundkonverter-2.1.2/PaxHeaders.4329/soundkonverterview.h0000644000000000000000000000013212076525023020555 xustar0030 mtime=1358604819.267806456 30 atime=1358604819.267806456 30 ctime=1418040695.107717316 ./soundkonverter-2.1.2/soundkonverterview.h0000755000175000001440000000636012076525023021562 0ustar00danielusers00000000000000/* * soundkonverterview.h * * Copyright (C) 2007 Daniel Faust */ #ifndef _SOUNDKONVERTERVIEW_H_ #define _SOUNDKONVERTERVIEW_H_ #include #include class KPushButton; class QMenu; class KAction; class KActionMenu; class QToolButton; class ProgressIndicator; class ComboButton; class Config; class Logger; class CDManager; class FileList; class OptionsLayer; // class QPainter; // class KUrl; /** * This is the main view class for soundKonverter. Most of the non-menu, * non-toolbar, and non-statusbar (e.g., non frame) GUI code should go * here. * * @short Main view * @author Daniel Faust * @version 1.0 */ class soundKonverterView : public QWidget { Q_OBJECT public: /** Default constructor */ soundKonverterView( Logger *_logger, Config *_config, CDManager *_cdManager, QWidget *parent ); /** Destructor */ ~soundKonverterView(); void addConvertFiles( const KUrl::List& urls, QString _profile, QString _format, const QString& directory, const QString& notifyCommand = "" ); void loadAutosaveFileList(); KAction *start() { return startAction; } KActionMenu *stopMenu() { return stopActionMenu; } void startConversion(); void killConversion(); signals: /** Use this signal to change the content of the statusbar */ // void signalChangeStatusbar(const QString& text); /** Use this signal to change the content of the caption */ // void signalChangeCaption( const QString& text ); public slots: bool showCdDialog( const QString& device = "", QString _profile = "", QString _format = "", const QString& directory = "", const QString& notifyCommand = "" ); void loadFileList( bool user = true ); void saveFileList( bool user = true ); void updateFileList(); private slots: void addClicked( int index ); void showFileDialog(); void showDirDialog(); void showUrlDialog(); void showPlaylistDialog(); // connected to fileList /** The count of items in the file list has changed to @p count */ void fileCountChanged( int count ); /** The conversion has started */ void conversionStarted(); /** The conversion has stopped */ void conversionStopped( bool failed ); /** Conversion will continue/stop after current files have been converted */ void queueModeChanged( bool enabled ); private: Config *config; Logger *logger; CDManager *cdManager; FileList *fileList; OptionsLayer *optionsLayer; /** The combobutton for adding files */ ComboButton *cAdd; /** The button to start the conversion */ KPushButton *pStart; /** Tha start action */ KAction *startAction; /** The button to stop the conversion */ KPushButton *pStop; /** The menu for the stop button */ KActionMenu *stopActionMenu; KAction *killAction; KAction *stopAction; KAction *continueAction; /** Displays the current progress */ ProgressIndicator *progressIndicator; void cleanupParameters( QString *profile, QString *format ); signals: void progressChanged( const QString& progress ); void signalConversionStarted(); void signalConversionStopped( bool failed ); void showLog( const int logId ); }; #endif // _soundKonverterVIEW_H_ ./soundkonverter-2.1.2/PaxHeaders.4329/options.h0000644000000000000000000000013212076525023016265 xustar0030 mtime=1358604819.218806322 30 atime=1358604819.218806322 30 ctime=1418040695.112717309 ./soundkonverter-2.1.2/options.h0000755000175000001440000000305412076525023017267 0ustar00danielusers00000000000000 #ifndef OPTIONS_H #define OPTIONS_H #include class OptionsSimple; class OptionsDetailed; class Config; class ConversionOptions; class KTabWidget; /** * @short The widget, where we can set our output options * @author Daniel Faust * @version 0.3 */ class Options : public QWidget { Q_OBJECT public: /** Constructor */ Options( Config *_config, const QString& text, QWidget *parent=0 ); /** Destructor */ ~Options(); /** Return the current options */ ConversionOptions *currentConversionOptions(); /** Set the current options */ bool setCurrentConversionOptions( ConversionOptions* optionsptions ); public slots: /** Set the current profile */ void setProfile( const QString& profile ); /** Set the current format */ void setFormat( const QString& format ); /** Set the current output directory mode */ void setOutputDirectoryMode( int mode ); /** Set the current output directory */ void setOutputDirectory( const QString& directory ); /** Should be called if the conversion options have been accepted by the user */ void accepted(); private: Config *config; KTabWidget *tab; OptionsSimple *optionsSimple; OptionsDetailed *optionsDetailed; private slots: void tabChanged( const int pageIndex ); void simpleOutputDirectoryModeChanged(const int mode); void simpleOutputDirectoryChanged(const QString&); void simpleOptionsChanged(); void detailedOutputDirectoryModeChanged(const int mode); }; #endif // OPTIONS_H ./soundkonverter-2.1.2/PaxHeaders.4329/aboutplugins.h0000644000000000000000000000013212076525023017306 xustar0030 mtime=1358604819.201806279 30 atime=1358604819.201806279 30 ctime=1418040695.112717309 ./soundkonverter-2.1.2/aboutplugins.h0000644000175000001440000000152012076525023020301 0ustar00danielusers00000000000000 #ifndef ABOUTPLUGINS_H #define ABOUTPLUGINS_H #include class Config; class BackendPlugin; class QLabel; class KPushButton; /** * @short Shows the logs that are collected by the logger * @author Daniel Faust * @version 1.0 */ class AboutPlugins : public KDialog { Q_OBJECT public: /** Default Constructor */ AboutPlugins( Config *_config, QWidget *parent=0, Qt::WFlags f=0 ); /** Default Destructor */ ~AboutPlugins(); private: Config *config; BackendPlugin *currentPlugin; QLabel *aboutPluginLabel; KPushButton *configurePlugin; QMap problemInfos; private slots: void currentPluginChanged( const QString& pluginName ); void configurePluginClicked(); void showProblemInfo( const QString& problemId ); }; #endif // ABOUTPLUGINS_H ./soundkonverter-2.1.2/PaxHeaders.4329/soundkonverter.h0000644000000000000000000000013212172311620017653 xustar0030 mtime=1374262160.525727491 30 atime=1374262160.525727491 30 ctime=1418040695.107717316 ./soundkonverter-2.1.2/soundkonverter.h0000755000175000001440000000442212172311620020655 0ustar00danielusers00000000000000/* * soundkonverter.h * * Copyright (C) 2007 Daniel Faust */ #ifndef SOUNDKONVERTER_H #define SOUNDKONVERTER_H #include #include #include class soundKonverterView; class KToggleAction; class KUrl; class Config; class Logger; class LogViewer; class CDManager; class ReplayGainScanner; #if KDE_IS_VERSION(4,4,0) class KStatusNotifierItem; #else class KSystemTrayIcon; #endif /** * This class serves as the main window for soundKonverter. It handles the * menus, toolbars, and status bars. * * @short Main window class * @author Daniel Faust * @version 1.0 */ class soundKonverter : public KXmlGuiWindow { Q_OBJECT public: /** Default Constructor */ soundKonverter(); /** Default Destructor */ ~soundKonverter(); virtual void saveProperties( KConfigGroup& configGroup ); void showSystemTray(); void addConvertFiles( const KUrl::List& urls, const QString& profile, const QString& format, const QString& directory, const QString& notifyCommand ); void addReplayGainFiles( const KUrl::List& urls ); bool ripCd( const QString& device, const QString& profile, const QString& format, const QString& directory, const QString& notifyCommand ); void setAutoClose( bool enabled ) { autoclose = enabled; } void startConversion(); void loadAutosaveFileList(); void startupChecks(); private slots: void showConfigDialog(); void showLogViewer( const int logId = 0 ); void showReplayGainScanner(); void replayGainScannerClosed(); void showMainWindow(); void showAboutPlugins(); void progressChanged( const QString& progress ); /** The conversion has started */ void conversionStarted(); /** The conversion has stopped */ void conversionStopped( bool failed ); private: Config *config; Logger *logger; CDManager *cdManager; QWeakPointer replayGainScanner; soundKonverterView *m_view; LogViewer *logViewer; #if KDE_IS_VERSION(4,4,0) KStatusNotifierItem *systemTray; #else KSystemTrayIcon *systemTray; #endif /// exit soundkonverter after all files have been converted bool autoclose; void setupActions(); }; #endif // _SOUNDKONVERTER_H_ ./soundkonverter-2.1.2/PaxHeaders.4329/soundkonverter_filterplugin.desktop0000644000000000000000000000013212076525023023670 xustar0030 mtime=1358604819.266806454 30 atime=1358604819.265806451 30 ctime=1418040695.112717309 ./soundkonverter-2.1.2/soundkonverter_filterplugin.desktop0000644000175000001440000000021612076525023024664 0ustar00danielusers00000000000000[Desktop Entry] Type=ServiceType X-KDE-ServiceType=soundKonverter/FilterPlugin X-KDE-Derived=KPluginInfo Comment=soundKonverter filter plugin ./soundkonverter-2.1.2/PaxHeaders.4329/opener0000644000000000000000000000012012431665352015636 xustar0030 mtime=1416063722.366892884 20 atime=1358274329 30 ctime=1418040695.115717304 ./soundkonverter-2.1.2/opener/0000755000175000001440000000000012431665352016713 5ustar00danielusers00000000000000./soundkonverter-2.1.2/opener/PaxHeaders.4329/diropener.h0000644000000000000000000000013212076525023020051 xustar0030 mtime=1358604819.217806319 30 atime=1358604819.217806319 30 ctime=1418040695.115717304 ./soundkonverter-2.1.2/opener/diropener.h0000755000175000001440000000302212076525023021046 0ustar00danielusers00000000000000 #ifndef DIRDIALOG_H #define DIRDIALOG_H #include class Config; class Options; class ConversionOptions; class QLabel; class QCheckBox; class KPushButton; class KUrlRequester; class KListWidget; /** * @short The Dir Opener * @author Daniel Faust * @version 0.3 */ class DirOpener : public KDialog { Q_OBJECT public: enum DialogPage { DirOpenPage, ConversionOptionsPage }; enum Mode { Convert = 0x0001, ReplayGain = 0x0002 }; /** Constructor */ DirOpener( Config *config, Mode _mode, QWidget *parent=0, Qt::WFlags f=0 ); /** Destructor */ ~DirOpener(); /** true if the file dialog was aborted (don't execute the dialog) */ bool dialogAborted; private slots: void proceedClicked(); void addClicked(); void selectAllClicked(); void selectNoneClicked(); void showHelp(); private: /** config pointer */ Config *config; /** the widget for selecting the directory */ QWidget *dirOpenerWidget; /** the conversion options editor widget */ Options *options; /** the current page */ DialogPage page; /** the dialog mode */ Mode mode; QLabel *lSelector; QLabel *lOptions; KUrlRequester *uDirectory; KListWidget *fileTypes; KPushButton *pSelectAll; KPushButton *pSelectNone; QCheckBox *cRecursive; signals: void open( const KUrl& directory, bool recursive, const QStringList& codecList, ConversionOptions *conversionOptions = 0 ); }; #endif ./soundkonverter-2.1.2/opener/PaxHeaders.4329/playlistopener.h0000644000000000000000000000006212054666405021144 xustar0020 atime=1353936133 30 ctime=1418040695.115717304 ./soundkonverter-2.1.2/opener/playlistopener.h0000644000175000001440000000203512054666405022137 0ustar00danielusers00000000000000// // C++ Interface: opener // // Description: // // // Author: Daniel Faust , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef PLAYLISTOPENER_H #define PLAYLISTOPENER_H #include #include class Config; class Options; class QLabel; class ConversionOptions; class KDialog; class KPushButton; class KFileDialog; /** @author Daniel Faust */ class PlaylistOpener : public KDialog { Q_OBJECT public: PlaylistOpener( Config *_config, QWidget *parent=0, Qt::WFlags f=0 ); ~PlaylistOpener(); /** true if the file dialog was aborted (don't execute the dialog) */ bool dialogAborted; private: Config *config; KFileDialog *fileDialog; Options *options; KUrl::List urls; KPushButton *pAdd; KPushButton *pCancel; QLabel *formatHelp; private slots: void fileDialogAccepted(); void okClickedSlot(); signals: void open( const KUrl::List& files, ConversionOptions *conversionOptions ); }; #endif ./soundkonverter-2.1.2/opener/PaxHeaders.4329/cdopener.h0000644000000000000000000000013012276172537017671 xustar0029 mtime=1392047455.52709251 29 atime=1392047455.52709251 30 ctime=1418040695.115717304 ./soundkonverter-2.1.2/opener/cdopener.h0000755000175000001440000001624512276172537020703 0ustar00danielusers00000000000000 #ifndef CDOPENER_H #define CDOPENER_H #include #include #include #include #include extern "C" { #include #include } #include #include #include #include #include #include class TagEngine; class Config; class Options; class ConversionOptions; class QTreeWidget; class KPushButton; class KLineEdit; class KComboBox; class KIntSpinBox; class KTextEdit; class QGroupBox; class QTreeWidgetItem; class QLabel; class QCheckBox; class TagData; class PlayerWidget : public QWidget { Q_OBJECT public: PlayerWidget( Phonon::MediaObject *mediaObject, int _track, QTreeWidgetItem *_treeWidgetItem, QWidget *parent = 0, Qt::WindowFlags f = 0 ); ~PlayerWidget(); void trackChanged( int track ); bool isPlaying() { return playing; } QTreeWidgetItem *treeWidgetItem() { return m_treeWidgetItem; } private: int track; bool playing; QTreeWidgetItem *m_treeWidgetItem; KPushButton *pStartPlayback; KPushButton *pStopPlayback; Phonon::SeekSlider *seekSlider; private slots: void startPlaybackClicked(); void stopPlaybackClicked(); signals: void startPlayback( int track ); void stopPlayback(); }; /** * @short Shows a dialog for selecting files from a CD * @author Daniel Faust * @version 1.0 */ class CDOpener : public KDialog { Q_OBJECT public: enum DialogPage { CdOpenPage, ConversionOptionsPage }; enum Columns { Column_Rip = 0, Column_Track = 1, Column_Artist = 2, Column_Composer = 3, Column_Title = 4, Column_Length = 5, Column_Player = 6 }; /** Constructor */ CDOpener( Config *_config, const QString& _device, QWidget *parent = 0, Qt::WFlags f=0 ); /** Destructor */ ~CDOpener(); /** true if no CD was found (don't execute the dialog) */ bool noCdFound; public slots: /** Set the current profile */ void setProfile( const QString& profile ); /** Set the current format */ void setFormat( const QString& format ); /** Set the current output directory */ void setOutputDirectory( const QString& directory ); /** Set the command to execute after the conversion is complete */ void setCommand( const QString& _command ); private: /** returns a list of devices holding audio cds plus a short description (track count) */ QMap cdDevices(); bool openCdDevice( const QString& _device ); int cdda_audio_tracks( cdrom_drive *cdDrive ) const; /** the widget for selecting and editing the cd tracks */ QWidget *cdOpenerWidget; /** the widget for showing the progress of reading the cd / cddb data */ QWidget *cdOpenerOverlayWidget; /** the conversion options editor widget */ Options *options; /** the current page */ DialogPage page; QLabel *lSelector; QLabel *lOptions; /** A list of all tracks on the CD */ QTreeWidget *trackList; /** A combobox for entering the artist or selecting VA of the whole CD */ KLineEdit *lArtist; /** A lineedit for entering the album name */ KLineEdit *lAlbum; /** A spinbox for entering or selecting the disc number */ KIntSpinBox *iDisc; /** A spinbox for entering or selecting the total disc number */ KIntSpinBox *iDiscTotal; /** A spinbox for entering or selecting the year of the album */ KIntSpinBox *iYear; /** A combobox for entering or selecting the genre of the album */ KComboBox *cGenre; /** The groupbox shows the selected track numbers */ QGroupBox *tagGroupBox; /** Set the focus of the tag editor to the track over it */ KPushButton *pTrackUp; /** Set the focus of the tag editor to the track under it */ KPushButton *pTrackDown; /** A lineedit for entering the title of track */ KLineEdit *lTrackTitle; KPushButton *pTrackTitleEdit; /** A lineedit for entering the artist of a track */ KLineEdit *lTrackArtist; KPushButton *pTrackArtistEdit; /** A lineedit for entering the composer of a track */ KLineEdit *lTrackComposer; KPushButton *pTrackComposerEdit; /** A textedit for entering a comment for a track */ KTextEdit *tTrackComment; KPushButton *pTrackCommentEdit; Phonon::AudioOutput *audioOutput; Phonon::MediaObject *mediaObject; Phonon::MediaController *mediaController; Phonon::MediaSource *mediaSource; QList playerWidgets; /** Save the tag information to a cue file */ KPushButton *pSaveCue; /** Request CDDB information */ KPushButton *pCDDB; /** Rip enitre CD as one track */ QCheckBox *cEntireCd; /** Add selected tracks to the file list and quit the dialog */ KPushButton *pAdd; /** proceed to select conversion options */ KPushButton *pProceed; /** Quit the dialog */ KPushButton *pCancel; Config *config; QString device; cdrom_drive *cdDrive; cdrom_paranoia *cdParanoia; // void *wmHandle; KCDDB::Client *cddb; QList tags; // @0 disc tags bool cdTextFound; bool cddbFound; QString lastAlbumArtist; QTimer timeoutTimer; QList selectedTracks; /** Show the progress of reading the cd / cddb data */ QLabel *lOverlayLabel; QTimer fadeTimer; float fadeAlpha; int fadeMode; // 1 = fade in, 2 = fade out QString command; inline QBrush brushSetAlpha( QBrush brush, const int alpha ) { QColor color = brush.color(); color.setAlpha( alpha ); brush.setColor( color ); return brush; } void fadeIn(); void fadeOut(); void adjustArtistColumn(); void adjustComposerColumn(); private slots: void requestCddb( bool autoRequest = false ); void lookup_cddb_done( KCDDB::Result result ); void timeout(); void trackChanged(); void trackUpPressed(); void trackDownPressed(); void artistChanged( const QString& text ); void trackTitleChanged( const QString& text ); void trackArtistChanged( const QString& text ); void trackComposerChanged( const QString& text ); void trackCommentChanged(); void editTrackTitleClicked(); void editTrackArtistClicked(); void editTrackComposerClicked(); void editTrackCommentClicked(); // void itemHighlighted( QTreeWidgetItem *item, int column ); void startPlayback( int track ); void stopPlayback(); void playbackTitleChanged( int title ); void playbackStateChanged( Phonon::State newstate, Phonon::State oldstate ); void proceedClicked(); void addClicked(); // void addAsOneTrackClicked(); void saveCuesheetClicked(); void fadeAnim(); signals: void addTracks( const QString& device, QList trackList, int tracks, QList tagList, ConversionOptions *conversionOptions, const QString& command ); void addDisc( const QString& device, ConversionOptions *conversionOptions ); //void openCuesheetEditor( const QString& content ); }; #endif // CDOPENER_H ./soundkonverter-2.1.2/opener/PaxHeaders.4329/fileopener.h0000644000000000000000000000006212054666405020222 xustar0020 atime=1353936133 30 ctime=1418040695.115717304 ./soundkonverter-2.1.2/opener/fileopener.h0000644000175000001440000000203612054666405021216 0ustar00danielusers00000000000000// // C++ Interface: opener // // Description: // // // Author: Daniel Faust , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef FILEOPENER_H #define FILEOPENER_H #include #include class Config; class Options; class QLabel; class ConversionOptions; class KDialog; class KPushButton; class KFileDialog; /** @author Daniel Faust */ class FileOpener : public KDialog { Q_OBJECT public: FileOpener( Config *_config, QWidget *parent=0, Qt::WFlags f=0 ); ~FileOpener(); /** true if the file dialog was aborted (don't execute the dialog) */ bool dialogAborted; private: Config *config; KFileDialog *fileDialog; Options *options; KUrl::List urls; KPushButton *pAdd; KPushButton *pCancel; QLabel *formatHelp; private slots: void fileDialogAccepted(); void okClickedSlot(); void showHelp(); signals: void open( const KUrl::List& files, ConversionOptions *conversionOptions ); }; #endif ./soundkonverter-2.1.2/opener/PaxHeaders.4329/fileopener.cpp0000644000000000000000000000013212276440204020544 xustar0030 mtime=1392132228.539615461 30 atime=1392132228.539615461 30 ctime=1418040695.115717304 ./soundkonverter-2.1.2/opener/fileopener.cpp0000644000175000001440000001776512276440204021561 0ustar00danielusers00000000000000// // C++ Implementation: opener // // Description: // // // Author: Daniel Faust , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "fileopener.h" #include "../options.h" #include "../config.h" #include "../codecproblems.h" #include #include #include #include #include #include #include #include #include FileOpener::FileOpener( Config *_config, QWidget *parent, Qt::WFlags f ) : KDialog( parent, f ), dialogAborted( false ), config( _config ) { setCaption( i18n("Add Files") ); setWindowIcon( KIcon("audio-x-generic") ); setButtons( 0 ); const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); QWidget *widget = new QWidget(); setMainWidget( widget ); QGridLayout *mainGrid = new QGridLayout( widget ); QStringList filterList; QStringList allFilter; const QStringList formats = config->pluginLoader()->formatList( PluginLoader::Decode, PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy|PluginLoader::Lossless|PluginLoader::Hybrid) ); foreach( QString format, formats ) { QString extensionFilter = config->pluginLoader()->codecExtensions(format).join(" *."); if( extensionFilter.length() == 0 ) continue; extensionFilter = "*." + extensionFilter; allFilter += extensionFilter; filterList += extensionFilter + "|" + i18n("%1 files",format.replace("/","\\/")); } filterList.prepend( allFilter.join(" ") + "|" + i18n("All supported files") ); filterList += "*.*|" + i18n("All files"); options = new Options( config, i18n("Select your desired output options and click on \"Ok\"."), widget ); mainGrid->addWidget( options, 1, 0 ); // add a horizontal box layout for the control elements QHBoxLayout *controlBox = new QHBoxLayout(); mainGrid->addLayout( controlBox, 2, 0 ); controlBox->addStretch(); pAdd = new KPushButton( KIcon("dialog-ok"), i18n("Ok"), widget ); controlBox->addWidget( pAdd ); connect( pAdd, SIGNAL(clicked()), this, SLOT(okClickedSlot()) ); pCancel = new KPushButton( KIcon("dialog-cancel"), i18n("Cancel"), widget ); controlBox->addWidget( pCancel ); connect( pCancel, SIGNAL(clicked()), this, SLOT(reject()) ); // add the control elements formatHelp = new QLabel( "" + i18n("Are you missing some file formats?") + "", widget ); connect( formatHelp, SIGNAL(linkActivated(const QString&)), this, SLOT(showHelp()) ); fileDialog = new KFileDialog( KUrl("kfiledialog:///soundkonverter-add-media"), filterList.join("\n"), this, formatHelp ); fileDialog->setWindowTitle( i18n("Add Files") ); fileDialog->setMode( KFile::Files | KFile::ExistingOnly ); connect( fileDialog, SIGNAL(accepted()), this, SLOT(fileDialogAccepted()) ); connect( fileDialog, SIGNAL(rejected()), this, SLOT(reject()) ); const int dialogReturnCode = fileDialog->exec(); if( dialogReturnCode == QDialog::Rejected ) dialogAborted = true; // Prevent the dialog from beeing too wide because of the directory history if( parent && width() > parent->width() ) setInitialSize( QSize(parent->width()-fontHeight,sizeHint().height()) ); KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group = conf->group( "FileOpener" ); restoreDialogSize( group ); } FileOpener::~FileOpener() { KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group = conf->group( "FileOpener" ); saveDialogSize( group ); } void FileOpener::fileDialogAccepted() { QStringList errorList; // codec @0 files @1 solutions QMap< QString, QList > problems; QString fileName; urls.clear(); urls = fileDialog->selectedUrls(); const bool canDecodeAac = config->pluginLoader()->canDecode( "m4a/aac" ); const bool canDecodeAlac = config->pluginLoader()->canDecode( "m4a/alac" ); const bool checkM4a = ( !canDecodeAac || !canDecodeAlac ) && canDecodeAac != canDecodeAlac; for( int i=0; ipluginLoader()->getCodecFromFile( urls.at(i), &mimeType, checkM4a ); if( !config->pluginLoader()->canDecode(codecName,&errorList) ) { fileName = urls.at(i).pathOrUrl(); if( codecName.isEmpty() ) codecName = mimeType; if( codecName.isEmpty() ) codecName = fileName.right(fileName.length()-fileName.lastIndexOf(".")-1); if( problems.value(codecName).count() < 2 ) { problems[codecName] += QStringList(); problems[codecName] += QStringList(); } problems[codecName][0] += fileName; if( !errorList.isEmpty() ) { problems[codecName][1] += errorList; } else { problems[codecName][1] += i18n("This file type is unknown to soundKonverter.\nMaybe you need to install an additional soundKonverter plugin.\nYou should have a look at your distribution's package manager for this."); } urls.removeAt(i); i--; } } QList problemList; for( int i=0; i= 0x040500 problems[problem.codecName][1].removeDuplicates(); #else QStringList found; for( int j=0; j 0 ) { CodecProblems *problemsDialog = new CodecProblems( CodecProblems::Decode, problemList, this ); problemsDialog->exec(); } if( urls.count() <= 0 ) reject(); } void FileOpener::okClickedSlot() { ConversionOptions *conversionOptions = options->currentConversionOptions(); if( conversionOptions ) { options->accepted(); emit open( urls, conversionOptions ); accept(); } else { KMessageBox::error( this, i18n("No conversion options selected.") ); } } void FileOpener::showHelp() { QList problemList; QMap problems = config->pluginLoader()->decodeProblems(); for( int i=0; iexec(); } ./soundkonverter-2.1.2/opener/PaxHeaders.4329/diropener.cpp0000644000000000000000000000013212276440204020403 xustar0030 mtime=1392132228.583615623 30 atime=1392132228.583615623 30 ctime=1418040695.115717304 ./soundkonverter-2.1.2/opener/diropener.cpp0000755000175000001440000002024412276440204021405 0ustar00danielusers00000000000000 #include "diropener.h" #include "../config.h" #include "../options.h" #include "../codecproblems.h" #include #include #include #include #include #include #include #include #include #include #include #include #include DirOpener::DirOpener( Config *_config, Mode _mode, QWidget *parent, Qt::WFlags f ) : KDialog( parent, f ), dialogAborted( false ), config( _config ), mode( _mode ) { setCaption( i18n("Add folder") ); setWindowIcon( KIcon("folder") ); if( mode == Convert ) { setButtons( KDialog::User1 | KDialog::Cancel ); } else if( mode == ReplayGain ) { setButtons( KDialog::Ok | KDialog::Cancel ); } setButtonText( KDialog::User1, i18n("Proceed") ); setButtonIcon( KDialog::User1, KIcon("go-next") ); const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); connect( this, SIGNAL(user1Clicked()), this, SLOT(proceedClicked()) ); connect( this, SIGNAL(okClicked()), this, SLOT(addClicked()) ); page = DirOpenPage; QWidget *widget = new QWidget(); QGridLayout *mainGrid = new QGridLayout( widget ); QGridLayout *topGrid = new QGridLayout(); mainGrid->addLayout( topGrid, 0, 0 ); setMainWidget( widget ); lSelector = new QLabel( i18n("1. Select directory"), widget ); QFont font; font.setBold( true ); lSelector->setFont( font ); topGrid->addWidget( lSelector, 0, 0 ); lOptions = new QLabel( i18n("2. Set conversion options"), widget ); topGrid->addWidget( lOptions, 0, 1 ); // draw a horizontal line QFrame *lineFrame = new QFrame( widget ); lineFrame->setFrameShape( QFrame::HLine ); lineFrame->setFrameShadow( QFrame::Sunken ); mainGrid->addWidget( lineFrame, 1, 0 ); if( mode == ReplayGain ) { lSelector->hide(); lOptions->hide(); lineFrame->hide(); } // Dir Opener Widget dirOpenerWidget = new QWidget( widget ); mainGrid->addWidget( dirOpenerWidget, 2, 0 ); QVBoxLayout *box = new QVBoxLayout( dirOpenerWidget ); QHBoxLayout *directoryBox = new QHBoxLayout(); box->addLayout( directoryBox ); QLabel *labelFilter = new QLabel( i18n("Directory:"), dirOpenerWidget ); directoryBox->addWidget( labelFilter ); uDirectory = new KUrlRequester( KUrl("kfiledialog:///soundkonverter-add-media"), dirOpenerWidget ); uDirectory->setMode( KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly ); directoryBox->addWidget( uDirectory ); QLabel *labelDirectory = new QLabel( i18n("Only add selected file formats:"), dirOpenerWidget ); box->addWidget( labelDirectory ); QHBoxLayout *fileTypesBox = new QHBoxLayout(); box->addLayout( fileTypesBox ); QStringList codecList; fileTypes = new KListWidget( dirOpenerWidget ); if( mode == Convert ) { codecList = config->pluginLoader()->formatList( PluginLoader::Decode, PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy|PluginLoader::Lossless|PluginLoader::Hybrid) ); } else if( mode == ReplayGain ) { codecList = config->pluginLoader()->formatList( PluginLoader::ReplayGain, PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy|PluginLoader::Lossless|PluginLoader::Hybrid) ); } for( int i = 0; i < codecList.size(); i++ ) { if( codecList.at(i) == "audio cd" ) continue; QListWidgetItem *newItem = new QListWidgetItem( codecList.at(i), fileTypes ); newItem->setFlags( Qt::ItemIsEnabled | Qt::ItemIsUserCheckable ); newItem->setCheckState( Qt::Checked ); } QVBoxLayout *fileTypesFormatsBox = new QVBoxLayout(); fileTypesBox->addLayout( fileTypesFormatsBox ); fileTypesFormatsBox->addWidget( fileTypes ); QLabel *formatHelp = new QLabel( "" + i18n("Are you missing some file formats?") + "", this ); connect( formatHelp, SIGNAL(linkActivated(const QString&)), this, SLOT(showHelp()) ); fileTypesFormatsBox->addWidget( formatHelp ); QVBoxLayout *fileTypesButtonsBox = new QVBoxLayout(); fileTypesBox->addLayout( fileTypesButtonsBox ); fileTypesButtonsBox->addStretch(); pSelectAll = new KPushButton( KIcon("edit-select-all"), i18n("Select all"), dirOpenerWidget ); fileTypesButtonsBox->addWidget( pSelectAll ); connect( pSelectAll, SIGNAL(clicked()), this, SLOT(selectAllClicked()) ); pSelectNone = new KPushButton( KIcon("application-x-zerosize"), i18n("Select none"), dirOpenerWidget ); fileTypesButtonsBox->addWidget( pSelectNone ); connect( pSelectNone, SIGNAL(clicked()), this, SLOT(selectNoneClicked()) ); cRecursive = new QCheckBox( i18n("Recursive"), dirOpenerWidget ); cRecursive->setChecked( true ); cRecursive->setToolTip( i18n("If checked, files from subdirectories will be added, too.") ); fileTypesButtonsBox->addWidget( cRecursive ); fileTypesButtonsBox->addStretch(); // Conversion Options Widget options = new Options( config, i18n("Select your desired output options and click on \"Ok\"."), widget ); mainGrid->addWidget( options, 2, 0 ); adjustSize(); options->hide(); const KUrl url = KFileDialog::getExistingDirectoryUrl( uDirectory->url(), this ); if( !url.isEmpty() ) uDirectory->setUrl( url ); else dialogAborted = true; // Prevent the dialog from beeing too wide because of the directory history if( parent && width() > parent->width() ) setInitialSize( QSize(parent->width()-fontHeight,sizeHint().height()) ); KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group = conf->group( "DirOpener" ); restoreDialogSize( group ); } DirOpener::~DirOpener() { KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group = conf->group( "DirOpener" ); saveDialogSize( group ); } void DirOpener::proceedClicked() { if( page == DirOpenPage ) { dirOpenerWidget->hide(); options->show(); page = ConversionOptionsPage; QFont font; font.setBold( false ); lSelector->setFont( font ); font.setBold( true ); lOptions->setFont( font ); setButtons( KDialog::Ok | KDialog::Cancel ); } } void DirOpener::addClicked() { QStringList selectedCodecs; for( int i = 0; i < fileTypes->count(); i++ ) { if( fileTypes->item(i)->checkState() == Qt::Checked ) selectedCodecs += fileTypes->item(i)->text(); } if( mode == Convert ) { ConversionOptions *conversionOptions = options->currentConversionOptions(); if( conversionOptions ) { hide(); options->accepted(); emit open( uDirectory->url(), cRecursive->checkState() == Qt::Checked, selectedCodecs, conversionOptions ); accept(); } else { KMessageBox::error( this, i18n("No conversion options selected.") ); } } else if( mode == ReplayGain ) { hide(); emit open( uDirectory->url(), cRecursive->checkState() == Qt::Checked, selectedCodecs ); accept(); } } void DirOpener::selectAllClicked() { for( int i = 0; i < fileTypes->count(); i++ ) { fileTypes->item(i)->setCheckState( Qt::Checked ); } } void DirOpener::selectNoneClicked() { for( int i = 0; i < fileTypes->count(); i++ ) { fileTypes->item(i)->setCheckState( Qt::Unchecked ); } } void DirOpener::showHelp() { QList problemList; QMap problems = ( mode == Convert ) ? config->pluginLoader()->decodeProblems() : config->pluginLoader()->replaygainProblems(); for( int i=0; iexec(); } ./soundkonverter-2.1.2/opener/PaxHeaders.4329/cdopener.cpp0000644000000000000000000000013212300371215020204 xustar0030 mtime=1392636557.709273288 30 atime=1392636557.709273288 30 ctime=1418040695.115717304 ./soundkonverter-2.1.2/opener/cdopener.cpp0000755000175000001440000013142612300371215021213 0ustar00danielusers00000000000000 #include "cdopener.h" #include "../metadata/tagengine.h" #include "../config.h" #include "../options.h" #include "../outputdirectory.h" #include "../global.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include PlayerWidget::PlayerWidget( Phonon::MediaObject *mediaObject, int _track, QTreeWidgetItem *_treeWidgetItem, QWidget *parent, Qt::WindowFlags f ) : QWidget( parent, f ), track( _track ), m_treeWidgetItem( _treeWidgetItem ) { const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); QHBoxLayout *trackPlayerBox = new QHBoxLayout(); setLayout( trackPlayerBox ); pStartPlayback = new KPushButton( KIcon("media-playback-start"), "", this ); pStartPlayback->setFixedSize( 1.5*fontHeight, 1.5*fontHeight ); trackPlayerBox->addWidget( pStartPlayback ); connect( pStartPlayback, SIGNAL(clicked()), this, SLOT(startPlaybackClicked()) ); pStopPlayback = new KPushButton( KIcon("media-playback-stop"), "", this ); pStopPlayback->setFixedSize( 1.5*fontHeight, 1.5*fontHeight ); pStopPlayback->hide(); trackPlayerBox->addWidget( pStopPlayback ); connect( pStopPlayback, SIGNAL(clicked()), this, SLOT(stopPlaybackClicked()) ); seekSlider = new Phonon::SeekSlider( this ); seekSlider->setMediaObject( mediaObject ); seekSlider->setIconVisible( false ); seekSlider->hide(); trackPlayerBox->addWidget( seekSlider, 1 ); trackPlayerBox->addStretch(); } PlayerWidget::~PlayerWidget() {} void PlayerWidget::startPlaybackClicked() { /* playing = true; pStartPlayback->hide(); pStopPlayback->show(); seekSlider->show();*/ emit startPlayback( track ); } void PlayerWidget::stopPlaybackClicked() { /* playing = false; pStartPlayback->show(); pStopPlayback->hide(); seekSlider->hide();*/ emit stopPlayback(); } void PlayerWidget::trackChanged( int _track ) { if( _track != track ) { playing = false; pStartPlayback->show(); pStopPlayback->hide(); seekSlider->hide(); } else { playing = true; pStartPlayback->hide(); pStopPlayback->show(); seekSlider->show(); } } CDOpener::CDOpener( Config *_config, const QString& _device, QWidget *parent, Qt::WFlags f ) : KDialog( parent, f ), noCdFound( false ), config( _config ), cdDrive( 0 ), cdParanoia( 0 ), cddb( 0 ), cdTextFound( false ), cddbFound( false ) { setButtons( 0 ); page = CdOpenPage; const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); // let the dialog look nice setCaption( i18n("Add CD tracks") ); setWindowIcon( KIcon("media-optical-audio") ); QWidget *widget = new QWidget( this ); QGridLayout *mainGrid = new QGridLayout( widget ); QGridLayout *topGrid = new QGridLayout(); mainGrid->addLayout( topGrid, 0, 0 ); setMainWidget( widget ); lSelector = new QLabel( i18n("1. Select CD tracks"), widget ); QFont font; font.setBold( true ); lSelector->setFont( font ); topGrid->addWidget( lSelector, 0, 0 ); lOptions = new QLabel( i18n("2. Set conversion options"), widget ); topGrid->addWidget( lOptions, 0, 1 ); // draw a horizontal line QFrame *lineFrame = new QFrame( widget ); lineFrame->setFrameShape( QFrame::HLine ); lineFrame->setFrameShadow( QFrame::Sunken ); mainGrid->addWidget( lineFrame, 1, 0 ); // CD Opener Widget cdOpenerWidget = new QWidget( widget ); mainGrid->addWidget( cdOpenerWidget, 2, 0 ); // the grid for all widgets in the dialog QGridLayout *gridLayout = new QGridLayout( cdOpenerWidget ); // the box for the cover and artist/album grid QHBoxLayout *topBoxLayout = new QHBoxLayout(); gridLayout->addLayout( topBoxLayout, 0, 0 ); // the album cover QLabel *lAlbumCover = new QLabel( "", cdOpenerWidget ); topBoxLayout->addWidget( lAlbumCover ); lAlbumCover->setPixmap( QPixmap( KStandardDirs::locate("data","soundkonverter/images/nocover.png") ) ); lAlbumCover->setContentsMargins( 0, 0, 0.5*fontHeight, 0 ); // the grid for the artist and album input QGridLayout *topGridLayout = new QGridLayout(); topBoxLayout->addLayout( topGridLayout ); // set up the first row at the top QLabel *lArtistLabel = new QLabel( i18n("Album artist:"), cdOpenerWidget ); topGridLayout->addWidget( lArtistLabel, 0, 0 ); lArtist = new KLineEdit( cdOpenerWidget ); topGridLayout->addWidget( lArtist, 0, 1 ); connect( lArtist, SIGNAL(textChanged(const QString&)), this, SLOT(artistChanged(const QString&)) ); // set up the second row at the top QLabel *lAlbumLabel = new QLabel( i18n("Album:"), cdOpenerWidget ); topGridLayout->addWidget( lAlbumLabel, 1, 0 ); lAlbum = new KLineEdit( cdOpenerWidget ); topGridLayout->addWidget( lAlbum, 1, 1 ); // set up the third row at the top QLabel *lDiscLabel = new QLabel( i18n("Disc No.:"), cdOpenerWidget ); topGridLayout->addWidget( lDiscLabel, 2, 0 ); // add a horizontal box layout for the year and genre QHBoxLayout *yearBox = new QHBoxLayout(); topGridLayout->addLayout( yearBox, 2, 1 ); // and fill it up iDisc = new KIntSpinBox( 1, 99, 1, 1, cdOpenerWidget ); yearBox->addWidget( iDisc ); QLabel *lDiscTotalLabel = new QLabel( i18nc("Track/Disc No. x of y","of"), cdOpenerWidget ); lDiscTotalLabel->setAlignment( Qt::AlignHCenter | Qt::AlignVCenter ); yearBox->addWidget( lDiscTotalLabel ); iDiscTotal = new KIntSpinBox( 1, 99, 1, 1, cdOpenerWidget ); yearBox->addWidget( iDiscTotal ); QLabel *lYearLabel = new QLabel( i18n("Year:"), cdOpenerWidget ); lYearLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter ); yearBox->addWidget( lYearLabel ); iYear = new KIntSpinBox( 0, 99999, 1, QDate::currentDate().year(), cdOpenerWidget ); yearBox->addWidget( iYear ); QLabel *lGenreLabel = new QLabel( i18n("Genre:"), cdOpenerWidget ); lGenreLabel->setAlignment( Qt::AlignRight | Qt::AlignVCenter ); yearBox->addWidget( lGenreLabel ); cGenre = new KComboBox( true, cdOpenerWidget ); cGenre->addItems( config->tagEngine()->genreList ); cGenre->setEditText( "" ); KCompletion *cGenreCompletion = cGenre->completionObject(); cGenreCompletion->insertItems( config->tagEngine()->genreList ); cGenreCompletion->setIgnoreCase( true ); yearBox->addWidget( cGenre ); topGridLayout->setColumnStretch( 1, 1 ); // generate the list view for the tracks trackList = new QTreeWidget( cdOpenerWidget ); gridLayout->addWidget( trackList, 1, 0 ); // and fill in the headers trackList->setColumnCount( 5 ); QStringList labels; labels.append( i18nc("column title","Rip") ); labels.append( i18n("Track") ); labels.append( i18n("Artist") ); labels.append( i18n("Composer") ); labels.append( i18n("Title") ); labels.append( i18n("Length") ); labels.append( i18n("Player") ); trackList->setHeaderLabels( labels ); trackList->setSelectionBehavior( QAbstractItemView::SelectRows ); trackList->setSelectionMode( QAbstractItemView::ExtendedSelection ); trackList->setSortingEnabled( false ); trackList->setRootIsDecorated( false ); trackList->header()->setResizeMode( Column_Artist, QHeaderView::ResizeToContents ); trackList->header()->setResizeMode( Column_Composer, QHeaderView::ResizeToContents ); trackList->header()->setResizeMode( Column_Title, QHeaderView::ResizeToContents ); // trackList->setMouseTracking( true ); connect( trackList, SIGNAL(itemSelectionChanged()), this, SLOT(trackChanged()) ); // connect( trackList, SIGNAL(itemEntered(QTreeWidgetItem*,int)), this, SLOT(itemHighlighted(QTreeWidgetItem*,int)) ); gridLayout->setRowStretch( 1, 1 ); // create the box at the bottom for editing the tags tagGroupBox = new QGroupBox( i18n("No track selected"), cdOpenerWidget ); gridLayout->addWidget( tagGroupBox, 2, 0 ); QGridLayout *tagGridLayout = new QGridLayout( tagGroupBox ); // add the up and down buttons pTrackUp = new KPushButton( "", tagGroupBox ); pTrackUp->setIcon( KIcon("arrow-up") ); pTrackUp->setFixedSize( pTrackUp->sizeHint().height(), pTrackUp->sizeHint().height() ); pTrackUp->setAutoRepeat( true ); connect( pTrackUp, SIGNAL(clicked()), this, SLOT(trackUpPressed()) ); tagGridLayout->addWidget( pTrackUp, 0, 0 ); pTrackDown = new KPushButton( "", tagGroupBox ); pTrackDown->setIcon( KIcon("arrow-down") ); pTrackDown->setFixedSize( pTrackDown->sizeHint().height(), pTrackDown->sizeHint().height() ); pTrackDown->setAutoRepeat( true ); connect( pTrackDown, SIGNAL(clicked()), this, SLOT(trackDownPressed()) ); tagGridLayout->addWidget( pTrackDown, 1, 0 ); // add the inputs // add a horizontal box layout for the title QHBoxLayout *trackTitleBox = new QHBoxLayout(); tagGridLayout->addLayout( trackTitleBox, 0, 2 ); // and fill it up QLabel *lTrackTitleLabel = new QLabel( i18n("Title:"), tagGroupBox ); tagGridLayout->addWidget( lTrackTitleLabel, 0, 1 ); lTrackTitle = new KLineEdit( tagGroupBox ); trackTitleBox->addWidget( lTrackTitle ); connect( lTrackTitle, SIGNAL(textChanged(const QString&)), this, SLOT(trackTitleChanged(const QString&)) ); pTrackTitleEdit = new KPushButton( "", tagGroupBox ); pTrackTitleEdit->setIcon( KIcon("document-edit") ); pTrackTitleEdit->setFixedSize( lTrackTitle->sizeHint().height(), lTrackTitle->sizeHint().height() ); pTrackTitleEdit->hide(); trackTitleBox->addWidget( pTrackTitleEdit ); connect( pTrackTitleEdit, SIGNAL(clicked()), this, SLOT(editTrackTitleClicked()) ); // add a horizontal box layout for the composer QHBoxLayout *trackArtistBox = new QHBoxLayout(); tagGridLayout->addLayout( trackArtistBox, 1, 2 ); // and fill it up QLabel *lTrackArtistLabel = new QLabel( i18n("Artist:"), tagGroupBox ); tagGridLayout->addWidget( lTrackArtistLabel, 1, 1 ); lTrackArtist = new KLineEdit( tagGroupBox ); trackArtistBox->addWidget( lTrackArtist ); connect( lTrackArtist, SIGNAL(textChanged(const QString&)), this, SLOT(trackArtistChanged(const QString&)) ); pTrackArtistEdit = new KPushButton( "", tagGroupBox ); pTrackArtistEdit->setIcon( KIcon("document-edit") ); pTrackArtistEdit->setFixedSize( lTrackArtist->sizeHint().height(), lTrackArtist->sizeHint().height() ); pTrackArtistEdit->hide(); trackArtistBox->addWidget( pTrackArtistEdit ); connect( pTrackArtistEdit, SIGNAL(clicked()), this, SLOT(editTrackArtistClicked()) ); QLabel *lTrackComposerLabel = new QLabel( i18n("Composer:"), tagGroupBox ); trackArtistBox->addWidget( lTrackComposerLabel ); lTrackComposer = new KLineEdit( tagGroupBox ); trackArtistBox->addWidget( lTrackComposer ); connect( lTrackComposer, SIGNAL(textChanged(const QString&)), this, SLOT(trackComposerChanged(const QString&)) ); pTrackComposerEdit = new KPushButton( "", tagGroupBox ); pTrackComposerEdit->setIcon( KIcon("document-edit") ); pTrackComposerEdit->setFixedSize( lTrackComposer->sizeHint().height(), lTrackComposer->sizeHint().height() ); pTrackComposerEdit->hide(); trackArtistBox->addWidget( pTrackComposerEdit ); connect( pTrackComposerEdit, SIGNAL(clicked()), this, SLOT(editTrackComposerClicked()) ); // add a horizontal box layout for the comment QHBoxLayout *trackCommentBox = new QHBoxLayout(); tagGridLayout->addLayout( trackCommentBox, 2, 2 ); // and fill it up QLabel *lTrackCommentLabel = new QLabel( i18n("Comment:"), tagGroupBox ); tagGridLayout->addWidget( lTrackCommentLabel, 2, 1 ); tTrackComment = new KTextEdit( tagGroupBox ); trackCommentBox->addWidget( tTrackComment ); tTrackComment->setFixedHeight( 4*fontHeight ); connect( tTrackComment, SIGNAL(textChanged()), this, SLOT(trackCommentChanged()) ); pTrackCommentEdit = new KPushButton( "", tagGroupBox ); pTrackCommentEdit->setIcon( KIcon("document-edit") ); pTrackCommentEdit->setFixedSize( lTrackTitle->sizeHint().height(), lTrackTitle->sizeHint().height() ); pTrackCommentEdit->hide(); trackCommentBox->addWidget( pTrackCommentEdit ); connect( pTrackCommentEdit, SIGNAL(clicked()), this, SLOT(editTrackCommentClicked()) ); audioOutput = new Phonon::AudioOutput( Phonon::MusicCategory, this ); audioOutput->setVolume( 0.5 ); mediaObject = new Phonon::MediaObject( this ); mediaObject->setTickInterval( 500 ); Phonon::createPath( mediaObject, audioOutput ); mediaController = new Phonon::MediaController( mediaObject ); mediaController->setAutoplayTitles( false ); connect( mediaController, SIGNAL(titleChanged(int)), this, SLOT(playbackTitleChanged(int)) ); connect( mediaObject, SIGNAL(stateChanged(Phonon::State,Phonon::State)), this, SLOT(playbackStateChanged(Phonon::State,Phonon::State)) ); // Cd Opener Overlay Widget cdOpenerOverlayWidget = new QWidget( widget ); mainGrid->addWidget( cdOpenerOverlayWidget, 2, 0 ); QHBoxLayout *cdOpenerOverlayLayout = new QHBoxLayout(); cdOpenerOverlayWidget->setLayout( cdOpenerOverlayLayout ); // lOverlayLabel = new QLabel( i18n("Please wait, trying to read audio CD ..."), cdOpenerOverlayWidget ); lOverlayLabel = new QLabel( cdOpenerOverlayWidget ); cdOpenerOverlayLayout->addWidget( lOverlayLabel ); lOverlayLabel->setAlignment( Qt::AlignCenter ); cdOpenerOverlayWidget->setAutoFillBackground( true ); QPalette newPalette = cdOpenerOverlayWidget->palette(); newPalette.setBrush( QPalette::Window, brushSetAlpha( newPalette.window(), 192 ) ); cdOpenerOverlayWidget->setPalette( newPalette ); // Conversion Options Widget // add a vertical box layout for the options widget QVBoxLayout *optionsBox = new QVBoxLayout(); mainGrid->addLayout( optionsBox, 2, 0 ); options = new Options( config, i18n("Select your desired output options and click on \"Ok\"."), widget ); optionsBox->addWidget( options ); options->hide(); optionsBox->addStretch(); // draw a horizontal line QFrame *buttonLineFrame = new QFrame( widget ); buttonLineFrame->setFrameShape( QFrame::HLine ); buttonLineFrame->setFrameShadow( QFrame::Sunken ); buttonLineFrame->setFrameShape( QFrame::HLine ); mainGrid->addWidget( buttonLineFrame, 4, 0 ); // add a horizontal box layout for the control elements QHBoxLayout *controlBox = new QHBoxLayout(); mainGrid->addLayout( controlBox, 5, 0 ); // add the control elements pSaveCue = new KPushButton( KIcon("document-save"), i18n("Save cue sheet..."), widget ); controlBox->addWidget( pSaveCue ); connect( pSaveCue, SIGNAL(clicked()), this, SLOT(saveCuesheetClicked()) ); controlBox->addSpacing( fontHeight ); pCDDB = new KPushButton( KIcon("download"), i18n("Request CDDB"), widget ); controlBox->addWidget( pCDDB ); connect( pCDDB, SIGNAL(clicked()), this, SLOT(requestCddb()) ); controlBox->addStretch(); cEntireCd = new QCheckBox( i18n("Rip entire CD to one file"), widget ); QStringList errorList; cEntireCd->setEnabled( config->pluginLoader()->canRipEntireCd(&errorList) ); if( !cEntireCd->isEnabled() ) { QPalette notificationPalette = cEntireCd->palette(); notificationPalette.setColor( QPalette::Disabled, QPalette::WindowText, QColor(174,127,130) ); // QColor(181,96,101) cEntireCd->setPalette( notificationPalette ); if( !errorList.isEmpty() ) { errorList.prepend( i18n("Ripping an entire cd to a single file is not supported by the installed backends.\nPossible solutions are listed below.\n") ); } else { errorList += i18n("Ripping an entire cd to a single file is not supported by the installed backends.\nPlease check your distribution's package manager in order to install an additional ripper plugin which supports ripping to one file."); } cEntireCd->setToolTip( errorList.join("\n") ); } controlBox->addWidget( cEntireCd ); controlBox->addSpacing( 2*fontHeight ); pProceed = new KPushButton( KIcon("go-next"), i18n("Proceed"), widget ); controlBox->addWidget( pProceed ); connect( pProceed, SIGNAL(clicked()), this, SLOT(proceedClicked()) ); pAdd = new KPushButton( KIcon("dialog-ok"), i18n("Ok"), widget ); controlBox->addWidget( pAdd ); pAdd->hide(); connect( pAdd, SIGNAL(clicked()), this, SLOT(addClicked()) ); pCancel = new KPushButton( KIcon("dialog-cancel"), i18n("Cancel"), widget ); controlBox->addWidget( pCancel ); connect( pCancel, SIGNAL(clicked()), this, SLOT(reject()) ); connect( &fadeTimer, SIGNAL(timeout()), this, SLOT(fadeAnim()) ); fadeAlpha = 255.0f; cddb = new KCDDB::Client(); connect( cddb, SIGNAL(finished(KCDDB::Result)), this, SLOT(lookup_cddb_done(KCDDB::Result)) ); // set up timeout timer timeoutTimer.setSingleShot( true ); connect( &timeoutTimer, SIGNAL(timeout()), this, SLOT(timeout()) ); if( !_device.isEmpty() ) { device = _device; } else { const QMap devices = cdDevices(); if( devices.count() <= 0 ) { noCdFound = true; return; } else if( devices.count() == 1 ) { device = devices.keys().at(0); } else { QStringList list; foreach( const QString desc, devices.values() ) { list.append( desc ); } bool ok = false; const QString selection = KInputDialog::getItem( i18n("Select CD-ROM drive"), i18n("Multiple CD-ROM drives where found. Please select one:"), list, 0, false, &ok, this ); if( ok ) { // The user selected an item and pressed OK device = devices.keys().at(list.indexOf(selection)); } else { noCdFound = true; return; } } } const bool success = openCdDevice( device ); if( !success ) { KMessageBox::information(this,"success = false, couldn't open audio device.\nplease report this bug."); noCdFound = true; return; } mediaSource = new Phonon::MediaSource( Phonon::Cd, device ); mediaObject->setCurrentSource( *mediaSource ); // WARNING doesn't work with phonon-xine // Prevent the dialog from beeing too wide because of the directory history if( parent && width() > parent->width() ) setInitialSize( QSize(parent->width()-fontHeight,sizeHint().height()) ); KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group = conf->group( "CDOpener" ); restoreDialogSize( group ); } CDOpener::~CDOpener() { KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group = conf->group( "CDOpener" ); saveDialogSize( group ); if( cdParanoia ) { paranoia_free( cdParanoia ); // delete cdParanoia; } if( cdDrive ) { cdda_close( cdDrive ); // delete cdDrive; } if( cddb ) delete cddb; } void CDOpener::setProfile( const QString& profile ) { options->setProfile( profile ); } void CDOpener::setFormat( const QString& format ) { options->setFormat( format ); } void CDOpener::setOutputDirectory( const QString& directory ) { options->setOutputDirectory( directory ); } void CDOpener::setCommand( const QString& _command ) { command = _command; } QMap CDOpener::cdDevices() { QMap devices; QList solidDevices = Solid::Device::listFromType(Solid::DeviceInterface::OpticalDisc, QString()); foreach( Solid::Device solidDevice, solidDevices ) { Solid::OpticalDisc *opticalDisc = solidDevice.as(); if( opticalDisc && opticalDisc->availableContent() & Solid::OpticalDisc::Audio ) { Solid::Block *block = solidDevice.as(); if( block ) { const QString device = block->device(); const Solid::Device parentDevice( solidDevice.parentUdi() ); const QString name = parentDevice.product(); cdDrive = cdda_identify( device.toAscii(), CDDA_MESSAGE_PRINTIT, 0 ); if( cdDrive && cdda_open(cdDrive) == 0 ) { const QString desc = i18n("%1 (%2): Audio CD with %3 tracks").arg(name).arg(device).arg(cdda_audio_tracks(cdDrive)); devices.insert( device, desc ); } } } } return devices; } int CDOpener::cdda_audio_tracks( cdrom_drive *cdDrive ) const { const int nrOfTracks = cdda_tracks(cdDrive); for( int i=1; i<=nrOfTracks; i++ ) { if( !(IS_AUDIO(cdDrive,i-1)) ) return i-1; } return nrOfTracks; } bool CDOpener::openCdDevice( const QString& _device ) { // paranoia init QFile deviceFile(_device); if( !deviceFile.exists() ) { return false; } else { cdDrive = cdda_identify( _device.toAscii(), CDDA_MESSAGE_PRINTIT, 0 ); if( !cdDrive || cdda_open( cdDrive ) != 0 ) { return false; } } cdParanoia = paranoia_init( cdDrive ); // cd text // const int status = wm_cd_init( device.toAscii().data(), "", "", "", &wmHandle ); // // struct cdtext_info *info = 0; // // if( !WM_CDS_ERROR(status) ) // { // info = wm_cd_get_cdtext( wmHandle ); // // if( !info || !info->valid || info->count_of_entries != cdda_tracks(cdDrive) ) // if( !info || !info->valid ) // { // kDebug() << "no or invalid CDTEXT"; // info = 0; // } // } // add tracks to list qDeleteAll( tags ); tags.clear(); TagData *newTags = new TagData(); newTags->track = 1; newTags->trackTotal = 1; newTags->disc = 1; newTags->discTotal = 1; newTags->year = (QDate::currentDate()).year(); tags += newTags; const int trackTotal = cdda_audio_tracks( cdDrive ); for( int i=0; itrack = i+1; newTags->trackTotal = trackTotal; const long size = CD_FRAMESIZE_RAW * (cdda_track_lastsector(cdDrive,newTags->track)-cdda_track_firstsector(cdDrive,newTags->track)); newTags->length = (8 * size) / (44100 * 2 * 16); tags += newTags; QStringList data; data.append( "" ); data.append( QString().sprintf("%02i",newTags->track) ); data.append( newTags->artist ); data.append( newTags->composer ); data.append( newTags->title ); data.append( QString().sprintf("%i:%02i",newTags->length/60,newTags->length%60) ); QTreeWidgetItem *item = new QTreeWidgetItem( trackList, data ); PlayerWidget *playerWidget = new PlayerWidget( mediaObject, newTags->track, item, this ); // playerWidget->hide(); connect( playerWidget, SIGNAL(startPlayback(int)), this, SLOT(startPlayback(int)) ); connect( playerWidget, SIGNAL(stopPlayback()), this, SLOT(stopPlayback()) ); playerWidgets.append( playerWidget ); trackList->setItemWidget( item, Column_Player, playerWidget ); item->setCheckState( 0, Qt::Checked ); } trackList->resizeColumnToContents( Column_Rip ); trackList->resizeColumnToContents( Column_Track ); trackList->resizeColumnToContents( Column_Length ); if( trackList->topLevelItem(0) ) trackList->topLevelItem(0)->setSelected( true ); lArtist->setText( tags.at(0)->artist ); lAlbum->setText( tags.at(0)->album ); iDisc->setValue( tags.at(0)->disc ); iDiscTotal->setValue( tags.at(0)->discTotal ); iYear->setValue( tags.at(0)->year ); cGenre->setEditText( tags.at(0)->genre ); artistChanged( lArtist->text() ); adjustComposerColumn(); // request cddb data requestCddb( true ); return true; } void CDOpener::requestCddb( bool autoRequest ) { lOverlayLabel->setText( i18n("Please wait, trying to download CDDB data ...") ); timeoutTimer.start( autoRequest ? 10000 : 20000 ); // cddb needs offsets +150 frames (2 seconds * 75 frames per second) KCDDB::TrackOffsetList offsets; for( int i=1; i<=cdda_tracks(cdDrive); i++ ) { if( !(IS_AUDIO(cdDrive,i-1)) ) break; offsets.append( cdda_track_firstsector(cdDrive,i) + 150 ); } offsets.append( cdda_disc_lastsector(cdDrive) + 150 + 1 ); cddb->config().reparse(); cddb->setBlockingMode( false ); cddb->lookup( offsets ); } void CDOpener::lookup_cddb_done( KCDDB::Result result ) { timeoutTimer.stop(); if( result != KCDDB::Success && result != KCDDB::MultipleRecordFound ) { // TODO error message if request was initiated by the user // Error(i18n("No entry found in CDDB."), i18n("This means no data found in the CDDB database. Please enter the data manually. Maybe try another CDDB server."), Error::ERROR, this); fadeOut(); return; } cddbFound = true; KCDDB::CDInfo info = cddb->lookupResponse().first(); if( cddb->lookupResponse().count() > 1 || cdTextFound ) { KCDDB::CDInfoList cddb_info = cddb->lookupResponse(); QStringList list; if( cdTextFound ) { // list.append( QString("CD Text: %1, %2").arg(compact_disc->discArtist()).arg(compact_disc->discTitle()) ); } for( int i=0; iartist = info.track(i-1).get(KCDDB::Artist).toString(); tags.at(i)->title = info.track(i-1).get(KCDDB::Title).toString(); tags.at(i)->comment = info.track(i-1).get(KCDDB::Comment).toString(); QTreeWidgetItem *item = trackList->topLevelItem(i-1); item->setText( 2, tags.at(i)->artist ); item->setText( 4, tags.at(i)->title ); } tags.at(0)->album = info.get(KCDDB::Title).toString(); tags.at(0)->artist = info.get(KCDDB::Artist).toString(); tags.at(0)->year = info.get(KCDDB::Year).toInt(); tags.at(0)->genre = info.get(KCDDB::Genre).toString(); // TODO resize colums up to a certain width lArtist->setText( tags.at(0)->artist ); lAlbum->setText( tags.at(0)->album ); iDisc->setValue( tags.at(0)->disc ); iDiscTotal->setValue( tags.at(0)->discTotal ); iYear->setValue( tags.at(0)->year ); cGenre->setEditText( tags.at(0)->genre ); artistChanged( lArtist->text() ); fadeOut(); } void CDOpener::timeout() { fadeOut(); } void CDOpener::trackUpPressed() { QTreeWidgetItem *item = trackList->topLevelItem( selectedTracks.first() - 2 ); if( !item ) return; disconnect( trackList, SIGNAL(itemSelectionChanged()), 0, 0 ); // avoid backfireing for( int i=0; itopLevelItem( selectedTracks.at(i)-1 ); if( item ) item->setSelected( false ); } item->setSelected( true ); trackList->scrollToItem( item ); connect( trackList, SIGNAL(itemSelectionChanged()), this, SLOT(trackChanged()) ); trackChanged(); } void CDOpener::trackDownPressed() { QTreeWidgetItem *item = trackList->topLevelItem( selectedTracks.last() ); if( !item ) return; disconnect( trackList, SIGNAL(itemSelectionChanged()), 0, 0 ); // avoid backfireing for( int i=0; itopLevelItem( selectedTracks.at(i)-1 ); if( item ) item->setSelected( false ); } item->setSelected( true ); trackList->scrollToItem( item ); connect( trackList, SIGNAL(itemSelectionChanged()), this, SLOT(trackChanged()) ); trackChanged(); } void CDOpener::trackChanged() { // NOTE if no track is selected soundkonverter could use the current item as default item (like qlistview does) // rebuild the list of the selected tracks selectedTracks.clear(); QTreeWidgetItem *item; for( int i=0; itopLevelItemCount(); i++ ) { item = trackList->topLevelItem( i ); if( item->isSelected() ) { selectedTracks.append( i+1 ); } } // insert the new values if( selectedTracks.count() < 1 ) { pTrackUp->setEnabled( false ); pTrackDown->setEnabled( false ); lTrackTitle->setEnabled( false ); lTrackTitle->setText( "" ); pTrackTitleEdit->hide(); lTrackArtist->setEnabled( false ); lTrackArtist->setText( "" ); pTrackArtistEdit->hide(); lTrackComposer->setEnabled( false ); lTrackComposer->setText( "" ); pTrackComposerEdit->hide(); tTrackComment->setEnabled( false ); tTrackComment->setReadOnly( true ); tTrackComment->setText( "" ); pTrackCommentEdit->hide(); pTrackUp->setEnabled( false ); pTrackDown->setEnabled( false ); return; } else if( selectedTracks.count() > 1 ) { if( selectedTracks.first() > 1 ) pTrackUp->setEnabled( true ); else pTrackUp->setEnabled( false ); if( selectedTracks.last() < trackList->topLevelItemCount() ) pTrackDown->setEnabled( true ); else pTrackDown->setEnabled( false ); QString trackListString = ""; if( selectedTracks.count() == trackList->topLevelItemCount() ) { trackListString = i18n("All tracks"); } else { trackListString = i18n("Tracks") + QString().sprintf( " %02i", selectedTracks.at(0) ); for( int i=1; isetTitle( trackListString ); const QString title = tags.at(selectedTracks.at(0))->title; bool equalTitles = true; const QString artist = tags.at(selectedTracks.at(0))->artist; bool equalArtists = true; const QString composer = tags.at(selectedTracks.at(0))->composer; bool equalComposers = true; const QString comment = tags.at(selectedTracks.at(0))->comment; bool equalComments = true; for( int i=1; ititle ) equalTitles = false; if( artist != tags.at(selectedTracks.at(i))->artist ) equalArtists = false; if( composer != tags.at(selectedTracks.at(i))->composer ) equalComposers = false; if( comment != tags.at(selectedTracks.at(i))->comment ) equalComments = false; } if( equalTitles ) { lTrackTitle->setEnabled( true ); lTrackTitle->setText( title ); pTrackTitleEdit->hide(); } else { lTrackTitle->setEnabled( false ); lTrackTitle->setText( "" ); pTrackTitleEdit->show(); } if( equalArtists ) { lTrackArtist->setEnabled( true ); lTrackArtist->setText( artist ); pTrackArtistEdit->hide(); } else { lTrackArtist->setEnabled( false ); lTrackArtist->setText( "" ); pTrackArtistEdit->show(); } if( equalComposers ) { lTrackComposer->setEnabled( true ); lTrackComposer->setText( composer ); pTrackComposerEdit->hide(); } else { lTrackComposer->setEnabled( false ); lTrackComposer->setText( "" ); pTrackComposerEdit->show(); } if( equalComments ) { tTrackComment->setEnabled( true ); tTrackComment->setReadOnly( false ); tTrackComment->setText( comment ); pTrackCommentEdit->hide(); } else { tTrackComment->setEnabled( false ); tTrackComment->setReadOnly( true ); tTrackComment->setText( "" ); pTrackCommentEdit->show(); } } else { if( selectedTracks.first() > 1 ) pTrackUp->setEnabled( true ); else pTrackUp->setEnabled( false ); if( selectedTracks.last() < trackList->topLevelItemCount() ) pTrackDown->setEnabled( true ); else pTrackDown->setEnabled( false ); tagGroupBox->setTitle( i18n("Track") + QString().sprintf(" %02i",selectedTracks.at(0)) ); lTrackTitle->setEnabled( true ); lTrackTitle->setText( tags.at(selectedTracks.at(0))->title ); pTrackTitleEdit->hide(); lTrackArtist->setEnabled( true ); lTrackArtist->setText( tags.at(selectedTracks.at(0))->artist ); pTrackArtistEdit->hide(); lTrackComposer->setEnabled( true ); lTrackComposer->setText( tags.at(selectedTracks.at(0))->composer ); pTrackComposerEdit->hide(); tTrackComment->setEnabled( true ); tTrackComment->setReadOnly( false ); tTrackComment->setText( tags.at(selectedTracks.at(0))->comment ); pTrackCommentEdit->hide(); } } void CDOpener::artistChanged( const QString& text ) { for( int i=1; iartist == lastAlbumArtist ) { tags.at(i)->artist = text; if( QTreeWidgetItem *item = trackList->topLevelItem( i-1 ) ) { item->setText( Column_Artist, text ); } } } tags.at(0)->artist = text; lastAlbumArtist = text; adjustArtistColumn(); trackChanged(); } void CDOpener::adjustArtistColumn() { QString albumArtist = tags.at(0)->artist; for( int i=1; iartist != albumArtist ) { trackList->setColumnHidden( Column_Artist, false ); return; } } trackList->setColumnHidden( Column_Artist, true ); } void CDOpener::adjustComposerColumn() { for( int i=1; icomposer.isEmpty() ) { trackList->setColumnHidden( Column_Composer, false ); return; } } trackList->setColumnHidden( Column_Composer, true ); } void CDOpener::trackTitleChanged( const QString& text ) { if( !lTrackTitle->isEnabled() ) return; for( int i=0; itopLevelItem( selectedTracks.at(i)-1 ); if( item ) item->setText( Column_Title, text ); tags.at(selectedTracks.at(i))->title = text; } } void CDOpener::trackArtistChanged( const QString& text ) { if( !lTrackArtist->isEnabled() ) return; for( int i=0; itopLevelItem( selectedTracks.at(i)-1 ); if( item ) item->setText( Column_Artist, text ); tags.at(selectedTracks.at(i))->artist = text; } adjustArtistColumn(); } void CDOpener::trackComposerChanged( const QString& text ) { if( !lTrackComposer->isEnabled() ) return; for( int i=0; itopLevelItem( selectedTracks.at(i)-1 ); if( item ) item->setText( Column_Composer, text ); tags.at(selectedTracks.at(i))->composer = text; } adjustComposerColumn(); } void CDOpener::trackCommentChanged() { QString text = tTrackComment->toPlainText(); if( !tTrackComment->isEnabled() ) return; for( int i=0; icomment = text; } } void CDOpener::editTrackTitleClicked() { lTrackTitle->setEnabled( true ); lTrackTitle->setFocus(); pTrackTitleEdit->hide(); trackTitleChanged( lTrackTitle->text() ); } void CDOpener::editTrackArtistClicked() { lTrackArtist->setEnabled( true ); lTrackArtist->setFocus(); pTrackArtistEdit->hide(); trackArtistChanged( lTrackArtist->text() ); } void CDOpener::editTrackComposerClicked() { lTrackComposer->setEnabled( true ); lTrackComposer->setFocus(); pTrackComposerEdit->hide(); trackComposerChanged( lTrackComposer->text() ); } void CDOpener::editTrackCommentClicked() { tTrackComment->setEnabled( true ); tTrackComment->setReadOnly( false ); tTrackComment->setFocus(); pTrackCommentEdit->hide(); trackCommentChanged(); } void CDOpener::fadeIn() { fadeTimer.start( 50 ); fadeMode = 1; cdOpenerOverlayWidget->show(); } void CDOpener::fadeOut() { fadeTimer.start( 50 ); fadeMode = 2; } void CDOpener::fadeAnim() { if( fadeMode == 1 ) { fadeAlpha += 255.0f/50.0f*8.0f; } else if( fadeMode == 2 ) { fadeAlpha -= 255.0f/50.0f*8.0f; } if( fadeAlpha <= 0.0f ) { fadeAlpha = 0.0f; fadeMode = 0; cdOpenerOverlayWidget->hide(); } else if( fadeAlpha >= 255.0f ) { fadeAlpha = 255.0f; fadeMode = 0; } else { fadeTimer.start( 50 ); } QPalette newPalette = cdOpenerOverlayWidget->palette(); newPalette.setBrush( QPalette::Window, brushSetAlpha( newPalette.window(), 192.0f/255.0f*fadeAlpha ) ); cdOpenerOverlayWidget->setPalette( newPalette ); newPalette = lOverlayLabel->palette(); newPalette.setBrush( QPalette::WindowText, brushSetAlpha( newPalette.windowText(), fadeAlpha ) ); lOverlayLabel->setPalette( newPalette ); } void CDOpener::proceedClicked() { int trackCount = 0; for( int i=0; itopLevelItemCount(); i++ ) { if( trackList->topLevelItem(i)->checkState(0) == Qt::Checked ) trackCount++; } if( trackCount == 0 ) { KMessageBox::error( this, i18n("Please select at least one track in order to proceed.") ); return; } if( options->currentConversionOptions() && options->currentConversionOptions()->outputDirectoryMode == OutputDirectory::Source ) { options->setOutputDirectoryMode( (int)OutputDirectory::MetaData ); } cdOpenerWidget->hide(); pSaveCue->hide(); pCDDB->hide(); cEntireCd->hide(); options->show(); page = ConversionOptionsPage; QFont font; font.setBold( false ); lSelector->setFont( font ); font.setBold( true ); lOptions->setFont( font ); pProceed->hide(); pAdd->show(); } void CDOpener::addClicked() { ConversionOptions *conversionOptions = options->currentConversionOptions(); if( conversionOptions ) { QList tracks; QList tagList; const int trackCount = cdda_audio_tracks( cdDrive ); if( cEntireCd->isEnabled() && cEntireCd->isChecked() ) { tags.at(0)->title = lAlbum->text(); tags.at(0)->artist = lArtist->text(); tags.at(0)->albumArtist = lArtist->text(); tags.at(0)->album = lAlbum->text(); tags.at(0)->disc = iDisc->value(); tags.at(0)->discTotal = iDiscTotal->value(); tags.at(0)->year = iYear->value(); tags.at(0)->genre = cGenre->currentText(); const long size = CD_FRAMESIZE_RAW * (cdda_track_lastsector(cdDrive,trackCount)-cdda_track_firstsector(cdDrive,1)); tags.at(0)->length = (8 * size) / (44100 * 2 * 16); tagList.append( tags.at(0) ); tracks.append( 0 ); } else { for( int i=0; itopLevelItemCount(); i++ ) { if( trackList->topLevelItem(i)->checkState(0) == Qt::Checked ) { tags.at(i+1)->albumArtist = lArtist->text(); tags.at(i+1)->album = lAlbum->text(); tags.at(i+1)->disc = iDisc->value(); tags.at(i+1)->discTotal = iDiscTotal->value(); tags.at(i+1)->year = iYear->value(); tags.at(i+1)->genre = cGenre->currentText(); const long size = CD_FRAMESIZE_RAW * (cdda_track_lastsector(cdDrive,i+1)-cdda_track_firstsector(cdDrive,i+1)); tags.at(i+1)->length = (8 * size) / (44100 * 2 * 16); tagList.append( tags.at(i+1) ); tracks.append( i+1 ); } } } options->accepted(); emit addTracks( device, tracks, trackCount, tagList, conversionOptions, command ); accept(); } else { KMessageBox::error( this, i18n("No conversion options selected.") ); } } void CDOpener::saveCuesheetClicked() { QString filename = KFileDialog::getSaveFileName( QDir::homePath(), "*.cue" ); if( filename.isEmpty() ) return; QFile cueFile( filename ); if( cueFile.exists() ) { const int ret = KMessageBox::questionYesNo( this, i18n("A file with this name already exists.\n\nDo you want to overwrite the existing one?"), i18n("File already exists") ); if( ret == KMessageBox::No ) return; } if( !cueFile.open( QIODevice::WriteOnly ) ) return; QString content; content.append( "REM COMMENT \"soundKonverter " + QString(SOUNDKONVERTER_VERSION_STRING) + "\"\n" ); content.append( "TITLE \"" + lAlbum->text() + "\"\n" ); content.append( "PERFORMER \"" + lArtist->text() + "\"\n" ); content.append( "FILE \"\" WAVE\n" ); for( int i=1; itrack ) ); content.append( " TITLE \"" + tags.at(i)->title + "\"\n" ); content.append( " PERFORMER \"" + tags.at(i)->artist + "\"\n" ); content.append( " SONGWRITER \"" + tags.at(i)->composer + "\"\n" ); const long size = CD_FRAMESIZE_RAW * cdda_track_firstsector(cdDrive,i); const long length = (8 * size) / (44100 * 2 * 16); const long frames = (8 * size) / (588 * 2 * 16); content.append( QString().sprintf(" INDEX 01 %02li:%02li:%02li\n",length/60,length%60,frames%75) ); } QTextStream ts( &cueFile ); ts << content; cueFile.close(); } // void CDOpener::itemHighlighted( QTreeWidgetItem *item, int column ) // { // for( int i=0; itreeWidgetItem() ) // playerWidgets[i]->show(); // else if( !playerWidgets.at(i)->isPlaying() ) // playerWidgets[i]->hide(); // } // } void CDOpener::startPlayback( int track ) { for( int i=0; iisPlaying() ) playerWidgets[i]->trackChanged( track ); } mediaController->setCurrentTitle( track ); mediaObject->play(); } void CDOpener::stopPlayback() { mediaObject->stop(); } void CDOpener::playbackTitleChanged( int title ) { for( int i=0; iisPlaying() ) || ( i+1 == title && !playerWidgets.at(i)->isPlaying() ) ) playerWidgets[i]->trackChanged( title ); } } void CDOpener::playbackStateChanged( Phonon::State newstate, Phonon::State oldstate ) { Q_UNUSED(oldstate) if( newstate == Phonon::StoppedState ) { playbackTitleChanged( 0 ); } else if( newstate == Phonon::PlayingState ) { playbackTitleChanged( mediaController->currentTitle() ); } } ./soundkonverter-2.1.2/opener/PaxHeaders.4329/playlistopener.cpp0000644000000000000000000000013212276440204021466 xustar0030 mtime=1392132228.521615395 30 atime=1392132228.521615395 30 ctime=1418040695.115717304 ./soundkonverter-2.1.2/opener/playlistopener.cpp0000644000175000001440000002122412276440204022464 0ustar00danielusers00000000000000// // C++ Implementation: opener // // Description: // // // Author: Daniel Faust , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "playlistopener.h" #include "../options.h" #include "../config.h" #include "../codecproblems.h" #include #include #include #include #include #include #include #include #include PlaylistOpener::PlaylistOpener( Config *_config, QWidget *parent, Qt::WFlags f ) : KDialog( parent, f ), dialogAborted( false ), config( _config ) { setCaption( i18n("Add playlist") ); setWindowIcon( KIcon("view-media-playlist") ); setButtons( 0 ); const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); QWidget *widget = new QWidget(); setMainWidget( widget ); QGridLayout *mainGrid = new QGridLayout( widget ); options = new Options( config, i18n("Select your desired output options and click on \"Ok\"."), widget ); mainGrid->addWidget( options, 1, 0 ); // add a horizontal box layout for the control elements QHBoxLayout *controlBox = new QHBoxLayout(); mainGrid->addLayout( controlBox, 2, 0 ); controlBox->addStretch(); pAdd = new KPushButton( KIcon("dialog-ok"), i18n("Ok"), widget ); controlBox->addWidget( pAdd ); connect( pAdd, SIGNAL(clicked()), this, SLOT(okClickedSlot()) ); pCancel = new KPushButton( KIcon("dialog-cancel"), i18n("Cancel"), widget ); controlBox->addWidget( pCancel ); connect( pCancel, SIGNAL(clicked()), this, SLOT(reject()) ); fileDialog = new KFileDialog( KUrl("kfiledialog:///soundkonverter-add-media"), "*.m3u", this ); fileDialog->setWindowTitle( i18n("Add Files") ); fileDialog->setMode( KFile::File | KFile::ExistingOnly ); connect( fileDialog, SIGNAL(accepted()), this, SLOT(fileDialogAccepted()) ); connect( fileDialog, SIGNAL(rejected()), this, SLOT(reject()) ); const int dialogReturnCode = fileDialog->exec(); if( dialogReturnCode == QDialog::Rejected ) dialogAborted = true; // Prevent the dialog from beeing too wide because of the directory history if( parent && width() > parent->width() ) setInitialSize( QSize(parent->width()-fontHeight,sizeHint().height()) ); KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group = conf->group( "PlaylistOpener" ); restoreDialogSize( group ); } PlaylistOpener::~PlaylistOpener() { KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group = conf->group( "PlaylistOpener" ); saveDialogSize( group ); } void PlaylistOpener::fileDialogAccepted() { QStringList errorList; // codec @0 files @1 solutions QMap< QString, QList > problems; // QStringList messageList; QString fileName; QStringList filesNotFound; urls.clear(); KUrl playlistUrl = fileDialog->selectedUrl(); QFile playlistFile( playlistUrl.toLocalFile() ); if( playlistFile.open(QIODevice::ReadOnly) ) { QTextStream stream(&playlistFile); QString line; do { line = stream.readLine(); if( !line.startsWith("#EXTM3U") && !line.startsWith("#EXTINF") && !line.isEmpty() ) { KUrl url(line); if( url.isRelative() ) url = KUrl( playlistUrl.directory() + "/" + line ); url.cleanPath(); if( !url.isLocalFile() || QFile::exists(url.toLocalFile()) ) urls += url; else filesNotFound += url.pathOrUrl(); } } while( !line.isNull() ); playlistFile.close(); } const bool canDecodeAac = config->pluginLoader()->canDecode( "m4a/aac" ); const bool canDecodeAlac = config->pluginLoader()->canDecode( "m4a/alac" ); const bool checkM4a = ( !canDecodeAac || !canDecodeAlac ) && canDecodeAac != canDecodeAlac; for( int i=0; ipluginLoader()->getCodecFromFile( urls.at(i), &mimeType, checkM4a ); if( !config->pluginLoader()->canDecode(codecName,&errorList) ) { fileName = urls.at(i).pathOrUrl(); if( codecName.isEmpty() ) codecName = mimeType; if( codecName.isEmpty() ) codecName = fileName.right(fileName.length()-fileName.lastIndexOf(".")-1); if( problems.value(codecName).count() < 2 ) { problems[codecName] += QStringList(); problems[codecName] += QStringList(); } problems[codecName][0] += fileName; if( !errorList.isEmpty() ) { problems[codecName][1] += errorList; } else { problems[codecName][1] += i18n("This file type is unknown to soundKonverter.\nMaybe you need to install an additional soundKonverter plugin.\nYou should have a look at your distribution's package manager for this."); } urls.removeAt(i); i--; } } QList problemList; for( int i=0; i= 0x040500 problems[problem.codecName][1].removeDuplicates(); #else QStringList found; for( int j=0; j:\n" + problems.value(codecName).at(1).join("\nor\n") + i18n("\n\nAffected files:\n") + affectedFiles.join("\n"); } } if( problemList.count() > 0 ) { CodecProblems *problemsDialog = new CodecProblems( CodecProblems::Decode, problemList, this ); problemsDialog->exec(); } // if( !messageList.isEmpty() ) // { // messageList.prepend( i18n("Some files can't be decoded.\nPossible solutions are listed below.") ); // QMessageBox *messageBox = new QMessageBox( this ); // messageBox->setIcon( QMessageBox::Information ); // messageBox->setWindowTitle( i18n("Missing backends") ); // messageBox->setText( messageList.join("\n\n").replace("\n","
") ); // messageBox->setTextFormat( Qt::RichText ); // messageBox->exec(); // } if( !filesNotFound.isEmpty() ) { int filesNotFoundCount = filesNotFound.count(); if( filesNotFoundCount > 5 ) { do { filesNotFound.removeLast(); } while( filesNotFound.count() >= 5 ); filesNotFound += i18n("... and %1 more files",filesNotFoundCount-4); } filesNotFound.prepend( i18n("The following files couldn't be found:\n") ); QMessageBox *messageBox = new QMessageBox( this ); messageBox->setIcon( QMessageBox::Information ); messageBox->setWindowTitle( i18n("Files not found") ); messageBox->setText( filesNotFound.join("\n").replace("\n","
") ); messageBox->setTextFormat( Qt::RichText ); messageBox->exec(); } if( urls.count() <= 0 ) reject(); } void PlaylistOpener::okClickedSlot() { ConversionOptions *conversionOptions = options->currentConversionOptions(); if( conversionOptions ) { options->accepted(); emit open( urls, conversionOptions ); accept(); } else { KMessageBox::error( this, i18n("No conversion options selected.") ); } } ./soundkonverter-2.1.2/opener/PaxHeaders.4329/urlopener.cpp0000644000000000000000000000013212276440204020427 xustar0030 mtime=1392132228.508615347 30 atime=1392132228.508615347 30 ctime=1418040695.115717304 ./soundkonverter-2.1.2/opener/urlopener.cpp0000644000175000001440000001060412276440204021425 0ustar00danielusers00000000000000// // C++ Implementation: opener // // Description: // // // Author: Daniel Faust , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "urlopener.h" #include "../options.h" #include "../config.h" #include #include #include #include #include #include #include #include // TODO enable proceed button only if at least one file got selected // copy'n'paste error ??? // TODO message box if url can't be added -> maybe in file list UrlOpener::UrlOpener( Config *_config, QWidget *parent, Qt::WFlags f ) : KDialog( parent, f ), config( _config ) { setCaption( i18n("Add url") ); setWindowIcon( KIcon("network-workgroup") ); setButtons( 0 ); page = FileOpenPage; const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); QWidget *widget = new QWidget(); setMainWidget( widget ); QGridLayout *mainGrid = new QGridLayout( widget ); QGridLayout *topGrid = new QGridLayout( widget ); mainGrid->addLayout( topGrid, 0, 0 ); lSelector = new QLabel( i18n("1. Enter url"), widget ); QFont font; font.setBold( true ); lSelector->setFont( font ); topGrid->addWidget( lSelector, 0, 0 ); lOptions = new QLabel( i18n("2. Set conversion options"), widget ); topGrid->addWidget( lOptions, 0, 1 ); // draw a horizontal line QFrame *lineFrame = new QFrame( widget ); lineFrame->setFrameShape( QFrame::HLine ); lineFrame->setFrameShadow( QFrame::Sunken ); mainGrid->addWidget( lineFrame, 1, 0 ); QVBoxLayout *urlBox = new QVBoxLayout(); mainGrid->addLayout( urlBox, 2, 0 ); urlBox->addSpacing( 6*fontHeight ); urlRequester = new KUrlRequester( widget ); urlRequester->setMode( KFile::File | KFile::ExistingOnly ); urlBox->addWidget( urlRequester ); urlBox->addStretch(); options = new Options( config, i18n("Select your desired output options and click on \"Ok\"."), widget ); mainGrid->addWidget( options, 2, 0 ); adjustSize(); options->hide(); // add a horizontal box layout for the control elements QHBoxLayout *controlBox = new QHBoxLayout(); mainGrid->addLayout( controlBox, 5, 0 ); controlBox->addStretch(); pProceed = new KPushButton( KIcon("go-next"), i18n("Proceed"), widget ); controlBox->addWidget( pProceed ); connect( pProceed, SIGNAL(clicked()), this, SLOT(proceedClickedSlot()) ); pAdd = new KPushButton( KIcon("dialog-ok"), i18n("Ok"), widget ); controlBox->addWidget( pAdd ); pAdd->hide(); connect( pAdd, SIGNAL(clicked()), this, SLOT(okClickedSlot()) ); pCancel = new KPushButton( KIcon("dialog-cancel"), i18n("Cancel"), widget ); controlBox->addWidget( pCancel ); connect( pCancel, SIGNAL(clicked()), this, SLOT(reject()) ); // Prevent the dialog from beeing too wide because of the directory history if( parent && width() > parent->width() ) setInitialSize( QSize(parent->width()-fontHeight,sizeHint().height()) ); KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group = conf->group( "UrlOpener" ); restoreDialogSize( group ); } UrlOpener::~UrlOpener() { KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group = conf->group( "UrlOpener" ); saveDialogSize( group ); } void UrlOpener::proceedClickedSlot() { if( page == FileOpenPage ) { if( !urlRequester->url().isValid() ) { KMessageBox::information( this, i18n("The Url you entered is invalid. Please try again.") ); return; } urls = urlRequester->url(); urlRequester->hide(); options->show(); page = ConversionOptionsPage; QFont font; font.setBold( false ); lSelector->setFont( font ); font.setBold( true ); lOptions->setFont( font ); pProceed->hide(); pAdd->show(); } } void UrlOpener::okClickedSlot() { if( page == ConversionOptionsPage ) { ConversionOptions *conversionOptions = options->currentConversionOptions(); if( conversionOptions ) { options->accepted(); emit open( urls, conversionOptions ); accept(); } else { KMessageBox::error( this, i18n("No conversion options selected.") ); } } } ./soundkonverter-2.1.2/opener/PaxHeaders.4329/urlopener.h0000644000000000000000000000006211615742331020100 xustar0020 atime=1308764510 30 ctime=1418040695.115717304 ./soundkonverter-2.1.2/opener/urlopener.h0000644000175000001440000000220111615742331021066 0ustar00danielusers00000000000000// // C++ Interface: opener // // Description: // // // Author: Daniel Faust , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef URLOPENER_H #define URLOPENER_H #include #include class Config; class Options; class QLabel; class ConversionOptions; class KDialog; class KFileWidget; class KPushButton; class KUrlRequester; /** @author Daniel Faust */ class UrlOpener : public KDialog { Q_OBJECT public: enum DialogPage { FileOpenPage, ConversionOptionsPage }; UrlOpener( Config *_config, QWidget *parent=0, Qt::WFlags f=0 ); ~UrlOpener(); DialogPage currentPage() { return page; } private: Config *config; KUrlRequester *urlRequester; Options *options; DialogPage page; QLabel *lSelector; QLabel *lOptions; KUrl::List urls; KPushButton *pProceed; KPushButton *pAdd; KPushButton *pCancel; private slots: void proceedClickedSlot(); void okClickedSlot(); signals: void open( const KUrl::List& files, ConversionOptions *conversionOptions ); }; #endif ./soundkonverter-2.1.2/PaxHeaders.4329/filelistitem.cpp0000644000000000000000000000013012441312442017610 xustar0029 mtime=1418040610.31084048 29 atime=1418040610.31084048 30 ctime=1418040695.113717307 ./soundkonverter-2.1.2/filelistitem.cpp0000644000175000001440000001304712441312442020614 0ustar00danielusers00000000000000 #include "filelistitem.h" #include FileListItem::FileListItem( QTreeWidget *parent, QTreeWidgetItem *after ) : QTreeWidgetItem( parent, after ), tags( 0 ) { conversionOptionsId = -1; state = WaitingForConversion; local = true; track = -1; tracks = 0; length = 0; logId = -1; } FileListItem::FileListItem( QTreeWidget *parent ) : QTreeWidgetItem( parent ), tags( 0 ) { conversionOptionsId = -1; state = WaitingForConversion; local = true; track = -1; tracks = 0; length = 0; logId = -1; } FileListItem::~FileListItem() { if( tags ) delete tags; if( lInfo.data() ) delete lInfo.data(); } FileListItemDelegate::FileListItemDelegate( QObject *parent ) : QItemDelegate( parent ) {} // TODO margin void FileListItemDelegate::paint( QPainter *painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const { FileListItem *item = static_cast( index.internalPointer() ); QColor backgroundColor; painter->save(); QStyleOptionViewItem _option = option; bool isConverting = false; bool isFailed = false; if( item ) { switch( item->state ) { case FileListItem::WaitingForConversion: break; case FileListItem::Ripping: isConverting = true; break; case FileListItem::Converting: isConverting = true; break; case FileListItem::ApplyingReplayGain: isConverting = true; break; case FileListItem::WaitingForAlbumGain: break; case FileListItem::ApplyingAlbumGain: isConverting = true; break; case FileListItem::Stopped: switch( item->returnCode ) { case FileListItem::Succeeded: break; case FileListItem::SucceededWithProblems: break; case FileListItem::StoppedByUser: break; case FileListItem::BackendNeedsConfiguration: isFailed = true; break; case FileListItem::DiscFull: isFailed = true; break; case FileListItem::Skipped: break; case FileListItem::Failed: isFailed = true; break; } break; } } if( isConverting ) { if( option.state & QStyle::State_Selected ) { backgroundColor = QColor(215,102,102); // hsv: 0, 134, 215 } else { backgroundColor = QColor(255,234,234); // hsv: 0, 21, 255 } } else if( isFailed ) { if( option.state & QStyle::State_Selected ) { backgroundColor = QColor(235,154, 49); // hsv: 34, 202, 235 } else { backgroundColor = QColor(255,204,156); // hsv: 29, 99, 255 } } else { if( option.state & QStyle::State_Selected ) { backgroundColor = option.palette.highlight().color(); } else { backgroundColor = option.palette.base().color(); } } painter->fillRect( option.rect, backgroundColor ); int m_left, m_top, m_right, m_bottom; item->treeWidget()->getContentsMargins( &m_left, &m_top, &m_right, &m_bottom ); //QRect m_rect = QRect( option.rect.x()+m_left, option.rect.y()+m_top, option.rect.width()-m_left-m_right, option.rect.height()-m_top-m_bottom ); QRect m_rect = QRect( option.rect.x()+m_left, option.rect.y(), option.rect.width()-m_left-m_right, option.rect.height() ); if( index.column() == 1 || index.column() == 2 ) { QRect textRect = painter->boundingRect( QRect(), Qt::AlignLeft|Qt::TextSingleLine, item->text(index.column()) ); if ( textRect.width() < m_rect.width() ) { painter->drawText( m_rect, Qt::TextSingleLine|Qt::TextExpandTabs, item->text(index.column()) ); } else { //textRect = painter->boundingRect( QRect(), Qt::AlignLeft, "... " ); painter->drawText( m_rect, Qt::AlignRight|Qt::TextSingleLine|Qt::TextExpandTabs, item->text(index.column()) ); QLinearGradient linearGrad( QPoint(m_rect.x(),0), QPoint(m_rect.x()+15,0) ); linearGrad.setColorAt( 0, backgroundColor ); backgroundColor.setAlpha( 0 ); linearGrad.setColorAt( 1, backgroundColor ); painter->fillRect( m_rect.x(), m_rect.y(), 15, m_rect.height(), linearGrad ); } } else { painter->drawText( m_rect, Qt::TextSingleLine|Qt::TextExpandTabs, item->text(index.column()) ); } //QItemDelegate::paint( painter, _option, index ); painter->restore(); // int progress = (index.row() != 0 ? 100 / index.row() : 0); // // // draw your cool progress bar here // QStyleOptionProgressBar opt; // opt.rect = option.rect; // opt.minimum = 0; // opt.maximum = 100; // opt.progress = progress; // opt.text = QString("%1%").arg(progress); // opt.textVisible = true; // QApplication::style()->drawControl(QStyle::CE_ProgressBar, &opt, painter, 0); // maybe even let default implementation draw list item contents? // QItemDelegate::paint(painter, option, index); } ./soundkonverter-2.1.2/PaxHeaders.4329/conversionoptionsmanager.h0000644000000000000000000000006211304233715021725 xustar0020 atime=1308764510 30 ctime=1418040695.111717311 ./soundkonverter-2.1.2/conversionoptionsmanager.h0000644000175000001440000000211111304233715022713 0ustar00danielusers00000000000000// // C++ Interface: conversionoptionsmanager // // Description: // // // Author: Daniel Faust , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #ifndef CONVERSIONOPTIONSMANAGER_H #define CONVERSIONOPTIONSMANAGER_H #include class ConversionOptions; class PluginLoader; /** @author Daniel Faust */ class ConversionOptionsManager { public: struct ConversionOptionsElement { int id; int references; ConversionOptions *conversionOptions; }; ConversionOptionsManager( PluginLoader *_pluginLoader ); ~ConversionOptionsManager(); int addConversionOptions( ConversionOptions *conversionOptions ); int increaseReferences( int id ); ConversionOptions *getConversionOptions( int id ); void removeConversionOptions( int id ); int updateConversionOptions( int id, ConversionOptions *conversionOptions ); QList getAllIds(); private: PluginLoader *pluginLoader; QList elements; int idCounter; }; #endif ./soundkonverter-2.1.2/PaxHeaders.4329/filelist.h0000644000000000000000000000013212322502573016404 xustar0030 mtime=1397392763.910331388 30 atime=1397392763.910331388 30 ctime=1418040695.113717307 ./soundkonverter-2.1.2/filelist.h0000755000175000001440000001166012322502573017410 0ustar00danielusers00000000000000 #ifndef FILELIST_H #define FILELIST_H #include #include "filelistitem.h" #include // #include class FileListItem; class Config; class Logger; class TagEngine; class OptionsEditor; class OptionsLayer; class ConversionOptions; class QMenu; class KAction; class QProgressBar; /** * @short The file list * @author Daniel Faust * @version 0.3 */ class FileList : public QTreeWidget { Q_OBJECT public: enum Columns { Column_State = 0, Column_Input = 1, Column_Output = 2, Column_Quality = 3 }; /** Constructor */ FileList( Logger *_logger, Config *_config, QWidget *parent = 0 ); /** Destructor */ ~FileList(); FileListItem *topLevelItem( int index ) const { return static_cast( QTreeWidget::topLevelItem(index) ); } // FileListItem *itemAbove( FileListItem* item ) const { return static_cast( QTreeWidget::itemAbove(item) ); } // FileListItem *itemBelow( FileListItem* item ) const { return static_cast( QTreeWidget::itemBelow(item) ); } void setOptionsLayer( OptionsLayer *_optionsLayer ) { optionsLayer = _optionsLayer; } void load( bool user = false ); void updateAllItems(); // Gets triggered if the configuration changes and the file list needs to be updated void updateItem( FileListItem *item ); bool waitForAlbumGain( FileListItem *item ); private: /** Counts all files in a directory */ int countDir( const QString& directory, bool recursive, int count = 0 ); /** Lists all files in a directory and adds them to the file list */ int listDir( const QString& directory, const QStringList& filter, bool recursive, int conversionOptionsId, int count = 0 ); /** A progressbar, that is shown, when a directory is added recursive */ QProgressBar *pScanStatus; /** Update timer for the scan status */ QTime tScanStatus; // debug // int TimeCount; // QTime Time; void convertNextItem(); int waitingCount(); int convertingCount( bool includeWaiting = false ); // qulonglong spaceLeftForDirectory( const QString& dir ); // QStringList fullDiscs; // a list of mount points with volumes that don't have enougth space left QList selectedFiles; void dragEnterEvent( QDragEnterEvent *event ); void dropEvent( QDropEvent *event ); void resizeEvent( QResizeEvent *event ); bool queue; Logger *logger; Config *config; TagEngine *tagEngine; OptionsEditor *optionsEditor; OptionsLayer *optionsLayer; QMenu *contextMenu; KAction *editAction; KAction *startAction; KAction *stopAction; KAction *removeAction; // KAction* paste; private slots: void showContextMenu( const QPoint& point ); void showOptionsEditorDialog(); void removeSelectedItems(); void convertSelectedItems(); void killSelectedItems(); void itemsSelected(); // connected to OptionsEditor void updateItems( QList items ); void selectPreviousItem(); void selectNextItem(); void showLogClicked( const QString& logIdString ); public slots: // connected to soundKonverterView void addFiles( const KUrl::List& fileList, ConversionOptions *conversionOptions, const QString& notifyCommand = "", const QString& _codecName = "", int conversionOptionsId = -1 ); void addDir( const KUrl& directory, bool recursive, const QStringList& codecList, ConversionOptions *conversionOptions ); void addTracks( const QString& device, QList trackList, int tracks, QList tagList, ConversionOptions *conversionOptions, const QString& notifyCommand = "" ); void startConversion(); void killConversion(); void stopConversion(); void continueConversion(); void save( bool user = false ); // connected to Convert /** The conversion of an item has finished and the state is reported */ void itemFinished( FileListItem *item, FileListItem::ReturnCode returnCode, bool waitingForAlbumGain = false ); /** The ripping of a track has finished, so the device is free for ripping the next track */ void rippingFinished( const QString& device ); signals: // connected to ProgressIndicator void timeChanged( float timeDelta ); void finished( bool ); // connected to soundKonverterView void fileCountChanged( int count ); void conversionStarted(); void conversionStopped( bool failed ); void queueModeChanged( bool enabled ); void showLog( const int logId ); // void stopClicked(); // void continueClicked(); // connected to Convert void convertItem( FileListItem* ); void killItem( FileListItem* ); void replaygainItems( QList ); // connected to OptionsEditor void editItems( QList ); void setPreviousItemEnabled( bool ); void setNextItemEnabled( bool ); void itemRemoved( FileListItem* ); }; #endif // FILELIST_H ./soundkonverter-2.1.2/PaxHeaders.4329/convert.cpp0000644000000000000000000000013212441312442016600 xustar0030 mtime=1418040610.309840481 30 atime=1418040610.308840482 30 ctime=1418040695.114717305 ./soundkonverter-2.1.2/convert.cpp0000644000175000001440000015001412441312442017576 0ustar00danielusers00000000000000 #include "convert.h" #include "convertitem.h" #include "config.h" #include "core/codecplugin.h" #include "core/conversionoptions.h" #include "filelist.h" #include "global.h" #include "logger.h" #include "outputdirectory.h" #include #include #include #include #include #include Convert::Convert( Config *_config, FileList *_fileList, Logger *_logger, QObject *parent ) : QObject( parent ), config( _config ), fileList( _fileList ), logger( _logger ) { connect( &updateTimer, SIGNAL(timeout()), this, SLOT(updateProgress()) ); QList codecPlugins = config->pluginLoader()->getAllCodecPlugins(); for( int i=0; i filterPlugins = config->pluginLoader()->getAllFilterPlugins(); for( int i=0; i replaygainPlugins = config->pluginLoader()->getAllReplayGainPlugins(); for( int i=0; i ripperPlugins = config->pluginLoader()->getAllRipperPlugins(); for( int i=0; itake > 0 ) remove( item, FileListItem::Failed ); logger->log( item->logID, i18n("Getting file") ); item->state = ConvertItem::get; item->tempInputUrl = item->generateTempUrl( "download", item->inputUrl.fileName().mid(item->inputUrl.fileName().lastIndexOf(".")+1) ); if( !updateTimer.isActive() ) updateTimer.start( ConfigUpdateDelay ); logger->log( item->logID, i18n("Copying \"%1\" to \"%2\"",item->inputUrl.pathOrUrl(),item->tempInputUrl.toLocalFile()) ); item->kioCopyJob = KIO::file_copy( item->inputUrl, item->tempInputUrl, 0700 , KIO::HideProgressInfo ); connect( item->kioCopyJob.data(), SIGNAL(result(KJob*)), this, SLOT(kioJobFinished(KJob*)) ); connect( item->kioCopyJob.data(), SIGNAL(percent(KJob*,unsigned long)), this, SLOT(kioJobProgress(KJob*,unsigned long)) ); } void Convert::convert( ConvertItem *item ) { if( !item ) return; ConversionOptions *conversionOptions = config->conversionOptionsManager()->getConversionOptions( item->fileListItem->conversionOptionsId ); if( !conversionOptions ) return; KUrl inputUrl; if( !item->tempInputUrl.toLocalFile().isEmpty() ) inputUrl = item->tempInputUrl; else inputUrl = item->inputUrl; if( !item->fileListItem->tags ) item->fileListItem->tags = config->tagEngine()->readTags( inputUrl ); if( item->outputUrl.isEmpty() ) { // item->outputUrl = !item->fileListItem->outputUrl.url().isEmpty() ? item->fileListItem->outputUrl : OutputDirectory::calcPath( item->fileListItem, config, usedOutputNames.values() ); item->outputUrl = OutputDirectory::calcPath( item->fileListItem, config, usedOutputNames.values() ); if( QFile::exists(item->outputUrl.toLocalFile()) ) { logger->log( item->logID, "\tOutput file already exists" ); item->outputUrl = KUrl(); remove( item, FileListItem::Skipped ); return; } OutputDirectory::makePath( item->outputUrl ); fileList->updateItem( item->fileListItem ); } usedOutputNames.insert( item->logID, item->outputUrl.toLocalFile() ); if( item->take > item->conversionPipes.count() - 1 ) { logger->log( item->logID, "\t" + i18n("No more backends left to try :(") ); remove( item, FileListItem::Failed ); return; } if( item->take > 0 ) item->updateTimes(); item->conversionPipesStep = -1; if( !updateTimer.isActive() ) updateTimer.start( ConfigUpdateDelay ); if( item->conversionPipes.at(item->take).trunks.count() == 1 ) // conversion can be done by one plugin alone { logger->log( item->logID, i18n("Converting") ); item->state = ConvertItem::convert; item->conversionPipesStep = 0; item->backendPlugin = item->conversionPipes.at(item->take).trunks.at(0).plugin; if( item->backendPlugin->type() == "codec" || item->backendPlugin->type() == "filter" ) { bool useInternalReplayGain = false; if( item->conversionPipes.at(item->take).trunks.at(0).data.hasInternalReplayGain && item->mode & ConvertItem::replaygain ) { foreach( Config::CodecData codecData, config->data.backends.codecs ) { if( codecData.codecName == item->conversionPipes.at(item->take).trunks.at(0).codecTo ) { if( codecData.replaygain.first() == i18n("Try internal") ) useInternalReplayGain = true; break; } } } if( useInternalReplayGain ) { item->internalReplayGainUsed = true; } item->backendID = qobject_cast(item->backendPlugin)->convert( inputUrl, item->outputUrl, item->conversionPipes.at(item->take).trunks.at(0).codecFrom, item->conversionPipes.at(item->take).trunks.at(0).codecTo, conversionOptions, item->fileListItem->tags, useInternalReplayGain ); } else if( item->backendPlugin->type() == "ripper" ) { item->backendID = qobject_cast(item->backendPlugin)->rip( item->fileListItem->device, item->fileListItem->track, item->fileListItem->tracks, item->outputUrl ); } if( item->backendID < 100 ) { switch( item->backendID ) { case BackendPlugin::BackendNeedsConfiguration: { logger->log( item->logID, "\t" + i18n("Conversion failed. At least one of the used backends needs to be configured properly.") ); remove( item, FileListItem::BackendNeedsConfiguration ); break; } case BackendPlugin::FeatureNotSupported: { logger->log( item->logID, "\t" + i18n("Conversion failed. The preferred plugin lacks support for a necessary feature.") ); executeSameStep( item ); break; } case BackendPlugin::UnknownError: { logger->log( item->logID, "\t" + i18n("Conversion failed. Unknown Error.") ); executeSameStep( item ); break; } } } else if( item->backendPlugin->type() == "ripper" ) { item->fileListItem->state = FileListItem::Ripping; } } else // conversion needs two plugins or more { bool usePipes = false; bool useInternalReplayGain = false; QStringList commandList; if( config->data.advanced.usePipes ) { usePipes = true; const int stepCount = item->conversionPipes.at(item->take).trunks.count() - 1; int step = 0; foreach( const ConversionPipeTrunk trunk, item->conversionPipes.at(item->take).trunks ) { BackendPlugin *plugin = trunk.plugin; QStringList command; const KUrl inUrl = ( step == 0 ) ? inputUrl : KUrl(); const KUrl outUrl = ( step == stepCount ) ? item->outputUrl : KUrl(); if( plugin->type() == "codec" || plugin->type() == "filter" ) { if( step == stepCount && trunk.data.hasInternalReplayGain && item->mode & ConvertItem::replaygain ) { foreach( Config::CodecData codecData, config->data.backends.codecs ) { if( codecData.codecName == trunk.codecTo ) { if( codecData.replaygain.first() == i18n("Try internal") ) useInternalReplayGain = true; break; } } } command = qobject_cast(plugin)->convertCommand( inUrl, outUrl, item->conversionPipes.at(item->take).trunks.at(step).codecFrom, item->conversionPipes.at(item->take).trunks.at(step).codecTo, conversionOptions, item->fileListItem->tags, useInternalReplayGain ); } else if( plugin->type() == "ripper" ) { command = qobject_cast(plugin)->ripCommand( item->fileListItem->device, item->fileListItem->track, item->fileListItem->tracks, outUrl ); } if( command.isEmpty() ) { usePipes = false; break; } commandList.append( command.join(" ") ); step++; } } if( usePipes ) { // both plugins support pipes const QString command = commandList.join(" | "); if( useInternalReplayGain ) item->internalReplayGainUsed = true; logger->log( item->logID, i18n("Converting") ); item->state = ConvertItem::convert; // merge all conversion times into one since we are doing everything in one step float time = 0.0f; foreach( float t, item->convertTimes ) { time += t; } item->convertTimes.clear(); item->convertTimes.append( time ); item->conversionPipesStep = 0; logger->log( item->logID, "
\t" + command + "
" ); item->process = new KProcess(); item->process.data()->setOutputChannelMode( KProcess::MergedChannels ); connect( item->process.data(), SIGNAL(readyRead()), this, SLOT(processOutput()) ); connect( item->process.data(), SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(processExit(int,QProcess::ExitStatus)) ); item->process.data()->clearProgram(); item->process.data()->setShellCommand( command ); item->process.data()->start(); } else { // at least on plugins doesn't support pipes // estimated size of the wav file int estimatedFileSize = 0; if( item->conversionPipes.at(item->take).trunks.first().plugin->type() == "ripper" && item->fileListItem->tags ) { estimatedFileSize = item->fileListItem->tags->length * 44100*16*2/8/1024/1024; } else { QFileInfo fileInfo( inputUrl.toLocalFile() ); estimatedFileSize = fileInfo.size(); if( config->pluginLoader()->isCodecLossless(item->fileListItem->codecName) ) { estimatedFileSize *= 1.4; } else if( item->fileListItem->codecName == "midi" || item->fileListItem->codecName == "mod" ) { estimatedFileSize *= 1000; } else { estimatedFileSize *= 10; } estimatedFileSize /= 1024*1024; } const bool useSharedMemory = config->data.advanced.useSharedMemoryForTempFiles && estimatedFileSize > 0 && estimatedFileSize < config->data.advanced.maxSizeForSharedMemoryTempFiles; for( int i=0; iconversionPipes.at(item->take).trunks.count()-1; i++ ) { item->tempConvertUrls += item->generateTempUrl( "convert", config->pluginLoader()->codecExtensions(item->conversionPipes.at(item->take).trunks.at(i).codecTo).first(), useSharedMemory ); } convertNextBackend( item ); } } } void Convert::convertNextBackend( ConvertItem *item ) { if( !item ) return; ConversionOptions *conversionOptions = config->conversionOptionsManager()->getConversionOptions( item->fileListItem->conversionOptionsId ); if( !conversionOptions ) return; const int stepCount = item->conversionPipes.at(item->take).trunks.count() - 1; const int step = ++item->conversionPipesStep; if( step > stepCount ) { executeNextStep( item ); } BackendPlugin *plugin = item->conversionPipes.at(item->take).trunks.at(step).plugin; if( !plugin ) return; KUrl inputUrl; if( !item->tempInputUrl.toLocalFile().isEmpty() ) inputUrl = item->tempInputUrl; else inputUrl = item->inputUrl; const KUrl inUrl = ( step == 0 ) ? inputUrl : item->tempConvertUrls.at(step - 1); const KUrl outUrl = ( step == stepCount ) ? item->outputUrl : item->tempConvertUrls.at(step); if( step == 0 ) { if( plugin->type() == "ripper" ) { item->state = ConvertItem::rip; logger->log( item->logID, i18n("Ripping") ); } else if( plugin->type() == "codec" || ( plugin->type() == "filter" && item->conversionPipes.at(item->take).trunks.at(step).codecFrom != "wav" ) ) { item->state = ConvertItem::decode; logger->log( item->logID, i18n("Decoding") ); } else if( plugin->type() == "filter" ) { item->state = ConvertItem::filter; logger->log( item->logID, i18n("Applying filter") ); } } else if( step == stepCount ) { if( plugin->type() == "codec" || ( plugin->type() == "filter" && item->conversionPipes.at(item->take).trunks.at(step).codecTo != "wav" ) ) { item->state = ConvertItem::encode; logger->log( item->logID, i18n("Encoding") ); } else if( plugin->type() == "filter" ) { item->state = ConvertItem::filter; logger->log( item->logID, i18n("Applying filter") ); } } else { item->state = ConvertItem::filter; logger->log( item->logID, i18n("Applying filter") ); } item->backendPlugin = plugin; if( plugin->type() == "codec" || plugin->type() == "filter" ) { bool useInternalReplayGain = false; if( step == stepCount && item->conversionPipes.at(item->take).trunks.at(step).data.hasInternalReplayGain && item->mode & ConvertItem::replaygain ) { foreach( Config::CodecData codecData, config->data.backends.codecs ) { if( codecData.codecName == item->conversionPipes.at(item->take).trunks.at(step).codecTo ) { if( codecData.replaygain.first() == i18n("Try internal") ) useInternalReplayGain = true; break; } } } if( useInternalReplayGain ) { item->internalReplayGainUsed = true; } item->backendID = qobject_cast(plugin)->convert( inUrl, outUrl, item->conversionPipes.at(item->take).trunks.at(step).codecFrom, item->conversionPipes.at(item->take).trunks.at(step).codecTo, conversionOptions, item->fileListItem->tags, useInternalReplayGain ); } else if( plugin->type() == "ripper" ) { item->backendID = qobject_cast(plugin)->rip( item->fileListItem->device, item->fileListItem->track, item->fileListItem->tracks, outUrl ); } if( item->backendID < 100 ) { switch( item->backendID ) { case BackendPlugin::BackendNeedsConfiguration: { logger->log( item->logID, "\t" + i18n("Conversion failed. At least one of the used backends needs to be configured properly.") ); remove( item, FileListItem::BackendNeedsConfiguration ); break; } case BackendPlugin::FeatureNotSupported: { logger->log( item->logID, "\t" + i18n("Conversion failed. The preferred plugin lacks support for a necessary feature.") ); executeSameStep( item ); break; } case BackendPlugin::UnknownError: { logger->log( item->logID, "\t" + i18n("Conversion failed. Unknown Error.") ); executeSameStep( item ); break; } } } else if( item->backendPlugin->type() == "ripper" ) { item->fileListItem->state = FileListItem::Ripping; } } void Convert::replaygain( ConvertItem *item ) { if( !item ) return; const QString albumName = item->fileListItem->tags ? item->fileListItem->tags->album : ""; if( fileList->waitForAlbumGain(item->fileListItem) ) { logger->log( item->logID, i18n("Skipping Replay Gain, Album Gain will be calculated later") ); albumGainItems[albumName].append( item ); item->state = ConvertItem::replaygain; executeNextStep( item ); return; } QList albumItems; if( !albumName.isEmpty() ) albumItems = albumGainItems[albumName]; albumItems.append( item ); logger->log( item->logID, i18n("Applying Replay Gain") ); if( item->take > item->replaygainPipes.count() - 1 ) { logger->log( item->logID, "\t" + i18n("No more backends left to try :(") ); remove( item, FileListItem::Failed ); return; } item->state = ConvertItem::replaygain; item->backendPlugin = item->replaygainPipes.at(item->take).plugin; KUrl::List urlList; QStringList directories; foreach( ConvertItem *albumItem, albumItems ) { urlList.append( albumItem->outputUrl ); directories.append( albumItem->outputUrl.directory() ); if( albumItem != item ) { albumItem->fileListItem->state = FileListItem::ApplyingAlbumGain; fileList->updateItem( albumItem->fileListItem ); } } bool waitForVorbisGainFinish = false; if( item->backendPlugin->name() == "Vorbis Gain" ) { foreach( const QString directory, directories ) { if( activeVorbisGainDirectories.contains(directory) ) { waitForVorbisGainFinish = true; break; } } if( waitForVorbisGainFinish ) { logger->log( item->logID, i18n("Waiting for running Vorbis Gain process to finish") ); item->state = ConvertItem::wait_replaygain; item->fileListItem->state = FileListItem::WaitingForAlbumGain; fileList->updateItem( item->fileListItem ); emit finished( 0, FileListItem::Failed, false ); // send signal to FileList; trigger call of FileList::convertNextItem() return; } else { activeVorbisGainDirectories.append( directories ); } } item->backendID = qobject_cast(item->backendPlugin)->apply( urlList ); if( item->backendID < 100 ) { switch( item->backendID ) { case BackendPlugin::BackendNeedsConfiguration: { logger->log( item->logID, "\t" + i18n("Conversion failed. At least one of the used backends needs to be configured properly.") ); remove( item, FileListItem::BackendNeedsConfiguration ); break; } case BackendPlugin::FeatureNotSupported: { logger->log( item->logID, "\t" + i18n("Conversion failed. The preferred plugin lacks support for a necessary feature.") ); executeSameStep( item ); break; } case BackendPlugin::UnknownError: { logger->log( item->logID, "\t" + i18n("Conversion failed. Unknown Error.") ); executeSameStep( item ); break; } } } if( !updateTimer.isActive() ) updateTimer.start( ConfigUpdateDelay ); } void Convert::writeTags( ConvertItem *item ) { if( !item || !item->fileListItem || !item->fileListItem->tags ) return; logger->log( item->logID, i18n("Writing tags") ); // item->state = ConvertItem::write_tags; // item->fileListItem->setText( 0, i18n("Writing tags")+"... 00 %" ); config->tagEngine()->writeTags( item->outputUrl, item->fileListItem->tags ); KUrl inputUrl; if( !item->tempInputUrl.toLocalFile().isEmpty() ) inputUrl = item->tempInputUrl; else inputUrl = item->inputUrl; if( !(item->fileListItem->tags->tagsRead & TagData::Covers) ) { item->fileListItem->tags->covers = config->tagEngine()->readCovers( inputUrl ); item->fileListItem->tags->tagsRead = TagData::TagsRead(item->fileListItem->tags->tagsRead | TagData::Covers); } const bool success = config->tagEngine()->writeCovers( item->outputUrl, item->fileListItem->tags->covers ); if( config->data.coverArt.writeCovers == 0 || ( config->data.coverArt.writeCovers == 1 && !success ) ) { config->tagEngine()->writeCoversToDirectory( item->outputUrl.directory(), item->fileListItem->tags ); } } // void Convert::executeUserScript( ConvertItem *item ) // { // logger->log( item->logID, i18n("Running user script") ); // item->state = ConvertItem::execute_userscript; // // KUrl source( item->fileListItem->options.filePathName ); // KUrl destination( item->outputFilePathName ); // // item->fileListItem->setText( 0, i18n("Running user script")+"... 00 %" ); // // item->convertProcess->clearProgram(); // // QString userscript = locate( "data", "soundkonverter/userscript.sh" ); // if( userscript == "" ) executeNextStep( item ); // // *(item->convertProcess) << userscript; // *(item->convertProcess) << source.path(); // *(item->convertProcess) << destination.path(); // // logger->log( item->logID, userscript + " \"" + source.path() + "\" \"" + destination.path() + "\"" ); // // // /* item->convertProcess->setPriority( config->data.general.priority ); // // item->convertProcess->start( KProcess::NotifyOnExit, KProcess::AllOutput );*/ // } void Convert::executeNextStep( ConvertItem *item ) { logger->log( item->logID, "
" + i18n("Executing next step") ); item->lastTake = item->take; item->take = 0; item->progress = 0.0f; switch( item->state ) { case ConvertItem::initial: { if( item->mode & ConvertItem::get ) get( item ); else if( item->mode & ConvertItem::convert ) convert( item ); else if( item->mode & ConvertItem::replaygain ) replaygain( item ); else remove( item, FileListItem::Succeeded ); break; } case ConvertItem::get: { if( item->mode & ConvertItem::convert ) convert( item ); else remove( item, FileListItem::Succeeded ); break; } case ConvertItem::convert: case ConvertItem::encode: { if( item->mode & ConvertItem::replaygain ) replaygain( item ); else remove( item, FileListItem::Succeeded ); break; } case ConvertItem::rip: case ConvertItem::decode: case ConvertItem::filter: { item->take = item->lastTake; convertNextBackend( item ); break; } case ConvertItem::wait_replaygain: { replaygain( item ); break; } case ConvertItem::replaygain: { remove( item, FileListItem::Succeeded ); break; } } } void Convert::executeSameStep( ConvertItem *item ) { item->take++; item->updateTimes(); item->progress = 0.0f; if( item->internalReplayGainUsed ) { item->mode = ConvertItem::Mode( item->mode | ConvertItem::replaygain ); item->internalReplayGainUsed = false; } switch( item->state ) { case ConvertItem::initial: { break; } case ConvertItem::get: { get( item ); return; } case ConvertItem::rip: case ConvertItem::convert: case ConvertItem::decode: case ConvertItem::filter: case ConvertItem::encode: { // remove temp/failed files foreach( const KUrl url, item->tempConvertUrls ) { if( QFile::exists(url.toLocalFile()) ) { QFile::remove( url.toLocalFile() ); } } if( QFile::exists(item->outputUrl.toLocalFile()) ) { QFile::remove( item->outputUrl.toLocalFile() ); } convert( item ); return; } case ConvertItem::wait_replaygain: case ConvertItem::replaygain: { replaygain( item ); return; } } remove( item, FileListItem::Failed ); // shouldn't be possible } void Convert::kioJobProgress( KJob *job, unsigned long percent ) { // search the item list for our item foreach( ConvertItem *item, items ) { if( item->kioCopyJob.data() == job ) { item->progress = (float)percent; } } } void Convert::kioJobFinished( KJob *job ) { // search the item list for our item foreach( ConvertItem *item, items ) { if( item->kioCopyJob.data() == job ) { item->kioCopyJob.data()->deleteLater(); if( job->error() == 0 ) // copy was successful { float fileTime; switch( item->state ) { case ConvertItem::get: { fileTime = item->getTime; break; } default: { fileTime = 0.0f; } } if( item->state == ConvertItem::get ) { if( !item->fileListItem->tags ) { item->fileListItem->tags = config->tagEngine()->readTags( item->tempInputUrl ); if( item->fileListItem->tags ) { logger->log( item->logID, i18n("Read tags successfully") ); } else { logger->log( item->logID, i18n("Unable to read tags") ); } } } item->finishedTime += fileTime; executeNextStep( item ); } else { // remove temp/failed files if( QFile::exists(item->tempInputUrl.toLocalFile()) ) { QFile::remove(item->tempInputUrl.toLocalFile()); logger->log( item->logID, i18nc("removing file","Removing: %1",item->tempInputUrl.toLocalFile()) ); } if( QFile::exists(item->tempInputUrl.toLocalFile()+".part") ) { QFile::remove(item->tempInputUrl.toLocalFile()+".part"); logger->log( item->logID, i18nc("removing file","Removing: %1",item->tempInputUrl.toLocalFile()+".part") ); } if( job->error() == 1 ) { remove( item, FileListItem::StoppedByUser ); } else { logger->log( item->logID, i18n("An error occurred. Error code: %1 (%2)",job->error(),job->errorString()) ); remove( item, FileListItem::Failed ); } } } } } void Convert::processOutput() { foreach( ConvertItem *item, items ) { if( item->process.data() == QObject::sender() ) { const QString output = item->process.data()->readAllStandardOutput().data(); bool logOutput = true; foreach( const ConversionPipeTrunk trunk, item->conversionPipes.at(item->take).trunks ) { const float progress = trunk.plugin->parseOutput( output ); if( progress > item->progress ) { item->progress = progress; logOutput = false; } } if( logOutput && !output.simplified().isEmpty() ) logger->log( item->logID, "
\t" + output.trimmed().replace("\n","
\t") + "
" ); break; } } } void Convert::processExit( int exitCode, QProcess::ExitStatus exitStatus ) { Q_UNUSED(exitStatus) if( QObject::sender() == 0 ) { logger->log( 1000, QString("Error: processExit was called from a null sender. Exit code: %1").arg(exitCode) ); KMessageBox::error( 0, QString("Error: processExit was called from a null sender. Exit code: %1").arg(exitCode) ); return; } // search the item list for our item foreach( ConvertItem *item, items ) { if( item->process.data() == QObject::sender() ) { item->process.data()->deleteLater(); // NOTE crash discovered here - probably fixed by using deleteLater if( item->killed ) { remove( item, FileListItem::StoppedByUser ); return; } if( exitCode == 0 ) { float fileTime; switch( item->state ) { case ConvertItem::initial: case ConvertItem::get: case ConvertItem::wait_replaygain: { fileTime = 0.0f; break; } case ConvertItem::convert: case ConvertItem::rip: case ConvertItem::decode: case ConvertItem::filter: case ConvertItem::encode: { fileTime = item->convertTimes.at(item->conversionPipesStep); break; } case ConvertItem::replaygain: { fileTime = item->replaygainTime; break; } } item->finishedTime += fileTime; if( item->state == ConvertItem::rip ) { item->fileListItem->state = FileListItem::Converting; emit rippingFinished( item->fileListItem->device ); } if( item->internalReplayGainUsed ) { item->mode = ConvertItem::Mode( item->mode ^ ConvertItem::replaygain ); } switch( item->state ) { case ConvertItem::rip: case ConvertItem::decode: case ConvertItem::filter: { convertNextBackend( item ); break; } default: { executeNextStep( item ); } } } else { logger->log( item->logID, "\t" + i18n("Conversion failed. Exit code: %1",exitCode) ); executeSameStep( item ); } } } } void Convert::pluginProcessFinished( int id, int exitCode ) { if( QObject::sender() == 0 ) { logger->log( 1000, QString("Error: pluginProcessFinished was called from a null sender. Exit code: %1").arg(exitCode) ); KMessageBox::error( 0, QString("Error: pluginProcessFinished was called from a null sender. Exit code: %1").arg(exitCode) ); return; } foreach( ConvertItem *item, items ) { if( item->backendPlugin && item->backendPlugin == QObject::sender() && item->backendID == id ) { item->backendID = -1; if( item->backendPlugin->name() == "Vorbis Gain" ) { activeVorbisGainDirectories.removeAll( item->outputUrl.directory() ); foreach( ConvertItem *nextItem, items ) { if( nextItem->state == ConvertItem::wait_replaygain && nextItem->backendPlugin->name() == "Vorbis Gain" ) { executeNextStep( nextItem ); break; } } } if( item->killed ) { remove( item, FileListItem::StoppedByUser ); return; } if( exitCode == 0 ) { float fileTime; switch( item->state ) { case ConvertItem::initial: case ConvertItem::get: case ConvertItem::wait_replaygain: { fileTime = 0.0f; break; } case ConvertItem::convert: case ConvertItem::rip: case ConvertItem::decode: case ConvertItem::filter: case ConvertItem::encode: { fileTime = item->convertTimes.at(item->conversionPipesStep); break; } case ConvertItem::replaygain: { fileTime = item->replaygainTime; break; } } item->finishedTime += fileTime; if( item->state == ConvertItem::rip ) { item->fileListItem->state = FileListItem::Converting; emit rippingFinished( item->fileListItem->device ); } if( item->internalReplayGainUsed ) { item->mode = ConvertItem::Mode( item->mode ^ ConvertItem::replaygain ); } executeNextStep( item ); } else { logger->log( item->logID, "\t" + i18n("Conversion failed. Exit code: %1",exitCode) ); executeSameStep( item ); } } } } void Convert::pluginLog( int id, const QString& message ) { // log all cached logs that can be logged now for( int i=0; ibackendPlugin && items.at(j)->backendPlugin == pluginLogQueue.at(i).plugin && items.at(j)->backendID == pluginLogQueue.at(i).id ) { for( int k=0; klog( items.at(j)->logID, pluginLogQueue.at(i).messages.at(k) ); } pluginLogQueue.removeAt(i); i--; break; } } } if( message.trimmed().isEmpty() ) return; // search the matching process for( int i=0; ibackendPlugin && items.at(i)->backendPlugin == QObject::sender() && items.at(i)->backendID == id ) { logger->log( items.at(i)->logID, message ); return; } } // if the process can't be found; add to the log queue for( int i=0; i(QObject::sender()); newLog.id = id; newLog.messages = QStringList(message); pluginLogQueue += newLog; // logger->log( 1000, qobject_cast(QObject::sender())->name() + ": " + message.trimmed().replace("\n","\n\t") ); } void Convert::add( FileListItem *fileListItem ) { KUrl fileName; if( fileListItem->track >= 0 ) { if( fileListItem->tags ) { fileName = KUrl( i18nc("identificator for the logger","CD track %1: %2 - %3",QString().sprintf("%02i",fileListItem->tags->track),fileListItem->tags->artist,fileListItem->tags->title) ); } else // shouldn't be possible { fileName = KUrl( i18nc("identificator for the logger","CD track %1",fileListItem->track) ); } } else { fileName = fileListItem->url; } logger->log( 1000, i18n("Adding new item to conversion list: '%1'",fileName.pathOrUrl()) ); ConvertItem *newItem = new ConvertItem( fileListItem ); items.append( newItem ); // register at the logger newItem->logID = logger->registerProcess( fileName.pathOrUrl() ); logger->log( 1000, "\t" + i18n("Got log ID: %1",QString::number(newItem->logID)) ); // TODO remove redundancy, logID is needed in the fileListItem newItem->fileListItem->logId = newItem->logID; // logger->log( newItem->logID, "Mime Type: " + newItem->fileListItem->mimeType ); // if( newItem->fileListItem->tags ) logger->log( newItem->logID, i18n("Tags successfully read") ); // else logger->log( newItem->logID, i18n("Reading tags failed") ); // set some variables to default values newItem->mode = (ConvertItem::Mode)0x0000; newItem->state = (ConvertItem::Mode)0x0000; newItem->inputUrl = fileListItem->url; ConversionOptions *conversionOptions = config->conversionOptionsManager()->getConversionOptions(fileListItem->conversionOptionsId); if( !conversionOptions ) { logger->log( 1000, "Convert::add(...) no ConversionOptions found" ); remove( newItem, FileListItem::Failed ); return; } if( fileListItem->track >= 0 ) { logger->log( newItem->logID, "\t" + i18n("Track number: %1, device: %2",QString::number(fileListItem->track),fileListItem->device) ); } newItem->conversionPipes = config->pluginLoader()->getConversionPipes( fileListItem->codecName, conversionOptions->codecName, conversionOptions->filterOptions, conversionOptions->pluginName ); logger->log( newItem->logID, "\t" + i18n("Possible conversion strategies:") ); for( int i=0; iconversionPipes.size(); i++ ) { QStringList pipe_str; for( int j=0; jconversionPipes.at(i).trunks.size(); j++ ) { pipe_str += QString("%1 %2 %3 (%4)").arg(newItem->conversionPipes.at(i).trunks.at(j).codecFrom).arg(QChar(10141)).arg(newItem->conversionPipes.at(i).trunks.at(j).codecTo).arg(newItem->conversionPipes.at(i).trunks.at(j).plugin->name()); } logger->log( newItem->logID, "\t\t" + pipe_str.join(", ") ); } if( conversionOptions->outputDirectoryMode != OutputDirectory::Source ) logger->log( newItem->logID, i18n("File system type: %1",conversionOptions->outputFilesystem) ); newItem->mode = ConvertItem::Mode( newItem->mode | ConvertItem::convert ); if( conversionOptions->replaygain ) { newItem->replaygainPipes = config->pluginLoader()->getReplayGainPipes( conversionOptions->codecName ); newItem->mode = ConvertItem::Mode( newItem->mode | ConvertItem::replaygain ); } if( !newItem->inputUrl.isLocalFile() && fileListItem->track == -1 ) newItem->mode = ConvertItem::Mode( newItem->mode | ConvertItem::get ); // if( (!newItem->inputUrl.isLocalFile() && item->track == -1) || newItem->inputUrl.url().toAscii() != newItem->inputUrl.url() ) // newItem->mode = ConvertItem::Mode( newItem->mode | ConvertItem::get ); newItem->updateTimes(); // (visual) feedback fileListItem->state = FileListItem::Converting; newItem->progressedTime.start(); // and start executeNextStep( newItem ); } void Convert::remove( ConvertItem *item, FileListItem::ReturnCode returnCode ) { // TODO "remove" (re-add) the times to the progress indicator //emit uncountTime( item->getTime + item->getCorrectionTime + item->ripTime + // item->decodeTime + item->encodeTime + item->replaygainTime ); QString exitMessage; bool waitForAlbumGain = false; const QString albumName = item->fileListItem->tags ? item->fileListItem->tags->album : ""; if( !albumName.isEmpty() ) waitForAlbumGain = albumGainItems[albumName].contains( item ); QFileInfo outputFileInfo( item->outputUrl.toLocalFile() ); float fileRatio = outputFileInfo.size(); if( item->fileListItem->track > 0 ) { fileRatio /= item->fileListItem->length*4*44100; } else if( !item->fileListItem->local ) { QFileInfo inputFileInfo( item->tempInputUrl.toLocalFile() ); fileRatio /= inputFileInfo.size(); } else { QFileInfo inputFileInfo( item->inputUrl.toLocalFile() ); fileRatio /= inputFileInfo.size(); } ConversionOptions *conversionOptions = config->conversionOptionsManager()->getConversionOptions( item->fileListItem->conversionOptionsId ); if( fileRatio < 0.01 && outputFileInfo.size() < 100000 && returnCode != FileListItem::StoppedByUser && ( !conversionOptions || !config->pluginLoader()->isCodecInferiorQuality(conversionOptions->codecName) ) ) { exitMessage = i18n("An error occurred, the output file size is less than one percent of the input file size"); if( returnCode == FileListItem::Succeeded || returnCode == FileListItem::SucceededWithProblems ) { logger->log( item->logID, i18n("Conversion failed, trying again. Exit code: -2 (%1)",exitMessage) ); item->take = item->lastTake; logger->log( item->logID, i18n("Removing partially converted output file") ); QFile::remove( item->outputUrl.toLocalFile() ); executeSameStep( item ); return; } } if( returnCode == FileListItem::Succeeded && item->lastTake > 0 ) returnCode = FileListItem::SucceededWithProblems; switch( returnCode ) { case FileListItem::Succeeded: exitMessage = i18nc("Conversion exit status","Normal exit"); break; case FileListItem::SucceededWithProblems: exitMessage = i18nc("Conversion exit status","Succeeded but problems occurred"); break; case FileListItem::StoppedByUser: exitMessage = i18nc("Conversion exit status","Aborted by the user"); break; case FileListItem::BackendNeedsConfiguration: exitMessage = i18nc("Conversion exit status","Backend needs configuration"); break; case FileListItem::DiscFull: exitMessage = i18nc("Conversion exit status","Not enough space on the output device"); break; case FileListItem::Skipped: exitMessage = i18nc("Conversion exit status","File already exists"); break; case FileListItem::Failed: exitMessage = i18nc("Conversion exit status","An error occurred"); break; } if( returnCode == FileListItem::Succeeded || returnCode == FileListItem::SucceededWithProblems ) writeTags( item ); if( !waitForAlbumGain && !item->fileListItem->notifyCommand.isEmpty() && ( !config->data.general.waitForAlbumGain || !conversionOptions->replaygain ) ) { QList albumItems; if( !albumName.isEmpty() ) albumItems = albumGainItems[albumName]; albumItems.append( item ); foreach( ConvertItem *albumItem, albumItems ) { QString command = albumItem->fileListItem->notifyCommand; // command.replace( "%u", albumItem->fileListItem->url ); command.replace( "%i", albumItem->inputUrl.toLocalFile() ); command.replace( "%o", albumItem->outputUrl.toLocalFile() ); logger->log( item->logID, i18n("Executing command: \"%1\"",command) ); QProcess::startDetached( command ); } } // remove temp/failed files if( QFile::exists(item->tempInputUrl.toLocalFile()) ) { QFile::remove(item->tempInputUrl.toLocalFile()); } foreach( const KUrl url, item->tempConvertUrls ) { if( QFile::exists(url.toLocalFile()) ) { QFile::remove( url.toLocalFile() ); } } if( returnCode != FileListItem::Succeeded && returnCode != FileListItem::SucceededWithProblems && returnCode != FileListItem::Skipped && QFile::exists(item->outputUrl.toLocalFile()) ) { logger->log( item->logID, i18n("Removing partially converted output file") ); QFile::remove(item->outputUrl.toLocalFile()); } usedOutputNames.remove( item->logID ); logger->log( item->logID, "
" + i18n("Removing file from conversion list. Exit code %1 (%2)",returnCode,exitMessage) ); logger->log( item->logID, "\t" + i18n("Conversion time") + ": " + Global::prettyNumber(item->progressedTime.elapsed(),"ms") ); logger->log( item->logID, "\t" + i18n("Output file size") + ": " + Global::prettyNumber(outputFileInfo.size(),"B") ); logger->log( item->logID, "\t" + i18n("File size ratio") + ": " + Global::prettyNumber(fileRatio*100,"%") ); emit timeFinished( item->fileListItem->length ); if( item->process.data() ) item->process.data()->deleteLater(); if( item->kioCopyJob.data() ) item->kioCopyJob.data()->deleteLater(); if( !waitForAlbumGain && !albumName.isEmpty() ) { QList albumItems = albumGainItems[albumName]; foreach( ConvertItem *albumItem, albumItems ) { emit finished( albumItem->fileListItem, FileListItem::Succeeded ); // send signal to FileList } qDeleteAll( albumItems ); albumGainItems.remove( albumName ); } emit finished( item->fileListItem, returnCode, waitForAlbumGain ); // send signal to FileList emit finishedProcess( item->logID, returnCode == FileListItem::Succeeded, waitForAlbumGain ); // send signal to Logger items.removeAll( item ); if( !waitForAlbumGain ) delete item; if( items.size() == 0 && albumGainItems.size() == 0 ) updateTimer.stop(); } void Convert::kill( FileListItem *fileListItem ) { for( int i=0; ifileListItem == fileListItem ) { items.at(i)->killed = true; if( items.at(i)->backendID != -1 && items.at(i)->backendPlugin ) { items.at(i)->backendPlugin->kill( items.at(i)->backendID ); } else if( items.at(i)->process.data() != 0 ) { items.at(i)->process.data()->kill(); } else if( items.at(i)->kioCopyJob.data() != 0 ) { items.at(i)->kioCopyJob.data()->kill( KJob::EmitResult ); } } } } void Convert::itemRemoved( FileListItem *fileListItem ) { if( !fileListItem ) return; const QString albumName = fileListItem->tags ? fileListItem->tags->album : ""; if( !albumName.isEmpty() ) { QList albumItems = albumGainItems[albumName]; foreach( ConvertItem *albumItem, albumItems ) { if( albumItem->fileListItem == fileListItem ) { albumGainItems[albumName].removeAll( albumItem ); break; } } } } void Convert::updateProgress() { float time = 0.0f; float fileTime; QString fileProgressString; // trigger flushing of the logger cache pluginLog( 0, "" ); foreach( ConvertItem *item, items ) { float fileProgress = 0.0f; bool logProgress = true; if( item->backendID != -1 && item->backendPlugin ) { fileProgress = item->backendPlugin->progress( item->backendID ); } else { fileProgress = item->progress; } if( fileProgress >= 0 ) { fileProgressString = Global::prettyNumber(fileProgress,"%"); } else { fileProgressString = i18nc("The conversion progress can't be determined","Unknown"); fileProgress = 0; // make it a valid value so the calculations below work } fileTime = 0.0f; switch( item->state ) { case ConvertItem::initial: { break; } case ConvertItem::get: { fileTime = item->getTime; item->fileListItem->setText( 0, i18n("Getting file")+"... "+fileProgressString ); break; } case ConvertItem::convert: { fileTime = item->convertTimes.at(item->conversionPipesStep); item->fileListItem->setText( 0, i18n("Converting")+"... "+fileProgressString ); break; } case ConvertItem::rip: { fileTime = item->convertTimes.at(item->conversionPipesStep); item->fileListItem->setText( 0, i18n("Ripping")+"... "+fileProgressString ); break; } case ConvertItem::decode: { fileTime = item->convertTimes.at(item->conversionPipesStep); item->fileListItem->setText( 0, i18n("Decoding")+"... "+fileProgressString ); break; } case ConvertItem::filter: { fileTime = item->convertTimes.at(item->conversionPipesStep); item->fileListItem->setText( 0, i18n("Filter")+"... "+fileProgressString ); break; } case ConvertItem::encode: { fileTime = item->convertTimes.at(item->conversionPipesStep); item->fileListItem->setText( 0, i18n("Encoding")+"... "+fileProgressString ); break; } case ConvertItem::wait_replaygain: { item->fileListItem->setText( 0, i18n("Waiting for Replay Gain") ); logProgress = false; break; } case ConvertItem::replaygain: { const QString albumName = item->fileListItem->tags ? item->fileListItem->tags->album : ""; QList albumItems; if( !albumName.isEmpty() ) albumItems = albumGainItems[albumName]; if( !albumItems.contains(item) ) albumItems.append( item ); foreach( ConvertItem *albumItem, albumItems ) { fileTime += albumItem->replaygainTime; } item->fileListItem->setText( 0, i18n("Replay Gain")+"... "+fileProgressString ); break; } } time += item->finishedTime + fileProgress * fileTime / 100.0f; if( logProgress ) { logger->log( item->logID, "
\t" + i18n("Progress: %1",fileProgress) + "
" ); } } emit updateTime( time ); } ./soundkonverter-2.1.2/PaxHeaders.4329/options.cpp0000644000000000000000000000006212076525023016622 xustar0020 atime=1378539090 30 ctime=1418040695.108717315 ./soundkonverter-2.1.2/options.cpp0000755000175000001440000002213712076525023017625 0ustar00danielusers00000000000000 #include "options.h" #include "optionssimple.h" #include "optionsdetailed.h" #include "outputdirectory.h" #include "pluginloader.h" #include "config.h" #include #include #include Options::Options( Config *_config, const QString& text, QWidget *parent ) : QWidget( parent ), config( _config ) { QGridLayout *gridLayout = new QGridLayout( this ); gridLayout->setContentsMargins( 0, 0, 0, 0 ); tab = new KTabWidget( this ); gridLayout->addWidget( tab, 0, 0 ); connect( tab, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)) ); optionsSimple = new OptionsSimple( config, text, this ); connect( optionsSimple, SIGNAL(optionsChanged()), this, SLOT(simpleOptionsChanged()) ); connect( optionsSimple->outputDirectory, SIGNAL(modeChanged(int)), this, SLOT(simpleOutputDirectoryModeChanged(int)) ); connect( optionsSimple->outputDirectory, SIGNAL(directoryChanged(const QString&)), this, SLOT(simpleOutputDirectoryChanged(const QString&)) ); optionsDetailed = new OptionsDetailed( config, this ); connect( optionsDetailed->outputDirectory, SIGNAL(modeChanged(int)), this, SLOT(detailedOutputDirectoryModeChanged(int)) ); connect( optionsDetailed, SIGNAL(currentDataRateChanged(int)), optionsSimple, SLOT(currentDataRateChanged(int)) ); connect( optionsDetailed, SIGNAL(customProfilesEdited()), optionsSimple, SLOT(updateProfiles()) ); connect( optionsSimple, SIGNAL(customProfilesEdited()), optionsDetailed, SLOT(updateProfiles()) ); optionsSimple->init(); optionsDetailed->init(); QString format; const QStringList formats = config->pluginLoader()->formatList(PluginLoader::Encode,PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy|PluginLoader::Lossless|PluginLoader::Hybrid)); if( config->data.general.defaultFormat == i18n("Last used") || config->data.general.defaultFormat == "Last used" ) { format = config->data.general.lastFormat; } else { format = config->data.general.defaultFormat; } if( !formats.contains(format) ) format.clear(); if( format.isEmpty() && formats.count() > 0 ) { if( formats.contains(config->data.general.lastFormat) ) format = config->data.general.lastFormat; else format = formats.at(0); } optionsDetailed->setCurrentFormat( format ); QString profile; if( config->data.general.defaultProfile == i18n("Last used") || config->data.general.defaultProfile == "Last used" ) { profile = "soundkonverter_last_used"; } else { profile = config->data.general.defaultProfile; } if( profile.isEmpty() ) profile = i18n("High"); optionsDetailed->setCurrentProfile( profile ); const int startTab = ( config->data.general.startTab == 0 ) ? config->data.general.lastTab : config->data.general.startTab - 1; tab->addTab( optionsSimple, i18n("Simple") ); tab->addTab( optionsDetailed, i18n("Detailed") ); tab->setCurrentIndex( startTab ); } Options::~Options() {} ConversionOptions *Options::currentConversionOptions() { return optionsDetailed->currentConversionOptions(); } bool Options::setCurrentConversionOptions( ConversionOptions *options ) { const bool success = optionsDetailed->setCurrentConversionOptions( options ); tabChanged( 0 ); // update optionsSimple return success; } void Options::simpleOutputDirectoryModeChanged( const int mode ) { if( optionsDetailed && optionsDetailed->outputDirectory ) optionsDetailed->outputDirectory->setMode( (OutputDirectory::Mode)mode ); config->data.general.lastOutputDirectoryMode = mode; } void Options::simpleOutputDirectoryChanged( const QString& directory ) { if( optionsDetailed && optionsDetailed->outputDirectory ) optionsDetailed->outputDirectory->setDirectory( directory ); } void Options::simpleOptionsChanged() { optionsDetailed->setCurrentFormat( optionsSimple->currentFormat() ); optionsDetailed->setCurrentProfile( optionsSimple->currentProfile() ); optionsDetailed->resetFilterOptions(); optionsDetailed->setReplayGainChecked( optionsSimple->isReplayGainChecked() ); QString toolTip; const bool replaygainEnabled = optionsDetailed->isReplayGainEnabled( &toolTip ); optionsSimple->setReplayGainEnabled( replaygainEnabled, toolTip ); } void Options::detailedOutputDirectoryModeChanged( const int mode ) { config->data.general.lastOutputDirectoryMode = mode; } void Options::tabChanged( const int pageIndex ) { if( pageIndex == 0 ) { // NOTE prevent signals from firing back disconnect( optionsSimple, SIGNAL(optionsChanged()), 0, 0 ); disconnect( optionsSimple->outputDirectory, SIGNAL(modeChanged(int)), 0, 0 ); disconnect( optionsSimple->outputDirectory, SIGNAL(directoryChanged(const QString&)), 0, 0 ); optionsSimple->updateProfiles(); optionsSimple->setCurrentProfile( optionsDetailed->currentProfile() ); optionsSimple->setCurrentFormat( optionsDetailed->currentFormat() ); QString toolTip; const bool replaygainEnabled = optionsDetailed->isReplayGainEnabled( &toolTip ); const bool replaygainChecked = optionsDetailed->isReplayGainChecked(); optionsSimple->setReplayGainEnabled( replaygainEnabled, toolTip ); optionsSimple->setReplayGainChecked( replaygainChecked ); optionsSimple->setCurrentPlugin( optionsDetailed->getCurrentPlugin() ); optionsSimple->outputDirectory->setMode( optionsDetailed->outputDirectory->mode() ); optionsSimple->outputDirectory->setDirectory( optionsDetailed->outputDirectory->directory() ); connect( optionsSimple, SIGNAL(optionsChanged()), this, SLOT(simpleOptionsChanged()) ); connect( optionsSimple->outputDirectory, SIGNAL(modeChanged(int)), this, SLOT(simpleOutputDirectoryModeChanged(int)) ); connect( optionsSimple->outputDirectory, SIGNAL(directoryChanged(const QString&)), this, SLOT(simpleOutputDirectoryChanged(const QString&)) ); } config->data.general.lastTab = tab->currentIndex(); } void Options::setProfile( const QString& profile ) { optionsSimple->setCurrentProfile( profile ); simpleOptionsChanged(); } void Options::setFormat( const QString& format ) { optionsSimple->setCurrentFormat( format ); simpleOptionsChanged(); } void Options::setOutputDirectoryMode( int mode ) { QString directory; optionsSimple->setCurrentOutputDirectoryMode( (OutputDirectory::Mode)mode ); if( mode == (int)OutputDirectory::Specify ) directory = config->data.general.specifyOutputDirectory; else if( mode == (int)OutputDirectory::Source ) directory = ""; else if( mode == (int)OutputDirectory::MetaData ) directory = config->data.general.metaDataOutputDirectory; else if( mode == (int)OutputDirectory::CopyStructure ) directory = config->data.general.copyStructureOutputDirectory; optionsSimple->setCurrentOutputDirectory( directory ); simpleOutputDirectoryModeChanged( (OutputDirectory::Mode)mode ); simpleOutputDirectoryChanged( directory ); } void Options::setOutputDirectory( const QString& directory ) { optionsSimple->setCurrentOutputDirectoryMode( OutputDirectory::Specify ); optionsSimple->setCurrentOutputDirectory( directory ); simpleOutputDirectoryModeChanged( OutputDirectory::Specify ); simpleOutputDirectoryChanged( directory ); } void Options::accepted() { const OutputDirectory::Mode mode = (OutputDirectory::Mode)config->data.general.lastOutputDirectoryMode; if( mode == OutputDirectory::MetaData ) { const QString path = config->data.general.metaDataOutputDirectory; if( config->data.general.lastMetaDataOutputDirectoryPaths.contains(path) ) config->data.general.lastMetaDataOutputDirectoryPaths.removeAll( path ); else if( config->data.general.lastMetaDataOutputDirectoryPaths.size() >= 5 ) config->data.general.lastMetaDataOutputDirectoryPaths.removeLast(); config->data.general.lastMetaDataOutputDirectoryPaths.prepend( path ); } else if( mode == OutputDirectory::Specify ) { const QString path = config->data.general.specifyOutputDirectory; if( config->data.general.lastNormalOutputDirectoryPaths.contains(path) ) config->data.general.lastNormalOutputDirectoryPaths.removeAll( path ); else if( config->data.general.lastNormalOutputDirectoryPaths.size() >= 5 ) config->data.general.lastNormalOutputDirectoryPaths.removeLast(); config->data.general.lastNormalOutputDirectoryPaths.prepend( path ); } else if( mode == OutputDirectory::CopyStructure ) { const QString path = config->data.general.copyStructureOutputDirectory; if( config->data.general.lastNormalOutputDirectoryPaths.contains(path) ) config->data.general.lastNormalOutputDirectoryPaths.removeAll( path ); else if( config->data.general.lastNormalOutputDirectoryPaths.size() >= 5 ) config->data.general.lastNormalOutputDirectoryPaths.removeLast(); config->data.general.lastNormalOutputDirectoryPaths.prepend( path ); } } ./soundkonverter-2.1.2/PaxHeaders.4329/configdialog0000644000000000000000000000011612441312442016766 xustar0030 mtime=1418040610.308840482 20 atime=1358274329 28 ctime=1418040695.1787172 ./soundkonverter-2.1.2/configdialog/0000755000175000001440000000000012441312442020036 5ustar00danielusers00000000000000./soundkonverter-2.1.2/configdialog/PaxHeaders.4329/configcoverartpage.cpp0000644000000000000000000000006212276430365023432 xustar0020 atime=1398102755 30 ctime=1418040695.177717202 ./soundkonverter-2.1.2/configdialog/configcoverartpage.cpp0000644000175000001440000001726512276430365024440 0ustar00danielusers00000000000000 #include "configcoverartpage.h" #include "../config.h" #include #include #include #include #include #include ConfigCoverArtPage::ConfigCoverArtPage( Config *_config, QWidget *parent ) : ConfigPageBase( parent ), config( _config ) { QVBoxLayout *box = new QVBoxLayout( this ); QFont groupFont; groupFont.setBold( true ); QLabel *lCoverSaving = new QLabel( i18n("Saving covers to output directory"), this ); lCoverSaving->setFont( groupFont ); box->addWidget( lCoverSaving ); box->addSpacing( spacingSmall ); QHBoxLayout *coverSavingBox = new QHBoxLayout(); coverSavingBox->addSpacing( spacingOffset ); box->addLayout( coverSavingBox ); QVBoxLayout *writeCoversBox = new QVBoxLayout(); coverSavingBox->addLayout( writeCoversBox ); QLabel *lWriteCovers = new QLabel( i18n("Save embedded covers to output directory"), this ); writeCoversBox->addWidget( lWriteCovers ); rWriteCoversAlways = new QRadioButton( i18n("Always"), this ); writeCoversBox->addWidget( rWriteCoversAlways ); rWriteCoversAuto = new QRadioButton( i18n("Only if embedding the covers into the output files is not possible"), this ); writeCoversBox->addWidget( rWriteCoversAuto ); rWriteCoversNever = new QRadioButton( i18n("Never"), this ); writeCoversBox->addWidget( rWriteCoversNever ); QButtonGroup *writeCoversGroup = new QButtonGroup( this ); writeCoversGroup->addButton( rWriteCoversAlways ); writeCoversGroup->addButton( rWriteCoversAuto ); writeCoversGroup->addButton( rWriteCoversNever ); connect( writeCoversGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(writeCoversChanged(QAbstractButton*)) ); connect( writeCoversGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(somethingChanged()) ); if( config->data.coverArt.writeCovers == 0 ) rWriteCoversAlways->setChecked( true ); else if( config->data.coverArt.writeCovers == 1 ) rWriteCoversAuto->setChecked( true ); else if( config->data.coverArt.writeCovers == 2 ) rWriteCoversNever->setChecked( true ); writeCoversBox->addSpacing( spacingMedium ); lWriteCoverName = new QLabel( i18n("File name for the cover (when saving to output directory)"), this ); writeCoversBox->addWidget( lWriteCoverName ); rWriteCoverNameTitle = new QRadioButton( i18n("The embedded cover description"), this ); writeCoversBox->addWidget( rWriteCoverNameTitle ); rWriteCoverNameDefault = new QRadioButton( i18n("The default cover file name"), this ); writeCoversBox->addWidget( rWriteCoverNameDefault ); QHBoxLayout *writeCoverNameTextBox = new QHBoxLayout( this ); lWriteCoverNameDefaultLabel = new QLabel( i18n("Default cover file name:"), this ); writeCoverNameTextBox->addWidget( lWriteCoverNameDefaultLabel ); lWriteCoverNameDefaultEdit = new KLineEdit( this ); lWriteCoverNameDefaultEdit->setToolTip( i18n("The following strings are wildcards that will be replaced\nby the information in the meta data:\n\n%a - Artist\n%b - Album\n%d - Cover description\n%r - Cover role") ); writeCoverNameTextBox->addWidget( lWriteCoverNameDefaultEdit ); writeCoverNameTextBox->addStretch(); writeCoversBox->addLayout( writeCoverNameTextBox ); connect( lWriteCoverNameDefaultEdit, SIGNAL(textChanged(QString)), this, SLOT(somethingChanged()) ); QButtonGroup *writeCoverNameGroup = new QButtonGroup( this ); writeCoverNameGroup->addButton( rWriteCoverNameTitle ); writeCoverNameGroup->addButton( rWriteCoverNameDefault ); connect( writeCoverNameGroup, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(somethingChanged()) ); if( config->data.coverArt.writeCoverName == 0 ) rWriteCoverNameTitle->setChecked( true ); else if( config->data.coverArt.writeCoverName == 1 ) rWriteCoverNameDefault->setChecked( true ); lWriteCoverNameDefaultEdit->setText( config->data.coverArt.writeCoverDefaultName ); // QGroupBox *coverGroup = new QGroupBox( i18n("CD covers"), this ); // writeCoversBox->addWidget( coverGroup ); // QVBoxLayout *coverBox = new QVBoxLayout(); // // cCopyCover = new QCheckBox( i18n("Copy covers from the source directoy to output directoy"), this ); // coverBox->addWidget( cCopyCover ); // connect( cCopyCover, SIGNAL(toggled(bool)), this, SIGNAL(configChanged()) ); // // cEmbedCover = new QCheckBox( i18n("Embed covers from the source directoy into meta tags if possible"), this ); // coverBox->addWidget( cEmbedCover ); // connect( cEmbedCover, SIGNAL(toggled(bool)), this, SIGNAL(configChanged()) ); // // lCoverList = new QListView( this ); // coverBox->addWidget( lCoverList ); // // coverGroup->setLayout( coverBox ); // // QHBoxLayout *startTabBox = new QHBoxLayout(); // writeCoversBox->addLayout( startTabBox ); // // writeCoversBox->addSpacing( 5 ); // // QGroupBox *userScriptGroup = new QGroupBox( i18n("User scripts"), this ); // writeCoversBox->addWidget( userScriptGroup ); // QVBoxLayout *userScriptBox = new QVBoxLayout(); // // QLabel *lUserScript = new QLabel( i18n("Check all scripts that should be executed after a conversion has finished"), this ); // userScriptBox->addWidget( lUserScript ); // // QListView *lUserScriptList = new QListView( this ); // userScriptBox->addWidget( lUserScriptList ); // // userScriptGroup->setLayout( userScriptBox ); box->addStretch(); } ConfigCoverArtPage::~ConfigCoverArtPage() {} void ConfigCoverArtPage::resetDefaults() { rWriteCoversAuto->setChecked( true ); rWriteCoverNameTitle->setChecked( true ); lWriteCoverNameDefaultEdit->setText( i18nc("cover file name","cover") ); emit configChanged( true ); } void ConfigCoverArtPage::saveSettings() { if( rWriteCoversAlways->isChecked() ) config->data.coverArt.writeCovers = 0; else if( rWriteCoversAuto->isChecked() ) config->data.coverArt.writeCovers = 1; else if( rWriteCoversNever->isChecked() ) config->data.coverArt.writeCovers = 2; if( rWriteCoverNameTitle->isChecked() ) config->data.coverArt.writeCoverName = 0; else if( rWriteCoverNameDefault->isChecked() ) config->data.coverArt.writeCoverName = 1; config->data.coverArt.writeCoverDefaultName = lWriteCoverNameDefaultEdit->text(); } void ConfigCoverArtPage::somethingChanged() { const bool changed = ( rWriteCoversAlways->isChecked() && config->data.coverArt.writeCovers != 0 ) || ( rWriteCoversAuto->isChecked() && config->data.coverArt.writeCovers != 1 ) || ( rWriteCoversNever->isChecked() && config->data.coverArt.writeCovers != 2 ) || ( rWriteCoverNameTitle->isChecked() && config->data.coverArt.writeCoverName != 0 ) || ( rWriteCoverNameDefault->isChecked() && config->data.coverArt.writeCoverName != 1 ) || lWriteCoverNameDefaultEdit->text() != config->data.coverArt.writeCoverDefaultName; emit configChanged( changed ); } void ConfigCoverArtPage::writeCoversChanged( QAbstractButton *button ) { if( button == rWriteCoversNever ) { lWriteCoverName->setEnabled( false ); rWriteCoverNameTitle->setEnabled( false ); rWriteCoverNameDefault->setEnabled( false ); lWriteCoverNameDefaultLabel->setEnabled( false ); lWriteCoverNameDefaultEdit->setEnabled( false ); } else { lWriteCoverName->setEnabled( true ); rWriteCoverNameTitle->setEnabled( true ); rWriteCoverNameDefault->setEnabled( true ); lWriteCoverNameDefaultLabel->setEnabled( true ); lWriteCoverNameDefaultEdit->setEnabled( true ); } } ./soundkonverter-2.1.2/configdialog/PaxHeaders.4329/configbackendspage.cpp0000644000000000000000000000012012276430304023343 xustar0030 mtime=1392128196.750746342 20 atime=1376732164 30 ctime=1418040695.177717202 ./soundkonverter-2.1.2/configdialog/configbackendspage.cpp0000755000175000001440000004711512276430304024356 0ustar00danielusers00000000000000// // C++ Implementation: configbackendspage // // Description: // // // Author: Daniel Faust , (C) 2007 // // Copyright: See COPYING file that comes with this distribution // // #include "configbackendspage.h" #include "../config.h" #include "../core/codecplugin.h" #include #include #include #include #include #include #include #include #include #include #include BackendsListWidget::BackendsListWidget( const QString& _name, Config *_config, QWidget *parent ) : QGroupBox( _name, parent ), config( _config ), name( _name ) { QVBoxLayout *box = new QVBoxLayout(); setLayout( box ); lBackends = new QListWidget( this ); connect( lBackends, SIGNAL(currentRowChanged(int)), this, SLOT(itemSelected(int)) ); box->addWidget( lBackends ); QHBoxLayout *arrowBox = new QHBoxLayout(); box->addLayout( arrowBox ); pUp = new QToolButton( this ); pUp->setIcon( KIcon("arrow-up") ); pUp->setAutoRaise( true ); pUp->setEnabled( false ); connect( pUp, SIGNAL(clicked()), this, SLOT(up()) ); arrowBox->addWidget( pUp ); pDown = new QToolButton( this ); pDown->setIcon( KIcon("arrow-down") ); pDown->setAutoRaise( true ); pDown->setEnabled( false ); connect( pDown, SIGNAL(clicked()), this, SLOT(down()) ); arrowBox->addWidget( pDown ); pConfigure = new QToolButton( this ); pConfigure->setIcon( KIcon("configure") ); pConfigure->setAutoRaise( true ); pConfigure->setEnabled( false ); connect( pConfigure, SIGNAL(clicked()), this, SLOT(configure()) ); arrowBox->addWidget( pConfigure ); pInfo = new QToolButton( this ); pInfo->setIcon( KIcon("help-about") ); pInfo->setAutoRaise( true ); pInfo->setEnabled( false ); arrowBox->addWidget( pInfo ); connect( pInfo, SIGNAL(clicked()), this, SLOT(info()) ); } BackendsListWidget::~BackendsListWidget() {} void BackendsListWidget::setFormat( const QString& _format ) { format = _format; } void BackendsListWidget::addItem( const QString& item ) { lBackends->addItem( item ); } void BackendsListWidget::clear() { lBackends->clear(); pUp->setEnabled( false ); pDown->setEnabled( false ); pConfigure->setEnabled( false ); pInfo->setEnabled( false ); pUp->setToolTip( "" ); pDown->setToolTip( "" ); pConfigure->setToolTip( "" ); pInfo->setToolTip( "" ); originalOrder.clear(); } QStringList BackendsListWidget::getList() { QStringList list; for( int i=0; icount(); i++ ) { list.append( lBackends->item(i)->text() ); } return list; } bool BackendsListWidget::changed() { return originalOrder != getList(); } void BackendsListWidget::resetOrder() { originalOrder = getList(); } void BackendsListWidget::itemSelected( int row ) { const QListWidgetItem *item = lBackends->item( row ); if( !item ) return; BackendPlugin *plugin = config->pluginLoader()->backendPluginByName( item->text() ); pUp->setEnabled( row > 0 ); pDown->setEnabled( row < lBackends->count()-1 ); if( plugin ) { if( name == i18n("Decoder") ) pConfigure->setEnabled( plugin->isConfigSupported(CodecPlugin::Decoder,format) ); else if( name == i18n("Encoder") ) pConfigure->setEnabled( plugin->isConfigSupported(CodecPlugin::Encoder,format) ); else if( name == i18n("Replay Gain") ) pConfigure->setEnabled( plugin->isConfigSupported(CodecPlugin::ReplayGain,format) ); pInfo->setEnabled( plugin->hasInfo() ); const QString pluginName = plugin->name(); if( pUp->isEnabled() ) pUp->setToolTip( i18n("Move %1 one position up",pluginName) ); else pUp->setToolTip( "" ); if( pDown->isEnabled() ) pDown->setToolTip( i18n("Move %1 one position down",pluginName) ); else pDown->setToolTip( "" ); if( pInfo->isEnabled() ) pInfo->setToolTip( i18n("About %1 ...",pluginName) ); else pInfo->setToolTip( "" ); if( pConfigure->isEnabled() ) pConfigure->setToolTip( i18n("Configure %1 ...",pluginName) ); else pConfigure->setToolTip( "" ); } } void BackendsListWidget::up() { const int row = lBackends->currentRow(); lBackends->insertItem( row-1, lBackends->takeItem(row) ); lBackends->setCurrentRow( row-1 ); emit orderChanged(); } void BackendsListWidget::down() { const int row = lBackends->currentRow(); lBackends->insertItem( row+1, lBackends->takeItem(row) ); lBackends->setCurrentRow( row+1 ); emit orderChanged(); } void BackendsListWidget::configure() { const int row = lBackends->currentRow(); const QListWidgetItem *item = lBackends->item( row ); if( !item ) return; BackendPlugin *plugin = config->pluginLoader()->backendPluginByName( item->text() ); if( plugin ) { if( name == i18n("Decoder") ) plugin->showConfigDialog( CodecPlugin::Decoder, format, this ); else if( name == i18n("Encoder") ) plugin->showConfigDialog( CodecPlugin::Encoder, format, this ); else if( name == i18n("Replay Gain") ) plugin->showConfigDialog( CodecPlugin::ReplayGain, format, this ); } } void BackendsListWidget::info() { const int row = lBackends->currentRow(); const QListWidgetItem *item = lBackends->item( row ); if( !item ) return; BackendPlugin *plugin = config->pluginLoader()->backendPluginByName( item->text() ); if( plugin ) plugin->showInfo( this ); } // class ConfigBackendsPage /////////////////////////// ConfigBackendsPage::ConfigBackendsPage( Config *_config, QWidget *parent ) : ConfigPageBase( parent ), config( _config ) { QVBoxLayout *box = new QVBoxLayout( this ); QFont groupFont; groupFont.setBold( true ); QLabel *lCdRipper = new QLabel( i18n("CD ripper"), this ); lCdRipper->setFont( groupFont ); box->addWidget( lCdRipper ); box->addSpacing( spacingSmall ); QHBoxLayout *ripperBox = new QHBoxLayout(); ripperBox->addSpacing( spacingOffset ); box->addLayout( ripperBox ); QLabel *lSelectorRipper = new QLabel( i18n("Use plugin:"), this ); ripperBox->addWidget( lSelectorRipper ); ripperBox->setStretchFactor( lSelectorRipper, 2 ); cSelectorRipper = new KComboBox( this ); foreach( const Config::CodecData& codec, config->data.backends.codecs ) { if( codec.codecName == "audio cd" ) { cSelectorRipper->addItems( codec.decoders ); } } ripperBox->addWidget( cSelectorRipper ); ripperBox->setStretchFactor( cSelectorRipper, 1 ); connect( cSelectorRipper, SIGNAL(activated(int)), this, SLOT(somethingChanged()) ); connect( cSelectorRipper, SIGNAL(activated(const QString&)), this, SLOT(ripperChanged(const QString&)) ); pConfigureRipper = new KPushButton( KIcon("configure"), "", this ); pConfigureRipper->setFixedSize( cSelectorRipper->sizeHint().height(), cSelectorRipper->sizeHint().height() ); pConfigureRipper->setFlat( true ); ripperBox->addWidget( pConfigureRipper ); ripperBox->setStretchFactor( pConfigureRipper, 1 ); connect( pConfigureRipper, SIGNAL(clicked()), this, SLOT(configureRipper()) ); box->addSpacing( spacingBig ); QLabel *lFilters = new QLabel( i18n("Filters"), this ); lFilters->setFont( groupFont ); box->addWidget( lFilters ); box->addSpacing( spacingSmall ); QHBoxLayout *filterBox = new QHBoxLayout(); filterBox->addSpacing( spacingOffset ); box->addLayout( filterBox ); QGridLayout *filterGrid = new QGridLayout(); int row = 0; foreach( const QString filterPluginName, config->data.backends.filters ) { if( row == 0 ) { QLabel *lSelectorFilter = new QLabel( i18n("Enable plugins:"), this ); filterGrid->addWidget( lSelectorFilter, row, 0 ); } QCheckBox *newCheckBox = new QCheckBox( filterPluginName, this ); newCheckBox->setChecked( config->data.backends.enabledFilters.contains(filterPluginName) ); filterGrid->addWidget( newCheckBox, row, 1 ); filterCheckBoxes.append( newCheckBox ); connect( newCheckBox, SIGNAL(stateChanged(int)), this, SLOT(somethingChanged()) ); KPushButton *newConfigButton = new KPushButton( KIcon("configure"), "", this ); newConfigButton->setFixedSize( cSelectorRipper->sizeHint().height(), cSelectorRipper->sizeHint().height() ); newConfigButton->setFlat( true ); filterGrid->addWidget( newConfigButton, row, 2 ); connect( newConfigButton, SIGNAL(clicked()), this, SLOT(configureFilter()) ); filterConfigButtons.append( newConfigButton ); FilterPlugin *plugin = qobject_cast(config->pluginLoader()->backendPluginByName(filterPluginName)); if( plugin ) { newConfigButton->setEnabled( plugin->isConfigSupported(BackendPlugin::General,"") ); } else { newConfigButton->setEnabled( false ); } if( newConfigButton->isEnabled() ) newConfigButton->setToolTip( i18n("Configure %1 ...",filterPluginName) ); row++; } filterGrid->setColumnStretch( 0, 2 ); filterGrid->setColumnStretch( 1, 1 ); filterBox->addLayout( filterGrid ); box->addSpacing( spacingBig ); QLabel *lPriorities = new QLabel( i18n("Priorities"), this ); lPriorities->setFont( groupFont ); box->addWidget( lPriorities ); box->addSpacing( spacingSmall ); QVBoxLayout *formatBox = new QVBoxLayout(); box->addLayout( formatBox, 1 ); QHBoxLayout *formatSelectorBox = new QHBoxLayout(); formatSelectorBox->addSpacing( spacingOffset ); formatBox->addLayout( formatSelectorBox ); QLabel *lSelectorFormat = new QLabel( i18n("Configure plugin priorities for format:"), this ); formatSelectorBox->addWidget( lSelectorFormat ); cSelectorFormat = new KComboBox( this ); cSelectorFormat->addItems( config->pluginLoader()->formatList(PluginLoader::Possibilities(PluginLoader::Encode|PluginLoader::Decode|PluginLoader::ReplayGain),PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy|PluginLoader::Lossless|PluginLoader::Hybrid)) ); cSelectorFormat->removeItem( cSelectorFormat->findText("wav") ); cSelectorFormat->removeItem( cSelectorFormat->findText("audio cd") ); formatSelectorBox->addWidget( cSelectorFormat ); connect( cSelectorFormat, SIGNAL(activated(const QString&)), this, SLOT(formatChanged(const QString&)) ); formatSelectorBox->addStretch(); QHBoxLayout *formatBackendsBox = new QHBoxLayout(); formatBackendsBox->addSpacing( spacingOffset ); formatBox->addLayout( formatBackendsBox ); decoderList = new BackendsListWidget( i18n("Decoder"), config, this ); formatBackendsBox->addWidget( decoderList ); connect( decoderList, SIGNAL(orderChanged()), this, SLOT(somethingChanged()) ); encoderList = new BackendsListWidget( i18n("Encoder"), config, this ); formatBackendsBox->addWidget( encoderList ); connect( encoderList, SIGNAL(orderChanged()), this, SLOT(somethingChanged()) ); replaygainList = new BackendsListWidget( i18n("Replay Gain"), config, this ); formatBackendsBox->addWidget( replaygainList ); connect( replaygainList, SIGNAL(orderChanged()), this, SLOT(somethingChanged()) ); QHBoxLayout *optimizationsBox = new QHBoxLayout(); optimizationsBox->addSpacing( spacingOffset ); formatBox->addLayout( optimizationsBox ); optimizationsBox->addStretch(); pShowOptimizations = new KPushButton( KIcon("games-solve"), i18n("Show possible optimizations"), this ); optimizationsBox->addWidget( pShowOptimizations ); connect( pShowOptimizations, SIGNAL(clicked()), this, SLOT(showOptimizations()) ); optimizationsBox->addStretch(); box->addStretch( 2 ); ripperChanged( cSelectorRipper->currentText() ); formatChanged( cSelectorFormat->currentText() ); } ConfigBackendsPage::~ConfigBackendsPage() {} void ConfigBackendsPage::ripperChanged( const QString& pluginName ) { RipperPlugin *plugin = qobject_cast(config->pluginLoader()->backendPluginByName(pluginName)); if( plugin ) { pConfigureRipper->setEnabled( plugin->isConfigSupported(BackendPlugin::General,"") ); } else { pConfigureRipper->setEnabled( false ); } if( pConfigureRipper->isEnabled() ) pConfigureRipper->setToolTip( i18n("Configure %1 ...",pluginName) ); else pConfigureRipper->setToolTip( "" ); } void ConfigBackendsPage::formatChanged( const QString& format, bool ignoreChanges ) { QStringList plugins; if( !ignoreChanges && ( decoderList->changed() || encoderList->changed() || replaygainList->changed() ) ) { const int ret = KMessageBox::questionYesNo( this, i18n("You have changed the current settings.\nDo you want to save them?"), i18n("Settings changed") ); if( ret == KMessageBox::Yes ) { saveSettings(); config->save(); } } decoderList->clear(); encoderList->clear(); replaygainList->clear(); currentFormat = format; decoderList->setFormat( format ); encoderList->setFormat( format ); replaygainList->setFormat( format ); foreach( const Config::CodecData codec, config->data.backends.codecs ) { if( codec.codecName == format ) { foreach( const QString decoder, codec.decoders ) { decoderList->addItem( decoder ); } foreach( const QString encoder, codec.encoders ) { encoderList->addItem( encoder ); } foreach( const QString replaygain, codec.replaygain ) { replaygainList->addItem( replaygain ); } } } decoderList->resetOrder(); encoderList->resetOrder(); replaygainList->resetOrder(); emit configChanged( false ); } void ConfigBackendsPage::resetDefaults() { // rippers QStringList allPlugins; foreach( RipperPlugin *plugin, config->pluginLoader()->getAllRipperPlugins() ) { const QString pluginName = plugin->name(); foreach( const ConversionPipeTrunk trunk, plugin->codecTable() ) { if( trunk.enabled && allPlugins.filter(QRegExp("[0-9]{8,8}"+pluginName)).count() == 0 ) { allPlugins += QString::number(trunk.rating).rightJustified(8,'0') + pluginName; break; } } } allPlugins.sort(); if( allPlugins.count() > 0 ) { const QString defaultRipper = allPlugins.first().right(allPlugins.first().length()-8); cSelectorRipper->setCurrentIndex( cSelectorRipper->findText(defaultRipper) ); } int i = 0; foreach( QCheckBox *checkBox, filterCheckBoxes ) { const QString filterPluginName = config->data.backends.filters.at(i); checkBox->setChecked( i == 0 ); i++; } const int answer = KMessageBox::questionYesNo( this, i18n("This will choose the best backends for all formats and save the new preferences immediately.\n\nDo you want to continue?") ); if( answer == KMessageBox::Yes ) { QList optimizationList = config->getOptimizations( true ); for( int i=0; idoOptimizations( optimizationList ); formatChanged( cSelectorFormat->currentText(), true ); emit configChanged( false ); } } void ConfigBackendsPage::saveSettings() { for( int i=0; idata.backends.codecs.count(); i++ ) { if( config->data.backends.codecs.at(i).codecName == "audio cd" ) { const QString currentRipper = cSelectorRipper->currentText(); QStringList rippers = config->data.backends.codecs[i].decoders; rippers.removeAll( currentRipper ); rippers.prepend( currentRipper ); config->data.backends.codecs[i].decoders = rippers; } } config->data.backends.enabledFilters.clear(); int i = 0; foreach( QCheckBox *checkBox, filterCheckBoxes ) { const QString filterPluginName = config->data.backends.filters.at(i); if( checkBox->isChecked() ) config->data.backends.enabledFilters.append( filterPluginName ); i++; } for( int i=0; idata.backends.codecs.count(); i++ ) { if( config->data.backends.codecs.at(i).codecName == currentFormat ) { config->data.backends.codecs[i].decoders = decoderList->getList(); config->data.backends.codecs[i].encoders = encoderList->getList(); config->data.backends.codecs[i].replaygain = replaygainList->getList(); } } decoderList->resetOrder(); encoderList->resetOrder(); replaygainList->resetOrder(); // ensure that the user won't get bothered by an optimization message at the next start QList optimizationList = config->getOptimizations( true ); for( int i=0; idata.backendOptimizationsIgnoreList.optimizationList = optimizationList; } void ConfigBackendsPage::somethingChanged() { bool changed = false; int i = 0; foreach( QCheckBox *checkBox, filterCheckBoxes ) { if( checkBox == QObject::sender() ) { const QString filterPluginName = config->data.backends.filters.at(i); if( checkBox->isChecked() != config->data.backends.enabledFilters.contains(filterPluginName) ) { changed = true; break; } } i++; } if( decoderList->changed() || encoderList->changed() || replaygainList->changed() ) changed = true; emit configChanged( changed ); } void ConfigBackendsPage::configureRipper() { RipperPlugin *plugin = qobject_cast(config->pluginLoader()->backendPluginByName(cSelectorRipper->currentText())); if( plugin ) { plugin->showConfigDialog( BackendPlugin::General, "", this ); } } void ConfigBackendsPage::configureFilter() { int i = 0; foreach( KPushButton *configButton, filterConfigButtons ) { if( configButton == QObject::sender() ) { const QString filterPluginName = config->data.backends.filters.at(i); FilterPlugin *plugin = qobject_cast(config->pluginLoader()->backendPluginByName(filterPluginName)); if( plugin ) { plugin->showConfigDialog( BackendPlugin::General, "", this ); } } i++; } } void ConfigBackendsPage::showOptimizations() { QList optimizationList = config->getOptimizations( true ); if( !optimizationList.isEmpty() ) { CodecOptimizations *optimizationsDialog = new CodecOptimizations( optimizationList, this ); connect( optimizationsDialog, SIGNAL(solutions(const QList&)), config, SLOT(doOptimizations(const QList&)) ); optimizationsDialog->exec(); } else { KMessageBox::information( this, i18n("All backend settings seem to be optimal, there is nothing to do.") ); } formatChanged( cSelectorFormat->currentText(), true ); } ./soundkonverter-2.1.2/configdialog/PaxHeaders.4329/configgeneralpage.h0000644000000000000000000000013212441312442022652 xustar0030 mtime=1418040610.308840482 30 atime=1418040610.308840482 30 ctime=1418040695.177717202 ./soundkonverter-2.1.2/configdialog/configgeneralpage.h0000755000175000001440000000240212441312442023650 0ustar00danielusers00000000000000// // C++ Interface: configgeneralpage // // Description: // // // Author: Daniel Faust , (C) 2007 // // Copyright: See COPYING file that comes with this distribution // // #ifndef CONFIGGENERALPAGE_H #define CONFIGGENERALPAGE_H #include "configpagebase.h" class Config; class QCheckBox; class KComboBox; class KIntSpinBox; class KLineEdit; class KPushButton; /** @author Daniel Faust */ class ConfigGeneralPage : public ConfigPageBase { Q_OBJECT public: /** Default Constructor */ ConfigGeneralPage( Config *_config, QWidget *parent=0 ); /** Default Destructor */ ~ConfigGeneralPage(); private: KComboBox *cStartTab; KComboBox *cDefaultProfile; KComboBox *cDefaultFormat; // KComboBox *cPriority; // QStringList sPriority; KComboBox *cConflictHandling; KIntSpinBox *iNumFiles; QCheckBox *cWaitForAlbumGain; KComboBox *cReplayGainGrouping; KIntSpinBox *iNumReplayGainFiles; Config *config; // int profileIndex( const QString& string ); // int formatIndex( const QString& string ); public slots: void resetDefaults(); void saveSettings(); private slots: void somethingChanged(); // void selectDir(); void profileChanged(); }; #endif ./soundkonverter-2.1.2/configdialog/PaxHeaders.4329/configadvancedpage.h0000644000000000000000000000013212172311620023000 xustar0030 mtime=1374262160.512727438 30 atime=1374262160.512727438 30 ctime=1418040695.176717203 ./soundkonverter-2.1.2/configdialog/configadvancedpage.h0000644000175000001440000000230512172311620023775 0ustar00danielusers00000000000000// // C++ Interface: configgeneralpage // // Description: // // // Author: Daniel Faust , (C) 2007 // // Copyright: See COPYING file that comes with this distribution // // #ifndef CONFIGADVANCEDPAGE_H #define CONFIGADVANCEDPAGE_H #include "configpagebase.h" class Config; class QCheckBox; class KIntSpinBox; class KComboBox; /** @author Daniel Faust */ class ConfigAdvancedPage : public ConfigPageBase { Q_OBJECT public: /** * Default Constructor */ ConfigAdvancedPage( Config *_config, QWidget *parent=0 ); /** * Default Destructor */ ~ConfigAdvancedPage(); private: KComboBox *cPreferredOggVorbisExtension; KComboBox *cPreferredVorbisCommentCommentTag; KComboBox *cPreferredVorbisCommentTrackTotalTag; KComboBox *cPreferredVorbisCommentDiscTotalTag; QCheckBox *cUseVFATNames; QCheckBox *cEjectCdAfterRip; QCheckBox *cWriteLogFiles; QCheckBox *cUseSharedMemoryForTempFiles; KIntSpinBox *iMaxSizeForSharedMemoryTempFiles; QCheckBox *cUsePipes; Config *config; public slots: void resetDefaults(); void saveSettings(); private slots: void somethingChanged(); }; #endif ./soundkonverter-2.1.2/configdialog/PaxHeaders.4329/configpagebase.h0000644000000000000000000000013212276430421022153 xustar0030 mtime=1392128273.610019627 30 atime=1392128273.610019627 30 ctime=1418040695.177717202 ./soundkonverter-2.1.2/configdialog/configpagebase.h0000755000175000001440000000127512276430421023160 0ustar00danielusers00000000000000// // C++ Interface: configpagebase // // Description: // // // Author: Daniel Faust , (C) 2007 // // Copyright: See COPYING file that comes with this distribution // // #ifndef CONFIGPAGEBASE_H #define CONFIGPAGEBASE_H #include class Config; /** @author Daniel Faust */ class ConfigPageBase : public QWidget { Q_OBJECT public: ConfigPageBase( QWidget *parent=0 ); virtual ~ConfigPageBase(); int spacingOffset; int spacingSmall; int spacingMedium; int spacingBig; public slots: virtual void resetDefaults(); virtual void saveSettings(); signals: void configChanged( bool state = true ); }; #endif ./soundkonverter-2.1.2/configdialog/PaxHeaders.4329/configbackendspage.h0000644000000000000000000000013212076525023023014 xustar0030 mtime=1358604819.204806279 30 atime=1358604819.204806279 30 ctime=1418040695.177717202 ./soundkonverter-2.1.2/configdialog/configbackendspage.h0000755000175000001440000000436312076525023024022 0ustar00danielusers00000000000000// // C++ Interface: configbackendspage // // Description: // // // Author: Daniel Faust , (C) 2007 // // Copyright: See COPYING file that comes with this distribution // // #ifndef CONFIGBACKENDSPAGE_H #define CONFIGBACKENDSPAGE_H #include "configpagebase.h" #include class KComboBox; class KPushButton; class QCheckBox; class QListWidget; class QToolButton; class QListWidgetItem; /** @author Daniel Faust */ class BackendsListWidget : public QGroupBox { Q_OBJECT public: /** Default Constructor */ BackendsListWidget( const QString& _name, Config *_config, QWidget *parent=0 ); /** Default Destructor*/ ~BackendsListWidget(); void setFormat( const QString& _format ); void addItem( const QString& item ); void clear(); QStringList getList(); bool changed(); void resetOrder(); private: Config *config; QString name; QString format; QStringList originalOrder; QListWidget *lBackends; QToolButton *pUp; QToolButton *pDown; QToolButton *pConfigure; QToolButton *pInfo; private slots: void itemSelected( int item ); void up(); void down(); void configure(); void info(); signals: void orderChanged(); }; /** @author Daniel Faust */ class ConfigBackendsPage : public ConfigPageBase { Q_OBJECT public: /** Default Constructor */ ConfigBackendsPage( Config *_config, QWidget *parent=0 ); /** Default Destructor */ ~ConfigBackendsPage(); private: Config *config; KComboBox *cSelectorRipper; KComboBox *cSelectorFormat; QList filterCheckBoxes; QList filterConfigButtons; BackendsListWidget *decoderList; BackendsListWidget *encoderList; BackendsListWidget *replaygainList; KPushButton *pConfigureRipper; KPushButton *pShowOptimizations; QString currentFormat; private slots: void somethingChanged(); void ripperChanged( const QString& pluginName ); void formatChanged( const QString& format, bool ignoreChanges = false ); void configureRipper(); void configureFilter(); void showOptimizations(); public slots: void resetDefaults(); void saveSettings(); }; #endif ./soundkonverter-2.1.2/configdialog/PaxHeaders.4329/configadvancedpage.cpp0000644000000000000000000000013112276430351023342 xustar0030 mtime=1392128233.659877554 29 atime=1392128233.65887755 30 ctime=1418040695.177717202 ./soundkonverter-2.1.2/configdialog/configadvancedpage.cpp0000644000175000001440000003555012276430351024350 0ustar00danielusers00000000000000// // C++ Implementation: configgeneralpage // // Description: // // // Author: Daniel Faust , (C) 2007 // // Copyright: See COPYING file that comes with this distribution // // #include "configadvancedpage.h" #include "../config.h" #include #include #include #include #include #include #include #include ConfigAdvancedPage::ConfigAdvancedPage( Config *_config, QWidget *parent ) : ConfigPageBase( parent ), config( _config ) { QVBoxLayout *box = new QVBoxLayout( this ); QFont groupFont; groupFont.setBold( true ); QLabel *lAdvanced = new QLabel( i18n("Advanced"), this ); lAdvanced->setFont( groupFont ); box->addWidget( lAdvanced ); box->addSpacing( spacingSmall ); QHBoxLayout *preferredOggVorbisExtensionBox = new QHBoxLayout(); preferredOggVorbisExtensionBox->addSpacing( spacingOffset ); box->addLayout( preferredOggVorbisExtensionBox ); QLabel* lPreferredOggVorbisExtension = new QLabel( i18n("Preferred file name extension for ogg vorbis files:"), this ); preferredOggVorbisExtensionBox->addWidget( lPreferredOggVorbisExtension ); cPreferredOggVorbisExtension = new KComboBox( this ); cPreferredOggVorbisExtension->addItem( "ogg" ); cPreferredOggVorbisExtension->addItem( "oga" ); cPreferredOggVorbisExtension->setCurrentIndex( config->data.general.preferredOggVorbisExtension == "ogg" ? 0 : 1 ); preferredOggVorbisExtensionBox->addWidget( cPreferredOggVorbisExtension ); connect( cPreferredOggVorbisExtension, SIGNAL(activated(int)), this, SLOT(somethingChanged()) ); preferredOggVorbisExtensionBox->setStretch( 0, 3 ); preferredOggVorbisExtensionBox->setStretch( 1, 1 ); box->addSpacing( spacingSmall ); QHBoxLayout *preferredVorbisCommentCommentTagBox = new QHBoxLayout(); preferredVorbisCommentCommentTagBox->addSpacing( spacingOffset ); box->addLayout( preferredVorbisCommentCommentTagBox ); QLabel* lPreferredVorbisCommentCommentTag = new QLabel( i18n("Preferred comment tag field for ogg vorbis and flac files:"), this ); lPreferredVorbisCommentCommentTag->setToolTip( i18n("Some applications use the field DESCRIPTION even though the field COMMENT is the correct one.\nComments will be written to the selected field, when reading tags the selected field will be preferred.") ); preferredVorbisCommentCommentTagBox->addWidget( lPreferredVorbisCommentCommentTag ); cPreferredVorbisCommentCommentTag = new KComboBox( this ); cPreferredVorbisCommentCommentTag->setToolTip( i18n("Some applications use the field DESCRIPTION even though the field COMMENT is the correct one.\nComments will be written to the selected field, when reading tags the selected field will be preferred.") ); cPreferredVorbisCommentCommentTag->addItem( "COMMENT" ); cPreferredVorbisCommentCommentTag->addItem( "DESCRIPTION" ); cPreferredVorbisCommentCommentTag->setCurrentIndex( config->data.general.preferredVorbisCommentCommentTag == "COMMENT" ? 0 : 1 ); preferredVorbisCommentCommentTagBox->addWidget( cPreferredVorbisCommentCommentTag ); connect( cPreferredVorbisCommentCommentTag, SIGNAL(activated(int)), this, SLOT(somethingChanged()) ); preferredVorbisCommentCommentTagBox->setStretch( 0, 3 ); preferredVorbisCommentCommentTagBox->setStretch( 1, 1 ); box->addSpacing( spacingSmall ); QHBoxLayout *preferredVorbisCommentTrackTotalTagBox = new QHBoxLayout(); preferredVorbisCommentTrackTotalTagBox->addSpacing( spacingOffset ); box->addLayout( preferredVorbisCommentTrackTotalTagBox ); QLabel* lPreferredVorbisCommentTrackTotalTag = new QLabel( i18n("Preferred total tracks number tag field for ogg vorbis and flac files:"), this ); lPreferredVorbisCommentTrackTotalTag->setToolTip( i18n("Total tracks number will be written to the selected field, when reading tags the selected field will be preferred.\nWhen using the field TRACKNUMBER, the track number and the total tracks number will be written to the same field separated by a slash ('/').") ); preferredVorbisCommentTrackTotalTagBox->addWidget( lPreferredVorbisCommentTrackTotalTag ); cPreferredVorbisCommentTrackTotalTag = new KComboBox( this ); cPreferredVorbisCommentTrackTotalTag->setToolTip( i18n("Total tracks number will be written to the selected field, when reading tags the selected field will be preferred.\nWhen using the field TRACKNUMBER, the track number and the total tracks number will be written to the same field separated by a slash ('/').") ); cPreferredVorbisCommentTrackTotalTag->addItem( "TRACKTOTAL" ); cPreferredVorbisCommentTrackTotalTag->addItem( "TOTALTRACKS" ); cPreferredVorbisCommentTrackTotalTag->addItem( "TRACKNUMBER" ); cPreferredVorbisCommentTrackTotalTag->setCurrentIndex( cPreferredVorbisCommentTrackTotalTag->findText(config->data.general.preferredVorbisCommentTrackTotalTag) ); preferredVorbisCommentTrackTotalTagBox->addWidget( cPreferredVorbisCommentTrackTotalTag ); connect( cPreferredVorbisCommentTrackTotalTag, SIGNAL(activated(int)), this, SLOT(somethingChanged()) ); preferredVorbisCommentTrackTotalTagBox->setStretch( 0, 3 ); preferredVorbisCommentTrackTotalTagBox->setStretch( 1, 1 ); box->addSpacing( spacingSmall ); QHBoxLayout *preferredVorbisCommentDiscTotalTagBox = new QHBoxLayout(); preferredVorbisCommentDiscTotalTagBox->addSpacing( spacingOffset ); box->addLayout( preferredVorbisCommentDiscTotalTagBox ); QLabel* lPreferredVorbisCommentDiscTotalTag = new QLabel( i18n("Preferred total discs number tag field for ogg vorbis and flac files:"), this ); lPreferredVorbisCommentDiscTotalTag->setToolTip( i18n("Total discs number will be written to the selected field, when reading tags the selected field will be preferred.\nWhen using the field DISCNUMBER, the disc number and the total discs number will be written to the same field separated by a slash ('/').") ); preferredVorbisCommentDiscTotalTagBox->addWidget( lPreferredVorbisCommentDiscTotalTag ); cPreferredVorbisCommentDiscTotalTag = new KComboBox( this ); cPreferredVorbisCommentDiscTotalTag->setToolTip( i18n("Total discs number will be written to the selected field, when reading tags the selected field will be preferred.\nWhen using the field DISCNUMBER, the disc number and the total discs number will be written to the same field separated by a slash ('/').") ); cPreferredVorbisCommentDiscTotalTag->addItem( "DISCTOTAL" ); cPreferredVorbisCommentDiscTotalTag->addItem( "TOTALDISCS" ); cPreferredVorbisCommentDiscTotalTag->addItem( "DISCNUMBER" ); cPreferredVorbisCommentDiscTotalTag->setCurrentIndex( cPreferredVorbisCommentDiscTotalTag->findText(config->data.general.preferredVorbisCommentDiscTotalTag) ); preferredVorbisCommentDiscTotalTagBox->addWidget( cPreferredVorbisCommentDiscTotalTag ); connect( cPreferredVorbisCommentDiscTotalTag, SIGNAL(activated(int)), this, SLOT(somethingChanged()) ); preferredVorbisCommentDiscTotalTagBox->setStretch( 0, 3 ); preferredVorbisCommentDiscTotalTagBox->setStretch( 1, 1 ); box->addSpacing( spacingSmall ); QHBoxLayout *useVFATNamesBox = new QHBoxLayout(); useVFATNamesBox->addSpacing( spacingOffset ); box->addLayout( useVFATNamesBox ); cUseVFATNames = new QCheckBox( i18n("Always use FAT compatible output file names"), this ); cUseVFATNames->setToolTip( i18n("Replaces some special characters like \'?\' by \'_\'.\nIf the output directory is on a FAT file system FAT compatible file names will automatically be used independently from this option.") ); cUseVFATNames->setChecked( config->data.general.useVFATNames ); useVFATNamesBox->addWidget( cUseVFATNames ); connect( cUseVFATNames, SIGNAL(toggled(bool)), this, SLOT(somethingChanged()) ); box->addSpacing( spacingSmall ); QHBoxLayout *ejectCdAfterRipBox = new QHBoxLayout(); ejectCdAfterRipBox->addSpacing( spacingOffset ); box->addLayout( ejectCdAfterRipBox ); cEjectCdAfterRip = new QCheckBox( i18n("Eject CD after ripping has been completed"), this ); cEjectCdAfterRip->setChecked( config->data.advanced.ejectCdAfterRip ); ejectCdAfterRipBox->addWidget( cEjectCdAfterRip ); connect( cEjectCdAfterRip, SIGNAL(toggled(bool)), this, SLOT(somethingChanged()) ); box->addSpacing( spacingBig ); QLabel *lDebug = new QLabel( i18n("Debug"), this ); // TODO rename lDebug->setFont( groupFont ); box->addWidget( lDebug ); box->addSpacing( spacingSmall ); QHBoxLayout *writeLogFilesBox = new QHBoxLayout(); writeLogFilesBox->addSpacing( spacingOffset ); box->addLayout( writeLogFilesBox ); cWriteLogFiles = new QCheckBox( i18n("Write log files to disc"), this ); cWriteLogFiles->setToolTip( i18n("Write log files to the hard drive while converting.\nThis can be useful if a crash occurs and you can't access the log file using the log viewer.\nLog files will be written to %1",KStandardDirs::locateLocal("data","soundkonverter/log/")) ); cWriteLogFiles->setChecked( config->data.general.writeLogFiles ); writeLogFilesBox->addWidget( cWriteLogFiles ); connect( cWriteLogFiles, SIGNAL(toggled(bool)), this, SLOT(somethingChanged()) ); box->addSpacing( spacingBig ); QLabel *lExperimental = new QLabel( i18n("Experimental"), this ); lExperimental->setFont( groupFont ); box->addWidget( lExperimental ); box->addSpacing( spacingSmall ); QHBoxLayout *useSharedMemoryForTempFilesBox = new QHBoxLayout(); useSharedMemoryForTempFilesBox->addSpacing( spacingOffset ); box->addLayout( useSharedMemoryForTempFilesBox ); cUseSharedMemoryForTempFiles = new QCheckBox( i18n("Store temporary files in memory unless the estimated size is more than:"), this ); cUseSharedMemoryForTempFiles->setToolTip( i18n("Don't store files that are expected to be bigger than this value in memory to avoid swapping") ); cUseSharedMemoryForTempFiles->setChecked( config->data.advanced.useSharedMemoryForTempFiles ); useSharedMemoryForTempFilesBox->addWidget( cUseSharedMemoryForTempFiles ); iMaxSizeForSharedMemoryTempFiles = new KIntSpinBox( 1, config->data.advanced.sharedMemorySize, 1, config->data.advanced.sharedMemorySize / 2, this ); iMaxSizeForSharedMemoryTempFiles->setToolTip( i18n("Don't store files that are expected to be bigger than this value in memory to avoid swapping") ); iMaxSizeForSharedMemoryTempFiles->setSuffix( " " + i18nc("mega in bytes","MiB") ); iMaxSizeForSharedMemoryTempFiles->setValue( config->data.advanced.maxSizeForSharedMemoryTempFiles ); useSharedMemoryForTempFilesBox->addWidget( iMaxSizeForSharedMemoryTempFiles ); if( config->data.advanced.sharedMemorySize == 0 ) { cUseSharedMemoryForTempFiles->setEnabled( false ); cUseSharedMemoryForTempFiles->setChecked( false ); cUseSharedMemoryForTempFiles->setToolTip( i18n("It seems there's no filesystem mounted on /dev/shm") ); } iMaxSizeForSharedMemoryTempFiles->setEnabled( cUseSharedMemoryForTempFiles->isChecked() ); connect( cUseSharedMemoryForTempFiles, SIGNAL(toggled(bool)), this, SLOT(somethingChanged()) ); connect( cUseSharedMemoryForTempFiles, SIGNAL(toggled(bool)), iMaxSizeForSharedMemoryTempFiles, SLOT(setEnabled(bool)) ); connect( iMaxSizeForSharedMemoryTempFiles, SIGNAL(valueChanged(int)), this, SLOT(somethingChanged()) ); useSharedMemoryForTempFilesBox->setStretch( 0, 3 ); useSharedMemoryForTempFilesBox->setStretch( 1, 1 ); box->addSpacing( spacingSmall ); QHBoxLayout *usePipesBox = new QHBoxLayout(); usePipesBox->addSpacing( spacingOffset ); box->addLayout( usePipesBox ); cUsePipes = new QCheckBox( i18n("Use pipes when possible"), this ); cUsePipes->setToolTip( i18n("Pipes make it unnecessary to use temporary files, therefore increasing the performance.\nBut some backends cause errors in this mode so be cautious.") ); cUsePipes->setChecked( config->data.advanced.usePipes ); usePipesBox->addWidget( cUsePipes ); connect( cUsePipes, SIGNAL(toggled(bool)), this, SLOT(somethingChanged()) ); box->addStretch(); } ConfigAdvancedPage::~ConfigAdvancedPage() {} void ConfigAdvancedPage::resetDefaults() { cPreferredOggVorbisExtension->setCurrentIndex( 0 ); cPreferredVorbisCommentCommentTag->setCurrentIndex( 1 ); cPreferredVorbisCommentTrackTotalTag->setCurrentIndex( 0 ); cPreferredVorbisCommentDiscTotalTag->setCurrentIndex( 0 ); cUseVFATNames->setChecked( false ); cEjectCdAfterRip->setChecked( true ); cWriteLogFiles->setChecked( false ); cUseSharedMemoryForTempFiles->setChecked( false ); iMaxSizeForSharedMemoryTempFiles->setValue( config->data.advanced.sharedMemorySize / 4 ); cUsePipes->setChecked( false ); emit configChanged( true ); } void ConfigAdvancedPage::saveSettings() { config->data.general.preferredOggVorbisExtension = cPreferredOggVorbisExtension->currentText(); config->data.general.preferredVorbisCommentCommentTag = cPreferredVorbisCommentCommentTag->currentText(); config->data.general.preferredVorbisCommentTrackTotalTag = cPreferredVorbisCommentTrackTotalTag->currentText(); config->data.general.preferredVorbisCommentDiscTotalTag = cPreferredVorbisCommentDiscTotalTag->currentText(); config->data.general.useVFATNames = cUseVFATNames->isChecked(); config->data.advanced.ejectCdAfterRip = cEjectCdAfterRip->isChecked(); config->data.general.writeLogFiles = cWriteLogFiles->isChecked(); config->data.advanced.useSharedMemoryForTempFiles = cUseSharedMemoryForTempFiles->isEnabled() && cUseSharedMemoryForTempFiles->isChecked(); config->data.advanced.maxSizeForSharedMemoryTempFiles = iMaxSizeForSharedMemoryTempFiles->value(); config->data.advanced.usePipes = cUsePipes->isChecked(); } void ConfigAdvancedPage::somethingChanged() { const bool changed = cPreferredOggVorbisExtension->currentText() != config->data.general.preferredOggVorbisExtension || cPreferredVorbisCommentCommentTag->currentText() != config->data.general.preferredVorbisCommentCommentTag || cPreferredVorbisCommentTrackTotalTag->currentText() != config->data.general.preferredVorbisCommentTrackTotalTag || cPreferredVorbisCommentDiscTotalTag->currentText() != config->data.general.preferredVorbisCommentDiscTotalTag || cUseVFATNames->isChecked() != config->data.general.useVFATNames || cEjectCdAfterRip->isChecked() != config->data.advanced.ejectCdAfterRip || cWriteLogFiles->isChecked() != config->data.general.writeLogFiles || cUseSharedMemoryForTempFiles->isChecked() != config->data.advanced.useSharedMemoryForTempFiles || iMaxSizeForSharedMemoryTempFiles->value() != config->data.advanced.maxSizeForSharedMemoryTempFiles || cUsePipes->isChecked() != config->data.advanced.usePipes; emit configChanged( changed ); } ./soundkonverter-2.1.2/configdialog/PaxHeaders.4329/configgeneralpage.cpp0000644000000000000000000000013212441312442023205 xustar0030 mtime=1418040610.308840482 30 atime=1418040610.307840484 30 ctime=1418040695.176717203 ./soundkonverter-2.1.2/configdialog/configgeneralpage.cpp0000755000175000001440000003032112441312442024204 0ustar00danielusers00000000000000// // C++ Implementation: configgeneralpage // // Description: // // // Author: Daniel Faust , (C) 2007 // // Copyright: See COPYING file that comes with this distribution // // #include "configgeneralpage.h" #include "../config.h" #include #include #include #include #include #include #include #include #include #include #include #include ConfigGeneralPage::ConfigGeneralPage( Config *_config, QWidget *parent ) : ConfigPageBase( parent ), config( _config ) { const int processorsCount = Solid::Device::listFromType(Solid::DeviceInterface::Processor, QString()).count(); QVBoxLayout *box = new QVBoxLayout( this ); QFont groupFont; groupFont.setBold( true ); QLabel *lUserInterface = new QLabel( i18n("User interface"), this ); lUserInterface->setFont( groupFont ); box->addWidget( lUserInterface ); box->addSpacing( spacingSmall ); QHBoxLayout *startTabBox = new QHBoxLayout(); startTabBox->addSpacing( spacingOffset ); box->addLayout( startTabBox ); QLabel *lStartTab = new QLabel( i18n("Start in Mode:"), this ); startTabBox->addWidget( lStartTab ); cStartTab = new KComboBox( this ); cStartTab->addItem( i18n("Last used") ); cStartTab->addItem( i18n("Simple") ); cStartTab->addItem( i18n("Detailed") ); cStartTab->setCurrentIndex( config->data.general.startTab ); startTabBox->addWidget( cStartTab ); connect( cStartTab, SIGNAL(activated(int)), this, SLOT(somethingChanged()) ); box->addSpacing( spacingSmall ); QHBoxLayout *defaultProfileBox = new QHBoxLayout(); defaultProfileBox->addSpacing( spacingOffset ); box->addLayout( defaultProfileBox ); QLabel *lDefaultProfile = new QLabel( i18n("Default profile:"), this ); defaultProfileBox->addWidget( lDefaultProfile ); cDefaultProfile = new KComboBox( this ); QStringList sDefaultProfile; sDefaultProfile += i18n("Last used"); sDefaultProfile += i18n("Very low"); sDefaultProfile += i18n("Low"); sDefaultProfile += i18n("Medium"); sDefaultProfile += i18n("High"); sDefaultProfile += i18n("Very high"); sDefaultProfile += i18n("Lossless"); // sDefaultProfile += i18n("Hybrid"); // currently unused sDefaultProfile += config->customProfiles(); cDefaultProfile->addItems( sDefaultProfile ); cDefaultProfile->setCurrentIndex( cDefaultProfile->findText(config->data.general.defaultProfile) ); defaultProfileBox->addWidget( cDefaultProfile ); connect( cDefaultProfile, SIGNAL(activated(int)), this, SLOT(profileChanged()) ); connect( cDefaultProfile, SIGNAL(activated(int)), this, SLOT(somethingChanged()) ); QLabel *lDefaultFormat = new QLabel( i18n("Default format:"), this ); defaultProfileBox->addWidget( lDefaultFormat ); cDefaultFormat = new KComboBox( this ); cDefaultFormat->setCurrentIndex( cDefaultFormat->findText(config->data.general.defaultFormat) ); defaultProfileBox->addWidget( cDefaultFormat ); connect( cDefaultFormat, SIGNAL(activated(int)), this, SLOT(somethingChanged()) ); profileChanged(); box->addSpacing( spacingBig ); QLabel *lConversion = new QLabel( i18n("Conversion"), this ); lConversion->setFont( groupFont ); box->addWidget( lConversion ); box->addSpacing( spacingSmall ); // QHBoxLayout *priorityBox = new QHBoxLayout(); // box->addLayout( priorityBox ); // QLabel *lPriority = new QLabel( i18n("Process priority of the backends:"), this ); // priorityBox->addWidget( lPriority ); // cPriority = new KComboBox( this ); // sPriority += i18n("Normal"); // sPriority += i18n("Low"); // cPriority->addItems( sPriority ); // cPriority->setCurrentIndex( config->data.general.priority / 10 ); // NOTE that just works for 'normal' and 'low' // priorityBox->addWidget( cPriority ); // connect( cPriority, SIGNAL(activated(int)), this, SIGNAL(configChanged()) ); // // box->addSpacing( 5 ); QHBoxLayout *conflictHandlingBox = new QHBoxLayout(); conflictHandlingBox->addSpacing( spacingOffset ); box->addLayout( conflictHandlingBox ); QLabel *lConflictHandling = new QLabel( i18n("Conflict handling:"), this ); conflictHandlingBox->addWidget( lConflictHandling ); cConflictHandling = new KComboBox( this ); cConflictHandling->addItem( i18n("Generate new file name") ); cConflictHandling->addItem( i18n("Skip file") ); // cConflictHandling->addItem( i18n("Overwrite file") ); cConflictHandling->setToolTip( i18n("Do that if the output file already exists") ); cConflictHandling->setCurrentIndex( (int)config->data.general.conflictHandling ); conflictHandlingBox->addWidget( cConflictHandling ); connect( cConflictHandling, SIGNAL(activated(int)), this, SLOT(somethingChanged()) ); box->addSpacing( spacingSmall ); QHBoxLayout *numFilesBox = new QHBoxLayout(); numFilesBox->addSpacing( spacingOffset ); box->addLayout( numFilesBox ); QLabel *lNumFiles = new QLabel( i18n("Number of files to convert at once:"), this ); numFilesBox->addWidget( lNumFiles ); iNumFiles = new KIntSpinBox( this ); iNumFiles->setToolTip( i18n("You shouldn't set this number higher than the amount of installed processor cores.\nThere have been %1 processor cores detected.").arg(processorsCount) ); iNumFiles->setRange( 1, 100 ); iNumFiles->setValue( config->data.general.numFiles ); numFilesBox->addWidget( iNumFiles ); connect( iNumFiles, SIGNAL(valueChanged(int)), this, SLOT(somethingChanged()) ); numFilesBox->setStretch( 0, 3 ); numFilesBox->setStretch( 1, 1 ); box->addSpacing( spacingSmall ); QHBoxLayout *waitForAlbumGainBox = new QHBoxLayout(); waitForAlbumGainBox->addSpacing( spacingOffset ); box->addLayout( waitForAlbumGainBox ); cWaitForAlbumGain = new QCheckBox( i18n("Apply album gain to converted files"), this ); cWaitForAlbumGain->setToolTip( i18n("Keep songs of the same album waiting in file list in order to apply album gain to all files.") ); cWaitForAlbumGain->setChecked( config->data.general.waitForAlbumGain ); waitForAlbumGainBox->addWidget( cWaitForAlbumGain ); connect( cWaitForAlbumGain, SIGNAL(toggled(bool)), this, SLOT(somethingChanged()) ); box->addSpacing( spacingBig ); QLabel *lReplayGainTool = new QLabel( i18n("Replay Gain tool"), this ); lReplayGainTool->setFont( groupFont ); box->addWidget( lReplayGainTool ); box->addSpacing( spacingSmall ); QHBoxLayout *replayGainGroupingBox = new QHBoxLayout(); replayGainGroupingBox->addSpacing( spacingOffset ); box->addLayout( replayGainGroupingBox ); QLabel* lReplayGainGrouping = new QLabel( i18n("Group files in the Replay Gain tool by:"), this ); replayGainGroupingBox->addWidget( lReplayGainGrouping ); cReplayGainGrouping = new KComboBox( this ); cReplayGainGrouping->addItem( i18nc("Group files in the Replay Gain tool by","Album tags and directories") ); cReplayGainGrouping->addItem( i18nc("Group files in the Replay Gain tool by","Album tags only") ); cReplayGainGrouping->addItem( i18nc("Group files in the Replay Gain tool by","Directories only") ); cReplayGainGrouping->setCurrentIndex( (int)config->data.general.replayGainGrouping ); replayGainGroupingBox->addWidget( cReplayGainGrouping ); connect( cReplayGainGrouping, SIGNAL(activated(int)), this, SLOT(somethingChanged()) ); box->addSpacing( spacingSmall ); QHBoxLayout *numReplayGainFilesBox = new QHBoxLayout(); numReplayGainFilesBox->addSpacing( spacingOffset ); box->addLayout( numReplayGainFilesBox ); QLabel *lNumReplayGainFiles = new QLabel( i18n("Number of items to process at once:"), this ); numReplayGainFilesBox->addWidget( lNumReplayGainFiles ); iNumReplayGainFiles = new KIntSpinBox( this ); iNumReplayGainFiles->setToolTip( i18n("You shouldn't set this number higher than the amount of installed processor cores.\nThere have been %1 processor cores detected.").arg(processorsCount) ); iNumReplayGainFiles->setRange( 1, 100 ); iNumReplayGainFiles->setValue( config->data.general.numReplayGainFiles ); numReplayGainFilesBox->addWidget( iNumReplayGainFiles ); connect( iNumReplayGainFiles, SIGNAL(valueChanged(int)), this, SLOT(somethingChanged()) ); numReplayGainFilesBox->setStretch( 0, 3 ); numReplayGainFilesBox->setStretch( 1, 1 ); box->addStretch(); } ConfigGeneralPage::~ConfigGeneralPage() {} void ConfigGeneralPage::resetDefaults() { const int processorsCount = Solid::Device::listFromType(Solid::DeviceInterface::Processor, QString()).count(); cStartTab->setCurrentIndex( 0 ); cDefaultProfile->setCurrentIndex( 0 ); cDefaultFormat->setCurrentIndex( 0 ); // cPriority->setCurrentIndex( 1 ); cConflictHandling->setCurrentIndex( 0 ); iNumFiles->setValue( processorsCount > 0 ? processorsCount : 1 ); cWaitForAlbumGain->setChecked( true ); cReplayGainGrouping->setCurrentIndex( 0 ); iNumReplayGainFiles->setValue( processorsCount > 0 ? processorsCount : 1 ); emit configChanged( true ); } void ConfigGeneralPage::saveSettings() { config->data.general.startTab = cStartTab->currentIndex(); config->data.general.defaultProfile = cDefaultProfile->currentText(); config->data.general.defaultFormat = cDefaultFormat->currentText(); // config->data.general.priority = cPriority->currentIndex() * 10; // NOTE that just works for 'normal' and 'low' config->data.general.conflictHandling = (Config::Data::General::ConflictHandling)cConflictHandling->currentIndex(); config->data.general.numFiles = iNumFiles->value(); config->data.general.waitForAlbumGain = cWaitForAlbumGain->isChecked(); config->data.general.replayGainGrouping = (Config::Data::General::ReplayGainGrouping)cReplayGainGrouping->currentIndex(); config->data.general.numReplayGainFiles = iNumReplayGainFiles->value(); } void ConfigGeneralPage::somethingChanged() { const bool changed = cStartTab->currentIndex() != config->data.general.startTab || cDefaultProfile->currentText() != config->data.general.defaultProfile || cDefaultFormat->currentText() != config->data.general.defaultFormat || cConflictHandling->currentIndex() != (int)config->data.general.conflictHandling || iNumFiles->value() != config->data.general.numFiles || cWaitForAlbumGain->isChecked() != config->data.general.waitForAlbumGain || cReplayGainGrouping->currentIndex() != (int)config->data.general.replayGainGrouping || iNumReplayGainFiles->value() != config->data.general.numReplayGainFiles; emit configChanged( changed ); } void ConfigGeneralPage::profileChanged() { const QString profile = cDefaultProfile->currentText(); QString lastFormat = cDefaultFormat->currentText(); if( lastFormat.isEmpty() ) lastFormat = config->data.general.defaultFormat; cDefaultFormat->clear(); if( profile == i18n("Last used") ) { cDefaultFormat->addItem( i18n("Last used") ); } else if( profile == i18n("Very low") || profile == i18n("Low") || profile == i18n("Medium") || profile == i18n("High") || profile == i18n("Very high") ) { cDefaultFormat->addItem( i18n("Last used") ); cDefaultFormat->addItems( config->pluginLoader()->formatList(PluginLoader::Encode,PluginLoader::Lossy) ); } else if( profile == i18n("Lossless") ) { cDefaultFormat->addItem( i18n("Last used") ); cDefaultFormat->addItems( config->pluginLoader()->formatList(PluginLoader::Encode,PluginLoader::Lossless) ); } else if( profile == i18n("Hybrid") ) { cDefaultFormat->addItem( i18n("Last used") ); cDefaultFormat->addItems( config->pluginLoader()->formatList(PluginLoader::Encode,PluginLoader::Hybrid) ); } else { ConversionOptions *conversionOptions = config->data.profiles.value( profile ); if( conversionOptions ) cDefaultFormat->addItem( conversionOptions->codecName ); } if( cDefaultFormat->findText(lastFormat) != -1 ) cDefaultFormat->setCurrentIndex( cDefaultFormat->findText(lastFormat) ); } ./soundkonverter-2.1.2/configdialog/PaxHeaders.4329/configcoverartpage.h0000644000000000000000000000013212076525023023067 xustar0030 mtime=1358604819.205806282 30 atime=1358604819.205806282 30 ctime=1418040695.177717202 ./soundkonverter-2.1.2/configdialog/configcoverartpage.h0000644000175000001440000000242012076525023024062 0ustar00danielusers00000000000000// // C++ Interface: configgeneralpage // // Description: // // // Author: Daniel Faust , (C) 2007 // // Copyright: See COPYING file that comes with this distribution // // #ifndef CONFIGCOVERARTPAGE_H #define CONFIGCOVERARTPAGE_H #include "configpagebase.h" class Config; class QRadioButton; class QLabel; class QAbstractButton; class KLineEdit; /** @author Daniel Faust */ class ConfigCoverArtPage : public ConfigPageBase { Q_OBJECT public: /** * Default Constructor */ ConfigCoverArtPage( Config *_config, QWidget *parent=0 ); /** * Default Destructor */ ~ConfigCoverArtPage(); private: QRadioButton *rWriteCoversAlways; QRadioButton *rWriteCoversAuto; QRadioButton *rWriteCoversNever; QLabel *lWriteCoverName; QRadioButton *rWriteCoverNameTitle; QRadioButton *rWriteCoverNameDefault; QLabel *lWriteCoverNameDefaultLabel; KLineEdit *lWriteCoverNameDefaultEdit; // QCheckBox *cCopyCover; // QCheckBox *cEmbedCover; // QListView *lCoverList; Config *config; private slots: void somethingChanged(); void writeCoversChanged( QAbstractButton *button ); public slots: void resetDefaults(); void saveSettings(); }; #endif ./soundkonverter-2.1.2/configdialog/PaxHeaders.4329/configdialog.h0000644000000000000000000000013212076525023021644 xustar0030 mtime=1358604819.205806282 30 atime=1358604819.205806282 30 ctime=1418040695.177717202 ./soundkonverter-2.1.2/configdialog/configdialog.h0000755000175000001440000000213512076525023022645 0ustar00danielusers00000000000000 #ifndef CONFIGDIALOG_H #define CONFIGDIALOG_H #include class Config; class ConfigGeneralPage; class ConfigAdvancedPage; class ConfigCoverArtPage; class ConfigBackendsPage; /** @author Daniel Faust */ class ConfigDialog : public KPageDialog { Q_OBJECT public: ConfigDialog( Config *_config, QWidget *parent = 0/*, Page startPage = GeneralPage*/ ); ~ConfigDialog(); private: Config *config; KPageWidgetItem *generalPage; ConfigGeneralPage *configGeneralPage; KPageWidgetItem *advancedPage; ConfigAdvancedPage *configAdvancedPage; KPageWidgetItem *coverArtPage; ConfigCoverArtPage *configCoverArtPage; KPageWidgetItem *backendsPage; ConfigBackendsPage *configBackendsPage; bool lastUseVFATNames; int lastConflictHandling; bool generalPageChanged; bool advancedlPageChanged; bool coverArtPageChanged; bool backendsPageChanged; private slots: void configChanged( bool state ); void okClicked(); void applyClicked(); void defaultClicked(); signals: void updateFileList(); }; #endif ./soundkonverter-2.1.2/configdialog/PaxHeaders.4329/configpagebase.cpp0000644000000000000000000000012412276430236022513 xustar0028 mtime=1392128158.6946111 28 atime=1392128158.6946111 28 ctime=1418040695.1787172 ./soundkonverter-2.1.2/configdialog/configpagebase.cpp0000755000175000001440000000126112276430236023512 0ustar00danielusers00000000000000// // C++ Implementation: configpagebase // // Description: // // // Author: Daniel Faust , (C) 2007 // // Copyright: See COPYING file that comes with this distribution // // #include "configpagebase.h" #include ConfigPageBase::ConfigPageBase( QWidget *parent ) : QWidget( parent ) { const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); spacingOffset = 2 * fontHeight; spacingSmall = 0.5*fontHeight; spacingMedium = fontHeight; spacingBig = 2 * fontHeight; } ConfigPageBase::~ConfigPageBase() {} void ConfigPageBase::resetDefaults() {} void ConfigPageBase::saveSettings() {} ./soundkonverter-2.1.2/configdialog/PaxHeaders.4329/configdialog.cpp0000644000000000000000000000013212076525023022177 xustar0030 mtime=1358604819.205806282 30 atime=1358604819.205806282 30 ctime=1418040695.177717202 ./soundkonverter-2.1.2/configdialog/configdialog.cpp0000755000175000001440000001032312076525023023176 0ustar00danielusers00000000000000// // C++ Implementation: configdialog // // Description: // // // Author: Daniel Faust , (C) 2007 // // Copyright: See COPYING file that comes with this distribution // // #include "configdialog.h" #include "../config.h" #include "configgeneralpage.h" #include "configadvancedpage.h" #include "configcoverartpage.h" #include "configbackendspage.h" #include #include #include ConfigDialog::ConfigDialog( Config *_config, QWidget *parent/*, Page startPage*/ ) : KPageDialog( parent ), config( _config ) { setButtons( KDialog::Help | KDialog::Default | KDialog::Apply | KDialog::Ok | KDialog::Cancel ); setCaption( i18n("Settings") ); generalPageChanged = false; advancedlPageChanged = false; coverArtPageChanged = false; backendsPageChanged = false; button(KDialog::Apply)->setEnabled( false ); connect( this, SIGNAL(applyClicked()), this, SLOT(applyClicked()) ); connect( this, SIGNAL(okClicked()), this, SLOT(okClicked()) ); connect( this, SIGNAL(defaultClicked()), this, SLOT(defaultClicked()) ); configGeneralPage = new ConfigGeneralPage( config, this ); generalPage = addPage( (QWidget*)configGeneralPage, i18n("General") ); generalPage->setHeader( "" ); generalPage->setIcon( KIcon("configure") ); connect( configGeneralPage, SIGNAL(configChanged(bool)), this, SLOT(configChanged(bool)) ); configAdvancedPage = new ConfigAdvancedPage( config, this ); advancedPage = addPage( (QWidget*)configAdvancedPage, i18n("Advanced") ); advancedPage->setHeader( "" ); advancedPage->setIcon( KIcon("preferences-desktop-gaming") ); connect( configAdvancedPage, SIGNAL(configChanged(bool)), this, SLOT(configChanged(bool)) ); configCoverArtPage = new ConfigCoverArtPage( config, this ); coverArtPage = addPage( (QWidget*)configCoverArtPage, i18n("Cover art") ); coverArtPage->setHeader( "" ); coverArtPage->setIcon( KIcon("image-x-generic") ); connect( configCoverArtPage, SIGNAL(configChanged(bool)), this, SLOT(configChanged(bool)) ); configBackendsPage = new ConfigBackendsPage( config, this ); backendsPage = addPage( (QWidget*)configBackendsPage, i18n("Backends") ); backendsPage->setHeader( "" ); backendsPage->setIcon( KIcon("applications-system") ); connect( configBackendsPage, SIGNAL(configChanged(bool)), this, SLOT(configChanged(bool)) ); lastUseVFATNames = config->data.general.useVFATNames; lastConflictHandling = (int)config->data.general.conflictHandling; } ConfigDialog::~ConfigDialog() {} void ConfigDialog::configChanged( bool state ) { if( QObject::sender() == configGeneralPage ) { generalPageChanged = state; } else if( QObject::sender() == configAdvancedPage ) { advancedlPageChanged = state; } else if( QObject::sender() == configCoverArtPage ) { coverArtPageChanged = state; } else if( QObject::sender() == configBackendsPage ) { backendsPageChanged = state; } const bool changed = ( generalPageChanged || advancedlPageChanged || coverArtPageChanged || backendsPageChanged ); button(KDialog::Apply)->setEnabled( changed ); } void ConfigDialog::applyClicked() { okClicked(); generalPageChanged = false; advancedlPageChanged = false; coverArtPageChanged = false; backendsPageChanged = false; button(KDialog::Apply)->setEnabled( false ); } void ConfigDialog::okClicked() { configGeneralPage->saveSettings(); configAdvancedPage->saveSettings(); configCoverArtPage->saveSettings(); configBackendsPage->saveSettings(); config->save(); if( lastUseVFATNames != config->data.general.useVFATNames || lastConflictHandling != (int)config->data.general.conflictHandling ) { emit updateFileList(); } } void ConfigDialog::defaultClicked() { if( currentPage() == generalPage ) { configGeneralPage->resetDefaults(); } else if( currentPage() == advancedPage ) { configAdvancedPage->resetDefaults(); } else if( currentPage() == coverArtPage ) { configCoverArtPage->resetDefaults(); } else if( currentPage() == backendsPage ) { configBackendsPage->resetDefaults(); } } ./soundkonverter-2.1.2/PaxHeaders.4329/config.h0000644000000000000000000000013212441312442016032 xustar0030 mtime=1418040610.307840484 30 atime=1418040610.306840485 30 ctime=1418040695.114717305 ./soundkonverter-2.1.2/config.h0000755000175000001440000001024712441312442017036 0ustar00danielusers00000000000000// // C++ Interface: config // #ifndef CONFIG_H #define CONFIG_H #include #include "pluginloader.h" #include "metadata/tagengine.h" #include "conversionoptionsmanager.h" #include "codecoptimizations.h" #include #define ConfigUpdateDelay 100 class Logger; /** @author Daniel Faust */ class Config : public QObject { Q_OBJECT public: struct CodecData { QString codecName; QStringList encoders; QStringList decoders; QStringList replaygain; }; struct ProfileData { QString fileName; QString profileName; QString pluginName; QString codecName; QDomDocument data; }; struct Data { struct General { int startTab; int lastTab; QString defaultProfile; QString lastProfile; // may be obsolete QString defaultFormat; QString lastFormat; int lastOutputDirectoryMode; QString specifyOutputDirectory; QString metaDataOutputDirectory; QString copyStructureOutputDirectory; QStringList lastMetaDataOutputDirectoryPaths; QStringList lastNormalOutputDirectoryPaths; // int priority; bool waitForAlbumGain; bool useVFATNames; bool writeLogFiles; enum ConflictHandling { NewFileName = 0, Skip = 1, Overwrite = 2 } conflictHandling; int numFiles; int numReplayGainFiles; // bool executeUserScript; // bool showToolBar; // int outputFilePermissions; QStringList actionMenuConvertMimeTypes; QStringList actionMenuReplayGainMimeTypes; enum ReplayGainGrouping { AlbumDirectory = 0, Album = 1, Directory = 2 } replayGainGrouping; QString preferredOggVorbisExtension; QString preferredVorbisCommentCommentTag; QString preferredVorbisCommentTrackTotalTag; QString preferredVorbisCommentDiscTotalTag; } general; struct Advanced { bool useSharedMemoryForTempFiles; int maxSizeForSharedMemoryTempFiles; // maximum file size for storing in shared memory [MiB] int sharedMemorySize; // the size of the tmpfs [MiB] bool usePipes; bool ejectCdAfterRip; } advanced; struct CoverArt { int writeCovers; int writeCoverName; QString writeCoverDefaultName; } coverArt; struct Backends { QList codecs; QStringList filters; QStringList enabledFilters; } backends; struct BackendOptimizationsIgnoreList { QList optimizationList; } backendOptimizationsIgnoreList; struct App { int configVersion; } app; QMap profiles; } data; Config( Logger *_logger, QObject *parent ); ~Config(); void load(); void save(); /// returns a list of all working custom profiles QStringList customProfiles(); /// Check if new backends got installed and the backend settings can be optimized QList getOptimizations( bool includeIgnored = false ); PluginLoader *pluginLoader() { return pPluginLoader; } TagEngine *tagEngine() { return pTagEngine; } ConversionOptionsManager *conversionOptionsManager() { return pConversionOptionsManager; } public slots: /// Optimize backend settings according to the user input void doOptimizations( const QList& optimizationList ); signals: /// connected to logger void updateWriteLogFilesSetting( bool writeLogFiles ); private: Logger *logger; PluginLoader *pPluginLoader; TagEngine *pTagEngine; ConversionOptionsManager *pConversionOptionsManager; void writeServiceMenu(); }; #endif ./soundkonverter-2.1.2/PaxHeaders.4329/soundkonverter-rip-audiocd.desktop.template0000644000000000000000000000006211633413563025121 xustar0020 atime=1308600737 30 ctime=1418040695.111717311 ./soundkonverter-2.1.2/soundkonverter-rip-audiocd.desktop.template0000644000175000001440000000035411633413563026116 0ustar00danielusers00000000000000[Desktop Entry] X-KDE-Solid-Predicate=OpticalDisc.availableContent & 'Audio' Type=Service Actions=Rip X-KDE-Priority=TopLevel [Desktop Action Rip] _Name=Rip Audio CD with soundKonverter Icon=soundkonverter Exec=soundkonverter --rip %d ./soundkonverter-2.1.2/PaxHeaders.4329/logger.cpp0000644000000000000000000000013212076525023016404 xustar0030 mtime=1358604819.214806309 30 atime=1358604819.214806309 30 ctime=1418040695.107717316 ./soundkonverter-2.1.2/logger.cpp0000644000175000001440000001206212076525023017402 0ustar00danielusers00000000000000 #include "logger.h" #include #include #include #include #include LoggerItem::LoggerItem() {} LoggerItem::~LoggerItem() {} Logger::Logger( QObject *parent) : QObject( parent ) { KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "General" ); writeLogFiles = group.readEntry( "writeLogFiles", false ); LoggerItem *item = new LoggerItem(); item->identifier = "soundKonverter"; item->id = 1000; item->completed = true; item->succeeded = true; item->file.setFileName( KStandardDirs::locateLocal("data",QString("soundkonverter/log/%1.log").arg(item->id)) ); if( writeLogFiles ) { // TODO error handling item->file.open( QIODevice::WriteOnly ); item->textStream.setDevice( &(item->file) ); } processes.append( item ); srand( (unsigned)time(NULL) ); } Logger::~Logger() { for( QList::Iterator it = processes.begin(); it != processes.end(); ++it ) { if( (*it)->file.isOpen() ) (*it)->file.close(); if( (*it)->file.exists() ) (*it)->file.remove(); delete *it; } } // void Logger::cleanUp() // { // for( QList::Iterator it = processes.begin(); it != processes.end(); ++it ) // { // if( (*it)->id != 1000 ) // { // emit removedProcess( (*it)->id ); // (*it)->file.close(); // (*it)->file.remove(); // delete *it; // } // } // processes.clear(); // } int Logger::registerProcess( const QString& identifier ) { LoggerItem *item = new LoggerItem(); item->identifier = identifier; item->id = getNewID(); item->completed = false; item->file.setFileName( KStandardDirs::locateLocal("data",QString("soundkonverter/log/%1.log").arg(item->id)) ); if( writeLogFiles ) { // TODO error handling item->file.open( QIODevice::WriteOnly ); item->textStream.setDevice( &(item->file) ); } processes.append( item ); log( item->id, i18n("Identifier") + ": " + item->identifier ); log( item->id, i18n("Log ID") + ": " + QString::number(item->id) ); emit updateProcess( item->id ); return item->id; } void Logger::log( int id, const QString& data ) { for( QList::Iterator it = processes.begin(); it != processes.end(); ++it ) { if( (*it)->id == id ) { (*it)->data.append( data ); if( (*it)->data.count() > 10000 ) (*it)->data.removeFirst(); if( writeLogFiles && (*it)->file.isOpen() ) { (*it)->textStream << data; (*it)->textStream << "\n"; (*it)->textStream.flush(); } if( id == 1000 ) emit updateProcess( id ); return; } } } int Logger::getNewID() { bool ok; int id; do { id = rand(); ok = true; for( QList::Iterator it = processes.begin(); it != processes.end(); ++it ) { if( (*it)->id == id ) ok = false; } } while( !ok ); return id; } LoggerItem* Logger::getLog( int id ) { for( QList::Iterator it = processes.begin(); it != processes.end(); ++it ) { if( (*it)->id == id ) return *it; } return 0; } QList Logger::getLogs() { /* QList items; for( QList::Iterator it = processes.begin(); it != processes.end(); ++it ) { if( (*it)->completed ) items.append( *it ); } return items;*/ return processes; } void Logger::processCompleted( int id, bool succeeded, bool waitingForAlbumGain ) { Q_UNUSED( waitingForAlbumGain ) LoggerItem* removeItem = 0; QTime time = QTime::currentTime(); for( int i=0; itime < time && processes.at(i)->completed && processes.at(i)->succeeded && processes.at(i)->id != 1000 ) { time = processes.at(i)->time; removeItem = processes.at(i); } else if( processes.at(i)->id == id ) { processes.at(i)->succeeded = succeeded; processes.at(i)->completed = true; processes.at(i)->time = processes.at(i)->time.currentTime(); processes.at(i)->data.append( i18n("Finished logging") ); if( processes.at(i)->file.isOpen() ) { processes.at(i)->textStream << i18n("Finished logging"); processes.at(i)->file.close(); } emit updateProcess( id ); } } if( removeItem && processes.count() > 11 ) { emit removedProcess( removeItem->id ); if( removeItem->file.exists() ) removeItem->file.remove(); processes.removeAt( processes.indexOf(removeItem) ); delete removeItem; } } void Logger::updateWriteSetting( bool _writeLogFiles ) { writeLogFiles = _writeLogFiles; } ./soundkonverter-2.1.2/PaxHeaders.4329/global.cpp0000644000000000000000000000013212076525023016365 xustar0030 mtime=1358604819.213806306 30 atime=1358604819.213806306 30 ctime=1418040695.111717311 ./soundkonverter-2.1.2/global.cpp0000644000175000001440000001144212076525023017364 0ustar00danielusers00000000000000// // C++ Implementation: global // // Description: // // // Author: Daniel Faust , (C) 2008 // // Copyright: See COPYING file that comes with this distribution // // #include "global.h" #include #include Global::Global() {} Global::~Global() {} QString Global::prettyNumber( double num, QString unit, short digits ) { QString prettyString; if( unit == "%" && digits == 3 ) { if( num < 10 ) prettyString.sprintf("%.2f %%",num); else if( num < 100 ) prettyString.sprintf("%.1f %%",num); else prettyString.sprintf("%.0f %%",num); if( KGlobal::locale()->decimalSymbol() != "." ) prettyString.replace(".",KGlobal::locale()->decimalSymbol()); } else if( unit == "%" && digits == 2 ) { if( num < 10 ) prettyString.sprintf("%.1f %%",num); else prettyString.sprintf("%.0f %%",num); if( KGlobal::locale()->decimalSymbol() != "." ) prettyString.replace(".",KGlobal::locale()->decimalSymbol()); } else if( unit == "B" ) { short pow = 0; while( num > 1024 ) { num /= 1024; pow++; } if( pow == 0 ) unit = "B"; else if( pow == 1 ) unit = "KiB"; else if( pow == 2 ) unit = "MiB"; else if( pow == 3 ) unit = "GiB"; else if( pow == 4 ) unit = "TiB"; else if( pow == 5 ) unit = "PiB"; else if( pow == 6 ) unit = "EiB"; else if( pow == 7 ) unit = "ZiB"; else if( pow == 8 ) unit = "YiB"; else unit = "Nan"; if( num < 100 || num > 999 ) prettyString = QString::number(num).left(4); else prettyString = QString::number(num).left(3); prettyString = prettyString + " " + unit; if( KGlobal::locale()->decimalSymbol() != "." ) prettyString.replace(".",KGlobal::locale()->decimalSymbol()); } else if( unit == "ms" ) { short days = (int)(num/86400000.0f); short hours = (int)(num/3600000.0f)%24; short minutes = (int)(num/60000.0f)%60; short seconds = (int)(num/1000.0f)%60; short milliseconds = (int)num%1000; if( days >= 10 ) prettyString = QString("%1%2").arg(days).arg(i18nc("days","d")); else if( days >= 1 ) prettyString = QString("%1%2 %3%4").arg(days).arg(i18nc("days","d")).arg(hours).arg(i18nc("hours","h")); else if( hours >= 1 ) prettyString = QString("%1%2 %3%4").arg(hours).arg(i18nc("hours","h")).arg(minutes).arg(i18nc("minutes","m")); else if( minutes >= 1 && seconds < 10 ) prettyString = QString("%1%2 0%3%4").arg(minutes).arg(i18nc("minutes","m")).arg(seconds).arg(i18nc("seconds","s")); else if( minutes >= 1 ) prettyString = QString("%1%2 %3%4").arg(minutes).arg(i18nc("minutes","m")).arg(seconds).arg(i18nc("seconds","s")); else if( seconds >= 1 && milliseconds < 10 ) prettyString = QString("%1%2 00%3%4").arg(seconds).arg(i18nc("seconds","s")).arg(milliseconds).arg(i18nc("milliseconds","ms")); else if( seconds >= 1 && milliseconds < 100 ) prettyString = QString("%1%2 0%3%4").arg(seconds).arg(i18nc("seconds","s")).arg(milliseconds).arg(i18nc("milliseconds","ms")); else if( seconds >= 1 ) prettyString = QString("%1%2 %3%4").arg(seconds).arg(i18nc("seconds","s")).arg(milliseconds).arg(i18nc("milliseconds","ms")); else if( milliseconds >= 1 ) prettyString = QString("%1%2").arg(milliseconds).arg(i18nc("milliseconds","ms")); } else if( unit == "s" ) { short days = (int)(num/86400); short hours = (int)(num/3600)%24; short minutes = (int)(num/60)%60; short seconds = (int)(num)%60; if( days >= 10 ) prettyString = QString("%1%2").arg(days).arg(i18nc("days","d")); else if( days >= 1 ) prettyString = QString("%1%2 %3%4").arg(days).arg(i18nc("days","d")).arg(hours).arg(i18nc("hours","h")); else if( hours >= 1 ) prettyString = QString("%1%2 %3%4").arg(hours).arg(i18nc("hours","h")).arg(minutes).arg(i18nc("minutes","m")); else if( minutes >= 1 && seconds < 10 ) prettyString = QString("%1%2 0%3%4").arg(minutes).arg(i18nc("minutes","m")).arg(seconds).arg(i18nc("seconds","s")); else if( minutes >= 1 ) prettyString = QString("%1%2 %3%4").arg(minutes).arg(i18nc("minutes","m")).arg(seconds).arg(i18nc("seconds","s")); else if( seconds >= 1 ) prettyString = QString("%1%2").arg(seconds).arg(i18nc("seconds","s")); } return prettyString; } ./soundkonverter-2.1.2/PaxHeaders.4329/codecoptimizations.cpp0000644000000000000000000000013212110711557021032 xustar0030 mtime=1361285999.283426608 30 atime=1361285999.282426614 30 ctime=1418040695.107717316 ./soundkonverter-2.1.2/codecoptimizations.cpp0000644000175000001440000000730612110711557022035 0ustar00danielusers00000000000000 #include "codecoptimizations.h" #include #include #include #include #include #include #include CodecOptimizations::CodecOptimizations( const QList& _optimizationList, QWidget* parent, Qt::WFlags f ) : KDialog( parent, f ), optimizationList( _optimizationList ) { setCaption( i18n("Solutions for backend problems") ); setWindowIcon( KIcon("help-about") ); setButtons( KDialog::Ok | KDialog::Cancel ); setButtonFocus( KDialog::Cancel ); connect( this, SIGNAL(okClicked()), this, SLOT(okClicked()) ); QWidget *widget = new QWidget( this ); setMainWidget( widget ); QVBoxLayout *box = new QVBoxLayout( widget ); QLabel *messageLabel = new QLabel( i18n("You have installed or removed backends and your soundKonverter settings can be optimized."), this ); box->addWidget( messageLabel ); QFrame *frame = new QFrame( widget ); frame->setFrameShape( QFrame::StyledPanel ); frame->setFrameShadow( QFrame::Sunken ); box->addWidget( frame ); QGridLayout *grid = new QGridLayout( frame ); grid->setColumnStretch( 1, 0 ); grid->setColumnStretch( 2, 0 ); for( int i=0; iaddWidget( solutionLabel, i, 0 ); if( mode == Optimization::Encode ) { solutionLabel->setText( i18n( "For encoding %1 files the backend '%2' can be replaced with '%3'.", codecName, currentBackend, betterBackend ) ); } else if( mode == Optimization::Decode && codecName == "audio cd" ) { solutionLabel->setText( i18n( "For ripping audio CDs the backend '%1' can be replaced with '%2'.", currentBackend, betterBackend ) ); } else if( mode == Optimization::Decode ) { solutionLabel->setText( i18n( "For decoding %1 files the backend '%2' can be replaced with '%3'.", codecName, currentBackend, betterBackend ) ); } else if( mode == Optimization::ReplayGain ) { solutionLabel->setText( i18n( "For applying Replay Gain to %1 files the backend '%2' can be replaced with '%3'.", codecName, currentBackend, betterBackend ) ); } QRadioButton *solutionIgnore = new QRadioButton( i18n("Ignore"), frame ); if( solution == Optimization::Ignore ) solutionIgnore->setChecked( true ); grid->addWidget( solutionIgnore, i, 1 ); QRadioButton *solutionFix = new QRadioButton( i18n("Fix"), frame ); solutionFixButtons.append( solutionFix ); if( solution != Optimization::Ignore ) solutionFix->setChecked( true ); grid->addWidget( solutionFix, i, 2 ); QButtonGroup *solutionButtonGroup = new QButtonGroup( frame ); solutionButtonGroup->addButton( solutionIgnore ); solutionButtonGroup->addButton( solutionFix ); } } CodecOptimizations::~CodecOptimizations() {} void CodecOptimizations::okClicked() { for( int i=0; iisChecked() ) optimizationList[i].solution = Optimization::Fix; else optimizationList[i].solution = Optimization::Ignore; } emit solutions( optimizationList ); } ./soundkonverter-2.1.2/PaxHeaders.4329/optionslayer.cpp0000644000000000000000000000013212276425343017663 xustar0030 mtime=1392126691.483331247 30 atime=1392126691.483331247 30 ctime=1418040695.113717307 ./soundkonverter-2.1.2/optionslayer.cpp0000755000175000001440000001072112276425343020664 0ustar00danielusers00000000000000 #include "optionslayer.h" #include "options.h" #include "config.h" #include #include #include #include #include #include #include #include OptionsLayer::OptionsLayer( Config *config, QWidget *parent ) : QWidget( parent ) { const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); QGridLayout *gridLayout = new QGridLayout( this ); gridLayout->setContentsMargins( 2*fontHeight, 2*fontHeight, 2*fontHeight, 2*fontHeight ); frame = new QFrame( this ); gridLayout->addWidget( frame, 0, 0 ); frame->setFrameShape( QFrame::StyledPanel ); frame->setFrameShadow( QFrame::Raised ); frame->setAutoFillBackground( true ); QPalette palette = frame->palette(); QBrush brush = palette.window(); QBrush oldBrush = brush; // brush.setColor( QColor(230,236,238) ); // 223,230,231 // brush.setColor( QColor(223,230,231) ); palette.setBrush( QPalette::Window, brush ); frame->setPalette( palette ); QVBoxLayout *frameLayout = new QVBoxLayout( frame ); options = new Options( config, i18n("Select your desired output options and click on \"Ok\"."), this ); frameLayout->addWidget( options ); QHBoxLayout *buttonBox = new QHBoxLayout(); frameLayout->addLayout( buttonBox ); buttonBox->addStretch(); pOk = new KPushButton( KIcon("dialog-ok"), i18n("Ok"), this ); buttonBox->addWidget( pOk ); connect( pOk, SIGNAL(clicked()), this, SLOT(ok()) ); pCancel = new KPushButton( KIcon("dialog-cancel"), i18n("Cancel"), this ); buttonBox->addWidget( pCancel ); connect( pCancel, SIGNAL(clicked()), this, SLOT(abort()) ); palette = options->palette(); brush = palette.window(); palette.setBrush( QPalette::Window, brush ); options->setPalette( palette ); setAutoFillBackground( true ); connect( &fadeTimer, SIGNAL(timeout()), this, SLOT(fadeAnim()) ); fadeAlpha = 0.0f; } OptionsLayer::~OptionsLayer() {} void OptionsLayer::fadeIn() { pOk->setDisabled( false ); pCancel->setDisabled( false ); fadeTimer.start( 50 ); fadeMode = 1; QPalette newPalette = palette(); newPalette.setBrush( QPalette::Window, brushSetAlpha( newPalette.window(), 0 ) ); setPalette( newPalette ); newPalette = frame->palette(); newPalette.setBrush( QPalette::Window, brushSetAlpha( newPalette.window(), 0 ) ); frame->setPalette( newPalette ); frame->hide(); show(); } void OptionsLayer::fadeOut() { urls.clear(); fadeTimer.start( 50 ); fadeMode = 2; frame->hide(); } void OptionsLayer::fadeAnim() { if( fadeMode == 1 ) fadeAlpha += 255.0f/50.0f*8.0f; else if( fadeMode == 2 ) fadeAlpha -= 255.0f/50.0f*8.0f; if( fadeAlpha <= 0.0f ) { fadeAlpha = 0.0f; fadeMode = 0; hide(); } else if( fadeAlpha >= 255.0f ) { fadeAlpha = 255.0f; fadeMode = 0; frame->show(); } else { fadeTimer.start( 50 ); } QPalette newPalette = palette(); newPalette.setBrush( QPalette::Window, brushSetAlpha( newPalette.window(), 192.0f/255.0f*fadeAlpha ) ); setPalette( newPalette ); newPalette = frame->palette(); newPalette.setBrush( QPalette::Window, brushSetAlpha( newPalette.window(), 230.0f/255.0f*fadeAlpha ) ); frame->setPalette( newPalette ); } void OptionsLayer::addUrls( const KUrl::List& _urls ) { urls += _urls; } void OptionsLayer::abort() { fadeOut(); } void OptionsLayer::ok() { ConversionOptions *conversionOptions = options->currentConversionOptions(); if( conversionOptions ) { options->accepted(); pOk->setDisabled( true ); pCancel->setDisabled( true ); kapp->processEvents(); emit done( urls, conversionOptions, command ); emit saveFileList(); fadeOut(); } else { KMessageBox::error( this, i18n("No conversion options selected.") ); // possibly unneeded i18n string } } void OptionsLayer::setProfile( const QString& profile ) { options->setProfile( profile ); } void OptionsLayer::setFormat( const QString& format ) { options->setFormat( format ); } void OptionsLayer::setOutputDirectory( const QString& directory ) { options->setOutputDirectory( directory ); } void OptionsLayer::setCommand( const QString& _command ) { command = _command; } void OptionsLayer::setCurrentConversionOptions( ConversionOptions *conversionOptions ) { options->setCurrentConversionOptions( conversionOptions ); } ./soundkonverter-2.1.2/PaxHeaders.4329/progressindicator.cpp0000644000000000000000000000006212322505442020665 xustar0020 atime=1416311950 30 ctime=1418040695.113717307 ./soundkonverter-2.1.2/progressindicator.cpp0000755000175000001440000001262712322505442021673 0ustar00danielusers00000000000000 #include "progressindicator.h" #include "global.h" #include #include #include #include #include #include #include TrailingAverage::TrailingAverage() { count = 10; } TrailingAverage::~TrailingAverage() {} void TrailingAverage::setCount( int _count ) { count = _count; while( deltaTime.count() > count ) deltaTime.removeFirst(); while( deltaValue.count() > count ) deltaValue.removeFirst(); } void TrailingAverage::addData( float _deltaTime, float _deltaValue ) { while( deltaTime.count() > count ) deltaTime.removeFirst(); while( deltaValue.count() > count ) deltaValue.removeFirst(); deltaTime.append( _deltaTime ); deltaValue.append( _deltaValue ); } float TrailingAverage::average() { float _deltaTime = 0; foreach( const float time, deltaTime ) _deltaTime += time; float _deltaValue = 0; foreach( const float value, deltaValue ) _deltaValue += value; return _deltaValue / _deltaTime; } ProgressIndicator::ProgressIndicator( QWidget *parent, Feature features ) : QWidget( parent ), lSpeed( 0 ), lTime( 0 ) { const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); totalTime = processedTime = 0; QHBoxLayout *box = new QHBoxLayout( this ); box->setContentsMargins( 0, 0, 0, 0 ); pBar = new QProgressBar( this ); box->addWidget( pBar, 0, Qt::AlignVCenter ); pBar->setRange( 0, 1 ); pBar->setValue( 0 ); if( features != 0 ) { box->addSpacing( 0.4*fontHeight ); QGridLayout *statusChildGrid = new QGridLayout(); statusChildGrid->setContentsMargins( 0, 0, 0, 0 ); box->addLayout( statusChildGrid ); box->setAlignment( statusChildGrid, Qt::AlignVCenter ); if( features & FeatureSpeed ) { QLabel *lSpeedText = new QLabel( i18n("Speed:"), this ); statusChildGrid->addWidget( lSpeedText, 0, 0, Qt::AlignVCenter ); QString actSpeed = " 0x"; lSpeed = new QLabel( "
" + actSpeed + "
", this ); statusChildGrid->addWidget( lSpeed, 0, 1, Qt::AlignVCenter | Qt::AlignRight ); speedAverage.setCount( 10 ); } if( features & FeatureTime ) { QLabel *lTimeText = new QLabel( i18n("Remaining time:"), this ); statusChildGrid->addWidget( lTimeText, 1, 0, Qt::AlignVCenter ); lTime = new QLabel( "
 0s
", this ); lTime->setFont( QFont( "Courier" ) ); statusChildGrid->addWidget( lTime, 1, 1, Qt::AlignVCenter | Qt::AlignRight ); timeAverage.setCount( 60 ); } updateTime.setHMS( 24, 0, 0 ); } } ProgressIndicator::~ProgressIndicator() {} void ProgressIndicator::timeChanged( float timeDelta ) { totalTime += timeDelta; if( totalTime > 0 ) pBar->setRange( 0, (int)totalTime ); else pBar->setRange( 0, 1 ); } void ProgressIndicator::timeFinished( float timeDelta ) { processedTime += timeDelta; } void ProgressIndicator::finished( bool reset ) { if( reset ) { totalTime -= processedTime; if( totalTime < 0 ) totalTime = 0.0f; } processedTime = 0.0f; pBar->setRange( 0, totalTime > 0 ? (int)totalTime : 1 ); if( reset ) pBar->setValue( totalTime > 0 ? 0 : 1 ); else pBar->setValue( pBar->maximum() ); updateTime.setHMS( 24, 0, 0 ); if( lTime ) { lTime->setText( "
 0s
" ); } if( lSpeed ) { QString actSpeed = " 0x"; lSpeed->setText( "
" + actSpeed + "
" ); } emit progressChanged( i18n("Finished") ); } void ProgressIndicator::update( float timeProgress ) { const float currentProcessedTime = processedTime + timeProgress; pBar->setValue( (int)currentProcessedTime ); const int iPercent = ( pBar->maximum() > 0 ) ? pBar->value() * 100 / pBar->maximum() : 0; if( lTime || lSpeed ) { if( !updateTime.isValid() ) updateTime.start(); if( updateTime.elapsed() >= 1000 ) { const float deltaTime = updateTime.restart() / 1000; if( lTime ) { timeAverage.addData( deltaTime, currentProcessedTime - lastProcessedTime ); const float remainingProcessTime = totalTime - currentProcessedTime; const float remainingTime = remainingProcessTime / timeAverage.average() + 1; lTime->setText( "
" + Global::prettyNumber(remainingTime,"s") + "
" ); } if( lSpeed ) { speedAverage.addData( deltaTime, currentProcessedTime - lastProcessedTime ); const float speed = speedAverage.average(); if( speed >= 0.0f && speed < 100000.0f ) { QString speedString = QString::number(qRound(speed)) + "x"; if( speed < 10 ) speedString = " " + speedString; if( speed < 100 ) speedString = " " + speedString; lSpeed->setText( "
" + speedString + "
" ); } } lastProcessedTime = currentProcessedTime; } } emit progressChanged( QString::number(iPercent) + "%" ); } ./soundkonverter-2.1.2/PaxHeaders.4329/cmake_uninstall.cmake.in0000644000000000000000000000006211635143360021203 xustar0020 atime=1316275929 30 ctime=1418040695.108717315 ./soundkonverter-2.1.2/cmake_uninstall.cmake.in0000644000175000001440000000176311635143360022205 0ustar00danielusers00000000000000if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) string(REGEX REPLACE "\n" ";" files "${files}") list(REVERSE files) foreach (file ${files}) message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") if (EXISTS "$ENV{DESTDIR}${file}") execute_process( COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}" OUTPUT_VARIABLE rm_out RESULT_VARIABLE rm_retval ) if(NOT ${rm_retval} EQUAL 0) message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") endif (NOT ${rm_retval} EQUAL 0) else (EXISTS "$ENV{DESTDIR}${file}") message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") endif (EXISTS "$ENV{DESTDIR}${file}") endforeach(file) ./soundkonverter-2.1.2/PaxHeaders.4329/cmake0000644000000000000000000000006211357377551015442 xustar0020 atime=1358274329 30 ctime=1418040695.168717217 ./soundkonverter-2.1.2/cmake/0000755000175000001440000000000011357377551016512 5ustar00danielusers00000000000000./soundkonverter-2.1.2/cmake/PaxHeaders.4329/modules0000644000000000000000000000006211743013200017063 xustar0020 atime=1358274330 30 ctime=1418040695.167717219 ./soundkonverter-2.1.2/cmake/modules/0000755000175000001440000000000011743013200020133 5ustar00danielusers00000000000000./soundkonverter-2.1.2/cmake/modules/PaxHeaders.4329/FindTaglib-Extras.cmake0000644000000000000000000000006211346023516023423 xustar0020 atime=1306662471 30 ctime=1418040695.167717219 ./soundkonverter-2.1.2/cmake/modules/FindTaglib-Extras.cmake0000644000175000001440000001104511346023516024417 0ustar00danielusers00000000000000# - Try to find the Taglib-Extras library # Once done this will define # # TAGLIB-EXTRAS_FOUND - system has the taglib library # TAGLIB-EXTRAS_CFLAGS - the taglib cflags # TAGLIB-EXTRAS_LIBRARIES - The libraries needed to use taglib # Copyright (c) 2006, Laurent Montel, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if(NOT TAGLIB-EXTRAS_MIN_VERSION) set(TAGLIB-EXTRAS_MIN_VERSION "1.0") endif(NOT TAGLIB-EXTRAS_MIN_VERSION) if(NOT WIN32) find_program(TAGLIB-EXTRASCONFIG_EXECUTABLE NAMES taglib-extras-config PATHS ${BIN_INSTALL_DIR} ) endif(NOT WIN32) #reset vars set(TAGLIB-EXTRAS_LIBRARIES) set(TAGLIB-EXTRAS_CFLAGS) # if taglib-extras-config has been found if(TAGLIB-EXTRASCONFIG_EXECUTABLE) exec_program(${TAGLIB-EXTRASCONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB-EXTRAS_VERSION) if(TAGLIB-EXTRAS_VERSION STRLESS "${TAGLIB-EXTRAS_MIN_VERSION}") message(STATUS "TagLib-Extras version too old: version searched :${TAGLIB-EXTRAS_MIN_VERSION}, found ${TAGLIB-EXTRAS_VERSION}") set(TAGLIB-EXTRAS_FOUND FALSE) else(TAGLIB-EXTRAS_VERSION STRLESS "${TAGLIB-EXTRAS_MIN_VERSION}") exec_program(${TAGLIB-EXTRASCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB-EXTRAS_LIBRARIES) exec_program(${TAGLIB-EXTRASCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB-EXTRAS_CFLAGS) if(TAGLIB-EXTRAS_LIBRARIES AND TAGLIB-EXTRAS_CFLAGS) set(TAGLIB-EXTRAS_FOUND TRUE) endif(TAGLIB-EXTRAS_LIBRARIES AND TAGLIB-EXTRAS_CFLAGS) string(REGEX REPLACE " *-I" ";" TAGLIB-EXTRAS_INCLUDES "${TAGLIB-EXTRAS_CFLAGS}") endif(TAGLIB-EXTRAS_VERSION STRLESS "${TAGLIB-EXTRAS_MIN_VERSION}") mark_as_advanced(TAGLIB-EXTRAS_CFLAGS TAGLIB-EXTRAS_LIBRARIES TAGLIB-EXTRAS_INCLUDES) else(TAGLIB-EXTRASCONFIG_EXECUTABLE) find_path(TAGLIB-EXTRAS_INCLUDES NAMES tfile_helper.h PATH_SUFFIXES taglib-extras PATHS ${KDE4_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ) IF(NOT WIN32) # on non-win32 we don't need to take care about WIN32_DEBUG_POSTFIX FIND_LIBRARY(TAGLIB-EXTRAS_LIBRARIES tag-extras PATHS ${KDE4_LIB_DIR} ${LIB_INSTALL_DIR}) ELSE(NOT WIN32) # 1. get all possible libnames SET(args PATHS ${KDE4_LIB_DIR} ${LIB_INSTALL_DIR}) SET(newargs "") SET(libnames_release "") SET(libnames_debug "") LIST(LENGTH args listCount) # just one name LIST(APPEND libnames_release "tag-extras") LIST(APPEND libnames_debug "tag-extrasd") SET(newargs ${args}) # search the release lib FIND_LIBRARY(TAGLIB-EXTRAS_LIBRARIES_RELEASE NAMES ${libnames_release} ${newargs} ) # search the debug lib FIND_LIBRARY(TAGLIB-EXTRAS_LIBRARIES_DEBUG NAMES ${libnames_debug} ${newargs} ) IF(TAGLIB-EXTRAS_LIBRARIES_RELEASE AND TAGLIB-EXTRAS_LIBRARIES_DEBUG) # both libs found SET(TAGLIB-EXTRAS_LIBRARIES optimized ${TAGLIB-EXTRAS_LIBRARIES_RELEASE} debug ${TAGLIB-EXTRAS_LIBRARIES_DEBUG}) ELSE(TAGLIB-EXTRAS_LIBRARIES_RELEASE AND TAGLIB-EXTRAS_LIBRARIES_DEBUG) IF(TAGLIB-EXTRAS_LIBRARIES_RELEASE) # only release found SET(TAGLIB-EXTRAS_LIBRARIES ${TAGLIB-EXTRAS_LIBRARIES_RELEASE}) ELSE(TAGLIB-EXTRAS_LIBRARIES_RELEASE) # only debug (or nothing) found SET(TAGLIB-EXTRAS_LIBRARIES ${TAGLIB-EXTRAS_LIBRARIES_DEBUG}) ENDIF(TAGLIB-EXTRAS_LIBRARIES_RELEASE) ENDIF(TAGLIB-EXTRAS_LIBRARIES_RELEASE AND TAGLIB-EXTRAS_LIBRARIES_DEBUG) MARK_AS_ADVANCED(TAGLIB-EXTRAS_LIBRARIES_RELEASE) MARK_AS_ADVANCED(TAGLIB-EXTRAS_LIBRARIES_DEBUG) ENDIF(NOT WIN32) INCLUDE(FindPackageMessage) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Taglib-Extras DEFAULT_MSG TAGLIB-EXTRAS_INCLUDES TAGLIB-EXTRAS_LIBRARIES) endif(TAGLIB-EXTRASCONFIG_EXECUTABLE) if(TAGLIB-EXTRAS_FOUND) if(NOT Taglib-Extras_FIND_QUIETLY AND TAGLIB-EXTRASCONFIG_EXECUTABLE) message(STATUS "Taglib-Extras found: ${TAGLIB-EXTRAS_LIBRARIES}") endif(NOT Taglib-Extras_FIND_QUIETLY AND TAGLIB-EXTRASCONFIG_EXECUTABLE) else(TAGLIB-EXTRAS_FOUND) if(Taglib-Extras_FIND_REQUIRED) message(FATAL_ERROR "Could not find Taglib-Extras") endif(Taglib-Extras_FIND_REQUIRED) endif(TAGLIB-EXTRAS_FOUND) ./soundkonverter-2.1.2/cmake/modules/PaxHeaders.4329/FindCdparanoia.cmake0000644000000000000000000000006211132453425023015 xustar0020 atime=1308763306 30 ctime=1418040695.167717219 ./soundkonverter-2.1.2/cmake/modules/FindCdparanoia.cmake0000644000175000001440000000251211132453425024010 0ustar00danielusers00000000000000# - Try to find the CD Paranoia libraries # Once done this will define # # CDPARANOIA_FOUND - system has cdparanoia # CDPARANOIA_INCLUDE_DIR - the cdparanoia include directory # CDPARANOIA_LIBRARIES - Link these to use cdparanoia # # Copyright (c) 2006, Richard Laerkaeng, # Copyright (c) 2007, Allen Winter, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if (CDPARANOIA_INCLUDE_DIR AND CDPARANOIA_LIBRARIES) # in cache already SET(CDPARANOIA_FOUND TRUE) else (CDPARANOIA_INCLUDE_DIR AND CDPARANOIA_LIBRARIES) FIND_PATH(CDPARANOIA_INCLUDE_DIR cdda_interface.h PATH_SUFFIXES cdda) FIND_LIBRARY(CDPARANOIA_LIBRARY NAMES cdda_paranoia) FIND_LIBRARY(CDPARANOIA_IF_LIBRARY NAMES cdda_interface) IF (CDPARANOIA_LIBRARY AND CDPARANOIA_IF_LIBRARY) SET(CDPARANOIA_LIBRARIES ${CDPARANOIA_LIBRARY} ${CDPARANOIA_IF_LIBRARY} "-lm") ENDIF (CDPARANOIA_LIBRARY AND CDPARANOIA_IF_LIBRARY) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Cdparanoia DEFAULT_MSG CDPARANOIA_LIBRARIES CDPARANOIA_INCLUDE_DIR) MARK_AS_ADVANCED(CDPARANOIA_INCLUDE_DIR CDPARANOIA_LIBRARIES) endif (CDPARANOIA_INCLUDE_DIR AND CDPARANOIA_LIBRARIES) ./soundkonverter-2.1.2/cmake/modules/PaxHeaders.4329/FindTaglib.cmake0000644000000000000000000000006211346023516022157 xustar0020 atime=1308763306 30 ctime=1418040695.167717219 ./soundkonverter-2.1.2/cmake/modules/FindTaglib.cmake0000644000175000001440000000773611346023516023167 0ustar00danielusers00000000000000# - Try to find the Taglib library # Once done this will define # # TAGLIB_FOUND - system has the taglib library # TAGLIB_CFLAGS - the taglib cflags # TAGLIB_LIBRARIES - The libraries needed to use taglib # Copyright (c) 2006, Laurent Montel, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. if(NOT TAGLIB_MIN_VERSION) set(TAGLIB_MIN_VERSION "1.6") endif(NOT TAGLIB_MIN_VERSION) if(NOT WIN32) find_program(TAGLIBCONFIG_EXECUTABLE NAMES taglib-config PATHS ${BIN_INSTALL_DIR} ) endif(NOT WIN32) #reset vars set(TAGLIB_LIBRARIES) set(TAGLIB_CFLAGS) # if taglib-config has been found if(TAGLIBCONFIG_EXECUTABLE) exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --version RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_VERSION) if(TAGLIB_VERSION STRLESS "${TAGLIB_MIN_VERSION}") message(STATUS "TagLib version too old: version searched :${TAGLIB_MIN_VERSION}, found ${TAGLIB_VERSION}") set(TAGLIB_FOUND FALSE) else(TAGLIB_VERSION STRLESS "${TAGLIB_MIN_VERSION}") exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_LIBRARIES) exec_program(${TAGLIBCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE TAGLIB_CFLAGS) if(TAGLIB_LIBRARIES AND TAGLIB_CFLAGS) set(TAGLIB_FOUND TRUE) endif(TAGLIB_LIBRARIES AND TAGLIB_CFLAGS) string(REGEX REPLACE " *-I" ";" TAGLIB_INCLUDES "${TAGLIB_CFLAGS}") endif(TAGLIB_VERSION STRLESS "${TAGLIB_MIN_VERSION}") mark_as_advanced(TAGLIB_CFLAGS TAGLIB_LIBRARIES TAGLIB_INCLUDES) else(TAGLIBCONFIG_EXECUTABLE) find_path(TAGLIB_INCLUDES NAMES tag.h PATH_SUFFIXES taglib PATHS ${KDE4_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ) IF(NOT WIN32) # on non-win32 we don't need to take care about WIN32_DEBUG_POSTFIX FIND_LIBRARY(TAGLIB_LIBRARIES tag PATHS ${KDE4_LIB_DIR} ${LIB_INSTALL_DIR}) ELSE(NOT WIN32) # 1. get all possible libnames SET(args PATHS ${KDE4_LIB_DIR} ${LIB_INSTALL_DIR}) SET(newargs "") SET(libnames_release "") SET(libnames_debug "") LIST(LENGTH args listCount) # just one name LIST(APPEND libnames_release "tag") LIST(APPEND libnames_debug "tagd") SET(newargs ${args}) # search the release lib FIND_LIBRARY(TAGLIB_LIBRARIES_RELEASE NAMES ${libnames_release} ${newargs} ) # search the debug lib FIND_LIBRARY(TAGLIB_LIBRARIES_DEBUG NAMES ${libnames_debug} ${newargs} ) IF(TAGLIB_LIBRARIES_RELEASE AND TAGLIB_LIBRARIES_DEBUG) # both libs found SET(TAGLIB_LIBRARIES optimized ${TAGLIB_LIBRARIES_RELEASE} debug ${TAGLIB_LIBRARIES_DEBUG}) ELSE(TAGLIB_LIBRARIES_RELEASE AND TAGLIB_LIBRARIES_DEBUG) IF(TAGLIB_LIBRARIES_RELEASE) # only release found SET(TAGLIB_LIBRARIES ${TAGLIB_LIBRARIES_RELEASE}) ELSE(TAGLIB_LIBRARIES_RELEASE) # only debug (or nothing) found SET(TAGLIB_LIBRARIES ${TAGLIB_LIBRARIES_DEBUG}) ENDIF(TAGLIB_LIBRARIES_RELEASE) ENDIF(TAGLIB_LIBRARIES_RELEASE AND TAGLIB_LIBRARIES_DEBUG) MARK_AS_ADVANCED(TAGLIB_LIBRARIES_RELEASE) MARK_AS_ADVANCED(TAGLIB_LIBRARIES_DEBUG) ENDIF(NOT WIN32) INCLUDE(FindPackageMessage) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Taglib DEFAULT_MSG TAGLIB_INCLUDES TAGLIB_LIBRARIES) endif(TAGLIBCONFIG_EXECUTABLE) if(TAGLIB_FOUND) if(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE) message(STATUS "Taglib found: ${TAGLIB_LIBRARIES}") endif(NOT Taglib_FIND_QUIETLY AND TAGLIBCONFIG_EXECUTABLE) else(TAGLIB_FOUND) if(Taglib_FIND_REQUIRED) message(FATAL_ERROR "Could not find Taglib") endif(Taglib_FIND_REQUIRED) endif(TAGLIB_FOUND) ./soundkonverter-2.1.2/cmake/modules/PaxHeaders.4329/FindKcddb.cmake0000644000000000000000000000006211743013200021752 xustar0020 atime=1334580108 30 ctime=1418040695.167717219 ./soundkonverter-2.1.2/cmake/modules/FindKcddb.cmake0000644000175000001440000000215711743013200022752 0ustar00danielusers00000000000000# - Try to find Kcddb # Once done this will define # # KCDDB_FOUND - system has Kcddb # KCDDB_INCLUDE_DIR - the Kcddb include directory # KCDDB_LIBRARIES - Link these to use Kcddb # KCDDB_DEFINITIONS - Compiler switches required for using Kcddb # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # if ( KCDDB_INCLUDE_DIR AND KCDDB_LIBRARIES ) # in cache already SET(Kcddb_FIND_QUIETLY TRUE) endif ( KCDDB_INCLUDE_DIR AND KCDDB_LIBRARIES ) FIND_PATH(KCDDB_INCLUDE_DIR NAMES client.h PATH_SUFFIXES libkcddb PATHS ${KDE4_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ) FIND_LIBRARY(KCDDB_LIBRARIES NAMES kcddb PATHS ${KDE4_LIB_DIR} ${LIB_INSTALL_DIR} ) include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Kcddb "The kcddb devel package is needed. Alternatively you may find the necessary files in the kdemultimedia package." KCDDB_INCLUDE_DIR KCDDB_LIBRARIES ) # show the KCDDB_INCLUDE_DIR and KCDDB_LIBRARIES variables only in the advanced view MARK_AS_ADVANCED(KCDDB_INCLUDE_DIR KCDDB_LIBRARIES ) ./soundkonverter-2.1.2/PaxHeaders.4329/pluginloader.cpp0000644000000000000000000000006212076525023017614 xustar0020 atime=1396206967 30 ctime=1418040695.112717309 ./soundkonverter-2.1.2/pluginloader.cpp0000755000175000001440000012360012076525023020614 0ustar00danielusers00000000000000// // C++ Implementation: pluginloader // // Description: // // // Author: Daniel Faust , (C) 2007 // // Copyright: See COPYING file that comes with this distribution // // #include "pluginloader.h" #include "logger.h" #include "config.h" #include #include #include #include bool moreThanConversionPipe( const ConversionPipe& pipe1, const ConversionPipe& pipe2 ) { int rating1 = 0; int rating2 = 0; int minimumRating1 = 0; foreach( const ConversionPipeTrunk trunk, pipe1.trunks ) { if( minimumRating1 == 0 || trunk.rating < minimumRating1 ) minimumRating1 = trunk.rating; rating1 -= 10; } rating1 += minimumRating1; int minimumRating2 = 0; foreach( const ConversionPipeTrunk trunk, pipe2.trunks ) { if( minimumRating2 == 0 || trunk.rating < minimumRating2 ) minimumRating2 = trunk.rating; rating2 -= 10; } rating2 += minimumRating2; return rating1 > rating2; } bool moreThanReplayGainPipe( const ReplayGainPipe& pipe1, const ReplayGainPipe& pipe2 ) { return pipe1.rating > pipe2.rating; } PluginLoader::PluginLoader( Logger *_logger, Config *_config ) : logger( _logger ), config( _config ) { atomPath += "moov"; atomPath += "trak"; atomPath += "mdia"; atomPath += "minf"; atomPath += "stbl"; atomPath += "stsd"; } PluginLoader::~PluginLoader() { qDeleteAll( codecPlugins ); qDeleteAll( filterPlugins ); qDeleteAll( replaygainPlugins ); qDeleteAll( ripperPlugins ); } void PluginLoader::addFormatInfo( const QString& codecName, BackendPlugin *plugin ) { BackendPlugin::FormatInfo info = plugin->formatInfo( codecName ); for( int i=0; ilog( 1000, "Disturbing Error: Plugin " + plugin->name() + " says " + codecName + " was " + (info.lossless?"lossless":"lossy") + " but it is already registed as " + (!info.lossless?"lossless":"lossy") + "" ); return; } } formatInfos.append( info ); } void PluginLoader::load() { QTime overallTime; overallTime.start(); QTime createInstanceTime; int createInstanceTimeSum = 0; KService::List offers; logger->log( 1000, "\nloading plugins ..." ); offers = KServiceTypeTrader::self()->query("soundKonverter/CodecPlugin"); if( !offers.isEmpty() ) { for( int i=0; istorageId() << ""; QString error; CodecPlugin *plugin = KService::createInstance( offers.at(i), 0, allArgs, &error ); if( plugin ) { logger->log( 1000, "\tloading plugin: " + plugin->name() ); createInstanceTimeSum += createInstanceTime.elapsed(); codecPlugins.append( plugin ); plugin->scanForBackends(); QMap encodeCodecs; QMap decodeCodecs; QList codecTable = plugin->codecTable(); for( int j = 0; j < codecTable.count(); j++ ) { codecTable[j].plugin = plugin; conversionPipeTrunks.append( codecTable.at(j) ); if( codecTable.at(j).codecTo != "wav" ) encodeCodecs[codecTable.at(j).codecTo] += codecTable.at(j).enabled; if( codecTable.at(j).codecFrom != "wav" ) decodeCodecs[codecTable.at(j).codecFrom] += codecTable.at(j).enabled; addFormatInfo( codecTable.at(j).codecFrom, plugin ); addFormatInfo( codecTable.at(j).codecTo, plugin ); } if( encodeCodecs.count() > 0 ) { logger->log( 1000, "\t\tencode:" ); for( int j=0; jlog( 1000, "
\t\t\t" + QString("%1%2(%3)").arg(encodeCodecs.keys().at(j)).arg(spaces).arg(encodeCodecs.values().at(j) ? "enabled" : "disabled") + "
" ); } } if( decodeCodecs.count() > 0 ) { logger->log( 1000, "\t\tdecode:" ); for( int j=0; jlog( 1000, "
\t\t\t" + QString("%1%2(%3)").arg(decodeCodecs.keys().at(j)).arg(spaces).arg(decodeCodecs.values().at(j) ? "enabled" : "disabled") + "
" ); } } logger->log( 1000, "" ); } else { logger->log( 1000, "
\tfailed to load plugin: " + offers.at(i)->library() + "
" ); } } } offers = KServiceTypeTrader::self()->query("soundKonverter/FilterPlugin"); if( !offers.isEmpty() ) { for( int i=0; istorageId() << ""; QString error; FilterPlugin *plugin = KService::createInstance( offers.at(i), 0, allArgs, &error ); if( plugin ) { logger->log( 1000, "\tloading plugin: " + plugin->name() ); createInstanceTimeSum += createInstanceTime.elapsed(); filterPlugins.append( plugin ); plugin->scanForBackends(); QMap encodeCodecs; QMap decodeCodecs; QList codecTable = plugin->codecTable(); for( int j = 0; j < codecTable.count(); j++ ) { codecTable[j].plugin = plugin; filterPipeTrunks.append( codecTable.at(j) ); if( codecTable.at(j).codecTo != "wav" ) encodeCodecs[codecTable.at(j).codecTo] += codecTable.at(j).enabled; if( codecTable.at(j).codecFrom != "wav" ) decodeCodecs[codecTable.at(j).codecFrom] += codecTable.at(j).enabled; addFormatInfo( codecTable.at(j).codecFrom, plugin ); addFormatInfo( codecTable.at(j).codecTo, plugin ); } if( encodeCodecs.count() > 0 ) { logger->log( 1000, "\t\tencode:" ); for( int j=0; jlog( 1000, "
\t\t\t" + QString("%1%2(%3)").arg(encodeCodecs.keys().at(j)).arg(spaces).arg(encodeCodecs.values().at(j) ? "enabled" : "disabled") + "
" ); } } if( decodeCodecs.count() > 0 ) { logger->log( 1000, "\t\tdecode:" ); for( int j=0; jlog( 1000, "
\t\t\t" + QString("%1%2(%3)").arg(decodeCodecs.keys().at(j)).arg(spaces).arg(decodeCodecs.values().at(j) ? "enabled" : "disabled") + "
" ); } } // TODO filters logger->log( 1000, "" ); } else { logger->log( 1000, "
\tfailed to load plugin: " + offers.at(i)->library() + "
" ); } } } offers = KServiceTypeTrader::self()->query("soundKonverter/ReplayGainPlugin"); if( !offers.isEmpty() ) { for( int i=0; istorageId() << ""; QString error; ReplayGainPlugin *plugin = KService::createInstance( offers.at(i), 0, allArgs, &error ); if( plugin ) { logger->log( 1000, "\tloading plugin: " + plugin->name() ); createInstanceTimeSum += createInstanceTime.elapsed(); replaygainPlugins.append( plugin ); plugin->scanForBackends(); QList codecTable = plugin->codecTable(); for( int j = 0; j < codecTable.count(); j++ ) { codecTable[j].plugin = plugin; replaygainPipes.append( codecTable.at(j) ); QString spaces; spaces.fill( ' ', 12 - codecTable.at(j).codecName.length() ); logger->log( 1000, "
\t\t\t" + QString("%1%2(%3)").arg(codecTable.at(j).codecName).arg(spaces).arg(codecTable.at(j).enabled ? "enabled" : "disabled") + "
" ); addFormatInfo( codecTable.at(j).codecName, plugin ); } logger->log( 1000, "" ); } else { logger->log( 1000, "
\tfailed to load plugin: " + offers.at(i)->library() + "
" ); } } } offers = KServiceTypeTrader::self()->query("soundKonverter/RipperPlugin"); if( !offers.isEmpty() ) { for( int i=0; istorageId() << ""; QString error; RipperPlugin *plugin = KService::createInstance( offers.at(i), 0, allArgs, &error ); if( plugin ) { logger->log( 1000, "\tloading plugin: " + plugin->name() ); createInstanceTimeSum += createInstanceTime.elapsed(); ripperPlugins.append( plugin ); plugin->scanForBackends(); QList codecTable = plugin->codecTable(); for( int j = 0; j < codecTable.count(); j++ ) { codecTable[j].plugin = plugin; conversionPipeTrunks.append( codecTable.at(j) ); QString spaces; spaces.fill( ' ', 12 - codecTable.at(j).codecTo.length() ); logger->log( 1000, "
\t\t\t" + QString("%1%2(%3, %4)").arg(codecTable.at(j).codecTo).arg(spaces).arg(codecTable.at(j).enabled ? "enabled" : "disabled").arg(codecTable.at(j).data.canRipEntireCd ? "can rip to single file" : "can't rip to single file") + "
" ); } logger->log( 1000, "" ); } else { logger->log( 1000, "
\tfailed to load plugin: " + offers.at(i)->library() + "
" ); } } } conversionFilterPipeTrunks = conversionPipeTrunks + filterPipeTrunks; logger->log( 1000, QString("... all plugins loaded (took %1 ms, creating instances: %2 ms)").arg(overallTime.elapsed()).arg(createInstanceTimeSum) + "\n" ); } QStringList PluginLoader::formatList( Possibilities possibilities, CompressionType compressionType ) { QSet set; QStringList list; foreach( const ConversionPipeTrunk trunk, conversionFilterPipeTrunks ) { if( !trunk.enabled ) continue; if( possibilities & Encode ) { const QString codec = trunk.codecTo; const bool isLossless = isCodecLossless(codec); const bool isInferiorQuality = isCodecInferiorQuality(codec); // const bool isHybrid = isCodecHybrid(codec); if( ( ( compressionType & Lossy && !isLossless ) || ( compressionType & Lossless && isLossless ) ) && ( ( compressionType & InferiorQuality && isInferiorQuality ) || !isInferiorQuality ) ) set += codec; // if( compressionType & Hybrid && isCodecHybrid(codec) && ( compressionType & InferiorQuality && isInferiorQuality || !isInferiorQuality ) ) // set += codec; } if( possibilities & Decode ) { const QString codec = trunk.codecFrom; const bool isLossless = isCodecLossless(codec); const bool isInferiorQuality = isCodecInferiorQuality(codec); // const bool isHybrid = isCodecHybrid(codec); if( ( ( compressionType & Lossy && !isLossless ) || ( compressionType & Lossless && isLossless ) ) && ( ( compressionType & InferiorQuality && isInferiorQuality ) || !isInferiorQuality ) ) set += codec; // if( compressionType & Hybrid && isCodecHybrid(codec) && ( compressionType & InferiorQuality && isInferiorQuality || !isInferiorQuality ) ) // set += codec; } } if( possibilities & ReplayGain ) { for( int i=0; i PluginLoader::encodersForCodec( const QString& codecName ) { QSet encoders; foreach( const ConversionPipeTrunk pipeTrunk, conversionFilterPipeTrunks ) { if( pipeTrunk.codecTo == codecName && pipeTrunk.enabled ) { encoders += qobject_cast(pipeTrunk.plugin); } } return encoders.toList(); } // QList PluginLoader::decodersForCodec( const QString& codecName ) // { // QSet decoders; // // for( int i=0; itype() == "codec" ) // { // decoders += qobject_cast(conversionPipeTrunks.at(i).plugin); // } // } // // for( int i=0; itype() == "filter" ) // { // decoders += qobject_cast(filterPipeTrunks.at(i).plugin); // } // } // // return decoders.toList(); // } // QList PluginLoader::replaygainForCodec( const QString& codecName ) // { // QSet replaygain; // // for( int i=0; iname() == name ) { return codecPlugins.at(i); } } for( int i=0; iname() == name ) { return filterPlugins.at(i); } } for( int i=0; iname() == name ) { return replaygainPlugins.at(i); } } for( int i=0; iname() == name ) { return ripperPlugins.at(i); } } return 0; } QList PluginLoader::getConversionPipes( const QString& codecFrom, const QString& codecTo, QList filterOptions, const QString& preferredPlugin ) { QList list; QStringList decoders; QStringList encoders; // get the lists of decoders and encoders ordered by the user in the config dialog for( int i=0; idata.backends.codecs.count(); i++ ) { if( config->data.backends.codecs.at(i).codecName == codecFrom ) { decoders = config->data.backends.codecs.at(i).decoders; } if( config->data.backends.codecs.at(i).codecName == codecTo && codecTo != "wav" ) { encoders = config->data.backends.codecs.at(i).encoders; } } // prepend the preferred plugin if( !preferredPlugin.isEmpty() ) { encoders.removeAll( preferredPlugin ); encoders.prepend( preferredPlugin ); } QList filterPlugins; foreach( FilterOptions *filter, filterOptions ) { filterPlugins.append( qobject_cast(backendPluginByName(filter->pluginName)) ); } // build all possible pipes for( int i=0; i(conversionFilterPipeTrunks.at(i).plugin) ) continue; foreach( ConversionPipeTrunk trunk, filterPipeTrunks ) { if( trunk.plugin == plugin && trunk.codecFrom == "wav" && trunk.codecTo == "wav" && trunk.enabled ) { newPipe.trunks += trunk; break; } } } newPipe.trunks += conversionFilterPipeTrunks.at(i); if( encoders.indexOf(newPipe.trunks.last().plugin->name()) != -1 ) { // add rating depending on the position in the list ordered by the user, encoders do count much const int rating = ( encoders.count() - encoders.indexOf(newPipe.trunks.last().plugin->name()) ) * 1000000; for( int i=0; i(conversionFilterPipeTrunks.at(i).plugin) ) continue; foreach( ConversionPipeTrunk trunk, filterPipeTrunks ) { if( trunk.plugin == plugin && trunk.codecFrom == "wav" && trunk.codecTo == "wav" && trunk.enabled ) { newPipe.trunks += trunk; break; } } } if( decoders.indexOf(newPipe.trunks.first().plugin->name()) != -1 ) { // add rating depending on the position in the list ordered by the user, decoders don't count much const int rating = ( decoders.count() - decoders.indexOf(newPipe.trunks.first().plugin->name()) ) * 1000; for( int i=0; iname()) != -1 ) { // add rating depending on the position in the list ordered by the user, decoders don't count much newPipe.trunks[0].rating += ( decoders.count() - decoders.indexOf(newPipe.trunks.first().plugin->name()) ) * 1000; } if( encoders.indexOf(newPipe.trunks.first().plugin->name()) != -1 ) { // add rating depending on the position in the list ordered by the user, encoders do count much newPipe.trunks[0].rating += ( encoders.count() - encoders.indexOf(newPipe.trunks.first().plugin->name()) ) * 1000000; } list += newPipe; } } else if( conversionFilterPipeTrunks.at(i).codecTo == "wav" ) { if( conversionFilterPipeTrunks.at(i).codecFrom == conversionFilterPipeTrunks.at(i).codecTo ) continue; for( int j = 0; j < conversionFilterPipeTrunks.count(); j++ ) { if( i == j ) continue; if( conversionFilterPipeTrunks.at(j).codecFrom == conversionFilterPipeTrunks.at(j).codecTo ) continue; if( conversionFilterPipeTrunks.at(j).codecFrom == conversionFilterPipeTrunks.at(i).codecTo && conversionFilterPipeTrunks.at(j).codecTo == codecTo && conversionFilterPipeTrunks.at(j).enabled ) { ConversionPipe newPipe; newPipe.trunks += conversionFilterPipeTrunks.at(i); foreach( FilterPlugin *plugin, filterPlugins ) { if( plugin == qobject_cast(conversionFilterPipeTrunks.at(i).plugin) ) continue; if( plugin == qobject_cast(conversionFilterPipeTrunks.at(j).plugin) ) continue; foreach( ConversionPipeTrunk trunk, filterPipeTrunks ) { if( trunk.plugin == plugin && trunk.codecFrom == "wav" && trunk.codecTo == "wav" && trunk.enabled ) { newPipe.trunks += trunk; break; } } } newPipe.trunks += conversionFilterPipeTrunks.at(j); if( decoders.indexOf(newPipe.trunks.first().plugin->name()) != -1 ) { // add rating depending on the position in the list ordered by the user, decoders don't count much const int rating = ( decoders.count() - decoders.indexOf(newPipe.trunks.first().plugin->name()) ) * 1000; for( int i=0; iname()) != -1 ) { // add rating depending on the position in the list ordered by the user, encoders do count much const int rating = ( encoders.count() - encoders.indexOf(newPipe.trunks.last().plugin->name()) ) * 1000000; for( int i=0; i PluginLoader::getReplayGainPipes( const QString& codecName, const QString& preferredPlugin ) { QList list; QStringList backends; // get the lists of decoders and encoders ordered by the user in the config dialog for( int i=0; idata.backends.codecs.count(); i++ ) { if( config->data.backends.codecs.at(i).codecName == codecName ) { backends = config->data.backends.codecs.at(i).replaygain; } } // prepend the preferred plugin backends.removeAll( preferredPlugin ); backends.prepend( preferredPlugin ); for( int i=0; iname()) != -1 ) { // add rating depending on the position in the list ordered by the user newPipe.rating += ( backends.count() - backends.indexOf(newPipe.plugin->name()) ) * 1000; } list += newPipe; } } qSort( list.begin(), list.end(), moreThanReplayGainPipe ); return list; } QString PluginLoader::getCodecFromM4aFile( QFile *file ) { int atomPathDepth = 0; qint64 maxPos = file->size(); while( !file->atEnd() ) { const QByteArray length = file->read(4); const QByteArray name = file->read(4); if( atomPathDepth == 6 && name == "mp4a" ) { // It could be something other than aac but lets assume it's aac for now return "m4a/aac"; } else if( atomPathDepth == 6 && name == "alac" ) { return "m4a/alac"; } else if( length.size() == 4 ) { qint64 int_length = ((static_cast(length.at(0)) & 0xFF) << 24) + ((static_cast(length.at(1)) & 0xFF) << 16) + ((static_cast(length.at(2)) & 0xFF) << 8) + ((static_cast(length.at(3)) & 0xFF) ); if( int_length == 0 ) // Meaning: continues until end of file. return ""; if( int_length == 1 ) // Meaning: length is 64 bits { const QByteArray l = file->read(8); int_length = ((static_cast(l.at(0)) & 0xFF) << 56) + ((static_cast(l.at(1)) & 0xFF) << 48) + ((static_cast(l.at(2)) & 0xFF) << 40) + ((static_cast(l.at(3)) & 0xFF) << 32) + ((static_cast(l.at(4)) & 0xFF) << 24) + ((static_cast(l.at(5)) & 0xFF) << 16) + ((static_cast(l.at(6)) & 0xFF) << 8) + ((static_cast(l.at(7)) & 0xFF) ); } if( name == atomPath.at(atomPathDepth) ) { atomPathDepth++; maxPos = file->pos() - 8 + int_length; if( atomPathDepth == 6 ) file->seek( file->pos() + 8 ); // Skip 'stsd' header } else { if( file->pos() - 8 + int_length > maxPos ) return ""; file->seek( file->pos() - 8 + int_length ); } } else { return ""; } } return ""; } QString PluginLoader::getCodecFromFile( const KUrl& filename, QString *mimeType, bool checkM4a ) { QString codec = ""; short rating = 0; const QString mime = KMimeType::findByUrl(filename)->name(); if( mimeType ) *mimeType = mime; if( mime == "inode/directory" ) return codec; const QString extension = filename.url().mid( filename.url().lastIndexOf(".") + 1 ).toLower(); foreach( const BackendPlugin::FormatInfo info, formatInfos ) { short newRating = info.priority; if( info.mimeTypes.contains(mime) ) newRating += 100 - info.mimeTypes.indexOf(mime); if( info.extensions.contains(extension) ) newRating += 100 - info.extensions.indexOf(extension); // special treatment for the mp4 family if( ( mime == "audio/mp4" || mime == "audio/x-m4a" ) && extension == "aac" && info.codecName == "m4a/aac" ) newRating = 300; else if( ( mime == "audio/mp4" || mime == "audio/x-m4a" ) && extension == "alac" && info.codecName == "m4a/alac" ) newRating = 300; if( newRating == info.priority ) continue; if( newRating == 300 ) { return info.codecName; } else if( newRating > rating ) { rating = newRating; codec = info.codecName; } } // special treatment for the mp4 family if( checkM4a && ( mime == "audio/mp4" || mime == "audio/x-m4a" ) && filename.isLocalFile() ) { QFile file( filename.toLocalFile() ); if( file.open(QIODevice::ReadOnly) ) { const QString newCodec = getCodecFromM4aFile( &file ); file.close(); if( !newCodec.isEmpty() ) return newCodec; } } // get codec from a plugin - not used at the moment // QList allPlugins; // foreach( CodecPlugin *plugin, codecPlugins ) // allPlugins.append( plugin ); // foreach( FilterPlugin *plugin, filterPlugins ) // allPlugins.append( plugin ); // foreach( ReplayGainPlugin *plugin, replaygainPlugins ) // allPlugins.append( plugin ); // // foreach( BackendPlugin *plugin, allPlugins ) // { // short newRating = 0; // const QString newCodec = plugin->getCodecFromFile( filename, mime, &newRating ); // if( !newCodec.isEmpty() && newRating == 300 ) // { // return newCodec; // } // else if( !newCodec.isEmpty() && newRating > rating ) // { // rating = newRating; // codec = newCodec; // } // } return codec; } bool PluginLoader::canDecode( const QString& codecName, QStringList *errorList ) { if( codecName.isEmpty() ) return false; for( int i=0; icontains(conversionFilterPipeTrunks.at(i).problemInfo) ) { errorList->append( conversionFilterPipeTrunks.at(i).problemInfo ); } } } } return false; } bool PluginLoader::canReplayGain( const QString& codecName, CodecPlugin *plugin, QStringList *errorList ) { if( codecName.isEmpty() ) return false; for( int i=0; icontains(replaygainPipes.at(i).problemInfo) ) { errorList->append( replaygainPipes.at(i).problemInfo ); } } } } return false; } bool PluginLoader::canRipEntireCd( QStringList *errorList ) { for( int i=0; itype() == "ripper" && conversionFilterPipeTrunks.at(i).data.canRipEntireCd && conversionFilterPipeTrunks.at(i).enabled ) { return true; } } if( errorList ) { for( int i=0; itype() == "ripper" && conversionFilterPipeTrunks.at(i).data.canRipEntireCd ) { if( !conversionFilterPipeTrunks.at(i).problemInfo.isEmpty() && !errorList->contains(conversionFilterPipeTrunks.at(i).problemInfo) ) { errorList->append( conversionFilterPipeTrunks.at(i).problemInfo ); } } } } return false; } QMap PluginLoader::decodeProblems( bool detailed ) { QMap problems; QStringList errorList; QStringList enabledCodecs; if( !detailed ) { for( int i=0; i PluginLoader::encodeProblems( bool detailed ) { QMap problems; QStringList errorList; QStringList enabledCodecs; if( !detailed ) { for( int i=0; i PluginLoader::replaygainProblems( bool detailed ) { QMap problems; QStringList errorList; QStringList enabledCodecs; if( !detailed ) { for( int i=0; iname() == pluginName && conversionFilterPipeTrunks.at(i).codecFrom == codecName ) { return conversionFilterPipeTrunks.at(i).problemInfo; } } return QString(); } QString PluginLoader::pluginEncodeProblems( const QString& pluginName, const QString& codecName ) { for( int i=0; iname() == pluginName && conversionFilterPipeTrunks.at(i).codecTo == codecName ) { return conversionFilterPipeTrunks.at(i).problemInfo; } } return QString(); } QString PluginLoader::pluginReplayGainProblems( const QString& pluginName, const QString& codecName ) { for( int i=0; iname() == pluginName && replaygainPipes.at(i).codecName == codecName ) { return replaygainPipes.at(i).problemInfo; } } return QString(); } bool PluginLoader::isCodecLossless( const QString& codecName ) { for( int i=0; itype() == "codec" && conversionPipeTrunks.at(i).data.hasInternalReplayGain ) { return true; } } return false; } QStringList PluginLoader::codecExtensions( const QString& codecName ) { for( int i=0; idata.general.preferredOggVorbisExtension == "oga" ) { extensions.removeAll( "oga" ); extensions.prepend( "oga" ); } return extensions; } } return QStringList(); } QStringList PluginLoader::codecMimeTypes( const QString& codecName ) { for( int i=0; i */ #include "soundkonverterview.h" #include "filelist.h" #include "filelistitem.h" #include "combobutton.h" #include "progressindicator.h" #include "optionslayer.h" #include "config.h" #include "logger.h" #include "opener/fileopener.h" #include "opener/diropener.h" #include "opener/cdopener.h" #include "opener/urlopener.h" #include "opener/playlistopener.h" #include "convert.h" #include "options.h" #include "codecproblems.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include soundKonverterView::soundKonverterView( Logger *_logger, Config *_config, CDManager *_cdManager, QWidget *parent ) : QWidget( parent ), config( _config ), logger( _logger ), cdManager( _cdManager ) { setAcceptDrops( true ); const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); // the grid for all widgets in the main window QGridLayout* gridLayout = new QGridLayout( this ); fileList = new FileList( logger, config, this ); gridLayout->addWidget( fileList, 1, 0 ); gridLayout->setRowStretch( 1, 1 ); connect( fileList, SIGNAL(fileCountChanged(int)), this, SLOT(fileCountChanged(int)) ); connect( fileList, SIGNAL(conversionStarted()), this, SLOT(conversionStarted()) ); connect( fileList, SIGNAL(conversionStopped(bool)), this, SLOT(conversionStopped(bool)) ); connect( fileList, SIGNAL(queueModeChanged(bool)), this, SLOT(queueModeChanged(bool)) ); connect( fileList, SIGNAL(showLog(int)), this, SIGNAL(showLog(int)) ); optionsLayer = new OptionsLayer( config, this ); fileList->setOptionsLayer( optionsLayer ); optionsLayer->hide(); gridLayout->addWidget( optionsLayer, 1, 0 ); connect( optionsLayer, SIGNAL(done(const KUrl::List&,ConversionOptions*,const QString&)), fileList, SLOT(addFiles(const KUrl::List&,ConversionOptions*,const QString&)) ); connect( optionsLayer, SIGNAL(saveFileList()), fileList, SLOT(save()) ); // add a horizontal box layout for the add combobutton to the grid QHBoxLayout *addBox = new QHBoxLayout(); addBox->setContentsMargins( 1, 0, 1, 0 ); // extra margin - determined by experiments gridLayout->addLayout( addBox, 3, 0 ); // create the combobutton for adding files to the file list cAdd = new ComboButton( this ); QFont font = cAdd->font(); //font.setWeight( QFont::DemiBold ); font.setPointSize( font.pointSize() + 3 ); cAdd->setFont( font ); cAdd->insertItem( KIcon("audio-x-generic"), i18n("Add files...") ); cAdd->insertItem( KIcon("folder"), i18n("Add folder...") ); cAdd->insertItem( KIcon("media-optical-audio"), i18n("Add CD tracks...") ); cAdd->insertItem( KIcon("network-workgroup"), i18n("Add url...") ); cAdd->insertItem( KIcon("view-media-playlist"), i18n("Add playlist...") ); cAdd->increaseHeight( 0.6*fontHeight ); addBox->addWidget( cAdd, 0, Qt::AlignVCenter ); connect( cAdd, SIGNAL(clicked(int)), this, SLOT(addClicked(int)) ); cAdd->setFocus(); addBox->addSpacing( fontHeight ); startAction = new KAction( KIcon("system-run"), i18n("Start"), this ); connect( startAction, SIGNAL(triggered()), fileList, SLOT(startConversion()) ); pStart = new KPushButton( KIcon("system-run"), i18n("Start"), this ); pStart->setFixedHeight( pStart->size().height() ); pStart->setEnabled( false ); startAction->setEnabled( false ); addBox->addWidget( pStart, 0, Qt::AlignVCenter ); connect( pStart, SIGNAL(clicked()), fileList, SLOT(startConversion()) ); stopActionMenu = new KActionMenu( KIcon("process-stop"), i18n("Stop"), this ); stopActionMenu->setDelayed( false ); killAction = new KAction( KIcon("flag-red"), i18n("Stop immediatelly"), this ); stopActionMenu->addAction( killAction ); connect( killAction, SIGNAL(triggered()), fileList, SLOT(killConversion()) ); stopAction = new KAction( KIcon("flag-yellow"), i18n("Stop after current conversions are completed"), this ); stopActionMenu->addAction( stopAction ); connect( stopAction, SIGNAL(triggered()), fileList, SLOT(stopConversion()) ); continueAction = new KAction( KIcon("flag-green"), i18n("Continue after current conversions are completed"), this ); stopActionMenu->addAction( continueAction ); connect( continueAction, SIGNAL(triggered()), fileList, SLOT(continueConversion()) ); queueModeChanged( true ); pStop = new KPushButton( KIcon("process-stop"), i18n("Stop"), this ); pStop->setFixedHeight( pStop->size().height() ); pStop->hide(); stopActionMenu->setEnabled( false ); pStop->setMenu( stopActionMenu->menu() ); addBox->addWidget( pStop, 0, Qt::AlignVCenter ); addBox->addSpacing( fontHeight ); progressIndicator = new ProgressIndicator( this, ProgressIndicator::Feature( ProgressIndicator::FeatureSpeed | ProgressIndicator::FeatureTime ) ); addBox->addWidget( progressIndicator, 0, Qt::AlignVCenter ); connect( progressIndicator, SIGNAL(progressChanged(const QString&)), this, SIGNAL(progressChanged(const QString&)) ); connect( fileList, SIGNAL(timeChanged(float)), progressIndicator, SLOT(timeChanged(float)) ); connect( fileList, SIGNAL(finished(bool)), progressIndicator, SLOT(finished(bool)) ); Convert *convert = new Convert( config, fileList, logger, this ); connect( fileList, SIGNAL(convertItem(FileListItem*)), convert, SLOT(add(FileListItem*)) ); connect( fileList, SIGNAL(killItem(FileListItem*)), convert, SLOT(kill(FileListItem*)) ); connect( fileList, SIGNAL(itemRemoved(FileListItem*)), convert, SLOT(itemRemoved(FileListItem*)) ); connect( convert, SIGNAL(finished(FileListItem*,FileListItem::ReturnCode,bool)), fileList, SLOT(itemFinished(FileListItem*,FileListItem::ReturnCode,bool)) ); connect( convert, SIGNAL(rippingFinished(const QString&)), fileList, SLOT(rippingFinished(const QString&)) ); connect( convert, SIGNAL(finishedProcess(int,bool,bool)), logger, SLOT(processCompleted(int,bool,bool)) ); connect( convert, SIGNAL(updateTime(float)), progressIndicator, SLOT(update(float)) ); connect( convert, SIGNAL(timeFinished(float)), progressIndicator, SLOT(timeFinished(float)) ); } soundKonverterView::~soundKonverterView() {} void soundKonverterView::addClicked( int index ) { if( index == 0 ) { showFileDialog(); } else if( index == 1 ) { showDirDialog(); } else if( index == 2 ) { showCdDialog(); } else if( index == 3 ) { showUrlDialog(); } else { showPlaylistDialog(); } } void soundKonverterView::showFileDialog() { FileOpener *dialog = new FileOpener( config, this ); // dialog->resize( size().width() - 10, size().height() ); if( !dialog->dialogAborted ) { connect( dialog, SIGNAL(open(const KUrl::List&,ConversionOptions*)), fileList, SLOT(addFiles(const KUrl::List&,ConversionOptions*)) ); dialog->exec(); disconnect( dialog, SIGNAL(open(const KUrl::List&,ConversionOptions*)), 0, 0 ); fileList->save( false ); } delete dialog; } void soundKonverterView::showDirDialog() { DirOpener *dialog = new DirOpener( config, DirOpener::Convert, this ); if( !dialog->dialogAborted ) { connect( dialog, SIGNAL(open(const KUrl&,bool,const QStringList&,ConversionOptions*)), fileList, SLOT(addDir(const KUrl&,bool,const QStringList&,ConversionOptions*)) ); dialog->exec(); disconnect( dialog, SIGNAL(open(const KUrl&,bool,const QStringList&,ConversionOptions*)), 0, 0 ); fileList->save( false ); } delete dialog; } bool soundKonverterView::showCdDialog( const QString& device, QString _profile, QString _format, const QString& directory, const QString& notifyCommand ) { QString profile = _profile; QString format = _format; cleanupParameters( &profile, &format ); bool success = false; QString message; QStringList errorList; if( !config->pluginLoader()->canDecode("audio cd",&errorList) ) { QList problemList; CodecProblems::Problem problem; problem.codecName = "audio cd"; problem.solutions = errorList; problemList += problem; CodecProblems *problemsDialog = new CodecProblems( CodecProblems::AudioCd, problemList, this ); problemsDialog->exec(); return false; } // create a new CDOpener object for letting the user add some tracks from a CD CDOpener *dialog = new CDOpener( config, device, this ); if( !dialog->noCdFound ) { if( !profile.isEmpty() ) dialog->setProfile( profile ); if( !format.isEmpty() ) dialog->setFormat( format ); if( !directory.isEmpty() ) dialog->setOutputDirectory( directory ); if( !notifyCommand.isEmpty() ) dialog->setCommand( notifyCommand ); connect( dialog, SIGNAL(addTracks(const QString&,QList,int,QList,ConversionOptions*,const QString&)), fileList, SLOT(addTracks(const QString&,QList,int,QList,ConversionOptions*,const QString&)) ); dialog->exec(); disconnect( dialog, SIGNAL(addTracks(const QString&,QList,int,QList,ConversionOptions*,const QString&)), 0, 0 ); if( dialog->result() == QDialog::Accepted ) { success = true; fileList->save( false ); } } else { KMessageBox::error( this, i18n("No CD device found") ); } delete dialog; return success; } void soundKonverterView::showUrlDialog() { UrlOpener *dialog = new UrlOpener( config, this ); connect( dialog, SIGNAL(open(const KUrl::List&,ConversionOptions*)), fileList, SLOT(addFiles(const KUrl::List&,ConversionOptions*)) ); dialog->exec(); disconnect( dialog, SIGNAL(open(const KUrl::List&,ConversionOptions*)), 0, 0 ); delete dialog; fileList->save( false ); } void soundKonverterView::showPlaylistDialog() { PlaylistOpener *dialog = new PlaylistOpener( config, this ); // dialog->resize( size().width() - 10, size().height() ); if( !dialog->dialogAborted ) { connect( dialog, SIGNAL(open(const KUrl::List&,ConversionOptions*)), fileList, SLOT(addFiles(const KUrl::List&,ConversionOptions*)) ); dialog->exec(); disconnect( dialog, SIGNAL(open(const KUrl::List&,ConversionOptions*)), 0, 0 ); fileList->save( false ); } delete dialog; } void soundKonverterView::addConvertFiles( const KUrl::List& urls, QString _profile, QString _format, const QString& directory, const QString& notifyCommand ) { KUrl::List k_urls; QStringList errorList; // codec @0 files @1 solutions QMap< QString, QList > problems; QString fileName; const bool canDecodeAac = config->pluginLoader()->canDecode( "m4a/aac" ); const bool canDecodeAlac = config->pluginLoader()->canDecode( "m4a/alac" ); const bool checkM4a = ( !canDecodeAac || !canDecodeAlac ) && canDecodeAac != canDecodeAlac; for( int i=0; ipluginLoader()->getCodecFromFile( urls.at(i), &mimeType, checkM4a ); if( codecName == "inode/directory" || config->pluginLoader()->canDecode(codecName,&errorList) ) { k_urls += urls.at(i); } else { fileName = urls.at(i).pathOrUrl(); if( codecName.isEmpty() ) codecName = mimeType; if( codecName.isEmpty() ) codecName = fileName.right(fileName.length()-fileName.lastIndexOf(".")-1); if( problems.value(codecName).count() < 2 ) { problems[codecName] += QStringList(); problems[codecName] += QStringList(); } problems[codecName][0] += fileName; if( !errorList.isEmpty() ) { problems[codecName][1] += errorList; } else { problems[codecName][1] += i18n("This file type is unknown to soundKonverter.\nMaybe you need to install an additional soundKonverter plugin.\nYou should have a look at your distribution's package manager for this."); } } } QList problemList; for( int i=0; i= 0x040500 problems[problem.codecName][1].removeDuplicates(); #else QStringList found; for( int j=0; j 0 ) { CodecProblems *problemsDialog = new CodecProblems( CodecProblems::Decode, problemList, this ); problemsDialog->exec(); } if( k_urls.count() > 0 ) { QString profile = _profile; QString format = _format; cleanupParameters( &profile, &format ); if( !profile.isEmpty() && !format.isEmpty() && !directory.isEmpty() ) { Options *options = new Options( config, "", 0 ); options->hide(); options->setProfile( profile ); options->setFormat( format ); options->setOutputDirectory( directory ); ConversionOptions *conversionOptions = options->currentConversionOptions(); delete options; if( conversionOptions ) { fileList->addFiles( k_urls, conversionOptions, notifyCommand ); } else { // FIXME error message, null pointer for conversion options // KMessageBox::error( this, i18n("Sorry, this shouldn't happen.\n\nPlease report this bug and attach the following error message:\n\nsoundKonverterView::addConvertFiles; Options::currentConversionOptions returned 0"), i18n("Internal error") ); KMessageBox::error( this, "Sorry, this shouldn't happen.\n\nPlease report this bug and attach the following error message:\n\nsoundKonverterView::addConvertFiles; Options::currentConversionOptions returned 0", "Internal error" ); } } else { optionsLayer->addUrls( k_urls ); if( !profile.isEmpty() ) optionsLayer->setProfile( profile ); if( !format.isEmpty() ) optionsLayer->setFormat( format ); if( !directory.isEmpty() ) optionsLayer->setOutputDirectory( directory ); if( !notifyCommand.isEmpty() ) optionsLayer->setCommand( notifyCommand ); optionsLayer->fadeIn(); } } fileList->save( false ); } void soundKonverterView::loadAutosaveFileList() { fileList->load( false ); } void soundKonverterView::startConversion() { fileList->startConversion(); } void soundKonverterView::killConversion() { fileList->killConversion(); } void soundKonverterView::fileCountChanged( int count ) { pStart->setEnabled( count > 0 ); startAction->setEnabled( count > 0 ); } void soundKonverterView::conversionStarted() { pStart->hide(); startAction->setEnabled( false ); pStop->show(); stopActionMenu->setEnabled( true ); emit signalConversionStarted(); } void soundKonverterView::conversionStopped( bool failed ) { pStart->show(); startAction->setEnabled( true ); pStop->hide(); stopActionMenu->setEnabled( false ); emit signalConversionStopped( failed ); } void soundKonverterView::queueModeChanged( bool enabled ) { stopAction->setVisible( enabled ); continueAction->setVisible( !enabled ); } void soundKonverterView::loadFileList( bool user ) { fileList->load( user ); } void soundKonverterView::saveFileList( bool user ) { fileList->save( user ); } void soundKonverterView::updateFileList() { fileList->updateAllItems(); } void soundKonverterView::cleanupParameters( QString *profile, QString *format ) { QString old_profile = *profile; QString old_format = *format; QString new_profile; QString new_format; const QStringList formatList = config->pluginLoader()->formatList( PluginLoader::Encode, PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy|PluginLoader::Lossless|PluginLoader::Hybrid) ); if( formatList.contains(old_format) ) { new_format = old_format; } else { foreach( const QString format, formatList ) { if( config->pluginLoader()->codecExtensions(format).contains(old_format) ) { new_format = format; break; } } } if( old_profile.toLower() == i18n("Very low").toLower() || old_profile.toLower() == "very low" || old_profile.toLower() == "very_low" ) { new_profile = i18n("Very low"); new_format = config->pluginLoader()->formatList(PluginLoader::Encode,PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy)).contains(new_format) ? new_format : ""; } else if( old_profile.toLower() == i18n("Low").toLower() || old_profile.toLower() == "low" ) { new_profile = i18n("Low"); new_format = config->pluginLoader()->formatList(PluginLoader::Encode,PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy)).contains(new_format) ? new_format : ""; } else if( old_profile.toLower() == i18n("Medium").toLower() || old_profile.toLower() == "medium" ) { new_profile = i18n("Medium"); new_format = config->pluginLoader()->formatList(PluginLoader::Encode,PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy)).contains(new_format) ? new_format : ""; } else if( old_profile.toLower() == i18n("High").toLower() || old_profile.toLower() == "high" ) { new_profile = i18n("High"); new_format = config->pluginLoader()->formatList(PluginLoader::Encode,PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy)).contains(new_format) ? new_format : ""; } else if( old_profile.toLower() == i18n("Very high").toLower() || old_profile.toLower() == "very high" || old_profile.toLower() == "very_high" ) { new_profile = i18n("Very high"); new_format = config->pluginLoader()->formatList(PluginLoader::Encode,PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy)).contains(new_format) ? new_format : ""; } else if( old_profile.toLower() == i18n("Lossless").toLower() || old_profile.toLower() == "lossless" ) { new_profile = i18n("Lossless"); new_format = config->pluginLoader()->formatList(PluginLoader::Encode,PluginLoader::Lossless).contains(new_format) ? new_format : ""; } else if( old_profile.toLower() == i18n("Hybrid").toLower() || old_profile.toLower() == "hybrid" ) { new_profile = i18n("Hybrid"); new_format = config->pluginLoader()->formatList(PluginLoader::Encode,PluginLoader::Hybrid).contains(new_format) ? new_format : ""; } else if( config->data.profiles.contains(old_profile) ) { new_profile = old_profile; ConversionOptions *conversionOptions = config->data.profiles.value( new_profile ); if( conversionOptions ) new_format += conversionOptions->codecName; } *profile = new_profile; *format = new_format; } #include "soundkonverterview.moc" ./soundkonverter-2.1.2/PaxHeaders.4329/soundkonverter_codecplugin.desktop0000644000000000000000000000006210723037124023457 xustar0020 atime=1308600737 30 ctime=1418040695.108717315 ./soundkonverter-2.1.2/soundkonverter_codecplugin.desktop0000644000175000001440000000021410723037124024447 0ustar00danielusers00000000000000[Desktop Entry] Type=ServiceType X-KDE-ServiceType=soundKonverter/CodecPlugin X-KDE-Derived=KPluginInfo Comment=soundKonverter codec plugin ./soundkonverter-2.1.2/PaxHeaders.4329/soundkonverterapp.h0000644000000000000000000000013212076525023020363 xustar0030 mtime=1358604819.266806454 30 atime=1358604819.266806454 30 ctime=1418040695.108717315 ./soundkonverter-2.1.2/soundkonverterapp.h0000755000175000001440000000125212076525023021363 0ustar00danielusers00000000000000 #ifndef SOUNDKONVERTERAPP_H #define SOUNDKONVERTERAPP_H #include class soundKonverter; /** * @short The soundKonverter application. It controlles ensures that there can only run one instance of soundKonverter. * @author Daniel Faust * @version 0.3 */ class soundKonverterApp : public KUniqueApplication { Q_OBJECT public: /** Constructor */ soundKonverterApp(); /** Destructor */ ~soundKonverterApp(); /** This function is called, when a new instance of soundKonverter should be created */ virtual int newInstance(); // private: soundKonverter *mainWindow; }; #endif // SOUNDKONVERTERAPP_H ./soundkonverter-2.1.2/PaxHeaders.4329/optionsdetailed.h0000644000000000000000000000013212076525023017761 xustar0030 mtime=1358604819.219806324 30 atime=1358604819.219806324 30 ctime=1418040695.109717314 ./soundkonverter-2.1.2/optionsdetailed.h0000755000175000001440000000417212076525023020765 0ustar00danielusers00000000000000 #ifndef OPTIONSDETAILED_H #define OPTIONSDETAILED_H #include #include #include #include class CodecPlugin; class Config; class ConversionOptions; class FilterPlugin; class OutputDirectory; class CodecWidget; class FilterWidget; class KComboBox; class KPushButton; class QGridLayout; class QLabel; class QToolButton; /** @author Daniel Faust */ class OptionsDetailed : public QWidget { Q_OBJECT public: OptionsDetailed( Config *_config, QWidget *parent=0 ); ~OptionsDetailed(); void init(); /** Return the current options */ ConversionOptions *currentConversionOptions( bool saveLastUsed = true ); /** Set the current options */ bool setCurrentConversionOptions( ConversionOptions *options ); QString currentProfile(); bool setCurrentProfile( const QString& profile ); QString currentFormat(); void setCurrentFormat( const QString& format ); void resetFilterOptions(); void setReplayGainChecked( bool enabled ); bool isReplayGainEnabled( QString *toolTip = 0 ); bool isReplayGainChecked(); CodecPlugin *getCurrentPlugin(); OutputDirectory *outputDirectory; // this way it's easier to sync simple and detailed options // QSize sizeHint(); private: QGridLayout *grid; KComboBox *cFormat; QLabel *lPlugin; KComboBox *cPlugin; KPushButton *pConfigurePlugin; CodecWidget *wPlugin; QMap wFilter; QCheckBox *cReplayGain; QLabel *lEstimSize; KPushButton *pProfileSave; QToolButton *pProfileLoad; Config *config; CodecPlugin *currentPlugin; // QSize size_hint; public slots: void somethingChanged(); void loadCustomProfileButtonClicked(); bool saveCustomProfile( bool lastUsed = false ); void updateProfiles(); private slots: void formatChanged( const QString& format ); void encoderChanged( const QString& encoder ); void configurePlugin(); signals: // connected to optionsSimple void currentDataRateChanged( int rate ); // void optionsChanged(); void customProfilesEdited(); }; #endif ./soundkonverter-2.1.2/PaxHeaders.4329/metadata0000644000000000000000000000012012441312442016114 xustar0030 mtime=1418040610.312840477 20 atime=1358274329 30 ctime=1418040695.170717213 ./soundkonverter-2.1.2/metadata/0000755000175000001440000000000012441312442017171 5ustar00danielusers00000000000000./soundkonverter-2.1.2/metadata/PaxHeaders.4329/tagengine.cpp0000644000000000000000000000013212441312442020641 xustar0030 mtime=1418040610.312840477 30 atime=1418040610.311840478 30 ctime=1418040695.169717215 ./soundkonverter-2.1.2/metadata/tagengine.cpp0000755000175000001440000020240612441312442021645 0ustar00danielusers00000000000000 #include "tagengine.h" #include "MetaReplayGain.h" #include "config.h" // Taglib added support for FLAC pictures in 1.7.0 #if (TAGLIB_MAJOR_VERSION > 1) || (TAGLIB_MAJOR_VERSION == 1 && TAGLIB_MINOR_VERSION >= 7) # define TAGLIB_HAS_FLAC_PICTURELIST # define TAGLIB_HAS_ASF_PICTURE #endif // Taglib added support for opus in 1.9.0 #if (TAGLIB_MAJOR_VERSION > 1) || (TAGLIB_MAJOR_VERSION == 1 && TAGLIB_MINOR_VERSION >= 9) # define TAGLIB_HAS_OPUS #endif #include #include #include #include #include #include //used to load genre list #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #ifdef TAGLIB_HAS_OPUS #include #endif CoverData::CoverData( const QByteArray& _data, const QString& _mimyType, Role _role, const QString& _description, QObject *parent ) : QObject( parent ) { data = _data; mimeType = _mimyType; role = _role; description = _description; } CoverData::~CoverData() {} QString CoverData::roleName( Role role ) { switch( role ) { case Other: return i18nc("cover type","Unclassified"); case FileIcon: return i18nc("cover type","32x32 PNG file icon"); case OtherFileIcon: return i18nc("cover type","File icon"); case FrontCover: return i18nc("cover type","Front cover"); case BackCover: return i18nc("cover type","Back cover"); case LeafletPage: return i18nc("cover type","Leaflet page"); case Media: return i18nc("cover type","CD photo"); case LeadArtist: return i18nc("cover type","Lead artist picture"); case Artist: return i18nc("cover type","Artist picture"); case Conductor: return i18nc("cover type","Conductor picture"); case Band: return i18nc("cover type","Band picture"); case Composer: return i18nc("cover type","Composer picture"); case Lyricist: return i18nc("cover type","Lyricist picture"); case RecordingLocation: return i18nc("cover type","Picture of the recording location"); case DuringRecording: return i18nc("cover type","Picture of the artists during recording"); case DuringPerformance: return i18nc("cover type","Picture of the artists during performance"); case MovieScreenCapture: return i18nc("cover type","Picture from a video"); case ColouredFish: return i18nc("cover type","Picture of a large, coloured fish"); case Illustration: return i18nc("cover type","Illustration related to the track"); case BandLogo: return i18nc("cover type","Band logo"); case PublisherLogo: return i18nc("cover type","Publisher logo"); } return QString(); } TagData::TagData() { track = 0; trackTotal = 0; disc = 0; discTotal = 0; year = 0; trackGain = 0; albumGain = 0; tagsRead = TagsRead(0); length = 0; samplingRate = 0; } TagData::~TagData() { qDeleteAll( covers ); } TagEngine::TagEngine( Config *_config ) : config( _config ) { TagLib::StringList genres = TagLib::ID3v1::genreList(); for( TagLib::StringList::ConstIterator it = genres.begin(), end = genres.end(); it != end; ++it ) genreList += TStringToQString( (*it) ); genreList.sort(); } TagEngine::~TagEngine() {} TagData* TagEngine::readTags( const KUrl& fileName ) { TagLib::FileRef fileref( fileName.pathOrUrl().toLocal8Bit() ); if( !fileref.isNull() ) { TagData *tagData = new TagData(); TagLib::Tag *tag = fileref.tag(); if( tag ) { tagData->title = TStringToQString( tag->title() ); tagData->artist = TStringToQString( tag->artist() ); tagData->album = TStringToQString( tag->album() ); tagData->genre = TStringToQString( tag->genre() ); if( TagLib::Ogg::Vorbis::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::Ogg::XiphComment *tag = file->tag() ) { const QString preferredOggVorbisCommentTag = config->data.general.preferredVorbisCommentCommentTag; const QString otherOggVorbisCommentTag = ( preferredOggVorbisCommentTag == "COMMENT" ) ? "DESCRIPTION" : "COMMENT"; if( tag && tag->fieldListMap().contains(TagLib::String(preferredOggVorbisCommentTag.toUtf8().data(),TagLib::String::UTF8)) ) tagData->comment = TStringToQString( tag->fieldListMap()[TagLib::String(preferredOggVorbisCommentTag.toUtf8().data(), TagLib::String::UTF8)].front() ); else if( tag && tag->fieldListMap().contains(TagLib::String(otherOggVorbisCommentTag.toUtf8().data(),TagLib::String::UTF8)) ) tagData->comment = TStringToQString( tag->fieldListMap()[TagLib::String(otherOggVorbisCommentTag.toUtf8().data(), TagLib::String::UTF8)].front() ); } } else if( TagLib::FLAC::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::Ogg::XiphComment *tag = file->xiphComment() ) { const QString preferredOggVorbisCommentTag = config->data.general.preferredVorbisCommentCommentTag; const QString otherOggVorbisCommentTag = ( preferredOggVorbisCommentTag == "COMMENT" ) ? "DESCRIPTION" : "COMMENT"; if( tag && tag->fieldListMap().contains(TagLib::String(preferredOggVorbisCommentTag.toUtf8().data(),TagLib::String::UTF8)) ) tagData->comment = TStringToQString( tag->fieldListMap()[TagLib::String(preferredOggVorbisCommentTag.toUtf8().data(), TagLib::String::UTF8)].front() ); else if( tag && tag->fieldListMap().contains(TagLib::String(otherOggVorbisCommentTag.toUtf8().data(),TagLib::String::UTF8)) ) tagData->comment = TStringToQString( tag->fieldListMap()[TagLib::String(otherOggVorbisCommentTag.toUtf8().data(), TagLib::String::UTF8)].front() ); } } else { tagData->comment = TStringToQString( tag->comment() ); } tagData->track = tag->track(); tagData->year = tag->year(); } TagLib::AudioProperties *audioProperties = fileref.audioProperties(); if( audioProperties ) { tagData->length = audioProperties->length(); tagData->samplingRate = audioProperties->sampleRate(); } Meta::ReplayGainTagMap replayGainTags = Meta::readReplayGainTags( fileref ); if( replayGainTags.contains(Meta::ReplayGain_Track_Gain) ) { tagData->trackGain = replayGainTags[ Meta::ReplayGain_Track_Gain ]; tagData->tagsRead = TagData::TagsRead(tagData->tagsRead | TagData::TrackGain); } if( replayGainTags.contains(Meta::ReplayGain_Album_Gain) ) { tagData->albumGain = replayGainTags[ Meta::ReplayGain_Album_Gain ]; tagData->tagsRead = TagData::TagsRead(tagData->tagsRead | TagData::AlbumGain); } QString track; QString disc; if( TagLib::MPEG::File *file = dynamic_cast(fileref.file()) ) { // TCMP : Compilation (true,1 vs. false,0) // POPM : rating, playcount // TXXX : TagLib::ID3v2::UserTextIdentificationFrame // APIC : TagLib::ID3v2::AttachedPictureFrame // UFID : TagLib::ID3v2::UniqueFileIdentifierFrame if( TagLib::ID3v2::Tag *tag = file->ID3v2Tag() ) { if( !tag->frameListMap()["TPE2"].isEmpty() ) tagData->albumArtist = TStringToQString( tag->frameListMap()["TPE2"].front()->toString() ); if( !tag->frameListMap()["TCOM"].isEmpty() ) tagData->composer = TStringToQString( tag->frameListMap()["TCOM"].front()->toString() ); if( !tag->frameListMap()["TRCK"].isEmpty() ) track = TStringToQString( tag->frameListMap()["TRCK"].front()->toString() ); if( !tag->frameListMap()["TPOS"].isEmpty() ) disc = TStringToQString( tag->frameListMap()["TPOS"].front()->toString() ); TagLib::ID3v2::FrameList ufid = tag->frameListMap()["UFID"]; if( !ufid.isEmpty() ) { for( TagLib::ID3v2::FrameList::Iterator it = ufid.begin(); it != ufid.end(); it++ ) { TagLib::ID3v2::UniqueFileIdentifierFrame *frame = dynamic_cast(*it); if( frame && frame->owner() == "http://musicbrainz.org" ) { const TagLib::ByteVector id = frame->identifier(); tagData->musicBrainzTrackId = QString::fromAscii( id.data(), id.size() ); } } } // Not tested - what about MusicBrainz Album Ids? // if( tagData->musicBrainzTrackId.isEmpty() ) // { // // foobar2k // TagLib::ID3v2::UserTextIdentificationFrame *frame = TagLib::ID3v2::UserTextIdentificationFrame::find( tag, "MUSICBRAINZ_TRACKID" ); // if( frame ) // { // const TagLib::StringList texts = frame->fieldList(); // if( texts.size() > 1) // { // tagData->musicBrainzTrackId = TStringToQString( texts[1] ); // } // } // } TagLib::ID3v2::UserTextIdentificationFrame *frame = TagLib::ID3v2::UserTextIdentificationFrame::find( tag, "MusicBrainz Album Id" ); if( frame ) { const TagLib::StringList texts = frame->fieldList(); if( texts.size() > 1) { tagData->musicBrainzReleaseId = TStringToQString( texts[1] ); } } } } else if( TagLib::Ogg::Vorbis::File *file = dynamic_cast(fileref.file()) ) { // COMPILATION (1 vs. 0) if( TagLib::Ogg::XiphComment *tag = file->tag() ) { if( !tag->fieldListMap()["ALBUMARTIST"].isEmpty() ) tagData->albumArtist = TStringToQString( tag->fieldListMap()["ALBUMARTIST"].front() ); if( !tag->fieldListMap()["COMPOSER"].isEmpty() ) tagData->composer = TStringToQString( tag->fieldListMap()["COMPOSER"].front() ); if( !tag->fieldListMap()["TRACKTOTAL"].isEmpty() ) // used by EasyTag tagData->trackTotal = TStringToQString( tag->fieldListMap()["TRACKTOTAL"].front() ).toInt(); else if( !tag->fieldListMap()["TOTALTRACKS"].isEmpty() ) tagData->trackTotal = TStringToQString( tag->fieldListMap()["TOTALTRACKS"].front() ).toInt(); else if( !tag->fieldListMap()["TRACKNUMBER"].isEmpty() ) track = TStringToQString( tag->fieldListMap()["TRACKNUMBER"].front() ); if( !tag->fieldListMap()["DISCNUMBER"].isEmpty() ) // used by Kid3, EasyTag disc = TStringToQString( tag->fieldListMap()["DISCNUMBER"].front() ); if( !tag->fieldListMap()["DISCTOTAL"].isEmpty() ) tagData->discTotal = TStringToQString( tag->fieldListMap()["DISCTOTAL"].front() ).toInt(); else if( !tag->fieldListMap()["TOTALDISCS"].isEmpty() ) tagData->discTotal = TStringToQString( tag->fieldListMap()["TOTALDISCS"].front() ).toInt(); if( !tag->fieldListMap()["MUSICBRAINZ_TRACKID"].isEmpty() ) tagData->musicBrainzTrackId = TStringToQString( tag->fieldListMap()["MUSICBRAINZ_TRACKID"].front() ); if( !tag->fieldListMap()["MUSICBRAINZ_ALBUMID"].isEmpty() ) tagData->musicBrainzReleaseId = TStringToQString( tag->fieldListMap()["MUSICBRAINZ_ALBUMID"].front() ); } } else if( TagLib::FLAC::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::Ogg::XiphComment *tag = file->xiphComment() ) { if( !tag->fieldListMap()["ALBUMARTIST"].isEmpty() ) tagData->albumArtist = TStringToQString( tag->fieldListMap()["ALBUMARTIST"].front() ); if( !tag->fieldListMap()["COMPOSER"].isEmpty() ) tagData->composer = TStringToQString( tag->fieldListMap()["COMPOSER"].front() ); if( !tag->fieldListMap()["TRACKTOTAL"].isEmpty() ) // used by EasyTag tagData->trackTotal = TStringToQString( tag->fieldListMap()["TRACKTOTAL"].front() ).toInt(); else if( !tag->fieldListMap()["TOTALTRACKS"].isEmpty() ) tagData->trackTotal = TStringToQString( tag->fieldListMap()["TOTALTRACKS"].front() ).toInt(); else if( !tag->fieldListMap()["TRACKNUMBER"].isEmpty() ) // used by Kid3 track = TStringToQString( tag->fieldListMap()["TRACKNUMBER"].front() ); if( !tag->fieldListMap()["DISCNUMBER"].isEmpty() ) // used by Kid3, EasyTag disc = TStringToQString( tag->fieldListMap()["DISCNUMBER"].front() ); if( !tag->fieldListMap()["DISCTOTAL"].isEmpty() ) tagData->discTotal = TStringToQString( tag->fieldListMap()["DISCTOTAL"].front() ).toInt(); else if( !tag->fieldListMap()["TOTALDISCS"].isEmpty() ) tagData->discTotal = TStringToQString( tag->fieldListMap()["TOTALDISCS"].front() ).toInt(); if( !tag->fieldListMap()["MUSICBRAINZ_TRACKID"].isEmpty() ) tagData->musicBrainzTrackId = TStringToQString( tag->fieldListMap()["MUSICBRAINZ_TRACKID"].front() ); if( !tag->fieldListMap()["MUSICBRAINZ_ALBUMID"].isEmpty() ) tagData->musicBrainzReleaseId = TStringToQString( tag->fieldListMap()["MUSICBRAINZ_ALBUMID"].front() ); } } #ifdef TAGLIB_HAS_OPUS else if( TagLib::Ogg::Opus::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::Ogg::XiphComment *tag = file->tag() ) { if( !tag->fieldListMap()["ALBUMARTIST"].isEmpty() ) tagData->albumArtist = TStringToQString( tag->fieldListMap()["ALBUMARTIST"].front() ); if( !tag->fieldListMap()["COMPOSER"].isEmpty() ) tagData->composer = TStringToQString( tag->fieldListMap()["COMPOSER"].front() ); if( !tag->fieldListMap()["TRACKTOTAL"].isEmpty() ) // used by EasyTag tagData->trackTotal = TStringToQString( tag->fieldListMap()["TRACKTOTAL"].front() ).toInt(); else if( !tag->fieldListMap()["TOTALTRACKS"].isEmpty() ) tagData->trackTotal = TStringToQString( tag->fieldListMap()["TOTALTRACKS"].front() ).toInt(); else if( !tag->fieldListMap()["TRACKNUMBER"].isEmpty() ) // used by Kid3 track = TStringToQString( tag->fieldListMap()["TRACKNUMBER"].front() ); if( !tag->fieldListMap()["DISCNUMBER"].isEmpty() ) // used by Kid3, EasyTag disc = TStringToQString( tag->fieldListMap()["DISCNUMBER"].front() ); if( !tag->fieldListMap()["DISCTOTAL"].isEmpty() ) tagData->discTotal = TStringToQString( tag->fieldListMap()["DISCTOTAL"].front() ).toInt(); else if( !tag->fieldListMap()["TOTALDISCS"].isEmpty() ) tagData->discTotal = TStringToQString( tag->fieldListMap()["TOTALDISCS"].front() ).toInt(); if( !tag->fieldListMap()["MUSICBRAINZ_TRACKID"].isEmpty() ) tagData->musicBrainzTrackId = TStringToQString( tag->fieldListMap()["MUSICBRAINZ_TRACKID"].front() ); if( !tag->fieldListMap()["MUSICBRAINZ_ALBUMID"].isEmpty() ) tagData->musicBrainzReleaseId = TStringToQString( tag->fieldListMap()["MUSICBRAINZ_ALBUMID"].front() ); } } #endif // TAGLIB_HAS_OPUS else if( TagLib::MP4::File *file = dynamic_cast(fileref.file()) ) { // cpil : Compilation (true vs. false) if( TagLib::MP4::Tag *tag = file->tag() ) { TagLib::MP4::ItemListMap map = tag->itemListMap(); for( TagLib::MP4::ItemListMap::ConstIterator it = map.begin(); it != map.end(); ++it ) { if( it->first == "aART" ) { tagData->albumArtist = TStringToQString( it->second.toStringList().front() ); } else if( it->first == "\xA9wrt" ) { tagData->composer = TStringToQString( it->second.toStringList().front() ); } else if( it->first == "trkn" ) { tagData->trackTotal = it->second.toIntPair().second; } else if( it->first == "disk" ) { tagData->disc = it->second.toIntPair().first; tagData->discTotal = it->second.toIntPair().second; } // else if( it->first == "\xA9lyr" ) // { // tagData->comment = TStringToQString( it->second.toStringList().front() ); // } else if( it->first == "----:com.apple.iTunes:MusicBrainz Track Id" ) { tagData->musicBrainzTrackId = TStringToQString( it->second.toStringList().front() ); } else if( it->first == "----:com.apple.iTunes:MusicBrainz Album Id" ) { tagData->musicBrainzReleaseId = TStringToQString( it->second.toStringList().front() ); } } } } else if( TagLib::ASF::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::ASF::Tag *tag = file->tag() ) { TagLib::ASF::AttributeListMap map = tag->attributeListMap(); for( TagLib::ASF::AttributeListMap::ConstIterator it = map.begin(); it != map.end(); ++it ) { if( !it->second.size() ) continue; if( it->first == "WM/AlbumArtist" ) { tagData->albumArtist = TStringToQString( it->second.front().toString() ); } else if( it->first == "WM/Composer" ) { tagData->composer = TStringToQString( it->second.front().toString() ); } else if( it->first == "WM/TrackNumber" ) { track = TStringToQString( it->second.front().toString() ); } else if( it->first == "WM/PartOfSet" ) { disc = TStringToQString( it->second.front().toString() ); } else if( it->first == "MusicBrainz/Track Id" ) { tagData->musicBrainzTrackId = TStringToQString( it->second.front().toString() ); } else if( it->first == "MusicBrainz/Album Id" ) { tagData->musicBrainzReleaseId = TStringToQString( it->second.front().toString() ); } } } } /*else if( TagLib::MPC::File *file = dynamic_cast( fileref.file() ) ) { if( file->APETag() ) { if( !file->APETag()->itemListMap()[ "REPLAYGAIN_TRACK_GAIN" ].isEmpty() ) trackGain = TStringToQString( file->APETag()->itemListMap()["REPLAYGAIN_TRACK_GAIN"].toString() ); if( !file->APETag()->itemListMap()[ "REPLAYGAIN_ALBUM_GAIN" ].isEmpty() ) albumGain = TStringToQString( file->APETag()->itemListMap()["REPLAYGAIN_ALBUM_GAIN"].toString() ); } }*/ /* else if( TagLib::WavPack::File *file = dynamic_cast( fileref.file() ) ) { if( file->APETag() ) { if( !file->APETag()->itemListMap()[ "REPLAYGAIN_TRACK_GAIN" ].isEmpty() ) trackGain = TStringToQString( file->APETag()->itemListMap()["REPLAYGAIN_TRACK_GAIN"].toString() ); if( !file->APETag()->itemListMap()[ "REPLAYGAIN_ALBUM_GAIN" ].isEmpty() ) albumGain = TStringToQString( file->APETag()->itemListMap()["REPLAYGAIN_ALBUM_GAIN"].toString() ); } }*/ /*else if( TagLib::TTA::File *file = dynamic_cast( fileref.file() ) ) // NOTE writing works, but reading not { if( file->ID3v2Tag() ) { if( !file->ID3v2Tag()->frameListMap()[ "TPOS" ].isEmpty() ) disc = TStringToQString( file->ID3v2Tag()->frameListMap()["TPOS"].front()->toString() ); if( !file->ID3v2Tag()->frameListMap()[ "TCOM" ].isEmpty() ) tagData->composer = TStringToQString( file->ID3v2Tag()->frameListMap()["TCOM"].front()->toString() ); } }*/ if( !track.isEmpty() ) { const int i = track.indexOf('/'); if( i != -1 ) { tagData->trackTotal = track.right( track.count() - i - 1 ).toInt(); } } if( !disc.isEmpty() ) { const int i = disc.indexOf('/'); if( i != -1 ) { tagData->disc = disc.left( i ).toInt(); tagData->discTotal = disc.right( disc.count() - i - 1 ).toInt(); } else { tagData->disc = disc.toInt(); } } return tagData; } return 0; } bool TagEngine::writeTags( const KUrl& fileName, TagData *tagData ) { if( !tagData ) return false; TagLib::FileRef fileref( fileName.pathOrUrl().toLocal8Bit(), false ); //Set default codec to UTF-8 (see bugs 111246 and 111232) TagLib::ID3v2::FrameFactory::instance()->setDefaultTextEncoding( TagLib::String::UTF8 ); if( !fileref.isNull() ) { if( TagLib::Tag *tag = fileref.tag() ) { tag->setTitle( TagLib::String(tagData->title.toUtf8().data(), TagLib::String::UTF8) ); tag->setArtist( TagLib::String(tagData->artist.toUtf8().data(), TagLib::String::UTF8) ); tag->setAlbum( TagLib::String(tagData->album.toUtf8().data(), TagLib::String::UTF8) ); tag->setTrack( tagData->track ); tag->setYear( tagData->year ); if( TagLib::Ogg::Vorbis::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::Ogg::XiphComment *tag = file->tag() ) { if( !tagData->comment.isEmpty() ) tag->addField( TagLib::String(config->data.general.preferredVorbisCommentCommentTag.toUtf8().data(), TagLib::String::UTF8), TagLib::String(tagData->comment.toUtf8().data(), TagLib::String::UTF8), true ); } } else if( TagLib::FLAC::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::Ogg::XiphComment *tag = file->xiphComment() ) { if( !tagData->comment.isEmpty() ) tag->addField( TagLib::String(config->data.general.preferredVorbisCommentCommentTag.toUtf8().data(), TagLib::String::UTF8), TagLib::String(tagData->comment.toUtf8().data(), TagLib::String::UTF8), true ); } } else { tag->setComment( TagLib::String(tagData->comment.toUtf8().data(), TagLib::String::UTF8) ); } tag->setGenre( TagLib::String(tagData->genre.toUtf8().data(), TagLib::String::UTF8) ); } else { return false; } QString track; if( tagData->trackTotal > 0 ) { track = QString::number(tagData->track) + "/" + QString::number(tagData->trackTotal); } QString disc; if( tagData->disc > 0 ) { disc = QString::number(tagData->disc); if( tagData->discTotal > 0 ) { disc += "/" + QString::number(tagData->discTotal); } } if( TagLib::MPEG::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::ID3v2::Tag *tag = file->ID3v2Tag() ) { if( !tagData->albumArtist.isEmpty() ) { if( !tag->frameListMap()["TPE2"].isEmpty() ) { tag->frameListMap()["TPE2"].front()->setText( TagLib::String(tagData->albumArtist.toUtf8().data(), TagLib::String::UTF8) ); } else { TagLib::ID3v2::TextIdentificationFrame *frame = new TagLib::ID3v2::TextIdentificationFrame( "TPE2", TagLib::ID3v2::FrameFactory::instance()->defaultTextEncoding() ); frame->setText( TagLib::String(tagData->albumArtist.toUtf8().data(), TagLib::String::UTF8) ); tag->addFrame( frame ); } } if( !tagData->composer.isEmpty() ) { if( !tag->frameListMap()["TCOM"].isEmpty() ) { tag->frameListMap()["TCOM"].front()->setText( TagLib::String(tagData->composer.toUtf8().data(), TagLib::String::UTF8) ); } else { TagLib::ID3v2::TextIdentificationFrame *frame = new TagLib::ID3v2::TextIdentificationFrame( "TCOM", TagLib::ID3v2::FrameFactory::instance()->defaultTextEncoding() ); frame->setText( TagLib::String(tagData->composer.toUtf8().data(), TagLib::String::UTF8) ); tag->addFrame( frame ); } } if( !track.isEmpty() ) { if( !tag->frameListMap()["TRCK"].isEmpty() ) { tag->frameListMap()["TRCK"].front()->setText( TagLib::String(track.toUtf8().data(), TagLib::String::UTF8) ); } else { TagLib::ID3v2::TextIdentificationFrame *frame = new TagLib::ID3v2::TextIdentificationFrame( "TRCK", TagLib::ID3v2::FrameFactory::instance()->defaultTextEncoding() ); frame->setText( TagLib::String(track.toUtf8().data(), TagLib::String::UTF8) ); tag->addFrame( frame ); } } if( !disc.isEmpty() ) { if( !tag->frameListMap()["TPOS"].isEmpty() ) { tag->frameListMap()["TPOS"].front()->setText( TagLib::String(disc.toUtf8().data(), TagLib::String::UTF8) ); } else { TagLib::ID3v2::TextIdentificationFrame *frame = new TagLib::ID3v2::TextIdentificationFrame( "TPOS", TagLib::ID3v2::FrameFactory::instance()->defaultTextEncoding() ); frame->setText( TagLib::String(disc.toUtf8().data(), TagLib::String::UTF8) ); tag->addFrame( frame ); } } if( !tagData->musicBrainzTrackId.isEmpty() ) { TagLib::ID3v2::UniqueFileIdentifierFrame *frame = new TagLib::ID3v2::UniqueFileIdentifierFrame( "http://musicbrainz.org", TagLib::ByteVector(tagData->musicBrainzTrackId.toUtf8().data(), TagLib::String::UTF8) ); tag->addFrame( frame ); } if( !tagData->musicBrainzReleaseId.isEmpty() ) { TagLib::ID3v2::UserTextIdentificationFrame *frame = new TagLib::ID3v2::UserTextIdentificationFrame( TagLib::ID3v2::FrameFactory::instance()->defaultTextEncoding() ); frame->setDescription( "MusicBrainz Album Id" ); frame->setText( TagLib::String(tagData->musicBrainzReleaseId.toUtf8().data(), TagLib::String::UTF8) ); tag->addFrame( frame ); } // // HACK sets the id3v2 genre tag as string // if( !tagData->genre.isEmpty() ) // { // if( !tag->frameListMap()["TCON"].isEmpty() ) // { // tag->frameListMap()["TCON"].front()->setText( TagLib::String(tagData->genre.toUtf8().data(), TagLib::String::UTF8) ); // } // else // { // TagLib::ID3v2::TextIdentificationFrame *frame = new TagLib::ID3v2::TextIdentificationFrame( "TCON", TagLib::ID3v2::FrameFactory::instance()->defaultTextEncoding() ); // frame->setText( TagLib::String(tagData->genre.toUtf8().data(), TagLib::String::UTF8) ); // tag->addFrame( frame ); // } // } // // HACK sets the id3 <= v2.3.0 year tag // if( tagData->year > 0 ) // { // if( !tag->frameListMap()["TYER"].isEmpty() ) // { // tag->frameListMap()["TYER"].front()->setText( TagLib::String(QString::number(tagData->year).toUtf8().data(), TagLib::String::UTF8) ); // } // else // { // TagLib::ID3v2::TextIdentificationFrame *frame = new TagLib::ID3v2::TextIdentificationFrame( "TYER", TagLib::ID3v2::FrameFactory::instance()->defaultTextEncoding() ); // frame->setText( TagLib::String(QString::number(tagData->year).toUtf8().data(), TagLib::String::UTF8) ); // tag->addFrame( frame ); // } // } } } else if( TagLib::Ogg::Vorbis::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::Ogg::XiphComment *tag = file->tag() ) { if( !tagData->albumArtist.isEmpty() ) { if( tag->contains("ALBUMARTIST") ) tag->removeField("ALBUMARTIST"); tag->addField( "ALBUMARTIST", TagLib::String(tagData->albumArtist.toUtf8().data(), TagLib::String::UTF8), true ); } if( !tagData->composer.isEmpty() ) { if( tag->contains("COMPOSER") ) tag->removeField("COMPOSER"); tag->addField( "COMPOSER", TagLib::String(tagData->composer.toUtf8().data(), TagLib::String::UTF8), true ); } if( tagData->trackTotal > 0 ) { if( config->data.general.preferredVorbisCommentTrackTotalTag == "TRACKNUMBER" ) { if( tag->contains("TRACKNUMBER") ) tag->removeField("TRACKNUMBER"); tag->addField( "TRACKNUMBER", TagLib::String(track.toUtf8().data(), TagLib::String::UTF8), true ); } else { tag->addField( TagLib::String(config->data.general.preferredVorbisCommentTrackTotalTag.toUtf8().data(), TagLib::String::UTF8), TagLib::String(QString::number(tagData->trackTotal).toUtf8().data(), TagLib::String::UTF8), true ); } } if( tagData->disc > 0 ) { if( tag->contains("DISCNUMBER") ) tag->removeField("DISCNUMBER"); tag->addField( "DISCNUMBER", TagLib::String(QString::number(tagData->disc).toUtf8().data(), TagLib::String::UTF8), true ); } if( tagData->discTotal > 0 ) { if( config->data.general.preferredVorbisCommentDiscTotalTag == "DISCNUMBER" ) { if( tag->contains("DISCNUMBER") ) tag->removeField("DISCNUMBER"); tag->addField( "DISCNUMBER", TagLib::String(disc.toUtf8().data(), TagLib::String::UTF8), true ); } else { tag->addField( TagLib::String(config->data.general.preferredVorbisCommentDiscTotalTag.toUtf8().data(), TagLib::String::UTF8), TagLib::String(QString::number(tagData->discTotal).toUtf8().data(), TagLib::String::UTF8), true ); } } if( !tagData->musicBrainzTrackId.isEmpty() ) { if( tag->contains("MUSICBRAINZ_TRACKID") ) tag->removeField("MUSICBRAINZ_TRACKID"); tag->addField( "MUSICBRAINZ_TRACKID", TagLib::String(tagData->musicBrainzTrackId.toUtf8().data(), TagLib::String::UTF8), true ); } if( !tagData->musicBrainzReleaseId.isEmpty() ) { if( tag->contains("MUSICBRAINZ_ALBUMID") ) tag->removeField("MUSICBRAINZ_ALBUMID"); tag->addField( "MUSICBRAINZ_ALBUMID", TagLib::String(tagData->musicBrainzReleaseId.toUtf8().data(), TagLib::String::UTF8), true ); } } } else if( TagLib::FLAC::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::Ogg::XiphComment *tag = file->xiphComment() ) { if( !tagData->albumArtist.isEmpty() ) { if( tag->contains("ALBUMARTIST") ) tag->removeField("ALBUMARTIST"); tag->addField( "ALBUMARTIST", TagLib::String(tagData->albumArtist.toUtf8().data(), TagLib::String::UTF8), true ); } if( !tagData->composer.isEmpty() ) { if( tag->contains("COMPOSER") ) tag->removeField("COMPOSER"); tag->addField( "COMPOSER", TagLib::String(tagData->composer.toUtf8().data(), TagLib::String::UTF8), true ); } if( tagData->trackTotal > 0 ) { if( config->data.general.preferredVorbisCommentTrackTotalTag == "TRACKNUMBER" ) { if( tag->contains("TRACKNUMBER") ) tag->removeField("TRACKNUMBER"); tag->addField( "TRACKNUMBER", TagLib::String(track.toUtf8().data(), TagLib::String::UTF8), true ); } else { tag->addField( TagLib::String(config->data.general.preferredVorbisCommentTrackTotalTag.toUtf8().data(), TagLib::String::UTF8), TagLib::String(QString::number(tagData->trackTotal).toUtf8().data(), TagLib::String::UTF8), true ); } } if( tagData->disc > 0 ) { if( tag->contains("DISCNUMBER") ) tag->removeField("DISCNUMBER"); tag->addField( "DISCNUMBER", TagLib::String(QString::number(tagData->disc).toUtf8().data(), TagLib::String::UTF8), true ); } if( tagData->discTotal > 0 ) { if( config->data.general.preferredVorbisCommentDiscTotalTag == "DISCNUMBER" ) { if( tag->contains("DISCNUMBER") ) tag->removeField("DISCNUMBER"); tag->addField( "DISCNUMBER", TagLib::String(disc.toUtf8().data(), TagLib::String::UTF8), true ); } else { tag->addField( TagLib::String(config->data.general.preferredVorbisCommentDiscTotalTag.toUtf8().data(), TagLib::String::UTF8), TagLib::String(QString::number(tagData->discTotal).toUtf8().data(), TagLib::String::UTF8), true ); } } if( !tagData->musicBrainzTrackId.isEmpty() ) { if( tag->contains("MUSICBRAINZ_TRACKID") ) tag->removeField("MUSICBRAINZ_TRACKID"); tag->addField( "MUSICBRAINZ_TRACKID", TagLib::String(tagData->musicBrainzTrackId.toUtf8().data(), TagLib::String::UTF8), true ); } if( !tagData->musicBrainzReleaseId.isEmpty() ) { if( tag->contains("MUSICBRAINZ_ALBUMID") ) tag->removeField("MUSICBRAINZ_ALBUMID"); tag->addField( "MUSICBRAINZ_ALBUMID", TagLib::String(tagData->musicBrainzReleaseId.toUtf8().data(), TagLib::String::UTF8), true ); } } } #ifdef TAGLIB_HAS_OPUS else if( TagLib::Ogg::Opus::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::Ogg::XiphComment *tag = file->tag() ) { if( !tagData->albumArtist.isEmpty() ) { if( tag->contains("ALBUMARTIST") ) tag->removeField("ALBUMARTIST"); tag->addField( "ALBUMARTIST", TagLib::String(tagData->albumArtist.toUtf8().data(), TagLib::String::UTF8), true ); } if( !tagData->composer.isEmpty() ) { if( tag->contains("COMPOSER") ) tag->removeField("COMPOSER"); tag->addField( "COMPOSER", TagLib::String(tagData->composer.toUtf8().data(), TagLib::String::UTF8), true ); } if( tagData->trackTotal > 0 ) { if( config->data.general.preferredVorbisCommentTrackTotalTag == "TRACKNUMBER" ) { if( tag->contains("TRACKNUMBER") ) tag->removeField("TRACKNUMBER"); tag->addField( "TRACKNUMBER", TagLib::String(track.toUtf8().data(), TagLib::String::UTF8), true ); } else { tag->addField( TagLib::String(config->data.general.preferredVorbisCommentTrackTotalTag.toUtf8().data(), TagLib::String::UTF8), TagLib::String(QString::number(tagData->trackTotal).toUtf8().data(), TagLib::String::UTF8), true ); } } if( tagData->disc > 0 ) { if( tag->contains("DISCNUMBER") ) tag->removeField("DISCNUMBER"); tag->addField( "DISCNUMBER", TagLib::String(QString::number(tagData->disc).toUtf8().data(), TagLib::String::UTF8), true ); } if( tagData->discTotal > 0 ) { if( config->data.general.preferredVorbisCommentDiscTotalTag == "DISCNUMBER" ) { if( tag->contains("DISCNUMBER") ) tag->removeField("DISCNUMBER"); tag->addField( "DISCNUMBER", TagLib::String(disc.toUtf8().data(), TagLib::String::UTF8), true ); } else { tag->addField( TagLib::String(config->data.general.preferredVorbisCommentDiscTotalTag.toUtf8().data(), TagLib::String::UTF8), TagLib::String(QString::number(tagData->discTotal).toUtf8().data(), TagLib::String::UTF8), true ); } } if( !tagData->musicBrainzTrackId.isEmpty() ) { if( tag->contains("MUSICBRAINZ_TRACKID") ) tag->removeField("MUSICBRAINZ_TRACKID"); tag->addField( "MUSICBRAINZ_TRACKID", TagLib::String(tagData->musicBrainzTrackId.toUtf8().data(), TagLib::String::UTF8), true ); } if( !tagData->musicBrainzReleaseId.isEmpty() ) { if( tag->contains("MUSICBRAINZ_ALBUMID") ) tag->removeField("MUSICBRAINZ_ALBUMID"); tag->addField( "MUSICBRAINZ_ALBUMID", TagLib::String(tagData->musicBrainzReleaseId.toUtf8().data(), TagLib::String::UTF8), true ); } } } #endif // TAGLIB_HAS_OPUS else if( TagLib::MP4::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::MP4::Tag *tag = file->tag() ) { if( !tagData->albumArtist.isEmpty() ) tag->itemListMap()["aART"] = TagLib::StringList(TagLib::String(tagData->albumArtist.toUtf8().data(), TagLib::String::UTF8)); if( !tagData->composer.isEmpty() ) tag->itemListMap()["\xA9wrt"] = TagLib::StringList(TagLib::String(tagData->composer.toUtf8().data(), TagLib::String::UTF8)); if( tagData->trackTotal > 0 ) tag->itemListMap()["trkn"] = TagLib::MP4::Item( tagData->track, tagData->trackTotal ); if( tagData->disc > 0 ) { if( tagData->discTotal > 0 ) tag->itemListMap()["disk"] = TagLib::MP4::Item( tagData->disc, tagData->discTotal ); else tag->itemListMap()["disk"] = TagLib::MP4::Item( tagData->disc ); } if( !tagData->musicBrainzTrackId.isEmpty() ) tag->itemListMap()["----:com.apple.iTunes:MusicBrainz Track Id"] = TagLib::StringList(TagLib::String(tagData->musicBrainzTrackId.toUtf8().data(), TagLib::String::UTF8)); if( !tagData->musicBrainzReleaseId.isEmpty() ) tag->itemListMap()["----:com.apple.iTunes:MusicBrainz Album Id"] = TagLib::StringList(TagLib::String(tagData->musicBrainzReleaseId.toUtf8().data(), TagLib::String::UTF8)); } } else if( TagLib::ASF::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::ASF::Tag *tag = file->tag() ) { if( !tagData->albumArtist.isEmpty() ) { if( !tag->attributeListMap()["WM/AlbumArtist"].isEmpty() ) tag->attributeListMap()["WM/AlbumArtist"].clear(); tag->addAttribute( TagLib::String("WM/AlbumArtist"), TagLib::String(tagData->albumArtist.toUtf8().data(), TagLib::String::UTF8) ); } if( !tagData->composer.isEmpty() ) { if( !tag->attributeListMap()["WM/Composer"].isEmpty() ) tag->attributeListMap()["WM/Composer"].clear(); tag->addAttribute( TagLib::String("WM/Composer"), TagLib::String(tagData->composer.toUtf8().data(), TagLib::String::UTF8) ); } if( !track.isEmpty() ) { if( !tag->attributeListMap()["WM/TrackNumber"].isEmpty() ) tag->attributeListMap()["WM/TrackNumber"].clear(); tag->addAttribute( TagLib::String("WM/TrackNumber"), TagLib::String(track.toUtf8().data(), TagLib::String::UTF8) ); } if( !disc.isEmpty() ) { if( !tag->attributeListMap()["WM/PartOfSet"].isEmpty() ) tag->attributeListMap()["WM/PartOfSet"].clear(); tag->addAttribute( TagLib::String("WM/PartOfSet"), TagLib::String(disc.toUtf8().data(), TagLib::String::UTF8) ); } if( !tagData->musicBrainzTrackId.isEmpty() ) { if( !tag->attributeListMap()["MusicBrainz/Track Id"].isEmpty() ) tag->attributeListMap()["MusicBrainz/Track Id"].clear(); tag->addAttribute( TagLib::String("MusicBrainz/Track Id"), TagLib::String(tagData->musicBrainzTrackId.toUtf8().data(), TagLib::String::UTF8) ); } if( !tagData->musicBrainzReleaseId.isEmpty() ) { if( !tag->attributeListMap()["MusicBrainz/Album Id"].isEmpty() ) tag->attributeListMap()["MusicBrainz/Album Id"].clear(); tag->addAttribute( TagLib::String("MusicBrainz/Album Id"), TagLib::String(tagData->musicBrainzReleaseId.toUtf8().data(), TagLib::String::UTF8) ); } } } /*if( TagLib::TTA::File *file = dynamic_cast( fileref.file() ) ) // NOTE writing works, but reading not { if( file->ID3v2Tag() ) { if( !file->ID3v2Tag()->frameListMap()[ "TPOS" ].isEmpty() ) { file->ID3v2Tag()->frameListMap()[ "TPOS" ].front()->setText( QStringToTString( QString::number(tagData->disc) ) ); } else { TagLib::ID3v2::TextIdentificationFrame *frame = new TagLib::ID3v2::TextIdentificationFrame( "TPOS", TagLib::ID3v2::FrameFactory::instance()->defaultTextEncoding() ); frame->setText( QStringToTString( QString::number(tagData->disc) ) ); file->ID3v2Tag()->addFrame( frame ); } if( !file->ID3v2Tag()->frameListMap()[ "TCOM" ].isEmpty() ) { file->ID3v2Tag()->frameListMap()[ "TCOM" ].front()->setText( QStringToTString( tagData->composer ) ); } else { TagLib::ID3v2::TextIdentificationFrame *frame = new TagLib::ID3v2::TextIdentificationFrame( "TCOM", TagLib::ID3v2::FrameFactory::instance()->defaultTextEncoding() ); frame->setText( QStringToTString( tagData->composer ) ); file->ID3v2Tag()->addFrame( frame ); } } }*/ return fileref.save(); } return false; } QList TagEngine::readCovers( const KUrl& fileName ) { QList covers; TagLib::FileRef fileref( fileName.pathOrUrl().toLocal8Bit() ); if( !fileref.isNull() ) { if( TagLib::MPEG::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::ID3v2::Tag *tag = file->ID3v2Tag() ) { TagLib::ID3v2::FrameList apic_frames = tag->frameListMap()["APIC"]; for( TagLib::ID3v2::FrameList::ConstIterator iter = apic_frames.begin(); iter != apic_frames.end(); ++iter ) { TagLib::ID3v2::AttachedPictureFrame *pic = dynamic_cast(*iter); const QByteArray image_data( pic->picture().data(), pic->picture().size() ); CoverData *newCover = new CoverData( image_data, TStringToQString(pic->mimeType()), CoverData::Role(pic->type()), TStringToQString(pic->description()) ); covers.append( newCover ); } } } else if( TagLib::Ogg::Vorbis::File *file = dynamic_cast(fileref.file()) ) { // http://wiki.xiph.org/VorbisComment#Recommended_field_names if( TagLib::Ogg::XiphComment *tag = file->tag() ) { #ifdef TAGLIB_HAS_FLAC_PICTURELIST const TagLib::StringList& block = tag->fieldListMap()["METADATA_BLOCK_PICTURE"]; for( TagLib::StringList::ConstIterator i = block.begin(); i != block.end(); ++i ) { const QByteArray data( QByteArray::fromBase64( i->to8Bit().c_str() ) ); TagLib::ByteVector tdata( data.data(), data.size() ); TagLib::FLAC::Picture picture; if(!picture.parse(tdata)) continue; const QByteArray image_data( picture.data().data(), picture.data().size() ); CoverData *newCover = new CoverData( image_data, TStringToQString(picture.mimeType()), CoverData::Role(picture.type()), TStringToQString(picture.description()) ); covers.append( newCover ); } #endif // TAGLIB_HAS_FLAC_PICTURELIST TagLib::Ogg::FieldListMap map = tag->fieldListMap(); // Ogg lacks a definitive standard for embedding cover art, but it seems // b64 encoding a field called COVERART is the general convention TagLib::StringList coverArtValue; TagLib::StringList mimeTypeValue; TagLib::StringList descriptionValue; for( TagLib::Ogg::FieldListMap::ConstIterator it = map.begin(); it != map.end(); ++it ) { const TagLib::String key = it->first; const TagLib::StringList value = it->second; if( key == TagLib::String("COVERART") ) { coverArtValue = value; } else if( key == TagLib::String("COVERARTMIME") ) { mimeTypeValue = value; } else if( key == TagLib::String("COVERARTDESCRIPTION") ) { descriptionValue = value; } } for( uint i=0; i i ) ? mimeTypeValue[i] : ""; const TagLib::String description = ( descriptionValue.size() > i ) ? descriptionValue[i] : ""; CoverData *newCover = new CoverData( image_data, TStringToQString(mimeType), CoverData::FrontCover, TStringToQString(description) ); covers.append( newCover ); } } } else if( TagLib::FLAC::File *file = dynamic_cast(fileref.file()) ) { #ifdef TAGLIB_HAS_FLAC_PICTURELIST const TagLib::List picturelist = file->pictureList(); for( TagLib::List::ConstIterator it = picturelist.begin(); it != picturelist.end(); it++ ) { const TagLib::FLAC::Picture *picture = *it; const QByteArray image_data( picture->data().data(), picture->data().size() ); CoverData *newCover = new CoverData( image_data, TStringToQString(picture->mimeType()), CoverData::Role(picture->type()), TStringToQString(picture->description()) ); covers.append( newCover ); } #else Q_UNUSED(file) #endif // TAGLIB_HAS_FLAC_PICTURELIST } #ifdef TAGLIB_HAS_OPUS else if( TagLib::Ogg::Opus::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::Ogg::XiphComment *tag = file->tag() ) { #ifdef TAGLIB_HAS_FLAC_PICTURELIST const TagLib::StringList& block = tag->fieldListMap()["METADATA_BLOCK_PICTURE"]; for( TagLib::StringList::ConstIterator i = block.begin(); i != block.end(); ++i ) { const QByteArray data( QByteArray::fromBase64( i->to8Bit().c_str() ) ); TagLib::ByteVector tdata( data.data(), data.size() ); TagLib::FLAC::Picture picture; if(!picture.parse(tdata)) continue; const QByteArray image_data( picture.data().data(), picture.data().size() ); CoverData *newCover = new CoverData( image_data, TStringToQString(picture.mimeType()), CoverData::Role(picture.type()), TStringToQString(picture.description()) ); covers.append( newCover ); } #endif // TAGLIB_HAS_FLAC_PICTURELIST } } #endif // TAGLIB_HAS_OPUS else if( TagLib::MP4::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::MP4::Tag *tag = file->tag() ) { TagLib::MP4::ItemListMap map = tag->itemListMap(); for( TagLib::MP4::ItemListMap::ConstIterator it = map.begin(); it != map.end(); ++it ) { if( it->first == "covr" ) { TagLib::MP4::CoverArtList coverList = it->second.toCoverArtList(); for( TagLib::MP4::CoverArtList::Iterator cover = coverList.begin(); cover != coverList.end(); ++cover ) { const QByteArray image_data( cover->data().data(), cover->data().size() ); const QString mimeType = cover->format() == TagLib::MP4::CoverArt::PNG ? "image/png" : "image/jpeg"; CoverData *newCover = new CoverData( image_data, mimeType, CoverData::FrontCover ); covers.append( newCover ); } } } } } else if( TagLib::ASF::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::ASF::Tag *tag = file->tag() ) { #ifdef TAGLIB_HAS_ASF_PICTURE TagLib::ASF::AttributeListMap map = tag->attributeListMap(); for( TagLib::ASF::AttributeListMap::ConstIterator it = map.begin(); it != map.end(); ++it ) { if( !it->second.size() ) continue; if( it->first == "WM/Picture" ) { TagLib::ASF::AttributeList coverList = it->second; for( TagLib::ASF::AttributeList::ConstIterator cover = coverList.begin(); cover != coverList.end(); ++cover ) { if( cover->type() != TagLib::ASF::Attribute::BytesType ) continue; TagLib::ASF::Picture pic = cover->toPicture(); const QByteArray image_data( pic.picture().data(), pic.picture().size() ); CoverData *newCover = new CoverData( image_data, TStringToQString(pic.mimeType()), CoverData::Role(pic.type()), TStringToQString(pic.description()) ); covers.append( newCover ); } } } #else Q_UNUSED(tag) #endif // TAGLIB_HAS_ASF_PICTURE } } } return covers; } bool TagEngine::writeCovers( const KUrl& fileName, QList covers ) { if( covers.isEmpty() ) return true; TagLib::FileRef fileref( fileName.pathOrUrl().toLocal8Bit(), false ); if( !fileref.isNull() ) { if( TagLib::MPEG::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::ID3v2::Tag *tag = file->ID3v2Tag() ) { foreach( CoverData *cover, covers ) { TagLib::ID3v2::AttachedPictureFrame *frame = new TagLib::ID3v2::AttachedPictureFrame( "APIC" ); frame->setPicture( TagLib::ByteVector( cover->data.data(), cover->data.size() ) ); frame->setType( TagLib::ID3v2::AttachedPictureFrame::Type( cover->role ) ); if( !cover->mimeType.isEmpty() ) frame->setMimeType( TagLib::ByteVector(cover->mimeType.toUtf8().data()) ); if( !cover->description.isEmpty() ) frame->setDescription( TagLib::ByteVector(cover->description.toUtf8().data()) ); tag->addFrame( frame ); } } return fileref.save(); } else if( TagLib::Ogg::Vorbis::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::Ogg::XiphComment *tag = file->tag() ) { #ifdef TAGLIB_HAS_FLAC_PICTURELIST foreach( CoverData *cover, covers ) { TagLib::FLAC::Picture newPicture; newPicture.setData( TagLib::ByteVector( cover->data.data(), cover->data.size() ) ); newPicture.setType( TagLib::FLAC::Picture::Type( cover->role ) ); if( !cover->mimeType.isEmpty() ) newPicture.setMimeType( TagLib::ByteVector(cover->mimeType.toUtf8().data()) ); if( !cover->description.isEmpty() ) newPicture.setDescription( TagLib::ByteVector(cover->description.toUtf8().data()) ); TagLib::ByteVector t_block = newPicture.render(); const QByteArray q_block = QByteArray( t_block.data(), t_block.size() ); const QByteArray q_block_b64 = q_block.toBase64(); TagLib::ByteVector t_block_b64 = TagLib::ByteVector( q_block_b64.data(), q_block_b64.size() ); tag->addField( "METADATA_BLOCK_PICTURE", t_block_b64, false ); } #else Q_UNUSED(tag) #endif // TAGLIB_HAS_FLAC_PICTURELIST } return fileref.save(); } else if( TagLib::FLAC::File *file = dynamic_cast(fileref.file()) ) { #ifdef TAGLIB_HAS_FLAC_PICTURELIST foreach( CoverData *cover, covers ) { TagLib::FLAC::Picture *newPicture = new TagLib::FLAC::Picture(); newPicture->setData( TagLib::ByteVector( cover->data.data(), cover->data.size() ) ); newPicture->setType( TagLib::FLAC::Picture::Type( cover->role ) ); if( !cover->mimeType.isEmpty() ) newPicture->setMimeType( TagLib::ByteVector(cover->mimeType.toUtf8().data()) ); if( !cover->description.isEmpty() ) newPicture->setDescription( TagLib::ByteVector(cover->description.toUtf8().data()) ); file->addPicture( newPicture ); } #else Q_UNUSED(file) #endif // TAGLIB_HAS_FLAC_PICTURELIST return fileref.save(); } #ifdef TAGLIB_HAS_OPUS else if( TagLib::Ogg::Opus::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::Ogg::XiphComment *tag = file->tag() ) { #ifdef TAGLIB_HAS_FLAC_PICTURELIST foreach( CoverData *cover, covers ) { TagLib::FLAC::Picture newPicture; newPicture.setData( TagLib::ByteVector( cover->data.data(), cover->data.size() ) ); newPicture.setType( TagLib::FLAC::Picture::Type( cover->role ) ); if( !cover->mimeType.isEmpty() ) newPicture.setMimeType( TagLib::ByteVector(cover->mimeType.toUtf8().data()) ); if( !cover->description.isEmpty() ) newPicture.setDescription( TagLib::ByteVector(cover->description.toUtf8().data()) ); TagLib::ByteVector t_block = newPicture.render(); const QByteArray q_block = QByteArray( t_block.data(), t_block.size() ); const QByteArray q_block_b64 = q_block.toBase64(); TagLib::ByteVector t_block_b64 = TagLib::ByteVector( q_block_b64.data(), q_block_b64.size() ); tag->addField( "METADATA_BLOCK_PICTURE", t_block_b64, false ); } #endif // TAGLIB_HAS_FLAC_PICTURELIST } return fileref.save(); } #endif // TAGLIB_HAS_OPUS else if( TagLib::MP4::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::MP4::Tag *tag = file->tag() ) { TagLib::MP4::CoverArtList coversList; foreach( CoverData *cover, covers ) { const TagLib::MP4::CoverArt::Format format = cover->mimeType == "image/png" ? TagLib::MP4::CoverArt::PNG : TagLib::MP4::CoverArt::JPEG; coversList.append( TagLib::MP4::CoverArt( format, TagLib::ByteVector( cover->data.data(), cover->data.size() ) ) ); } tag->itemListMap()["covr"] = TagLib::MP4::Item( coversList ); } return fileref.save(); } else if( TagLib::ASF::File *file = dynamic_cast(fileref.file()) ) { if( TagLib::ASF::Tag *tag = file->tag() ) { #ifdef TAGLIB_HAS_ASF_PICTURE foreach( CoverData *cover, covers ) { TagLib::ASF::Picture *newPicture = new TagLib::ASF::Picture(); newPicture->setPicture( TagLib::ByteVector( cover->data.data(), cover->data.size() ) ); newPicture->setType( TagLib::ASF::Picture::Type( cover->role ) ); if( !cover->mimeType.isEmpty() ) newPicture->setMimeType( TagLib::ByteVector(cover->mimeType.toUtf8().data()) ); if( !cover->description.isEmpty() ) newPicture->setDescription( TagLib::ByteVector(cover->description.toUtf8().data()) ); tag->addAttribute( TagLib::String("WM/Picture"), TagLib::ASF::Attribute( newPicture->render() ) ); } #else Q_UNUSED(tag) #endif // TAGLIB_HAS_ASF_PICTURE } return fileref.save(); } } return false; } bool TagEngine::writeCoversToDirectory( const QString& directoryName, TagData *tags ) { if( !tags ) return false; QList covers = tags->covers; if( covers.isEmpty() ) return true; QDir dir( directoryName ); if( directoryName.isEmpty() || !dir.exists() ) return false; int i = covers.count() > 1 ? 1 : 0; foreach( CoverData *cover, covers ) { QString fileName = cover->description; if( fileName.isEmpty() || config->data.coverArt.writeCoverName == 1 ) { fileName = config->data.coverArt.writeCoverDefaultName; fileName.replace( "%a", "$replace_by_artist$" ); fileName.replace( "%b", "$replace_by_album$" ); fileName.replace( "%d", "$replace_by_description$" ); fileName.replace( "%r", "$replace_by_role$" ); QString artist = tags->artist; artist.replace("/",","); fileName.replace( "$replace_by_artist$", artist ); QString album = tags->album; album.replace("/",","); fileName.replace( "$replace_by_album$", album ); QString description = cover->description; description.replace("/",","); fileName.replace( "$replace_by_description$", description ); QString role = cover->roleName( cover->role ); role.replace("/",","); fileName.replace( "$replace_by_role$", role ); if( i > 0 ) fileName += QString::number(i); } QString extension; if( cover->mimeType == "image/jpeg" ) { extension = ".jpg"; if( fileName.toLower().endsWith(".jpg") ) fileName = fileName.left( fileName.count() - 4 ); if( fileName.toLower().endsWith(".jpeg") ) fileName = fileName.left( fileName.count() - 5 ); } else if( cover->mimeType == "image/png" ) { extension = ".png"; if( fileName.toLower().endsWith(".png") ) fileName = fileName.left( fileName.count() - 4 ); } QFile file( directoryName + "/" + fileName + extension ); if( !file.exists() ) { file.open( QIODevice::WriteOnly ); file.write( cover->data.data(), cover->data.size() ); file.close(); } i++; } return false; } ./soundkonverter-2.1.2/metadata/PaxHeaders.4329/MetaReplayGain.h0000644000000000000000000000006211507653544021226 xustar0020 atime=1308764509 30 ctime=1418040695.170717213 ./soundkonverter-2.1.2/metadata/MetaReplayGain.h0000644000175000001440000000422011507653544022217 0ustar00danielusers00000000000000/**************************************************************************************** * Copyright (c) 2009 Alex Merry * * Modyfied by Daniel Faust * * * * 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, see . * ****************************************************************************************/ #ifndef AMAROK_METAREPLAYGAIN_H #define AMAROK_METAREPLAYGAIN_H #include // Taglib #include /* This file exists (rather than putting the method in MetaUtility.h and * MetaUtility.cpp) because we need to share the implementation between * amaroklib and amarokcollectionscanner (which doesn't link to amaroklib). */ namespace Meta { enum ReplayGainTag { ReplayGain_Track_Gain, ReplayGain_Track_Peak, ReplayGain_Album_Gain, ReplayGain_Album_Peak }; typedef QMap ReplayGainTagMap; /** * Reads the replay gain tags from a taglib file. */ ReplayGainTagMap readReplayGainTags( TagLib::FileRef fileref ); } #endif // AMAROK_METAREPLAYGAIN_H ./soundkonverter-2.1.2/metadata/PaxHeaders.4329/tagengine.h0000644000000000000000000000013212441312442020306 xustar0030 mtime=1418040610.312840477 30 atime=1418040610.312840477 30 ctime=1418040695.169717215 ./soundkonverter-2.1.2/metadata/tagengine.h0000755000175000001440000000701012441312442021304 0ustar00danielusers00000000000000 #ifndef TAGENGINE_H #define TAGENGINE_H #include #include class Config; class CoverData : public QObject { public: /*! * This describes the function or content of the picture. * copyright: (C) 2002 - 2008 by Scott Wheeler */ enum Role { //! A type not enumerated below Other = 0x00, //! 32x32 PNG image that should be used as the file icon FileIcon = 0x01, //! File icon of a different size or format OtherFileIcon = 0x02, //! Front cover image of the album FrontCover = 0x03, //! Back cover image of the album BackCover = 0x04, //! Inside leaflet page of the album LeafletPage = 0x05, //! Image from the album itself Media = 0x06, //! Picture of the lead artist or soloist LeadArtist = 0x07, //! Picture of the artist or performer Artist = 0x08, //! Picture of the conductor Conductor = 0x09, //! Picture of the band or orchestra Band = 0x0A, //! Picture of the composer Composer = 0x0B, //! Picture of the lyricist or text writer Lyricist = 0x0C, //! Picture of the recording location or studio RecordingLocation = 0x0D, //! Picture of the artists during recording DuringRecording = 0x0E, //! Picture of the artists during performance DuringPerformance = 0x0F, //! Picture from a movie or video related to the track MovieScreenCapture = 0x10, //! Picture of a large, coloured fish ColouredFish = 0x11, //! Illustration related to the track Illustration = 0x12, //! Logo of the band or performer BandLogo = 0x13, //! Logo of the publisher (record company) PublisherLogo = 0x14 }; CoverData( const QByteArray& _data = QByteArray(), const QString& _mimyType = QString::null, Role _role = Other, const QString& _description = QString::null, QObject *parent = 0 ); ~CoverData(); QByteArray data; QString mimeType; Role role; QString description; static QString roleName( Role role ); }; class TagData : public QObject { Q_OBJECT public: TagData(); ~TagData(); /** The tags */ QString artist; QString albumArtist; QString composer; QString album; QString title; QString genre; QString comment; short track; short trackTotal; short disc; short discTotal; short year; float trackGain; float albumGain; QString musicBrainzTrackId; QString musicBrainzReleaseId; /** Covers */ QList covers; enum TagsRead { TrackGain = 0x01, AlbumGain = 0x02, Covers = 0x04 } tagsRead; /** The technical information */ int length; int samplingRate; }; class TagEngine { public: TagEngine( Config *_config ); ~TagEngine(); /** A list of all genre */ QStringList genreList; TagData* readTags( const KUrl& fileName ); bool writeTags( const KUrl& fileName, TagData *tagData ); QList readCovers( const KUrl& fileName ); bool writeCovers( const KUrl& fileName, QList covers ); bool writeCoversToDirectory( const QString& directoryName, TagData *tags ); private: Config *config; }; #endif // TAGENGINE_H ./soundkonverter-2.1.2/metadata/PaxHeaders.4329/MetaReplayGain.cpp0000644000000000000000000000013212076525023021547 xustar0030 mtime=1358604819.215806313 30 atime=1358604819.215806313 30 ctime=1418040695.170717213 ./soundkonverter-2.1.2/metadata/MetaReplayGain.cpp0000644000175000001440000003401312076525023022545 0ustar00danielusers00000000000000/**************************************************************************************** * Copyright (c) 2009 Alex Merry * * * * 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, see . * ****************************************************************************************/ // NOTE: this file is used by amarokcollectionscanner and CANNOT use any amaroklib // code [this includes debug()] #include "MetaReplayGain.h" #include #include // Taglib #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // #include // #include // converts a peak value from the normal digital scale form to the more useful decibel form // decibels are relative to the /adjusted/ waveform static qreal peakToDecibels( qreal scaleVal ) { if ( scaleVal > 0 ) return 20 * log10( scaleVal ); else return 0; } // NOTE: representation is taken to be a binary value with units in the first column, // 1/2 in the second and so on. static qreal readRVA2PeakValue( const TagLib::ByteVector &data, int bits, bool *ok ) { qreal peak = 0.0; // discarding digits at the end reduces precision, but doesn't otherwise change the value if ( bits > 32 ) bits = 32; // the +7 makes sure we round up when we divide by 8 unsigned int bytes = (bits + 7) / 8; // normalize appears not to write a peak at all, and hence sets bits to 0 if ( bits == 0 ) { if ( ok ) *ok = true; } else if ( bits >= 4 && data.size() >= bytes ) // fewer than 4 bits would just be daft { // excessBits is the number of bits we have to discard at the end unsigned int excessBits = (8 * bytes) - bits; // mask has 1s everywhere but the last /excessBits/ bits quint32 mask = 0xffffffff << excessBits; quint32 rawValue = 0; for ( unsigned int i = 0; i < bytes; ++i ) { rawValue <<= 8; rawValue += (unsigned char)data[i]; } rawValue &= mask; peak = rawValue; // amount we need to "shift" the value right to make the first digit the unit column unsigned int rightShift = (8 * bytes) - 1; peak /= (qreal)(1 << rightShift); if ( ok ) *ok = true; } else { if ( ok ) *ok = false; } return peak; } // adds the converted version of the scale value if it is a valid, non-negative float static void maybeAddPeak( const TagLib::String &scaleVal, Meta::ReplayGainTag key, Meta::ReplayGainTagMap *map ) { // scale value is >= 0, and typically not much bigger than 1 QString value = TStringToQString( scaleVal ); bool ok = false; qreal peak = value.toFloat( &ok ); if ( ok && peak >= 0 ) (*map)[key] = peakToDecibels( peak ); } static void maybeAddGain( const TagLib::String &input, Meta::ReplayGainTag key, Meta::ReplayGainTagMap *map ) { QString value = TStringToQString( input ).remove( " dB" ); bool ok = false; qreal gain = value.toFloat( &ok ); if (ok) (*map)[key] = gain; } static Meta::ReplayGainTagMap readID3v2Tags( TagLib::ID3v2::Tag *tag ) { Meta::ReplayGainTagMap map; { // ID3v2.4.0 native replay gain tag support (as written by Quod Libet, for example). TagLib::ID3v2::FrameList frames = tag->frameListMap()["RVA2"]; frames.append(tag->frameListMap()["XRVA"]); if ( !frames.isEmpty() ) { for ( unsigned int i = 0; i < frames.size(); ++i ) { // we have to parse this frame ourselves // ID3v2 frame header is 10 bytes, so skip that TagLib::ByteVector data = frames[i]->render().mid( 10 ); unsigned int offset = 0; QString desc( data.data() ); offset += desc.count() + 1; unsigned int channel = data.mid( offset, 1 ).toUInt( true ); // channel 1 is the main volume - the only one we care about if ( channel == 1 ) { ++offset; qint16 adjustment512 = data.mid( offset, 2 ).toShort( true ); qreal adjustment = ( (qreal)adjustment512 ) / 512.0; offset += 2; unsigned int peakBits = data.mid( offset, 1 ).toUInt( true ); ++offset; bool ok = false; qreal peak = readRVA2PeakValue( data.mid( offset ), peakBits, &ok ); if ( ok ) { if ( desc.toLower() == "album" ) { map[Meta::ReplayGain_Album_Gain] = adjustment; map[Meta::ReplayGain_Album_Peak] = peakToDecibels( peak ); } else if ( desc.toLower() == "track" || !map.contains( Meta::ReplayGain_Track_Gain ) ) { map[Meta::ReplayGain_Track_Gain] = adjustment; map[Meta::ReplayGain_Track_Peak] = peakToDecibels( peak ); } } } } if ( !map.isEmpty() ) return map; } } { // Foobar2000-style ID3v2.3.0 tags TagLib::ID3v2::FrameList frames = tag->frameListMap()["TXXX"]; for ( TagLib::ID3v2::FrameList::Iterator it = frames.begin(); it != frames.end(); ++it ) { TagLib::ID3v2::UserTextIdentificationFrame* frame = dynamic_cast( *it ); if ( frame && frame->fieldList().size() >= 2 ) { QString desc = TStringToQString( frame->description() ).toLower(); if ( desc == "replaygain_album_gain" ) maybeAddGain( frame->fieldList()[1], Meta::ReplayGain_Album_Gain, &map ); if ( desc == "replaygain_album_peak" ) maybeAddPeak( frame->fieldList()[1], Meta::ReplayGain_Album_Peak, &map ); if ( desc == "replaygain_track_gain" ) maybeAddGain( frame->fieldList()[1], Meta::ReplayGain_Track_Gain, &map ); if ( desc == "replaygain_track_peak" ) maybeAddPeak( frame->fieldList()[1], Meta::ReplayGain_Track_Peak, &map ); } } } return map; } static Meta::ReplayGainTagMap readAPETags( TagLib::APE::Tag *tag ) { Meta::ReplayGainTagMap map; const TagLib::APE::ItemListMap &items = tag->itemListMap(); if ( items.contains("REPLAYGAIN_TRACK_GAIN") ) { maybeAddGain( items["REPLAYGAIN_TRACK_GAIN"].values()[0], Meta::ReplayGain_Track_Gain, &map ); if ( items.contains("REPLAYGAIN_TRACK_PEAK") ) maybeAddPeak( items["REPLAYGAIN_TRACK_PEAK"].values()[0], Meta::ReplayGain_Track_Peak, &map ); } if ( items.contains("REPLAYGAIN_ALBUM_GAIN") ) { maybeAddGain( items["REPLAYGAIN_ALBUM_GAIN"].values()[0], Meta::ReplayGain_Album_Gain, &map ); if ( items.contains("REPLAYGAIN_ALBUM_PEAK") ) maybeAddPeak( items["REPLAYGAIN_ALBUM_PEAK"].values()[0], Meta::ReplayGain_Album_Peak, &map ); } return map; } static Meta::ReplayGainTagMap readXiphTags( TagLib::Ogg::XiphComment *tag ) { const TagLib::Ogg::FieldListMap &tagMap = tag->fieldListMap(); Meta::ReplayGainTagMap outputMap; if ( !tagMap["REPLAYGAIN_TRACK_GAIN"].isEmpty() ) { maybeAddGain( tagMap["REPLAYGAIN_TRACK_GAIN"].front(), Meta::ReplayGain_Track_Gain, &outputMap ); if ( !tagMap["REPLAYGAIN_TRACK_PEAK"].isEmpty() ) maybeAddPeak( tagMap["REPLAYGAIN_TRACK_PEAK"].front(), Meta::ReplayGain_Track_Peak, &outputMap ); } if ( !tagMap["REPLAYGAIN_ALBUM_GAIN"].isEmpty() ) { maybeAddGain( tagMap["REPLAYGAIN_ALBUM_GAIN"].front(), Meta::ReplayGain_Album_Gain, &outputMap ); if ( !tagMap["REPLAYGAIN_ALBUM_PEAK"].isEmpty() ) maybeAddPeak( tagMap["REPLAYGAIN_ALBUM_PEAK"].front(), Meta::ReplayGain_Album_Peak, &outputMap ); } return outputMap; } /*static Meta::ReplayGainTagMap readASFTags( TagLib::ASF::Tag *tag ) { const TagLib::ASF::AttributeListMap &tagMap = tag->attributeListMap(); Meta::ReplayGainTagMap outputMap; if ( !tagMap["REPLAYGAIN_TRACK_GAIN"].isEmpty() ) { maybeAddGain( tagMap["REPLAYGAIN_TRACK_GAIN"].front().toString(), Meta::ReplayGain_Track_Gain, &outputMap ); if ( !tagMap["REPLAYGAIN_TRACK_PEAK"].isEmpty() ) maybeAddPeak( tagMap["REPLAYGAIN_TRACK_PEAK"].front().toString(), Meta::ReplayGain_Track_Peak, &outputMap ); } if ( !tagMap["REPLAYGAIN_ALBUM_GAIN"].isEmpty() ) { maybeAddGain( tagMap["REPLAYGAIN_ALBUM_GAIN"].front().toString(), Meta::ReplayGain_Album_Gain, &outputMap ); if ( !tagMap["REPLAYGAIN_ALBUM_PEAK"].isEmpty() ) maybeAddPeak( tagMap["REPLAYGAIN_ALBUM_PEAK"].front().toString(), Meta::ReplayGain_Album_Peak, &outputMap ); } return outputMap; }*/ // Bad news: ReplayGain in MP4 is not actually standardized in any way. Maybe reimplement at some point...maybe. See // http://www.hydrogenaudio.org/forums/lofiversion/index.php/t14322.html #ifdef DO_NOT_USE_THIS_UNTIL_FIXED static Meta::ReplayGainTagMap readMP4Tags( TagLib::MP4::Tag *tag ) { Meta::ReplayGainTagMap outputMap; if ( !tag->trackReplayGain().isNull() ) { maybeAddGain( tag->trackReplayGain(), Meta::ReplayGain_Track_Gain, &outputMap ); if ( !tag->trackReplayGainPeak().isNull() ) maybeAddPeak( tag->trackReplayGainPeak(), Meta::ReplayGain_Track_Peak, &outputMap ); } if ( !tag->albumReplayGain().isNull() ) { maybeAddGain( tag->albumReplayGain(), Meta::ReplayGain_Album_Gain, &outputMap ); if ( !tag->albumReplayGainPeak().isNull() ) maybeAddPeak( tag->albumReplayGainPeak(), Meta::ReplayGain_Album_Peak, &outputMap ); } return outputMap; } #endif Meta::ReplayGainTagMap Meta::readReplayGainTags( TagLib::FileRef fileref ) { Meta::ReplayGainTagMap map; // NB: we can't get replay gain info from MPC files, since it's stored in some magic place // and not in the APE tags, and taglib doesn't let us access the information (unless // we want to parse the file ourselves). // FIXME: should we try getting the info from the MPC APE tag just in case? if ( TagLib::MPEG::File *file = dynamic_cast( fileref.file() ) ) { if ( file->ID3v2Tag() ) map = readID3v2Tags( file->ID3v2Tag() ); if ( map.isEmpty() && file->APETag() ) map = readAPETags( file->APETag() ); } else if ( TagLib::Ogg::Vorbis::File *file = dynamic_cast( fileref.file() ) ) { if ( file->tag() ) map = readXiphTags( file->tag() ); } else if ( TagLib::FLAC::File *file = dynamic_cast( fileref.file() ) ) { if ( file->xiphComment() ) map = readXiphTags( file->xiphComment() ); if ( map.isEmpty() && file->ID3v2Tag() ) map = readID3v2Tags( file->ID3v2Tag() ); } else if ( TagLib::Ogg::FLAC::File *file = dynamic_cast( fileref.file() ) ) { if ( file->tag() ) map = readXiphTags( file->tag() ); } else if ( TagLib::WavPack::File *file = dynamic_cast( fileref.file() ) ) { if ( file->APETag() ) map = readAPETags( file->APETag() ); } else if ( TagLib::TrueAudio::File *file = dynamic_cast( fileref.file() ) ) { if ( file->ID3v2Tag() ) map = readID3v2Tags( file->ID3v2Tag() ); } else if ( TagLib::Ogg::Speex::File *file = dynamic_cast( fileref.file() ) ) { if ( file->tag() ) map = readXiphTags( file->tag() ); } else if ( TagLib::MPC::File *file = dynamic_cast( fileref.file() ) ) { // This is NOT the correct way to get replay gain tags from MPC files, but // taglib doesn't allow us access to the real information. // This allows people to work around this issue by copying their replay gain // information to the APE tag. if ( file->APETag() ) map = readAPETags( file->APETag() ); } /* else if ( TagLib::ASF::File *file = dynamic_cast( fileref.file() ) ) { if ( file->tag() ) map = readASFTags( file->tag() ); }*/ // See comment above #ifdef DO_NOT_USE_THIS_UNTIL_FIXED else if ( TagLib::MP4::File *file = dynamic_cast( fileref.file() ) ) { if ( file->tag() ) map = readMP4Tags( file->getMP4Tag() ); } #endif return map; } ./soundkonverter-2.1.2/PaxHeaders.4329/soundkonverter.desktop.template0000644000000000000000000000013212076525023022716 xustar0030 mtime=1358604819.265806451 30 atime=1358604819.265806451 30 ctime=1418040695.108717315 ./soundkonverter-2.1.2/soundkonverter.desktop.template0000755000175000001440000000045712076525023023724 0ustar00danielusers00000000000000[Desktop Entry] Encoding=UTF-8 Name=soundKonverter Exec=soundkonverter %U Icon=soundkonverter Type=Application _GenericName=Audio file converter, CD ripper and Replay Gain tool Terminal=false Categories=AudioVideo;Audio;AudioVideoEditing;KDE; X-DocPath=https://github.com/HessiJames/soundkonverter/wiki ./soundkonverter-2.1.2/PaxHeaders.4329/optionseditor.cpp0000644000000000000000000000013212276426271020036 xustar0030 mtime=1392127161.295174484 30 atime=1392127161.295174484 30 ctime=1418040695.114717305 ./soundkonverter-2.1.2/optionseditor.cpp0000644000175000001440000010107212276426271021034 0ustar00danielusers00000000000000// // C++ Implementation: optionseditor // // Description: // // // Author: Daniel Faust , (C) 2008 - 2012 // // Copyright: See COPYING file that comes with this distribution // // #include "optionseditor.h" #include "options.h" #include "config.h" #include "filelistitem.h" #include "global.h" #include #include #include #include #include #include #include #include #include #include #include // TODO use QPointer or QSharedPointer OptionsEditor::OptionsEditor( Config *_config, QWidget *parent ) : KPageDialog( parent ), config( _config ) { tagEngine = config->tagEngine(); setButtons( KDialog::User1 | KDialog::User2 | KDialog::Ok | KDialog::Apply | KDialog::Cancel ); setButtonText( KDialog::User2, i18n("Previous") ); setButtonIcon( KDialog::User2, KIcon("go-previous") ); setButtonText( KDialog::User1, i18n("Next") ); setButtonIcon( KDialog::User1, KIcon("go-next") ); connect( this, SIGNAL(applyClicked()), this, SLOT(applyChanges()) ); connect( this, SIGNAL(okClicked()), this, SLOT(applyChanges()) ); button(KDialog::User2)->setAutoRepeat(true); button(KDialog::User1)->setAutoRepeat(true); QWidget *conversionOptionsWidget = new QWidget( this ); KPageWidgetItem *conversionOptionsPage = addPage( conversionOptionsWidget, i18n("Conversion") ); conversionOptionsPage->setIcon( KIcon( "view-list-text" ) ); // the grid for all widgets in the main window QGridLayout* conversionOptionsGridLayout = new QGridLayout( conversionOptionsWidget ); // generate the options input area options = new Options( config, i18n("Select your desired output options and click on \"Ok\"."), conversionOptionsWidget ); conversionOptionsGridLayout->addWidget( options, 0, 0 ); conversionOptionsGridLayout->setRowStretch( 1, 1 ); lEditOptions = new QLabel( "", conversionOptionsWidget ); conversionOptionsGridLayout->addWidget( lEditOptions, 2, 0 ); lEditOptions->setAlignment( Qt::AlignHCenter ); lEditOptions->hide(); pEditOptions = new KPushButton( i18n("Edit conversion options"), conversionOptionsWidget ); pEditOptions->setFixedWidth( pEditOptions->sizeHint().width() ); conversionOptionsGridLayout->addWidget( pEditOptions, 3, 0, Qt::AlignHCenter ); pEditOptions->hide(); connect( pEditOptions, SIGNAL(clicked()), this, SLOT(editOptionsClicked()) ); QWidget *tagsWidget = new QWidget( this ); KPageWidgetItem *tagsPage = addPage( tagsWidget, i18n("Tags") ); tagsPage->setIcon( KIcon( "feed-subscribe" ) ); // the grid for all widgets in the main window QGridLayout* tagsGridLayout = new QGridLayout( tagsWidget ); // add the inputs // add a horizontal box layout for the covers QHBoxLayout *coversBox = new QHBoxLayout(); tagsGridLayout->addLayout( coversBox, 0, 1 ); // and fill it up lCoversLabel = new QLabel( i18n("Covers:"), tagsWidget ); tagsGridLayout->addWidget( lCoversLabel, 0, 0 ); bCovers = new QHBoxLayout(); coversBox->addLayout( bCovers ); coversBox->addStretch(); // add a horizontal box layout for the title and track number QHBoxLayout *titleBox = new QHBoxLayout(); tagsGridLayout->addLayout( titleBox, 1, 1 ); // and fill it up lTitleLabel = new QLabel( i18n("Title:"), tagsWidget ); tagsGridLayout->addWidget( lTitleLabel, 1, 0 ); lTitle = new KLineEdit( tagsWidget ); titleBox->addWidget( lTitle ); pTitleEdit = new KPushButton( KIcon("edit-rename"), " ", tagsWidget ); pTitleEdit->setFixedSize( pTitleEdit->sizeHint().height(), lTitle->sizeHint().height() ); pTitleEdit->setFlat( true ); pTitleEdit->setToolTip( i18n("Edit") ); pTitleEdit->hide(); titleBox->addWidget( pTitleEdit ); connect( pTitleEdit, SIGNAL(clicked()), this, SLOT(editTitleClicked()) ); lTrackLabel = new QLabel( i18n("Track No.:"), tagsWidget ); titleBox->addWidget( lTrackLabel ); iTrack = new KIntSpinBox( 0, 999, 1, 1, tagsWidget ); titleBox->addWidget( iTrack ); pTrackEdit = new KPushButton( KIcon("edit-rename"), " ", tagsWidget ); pTrackEdit->setFixedSize( pTrackEdit->sizeHint().height(), iTrack->sizeHint().height() ); pTrackEdit->setFlat( true ); pTrackEdit->setToolTip( i18n("Edit") ); pTrackEdit->hide(); titleBox->addWidget( pTrackEdit ); connect( pTrackEdit, SIGNAL(clicked()), this, SLOT(editTrackClicked()) ); lTrackTotalLabel = new QLabel( i18nc("Track/Disc No. x of y","of"), tagsWidget ); titleBox->addWidget( lTrackTotalLabel ); iTrackTotal = new KIntSpinBox( 0, 999, 1, 1, tagsWidget ); titleBox->addWidget( iTrackTotal ); pTrackTotalEdit = new KPushButton( KIcon("edit-rename"), " ", tagsWidget ); pTrackTotalEdit->setFixedSize( pTrackTotalEdit->sizeHint().height(), iTrackTotal->sizeHint().height() ); pTrackTotalEdit->setFlat( true ); pTrackTotalEdit->setToolTip( i18n("Edit") ); pTrackTotalEdit->hide(); titleBox->addWidget( pTrackTotalEdit ); connect( pTrackTotalEdit, SIGNAL(clicked()), this, SLOT(editTrackTotalClicked()) ); // add a horizontal box layout for the artist and the composer QHBoxLayout *artistBox = new QHBoxLayout(); tagsGridLayout->addLayout( artistBox, 2, 1 ); // and fill it up lArtistLabel = new QLabel( i18n("Artist:"), tagsWidget ); tagsGridLayout->addWidget( lArtistLabel, 2, 0 ); lArtist = new KLineEdit( tagsWidget ); artistBox->addWidget( lArtist ); pArtistEdit = new KPushButton( KIcon("edit-rename"), " ", tagsWidget ); pArtistEdit->setFixedSize( pArtistEdit->sizeHint().height(), lArtist->sizeHint().height() ); pArtistEdit->setFlat( true ); pArtistEdit->setToolTip( i18n("Edit") ); pArtistEdit->hide(); artistBox->addWidget( pArtistEdit ); connect( pArtistEdit, SIGNAL(clicked()), this, SLOT(editArtistClicked()) ); lComposerLabel = new QLabel( i18n("Composer:"), tagsWidget ); artistBox->addWidget( lComposerLabel ); lComposer = new KLineEdit( tagsWidget ); artistBox->addWidget( lComposer ); pComposerEdit = new KPushButton( KIcon("edit-rename"), " ", tagsWidget ); pComposerEdit->setFixedSize( pComposerEdit->sizeHint().height(), lComposer->sizeHint().height() ); pComposerEdit->setFlat( true ); pComposerEdit->setToolTip( i18n("Edit") ); pComposerEdit->hide(); artistBox->addWidget( pComposerEdit ); connect( pComposerEdit, SIGNAL(clicked()), this, SLOT(editComposerClicked()) ); // add a horizontal box layout for the album QHBoxLayout *albumArtistBox = new QHBoxLayout(); tagsGridLayout->addLayout( albumArtistBox, 3, 1 ); // and fill it up lAlbumArtistLabel = new QLabel( i18n("Album artist:"), tagsWidget ); tagsGridLayout->addWidget( lAlbumArtistLabel, 3, 0 ); lAlbumArtist = new KLineEdit( tagsWidget ); albumArtistBox->addWidget( lAlbumArtist ); pAlbumArtistEdit = new KPushButton( KIcon("edit-rename"), " ", tagsWidget ); pAlbumArtistEdit->setFixedSize( pAlbumArtistEdit->sizeHint().height(), lAlbumArtist->sizeHint().height() ); pAlbumArtistEdit->setFlat( true ); pAlbumArtistEdit->setToolTip( i18n("Edit") ); pAlbumArtistEdit->hide(); albumArtistBox->addWidget( pAlbumArtistEdit ); connect( pAlbumArtistEdit, SIGNAL(clicked()), this, SLOT(editAlbumArtistClicked()) ); // add a horizontal box layout for the album QHBoxLayout *albumBox = new QHBoxLayout(); tagsGridLayout->addLayout( albumBox, 4, 1 ); // and fill it up lAlbumLabel = new QLabel( i18n("Album:"), tagsWidget ); tagsGridLayout->addWidget( lAlbumLabel, 4, 0 ); lAlbum = new KLineEdit( tagsWidget ); albumBox->addWidget( lAlbum ); pAlbumEdit = new KPushButton( KIcon("edit-rename"), " ", tagsWidget ); pAlbumEdit->setFixedSize( pAlbumEdit->sizeHint().height(), lAlbum->sizeHint().height() ); pAlbumEdit->setFlat( true ); pAlbumEdit->setToolTip( i18n("Edit") ); pAlbumEdit->hide(); albumBox->addWidget( pAlbumEdit ); connect( pAlbumEdit, SIGNAL(clicked()), this, SLOT(editAlbumClicked()) ); // add a horizontal box layout for the disc number, year and genre QHBoxLayout *albumdataBox = new QHBoxLayout(); tagsGridLayout->addLayout( albumdataBox, 5, 1 ); // and fill it up lDiscLabel = new QLabel( i18n("Disc No.:"), tagsWidget ); tagsGridLayout->addWidget( lDiscLabel, 5, 0 ); iDisc = new KIntSpinBox( 0, 99, 1, 1, tagsWidget ); albumdataBox->addWidget( iDisc ); pDiscEdit = new KPushButton( KIcon("edit-rename"), " ", tagsWidget ); pDiscEdit->setFixedSize( pDiscEdit->sizeHint().height(), iDisc->sizeHint().height() ); pDiscEdit->setFlat( true ); pDiscEdit->setToolTip( i18n("Edit") ); pDiscEdit->hide(); albumdataBox->addWidget( pDiscEdit ); connect( pDiscEdit, SIGNAL(clicked()), this, SLOT(editDiscClicked()) ); lDiscTotalLabel = new QLabel( i18nc("Track/Disc No. x of y","of"), tagsWidget ); albumdataBox->addWidget( lDiscTotalLabel ); iDiscTotal = new KIntSpinBox( 0, 99, 1, 1, tagsWidget ); albumdataBox->addWidget( iDiscTotal ); pDiscTotalEdit = new KPushButton( KIcon("edit-rename"), " ", tagsWidget ); pDiscTotalEdit->setFixedSize( pDiscTotalEdit->sizeHint().height(), iDiscTotal->sizeHint().height() ); pDiscTotalEdit->setFlat( true ); pDiscTotalEdit->setToolTip( i18n("Edit") ); pDiscTotalEdit->hide(); albumdataBox->addWidget( pDiscTotalEdit ); connect( pDiscTotalEdit, SIGNAL(clicked()), this, SLOT(editDiscTotalClicked()) ); albumdataBox->addStretch(); lYearLabel = new QLabel( i18n("Year:"), tagsWidget ); albumdataBox->addWidget( lYearLabel ); iYear = new KIntSpinBox( 0, 99999, 1, QDate::currentDate().year(), tagsWidget ); albumdataBox->addWidget( iYear ); pYearEdit = new KPushButton( KIcon("edit-rename"), " ", tagsWidget ); pYearEdit->setFixedSize( pYearEdit->sizeHint().height(), iYear->sizeHint().height() ); pYearEdit->setFlat( true ); pYearEdit->setToolTip( i18n("Edit") ); pYearEdit->hide(); albumdataBox->addWidget( pYearEdit ); connect( pYearEdit, SIGNAL(clicked()), this, SLOT(editYearClicked()) ); albumdataBox->addStretch(); lGenreLabel = new QLabel( i18n("Genre:"), tagsWidget ); albumdataBox->addWidget( lGenreLabel ); cGenre = new KComboBox( true, tagsWidget ); cGenre->addItems( tagEngine->genreList ); cGenre->clearEditText(); KCompletion *cGenreCompletion = cGenre->completionObject(); cGenreCompletion->insertItems( tagEngine->genreList ); cGenreCompletion->setIgnoreCase( tagsWidget ); albumdataBox->addWidget( cGenre ); pGenreEdit = new KPushButton( KIcon("edit-rename"), " ", tagsWidget ); pGenreEdit->setFixedSize( pGenreEdit->sizeHint().height(), cGenre->sizeHint().height() ); pGenreEdit->setFlat( true ); pGenreEdit->setToolTip( i18n("Edit") ); pGenreEdit->hide(); albumdataBox->addWidget( pGenreEdit ); connect( pGenreEdit, SIGNAL(clicked()), this, SLOT(editGenreClicked()) ); // add a horizontal box layout for the comment QHBoxLayout *commentBox = new QHBoxLayout(); tagsGridLayout->addLayout( commentBox, 6, 1 ); // and fill it up lCommentLabel = new QLabel( i18n("Comment:"), tagsWidget ); tagsGridLayout->addWidget( lCommentLabel, 6, 0 ); tComment = new KTextEdit( tagsWidget ); commentBox->addWidget( tComment ); pCommentEdit = new KPushButton( KIcon("edit-rename"), " ", tagsWidget ); pCommentEdit->setFixedSize( pCommentEdit->sizeHint().height(), lTitle->sizeHint().height() ); pCommentEdit->setFlat( true ); pCommentEdit->setToolTip( i18n("Edit") ); pCommentEdit->hide(); commentBox->addWidget( pCommentEdit ); connect( pCommentEdit, SIGNAL(clicked()), this, SLOT(editCommentClicked()) ); tagsGridLayout->setRowStretch( 6, 1 ); lEditTags = new QLabel( "", tagsWidget ); tagsGridLayout->addWidget( lEditTags, 7, 1 ); lEditTags->setAlignment( Qt::AlignHCenter ); lEditTags->hide(); pEditTags = new KPushButton( i18n("Edit tags"), tagsWidget ); pEditTags->setFixedWidth( pEditTags->sizeHint().width() ); tagsGridLayout->addWidget( pEditTags, 8, 1, Qt::AlignHCenter ); pEditTags->hide(); connect( pEditTags, SIGNAL(clicked()), this, SLOT(editTagsClicked()) ); } OptionsEditor::~OptionsEditor() {} void OptionsEditor::setTagInputEnabled( bool enabled ) { lTitleLabel->setEnabled( enabled ); lTitle->setEnabled( enabled ); pTitleEdit->hide(); lTrackLabel->setEnabled( enabled ); iTrack->setEnabled( enabled ); lTrackTotalLabel->setEnabled( enabled ); iTrackTotal->setEnabled( enabled ); pTrackEdit->hide(); lArtistLabel->setEnabled( enabled ); lArtist->setEnabled( enabled ); pArtistEdit->hide(); lComposerLabel->setEnabled( enabled ); lComposer->setEnabled( enabled ); pComposerEdit->hide(); lAlbumArtistLabel->setEnabled( enabled ); lAlbumArtist->setEnabled( enabled ); pAlbumArtistEdit->hide(); lAlbumLabel->setEnabled( enabled ); lAlbum->setEnabled( enabled ); pAlbumEdit->hide(); lDiscLabel->setEnabled( enabled ); iDisc->setEnabled( enabled ); lDiscTotalLabel->setEnabled( enabled ); iDiscTotal->setEnabled( enabled ); pDiscEdit->hide(); lYearLabel->setEnabled( enabled ); iYear->setEnabled( enabled ); pYearEdit->hide(); lGenreLabel->setEnabled( enabled ); cGenre->setEnabled( enabled ); pGenreEdit->hide(); lCommentLabel->setEnabled( enabled ); tComment->setEnabled( enabled ); tComment->setReadOnly( !enabled ); pCommentEdit->hide(); if( !enabled ) { lTitle->setText( "" ); iTrack->setValue( 0 ); iTrackTotal->setValue( 0 ); lArtist->setText( "" ); lComposer->setText( "" ); lAlbumArtist->setText( "" ); lAlbum->setText( "" ); iDisc->setValue( 0 ); iDiscTotal->setValue( 0 ); iYear->setValue( 0 ); cGenre->setEditText( "" ); tComment->setText( "" ); } } void OptionsEditor::itemsSelected( QList items ) { selectedItems.clear(); foreach( FileListItem *item, items ) { bool canEdit = false; if( item ) { switch( item->state ) { case FileListItem::WaitingForConversion: canEdit = true; break; case FileListItem::Ripping: break; case FileListItem::Converting: break; case FileListItem::ApplyingReplayGain: break; case FileListItem::WaitingForAlbumGain: break; case FileListItem::ApplyingAlbumGain: break; case FileListItem::Stopped: canEdit = true; break; } } if( canEdit ) selectedItems.append( item ); } // remove all cover widgets foreach( QLabel* label, lCovers ) { bCovers->removeWidget( label ); label->deleteLater(); } lCovers.clear(); lCoversLabel->setEnabled( false ); if( selectedItems.count() == 0 ) { setCaption( i18n("No file selected") ); options->setEnabled( false ); lEditOptions->hide(); pEditOptions->hide(); setTagInputEnabled( false ); lEditTags->hide(); pEditTags->hide(); return; } options->setEnabled( true ); lEditOptions->hide(); pEditOptions->hide(); setTagInputEnabled( true ); lEditTags->hide(); pEditTags->hide(); if( selectedItems.count() == 1 ) { FileListItem *item = selectedItems.first(); setCaption( selectedItems.first()->url.fileName() ); const bool success = options->setCurrentConversionOptions( config->conversionOptionsManager()->getConversionOptions(selectedItems.first()->conversionOptionsId) ); options->setEnabled( success ); // TODO show error message if !success if( item->tags == 0 && !item->local ) { setTagInputEnabled( false ); lEditTags->setText( i18n("The tags could not be read, because this is not a local file.\n" "soundKonverter will try to read the tags, when it is about to convert the file.\n" "If you want to edit the tags, you can hit the button below but then soundKonverter will not try\n" "to read the tags after downloading.") ); lEditTags->show(); pEditTags->show(); } else if( item->tags == 0 ) { setTagInputEnabled( false ); lEditTags->setText( i18n("Reading the tags of this file failed.\n" "soundKonverter will try to read the tags a second time, when it is about to convert the file.\n" "If you want to edit the tags, you can hit the button below but then soundKonverter will not try\n" "to read the tags a second time.") ); lEditTags->show(); pEditTags->show(); } else { const int fontHeight = QFontMetrics(QApplication::font()).boundingRect("M").size().height(); if( !(item->tags->tagsRead & TagData::Covers) ) { item->tags->covers = tagEngine->readCovers( item->url ); item->tags->tagsRead = TagData::TagsRead(item->tags->tagsRead | TagData::Covers); } foreach( CoverData* cover, item->tags->covers ) { QPixmap pixmap; pixmap.loadFromData( cover->data ); QLabel *label = new QLabel(); label->setFrameShape( QFrame::StyledPanel ); label->setFrameShadow( QFrame::Raised ); QString toolTip; toolTip += ""; toolTip += ""; if( !cover->description.isEmpty() ) toolTip += ""; toolTip += ""; if( !cover->mimeType.isEmpty() ) toolTip += ""; toolTip += "
" + i18nc("cover tooltip","Cover type:") + "" + CoverData::roleName(cover->role) + "
" + i18nc("cover tooltip","Description:") + "" + cover->description + "
" + i18nc("cover tooltip","Size:") + "" + i18nc("cover tooltip","%1 x %2 pixels (%3)",pixmap.width(),pixmap.height(),Global::prettyNumber(cover->data.size(),"B")) + "
" + i18nc("cover tooltip","Mime type:") + "" + cover->mimeType + "
"; label->setToolTip( toolTip ); bCovers->addWidget( label ); lCovers.append( label ); label->setPixmap( pixmap.scaledToHeight( 4.5*fontHeight, Qt::SmoothTransformation ) ); } lCoversLabel->setEnabled( item->tags->covers.count() > 0 ); lTitle->setText( item->tags->title ); iTrack->setValue( item->tags->track ); iTrackTotal->setValue( item->tags->trackTotal ); lArtist->setText( item->tags->artist ); lComposer->setText( item->tags->composer ); lAlbumArtist->setText( item->tags->albumArtist ); lAlbum->setText( item->tags->album ); iDisc->setValue( item->tags->disc ); iDiscTotal->setValue( item->tags->discTotal ); iYear->setValue( item->tags->year ); cGenre->setEditText( item->tags->genre ); tComment->setText( item->tags->comment ); } } else // selectedItems.count() > 1 { setCaption( i18n("%1 Files").arg(selectedItems.count()) ); FileListItem *firstItem = selectedItems.first(); const int conversionOptionsId = firstItem->conversionOptionsId; const QString title = ( firstItem->tags == 0 ) ? "" : firstItem->tags->title; const int track = ( firstItem->tags == 0 ) ? 0 : firstItem->tags->track; const int trackTotal = ( firstItem->tags == 0 ) ? 0 : firstItem->tags->trackTotal; const QString artist = ( firstItem->tags == 0 ) ? "" : firstItem->tags->artist; const QString composer = ( firstItem->tags == 0 ) ? "" : firstItem->tags->composer; const QString albumArtist = ( firstItem->tags == 0 ) ? "" : firstItem->tags->albumArtist; const QString album = ( firstItem->tags == 0 ) ? "" : firstItem->tags->album; const int disc = ( firstItem->tags == 0 ) ? 0 : firstItem->tags->disc; const int discTotal = ( firstItem->tags == 0 ) ? 0 : firstItem->tags->discTotal; const int year = ( firstItem->tags == 0 ) ? 0 : firstItem->tags->year; const QString genre = ( firstItem->tags == 0 ) ? "" : firstItem->tags->genre; const QString comment = ( firstItem->tags == 0 ) ? "" : firstItem->tags->comment; foreach( FileListItem *item, selectedItems ) { if( item->conversionOptionsId != conversionOptionsId ) { options->setEnabled( false ); lEditOptions->setText( i18n("You have selected multiple files with different conversion options.\nYou can change the options of all files by hitting the button below.") ); lEditOptions->show(); pEditOptions->show(); } if( item->tags == 0 ) { setTagInputEnabled( false ); lEditTags->setText( i18n("Reading the tags of one or more files failed.\n" "soundKonverter will try to read the tags a second time, when it is about to convert the files.\n" "If you want to edit the tags, you can hit the button below but then soundKonverter will not try\n" "to read the tags a second time.") ); lEditTags->show(); pEditTags->show(); continue; } if( title != item->tags->title && lTitle->isEnabled() ) { lTitle->setEnabled( false ); lTitle->setText( "" ); pTitleEdit->show(); } if( track != item->tags->track && iTrack->isEnabled() ) { iTrack->setEnabled( false ); iTrack->setValue( 1 ); pTrackEdit->show(); } if( trackTotal != item->tags->trackTotal && iTrackTotal->isEnabled() ) { iTrackTotal->setEnabled( false ); iTrackTotal->setValue( 1 ); pTrackTotalEdit->show(); } if( artist != item->tags->artist && lArtist->isEnabled() ) { lArtist->setEnabled( false ); lArtist->setText( "" ); pArtistEdit->show(); } if( composer != item->tags->composer && lComposer->isEnabled() ) { lComposer->setEnabled( false ); lComposer->setText( "" ); pComposerEdit->show(); } if( albumArtist != item->tags->albumArtist && lAlbumArtist->isEnabled() ) { lAlbumArtist->setEnabled( false ); lAlbumArtist->setText( "" ); pAlbumArtistEdit->show(); } if( album != item->tags->album && lAlbum->isEnabled() ) { lAlbum->setEnabled( false ); lAlbum->setText( "" ); pAlbumEdit->show(); } if( disc != item->tags->disc && iDisc->isEnabled() ) { iDisc->setEnabled( false ); iDisc->setValue( 1 ); pDiscEdit->show(); } if( discTotal != item->tags->discTotal && iDiscTotal->isEnabled() ) { iDiscTotal->setEnabled( false ); iDiscTotal->setValue( 1 ); pDiscTotalEdit->show(); } if( year != item->tags->year && iYear->isEnabled() ) { iYear->setEnabled( false ); iYear->setValue( QDate::currentDate().year() ); pYearEdit->show(); } if( genre != item->tags->genre && cGenre->isEnabled() ) { cGenre->setEnabled( false ); cGenre->setEditText( "" ); pGenreEdit->show(); } if( comment != item->tags->comment && tComment->isEnabled() ) { tComment->setEnabled( false ); tComment->setReadOnly( true ); tComment->setText( "" ); pCommentEdit->show(); } } if( options->isEnabled() ) { const bool success = options->setCurrentConversionOptions( config->conversionOptionsManager()->getConversionOptions(conversionOptionsId) ); options->setEnabled( success ); // TODO show error message if !success } if( lTitle->isEnabled() ) lTitle->setText( title ); if( iTrack->isEnabled() ) iTrack->setValue( track ); if( iTrackTotal->isEnabled() ) iTrackTotal->setValue( trackTotal ); if( lArtist->isEnabled() ) lArtist->setText( artist ); if( lComposer->isEnabled() ) lComposer->setText( composer ); if( lAlbumArtist->isEnabled() ) lAlbumArtist->setText( albumArtist ); if( lAlbum->isEnabled() ) lAlbum->setText( album ); if( iDisc->isEnabled() ) iDisc->setValue( disc ); if( iDiscTotal->isEnabled() ) iDiscTotal->setValue( discTotal ); if( iYear->isEnabled() ) iYear->setValue( year ); if( cGenre->isEnabled() ) cGenre->setEditText( genre ); if( tComment->isEnabled() ) tComment->setText( comment ); } } void OptionsEditor::setPreviousEnabled( bool enabled ) { enableButton( User2, enabled ); } void OptionsEditor::setNextEnabled( bool enabled ) { enableButton( User1, enabled ); } void OptionsEditor::applyChanges() { ConversionOptions *newConversionOptions = options->currentConversionOptions(); for( int i=0; iisEnabled() ) { selectedItems.at(i)->conversionOptionsId = config->conversionOptionsManager()->updateConversionOptions( selectedItems.at(i)->conversionOptionsId, newConversionOptions ); } else { // TODO error message } if( selectedItems.at(i)->tags ) { if( lTitle->isEnabled() ) selectedItems.at(i)->tags->title = lTitle->text(); if( iTrack->isEnabled() ) selectedItems.at(i)->tags->track = iTrack->value(); if( iTrackTotal->isEnabled() ) selectedItems.at(i)->tags->trackTotal = iTrackTotal->value(); if( lArtist->isEnabled() ) selectedItems.at(i)->tags->artist = lArtist->text(); if( lComposer->isEnabled() ) selectedItems.at(i)->tags->composer = lComposer->text(); if( lAlbumArtist->isEnabled() ) selectedItems.at(i)->tags->albumArtist = lAlbumArtist->text(); if( lAlbum->isEnabled() ) selectedItems.at(i)->tags->album = lAlbum->text(); if( iDisc->isEnabled() ) selectedItems.at(i)->tags->disc = iDisc->value(); if( iDiscTotal->isEnabled() ) selectedItems.at(i)->tags->discTotal= iDiscTotal->value(); if( iYear->isEnabled() ) selectedItems.at(i)->tags->year = iYear->value(); if( cGenre->isEnabled() ) selectedItems.at(i)->tags->genre = cGenre->currentText(); if( tComment->isEnabled() ) selectedItems.at(i)->tags->comment = tComment->toPlainText(); } } options->accepted(); emit updateFileListItems( selectedItems ); } void OptionsEditor::editOptionsClicked() { options->setEnabled( true ); lEditOptions->hide(); pEditOptions->hide(); if( selectedItems.count() > 0 && selectedItems.first() ) { ConversionOptions *conversionOptions = config->conversionOptionsManager()->getConversionOptions( selectedItems.first()->conversionOptionsId ); if( conversionOptions ) options->setCurrentConversionOptions( conversionOptions ); } } void OptionsEditor::editTagsClicked() { for( int i=0; itags = new TagData(); } editTitleClicked(); editTrackClicked(); editTrackTotalClicked(); editArtistClicked(); editComposerClicked(); editAlbumClicked(); editDiscClicked(); editDiscTotalClicked(); editYearClicked(); editGenreClicked(); editCommentClicked(); } void OptionsEditor::editTitleClicked() { lTitle->setEnabled( true ); lTitle->setFocus(); pTitleEdit->hide(); if( selectedItems.count() > 0 && selectedItems.first() && selectedItems.first()->tags ) { lTitle->setText( selectedItems.first()->tags->title ); } } void OptionsEditor::editTrackClicked() { iTrack->setEnabled( true ); iTrack->setFocus(); pTrackEdit->hide(); if( selectedItems.count() > 0 && selectedItems.first() && selectedItems.first()->tags ) { iTrack->setValue( selectedItems.first()->tags->track ); } } void OptionsEditor::editTrackTotalClicked() { iTrackTotal->setEnabled( true ); iTrackTotal->setFocus(); pTrackTotalEdit->hide(); if( selectedItems.count() > 0 && selectedItems.first() && selectedItems.first()->tags ) { iTrackTotal->setValue( selectedItems.first()->tags->trackTotal ); } } void OptionsEditor::editArtistClicked() { lArtist->setEnabled( true ); lArtist->setFocus(); pArtistEdit->hide(); if( selectedItems.count() > 0 && selectedItems.first() && selectedItems.first()->tags ) { lArtist->setText( selectedItems.first()->tags->artist ); } } void OptionsEditor::editComposerClicked() { lComposer->setEnabled( true ); lComposer->setFocus(); pComposerEdit->hide(); if( selectedItems.count() > 0 && selectedItems.first() && selectedItems.first()->tags ) { lComposer->setText( selectedItems.first()->tags->composer ); } } void OptionsEditor::editAlbumArtistClicked() { lAlbumArtist->setEnabled( true ); lAlbumArtist->setFocus(); pAlbumArtistEdit->hide(); if( selectedItems.count() > 0 && selectedItems.first() && selectedItems.first()->tags ) { lAlbumArtist->setText( selectedItems.first()->tags->albumArtist ); } } void OptionsEditor::editAlbumClicked() { lAlbum->setEnabled( true ); lAlbum->setFocus(); pAlbumEdit->hide(); if( selectedItems.count() > 0 && selectedItems.first() && selectedItems.first()->tags ) { lAlbum->setText( selectedItems.first()->tags->album ); } } void OptionsEditor::editDiscClicked() { iDisc->setEnabled( true ); iDisc->setFocus(); pDiscEdit->hide(); if( selectedItems.count() > 0 && selectedItems.first() && selectedItems.first()->tags ) { iDisc->setValue( selectedItems.first()->tags->disc ); } } void OptionsEditor::editDiscTotalClicked() { iDiscTotal->setEnabled( true ); iDiscTotal->setFocus(); pDiscTotalEdit->hide(); if( selectedItems.count() > 0 && selectedItems.first() && selectedItems.first()->tags ) { iDiscTotal->setValue( selectedItems.first()->tags->discTotal ); } } void OptionsEditor::editYearClicked() { iYear->setEnabled( true ); iYear->setFocus(); pYearEdit->hide(); if( selectedItems.count() > 0 && selectedItems.first() && selectedItems.first()->tags ) { iYear->setValue( selectedItems.first()->tags->year ); } } void OptionsEditor::editGenreClicked() { cGenre->setEnabled( true ); cGenre->setFocus(); pGenreEdit->hide(); if( selectedItems.count() > 0 && selectedItems.first() && selectedItems.first()->tags ) { cGenre->setCurrentItem( selectedItems.first()->tags->genre ); } } void OptionsEditor::editCommentClicked() { tComment->setEnabled( true ); tComment->setReadOnly( false ); tComment->setFocus(); pCommentEdit->hide(); if( selectedItems.count() > 0 && selectedItems.first() && selectedItems.first()->tags ) { tComment->setPlainText( selectedItems.first()->tags->comment ); } } ./soundkonverter-2.1.2/PaxHeaders.4329/main.cpp0000644000000000000000000000013212276145314016054 xustar0030 mtime=1392036556.380262138 30 atime=1392036556.380262138 30 ctime=1418040695.113717307 ./soundkonverter-2.1.2/main.cpp0000755000175000001440000000530512276145314017057 0ustar00danielusers00000000000000 #include "soundkonverterapp.h" #include "soundkonverter.h" #include "global.h" #include #include #include #include #include #include static const char description[] = I18N_NOOP("soundKonverter is a frontend to various audio converters, Replay Gain tools and CD rippers.\n\nPlease file bug reports at https://bugs.launchpad.net/soundkonverter\nor simply send me a mail to hessijames@gmail.com"); static const char version[] = SOUNDKONVERTER_VERSION_STRING; int main(int argc, char **argv) { KAboutData about("soundkonverter", 0, ki18n("soundKonverter"), version, ki18n(description), KAboutData::License_GPL, ki18n("(C) 2005-2012 Daniel Faust"), KLocalizedString(), 0, "hessijames@gmail.com"); about.addAuthor( ki18n("Daniel Faust"), KLocalizedString(), "hessijames@gmail.com" ); about.addCredit( ki18n("David Vignoni"), ki18n("Nuvola icon theme"), 0, "http://www.icon-king.com" ); about.addCredit( ki18n("Scott Wheeler"), ki18n("TagLib"), "wheeler@kde.org", "http://ktown.kde.org/~wheeler" ); about.addCredit( ki18n("Marco Nelles"), ki18n("Audex"), 0, "http://opensource.maniatek.de/audex" ); about.addCredit( ki18n("Amarok developers"), ki18n("Amarok"), 0, "http://amarok.kde.org" ); about.addCredit( ki18n("All programmers of audio converters"), ki18n("Backends") ); KCmdLineArgs::init(argc, argv, &about); KCmdLineOptions options; options.add( "replaygain", ki18n("Open the Replay Gain tool and add all given files") ); options.add( "rip ", ki18n("List all tracks on the cd drive , 'auto' will search for a cd") ); options.add( "profile ", ki18n("Add all files using the given profile") ); options.add( "format ", ki18n("Add all files using the given format") ); options.add( "output ", ki18n("Output all files to ") ); options.add( "invisible", ki18n("Start soundKonverter invisible") ); options.add( "autostart", ki18n("Start the conversion immediately (enabled when using '--invisible')") ); options.add( "autoclose", ki18n("Close soundKonverter after all files are converted (enabled when using '--invisible')") ); options.add( "command ", ki18n("Execute after each file has been converted (%i=input file, %o=output file)") ); options.add( "+[files]", ki18n("Audio file(s) to append to the file list") ); KCmdLineArgs::addCmdLineOptions(options); soundKonverterApp::addCmdLineOptions(); if( !soundKonverterApp::start() ) { return 0; } soundKonverterApp app; // mainWin has WDestructiveClose flag by default, so it will delete itself. return app.exec(); } ./soundkonverter-2.1.2/PaxHeaders.4329/config.cpp0000644000000000000000000000013212441312442016365 xustar0030 mtime=1418040610.306840485 30 atime=1418040610.306840485 30 ctime=1418040695.112717309 ./soundkonverter-2.1.2/config.cpp0000755000175000001440000013501012441312442017365 0ustar00danielusers00000000000000 #include "config.h" #include "logger.h" #include "global.h" #include #include #include #include #include #include Config::Config( Logger *_logger, QObject *parent ) : QObject( parent ), logger( _logger ) { connect( this, SIGNAL(updateWriteLogFilesSetting(bool)), logger, SLOT(updateWriteSetting(bool)) ); pPluginLoader = new PluginLoader( logger, this ); pTagEngine = new TagEngine( this ); pConversionOptionsManager = new ConversionOptionsManager( pPluginLoader ); } Config::~Config() { save(); qDeleteAll( data.profiles.values() ); data.profiles.clear(); delete pPluginLoader; delete pTagEngine; delete pConversionOptionsManager; } void Config::load() { QTime time; time.start(); QStringList formats; KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "General" ); data.app.configVersion = group.readEntry( "configVersion", 0 ); data.general.startTab = group.readEntry( "startTab", 0 ); data.general.lastTab = group.readEntry( "lastTab", 0 ); data.general.defaultProfile = group.readEntry( "defaultProfile", i18n("Last used") ); data.general.lastProfile = group.readEntry( "lastProfile", i18n("High") ); data.general.defaultFormat = group.readEntry( "defaultFormat", i18n("Last used") ); data.general.lastFormat = group.readEntry( "lastFormat", "ogg vorbis" ); data.general.lastOutputDirectoryMode = group.readEntry( "lastOutputDirectoryMode", 0 ); data.general.specifyOutputDirectory = group.readEntry( "specifyOutputDirectory", QDir::homePath() + "/soundKonverter" ); data.general.metaDataOutputDirectory = group.readEntry( "metaDataOutputDirectory", QDir::homePath() + "/soundKonverter/%b/%d - %n - %a - %t" ); data.general.copyStructureOutputDirectory = group.readEntry( "copyStructureOutputDirectory", QDir::homePath() + "/soundKonverter" ); data.general.lastMetaDataOutputDirectoryPaths = group.readEntry( "lastMetaDataOutputDirectoryPaths", QStringList() ); data.general.lastNormalOutputDirectoryPaths = group.readEntry( "lastNormalOutputDirectoryPaths", QStringList() ); data.general.waitForAlbumGain = group.readEntry( "waitForAlbumGain", true ); data.general.useVFATNames = group.readEntry( "useVFATNames", false ); data.general.writeLogFiles = group.readEntry( "writeLogFiles", false ); data.general.conflictHandling = (Config::Data::General::ConflictHandling)group.readEntry( "conflictHandling", 0 ); // data.general.priority = group.readEntry( "priority", 10 ); data.general.numFiles = group.readEntry( "numFiles", 0 ); data.general.numReplayGainFiles = group.readEntry( "numReplayGainFiles", 0 ); if( data.general.numFiles == 0 || data.general.numReplayGainFiles == 0 ) { QList processors = Solid::Device::listFromType(Solid::DeviceInterface::Processor, QString()); const int num = processors.count() > 0 ? processors.count() : 1; if( data.general.numFiles == 0 ) data.general.numFiles = num; if( data.general.numReplayGainFiles == 0 ) data.general.numReplayGainFiles = num; } // data.general.executeUserScript = group.readEntry( "executeUserScript", false ); // data.general.showToolBar = group.readEntry( "showToolBar", false ); // data.general.outputFilePermissions = group.readEntry( "outputFilePermissions", 644 ); data.general.actionMenuConvertMimeTypes = group.readEntry( "actionMenuConvertMimeTypes", QStringList() ); data.general.actionMenuReplayGainMimeTypes = group.readEntry( "actionMenuReplayGainMimeTypes", QStringList() ); data.general.replayGainGrouping = (Config::Data::General::ReplayGainGrouping)group.readEntry( "replayGainGrouping", 0 ); data.general.preferredOggVorbisExtension = group.readEntry( "preferredOggVorbisExtension", "ogg" ); data.general.preferredVorbisCommentCommentTag = group.readEntry( "preferredVorbisCommentCommentTag", "DESCRIPTION" ); data.general.preferredVorbisCommentTrackTotalTag = group.readEntry( "preferredVorbisCommentTrackTotalTag", "TRACKTOTAL" ); data.general.preferredVorbisCommentDiscTotalTag = group.readEntry( "preferredVorbisCommentDiscTotalTag", "DISCTOTAL" ); // due to a bug lastNormalOutputDirectoryPaths could have more than 5 items while( data.general.lastNormalOutputDirectoryPaths.count() > 5 ) data.general.lastNormalOutputDirectoryPaths.takeLast(); group = conf->group( "Advanced" ); data.advanced.useSharedMemoryForTempFiles = group.readEntry( "useSharedMemoryForTempFiles", false ); data.advanced.sharedMemorySize = 0; if( QFile::exists("/dev/shm") ) { system("df -B 1M /dev/shm | tail -1 > /dev/shm/soundkonverter_shm_size"); QFile chkdf("/dev/shm/soundkonverter_shm_size"); if( chkdf.open(QIODevice::ReadOnly|QIODevice::Text) ) { QTextStream t( &chkdf ); QString s = t.readLine(); QRegExp rxlen( "^(?:\\S+)(?:\\s+)(?:\\s+)(\\d+)(?:\\s+)(\\d+)(?:\\s+)(\\d+)(?:\\s+)(\\d+)" ); if( s.contains(rxlen) ) { data.advanced.sharedMemorySize = rxlen.cap(1).toInt(); } chkdf.close(); } chkdf.remove(); } data.advanced.maxSizeForSharedMemoryTempFiles = group.readEntry( "maxSizeForSharedMemoryTempFiles", data.advanced.sharedMemorySize / 4 ); data.advanced.usePipes = group.readEntry( "usePipes", false ); data.advanced.ejectCdAfterRip = group.readEntry( "ejectCdAfterRip", true ); group = conf->group( "CoverArt" ); data.coverArt.writeCovers = group.readEntry( "writeCovers", 1 ); data.coverArt.writeCoverName = group.readEntry( "writeCoverName", 0 ); data.coverArt.writeCoverDefaultName = group.readEntry( "writeCoverDefaultName", i18nc("cover file name","cover") ); group = conf->group( "Backends" ); formats = group.readEntry( "formats", QStringList() ); foreach( const QString format, formats ) { CodecData codecData; codecData.codecName = format; codecData.encoders = group.readEntry( format + "_encoders", QStringList() ); codecData.decoders = group.readEntry( format + "_decoders", QStringList() ); codecData.replaygain = group.readEntry( format + "_replaygain", QStringList() ); data.backends.codecs += codecData; } data.backends.filters = group.readEntry( "filters", QStringList() ); data.backends.enabledFilters = group.readEntry( "enabledFilters", QStringList() ); pPluginLoader->load(); QString pluginName; QStringList enabledPlugins; QStringList newPlugins; int codecIndex; formats = pPluginLoader->formatList( PluginLoader::Possibilities(PluginLoader::Encode|PluginLoader::Decode|PluginLoader::ReplayGain), PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy|PluginLoader::Lossless|PluginLoader::Hybrid) ); // build default backend priority list foreach( const QString format, formats ) { if( format == "wav" ) continue; // get the index of the format in the data.backends.codecs list for direct access codecIndex = -1; for( int i=0; iconversionFilterPipeTrunks ) { if( trunk.codecTo == format && trunk.enabled ) { pluginName = trunk.plugin->name(); enabledPlugins += pluginName; if( !data.backends.codecs.at(codecIndex).encoders.contains(pluginName) && newPlugins.filter(QRegExp("[0-9]{8,8}"+pluginName)).count()==0 ) { newPlugins += QString::number(trunk.rating).rightJustified(8,'0') + pluginName; } } } // remove plugins from the encoder list if they aren't enabled any more for( int i=0; i=0; i-- ) // QStringList doesn't support sorting in descending order { data.backends.codecs[codecIndex].encoders += newPlugins.at(i).right(newPlugins.at(i).length()-8); } // decoders enabledPlugins.clear(); newPlugins.clear(); // register existing enabled plugins as such and list new enabled plugins foreach( const ConversionPipeTrunk trunk, pPluginLoader->conversionFilterPipeTrunks ) { if( trunk.codecFrom == format && trunk.enabled ) { pluginName = trunk.plugin->name(); enabledPlugins += pluginName; if( !data.backends.codecs.at(codecIndex).decoders.contains(pluginName) && newPlugins.filter(QRegExp("[0-9]{8,8}"+pluginName)).count()==0 ) { newPlugins += QString::number(trunk.rating).rightJustified(8,'0') + pluginName; } } } // remove plugins from the decoder list if they aren't enabled any more for( int i=0; i=0; i-- ) // QStringList doesn't support sorting in descending order { data.backends.codecs[codecIndex].decoders += newPlugins.at(i).right(newPlugins.at(i).length()-8); } // replaygain enabledPlugins.clear(); const bool internalReplayGainEnabled = pPluginLoader->hasCodecInternalReplayGain(format); if( internalReplayGainEnabled ) { enabledPlugins += i18n("Try internal"); } newPlugins.clear(); // register existing enabled plugins as such and list new enabled plugins foreach( const ReplayGainPipe pipe, pPluginLoader->replaygainPipes ) { if( pipe.codecName == format && pipe.enabled ) { pluginName = pipe.plugin->name(); enabledPlugins += pluginName; if( !data.backends.codecs.at(codecIndex).replaygain.contains(pluginName) && newPlugins.filter(QRegExp("[0-9]{8,8}"+pluginName)).count()==0 ) { newPlugins += QString::number(pipe.rating).rightJustified(8,'0') + pluginName; } } } // remove plugins from the replay gain list if they aren't enabled any more for( int i=0; i=0; i-- ) // QStringList doesn't support sorting in descending order { data.backends.codecs[codecIndex].replaygain += newPlugins.at(i).right(newPlugins.at(i).length()-8); } } // filters enabledPlugins.clear(); newPlugins.clear(); // register existing enabled plugins as such and list new enabled plugins foreach( FilterPlugin *plugin, pPluginLoader->getAllFilterPlugins() ) { pluginName = plugin->name(); foreach( const ConversionPipeTrunk trunk, plugin->codecTable() ) { if( trunk.enabled && trunk.codecFrom == "wav" && trunk.codecTo == "wav" ) { enabledPlugins += pluginName; if( !data.backends.filters.contains(pluginName) && newPlugins.filter(QRegExp("[0-9]{8,8}"+pluginName)).count()==0 ) { newPlugins += QString::number(trunk.rating).rightJustified(8,'0') + pluginName; break; } } } } // remove plugins from the filter list if they aren't enabled any more for( int i=0; i=0; i-- ) // QStringList doesn't support sorting in descending order { data.backends.filters += newPlugins.at(i).right(newPlugins.at(i).length()-8); } // since filters can be completely disabled we have to keep track of data.backends.enabledFilters as well // remove plugins from the enabledFilters list if they aren't enabled any more for( int i=0; i 0 ) { data.backends.enabledFilters.append( data.backends.filters.first() ); } logger->log( 1000, "\nloading profiles ..." ); QFile listFile( KStandardDirs::locateLocal("data","soundkonverter/profiles.xml") ); if( listFile.open( QIODevice::ReadOnly ) ) { QDomDocument list("soundkonverter_profilelist"); if( list.setContent( &listFile ) ) { QDomElement root = list.documentElement(); if( root.nodeName() == "soundkonverter" && root.attribute("type") == "profilelist" ) { QDomNodeList conversionOptionsElements = root.elementsByTagName("conversionOptions"); for( int i=0; i filterOptionsElements; const QString profileName = conversionOptionsElements.at(i).toElement().attribute("profileName"); const QString pluginName = conversionOptionsElements.at(i).toElement().attribute("pluginName"); CodecPlugin *plugin = (CodecPlugin*)pPluginLoader->backendPluginByName( pluginName ); if( plugin ) { conversionOptions = plugin->conversionOptionsFromXml( conversionOptionsElements.at(i).toElement(), &filterOptionsElements ); } else { logger->log( 1000, "\tname: " + profileName + ", plugin: " + pluginName ); logger->log( 1000, "\t\tcannot be loaded beacause the plugin cannot be found" ); continue; } if( conversionOptions ) { foreach( QDomElement filterOptionsElement, filterOptionsElements ) { FilterOptions *filterOptions = 0; const QString filterPluginName = filterOptionsElement.attribute("pluginName"); FilterPlugin *filterPlugin = (FilterPlugin*)pPluginLoader->backendPluginByName( filterPluginName ); if( filterPlugin ) { filterOptions = filterPlugin->filterOptionsFromXml( filterOptionsElement ); } else { logger->log( 1000, "\tcannot load filter for profile: " + profileName ); continue; } conversionOptions->filterOptions.append( filterOptions ); } } if( conversionOptions ) { data.profiles[profileName] = conversionOptions; if( profileName != "soundkonverter_last_used" ) logger->log( 1000, "\tname: " + profileName + ", plugin: " + pluginName ); } } } } listFile.close(); } logger->log( 1000, "... all profiles loaded\n" ); QString profile; QStringList sFormat; QStringList sProfile; sProfile += i18n("Last used"); sProfile += i18n("Very low"); sProfile += i18n("Low"); sProfile += i18n("Medium"); sProfile += i18n("High"); sProfile += i18n("Very high"); sProfile += i18n("Lossless"); sProfile += i18n("Hybrid"); sProfile += customProfiles(); if( sProfile.indexOf(data.general.defaultProfile) == -1 ) { data.general.defaultProfile = i18n("High"); } else { profile = data.general.defaultProfile; if( profile == i18n("Very low") || profile == i18n("Low") || profile == i18n("Medium") || profile == i18n("High") || profile == i18n("Very high") ) { sFormat = pPluginLoader->formatList(PluginLoader::Encode,PluginLoader::Lossy); } else if( profile == i18n("Lossless") ) { sFormat = pPluginLoader->formatList(PluginLoader::Encode,PluginLoader::Lossless); } else if( profile == i18n("Hybrid") ) { sFormat = pPluginLoader->formatList(PluginLoader::Encode,PluginLoader::Hybrid); } else if( profile == i18n("User defined") ) { sFormat = pPluginLoader->formatList(PluginLoader::Encode,PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy|PluginLoader::Lossless|PluginLoader::Hybrid)); } else { ConversionOptions *conversionOptions = data.profiles.value( profile ); if( conversionOptions ) sFormat += conversionOptions->codecName; } if( sFormat.indexOf(data.general.defaultFormat) == -1 ) { data.general.defaultFormat = i18n("Last used"); } } group = conf->group( "BackendOptimizationsIgnoreList" ); const int backendOptimizationsIgnoreListCount = group.readEntry( "count", 0 ); CodecOptimizations::Optimization optimization; for( int i=0; ilog( 1000, QString("loading of the configuration took %1 ms").arg(time.elapsed()) ); } void Config::save() { writeServiceMenu(); KSharedConfig::Ptr conf = KGlobal::config(); KConfigGroup group; group = conf->group( "General" ); group.writeEntry( "configVersion", SOUNDKONVERTER_VERSION_NUMBER ); group.writeEntry( "startTab", data.general.startTab ); group.writeEntry( "lastTab", data.general.lastTab ); group.writeEntry( "defaultProfile", data.general.defaultProfile ); group.writeEntry( "lastProfile", data.general.lastProfile ); group.writeEntry( "defaultFormat", data.general.defaultFormat ); group.writeEntry( "lastFormat", data.general.lastFormat ); group.writeEntry( "lastOutputDirectoryMode", data.general.lastOutputDirectoryMode ); group.writeEntry( "specifyOutputDirectory", data.general.specifyOutputDirectory ); group.writeEntry( "metaDataOutputDirectory", data.general.metaDataOutputDirectory ); group.writeEntry( "copyStructureOutputDirectory", data.general.copyStructureOutputDirectory ); group.writeEntry( "lastMetaDataOutputDirectoryPaths", data.general.lastMetaDataOutputDirectoryPaths ); group.writeEntry( "lastNormalOutputDirectoryPaths", data.general.lastNormalOutputDirectoryPaths ); group.writeEntry( "waitForAlbumGain", data.general.waitForAlbumGain ); group.writeEntry( "useVFATNames", data.general.useVFATNames ); group.writeEntry( "writeLogFiles", data.general.writeLogFiles ); group.writeEntry( "conflictHandling", (int)data.general.conflictHandling ); // group.writeEntry( "priority", data.general.priority ); group.writeEntry( "numFiles", data.general.numFiles ); group.writeEntry( "numReplayGainFiles", data.general.numReplayGainFiles ); // group.writeEntry( "executeUserScript", data.general.executeUserScript ); // group.writeEntry( "showToolBar", data.general.showToolBar ); // group.writeEntry( "outputFilePermissions", data.general.outputFilePermissions ); group.writeEntry( "actionMenuConvertMimeTypes", data.general.actionMenuConvertMimeTypes ); group.writeEntry( "actionMenuReplayGainMimeTypes", data.general.actionMenuReplayGainMimeTypes ); group.writeEntry( "replayGainGrouping", (int)data.general.replayGainGrouping ); group.writeEntry( "preferredOggVorbisExtension", data.general.preferredOggVorbisExtension ); group.writeEntry( "preferredVorbisCommentCommentTag", data.general.preferredVorbisCommentCommentTag ); group.writeEntry( "preferredVorbisCommentTrackTotalTag", data.general.preferredVorbisCommentTrackTotalTag ); group.writeEntry( "preferredVorbisCommentDiscTotalTag", data.general.preferredVorbisCommentDiscTotalTag ); group = conf->group( "Advanced" ); group.writeEntry( "useSharedMemoryForTempFiles", data.advanced.useSharedMemoryForTempFiles ); group.writeEntry( "maxSizeForSharedMemoryTempFiles", data.advanced.maxSizeForSharedMemoryTempFiles ); group.writeEntry( "usePipes", data.advanced.usePipes ); group.writeEntry( "ejectCdAfterRip", data.advanced.ejectCdAfterRip ); group = conf->group( "CoverArt" ); group.writeEntry( "writeCovers", data.coverArt.writeCovers ); group.writeEntry( "writeCoverName", data.coverArt.writeCoverName ); group.writeEntry( "writeCoverDefaultName", data.coverArt.writeCoverDefaultName ); group = conf->group( "Backends" ); group.deleteEntry( "rippers" ); QStringList formats; foreach( const CodecData codec, data.backends.codecs ) { const QString format = codec.codecName; group.writeEntry( format + "_encoders", codec.encoders ); group.writeEntry( format + "_decoders", codec.decoders ); group.writeEntry( format + "_replaygain", codec.replaygain ); formats += format; } group.writeEntry( "formats", formats ); group.writeEntry( "filters", data.backends.filters ); group.writeEntry( "enabledFilters", data.backends.enabledFilters ); group = conf->group( "BackendOptimizationsIgnoreList" ); group.writeEntry( "count", data.backendOptimizationsIgnoreList.optimizationList.count() ); for( int i=0; iformatList( PluginLoader::Decode, PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy|PluginLoader::Lossless|PluginLoader::Hybrid) ); mimeTypes.clear(); foreach( const QString format, convertFormats ) { mimeTypes += pPluginLoader->codecMimeTypes( format ); } content += "ServiceTypes=KonqPopupMenu/Plugin," + mimeTypes.join(",") + "\n"; content += "Icon=soundkonverter\n"; content += "Actions=ConvertWithSoundkonverter;\n\n"; content += "[Desktop Action ConvertWithSoundkonverter]\n"; content += "Name="+i18n("Convert with soundKonverter")+"\n"; content += "Icon=soundkonverter\n"; content += "Exec=soundkonverter %F\n"; const QString convertActionFileName = KStandardDirs::locateLocal( "services", "ServiceMenus/convert_with_soundkonverter.desktop" ); if( ( data.general.actionMenuConvertMimeTypes != mimeTypes || !QFile::exists(convertActionFileName) ) && mimeTypes.count() > 0 ) { QFile convertActionFile( convertActionFileName ); if( convertActionFile.open( QIODevice::WriteOnly | QIODevice::Text ) ) { QTextStream convertActionStream( &convertActionFile ); convertActionStream << content; convertActionFile.close(); } data.general.actionMenuConvertMimeTypes = mimeTypes; } content = ""; content += "[Desktop Entry]\n"; content += "Type=Service\n"; content += "Encoding=UTF-8\n"; const QStringList replaygainFormats = pPluginLoader->formatList( PluginLoader::ReplayGain, PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy|PluginLoader::Lossless|PluginLoader::Hybrid) ); mimeTypes.clear(); foreach( const QString format, replaygainFormats ) { mimeTypes += pPluginLoader->codecMimeTypes( format ); } content += "ServiceTypes=KonqPopupMenu/Plugin," + mimeTypes.join(",") + "\n"; content += "Icon=soundkonverter_replaygain\n"; content += "Actions=AddReplayGainWithSoundkonverter;\n\n"; content += "[Desktop Action AddReplayGainWithSoundkonverter]\n"; content += "Name="+i18n("Add Replay Gain with soundKonverter")+"\n"; content += "Icon=soundkonverter-replaygain\n"; content += "Exec=soundkonverter --replaygain %F\n"; const QString replaygainActionFileName = KStandardDirs::locateLocal( "services", "ServiceMenus/add_replaygain_with_soundkonverter.desktop" ); if( ( data.general.actionMenuReplayGainMimeTypes != mimeTypes || !QFile::exists(replaygainActionFileName) ) && mimeTypes.count() > 0 ) { QFile replaygainActionFile( replaygainActionFileName ); if( replaygainActionFile.open( QIODevice::WriteOnly | QIODevice::Text ) ) { QTextStream replaygainActionStream( &replaygainActionFile ); replaygainActionStream << content; replaygainActionFile.close(); } data.general.actionMenuReplayGainMimeTypes = mimeTypes; } } QStringList Config::customProfiles() { QStringList profiles; foreach( const QString profileName, data.profiles.keys() ) { if( profileName == "soundkonverter_last_used" ) continue; QList plugins = pPluginLoader->encodersForCodec( data.profiles.value(profileName)->codecName ); foreach( CodecPlugin *plugin, plugins ) { if( plugin->name() == data.profiles.value(profileName)->pluginName ) { profiles.append( profileName ); break; } } } return profiles; } QList Config::getOptimizations( bool includeIgnored ) { QTime time; time.start(); QList optimizationList; CodecOptimizations::Optimization optimization; QStringList tempPluginList; QStringList optimizedPluginList; int currentBackendRating = 0; int betterBackendRating = 0; int codecIndex; bool ignore; const QStringList formats = pPluginLoader->formatList( PluginLoader::Possibilities(PluginLoader::Encode|PluginLoader::Decode|PluginLoader::ReplayGain), PluginLoader::CompressionType(PluginLoader::InferiorQuality|PluginLoader::Lossy|PluginLoader::Lossless|PluginLoader::Hybrid) ); foreach( const QString format, formats ) { if( format == "wav" ) continue; codecIndex = -1; for( int j=0; jconversionPipeTrunks.count(); j++ ) { if( pPluginLoader->conversionPipeTrunks.at(j).codecTo == format && pPluginLoader->conversionPipeTrunks.at(j).enabled && pPluginLoader->conversionPipeTrunks.at(j).plugin->type() == "codec" ) { const QString pluginName = pPluginLoader->conversionPipeTrunks.at(j).plugin->name(); if( tempPluginList.filter(QRegExp("[0-9]{8,8}"+pluginName)).count() == 0 ) { tempPluginList += QString::number(pPluginLoader->conversionPipeTrunks.at(j).rating).rightJustified(8,'0') + pluginName; } } } for( int j=0; jfilterPipeTrunks.count(); j++ ) { if( pPluginLoader->filterPipeTrunks.at(j).codecTo == format && pPluginLoader->filterPipeTrunks.at(j).enabled && pPluginLoader->filterPipeTrunks.at(j).plugin->type() == "filter" ) { const QString pluginName = pPluginLoader->filterPipeTrunks.at(j).plugin->name(); if( tempPluginList.filter(QRegExp("[0-9]{8,8}"+pluginName)).count() == 0 ) { tempPluginList += QString::number(pPluginLoader->filterPipeTrunks.at(j).rating).rightJustified(8,'0') + pluginName; } } } tempPluginList.sort(); optimizedPluginList.clear(); for( int j=tempPluginList.count()-1; j>=0; j-- ) { const QString pluginName = tempPluginList.at(j).right(tempPluginList.at(j).length()-8); const int pluginRating = tempPluginList.at(j).left(8).toInt(); optimizedPluginList += pluginName; if( data.backends.codecs.at(codecIndex).encoders.count() > 0 && pluginName == data.backends.codecs.at(codecIndex).encoders.first() ) { currentBackendRating = pluginRating; } if( j == tempPluginList.count()-1 ) { betterBackendRating = pluginRating; } } if( optimizedPluginList.count() != 0 && data.backends.codecs.at(codecIndex).encoders.count() != 0 ) { ignore = false; for( int j=0; j currentBackendRating ) { if( ignore && includeIgnored ) { optimization.codecName = format; optimization.mode = CodecOptimizations::Optimization::Encode; optimization.currentBackend = data.backends.codecs.at(codecIndex).encoders.first(); optimization.betterBackend = optimizedPluginList.first(); optimization.solution = CodecOptimizations::Optimization::Ignore; optimizationList.append(optimization); } else if( !ignore ) { optimization.codecName = format; optimization.mode = CodecOptimizations::Optimization::Encode; optimization.currentBackend = data.backends.codecs.at(codecIndex).encoders.first(); optimization.betterBackend = optimizedPluginList.first(); optimization.solution = CodecOptimizations::Optimization::Undecided; optimizationList.append(optimization); } } } // decoders tempPluginList.clear(); for( int j=0; jconversionPipeTrunks.count(); j++ ) { if( pPluginLoader->conversionPipeTrunks.at(j).codecFrom == format && pPluginLoader->conversionPipeTrunks.at(j).enabled && pPluginLoader->conversionPipeTrunks.at(j).plugin->type() == "codec" ) { const QString pluginName = pPluginLoader->conversionPipeTrunks.at(j).plugin->name(); if( tempPluginList.filter(QRegExp("[0-9]{8,8}"+pluginName)).count() == 0 ) { tempPluginList += QString::number(pPluginLoader->conversionPipeTrunks.at(j).rating).rightJustified(8,'0') + pluginName; } } } for( int j=0; jfilterPipeTrunks.count(); j++ ) { if( pPluginLoader->filterPipeTrunks.at(j).codecFrom == format && pPluginLoader->filterPipeTrunks.at(j).enabled && pPluginLoader->filterPipeTrunks.at(j).plugin->type() == "filter" ) { const QString pluginName = pPluginLoader->filterPipeTrunks.at(j).plugin->name(); if( tempPluginList.filter(QRegExp("[0-9]{8,8}"+pluginName)).count() == 0 ) { tempPluginList += QString::number(pPluginLoader->filterPipeTrunks.at(j).rating).rightJustified(8,'0') + pluginName; } } } tempPluginList.sort(); optimizedPluginList.clear(); for( int j=tempPluginList.count()-1; j>=0; j-- ) { const QString pluginName = tempPluginList.at(j).right(tempPluginList.at(j).length()-8); const int pluginRating = tempPluginList.at(j).left(8).toInt(); optimizedPluginList += pluginName; if( data.backends.codecs.at(codecIndex).decoders.count() > 0 && pluginName == data.backends.codecs.at(codecIndex).decoders.first() ) { currentBackendRating = pluginRating; } if( j == tempPluginList.count()-1 ) { betterBackendRating = pluginRating; } } if( optimizedPluginList.count() != 0 && data.backends.codecs.at(codecIndex).decoders.count() != 0 ) { ignore = false; for( int j=0; j currentBackendRating ) { if( ignore && includeIgnored ) { optimization.codecName = format; optimization.mode = CodecOptimizations::Optimization::Decode; optimization.currentBackend = data.backends.codecs.at(codecIndex).decoders.first(); optimization.betterBackend = optimizedPluginList.first(); optimization.solution = CodecOptimizations::Optimization::Ignore; optimizationList.append(optimization); } else if( !ignore ) { optimization.codecName = format; optimization.mode = CodecOptimizations::Optimization::Decode; optimization.currentBackend = data.backends.codecs.at(codecIndex).decoders.first(); optimization.betterBackend = optimizedPluginList.first(); optimization.solution = CodecOptimizations::Optimization::Undecided; optimizationList.append(optimization); } } } // replaygain tempPluginList.clear(); for( int j=0; jreplaygainPipes.count(); j++ ) { if( pPluginLoader->replaygainPipes.at(j).codecName == format && pPluginLoader->replaygainPipes.at(j).enabled ) { const QString pluginName = pPluginLoader->replaygainPipes.at(j).plugin->name(); if( tempPluginList.filter(QRegExp("[0-9]{8,8}"+pluginName)).count() == 0 ) { tempPluginList += QString::number(pPluginLoader->replaygainPipes.at(j).rating).rightJustified(8,'0') + pluginName; } } } tempPluginList.sort(); optimizedPluginList.clear(); for( int j=tempPluginList.count()-1; j>=0; j-- ) { const QString pluginName = tempPluginList.at(j).right(tempPluginList.at(j).length()-8); const int pluginRating = tempPluginList.at(j).left(8).toInt(); optimizedPluginList += pluginName; if( data.backends.codecs.at(codecIndex).replaygain.count() > 0 && pluginName == data.backends.codecs.at(codecIndex).replaygain.first() ) { currentBackendRating = pluginRating; } if( j == tempPluginList.count()-1 ) { betterBackendRating = pluginRating; } } if( optimizedPluginList.count() != 0 && data.backends.codecs.at(codecIndex).replaygain.count() != 0 ) { ignore = false; for( int j=0; j currentBackendRating ) { if( ignore && includeIgnored ) { optimization.codecName = format; optimization.mode = CodecOptimizations::Optimization::ReplayGain; optimization.currentBackend = data.backends.codecs.at(codecIndex).replaygain.first(); optimization.betterBackend = optimizedPluginList.first(); optimization.solution = CodecOptimizations::Optimization::Ignore; optimizationList.append(optimization); } else if( !ignore ) { optimization.codecName = format; optimization.mode = CodecOptimizations::Optimization::ReplayGain; optimization.currentBackend = data.backends.codecs.at(codecIndex).replaygain.first(); optimization.betterBackend = optimizedPluginList.first(); optimization.solution = CodecOptimizations::Optimization::Undecided; optimizationList.append(optimization); } } } } logger->log( 1000, QString("generation of the optimization list took %1 ms").arg(time.elapsed()) ); return optimizationList; } void Config::doOptimizations( const QList& optimizationList ) { int codecIndex; for( int i=0; i