scottie modes added ; with dayton paper copy
This commit is contained in:
53
main.c
53
main.c
@@ -1,44 +1,69 @@
|
||||
#include "sstv.h"
|
||||
#include "martin.h"
|
||||
#include "scottie.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
static void usage(const char *prog) {
|
||||
printf("Usage: %s <mode> input_image output.wav\n", prog);
|
||||
printf("Modes:\n");
|
||||
printf(" robot36 - Robot 36 (default)\n");
|
||||
printf(" martin1 - Martin M1\n");
|
||||
printf(" martin2 - Martin M2\n");
|
||||
fprintf(stderr,
|
||||
"Usage: %s <mode> <input_image> <output_wav>\n"
|
||||
"\n"
|
||||
"Modes:\n"
|
||||
" robot36 Robot 36 (320x240)\n"
|
||||
" martin1 Martin M1 (320x256)\n"
|
||||
" martin2 Martin M2 (320x256)\n"
|
||||
" scottie1 Scottie S1 (320x256)\n"
|
||||
" scottie2 Scottie S2 (320x256)\n"
|
||||
" scottiedx Scottie DX (320x256)\n"
|
||||
"\n"
|
||||
"Example:\n"
|
||||
" %s mode photo.jpg output.wav\n",
|
||||
prog, prog);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
if (argc < 4) {
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc != 4) {
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char *mode_str = argv[1];
|
||||
const char *mode = argv[1];
|
||||
const char *input_img = argv[2];
|
||||
const char *output_wav = argv[3];
|
||||
|
||||
clock_t start = clock();
|
||||
|
||||
int ok = 0;
|
||||
|
||||
if (strcmp(mode_str, "robot36") == 0) {
|
||||
if (strcmp(mode, "robot36") == 0) {
|
||||
ok = sstv_encode_robot36(input_img, output_wav);
|
||||
} else if (strcmp(mode_str, "martin1") == 0) {
|
||||
} else if (strcmp(mode, "martin1") == 0) {
|
||||
ok = sstv_encode_martin(input_img, output_wav, &MARTIN_M1);
|
||||
} else if (strcmp(mode_str, "martin2") == 0) {
|
||||
} else if (strcmp(mode, "martin2") == 0) {
|
||||
ok = sstv_encode_martin(input_img, output_wav, &MARTIN_M2);
|
||||
} else if (strcmp(mode, "scottie1") == 0) {
|
||||
ok = sstv_encode_scottie(input_img, output_wav, &SCOTTIE_S1);
|
||||
} else if (strcmp(mode, "scottie2") == 0) {
|
||||
ok = sstv_encode_scottie(input_img, output_wav, &SCOTTIE_S2);
|
||||
} else if (strcmp(mode, "scottiedx") == 0) {
|
||||
ok = sstv_encode_scottie(input_img, output_wav, &SCOTTIE_DX);
|
||||
} else {
|
||||
fprintf(stderr, "Unknown mode: %s\n", mode_str);
|
||||
fprintf(stderr, "unknown mode: %s\n\n", mode);
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!ok) {
|
||||
fprintf(stderr, "Encoding failed.\n");
|
||||
fprintf(stderr, "make sure the file exsists");
|
||||
return 1;
|
||||
}
|
||||
|
||||
printf("Done.\n");
|
||||
clock_t end = clock();
|
||||
|
||||
double elapsed = (double)(end - start) / CLOCKS_PER_SEC;
|
||||
|
||||
printf("encoded '%s' -> '%s' using '%s'\n", input_img, output_wav, mode);
|
||||
printf("took %.3f seconds\n", elapsed);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user