This commit is contained in:
tTh 2024-09-29 18:46:38 +02:00
parent d510e56d44
commit 5fbff721d8
2 changed files with 18 additions and 5 deletions

View File

@ -6,12 +6,14 @@
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
#include <string.h>
#include "../floatimg.h"
int verbosity; // nasty global var.
/* --------------------------------------------------------------------- */
/* nouveau - Mon Apr 8 11:52:18 UTC 2024 */
int copy_metadata(FloatImg *src, FloatImg *dst)
{
FimgMetaData *mdsrc, *mddst;
@ -21,7 +23,10 @@ fprintf(stderr, ">>> %s ( %p %p )\n", __func__, src, dst);
#endif
mdsrc = &(src->mdatas); mddst = &(dst->mdatas);
fprintf(stderr, "metadata copy: %p --> %p\n", mdsrc, mddst);
if (verbosity) fprintf(stderr, "%s: %p --> %p\n", __func__, mdsrc, mddst);
mdsrc->reserved[1] = 0x55555555;
memcpy(mddst, mdsrc, sizeof(FimgMetaData));
return 0;
}
@ -62,11 +67,12 @@ if (foo) {
#endif
return foo;
}
/* XXX
* may be we can also copy the metadate from src to dst ?
* with an option on the command line ?
*/
copy_metadata(&src, &dst);
foo = copy_metadata(&src, &dst);
foo = fimg_dumpmd_to_file(&dst, dstname, NULL, 0);
if (foo) {
@ -105,6 +111,7 @@ char *output_file = "out.fimg";
while ((opt = getopt(argc, argv, "ho:vx")) != -1) {
switch(opt) {
case 'h': help(); break;
case 'm': break;
case 'o': output_file = optarg; break;
case 'v': verbosity++; break;
case 'x': experiment++; break;

View File

@ -16,7 +16,7 @@
int verbosity;
enum comId { C_timestamp, C_daytime, C_count, C_fval, C_cpid, C_origin,
C_idcam, C_reserved, C_all };
C_idcam, C_reserved, C_all, C_dayhour };
typedef struct {
char *name;
@ -26,6 +26,7 @@ typedef struct {
Cmd Cmd_list[] = {
{ "timestamp", C_timestamp },
{ "daytime", C_daytime },
{ "dayhour", C_dayhour },
{ "cpid", C_cpid },
{ "count", C_count },
{ "fval", C_fval },
@ -86,6 +87,7 @@ int get_print_metadata(char *fname, char *command)
{
int foo, action;
FimgMetaData metadata;
time_t tstamp;
#if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( '%s' '%s' )\n", __func__, fname, command);
@ -98,11 +100,15 @@ if (foo) return foo;
action = lookup_cmd(command);
// fprintf(stderr, " command '%s' -> %d\n", command, action);
tstamp = metadata.timestamp.tv_sec;
switch(action) {
case C_timestamp:
printf("timestamp %ld\n", metadata.timestamp.tv_sec); break;
printf("timestamp %ld\n", tstamp); break;
case C_daytime:
printf("%s\n", ctime(&metadata.timestamp.tv_sec)); break;
printf("%s\n", ctime(&tstamp)); break;
case C_dayhour:
printf("%s\n", ctime(&tstamp)); break;
case C_count:
printf("count %d\n", metadata.count); break;
case C_fval: