45 lines
1.1 KiB
C
45 lines
1.1 KiB
C
#include "sstv.h"
|
|
#include "martin.h"
|
|
#include <stdio.h>
|
|
#include <string.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");
|
|
}
|
|
|
|
int main(int argc, char **argv) {
|
|
if (argc < 4) {
|
|
usage(argv[0]);
|
|
return 1;
|
|
}
|
|
|
|
const char *mode_str = argv[1];
|
|
const char *input_img = argv[2];
|
|
const char *output_wav = argv[3];
|
|
int ok = 0;
|
|
|
|
if (strcmp(mode_str, "robot36") == 0) {
|
|
ok = sstv_encode_robot36(input_img, output_wav);
|
|
} else if (strcmp(mode_str, "martin1") == 0) {
|
|
ok = sstv_encode_martin(input_img, output_wav, &MARTIN_M1);
|
|
} else if (strcmp(mode_str, "martin2") == 0) {
|
|
ok = sstv_encode_martin(input_img, output_wav, &MARTIN_M2);
|
|
} else {
|
|
fprintf(stderr, "Unknown mode: %s\n", mode_str);
|
|
usage(argv[0]);
|
|
return 1;
|
|
}
|
|
|
|
if (!ok) {
|
|
fprintf(stderr, "Encoding failed.\n");
|
|
return 1;
|
|
}
|
|
|
|
printf("Done.\n");
|
|
return 0;
|
|
}
|