Rework formats

Use a POD for the format body. This allows us to more easily build
and copy the formats.
Remove obsolete code to make video and audio formats.
Use SpaVideo/AudioInfo to keep track of formats. Make functions to parse
the format into the structures.
Update plugins
This commit is contained in:
Wim Taymans 2017-02-24 09:28:18 +01:00
parent 7fc73953cd
commit 16b62de53a
34 changed files with 1096 additions and 1579 deletions

View file

@ -95,24 +95,19 @@ pinos_serialize_format_get_size (const SpaFormat *format)
if (format == NULL)
return 0;
return pinos_serialize_props_get_size (&format->props) - sizeof (SpaProps) + sizeof (SpaFormat);
return SPA_FORMAT_SIZE (format);
}
size_t
pinos_serialize_format_serialize (void *dest, const SpaFormat *format)
{
SpaFormat *tf;
size_t size;
if (format == NULL)
return 0;
tf = dest;
tf->media_type = format->media_type;
tf->media_subtype = format->media_subtype;
dest = SPA_MEMBER (tf, offsetof (SpaFormat, props), void);
size = pinos_serialize_props_serialize (dest, &format->props) - sizeof (SpaProps) + sizeof (SpaFormat);
size = SPA_FORMAT_SIZE (format);
memcpy (dest, format, size);
return size;
}
@ -120,12 +115,7 @@ pinos_serialize_format_serialize (void *dest, const SpaFormat *format)
SpaFormat *
pinos_serialize_format_deserialize (void *src, off_t offset)
{
SpaFormat *f;
f = SPA_MEMBER (src, offset, SpaFormat);
pinos_serialize_props_deserialize (f, offsetof (SpaFormat, props));
return f;
return SPA_MEMBER (src, offset, SpaFormat);
}
SpaFormat *