s->update_requested_latency = NULL;
s->set_port = NULL;
s->get_formats = NULL;
+ s->set_formats = NULL;
}
/* Called from main context */
return ret;
}
+/* Called from the main thread */
+/* Allows an external source to set what formats a sink supports if the sink
+ * permits this. The function makes a copy of the formats on success. */
+pa_bool_t pa_sink_set_formats(pa_sink *s, pa_idxset *formats) {
+ pa_assert(s);
+ pa_assert(formats);
+
+ if (s->set_formats)
+ /* Sink supports setting formats -- let's give it a shot */
+ return s->set_formats(s, formats);
+ else
+ /* Sink doesn't support setting this -- bail out */
+ return FALSE;
+}
+
/* Called from the main thread */
/* Checks if the sink can accept this format */
pa_bool_t pa_sink_check_format(pa_sink *s, pa_format_info *f)
* in descending order of preference. */
pa_idxset* (*get_formats)(pa_sink *s); /* ditto */
+ /* Called to set the list of formats supported by the sink. Can be
+ * NULL if the sink does not support this. Returns TRUE on success,
+ * FALSE otherwise (for example when an unsupportable format is
+ * set). Makes a copy of the formats passed in. */
+ pa_bool_t (*set_formats)(pa_sink *s, pa_idxset *formats); /* ditto */
+
/* Contains copies of the above data so that the real-time worker
* thread can work without access locking */
struct {
void pa_sink_move_all_fail(pa_queue *q);
pa_idxset* pa_sink_get_formats(pa_sink *s);
+pa_bool_t pa_sink_set_formats(pa_sink *s, pa_idxset *formats);
pa_bool_t pa_sink_check_format(pa_sink *s, pa_format_info *f);
pa_idxset* pa_sink_check_formats(pa_sink *s, pa_idxset *in_formats);