From 75a321d4c616ea914f7a7799574b2164ac41bb92 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Mon, 12 Dec 2011 15:59:26 +0100 Subject: In preprocessing mode, announce the events only after reconstruction is done --- ipecamera/events.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'ipecamera/events.c') diff --git a/ipecamera/events.c b/ipecamera/events.c index a6cf57e..032e8ed 100644 --- a/ipecamera/events.c +++ b/ipecamera/events.c @@ -48,7 +48,11 @@ int ipecamera_stream(pcilib_context_t *vctx, pcilib_event_callback_t callback, v // This loop iterates while the generation while ((run_flag)&&((ctx->run_streamer)||(ctx->reported_id != ctx->event_id))) { +#ifdef IPECAMERA_ANNOUNCE_READY + while (((!ctx->preproc)&&(ctx->reported_id != ctx->event_id))||((ctx->preproc)&&(ctx->reported_id != ctx->preproc_id))) { +#else /* IPECAMERA_ANNOUNCE_READY */ while (ctx->reported_id != ctx->event_id) { +#endif /* IPECAMERA_ANNOUNCE_READY */ if ((ctx->event_id - ctx->reported_id) > (ctx->buffer_size - IPECAMERA_RESERVE_BUFFERS)) ctx->reported_id = ctx->event_id - (ctx->buffer_size - 1) - IPECAMERA_RESERVE_BUFFERS; else ++ctx->reported_id; @@ -90,12 +94,22 @@ int ipecamera_next_event(pcilib_context_t *vctx, pcilib_timeout_t timeout, pcili return PCILIB_ERROR_INVALID_REQUEST; } +#ifdef IPECAMERA_ANNOUNCE_READY + if (((!ctx->preproc)&&(ctx->reported_id == ctx->event_id))||((ctx->preproc)&&(ctx->reported_id == ctx->preproc_id))) { +#else /* IPECAMERA_ANNOUNCE_READY */ if (ctx->reported_id == ctx->event_id) { +#endif /* IPECAMERA_ANNOUNCE_READY */ + if (timeout) { pcilib_calc_deadline(&tv, timeout); - - while ((pcilib_calc_time_to_deadline(&tv) > 0)&&(ctx->reported_id == ctx->event_id)) + +#ifdef IPECAMERA_ANNOUNCE_READY + while ((pcilib_calc_time_to_deadline(&tv) > 0)&&(((!ctx->preproc)&&(ctx->reported_id == ctx->event_id))||((ctx->preproc)&&(ctx->reported_id == ctx->preproc_id)))) { +#else /* IPECAMERA_ANNOUNCE_READY */ + while ((pcilib_calc_time_to_deadline(&tv) > 0)&&(ctx->reported_id == ctx->event_id)) { +#endif /* IPECAMERA_ANNOUNCE_READY */ usleep(IPECAMERA_NOFRAME_SLEEP); + } } if (ctx->reported_id == ctx->event_id) return PCILIB_ERROR_TIMEOUT; -- cgit v1.2.3