[ Previous | Next | Contents | Glossary | Home | Search ]
Ultimedia Services Version 2 for AIX: Programmer's Guide and Reference

UMSPCM16toMPEG1 Object

This audio encoder object converts audio from PCM16 format into an MPEG-1 format. MPEG-1 is the Moving Pictures Experts Group standard for a compressed audio stream (ISO document number 11172-3). The Audio Encoder object is capable of producing either Layer I or Layer II compressed data. The input data format, PCM16, is 16 bits per sample, twos complement data, with MSB first.

In order to encode the audio data, a minimum amount of data must be delivered each time the filter/compression operation is called. The minimum amount needed can be determined using the get_minimum_input_size method. This amount of data must be delivered each time the compress method is called, otherwise an error return is generated. Handling the last chunk of input data may require some planning.

The reset method discards any previous input data samples that might be stored in the compression object. This method should be called before compressing a new audio stream.

The MPEG-1 Audio Encoder object inherits from the UMSFilter object and contains all those methods plus the following, MPEG-1 unique methods. The compression format (Layer I or Layer II), bit rate, and various header flags are all settable using the following methods.

To learn more about the UMSPCM16toMPEG1 object, see:

For introductory information, see Audio Codec Objects.

Enumeration Lists

enum CompressType {
   UMSPCM16toMPEG1_LAYER_1,   /* Layer I  audio format */
   UMSPCM16toMPEG1_LAYER_2}   /* Layer II audio format */
enum channelEncode {
   UMSPCM16toMPEG1_MONO,      /* Monophonic audio */
   UMSPCM16toMPEG1_STEREO,   /* Stereo audio signal */
   UMSPCM16toMPEG1_JOINT_STEREO};   /* Intensity stereo */
enum OnOff {
   UMSPCM16toMPEG1_On,   /* Bit ON */
   UMSPCM16toMPEG1_Off};   /* Bit OFF */

Method Descriptions

ReturnCode get_compress_type(inout CompressType compress_type)

Description

This method returns the current setting of the compression type.

Arguments
inout CompressType compress_type The return value of compress_type gives the current compression format.
Return Values

Success

Failure

ReturnCode get_copyright_flag(inout OnOff flag)

Description

This method queries the state of the copyright flag.

Arguments
inout OnOff flag The returned value, flag, indicates whether the copyright bit is enabled or disabled.
Return Values

Success

Failure

ReturnCode get_error_protect(inout OnOff flag)

Description

This method returns the state of the error protection flag.

Arguments
inout OnOff flag The return value, indicates whether error protection is turned On or Off.
Return Values

Success

Failure

ReturnCode get_minimum_input_size(inout long minimum_size)

Description

The value minimum_size will be filled in with the minimum amount of data needed in the filter method in order to do the compression. The PCM16toMPEG1 object requires a certain amount of data in order to begin encoding.

Arguments
inout long minimum_size The minimum of input data that must be available during a compress frame operation.
Return Values

Success

Failure

ReturnCode get_original_flag(inout OnOff flag)

Description

This method queries the current state of the original flag.

Arguments
inout OnOff flag The enum type, flag, queries the state of the original bit.
Return Values

Success

Failure

ReturnCode get_output_bit_rate(inout long bit_rate)

Description

Returns the current bit rate setting.

Arguments
inout long bit_rate The return value, bit_rate, is the compressed bits-per-second target rate for audio encoder.
Return Values

Success

Failure

ReturnCode set_compress_type(in CompressType compress_type)

Description

This method allows the user to select the MPEG-1 format for compression. Layer I typically gives a lower compression rate, but is somewhat easier to decode, while Layer II gives better compression at a cost of additional decoding complexity. Layer I is recommended for bit rates above 128 Kbits/s per channel. Layer II is recommended for bit rates around 128 kbits/s per channel.

Arguments
in CompressType compress_type The compress_type specifies the encoding format, Layer I or Layer II.
Return Values

Success

Failure

ReturnCode set_copyright_flag(in OnOff flag)

Description

If this flag is set Off, then the copyright bit in the MPEG-1 header is turned off; On turns the bit on, and indicates the audio material is copyrighted.

Arguments
in OnOff flag The enum type, flag, enables or disables the setting of the copyright bit in the header.
Return Values:

Success

Failure

ReturnCode set_error_protect(in OnOff flag)

Description

This method sets the flag to add a 16-bit parity-check word for optional error protection within the encoded bitstream. The MPEG-1 decoder would check the integrity of the compressed data stream. Error checking should only be enabled where data integrity is a problem.

Arguments
in OnOff flag The enum type, flag, indicates whether error protection should be enabled or disabled.
Return Values

Success

Failure

ReturnCode set_input_bit_rate(inout long bit_rate)

Description

This method sets the MPEG-1 compressed audio bit rate. The combined audio and video compressed data rate is typically set to be less than 1.5 Megabits per second. Typical data rates are around 200 kilobits per second. Valid values for Mono files are 32 to 192 kbit/s. Valid values for stereo files are 64 to 384 kbit/s.

Arguments
inout long bit_rate The input value, bit_rate, requested by the user. The actual rate set is returned by the object and specifies the average compressed data rate.
Return Values

Success

Failure

ValueChanged

ReturnCode set_original_flag (in OnOff flag)

Description

Set this flag to Off if the audio bitstream is a copy and On if the bitstream is an original.

Arguments
in OnOff flag The enum type, flag, sets the original bit in the MPEG-1 header.
Return Values

Success

Failure

For introductory information, see Audio Codec Objects.


[ Previous | Next | Contents | Glossary | Home | Search ]