+/** @since 0.3.0 */
+SR_API struct sr_output *sr_output_new(struct sr_output_format *of,
+ GHashTable *params, const struct sr_dev_inst *sdi)
+{
+ struct sr_output *o;
+
+ o = g_malloc(sizeof(struct sr_output));
+ o->format = of;
+ o->sdi = sdi;
+ o->params = params;
+ if (o->format->init && o->format->init(o) != SR_OK) {
+ g_free(o);
+ o = NULL;
+ }
+
+ return o;
+}
+
+/** @since 0.3.0 */
+SR_API int sr_output_send(struct sr_output *o,
+ const struct sr_datafeed_packet *packet, GString **out)
+{
+ return o->format->receive(o, packet, out);
+}
+
+/** @since 0.3.0 */
+SR_API int sr_output_free(struct sr_output *o)
+{
+ int ret;
+
+ ret = SR_OK;
+ if (o->format->cleanup)
+ ret = o->format->cleanup(o);
+ g_free(o);
+
+ return ret;
+}
+