@@ -193,6 +193,8 @@ static void event_loop(LibcameraStillApp &app)
193
193
std::this_thread::sleep_for (10ms);
194
194
}
195
195
}
196
+ else if (options->zsl )
197
+ app.ConfigureZsl ();
196
198
else
197
199
app.ConfigureViewfinder ();
198
200
app.StartCamera ();
@@ -209,6 +211,7 @@ static void event_loop(LibcameraStillApp &app)
209
211
} af_wait_state = AF_WAIT_NONE;
210
212
int af_wait_timeout = 0 ;
211
213
214
+ bool want_capture = false ;
212
215
for (unsigned int count = 0 ;; count++)
213
216
{
214
217
LibcameraApp::Msg msg = app.Wait ();
@@ -235,7 +238,7 @@ static void event_loop(LibcameraStillApp &app)
235
238
// In viewfinder mode, run until the timeout or keypress. When that happens,
236
239
// if the "--autofocus-on-capture" option was set, trigger an AF scan and wait
237
240
// for it to complete. Then switch to capture mode if an output was requested.
238
- if (app.ViewfinderStream ())
241
+ if (app.ViewfinderStream () && !want_capture )
239
242
{
240
243
LOG (2 , " Viewfinder frame " << count);
241
244
timelapse_frames++;
@@ -244,7 +247,6 @@ static void event_loop(LibcameraStillApp &app)
244
247
bool timelapse_timed_out = options->timelapse &&
245
248
(now - timelapse_time) > options->timelapse .value &&
246
249
timelapse_frames >= TIMELAPSE_MIN_FRAMES;
247
- bool want_capture = false ;
248
250
249
251
if (af_wait_state != AF_WAIT_NONE)
250
252
{
@@ -281,43 +283,53 @@ static void event_loop(LibcameraStillApp &app)
281
283
keypressed = false ;
282
284
af_wait_state = AF_WAIT_NONE;
283
285
timelapse_time = std::chrono::high_resolution_clock::now ();
284
- app.StopCamera ();
285
- app.Teardown ();
286
- app.ConfigureStill (still_flags);
286
+ if (!options->zsl )
287
+ {
288
+ app.StopCamera ();
289
+ app.Teardown ();
290
+ app.ConfigureStill (still_flags);
291
+ }
287
292
if (options->af_on_capture )
288
293
{
289
294
libcamera::ControlList cl;
290
295
cl.set (libcamera::controls::AfMode, libcamera::controls::AfModeAuto);
291
296
cl.set (libcamera::controls::AfTrigger, libcamera::controls::AfTriggerCancel);
292
297
app.SetControls (cl);
293
298
}
294
- app.StartCamera ();
299
+ if (!options->zsl )
300
+ app.StartCamera ();
295
301
}
296
302
else
297
303
app.ShowPreview (completed_request, app.ViewfinderStream ());
298
304
}
299
305
// In still capture mode, save a jpeg. Go back to viewfinder if in timelapse mode,
300
306
// otherwise quit.
301
- else if (app.StillStream ())
307
+ else if (app.StillStream () && want_capture )
302
308
{
303
- app.StopCamera ();
309
+ want_capture = false ;
310
+ if (!options->zsl )
311
+ app.StopCamera ();
304
312
LOG (1 , " Still capture image received" );
305
313
save_images (app, completed_request);
306
314
if (!options->metadata .empty ())
307
315
save_metadata (options, completed_request->metadata );
308
316
timelapse_frames = 0 ;
309
317
if (!options->immediate && (options->timelapse || options->signal || options->keypress ))
310
318
{
311
- app.Teardown ();
312
- app.ConfigureViewfinder ();
319
+ if (!options->zsl )
320
+ {
321
+ app.Teardown ();
322
+ app.ConfigureViewfinder ();
323
+ }
313
324
if (options->af_on_capture && options->afMode_index == -1 )
314
325
{
315
326
libcamera::ControlList cl;
316
327
cl.set (libcamera::controls::AfMode, libcamera::controls::AfModeAuto);
317
328
cl.set (libcamera::controls::AfTrigger, libcamera::controls::AfTriggerCancel);
318
329
app.SetControls (cl);
319
330
}
320
- app.StartCamera ();
331
+ if (!options->zsl )
332
+ app.StartCamera ();
321
333
af_wait_state = AF_WAIT_NONE;
322
334
}
323
335
else
0 commit comments