mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
Unify props, params and formats
Make enum_params and set_param to configure properties, format and other parameters. This allows us to remove some duplicate code and make the properties and parameters much more extensible. Use the object id to mark the id of the parameter. Remove the spa_format and spa_props. We can now make the client-node easier by merging the various format methods into the params. Make the stream API more powerful now that we can pass params around.
This commit is contained in:
parent
b6ee67905d
commit
f3bca48398
87 changed files with 3773 additions and 3580 deletions
|
|
@ -24,7 +24,7 @@
|
|||
#include <gst/video/video.h>
|
||||
#include <gst/audio/audio.h>
|
||||
|
||||
#include <spa/format-builder.h>
|
||||
#include <spa/pod-builder.h>
|
||||
#include <spa/video/format-utils.h>
|
||||
#include <spa/audio/format-utils.h>
|
||||
|
||||
|
|
@ -542,7 +542,7 @@ write_pod (struct spa_pod_builder *b, uint32_t ref, const void *data, uint32_t s
|
|||
return ref;
|
||||
}
|
||||
|
||||
static struct spa_format *
|
||||
static struct spa_pod_object *
|
||||
convert_1 (GstCapsFeatures *cf, GstStructure *cs)
|
||||
{
|
||||
ConvertData d;
|
||||
|
|
@ -557,9 +557,9 @@ convert_1 (GstCapsFeatures *cf, GstStructure *cs)
|
|||
|
||||
d.b.write = write_pod;
|
||||
|
||||
spa_pod_builder_push_format (&d.b, &f, type.format,
|
||||
*d.type->media_type,
|
||||
*d.type->media_subtype);
|
||||
spa_pod_builder_push_object (&d.b, &f, 0, type.format);
|
||||
spa_pod_builder_id(&d.b, *d.type->media_type);
|
||||
spa_pod_builder_id(&d.b, *d.type->media_subtype);
|
||||
|
||||
if (*d.type->media_type == type.media_type.video)
|
||||
handle_video_fields (&d);
|
||||
|
|
@ -568,15 +568,15 @@ convert_1 (GstCapsFeatures *cf, GstStructure *cs)
|
|||
|
||||
spa_pod_builder_pop (&d.b, &f);
|
||||
|
||||
return SPA_MEMBER (d.b.data, 0, struct spa_format);
|
||||
return SPA_MEMBER (d.b.data, 0, struct spa_pod_object);
|
||||
}
|
||||
|
||||
struct spa_format *
|
||||
struct spa_pod_object *
|
||||
gst_caps_to_format (GstCaps *caps, guint index, struct spa_type_map *map)
|
||||
{
|
||||
GstCapsFeatures *f;
|
||||
GstStructure *s;
|
||||
struct spa_format *res;
|
||||
struct spa_pod_object *res;
|
||||
|
||||
g_return_val_if_fail (GST_IS_CAPS (caps), NULL);
|
||||
g_return_val_if_fail (gst_caps_is_fixed (caps), NULL);
|
||||
|
|
@ -596,7 +596,7 @@ foreach_func (GstCapsFeatures *features,
|
|||
GstStructure *structure,
|
||||
GPtrArray *array)
|
||||
{
|
||||
struct spa_format *fmt;
|
||||
struct spa_pod_object *fmt;
|
||||
|
||||
if ((fmt = convert_1 (features, structure)))
|
||||
g_ptr_array_insert (array, -1, fmt);
|
||||
|
|
@ -794,7 +794,7 @@ handle_fraction_prop (struct spa_pod_prop *prop, const char *key, GstCaps *res)
|
|||
}
|
||||
}
|
||||
GstCaps *
|
||||
gst_caps_from_format (const struct spa_format *format, struct spa_type_map *map)
|
||||
gst_caps_from_format (const struct spa_pod_object *format, struct spa_type_map *map)
|
||||
{
|
||||
GstCaps *res = NULL;
|
||||
uint32_t media_type, media_subtype;
|
||||
|
|
@ -802,13 +802,13 @@ gst_caps_from_format (const struct spa_format *format, struct spa_type_map *map)
|
|||
|
||||
ensure_types(map);
|
||||
|
||||
media_type = SPA_FORMAT_MEDIA_TYPE (format);
|
||||
media_subtype = SPA_FORMAT_MEDIA_SUBTYPE (format);
|
||||
spa_pod_object_parse(format, "I", &media_type,
|
||||
"I", &media_subtype);
|
||||
|
||||
if (media_type == type.media_type.video) {
|
||||
if (media_subtype == type.media_subtype.raw) {
|
||||
res = gst_caps_new_empty_simple ("video/x-raw");
|
||||
if ((prop = spa_format_find_prop (format, type.format_video.format))) {
|
||||
if ((prop = spa_pod_object_find_prop (format, type.format_video.format))) {
|
||||
handle_id_prop (prop, "format", res);
|
||||
}
|
||||
}
|
||||
|
|
@ -821,13 +821,13 @@ gst_caps_from_format (const struct spa_format *format, struct spa_type_map *map)
|
|||
"alignment", G_TYPE_STRING, "au",
|
||||
NULL);
|
||||
}
|
||||
if ((prop = spa_format_find_prop (format, type.format_video.size))) {
|
||||
if ((prop = spa_pod_object_find_prop (format, type.format_video.size))) {
|
||||
handle_rect_prop (prop, "width", "height", res);
|
||||
}
|
||||
if ((prop = spa_format_find_prop (format, type.format_video.framerate))) {
|
||||
if ((prop = spa_pod_object_find_prop (format, type.format_video.framerate))) {
|
||||
handle_fraction_prop (prop, "framerate", res);
|
||||
}
|
||||
if ((prop = spa_format_find_prop (format, type.format_video.max_framerate))) {
|
||||
if ((prop = spa_pod_object_find_prop (format, type.format_video.max_framerate))) {
|
||||
handle_fraction_prop (prop, "max-framerate", res);
|
||||
}
|
||||
} else if (media_type == type.media_type.audio) {
|
||||
|
|
@ -835,13 +835,13 @@ gst_caps_from_format (const struct spa_format *format, struct spa_type_map *map)
|
|||
res = gst_caps_new_simple ("audio/x-raw",
|
||||
"layout", G_TYPE_STRING, "interleaved",
|
||||
NULL);
|
||||
if ((prop = spa_format_find_prop (format, type.format_audio.format))) {
|
||||
if ((prop = spa_pod_object_find_prop (format, type.format_audio.format))) {
|
||||
handle_id_prop (prop, "format", res);
|
||||
}
|
||||
if ((prop = spa_format_find_prop (format, type.format_audio.rate))) {
|
||||
if ((prop = spa_pod_object_find_prop (format, type.format_audio.rate))) {
|
||||
handle_int_prop (prop, "rate", res);
|
||||
}
|
||||
if ((prop = spa_format_find_prop (format, type.format_audio.channels))) {
|
||||
if ((prop = spa_pod_object_find_prop (format, type.format_audio.channels))) {
|
||||
handle_int_prop (prop, "channels", res);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue