summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2011-12-13 18:38:03 +0100
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2011-12-13 18:38:03 +0100
commit5af397b0053c32b96b4b83767ddefc22d1fd09f2 (patch)
treec3862159a4db79041175bc20c60d756029cd2470
parent1636d4d6945a20c62683b69c69c6b16e0c63b0ca (diff)
downloadipecamera-5af397b0053c32b96b4b83767ddefc22d1fd09f2.tar.gz
ipecamera-5af397b0053c32b96b4b83767ddefc22d1fd09f2.tar.bz2
ipecamera-5af397b0053c32b96b4b83767ddefc22d1fd09f2.tar.xz
ipecamera-5af397b0053c32b96b4b83767ddefc22d1fd09f2.zip
Send padding data to rawdata_callback
-rw-r--r--ipecamera/reader.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/ipecamera/reader.c b/ipecamera/reader.c
index 587fc19..9be6533 100644
--- a/ipecamera/reader.c
+++ b/ipecamera/reader.c
@@ -51,6 +51,7 @@ static int ipecamera_data_callback(void *user, pcilib_dma_flags_t flags, size_t
int eof = 0;
#ifdef IPECAMERA_BUG_MULTIFRAME_PACKETS
+ size_t real_size;
size_t extra_data = 0;
#endif /* IPECAMERA_BUG_MULTIFRAME_PACKETS */
@@ -64,6 +65,16 @@ static int ipecamera_data_callback(void *user, pcilib_dma_flags_t flags, size_t
}
if (startpos) {
+ // pass padding to rawdata callback
+ if (ctx->event.params.rawdata.callback) {
+ res = ctx->event.params.rawdata.callback(0, NULL, PCILIB_EVENT_FLAG_RAW_DATA_ONLY, startpos, buf, ctx->event.params.rawdata.user);
+ if (res <= 0) {
+ if (res < 0) return res;
+ ctx->run_reader = 0;
+ }
+ }
+
+
buf += startpos;
bufsize -= startpos;
}
@@ -85,6 +96,9 @@ static int ipecamera_data_callback(void *user, pcilib_dma_flags_t flags, size_t
}
#ifdef IPECAMERA_BUG_MULTIFRAME_PACKETS
+ // for rawdata_callback with complete padding
+ real_size = bufsize;
+
if (ctx->cur_size + bufsize > ctx->raw_size) {
size_t need;
@@ -118,7 +132,11 @@ static int ipecamera_data_callback(void *user, pcilib_dma_flags_t flags, size_t
if (ctx->cur_size >= ctx->full_size) eof = 1;
if (ctx->event.params.rawdata.callback) {
+#ifdef IPECAMERA_BUG_MULTIFRAME_PACKETS
+ res = ctx->event.params.rawdata.callback(ctx->event_id, (pcilib_event_info_t*)(ctx->frame + ctx->buffer_pos), (eof?PCILIB_EVENT_FLAG_EOF:PCILIB_EVENT_FLAGS_DEFAULT), real_size, buf, ctx->event.params.rawdata.user);
+#else /* IPECAMERA_BUG_MULTIFRAME_PACKETS */
res = ctx->event.params.rawdata.callback(ctx->event_id, (pcilib_event_info_t*)(ctx->frame + ctx->buffer_pos), (eof?PCILIB_EVENT_FLAG_EOF:PCILIB_EVENT_FLAGS_DEFAULT), bufsize, buf, ctx->event.params.rawdata.user);
+#endif /* IPECAMERA_BUG_MULTIFRAME_PACKETS */
if (res <= 0) {
if (res < 0) return res;
ctx->run_reader = 0;