mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
rework props with pod
This commit is contained in:
parent
f02f93cda9
commit
dbae2e3f96
25 changed files with 232 additions and 472 deletions
|
|
@ -205,131 +205,30 @@ pinos_serialize_port_info_copy_into (void *dest, const SpaPortInfo *info)
|
||||||
size_t
|
size_t
|
||||||
pinos_serialize_props_get_size (const SpaProps *props)
|
pinos_serialize_props_get_size (const SpaProps *props)
|
||||||
{
|
{
|
||||||
size_t len;
|
|
||||||
unsigned int i, j;
|
|
||||||
SpaPropInfo *pi;
|
|
||||||
SpaPropRangeInfo *ri;
|
|
||||||
|
|
||||||
if (props == NULL)
|
if (props == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
len = sizeof (SpaProps);
|
return SPA_POD_SIZE (props);
|
||||||
for (i = 0; i < props->n_prop_info; i++) {
|
|
||||||
pi = (SpaPropInfo *) &props->prop_info[i];
|
|
||||||
len += sizeof (SpaPropInfo);
|
|
||||||
len += pi->name ? strlen (pi->name) + 1 : 0;
|
|
||||||
/* for the value */
|
|
||||||
len += pi->maxsize;
|
|
||||||
for (j = 0; j < pi->n_range_values; j++) {
|
|
||||||
ri = (SpaPropRangeInfo *)&pi->range_values[j];
|
|
||||||
len += sizeof (SpaPropRangeInfo);
|
|
||||||
len += ri->name ? strlen (ri->name) + 1 : 0;
|
|
||||||
/* the size of the range value */
|
|
||||||
len += ri->val.size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
pinos_serialize_props_serialize (void *p, const SpaProps *props)
|
pinos_serialize_props_serialize (void *p, const SpaProps *props)
|
||||||
{
|
{
|
||||||
size_t len, slen;
|
size_t size;
|
||||||
unsigned int i, j, c;
|
|
||||||
SpaProps *tp;
|
|
||||||
SpaPropInfo *pi;
|
|
||||||
SpaPropRangeInfo *ri;
|
|
||||||
|
|
||||||
if (props == NULL)
|
if (props == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
tp = p;
|
size = SPA_POD_SIZE (props);
|
||||||
memcpy (tp, props, sizeof (SpaProps));
|
memcpy (p, props, size);
|
||||||
pi = SPA_MEMBER (tp, sizeof(SpaProps), SpaPropInfo);
|
|
||||||
ri = SPA_MEMBER (pi, sizeof(SpaPropInfo) * tp->n_prop_info, SpaPropRangeInfo);
|
|
||||||
|
|
||||||
tp->prop_info = SPA_INT_TO_PTR (SPA_PTRDIFF (pi, tp));
|
return size;
|
||||||
|
|
||||||
/* write propinfo array */
|
|
||||||
for (i = 0, c = 0; i < tp->n_prop_info; i++) {
|
|
||||||
memcpy (&pi[i], &props->prop_info[i], sizeof (SpaPropInfo));
|
|
||||||
pi[i].range_values = SPA_INT_TO_PTR (SPA_PTRDIFF (&ri[c], tp));
|
|
||||||
for (j = 0; j < pi[i].n_range_values; j++, c++) {
|
|
||||||
memcpy (&ri[c], &props->prop_info[i].range_values[j], sizeof (SpaPropRangeInfo));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p = &ri[c];
|
|
||||||
/* strings and default values from props and ranges */
|
|
||||||
for (i = 0, c = 0; i < tp->n_prop_info; i++) {
|
|
||||||
if (pi[i].name) {
|
|
||||||
slen = strlen (pi[i].name) + 1;
|
|
||||||
memcpy (p, pi[i].name, slen);
|
|
||||||
pi[i].name = SPA_INT_TO_PTR (SPA_PTRDIFF (p, tp));
|
|
||||||
p += slen;
|
|
||||||
} else {
|
|
||||||
pi[i].name = 0;
|
|
||||||
}
|
|
||||||
for (j = 0; j < pi[i].n_range_values; j++, c++) {
|
|
||||||
if (ri[c].name) {
|
|
||||||
slen = strlen (ri[c].name) + 1;
|
|
||||||
memcpy (p, ri[c].name, slen);
|
|
||||||
ri[c].name = SPA_INT_TO_PTR (SPA_PTRDIFF (p, tp));
|
|
||||||
p += slen;
|
|
||||||
} else {
|
|
||||||
ri[c].name = 0;
|
|
||||||
}
|
|
||||||
if (ri[c].val.size) {
|
|
||||||
memcpy (p, ri[c].val.value, ri[c].val.size);
|
|
||||||
ri[c].val.value = SPA_INT_TO_PTR (SPA_PTRDIFF (p, tp));
|
|
||||||
p += ri[c].val.size;
|
|
||||||
} else {
|
|
||||||
ri[c].val.value = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* and the actual values */
|
|
||||||
for (i = 0; i < tp->n_prop_info; i++) {
|
|
||||||
if (pi[i].offset) {
|
|
||||||
memcpy (p, SPA_MEMBER (props, pi[i].offset, void), pi[i].maxsize);
|
|
||||||
pi[i].offset = SPA_PTRDIFF (p, tp);
|
|
||||||
p += pi[i].maxsize;
|
|
||||||
} else {
|
|
||||||
pi[i].offset = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
len = SPA_PTRDIFF (p, tp);
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SpaProps *
|
SpaProps *
|
||||||
pinos_serialize_props_deserialize (void *p, off_t offset)
|
pinos_serialize_props_deserialize (void *p, off_t offset)
|
||||||
{
|
{
|
||||||
SpaProps *tp;
|
return SPA_MEMBER (p, offset, SpaProps);
|
||||||
unsigned int i, j;
|
|
||||||
SpaPropInfo *pi;
|
|
||||||
SpaPropRangeInfo *ri;
|
|
||||||
|
|
||||||
tp = SPA_MEMBER (p, offset, SpaProps);
|
|
||||||
if (tp->prop_info)
|
|
||||||
tp->prop_info = SPA_MEMBER (tp, SPA_PTR_TO_INT (tp->prop_info), SpaPropInfo);
|
|
||||||
/* now fix all the pointers */
|
|
||||||
for (i = 0; i < tp->n_prop_info; i++) {
|
|
||||||
pi = (SpaPropInfo *) &tp->prop_info[i];
|
|
||||||
if (pi->name)
|
|
||||||
pi->name = SPA_MEMBER (tp, SPA_PTR_TO_INT (pi->name), char);
|
|
||||||
if (pi->range_values)
|
|
||||||
pi->range_values = SPA_MEMBER (tp, SPA_PTR_TO_INT (pi->range_values), SpaPropRangeInfo);
|
|
||||||
|
|
||||||
for (j = 0; j < pi->n_range_values; j++) {
|
|
||||||
ri = (SpaPropRangeInfo *) &pi->range_values[j];
|
|
||||||
if (ri->name)
|
|
||||||
ri->name = SPA_MEMBER (tp, SPA_PTR_TO_INT (ri->name), char);
|
|
||||||
if (ri->val.value)
|
|
||||||
ri->val.value = SPA_MEMBER (tp, SPA_PTR_TO_INT (ri->val.value), void);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return tp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SpaProps *
|
SpaProps *
|
||||||
|
|
|
||||||
|
|
@ -443,14 +443,18 @@ GstCaps *
|
||||||
gst_caps_from_format (const SpaFormat *format)
|
gst_caps_from_format (const SpaFormat *format)
|
||||||
{
|
{
|
||||||
GstCaps *res = NULL;
|
GstCaps *res = NULL;
|
||||||
|
uint32_t media_type, media_subtype;
|
||||||
|
|
||||||
if (format->body.media_type == SPA_MEDIA_TYPE_VIDEO) {
|
media_type = format->body.media_type.value;
|
||||||
|
media_subtype = format->body.media_subtype.value;
|
||||||
|
|
||||||
|
if (media_type == SPA_MEDIA_TYPE_VIDEO) {
|
||||||
SpaVideoInfo f;
|
SpaVideoInfo f;
|
||||||
|
|
||||||
if (spa_format_video_parse (format, &f) < 0)
|
if (spa_format_video_parse (format, &f) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (format->body.media_subtype == SPA_MEDIA_SUBTYPE_RAW) {
|
if (media_subtype == SPA_MEDIA_SUBTYPE_RAW) {
|
||||||
res = gst_caps_new_simple ("video/x-raw",
|
res = gst_caps_new_simple ("video/x-raw",
|
||||||
"format", G_TYPE_STRING, gst_video_format_to_string (f.info.raw.format),
|
"format", G_TYPE_STRING, gst_video_format_to_string (f.info.raw.format),
|
||||||
"width", G_TYPE_INT, f.info.raw.size.width,
|
"width", G_TYPE_INT, f.info.raw.size.width,
|
||||||
|
|
@ -458,14 +462,14 @@ gst_caps_from_format (const SpaFormat *format)
|
||||||
"framerate", GST_TYPE_FRACTION, f.info.raw.framerate.num, f.info.raw.framerate.denom,
|
"framerate", GST_TYPE_FRACTION, f.info.raw.framerate.num, f.info.raw.framerate.denom,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
else if (format->body.media_subtype == SPA_MEDIA_SUBTYPE_MJPG) {
|
else if (media_subtype == SPA_MEDIA_SUBTYPE_MJPG) {
|
||||||
res = gst_caps_new_simple ("image/jpeg",
|
res = gst_caps_new_simple ("image/jpeg",
|
||||||
"width", G_TYPE_INT, f.info.mjpg.size.width,
|
"width", G_TYPE_INT, f.info.mjpg.size.width,
|
||||||
"height", G_TYPE_INT, f.info.mjpg.size.height,
|
"height", G_TYPE_INT, f.info.mjpg.size.height,
|
||||||
"framerate", GST_TYPE_FRACTION, f.info.mjpg.framerate.num, f.info.mjpg.framerate.denom,
|
"framerate", GST_TYPE_FRACTION, f.info.mjpg.framerate.num, f.info.mjpg.framerate.denom,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
else if (format->body.media_subtype == SPA_MEDIA_SUBTYPE_H264) {
|
else if (media_subtype == SPA_MEDIA_SUBTYPE_H264) {
|
||||||
res = gst_caps_new_simple ("video/x-h264",
|
res = gst_caps_new_simple ("video/x-h264",
|
||||||
"width", G_TYPE_INT, f.info.h264.size.width,
|
"width", G_TYPE_INT, f.info.h264.size.width,
|
||||||
"height", G_TYPE_INT, f.info.h264.size.height,
|
"height", G_TYPE_INT, f.info.h264.size.height,
|
||||||
|
|
@ -474,13 +478,13 @@ gst_caps_from_format (const SpaFormat *format)
|
||||||
"alignment", G_TYPE_STRING, "au",
|
"alignment", G_TYPE_STRING, "au",
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
} else if (format->body.media_type == SPA_MEDIA_TYPE_AUDIO) {
|
} else if (media_type == SPA_MEDIA_TYPE_AUDIO) {
|
||||||
SpaAudioInfo f;
|
SpaAudioInfo f;
|
||||||
|
|
||||||
if (spa_format_audio_parse (format, &f) < 0)
|
if (spa_format_audio_parse (format, &f) < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (format->body.media_subtype == SPA_MEDIA_SUBTYPE_RAW) {
|
if (media_subtype == SPA_MEDIA_SUBTYPE_RAW) {
|
||||||
res = gst_caps_new_simple ("audio/x-raw",
|
res = gst_caps_new_simple ("audio/x-raw",
|
||||||
"format", G_TYPE_STRING, gst_audio_format_to_string (f.info.raw.format),
|
"format", G_TYPE_STRING, gst_audio_format_to_string (f.info.raw.format),
|
||||||
"layout", G_TYPE_STRING, "interleaved",
|
"layout", G_TYPE_STRING, "interleaved",
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ static SpaResult
|
||||||
setup_video_node (SpaNode *spa_node, PinosProperties *pinos_props) {
|
setup_video_node (SpaNode *spa_node, PinosProperties *pinos_props) {
|
||||||
SpaResult res;
|
SpaResult res;
|
||||||
SpaProps *props;
|
SpaProps *props;
|
||||||
SpaPropValue value;
|
// SpaPropValue value;
|
||||||
const char *pattern;
|
const char *pattern;
|
||||||
uint32_t pattern_int;
|
uint32_t pattern_int;
|
||||||
|
|
||||||
|
|
@ -49,15 +49,15 @@ setup_video_node (SpaNode *spa_node, PinosProperties *pinos_props) {
|
||||||
return SPA_RESULT_ERROR;
|
return SPA_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
value.value = &pattern_int;
|
//// value.value = &pattern_int;
|
||||||
value.size = sizeof(uint32_t);
|
// value.size = sizeof(uint32_t);
|
||||||
|
|
||||||
if ((res = spa_node_get_props (spa_node, &props)) != SPA_RESULT_OK) {
|
if ((res = spa_node_get_props (spa_node, &props)) != SPA_RESULT_OK) {
|
||||||
pinos_log_debug ("spa_node_get_props failed: %d", res);
|
pinos_log_debug ("spa_node_get_props failed: %d", res);
|
||||||
return SPA_RESULT_ERROR;
|
return SPA_RESULT_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
spa_props_set_value (props, spa_props_index_for_name (props, "pattern"), &value);
|
// spa_props_set_value (props, spa_props_index_for_name (props, "pattern"), &value);
|
||||||
|
|
||||||
if ((res = spa_node_set_props (spa_node, props)) != SPA_RESULT_OK) {
|
if ((res = spa_node_set_props (spa_node, props)) != SPA_RESULT_OK) {
|
||||||
pinos_log_debug ("spa_node_set_props failed: %d", res);
|
pinos_log_debug ("spa_node_set_props failed: %d", res);
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,10 @@ spa_pod_builder_push_format (SpaPODBuilder *builder,
|
||||||
uint32_t media_type,
|
uint32_t media_type,
|
||||||
uint32_t media_subtype)
|
uint32_t media_subtype)
|
||||||
{
|
{
|
||||||
const SpaFormat p = { { sizeof (SpaFormatBody), SPA_POD_TYPE_FORMAT },
|
const SpaFormat p = { { { sizeof (SpaPODObjectBody) + sizeof (SpaFormatBody), SPA_POD_TYPE_OBJECT }, { 0, 0 } },
|
||||||
{ media_type, media_subtype } };
|
{ { { sizeof (uint32_t), SPA_POD_TYPE_INT }, media_type },
|
||||||
return spa_pod_builder_push (builder, frame, &p.pod,
|
{ { sizeof (uint32_t), SPA_POD_TYPE_INT }, media_subtype } } };
|
||||||
|
return spa_pod_builder_push (builder, frame, &p.obj.pod,
|
||||||
spa_pod_builder_raw (builder, &p, sizeof(p), false));
|
spa_pod_builder_raw (builder, &p, sizeof(p), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,8 +90,8 @@ typedef enum {
|
||||||
} SpaFormatProps;
|
} SpaFormatProps;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t media_type;
|
SpaPODInt media_type;
|
||||||
uint32_t media_subtype;
|
SpaPODInt media_subtype;
|
||||||
/* contents follow, series of SpaPODProp */
|
/* contents follow, series of SpaPODProp */
|
||||||
} SpaFormatBody;
|
} SpaFormatBody;
|
||||||
|
|
||||||
|
|
@ -102,7 +102,7 @@ typedef struct {
|
||||||
* @pod: POD object with properties
|
* @pod: POD object with properties
|
||||||
*/
|
*/
|
||||||
struct _SpaFormat {
|
struct _SpaFormat {
|
||||||
SpaPOD pod;
|
SpaPODObject obj;
|
||||||
SpaFormatBody body;
|
SpaFormatBody body;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -115,7 +115,7 @@ static inline SpaPODProp *
|
||||||
spa_format_find_prop (const SpaFormat *format, uint32_t key)
|
spa_format_find_prop (const SpaFormat *format, uint32_t key)
|
||||||
{
|
{
|
||||||
SpaPODProp *res;
|
SpaPODProp *res;
|
||||||
SPA_POD_FOREACH (format, res) {
|
SPA_FORMAT_BODY_FOREACH (&format->body, SPA_POD_BODY_SIZE (format), res) {
|
||||||
if (res->pod.type == SPA_POD_TYPE_PROP && res->body.key == key)
|
if (res->pod.type == SPA_POD_TYPE_PROP && res->body.key == key)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,7 @@ typedef enum {
|
||||||
SPA_POD_TYPE_STRUCT,
|
SPA_POD_TYPE_STRUCT,
|
||||||
SPA_POD_TYPE_OBJECT,
|
SPA_POD_TYPE_OBJECT,
|
||||||
SPA_POD_TYPE_PROP,
|
SPA_POD_TYPE_PROP,
|
||||||
SPA_POD_TYPE_BYTES,
|
SPA_POD_TYPE_BYTES
|
||||||
SPA_POD_TYPE_FORMAT
|
|
||||||
} SpaPODType;
|
} SpaPODType;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
|
||||||
|
|
@ -24,167 +24,39 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct _SpaProps SpaProps;
|
#include <spa/pod.h>
|
||||||
|
#include <spa/pod-builder.h>
|
||||||
|
|
||||||
|
typedef SpaPODObject SpaProps;
|
||||||
|
|
||||||
#define SPA_PROPS_URI "http://spaplug.in/ns/props"
|
#define SPA_PROPS_URI "http://spaplug.in/ns/props"
|
||||||
#define SPA_PROPS_PREFIX SPA_PROPS_URI "#"
|
#define SPA_PROPS_PREFIX SPA_PROPS_URI "#"
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <spa/defs.h>
|
|
||||||
#include <spa/dict.h>
|
|
||||||
|
|
||||||
/**
|
static inline off_t
|
||||||
* SpaPropType:
|
spa_pod_builder_push_props (SpaPODBuilder *builder,
|
||||||
*/
|
SpaPODFrame *frame)
|
||||||
typedef enum {
|
|
||||||
SPA_PROP_TYPE_INVALID = 0,
|
|
||||||
SPA_PROP_TYPE_BOOL,
|
|
||||||
SPA_PROP_TYPE_INT8,
|
|
||||||
SPA_PROP_TYPE_UINT8,
|
|
||||||
SPA_PROP_TYPE_INT16,
|
|
||||||
SPA_PROP_TYPE_UINT16,
|
|
||||||
SPA_PROP_TYPE_INT32,
|
|
||||||
SPA_PROP_TYPE_UINT32,
|
|
||||||
SPA_PROP_TYPE_INT64,
|
|
||||||
SPA_PROP_TYPE_UINT64,
|
|
||||||
SPA_PROP_TYPE_INT,
|
|
||||||
SPA_PROP_TYPE_UINT,
|
|
||||||
SPA_PROP_TYPE_FLOAT,
|
|
||||||
SPA_PROP_TYPE_DOUBLE,
|
|
||||||
SPA_PROP_TYPE_STRING,
|
|
||||||
SPA_PROP_TYPE_RECTANGLE,
|
|
||||||
SPA_PROP_TYPE_FRACTION,
|
|
||||||
SPA_PROP_TYPE_BITMASK,
|
|
||||||
SPA_PROP_TYPE_POINTER
|
|
||||||
} SpaPropType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SpaPropFlags:
|
|
||||||
* @SPA_PROP_FLAG_NONE: no flags
|
|
||||||
* @SPA_PROP_FLAG_OPTIONAL: the value can be left unset
|
|
||||||
* @SPA_PROP_FLAG_READABLE: property is readable
|
|
||||||
* @SPA_PROP_FLAG_WRITABLE: property is writable
|
|
||||||
* @SPA_PROP_FLAG_READWRITE: property is readable and writable
|
|
||||||
* @SPA_PROP_FLAG_DEPRECATED: property is deprecated and should not be used
|
|
||||||
* @SPA_PROP_FLAG_INFO: property is to get/set the complete structure
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
SPA_PROP_FLAG_NONE = 0,
|
|
||||||
SPA_PROP_FLAG_OPTIONAL = (1 << 0),
|
|
||||||
SPA_PROP_FLAG_READABLE = (1 << 1),
|
|
||||||
SPA_PROP_FLAG_WRITABLE = (1 << 2),
|
|
||||||
SPA_PROP_FLAG_READWRITE = SPA_PROP_FLAG_READABLE | SPA_PROP_FLAG_WRITABLE,
|
|
||||||
SPA_PROP_FLAG_DEPRECATED = (1 << 3),
|
|
||||||
SPA_PROP_FLAG_INFO = (1 << 4),
|
|
||||||
} SpaPropFlags;
|
|
||||||
|
|
||||||
/* SpaPropRangeType:
|
|
||||||
* @SPA_PROP_RANGE_TYPE_NONE: no range specified, full range of type applies
|
|
||||||
* @SPA_PROP_RANGE_TYPE_MIN_MAX: range contains 2 values, min and max
|
|
||||||
* @SPA_PROP_RANGE_TYPE_STEP: range contains 3 values, min, max and step
|
|
||||||
* @SPA_PROP_RANGE_TYPE_ENUM: range contains enum of possible values
|
|
||||||
* @SPA_PROP_RANGE_TYPE_FLAGS: range contains flags of possible values
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
SPA_PROP_RANGE_TYPE_NONE = 0,
|
|
||||||
SPA_PROP_RANGE_TYPE_MIN_MAX,
|
|
||||||
SPA_PROP_RANGE_TYPE_STEP,
|
|
||||||
SPA_PROP_RANGE_TYPE_ENUM,
|
|
||||||
SPA_PROP_RANGE_TYPE_FLAGS,
|
|
||||||
} SpaPropRangeType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SpaPropValue:
|
|
||||||
* @size: the property size
|
|
||||||
* @value: the property value.
|
|
||||||
*
|
|
||||||
* The structure to set and get properties.
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
size_t size;
|
|
||||||
const void *value;
|
|
||||||
} SpaPropValue;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SpaPropRangeInfo:
|
|
||||||
* @name: name of this value
|
|
||||||
* @val: the value
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
const char *name;
|
|
||||||
SpaPropValue val;
|
|
||||||
} SpaPropRangeInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SpaPropInfo:
|
|
||||||
* @id: unique id
|
|
||||||
* @offset: offset in structure with data
|
|
||||||
* @name: human readable name
|
|
||||||
* @flags: property flags
|
|
||||||
* @type: property type
|
|
||||||
* @max_size: maximum size of property value
|
|
||||||
* @range_type: type of the range values
|
|
||||||
* @n_range_values: number of elements in @range_values
|
|
||||||
* @range_values: array of possible values
|
|
||||||
* @extra: extra info
|
|
||||||
*/
|
|
||||||
typedef struct {
|
|
||||||
uint32_t id;
|
|
||||||
size_t offset;
|
|
||||||
const char *name;
|
|
||||||
SpaPropFlags flags;
|
|
||||||
SpaPropType type;
|
|
||||||
size_t maxsize;
|
|
||||||
SpaPropRangeType range_type;
|
|
||||||
unsigned int n_range_values;
|
|
||||||
const SpaPropRangeInfo *range_values;
|
|
||||||
SpaDict *extra;
|
|
||||||
} SpaPropInfo;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SpaProps:
|
|
||||||
* @n_prop_info: number of elements in @prop_info
|
|
||||||
* @prop_info: array of #SpaPropInfo. Contains info about the
|
|
||||||
* properties. Can be %NULL when unspecified.
|
|
||||||
* @unset_mask: mask of unset properties. For each property in @prop_info there
|
|
||||||
* is a corresponding bit that specifies if the property is currently
|
|
||||||
* unset. When more than 32 properties are present, more uint32_t
|
|
||||||
* fields follow this one.
|
|
||||||
*
|
|
||||||
* Generic propertiers.
|
|
||||||
*/
|
|
||||||
struct _SpaProps {
|
|
||||||
unsigned int n_prop_info;
|
|
||||||
const SpaPropInfo *prop_info;
|
|
||||||
uint32_t unset_mask;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define SPA_PROPS_INDEX_IS_UNSET(p,idx) ((&(p)->unset_mask)[(idx) >> 5] & (1U << ((idx) & 31)))
|
|
||||||
#define SPA_PROPS_INDEX_UNSET(p,idx) ((&(p)->unset_mask)[(idx) >> 5] |= (1U << ((idx) & 31)))
|
|
||||||
#define SPA_PROPS_INDEX_SET(p,idx) ((&(p)->unset_mask)[(idx) >> 5] &= ~(1U << ((idx) & 31)))
|
|
||||||
|
|
||||||
static inline unsigned int
|
|
||||||
spa_props_index_for_id (const SpaProps *props, uint32_t id)
|
|
||||||
{
|
{
|
||||||
unsigned int i;
|
return spa_pod_builder_push_object (builder, frame, 0, 0);
|
||||||
|
|
||||||
for (i = 0; i < props->n_prop_info; i++) {
|
|
||||||
if (props->prop_info[i].id == id)
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
return SPA_IDX_INVALID;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline unsigned int
|
static inline off_t
|
||||||
spa_props_index_for_name (const SpaProps *props, const char *name)
|
spa_pod_builder_props (SpaPODBuilder *builder,
|
||||||
|
uint32_t propid, ...)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
SpaPODFrame f;
|
||||||
|
va_list args;
|
||||||
|
off_t off;
|
||||||
|
|
||||||
for (i = 0; i < props->n_prop_info; i++) {
|
off = spa_pod_builder_push_props (builder, &f);
|
||||||
if (strcmp (props->prop_info[i].name, name) == 0)
|
|
||||||
return i;
|
va_start (args, propid);
|
||||||
}
|
spa_pod_builder_propv (builder, propid, args);
|
||||||
return SPA_IDX_INVALID;
|
va_end (args);
|
||||||
|
|
||||||
|
spa_pod_builder_pop (builder, &f);
|
||||||
|
|
||||||
|
return off;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,13 @@ spa_format_audio_parse (const SpaFormat *format,
|
||||||
SpaPODProp *prop;
|
SpaPODProp *prop;
|
||||||
const ParseInfo *pinfo, *find;
|
const ParseInfo *pinfo, *find;
|
||||||
|
|
||||||
if (format->body.media_type != SPA_MEDIA_TYPE_AUDIO)
|
if (format->body.media_type.value != SPA_MEDIA_TYPE_AUDIO)
|
||||||
return SPA_RESULT_INVALID_MEDIA_TYPE;
|
return SPA_RESULT_INVALID_MEDIA_TYPE;
|
||||||
|
|
||||||
switch (format->body.media_subtype) {
|
info->media_type = format->body.media_type.value;
|
||||||
|
info->media_subtype = format->body.media_subtype.value;
|
||||||
|
|
||||||
|
switch (info->media_subtype) {
|
||||||
case SPA_MEDIA_SUBTYPE_RAW:
|
case SPA_MEDIA_SUBTYPE_RAW:
|
||||||
pinfo = raw_parse_info;
|
pinfo = raw_parse_info;
|
||||||
break;
|
break;
|
||||||
|
|
@ -85,9 +88,6 @@ spa_format_audio_parse (const SpaFormat *format,
|
||||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->media_type = format->body.media_type;
|
|
||||||
info->media_subtype = format->body.media_subtype;
|
|
||||||
|
|
||||||
SPA_POD_FOREACH (format, prop) {
|
SPA_POD_FOREACH (format, prop) {
|
||||||
if ((find = parse_info_find (pinfo, prop->body.key, prop->body.value.type))) {
|
if ((find = parse_info_find (pinfo, prop->body.key, prop->body.value.type))) {
|
||||||
memcpy (SPA_MEMBER (info, find->offset, void),
|
memcpy (SPA_MEMBER (info, find->offset, void),
|
||||||
|
|
|
||||||
|
|
@ -227,6 +227,7 @@ spa_debug_dump_mem (const void *mem, size_t size)
|
||||||
SpaResult
|
SpaResult
|
||||||
spa_debug_props (const SpaProps *props, bool print_ranges)
|
spa_debug_props (const SpaProps *props, bool print_ranges)
|
||||||
{
|
{
|
||||||
|
spa_debug_pod (&props->pod);
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -352,7 +353,7 @@ print_pod_value (uint32_t size, uint32_t type, void *body, int prefix)
|
||||||
printf ("%-*sDouble %g\n", prefix, "", *(double *) body);
|
printf ("%-*sDouble %g\n", prefix, "", *(double *) body);
|
||||||
break;
|
break;
|
||||||
case SPA_POD_TYPE_STRING:
|
case SPA_POD_TYPE_STRING:
|
||||||
printf ("%-*sString %s\n", prefix, "", (char *) body);
|
printf ("%-*sString \"%s\"\n", prefix, "", (char *) body);
|
||||||
break;
|
break;
|
||||||
case SPA_POD_TYPE_RECTANGLE:
|
case SPA_POD_TYPE_RECTANGLE:
|
||||||
{
|
{
|
||||||
|
|
@ -419,17 +420,6 @@ print_pod_value (uint32_t size, uint32_t type, void *body, int prefix)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SPA_POD_TYPE_FORMAT:
|
|
||||||
{
|
|
||||||
SpaFormatBody *b = body;
|
|
||||||
SpaPODProp *p;
|
|
||||||
|
|
||||||
printf ("%-*sFormat: size %d\n", prefix, "", size);
|
|
||||||
printf ("%-*s Media Type: %d / %d\n", prefix, "", b->media_type, b->media_subtype);
|
|
||||||
SPA_FORMAT_BODY_FOREACH (b, size, p)
|
|
||||||
print_pod_value (p->pod.size, p->pod.type, SPA_POD_BODY (p), prefix + 6);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -491,16 +481,20 @@ spa_debug_format (const SpaFormat *format)
|
||||||
const char *media_subtype;
|
const char *media_subtype;
|
||||||
const char **prop_names;
|
const char **prop_names;
|
||||||
SpaPODProp *prop;
|
SpaPODProp *prop;
|
||||||
|
uint32_t mtype, mstype;
|
||||||
|
|
||||||
if (format == NULL)
|
if (format == NULL)
|
||||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
|
|
||||||
if (format->body.media_type > 0 && format->body.media_type < SPA_N_ELEMENTS (media_type_names)) {
|
mtype = format->body.media_type.value;
|
||||||
media_type = media_type_names[format->body.media_type].name;
|
mstype = format->body.media_subtype.value;
|
||||||
first = media_type_names[format->body.media_type].first;
|
|
||||||
last = media_type_names[format->body.media_type].last;
|
if (mtype > 0 && mtype < SPA_N_ELEMENTS (media_type_names)) {
|
||||||
idx = media_type_names[format->body.media_type].idx;
|
media_type = media_type_names[mtype].name;
|
||||||
prop_names = media_type_names[format->body.media_type].prop_names;
|
first = media_type_names[mtype].first;
|
||||||
|
last = media_type_names[mtype].last;
|
||||||
|
idx = media_type_names[mtype].idx;
|
||||||
|
prop_names = media_type_names[mtype].prop_names;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
media_type = "unknown";
|
media_type = "unknown";
|
||||||
|
|
@ -508,11 +502,11 @@ spa_debug_format (const SpaFormat *format)
|
||||||
prop_names = NULL;
|
prop_names = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format->body.media_subtype >= SPA_MEDIA_SUBTYPE_ANY_FIRST &&
|
if (mstype >= SPA_MEDIA_SUBTYPE_ANY_FIRST &&
|
||||||
format->body.media_subtype <= SPA_MEDIA_SUBTYPE_ANY_LAST) {
|
mstype <= SPA_MEDIA_SUBTYPE_ANY_LAST) {
|
||||||
media_subtype = media_subtype_names[format->body.media_subtype].name;
|
media_subtype = media_subtype_names[mstype].name;
|
||||||
} else if (format->body.media_subtype >= first && format->body.media_subtype <= last)
|
} else if (mstype >= first && mstype <= last)
|
||||||
media_subtype = media_subtype_names[format->body.media_subtype - first + idx].name;
|
media_subtype = media_subtype_names[mstype - first + idx].name;
|
||||||
else
|
else
|
||||||
media_subtype = "unknown";
|
media_subtype = "unknown";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
spalib_sources = ['audio-raw.c',
|
spalib_sources = ['audio-raw.c',
|
||||||
'debug.c',
|
'debug.c',
|
||||||
'mapper.c',
|
'mapper.c',
|
||||||
'props.c',
|
|
||||||
'video-raw.c']
|
'video-raw.c']
|
||||||
|
|
||||||
spalib = shared_library('spa-lib',
|
spalib = shared_library('spa-lib',
|
||||||
|
|
|
||||||
|
|
@ -26,42 +26,6 @@ extern "C" {
|
||||||
|
|
||||||
#include <spa/props.h>
|
#include <spa/props.h>
|
||||||
|
|
||||||
/**
|
|
||||||
* spa_props_set_value:
|
|
||||||
* @props: a #SpaProps
|
|
||||||
* @index: the index of the property in the prop_info array
|
|
||||||
* @value: the value to set
|
|
||||||
*
|
|
||||||
* Sets @value in @prop. type should match the type specified
|
|
||||||
* in the #SpaPropInfo at @index or else #SPA_RESULT_WRONG_PROPERTY_TYPE
|
|
||||||
* is returned.
|
|
||||||
*
|
|
||||||
* Returns: #SPA_RESULT_OK on success.
|
|
||||||
* #SPA_RESULT_INVALID_PROPERTY_INDEX when @index is not valid
|
|
||||||
* #SPA_RESULT_WRONG_PROPERTY_TYPE when type is not correct
|
|
||||||
*/
|
|
||||||
SpaResult spa_props_set_value (SpaProps *props,
|
|
||||||
unsigned int index,
|
|
||||||
const SpaPropValue *value);
|
|
||||||
/**
|
|
||||||
* spa_props_get_value:
|
|
||||||
* @props: a #SpaProps
|
|
||||||
* @index: the property index in the prop_info array
|
|
||||||
* @value: a location for the type, size and value
|
|
||||||
*
|
|
||||||
* Get the size and value of the property at @index.
|
|
||||||
*
|
|
||||||
* Returns: #SPA_RESULT_OK on success.
|
|
||||||
* #SPA_RESULT_INVALID_PROPERTY_INDEX when @index is not valid
|
|
||||||
* #SPA_RESULT_PROPERTY_UNSET when no value has been set yet
|
|
||||||
*/
|
|
||||||
SpaResult spa_props_get_value (const SpaProps *props,
|
|
||||||
unsigned int index,
|
|
||||||
SpaPropValue *value);
|
|
||||||
|
|
||||||
SpaResult spa_props_copy_values (const SpaProps *src,
|
|
||||||
SpaProps *dest);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
} /* extern "C" */
|
} /* extern "C" */
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -85,10 +85,13 @@ spa_format_video_parse (const SpaFormat *format,
|
||||||
SpaPODProp *prop;
|
SpaPODProp *prop;
|
||||||
const ParseInfo *pinfo, *find;
|
const ParseInfo *pinfo, *find;
|
||||||
|
|
||||||
if (format->body.media_type != SPA_MEDIA_TYPE_VIDEO)
|
if (format->body.media_type.value != SPA_MEDIA_TYPE_VIDEO)
|
||||||
return SPA_RESULT_INVALID_MEDIA_TYPE;
|
return SPA_RESULT_INVALID_MEDIA_TYPE;
|
||||||
|
|
||||||
switch (format->body.media_subtype) {
|
info->media_type = format->body.media_type.value;
|
||||||
|
info->media_subtype = format->body.media_subtype.value;
|
||||||
|
|
||||||
|
switch (info->media_subtype) {
|
||||||
case SPA_MEDIA_SUBTYPE_RAW:
|
case SPA_MEDIA_SUBTYPE_RAW:
|
||||||
pinfo = raw_parse_info;
|
pinfo = raw_parse_info;
|
||||||
break;
|
break;
|
||||||
|
|
@ -116,9 +119,6 @@ spa_format_video_parse (const SpaFormat *format,
|
||||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->media_type = format->body.media_type;
|
|
||||||
info->media_subtype = format->body.media_subtype;
|
|
||||||
|
|
||||||
SPA_POD_FOREACH (format, prop) {
|
SPA_POD_FOREACH (format, prop) {
|
||||||
if ((find = parse_info_find (pinfo, prop->body.key, prop->body.value.type))) {
|
if ((find = parse_info_find (pinfo, prop->body.key, prop->body.value.type))) {
|
||||||
memcpy (SPA_MEMBER (info, find->offset, void),
|
memcpy (SPA_MEMBER (info, find->offset, void),
|
||||||
|
|
@ -142,8 +142,8 @@ spa_format_filter (const SpaFormat *format,
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter->body.media_type != format->body.media_type ||
|
if (filter->body.media_type.value != format->body.media_type.value ||
|
||||||
filter->body.media_subtype != format->body.media_subtype)
|
filter->body.media_subtype.value != format->body.media_subtype.value)
|
||||||
return SPA_RESULT_INVALID_MEDIA_TYPE;
|
return SPA_RESULT_INVALID_MEDIA_TYPE;
|
||||||
|
|
||||||
spa_pod_builder_raw (result, format, SPA_POD_SIZE (format), true);
|
spa_pod_builder_raw (result, format, SPA_POD_SIZE (format), true);
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ update_state (SpaALSASink *this, SpaNodeState state)
|
||||||
this->node.state = state;
|
this->node.state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static const uint32_t min_uint32 = 1;
|
static const uint32_t min_uint32 = 1;
|
||||||
static const uint32_t max_uint32 = UINT32_MAX;
|
static const uint32_t max_uint32 = UINT32_MAX;
|
||||||
|
|
||||||
|
|
@ -109,6 +110,7 @@ static const SpaPropInfo prop_info[] =
|
||||||
SPA_PROP_RANGE_TYPE_NONE, 0, NULL,
|
SPA_PROP_RANGE_TYPE_NONE, 0, NULL,
|
||||||
NULL },
|
NULL },
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
static SpaResult
|
static SpaResult
|
||||||
spa_alsa_sink_node_get_props (SpaNode *node,
|
spa_alsa_sink_node_get_props (SpaNode *node,
|
||||||
|
|
@ -146,7 +148,7 @@ spa_alsa_sink_node_set_props (SpaNode *node,
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = spa_props_copy_values (props, &p->props);
|
//res = spa_props_copy_values (props, &p->props);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
@ -829,8 +831,10 @@ alsa_sink_init (const SpaHandleFactory *factory,
|
||||||
this->uri.node = spa_id_map_get_id (this->map, SPA_NODE_URI);
|
this->uri.node = spa_id_map_get_id (this->map, SPA_NODE_URI);
|
||||||
|
|
||||||
this->node = alsasink_node;
|
this->node = alsasink_node;
|
||||||
|
#if 0
|
||||||
this->props[1].props.n_prop_info = PROP_ID_LAST;
|
this->props[1].props.n_prop_info = PROP_ID_LAST;
|
||||||
this->props[1].props.prop_info = prop_info;
|
this->props[1].props.prop_info = prop_info;
|
||||||
|
#endif
|
||||||
this->stream = SND_PCM_STREAM_PLAYBACK;
|
this->stream = SND_PCM_STREAM_PLAYBACK;
|
||||||
reset_alsa_sink_props (&this->props[1]);
|
reset_alsa_sink_props (&this->props[1]);
|
||||||
|
|
||||||
|
|
@ -839,7 +843,7 @@ alsa_sink_init (const SpaHandleFactory *factory,
|
||||||
for (i = 0; info && i < info->n_items; i++) {
|
for (i = 0; info && i < info->n_items; i++) {
|
||||||
if (!strcmp (info->items[i].key, "alsa.card")) {
|
if (!strcmp (info->items[i].key, "alsa.card")) {
|
||||||
snprintf (this->props[1].device, 63, "hw:%s", info->items[i].value);
|
snprintf (this->props[1].device, 63, "hw:%s", info->items[i].value);
|
||||||
this->props[1].props.unset_mask &= ~1;
|
// this->props[1].props.unset_mask &= ~1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,9 @@ reset_alsa_props (SpaALSAProps *props)
|
||||||
props->period_size = default_period_size;
|
props->period_size = default_period_size;
|
||||||
props->periods = default_periods;
|
props->periods = default_periods;
|
||||||
props->period_event = default_period_event;
|
props->period_event = default_period_event;
|
||||||
props->props.unset_mask = 0xf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
static const uint32_t min_uint32 = 1;
|
static const uint32_t min_uint32 = 1;
|
||||||
static const uint32_t max_uint32 = UINT32_MAX;
|
static const uint32_t max_uint32 = UINT32_MAX;
|
||||||
|
|
||||||
|
|
@ -110,6 +110,7 @@ static const SpaPropInfo prop_info[] =
|
||||||
SPA_PROP_RANGE_TYPE_NONE, 0, NULL,
|
SPA_PROP_RANGE_TYPE_NONE, 0, NULL,
|
||||||
NULL },
|
NULL },
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
static SpaResult
|
static SpaResult
|
||||||
spa_alsa_source_node_get_props (SpaNode *node,
|
spa_alsa_source_node_get_props (SpaNode *node,
|
||||||
|
|
@ -147,7 +148,7 @@ spa_alsa_source_node_set_props (SpaNode *node,
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = spa_props_copy_values (props, &p->props);
|
//res = spa_props_copy_values (props, &p->props);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
@ -896,8 +897,10 @@ alsa_source_init (const SpaHandleFactory *factory,
|
||||||
|
|
||||||
this->node = alsasource_node;
|
this->node = alsasource_node;
|
||||||
this->clock = alsasource_clock;
|
this->clock = alsasource_clock;
|
||||||
|
#if 0
|
||||||
this->props[1].props.n_prop_info = PROP_ID_LAST;
|
this->props[1].props.n_prop_info = PROP_ID_LAST;
|
||||||
this->props[1].props.prop_info = prop_info;
|
this->props[1].props.prop_info = prop_info;
|
||||||
|
#endif
|
||||||
this->stream = SND_PCM_STREAM_CAPTURE;
|
this->stream = SND_PCM_STREAM_CAPTURE;
|
||||||
reset_alsa_props (&this->props[1]);
|
reset_alsa_props (&this->props[1]);
|
||||||
|
|
||||||
|
|
@ -907,7 +910,7 @@ alsa_source_init (const SpaHandleFactory *factory,
|
||||||
for (i = 0; info && i < info->n_items; i++) {
|
for (i = 0; info && i < info->n_items; i++) {
|
||||||
if (!strcmp (info->items[i].key, "alsa.card")) {
|
if (!strcmp (info->items[i].key, "alsa.card")) {
|
||||||
snprintf (this->props[1].device, 63, "hw:%s", info->items[i].value);
|
snprintf (this->props[1].device, 63, "hw:%s", info->items[i].value);
|
||||||
this->props[1].props.unset_mask &= ~1;
|
// this->props[1].props.unset_mask &= ~1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,11 +97,6 @@ enum {
|
||||||
PROP_ID_LAST,
|
PROP_ID_LAST,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const SpaPropInfo prop_info[] =
|
|
||||||
{
|
|
||||||
{ PROP_ID_LAST, },
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
reset_audiomixer_props (SpaAudioMixerProps *props)
|
reset_audiomixer_props (SpaAudioMixerProps *props)
|
||||||
{
|
{
|
||||||
|
|
@ -119,7 +114,6 @@ spa_audiomixer_node_get_props (SpaNode *node,
|
||||||
this = SPA_CONTAINER_OF (node, SpaAudioMixer, node);
|
this = SPA_CONTAINER_OF (node, SpaAudioMixer, node);
|
||||||
|
|
||||||
memcpy (&this->props[0], &this->props[1], sizeof (this->props[1]));
|
memcpy (&this->props[0], &this->props[1], sizeof (this->props[1]));
|
||||||
*props = &this->props[0].props;
|
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -142,7 +136,6 @@ spa_audiomixer_node_set_props (SpaNode *node,
|
||||||
reset_audiomixer_props (p);
|
reset_audiomixer_props (p);
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
res = spa_props_copy_values (props, &p->props);
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
@ -755,8 +748,10 @@ spa_audiomixer_init (const SpaHandleFactory *factory,
|
||||||
this->uri.node = spa_id_map_get_id (this->map, SPA_NODE_URI);
|
this->uri.node = spa_id_map_get_id (this->map, SPA_NODE_URI);
|
||||||
|
|
||||||
this->node = audiomixer_node;
|
this->node = audiomixer_node;
|
||||||
|
#if 0
|
||||||
this->props[1].props.n_prop_info = PROP_ID_LAST;
|
this->props[1].props.n_prop_info = PROP_ID_LAST;
|
||||||
this->props[1].props.prop_info = prop_info;
|
this->props[1].props.prop_info = prop_info;
|
||||||
|
#endif
|
||||||
reset_audiomixer_props (&this->props[1]);
|
reset_audiomixer_props (&this->props[1]);
|
||||||
|
|
||||||
this->out_ports[0].valid = true;
|
this->out_ports[0].valid = true;
|
||||||
|
|
|
||||||
|
|
@ -111,19 +111,20 @@ struct _SpaAudioTestSrc {
|
||||||
#define DEFAULT_FREQ 440.0
|
#define DEFAULT_FREQ 440.0
|
||||||
#define DEFAULT_LIVE true
|
#define DEFAULT_LIVE true
|
||||||
|
|
||||||
|
#if 0
|
||||||
static const double min_volume = 0.0;
|
static const double min_volume = 0.0;
|
||||||
static const double max_volume = 10.0;
|
static const double max_volume = 10.0;
|
||||||
static const double min_freq = 0.0;
|
static const double min_freq = 0.0;
|
||||||
static const double max_freq = 50000000.0;
|
static const double max_freq = 50000000.0;
|
||||||
|
|
||||||
|
static const uint32_t wave_val_sine = 0;
|
||||||
|
static const uint32_t wave_val_square = 1;
|
||||||
|
|
||||||
static const SpaPropRangeInfo volume_range[] = {
|
static const SpaPropRangeInfo volume_range[] = {
|
||||||
{ "min", { sizeof (double), &min_volume } },
|
{ "min", { sizeof (double), &min_volume } },
|
||||||
{ "max", { sizeof (double), &max_volume } },
|
{ "max", { sizeof (double), &max_volume } },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const uint32_t wave_val_sine = 0;
|
|
||||||
static const uint32_t wave_val_square = 1;
|
|
||||||
|
|
||||||
static const SpaPropRangeInfo wave_range[] = {
|
static const SpaPropRangeInfo wave_range[] = {
|
||||||
{ "sine", { sizeof (uint32_t), &wave_val_sine } },
|
{ "sine", { sizeof (uint32_t), &wave_val_sine } },
|
||||||
{ "square", { sizeof (uint32_t), &wave_val_square } },
|
{ "square", { sizeof (uint32_t), &wave_val_square } },
|
||||||
|
|
@ -169,6 +170,7 @@ static const SpaPropInfo prop_info[] =
|
||||||
SPA_PROP_RANGE_TYPE_MIN_MAX, 2, volume_range,
|
SPA_PROP_RANGE_TYPE_MIN_MAX, 2, volume_range,
|
||||||
NULL },
|
NULL },
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
static SpaResult
|
static SpaResult
|
||||||
reset_audiotestsrc_props (SpaAudioTestSrcProps *props)
|
reset_audiotestsrc_props (SpaAudioTestSrcProps *props)
|
||||||
|
|
@ -193,7 +195,6 @@ spa_audiotestsrc_node_get_props (SpaNode *node,
|
||||||
this = SPA_CONTAINER_OF (node, SpaAudioTestSrc, node);
|
this = SPA_CONTAINER_OF (node, SpaAudioTestSrc, node);
|
||||||
|
|
||||||
memcpy (&this->props[0], &this->props[1], sizeof (this->props[1]));
|
memcpy (&this->props[0], &this->props[1], sizeof (this->props[1]));
|
||||||
*props = &this->props[0].props;
|
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -215,7 +216,7 @@ spa_audiotestsrc_node_set_props (SpaNode *node,
|
||||||
if (props == NULL) {
|
if (props == NULL) {
|
||||||
res = reset_audiotestsrc_props (p);
|
res = reset_audiotestsrc_props (p);
|
||||||
} else {
|
} else {
|
||||||
res = spa_props_copy_values (props, &p->props);
|
// res = spa_props_copy_values (props, &p->props);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->props[1].live)
|
if (this->props[1].live)
|
||||||
|
|
@ -988,8 +989,10 @@ audiotestsrc_init (const SpaHandleFactory *factory,
|
||||||
|
|
||||||
this->node = audiotestsrc_node;
|
this->node = audiotestsrc_node;
|
||||||
this->clock = audiotestsrc_clock;
|
this->clock = audiotestsrc_clock;
|
||||||
|
#if 0
|
||||||
this->props[1].props.n_prop_info = PROP_ID_LAST;
|
this->props[1].props.n_prop_info = PROP_ID_LAST;
|
||||||
this->props[1].props.prop_info = prop_info;
|
this->props[1].props.prop_info = prop_info;
|
||||||
|
#endif
|
||||||
reset_audiotestsrc_props (&this->props[1]);
|
reset_audiotestsrc_props (&this->props[1]);
|
||||||
|
|
||||||
spa_list_init (&this->empty);
|
spa_list_init (&this->empty);
|
||||||
|
|
|
||||||
|
|
@ -87,11 +87,6 @@ enum {
|
||||||
PROP_ID_LAST,
|
PROP_ID_LAST,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const SpaPropInfo prop_info[] =
|
|
||||||
{
|
|
||||||
{ 0, },
|
|
||||||
};
|
|
||||||
|
|
||||||
static SpaResult
|
static SpaResult
|
||||||
spa_ffmpeg_dec_node_get_props (SpaNode *node,
|
spa_ffmpeg_dec_node_get_props (SpaNode *node,
|
||||||
SpaProps **props)
|
SpaProps **props)
|
||||||
|
|
@ -128,7 +123,7 @@ spa_ffmpeg_dec_node_set_props (SpaNode *node,
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = spa_props_copy_values (props, &p->props);
|
//res = spa_props_copy_values (props, &p->props);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
@ -581,8 +576,10 @@ spa_ffmpeg_dec_init (SpaHandle *handle,
|
||||||
this->uri.node = spa_id_map_get_id (this->map, SPA_NODE_URI);
|
this->uri.node = spa_id_map_get_id (this->map, SPA_NODE_URI);
|
||||||
|
|
||||||
this->node = ffmpeg_dec_node;
|
this->node = ffmpeg_dec_node;
|
||||||
|
#if 0
|
||||||
this->props[1].props.n_prop_info = PROP_ID_LAST;
|
this->props[1].props.n_prop_info = PROP_ID_LAST;
|
||||||
this->props[1].props.prop_info = prop_info;
|
this->props[1].props.prop_info = prop_info;
|
||||||
|
#endif
|
||||||
reset_ffmpeg_dec_props (&this->props[1]);
|
reset_ffmpeg_dec_props (&this->props[1]);
|
||||||
|
|
||||||
this->in_ports[0].info.flags = SPA_PORT_INFO_FLAG_NONE;
|
this->in_ports[0].info.flags = SPA_PORT_INFO_FLAG_NONE;
|
||||||
|
|
|
||||||
|
|
@ -91,11 +91,6 @@ enum {
|
||||||
PROP_ID_LAST,
|
PROP_ID_LAST,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const SpaPropInfo prop_info[] =
|
|
||||||
{
|
|
||||||
{ 0, },
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_state (SpaFFMpegEnc *this, SpaNodeState state)
|
update_state (SpaFFMpegEnc *this, SpaNodeState state)
|
||||||
{
|
{
|
||||||
|
|
@ -138,7 +133,7 @@ spa_ffmpeg_enc_node_set_props (SpaNode *node,
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = spa_props_copy_values (props, &p->props);
|
//res = spa_props_copy_values (props, &p->props);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
@ -308,8 +303,8 @@ spa_ffmpeg_enc_node_port_set_format (SpaNode *node,
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format->body.media_type != SPA_MEDIA_TYPE_VIDEO ||
|
if (format->body.media_type.value != SPA_MEDIA_TYPE_VIDEO ||
|
||||||
format->body.media_subtype != SPA_MEDIA_SUBTYPE_RAW)
|
format->body.media_subtype.value != SPA_MEDIA_SUBTYPE_RAW)
|
||||||
return SPA_RESULT_INVALID_MEDIA_TYPE;
|
return SPA_RESULT_INVALID_MEDIA_TYPE;
|
||||||
|
|
||||||
if ((res = spa_format_video_parse (format, &port->format[0]) < 0))
|
if ((res = spa_format_video_parse (format, &port->format[0]) < 0))
|
||||||
|
|
@ -588,8 +583,6 @@ spa_ffmpeg_enc_init (SpaHandle *handle,
|
||||||
this->uri.node = spa_id_map_get_id (this->map, SPA_NODE_URI);
|
this->uri.node = spa_id_map_get_id (this->map, SPA_NODE_URI);
|
||||||
|
|
||||||
this->node = ffmpeg_enc_node;
|
this->node = ffmpeg_enc_node;
|
||||||
this->props[1].props.n_prop_info = PROP_ID_LAST;
|
|
||||||
this->props[1].props.prop_info = prop_info;
|
|
||||||
reset_ffmpeg_enc_props (&this->props[1]);
|
reset_ffmpeg_enc_props (&this->props[1]);
|
||||||
|
|
||||||
this->in_ports[0].info.flags = SPA_PORT_INFO_FLAG_NONE;
|
this->in_ports[0].info.flags = SPA_PORT_INFO_FLAG_NONE;
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ typedef struct _SpaV4l2Source SpaV4l2Source;
|
||||||
static const char default_device[] = "/dev/video0";
|
static const char default_device[] = "/dev/video0";
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SpaProps props;
|
|
||||||
char device[64];
|
char device[64];
|
||||||
char device_name[128];
|
char device_name[128];
|
||||||
int device_fd;
|
int device_fd;
|
||||||
|
|
@ -49,7 +48,6 @@ static void
|
||||||
reset_v4l2_source_props (SpaV4l2SourceProps *props)
|
reset_v4l2_source_props (SpaV4l2SourceProps *props)
|
||||||
{
|
{
|
||||||
strncpy (props->device, default_device, 64);
|
strncpy (props->device, default_device, 64);
|
||||||
props->props.unset_mask = 7;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAX_BUFFERS 64
|
#define MAX_BUFFERS 64
|
||||||
|
|
@ -121,7 +119,8 @@ struct _SpaV4l2Source {
|
||||||
|
|
||||||
uint32_t seq;
|
uint32_t seq;
|
||||||
|
|
||||||
SpaV4l2SourceProps props[2];
|
uint8_t props_buffer[512];
|
||||||
|
SpaV4l2SourceProps props;
|
||||||
|
|
||||||
SpaNodeEventCallback event_cb;
|
SpaNodeEventCallback event_cb;
|
||||||
void *user_data;
|
void *user_data;
|
||||||
|
|
@ -140,32 +139,10 @@ update_state (SpaV4l2Source *this, SpaNodeState state)
|
||||||
#include "v4l2-utils.c"
|
#include "v4l2-utils.c"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
PROP_ID_NONE,
|
||||||
PROP_ID_DEVICE,
|
PROP_ID_DEVICE,
|
||||||
PROP_ID_DEVICE_NAME,
|
PROP_ID_DEVICE_NAME,
|
||||||
PROP_ID_DEVICE_FD,
|
PROP_ID_DEVICE_FD,
|
||||||
PROP_ID_LAST,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const SpaPropInfo prop_info[] =
|
|
||||||
{
|
|
||||||
{ PROP_ID_DEVICE, offsetof (SpaV4l2SourceProps, device),
|
|
||||||
"device",
|
|
||||||
SPA_PROP_FLAG_READWRITE,
|
|
||||||
SPA_PROP_TYPE_STRING, 63,
|
|
||||||
SPA_PROP_RANGE_TYPE_NONE, 0, NULL,
|
|
||||||
NULL },
|
|
||||||
{ PROP_ID_DEVICE_NAME, offsetof (SpaV4l2SourceProps, device_name),
|
|
||||||
"device-name",
|
|
||||||
SPA_PROP_FLAG_READABLE,
|
|
||||||
SPA_PROP_TYPE_STRING, 127,
|
|
||||||
SPA_PROP_RANGE_TYPE_NONE, 0, NULL,
|
|
||||||
NULL },
|
|
||||||
{ PROP_ID_DEVICE_FD, offsetof (SpaV4l2SourceProps, device_fd),
|
|
||||||
"device-fd",
|
|
||||||
SPA_PROP_FLAG_READABLE,
|
|
||||||
SPA_PROP_TYPE_UINT32, sizeof (uint32_t),
|
|
||||||
SPA_PROP_RANGE_TYPE_NONE, 0, NULL,
|
|
||||||
NULL },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static SpaResult
|
static SpaResult
|
||||||
|
|
@ -173,14 +150,33 @@ spa_v4l2_source_node_get_props (SpaNode *node,
|
||||||
SpaProps **props)
|
SpaProps **props)
|
||||||
{
|
{
|
||||||
SpaV4l2Source *this;
|
SpaV4l2Source *this;
|
||||||
|
SpaPODBuilder b = { NULL, };
|
||||||
|
|
||||||
if (node == NULL || props == NULL)
|
if (node == NULL || props == NULL)
|
||||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
|
|
||||||
this = SPA_CONTAINER_OF (node, SpaV4l2Source, node);
|
this = SPA_CONTAINER_OF (node, SpaV4l2Source, node);
|
||||||
|
|
||||||
memcpy (&this->props[0], &this->props[1], sizeof (this->props[1]));
|
b.data = this->props_buffer;
|
||||||
*props = &this->props[0].props;
|
b.size = sizeof (this->props_buffer);
|
||||||
|
|
||||||
|
*props = SPA_MEMBER (b.data, spa_pod_builder_props (&b,
|
||||||
|
|
||||||
|
PROP_ID_DEVICE, SPA_POD_TYPE_STRING,
|
||||||
|
this->props.device, sizeof (this->props.device),
|
||||||
|
SPA_POD_PROP_FLAG_READWRITE |
|
||||||
|
SPA_POD_PROP_RANGE_NONE,
|
||||||
|
|
||||||
|
PROP_ID_DEVICE_NAME, SPA_POD_TYPE_STRING,
|
||||||
|
this->props.device_name, sizeof (this->props.device_name),
|
||||||
|
SPA_POD_PROP_FLAG_READABLE |
|
||||||
|
SPA_POD_PROP_RANGE_NONE,
|
||||||
|
|
||||||
|
PROP_ID_DEVICE_FD, SPA_POD_TYPE_INT,
|
||||||
|
this->props.device_fd,
|
||||||
|
SPA_POD_PROP_FLAG_READABLE |
|
||||||
|
SPA_POD_PROP_RANGE_NONE,
|
||||||
|
0), SpaProps);
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -190,23 +186,27 @@ spa_v4l2_source_node_set_props (SpaNode *node,
|
||||||
const SpaProps *props)
|
const SpaProps *props)
|
||||||
{
|
{
|
||||||
SpaV4l2Source *this;
|
SpaV4l2Source *this;
|
||||||
SpaV4l2SourceProps *p;
|
|
||||||
SpaResult res;
|
|
||||||
|
|
||||||
if (node == NULL)
|
if (node == NULL)
|
||||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
|
|
||||||
this = SPA_CONTAINER_OF (node, SpaV4l2Source, node);
|
this = SPA_CONTAINER_OF (node, SpaV4l2Source, node);
|
||||||
p = &this->props[1];
|
|
||||||
|
|
||||||
if (props == NULL) {
|
if (props == NULL) {
|
||||||
reset_v4l2_source_props (p);
|
reset_v4l2_source_props (&this->props);
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
|
} else {
|
||||||
|
SpaPODProp *pr;
|
||||||
|
|
||||||
|
SPA_POD_OBJECT_BODY_FOREACH (&props->body, props->pod.size, pr) {
|
||||||
|
switch (pr->body.key) {
|
||||||
|
case PROP_ID_DEVICE:
|
||||||
|
strncpy (this->props.device, SPA_POD_CONTENTS (SpaPODProp, pr), 63);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return SPA_RESULT_OK;
|
||||||
res = spa_props_copy_values (props, &p->props);
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static SpaResult
|
static SpaResult
|
||||||
|
|
@ -961,9 +961,8 @@ v4l2_source_init (const SpaHandleFactory *factory,
|
||||||
|
|
||||||
this->node = v4l2source_node;
|
this->node = v4l2source_node;
|
||||||
this->clock = v4l2source_clock;
|
this->clock = v4l2source_clock;
|
||||||
this->props[1].props.n_prop_info = PROP_ID_LAST;
|
|
||||||
this->props[1].props.prop_info = prop_info;
|
reset_v4l2_source_props (&this->props);
|
||||||
reset_v4l2_source_props (&this->props[1]);
|
|
||||||
|
|
||||||
this->state[0].log = this->log;
|
this->state[0].log = this->log;
|
||||||
this->state[0].info.flags = SPA_PORT_INFO_FLAG_LIVE;
|
this->state[0].info.flags = SPA_PORT_INFO_FLAG_LIVE;
|
||||||
|
|
@ -971,10 +970,8 @@ v4l2_source_init (const SpaHandleFactory *factory,
|
||||||
this->state[0].export_buf = true;
|
this->state[0].export_buf = true;
|
||||||
|
|
||||||
if (info && (str = spa_dict_lookup (info, "device.path"))) {
|
if (info && (str = spa_dict_lookup (info, "device.path"))) {
|
||||||
strncpy (this->props[1].device, str, 63);
|
strncpy (this->props.device, str, 63);
|
||||||
this->props[1].props.unset_mask &= ~1;
|
|
||||||
}
|
}
|
||||||
this->props[1].props.unset_mask &= ~1;
|
|
||||||
|
|
||||||
update_state (this, SPA_NODE_STATE_CONFIGURE);
|
update_state (this, SPA_NODE_STATE_CONFIGURE);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,12 +28,12 @@ spa_v4l2_open (SpaV4l2Source *this)
|
||||||
{
|
{
|
||||||
SpaV4l2State *state = &this->state[0];
|
SpaV4l2State *state = &this->state[0];
|
||||||
struct stat st;
|
struct stat st;
|
||||||
SpaV4l2SourceProps *props = &this->props[1];
|
SpaV4l2SourceProps *props = &this->props;
|
||||||
|
|
||||||
if (state->opened)
|
if (state->opened)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (props->props.unset_mask & 1) {
|
if (props->device[0] == '\0') {
|
||||||
spa_log_error (state->log, "v4l2: Device property not set");
|
spa_log_error (state->log, "v4l2: Device property not set");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
@ -326,9 +326,9 @@ enum_filter_format (const SpaFormat *filter, unsigned int index)
|
||||||
{
|
{
|
||||||
SpaVideoFormat video_format = SPA_VIDEO_FORMAT_UNKNOWN;
|
SpaVideoFormat video_format = SPA_VIDEO_FORMAT_UNKNOWN;
|
||||||
|
|
||||||
if ((filter->body.media_type == SPA_MEDIA_TYPE_VIDEO ||
|
if ((filter->body.media_type.value == SPA_MEDIA_TYPE_VIDEO ||
|
||||||
filter->body.media_type == SPA_MEDIA_TYPE_IMAGE)) {
|
filter->body.media_type.value == SPA_MEDIA_TYPE_IMAGE)) {
|
||||||
if (filter->body.media_subtype == SPA_MEDIA_SUBTYPE_RAW) {
|
if (filter->body.media_subtype.value == SPA_MEDIA_SUBTYPE_RAW) {
|
||||||
SpaPODProp *p;
|
SpaPODProp *p;
|
||||||
unsigned int n_values;
|
unsigned int n_values;
|
||||||
const uint32_t *values;
|
const uint32_t *values;
|
||||||
|
|
@ -488,8 +488,8 @@ next_fmtdesc:
|
||||||
if (video_format == SPA_VIDEO_FORMAT_UNKNOWN)
|
if (video_format == SPA_VIDEO_FORMAT_UNKNOWN)
|
||||||
return SPA_RESULT_ENUM_END;
|
return SPA_RESULT_ENUM_END;
|
||||||
|
|
||||||
info = find_format_info_by_media_type (filter->body.media_type,
|
info = find_format_info_by_media_type (filter->body.media_type.value,
|
||||||
filter->body.media_subtype,
|
filter->body.media_subtype.value,
|
||||||
video_format,
|
video_format,
|
||||||
0);
|
0);
|
||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
|
|
@ -562,12 +562,12 @@ do_frmsize:
|
||||||
&values[2],
|
&values[2],
|
||||||
&step))
|
&step))
|
||||||
goto have_size;
|
goto have_size;
|
||||||
} else if (range == SPA_PROP_RANGE_TYPE_STEP && n_values > 3) {
|
} else if (range == SPA_POD_PROP_RANGE_STEP && n_values > 3) {
|
||||||
if (filter_framesize (&state->frmsize, &values[1],
|
if (filter_framesize (&state->frmsize, &values[1],
|
||||||
&values[2],
|
&values[2],
|
||||||
&values[3]))
|
&values[3]))
|
||||||
goto have_size;
|
goto have_size;
|
||||||
} else if (range == SPA_PROP_RANGE_TYPE_ENUM) {
|
} else if (range == SPA_POD_PROP_RANGE_ENUM) {
|
||||||
for (i = 1; i < n_values; i++) {
|
for (i = 1; i < n_values; i++) {
|
||||||
if (filter_framesize (&state->frmsize, &values[i],
|
if (filter_framesize (&state->frmsize, &values[i],
|
||||||
&values[i],
|
&values[i],
|
||||||
|
|
@ -668,17 +668,17 @@ have_size:
|
||||||
&values[0],
|
&values[0],
|
||||||
&step))
|
&step))
|
||||||
goto have_framerate;
|
goto have_framerate;
|
||||||
} else if (range == SPA_PROP_RANGE_TYPE_MIN_MAX && n_values > 2) {
|
} else if (range == SPA_POD_PROP_RANGE_MIN_MAX && n_values > 2) {
|
||||||
if (filter_framerate (&state->frmival, &values[1],
|
if (filter_framerate (&state->frmival, &values[1],
|
||||||
&values[2],
|
&values[2],
|
||||||
&step))
|
&step))
|
||||||
goto have_framerate;
|
goto have_framerate;
|
||||||
} else if (range == SPA_PROP_RANGE_TYPE_STEP && n_values > 3) {
|
} else if (range == SPA_POD_PROP_RANGE_STEP && n_values > 3) {
|
||||||
if (filter_framerate (&state->frmival, &values[1],
|
if (filter_framerate (&state->frmival, &values[1],
|
||||||
&values[2],
|
&values[2],
|
||||||
&values[3]))
|
&values[3]))
|
||||||
goto have_framerate;
|
goto have_framerate;
|
||||||
} else if (range == SPA_PROP_RANGE_TYPE_ENUM) {
|
} else if (range == SPA_POD_PROP_RANGE_ENUM) {
|
||||||
for (i = 1; i < n_values; i++) {
|
for (i = 1; i < n_values; i++) {
|
||||||
if (filter_framerate (&state->frmival, &values[i],
|
if (filter_framerate (&state->frmival, &values[i],
|
||||||
&values[i],
|
&values[i],
|
||||||
|
|
@ -693,7 +693,7 @@ have_size:
|
||||||
have_framerate:
|
have_framerate:
|
||||||
|
|
||||||
if (state->frmival.type == V4L2_FRMIVAL_TYPE_DISCRETE) {
|
if (state->frmival.type == V4L2_FRMIVAL_TYPE_DISCRETE) {
|
||||||
prop->body.flags |= SPA_PROP_RANGE_TYPE_ENUM;
|
prop->body.flags |= SPA_POD_PROP_RANGE_ENUM;
|
||||||
spa_pod_builder_fraction (&b,
|
spa_pod_builder_fraction (&b,
|
||||||
state->frmival.discrete.denominator,
|
state->frmival.discrete.denominator,
|
||||||
state->frmival.discrete.numerator);
|
state->frmival.discrete.numerator);
|
||||||
|
|
@ -708,9 +708,9 @@ have_framerate:
|
||||||
state->frmival.stepwise.max.numerator);
|
state->frmival.stepwise.max.numerator);
|
||||||
|
|
||||||
if (state->frmival.type == V4L2_FRMIVAL_TYPE_CONTINUOUS) {
|
if (state->frmival.type == V4L2_FRMIVAL_TYPE_CONTINUOUS) {
|
||||||
prop->body.flags |= SPA_PROP_RANGE_TYPE_MIN_MAX;
|
prop->body.flags |= SPA_POD_PROP_RANGE_MIN_MAX;
|
||||||
} else {
|
} else {
|
||||||
prop->body.flags |= SPA_PROP_RANGE_TYPE_STEP;
|
prop->body.flags |= SPA_POD_PROP_RANGE_STEP;
|
||||||
spa_pod_builder_fraction (&b,
|
spa_pod_builder_fraction (&b,
|
||||||
state->frmival.stepwise.step.denominator,
|
state->frmival.stepwise.step.denominator,
|
||||||
state->frmival.stepwise.step.numerator);
|
state->frmival.stepwise.step.numerator);
|
||||||
|
|
|
||||||
|
|
@ -283,7 +283,7 @@ draw (SpaVideoTestSrc *this, char *data)
|
||||||
if (res != SPA_RESULT_OK)
|
if (res != SPA_RESULT_OK)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
pattern = this->props[1].pattern;
|
pattern = this->props.pattern;
|
||||||
if (pattern == pattern_val_smpte_snow)
|
if (pattern == pattern_val_smpte_snow)
|
||||||
draw_smpte_snow (&dd);
|
draw_smpte_snow (&dd);
|
||||||
else if (pattern == pattern_val_snow)
|
else if (pattern == pattern_val_snow)
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ typedef struct {
|
||||||
typedef struct _SpaVideoTestSrc SpaVideoTestSrc;
|
typedef struct _SpaVideoTestSrc SpaVideoTestSrc;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SpaProps props;
|
|
||||||
bool live;
|
bool live;
|
||||||
uint32_t pattern;
|
uint32_t pattern;
|
||||||
} SpaVideoTestSrcProps;
|
} SpaVideoTestSrcProps;
|
||||||
|
|
@ -72,7 +71,8 @@ struct _SpaVideoTestSrc {
|
||||||
SpaLog *log;
|
SpaLog *log;
|
||||||
SpaLoop *data_loop;
|
SpaLoop *data_loop;
|
||||||
|
|
||||||
SpaVideoTestSrcProps props[2];
|
SpaVideoTestSrcProps props;
|
||||||
|
uint8_t props_buffer[256];
|
||||||
|
|
||||||
SpaNodeEventCallback event_cb;
|
SpaNodeEventCallback event_cb;
|
||||||
void *user_data;
|
void *user_data;
|
||||||
|
|
@ -110,17 +110,18 @@ struct _SpaVideoTestSrc {
|
||||||
static const uint32_t pattern_val_smpte_snow = 0;
|
static const uint32_t pattern_val_smpte_snow = 0;
|
||||||
static const uint32_t pattern_val_snow = 1;
|
static const uint32_t pattern_val_snow = 1;
|
||||||
|
|
||||||
|
enum {
|
||||||
|
PROP_ID_NONE = 0,
|
||||||
|
PROP_ID_LIVE,
|
||||||
|
PROP_ID_PATTERN,
|
||||||
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
static const SpaPropRangeInfo pattern_range[] = {
|
static const SpaPropRangeInfo pattern_range[] = {
|
||||||
{ "smpte-snow", { sizeof (uint32_t), &pattern_val_smpte_snow } },
|
{ "smpte-snow", { sizeof (uint32_t), &pattern_val_smpte_snow } },
|
||||||
{ "snow", { sizeof (uint32_t), &pattern_val_snow } },
|
{ "snow", { sizeof (uint32_t), &pattern_val_snow } },
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_ID_LIVE,
|
|
||||||
PROP_ID_PATTERN,
|
|
||||||
PROP_ID_LAST,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const SpaPropInfo prop_info[] =
|
static const SpaPropInfo prop_info[] =
|
||||||
{
|
{
|
||||||
{ PROP_ID_LIVE, offsetof (SpaVideoTestSrcProps, live),
|
{ PROP_ID_LIVE, offsetof (SpaVideoTestSrcProps, live),
|
||||||
|
|
@ -136,6 +137,7 @@ static const SpaPropInfo prop_info[] =
|
||||||
SPA_PROP_RANGE_TYPE_ENUM, SPA_N_ELEMENTS (pattern_range), pattern_range,
|
SPA_PROP_RANGE_TYPE_ENUM, SPA_N_ELEMENTS (pattern_range), pattern_range,
|
||||||
NULL },
|
NULL },
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
static SpaResult
|
static SpaResult
|
||||||
reset_videotestsrc_props (SpaVideoTestSrcProps *props)
|
reset_videotestsrc_props (SpaVideoTestSrcProps *props)
|
||||||
|
|
@ -151,14 +153,28 @@ spa_videotestsrc_node_get_props (SpaNode *node,
|
||||||
SpaProps **props)
|
SpaProps **props)
|
||||||
{
|
{
|
||||||
SpaVideoTestSrc *this;
|
SpaVideoTestSrc *this;
|
||||||
|
SpaPODBuilder b = { NULL, };
|
||||||
|
|
||||||
if (node == NULL || props == NULL)
|
if (node == NULL || props == NULL)
|
||||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
|
|
||||||
this = SPA_CONTAINER_OF (node, SpaVideoTestSrc, node);
|
this = SPA_CONTAINER_OF (node, SpaVideoTestSrc, node);
|
||||||
|
|
||||||
memcpy (&this->props[0], &this->props[1], sizeof (this->props[1]));
|
b.data = this->props_buffer;
|
||||||
*props = &this->props[0].props;
|
b.size = sizeof (this->props_buffer);
|
||||||
|
|
||||||
|
*props = SPA_MEMBER (b.data, spa_pod_builder_props (&b,
|
||||||
|
PROP_ID_LIVE, SPA_POD_TYPE_BOOL,
|
||||||
|
this->props.live,
|
||||||
|
SPA_POD_PROP_FLAG_READWRITE |
|
||||||
|
SPA_POD_PROP_RANGE_NONE,
|
||||||
|
PROP_ID_PATTERN, SPA_POD_TYPE_INT,
|
||||||
|
this->props.pattern,
|
||||||
|
SPA_POD_PROP_FLAG_READWRITE |
|
||||||
|
SPA_POD_PROP_RANGE_ENUM, 2,
|
||||||
|
pattern_val_smpte_snow,
|
||||||
|
pattern_val_snow,
|
||||||
|
0), SpaProps);
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -175,15 +191,26 @@ spa_videotestsrc_node_set_props (SpaNode *node,
|
||||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||||
|
|
||||||
this = SPA_CONTAINER_OF (node, SpaVideoTestSrc, node);
|
this = SPA_CONTAINER_OF (node, SpaVideoTestSrc, node);
|
||||||
p = &this->props[1];
|
p = &this->props;
|
||||||
|
|
||||||
if (props == NULL) {
|
if (props == NULL) {
|
||||||
res = reset_videotestsrc_props (p);
|
res = reset_videotestsrc_props (p);
|
||||||
} else {
|
} else {
|
||||||
res = spa_props_copy_values (props, &p->props);
|
SpaPODProp *pr;
|
||||||
|
|
||||||
|
SPA_POD_OBJECT_BODY_FOREACH(&props->body, props->pod.size, pr) {
|
||||||
|
switch (pr->body.key) {
|
||||||
|
case PROP_ID_LIVE:
|
||||||
|
this->props.live = ((SpaPODBool*)&pr->body.value)->value;
|
||||||
|
break;
|
||||||
|
case PROP_ID_PATTERN:
|
||||||
|
this->props.pattern = ((SpaPODInt*)&pr->body.value)->value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this->props[1].live)
|
if (this->props.live)
|
||||||
this->info.flags |= SPA_PORT_INFO_FLAG_LIVE;
|
this->info.flags |= SPA_PORT_INFO_FLAG_LIVE;
|
||||||
else
|
else
|
||||||
this->info.flags &= ~SPA_PORT_INFO_FLAG_LIVE;
|
this->info.flags &= ~SPA_PORT_INFO_FLAG_LIVE;
|
||||||
|
|
@ -217,7 +244,7 @@ static void
|
||||||
set_timer (SpaVideoTestSrc *this, bool enabled)
|
set_timer (SpaVideoTestSrc *this, bool enabled)
|
||||||
{
|
{
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
if (this->props[1].live) {
|
if (this->props.live) {
|
||||||
uint64_t next_time = this->start_time + this->elapsed_time;
|
uint64_t next_time = this->start_time + this->elapsed_time;
|
||||||
this->timerspec.it_value.tv_sec = next_time / SPA_NSEC_PER_SEC;
|
this->timerspec.it_value.tv_sec = next_time / SPA_NSEC_PER_SEC;
|
||||||
this->timerspec.it_value.tv_nsec = next_time % SPA_NSEC_PER_SEC;
|
this->timerspec.it_value.tv_nsec = next_time % SPA_NSEC_PER_SEC;
|
||||||
|
|
@ -305,7 +332,7 @@ spa_videotestsrc_node_send_command (SpaNode *node,
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
|
|
||||||
clock_gettime (CLOCK_MONOTONIC, &now);
|
clock_gettime (CLOCK_MONOTONIC, &now);
|
||||||
if (this->props[1].live)
|
if (this->props.live)
|
||||||
this->start_time = SPA_TIMESPEC_TO_TIME (&now);
|
this->start_time = SPA_TIMESPEC_TO_TIME (&now);
|
||||||
else
|
else
|
||||||
this->start_time = 0;
|
this->start_time = 0;
|
||||||
|
|
@ -782,7 +809,7 @@ spa_videotestsrc_node_port_reuse_buffer (SpaNode *node,
|
||||||
b->outstanding = false;
|
b->outstanding = false;
|
||||||
spa_list_insert (this->empty.prev, &b->link);
|
spa_list_insert (this->empty.prev, &b->link);
|
||||||
|
|
||||||
if (!this->props[1].live)
|
if (!this->props.live)
|
||||||
set_timer (this, true);
|
set_timer (this, true);
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
|
|
@ -962,9 +989,11 @@ videotestsrc_init (const SpaHandleFactory *factory,
|
||||||
|
|
||||||
this->node = videotestsrc_node;
|
this->node = videotestsrc_node;
|
||||||
this->clock = videotestsrc_clock;
|
this->clock = videotestsrc_clock;
|
||||||
|
#if 0
|
||||||
this->props[1].props.n_prop_info = PROP_ID_LAST;
|
this->props[1].props.n_prop_info = PROP_ID_LAST;
|
||||||
this->props[1].props.prop_info = prop_info;
|
this->props[1].props.prop_info = prop_info;
|
||||||
reset_videotestsrc_props (&this->props[1]);
|
#endif
|
||||||
|
reset_videotestsrc_props (&this->props);
|
||||||
|
|
||||||
spa_list_init (&this->empty);
|
spa_list_init (&this->empty);
|
||||||
|
|
||||||
|
|
@ -980,7 +1009,7 @@ videotestsrc_init (const SpaHandleFactory *factory,
|
||||||
|
|
||||||
this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS |
|
this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS |
|
||||||
SPA_PORT_INFO_FLAG_NO_REF;
|
SPA_PORT_INFO_FLAG_NO_REF;
|
||||||
if (this->props[1].live)
|
if (this->props.live)
|
||||||
this->info.flags |= SPA_PORT_INFO_FLAG_LIVE;
|
this->info.flags |= SPA_PORT_INFO_FLAG_LIVE;
|
||||||
|
|
||||||
this->node.state = SPA_NODE_STATE_CONFIGURE;
|
this->node.state = SPA_NODE_STATE_CONFIGURE;
|
||||||
|
|
|
||||||
|
|
@ -91,9 +91,11 @@ struct _SpaVolume {
|
||||||
#define CHECK_PORT(this,d,p) ((p) == 0)
|
#define CHECK_PORT(this,d,p) ((p) == 0)
|
||||||
|
|
||||||
static const double default_volume = 1.0;
|
static const double default_volume = 1.0;
|
||||||
|
static const bool default_mute = false;
|
||||||
|
|
||||||
|
#if 0
|
||||||
static const double min_volume = 0.0;
|
static const double min_volume = 0.0;
|
||||||
static const double max_volume = 10.0;
|
static const double max_volume = 10.0;
|
||||||
static const bool default_mute = false;
|
|
||||||
|
|
||||||
static const SpaPropRangeInfo volume_range[] = {
|
static const SpaPropRangeInfo volume_range[] = {
|
||||||
{ "min", { sizeof (double), &min_volume } },
|
{ "min", { sizeof (double), &min_volume } },
|
||||||
|
|
@ -122,6 +124,8 @@ static const SpaPropInfo prop_info[] =
|
||||||
NULL },
|
NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
reset_volume_props (SpaVolumeProps *props)
|
reset_volume_props (SpaVolumeProps *props)
|
||||||
{
|
{
|
||||||
|
|
@ -170,7 +174,7 @@ spa_volume_node_set_props (SpaNode *node,
|
||||||
reset_volume_props (p);
|
reset_volume_props (p);
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
res = spa_props_copy_values (props, &p->props);
|
//res = spa_props_copy_values (props, &p->props);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
@ -848,8 +852,10 @@ volume_init (const SpaHandleFactory *factory,
|
||||||
this->uri.node = spa_id_map_get_id (this->map, SPA_NODE_URI);
|
this->uri.node = spa_id_map_get_id (this->map, SPA_NODE_URI);
|
||||||
|
|
||||||
this->node = volume_node;
|
this->node = volume_node;
|
||||||
|
#if 0
|
||||||
this->props[1].props.n_prop_info = PROP_ID_LAST;
|
this->props[1].props.n_prop_info = PROP_ID_LAST;
|
||||||
this->props[1].props.prop_info = prop_info;
|
this->props[1].props.prop_info = prop_info;
|
||||||
|
#endif
|
||||||
reset_volume_props (&this->props[1]);
|
reset_volume_props (&this->props[1]);
|
||||||
|
|
||||||
this->in_ports[0].info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS |
|
this->in_ports[0].info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS |
|
||||||
|
|
|
||||||
|
|
@ -107,6 +107,7 @@ enum {
|
||||||
PROP_ID_LAST,
|
PROP_ID_LAST,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if 0
|
||||||
static const SpaPropInfo prop_info[] =
|
static const SpaPropInfo prop_info[] =
|
||||||
{
|
{
|
||||||
{ PROP_ID_DEVICE, offsetof (SpaXvSinkProps, device),
|
{ PROP_ID_DEVICE, offsetof (SpaXvSinkProps, device),
|
||||||
|
|
@ -128,6 +129,7 @@ static const SpaPropInfo prop_info[] =
|
||||||
SPA_PROP_RANGE_TYPE_NONE, 0, NULL,
|
SPA_PROP_RANGE_TYPE_NONE, 0, NULL,
|
||||||
NULL },
|
NULL },
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
update_state (SpaXvSink *this, SpaNodeState state)
|
update_state (SpaXvSink *this, SpaNodeState state)
|
||||||
|
|
@ -147,7 +149,6 @@ spa_xv_sink_node_get_props (SpaNode *node,
|
||||||
this = SPA_CONTAINER_OF (node, SpaXvSink, node);
|
this = SPA_CONTAINER_OF (node, SpaXvSink, node);
|
||||||
|
|
||||||
memcpy (&this->props[0], &this->props[1], sizeof (this->props[1]));
|
memcpy (&this->props[0], &this->props[1], sizeof (this->props[1]));
|
||||||
*props = &this->props[0].props;
|
|
||||||
|
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
@ -170,9 +171,6 @@ spa_xv_sink_node_set_props (SpaNode *node,
|
||||||
reset_xv_sink_props (p);
|
reset_xv_sink_props (p);
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = spa_props_copy_values (props, &p->props);
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -337,8 +335,8 @@ spa_xv_sink_node_port_set_format (SpaNode *node,
|
||||||
return SPA_RESULT_OK;
|
return SPA_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (format->body.media_type == SPA_MEDIA_TYPE_VIDEO) {
|
if (format->body.media_type.value == SPA_MEDIA_TYPE_VIDEO) {
|
||||||
if (format->body.media_subtype == SPA_MEDIA_SUBTYPE_RAW) {
|
if (format->body.media_subtype.value == SPA_MEDIA_SUBTYPE_RAW) {
|
||||||
if ((res = spa_format_video_parse (format, &info) < 0))
|
if ((res = spa_format_video_parse (format, &info) < 0))
|
||||||
return res;
|
return res;
|
||||||
} else
|
} else
|
||||||
|
|
@ -584,8 +582,10 @@ xv_sink_init (const SpaHandleFactory *factory,
|
||||||
this->uri.node = spa_id_map_get_id (this->map, SPA_NODE_URI);
|
this->uri.node = spa_id_map_get_id (this->map, SPA_NODE_URI);
|
||||||
|
|
||||||
this->node = xvsink_node;
|
this->node = xvsink_node;
|
||||||
|
#if 0
|
||||||
this->props[1].props.n_prop_info = PROP_ID_LAST;
|
this->props[1].props.n_prop_info = PROP_ID_LAST;
|
||||||
this->props[1].props.prop_info = prop_info;
|
this->props[1].props.prop_info = prop_info;
|
||||||
|
#endif
|
||||||
reset_xv_sink_props (&this->props[1]);
|
reset_xv_sink_props (&this->props[1]);
|
||||||
|
|
||||||
this->info.flags = SPA_PORT_INFO_FLAG_NONE;
|
this->info.flags = SPA_PORT_INFO_FLAG_NONE;
|
||||||
|
|
|
||||||
|
|
@ -86,9 +86,10 @@ static const struct _test_format {
|
||||||
} framerate_vals;
|
} framerate_vals;
|
||||||
} props;
|
} props;
|
||||||
} test_format = {
|
} test_format = {
|
||||||
{ { sizeof (test_format.props) + sizeof (SpaFormatBody), SPA_POD_TYPE_FORMAT },
|
{ { { sizeof (test_format.props) + sizeof (SpaFormatBody) + sizeof (SpaPODObjectBody), SPA_POD_TYPE_OBJECT },
|
||||||
{ SPA_MEDIA_TYPE_VIDEO,
|
{ 0, 0 } },
|
||||||
SPA_MEDIA_SUBTYPE_RAW },
|
{ { { sizeof (uint32_t), SPA_POD_TYPE_INT }, SPA_MEDIA_TYPE_VIDEO },
|
||||||
|
{ { sizeof (uint32_t), SPA_POD_TYPE_INT }, SPA_MEDIA_SUBTYPE_RAW } },
|
||||||
}, {
|
}, {
|
||||||
{ { sizeof (test_format.props.format_vals) + sizeof (SpaPODPropBody),
|
{ { sizeof (test_format.props.format_vals) + sizeof (SpaPODPropBody),
|
||||||
SPA_POD_TYPE_PROP } ,
|
SPA_POD_TYPE_PROP } ,
|
||||||
|
|
@ -156,7 +157,7 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
spa_pod_builder_pop (&b, &frame[0]);
|
spa_pod_builder_pop (&b, &frame[0]);
|
||||||
|
|
||||||
spa_debug_pod (&fmt->pod);
|
spa_debug_pod (&fmt->obj.pod);
|
||||||
|
|
||||||
memset (&b, 0, sizeof(b));
|
memset (&b, 0, sizeof(b));
|
||||||
b.data = buffer;
|
b.data = buffer;
|
||||||
|
|
@ -183,10 +184,10 @@ main (int argc, char *argv[])
|
||||||
0);
|
0);
|
||||||
|
|
||||||
fmt = SPA_MEMBER (buffer, o, SpaFormat);
|
fmt = SPA_MEMBER (buffer, o, SpaFormat);
|
||||||
spa_debug_pod (&fmt->pod);
|
spa_debug_pod (&fmt->obj.pod);
|
||||||
spa_debug_format (fmt);
|
spa_debug_format (fmt);
|
||||||
|
|
||||||
spa_debug_pod (&test_format.fmt.pod);
|
spa_debug_pod (&test_format.fmt.obj.pod);
|
||||||
spa_debug_format (&test_format.fmt);
|
spa_debug_format (&test_format.fmt);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue