Debian Codegraph @

src/core/capabilities/TranscodeCapability.h

raw
1 /****************************************************************************************
2 * Copyright (c) 2012 Matěj Laitl <[email protected]> *
3 * *
4 * This program is free software; you can redistribute it and/or modify it under *
5 * the terms of the GNU General Public License as published by the Free Software *
6 * Foundation; either version 2 of the License, or (at your option) any later *
7 * version. *
8 * *
9 * This program is distributed in the hope that it will be useful, but WITHOUT ANY *
10 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A *
11 * PARTICULAR PURPOSE. See the GNU General Public License for more details. *
12 * *
13 * You should have received a copy of the GNU General Public License along with *
14 * this program. If not, see <http://www.gnu.org/licenses/>. *
15 ****************************************************************************************/
16
17 #ifndef TRANSCODECAPABILITY_H
18 #define TRANSCODECAPABILITY_H
19
20 #include "core/amarokcore_export.h"
21 #include "core/capabilities/Capability.h"
22 #include "core/transcoding/TranscodingConfiguration.h"
23
24 #include <QStringList>
25
26 namespace Capabilities
27 {
28
29 /**
30 * Collections whose CollectionLocation supports transcoding (e.g. it doesn't ignore
31 * Transcoding::Configuration configuration parameter in copyUrlsToCollection())
32 * can and should provide this capability so that core CollectionLocation methods can
33 * ask user whether she wants to just copy/move or transcode tracks when
34 * copying/moving/dragging them to destination collection.
35 *
36 * If your collection doesn't support transcoding (not implemented or just
37 * temporarily), you should not (temporarily) provide this capability.
38 *
39 * @author Matěj Laitl <[email protected]>
40 */
41 class AMAROKCORE_EXPORT TranscodeCapability : public Capability
42 {
43 Q_OBJECT
44
45 public:
46 ~TranscodeCapability() override;
47
48 /**
49 * Return a list of file types (should be compatible with Meta::Track::type())
50 * that your collection is able to play. This is used to disable transcoding
51 * to formats that wouldn't be playable; if your collection is a portable player
52 * that can only play ogg vorbis and flac, you would return
53 * QStringList() << "ogg" << "flac";
54 *
55 * In order not to suck users, "plain copy" option is always available
56 * regardless of what this method returns.
57 *
58 * Return value of empty QStringList() is special and means that there should
59 * be no restriction on enabled transcoders. Default implementation returns
60 * this value.
61 */
62 virtual QStringList playableFileTypes() { return QStringList(); }
63
64 /**
65 * Return configuration previously saved using setSavedConfiguration() or invalid
66 * configuration if there is no configuration saved.
67 */
68 virtual Transcoding::Configuration savedConfiguration() = 0;
69
70 /**
71 * Set saved configuration to @p configuration. An invalid configuration
72 * should be interpreted as an action to unset saved configuration.
73 *
74 * @param configuration the transcoding configuration
75 */
76 virtual void setSavedConfiguration( const Transcoding::Configuration &configuration ) = 0;
77
78 /**
79 * Type of this capability
80 */
81 static Type capabilityInterfaceType() { return Capability::Transcode; }
82 };
83
84 } // napespace Capabilities
85
86 #endif // TRANSCODECAPABILITY_H