martin modes, and some bugfixes to get them working
This commit is contained in:
35
main.c
35
main.c
@@ -1,14 +1,41 @@
|
||||
#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 < 3) {
|
||||
printf("Usage: %s input_image output.wav\n", argv[0]);
|
||||
if (argc < 4) {
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!sstv_encode_robot36(argv[1], argv[2])) {
|
||||
printf("Encoding failed\n");
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user