Skip to content

Commit

Permalink
Don't show warning when trying to remove additional fields on tagging…
Browse files Browse the repository at this point in the history
… systems that don't support them [#316]
  • Loading branch information
Zeugma440 committed Feb 15, 2025
1 parent 2ee838d commit 808f649
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 3 deletions.
4 changes: 4 additions & 0 deletions ATL/AudioData/IO/AA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ protected override MetaDataIOFactory.TagType getImplementedTagType()
return MetaDataIOFactory.TagType.NATIVE;
}
/// <inheritdoc/>
protected override bool supportsPictures => true;
/// <inheritdoc/>
protected override bool supportsAdditionalFields => true;
/// <inheritdoc/>
protected override Field getFrameMapping(string zone, string ID, byte tagVersion)
{
Field supportedMetaId = Field.NO_FIELD;
Expand Down
2 changes: 2 additions & 0 deletions ATL/AudioData/IO/AIFF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ public AudioFormat AudioFormat
}
/// <inheritdoc/>
public bool IsNativeMetadataRich => false;
/// <inheritdoc/>
protected override bool supportsAdditionalFields => true;

public long AudioDataOffset { get; set; }
public long AudioDataSize { get; set; }
Expand Down
4 changes: 4 additions & 0 deletions ATL/AudioData/IO/APEtag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,10 @@ protected override MetaDataIOFactory.TagType getImplementedTagType()

/// <inheritdoc/>
protected override byte ratingConvention => RC_APE;
/// <inheritdoc/>
protected override bool supportsAdditionalFields => true;
/// <inheritdoc/>
protected override bool supportsPictures => true;

/// <inheritdoc/>
protected override Field getFrameMapping(string zone, string ID, byte tagVersion)
Expand Down
2 changes: 2 additions & 0 deletions ATL/AudioData/IO/GYM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ class GYM : MetaDataIO, IAudioDataIO
}
/// <inheritdoc/>
public bool IsNativeMetadataRich => false;
/// <inheritdoc/>
protected override bool supportsAdditionalFields => true;

// IMetaDataIO
protected override int getDefaultTagOffset()
Expand Down
7 changes: 6 additions & 1 deletion ATL/AudioData/IO/ID3v2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,12 @@ protected override MetaDataIOFactory.TagType getImplementedTagType()
}

/// <inheritdoc/>
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
// Actually 3 or 4 when strictly applying ID3v2.3 / ID3v2.4 specs, but thanks to TXXX fields, any code is supported
public override byte FieldCodeFixedLength => 0;
/// <inheritdoc/>
protected override bool supportsAdditionalFields => true;
/// <inheritdoc/>
protected override bool supportsPictures => true;


// ********************* Auxiliary functions & voids ********************
Expand Down
5 changes: 5 additions & 0 deletions ATL/AudioData/IO/MKA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ public AudioFormat AudioFormat

/// <inheritdoc/>
public bool IsNativeMetadataRich => true;
/// <inheritdoc/>
protected override bool supportsAdditionalFields => true;
/// <inheritdoc/>
protected override bool supportsPictures => true;

protected override Field getFrameMapping(string zone, string ID, byte tagVersion)
{
Field supportedMetaId = Field.NO_FIELD;
Expand Down
4 changes: 4 additions & 0 deletions ATL/AudioData/IO/MP4.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ public bool isValid()
}
/// <inheritdoc/>
public bool IsNativeMetadataRich => true;
/// <inheritdoc/>
protected override bool supportsAdditionalFields => true;
/// <inheritdoc/>
protected override bool supportsPictures => true;
public ChannelsArrangement ChannelsArrangement { get; private set; }

public long AudioDataOffset { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions ATL/AudioData/IO/PSF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ public AudioFormat AudioFormat
}
/// <inheritdoc/>
public bool IsNativeMetadataRich => false;
/// <inheritdoc/>
protected override bool supportsAdditionalFields => true;
public long AudioDataOffset { get; set; }
public long AudioDataSize { get; set; }

