Windows Media Audio Pro: Difference between revisions

From MultimediaWiki
Jump to navigation Jump to search
(Added one more extradata dump)
No edit summary
Line 68: Line 68:
[[Category:Audio Codecs]]
[[Category:Audio Codecs]]
[[Category:Undiscovered Audio Codecs]]
[[Category:Undiscovered Audio Codecs]]
[[Category: Multichannel Audio Codecs]]

Revision as of 07:05, 17 January 2008

The next generation of Windows Media audio codecs.

Extra data layout

This is a rough guess of the extra data from the asf container (little endian order).

byte 1-2    Bits per sample (wBitsPerSample) (http://msdn2.microsoft.com/en-us/library/ms791274.aspx)
byte 3-6    Channel mask (dwChannelMask) (http://msdn2.microsoft.com/en-us/library/ms790436.aspx)
byte 7-14   Not used
byte 15-16  Decoding flags, bitfield used for calculating samples per frame amongst others (int16_t)
byte 17-18  Probably some flags for low bitrate files.

Example extradata dump of a 5.1 file:

[[18] [0]] [[3f] [0] [0] [0]] [0] [0] [0] [0] [0] [0] [0] [0] [[e0] [0]] [0] [0]

Example extradata dump of a stereo file:

[[18] [0]] [[3] [0] [0] [0]] [0] [0] [0] [0] [0] [0] [0] [0] [[e0] [0]] [0] [0]

Example extradata dump of a low bitrate stereo file:

[[10] [0]] [[3] [0] [0] [0]] [0] [0] [0] [0] [0] [0] [0] [0] [[e0] [0]] [[42] [c0]]

Channel configuration

Wma pro uses the dwChannelMask for channel configuration.

SPEAKER_FRONT_LEFT             0x00001
SPEAKER_FRONT_RIGHT            0x00002
SPEAKER_FRONT_CENTER           0x00004
SPEAKER_LOW_FREQUENCY          0x00008
SPEAKER_BACK_LEFT              0x00010
SPEAKER_BACK_RIGHT             0x00020
SPEAKER_FRONT_LEFT_OF_CENTER   0x00040
SPEAKER_FRONT_RIGHT_OF_CENTER  0x00080
SPEAKER_BACK_CENTER            0x00100
SPEAKER_SIDE_LEFT              0x00200
SPEAKER_SIDE_RIGHT             0x00400
SPEAKER_TOP_CENTER             0x00800
SPEAKER_TOP_FRONT_LEFT         0x01000
SPEAKER_TOP_FRONT_CENTER       0x02000
SPEAKER_TOP_FRONT_RIGHT        0x04000
SPEAKER_TOP_BACK_LEFT          0x08000
SPEAKER_TOP_BACK_CENTER        0x10000
SPEAKER_TOP_BACK_RIGHT         0x20000

And the following configurations are valid (incorrect, will fix later):

channelmasks[8] = {
    NULL,
    SPEAKER_FRONT_LEFT,
    SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT,
    SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER,
    SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY,
    SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT,
    SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT,
    SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_FRONT_LEFT_OF_CENTER,
}

To get the active channel configuration use the channels parameter from the container and do a look up in this table.

channelmask = channelmasks[container channels]

Note that this makes the extradata channel mask redundant.