diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-12-09 08:12:29 +0100 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-12-09 08:12:29 +0100 |
commit | de31339c3382d32be9c4440466b1d01e40e0d0b3 (patch) | |
tree | e213d5552b9d744761b280f5512d45d3d6323729 /ipecamera | |
parent | 0588002d470caf396a09470d077f4f91a6020f7b (diff) | |
download | pcitool-de31339c3382d32be9c4440466b1d01e40e0d0b3.tar.gz pcitool-de31339c3382d32be9c4440466b1d01e40e0d0b3.tar.bz2 pcitool-de31339c3382d32be9c4440466b1d01e40e0d0b3.tar.xz pcitool-de31339c3382d32be9c4440466b1d01e40e0d0b3.zip |
Few fixes
Diffstat (limited to 'ipecamera')
-rw-r--r-- | ipecamera/image.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ipecamera/image.c b/ipecamera/image.c index 3b3c9df..89e02a7 100644 --- a/ipecamera/image.c +++ b/ipecamera/image.c @@ -365,7 +365,8 @@ static int ipecamera_resolve_event_id(ipecamera_t *ctx, pcilib_event_id_t evid) } static inline int ipecamera_new_frame(ipecamera_t *ctx) { - ctx->frame_info[ctx->buffer_pos].raw_size =ctx->cur_size; + ctx->frame_info[ctx->buffer_pos].raw_size = ctx->cur_size; + if (ctx->cur_size < ctx->raw_size) ctx->frame_info[ctx->buffer_pos].info.flags |= PCILIB_EVENT_INFO_FLAG_BROKEN; ctx->buffer_pos = (++ctx->event_id) % ctx->buffer_size; @@ -799,7 +800,7 @@ int ipecamera_stream(pcilib_context_t *vctx, pcilib_event_callback_t callback, v 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; - callback(ctx->reported_id, (pcilib_event_info_t*)(ctx->frame_info + (ctx->reported_id%ctx->buffer_size)), user); + callback(ctx->reported_id, (pcilib_event_info_t*)(ctx->frame_info + ((ctx->reported_id-1)%ctx->buffer_size)), user); } usleep(IPECAMERA_NOFRAME_SLEEP); } @@ -843,7 +844,10 @@ int ipecamera_next_event(pcilib_context_t *vctx, pcilib_event_t event_mask, pcil 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; - return ctx->reported_id; + if (evid) *evid = ctx->reported_id; + if (info) *info = (pcilib_event_info_t*)(ctx->frame_info + ((ctx->reported_id-1)%ctx->buffer_size)); + + return 0; } |