mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-24 00:18:07 +02:00
Bug 265 fix for MP2 files.
This commit is contained in:
parent
014863a076
commit
031a9e0af3
@ -186,6 +186,9 @@ public:
|
||||
private:
|
||||
|
||||
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
|
||||
|
||||
};
|
||||
|
||||
@ -357,6 +360,9 @@ int ExportMP2::AddTags(AudacityProject *project, char **buffer, bool *endOfFile,
|
||||
name = ID3_FRAME_ALBUM;
|
||||
}
|
||||
else if (n.CmpNoCase(TAG_YEAR) == 0) {
|
||||
// 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) {
|
||||
@ -372,6 +378,43 @@ int ExportMP2::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 ExportMP2::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) {
|
||||
@ -412,38 +455,8 @@ int ExportMP2::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