Skip to content

Commit f26f1f9

Browse files
committed
audio record
1 parent faed881 commit f26f1f9

15 files changed

+383
-176
lines changed

DumpAVIHeaders/Program.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,18 @@ static void ReadAviStreamHeader(string spc, BinaryReader br) {
186186
mAviSH.right = br.ReadInt16();
187187
mAviSH.bottom = br.ReadInt16();
188188

189-
Console.WriteLine("{0:x12} {1} AviStreamHeader {2} {3}",
189+
Console.WriteLine("{0:x12} {1} AviStreamHeader {2}bytes {3} {4}"
190+
+ " dwFlags={5:x8} wPriority={6} wLanguage={7} dwInitialFrames={8} dwScale={9}"
191+
+ " dwRate={10} dwStart={11} dwLength={12} dwSuggestedBufferSize={13}"
192+
+ " dwQuality={14} dwSampleSize={15}",
190193
br.BaseStream.Position-64, spc,
191-
FourCCToString(mAviSH.fccType), FourCCToString(mAviSH.fccHandler));
194+
cb,
195+
FourCCToString(mAviSH.fccType), FourCCToString(mAviSH.fccHandler),
196+
197+
mAviSH.dwFlags, mAviSH.wPriority, mAviSH.wLanguage,
198+
mAviSH.dwInitialFrames, mAviSH.dwScale, mAviSH.dwRate, mAviSH.dwStart,
199+
mAviSH.dwLength, mAviSH.dwSuggestedBufferSize, mAviSH.dwQuality,
200+
mAviSH.dwSampleSize);
192201
}
193202

194203
static void ReadBitmapInfoHeader(string spc, BinaryReader br) {
@@ -230,10 +239,12 @@ static void ReadWaveFormatEx(string spc, BinaryReader br) {
230239
mWavFmt.wBitsPerSample = br.ReadUInt16();
231240
mWavFmt.cbSize = br.ReadUInt16();
232241

233-
Console.WriteLine("{0:x12} {1} WaveFormatEx {2}Hz {3}bit {4}ch",
242+
Console.WriteLine("{0:x12} {1} WaveFormatEx {2}bytes {3}Hz {4}bit {5}ch cbSize={6}",
234243
br.BaseStream.Position-22, spc,
244+
cb,
235245
mWavFmt.nSamplesPerSec,
236-
mWavFmt.wBitsPerSample, mWavFmt.nChannels);
246+
mWavFmt.wBitsPerSample, mWavFmt.nChannels,
247+
mWavFmt.cbSize);
237248

238249
br.BaseStream.Seek(cb - 18, SeekOrigin.Current);
239250
}

MLDX12VideoCapture/MLAVICommon.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ enum MLFOURCC {
2121
MLFOURCC_movi = 0x69766f6d,
2222
MLFOURCC_00db = 0x62643030,
2323
MLFOURCC_00dc = 0x63643030,
24+
MLFOURCC_01wb = 0x62773130,
2425
};
2526

2627
struct MLAviMainHeader {
@@ -85,6 +86,20 @@ struct MLBitmapInfoHeader {
8586
uint32_t biClrImportant;
8687
};
8788

89+
// 18bytes
90+
struct MLWaveFormatExtensible {
91+
uint16_t wFormatTag;
92+
short nChannels;
93+
uint32_t nSamplesPerSec;
94+
uint32_t nAvgBytesPerSec;
95+
short nBlockAlign;
96+
short wBitsPerSample;
97+
short cbSize;
98+
short wValidBitsPerSample;
99+
uint32_t dwChannelMask;
100+
uint32_t subFormatGuid[4];
101+
};
102+
88103
struct MLRiffHeader {
89104
uint32_t riff;
90105
uint32_t bytes;
@@ -105,3 +120,4 @@ struct MLStreamDataHeader {
105120
uint32_t MLStringToFourCC(const char *s);
106121

107122
const std::string MLFourCCtoString(uint32_t fourcc);
123+

MLDX12VideoCapture/MLAviReader.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,6 @@ MLAviReader::~MLAviReader(void)
1515
Close();
1616
}
1717

18-
MLVideoTime
19-
MLAviReader::FrameNrToTime(const int frameNr)
20-
{
21-
MLVideoTime r;
22-
memset(&r, 0, sizeof r);
23-
24-
if (FramesPerSec() == 0) {
25-
return r;
26-
}
27-
28-
r.frame = frameNr % FramesPerSec();
29-
const int totalSec = frameNr / FramesPerSec();
30-
31-
r.hour = totalSec / 3600;
32-
int remain = totalSec - r.hour * 3600;
33-
r.min = remain / 60;
34-
remain -= r.min * 60;
35-
r.sec = remain;
36-
37-
return r;
38-
}
39-
4018
float
4119
MLAviReader::DurationSec(void) const
4220
{

MLDX12VideoCapture/MLAviReader.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ class MLAviReader {
2222

2323
float DurationSec(void) const;
2424

25-
MLVideoTime FrameNrToTime(const int frameNr);
26-
2725
/// @return > 0 : copied bytes, negative value: error.
2826
int GetImage(const int frameNr,
2927
const uint32_t buffBytes, uint8_t *buff);

0 commit comments

Comments
 (0)