mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
Improve negotiation
Fix selection of the default property value by restricting it to something in the valid range of the property. Fix audio/videotestsrc reuse Fix format enum with filters. Fix module property configuration Fix connection refill
This commit is contained in:
parent
282995d0d0
commit
710a1a41e6
13 changed files with 131 additions and 81 deletions
|
|
@ -43,6 +43,17 @@ typedef struct _SpaPODBuilder {
|
|||
|
||||
#define SPA_POD_BUILDER_DEREF(b,ref,type) SPA_MEMBER ((b)->data, (ref), type)
|
||||
|
||||
static inline void
|
||||
spa_pod_builder_init (SpaPODBuilder *builder,
|
||||
void *data,
|
||||
size_t size)
|
||||
{
|
||||
builder->data = data;
|
||||
builder->size = size;
|
||||
builder->offset = 0;
|
||||
builder->stack = NULL;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
spa_pod_builder_in_array (SpaPODBuilder *builder)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -318,8 +318,8 @@ struct pod_type_name {
|
|||
} pod_type_names[] = {
|
||||
{ "invalid", "*Invalid*" },
|
||||
{ "bool", "Bool" },
|
||||
{ "int", "Int" },
|
||||
{ "uri", "URI" },
|
||||
{ "int", "Int" },
|
||||
{ "long", "Long" },
|
||||
{ "float", "Float" },
|
||||
{ "double", "Double" },
|
||||
|
|
@ -341,12 +341,12 @@ print_pod_value (uint32_t size, uint32_t type, void *body, int prefix)
|
|||
case SPA_POD_TYPE_BOOL:
|
||||
printf ("%-*sBool %d\n", prefix, "", *(int32_t *) body);
|
||||
break;
|
||||
case SPA_POD_TYPE_INT:
|
||||
printf ("%-*sInt %d\n", prefix, "", *(int32_t *) body);
|
||||
break;
|
||||
case SPA_POD_TYPE_URI:
|
||||
printf ("%-*sURI %d\n", prefix, "", *(int32_t *) body);
|
||||
break;
|
||||
case SPA_POD_TYPE_INT:
|
||||
printf ("%-*sInt %d\n", prefix, "", *(int32_t *) body);
|
||||
break;
|
||||
case SPA_POD_TYPE_LONG:
|
||||
printf ("%-*sLong %"PRIi64"\n", prefix, "", *(int64_t *) body);
|
||||
break;
|
||||
|
|
@ -441,10 +441,10 @@ print_format_value (uint32_t size, uint32_t type, void *body)
|
|||
case SPA_POD_TYPE_BOOL:
|
||||
fprintf (stderr, "%s", *(int32_t *) body ? "true" : "false");
|
||||
break;
|
||||
case SPA_POD_TYPE_INT:
|
||||
case SPA_POD_TYPE_URI:
|
||||
fprintf (stderr, "%"PRIi32, *(int32_t *) body);
|
||||
break;
|
||||
case SPA_POD_TYPE_URI:
|
||||
case SPA_POD_TYPE_INT:
|
||||
fprintf (stderr, "%"PRIi32, *(int32_t *) body);
|
||||
break;
|
||||
case SPA_POD_TYPE_LONG:
|
||||
|
|
|
|||
|
|
@ -156,6 +156,52 @@ compare_value (SpaPODType type, const void *r1, const void *r2)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
fix_default (SpaPODProp *prop)
|
||||
{
|
||||
void *val = SPA_MEMBER (prop, sizeof (SpaPODProp), void),
|
||||
*alt = SPA_MEMBER (val, prop->body.value.size, void);
|
||||
int i, nalt = SPA_POD_PROP_N_VALUES (prop) - 1;
|
||||
|
||||
switch (prop->body.flags & SPA_POD_PROP_RANGE_MASK) {
|
||||
case SPA_POD_PROP_RANGE_NONE:
|
||||
break;
|
||||
case SPA_POD_PROP_RANGE_MIN_MAX:
|
||||
case SPA_POD_PROP_RANGE_STEP:
|
||||
if (compare_value (prop->body.value.type, val, alt) < 0)
|
||||
memcpy (val, alt, prop->body.value.size);
|
||||
alt = SPA_MEMBER (alt, prop->body.value.size, void);
|
||||
if (compare_value (prop->body.value.type, val, alt) > 0)
|
||||
memcpy (val, alt, prop->body.value.size);
|
||||
break;
|
||||
case SPA_POD_PROP_RANGE_ENUM:
|
||||
{
|
||||
void *best = NULL;
|
||||
|
||||
for (i = 0; i < nalt; i++) {
|
||||
if (compare_value (prop->body.value.type, val, alt) == 0) {
|
||||
best = alt;
|
||||
break;
|
||||
}
|
||||
if (best == NULL)
|
||||
best = alt;
|
||||
alt = SPA_MEMBER (alt, prop->body.value.size, void);
|
||||
}
|
||||
if (best)
|
||||
memcpy (val, best, prop->body.value.size);
|
||||
|
||||
if (nalt == 1) {
|
||||
prop->body.flags &= ~SPA_POD_PROP_FLAG_UNSET;
|
||||
prop->body.flags &= ~SPA_POD_PROP_RANGE_MASK;
|
||||
prop->body.flags |= SPA_POD_PROP_RANGE_NONE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPA_POD_PROP_RANGE_FLAGS:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static inline SpaPODProp *
|
||||
find_prop (const SpaPOD *pod, uint32_t size, uint32_t key)
|
||||
{
|
||||
|
|
@ -244,10 +290,7 @@ spa_props_filter (SpaPODBuilder *b,
|
|||
}
|
||||
if (n_copied == 0)
|
||||
return SPA_RESULT_NO_FORMAT;
|
||||
if (n_copied == 1)
|
||||
np->body.flags |= SPA_POD_PROP_RANGE_NONE;
|
||||
else
|
||||
np->body.flags |= SPA_POD_PROP_RANGE_ENUM | SPA_POD_PROP_FLAG_UNSET;
|
||||
np->body.flags |= SPA_POD_PROP_RANGE_ENUM | SPA_POD_PROP_FLAG_UNSET;
|
||||
}
|
||||
|
||||
if ((rt1 == SPA_POD_PROP_RANGE_NONE && rt2 == SPA_POD_PROP_RANGE_MIN_MAX) ||
|
||||
|
|
@ -264,10 +307,7 @@ spa_props_filter (SpaPODBuilder *b,
|
|||
}
|
||||
if (n_copied == 0)
|
||||
return SPA_RESULT_NO_FORMAT;
|
||||
if (n_copied == 1)
|
||||
np->body.flags |= SPA_POD_PROP_RANGE_NONE;
|
||||
else
|
||||
np->body.flags |= SPA_POD_PROP_RANGE_ENUM | SPA_POD_PROP_FLAG_UNSET;
|
||||
np->body.flags |= SPA_POD_PROP_RANGE_ENUM | SPA_POD_PROP_FLAG_UNSET;
|
||||
}
|
||||
|
||||
if ((rt1 == SPA_POD_PROP_RANGE_NONE && rt2 == SPA_POD_PROP_RANGE_STEP) ||
|
||||
|
|
@ -289,10 +329,7 @@ spa_props_filter (SpaPODBuilder *b,
|
|||
}
|
||||
if (n_copied == 0)
|
||||
return SPA_RESULT_NO_FORMAT;
|
||||
if (n_copied == 1)
|
||||
np->body.flags |= SPA_POD_PROP_RANGE_NONE;
|
||||
else
|
||||
np->body.flags |= SPA_POD_PROP_RANGE_ENUM | SPA_POD_PROP_FLAG_UNSET;
|
||||
np->body.flags |= SPA_POD_PROP_RANGE_ENUM | SPA_POD_PROP_FLAG_UNSET;
|
||||
}
|
||||
|
||||
if (rt1 == SPA_POD_PROP_RANGE_MIN_MAX && rt2 == SPA_POD_PROP_RANGE_MIN_MAX) {
|
||||
|
|
@ -348,6 +385,7 @@ spa_props_filter (SpaPODBuilder *b,
|
|||
return SPA_RESULT_NOT_IMPLEMENTED;
|
||||
|
||||
spa_pod_builder_pop (b, &f);
|
||||
fix_default (np);
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,8 +74,7 @@ spa_alsa_sink_node_get_props (SpaNode *node,
|
|||
|
||||
this = SPA_CONTAINER_OF (node, SpaALSASink, node);
|
||||
|
||||
b.data = this->props_buffer;
|
||||
b.size = sizeof (this->props_buffer);
|
||||
spa_pod_builder_init (&b, this->props_buffer, sizeof (this->props_buffer));
|
||||
|
||||
*props = SPA_MEMBER (b.data, spa_pod_builder_props (&b,
|
||||
PROP_ID_DEVICE, SPA_POD_TYPE_STRING,
|
||||
|
|
@ -329,7 +328,7 @@ spa_alsa_sink_node_port_enum_formats (SpaNode *node,
|
|||
SpaResult res;
|
||||
SpaFormat *fmt;
|
||||
uint8_t buffer[1024];
|
||||
SpaPODBuilder b = { buffer, sizeof (buffer), };
|
||||
SpaPODBuilder b = { NULL, };
|
||||
|
||||
if (node == NULL || format == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
|
@ -339,7 +338,10 @@ spa_alsa_sink_node_port_enum_formats (SpaNode *node,
|
|||
if (!CHECK_PORT (this, direction, port_id))
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
|
||||
switch (index) {
|
||||
next:
|
||||
spa_pod_builder_init (&b, buffer, sizeof (buffer));
|
||||
|
||||
switch (index++) {
|
||||
case 0:
|
||||
fmt = SPA_MEMBER (buffer, spa_pod_builder_format (&b,
|
||||
SPA_MEDIA_TYPE_AUDIO, SPA_MEDIA_SUBTYPE_RAW,
|
||||
|
|
@ -370,12 +372,10 @@ spa_alsa_sink_node_port_enum_formats (SpaNode *node,
|
|||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
|
||||
b.data = this->format_buffer;
|
||||
b.size = sizeof (this->format_buffer);
|
||||
b.offset = 0;
|
||||
spa_pod_builder_init (&b, this->format_buffer, sizeof (this->format_buffer));
|
||||
|
||||
if ((res = spa_format_filter (fmt, filter, &b)) != SPA_RESULT_OK)
|
||||
return res;
|
||||
goto next;
|
||||
|
||||
*format = SPA_MEMBER (b.data, 0, SpaFormat);
|
||||
|
||||
|
|
|
|||
|
|
@ -74,8 +74,7 @@ spa_alsa_source_node_get_props (SpaNode *node,
|
|||
|
||||
this = SPA_CONTAINER_OF (node, SpaALSASource, node);
|
||||
|
||||
b.data = this->props_buffer;
|
||||
b.size = sizeof (this->props_buffer);
|
||||
spa_pod_builder_init (&b, this->props_buffer, sizeof (this->props_buffer));
|
||||
|
||||
*props = SPA_MEMBER (b.data, spa_pod_builder_props (&b,
|
||||
PROP_ID_DEVICE, SPA_POD_TYPE_STRING,
|
||||
|
|
@ -363,8 +362,8 @@ spa_alsa_source_node_port_enum_formats (SpaNode *node,
|
|||
SpaALSASource *this;
|
||||
SpaResult res;
|
||||
SpaFormat *fmt;
|
||||
uint8_t buffer[256];
|
||||
SpaPODBuilder b = { buffer, sizeof (buffer), };
|
||||
uint8_t buffer[1024];
|
||||
SpaPODBuilder b = { NULL, };
|
||||
|
||||
if (node == NULL || format == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
|
@ -374,7 +373,10 @@ spa_alsa_source_node_port_enum_formats (SpaNode *node,
|
|||
if (!CHECK_PORT (this, direction, port_id))
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
|
||||
switch (index) {
|
||||
next:
|
||||
spa_pod_builder_init (&b, buffer, sizeof (buffer));
|
||||
|
||||
switch (index++) {
|
||||
case 0:
|
||||
fmt = SPA_MEMBER (buffer, spa_pod_builder_format (&b,
|
||||
SPA_MEDIA_TYPE_AUDIO, SPA_MEDIA_SUBTYPE_RAW,
|
||||
|
|
@ -404,12 +406,10 @@ spa_alsa_source_node_port_enum_formats (SpaNode *node,
|
|||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
|
||||
b.data = this->format_buffer;
|
||||
b.size = sizeof (this->format_buffer);
|
||||
b.offset = 0;
|
||||
spa_pod_builder_init (&b, this->format_buffer, sizeof (this->format_buffer));
|
||||
|
||||
if ((res = spa_format_filter (fmt, filter, &b)) != SPA_RESULT_OK)
|
||||
return res;
|
||||
goto next;
|
||||
|
||||
*format = SPA_MEMBER (this->format_buffer, 0, SpaFormat);
|
||||
|
||||
|
|
|
|||
|
|
@ -143,8 +143,7 @@ spa_audiotestsrc_node_get_props (SpaNode *node,
|
|||
|
||||
this = SPA_CONTAINER_OF (node, SpaAudioTestSrc, node);
|
||||
|
||||
b.data = this->props_buffer;
|
||||
b.size = sizeof (this->props_buffer);
|
||||
spa_pod_builder_init (&b, this->props_buffer, sizeof (this->props_buffer));
|
||||
|
||||
*props = SPA_MEMBER (b.data, spa_pod_builder_props (&b,
|
||||
PROP_ID_LIVE, SPA_POD_TYPE_BOOL,
|
||||
|
|
@ -462,7 +461,7 @@ spa_audiotestsrc_node_port_enum_formats (SpaNode *node,
|
|||
SpaResult res;
|
||||
SpaFormat *fmt;
|
||||
uint8_t buffer[256];
|
||||
SpaPODBuilder b = { buffer, sizeof (buffer), };
|
||||
SpaPODBuilder b = { NULL, };
|
||||
|
||||
if (node == NULL || format == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
|
@ -472,9 +471,11 @@ spa_audiotestsrc_node_port_enum_formats (SpaNode *node,
|
|||
if (!CHECK_PORT (this, direction, port_id))
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
|
||||
switch (index) {
|
||||
next:
|
||||
spa_pod_builder_init (&b, buffer, sizeof (buffer));
|
||||
|
||||
switch (index++) {
|
||||
case 0:
|
||||
{
|
||||
fmt = SPA_MEMBER (buffer, spa_pod_builder_format (&b,
|
||||
SPA_MEDIA_TYPE_AUDIO, SPA_MEDIA_SUBTYPE_RAW,
|
||||
SPA_PROP_ID_AUDIO_FORMAT, SPA_POD_TYPE_INT,
|
||||
|
|
@ -495,17 +496,14 @@ spa_audiotestsrc_node_port_enum_formats (SpaNode *node,
|
|||
1, INT32_MAX,
|
||||
0), SpaFormat);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
|
||||
b.data = this->format_buffer;
|
||||
b.size = sizeof (this->format_buffer);
|
||||
b.offset = 0;
|
||||
spa_pod_builder_init (&b, this->format_buffer, sizeof (this->format_buffer));
|
||||
|
||||
if ((res = spa_format_filter (fmt, filter, &b)) != SPA_RESULT_OK)
|
||||
return res;
|
||||
goto next;
|
||||
|
||||
*format = SPA_POD_BUILDER_DEREF (&b, 0, SpaFormat);
|
||||
|
||||
|
|
@ -519,6 +517,8 @@ clear_buffers (SpaAudioTestSrc *this)
|
|||
spa_log_info (this->log, "audiotestsrc %p: clear buffers", this);
|
||||
this->n_buffers = 0;
|
||||
spa_list_init (&this->empty);
|
||||
this->started = false;
|
||||
set_timer (this, false);
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -599,8 +599,7 @@ spa_audiotestsrc_node_port_get_format (SpaNode *node,
|
|||
if (!this->have_format)
|
||||
return SPA_RESULT_NO_FORMAT;
|
||||
|
||||
b.data = this->format_buffer;
|
||||
b.size = sizeof (this->format_buffer);
|
||||
spa_pod_builder_init (&b, this->format_buffer, sizeof (this->format_buffer));
|
||||
|
||||
*format = SPA_MEMBER (b.data, spa_pod_builder_format (&b,
|
||||
SPA_MEDIA_TYPE_AUDIO, SPA_MEDIA_SUBTYPE_RAW,
|
||||
|
|
|
|||
|
|
@ -452,7 +452,7 @@ spa_v4l2_enum_format (SpaV4l2Source *this,
|
|||
unsigned int index)
|
||||
{
|
||||
SpaV4l2State *state = &this->state[0];
|
||||
int res;
|
||||
int res, n_fractions;
|
||||
const FormatInfo *info;
|
||||
SpaPODFrame f[2];
|
||||
SpaPODProp *prop;
|
||||
|
|
@ -631,7 +631,7 @@ have_size:
|
|||
SPA_POD_PROP_FLAG_UNSET |
|
||||
SPA_POD_PROP_FLAG_READWRITE),
|
||||
SpaPODProp);
|
||||
spa_pod_builder_fraction (&b, 25, 1);
|
||||
n_fractions = 0;
|
||||
|
||||
state->frmival.index = 0;
|
||||
|
||||
|
|
@ -694,12 +694,18 @@ have_framerate:
|
|||
|
||||
if (state->frmival.type == V4L2_FRMIVAL_TYPE_DISCRETE) {
|
||||
prop->body.flags |= SPA_POD_PROP_RANGE_ENUM;
|
||||
if (n_fractions == 0)
|
||||
spa_pod_builder_fraction (&b,
|
||||
state->frmival.discrete.denominator,
|
||||
state->frmival.discrete.numerator);
|
||||
spa_pod_builder_fraction (&b,
|
||||
state->frmival.discrete.denominator,
|
||||
state->frmival.discrete.numerator);
|
||||
state->frmival.index++;
|
||||
} else if (state->frmival.type == V4L2_FRMIVAL_TYPE_CONTINUOUS ||
|
||||
state->frmival.type == V4L2_FRMIVAL_TYPE_STEPWISE) {
|
||||
if (n_fractions == 0)
|
||||
spa_pod_builder_fraction (&b, 25, 1);
|
||||
spa_pod_builder_fraction (&b,
|
||||
state->frmival.stepwise.min.denominator,
|
||||
state->frmival.stepwise.min.numerator);
|
||||
|
|
@ -717,6 +723,7 @@ have_framerate:
|
|||
}
|
||||
break;
|
||||
}
|
||||
n_fractions++;
|
||||
}
|
||||
spa_pod_builder_pop (&b, &f[1]);
|
||||
spa_pod_builder_pop (&b, &f[0]);
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ struct _SpaVideoTestSrc {
|
|||
SpaLog *log;
|
||||
SpaLoop *data_loop;
|
||||
|
||||
uint8_t props_buffer[512];
|
||||
SpaVideoTestSrcProps props;
|
||||
uint8_t props_buffer[256];
|
||||
|
||||
SpaNodeEventCallback event_cb;
|
||||
void *user_data;
|
||||
|
|
@ -135,8 +135,7 @@ spa_videotestsrc_node_get_props (SpaNode *node,
|
|||
|
||||
this = SPA_CONTAINER_OF (node, SpaVideoTestSrc, node);
|
||||
|
||||
b.data = this->props_buffer;
|
||||
b.size = sizeof (this->props_buffer);
|
||||
spa_pod_builder_init (&b, this->props_buffer, sizeof (this->props_buffer));
|
||||
|
||||
*props = SPA_MEMBER (b.data, spa_pod_builder_props (&b,
|
||||
PROP_ID_LIVE, SPA_POD_TYPE_BOOL,
|
||||
|
|
@ -431,7 +430,7 @@ spa_videotestsrc_node_port_enum_formats (SpaNode *node,
|
|||
SpaResult res;
|
||||
SpaFormat *fmt;
|
||||
uint8_t buffer[1024];
|
||||
SpaPODBuilder b = { buffer, sizeof (buffer), };
|
||||
SpaPODBuilder b = { NULL, };
|
||||
|
||||
if (node == NULL || format == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
|
@ -441,7 +440,10 @@ spa_videotestsrc_node_port_enum_formats (SpaNode *node,
|
|||
if (!CHECK_PORT (this, direction, port_id))
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
|
||||
switch (index) {
|
||||
next:
|
||||
spa_pod_builder_init (&b, buffer, sizeof (buffer));
|
||||
|
||||
switch (index++) {
|
||||
case 0:
|
||||
fmt = SPA_MEMBER (buffer, spa_pod_builder_format (&b,
|
||||
SPA_MEDIA_TYPE_VIDEO, SPA_MEDIA_SUBTYPE_RAW,
|
||||
|
|
@ -468,12 +470,10 @@ spa_videotestsrc_node_port_enum_formats (SpaNode *node,
|
|||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
|
||||
b.data = this->format_buffer;
|
||||
b.size = sizeof (this->format_buffer);
|
||||
b.offset = 0;
|
||||
spa_pod_builder_init (&b, this->format_buffer, sizeof (this->format_buffer));
|
||||
|
||||
if ((res = spa_format_filter (fmt, filter, &b)) != SPA_RESULT_OK)
|
||||
return res;
|
||||
goto next;
|
||||
|
||||
*format = SPA_POD_BUILDER_DEREF (&b, 0, SpaFormat);
|
||||
|
||||
|
|
@ -487,6 +487,8 @@ clear_buffers (SpaVideoTestSrc *this)
|
|||
spa_log_info (this->log, "videotestsrc %p: clear buffers", this);
|
||||
this->n_buffers = 0;
|
||||
spa_list_init (&this->empty);
|
||||
this->started = false;
|
||||
set_timer (this, false);
|
||||
}
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
|
@ -579,8 +581,7 @@ spa_videotestsrc_node_port_get_format (SpaNode *node,
|
|||
if (!this->have_format)
|
||||
return SPA_RESULT_NO_FORMAT;
|
||||
|
||||
b.data = this->format_buffer;
|
||||
b.size = sizeof (this->format_buffer);
|
||||
spa_pod_builder_init (&b, this->format_buffer, sizeof (this->format_buffer));
|
||||
|
||||
*format = SPA_MEMBER (b.data, spa_pod_builder_format (&b,
|
||||
SPA_MEDIA_TYPE_VIDEO, SPA_MEDIA_SUBTYPE_RAW,
|
||||
|
|
@ -597,7 +598,6 @@ spa_videotestsrc_node_port_get_format (SpaNode *node,
|
|||
SPA_POD_PROP_FLAG_READWRITE,
|
||||
0), SpaFormat);
|
||||
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -125,8 +125,7 @@ spa_volume_node_get_props (SpaNode *node,
|
|||
|
||||
this = SPA_CONTAINER_OF (node, SpaVolume, node);
|
||||
|
||||
b.data = this->props_buffer;
|
||||
b.size = sizeof (this->props_buffer);
|
||||
spa_pod_builder_init (&b, this->props_buffer, sizeof (this->props_buffer));
|
||||
|
||||
*props = SPA_MEMBER (b.data, spa_pod_builder_props (&b,
|
||||
PROP_ID_VOLUME, SPA_POD_TYPE_DOUBLE,
|
||||
|
|
@ -293,7 +292,7 @@ spa_volume_node_port_enum_formats (SpaNode *node,
|
|||
SpaResult res;
|
||||
SpaFormat *fmt;
|
||||
uint8_t buffer[1024];
|
||||
SpaPODBuilder b = { buffer, sizeof (buffer), };
|
||||
SpaPODBuilder b = { NULL, };
|
||||
|
||||
if (node == NULL || format == NULL)
|
||||
return SPA_RESULT_INVALID_ARGUMENTS;
|
||||
|
|
@ -303,7 +302,10 @@ spa_volume_node_port_enum_formats (SpaNode *node,
|
|||
if (!CHECK_PORT (this, direction, port_id))
|
||||
return SPA_RESULT_INVALID_PORT;
|
||||
|
||||
switch (index) {
|
||||
next:
|
||||
spa_pod_builder_init (&b, buffer, sizeof (buffer));
|
||||
|
||||
switch (index++) {
|
||||
case 0:
|
||||
fmt = SPA_MEMBER (buffer, spa_pod_builder_format (&b,
|
||||
SPA_MEDIA_TYPE_AUDIO, SPA_MEDIA_SUBTYPE_RAW,
|
||||
|
|
@ -329,12 +331,10 @@ spa_volume_node_port_enum_formats (SpaNode *node,
|
|||
return SPA_RESULT_ENUM_END;
|
||||
}
|
||||
|
||||
b.data = this->format_buffer;
|
||||
b.size = sizeof (this->format_buffer);
|
||||
b.offset = 0;
|
||||
spa_pod_builder_init (&b, this->format_buffer, sizeof (this->format_buffer));
|
||||
|
||||
if ((res = spa_format_filter (fmt, filter, &b)) != SPA_RESULT_OK)
|
||||
return res;
|
||||
goto next;
|
||||
|
||||
*format = SPA_POD_BUILDER_DEREF (&b, 0, SpaFormat);
|
||||
|
||||
|
|
|
|||
|
|
@ -126,8 +126,7 @@ spa_xv_sink_node_get_props (SpaNode *node,
|
|||
|
||||
this = SPA_CONTAINER_OF (node, SpaXvSink, node);
|
||||
|
||||
b.data = this->props_buffer;
|
||||
b.size = sizeof (this->props_buffer);
|
||||
spa_pod_builder_init (&b, this->props_buffer, sizeof (this->props_buffer));
|
||||
|
||||
*props = SPA_MEMBER (b.data, spa_pod_builder_props (&b,
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue