Easy setup for tak/ogg/mp3 external encoders

This commit is contained in:
chudov
2009-02-19 06:26:56 +00:00
parent f37d698f6a
commit 6fc7cdebe7
12 changed files with 595 additions and 222 deletions

View File

@@ -45,7 +45,9 @@ namespace TagLib.UserDefined {
{
#region Private Fields
private bool _supportsAPEv2 = true;
private bool _supportsAPEv2 = true;
private bool _supportsID3v2 = true;
#endregion
@@ -70,10 +72,17 @@ namespace TagLib.UserDefined {
/// <exception cref="ArgumentNullException">
/// <paramref name="path" /> is <see langword="null" />.
/// </exception>
public File (string path, ReadStyle propertiesStyle, bool supportsAPEv2)
public File (string path, ReadStyle propertiesStyle, bool supportsAPEv2, bool supportsID3v2)
: base (path, propertiesStyle)
{
_supportsAPEv2 = supportsAPEv2;
_supportsAPEv2 = supportsAPEv2;
_supportsID3v2 = supportsID3v2;
// Make sure we have an APE tag.
if (_supportsAPEv2)
GetTag(TagTypes.Ape, true);
else
if (_supportsID3v2)
GetTag(TagTypes.Id3v2, true);
}
/// <summary>
@@ -87,10 +96,18 @@ namespace TagLib.UserDefined {
/// </param>
/// <exception cref="ArgumentNullException">
/// <paramref name="path" /> is <see langword="null" />.
/// </exception>
public File (string path, bool supportsAPEv2) : base (path)
/// </exception>
public File(string path, bool supportsAPEv2, bool supportsID3v2)
: base(path)
{
_supportsAPEv2 = supportsAPEv2;
_supportsAPEv2 = supportsAPEv2;
_supportsID3v2 = supportsID3v2;
// Make sure we have an APE tag.
if (_supportsAPEv2)
GetTag(TagTypes.Ape, true);
else
if (_supportsID3v2)
GetTag(TagTypes.Id3v2, true);
}
/// <summary>
@@ -111,11 +128,18 @@ namespace TagLib.UserDefined {
/// <paramref name="abstraction" /> is <see langword="null"
/// />.
/// </exception>
public File (File.IFileAbstraction abstraction,
ReadStyle propertiesStyle, bool supportsAPEv2)
public File (File.IFileAbstraction abstraction,
ReadStyle propertiesStyle, bool supportsAPEv2, bool supportsID3v2)
: base (abstraction, propertiesStyle)
{
_supportsAPEv2 = supportsAPEv2;
_supportsAPEv2 = supportsAPEv2;
_supportsID3v2 = supportsID3v2;
// Make sure we have an APE tag.
if (_supportsAPEv2)
GetTag(TagTypes.Ape, true);
else
if (_supportsID3v2)
GetTag(TagTypes.Id3v2, true);
}
/// <summary>
@@ -130,11 +154,18 @@ namespace TagLib.UserDefined {
/// <exception cref="ArgumentNullException">
/// <paramref name="abstraction" /> is <see langword="null"
/// />.
/// </exception>
public File (File.IFileAbstraction abstraction, bool supportsAPEv2)
/// </exception>
public File(File.IFileAbstraction abstraction, bool supportsAPEv2, bool supportsID3v2)
: base (abstraction)
{
_supportsAPEv2 = supportsAPEv2;
_supportsAPEv2 = supportsAPEv2;
_supportsID3v2 = supportsID3v2;
// Make sure we have an APE tag.
if (_supportsAPEv2)
GetTag(TagTypes.Ape, true);
else
if (_supportsID3v2)
GetTag(TagTypes.Id3v2, true);
}
#endregion
@@ -149,6 +180,14 @@ namespace TagLib.UserDefined {
{
return _supportsAPEv2;
}
}
public bool SupportsID3v2
{
get
{
return _supportsID3v2;
}
}
@@ -240,9 +279,6 @@ namespace TagLib.UserDefined {
protected override void ReadEnd (long end,
ReadStyle propertiesStyle)
{
// Make sure we have an APE tag.
if (_supportsAPEv2)
GetTag (TagTypes.Ape, true);
}
/// <summary>
@@ -293,12 +329,12 @@ namespace TagLib.UserDefined {
private static TagLib.File UserDefinedResolver(TagLib.File.IFileAbstraction abstraction, string mimetype, TagLib.ReadStyle style)
{
if (mimetype == "taglib/flac" || mimetype == "taglib/wv" || mimetype == "taglib/ape" || mimetype == "taglib/wav")
if (mimetype == "taglib/flac" || mimetype == "taglib/wv" || mimetype == "taglib/ape" || mimetype == "taglib/wav" || mimetype == "taglib/ogg")
return null;
if (mimetype == "taglib/tta")
return new File(abstraction, style, true);
return new File(abstraction, style, true, false);
if (mimetype == "taglib/" + _config.udc1Extension)
return new File(abstraction, style, _config.udc1APEv2);
return new File(abstraction, style, _config.udc1APEv2, _config.udc1ID3v2);
return null;
}