#include "metadata.h"
#include "data-stream.h"
#include "file.h"
+#include "../common/metadata/decoder.h"
#define PRINT_ERR_STREAM ctf_fs->error_fp
#define PRINT_PREFIX "ctf-fs"
ctf_fs = bt_private_component_get_user_data(priv_comp);
if (!ctf_fs) {
- ret = BT_NOTIFICATION_ITERATOR_STATUS_INVAL;
+ ret = BT_NOTIFICATION_ITERATOR_STATUS_INVALID;
goto error;
}
port_data = bt_private_port_get_user_data(port);
if (!port_data) {
- ret = BT_NOTIFICATION_ITERATOR_STATUS_INVAL;
+ ret = BT_NOTIFICATION_ITERATOR_STATUS_INVALID;
goto error;
}
port_name->str, stream_path);
/* Create output port for this file */
- port = bt_private_component_source_add_output_private_port(
- ctf_fs->priv_comp, port_name->str);
- if (!port) {
- goto error;
- }
-
port_data = g_new0(struct ctf_fs_port_data, 1);
if (!port_data) {
goto error;
goto error;
}
- ret = bt_private_port_set_user_data(port, port_data);
- if (ret) {
+ port = bt_private_component_source_add_output_private_port(
+ ctf_fs->priv_comp, port_name->str, port_data);
+ if (!port) {
goto error;
}
const char *basename;
GError *error = NULL;
GDir *dir = NULL;
- struct bt_private_port *def_port;
struct ctf_fs_file *file = NULL;
- /* Remove default port if needed */
- def_port = bt_private_component_source_get_default_output_private_port(
- ctf_fs->priv_comp);
- if (def_port) {
- bt_private_port_remove_from_component(def_port);
- bt_put(def_port);
- }
-
/* Create one output port for each stream file */
dir = g_dir_open(ctf_fs->trace_path->str, 0, &error);
if (!dir) {
for (i = 0; i < count; i++) {
struct bt_ctf_clock_class *clock_class =
- bt_ctf_trace_get_clock_class(ctf_fs->metadata->trace,
- i);
+ bt_ctf_trace_get_clock_class_by_index(
+ ctf_fs->metadata->trace, i);
assert(clock_class);
ret = bt_clock_class_priority_map_add_clock_class(
ctf_fs->trace_path = g_string_new(path);
if (!ctf_fs->trace_path) {
+ BT_PUT(value);
goto error;
}
+ bt_put(value);
+
+ value = bt_value_map_get(params, "offset-s");
+ if (value) {
+ int64_t offset;
+
+ if (!bt_value_is_integer(value)) {
+ fprintf(stderr,
+ "offset-s should be an integer\n");
+ goto error;
+ }
+ ret = bt_value_integer_get(value, &offset);
+ if (ret != BT_VALUE_STATUS_OK) {
+ fprintf(stderr,
+ "Failed to get offset-s value\n");
+ goto error;
+ }
+ ctf_fs->options.clock_offset = offset;
+ bt_put(value);
+ }
+
+ value = bt_value_map_get(params, "offset-ns");
+ if (value) {
+ int64_t offset;
+
+ if (!bt_value_is_integer(value)) {
+ fprintf(stderr,
+ "offset-ns should be an integer\n");
+ goto error;
+ }
+ ret = bt_value_integer_get(value, &offset);
+ if (ret != BT_VALUE_STATUS_OK) {
+ fprintf(stderr,
+ "Failed to get offset-ns value\n");
+ goto error;
+ }
+ ctf_fs->options.clock_offset_ns = offset;
+ bt_put(value);
+ }
+
ctf_fs->error_fp = stderr;
ctf_fs->page_size = (size_t) getpagesize();
ctf_fs_destroy_data(ctf_fs);
ctf_fs = NULL;
end:
- BT_PUT(value);
return ctf_fs;
}
goto error;
}
- is_packetized = ctf_metadata_is_packetized(metadata_fp, &bo);
+ is_packetized = ctf_metadata_decoder_is_packetized(metadata_fp,
+ &bo);
if (is_packetized) {
- ret = ctf_metadata_packetized_file_to_buf(NULL,
- metadata_fp, (uint8_t **) &metadata_text, bo);
+ ret = ctf_metadata_decoder_packetized_file_stream_to_buf(
+ metadata_fp, &metadata_text, bo);
if (ret) {
fprintf(stderr,
"Cannot decode packetized metadata file\n");