id3v2.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. /*
  2. mpg123clr: MPEG Audio Decoder library Common Language Runtime version.
  3. copyright 2009 by Malcolm Boczek - free software under the terms of the LGPL 2.1
  4. mpg123clr.dll is a derivative work of libmpg123 - all original mpg123 licensing terms apply.
  5. All rights to this work freely assigned to the mpg123 project.
  6. */
  7. /*
  8. libmpg123: MPEG Audio Decoder library
  9. copyright 1995-2008 by the mpg123 project - free software under the terms of the LGPL 2.1
  10. see COPYING and AUTHORS files in distribution or http://mpg123.org
  11. */
  12. /*
  13. 1.8.1.0 04-Aug-09 Initial release.
  14. */
  15. #pragma once
  16. #pragma warning(disable : 4635)
  17. #include "mpg123.h"
  18. #pragma warning(default : 4635)
  19. #include "string.h"
  20. #include "text.h"
  21. #include <string>
  22. #include <iostream>
  23. #include <vcclr.h>
  24. using namespace std;
  25. using namespace System;
  26. using namespace System::Runtime::InteropServices;
  27. namespace mpg123clr
  28. {
  29. namespace id3
  30. {
  31. // Recommended usage when creating reference type on the managed heap (not using stack semantics
  32. // for reference types...) [see Destructors and Finalizers in Visual C++]
  33. //
  34. // A ^ myA = gcnew A;
  35. // try
  36. // {
  37. // use myA
  38. // }
  39. // finally
  40. // {
  41. // delete myA;
  42. // }
  43. ///<summary>Wrapper for mpg123_id3v2.</summary>
  44. [StructLayout(LayoutKind::Sequential)]
  45. public ref struct mpg123id3v2
  46. {
  47. private:
  48. mpg123_id3v2* sb;
  49. array<mpg123text^>^ __clrcall MakeTextList(mpg123_text* ptr, size_t count);
  50. protected:
  51. ///<summary>Finalizer.
  52. ///<para>Does nothing - wrapper points to underlying memory, this class doesn't allocate memory.</para></summary>
  53. /// Implementation of CLR Finalize().
  54. !mpg123id3v2(void);
  55. internal:
  56. ///<summary>Working Constructor.
  57. ///<para>Maps to mpg123_id3v2 memory.</para>
  58. ///</summary>
  59. mpg123id3v2(mpg123_id3v2* sb);
  60. public:
  61. ///<summary>Constructor.
  62. ///<para>Only creates object for use as "out" target in ID3 constructor.</para>
  63. ///</summary>
  64. mpg123id3v2(void);
  65. ///<summary>Destructor. Used for final object deletion.
  66. ///<para>Calls finalizer for clean disposal of internal (unmanaged) library handles.</para>
  67. ///</summary>
  68. /// Implementation of CLR Dispose().
  69. /// ~Destructor and !Finalizer are the prescribed implementation of Dispose() and Finalize().
  70. /// See Destructors and Finalizers in Visual C++
  71. ~mpg123id3v2(void);
  72. ///<summary>Get the ID3v2 title text.
  73. ///<para>Property returns the last encountered ID3v2 title text.</para>
  74. ///</summary>
  75. ///<value>The last encountered ID3v2 title text.</value>
  76. property String^ title{String^ __clrcall get();}
  77. ///<summary>Get the ID3v2 artist text.
  78. ///<para>Property returns the last encountered ID3v2 artist text.</para>
  79. ///</summary>
  80. ///<value>The last encountered ID3v2 artist text.</value>
  81. property String^ artist{String^ __clrcall get();}
  82. ///<summary>Get the ID3v2 album text.
  83. ///<para>Property returns the last encountered ID3v2 album text.</para>
  84. ///</summary>
  85. ///<value>The last encountered ID3v2 album text.</value>
  86. property String^ album{String^ __clrcall get();}
  87. ///<summary>Get the ID3v2 comment text.
  88. ///<para>Property returns the last encountered ID3v2 comment text.</para>
  89. ///</summary>
  90. ///<value>The last encountered ID3v2 comment text.</value>
  91. property String^ comment{String^ __clrcall get();}
  92. ///<summary>Get the ID3v2 year text.
  93. ///<para>Property returns the last encountered ID3v2 year text.</para>
  94. ///</summary>
  95. ///<value>The last encountered ID3v2 year text.</value>
  96. property String^ year{String^ __clrcall get();}
  97. ///<summary>Get the ID3v2 genre text.
  98. ///<para>Property returns the last encountered ID3v2 genre text.</para>
  99. ///</summary>
  100. ///<value>The last encountered ID3v2 genre text.</value>
  101. property String^ genre{String^ __clrcall get();}
  102. ///<summary>Get the ID3v2 version.
  103. ///<para>Property returns the ID3v2 version.</para>
  104. ///</summary>
  105. ///<value>The ID3v2 version.</value>
  106. property int version{int __clrcall get();}
  107. ///<summary>Get an array of Comments.
  108. ///<para>Property returns an array of Comments.</para>
  109. ///</summary>
  110. ///<value>An array of Comments.</value>
  111. property array<mpg123clr::mpg123text^>^ Comments{array<mpg123clr::mpg123text^>^ __clrcall get();};
  112. ///<summary>Get an array of ID3v2 text fields (including USLT).
  113. ///<para>Property returns an array of ID3v2 text fields (including USLT).</para>
  114. ///</summary>
  115. ///<value>An array of ID3v2 text fields (including USLT).</value>
  116. property array<mpg123clr::mpg123text^>^ Texts{array<mpg123clr::mpg123text^>^ __clrcall get();};
  117. ///<summary>Get an array of extra (TXXX) fields.
  118. ///<para>Property returns an array of extra (TXXX) fields.</para>
  119. ///</summary>
  120. ///<value>An array of extra (TXXX) fields.</value>
  121. property array<mpg123clr::mpg123text^>^ Extras{array<mpg123clr::mpg123text^>^ __clrcall get();};
  122. };
  123. }
  124. }