> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Media Fmt API Basic

> This file contains media format IDs and definitions.

**Header:** `spf/api/modules/media_fmt_api_basic.h`

## Structures

### `payload_data_fmt_iec_packetized_t`

**Members**

<ParamField path="sample_rate" type="uint32_t" />

<ParamField path="num_channels" type="uint16_t" />

<ParamField path="reserved" type="uint16_t" />

### `payload_data_fmt_generic_compressed_t`

Payload structure used when media\_format\_t::data\_format = DATA\_FORMAT\_GENERIC\_COMPRESSED.

**Members**

<ParamField path="sample_rate" type="uint32_t">
  Number of samples per second in the audio stream.
</ParamField>

<ParamField path="bits_per_sample" type="uint16_t">
  Number of bits required to store one sample.
</ParamField>

<ParamField path="num_channels" type="uint16_t">
  Number of channels.
</ParamField>

### `payload_media_fmt_pcm_t`

Payload of MEDIA\_FMT\_ID\_PCM when media\_format\_t::fmt\_id = MEDIA\_FMT\_ID\_PCM and data\_format = DATA\_FORMAT\_FIXED\_POINT.

**Members**

<ParamField path="sample_rate" type="uint32_t">
  Number of samples per second in the audio stream.
</ParamField>

<ParamField path="bit_width" type="uint16_t">
  Bit width of each sample.
</ParamField>

<ParamField path="alignment" type="uint8_t">
  Alignment of bits\_per\_sample in sample\_word\_size.
</ParamField>

<ParamField path="interleaved" type="uint8_t">
  Indicates whether the data is interleaved.
</ParamField>

<ParamField path="bits_per_sample" type="uint16_t">
  Number of bits required to store one sample.
</ParamField>

<ParamField path="q_factor" type="uint16_t">
  Indicates the Q factor of the PCM data:
</ParamField>

<ParamField path="endianness" type="uint16_t">
  Indicates whether PCM samples are stored in little endian or big endian format.
</ParamField>

<ParamField path="num_channels" type="uint16_t">
  Number of channels in the channel\_mapping array.
</ParamField>

### `media_format_t`

Payload structure used by the following opcodes:

**Members**

<ParamField path="data_format" type="uint32_t">
  Format of the data.
</ParamField>

<ParamField path="fmt_id" type="uint32_t">
  Media format ID of the data stream.
</ParamField>

<ParamField path="payload_size" type="uint32_t">
  Size of the payload that immediately follows this structure.
</ParamField>

### `param_id_encoder_output_config_t`

Payload of the PARAM\_ID\_ENCODER\_OUTPUT\_CONFIG parameter.

**Members**

<ParamField path="data_format" type="uint32_t">
  Format of the output data.
</ParamField>

<ParamField path="fmt_id" type="uint32_t">
  Media format ID for the output data stream.
</ParamField>

<ParamField path="payload_size" type="uint32_t">
  Size of the custom payload that immediately follows this structure.
</ParamField>

## Type Definitions

### `payload_data_fmt_iec_packetized_t`

```cpp theme={null}
typedef struct payload_data_fmt_iec_packetized_t payload_data_fmt_iec_packetized_t
```

### `payload_data_fmt_generic_compressed_t`

```cpp theme={null}
typedef struct payload_data_fmt_generic_compressed_t payload_data_fmt_generic_compressed_t
```

### `payload_media_fmt_pcm_t`

```cpp theme={null}
typedef struct payload_media_fmt_pcm_t payload_media_fmt_pcm_t
```

### `media_format_t`

```cpp theme={null}
typedef struct media_format_t media_format_t
```

### `param_id_encoder_output_config_t`

```cpp theme={null}
typedef struct param_id_encoder_output_config_t param_id_encoder_output_config_t
```

## Enumerations

### `pcm_channel_map`

Channel map values.

#### Values

