diff --git a/pinos/server/daemon.c b/pinos/server/daemon.c index 52fdd2e86..fc4bf554b 100644 --- a/pinos/server/daemon.c +++ b/pinos/server/daemon.c @@ -210,7 +210,7 @@ on_port_added (PinosNode *node, PinosPort *port, PinosClient *client) g_clear_error (&error); return; } - link = pinos_link_new (pinos_node_get_daemon (node), port, target, NULL); + link = pinos_link_new (pinos_node_get_daemon (node), port, target); pinos_client_add_object (client, G_OBJECT (link)); } } diff --git a/pinos/server/link.c b/pinos/server/link.c index 2d96cdd9d..5571b735e 100644 --- a/pinos/server/link.c +++ b/pinos/server/link.c @@ -56,9 +56,6 @@ struct _PinosLinkPrivate SpaNode *input_node; uint32_t input_port; - GBytes *possible_formats; - GBytes *format; - SpaBuffer *buffers[16]; unsigned int n_buffers; }; @@ -72,8 +69,6 @@ enum PROP_OUTPUT, PROP_INPUT, PROP_OBJECT_PATH, - PROP_POSSIBLE_FORMATS, - PROP_FORMAT, }; enum @@ -146,14 +141,6 @@ pinos_link_get_property (GObject *_object, g_value_set_string (value, priv->object_path); break; - case PROP_POSSIBLE_FORMATS: - g_value_set_boxed (value, priv->possible_formats); - break; - - case PROP_FORMAT: - g_value_set_boxed (value, priv->format); - break; - default: G_OBJECT_WARN_INVALID_PROPERTY_ID (link, prop_id, pspec); break; @@ -190,18 +177,6 @@ pinos_link_set_property (GObject *_object, priv->object_path = g_value_dup_string (value); break; - case PROP_POSSIBLE_FORMATS: - if (priv->possible_formats) - g_bytes_unref (priv->possible_formats); - priv->possible_formats = g_value_dup_boxed (value); - break; - - case PROP_FORMAT: - if (priv->format) - g_bytes_unref (priv->format); - priv->format = g_value_dup_boxed (value); - break; - default: G_OBJECT_WARN_INVALID_PROPERTY_ID (link, prop_id, pspec); break; @@ -430,8 +405,6 @@ pinos_link_finalize (GObject * object) PinosLinkPrivate *priv = link->priv; g_debug ("link %p: finalize", link); - g_clear_pointer (&priv->possible_formats, g_bytes_unref); - g_clear_pointer (&priv->format, g_bytes_unref); g_clear_object (&priv->daemon); g_clear_object (&priv->iface); g_free (priv->object_path); @@ -483,26 +456,6 @@ pinos_link_class_init (PinosLinkClass * klass) G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (gobject_class, - PROP_POSSIBLE_FORMATS, - g_param_spec_boxed ("possible-formats", - "Possible Formats", - "The possbile formats of the link", - G_TYPE_BYTES, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (gobject_class, - PROP_FORMAT, - g_param_spec_boxed ("format", - "Format", - "The format of the link", - G_TYPE_BYTES, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT | - G_PARAM_STATIC_STRINGS)); - signals[SIGNAL_REMOVE] = g_signal_new ("remove", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST, @@ -527,8 +480,7 @@ pinos_link_init (PinosLink * link) PinosLink * pinos_link_new (PinosDaemon *daemon, PinosPort *output, - PinosPort *input, - GBytes *format_filter) + PinosPort *input) { PinosLink *link; PinosPort *tmp; @@ -543,7 +495,6 @@ pinos_link_new (PinosDaemon *daemon, "daemon", daemon, "output", output, "input", input, - "possible-formats", format_filter, NULL); return link; @@ -582,41 +533,3 @@ pinos_link_get_object_path (PinosLink *link) return priv->object_path; } - -/** - * pinos_link_get_possible_formats: - * @link: a #PinosLink - * - * Get the possible formats of @link - * - * Returns: the possible formats or %NULL - */ -GBytes * -pinos_link_get_possible_formats (PinosLink *link) -{ - PinosLinkPrivate *priv; - - g_return_val_if_fail (PINOS_IS_LINK (link), NULL); - priv = link->priv; - - return priv->possible_formats; -} - -/** - * pinos_link_get_format: - * @link: a #PinosLink - * - * Get the format of @link - * - * Returns: the format or %NULL - */ -GBytes * -pinos_link_get_format (PinosLink *link) -{ - PinosLinkPrivate *priv; - - g_return_val_if_fail (PINOS_IS_LINK (link), NULL); - priv = link->priv; - - return priv->format; -} diff --git a/pinos/server/link.h b/pinos/server/link.h index 1c0a342b5..67219504d 100644 --- a/pinos/server/link.h +++ b/pinos/server/link.h @@ -64,13 +64,10 @@ GType pinos_link_get_type (void); PinosLink * pinos_link_new (PinosDaemon *daemon, PinosPort *output, - PinosPort *input, - GBytes *format_filter); + PinosPort *input); void pinos_link_remove (PinosLink *link); -GBytes * pinos_link_get_possible_formats (PinosLink *link); -GBytes * pinos_link_get_format (PinosLink *link); PinosProperties * pinos_link_get_properties (PinosLink *link); const gchar * pinos_link_get_object_path (PinosLink *link); diff --git a/spa/lib/props.c b/spa/lib/props.c index 856eeb6fe..dce475c5e 100644 --- a/spa/lib/props.c +++ b/spa/lib/props.c @@ -68,6 +68,7 @@ spa_props_get_prop (const SpaProps *props, info = &props->prop_info[index]; if ((info->flags & SPA_PROP_FLAG_READABLE) == 0) return SPA_RESULT_INVALID_PROPERTY_ACCESS; + if (props->unset_mask & (1u << index)) return SPA_RESULT_PROPERTY_UNSET; diff --git a/spa/plugins/v4l2/v4l2-source.c b/spa/plugins/v4l2/v4l2-source.c index 53c8737c6..937f19827 100644 --- a/spa/plugins/v4l2/v4l2-source.c +++ b/spa/plugins/v4l2/v4l2-source.c @@ -402,11 +402,15 @@ spa_v4l2_source_node_port_set_format (SpaNode *node, tf = &state->format[1]; fs = sizeof (V4l2Format); - spa_v4l2_format_init (f); - f->fmt.media_type = format->media_type; - f->fmt.media_subtype = format->media_subtype; - if ((res = spa_props_copy (&format->props, &f->fmt.props) < 0)) - return res; + if ((SpaFormat*)f != format) { + spa_v4l2_format_init (f); + f->fmt.media_type = format->media_type; + f->fmt.media_subtype = format->media_subtype; + if ((res = spa_props_copy (&format->props, &f->fmt.props) < 0)) + return res; + } else { + f = (V4l2Format*)format; + } if (spa_v4l2_set_format (this, f, flags & SPA_PORT_FORMAT_FLAG_TEST_ONLY) < 0) return SPA_RESULT_INVALID_MEDIA_TYPE;