Skip to content

Commit 808f649

Browse files
committed
Don't show warning when trying to remove additional fields on tagging systems that don't support them [#316]
1 parent 2ee838d commit 808f649

15 files changed

+62
-3
lines changed

ATL/AudioData/IO/AA.cs

+4
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ protected override MetaDataIOFactory.TagType getImplementedTagType()
168168
return MetaDataIOFactory.TagType.NATIVE;
169169
}
170170
/// <inheritdoc/>
171+
protected override bool supportsPictures => true;
172+
/// <inheritdoc/>
173+
protected override bool supportsAdditionalFields => true;
174+
/// <inheritdoc/>
171175
protected override Field getFrameMapping(string zone, string ID, byte tagVersion)
172176
{
173177
Field supportedMetaId = Field.NO_FIELD;

ATL/AudioData/IO/AIFF.cs

+2
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ public AudioFormat AudioFormat
114114
}
115115
/// <inheritdoc/>
116116
public bool IsNativeMetadataRich => false;
117+
/// <inheritdoc/>
118+
protected override bool supportsAdditionalFields => true;
117119

118120
public long AudioDataOffset { get; set; }
119121
public long AudioDataSize { get; set; }

ATL/AudioData/IO/APEtag.cs

+4
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,10 @@ protected override MetaDataIOFactory.TagType getImplementedTagType()
165165

166166
/// <inheritdoc/>
167167
protected override byte ratingConvention => RC_APE;
168+
/// <inheritdoc/>
169+
protected override bool supportsAdditionalFields => true;
170+
/// <inheritdoc/>
171+
protected override bool supportsPictures => true;
168172

169173
/// <inheritdoc/>
170174
protected override Field getFrameMapping(string zone, string ID, byte tagVersion)

ATL/AudioData/IO/GYM.cs

+2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ class GYM : MetaDataIO, IAudioDataIO
6969
}
7070
/// <inheritdoc/>
7171
public bool IsNativeMetadataRich => false;
72+
/// <inheritdoc/>
73+
protected override bool supportsAdditionalFields => true;
7274

7375
// IMetaDataIO
7476
protected override int getDefaultTagOffset()

ATL/AudioData/IO/ID3v2.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,12 @@ protected override MetaDataIOFactory.TagType getImplementedTagType()
491491
}
492492

493493
/// <inheritdoc/>
494-
public override byte FieldCodeFixedLength => 0; // Actually 3 or 4 when strictly applying ID3v2.3 / ID3v2.4 specs, but thanks to TXXX fields, any code is supported
494+
// Actually 3 or 4 when strictly applying ID3v2.3 / ID3v2.4 specs, but thanks to TXXX fields, any code is supported
495+
public override byte FieldCodeFixedLength => 0;
496+
/// <inheritdoc/>
497+
protected override bool supportsAdditionalFields => true;
498+
/// <inheritdoc/>
499+
protected override bool supportsPictures => true;
495500

496501

497502
// ********************* Auxiliary functions & voids ********************

ATL/AudioData/IO/MKA.cs

+5
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ public AudioFormat AudioFormat
250250

251251
/// <inheritdoc/>
252252
public bool IsNativeMetadataRich => true;
253+
/// <inheritdoc/>
254+
protected override bool supportsAdditionalFields => true;
255+
/// <inheritdoc/>
256+
protected override bool supportsPictures => true;
257+
253258
protected override Field getFrameMapping(string zone, string ID, byte tagVersion)
254259
{
255260
Field supportedMetaId = Field.NO_FIELD;

ATL/AudioData/IO/MP4.cs

+4
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ public bool isValid()
186186
}
187187
/// <inheritdoc/>
188188
public bool IsNativeMetadataRich => true;
189+
/// <inheritdoc/>
190+
protected override bool supportsAdditionalFields => true;
191+
/// <inheritdoc/>
192+
protected override bool supportsPictures => true;
189193
public ChannelsArrangement ChannelsArrangement { get; private set; }
190194

191195
public long AudioDataOffset { get; set; }

ATL/AudioData/IO/PSF.cs

+2
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ public AudioFormat AudioFormat
100100
}
101101
/// <inheritdoc/>
102102
public bool IsNativeMetadataRich => false;
103+
/// <inheritdoc/>
104+
protected override bool supportsAdditionalFields => true;
103105
public long AudioDataOffset { get; set; }
104106
public long AudioDataSize { get; set; }
105107

ATL/AudioData/IO/SPC.cs

