-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathCodec.h
More file actions
153 lines (119 loc) · 3.85 KB
/
Copy pathCodec.h
File metadata and controls
153 lines (119 loc) · 3.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
/*
** CDex - Open Source Digital Audio CD Extractor
**
** Copyright (C) 2006 - 2007 Georgy Berdyshev
** Copyright (C) 1999 Albert L. Faber
**
** http://cdexos.sourceforge.net/
** http://sourceforge.net/projects/cdexos
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CODEC_INCLUDED
#define CODEC_INCLUDED
#include <windows.h>
#include <mmsystem.h>
#include <mmreg.h> // Multimedia registration
#include <msacm.h> // Audio Compression Manager
#include <vector>
#include "config.h"
//CAcmCodec g_AcmCodec;
// 1 byte alignment or SCSI structures
#pragma pack(push,1)
class CAcmFormat : public ACMFORMATDETAILS
{
public:
// CONSTRUCTOR
CAcmFormat();
// DESTRUCTOR
~CAcmFormat();
// COPY CONSTRUCTOR
CAcmFormat(const CAcmFormat& rhs);
// COPY CONSTRUCTOR
CAcmFormat(const ACMFORMATDETAILS& rhs);
// ASSIGNMENT OPERATOR
CAcmFormat& operator=(const CAcmFormat& rhs);
};
class CAcmDriverInfo : public CObject
{
public:
// CONSTRUCTOR
CAcmDriverInfo();
// DESTRUCTOR
~CAcmDriverInfo();
// COPY CONSTRUCTOR
CAcmDriverInfo(const CAcmDriverInfo& rhs);
// ASSIGNMENT OPERATOR
CAcmDriverInfo& operator=(const CAcmDriverInfo& rhs);
HACMDRIVERID hadid;
ACMDRIVERDETAILS dd;
vector<CAcmFormat> m_vFormatDetails;
};
class CCodecDetails:public CObject
{
CCodecDetails();
~CCodecDetails();
};
class CAcmCodec:public CObject
{
public:
vector<CAcmDriverInfo> m_vAcmDriverInfo;
private:
BOOL m_bIntermPCM;
int m_nOffset;
PBYTE m_pbtSrcBuffer;
PBYTE m_pbtPcmBuffer;
PBYTE m_pbtDstBuffer;
CAcmDriverInfo* m_pPcmAcmDriver;
CAcmDriverInfo* m_pDstAcmDriver;
CAcmFormat* m_pPcmAcmFormat;
CAcmFormat* m_pDstAcmFormat;
HACMSTREAM m_hPcmStream;
HACMSTREAM m_hDstStream;
HACMDRIVER m_hPcmDriver;
HACMDRIVER m_hDstDriver;
// Create ACM Stream Header
ACMSTREAMHEADER m_PcmStreamHdr;
ACMSTREAMHEADER m_DstStreamHdr;
DWORD m_dwSrcSamples;
DWORD m_dwDstSamples;
BOOL m_bMP3CodecInstalled;
int m_nBufferSize;
public:
CAcmCodec();
~CAcmCodec();
void ShowError(MMRESULT& mmr);
// Callback functions have to be static
static BOOL CALLBACK DriverEnumProc(HACMDRIVERID hadid, DWORD dwInstance, DWORD fdwSupport);
static BOOL CALLBACK FormatEnumProc(HACMDRIVERID hadid, LPACMFORMATDETAILS pafd, DWORD dwInstance, DWORD fdwSupport);
void GetVersion();
void EnumDrivers();
int GetNumEncoders(DWORD dwTag);
void ReInit();
CDEX_ERR DeInitStream(PBYTE pOutput, PDWORD pdwOutput);
BOOL IsMP3CodecInstalled() const {return m_bMP3CodecInstalled;}
// CDEX_ERR WinEncoderFunc(void* pMP3Params);
CUString GetACMCodecName(int CodecIndex) const;
void DisplayCodecInfo(int nCodecIndex) const;
int GetNumCodecs() const {return m_vAcmDriverInfo.size();}
int GetNumDetails(int nCodecIndex)const;
CUString GetACMCodecName(int nCodecIndex,DWORD dwTag);
CUString GetFormatString(int nCodecIndex,int nFormatIndex) const;
CUString GetFormatString(int nCodecIndex,int nFormatIndex,DWORD dwTag) const;
CDEX_ERR InitStream(CUString& strCodec,CUString& strFormat,INT nCodecID,int nSampleFreq,int nChannels,BOOL bHighQuality);
CDEX_ERR EncodeChunk(DWORD nSamples, PSHORT pSamples, PBYTE pOutput, PDWORD pdwOutput,int nFlags=ACM_STREAMCONVERTF_BLOCKALIGN);
};
void TestEnumDrivers();
#pragma pack(pop)
#endif