mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
spa: Add channel mode to mp3 audio info and add channel mode docs
This commit is contained in:
parent
2042a0483b
commit
592c7c404c
4 changed files with 25 additions and 4 deletions
|
|
@ -33,8 +33,9 @@ spa_format_audio_mp3_parse(const struct spa_pod *format, struct spa_audio_info_m
|
|||
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),
|
||||
SPA_FORMAT_AUDIO_channels, SPA_POD_OPT_Int(&info->channels),
|
||||
SPA_FORMAT_AUDIO_MP3_channelMode, SPA_POD_OPT_Id(&info->channel_mode));
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
@ -55,6 +56,9 @@ spa_format_audio_mp3_build(struct spa_pod_builder *builder, uint32_t id,
|
|||
if (info->channels != 0)
|
||||
spa_pod_builder_add(builder,
|
||||
SPA_FORMAT_AUDIO_channels, SPA_POD_Int(info->channels), 0);
|
||||
if (info->channel_mode != 0)
|
||||
spa_pod_builder_add(builder,
|
||||
SPA_FORMAT_AUDIO_MP3_channelMode, SPA_POD_Id(info->channel_mode), 0);
|
||||
return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,15 +18,26 @@ extern "C" {
|
|||
|
||||
enum spa_audio_mp3_channel_mode {
|
||||
SPA_AUDIO_MP3_CHANNEL_MODE_UNKNOWN,
|
||||
/** Mono mode, only used if channel count is 1 */
|
||||
SPA_AUDIO_MP3_CHANNEL_MODE_MONO,
|
||||
/** Regular stereo mode with two independent channels */
|
||||
SPA_AUDIO_MP3_CHANNEL_MODE_STEREO,
|
||||
/**
|
||||
* Joint stereo mode, exploiting the similarities between channels
|
||||
* using techniques like mid-side coding
|
||||
*/
|
||||
SPA_AUDIO_MP3_CHANNEL_MODE_JOINTSTEREO,
|
||||
/**
|
||||
* Two mono tracks, different from stereo in that each channel
|
||||
* contains entirely different content (like two different mono songs)
|
||||
*/
|
||||
SPA_AUDIO_MP3_CHANNEL_MODE_DUAL,
|
||||
};
|
||||
|
||||
struct spa_audio_info_mp3 {
|
||||
uint32_t rate; /*< sample rate */
|
||||
uint32_t channels; /*< number of channels */
|
||||
uint32_t rate; /*< sample rate in Hz */
|
||||
uint32_t channels; /*< number of channels */
|
||||
enum spa_audio_mp3_channel_mode channel_mode; /*< MP3 channel mode */
|
||||
};
|
||||
|
||||
#define SPA_AUDIO_INFO_MP3_INIT(...) ((struct spa_audio_info_mp3) { __VA_ARGS__ })
|
||||
|
|
|
|||
|
|
@ -97,6 +97,8 @@ static const struct spa_type_info spa_type_media_subtype[] = {
|
|||
#define SPA_TYPE_INFO_FORMAT_AUDIO_WMA_BASE SPA_TYPE_INFO_FORMAT_AUDIO_WMA ":"
|
||||
#define SPA_TYPE_INFO_FORMAT_AUDIO_AMR SPA_TYPE_INFO_FORMAT_AUDIO_BASE "AMR"
|
||||
#define SPA_TYPE_INFO_FORMAT_AUDIO_AMR_BASE SPA_TYPE_INFO_FORMAT_AUDIO_AMR ":"
|
||||
#define SPA_TYPE_INFO_FORMAT_AUDIO_MP3 SPA_TYPE_INFO_FORMAT_AUDIO_BASE "MP3"
|
||||
#define SPA_TYPE_INFO_FORMAT_AUDIO_MP3_BASE SPA_TYPE_INFO_FORMAT_AUDIO_MP3 ":"
|
||||
|
||||
#define SPA_TYPE_INFO_FormatVideo SPA_TYPE_INFO_FORMAT_BASE "Video"
|
||||
#define SPA_TYPE_INFO_FORMAT_VIDEO_BASE SPA_TYPE_INFO_FormatVideo ":"
|
||||
|
|
@ -139,6 +141,8 @@ static const struct spa_type_info spa_type_format[] = {
|
|||
spa_type_audio_wma_profile },
|
||||
{ SPA_FORMAT_AUDIO_AMR_bandMode, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_AUDIO_AMR_BASE "bandMode",
|
||||
spa_type_audio_amr_band_mode },
|
||||
{ SPA_FORMAT_AUDIO_MP3_channelMode, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_AUDIO_MP3_BASE "channelMode",
|
||||
spa_type_audio_mp3_channel_mode },
|
||||
|
||||
{ SPA_FORMAT_VIDEO_format, SPA_TYPE_Id, SPA_TYPE_INFO_FORMAT_VIDEO_BASE "format",
|
||||
spa_type_video_format, },
|
||||
|
|
|
|||
|
|
@ -110,6 +110,8 @@ enum spa_format {
|
|||
|
||||
SPA_FORMAT_AUDIO_AMR_bandMode, /**< AMR band mode (Id enum spa_audio_amr_band_mode) */
|
||||
|
||||
SPA_FORMAT_AUDIO_MP3_channelMode, /**< MP3 channel mode, (Id enum spa_audio_mp3_channel_mode) */
|
||||
|
||||
|
||||
/* Video Format keys */
|
||||
SPA_FORMAT_START_Video = 0x20000,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue