mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-17 08:56:49 -05:00
format: make helper functions to create formats
Use helper functions to create a fully specified format.
This commit is contained in:
parent
80de83f38a
commit
514528f2c7
24 changed files with 158 additions and 430 deletions
|
|
@ -205,31 +205,6 @@ static int port_enum_formats(struct spa_node *node,
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int port_get_format(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t *index,
|
||||
const struct spa_pod *filter,
|
||||
struct spa_pod **result,
|
||||
struct spa_pod_builder *builder)
|
||||
{
|
||||
struct data *d = SPA_CONTAINER_OF(node, struct data, impl_node);
|
||||
|
||||
if (*index != 0 || d->format.format == 0)
|
||||
return 0;
|
||||
|
||||
*result = spa_pod_builder_object(builder,
|
||||
SPA_TYPE_OBJECT_Format, SPA_PARAM_Format,
|
||||
"I", SPA_MEDIA_TYPE_video,
|
||||
"I", SPA_MEDIA_SUBTYPE_raw,
|
||||
":", SPA_FORMAT_VIDEO_format, "I", d->format.format,
|
||||
":", SPA_FORMAT_VIDEO_size, "R", &d->format.size,
|
||||
":", SPA_FORMAT_VIDEO_framerate, "F", &d->format.framerate);
|
||||
|
||||
(*index)++;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int impl_port_enum_params(struct spa_node *node,
|
||||
enum spa_direction direction, uint32_t port_id,
|
||||
uint32_t id, uint32_t *index,
|
||||
|
|
@ -261,7 +236,10 @@ static int impl_port_enum_params(struct spa_node *node,
|
|||
return port_enum_formats(node, direction, port_id, index, filter, result, builder);
|
||||
|
||||
case SPA_PARAM_Format:
|
||||
return port_get_format(node, direction, port_id, index, filter, result, builder);
|
||||
if (*index != 0 || d->format.format == 0)
|
||||
return 0;
|
||||
param = spa_format_video_raw_build(builder, id, &d->format);
|
||||
break;
|
||||
|
||||
case SPA_PARAM_Buffers:
|
||||
if (*index != 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue