BT_ASSERT(ds_file_group->sc->ir_sc);
BT_ASSERT(ctf_fs_trace->trace);
- bt_stream *stream;
+ bt2::StreamClass sc {ds_file_group->sc->ir_sc};
if (ds_file_group->stream_id == UINT64_C(-1)) {
/* No stream ID: use 0 */
- stream = bt_stream_create_with_id(ds_file_group->sc->ir_sc,
- (*ctf_fs_trace->trace)->libObjPtr(),
- ctf_fs_trace->next_stream_id);
+ ds_file_group->stream =
+ sc.instantiate(**ctf_fs_trace->trace, ctf_fs_trace->next_stream_id);
ctf_fs_trace->next_stream_id++;
} else {
/* Specific stream ID */
- stream = bt_stream_create_with_id(ds_file_group->sc->ir_sc,
- (*ctf_fs_trace->trace)->libObjPtr(),
- (uint64_t) ds_file_group->stream_id);
+ ds_file_group->stream = sc.instantiate(**ctf_fs_trace->trace, ds_file_group->stream_id);
}
- if (!stream) {
- BT_CLOGE_APPEND_CAUSE("Cannot create stream for DS file group: "
- "addr=%p, stream-name=\"%s\"",
- ds_file_group.get(), name.c_str());
- return -1;
- }
-
- ds_file_group->stream = bt2::Stream::Shared::createWithoutRef(stream);
-
int ret = bt_stream_set_name((*ds_file_group->stream)->libObjPtr(), name.c_str());
if (ret) {
BT_CLOGE_APPEND_CAUSE("Cannot set stream's name: "