forked from tTh/FloatImg
more fun with metadata
This commit is contained in:
parent
263e254980
commit
4dcc524fc4
@ -32,8 +32,10 @@ int fimg_show_metadata(FimgMetaData *pmd, char *title, int notused)
|
||||
int foo;
|
||||
double doubletime;
|
||||
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( %p '%s' 0x%08x )\n", __func__,
|
||||
pmd, title, notused);
|
||||
#endif
|
||||
|
||||
if (verbosity) {
|
||||
fprintf(stderr, "sizeof(metadata) = %ld\n", \
|
||||
@ -78,7 +80,10 @@ if (foo) {
|
||||
perror("omg");
|
||||
}
|
||||
else {
|
||||
fprintf(stderr, "Time of day %12ld %12ld\n", tvl.tv_sec, tvl.tv_usec);
|
||||
if (verbosity) {
|
||||
fprintf(stderr, "Time of day %12ld %12ld\n", \
|
||||
tvl.tv_sec, tvl.tv_usec);
|
||||
}
|
||||
memcpy(&(pmd->timestamp), &tvl, sizeof(struct timeval));
|
||||
}
|
||||
|
||||
@ -86,7 +91,7 @@ pmd->cpid = getpid();
|
||||
pmd->count = 0;
|
||||
pmd->fval = 255.0;
|
||||
strcpy(pmd->idcam, "<unknow>");
|
||||
pmd->origin = 0x55555555;
|
||||
pmd->origin = 0xdeadbeef;
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -98,9 +103,9 @@ FimgFileHead filehead;
|
||||
FimgMetaData metadata;
|
||||
int foo;
|
||||
|
||||
// #if DEBUG_LEVEL
|
||||
#if DEBUG_LEVEL
|
||||
fprintf(stderr, ">>> %s ( '%s' %p )\n", __func__, fname, pmd);
|
||||
// #endif
|
||||
#endif
|
||||
|
||||
if (NULL==(fp=fopen(fname, "r"))) {
|
||||
perror(fname);
|
||||
|
3
lib/t.c
3
lib/t.c
@ -28,6 +28,9 @@ foo = fimg_default_metadata(&Md);
|
||||
|
||||
foo = fimg_get_metadata_from_file(fname, &Md);
|
||||
fprintf(stderr, "%s : get metadata -> %d\n", fname, foo);
|
||||
if (foo) {
|
||||
return foo;
|
||||
}
|
||||
|
||||
foo = fimg_show_metadata(&Md, fname, 0);
|
||||
|
||||
|
@ -14,7 +14,8 @@
|
||||
int verbosity;
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
enum comId { C_timestamp, C_count, C_fval, C_cpid, C_origin, C_all };
|
||||
enum comId { C_timestamp, C_count, C_fval, C_cpid, C_origin,
|
||||
C_idcam, C_all };
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
@ -27,6 +28,7 @@ Cmd Cmd_list[] = {
|
||||
{ "count", C_count },
|
||||
{ "fval", C_fval },
|
||||
{ "origin", C_origin },
|
||||
{ "idcam", C_idcam },
|
||||
{ "all", C_all },
|
||||
{ NULL, 0, }
|
||||
};
|
||||
@ -78,6 +80,10 @@ switch(action) {
|
||||
printf("fval %f\n", metadata.fval); break;
|
||||
case C_cpid:
|
||||
printf("cpid %ld\n", metadata.cpid); break;
|
||||
case C_origin:
|
||||
printf("origin 0x%x\n", metadata.origin); break;
|
||||
case C_idcam:
|
||||
printf("camid \"%s\"\n", metadata.idcam); break;
|
||||
case C_all:
|
||||
fimg_show_metadata(&metadata, fname, 0); break;
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user