dsp: removed unneeded format property and always use the default format
This commit is contained in:

committed by
George Kiagiadakis

parent
efbefe9e0e
commit
9f07ba229c
@@ -230,13 +230,13 @@ emit_endpoint_ports(WpPipewireSimpleEndpoint *self)
|
|||||||
node_proxy = wp_proxy_get_pw_proxy(WP_PROXY(self->proxy_node));
|
node_proxy = wp_proxy_get_pw_proxy(WP_PROXY(self->proxy_node));
|
||||||
g_return_if_fail (node_proxy);
|
g_return_if_fail (node_proxy);
|
||||||
|
|
||||||
/* TODO: Assume all clients have this format for now */
|
/* The default format for audio clients */
|
||||||
format.format = SPA_AUDIO_FORMAT_F32P;
|
format.format = SPA_AUDIO_FORMAT_F32P;
|
||||||
format.flags = 1;
|
format.flags = 1;
|
||||||
format.rate = 48000;
|
format.rate = 48000;
|
||||||
format.channels = 2;
|
format.channels = 2;
|
||||||
format.position[0] = 0;
|
format.position[0] = SPA_AUDIO_CHANNEL_FL;
|
||||||
format.position[1] = 0;
|
format.position[1] = SPA_AUDIO_CHANNEL_FR;
|
||||||
|
|
||||||
/* Build the param profile */
|
/* Build the param profile */
|
||||||
spa_pod_builder_init(&pod_builder, buf, sizeof(buf));
|
spa_pod_builder_init(&pod_builder, buf, sizeof(buf));
|
||||||
|
@@ -169,7 +169,6 @@ on_audio_dsp_converter_created(GObject *initable, GAsyncResult *res,
|
|||||||
WpPwAudioSoftdspEndpoint *self = data;
|
WpPwAudioSoftdspEndpoint *self = data;
|
||||||
g_autoptr (WpCore) core = wp_endpoint_get_core(WP_ENDPOINT(self));
|
g_autoptr (WpCore) core = wp_endpoint_get_core(WP_ENDPOINT(self));
|
||||||
const struct pw_node_info *target = NULL;
|
const struct pw_node_info *target = NULL;
|
||||||
const struct spa_audio_info_raw *format = NULL;
|
|
||||||
GVariantDict d;
|
GVariantDict d;
|
||||||
GVariantIter iter;
|
GVariantIter iter;
|
||||||
const gchar *stream;
|
const gchar *stream;
|
||||||
@@ -184,14 +183,12 @@ on_audio_dsp_converter_created(GObject *initable, GAsyncResult *res,
|
|||||||
/* Get the target and format */
|
/* Get the target and format */
|
||||||
target = wp_pw_audio_dsp_get_info (self->converter);
|
target = wp_pw_audio_dsp_get_info (self->converter);
|
||||||
g_return_if_fail (target);
|
g_return_if_fail (target);
|
||||||
g_object_get (self->converter, "format", &format, NULL);
|
|
||||||
g_return_if_fail (format);
|
|
||||||
|
|
||||||
/* Create the audio dsp streams */
|
/* Create the audio dsp streams */
|
||||||
g_variant_iter_init (&iter, self->streams);
|
g_variant_iter_init (&iter, self->streams);
|
||||||
for (i = 0; g_variant_iter_next (&iter, "&s", &stream); i++) {
|
for (i = 0; g_variant_iter_next (&iter, "&s", &stream); i++) {
|
||||||
wp_pw_audio_dsp_new (WP_ENDPOINT(self), i, stream, self->direction,
|
wp_pw_audio_dsp_new (WP_ENDPOINT(self), i, stream, self->direction, FALSE,
|
||||||
FALSE, target, format, on_audio_dsp_stream_created, self);
|
target, on_audio_dsp_stream_created, self);
|
||||||
|
|
||||||
/* Register the stream */
|
/* Register the stream */
|
||||||
g_variant_dict_init (&d, NULL);
|
g_variant_dict_init (&d, NULL);
|
||||||
@@ -210,7 +207,6 @@ on_proxy_node_created(GObject *initable, GAsyncResult *res, gpointer data)
|
|||||||
g_autofree gchar *name = NULL;
|
g_autofree gchar *name = NULL;
|
||||||
const struct spa_dict *props;
|
const struct spa_dict *props;
|
||||||
const struct pw_node_info *target = NULL;
|
const struct pw_node_info *target = NULL;
|
||||||
const struct spa_audio_info_raw *format = NULL;
|
|
||||||
|
|
||||||
/* Get the proxy node */
|
/* Get the proxy node */
|
||||||
self->proxy_node = WP_PROXY_NODE (object_safe_new_finish (self, initable,
|
self->proxy_node = WP_PROXY_NODE (object_safe_new_finish (self, initable,
|
||||||
@@ -230,13 +226,8 @@ on_proxy_node_created(GObject *initable, GAsyncResult *res, gpointer data)
|
|||||||
/* Create the converter proxy */
|
/* Create the converter proxy */
|
||||||
target = wp_proxy_node_get_info (self->proxy_node);
|
target = wp_proxy_node_get_info (self->proxy_node);
|
||||||
g_return_if_fail (target);
|
g_return_if_fail (target);
|
||||||
format = wp_proxy_port_get_format (self->proxy_port);
|
|
||||||
g_return_if_fail (format);
|
|
||||||
/* TODO: For now we create convert as a stream because convert mode does not
|
|
||||||
* generate any ports, not sure why */
|
|
||||||
wp_pw_audio_dsp_new (WP_ENDPOINT(self), WP_STREAM_ID_NONE, "master",
|
wp_pw_audio_dsp_new (WP_ENDPOINT(self), WP_STREAM_ID_NONE, "master",
|
||||||
self->direction, TRUE, target, format, on_audio_dsp_converter_created,
|
self->direction, TRUE, target, on_audio_dsp_converter_created, self);
|
||||||
self);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@@ -24,7 +24,6 @@ enum {
|
|||||||
PROP_DIRECTION,
|
PROP_DIRECTION,
|
||||||
PROP_CONVERT,
|
PROP_CONVERT,
|
||||||
PROP_TARGET,
|
PROP_TARGET,
|
||||||
PROP_FORMAT,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -51,7 +50,6 @@ struct _WpPwAudioDsp
|
|||||||
enum pw_direction direction;
|
enum pw_direction direction;
|
||||||
gboolean convert;
|
gboolean convert;
|
||||||
const struct pw_node_info *target;
|
const struct pw_node_info *target;
|
||||||
const struct spa_audio_info_raw *format;
|
|
||||||
|
|
||||||
/* All ports handled by the port added callback */
|
/* All ports handled by the port added callback */
|
||||||
GHashTable *handled_ports;
|
GHashTable *handled_ports;
|
||||||
@@ -420,9 +418,13 @@ on_audio_dsp_proxy_created(GObject *initable, GAsyncResult *res,
|
|||||||
pw_node_proxy_enum_params (pw_proxy, 0, SPA_PARAM_Props, 0, -1, NULL);
|
pw_node_proxy_enum_params (pw_proxy, 0, SPA_PARAM_Props, 0, -1, NULL);
|
||||||
|
|
||||||
if (!self->convert) {
|
if (!self->convert) {
|
||||||
/* Get the port format */
|
/* Use the default format */
|
||||||
g_return_if_fail (self->format);
|
format.format = SPA_AUDIO_FORMAT_F32P;
|
||||||
format = *self->format;
|
format.flags = 1;
|
||||||
|
format.rate = 48000;
|
||||||
|
format.channels = 2;
|
||||||
|
format.position[0] = SPA_AUDIO_CHANNEL_FL;
|
||||||
|
format.position[1] = SPA_AUDIO_CHANNEL_FR;
|
||||||
|
|
||||||
/* Emit the ports */
|
/* Emit the ports */
|
||||||
spa_pod_builder_init(&pod_builder, buf, sizeof(buf));
|
spa_pod_builder_init(&pod_builder, buf, sizeof(buf));
|
||||||
@@ -496,9 +498,6 @@ wp_pw_audio_dsp_set_property (GObject * object, guint property_id,
|
|||||||
case PROP_TARGET:
|
case PROP_TARGET:
|
||||||
self->target = g_value_get_pointer(value);
|
self->target = g_value_get_pointer(value);
|
||||||
break;
|
break;
|
||||||
case PROP_FORMAT:
|
|
||||||
self->format = g_value_get_pointer(value);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -530,9 +529,6 @@ wp_pw_audio_dsp_get_property (GObject * object, guint property_id,
|
|||||||
case PROP_TARGET:
|
case PROP_TARGET:
|
||||||
g_value_set_pointer (value, (gpointer)self->target);
|
g_value_set_pointer (value, (gpointer)self->target);
|
||||||
break;
|
break;
|
||||||
case PROP_FORMAT:
|
|
||||||
g_value_set_pointer (value, (gpointer)self->format);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -651,17 +647,12 @@ wp_pw_audio_dsp_class_init (WpPwAudioDspClass * klass)
|
|||||||
g_param_spec_pointer ("target", "target",
|
g_param_spec_pointer ("target", "target",
|
||||||
"The target node info of the audio DSP",
|
"The target node info of the audio DSP",
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
||||||
g_object_class_install_property (object_class, PROP_FORMAT,
|
|
||||||
g_param_spec_pointer ("format", "format",
|
|
||||||
"The format of the audio DSP ports",
|
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wp_pw_audio_dsp_new (WpEndpoint *endpoint, guint id, const char *name,
|
wp_pw_audio_dsp_new (WpEndpoint *endpoint, guint id, const char *name,
|
||||||
enum pw_direction direction, gboolean convert,
|
enum pw_direction direction, gboolean convert,
|
||||||
const struct pw_node_info *target, const struct spa_audio_info_raw *format,
|
const struct pw_node_info *target, GAsyncReadyCallback callback,
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
g_async_initable_new_async (
|
g_async_initable_new_async (
|
||||||
@@ -673,7 +664,6 @@ wp_pw_audio_dsp_new (WpEndpoint *endpoint, guint id, const char *name,
|
|||||||
"direction", direction,
|
"direction", direction,
|
||||||
"convert", convert,
|
"convert", convert,
|
||||||
"target", target,
|
"target", target,
|
||||||
"format", format,
|
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -20,8 +20,8 @@ void wp_pw_audio_dsp_id_decode (guint id, guint *stream_id, guint *control_id);
|
|||||||
|
|
||||||
void wp_pw_audio_dsp_new (WpEndpoint *endpoint, guint id, const char *name,
|
void wp_pw_audio_dsp_new (WpEndpoint *endpoint, guint id, const char *name,
|
||||||
enum pw_direction direction, gboolean convert,
|
enum pw_direction direction, gboolean convert,
|
||||||
const struct pw_node_info *target, const struct spa_audio_info_raw *format,
|
const struct pw_node_info *target, GAsyncReadyCallback callback,
|
||||||
GAsyncReadyCallback callback, gpointer user_data);
|
gpointer user_data);
|
||||||
WpPwAudioDsp * wp_pw_audio_dsp_new_finish (GObject *initable, GAsyncResult *res,
|
WpPwAudioDsp * wp_pw_audio_dsp_new_finish (GObject *initable, GAsyncResult *res,
|
||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user