diff options
Diffstat (limited to 'ipecamera/events.c')
-rw-r--r-- | ipecamera/events.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/ipecamera/events.c b/ipecamera/events.c index 24e588a..dae71e0 100644 --- a/ipecamera/events.c +++ b/ipecamera/events.c @@ -112,18 +112,30 @@ int ipecamera_next_event(pcilib_context_t *vctx, pcilib_timeout_t timeout, pcili #endif /* IPECAMERA_ANNOUNCE_READY */ if (timeout) { - pcilib_calc_deadline(&tv, timeout); + if (timeout == PCILIB_TIMEOUT_INFINITE) { +#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 */ + usleep(IPECAMERA_NOFRAME_SLEEP); + } + } else { + pcilib_calc_deadline(&tv, timeout); #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)))) { + 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)) { + 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; + } retry: |