+2
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ partial class SPC : MetaDataIO, IAudioDataIO
166166
}
167167
/// <inheritdoc/>
168168
public bool IsNativeMetadataRich => false;
169+
/// <inheritdoc/>
170+
protected override bool supportsAdditionalFields => true;
169171

170172
public long AudioDataOffset { get; set; }
171173
public long AudioDataSize { get; set; }

ATL/AudioData/IO/TwinVQ.cs

+2
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ private sealed class HeaderInfo
106106
}
107107
/// <inheritdoc/>
108108
public bool IsNativeMetadataRich => false;
109+
/// <inheritdoc/>
110+
protected override bool supportsAdditionalFields => true;
109111

110112
public long AudioDataOffset { get; set; }
111113
public long AudioDataSize { get; set; }

ATL/AudioData/IO/VGM.cs

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ class VGM : MetaDataIO, IAudioDataIO
6464
}
6565
/// <inheritdoc/>
6666
public bool IsNativeMetadataRich => false;
67+
/// <inheritdoc/>
68+
protected override bool supportsAdditionalFields => true;
6769

6870
public long AudioDataOffset { get; set; }
6971
public long AudioDataSize { get; set; }

ATL/AudioData/IO/VorbisTag.cs

+5
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ public VorbisTag(bool writePicturesWithMetadata, bool writeMetadataFramingBit, b
116116

117117
protected override byte ratingConvention => RC_APE;
118118

119+
/// <inheritdoc/>
120+
protected override bool supportsAdditionalFields => true;
121+
/// <inheritdoc/>
122+
protected override bool supportsPictures => true;
123+
119124
protected override Field getFrameMapping(string zone, string ID, byte tagVersion)
120125
{
121126
Field supportedMetaId = Field.NO_FIELD;

ATL/AudioData/IO/WAV.cs

+4
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ public AudioFormat AudioFormat
126126
}
127127
/// <inheritdoc/>
128128
public bool IsNativeMetadataRich => false;
129+
/// <inheritdoc/>
130+
protected override bool supportsAdditionalFields => true;
131+
/// <inheritdoc/>
132+
protected override bool supportsPictures => true;
129133

130134
public long AudioDataOffset { get; set; }
131135
public long AudioDataSize { get; set; }

ATL/AudioData/IO/WMA.cs

+4
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ private void Reset()
189189
}
190190
/// <inheritdoc/>
191191
public bool IsNativeMetadataRich => true;
192+
/// <inheritdoc/>
193+
protected override bool supportsAdditionalFields => true;
194+
/// <inheritdoc/>
195+
protected override bool supportsPictures => true;
192196

193197
/// <inheritdoc/>
194198
protected override Field getFrameMapping(string zone, string ID, byte tagVersion)

ATL/AudioData/MetaDataIO.cs

+14-2
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,17 @@ public long Size
174174
/// </summary>
175175
protected virtual byte ratingConvention => RC_ID3v2;
176176

177+
/// <summary>
178+
/// Indicate if the tagging system supports embedded pictures
179+
/// </summary>
180+
protected virtual bool supportsPictures => false;
181+
182+
/// <summary>
183+
/// Indicate if the tagging system supports additional fields
184+
/// NB : Usually true except when the fields are a fixed set
185+
/// </summary>
186+
protected virtual bool supportsAdditionalFields => false;
187+
177188
/// <summary>
178189
/// Encode the given DateTime for the current tagging format
179190
/// </summary>
@@ -462,7 +473,7 @@ public async Task<bool> WriteAsync(Stream s, TagData tag, ProgressToken<float> w
462473
bool result = await surgeon.RewriteZonesAsync(s, writeAdapter, Zones, dataToWrite, Exists);
463474

464475
// Update tag information without calling Read
465-
if (result) tagData.IntegrateValues(dataToWrite);
476+
if (result) tagData.IntegrateValues(dataToWrite, supportsPictures, supportsAdditionalFields);
466477

467478
postprocessWrite(s);
468479

@@ -518,8 +529,9 @@ private TagData prepareWrite(Stream r, TagData tag)
518529
structureHelper.AddZone(0, 0);
519530
}
520531

532+
// Merge existing information + new tag information
521533
var dataToWrite = new TagData(tagData);
522-
dataToWrite.IntegrateValues(tag); // Merge existing information + new tag information
534+
dataToWrite.IntegrateValues(tag, supportsPictures, supportsAdditionalFields);
523535
dataToWrite.Cleanup();
524536

525537
preprocessWrite(dataToWrite);

0 commit comments

Comments
 (0)