File indexing completed on 2024-06-02 04:52:03

0001 /****************************************************************************************
0002  * Copyright (c) 2010 Téo Mrnjavac <teo@kde.org>                                        *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #include "TranscodingAlacFormat.h"
0018 
0019 #include <KLocalizedString>
0020 
0021 using namespace Transcoding;
0022 
0023 AlacFormat::AlacFormat()
0024 {
0025     m_encoder = ALAC;
0026     m_fileExtension = QStringLiteral("m4a");
0027     //ALAC seems to have absolutely no configurable options whatsoever. Gnomes would love it.
0028 }
0029 
0030 QString
0031 AlacFormat::prettyName() const
0032 {
0033     return i18n( "Apple Lossless" );
0034 }
0035 
0036 QString
0037 AlacFormat::description() const
0038 {
0039     return i18nc( "Feel free to redirect the english Wikipedia link to a local version, if "
0040                   "it exists.",
0041                   "<a href=http://en.wikipedia.org/wiki/Apple_Lossless>Apple Lossless</a> "
0042                   "(ALAC) is an audio codec for lossless compression of digital music.<br>"
0043                   "Recommended only for Apple music players and players that do not support "
0044                   "FLAC." );
0045 }
0046 
0047 QIcon
0048 AlacFormat::icon() const
0049 {
0050     return QIcon::fromTheme( QStringLiteral("audio-x-flac") ); //TODO: get a *real* icon!
0051 }
0052 
0053 QStringList
0054 AlacFormat::ffmpegParameters( const Configuration &configuration ) const
0055 {
0056     Q_UNUSED( configuration )
0057     QStringList parameters;
0058     parameters << QStringLiteral("-acodec") << QStringLiteral("alac");
0059     parameters << QStringLiteral("-vn"); // no album art, writing it to m4a is not supported by ffmpeg
0060     return parameters;
0061 }
0062 
0063 bool
0064 AlacFormat::verifyAvailability( const QString &ffmpegOutput ) const
0065 {
0066     return ffmpegOutput.contains( QRegExp( QStringLiteral("^ .EA... alac +") ) );
0067 }