AC_CONFIG_SRCDIR([src])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADER([src/config.h])
-AM_INIT_AUTOMAKE
+AM_INIT_AUTOMAKE([subdir-objects])
AC_SUBST(ACLOCAL_AMFLAGS, "-I m4")
srs_context_t *srs = c->srs;
const char *lang = language && *language ? language : NULL;
- return srs_query_voices(c->srs, lang, actorsp);
+ return srs_query_voices(srs, lang, actorsp);
}
static int nblock = 0;
-static int prflen = 0;
+static size_t prflen = 0;
static char blocks[MAX_DEPTH][MAX_BLOCK];
static char prefix[MAX_PREFIX];
}
+#ifdef SYSTEMD_ENABLED
static int set_passed_sockets(srs_context_t *srs, const char *variables)
{
-#ifdef SYSTEMD_ENABLED
const char *b, *e;
char key[256], val[64];
int nfd, i, n;
n = snprintf(val, sizeof(val), "%d", SD_LISTEN_FDS_START + i);
- if (n < 0 || n >= sizeof(val))
+ if (n < 0 || n >= (int)sizeof(val))
return -1;
srs_set_config(srs, key, val);
}
return 0;
-#else
- errno = EOPNOTSUPP;
- return -1;
-#endif
}
+#endif
static void config_load_plugins(srs_context_t *srs, char *plugins)
static void push_block(const char *block, int blen)
{
- int plen;
-
if (nblock >= MAX_DEPTH) {
mrp_log_error("Too deeply nested configuration block: %s.%s",
prefix, block);
static void pop_block(void)
{
char *block;
- int blen;
+ size_t blen;
if (nblock <= 0) {
mrp_log_error("Unbalanced block open ({) and close (}).");
if (nblock > 0)
snprintf(keybuf, sizeof(keybuf), "%s.%*.*s", prefix,
- klen, klen, key);
+ (int)klen, (int)klen, key);
else
- snprintf(keybuf, sizeof(keybuf), "%*.*s", klen, klen, key);
+ snprintf(keybuf, sizeof(keybuf), "%*.*s",
+ (int)klen, (int)klen, key);
strncpy(valbuf, val, vlen);
valbuf[vlen] = '\0';
{ "debug" , required_argument, NULL, 'd' },
{ "foreground" , no_argument , NULL, 'f' },
{ "valgrind" , optional_argument, NULL, 'V' },
+#ifdef SYSTEMD_ENABLED
{ "sockets" , required_argument, NULL, 'S' },
+#endif
{ "help" , no_argument , NULL, 'h' },
{ NULL, 0, NULL, 0 }
};
{
srs_pulse_t *p = (srs_pulse_t *)user_data;
+ MRP_UNUSED(api);
+ MRP_UNUSED(e);
+ MRP_UNUSED(tv);
+
if (p->pc != NULL) {
pa_context_unref(p->pc);
p->pc = NULL;
pa_context_state_t cst = pa_context_get_state(p->pc);
pa_stream_state_t sst;
+ MRP_UNUSED(ps);
+
if (cst == PA_CONTEXT_TERMINATED || cst == PA_CONTEXT_FAILED)
return;
{
stream_t *s = (stream_t *)user_data;
+ MRP_UNUSED(ps);
+
mrp_debug("pulse: stream #%u drained %s", s->id,
success ? "successfully" : "failed");
stream_t *s = (stream_t *)user_data;
int done;
+ MRP_UNUSED(ps);
+
stream_notify(s, SRS_STREAM_EVENT_PROGRESS);
if (s->offs == s->size) {
return;
}
-
+#if 0
static int get_effect_config(srs_context_t *srs, effect_t **cfgp)
{
static effect_t effects[32];
return neffect;
}
-
+#endif
static void process_unrecognized(srs_srec_t *srec, srs_srec_result_t *res)
{
srs_play_sound_file(srec->srs, e->data, NULL, NULL);
else
srs_say_msg(srec->srs, e->data, NULL, NULL);
+#else
+ MRP_UNUSED(srec);
#endif
+ MRP_UNUSED(res);
}
void *user_data)
{
srs_resctx_t *ctx = (srs_resctx_t *)user_data;
- srs_context_t *srs = ctx->srs;
MRP_UNUSED(err);
return set;
}
- fail:
if (ctx != NULL) {
if (set->set != NULL)
mrp_res_delete_resource_set(set->set);
if (mrp_res_acquire_resource_set(set->set) == 0)
return TRUE;
- else
- /* fall through */;
+ else {
+ /* fall through */
+ }
fail:
if (set->set != NULL) {
mrp_res_resource_t *srec, *ssyn;
srs_resctl_event_t e;
+ MRP_UNUSED(rctx);
+
srec = mrp_res_get_resource_by_name(rset, name_srec);
ssyn = mrp_res_get_resource_by_name(rset, name_ssyn);
{
const char *lang, *dialect, *gender, *s;
char *d;
- int idx, i;
- ssize_t n;
+ int idx;
lang = language->lang;
dialect = actor->dialect;
static void notify_request(request_t *req, srs_voice_event_t *event)
{
- renderer_t *r = req->r;
int mask = (1 << event->type);
srs_voice_event_t e;
{
state_t *state = (state_t *)srs->synthesizer;
renderer_t *r;
- srs_voice_actor_t *a;
int i;
if (state == NULL) {
if ((e = strchr(voice, '/')) != NULL) {
n = e - voice;
- if (n >= sizeof(renderer) - 1)
+ if (n >= (int)sizeof(renderer) - 1)
return NULL;
strncpy(renderer, voice, n);
l = find_language(state, voice, FALSE);
else {
n = e - voice;
- if (snprintf(lang, sizeof(lang), "%*.*s", n, n, voice) >= sizeof(lang))
+ if (snprintf(lang, sizeof(lang), "%*.*s",
+ (int)n, (int)n, voice) >= (int)sizeof(lang))
l = NULL;
else
l = find_language(state, lang, FALSE);
request_t *req = &qr->req;
srs_voice_event_t event;
+ MRP_UNUSED(t);
+
mrp_log_info("Voice/TTS request #%u timed out.", qr->req.id);
mrp_del_timer(req->timer);
double pitch, int timeout, int notify_mask,
srs_voice_notify_t notify, void *notify_data)
{
- queued_t *qr;
+ queued_t *qr = NULL;
+
+ MRP_UNUSED(rate);
+ MRP_UNUSED(pitch);
+ MRP_UNUSED(timeout);
qr = mrp_allocz(sizeof(*qr));
double pitch, int timeout, int notify_mask,
srs_voice_notify_t notify, void *notify_data)
{
- request_t *req;
+ request_t *req = NULL;
+
+ MRP_UNUSED(timeout);
req = mrp_allocz(sizeof(*req));
}
if ((req = state->active) != NULL) {
- if ((rid == -1 || req->id == rid) && (vid == -1 || req->vid == vid))
+ if ((rid == SRS_VOICE_INVALID || req->id == rid) &&
+ (vid == SRS_VOICE_INVALID || req->vid == vid))
return req;
}
mrp_list_foreach(&state->requests, p, n) {
req = mrp_list_entry(p, typeof(*req), hook);
- if ((rid == -1 || req->id == rid) && (vid == -1 || req->vid == vid))
+ if ((rid == SRS_VOICE_INVALID || req->id == rid) &&
+ (vid == SRS_VOICE_INVALID || req->vid == vid))
return req;
}
request_t *req = find_request(state, rid, -1);
renderer_t *voice = req ? req->r : NULL;
+ MRP_UNUSED(notify);
+
if (req == NULL)
return;
static void dbusif_cleanup(dbusif_t *bus)
{
- srs_context_t *srs = bus->self->srs;
const char *path, *iface, *method;
int (*cb)(mrp_dbus_t *, mrp_dbus_msg_t *, void *);
MRP_DBUS_TYPE_INVALID);
}
-
-static int parse_commands(mrp_dbus_msg_t *msg, char **commands, int ncommand)
-{
- int n;
-
- n = 0;
- while (n < ncommand - 1) {
- if (mrp_dbus_msg_read_basic(msg, MRP_DBUS_TYPE_STRING, commands + n))
- n++;
- else
- return -1;
- }
-
- return n;
-}
-
-
static int parse_register(mrp_dbus_msg_t *req, const char **id,
const char **name, const char **appclass,
char ***commands, int *ncommand, const char **errmsg)
static int focus_notify(srs_client_t *c, srs_voice_focus_t focus)
{
dbusif_t *bus = (dbusif_t *)c->user_data;
- srs_context_t *srs = c->srs;
const char *dest = c->id;
const char *path = SRS_CLIENT_PATH;
const char *iface = SRS_CLIENT_INTERFACE;
uint32_t *start, uint32_t *end, srs_audiobuf_t *audio)
{
dbusif_t *bus = (dbusif_t *)c->user_data;
- srs_context_t *srs = c->srs;
const char *dest = c->id;
const char *path = SRS_CLIENT_PATH;
const char *iface = SRS_CLIENT_INTERFACE;
static int voice_notify(srs_client_t *c, srs_voice_event_t *event)
{
dbusif_t *bus = (dbusif_t *)c->user_data;
- srs_context_t *srs = c->srs;
const char *dest = c->id;
const char *path = SRS_CLIENT_PATH;
const char *iface = SRS_CLIENT_INTERFACE;
int *notify_events, const char **errmsg)
{
char **events, *e;
- int i;
- size_t nevent;
+ size_t i, nevent;
int32_t to;
*id = mrp_dbus_msg_sender(req);
{
dbusif_t *bus = (dbusif_t *)user_data;
srs_context_t *srs = bus->self->srs;
- const char *id, *msg, *voice, *errmsg;
+ const char *id, *msg, *voice, *errmsg = NULL;
double rate, pitch;
int timeout, events, err;
uint32_t reqid;
{
dbusif_t *bus = (dbusif_t *)plugin->plugin_data;
+ MRP_UNUSED(bus);
+
mrp_debug("stop D-Bus client interface plugin");
return;
int timeout = 5000;
int events = FALSE;
char msg[1024], *t, *e, *p;
- int i, o;
+ int i, o, n;
size_t l;
- ssize_t n;
if (c->registered) {
print(c, "You need to unregister first to modify commands.");
}
else {
n = snprintf(p, l, "%s%s", sep, t);
- if (n >= l) {
+ if ((size_t)n >= l) {
print(c, "TTS message too long.");
return;
}
void *user_data)
{
client_t *c = (client_t *)user_data;
- uint32_t nvoice;
+ uint32_t nvoice, i;
char **voices, **lang, **dialect, **gender, **description;
size_t dummy;
- int i, n;
MRP_UNUSED(dbus);
{
srs_t *srs = (srs_t *)user_data;
srs_msg_t *msg = (srs_msg_t *)data;
- request_t *req;
MRP_UNUSED(t);
MRP_UNUSED(user_data);
int status = 0;
char *msg = !error ? "connection closed" : "connection error";
+ MRP_UNUSED(t);
+
mrp_debug("transport closed by server");
srs->conn_notify(srs, status, msg, srs->user_data);
srs_command_notify_t cmd_notify, void *user_data)
{
srs_t *srs;
- int i;
+ size_t i;
if (conn_notify == NULL)
return NULL;
void srs_destroy(srs_t *srs)
{
- int i;
+ size_t i;
if (srs == NULL)
return;
mrp_sockaddr_t addr;
socklen_t alen;
- const char *atype, *opt, *val;
+ const char *atype;
int flags;
void *typemap;
srs_req_register_t reg;
+ MRP_UNUSED(reconnect);
+
if (server == NULL)
server = DEFAULT_ADDRESS;
errno = ENOTCONN;
return -1;
}
+
+ return 0;
}
static void query_voices(client_t *c, srs_req_voiceqry_t *req)
{
- srs_voice_actor_t *actors;
+ srs_voice_actor_t *actors = NULL;
int nactor;
mrp_debug("received voice query request from native client #%d", c->id);
mrp_debug("replying to request #%u from native client #%d", reqno, c->id);
- if (actors < 0)
- actors = 0;
-
rpl.type = SRS_REPLY_QUERYVOICES;
rpl.reqno = reqno;
rpl.actors = actors;
srs_context_t *srs = s->self->srs;
mrp_sockaddr_t addr;
socklen_t alen;
- const char *type, *opt, *val;
+ const char *type;
int flags, state, sock;
void *typemap;
alen = mrp_transport_resolve(NULL, s->address, &addr, sizeof(addr), &type);
- if (alen < 0) {
+ if (alen == 0) {
mrp_log_error("Failed to resolve transport address '%s'.",
s->address);
goto fail;
plugin->plugin_data = s;
return TRUE;
-
- fail:
- mrp_free(s);
-
- return FALSE;
}
{
client_t *c = (client_t *)user_data;
+ MRP_UNUSED(srs);
+
if (status == 1) {
set_prompt(c, "connected");
print(c, "Connection to server established.");
{
client_t *c = (client_t *)user_data;
+ MRP_UNUSED(srs);
+
print(c, "Client has now %sfocus.", !focus ? "no " :
focus == SRS_VOICE_FOCUS_SHARED ? "shared " : "exclusive ");
}
void *user_data)
{
client_t *c = (client_t *)user_data;
- char cmd[1024], *p;
- size_t size;
int i;
+ MRP_UNUSED(srs);
+
print(c, "Got command #%d: ", idx);
for (i = 0; i < ntoken; i++)
print(c, " token #%d: %s", i, tokens[i]);
srs_voice_actor_t *a;
int i;
+ MRP_UNUSED(srs);
MRP_UNUSED(notify_data);
print(c, "Server has %d available matching voices.", nactor);
}
-static void tts_progress_cb(srs_t *srs, srs_voice_event_t *event,
- void *user_data, void *notify_data)
-{
- client_t *c = (client_t *)user_data;
-
- MRP_UNUSED(srs);
- MRP_UNUSED(notify_data);
-
- print(c, "Got voice rendering event 0x%x.", event->type);
-}
-
-
static void request_tts(client_t *c, int ntoken, char **tokens)
{
const char *sep = "";
int timeout = SRS_VOICE_QUEUE;
int events = FALSE;
char msg[1024], *t, *e, *p;
- int i, o;
+ int i, o, n;
size_t l;
- ssize_t n;
p = msg;
l = sizeof(msg);
}
else {
n = snprintf(p, l, "%s%s", sep, t);
- if (n >= l) {
+ if ((size_t)n >= l) {
print(c, "TTS message too long.");
return;
}
char *voice, *msg;
uint32_t id;
+ MRP_UNUSED(c);
+ MRP_UNUSED(path);
+ MRP_UNUSED(interface);
+
if (strcmp(method, "synthesize"))
return;
static void tts_setup(wrtc_t *wrtc)
{
- static GDBusInterfaceVTable vtable = { tts_request_cb, NULL, NULL };
+ static GDBusInterfaceVTable vtable = { tts_request_cb, NULL, NULL, {} };
wrtc->intr = g_dbus_node_info_new_for_xml(TTS_INTERFACE_XML, NULL);
{
wrtc_t *wrtc = (wrtc_t *)plugin->plugin_data;
+ MRP_UNUSED(wrtc);
+
mrp_debug("stop WRT media client plugin");
return;
{
context_t *ctx = (context_t *)plugin->plugin_data;
+ MRP_UNUSED(settings);
+
mrp_log_info("configuring input plugin");
ctx->key = KEY_PAUSE;
static void destroy_input(srs_plugin_t *plugin)
{
context_t *ctx = (context_t *)plugin->plugin_data;
- size_t i;
mrp_log_info("destroying input plugin");
const char *path;
const char *kbd;
const char *key;
- int fd;
if ((path = udev_device_get_property_value(dev, "DEVNAME"))) {
key = udev_device_get_property_value(dev, "ID_INPUT_KEY");
if (l < (int)sizeof(cmd)) {
mrp_log_info("search-client executing '%s'", cmd);
- system(cmd);
+ if (system(cmd) < 0) {
+ mrp_log_error("search-client: failed to execute search command \
+ '%s'", cmd);
+ }
}
}
else
static node_t *get_dictionary_node(node_t *prnt, const char *token, int insert)
{
- srs_dict_op_t op;
+ srs_dict_op_t op = SRS_DICT_OP_UNKNOWN;
char dict[MAX_DICT];
mrp_list_hook_t *p, *n;
node_t *node;
static void push_log(logger_t *logger)
{
- char *b, *e, *lb, *le, *file, lvl, name[1024], *msg;
- int line, len, nlen;
+ char *b, *e, *file, lvl, name[1024], *msg;
+ int line, len;
ssize_t n;
name[sizeof(name) - 1] = '\0';
lvl = 0;
if ((e = strchr(b, '\n')) == NULL) {
- if (logger->n >= sizeof(logger->buf) - 1) {
+ if (logger->n >= (ssize_t)sizeof(logger->buf) - 1) {
mrp_log_warning("Discarding too long sphinx log buffer.");
logger->n = 0;
}
default:
if (mrp_debug_check(file, "sphinx", line))
mrp_debug_msg("sphinx", line, file,
- "%*.*s", n, n, msg);
+ "%*.*s", (int)n, (int)n, msg);
break;
case 'W':
mrp_log_msg(MRP_LOG_WARNING, file, line, "sphinx",
- "%*.*s", n, n, msg);
+ "%*.*s", (int)n, (int)n, msg);
break;
case 'E':
case 'S':
case 'F':
mrp_log_msg(MRP_LOG_ERROR, file, line, "sphinx",
- "%*.*s", n, n, msg);
+ "%*.*s", (int)n, (int)n, msg);
break;
}
FILE *logger_create(context_t *ctx)
{
- static logger_t logger = { { -1, -1 }, NULL, 0 };
+ static logger_t logger = { { -1, -1 }, NULL, NULL, "", 0 };
mrp_mainloop_t *ml = plugin_get_mainloop(ctx->plugin);
mrp_io_event_t events = MRP_IO_EVENT_IN | MRP_IO_EVENT_HUP;
int32_t frlen;
int32 start, end;
size_t ncand;
- srs_srec_candidate_t *cand;
+ srs_srec_candidate_t *cand = cands;
srs_srec_token_t *tkn;
int32_t length;
static int espeak_setpitch(double dpitch)
{
- int min, max, step, pitch, orig;
+ int pitch, orig;
if (0.0 < dpitch && dpitch <= 2.0) {
pitch = (int)(50 * dpitch);
espeak_VOICE **voices, *v;
int nvoice, i;
const char *lang, *language, *dialect;
- int nactor;
if (e->srs->pulse == NULL)
return FALSE;
static void stop_espeak(srs_plugin_t *plugin)
{
+ MRP_UNUSED(plugin);
+
return;
}
while (*s && *s != ' ' && *s != '\t' && *s != ',' && *s != ':') {
*b++ = *s++;
- if (b - buf >= sizeof(buf) - 1) {
+ if (b - buf >= (int)sizeof(buf) - 1) {
errno = ENOBUFS;
return -1;
}
}
- if (b - buf >= sizeof(buf) - 1) {
+ if (b - buf >= (int)sizeof(buf) - 1) {
errno = ENOBUFS;
return -1;
}
while (*s && *s != ' ' && *s != '\t' && *s != ',' && *s != ':') {
*b++ = *s++;
- if (b - buf >= sizeof(buf) - 1) {
+ if (b - buf >= (int)sizeof(buf) - 1) {
errno = ENOBUFS;
return -1;
}
}
- if (b - buf >= sizeof(buf) - 1) {
+ if (b - buf >= (int)sizeof(buf) - 1) {
errno = ENOBUFS;
return -1;
}
{
char pattern[PATH_MAX], path[PATH_MAX], *p;
const char *l;
- int len, prfx, match, ok;
+ int len, prfx, ok;
DIR *dp;
struct dirent *de;
regex_t re;
regmatch_t rm;
if (strchr(lib, '*') == NULL && strchr(lib, '?') == NULL) {
- if (snprintf(buf, size, "%s/%s", dir, lib) >= size)
+ if ((size_t)snprintf(buf, size, "%s/%s", dir, lib) >= size)
return NULL;
if (access(buf, R_OK) == 0)
return buf;
if (prfx > 0 && strncmp(de->d_name, pattern, prfx) != 0)
continue;
- if (regexec(&re, de->d_name, 1, &rm, 0) == 0) {
- ok = snprintf(buf, size, "%s/%s", dir, de->d_name) < size;
+ if (regexec(&re, de->d_name, 1, &rm, 0) != 0)
+ continue;
- closedir(dp);
- regfree(&re);
+ ok = (size_t)snprintf(buf, size, "%s/%s", dir, de->d_name) < size;
- return ok ? buf : NULL;
- }
+ closedir(dp);
+ regfree(&re);
+
+ return ok ? buf : NULL;
}
else if (de->d_type == DT_LNK) {
struct stat st;
static int start_loader(srs_plugin_t *plugin)
{
+ MRP_UNUSED(plugin);
+
return TRUE;
}
{
festival_t *f = (festival_t *)api_data;
void *samples;
- uint32_t nsample, id;
- int srate, nchannel;
+ uint32_t id;
+ int srate, nchannel, nsample;
MRP_UNUSED(rate);
MRP_UNUSED(pitch);
if (e != NULL) {
len = e - b;
- if (len >= sizeof(voice) - 1) {
+ if (len >= (int)sizeof(voice) - 1) {
toolong:
mrp_log_error("Voice name '%*.*s' too long.", len, len, b);
return FALSE;
voice[len] = '\0';
}
else {
- if ((len = strlen(b)) >= sizeof(voice) - 1)
+ if ((len = strlen(b)) >= (int)sizeof(voice) - 1)
goto toolong;
strcpy(voice, b);
};
festival_t *f = (festival_t *)plugin->plugin_data;
- int nactor;
char **voices;
int nvoice;
char *lang, *dial, *descr;
- int female, age, i;
+ int female, i;
if (f->srs->pulse == NULL)
return FALSE;
static void stop_festival(srs_plugin_t *plugin)
{
+ MRP_UNUSED(plugin);
+
return;
}
static void update_loaded_voices(void)
{
voice_t *v;
- LISP ll, lentry, lname, llang, ldescr, lgender, lp, lk, lv;
+ LISP ll, lentry, lname, ldescr, lp, lk, lv;
const char *key;
if ((ll = siod_get_lval("Voice_descriptions", NULL)) == NIL)
int carnival_init(void)
{
- voice_t *v;
-
festival_initialize(TRUE, FESTIVAL_HEAP_SIZE);
update_available_voices();
if ((v = find_voice_entry(name)) != NULL && v->language != NULL)
return 0; /* already loaded, nothing to do */
- if (snprintf(loader, sizeof(loader), "voice_%s", name) >= sizeof(loader)) {
+ if (snprintf(loader, sizeof(loader), "voice_%s", name) >= (int)sizeof(loader)) {
errno = EOVERFLOW;
return -1;
return -1; /* not loaded, cannot select */
}
- if (snprintf(sel, sizeof(sel), "voice_%s", name) >= sizeof(sel)) {
+ if (snprintf(sel, sizeof(sel), "voice_%s", name) >= (int)sizeof(sel)) {
errno = EOVERFLOW;
return -1;