| Name | Value | Description |
| - | - | - |
| `PCM_CHANNEL_L` | = 1 | Front left channel. |
| `PCM_CHANNEL_R` | = 2 | Front right channel. |
| `PCM_CHANNEL_C` | = 3 | Front center channel. |
| `PCM_CHANNEL_LS` | = 4 | Left surround channel. |
| `PCM_CHANNEL_RS` | = 5 | Right surround channel. |
| `PCM_CHANNEL_LFE` | = 6 | Low frequency effect channel. |
| `PCM_CHANNEL_CS` | = 7 | Center surround channel; rear center channel. |
| `PCM_CHANNEL_CB` | = PCM\_CHANNEL\_CS | Center back channel. |
| `PCM_CHANNEL_LB` | = 8 | Left back channel; rear left channel. |
| `PCM_CHANNEL_RB` | = 9 | Right back channel; rear right channel. |
| `PCM_CHANNEL_TS` | = 10 | Top surround channel. |
| `PCM_CHANNEL_CVH` | = 11 | Center vertical height channel. |
| `PCM_CHANNEL_TFC` | = PCM\_CHANNEL\_CVH | Top front center channel. |
| `PCM_CHANNEL_MS` | = 12 | Mono surround channel. |
| `PCM_CHANNEL_FLC` | = 13 | Front left of center channel. |
| `PCM_CHANNEL_FRC` | = 14 | Front right of center channel. |
| `PCM_CHANNEL_RLC` | = 15 | Rear left of center channel. |
| `PCM_CHANNEL_RRC` | = 16 | Rear right of center channel. |
| `PCM_CHANNEL_LFE2` | = 17 | Secondary low frequency effect channel. |
| `PCM_CHANNEL_SL` | = 18 | Side left channel. |
| `PCM_CHANNEL_SR` | = 19 | Side right channel. |
| `PCM_CHANNEL_TFL` | = 20 | Top front left channel. |
| `PCM_CHANNEL_LVH` | = PCM\_CHANNEL\_TFL | Left vertical height channel. |
| `PCM_CHANNEL_TFR` | = 21 | Top front right channel. |
| `PCM_CHANNEL_RVH` | = PCM\_CHANNEL\_TFR | Right vertical height channel. |
| `PCM_CHANNEL_TC` | = 22 | Top center channel. |
| `PCM_CHANNEL_TBL` | = 23 | Top back left channel. |
| `PCM_CHANNEL_TBR` | = 24 | Top back right channel. |
| `PCM_CHANNEL_TSL` | = 25 | Top side left channel. |
| `PCM_CHANNEL_TSR` | = 26 | Top side right channel. |
| `PCM_CHANNEL_TBC` | = 27 | Top back center channel. |
| `PCM_CHANNEL_BFC` | = 28 | Bottom front center channel. |
| `PCM_CHANNEL_BFL` | = 29 | Bottom front left channel. |
| `PCM_CHANNEL_BFR` | = 30 | Bottom front right channel. |
| `PCM_CHANNEL_LW` | = 31 | Left wide channel. |
| `PCM_CHANNEL_RW` | = 32 | Right wide channel. |
| `PCM_CHANNEL_LSD` | = 33 | Left side direct channel. |
| `PCM_CHANNEL_RSD` | = 34 | Right side direct channel. |
| `PCM_CUSTOM_CHANNEL_MAP_1` | = 48 | Custom channel map 48 is reserved. |
| `PCM_CUSTOM_CHANNEL_MAP_2` | = 49 | Custom channel map 49 is reserved. |
| `PCM_CUSTOM_CHANNEL_MAP_3` | = 50 | Custom channel map 50 is reserved. |
| `PCM_CUSTOM_CHANNEL_MAP_4` | = 51 | Custom channel map 51 is reserved. |
| `PCM_CUSTOM_CHANNEL_MAP_5` | = 52 | Custom channel map 52 is reserved. |
| `PCM_CUSTOM_CHANNEL_MAP_6` | = 53 | Custom channel map 53 is reserved. |
| `PCM_CUSTOM_CHANNEL_MAP_7` | = 54 | Custom channel map 54 is reserved. |
| `PCM_CUSTOM_CHANNEL_MAP_8` | = 55 | Custom channel map 55 is reserved. |
| `PCM_CUSTOM_CHANNEL_MAP_9` | = 56 | Custom channel map 56 is reserved. |
| `PCM_CUSTOM_CHANNEL_MAP_10` | = 57 | Custom channel map 57 is reserved. |
| `PCM_CUSTOM_CHANNEL_MAP_11` | = 58 | Custom channel map 58 is reserved. |
| `PCM_CUSTOM_CHANNEL_MAP_12` | = 59 | Custom channel map 59 is reserved. |
| `PCM_CUSTOM_CHANNEL_MAP_13` | = 60 | Custom channel map 60 is reserved. |
| `PCM_CUSTOM_CHANNEL_MAP_14` | = 61 | Custom channel map 61 is reserved. |
| `PCM_CUSTOM_CHANNEL_MAP_15` | = 62 | Custom channel map 62 is reserved. |
| `PCM_CUSTOM_CHANNEL_MAP_16` | = 63 | Custom channel map 63 is reserved. |
| `PCM_MAX_CHANNEL_MAP` | = 63 | Last item in the list. |

## Macros

### `INFINITE`

Enumeration for infinity.

