From 3d36755c4ff953fe5c9694473a6fb6aed9f70876 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 2 Oct 2018 10:17:12 +0200 Subject: [PATCH] audio-dsp: use type-info to get channel names --- spa/include/spa/param/audio/type-info.h | 4 +- spa/include/spa/param/type-info.h | 1 - spa/include/spa/param/video/type-info.h | 4 +- src/modules/module-media-session/audio-dsp.c | 46 ++------------------ 4 files changed, 8 insertions(+), 47 deletions(-) diff --git a/spa/include/spa/param/audio/type-info.h b/spa/include/spa/param/audio/type-info.h index 86bbdf68e..2c70f613b 100644 --- a/spa/include/spa/param/audio/type-info.h +++ b/spa/include/spa/param/audio/type-info.h @@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef __SPA_AUDIO_RAW_TYPES_H__ -#define __SPA_AUDIO_RAW_TYPES_H__ +#ifndef __SPA_AUDIO_TYPES_H__ +#define __SPA_AUDIO_TYPES_H__ #ifdef __cplusplus extern "C" { diff --git a/spa/include/spa/param/type-info.h b/spa/include/spa/param/type-info.h index 67db1f69e..a9e4f62d1 100644 --- a/spa/include/spa/param/type-info.h +++ b/spa/include/spa/param/type-info.h @@ -25,7 +25,6 @@ extern "C" { #endif #include -#include #include #include #include diff --git a/spa/include/spa/param/video/type-info.h b/spa/include/spa/param/video/type-info.h index dd3ab2652..9151e1ade 100644 --- a/spa/include/spa/param/video/type-info.h +++ b/spa/include/spa/param/video/type-info.h @@ -17,8 +17,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef __SPA_VIDEO_RAW_TYPES_H__ -#define __SPA_VIDEO_RAW_TYPES_H__ +#ifndef __SPA_VIDEO_TYPES_H__ +#define __SPA_VIDEO_TYPES_H__ #ifdef __cplusplus extern "C" { diff --git a/src/modules/module-media-session/audio-dsp.c b/src/modules/module-media-session/audio-dsp.c index 960a9fcc3..b1ab43e24 100644 --- a/src/modules/module-media-session/audio-dsp.c +++ b/src/modules/module-media-session/audio-dsp.c @@ -28,6 +28,8 @@ #include #include #include +#include +#include #include "pipewire/core.h" #include "pipewire/link.h" @@ -144,47 +146,6 @@ static const struct pw_port_implementation port_implementation = { .use_buffers = port_use_buffers, }; -static const char *chmap_names[] = -{ - "UNK", /**< unknown */ - "NA", /**< unmapped */ - "MONO", /**< mono */ - "FL", /**< front left */ - "FR", /**< front right */ - "RL", /**< rear left */ - "RR", /**< rear right */ - "FC", /**< front center */ - "LFE", /**< LFE */ - "SL", /**< side left */ - "SR", /**< side right */ - "RC", /**< rear center */ - "FLC", /**< front left center */ - "FRC", /**< front right center */ - "RLC", /**< rear left center */ - "RRC", /**< rear right center */ - "FLW", /**< front left wide */ - "FRW", /**< front right wide */ - "FLH", /**< front left high */ - "FCH", /**< front center high */ - "FRH", /**< front right high */ - "TC", /**< top center */ - "TFL", /**< top front left */ - "TFR", /**< top front right */ - "TFC", /**< top front center */ - "TRL", /**< top rear left */ - "TRR", /**< top rear right */ - "TRC", /**< top rear center */ - "TFLC", /**< top front left center */ - "TFRC", /**< top front right center */ - "TSL", /**< top side left */ - "TSR", /**< top side right */ - "LLFE", /**< left LFE */ - "RLFE", /**< right LFE */ - "BC", /**< bottom center */ - "BLC", /**< bottom left center */ - "BRC", /**< bottom right center */ -}; - static int make_channel_name(struct node *n, char *channel_name, int i, uint64_t channelmask) { int j; @@ -193,7 +154,8 @@ static int make_channel_name(struct node *n, char *channel_name, int i, uint64_t for (j = 0; j < 64; j++) { if (channelmask & (1LL << j)) { if (i-- == 0) { - sprintf(channel_name, "%s", chmap_names[j]); + sprintf(channel_name, "%s", + rindex(spa_type_audio_channel[j].name, ':')+1); return 1; } }