ACM.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /**
  2. *
  3. * Lame ACM wrapper, encode/decode MP3 based RIFF/AVI files in MS Windows
  4. *
  5. * Copyright (c) 2002 Steve Lhomme <steve.lhomme at free.fr>
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  20. *
  21. */
  22. /*!
  23. \author Steve Lhomme
  24. \version \$Id$
  25. */
  26. #if !defined(_ACM_H__INCLUDED_)
  27. #define _ACM_H__INCLUDED_
  28. #if _MSC_VER >= 1000
  29. #pragma once
  30. #endif // _MSC_VER >= 1000
  31. #include <vector>
  32. #include <windows.h>
  33. #include <mmsystem.h>
  34. #include <mmreg.h>
  35. #include <msacm.h>
  36. #include <msacmdrv.h>
  37. #include "ADbg/ADbg.h"
  38. class AEncodeProperties;
  39. typedef enum vbr_mode_e vbr_mode;
  40. class bitrate_item {
  41. public:
  42. unsigned int frequency;
  43. unsigned int bitrate;
  44. unsigned int channels;
  45. vbr_mode mode;
  46. bool operator<(const bitrate_item & bitrate) const;
  47. };
  48. class ACM
  49. {
  50. public:
  51. ACM( HMODULE hModule );
  52. virtual ~ACM();
  53. LONG DriverProcedure(const HDRVR hdrvr, const UINT msg, LONG lParam1, LONG lParam2);
  54. static const char * GetVersionString(void) {return VersionString;}
  55. protected:
  56. // inline DWORD Configure( HWND hParentWindow, LPDRVCONFIGINFO pConfig );
  57. inline DWORD About( HWND hParentWindow );
  58. inline DWORD OnDriverDetails(const HDRVR hdrvr, LPACMDRIVERDETAILS a_DriverDetail);
  59. inline DWORD OnFormatTagDetails(LPACMFORMATTAGDETAILS a_FormatTagDetails, const LPARAM a_Query);
  60. inline DWORD OnFormatDetails(LPACMFORMATDETAILS a_FormatDetails, const LPARAM a_Query);
  61. inline DWORD OnFormatSuggest(LPACMDRVFORMATSUGGEST a_FormatSuggest);
  62. inline DWORD OnStreamOpen(LPACMDRVSTREAMINSTANCE a_StreamInstance);
  63. inline DWORD OnStreamClose(LPACMDRVSTREAMINSTANCE a_StreamInstance);
  64. inline DWORD OnStreamSize(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMDRVSTREAMSIZE the_StreamSize);
  65. inline DWORD OnStreamPrepareHeader(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMSTREAMHEADER a_StreamHeader);
  66. inline DWORD OnStreamUnPrepareHeader(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMSTREAMHEADER a_StreamHeader);
  67. inline DWORD OnStreamConvert(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMDRVSTREAMHEADER a_StreamHeader);
  68. void GetMP3FormatForIndex(const DWORD the_Index, WAVEFORMATEX & the_Format, unsigned short the_String[ACMFORMATDETAILS_FORMAT_CHARS]) const;
  69. void GetPCMFormatForIndex(const DWORD the_Index, WAVEFORMATEX & the_Format, unsigned short the_String[ACMFORMATDETAILS_FORMAT_CHARS]) const;
  70. DWORD GetNumberEncodingFormats() const;
  71. bool IsSmartOutput(const int frequency, const int bitrate, const int channels) const;
  72. void BuildBitrateTable();
  73. HMODULE my_hModule;
  74. HICON my_hIcon;
  75. ADbg my_debug;
  76. AEncodeProperties my_EncodingProperties;
  77. std::vector<bitrate_item> bitrate_table;
  78. static char VersionString[120];
  79. };
  80. #endif // !defined(_ACM_H__INCLUDED_)