File indexing completed on 2024-05-19 04:49:27
0001 /**************************************************************************************** 0002 * Copyright (c) 2012 Matěj Laitl <matej@laitl.cz> * 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 #ifndef TRANSCODECAPABILITY_H 0018 #define TRANSCODECAPABILITY_H 0019 0020 #include "core/amarokcore_export.h" 0021 #include "core/capabilities/Capability.h" 0022 #include "core/transcoding/TranscodingConfiguration.h" 0023 0024 #include <QStringList> 0025 0026 namespace Capabilities 0027 { 0028 0029 /** 0030 * Collections whose CollectionLocation supports transcoding (e.g. it doesn't ignore 0031 * Transcoding::Configuration configuration parameter in copyUrlsToCollection()) 0032 * can and should provide this capability so that core CollectionLocation methods can 0033 * ask user whether she wants to just copy/move or transcode tracks when 0034 * copying/moving/dragging them to destination collection. 0035 * 0036 * If your collection doesn't support transcoding (not implemented or just 0037 * temporarily), you should not (temporarily) provide this capability. 0038 * 0039 * @author Matěj Laitl <matej@laitl.cz> 0040 */ 0041 class AMAROKCORE_EXPORT TranscodeCapability : public Capability 0042 { 0043 Q_OBJECT 0044 0045 public: 0046 ~TranscodeCapability() override; 0047 0048 /** 0049 * Return a list of file types (should be compatible with Meta::Track::type()) 0050 * that your collection is able to play. This is used to disable transcoding 0051 * to formats that wouldn't be playable; if your collection is a portable player 0052 * that can only play ogg vorbis and flac, you would return 0053 * QStringList() << "ogg" << "flac"; 0054 * 0055 * In order not to suck users, "plain copy" option is always available 0056 * regardless of what this method returns. 0057 * 0058 * Return value of empty QStringList() is special and means that there should 0059 * be no restriction on enabled transcoders. Default implementation returns 0060 * this value. 0061 */ 0062 virtual QStringList playableFileTypes() { return QStringList(); } 0063 0064 /** 0065 * Return configuration previously saved using setSavedConfiguration() or invalid 0066 * configuration if there is no configuration saved. 0067 */ 0068 virtual Transcoding::Configuration savedConfiguration() = 0; 0069 0070 /** 0071 * Set saved configuration to @p configuration. An invalid configuration 0072 * should be interpreted as an action to unset saved configuration. 0073 * 0074 * @param configuration the transcoding configuration 0075 */ 0076 virtual void setSavedConfiguration( const Transcoding::Configuration &configuration ) = 0; 0077 0078 /** 0079 * Type of this capability 0080 */ 0081 static Type capabilityInterfaceType() { return Capability::Transcode; } 0082 }; 0083 0084 } // napespace Capabilities 0085 0086 #endif // TRANSCODECAPABILITY_H