```c theme={null}
#define INFINITE -1
```

### `INVALID_VALUE`

Enumeration for an invalid value.

```c theme={null}
#define INVALID_VALUE 0
```

### `BITS_PER_SAMPLE_16`

Sixteen bits per sample (= sample word size).

```c theme={null}
#define BITS_PER_SAMPLE_16 16
```

### `BITS_PER_SAMPLE_24`

Twenty-four bits per sample (= sample word size).

```c theme={null}
#define BITS_PER_SAMPLE_24 24
```

### `BITS_PER_SAMPLE_32`

Thirty-two bits per sample (= sample word size).

```c theme={null}
#define BITS_PER_SAMPLE_32 32
```

### `BYTES_PER_SAMPLE_TWO`

Two bytes per sample.

```c theme={null}
#define BYTES_PER_SAMPLE_TWO 2
```

### `BYTES_PER_SAMPLE_THREE`

Three bytes per sample.

```c theme={null}
#define BYTES_PER_SAMPLE_THREE 3
```

### `BYTES_PER_SAMPLE_FOUR`

Four bytes per sample.

```c theme={null}
#define BYTES_PER_SAMPLE_FOUR 4
```

### `BIT_WIDTH_16`

Sample has a bit width of 16 (the actual width of the sample in a word).

```c theme={null}
#define BIT_WIDTH_16 16
```

### `BIT_WIDTH_24`

Sample has a bit width of 24 (the actual width of the sample in a word).

```c theme={null}
#define BIT_WIDTH_24 24
```

### `BIT_WIDTH_32`

Sample has a bit width of 32 (the actual width of the sample in a word).

```c theme={null}
#define BIT_WIDTH_32 32
```

### `PCM_LSB_ALIGNED`

Enumeration for LSB alignment.

```c theme={null}
#define PCM_LSB_ALIGNED 1
```

### `PCM_MSB_ALIGNED`

Enumeration for MSB alignment.

```c theme={null}
#define PCM_MSB_ALIGNED 2
```

### `PCM_Q_FACTOR_15`

Enumeration for the Q15 factor.

```c theme={null}
#define PCM_Q_FACTOR_15 15
```

### `PCM_Q_FACTOR_23`

Enumeration for the Q23 factor.

```c theme={null}
#define PCM_Q_FACTOR_23 23
```

### `PCM_Q_FACTOR_27`

Enumeration for the Q27 factor.

```c theme={null}
#define PCM_Q_FACTOR_27 27
```

### `PCM_Q_FACTOR_31`

Enumeration for the Q31 factor.

```c theme={null}
#define PCM_Q_FACTOR_31 31
```

### `PCM_QFORMAT_SHIFT_FACTOR`

Shift factor for Q31 \<=> Q28 conversion for 32-bit P.

```c theme={null}
#define PCM_QFORMAT_SHIFT_FACTOR (PCM_Q_FACTOR_31 - PCM_Q_FACTOR_27)
```

### `SAMPLE_RATE_8K`

Sampling rate is 8 kHz.

```c theme={null}
#define SAMPLE_RATE_8K 8000
```

### `SAMPLE_RATE_11_025K`

Sampling rate is 11.025 kHz.

```c theme={null}
#define SAMPLE_RATE_11_025K 11025
```

### `SAMPLE_RATE_12K`

Sampling rate is 12 kHz.

```c theme={null}
#define SAMPLE_RATE_12K 12000
```

### `SAMPLE_RATE_16K`

Sampling rate is 16 kHz.

```c theme={null}
#define SAMPLE_RATE_16K 16000
```

### `SAMPLE_RATE_22_05K`

Sampling rate is 22.05 kHz.

```c theme={null}
#define SAMPLE_RATE_22_05K 22050
```

### `SAMPLE_RATE_24K`

Sampling rate is 24 kHz.

```c theme={null}
#define SAMPLE_RATE_24K 24000
```

### `SAMPLE_RATE_32K`

Sampling rate is 32 kHz.

```c theme={null}
#define SAMPLE_RATE_32K 32000
```

### `SAMPLE_RATE_44_1K`

Sampling rate is 44.1 kHz.

```c theme={null}
#define SAMPLE_RATE_44_1K 44100
```

### `SAMPLE_RATE_48K`

Sampling rate is 48 kHz.

```c theme={null}
#define SAMPLE_RATE_48K 48000
```

### `SAMPLE_RATE_88_2K`

Sampling rate is 88.2 kHz.

```c theme={null}
#define SAMPLE_RATE_88_2K 88200
```

### `SAMPLE_RATE_96K`

Sampling rate is 96 kHz.

