spa: Remove channel field from spa_audio_info_mpegh structure

A fixed channel count makes no sense with an entity based 3D audio format
like MPEG-H, because MPEG-H decoders do not simply decode; they
"spatialize" the entities, meaning that said entities are decoded and
rendered accordingto the needs of the target playback system and its
channel count.
This commit is contained in:
Carlos Rafael Giani 2025-10-02 12:12:53 +02:00
parent 52041e888c
commit 83ee3021e9
2 changed files with 8 additions and 6 deletions

View file

@ -33,8 +33,7 @@ spa_format_audio_mpegh_parse(const struct spa_pod *format, struct spa_audio_info
int res;
res = spa_pod_parse_object(format,
SPA_TYPE_OBJECT_Format, NULL,
SPA_FORMAT_AUDIO_rate, SPA_POD_OPT_Int(&info->rate),
SPA_FORMAT_AUDIO_channels, SPA_POD_OPT_Int(&info->channels));
SPA_FORMAT_AUDIO_rate, SPA_POD_OPT_Int(&info->rate));
return res;
}
@ -52,9 +51,6 @@ spa_format_audio_mpegh_build(struct spa_pod_builder *builder, uint32_t id,
if (info->rate != 0)
spa_pod_builder_add(builder,
SPA_FORMAT_AUDIO_rate, SPA_POD_Int(info->rate), 0);
if (info->channels != 0)
spa_pod_builder_add(builder,
SPA_FORMAT_AUDIO_channels, SPA_POD_Int(info->channels), 0);
return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
}

View file

@ -27,10 +27,16 @@ extern "C" {
*
* MPEG-H is documented in the ISO/IEC 23008-3 specification.
* MHAS is specified in ISO/IEC 23008-3, Clause 14.
*
* Note that unlike other formats, this one does not specify a channel
* count. This is because MPEG-H is entity-based; it contains multiple
* entities of different types (channel beds, audio objects etc.) which
* do not map 1:1 to channels. The channel amount is determined by
* decoders instead, based on the audio scene content and the target
* playback system.
*/
struct spa_audio_info_mpegh {
uint32_t rate; /*< sample rate */
uint32_t channels; /*< number of channels */
};
#define SPA_AUDIO_INFO_MPEGH_INIT(...) ((struct spa_audio_info_mpegh) { __VA_ARGS__ })