ret = pa_play_file_repeat(pa_namereg_get(u->module->core, NULL, PA_NAMEREG_SINK),
filename, NULL, p, repeat, &stream_idx);
if (ret != 0) {
- pa_log_error("pa_play_file_repeat failed.\n");
+ pa_dbus_send_error(conn, msg, DBUS_ERROR_NOT_SUPPORTED, "%s",
+ "org.tizen.multimedia.audio.UnsupportedMediaType");
goto exit;
}
pa_idxset_put(u->stream_idxs, pa_xmemdup(&stream_idx, sizeof(stream_idx)), NULL);
result = (dbus_int32_t)stream_idx;
+ pa_dbus_send_basic_value_reply(conn, msg, DBUS_TYPE_INT32, &result);
+
exit:
pa_proplist_free(p);
- pa_dbus_send_basic_value_reply(conn, msg, DBUS_TYPE_INT32, &result);
}
static void handle_sound_stop(DBusConnection *conn, DBusMessage *msg, void *userdata) {
pa_sink_input *si;
uint32_t stream_idx;
struct userdata *u = (struct userdata *)userdata;
+ int32_t *i;
+ uint32_t idx;
pa_assert(conn);
pa_assert(msg);
DBUS_TYPE_INVALID));
si = pa_idxset_get_by_index(u->module->core->sink_inputs, stream_idx);
- if (si != NULL) {
- int32_t *i = NULL;
- uint32_t idx = 0;
-
- PA_IDXSET_FOREACH(i, u->stream_idxs, idx) {
- if (*i == stream_idx) {
- pa_idxset_remove_by_data(u->stream_idxs, i, NULL);
- pa_xfree(i);
- }
+ if (!si) {
+ pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED, "%s",
+ "org.tizen.multimedia.audio.InvalidState");
+ return;
+ }
+
+ PA_IDXSET_FOREACH(i, u->stream_idxs, idx) {
+ if (*i == stream_idx) {
+ pa_idxset_remove_by_data(u->stream_idxs, i, NULL);
+ pa_xfree(i);
}
- pa_sink_input_unlink(si);
}
+ pa_sink_input_unlink(si);
pa_dbus_send_empty_reply(conn, msg);
}