mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-09 13:30:06 -05:00
prop-builder: add helper to make properties and formats
Use this to make a format filter. Use the filter to negotiate a format automatically.
This commit is contained in:
parent
c433df9d32
commit
808d6b6fca
11 changed files with 590 additions and 13 deletions
80
spa/lib/prop-builder.h
Normal file
80
spa/lib/prop-builder.h
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/* Simple Plugin API
|
||||
* Copyright (C) 2016 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __SPA_PROP_BUILDER_H__
|
||||
#define __SPA_PROP_BUILDER_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <spa/props.h>
|
||||
|
||||
typedef struct SpaPropBuilderRange SpaPropBuilderRange;
|
||||
typedef struct SpaPropBuilderInfo SpaPropBuilderInfo;
|
||||
typedef struct SpaPropBuilder SpaPropBuilder;
|
||||
|
||||
struct SpaPropBuilderRange {
|
||||
SpaPropBuilderRange *next;
|
||||
SpaPropRangeInfo info;
|
||||
};
|
||||
|
||||
struct SpaPropBuilderInfo {
|
||||
SpaPropBuilderInfo *next;
|
||||
SpaPropInfo info;
|
||||
const void *value;
|
||||
SpaPropBuilderRange *ranges;
|
||||
};
|
||||
|
||||
struct SpaPropBuilder {
|
||||
SpaPropBuilderInfo *head;
|
||||
SpaPropBuilderInfo *info;
|
||||
SpaPropBuilderRange *range;
|
||||
size_t n_prop_info;
|
||||
size_t n_range_info;
|
||||
size_t size;
|
||||
size_t struct_size;
|
||||
off_t prop_offset;
|
||||
void *dest;
|
||||
void *userdata;
|
||||
void (*finish) (SpaPropBuilder *b);
|
||||
};
|
||||
|
||||
|
||||
void spa_prop_builder_init (SpaPropBuilder *b,
|
||||
size_t struct_size,
|
||||
off_t prop_offset);
|
||||
|
||||
void spa_prop_builder_add_info (SpaPropBuilder *b,
|
||||
SpaPropBuilderInfo *i);
|
||||
void spa_prop_builder_add_range (SpaPropBuilder *b,
|
||||
SpaPropBuilderRange *r);
|
||||
|
||||
void * spa_prop_builder_finish (SpaPropBuilder *b);
|
||||
|
||||
SpaResult spa_props_filter (SpaPropBuilder *b,
|
||||
const SpaProps *props,
|
||||
const SpaProps *filter);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __SPA_PROP_BUILDER_H__ */
|
||||
Loading…
Add table
Add a link
Reference in a new issue