summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2017-11-10 16:11:53 +0100
committerWim Taymans <wtaymans@redhat.com>2017-11-10 16:11:53 +0100
commitdda28b158966ab3daf029b6006074a604551e4bf (patch)
treef89f2c1c215035148853e32a88ce51c048c8e17f
parentcaaeaff223b6ad61bab3c495d0cfa61e9611e827 (diff)
cleaup up the result codes
-rw-r--r--spa/include/spa/pod/parser.h6
-rw-r--r--spa/include/spa/utils/defs.h79
-rw-r--r--spa/lib/pod.c32
-rw-r--r--spa/plugins/alsa/alsa-sink.c2
-rw-r--r--spa/plugins/alsa/alsa-source.c2
-rw-r--r--spa/plugins/audiotestsrc/audiotestsrc.c2
-rw-r--r--spa/plugins/test/fakesink.c2
-rw-r--r--spa/plugins/test/fakesrc.c2
-rw-r--r--spa/plugins/v4l2/v4l2-source.c2
-rw-r--r--spa/plugins/videotestsrc/videotestsrc.c2
10 files changed, 63 insertions, 68 deletions
diff --git a/spa/include/spa/pod/parser.h b/spa/include/spa/pod/parser.h
index 5641048d..0a4ea662 100644
--- a/spa/include/spa/pod/parser.h
+++ b/spa/include/spa/pod/parser.h
@@ -206,7 +206,7 @@ static inline int spa_pod_parser_getv(struct spa_pod_parser *parser,
switch (*format) {
case '<':
if (pod == NULL || SPA_POD_TYPE(pod) != SPA_POD_TYPE_OBJECT)
- return SPA_RESULT_ERROR;
+ return SPA_RESULT_INCOMPATIBLE;
if (++parser->depth >= SPA_POD_MAX_DEPTH)
return SPA_RESULT_INVALID_ARGUMENTS;
@@ -215,7 +215,7 @@ static inline int spa_pod_parser_getv(struct spa_pod_parser *parser,
goto read_pod;
case '[':
if (pod == NULL || SPA_POD_TYPE(pod) != SPA_POD_TYPE_STRUCT)
- return SPA_RESULT_ERROR;
+ return SPA_RESULT_INCOMPATIBLE;
if (++parser->depth >= SPA_POD_MAX_DEPTH)
return SPA_RESULT_INVALID_ARGUMENTS;
@@ -224,7 +224,7 @@ static inline int spa_pod_parser_getv(struct spa_pod_parser *parser,
goto read_pod;
case ']': case '>':
if (current != NULL)
- return SPA_RESULT_ERROR;
+ return SPA_RESULT_INCOMPATIBLE;
if (--parser->depth < 0)
return SPA_RESULT_INVALID_ARGUMENTS;
diff --git a/spa/include/spa/utils/defs.h b/spa/include/spa/utils/defs.h
index 15fba949..5ef0bd6d 100644
--- a/spa/include/spa/utils/defs.h
+++ b/spa/include/spa/utils/defs.h
@@ -17,8 +17,8 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef __SPA_DEFS_H__
-#define __SPA_DEFS_H__
+#ifndef __SPA_UTILS_DEFS_H__
+#define __SPA_UTILS_DEFS_H__
#ifdef __cplusplus
extern "C" {
@@ -36,45 +36,40 @@ enum spa_result {
SPA_RESULT_OK = 0,
SPA_RESULT_ERROR = -1,
SPA_RESULT_ERRNO = -2,
- SPA_RESULT_INACTIVE = -3,
- SPA_RESULT_NO_FORMAT = -4,
- SPA_RESULT_INVALID_COMMAND = -5,
- SPA_RESULT_INVALID_PORT = -6,
- SPA_RESULT_HAVE_BUFFER = -7,
- SPA_RESULT_NEED_BUFFER = -8,
- SPA_RESULT_PORTS_CHANGED = -9,
- SPA_RESULT_FORMAT_CHANGED = -10,
- SPA_RESULT_PROPERTIES_CHANGED = -11,
- SPA_RESULT_NOT_IMPLEMENTED = -12,
- SPA_RESULT_INVALID_PROPERTY_INDEX = -13,
- SPA_RESULT_PROPERTY_UNSET = -14,
- SPA_RESULT_ENUM_END = -15,
- SPA_RESULT_WRONG_PROPERTY_TYPE = -16,
- SPA_RESULT_WRONG_PROPERTY_SIZE = -17,
- SPA_RESULT_INVALID_MEDIA_TYPE = -18,
- SPA_RESULT_INVALID_FORMAT_PROPERTIES = -19,
- SPA_RESULT_FORMAT_INCOMPLETE = -20,
- SPA_RESULT_INVALID_ARGUMENTS = -21,
- SPA_RESULT_UNKNOWN_INTERFACE = -22,
- SPA_RESULT_INVALID_DIRECTION = -23,
- SPA_RESULT_TOO_MANY_PORTS = -24,
- SPA_RESULT_INVALID_PROPERTY_ACCESS = -25,
- SPA_RESULT_UNEXPECTED = -26,
- SPA_RESULT_NO_BUFFERS = -27,
- SPA_RESULT_INVALID_BUFFER_ID = -28,
- SPA_RESULT_WRONG_STATE = -29,
- SPA_RESULT_ASYNC_BUSY = -30,
- SPA_RESULT_INVALID_OBJECT_ID = -31,
- SPA_RESULT_NO_MEMORY = -32,
- SPA_RESULT_NO_PERMISSION = -33,
- SPA_RESULT_SKIPPED = -34,
- SPA_RESULT_OUT_OF_BUFFERS = -35,
- SPA_RESULT_INCOMPATIBLE_PROPS = -36,
- SPA_RESULT_INCOMPATIBLE_VERSION = -37,
- SPA_RESULT_NOT_FOUND = -38,
- SPA_RESULT_BUSY = -39,
- SPA_RESULT_UNKNOWN_PARAM = -40,
- SPA_RESULT_PARAM_INCOMPLETE = -41,
+ SPA_RESULT_NOT_FOUND = -3,
+ SPA_RESULT_BUSY = -4,
+ SPA_RESULT_NO_MEMORY = -5,
+ SPA_RESULT_NO_PERMISSION = -6,
+ SPA_RESULT_INVALID_ARGUMENTS = -7,
+ SPA_RESULT_NOT_IMPLEMENTED = -8,
+ SPA_RESULT_UNKNOWN_INTERFACE = -9,
+ SPA_RESULT_UNEXPECTED = -10,
+ SPA_RESULT_INCOMPATIBLE = -11,
+ SPA_RESULT_INCOMPATIBLE_VERSION = -12,
+ SPA_RESULT_INCOMPLETE = -13,
+ SPA_RESULT_ENUM_END = -14,
+
+ SPA_RESULT_INACTIVE = -15,
+ SPA_RESULT_INVALID_COMMAND = -16,
+
+ SPA_RESULT_INVALID_PORT = -17,
+ SPA_RESULT_INVALID_DIRECTION = -18,
+ SPA_RESULT_PORTS_CHANGED = -19,
+ SPA_RESULT_TOO_MANY_PORTS = -20,
+
+ SPA_RESULT_PARAM_CHANGED = -21,
+ SPA_RESULT_PARAM_UNSET = -22,
+ SPA_RESULT_UNKNOWN_PARAM = -23,
+
+ SPA_RESULT_NO_FORMAT = -24,
+ SPA_RESULT_FORMAT_CHANGED = -25,
+ SPA_RESULT_INVALID_MEDIA_TYPE = -26,
+
+ SPA_RESULT_INVALID_BUFFER_ID = -27,
+ SPA_RESULT_NO_BUFFERS = -28,
+ SPA_RESULT_OUT_OF_BUFFERS = -29,
+ SPA_RESULT_HAVE_BUFFER = -30,
+ SPA_RESULT_NEED_BUFFER = -31,
};
#define SPA_ASYNC_BIT (1 << 30)
@@ -193,4 +188,4 @@ struct spa_fraction {
} /* extern "C" */
#endif
-#endif /* __SPA_DEFS_H__ */
+#endif /* __SPA_UTILS_DEFS_H__ */
diff --git a/spa/lib/pod.c b/spa/lib/pod.c
index 85376fba..3bbce5d7 100644
--- a/spa/lib/pod.c
+++ b/spa/lib/pod.c
@@ -144,7 +144,7 @@ filter_prop(struct spa_pod_builder *b,
/* incompatible property types */
if (p1->body.value.type != p2->body.value.type)
- return SPA_RESULT_INCOMPATIBLE_PROPS;
+ return SPA_RESULT_INCOMPATIBLE;
rt1 = p1->body.flags & SPA_POD_PROP_RANGE_MASK;
rt2 = p2->body.flags & SPA_POD_PROP_RANGE_MASK;
@@ -192,7 +192,7 @@ filter_prop(struct spa_pod_builder *b,
}
}
if (n_copied == 0)
- return SPA_RESULT_INCOMPATIBLE_PROPS;
+ return SPA_RESULT_INCOMPATIBLE;
np->body.flags |= SPA_POD_PROP_RANGE_ENUM | SPA_POD_PROP_FLAG_UNSET;
}
@@ -209,7 +209,7 @@ filter_prop(struct spa_pod_builder *b,
n_copied++;
}
if (n_copied == 0)
- return SPA_RESULT_INCOMPATIBLE_PROPS;
+ return SPA_RESULT_INCOMPATIBLE;
np->body.flags |= SPA_POD_PROP_RANGE_ENUM | SPA_POD_PROP_FLAG_UNSET;
}
@@ -231,7 +231,7 @@ filter_prop(struct spa_pod_builder *b,
n_copied++;
}
if (n_copied == 0)
- return SPA_RESULT_INCOMPATIBLE_PROPS;
+ return SPA_RESULT_INCOMPATIBLE;
np->body.flags |= SPA_POD_PROP_RANGE_ENUM | SPA_POD_PROP_FLAG_UNSET;
}
@@ -313,7 +313,7 @@ int pod_filter(struct spa_pod_builder *b,
case SPA_POD_TYPE_STRUCT:
if (pf != NULL) {
if (SPA_POD_TYPE(pf) != SPA_POD_TYPE_STRUCT)
- return SPA_RESULT_INCOMPATIBLE_PROPS;
+ return SPA_RESULT_INCOMPATIBLE;
pc = SPA_POD_CONTENTS(struct spa_pod_struct, pp);
pcs = SPA_POD_CONTENTS_SIZE(struct spa_pod_struct, pp);
@@ -334,7 +334,7 @@ int pod_filter(struct spa_pod_builder *b,
p1 = (struct spa_pod_object *) pp;
if (SPA_POD_TYPE(pf) != SPA_POD_TYPE_OBJECT)
- return SPA_RESULT_INCOMPATIBLE_PROPS;
+ return SPA_RESULT_INCOMPATIBLE;
pc = SPA_POD_CONTENTS(struct spa_pod_object, pp);
pcs = SPA_POD_CONTENTS_SIZE(struct spa_pod_object, pp);
@@ -365,9 +365,9 @@ int pod_filter(struct spa_pod_builder *b,
default:
if (pf != NULL) {
if (SPA_POD_SIZE(pp) != SPA_POD_SIZE(pf))
- return SPA_RESULT_INCOMPATIBLE_PROPS;
+ return SPA_RESULT_INCOMPATIBLE;
if (memcmp(pp, pf, SPA_POD_SIZE(pp)) != 0)
- return SPA_RESULT_INCOMPATIBLE_PROPS;
+ return SPA_RESULT_INCOMPATIBLE;
do_advance = true;
}
do_copy = true;
@@ -424,12 +424,12 @@ int pod_compare(const struct spa_pod *pod1,
uint32_t p1cs, p2cs;
if (p2 == NULL)
- return SPA_RESULT_INCOMPATIBLE_PROPS;
+ return SPA_RESULT_INCOMPATIBLE;
switch (SPA_POD_TYPE(p1)) {
case SPA_POD_TYPE_STRUCT:
if (SPA_POD_TYPE(p2) != SPA_POD_TYPE_STRUCT)
- return SPA_RESULT_INCOMPATIBLE_PROPS;
+ return SPA_RESULT_INCOMPATIBLE;
p1c = SPA_POD_CONTENTS(struct spa_pod_struct, p1);
p1cs = SPA_POD_CONTENTS_SIZE(struct spa_pod_struct, p1);
@@ -440,7 +440,7 @@ int pod_compare(const struct spa_pod *pod1,
break;
case SPA_POD_TYPE_OBJECT:
if (SPA_POD_TYPE(p2) != SPA_POD_TYPE_OBJECT)
- return SPA_RESULT_INCOMPATIBLE_PROPS;
+ return SPA_RESULT_INCOMPATIBLE;
p1c = SPA_POD_CONTENTS(struct spa_pod_object, p1);
p1cs = SPA_POD_CONTENTS_SIZE(struct spa_pod_object, p1);
@@ -457,15 +457,15 @@ int pod_compare(const struct spa_pod *pod1,
pr2 = find_prop(pod2, pod2_size, pr1->body.key);
if (pr2 == NULL)
- return SPA_RESULT_INCOMPATIBLE_PROPS;
+ return SPA_RESULT_INCOMPATIBLE;
/* incompatible property types */
if (pr1->body.value.type != pr2->body.value.type)
- return SPA_RESULT_INCOMPATIBLE_PROPS;
+ return SPA_RESULT_INCOMPATIBLE;
if (pr1->body.flags & SPA_POD_PROP_FLAG_UNSET ||
pr2->body.flags & SPA_POD_PROP_FLAG_UNSET)
- return SPA_RESULT_INCOMPATIBLE_PROPS;
+ return SPA_RESULT_INCOMPATIBLE;
a1 = SPA_MEMBER(pr1, sizeof(struct spa_pod_prop), void);
a2 = SPA_MEMBER(pr2, sizeof(struct spa_pod_prop), void);
@@ -475,7 +475,7 @@ int pod_compare(const struct spa_pod *pod1,
}
default:
if (SPA_POD_TYPE(p1) != SPA_POD_TYPE(p2))
- return SPA_RESULT_INCOMPATIBLE_PROPS;
+ return SPA_RESULT_INCOMPATIBLE;
res = compare_value(SPA_POD_TYPE(p1), SPA_POD_BODY(p1), SPA_POD_BODY(p2));
do_advance = true;
@@ -493,7 +493,7 @@ int pod_compare(const struct spa_pod *pod1,
return res;
}
if (p2 != NULL)
- return SPA_RESULT_INCOMPATIBLE_PROPS;
+ return SPA_RESULT_INCOMPATIBLE;
return SPA_RESULT_OK;
}
diff --git a/spa/plugins/alsa/alsa-sink.c b/spa/plugins/alsa/alsa-sink.c
index da026d54..3f3522b4 100644
--- a/spa/plugins/alsa/alsa-sink.c
+++ b/spa/plugins/alsa/alsa-sink.c
@@ -582,7 +582,7 @@ static int impl_node_process_input(struct spa_node *node)
this = SPA_CONTAINER_OF(node, struct state, node);
input = this->io;
- spa_return_val_if_fail(input != NULL, SPA_RESULT_WRONG_STATE);
+ spa_return_val_if_fail(input != NULL, SPA_RESULT_UNEXPECTED);
if (input->status == SPA_RESULT_HAVE_BUFFER && input->buffer_id < this->n_buffers) {
struct buffer *b = &this->buffers[input->buffer_id];
diff --git a/spa/plugins/alsa/alsa-source.c b/spa/plugins/alsa/alsa-source.c
index 2c85af5d..e7029ee0 100644
--- a/spa/plugins/alsa/alsa-source.c
+++ b/spa/plugins/alsa/alsa-source.c
@@ -625,7 +625,7 @@ static int impl_node_process_output(struct spa_node *node)
this = SPA_CONTAINER_OF(node, struct state, node);
io = this->io;
- spa_return_val_if_fail(io != NULL, SPA_RESULT_WRONG_STATE);
+ spa_return_val_if_fail(io != NULL, SPA_RESULT_UNEXPECTED);
if (io->status == SPA_RESULT_HAVE_BUFFER)
return SPA_RESULT_HAVE_BUFFER;
diff --git a/spa/plugins/audiotestsrc/audiotestsrc.c b/spa/plugins/audiotestsrc/audiotestsrc.c
index 485fb1ab..91c79b35 100644
--- a/spa/plugins/audiotestsrc/audiotestsrc.c
+++ b/spa/plugins/audiotestsrc/audiotestsrc.c
@@ -895,7 +895,7 @@ static int impl_node_process_output(struct spa_node *node)
this = SPA_CONTAINER_OF(node, struct impl, node);
io = this->io;
- spa_return_val_if_fail(io != NULL, SPA_RESULT_WRONG_STATE);
+ spa_return_val_if_fail(io != NULL, SPA_RESULT_UNEXPECTED);
if (io->status == SPA_RESULT_HAVE_BUFFER)
return SPA_RESULT_HAVE_BUFFER;
diff --git a/spa/plugins/test/fakesink.c b/spa/plugins/test/fakesink.c
index 65615371..831fe5f8 100644
--- a/spa/plugins/test/fakesink.c
+++ b/spa/plugins/test/fakesink.c
@@ -702,7 +702,7 @@ static int impl_node_process_input(struct spa_node *node)
this = SPA_CONTAINER_OF(node, struct impl, node);
input = this->io;
- spa_return_val_if_fail(input != NULL, SPA_RESULT_WRONG_STATE);
+ spa_return_val_if_fail(input != NULL, SPA_RESULT_UNEXPECTED);
if (input->status == SPA_RESULT_HAVE_BUFFER && input->buffer_id < this->n_buffers) {
struct buffer *b = &this->buffers[input->buffer_id];
diff --git a/spa/plugins/test/fakesrc.c b/spa/plugins/test/fakesrc.c
index eb147b53..c985a844 100644
--- a/spa/plugins/test/fakesrc.c
+++ b/spa/plugins/test/fakesrc.c
@@ -751,7 +751,7 @@ static int impl_node_process_output(struct spa_node *node)
this = SPA_CONTAINER_OF(node, struct impl, node);
io = this->io;
- spa_return_val_if_fail(io != NULL, SPA_RESULT_WRONG_STATE);
+ spa_return_val_if_fail(io != NULL, SPA_RESULT_UNEXPECTED);
if (io->status == SPA_RESULT_HAVE_BUFFER)
return SPA_RESULT_HAVE_BUFFER;
diff --git a/spa/plugins/v4l2/v4l2-source.c b/spa/plugins/v4l2/v4l2-source.c
index 8d161412..ea58806e 100644
--- a/spa/plugins/v4l2/v4l2-source.c
+++ b/spa/plugins/v4l2/v4l2-source.c
@@ -838,7 +838,7 @@ static int impl_node_process_output(struct spa_node *node)
port = &this->out_ports[0];
io = port->io;
- spa_return_val_if_fail(io != NULL, SPA_RESULT_WRONG_STATE);
+ spa_return_val_if_fail(io != NULL, SPA_RESULT_UNEXPECTED);
if (io->status == SPA_RESULT_HAVE_BUFFER)
return SPA_RESULT_HAVE_BUFFER;
diff --git a/spa/plugins/videotestsrc/videotestsrc.c b/spa/plugins/videotestsrc/videotestsrc.c
index a31ee930..3a956fc2 100644
--- a/spa/plugins/videotestsrc/videotestsrc.c
+++ b/spa/plugins/videotestsrc/videotestsrc.c
@@ -821,7 +821,7 @@ static int impl_node_process_output(struct spa_node *node)
this = SPA_CONTAINER_OF(node, struct impl, node);
io = this->io;
- spa_return_val_if_fail(io != NULL, SPA_RESULT_WRONG_STATE);
+ spa_return_val_if_fail(io != NULL, SPA_RESULT_UNEXPECTED);
if (io->status == SPA_RESULT_HAVE_BUFFER)
return SPA_RESULT_HAVE_BUFFER;