#include "sstv.h" #include "martin.h" #include "scottie.h" #include #include #include static void usage(const char *prog) { fprintf(stderr, "Usage: %s \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) { usage(argv[0]); return 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, "robot36") == 0) { ok = sstv_encode_robot36(input_img, output_wav); } else if (strcmp(mode, "martin1") == 0) { ok = sstv_encode_martin(input_img, output_wav, &MARTIN_M1); } 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\n", mode); usage(argv[0]); return 1; } if (!ok) { fprintf(stderr, "make sure the file exsists"); return 1; } 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; }