summaryrefslogtreecommitdiffstats
path: root/cli.c
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2012-07-24 23:00:02 +0200
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2012-07-24 23:00:02 +0200
commit587863fb5bc46f225c3b192ca4c2f63e0be8613b (patch)
treebcbde6497129f4681065bbad37489ea447be6ca2 /cli.c
parent8643089a3d39b49115c547c3b9c27c0086754ec5 (diff)
downloadipecamera-587863fb5bc46f225c3b192ca4c2f63e0be8613b.tar.gz
ipecamera-587863fb5bc46f225c3b192ca4c2f63e0be8613b.tar.bz2
ipecamera-587863fb5bc46f225c3b192ca4c2f63e0be8613b.tar.xz
ipecamera-587863fb5bc46f225c3b192ca4c2f63e0be8613b.zip
Respect --format parameter in cli
Diffstat (limited to 'cli.c')
-rw-r--r--cli.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/cli.c b/cli.c
index 3fdb568..07d6cc2 100644
--- a/cli.c
+++ b/cli.c
@@ -95,6 +95,7 @@ typedef enum {
typedef enum {
+ FORMAT_DEFAULT = 0,
FORMAT_RAW,
FORMAT_HEADER,
FORMAT_RINGFS
@@ -1159,8 +1160,15 @@ int GrabCallback(pcilib_event_id_t event_id, pcilib_event_info_t *info, void *us
ctx->incomplete_count++;
return PCILIB_STREAMING_CONTINUE;
}
-
- data = pcilib_get_data(handle, event_id, ctx->data, &size);
+
+ switch (ctx->format) {
+ case FORMAT_DEFAULT:
+ data = pcilib_get_data(handle, event_id, PCILIB_EVENT_DATA, &size);
+ break;
+ default:
+ data = pcilib_get_data(handle, event_id, PCILIB_EVENT_RAW_DATA, &size);
+ }
+
if (!data) {
ctx->broken_count++;
return PCILIB_STREAMING_CONTINUE;
@@ -2126,7 +2134,7 @@ int main(int argc, char **argv) {
size_t run_time = 0;
size_t buffer = 0;
size_t threads = 1;
- FORMAT format = FORMAT_RAW;
+ FORMAT format = FORMAT_DEFAULT;
PARTITION partition = PARTITION_UNKNOWN;
FLAGS flags = 0;
const char *type = NULL;
@@ -2463,9 +2471,10 @@ int main(int argc, char **argv) {
}
break;
case OPT_FORMAT:
- if (!strcasecmp(optarg, "add_header")) format = FORMAT_HEADER;
+ if (!strcasecmp(optarg, "raw")) format = FORMAT_RAW;
+ else if (!strcasecmp(optarg, "add_header")) format = FORMAT_HEADER;
// else if (!strcasecmp(optarg, "ringfs")) format = FORMAT_RINGFS;
- else if (strcasecmp(optarg, "raw")) Error("Invalid format (%s) is specified", optarg);
+ else if (strcasecmp(optarg, "default")) Error("Invalid format (%s) is specified", optarg);
break;
case OPT_QUIETE:
quiete = 1;