+ fs_writer->stream_states = g_hash_table_new_full(g_direct_hash,
+ g_direct_equal, NULL, destroy_stream_state_key);
+
+ /* Set all the existing streams in the unknown state. */
+ nr_stream = bt_ctf_trace_get_stream_count(trace);
+ for (i = 0; i < nr_stream; i++) {
+ enum fs_writer_stream_state *v;
+
+ stream = bt_ctf_trace_get_stream_by_index(trace, i);
+ if (!stream) {
+ fprintf(writer_component->err,
+ "[error] %s in %s:%d\n", __func__,
+ __FILE__, __LINE__);
+ goto error;
+ }
+
+ v = g_new0(enum fs_writer_stream_state, 1);
+ if (!v) {
+ fprintf(writer_component->err,
+ "[error] %s in %s:%d\n", __func__,
+ __FILE__, __LINE__);
+ goto error;
+ }
+ *v = FS_WRITER_UNKNOWN_STREAM;
+
+ g_hash_table_insert(fs_writer->stream_states, stream, v);
+ BT_PUT(stream);
+ }
+
+ /* Check if the trace is already static or register a listener. */