struct writer_component *writer_component,
struct bt_ctf_packet *packet, struct bt_ctf_stream *stream)
{
- struct bt_ctf_stream_class *stream_class = NULL;
- struct bt_ctf_writer *ctf_writer = NULL;
struct bt_ctf_stream *writer_stream = NULL;
- stream_class = bt_ctf_stream_get_class(stream);
- if (!stream_class) {
+ writer_stream = lookup_stream(writer_component, stream);
+ if (!writer_stream) {
fprintf(writer_component->err, "[error] %s in %s:%d\n",
__func__, __FILE__, __LINE__);
goto error;
}
-
- writer_stream = lookup_stream(writer_component, stream);
- if (!writer_stream) {
- struct fs_writer *fs_writer;
-
- fs_writer = get_fs_writer(writer_component, stream_class);
- if (!fs_writer) {
- fprintf(writer_component->err, "[error] %s in %s:%d\n",
- __func__, __FILE__, __LINE__);
- goto error;
- }
- ctf_writer = bt_get(fs_writer->writer);
- writer_stream = insert_new_stream(writer_component, ctf_writer,
- stream_class, stream);
- if (!writer_stream) {
- fprintf(writer_component->err, "[error] %s in %s:%d\n",
- __func__, __FILE__, __LINE__);
- goto error;
- }
- fs_writer->active_streams++;
- }
bt_get(writer_stream);
goto end;
error:
BT_PUT(writer_stream);
end:
- bt_put(ctf_writer);
- bt_put(stream_class);
return writer_stream;
}
return ret;
}
+BT_HIDDEN
+enum bt_component_status writer_stream_begin(
+ struct writer_component *writer_component,
+ struct bt_ctf_stream *stream)
+{
+ struct bt_ctf_stream_class *stream_class = NULL;
+ struct fs_writer *fs_writer;
+ struct bt_ctf_writer *ctf_writer = NULL;
+ struct bt_ctf_stream *writer_stream = NULL;
+ enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
+
+ stream_class = bt_ctf_stream_get_class(stream);
+ if (!stream_class) {
+ fprintf(writer_component->err, "[error] %s in %s:%d\n",
+ __func__, __FILE__, __LINE__);
+ goto error;
+ }
+
+ fs_writer = get_fs_writer(writer_component, stream_class);
+ if (!fs_writer) {
+ fprintf(writer_component->err, "[error] %s in %s:%d\n",
+ __func__, __FILE__, __LINE__);
+ goto error;
+ }
+ ctf_writer = bt_get(fs_writer->writer);
+ writer_stream = insert_new_stream(writer_component, ctf_writer,
+ stream_class, stream);
+ if (!writer_stream) {
+ fprintf(writer_component->err, "[error] %s in %s:%d\n",
+ __func__, __FILE__, __LINE__);
+ goto error;
+ }
+ fs_writer->active_streams++;
+
+ goto end;
+
+error:
+ ret = BT_COMPONENT_STATUS_ERROR;
+end:
+ bt_put(ctf_writer);
+ bt_put(stream_class);
+ return ret;
+}
+
BT_HIDDEN
enum bt_component_status writer_stream_end(
struct writer_component *writer_component,
}
break;
}
+ case BT_NOTIFICATION_TYPE_STREAM_BEGIN:
+ {
+ struct bt_ctf_stream *stream =
+ bt_notification_stream_begin_get_stream(notification);
+
+ if (!stream) {
+ ret = BT_COMPONENT_STATUS_ERROR;
+ goto end;
+ }
+ ret = writer_stream_begin(writer_component, stream);
+ bt_put(stream);
+ break;
+ }
case BT_NOTIFICATION_TYPE_STREAM_END:
{
struct bt_ctf_stream *stream =
BT_NOTIFICATION_TYPE_EVENT,
BT_NOTIFICATION_TYPE_PACKET_BEGIN,
BT_NOTIFICATION_TYPE_PACKET_END,
+ BT_NOTIFICATION_TYPE_STREAM_BEGIN,
BT_NOTIFICATION_TYPE_STREAM_END,
BT_NOTIFICATION_TYPE_SENTINEL,
};