rework props with pod

This commit is contained in:
Wim Taymans 2017-02-27 21:25:33 +01:00
parent f02f93cda9
commit dbae2e3f96
25 changed files with 232 additions and 472 deletions

View file

@ -52,6 +52,7 @@ update_state (SpaALSASink *this, SpaNodeState state)
this->node.state = state;
}
#if 0
static const uint32_t min_uint32 = 1;
static const uint32_t max_uint32 = UINT32_MAX;
@ -109,6 +110,7 @@ static const SpaPropInfo prop_info[] =
SPA_PROP_RANGE_TYPE_NONE, 0, NULL,
NULL },
};
#endif
static SpaResult
spa_alsa_sink_node_get_props (SpaNode *node,
@ -146,7 +148,7 @@ spa_alsa_sink_node_set_props (SpaNode *node,
return SPA_RESULT_OK;
}
res = spa_props_copy_values (props, &p->props);
//res = spa_props_copy_values (props, &p->props);
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->node = alsasink_node;
#if 0
this->props[1].props.n_prop_info = PROP_ID_LAST;
this->props[1].props.prop_info = prop_info;
#endif
this->stream = SND_PCM_STREAM_PLAYBACK;
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++) {
if (!strcmp (info->items[i].key, "alsa.card")) {
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;
}
}

View file

@ -50,9 +50,9 @@ reset_alsa_props (SpaALSAProps *props)
props->period_size = default_period_size;
props->periods = default_periods;
props->period_event = default_period_event;
props->props.unset_mask = 0xf;
}
#if 0
static const uint32_t min_uint32 = 1;
static const uint32_t max_uint32 = UINT32_MAX;
@ -110,6 +110,7 @@ static const SpaPropInfo prop_info[] =
SPA_PROP_RANGE_TYPE_NONE, 0, NULL,
NULL },
};
#endif
static SpaResult
spa_alsa_source_node_get_props (SpaNode *node,
@ -147,7 +148,7 @@ spa_alsa_source_node_set_props (SpaNode *node,
return SPA_RESULT_OK;
}
res = spa_props_copy_values (props, &p->props);
//res = spa_props_copy_values (props, &p->props);
return res;
}
@ -896,8 +897,10 @@ alsa_source_init (const SpaHandleFactory *factory,
this->node = alsasource_node;
this->clock = alsasource_clock;
#if 0
this->props[1].props.n_prop_info = PROP_ID_LAST;
this->props[1].props.prop_info = prop_info;
#endif
this->stream = SND_PCM_STREAM_CAPTURE;
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++) {
if (!strcmp (info->items[i].key, "alsa.card")) {
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;
}
}

View file

