fix modules

This commit is contained in:
Wim Taymans 2016-07-22 09:03:55 +02:00
parent 96df59274c
commit fcc9639479
2 changed files with 18 additions and 25 deletions

View file

@ -54,9 +54,8 @@ static SpaResult
make_node (SpaHandle **handle, const SpaNode **node, const char *lib, const char *name) make_node (SpaHandle **handle, const SpaNode **node, const char *lib, const char *name)
{ {
SpaResult res; SpaResult res;
void *hnd, *state; void *hnd, *state = NULL;
SpaEnumHandleFactoryFunc enum_func; SpaEnumHandleFactoryFunc enum_func;
unsigned int i;
if ((hnd = dlopen (lib, RTLD_NOW)) == NULL) { if ((hnd = dlopen (lib, RTLD_NOW)) == NULL) {
g_error ("can't load %s: %s", lib, dlerror()); g_error ("can't load %s: %s", lib, dlerror());
@ -67,11 +66,11 @@ make_node (SpaHandle **handle, const SpaNode **node, const char *lib, const char
return SPA_RESULT_ERROR; return SPA_RESULT_ERROR;
} }
for (i = 0; ;i++) { while (true) {
const SpaHandleFactory *factory; const SpaHandleFactory *factory;
const void *iface; const void *iface;
if ((res = enum_func (i, &factory)) < 0) { if ((res = enum_func (&factory, &state)) < 0) {
if (res != SPA_RESULT_ENUM_END) if (res != SPA_RESULT_ENUM_END)
g_error ("can't enumerate factories: %d", res); g_error ("can't enumerate factories: %d", res);
break; break;
@ -222,7 +221,6 @@ set_state (PinosNode *node,
PinosNodeState state) PinosNodeState state)
{ {
PinosSpaAlsaSink *this = PINOS_SPA_ALSA_SINK (node); PinosSpaAlsaSink *this = PINOS_SPA_ALSA_SINK (node);
PinosSpaAlsaSinkPrivate *priv = this->priv;
g_debug ("spa-alsa-sink %p: set state %s", node, pinos_node_state_as_string (state)); g_debug ("spa-alsa-sink %p: set state %s", node, pinos_node_state_as_string (state));
@ -254,9 +252,6 @@ get_property (GObject *object,
GValue *value, GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
PinosSpaAlsaSink *sink = PINOS_SPA_ALSA_SINK (object);
PinosSpaAlsaSinkPrivate *priv = sink->priv;
switch (prop_id) { switch (prop_id) {
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -270,9 +265,6 @@ set_property (GObject *object,
const GValue *value, const GValue *value,
GParamSpec *pspec) GParamSpec *pspec)
{ {
PinosSpaAlsaSink *sink = PINOS_SPA_ALSA_SINK (object);
PinosSpaAlsaSinkPrivate *priv = sink->priv;
switch (prop_id) { switch (prop_id) {
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@ -314,8 +306,9 @@ negotiate_formats (PinosSpaAlsaSink *this)
SpaProps *props; SpaProps *props;
uint32_t val; uint32_t val;
SpaPropValue value; SpaPropValue value;
void *state = NULL;
if ((res = priv->sink_node->port_enum_formats (priv->sink, 0, 0, &format)) < 0) if ((res = priv->sink_node->port_enum_formats (priv->sink, 0, &format, NULL, &state)) < 0)
return res; return res;
props = &format->props; props = &format->props;
@ -448,8 +441,6 @@ static void
sink_constructed (GObject * object) sink_constructed (GObject * object)
{ {
PinosServerNode *node = PINOS_SERVER_NODE (object); PinosServerNode *node = PINOS_SERVER_NODE (object);
PinosSpaAlsaSink *sink = PINOS_SPA_ALSA_SINK (object);
PinosSpaAlsaSinkPrivate *priv = sink->priv;
G_OBJECT_CLASS (pinos_spa_alsa_sink_parent_class)->constructed (object); G_OBJECT_CLASS (pinos_spa_alsa_sink_parent_class)->constructed (object);

View file

@ -73,9 +73,8 @@ static SpaResult
make_node (SpaHandle **handle, const SpaNode **node, const char *lib, const char *name) make_node (SpaHandle **handle, const SpaNode **node, const char *lib, const char *name)
{ {
SpaResult res; SpaResult res;
void *hnd; void *hnd, *state = NULL;
SpaEnumHandleFactoryFunc enum_func; SpaEnumHandleFactoryFunc enum_func;
unsigned int i;
if ((hnd = dlopen (lib, RTLD_NOW)) == NULL) { if ((hnd = dlopen (lib, RTLD_NOW)) == NULL) {
g_error ("can't load %s: %s", lib, dlerror()); g_error ("can't load %s: %s", lib, dlerror());
@ -86,11 +85,11 @@ make_node (SpaHandle **handle, const SpaNode **node, const char *lib, const char
return SPA_RESULT_ERROR; return SPA_RESULT_ERROR;
} }
for (i = 0; ;i++) { while (true) {
const SpaHandleFactory *factory; const SpaHandleFactory *factory;
const void *iface; const void *iface;
if ((res = enum_func (i, &factory)) < 0) { if ((res = enum_func (&factory, &state)) < 0) {
if (res != SPA_RESULT_ENUM_END) if (res != SPA_RESULT_ENUM_END)
g_error ("can't enumerate factories: %d", res); g_error ("can't enumerate factories: %d", res);
break; break;
@ -279,9 +278,11 @@ negotiate_formats (PinosSpaV4l2Source *this)
SpaProps *props; SpaProps *props;
uint32_t val; uint32_t val;
SpaPropValue value; SpaPropValue value;
void *state = NULL;
SpaFraction frac; SpaFraction frac;
SpaRectangle rect;
if ((res = priv->source_node->port_enum_formats (priv->source, 0, 0, &format)) < 0) if ((res = priv->source_node->port_enum_formats (priv->source, 0, &format, NULL, &state)) < 0)
return res; return res;
props = &format->props; props = &format->props;
@ -293,17 +294,18 @@ negotiate_formats (PinosSpaV4l2Source *this)
val = SPA_VIDEO_FORMAT_YUY2; val = SPA_VIDEO_FORMAT_YUY2;
if ((res = props->set_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_VIDEO_FORMAT), &value)) < 0) if ((res = props->set_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_VIDEO_FORMAT), &value)) < 0)
return res; return res;
val = 320;
if ((res = props->set_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_VIDEO_WIDTH), &value)) < 0) value.type = SPA_PROP_TYPE_RECTANGLE;
return res; value.size = sizeof (SpaRectangle);
val = 240; value.value = &rect;
if ((res = props->set_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_VIDEO_HEIGHT), &value)) < 0) rect.width = 320;
rect.height = 240;
if ((res = props->set_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_VIDEO_SIZE), &value)) < 0)
return res; return res;
value.type = SPA_PROP_TYPE_FRACTION; value.type = SPA_PROP_TYPE_FRACTION;
value.size = sizeof (SpaFraction); value.size = sizeof (SpaFraction);
value.value = &frac; value.value = &frac;
frac.num = 25; frac.num = 25;
frac.denom = 1; frac.denom = 1;
if ((res = props->set_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_VIDEO_FRAMERATE), &value)) < 0) if ((res = props->set_prop (props, spa_props_index_for_id (props, SPA_PROP_ID_VIDEO_FRAMERATE), &value)) < 0)