Ejemplo n.º 1
0
int main(int argc, char **argv) {
    if (argc < 2 || argc > 4) {
        printf("usage: encode_file <profilename> [<input_source>]\n");
        exit(1);
    }

    FILE *input;
    if ((argc == 2) || strncmp(argv[2], "-", 2) == 0) {
        input = stdin;
    } else {
        input = fopen(argv[2], "rb");
        if (!input) {
            fprintf(stderr, "failed to open %s: ", argv[2]);
            perror(NULL);
            exit(1);
        }
    }

    quiet_encoder_options *encodeopt =
        quiet_encoder_profile_filename(QUIET_PROFILES_LOCATION, argv[1]);

    if (!encodeopt) {
        printf("failed to read profile %s from %s\n", argv[1], QUIET_PROFILES_LOCATION);
        exit(1);
    }

    encode_to_wav(input, "encoded.wav", encodeopt);

    fclose(input);
    free(encodeopt);

    return 0;
}
Ejemplo n.º 2
0
int main(int argc, char **argv) {
    if (argc < 2 || argc > 4) {
        printf("usage: encode_file <profilename> [<input_source>]\n");
        exit(1);
    }

    FILE *input;
    if ((argc == 2) || strncmp(argv[2], "-", 2) == 0) {
        input = stdin;
    } else {
        input = fopen(argv[2], "rb");
    }

    quiet_encoder_options *encodeopt =
        quiet_encoder_profile_filename(QUIET_PROFILES_LOCATION, argv[1]);

    encode_to_wav(input, "encoded.wav", encodeopt);

    fclose(input);
    free(encodeopt);

    return 0;
}