summaryrefslogtreecommitdiffstats
path: root/ipecamera/events.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2011-12-12 15:59:26 +0100
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2011-12-12 15:59:26 +0100
commit75a321d4c616ea914f7a7799574b2164ac41bb92 (patch)
tree55b756709acec48f974b7a0ed6d46baad80f03b0 /ipecamera/events.c
parentd2dc73cab5b1c08822ce0066251e362f01525f10 (diff)
downloadipecamera-75a321d4c616ea914f7a7799574b2164ac41bb92.tar.gz
ipecamera-75a321d4c616ea914f7a7799574b2164ac41bb92.tar.bz2
ipecamera-75a321d4c616ea914f7a7799574b2164ac41bb92.tar.xz
ipecamera-75a321d4c616ea914f7a7799574b2164ac41bb92.zip
In preprocessing mode, announce the events only after reconstruction is done
Diffstat (limited to 'ipecamera/events.c')
-rw-r--r--ipecamera/events.c18
1 files changed, 16 insertions, 2 deletions
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;