format: make media types and properties dynamic

Use URI properties to dynamically register the media types/subtypes and
property names. Add some helpers to set up the mappings.
This commit is contained in:
Wim Taymans 2017-03-21 11:28:23 +01:00
parent ee470fc6c6
commit 3f5a3e215b
25 changed files with 769 additions and 685 deletions

View file

@ -37,16 +37,16 @@ spa_pod_builder_push_format (SpaPODBuilder *builder,
{
const SpaFormat p = { { sizeof (SpaFormatBody), SPA_POD_TYPE_OBJECT },
{ { 0, 0 },
{ { sizeof (uint32_t), SPA_POD_TYPE_INT }, media_type },
{ { sizeof (uint32_t), SPA_POD_TYPE_INT }, media_subtype } } };
{ { sizeof (uint32_t), SPA_POD_TYPE_URI }, media_type },
{ { sizeof (uint32_t), SPA_POD_TYPE_URI }, media_subtype } } };
return spa_pod_builder_push (builder, frame, &p.pod,
spa_pod_builder_raw (builder, &p, sizeof(p)));
}
#define spa_pod_builder_format(b,f,media_type,media_subtype,...) \
spa_pod_builder_object(b, f, 0, 0, \
SPA_POD_TYPE_INT,media_type, \
SPA_POD_TYPE_INT,media_subtype, \
SPA_POD_TYPE_URI,media_type, \
SPA_POD_TYPE_URI,media_subtype, \
__VA_ARGS__)
SpaResult