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 /*! 24 \author Steve Lhomme 25 \version \$Id$ 26 */ 27 28 #if !defined(_ACM_H__INCLUDED_) 29 #define _ACM_H__INCLUDED_ 30 31 #if _MSC_VER >= 1000 32 #pragma once 33 #endif // _MSC_VER >= 1000 34 35 #include <vector> 36 37 #include <windows.h> 38 #include <mmsystem.h> 39 #include <mmreg.h> 40 #include <msacm.h> 41 #include <msacmdrv.h> 42 43 44 #include "ADbg/ADbg.h" 45 46 class AEncodeProperties; 47 48 typedef enum vbr_mode_e vbr_mode; 49 50 class bitrate_item { 51 public: 52 unsigned int frequency; 53 unsigned int bitrate; 54 unsigned int channels; 55 vbr_mode mode; 56 57 bool operator<(const bitrate_item & bitrate) const; 58 }; 59 60 class ACM 61 { 62 public: 63 ACM( HMODULE hModule ); 64 virtual ~ACM(); 65 66 LONG DriverProcedure(const HDRVR hdrvr, const UINT msg, LONG lParam1, LONG lParam2); 67 GetVersionString(void)68 static const char * GetVersionString(void) {return VersionString;} 69 70 protected: 71 // inline DWORD Configure( HWND hParentWindow, LPDRVCONFIGINFO pConfig ); 72 inline DWORD About( HWND hParentWindow ); 73 74 inline DWORD OnDriverDetails(const HDRVR hdrvr, LPACMDRIVERDETAILS a_DriverDetail); 75 inline DWORD OnFormatTagDetails(LPACMFORMATTAGDETAILS a_FormatTagDetails, const LPARAM a_Query); 76 inline DWORD OnFormatDetails(LPACMFORMATDETAILS a_FormatDetails, const LPARAM a_Query); 77 inline DWORD OnFormatSuggest(LPACMDRVFORMATSUGGEST a_FormatSuggest); 78 inline DWORD OnStreamOpen(LPACMDRVSTREAMINSTANCE a_StreamInstance); 79 inline DWORD OnStreamClose(LPACMDRVSTREAMINSTANCE a_StreamInstance); 80 inline DWORD OnStreamSize(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMDRVSTREAMSIZE the_StreamSize); 81 inline DWORD OnStreamPrepareHeader(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMSTREAMHEADER a_StreamHeader); 82 inline DWORD OnStreamUnPrepareHeader(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMSTREAMHEADER a_StreamHeader); 83 inline DWORD OnStreamConvert(LPACMDRVSTREAMINSTANCE a_StreamInstance, LPACMDRVSTREAMHEADER a_StreamHeader); 84 85 void GetMP3FormatForIndex(const DWORD the_Index, WAVEFORMATEX & the_Format, unsigned short the_String[ACMFORMATDETAILS_FORMAT_CHARS]) const; 86 void GetPCMFormatForIndex(const DWORD the_Index, WAVEFORMATEX & the_Format, unsigned short the_String[ACMFORMATDETAILS_FORMAT_CHARS]) const; 87 DWORD GetNumberEncodingFormats() const; 88 bool IsSmartOutput(const int frequency, const int bitrate, const int channels) const; 89 void BuildBitrateTable(); 90 91 HMODULE my_hModule; 92 HICON my_hIcon; 93 ADbg my_debug; 94 AEncodeProperties my_EncodingProperties; 95 std::vector<bitrate_item> bitrate_table; 96 97 static char VersionString[120]; 98 }; 99 100 #endif // !defined(_ACM_H__INCLUDED_) 101 102