id3_header.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. // The authors have released ID3Lib as Public Domain (PD) and claim no copyright,
  2. // patent or other intellectual property protection in this work. This means that
  3. // it may be modified, redistributed and used in commercial and non-commercial
  4. // software and hardware without restrictions. ID3Lib is distributed on an "AS IS"
  5. // basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
  6. //
  7. // The ID3Lib authors encourage improvements and optimisations to be sent to the
  8. // ID3Lib coordinator, currently Dirk Mahoney ([email protected]). Approved
  9. // submissions may be altered, and will be included and released under these terms.
  10. //
  11. // Mon Nov 23 18:34:01 1998
  12. #ifndef ID3LIB_HEADER_H
  13. #define ID3LIB_HEADER_H
  14. #include "id3_types.h"
  15. #define MIN_ID3_TAGVERSION 2
  16. #define MAX_ID3_TAGVERSION 4
  17. #define ID3_TAGVERSION (3)
  18. #define ID3_TAGREVISION (0)
  19. struct ID3_HeaderInfo
  20. {
  21. unsigned __int8 version;
  22. unsigned __int8 revision;
  23. unsigned __int8 frameIDBytes;
  24. unsigned __int8 frameSizeBytes;
  25. unsigned __int8 frameFlagsBytes;
  26. bool hasExtHeader;
  27. luint extHeaderBytes;
  28. bool setExpBit;
  29. };
  30. struct ID3_Quirks
  31. {
  32. ID3_Quirks() : id3v2_4_itunes_bug(false) {}
  33. bool id3v2_4_itunes_bug; // itunes doesn't write syncsafe values for 2.4
  34. };
  35. class ID3_Header
  36. {
  37. public:
  38. ID3_Header (void);
  39. void SetVersion(uchar ver, uchar rev);
  40. void SetDataSize(luint newSize);
  41. void SetFlags(luint newFlags);
  42. void SetQuirks(ID3_Quirks &_quirks)
  43. {
  44. quirks=_quirks;
  45. }
  46. ID3_Quirks &GetQuirks()
  47. {
  48. return quirks;
  49. }
  50. virtual luint Size(void) = 0;
  51. virtual luint Render(unsigned __int8 *buffer) = 0;
  52. // *** PRIVATE INTERNAL DATA - DO NOT USE *** PRIVATE INTERNAL DATA - DO NOT USE ***
  53. protected:
  54. unsigned __int8 version; // which version?
  55. unsigned __int8 revision; // which revision?
  56. luint dataSize; // how big is the data?
  57. luint flags; // tag flags
  58. ID3_HeaderInfo *info; // the info about this version of the headers
  59. ID3_Quirks quirks;
  60. };
  61. ID3_HeaderInfo *ID3_LookupHeaderInfo (uchar ver, uchar rev);
  62. #endif