/alps/ipecamera

To get this branch, use:
bzr branch http://darksoft.org/webbzr/alps/ipecamera

« back to all changes in this revision

Viewing changes to ipecamera/events.c

  • Committer: Suren A. Chilingaryan
  • Date: 2012-02-02 17:06:36 UTC
  • Revision ID: csa@dside.dyndns.org-20120202170636-nr80onjyrqfdtc71
Support infinite timeouts in the get_next_frame

Show diffs side-by-side

added added

removed removed

Lines of Context:
112
112
#endif /* IPECAMERA_ANNOUNCE_READY */
113
113
 
114
114
        if (timeout) {
115
 
            pcilib_calc_deadline(&tv, timeout);
 
115
            if (timeout == PCILIB_TIMEOUT_INFINITE) {
 
116
#ifdef IPECAMERA_ANNOUNCE_READY
 
117
                while ((((!ctx->preproc)&&(ctx->reported_id == ctx->event_id))||((ctx->preproc)&&(ctx->reported_id == ctx->preproc_id)))) {
 
118
#else /* IPECAMERA_ANNOUNCE_READY */
 
119
                while ((ctx->reported_id == ctx->event_id)) {
 
120
#endif /* IPECAMERA_ANNOUNCE_READY */
 
121
                usleep(IPECAMERA_NOFRAME_SLEEP);
 
122
                }
 
123
            } else {        
 
124
                pcilib_calc_deadline(&tv, timeout);
116
125
 
117
126
#ifdef IPECAMERA_ANNOUNCE_READY
118
 
            while ((pcilib_calc_time_to_deadline(&tv) > 0)&&(((!ctx->preproc)&&(ctx->reported_id == ctx->event_id))||((ctx->preproc)&&(ctx->reported_id == ctx->preproc_id)))) {
 
127
                while ((pcilib_calc_time_to_deadline(&tv) > 0)&&(((!ctx->preproc)&&(ctx->reported_id == ctx->event_id))||((ctx->preproc)&&(ctx->reported_id == ctx->preproc_id)))) {
119
128
#else /* IPECAMERA_ANNOUNCE_READY */
120
 
            while ((pcilib_calc_time_to_deadline(&tv) > 0)&&(ctx->reported_id == ctx->event_id)) {
 
129
                while ((pcilib_calc_time_to_deadline(&tv) > 0)&&(ctx->reported_id == ctx->event_id)) {
121
130
#endif /* IPECAMERA_ANNOUNCE_READY */
122
131
                usleep(IPECAMERA_NOFRAME_SLEEP);
 
132
                }
123
133
            }
 
134
            
124
135
        }
125
136
        
126
137
        if (ctx->reported_id == ctx->event_id) return PCILIB_ERROR_TIMEOUT;
 
138
        
127
139
    }
128
140
 
129
141
retry: