ReactOS 0.4.15-dev-7918-g2a2556c
mpg123 PCM sample encodings

Classes

struct  mpg123_fmt
 

Macros

#define MPG123_SAMPLESIZE(enc)
 
#define MPG123_ZEROSAMPLE(enc, siz, off)
 

Enumerations

enum  mpg123_enc_enum {
  MPG123_ENC_8 = 0x00f , MPG123_ENC_16 = 0x040 , MPG123_ENC_24 = 0x4000 , MPG123_ENC_32 = 0x100 ,
  MPG123_ENC_SIGNED = 0x080 , MPG123_ENC_FLOAT = 0xe00 , MPG123_ENC_SIGNED_16 = (MPG123_ENC_16|MPG123_ENC_SIGNED|0x10) , MPG123_ENC_UNSIGNED_16 = (MPG123_ENC_16|0x20) ,
  MPG123_ENC_UNSIGNED_8 = 0x01 , MPG123_ENC_SIGNED_8 = (MPG123_ENC_SIGNED|0x02) , MPG123_ENC_ULAW_8 = 0x04 , MPG123_ENC_ALAW_8 = 0x08 ,
  MPG123_ENC_SIGNED_32 = MPG123_ENC_32|MPG123_ENC_SIGNED|0x1000 , MPG123_ENC_UNSIGNED_32 = MPG123_ENC_32|0x2000 , MPG123_ENC_SIGNED_24 = MPG123_ENC_24|MPG123_ENC_SIGNED|0x1000 , MPG123_ENC_UNSIGNED_24 = MPG123_ENC_24|0x2000 ,
  MPG123_ENC_FLOAT_32 = 0x200 , MPG123_ENC_FLOAT_64 = 0x400 , MPG123_ENC_ANY
}
 

Variables

long mpg123_fmt::rate
 
int mpg123_fmt::channels
 
int mpg123_fmt::encoding
 

Detailed Description

These are definitions for audio formats used by libmpg123 and libout123.

Macro Definition Documentation

◆ MPG123_SAMPLESIZE

#define MPG123_SAMPLESIZE (   enc)
Value:
( \
(enc) < 1 \
? 0 \
: ( (enc) & MPG123_ENC_8 \
? 1 \
: ( (enc) & MPG123_ENC_16 \
? 2 \
: ( (enc) & MPG123_ENC_24 \
? 3 \
: ( ( (enc) & MPG123_ENC_32 \
|| (enc) == MPG123_ENC_FLOAT_32 ) \
? 4 \
: ( (enc) == MPG123_ENC_FLOAT_64 \
? 8 \
: 0 \
) ) ) ) ) )
@ MPG123_ENC_32
Definition: fmt123.h:52
@ MPG123_ENC_8
Definition: fmt123.h:46
@ MPG123_ENC_FLOAT_64
Definition: fmt123.h:80
@ MPG123_ENC_24
Definition: fmt123.h:50
@ MPG123_ENC_16
Definition: fmt123.h:48
@ MPG123_ENC_FLOAT_32
Definition: fmt123.h:78

Get size of one PCM sample with given encoding. This is included both in libmpg123 and libout123. Both offer an API function to provide the macro results from library compile-time, not that of you application. This most likely does not matter as I do not expect any fresh PCM sample encoding to appear. But who knows? Perhaps the encoding type will be abused for funny things in future, not even plain PCM. And, by the way: Thomas really likes the ?: operator.

Parameters
encthe encoding (mpg123_enc_enum value)
Returns
size of one sample in bytes

Definition at line 101 of file fmt123.h.

◆ MPG123_ZEROSAMPLE

#define MPG123_ZEROSAMPLE (   enc,
  siz,
  off 
)
Value:
( \
(enc) == MPG123_ENC_ULAW_8 \
? (off == 0 ? 0xff : 0x00) \
: ( (enc) == MPG123_ENC_ALAW_8 \
? (off == 0 ? 0xd5 : 0x00) \
: ( (((enc) & (MPG123_ENC_SIGNED|MPG123_ENC_FLOAT)) || (siz) != ((off)+1)) \
? 0x00 \
: 0x80 \
) ) )
@ MPG123_ENC_ULAW_8
Definition: fmt123.h:66
@ MPG123_ENC_SIGNED
Definition: fmt123.h:54
@ MPG123_ENC_ALAW_8
Definition: fmt123.h:68
@ MPG123_ENC_FLOAT
Definition: fmt123.h:56

Representation of zero in differing encodings. This exists to define proper silence in various encodings without having to link to libsyn123 to do actual conversions at runtime. You have to handle big/little endian order yourself, though. This takes the shortcut that any signed encoding has a zero with all-zero bits. Unsigned linear encodings just have the highest bit set (2^(n-1) for n bits), while the nonlinear 8-bit ones are special.

Parameters
encthe encoding (mpg123_enc_enum value)
sizbytes per sample (return value of MPG123_SAMPLESIZE(enc))
offbyte (octet) offset counted from LSB
Returns
unsigned byte value for the designated octet

Definition at line 130 of file fmt123.h.

Enumeration Type Documentation

◆ mpg123_enc_enum

An enum over all sample types possibly known to mpg123. The values are designed as bit flags to allow bitmasking for encoding families. This is also why the enum is not used as type for actual encoding variables, plain integers (at least 16 bit, 15 bit being used) cover the possible combinations of these flags.

Note that (your build of) libmpg123 does not necessarily support all these. Usually, you can expect the 8bit encodings and signed 16 bit. Also 32bit float will be usual beginning with mpg123-1.7.0 . What you should bear in mind is that (SSE, etc) optimized routines may be absent for some formats. We do have SSE for 16, 32 bit and float, though. 24 bit integer is done via postprocessing of 32 bit output – just cutting the last byte, no rounding, even. If you want better, do it yourself.

All formats are in native byte order. If you need different endinaness, you can simply postprocess the output buffers (libmpg123 wouldn't do anything else). The macro MPG123_SAMPLESIZE() can be helpful there.

Enumerator
MPG123_ENC_8 
MPG123_ENC_16 
MPG123_ENC_24 
MPG123_ENC_32 
MPG123_ENC_SIGNED 
MPG123_ENC_FLOAT 
MPG123_ENC_SIGNED_16 
MPG123_ENC_UNSIGNED_16 
MPG123_ENC_UNSIGNED_8 
MPG123_ENC_SIGNED_8 
MPG123_ENC_ULAW_8 
MPG123_ENC_ALAW_8 
MPG123_ENC_SIGNED_32 
MPG123_ENC_UNSIGNED_32 
MPG123_ENC_SIGNED_24 
MPG123_ENC_UNSIGNED_24 
MPG123_ENC_FLOAT_32 
MPG123_ENC_FLOAT_64 
MPG123_ENC_ANY 

Definition at line 43 of file fmt123.h.

44{
45/* 0000 0000 0000 1111 Some 8 bit integer encoding. */
46 MPG123_ENC_8 = 0x00f
47/* 0000 0000 0100 0000 Some 16 bit integer encoding. */
48, MPG123_ENC_16 = 0x040
49/* 0100 0000 0000 0000 Some 24 bit integer encoding. */
50, MPG123_ENC_24 = 0x4000
51/* 0000 0001 0000 0000 Some 32 bit integer encoding. */
52, MPG123_ENC_32 = 0x100
53/* 0000 0000 1000 0000 Some signed integer encoding. */
54, MPG123_ENC_SIGNED = 0x080
55/* 0000 1110 0000 0000 Some float encoding. */
56, MPG123_ENC_FLOAT = 0xe00
57/* 0000 0000 1101 0000 signed 16 bit */
59/* 0000 0000 0110 0000 unsigned 16 bit */
61/* 0000 0000 0000 0001 unsigned 8 bit */
63/* 0000 0000 1000 0010 signed 8 bit */
65/* 0000 0000 0000 0100 ulaw 8 bit */
66, MPG123_ENC_ULAW_8 = 0x04
67/* 0000 0000 0000 1000 alaw 8 bit */
68, MPG123_ENC_ALAW_8 = 0x08
69/* 0001 0001 1000 0000 signed 32 bit */
71/* 0010 0001 0000 0000 unsigned 32 bit */
73/* 0101 0000 1000 0000 signed 24 bit */
75/* 0110 0000 0000 0000 unsigned 24 bit */
77/* 0000 0010 0000 0000 32bit float */
78, MPG123_ENC_FLOAT_32 = 0x200
79/* 0000 0100 0000 0000 64bit float */
80, MPG123_ENC_FLOAT_64 = 0x400
81/* Any possibly known encoding from the list above. */
88};
@ MPG123_ENC_UNSIGNED_32
Definition: fmt123.h:72
@ MPG123_ENC_SIGNED_16
Definition: fmt123.h:58
@ MPG123_ENC_UNSIGNED_24
Definition: fmt123.h:76
@ MPG123_ENC_ANY
Definition: fmt123.h:82
@ MPG123_ENC_SIGNED_24
Definition: fmt123.h:74
@ MPG123_ENC_SIGNED_8
Definition: fmt123.h:64
@ MPG123_ENC_SIGNED_32
Definition: fmt123.h:70
@ MPG123_ENC_UNSIGNED_16
Definition: fmt123.h:60
@ MPG123_ENC_UNSIGNED_8
Definition: fmt123.h:62

Variable Documentation

◆ channels

int mpg123_fmt::channels

channel count

Definition at line 150 of file fmt123.h.

◆ encoding

int mpg123_fmt::encoding

encoding code, can be single value or bitwise or of members of mpg123_enc_enum

Definition at line 153 of file fmt123.h.

◆ rate

long mpg123_fmt::rate

sampling rate in Hz

Definition at line 149 of file fmt123.h.