Linspire Audio Binary API

From MultimediaWiki
Jump to navigation Jump to search

Linspire is a Linux distribution that aims to rival Microsoft in desktop ease of use for the end-user. To that end, they have licensed certain of Microsoft's audio and video codecs that are not yet supported in open source. The binary decoder modules distributed with Linspire are Windows Media Audio 2 and 3. As of this writing, only Windows Media Audio 3 (WMA3) is called by the libavcodec glue code. However, both "Pro" and "Lossless" variants are supported with ths module.

The binary decoder for the WMA3 codec links into FFmpeg's libavcodec. The binary module has three interface functions: wma3init, wma3packet, and wma3end.

Initialization

The wma3init function has the following declaration:

 int wma3init(void *private_data, unsigned char *extradata, 
   long extradata_size, long sample_rate, long block_size,
   int wma3pro);
   
  • private_data: A private data structure used to store the internal decoder state. The libavcodec glue code declares this as an array of 1024 bytes.
  • extradata: The extradata bytes at the end of the WAVEFORMATEX header from the Microsoft media file (AVI or ASF).
  • extradata_size: The size of the buffer indicated by extradata.
  • sample_rate: The sampling frequency of the decompressed PCM audio.
  • block_size: The length of an individual block of encoded audio data.
  • wma3pro: This flag is set to 1 if initializing the decoder for decoding WMA3 "Pro" data. The flag is 0 if initializing the decoder for decoding WMA3 "Lossless" data.

Decoding

The wma3packet function has the following declaration:

 int wma3packet(void *private_data, void *data, int *data_size, unsigned char *buf, int buf_size);
  • private_data: A private data structure used to store the internal decoder state. The libavcodec glue code declares this as an array of 1024 bytes.
  • data: The void *data parameter passed into the libavcodec decoding function.
  • data_size: The int data_size parameter passed into the libavcodec decoding function.
  • buf: The encoded bytestream passed in from libavcodec.
  • buf_size: The size of the encoded bytestream.

The packet function returns an integer that can be returned from the libavcodec decode_packet function as part of the normal libavcodec API.

Cleanup

The wma3end function has the following declaration:

 int wma3end(void *private_data);
  • private_data: A private data structure used to store the internal decoder state. The libavcodec glue code declares this as an array of 1024 bytes.
  • The wma3end function returns an integer that can be returned from the libavcodec end function as part of the normal libavcodec API.

Original Source

Download the reference source here [1] Any mplayer package should do, the relevant files are libavcodec/wma3dec.c and libavcodec/wmv3dec.c.