forked from tTh/FloatImg
cosmetic
This commit is contained in:
parent
d510e56d44
commit
5fbff721d8
@ -6,12 +6,14 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#include "../floatimg.h"
|
#include "../floatimg.h"
|
||||||
|
|
||||||
int verbosity; // nasty global var.
|
int verbosity; // nasty global var.
|
||||||
|
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
|
/* nouveau - Mon Apr 8 11:52:18 UTC 2024 */
|
||||||
int copy_metadata(FloatImg *src, FloatImg *dst)
|
int copy_metadata(FloatImg *src, FloatImg *dst)
|
||||||
{
|
{
|
||||||
FimgMetaData *mdsrc, *mddst;
|
FimgMetaData *mdsrc, *mddst;
|
||||||
@ -21,7 +23,10 @@ fprintf(stderr, ">>> %s ( %p %p )\n", __func__, src, dst);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
mdsrc = &(src->mdatas); mddst = &(dst->mdatas);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -62,11 +67,12 @@ if (foo) {
|
|||||||
#endif
|
#endif
|
||||||
return foo;
|
return foo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX
|
/* XXX
|
||||||
* may be we can also copy the metadate from src to dst ?
|
* may be we can also copy the metadate from src to dst ?
|
||||||
* with an option on the command line ?
|
* 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);
|
foo = fimg_dumpmd_to_file(&dst, dstname, NULL, 0);
|
||||||
if (foo) {
|
if (foo) {
|
||||||
@ -105,6 +111,7 @@ char *output_file = "out.fimg";
|
|||||||
while ((opt = getopt(argc, argv, "ho:vx")) != -1) {
|
while ((opt = getopt(argc, argv, "ho:vx")) != -1) {
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
case 'h': help(); break;
|
case 'h': help(); break;
|
||||||
|
case 'm': break;
|
||||||
case 'o': output_file = optarg; break;
|
case 'o': output_file = optarg; break;
|
||||||
case 'v': verbosity++; break;
|
case 'v': verbosity++; break;
|
||||||
case 'x': experiment++; break;
|
case 'x': experiment++; break;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
int verbosity;
|
int verbosity;
|
||||||
|
|
||||||
enum comId { C_timestamp, C_daytime, C_count, C_fval, C_cpid, C_origin,
|
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 {
|
typedef struct {
|
||||||
char *name;
|
char *name;
|
||||||
@ -26,6 +26,7 @@ typedef struct {
|
|||||||
Cmd Cmd_list[] = {
|
Cmd Cmd_list[] = {
|
||||||
{ "timestamp", C_timestamp },
|
{ "timestamp", C_timestamp },
|
||||||
{ "daytime", C_daytime },
|
{ "daytime", C_daytime },
|
||||||
|
{ "dayhour", C_dayhour },
|
||||||
{ "cpid", C_cpid },
|
{ "cpid", C_cpid },
|
||||||
{ "count", C_count },
|
{ "count", C_count },
|
||||||
{ "fval", C_fval },
|
{ "fval", C_fval },
|
||||||
@ -86,6 +87,7 @@ int get_print_metadata(char *fname, char *command)
|
|||||||
{
|
{
|
||||||
int foo, action;
|
int foo, action;
|
||||||
FimgMetaData metadata;
|
FimgMetaData metadata;
|
||||||
|
time_t tstamp;
|
||||||
|
|
||||||
#if DEBUG_LEVEL
|
#if DEBUG_LEVEL
|
||||||
fprintf(stderr, ">>> %s ( '%s' '%s' )\n", __func__, fname, command);
|
fprintf(stderr, ">>> %s ( '%s' '%s' )\n", __func__, fname, command);
|
||||||
@ -98,11 +100,15 @@ if (foo) return foo;
|
|||||||
action = lookup_cmd(command);
|
action = lookup_cmd(command);
|
||||||
// fprintf(stderr, " command '%s' -> %d\n", command, action);
|
// fprintf(stderr, " command '%s' -> %d\n", command, action);
|
||||||
|
|
||||||
|
tstamp = metadata.timestamp.tv_sec;
|
||||||
|
|
||||||
switch(action) {
|
switch(action) {
|
||||||
case C_timestamp:
|
case C_timestamp:
|
||||||
printf("timestamp %ld\n", metadata.timestamp.tv_sec); break;
|
printf("timestamp %ld\n", tstamp); break;
|
||||||
case C_daytime:
|
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:
|
case C_count:
|
||||||
printf("count %d\n", metadata.count); break;
|
printf("count %d\n", metadata.count); break;
|
||||||
case C_fval:
|
case C_fval:
|
||||||
|
Loading…
Reference in New Issue
Block a user