/alps/pcitool

To get this branch, use:
bzr branch http://suren.me/webbzr/alps/pcitool

« back to all changes in this revision

Viewing changes to ipecamera/events.c

  • Committer: Suren A. Chilingaryan
  • Date: 2011-12-12 14:27:13 UTC
  • Revision ID: csa@dside.dyndns.org-20111212142713-xwpcvv6j5d3zmnvx
Minor fixes and improvements

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#include "events.h"
22
22
 
23
23
int ipecamera_stream(pcilib_context_t *vctx, pcilib_event_callback_t callback, void *user) {
 
24
    int run_flag = 1;
24
25
    int res, err = 0;
25
26
    int do_stop = 0;
26
27
    
46
47
    }
47
48
    
48
49
        // This loop iterates while the generation
49
 
    while ((ctx->run_streamer)||(ctx->reported_id != ctx->event_id)) {
 
50
    while ((run_flag)&&((ctx->run_streamer)||(ctx->reported_id != ctx->event_id))) {
50
51
        while (ctx->reported_id != ctx->event_id) {
51
52
            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;
52
53
            else ++ctx->reported_id;
57
58
                res = callback(ctx->reported_id, (pcilib_event_info_t*)&info, user);
58
59
                if (res <= 0) {
59
60
                    if (res < 0) err = -res;
 
61
                    run_flag = 0;
60
62
                    break;
61
63
                }
62
64
            }