Cleanup babeltrace-cfg, use BABELTRACE_PLUGIN_PATH
[babeltrace.git] / converter / babeltrace.c
index f884467eae97bfb3e7d9ff07e5f381e0b2ac8f29..9a5af9fb01efa436dc1f0604de83df2f1a0e886a 100644 (file)
@@ -29,9 +29,9 @@
 #include <babeltrace/babeltrace.h>
 #include <babeltrace/plugin/plugin.h>
 #include <babeltrace/component/component.h>
-#include <babeltrace/component/source.h>
-#include <babeltrace/component/sink.h>
-#include <babeltrace/component/filter.h>
+#include <babeltrace/component/component-source.h>
+#include <babeltrace/component/component-sink.h>
+#include <babeltrace/component/component-filter.h>
 #include <babeltrace/component/component-class.h>
 #include <babeltrace/component/notification/iterator.h>
 #include <babeltrace/ref.h>
@@ -81,7 +81,7 @@ struct bt_plugin *find_plugin(const char *name)
 static
 struct bt_component_class *find_component_class(const char *plugin_name,
                const char *comp_class_name,
-               enum bt_component_type comp_class_type)
+               enum bt_component_class_type comp_class_type)
 {
        struct bt_component_class *comp_class = NULL;
        struct bt_plugin *plugin = find_plugin(plugin_name);
@@ -98,16 +98,16 @@ end:
 }
 
 static
-const char *component_type_str(enum bt_component_type type)
+const char *component_type_str(enum bt_component_class_type type)
 {
        switch (type) {
-       case BT_COMPONENT_TYPE_SOURCE:
+       case BT_COMPONENT_CLASS_TYPE_SOURCE:
                return "source";
-       case BT_COMPONENT_TYPE_SINK:
+       case BT_COMPONENT_CLASS_TYPE_SINK:
                return "sink";
-       case BT_COMPONENT_TYPE_FILTER:
+       case BT_COMPONENT_CLASS_TYPE_FILTER:
                return "filter";
-       case BT_COMPONENT_TYPE_UNKNOWN:
+       case BT_COMPONENT_CLASS_TYPE_UNKNOWN:
        default:
                return "unknown";
        }
@@ -140,9 +140,14 @@ void print_component_classes_found(void)
        for (i = 0; i < plugins_count; i++) {
                int j;
                struct bt_plugin *plugin = g_ptr_array_index(loaded_plugins, i);
+               unsigned int major, minor, patch;
+               const char *extra;
+               enum bt_plugin_status version_status;
 
                component_classes_count =
                        bt_plugin_get_component_class_count(plugin);
+               version_status = bt_plugin_get_version(plugin, &major, &minor,
+                       &patch, &extra);
 
                for (j = 0; j < component_classes_count; j++) {
                        struct bt_component_class *comp_class =
@@ -157,7 +162,7 @@ void print_component_classes_found(void)
                                bt_plugin_get_description(plugin);
                        const char *comp_class_description =
                                bt_component_class_get_description(comp_class);
-                       enum bt_component_type type =
+                       enum bt_component_class_type type =
                                bt_component_class_get_type(comp_class);
 
                        printf_verbose("[%s - %s (%s)]\n", plugin_name,
@@ -169,6 +174,18 @@ void print_component_classes_found(void)
                                license ? license : "Unknown");
                        printf_verbose("\tplugin description: %s\n",
                                plugin_description ? plugin_description : "None");
+
+                       if (version_status == BT_PLUGIN_STATUS_OK) {
+                               printf_verbose("\tplugin version: %u.%u.%u",
+                                       major, minor, patch);
+
+                               if (extra) {
+                                       printf("%s", extra);
+                               }
+
+                               printf("\n");
+                       }
+
                        printf_verbose("\tcomponent description: %s\n",
                                comp_class_description ? comp_class_description : "None");
                        bt_put(comp_class);
@@ -356,7 +373,7 @@ struct bt_component *create_trimmer(struct bt_config_component *source_cfg)
        }
 
        trimmer_class = find_component_class("utils", "trimmer",
-               BT_COMPONENT_TYPE_FILTER);
+               BT_COMPONENT_CLASS_TYPE_FILTER);
        if (!trimmer_class) {
                fprintf(stderr, "Could not find trimmer component class. Aborting...\n");
                goto end;
@@ -383,7 +400,7 @@ int connect_source_sink(struct bt_component *source,
        struct bt_notification_iterator *source_it = NULL;
        struct bt_notification_iterator *to_sink_it = NULL;
 
-       source_it = bt_component_source_create_iterator(source);
+       source_it = bt_component_source_create_notification_iterator(source);
        if (!source_it) {
                fprintf(stderr, "Failed to instantiate source iterator. Aborting...\n");
                 ret = -1;
@@ -411,7 +428,7 @@ int connect_source_sink(struct bt_component *source,
                        goto end;
                }
 
-               to_sink_it = bt_component_filter_create_iterator(trimmer);
+               to_sink_it = bt_component_filter_create_notification_iterator(trimmer);
                if (!to_sink_it) {
                        fprintf(stderr, "Failed to instantiate trimmer iterator. Aborting...\n");
                        ret = -1;
@@ -480,7 +497,7 @@ int load_dynamic_plugins(struct bt_config *cfg)
                        continue;
                }
 
-               plugins = bt_plugin_create_all_from_dir(plugin_path, true);
+               plugins = bt_plugin_create_all_from_dir(plugin_path, false);
                if (!plugins) {
                        printf_debug("Unable to dynamically load plugins from path %s.\n",
                                plugin_path);
@@ -575,7 +592,7 @@ int main(int argc, const char **argv)
        source_params = bt_get(source_cfg->params);
        source_class = find_component_class(source_cfg->plugin_name->str,
                        source_cfg->component_name->str,
-                       BT_COMPONENT_TYPE_SOURCE);
+                       BT_COMPONENT_CLASS_TYPE_SOURCE);
        if (!source_class) {
                fprintf(stderr, "Could not find %s.%s source component class. Aborting...\n",
                                source_cfg->plugin_name->str,
@@ -588,7 +605,7 @@ int main(int argc, const char **argv)
        sink_params = bt_get(sink_cfg->params);
        sink_class = find_component_class(sink_cfg->plugin_name->str,
                        sink_cfg->component_name->str,
-                       BT_COMPONENT_TYPE_SINK);
+                       BT_COMPONENT_CLASS_TYPE_SINK);
        if (!sink_class) {
                fprintf(stderr, "Could not find %s.%s output component class. Aborting...\n",
                                sink_cfg->plugin_name->str,
This page took 0.025158 seconds and 4 git commands to generate.