Tag Parser: settings.h Source File

Tag Parser 12.5.2 C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags

Loading...
Searching...
No Matches
settings.h
Go to the documentation of this file.
1#ifndef TAGPARSER_SETTINGS_H
2#define TAGPARSER_SETTINGS_H
3
4#include "./tagtarget.h"
5
6#include <c++utilities/misc/flagenumclass.h>
7
8#include <cstdint>
9#include <type_traits>
10
11namespace TagParser {
12
13 enum class ElementPosition {
14 BeforeData,
15 AfterData,
16 Keep,
17};
18
22 enum class TagUsage {
23 Always,
24 KeepExisting,
25 Never,
26};
27
31 enum class TagCreationFlags : std::uint64_t {
32 None = 0,
33 TreatUnknownFilesAsMp3Files = 1 << 0,
34 Id3InitOnCreate = 1 << 1,
35 Id3TransferValuesOnRemoval = 1 << 2,
36 MergeMultipleSuccessiveId3v2Tags = 1 << 3,
37 KeepExistingId3v2Version
38 = 1 << 4,
39};
40
41} // namespace TagParser
42
43CPP_UTILITIES_MARK_FLAG_ENUM_CLASS(TagParser, TagParser::TagCreationFlags);
44
45namespace TagParser {
46
50 struct TagCreationSettings {
52 std::vector<TagTarget> requiredTargets = std::vector<TagTarget>();
54 TagCreationFlags flags = TagCreationFlags::Id3TransferValuesOnRemoval | TagCreationFlags::MergeMultipleSuccessiveId3v2Tags
55 | TagCreationFlags::KeepExistingId3v2Version;
57 TagUsage id3v1usage = TagUsage::KeepExisting;
59 TagUsage id3v2usage = TagUsage::Always;
61 std::uint8_t id3v2MajorVersion = 3;
62
63 // workaround for GGC bug 66297 (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66297)
64#if __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 2)
65 inline
66#else
67 constexpr
68#endif
69 TagCreationSettings &
70 setFlag(TagCreationFlags flag, bool enabled);
71};
72
73#if __GNUC__ < 7 || (__GNUC__ == 7 && __GNUC_MINOR__ < 2)
74inline
75#else
76constexpr
77#endif
78 TagCreationSettings &
79 TagCreationSettings::setFlag(TagCreationFlags flag, bool enabled)
80{
81 if (enabled) {
82 flags += flag;
83 } else {
84 flags -= flag;
85 }
86 return *this;
87}
88
89} // namespace TagParser
90
91#endif // TAGPARSER_SETTINGS_H
TagParser::SubFormats::None
@ None
Definition mediaformat.h:112
TagParser
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10
TagParser::ElementPosition
ElementPosition
Definition settings.h:13
TagParser::ElementPosition::Keep
@ Keep
Definition settings.h:16
TagParser::ElementPosition::BeforeData
@ BeforeData
Definition settings.h:14
TagParser::ElementPosition::AfterData
@ AfterData
Definition settings.h:15
TagParser::TagCreationFlags
TagCreationFlags
The Flags enum contains options to control the tag creation via MediaFileInfo::createAppropriateTags(...
Definition settings.h:31
TagParser::TagCreationFlags::Id3TransferValuesOnRemoval
@ Id3TransferValuesOnRemoval
Definition settings.h:35
TagParser::TagCreationFlags::MergeMultipleSuccessiveId3v2Tags
@ MergeMultipleSuccessiveId3v2Tags
Definition settings.h:36
TagParser::TagCreationFlags::Id3InitOnCreate
@ Id3InitOnCreate
Definition settings.h:34
TagParser::TagCreationFlags::TreatUnknownFilesAsMp3Files
@ TreatUnknownFilesAsMp3Files
Definition settings.h:33
TagParser::TagCreationFlags::KeepExistingId3v2Version
@ KeepExistingId3v2Version
Definition settings.h:37
TagParser::TagUsage
TagUsage
The TagUsage enum specifies the usage of a certain tag type.
Definition settings.h:22
TagParser::TagUsage::KeepExisting
@ KeepExisting
Definition settings.h:24
TagParser::TagUsage::Always
@ Always
Definition settings.h:23
TagParser::TagUsage::Never
@ Never
Definition settings.h:25
CPP_UTILITIES_MARK_FLAG_ENUM_CLASS
CPP_UTILITIES_MARK_FLAG_ENUM_CLASS(TagParser, TagParser::TagCreationFlags)
TagParser::TagCreationSettings
The TagSettings struct contains settings which can be passed to MediaFileInfo::createAppropriateTags(...
Definition settings.h:50
TagParser::TagCreationSettings::requiredTargets
std::vector< TagTarget > requiredTargets
Specifies the required targets. If targets are not supported by the container an informal notificatio...
Definition settings.h:52
TagParser::TagCreationSettings::id3v2MajorVersion
std::uint8_t id3v2MajorVersion
Specifies the ID3v2 version to be used in case an ID3v2 tag present or will be created....
Definition settings.h:61
TagParser::TagCreationSettings::id3v2usage
TagUsage id3v2usage
Specifies the usage of ID3v2 when creating tags for MP3 files (has no effect when the file is no MP3 ...
Definition settings.h:59
TagParser::TagCreationSettings::setFlag
TagCreationSettings & setFlag(TagCreationFlags flag, bool enabled)
Definition settings.h:79
TagParser::TagCreationSettings::flags
TagCreationFlags flags
Specifies options to control the tag creation. See TagSettings::Flags.
Definition settings.h:54
TagParser::TagCreationSettings::id3v1usage
TagUsage id3v1usage
Specifies the usage of ID3v1 when creating tags for MP3 files (has no effect when the file is no MP3 ...
Definition settings.h:57
tagtarget.h