@ -97,11 +97,6 @@ enum {
PROP_ID_LAST,
};
static const SpaPropInfo prop_info[] =
{
{ PROP_ID_LAST, },
};
static void
reset_audiomixer_props (SpaAudioMixerProps *props)
{
@ -119,7 +114,6 @@ spa_audiomixer_node_get_props (SpaNode *node,
this = SPA_CONTAINER_OF (node, SpaAudioMixer, node);
memcpy (&this->props[0], &this->props[1], sizeof (this->props[1]));
*props = &this->props[0].props;
return SPA_RESULT_OK;
}
@ -142,7 +136,6 @@ spa_audiomixer_node_set_props (SpaNode *node,
reset_audiomixer_props (p);
return SPA_RESULT_OK;
}
res = spa_props_copy_values (props, &p->props);
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->node = audiomixer_node;
#if 0
this->props[1].props.n_prop_info = PROP_ID_LAST;
this->props[1].props.prop_info = prop_info;
#endif
reset_audiomixer_props (&this->props[1]);
this->out_ports[0].valid = true;

View file

@ -111,19 +111,20 @@ struct _SpaAudioTestSrc {
#define DEFAULT_FREQ 440.0
#define DEFAULT_LIVE true
#if 0
static const double min_volume = 0.0;
static const double max_volume = 10.0;
static const double min_freq = 0.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[] = {
{ "min", { sizeof (double), &min_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[] = {
{ "sine", { sizeof (uint32_t), &wave_val_sine } },
{ "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,
NULL },
};
#endif
static SpaResult
reset_audiotestsrc_props (SpaAudioTestSrcProps *props)
@ -193,7 +195,6 @@ spa_audiotestsrc_node_get_props (SpaNode *node,
this = SPA_CONTAINER_OF (node, SpaAudioTestSrc, node);
memcpy (&this->props[0], &this->props[1], sizeof (this->props[1]));
*props = &this->props[0].props;
return SPA_RESULT_OK;
}
@ -215,7 +216,7 @@ spa_audiotestsrc_node_set_props (SpaNode *node,
if (props == NULL) {
res = reset_audiotestsrc_props (p);
} else {
res = spa_props_copy_values (props, &p->props);
// res = spa_props_copy_values (props, &p->props);
}
if (this->props[1].live)
@ -988,8 +989,10 @@ audiotestsrc_init (const SpaHandleFactory *factory,
this->node = audiotestsrc_node;
this->clock = audiotestsrc_clock;
#if 0
this->props[1].props.n_prop_info = PROP_ID_LAST;
this->props[1].props.prop_info = prop_info;
#endif
reset_audiotestsrc_props (&this->props[1]);
spa_list_init (&this->empty);

View file

@ -87,11 +87,6 @@ enum {
PROP_ID_LAST,
};
static const SpaPropInfo prop_info[] =
{
{ 0, },
};
static SpaResult
spa_ffmpeg_dec_node_get_props (SpaNode *node,
SpaProps **props)
@ -128,7 +123,7 @@ spa_ffmpeg_dec_node_set_props (SpaNode *node,
return SPA_RESULT_OK;
}
res = spa_props_copy_values (props, &p->props);
//res = spa_props_copy_values (props, &p->props);
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->node = ffmpeg_dec_node;
#if 0
this->props[1].props.n_prop_info = PROP_ID_LAST;
this->props[1].props.prop_info = prop_info;
#endif
reset_ffmpeg_dec_props (&this->props[1]);
this->in_ports[0].info.flags = SPA_PORT_INFO_FLAG_NONE;

View file

@ -91,11 +91,6 @@ enum {
PROP_ID_LAST,
};
static const SpaPropInfo prop_info[] =
{
{ 0, },
};
static void
update_state (SpaFFMpegEnc *this, SpaNodeState state)
{
@ -138,7 +133,7 @@ spa_ffmpeg_enc_node_set_props (SpaNode *node,
return SPA_RESULT_OK;
}
res = spa_props_copy_values (props, &p->props);
//res = spa_props_copy_values (props, &p->props);
return res;
}
@ -308,8 +303,8 @@ spa_ffmpeg_enc_node_port_set_format (SpaNode *node,
return SPA_RESULT_OK;
}
if (format->body.media_type != SPA_MEDIA_TYPE_VIDEO ||
format->body.media_subtype != SPA_MEDIA_SUBTYPE_RAW)
if (format->body.media_type.value != SPA_MEDIA_TYPE_VIDEO ||
format->body.media_subtype.value != SPA_MEDIA_SUBTYPE_RAW)
return SPA_RESULT_INVALID_MEDIA_TYPE;
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->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]);
this->in_ports[0].info.flags = SPA_PORT_INFO_FLAG_NONE;

View file

@ -39,7 +39,6 @@ typedef struct _SpaV4l2Source SpaV4l2Source;
static const char default_device[] = "/dev/video0";
typedef struct {
SpaProps props;
char device[64];
char device_name[128];
int device_fd;
@ -49,7 +48,6 @@ static void
reset_v4l2_source_props (SpaV4l2SourceProps *props)
{
strncpy (props->device, default_device, 64);
props->props.unset_mask = 7;
}
#define MAX_BUFFERS 64
@ -121,7 +119,8 @@ struct _SpaV4l2Source {
uint32_t seq;
SpaV4l2SourceProps props[2];
uint8_t props_buffer[512];
SpaV4l2SourceProps props;
SpaNodeEventCallback event_cb;
void *user_data;
@ -140,32 +139,10 @@ update_state (SpaV4l2Source *this, SpaNodeState state)
#include "v4l2-utils.c"
enum {
PROP_ID_NONE,
PROP_ID_DEVICE,
PROP_ID_DEVICE_NAME,
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
@ -173,14 +150,33 @@ spa_v4l2_source_node_get_props (SpaNode *node,
SpaProps **props)
{
SpaV4l2Source *this;
SpaPODBuilder b = { NULL, };
if (node == NULL || props == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;
this = SPA_CONTAINER_OF (node, SpaV4l2Source, node);
memcpy (&this->props[0], &this->props[1], sizeof (this->props[1]));
*props = &this->props[0].props;
b.data = this->props_buffer;
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;
}
@ -190,23 +186,27 @@ spa_v4l2_source_node_set_props (SpaNode *node,
const SpaProps *props)
{
SpaV4l2Source *this;
SpaV4l2SourceProps *p;
SpaResult res;
if (node == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;
this = SPA_CONTAINER_OF (node, SpaV4l2Source, node);
p = &this->props[1];
if (props == NULL) {
reset_v4l2_source_props (p);
reset_v4l2_source_props (&this->props);
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;
}
}
}
res = spa_props_copy_values (props, &p->props);
return res;
return SPA_RESULT_OK;
}
static SpaResult
@ -961,9 +961,8 @@ v4l2_source_init (const SpaHandleFactory *factory,
this->node = v4l2source_node;
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[1]);
reset_v4l2_source_props (&this->props);
this->state[0].log = this->log;
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;
if (info && (str = spa_dict_lookup (info, "device.path"))) {
strncpy (this->props[1].device, str, 63);
this->props[1].props.unset_mask &= ~1;
strncpy (this->props.device, str, 63);
}
this->props[1].props.unset_mask &= ~1;
update_state (this, SPA_NODE_STATE_CONFIGURE);

View file

@ -28,12 +28,12 @@ spa_v4l2_open (SpaV4l2Source *this)
{
SpaV4l2State *state = &this->state[0];
struct stat st;
SpaV4l2SourceProps *props = &this->props[1];
SpaV4l2SourceProps *props = &this->props;
if (state->opened)
return 0;
if (props->props.unset_mask & 1) {
if (props->device[0] == '\0') {
spa_log_error (state->log, "v4l2: Device property not set");
return -1;
}
@ -326,9 +326,9 @@ enum_filter_format (const SpaFormat *filter, unsigned int index)
{
SpaVideoFormat video_format = SPA_VIDEO_FORMAT_UNKNOWN;
if ((filter->body.media_type == SPA_MEDIA_TYPE_VIDEO ||
filter->body.media_type == SPA_MEDIA_TYPE_IMAGE)) {
if (filter->body.media_subtype == SPA_MEDIA_SUBTYPE_RAW) {
if ((filter->body.media_type.value == SPA_MEDIA_TYPE_VIDEO ||
filter->body.media_type.value == SPA_MEDIA_TYPE_IMAGE)) {
if (filter->body.media_subtype.value == SPA_MEDIA_SUBTYPE_RAW) {
SpaPODProp *p;
unsigned int n_values;
const uint32_t *values;
@ -488,8 +488,8 @@ next_fmtdesc:
if (video_format == SPA_VIDEO_FORMAT_UNKNOWN)
return SPA_RESULT_ENUM_END;
info = find_format_info_by_media_type (filter->body.media_type,
filter->body.media_subtype,
info = find_format_info_by_media_type (filter->body.media_type.value,
filter->body.media_subtype.value,
video_format,
0);
if (info == NULL)
@ -562,12 +562,12 @@ do_frmsize:
&values[2],
&step))
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],
&values[2],
&values[3]))
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++) {
if (filter_framesize (&state->frmsize, &values[i],
&values[i],
@ -668,17 +668,17 @@ have_size:
&values[0],
&step))
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],
&values[2],
&step))
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],
&values[2],
&values[3]))
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++) {
if (filter_framerate (&state->frmival, &values[i],
&values[i],
@ -693,7 +693,7 @@ have_size:
have_framerate:
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,
state->frmival.discrete.denominator,
state->frmival.discrete.numerator);
@ -708,9 +708,9 @@ have_framerate:
state->frmival.stepwise.max.numerator);
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 {
prop->body.flags |= SPA_PROP_RANGE_TYPE_STEP;
prop->body.flags |= SPA_POD_PROP_RANGE_STEP;
spa_pod_builder_fraction (&b,
state->frmival.stepwise.step.denominator,
state->frmival.stepwise.step.numerator);

View file

@ -283,7 +283,7 @@ draw (SpaVideoTestSrc *this, char *data)
if (res != SPA_RESULT_OK)
return res;
pattern = this->props[1].pattern;
pattern = this->props.pattern;
if (pattern == pattern_val_smpte_snow)
draw_smpte_snow (&dd);
else if (pattern == pattern_val_snow)

View file

@ -44,7 +44,6 @@ typedef struct {
typedef struct _SpaVideoTestSrc SpaVideoTestSrc;
typedef struct {
SpaProps props;
bool live;
uint32_t pattern;
} SpaVideoTestSrcProps;
@ -72,7 +71,8 @@ struct _SpaVideoTestSrc {
SpaLog *log;
SpaLoop *data_loop;
SpaVideoTestSrcProps props[2];
SpaVideoTestSrcProps props;
uint8_t props_buffer[256];
SpaNodeEventCallback event_cb;
void *user_data;
@ -110,17 +110,18 @@ struct _SpaVideoTestSrc {
static const uint32_t pattern_val_smpte_snow = 0;
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[] = {
{ "smpte-snow", { sizeof (uint32_t), &pattern_val_smpte_snow } },
{ "snow", { sizeof (uint32_t), &pattern_val_snow } },
};
enum {
PROP_ID_LIVE,
PROP_ID_PATTERN,
PROP_ID_LAST,
};
static const SpaPropInfo prop_info[] =
{
{ 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,
NULL },
};
#endif
static SpaResult
reset_videotestsrc_props (SpaVideoTestSrcProps *props)
@ -151,14 +153,28 @@ spa_videotestsrc_node_get_props (SpaNode *node,
SpaProps **props)
{
SpaVideoTestSrc *this;
SpaPODBuilder b = { NULL, };
if (node == NULL || props == NULL)
return SPA_RESULT_INVALID_ARGUMENTS;
this = SPA_CONTAINER_OF (node, SpaVideoTestSrc, node);
memcpy (&this->props[0], &this->props[1], sizeof (this->props[1]));
*props = &this->props[0].props;
b.data = this->props_buffer;
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;
}
@ -175,15 +191,26 @@ spa_videotestsrc_node_set_props (SpaNode *node,
return SPA_RESULT_INVALID_ARGUMENTS;
this = SPA_CONTAINER_OF (node, SpaVideoTestSrc, node);
p = &this->props[1];
p = &this->props;
if (props == NULL) {
res = reset_videotestsrc_props (p);
} 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;
else
this->info.flags &= ~SPA_PORT_INFO_FLAG_LIVE;
@ -217,7 +244,7 @@ static void
set_timer (SpaVideoTestSrc *this, bool enabled)
{
if (enabled) {
if (this->props[1].live) {
if (this->props.live) {
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_nsec = next_time % SPA_NSEC_PER_SEC;
@ -305,7 +332,7 @@ spa_videotestsrc_node_send_command (SpaNode *node,
return SPA_RESULT_OK;
clock_gettime (CLOCK_MONOTONIC, &now);
if (this->props[1].live)
if (this->props.live)
this->start_time = SPA_TIMESPEC_TO_TIME (&now);
else
this->start_time = 0;
@ -782,7 +809,7 @@ spa_videotestsrc_node_port_reuse_buffer (SpaNode *node,
b->outstanding = false;
spa_list_insert (this->empty.prev, &b->link);
if (!this->props[1].live)
if (!this->props.live)
set_timer (this, true);
return SPA_RESULT_OK;
@ -962,9 +989,11 @@ videotestsrc_init (const SpaHandleFactory *factory,
this->node = videotestsrc_node;
this->clock = videotestsrc_clock;
#if 0
this->props[1].props.n_prop_info = PROP_ID_LAST;
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);
@ -980,7 +1009,7 @@ videotestsrc_init (const SpaHandleFactory *factory,
this->info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS |
SPA_PORT_INFO_FLAG_NO_REF;
if (this->props[1].live)
if (this->props.live)
this->info.flags |= SPA_PORT_INFO_FLAG_LIVE;
this->node.state = SPA_NODE_STATE_CONFIGURE;

View file

@ -91,9 +91,11 @@ struct _SpaVolume {
#define CHECK_PORT(this,d,p) ((p) == 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 max_volume = 10.0;
static const bool default_mute = false;
static const SpaPropRangeInfo volume_range[] = {
{ "min", { sizeof (double), &min_volume } },
@ -122,6 +124,8 @@ static const SpaPropInfo prop_info[] =
NULL },
};
#endif
static void
reset_volume_props (SpaVolumeProps *props)
{
@ -170,7 +174,7 @@ spa_volume_node_set_props (SpaNode *node,
reset_volume_props (p);
return SPA_RESULT_OK;
}
res = spa_props_copy_values (props, &p->props);
//res = spa_props_copy_values (props, &p->props);
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->node = volume_node;
#if 0
this->props[1].props.n_prop_info = PROP_ID_LAST;
this->props[1].props.prop_info = prop_info;
#endif
reset_volume_props (&this->props[1]);
this->in_ports[0].info.flags = SPA_PORT_INFO_FLAG_CAN_USE_BUFFERS |

View file

@ -107,6 +107,7 @@ enum {
PROP_ID_LAST,
};
#if 0
static const SpaPropInfo prop_info[] =
{
{ PROP_ID_DEVICE, offsetof (SpaXvSinkProps, device),
@ -128,6 +129,7 @@ static const SpaPropInfo prop_info[] =
SPA_PROP_RANGE_TYPE_NONE, 0, NULL,
NULL },
};
#endif
static void
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);
memcpy (&this->props[0], &this->props[1], sizeof (this->props[1]));
*props = &this->props[0].props;
return SPA_RESULT_OK;
}
@ -170,9 +171,6 @@ spa_xv_sink_node_set_props (SpaNode *node,
reset_xv_sink_props (p);
return SPA_RESULT_OK;
}
res = spa_props_copy_values (props, &p->props);
return res;
}
@ -337,8 +335,8 @@ spa_xv_sink_node_port_set_format (SpaNode *node,
return SPA_RESULT_OK;
}
if (format->body.media_type == SPA_MEDIA_TYPE_VIDEO) {
if (format->body.media_subtype == SPA_MEDIA_SUBTYPE_RAW) {
if (format->body.media_type.value == SPA_MEDIA_TYPE_VIDEO) {
if (format->body.media_subtype.value == SPA_MEDIA_SUBTYPE_RAW) {
if ((res = spa_format_video_parse (format, &info) < 0))
return res;
} 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->node = xvsink_node;
#if 0
this->props[1].props.n_prop_info = PROP_ID_LAST;
this->props[1].props.prop_info = prop_info;
#endif
reset_xv_sink_props (&this->props[1]);
this->info.flags = SPA_PORT_INFO_FLAG_NONE;