pipewire/0018-pulse-server-print-encoding-name-in-format_info.patch
DistroBaker 3e5aaf49ce Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/pipewire.git#4467dc0ac39ed04eb0f686004dcd8e66555c6ad6
2021-02-22 09:10:22 +00:00

63 lines
2.2 KiB
Diff

From 4b591df145afa316e8e047764f9b98fc10cbacd9 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Fri, 19 Feb 2021 14:57:11 +0100
Subject: [PATCH 18/30] pulse-server: print encoding name in format_info
---
src/modules/module-protocol-pulse/format.c | 21 ++++++++++++++++++++-
src/modules/module-protocol-pulse/message.c | 4 +++-
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/src/modules/module-protocol-pulse/format.c b/src/modules/module-protocol-pulse/format.c
index 37abe5220..f718e70a7 100644
--- a/src/modules/module-protocol-pulse/format.c
+++ b/src/modules/module-protocol-pulse/format.c
@@ -476,9 +476,28 @@ enum encoding {
ENCODING_TRUEHD_IEC61937,
ENCODING_DTSHD_IEC61937,
ENCODING_MAX,
- NCODING_INVALID = -1,
+ ENCODING_INVALID = -1,
};
+static const char *encoding_names[] = {
+ [ENCODING_ANY] = "ANY",
+ [ENCODING_PCM] = "PCM",
+ [ENCODING_AC3_IEC61937] = "AC3-IEC61937",
+ [ENCODING_EAC3_IEC61937] = "EAC3-IEC61937",
+ [ENCODING_MPEG_IEC61937] = "MPEG-IEC61937",
+ [ENCODING_DTS_IEC61937] = "DTS-IEC61937",
+ [ENCODING_MPEG2_AAC_IEC61937] = "MPEG2-AAC-IEC61937",
+ [ENCODING_TRUEHD_IEC61937] = "TRUEHD-IEC61937",
+ [ENCODING_DTSHD_IEC61937] = "DTSHD-IEC61937",
+};
+
+static inline const char *format_encoding2name(enum encoding enc)
+{
+ if (enc >= 0 && enc < (int)SPA_N_ELEMENTS(encoding_names))
+ return encoding_names[enc];
+ return "INVALID";
+}
+
struct format_info {
enum encoding encoding;
struct pw_properties *props;
diff --git a/src/modules/module-protocol-pulse/message.c b/src/modules/module-protocol-pulse/message.c
index a0ddce058..e6c7e0a56 100644
--- a/src/modules/module-protocol-pulse/message.c
+++ b/src/modules/module-protocol-pulse/message.c
@@ -850,7 +850,9 @@ static int message_dump(enum spa_log_level level, struct message *m)
const struct spa_dict_item *it;
if ((res = read_format_info(m, &info)) < 0)
return res;
- pw_log(level, "%u: format-info: n_items:%u", o, info.props->dict.n_items);
+ pw_log(level, "%u: format-info: enc:%s n_items:%u",
+ o, format_encoding2name(info.encoding),
+ info.props->dict.n_items);
spa_dict_for_each(it, &info.props->dict)
pw_log(level, " '%s': '%s'", it->key, it->value);
break;
--
2.26.2