+ /* Output timestamp of subsequent signal changes. */
+ if (!timestamp_written)
+ g_string_append_printf(*out, "#%.0f",
+ (double)ctx->samplecount /
+ ctx->samplerate * ctx->period);
+
+ /* Output which signal changed to which value. */
+ g_string_append_c(*out, ' ');
+ g_string_append_c(*out, '0' + curbit);
+ g_string_append_c(*out, '!' + p);
+
+ timestamp_written = TRUE;
+ }
+
+ if (timestamp_written)
+ g_string_append_c(*out, '\n');
+
+ ctx->samplecount++;
+ memcpy(ctx->prevsample, sample, logic->unitsize);
+ }
+ break;
+ case SR_DF_END:
+ /* Write final timestamp as length indicator. */
+ *out = g_string_sized_new(512);
+ g_string_printf(*out, "#%.0f\n",
+ (double)ctx->samplecount / ctx->samplerate * ctx->period);
+ break;