static void endpoint_setconf_cb(struct a2dp_setup *setup, gboolean ret) { if (ret == FALSE) { setup->err = g_new(struct avdtp_error, 1); avdtp_error_init(setup->err, AVDTP_MEDIA_CODEC, AVDTP_UNSUPPORTED_CONFIGURATION); }
static gboolean finalize_suspend_errno(struct a2dp_setup *s, int err) { struct avdtp_error avdtp_err; avdtp_error_init(&avdtp_err, AVDTP_ERROR_ERRNO, -err); s->err = err ? &avdtp_err : NULL; return finalize_suspend(s); }
static void suspend_cfm(struct avdtp *session, struct avdtp_local_sep *sep, struct avdtp_stream *stream, struct avdtp_error *err, void *user_data) { struct a2dp_sep *a2dp_sep = user_data; struct a2dp_setup *setup; gboolean start; if (a2dp_sep->type == AVDTP_SEP_TYPE_SINK) DBG("Sink %p: Suspend_Cfm", sep); else DBG("Source %p: Suspend_Cfm", sep); a2dp_sep->suspending = FALSE; setup = find_setup_by_session(session); if (!setup) return; start = setup->start; setup->start = FALSE; if (err) { setup->stream = NULL; setup->err = err; finalize_suspend(setup); } else finalize_suspend_errno(setup, 0); if (!start) return; if (err) { setup->err = err; finalize_suspend(setup); } else if (avdtp_start(session, a2dp_sep->stream) < 0) { struct avdtp_error start_err; error("avdtp_start failed"); avdtp_error_init(&start_err, AVDTP_ERROR_ERRNO, EIO); setup->err = err; finalize_suspend(setup); } }
static void finalize_setup_errno(struct a2dp_setup *s, int err, GSourceFunc cb1, ...) { GSourceFunc finalize; va_list args; struct avdtp_error avdtp_err; if (err < 0) { avdtp_error_init(&avdtp_err, AVDTP_ERRNO, -err); s->err = &avdtp_err; } va_start(args, cb1); finalize = cb1; setup_ref(s); while (finalize != NULL) { finalize(s); finalize = va_arg(args, GSourceFunc); } setup_unref(s); va_end(args); }