Expand Down
2 changes: 2 additions & 0 deletions ATL/AudioData/IO/SPC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ partial class SPC : MetaDataIO, IAudioDataIO
}
/// <inheritdoc/>
public bool IsNativeMetadataRich => false;
/// <inheritdoc/>
protected override bool supportsAdditionalFields => true;

public long AudioDataOffset { get; set; }
public long AudioDataSize { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions ATL/AudioData/IO/TwinVQ.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ private sealed class HeaderInfo
}
/// <inheritdoc/>
public bool IsNativeMetadataRich => false;
/// <inheritdoc/>
protected override bool supportsAdditionalFields => true;

public long AudioDataOffset { get; set; }
public long AudioDataSize { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions ATL/AudioData/IO/VGM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class VGM : MetaDataIO, IAudioDataIO
}
/// <inheritdoc/>
public bool IsNativeMetadataRich => false;
/// <inheritdoc/>
protected override bool supportsAdditionalFields => true;

public long AudioDataOffset { get; set; }
public long AudioDataSize { get; set; }
Expand Down
5 changes: 5 additions & 0 deletions ATL/AudioData/IO/VorbisTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ public VorbisTag(bool writePicturesWithMetadata, bool writeMetadataFramingBit, b

protected override byte ratingConvention => RC_APE;

/// <inheritdoc/>
protected override bool supportsAdditionalFields => true;
/// <inheritdoc/>
protected override bool supportsPictures => true;

protected override Field getFrameMapping(string zone, string ID, byte tagVersion)
{
Field supportedMetaId = Field.NO_FIELD;
Expand Down
4 changes: 4 additions & 0 deletions ATL/AudioData/IO/WAV.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ public AudioFormat AudioFormat
}
/// <inheritdoc/>
public bool IsNativeMetadataRich => false;
/// <inheritdoc/>
protected override bool supportsAdditionalFields => true;
/// <inheritdoc/>
protected override bool supportsPictures => true;

public long AudioDataOffset { get; set; }
public long AudioDataSize { get; set; }
Expand Down
4 changes: 4 additions & 0 deletions ATL/AudioData/IO/WMA.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ private void Reset()
}
/// <inheritdoc/>
public bool IsNativeMetadataRich => true;
/// <inheritdoc/>
protected override bool supportsAdditionalFields => true;
/// <inheritdoc/>
protected override bool supportsPictures => true;

/// <inheritdoc/>
protected override Field getFrameMapping(string zone, string ID, byte tagVersion)
Expand Down
16 changes: 14 additions & 2 deletions ATL/AudioData/MetaDataIO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,17 @@ public long Size
/// </summary>
protected virtual byte ratingConvention => RC_ID3v2;

/// <summary>
/// Indicate if the tagging system supports embedded pictures
/// </summary>
protected virtual bool supportsPictures => false;

/// <summary>
/// Indicate if the tagging system supports additional fields
/// NB : Usually true except when the fields are a fixed set
/// </summary>
protected virtual bool supportsAdditionalFields => false;

/// <summary>
/// Encode the given DateTime for the current tagging format
/// </summary>
Expand Down Expand Up @@ -462,7 +473,7 @@ public async Task<bool> WriteAsync(Stream s, TagData tag, ProgressToken<float> w
bool result = await surgeon.RewriteZonesAsync(s, writeAdapter, Zones, dataToWrite, Exists);

// Update tag information without calling Read
if (result) tagData.IntegrateValues(dataToWrite);
if (result) tagData.IntegrateValues(dataToWrite, supportsPictures, supportsAdditionalFields);

postprocessWrite(s);

Expand Down Expand Up @@ -518,8 +529,9 @@ private TagData prepareWrite(Stream r, TagData tag)
structureHelper.AddZone(0, 0);
}

// Merge existing information + new tag information
var dataToWrite = new TagData(tagData);
dataToWrite.IntegrateValues(tag); // Merge existing information + new tag information
dataToWrite.IntegrateValues(tag, supportsPictures, supportsAdditionalFields);
dataToWrite.Cleanup();

preprocessWrite(dataToWrite);
Expand Down

0 comments on commit 808f649

Please sign in to comment.