Export (0) Print
Expand All

Dolby Digital Audio Encoder

The Dolby audio decoder is a Media Foundation transform (MFT) that encodes mono or stereo audio to Dolby Digital, also called Dolby AC-3. The encoder does not support multi-channel input, such as the 5.1 channel configuration.

Important  For versions of Windows prior to Windows 8, the Microsoft implementation of the Dolby Digital technology is restricted under terms of the Dolby Digital licensing program to use by Microsoft applications.

For more information about Dolby Digital audio, refer to Advanced Television Systems Committee (ATSC) document Digital Audio Compression Standard (AC-3, E-AC-3) Revision B.

Class Identifier

The class identifier (CLSID) of the Dolby audio decoder is CLSID_CMSDolbyDigitalEncMFT, defined in the header file wmcodecdsp.h.

Output Types

The output type must be set first, before the input type. The following table lists the required and optional attributes for the output media type.

AttributeDescriptionRemarks
MF_MT_MAJOR_TYPE Major type. Required. Must be MFMediaType_Audio.
MF_MT_SUBTYPE Audio subtype. Required. Must be MFAudioFormat_Dolby_AC3.
MF_MT_AUDIO_SAMPLES_PER_SECOND Samples per second. Required. The following values are supported:
  • 32000
  • 44100
  • 48000
MF_MT_AUDIO_NUM_CHANNELS Number of channels.Required. Must be either 1 (mono) or 2 (stereo).
MF_MT_AUDIO_CHANNEL_MASK Specifies the assignment of audio channels to speaker positions. Optional. If set, the value must be 0x3 for stereo (front left and right channels) or 0x4 for mono (front center channel).
MF_MT_AUDIO_AVG_BYTES_PER_SECOND Bit rate of the encoded AC-3 stream, in bytes per second. Optional. See Remarks for valid values. If this attribute is not set, the encoder uses a default bit rate, as described in Remarks.

 

If the optional attributes are not set, the encoder adds them to the media type after the type is set.

Input Types

The following table lists the required and optional attributes for the input media type.

AttributeDescriptionRemarks
MF_MT_MAJOR_TYPE Major type. Required. Must be MFMediaType_Audio.
MF_MT_SUBTYPE Audio subtype. Required. Must be MFAudioFormat_PCM or MFAudioFormat_Float.
MF_MT_AUDIO_BITS_PER_SAMPLE Number of bits per audio sample.Required. The value must be 16 if the subtype is MFAudioFormat_PCM, or 32 if the subtype is MFAudioFormat_Float.
MF_MT_AUDIO_SAMPLES_PER_SECOND Samples per second. Required. Must match the output type.
MF_MT_AUDIO_NUM_CHANNELS Number of channels.Required. Must match the output type.
MF_MT_AUDIO_BLOCK_ALIGNMENT Block alignment, in bytes.Required. Calculate the value as follows:
  • MFAudioFormat_PCM: Number of channels × 2.
  • MFAudioFormat_Float: Number of channels × 4.
MF_MT_AUDIO_AVG_BYTES_PER_SECOND Bit rate of the encoded AC3 stream, in bytes per second. Required. Must equal block alignment × samples per second.
MF_MT_AUDIO_CHANNEL_MASK Specifies the assignment of audio channels to speaker positions. Optional. If set, the value must match the output type.
MF_MT_AUDIO_VALID_BITS_PER_SAMPLE Number of valid bits of audio data in each audio sample.Optional. If set, the value must be identical to MF_MT_AUDIO_BITS_PER_SAMPLE.

 

The encoder does not support sample-rate conversion or stereo/mono conversion.

Remarks

Each Dolby AC-3 audio frame contains 1536 audio samples per channel. However, each input buffer to the encoder may contain any number of PCM samples. The size of each input buffer must be a multiple of the block alignment. The encoder caches input samples until it has enough for 1536 audio samples per channel; at which point the encoder outputs one AC-3 frame.

Each output buffer contains one raw AC-3 frame. The duration is equivalent to the duration of 1536 PCM samples at the current sampling rate (32 msec) at 48 kHz sample rate, 34.83 msec at 44.1 kHz, and 48 msec at 32 kHz). The size of each output buffer depends on the bit rate and the sample rate.

To specify the encoding bit rate, set the MF_MT_AUDIO_AVG_BYTES_PER_SECOND attribute in the output type. The following table shows the relation between encoding bit rate and MF_MT_AUDIO_AVG_BYTES_PER_SECOND.

Bit rate (kbps) MF_MT_AUDIO_AVG_BYTES_PER_SECOND Remarks
648000Mono only.
8010000Mono only.
9612000Mono only.
11214000Mono only.
12816000Mono or stereo.
16020000Mono or stereo.
19224000Mono or stereo. This is the default setting for mono.
22428000Mono or stereo.
25632000Mono or stereo. This is the default setting for stereo.
32040000Stereo only.
38448000Stereo only.
44856000Stereo only.

 

The default encoding bit rate is set at 256 kbps for stereo and 192 kbps for mono. The default settings are reflected in the media types returned by the encoder's IMFTransform::GetOutputAvailableType method.

Example Media Types

Here is an example of the media types that are needed to encode 16-bit integer PCM, 48-kHz stereo audio at the default bit rate of 256 kbps.

Output media type:

AttributeValue
MF_MT_MAJOR_TYPE MFMediaType_Audio
MF_MT_SUBTYPE MFAudioFormat_Dolby_AC3
MF_MT_AUDIO_SAMPLES_PER_SECOND 48000
MF_MT_AUDIO_NUM_CHANNELS 2

 

Input media type:

AttributeValue
MF_MT_MAJOR_TYPE MFMediaType_Audio
MF_MT_SUBTYPE MFAudioFormat_PCM
MF_MT_AUDIO_BITS_PER_SAMPLE 16
MF_MT_AUDIO_SAMPLES_PER_SECOND 48000
MF_MT_AUDIO_NUM_CHANNELS 2
MF_MT_AUDIO_BLOCK_ALIGNMENT 4
MF_MT_AUDIO_AVG_BYTES_PER_SECOND 192000

 

Requirements

Minimum supported client

Windows 8 [desktop apps | Windows Store apps]

Minimum supported server

None supported [desktop apps | Windows Store apps]

DLL

Msac3enc.dll

 

 

Community Additions

ADD
Show:
© 2014 Microsoft