Reggae common formats

From MorphOS Library

Grzegorz Kraszewski

Reggae common format or basic media format is the final result of media decoding, also intermediate format for processing (with filters) and input format for encoding and multiplexing. These formats are just raw PCM samples for audio and raw ARGB pixels for video. Stream description, like number of audio channels or video dimensions, is provided via attributes.

Audio common formats

All audio common formats are streams of linear PCM samples. Multichannel streams are interleaved. Stereo streams are intereleaved in [left, right] order. Interleaving for more channels is not yet defined. There are three sample formats defined:

  • MMFC_AUDIO_INT16 - the most common format, samples are 16-bit signed integers. Best for realtime processing targetted at audio.output.
  • MMFC_AUDIO_INT32 - very high quality, but slow processing. 32-bit signed integers. May be useful for non-realtime processing. Note that some filters may not support it.
  • MMFC_AUDIO_FLOAT32 - some compromise between the two above. Samples are single precision IEEE 754 floats with range normalized to <−1.0, +1.0>. Using floats makes avoiding internal overflow easier, but rounding errors may be dangerous.

Video common formats

Video common format is just an rectangular array of pixels. Row scan order is top-to-bottom, line scan order is left-to-right. Lines are not padded in any case. There is only one pixelformat defined currently:

  • MMFC_VIDEO_ARGB32 - every pixel takes 4 bytes, 8 bits per component, 8 bits for not premultiplied alpha channel. Pixel components order is [A, R, G, B].