PageRenderTime 62ms CodeModel.GetById 35ms RepoModel.GetById 0ms app.codeStats 0ms

/libtunepimp-0.5.3/plugins/wv/wvfile.h

#
C Header | 160 lines | 40 code | 25 blank | 95 comment | 0 complexity | 7396379b27acf88b3f1dd6ddba93d683 MD5 | raw file
Possible License(s): LGPL-2.1, LGPL-3.0, GPL-2.0, LGPL-2.0
  1. /***************************************************************************
  2. copyright : (C) 2006 by LukᚠLalinský
  3. email : lalinsky@gmail.com
  4. copyright : (C) 2004 by Allan Sandfeld Jensen
  5. email : kde@carewolf.org
  6. (original MPC implementation)
  7. ***************************************************************************/
  8. /***************************************************************************
  9. * This library is free software; you can redistribute it and/or modify *
  10. * it under the terms of the GNU Lesser General Public License version *
  11. * 2.1 as published by the Free Software Foundation. *
  12. * *
  13. * This library is distributed in the hope that it will be useful, but *
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of *
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
  16. * Lesser General Public License for more details. *
  17. * *
  18. * You should have received a copy of the GNU Lesser General Public *
  19. * License along with this library; if not, write to the Free Software *
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
  21. * USA *
  22. ***************************************************************************/
  23. #ifndef TAGLIB_WVFILE_H
  24. #define TAGLIB_WVFILE_H
  25. #include "tfile.h"
  26. #include "wvproperties.h"
  27. namespace TagLib {
  28. class Tag;
  29. namespace ID3v1 { class Tag; }
  30. namespace APE { class Tag; }
  31. //! An implementation of WavPack metadata
  32. /*!
  33. * This is implementation of WavPack metadata.
  34. *
  35. * This supports ID3v1 and APE (v1 and v2) style comments as well as reading stream
  36. * properties from the file.
  37. */
  38. namespace WavPack {
  39. //! An implementation of TagLib::File with WavPack specific methods
  40. /*!
  41. * This implements and provides an interface for WavPack files to the
  42. * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing
  43. * the abstract TagLib::File API as well as providing some additional
  44. * information specific to WavPack files.
  45. */
  46. class File : public TagLib::File
  47. {
  48. public:
  49. /*!
  50. * This set of flags is used for various operations and is suitable for
  51. * being OR-ed together.
  52. */
  53. enum TagTypes {
  54. //! Empty set. Matches no tag types.
  55. NoTags = 0x0000,
  56. //! Matches ID3v1 tags.
  57. ID3v1 = 0x0001,
  58. //! Matches APE tags.
  59. APE = 0x0002,
  60. //! Matches all tag types.
  61. AllTags = 0xffff
  62. };
  63. /*!
  64. * Contructs an WavPack file from \a file. If \a readProperties is true the
  65. * file's audio properties will also be read using \a propertiesStyle. If
  66. * false, \a propertiesStyle is ignored.
  67. */
  68. File(const char *file, bool readProperties = true,
  69. Properties::ReadStyle propertiesStyle = Properties::Average);
  70. /*!
  71. * Destroys this instance of the File.
  72. */
  73. virtual ~File();
  74. /*!
  75. * Returns the Tag for this file. This will be an APE tag, an ID3v1 tag
  76. * or a combination of the two.
  77. */
  78. virtual TagLib::Tag *tag() const;
  79. /*!
  80. * Returns the MPC::Properties for this file. If no audio properties
  81. * were read then this will return a null pointer.
  82. */
  83. virtual Properties *audioProperties() const;
  84. /*!
  85. * Saves the file.
  86. */
  87. virtual bool save();
  88. /*!
  89. * Returns a pointer to the ID3v1 tag of the file.
  90. *
  91. * If \a create is false (the default) this will return a null pointer
  92. * if there is no valid ID3v1 tag. If \a create is true it will create
  93. * an ID3v1 tag if one does not exist. If there is already an APE tag, the
  94. * new ID3v1 tag will be placed after it.
  95. *
  96. * \note The Tag <b>is still</b> owned by the APE::File and should not be
  97. * deleted by the user. It will be deleted when the file (object) is
  98. * destroyed.
  99. */
  100. ID3v1::Tag *ID3v1Tag(bool create = false);
  101. /*!
  102. * Returns a pointer to the APE tag of the file.
  103. *
  104. * If \a create is false (the default) this will return a null pointer
  105. * if there is no valid APE tag. If \a create is true it will create
  106. * a APE tag if one does not exist.
  107. *
  108. * \note The Tag <b>is still</b> owned by the APE::File and should not be
  109. * deleted by the user. It will be deleted when the file (object) is
  110. * destroyed.
  111. */
  112. APE::Tag *APETag(bool create = false);
  113. /*!
  114. * This will remove the tags that match the OR-ed together TagTypes from the
  115. * file. By default it removes all tags.
  116. *
  117. * \note This will also invalidate pointers to the tags
  118. * as their memory will be freed.
  119. * \note In order to make the removal permanent save() still needs to be called
  120. */
  121. void remove(int tags = AllTags);
  122. private:
  123. File(const File &);
  124. File &operator=(const File &);
  125. void read(bool readProperties, Properties::ReadStyle propertiesStyle);
  126. void scan();
  127. long findID3v1();
  128. long findAPE();
  129. class FilePrivate;
  130. FilePrivate *d;
  131. };
  132. }
  133. }
  134. #endif