More type cleanups

SPA_ID_* -> SPA_TYPE_*. We use 'type' for all registered types.
ID refers to either a registered type or an enum.
Improve introspection of object ids. Make 0 an invalid enum and
use it to look up the object id type.
Move some type-info files together.
Swap type and id of the object, we first specify the type and then
the id because the meaning of the id depends on the object type.
This commit is contained in:
Wim Taymans 2018-08-27 15:03:11 +02:00
parent 281b65934e
commit 90c1a95eef
117 changed files with 1198 additions and 1272 deletions

View file

@ -26,11 +26,6 @@ extern "C" {
#include <spa/support/loop.h>
#define SPA_TYPE__DBus SPA_TYPE_INTERFACE_BASE "DBus"
#define SPA_TYPE_DBUS_BASE SPA_TYPE__DBus ":"
#define SPA_TYPE_DBUS__Connection SPA_TYPE_DBUS_BASE "Connection"
enum spa_dbus_type {
SPA_DBUS_TYPE_SESSION, /**< The login session bus */
SPA_DBUS_TYPE_SYSTEM, /**< The systemwide bus */

View file

@ -1,43 +0,0 @@
/* Simple Plugin API
* Copyright (C) 2016 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __SPA_LOOP_TYPES_H__
#define __SPA_LOOP_TYPES_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <spa/support/loop.h>
#include <spa/utils/type-info.h>
#define SPA_TYPE__Loop SPA_TYPE_INTERFACE_BASE "Loop"
#define SPA_TYPE_LOOP_BASE SPA_TYPE__Loop ":"
#define SPA_TYPE__LoopControl SPA_TYPE_INTERFACE_BASE "LoopControl"
#define SPA_TYPE__LoopUtils SPA_TYPE_INTERFACE_BASE "LoopUtils"
#define SPA_TYPE_LOOP__MainLoop SPA_TYPE_LOOP_BASE "MainLoop"
#define SPA_TYPE_LOOP__DataLoop SPA_TYPE_LOOP_BASE "DataLoop"
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* __SPA_LOOP_H__ */

View file

@ -35,16 +35,16 @@ struct spa_handle {
/* user_data that can be set by the application */
void *user_data;
/**
* Get the interface provided by \a handle with \a interface_id.
* Get the interface provided by \a handle with \a type.
*
* \param handle a spa_handle
* \param interface_id the interface id
* \param type the interface type
* \param interface result to hold the interface.
* \return 0 on success
* -ENOTSUP when there are no interfaces
* -EINVAL when handle or info is NULL
*/
int (*get_interface) (struct spa_handle *handle, uint32_t interface_id, void **interface);
int (*get_interface) (struct spa_handle *handle, uint32_t type, void **interface);
/**
* Clean up the memory of \a handle. After this, \a handle should not be used
* anymore.