|
@@ -61,7 +61,7 @@ static SNDFILE *audioFile; |
|
|
// Number of channels in audio file |
|
|
// Number of channels in audio file |
|
|
int channels = 1; |
|
|
int channels = 1; |
|
|
|
|
|
|
|
|
// Function predeclarations |
|
|
|
|
|
|
|
|
// Function declarations |
|
|
static int initsnd(char *filename); |
|
|
static int initsnd(char *filename); |
|
|
int getsample(float *sample, int nb); |
|
|
int getsample(float *sample, int nb); |
|
|
static int processAudio(char *filename, options_t *opts); |
|
|
static int processAudio(char *filename, options_t *opts); |
|
@@ -76,11 +76,11 @@ int main(int argc, char **argv) { |
|
|
usage(); |
|
|
usage(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
options_t opts = { "r", "", 19, "", ".", 0 }; |
|
|
|
|
|
|
|
|
options_t opts = { "r", "", 19, "", ".", 0, "" }; |
|
|
|
|
|
|
|
|
// Parse arguments |
|
|
// Parse arguments |
|
|
int opt; |
|
|
int opt; |
|
|
while ((opt = getopt(argc, argv, "m:d:i:s:e:r")) != EOF) { |
|
|
|
|
|
|
|
|
while ((opt = getopt(argc, argv, "o:m:d:i:s:e:r")) != EOF) { |
|
|
switch (opt) { |
|
|
switch (opt) { |
|
|
case 'd': |
|
|
case 'd': |
|
|
opts.path = optarg; |
|
|
opts.path = optarg; |
|
@@ -104,6 +104,9 @@ int main(int argc, char **argv) { |
|
|
case 'r': |
|
|
case 'r': |
|
|
opts.realtime = 1; |
|
|
opts.realtime = 1; |
|
|
break; |
|
|
break; |
|
|
|
|
|
case 'o': |
|
|
|
|
|
opts.filename = optarg; |
|
|
|
|
|
break; |
|
|
default: |
|
|
default: |
|
|
usage(); |
|
|
usage(); |
|
|
} |
|
|
} |
|
@@ -139,14 +142,15 @@ static int processAudio(char *filename, options_t *opts){ |
|
|
strcpy(path, dirname(path)); |
|
|
strcpy(path, dirname(path)); |
|
|
sscanf(basename(filename), "%[^.].%s", img.name, extension); |
|
|
sscanf(basename(filename), "%[^.].%s", img.name, extension); |
|
|
|
|
|
|
|
|
// Set output filename to current time when in realtime mode |
|
|
|
|
|
if(opts->realtime){ |
|
|
if(opts->realtime){ |
|
|
|
|
|
// Set output filename to current time when in realtime mode |
|
|
time_t t; |
|
|
time_t t; |
|
|
time(&t); |
|
|
time(&t); |
|
|
strncpy(img.name, ctime(&t), 24); |
|
|
strncpy(img.name, ctime(&t), 24); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(opts->realtime) initWriter(opts, &img, IMG_WIDTH, MAX_HEIGHT, "Unprocessed realtime image", "r"); |
|
|
|
|
|
|
|
|
// Init a row writer |
|
|
|
|
|
initWriter(opts, &img, IMG_WIDTH, MAX_HEIGHT, "Unprocessed realtime image", "r"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
if(strcmp(extension, "png") == 0){ |
|
|
if(strcmp(extension, "png") == 0){ |
|
|
// Read PNG into image buffer |
|
|
// Read PNG into image buffer |
|
@@ -185,7 +189,7 @@ static int processAudio(char *filename, options_t *opts){ |
|
|
printf("Total rows: %d\n", img.nrow); |
|
|
printf("Total rows: %d\n", img.nrow); |
|
|
|
|
|
|
|
|
// Fallback for detecting the zenith |
|
|
// Fallback for detecting the zenith |
|
|
// TODO: encode zenith in raw images |
|
|
|
|
|
|
|
|
// TODO: encode metadata in raw images |
|
|
if(opts->map != NULL && opts->map[0] != '\0' && zenith == 0){ |
|
|
if(opts->map != NULL && opts->map[0] != '\0' && zenith == 0){ |
|
|
fprintf(stderr, "Guessing zenith in image, map will most likely be misaligned.\n"); |
|
|
fprintf(stderr, "Guessing zenith in image, map will most likely be misaligned.\n"); |
|
|
zenith = img.nrow / 2; |
|
|
zenith = img.nrow / 2; |
|
@@ -258,7 +262,7 @@ static int processAudio(char *filename, options_t *opts){ |
|
|
ImageOut(opts, &img, CHB_OFFSET, CH_WIDTH, desc, ch.id[img.chB], NULL); |
|
|
ImageOut(opts, &img, CHB_OFFSET, CH_WIDTH, desc, ch.id[img.chB], NULL); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Distribution image |
|
|
|
|
|
|
|
|
// Value distribution image |
|
|
if (CONTAINS(opts->type, 'd')) |
|
|
if (CONTAINS(opts->type, 'd')) |
|
|
distrib(opts, &img, "d"); |
|
|
distrib(opts, &img, "d"); |
|
|
|
|
|
|
|
@@ -326,10 +330,11 @@ static void usage(void) { |
|
|
" c: False color\n" |
|
|
" c: False color\n" |
|
|
" t: Temperature\n" |
|
|
" t: Temperature\n" |
|
|
" m: MCIR\n" |
|
|
" m: MCIR\n" |
|
|
" -d <dir> Image destination directory.\n" |
|
|
|
|
|
" -s [15-19] Satellite number\n" |
|
|
|
|
|
" -m <file> Map file\n" |
|
|
|
|
|
" -r Realtime decode\n" |
|
|
|
|
|
|
|
|
" -d <dir> Image destination directory.\n" |
|
|
|
|
|
" -o <name> Output filename\n" |
|
|
|
|
|
" -s [15-19] Satellite number\n" |
|
|
|
|
|
" -m <file> Map file\n" |
|
|
|
|
|
" -r Realtime decode\n" |
|
|
"\nRefer to the README for more infomation\n"); |
|
|
"\nRefer to the README for more infomation\n"); |
|
|
|
|
|
|
|
|
exit(EINVAL); |
|
|
exit(EINVAL); |
|
|