mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
spa: implement a log topic for alsa
This commit is contained in:
parent
a6e66d9180
commit
e9d869b46f
12 changed files with 67 additions and 5 deletions
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/utils/keys.h>
|
||||
|
|
@ -48,6 +47,8 @@
|
|||
#include <spa/pod/parser.h>
|
||||
#include <spa/debug/pod.h>
|
||||
|
||||
#include "alsa.h"
|
||||
|
||||
#include "acp/acp.h"
|
||||
|
||||
extern struct spa_i18n *acp_i18n;
|
||||
|
|
@ -1043,6 +1044,8 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this = (struct impl *) handle;
|
||||
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
alsa_log_topic_init(this->log);
|
||||
|
||||
this->loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Loop);
|
||||
acp_i18n = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_I18N);
|
||||
if (this->loop == NULL) {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@
|
|||
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/node/node.h>
|
||||
#include <spa/utils/keys.h>
|
||||
|
|
@ -46,6 +45,8 @@
|
|||
#include <spa/pod/parser.h>
|
||||
#include <spa/debug/pod.h>
|
||||
|
||||
#include "alsa.h"
|
||||
|
||||
#define NAME "alsa-device"
|
||||
|
||||
#define MAX_DEVICES 64
|
||||
|
|
@ -532,6 +533,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this = (struct impl *) handle;
|
||||
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
alsa_log_topic_init(this->log);
|
||||
|
||||
this->device.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_Device,
|
||||
|
|
|
|||
|
|
@ -926,6 +926,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this = (struct state *) handle;
|
||||
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
alsa_log_topic_init(this->log);
|
||||
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@
|
|||
#include <spa/param/audio/format.h>
|
||||
#include <spa/pod/filter.h>
|
||||
|
||||
#include "alsa.h"
|
||||
|
||||
#define NAME "alsa-pcm-source"
|
||||
|
||||
#include "alsa-pcm.h"
|
||||
|
|
@ -873,6 +875,8 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this = (struct state *) handle;
|
||||
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
alsa_log_topic_init(this->log);
|
||||
|
||||
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ extern "C" {
|
|||
|
||||
#include <spa/support/plugin.h>
|
||||
#include <spa/support/loop.h>
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/utils/list.h>
|
||||
#include <spa/utils/json.h>
|
||||
|
||||
|
|
@ -49,6 +48,8 @@ extern "C" {
|
|||
#include <spa/param/latency-utils.h>
|
||||
#include <spa/param/audio/format-utils.h>
|
||||
|
||||
#include "alsa.h"
|
||||
|
||||
#include "dll.h"
|
||||
|
||||
#define MIN_LATENCY 16
|
||||
|
|
|
|||
|
|
@ -884,6 +884,8 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this = (struct seq_state *) handle;
|
||||
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
alsa_log_topic_init(this->log);
|
||||
spa_log_info(this->log, "this is an alsa message");
|
||||
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||
this->main_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Loop);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@
|
|||
#include <spa/support/system.h>
|
||||
#include <spa/control/control.h>
|
||||
|
||||
#include "alsa.h"
|
||||
|
||||
#define NAME "alsa-seq"
|
||||
|
||||
#include "dll.h"
|
||||
|
|
|
|||
|
|
@ -36,7 +36,6 @@ extern "C" {
|
|||
|
||||
#include <spa/support/plugin.h>
|
||||
#include <spa/support/loop.h>
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/utils/list.h>
|
||||
|
||||
#include <spa/node/node.h>
|
||||
|
|
@ -46,6 +45,8 @@ extern "C" {
|
|||
#include <spa/param/audio/format-utils.h>
|
||||
#include <spa/param/latency-utils.h>
|
||||
|
||||
#include "alsa.h"
|
||||
|
||||
#include "dll.h"
|
||||
|
||||
struct props {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@
|
|||
#include <libudev.h>
|
||||
#include <alsa/asoundlib.h>
|
||||
|
||||
#include <spa/support/log.h>
|
||||
#include <spa/utils/type.h>
|
||||
#include <spa/utils/keys.h>
|
||||
#include <spa/utils/names.h>
|
||||
|
|
@ -44,6 +43,8 @@
|
|||
#include <spa/monitor/device.h>
|
||||
#include <spa/monitor/utils.h>
|
||||
|
||||
#include "alsa.h"
|
||||
|
||||
#define NAME "alsa-udev"
|
||||
|
||||
#define MAX_DEVICES 64
|
||||
|
|
@ -759,6 +760,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this->notify.fd = -1;
|
||||
|
||||
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
|
||||
alsa_log_topic_init(this->log);
|
||||
this->main_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Loop);
|
||||
|
||||
if (this->main_loop == NULL) {
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include <errno.h>
|
||||
|
||||
#include <spa/support/plugin.h>
|
||||
#include <spa/support/log.h>
|
||||
|
||||
extern const struct spa_handle_factory spa_alsa_source_factory;
|
||||
extern const struct spa_handle_factory spa_alsa_sink_factory;
|
||||
|
|
@ -33,6 +34,9 @@ extern const struct spa_handle_factory spa_alsa_device_factory;
|
|||
extern const struct spa_handle_factory spa_alsa_seq_bridge_factory;
|
||||
extern const struct spa_handle_factory spa_alsa_acp_device_factory;
|
||||
|
||||
struct spa_log_topic log_topic = SPA_LOG_TOPIC(0, "spa.alsa");
|
||||
struct spa_log_topic *alsa_log_topic = &log_topic;
|
||||
|
||||
SPA_EXPORT
|
||||
int spa_handle_factory_enum(const struct spa_handle_factory **factory, uint32_t *index)
|
||||
{
|
||||
|
|
|
|||
39
spa/plugins/alsa/alsa.h
Normal file
39
spa/plugins/alsa/alsa.h
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/* Spa ALSA Source
|
||||
*
|
||||
* Copyright © 2021 Red Hat, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef SPA_ALSA_H
|
||||
#define SPA_ALSA_H
|
||||
|
||||
#include <spa/support/log.h>
|
||||
|
||||
#undef SPA_LOG_TOPIC_DEFAULT
|
||||
#define SPA_LOG_TOPIC_DEFAULT alsa_log_topic
|
||||
extern struct spa_log_topic *alsa_log_topic;
|
||||
|
||||
static inline void alsa_log_topic_init(struct spa_log *log)
|
||||
{
|
||||
spa_log_topic_init(log, alsa_log_topic);
|
||||
}
|
||||
|
||||
#endif /* SPA_ALSA_H */
|
||||
|
|
@ -2,6 +2,7 @@ subdir('acp')
|
|||
subdir('mixer')
|
||||
|
||||
spa_alsa_sources = ['alsa.c',
|
||||
'alsa.h',
|
||||
'alsa-udev.c',
|
||||
'alsa-acp-device.c',
|
||||
'alsa-pcm-device.c',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue