我目前正在使用 C++ 读取 RIff fmt .wav 文件。我怎样才能找到文件的创建日期和时间。标头中包含的唯一时间是TimeStamp
表示自纪元以来的秒数。
以下是我正在使用的已解析 RIff 标头:
typedef struct RIFF_CHUNCK_DISCRIPTOR {
char RIFF[4]; // RIFF Header Magic header
int32_t ChunkSize; // RIFF Chunk Size
int32_t WAVE[4]; // WAVE Header
};
typedef struct CRIF_CHUNCK {
char Crif[4];
int32_t Length;
int32_t CrifCheckSum;
};
typedef struct FMT_CHUNCK_DISCRIPTOR {
char fmt[4]; // FMT header
int32_t Subchunk1Size; // Size of the fmt chunk
int16_t EncodingTag;
int16_t NumOfChan; // Number of channels
int32_t SamplesPerSec; // Sampling Frequency in Hz
int32_t bytesPerSec; // bytes per second
int16_t blockAlign; // 2=16-bit mono, 4=16-bit stereo
int16_t bitsPerSample; // Number of bits per sample
int16_t AudioFormat; // PCM = 0 , ADPCM = 2
int16_t SmplesPerChan;
};typedef struct FMT_CHUNCK_DISCRIPTOR_PCM {
char fmt[4]; // FMT header
int32_t Subchunk1Size; // Size of the fmt chunk
int16_t EncodingTag;
int16_t NumOfChan; // Number of channels
int32_t SamplesPerSec; // Sampling Frequency in Hz
int32_t bytesPerSec; // bytes per second
int16_t blockAlign; // 2=16-bit mono, 4=16-bit stereo
int16_t bitsPerSample; // Number of bits per sample
int16_t AudioFormat; // PCM = 0 , ADPCM = 2
};
typedef struct FACT_CHUNCK {
char fact[4];
int32_t FactSize;
int32_t dwSampleLength;
};
typedef struct META_DATA {
char meta[4];
uint32_t HeadData;// <length of the head data - 8>
uint8_t Version;
uint8_t Model;
uint32_t Serial;
uint32_t RecordingNumber;
uint16_t ChunkNumber;
uint32_t TimeStamp;
uint32_t MetadataChecksum;
};
typedef struct DATA_SUB_CHUNCK {
char Subchunk2ID[4]; // "data" string
int32_t Subchunk2Size; // Sampled data length
};
typedef struct CDAT {
char cdat[4]; // "data" string
int32_t CdatCheckSum; // Sampled data length
};
typedef struct FOOTER {
char foot[4]; // "data" string
int16_t PrevChunckNumb; // Sampled data length
int16_t NextChunckNumb;
int32_t FooterChunckSum;
};