```c theme={null}
#define SAMPLE_RATE_96K 96000
```

### `SAMPLE_RATE_176_4K`

Sampling rate is 176.4 kHz.

```c theme={null}
#define SAMPLE_RATE_176_4K 176400
```

### `SAMPLE_RATE_192K`

Sampling rate is 192 kHz.

```c theme={null}
#define SAMPLE_RATE_192K 192000
```

### `SAMPLE_RATE_352_8K`

Sampling rate is 352.8 kHz.

```c theme={null}
#define SAMPLE_RATE_352_8K 352800
```

### `SAMPLE_RATE_384K`

Sampling rate is 384 kHz.

```c theme={null}
#define SAMPLE_RATE_384K 384000
```

### `PCM_LITTLE_ENDIAN`

Byte order is little endian.

```c theme={null}
#define PCM_LITTLE_ENDIAN 1
```

### `PCM_BIG_ENDIAN`

Byte order is big endian.

```c theme={null}
#define PCM_BIG_ENDIAN 2
```

### `PCM_INTERLEAVED`

PCM data is interleaved.

```c theme={null}
#define PCM_INTERLEAVED 1
```

### `PCM_DEINTERLEAVED_PACKED`

PCM data is de-interleaved packed.

```c theme={null}
#define PCM_DEINTERLEAVED_PACKED 2
```

### `PCM_DEINTERLEAVED_UNPACKED`

PCM data is de-interleaved unpacked.

```c theme={null}
#define PCM_DEINTERLEAVED_UNPACKED 3
```

### `DATA_FORMAT_FIXED_POINT`

Enumeration for the fixed-point data format.

```c theme={null}
#define DATA_FORMAT_FIXED_POINT 1
```

### `DATA_FORMAT_IEC61937_PACKETIZED`

Data format is an IEC 61937 packetized stream.

```c theme={null}
#define DATA_FORMAT_IEC61937_PACKETIZED 2
```

### `DATA_FORMAT_IEC60958_PACKETIZED`

Data format is IEC 60958 packetized stream for PCM only.

```c theme={null}
#define DATA_FORMAT_IEC60958_PACKETIZED 3
```

### `DATA_FORMAT_DSD_OVER_PCM`

Data format is a DSD-over-PCM stream.

```c theme={null}
#define DATA_FORMAT_DSD_OVER_PCM 4
```

### `DATA_FORMAT_GENERIC_COMPRESSED`

Data format is a generic compressed stream.

```c theme={null}
#define DATA_FORMAT_GENERIC_COMPRESSED 5
```

### `DATA_FORMAT_RAW_COMPRESSED`

Data format is a Raw compressed stream.

```c theme={null}
#define DATA_FORMAT_RAW_COMPRESSED 6
```

### `DATA_FORMAT_COMPR_OVER_PCM_PACKETIZED`

Compressed bitstreams are packetized like PCM using a QTI-designed packetizer.

```c theme={null}
#define DATA_FORMAT_COMPR_OVER_PCM_PACKETIZED 7
```

### `DATA_FORMAT_IEC60958_PACKETIZED_NON_LINEAR`

Data format is an IEC 60958 packetized stream for compressed streams.

```c theme={null}
#define DATA_FORMAT_IEC60958_PACKETIZED_NON_LINEAR 8
```

### `PARAM_VAL_UNSET`

Value of a configured parameter (like bits\_per\_sample and num\_channels) is don't care .

```c theme={null}
#define PARAM_VAL_UNSET (-2)
```

### `PARAM_VAL_NATIVE`

Value of a configured parameter (like bits\_per\_sample and num\_channels) must follow the input media format that the module will receive or has received.

```c theme={null}
#define PARAM_VAL_NATIVE (-1)
```

### `PARAM_VAL_INVALID`

Value of a configured parameter (like bits\_per\_sample and num\_channels) is considered invalid and the Set parameter command should result in an error.

```c theme={null}
#define PARAM_VAL_INVALID 0
```

### `MEDIA_FMT_ID_PCM`

Identifier for the media format used to identify a PCM stream.

```c theme={null}
#define MEDIA_FMT_ID_PCM 0x09001000
```

### `PARAM_ID_MEDIA_FORMAT`

Identifier for the parameter used to set the media format on any Shared Memory Endpoint module.

```c theme={null}
#define PARAM_ID_MEDIA_FORMAT 0x0800100C
```

### `PARAM_ID_ENCODER_OUTPUT_CONFIG`

Identifier for the parameter that configures the encoder.

```c theme={null}
#define PARAM_ID_ENCODER_OUTPUT_CONFIG 0x08001009
```
