diff --git a/spa/include/spa/buffer/meta.h b/spa/include/spa/buffer/meta.h index 1775b25a9..c9202e1b9 100644 --- a/spa/include/spa/buffer/meta.h +++ b/spa/include/spa/buffer/meta.h @@ -38,12 +38,12 @@ extern "C" { */ enum spa_meta_type { SPA_META_Invalid, - SPA_META_Header, - SPA_META_VideoCrop, - SPA_META_VideoDamage, - SPA_META_Bitmap, - SPA_META_Cursor, - SPA_META_Control, /**< metadata contains a spa_pod_sequence + SPA_META_Header, /**< struct spa_meta_header */ + SPA_META_VideoCrop, /**< struct spa_meta_region with cropping data */ + SPA_META_VideoDamage, /**< array of struct spa_meta_region with damage */ + SPA_META_Bitmap, /**< struct spa_meta_bitmap */ + SPA_META_Cursor, /**< struct spa_meta_cursor */ + SPA_META_Control, /**< metadata contains a spa_meta_control * associated with the data */ SPA_META_LAST, /**< not part of ABI/API */ @@ -91,7 +91,8 @@ struct spa_meta_region { #define spa_meta_region_is_valid(m) ((m)->region.size.width != 0 && (m)->region.size.height != 0) -#define spa_meta_region_for_each(pos,meta) \ +/** iterate all the items in a metadata */ +#define spa_meta_for_each(pos,meta) \ for (pos = (__typeof(pos))spa_meta_first(meta); \ spa_meta_check(pos, meta); \ (pos)++) diff --git a/spa/include/spa/buffer/type-info.h b/spa/include/spa/buffer/type-info.h index cee813113..35594d6d3 100644 --- a/spa/include/spa/buffer/type-info.h +++ b/spa/include/spa/buffer/type-info.h @@ -56,19 +56,23 @@ static const struct spa_type_info spa_type_data_type[] = { #define SPA_TYPE_INFO_Meta SPA_TYPE_INFO_POINTER_BASE "Meta" #define SPA_TYPE_INFO_META_BASE SPA_TYPE_INFO_Meta ":" +#define SPA_TYPE_INFO_META_Array SPA_TYPE_INFO_META_BASE "Array" +#define SPA_TYPE_INFO_META_ARRAY_BASE SPA_TYPE_INFO_META_Array ":" + #define SPA_TYPE_INFO_META_Region SPA_TYPE_INFO_META_BASE "Region" #define SPA_TYPE_INFO_META_REGION_BASE SPA_TYPE_INFO_META_Region ":" -#define SPA_TYPE_INFO_META_RegionArray SPA_TYPE_INFO_META_BASE "RegionArray" -#define SPA_TYPE_INFO_META_REGION_ARRAY_BASE SPA_TYPE_INFO_META_RegionArray ":" +#define SPA_TYPE_INFO_META_ARRAY_Region SPA_TYPE_INFO_META_ARRAY_BASE "Region" +#define SPA_TYPE_INFO_META_ARRAY_REGION_BASE SPA_TYPE_INFO_META_ARRAY_Region ":" static const struct spa_type_info spa_type_meta_type[] = { { SPA_META_Invalid, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_BASE "Invalid", NULL }, { SPA_META_Header, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_BASE "Header", NULL }, { SPA_META_VideoCrop, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_REGION_BASE "VideoCrop", NULL }, - { SPA_META_VideoDamage, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_REGION_ARRAY_BASE "VideoDamage", NULL }, + { SPA_META_VideoDamage, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_ARRAY_REGION_BASE "VideoDamage", NULL }, { SPA_META_Bitmap, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_BASE "Bitmap", NULL }, { SPA_META_Cursor, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_BASE "Cursor", NULL }, + { SPA_META_Control, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_BASE "Control", NULL }, { 0, 0, NULL, NULL }, }; diff --git a/spa/include/spa/debug/buffer.h b/spa/include/spa/debug/buffer.h index 69dcbc8a8..bc769bcf4 100644 --- a/spa/include/spa/debug/buffer.h +++ b/spa/include/spa/debug/buffer.h @@ -75,7 +75,7 @@ static inline int spa_debug_buffer(int indent, const struct spa_buffer *buffer) case SPA_META_VideoDamage: { struct spa_meta_region *h; - spa_meta_region_for_each(h, m) { + spa_meta_for_each(h, m) { spa_debug("%*s" " struct spa_meta_region:", indent, ""); spa_debug("%*s" " x: %d", indent, "", h->region.position.x); spa_debug("%*s" " y: %d", indent, "", h->region.position.y); diff --git a/spa/include/spa/monitor/device.h b/spa/include/spa/monitor/device.h index e2741d157..a946c9d25 100644 --- a/spa/include/spa/monitor/device.h +++ b/spa/include/spa/monitor/device.h @@ -37,11 +37,19 @@ extern "C" { /** * spa_device: * - * The device interface. + * The device interface can be used to monitor all kinds of devices + * and create objects as a result. Objects a typically other + * Devices or Nodes. + * */ #define SPA_VERSION_DEVICE 0 struct spa_device { struct spa_interface iface; }; +/** + * Information about the device and parameters it supports + * + * This information is part of the info event on a device. + */ struct spa_device_info { #define SPA_VERSION_DEVICE_INFO 0 uint32_t version; @@ -51,25 +59,30 @@ struct spa_device_info { #define SPA_DEVICE_CHANGE_MASK_PARAMS (1u<<2) uint64_t change_mask; uint64_t flags; - const struct spa_dict *props; - struct spa_param_info *params; - uint32_t n_params; + const struct spa_dict *props; /**< device properties */ + struct spa_param_info *params; /**< supported parameters */ + uint32_t n_params; /**< number of elements in params */ }; #define SPA_DEVICE_INFO_INIT() (struct spa_device_info){ SPA_VERSION_DEVICE_INFO, } +/** + * Information about a device object + * + * This information is part of the object_info event on the device. + */ struct spa_device_object_info { #define SPA_VERSION_DEVICE_OBJECT_INFO 0 uint32_t version; - uint32_t type; - const char *factory_name; + uint32_t type; /**< the object type managed by this device */ + const char *factory_name; /**< a factory name that implements the object */ #define SPA_DEVICE_OBJECT_CHANGE_MASK_FLAGS (1u<<0) #define SPA_DEVICE_OBJECT_CHANGE_MASK_PROPS (1u<<1) uint64_t change_mask; uint64_t flags; - const struct spa_dict *props; + const struct spa_dict *props; /**< extra object properties */ }; #define SPA_DEVICE_OBJECT_INFO_INIT() (struct spa_device_object_info){ SPA_VERSION_DEVICE_OBJECT_INFO, } @@ -134,7 +147,7 @@ struct spa_device_methods { * the device. * * Setting the events will trigger the info event and an - * object_info event for each managed node on the new + * object_info event for each managed object on the new * listener. * * \param device a #spa_device diff --git a/src/examples/export-sink.c b/src/examples/export-sink.c index 781e6d70a..d2e626d67 100644 --- a/src/examples/export-sink.c +++ b/src/examples/export-sink.c @@ -387,7 +387,7 @@ static int do_render(struct spa_loop *loop, bool async, uint32_t seq, } if ((m = spa_buffer_find_meta(buf, SPA_META_VideoDamage))) { - spa_meta_region_for_each(r, m) { + spa_meta_for_each(r, m) { if (!spa_meta_region_is_valid(r)) break; if (memcmp(&r->region, &d->region, sizeof(struct spa_region)) == 0) diff --git a/src/modules/module-protocol-native/v0/typemap.h b/src/modules/module-protocol-native/v0/typemap.h index 6620fbd44..b8ea4704b 100644 --- a/src/modules/module-protocol-native/v0/typemap.h +++ b/src/modules/module-protocol-native/v0/typemap.h @@ -44,7 +44,7 @@ const struct type_info { { "Spa:Enum:ParamId:Meta", SPA_TYPE_INFO_PARAM_ID_BASE "Meta", SPA_PARAM_Meta, }, { "Spa:Pointer:Meta:Header", SPA_TYPE_INFO_META_BASE "Header", SPA_META_Header, }, { "Spa:Pointer:Meta:VideoCrop", SPA_TYPE_INFO_META_REGION_BASE "VideoCrop", SPA_META_VideoCrop, }, - { "Spa:Pointer:Meta:VideoDamage", SPA_TYPE_INFO_META_REGION_ARRAY_BASE "VideoDamage", SPA_META_VideoDamage, }, + { "Spa:Pointer:Meta:VideoDamage", SPA_TYPE_INFO_META_ARRAY_REGION_BASE "VideoDamage", SPA_META_VideoDamage, }, { "Spa:Pointer:Meta:Bitmap", SPA_TYPE_INFO_META_BASE "Bitmap", SPA_META_Bitmap, }, { "Spa:Pointer:Meta:Cursor", SPA_TYPE_INFO_META_BASE "Cursor", SPA_META_Cursor, }, { "Spa:Enum:DataType:MemPtr", SPA_TYPE_INFO_DATA_BASE "MemPtr", SPA_DATA_MemPtr, },