aboutsummaryrefslogtreecommitdiff
path: root/src/im-sandbox.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2022-01-10 12:24:53 +0100
committerThomas White <taw@physics.org>2022-06-02 12:15:38 +0200
commitbe3595c63e5d310624f03be05cb2d2006c4963d2 (patch)
treeab936ffc8c8b8fb28ea2acf20388c92a83a4454e /src/im-sandbox.c
parent79f8df1c73f2cb2baab96750263bf99d89971691 (diff)
Generate placeholder filename/event earlier
Previously, a placeholder was put in the queue ("ZMQdata //" or "ASAPOdata //"), and replaced by image_read_data_block. Instead, the "final" placeholder can be put in the queue already. Note that ASAP::O, at least, will replace this placeholder with a filename delivered by the data transport.
Diffstat (limited to 'src/im-sandbox.c')
-rw-r--r--src/im-sandbox.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/im-sandbox.c b/src/im-sandbox.c
index 059f4a74..158da59b 100644
--- a/src/im-sandbox.c
+++ b/src/im-sandbox.c
@@ -482,6 +482,9 @@ static int run_work(const struct index_args *iargs, Stream *st,
&event);
if ( pargs.zmq_data != NULL ) {
ok = 1;
+
+ /* ASAP::O provides a meaningful filename, which
+ * replaces the placeholder. */
free(pargs.filename);
free(pargs.event);
pargs.filename = filename;
@@ -889,15 +892,19 @@ static int fill_queue(struct get_pattern_ctx *gpctx, struct sandbox *sb)
char *evstr;
if ( sb->zmq ) {
- /* These values will be passed down to process_image,
- * but ignored. The 'real' filename, which is still a
- * 'fake' filename - only for accounting purposes - will
- * be generated by image_read_data_block(). */
+ /* These are just semi-meaningful placeholder values to
+ * be put into the queue, instead of "(null)".
+ * A unique filename is needed so that the GUI can
+ * tell the frames apart from one another.
+ * ASAP::O, for one, will replace this with a filename
+ * that corresponds to something real. */
filename = "ZMQdata";
- evstr = strdup("//");
+ evstr = malloc(64);
+ snprintf(evstr, 64, "//%i", sb->serial);
} else if ( sb->asapo ) {
filename = "ASAPOdata";
- evstr = strdup("//");
+ evstr = malloc(64);
+ snprintf(evstr, 64, "//%i", sb->serial);
} else {
if ( !get_pattern(gpctx, &filename, &evstr) ) return 1;
}