From 8a6c459f7080f04dae7ee6c19c646f9552029e2c Mon Sep 17 00:00:00 2001 From: Stefan Sauer Date: Wed, 11 May 2016 23:12:07 -0700 Subject: [PATCH] lv2: add support for host features Implement a log handler as the first one. --- ext/lv2/gstlv2utils.c | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/ext/lv2/gstlv2utils.c b/ext/lv2/gstlv2utils.c index 589f6c5..44700c6 100644 --- a/ext/lv2/gstlv2utils.c +++ b/ext/lv2/gstlv2utils.c @@ -25,9 +25,50 @@ #include "gstlv2.h" #include "gstlv2utils.h" +#include + GST_DEBUG_CATEGORY_EXTERN (lv2_debug); #define GST_CAT_DEFAULT lv2_debug +/* host features */ + +/* - log extension */ + +static int +lv2_log_printf (LV2_Log_Handle handle, LV2_URID type, const char *fmt, ...) +{ + va_list ap; + + va_start (ap, fmt); + gst_debug_log_valist (lv2_debug, GST_LEVEL_INFO, "", "", 0, NULL, fmt, ap); + va_end (ap); + return 1; +} + +static int +lv2_log_vprintf (LV2_Log_Handle handle, LV2_URID type, + const char *fmt, va_list ap) +{ + gst_debug_log_valist (lv2_debug, GST_LEVEL_INFO, "", "", 0, NULL, fmt, ap); + return 1; +} + +static LV2_Log_Log lv2_log = { + NULL, /* handle */ + lv2_log_printf, lv2_log_vprintf, +}; + +static const LV2_Feature lv2_log_feature = { LV2_LOG__log, &lv2_log }; + +/* feature list */ + +static const LV2_Feature *lv2_features[] = { + &lv2_log_feature, + NULL +}; + +/* api helpers */ + void gst_lv2_init (GstLV2 * lv2, GstLV2Class * lv2_class) { @@ -57,7 +98,7 @@ gst_lv2_setup (GstLV2 * lv2, unsigned long rate) lilv_instance_free (lv2->instance); if (!(lv2->instance = - lilv_plugin_instantiate (lv2_class->plugin, rate, NULL))) + lilv_plugin_instantiate (lv2_class->plugin, rate, lv2_features))) return FALSE; /* connect the control ports */ -- 2.7.4