nsid3v1.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #pragma once
  2. #include "nx/nxstring.h"
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #define NSID3V1_EXPORT
  7. typedef struct nsid3v1_tag_struct_t { } *nsid3v1_tag_t;
  8. // Basic methods
  9. NSID3V1_EXPORT int NSID3v1_Header_Valid(const void *data, size_t len);
  10. NSID3V1_EXPORT int NSID3v1_Tag_Create(const void *data, size_t len, nsid3v1_tag_t *out_tag);
  11. NSID3V1_EXPORT int NSID3v1_Tag_New(nsid3v1_tag_t *out_tag);
  12. // len must be >= 128. ALWAYS writes 128 bytes if successful
  13. NSID3V1_EXPORT int NSID3v1_Tag_Serialize(const nsid3v1_tag_t t, void *data, size_t len);
  14. NSID3V1_EXPORT int NSID3v1_Tag_Destroy(nsid3v1_tag_t t);
  15. // Generic getters
  16. //NSID3V1_EXPORT int NSID3v1_Field_Text_Get(const nsid3v1_tag_t *t, const int field, nx_string_t *out_value);
  17. NSID3V1_EXPORT int NSID3v1_Field_Text_Get(const nsid3v1_tag_t t, const int field, nx_string_t *out_value);
  18. // Specific field getters as text
  19. NSID3V1_EXPORT int NSID3v1_Get_Title(const nsid3v1_tag_t t, nx_string_t *value);
  20. NSID3V1_EXPORT int NSID3v1_Get_Artist(const nsid3v1_tag_t t, nx_string_t *value);
  21. NSID3V1_EXPORT int NSID3v1_Get_Album(const nsid3v1_tag_t t, nx_string_t *value);
  22. NSID3V1_EXPORT int NSID3v1_Get_Year(const nsid3v1_tag_t t, nx_string_t *value);
  23. NSID3V1_EXPORT int NSID3v1_Get_Comment(const nsid3v1_tag_t t, nx_string_t *value);
  24. NSID3V1_EXPORT int NSID3v1_Get_Track(const nsid3v1_tag_t t, nx_string_t *value);
  25. // Specific field getters as integers
  26. NSID3V1_EXPORT int NSID3v1_Int_Get_Year(const nsid3v1_tag_t t, unsigned int *value);
  27. NSID3V1_EXPORT int NSID3v1_Int_Get_Track(const nsid3v1_tag_t t, uint8_t *value);
  28. NSID3V1_EXPORT int NSID3v1_Int_Get_Genre(const nsid3v1_tag_t t, uint8_t *value);
  29. // Specific field setters as text
  30. NSID3V1_EXPORT int NSID3v1_Set_Title(nsid3v1_tag_t t, nx_string_t value);
  31. NSID3V1_EXPORT int NSID3v1_Set_Artist(nsid3v1_tag_t t, nx_string_t value);
  32. NSID3V1_EXPORT int NSID3v1_Set_Album(nsid3v1_tag_t t, nx_string_t value);
  33. NSID3V1_EXPORT int NSID3v1_Set_Year(nsid3v1_tag_t t, nx_string_t value);
  34. NSID3V1_EXPORT int NSID3v1_Set_Comment(nsid3v1_tag_t t, nx_string_t value);
  35. NSID3V1_EXPORT int NSID3v1_Set_Track(nsid3v1_tag_t t, nx_string_t value);
  36. // Specific field setters as integers
  37. NSID3V1_EXPORT int NSID3v1_Int_Set_Year(nsid3v1_tag_t t, unsigned int value);
  38. NSID3V1_EXPORT int NSID3v1_Int_Set_Track(nsid3v1_tag_t t, uint8_t value);
  39. NSID3V1_EXPORT int NSID3v1_Int_Set_Genre(nsid3v1_tag_t t, uint8_t value);
  40. // field types for ID3V1.0
  41. enum
  42. {
  43. NSID3V1_TAG,
  44. NSID3V1_TITLE,
  45. NSID3V1_ARTIST,
  46. NSID3V1_ALBUM,
  47. NSID3V1_YEAR,
  48. NSID3V1_COMMENT,
  49. NSID3V1_TRACK, // ID3V1.1
  50. NSID3V1_GENRE,
  51. };
  52. #ifdef __cplusplus
  53. }
  54. #endif