summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2015-03-29 20:28:32 +0200
committerSuren A. Chilingaryan <csa@suren.me>2015-03-29 20:28:32 +0200
commit4e99cc60d3af0a1a8e195f6dd2f107f3769118e0 (patch)
tree3a3e3e02cf5c6a0d5a01044e3bf7747802e124f2
parent2f2f6779d0d960fc2a6c08a2877db06ec8802d0f (diff)
downloadipecamera-4e99cc60d3af0a1a8e195f6dd2f107f3769118e0.tar.gz
ipecamera-4e99cc60d3af0a1a8e195f6dd2f107f3769118e0.tar.bz2
ipecamera-4e99cc60d3af0a1a8e195f6dd2f107f3769118e0.tar.xz
ipecamera-4e99cc60d3af0a1a8e195f6dd2f107f3769118e0.zip
While debugging write broken frames in individual files
-rw-r--r--ipecamera/data.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/ipecamera/data.c b/ipecamera/data.c
index bdc067e..2bcccd5 100644
--- a/ipecamera/data.c
+++ b/ipecamera/data.c
@@ -64,9 +64,11 @@ inline static int ipecamera_decode_frame(ipecamera_t *ctx, pcilib_event_id_t eve
#ifdef IPECAMERA_DEBUG_BROKEN_FRAMES
char name[128];
sprintf(name, "%s/broken.%4lu", IPECAMERA_DEBUG_BROKEN_FRAMES, ctx->event_id);
- FILE *f = fopen("/mnt/frames/broken", "w");
- fwrite(ctx->buffer + buf_ptr * ctx->padded_size, ctx->raw_size, 1, f);
- fclose(f);
+ FILE *f = fopen(name, "w");
+ if (f) {
+ fwrite(ctx->buffer + buf_ptr * ctx->padded_size, ctx->raw_size, 1, f);
+ fclose(f);
+ }
#endif /* IPECAMERA_DEBUG_BROKEN_FRAMES */
err = PCILIB_ERROR_FAILED;
ctx->frame[buf_ptr].event.image_broken = err;