mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-21 23:00:06 +02:00
This should fix bug #265 by writing both old and new year to tags. Since ID3v2 allows for unrecognized tags, there's no reason not to write both the old (TYER) and new (TDRC) tags. This should provide the year to apps using ID3v2.3 or ID3v2.4.
This commit is contained in:
parent
880b1b8c4b
commit
2d7b81145c
@ -1485,7 +1485,9 @@ private:
|
||||
wxString FindName(CHOICES *choices, int cnt, int needle);
|
||||
int AskResample(int bitrate, int rate, int lowrate, int highrate);
|
||||
int AddTags(AudacityProject *project, char **buffer, bool *endOfFile, Tags *tags);
|
||||
|
||||
#ifdef USE_LIBID3TAG
|
||||
void AddFrame(struct id3_tag *tp, bool v2, const wxString & n, const wxString & v, const char *name);
|
||||
#endif
|
||||
};
|
||||
|
||||
ExportMP3::ExportMP3()
|
||||
@ -1862,10 +1864,10 @@ int ExportMP3::AddTags(AudacityProject *project, char **buffer, bool *endOfFile,
|
||||
name = ID3_FRAME_ALBUM;
|
||||
}
|
||||
else if (n.CmpNoCase(TAG_YEAR) == 0) {
|
||||
// LLL: This should be ID3_FRAME_YEAR, but some apps do not like the
|
||||
// newer frame ID, so we force usage of the older one. (For now
|
||||
// anyway.)
|
||||
name = "TYER";
|
||||
// LLL: Some apps do not like the newer frame ID (ID3_FRAME_YEAR),
|
||||
// so we add old one as well.
|
||||
AddFrame(tp, v2, n, v, "TYER");
|
||||
name = ID3_FRAME_YEAR;
|
||||
}
|
||||
else if (n.CmpNoCase(TAG_GENRE) == 0) {
|
||||
name = ID3_FRAME_GENRE;
|
||||
@ -1880,6 +1882,43 @@ int ExportMP3::AddTags(AudacityProject *project, char **buffer, bool *endOfFile,
|
||||
name = ID3_FRAME_TRACK;
|
||||
}
|
||||
|
||||
AddFrame(tp, v2, n, v, name);
|
||||
}
|
||||
|
||||
if (v2) {
|
||||
tp->options &= (~ID3_TAG_OPTION_COMPRESSION); // No compression
|
||||
|
||||
// If this version of libid3tag supports it, use v2.3 ID3
|
||||
// tags instead of the newer, but less well supported, v2.4
|
||||
// that libid3tag uses by default.
|
||||
#ifdef ID3_TAG_HAS_TAG_OPTION_ID3V2_3
|
||||
tp->options |= ID3_TAG_OPTION_ID3V2_3;
|
||||
#endif
|
||||
|
||||
*endOfFile = false;
|
||||
}
|
||||
else {
|
||||
tp->options |= ID3_TAG_OPTION_ID3V1;
|
||||
*endOfFile = true;
|
||||
}
|
||||
|
||||
id3_length_t len;
|
||||
|
||||
len = id3_tag_render(tp, 0);
|
||||
*buffer = (char *)malloc(len);
|
||||
len = id3_tag_render(tp, (id3_byte_t *)*buffer);
|
||||
|
||||
id3_tag_delete(tp);
|
||||
|
||||
return len;
|
||||
#else //ifdef USE_LIBID3TAG
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_LIBID3TAG
|
||||
void ExportMP3::AddFrame(struct id3_tag *tp, bool v2, const wxString & n, const wxString & v, const char *name)
|
||||
{
|
||||
struct id3_frame *frame = id3_frame_new(name);
|
||||
|
||||
if (v2) {
|
||||
@ -1920,38 +1959,8 @@ int ExportMP3::AddTags(AudacityProject *project, char **buffer, bool *endOfFile,
|
||||
|
||||
id3_tag_attachframe(tp, frame);
|
||||
}
|
||||
|
||||
if (v2) {
|
||||
tp->options &= (~ID3_TAG_OPTION_COMPRESSION); // No compression
|
||||
|
||||
// If this version of libid3tag supports it, use v2.3 ID3
|
||||
// tags instead of the newer, but less well supported, v2.4
|
||||
// that libid3tag uses by default.
|
||||
#ifdef ID3_TAG_HAS_TAG_OPTION_ID3V2_3
|
||||
tp->options |= ID3_TAG_OPTION_ID3V2_3;
|
||||
#endif
|
||||
|
||||
*endOfFile = false;
|
||||
}
|
||||
else {
|
||||
tp->options |= ID3_TAG_OPTION_ID3V1;
|
||||
*endOfFile = true;
|
||||
}
|
||||
|
||||
id3_length_t len;
|
||||
|
||||
len = id3_tag_render(tp, 0);
|
||||
*buffer = (char *)malloc(len);
|
||||
len = id3_tag_render(tp, (id3_byte_t *)*buffer);
|
||||
|
||||
id3_tag_delete(tp);
|
||||
|
||||
return len;
|
||||
#else //ifdef USE_LIBID3TAG
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Constructor
|
||||
//----------------------------------------------------------------------------
|
||||
|
Loading…
x
Reference in New Issue
Block a user