audio_core: hle: mf: re-arrange comments
This commit is contained in:
parent
972b527374
commit
4bc6bfd51f
3 changed files with 19 additions and 12 deletions
|
@ -17,6 +17,8 @@ struct ADTSData {
|
||||||
u32 samplerate;
|
u32 samplerate;
|
||||||
};
|
};
|
||||||
|
|
||||||
u32 ParseADTS(char* buffer, struct ADTSData* out);
|
u32 ParseADTS(char* buffer, ADTSData* out);
|
||||||
|
|
||||||
// last two bytes of MF AAC decoder user data
|
// last two bytes of MF AAC decoder user data
|
||||||
u16 MFGetAACTag(struct ADTSData input);
|
// see https://docs.microsoft.com/en-us/windows/desktop/medfound/aac-decoder#example-media-types
|
||||||
|
u16 MFGetAACTag(ADTSData input);
|
||||||
|
|
|
@ -7,7 +7,7 @@ constexpr std::array<u32, 16> freq_table = {96000, 88200, 64000, 48000, 44100, 3
|
||||||
16000, 12000, 11025, 8000, 7350, 0, 0, 0};
|
16000, 12000, 11025, 8000, 7350, 0, 0, 0};
|
||||||
constexpr std::array<u8, 8> channel_table = {0, 1, 2, 3, 4, 5, 6, 8};
|
constexpr std::array<u8, 8> channel_table = {0, 1, 2, 3, 4, 5, 6, 8};
|
||||||
|
|
||||||
u32 ParseADTS(char* buffer, struct ADTSData* out) {
|
u32 ParseADTS(char* buffer, ADTSData* out) {
|
||||||
u32 tmp = 0;
|
u32 tmp = 0;
|
||||||
|
|
||||||
// sync word 0xfff
|
// sync word 0xfff
|
||||||
|
@ -40,7 +40,13 @@ u32 ParseADTS(char* buffer, struct ADTSData* out) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// last two bytes of MF AAC decoder user data
|
// last two bytes of MF AAC decoder user data
|
||||||
u16 MFGetAACTag(struct ADTSData input) {
|
// Audio object type (5 bits)
|
||||||
|
// Sample rate profile (4 bits)
|
||||||
|
// Channel configuration profile (4 bits)
|
||||||
|
// Frame length flag (1 bit)
|
||||||
|
// Depends on core coder (1 bit)
|
||||||
|
// Extension flag (1 bit)
|
||||||
|
u16 MFGetAACTag(ADTSData input) {
|
||||||
u16 tag = 0;
|
u16 tag = 0;
|
||||||
|
|
||||||
tag |= input.profile << 11;
|
tag |= input.profile << 11;
|
||||||
|
|
|
@ -134,14 +134,6 @@ bool SelectInputMediaType(IMFTransform* transform, int in_stream_id, const ADTSD
|
||||||
t->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio);
|
t->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Audio);
|
||||||
t->SetGUID(MF_MT_SUBTYPE, audio_format);
|
t->SetGUID(MF_MT_SUBTYPE, audio_format);
|
||||||
|
|
||||||
// see https://docs.microsoft.com/en-us/windows/desktop/medfound/aac-decoder#example-media-types
|
|
||||||
// and https://docs.microsoft.com/zh-cn/windows/desktop/api/mmreg/ns-mmreg-heaacwaveinfo_tag
|
|
||||||
// for the meaning of the byte array below
|
|
||||||
|
|
||||||
// for integrate into a larger project, it is recommended to wrap the parameters into a struct
|
|
||||||
// and pass that struct into the function
|
|
||||||
// const UINT8 aac_data[] = { 0x01, 0x00, 0xfe, 00, 00, 00, 00, 00, 00, 00, 00, 00, 0x11, 0x90
|
|
||||||
// }; 0: raw aac 1: adts 2: adif 3: latm/laos
|
|
||||||
t->SetUINT32(MF_MT_AAC_PAYLOAD_TYPE, 1);
|
t->SetUINT32(MF_MT_AAC_PAYLOAD_TYPE, 1);
|
||||||
t->SetUINT32(MF_MT_AUDIO_NUM_CHANNELS, adts.channels);
|
t->SetUINT32(MF_MT_AUDIO_NUM_CHANNELS, adts.channels);
|
||||||
t->SetUINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND, adts.samplerate);
|
t->SetUINT32(MF_MT_AUDIO_SAMPLES_PER_SECOND, adts.samplerate);
|
||||||
|
@ -211,6 +203,13 @@ int DetectMediaType(char* buffer, size_t len, ADTSData* output, char** aac_tag)
|
||||||
}
|
}
|
||||||
|
|
||||||
ADTSData tmp;
|
ADTSData tmp;
|
||||||
|
// see https://docs.microsoft.com/en-us/windows/desktop/api/mmreg/ns-mmreg-heaacwaveinfo_tag
|
||||||
|
// for the meaning of the byte array below
|
||||||
|
|
||||||
|
// it might be a good idea to wrap the parameters into a struct
|
||||||
|
// and pass that struct into the function but this will lead to messier code
|
||||||
|
// const UINT8 aac_data[] = { 0x01, 0x00, 0xfe, 00, 00, 00, 00, 00, 00, 00, 00, 00, 0x11, 0x90
|
||||||
|
// }; first byte: 0: raw aac 1: adts 2: adif 3: latm/laos
|
||||||
UINT8 aac_tmp[] = {0x01, 0x00, 0xfe, 00, 00, 00, 00, 00, 00, 00, 00, 00, 0x00, 0x00};
|
UINT8 aac_tmp[] = {0x01, 0x00, 0xfe, 00, 00, 00, 00, 00, 00, 00, 00, 00, 0x00, 0x00};
|
||||||
uint16_t tag = 0;
|
uint16_t tag = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue