/* usage_short() Display the short usage information */ static void usage_short() { /* print a bit of info about the program */ fprintf(stderr, "TwoLAME version %s (%s)\n", get_twolame_version(), get_twolame_url()); fprintf(stderr, "MPEG Audio Layer II (MP2) encoder\n\n"); fprintf(stderr, "Usage: twolame [options] <infile> [outfile]\n\n"); fprintf(stderr, "Try \"twolame --help\" for more information.\n"); exit(ERR_NO_ENCODE); }
/* usage_long() Display the extended usage information */ static void usage_long() { fprintf(stdout, "TwoLAME version %s (%s)\n", get_twolame_version(), get_twolame_url()); fprintf(stdout, "MPEG Audio Layer II (MP2) encoder\n"); fprintf(stdout, "Usage: \n"); fprintf(stdout, "\ttwolame [options] <infile> [outfile]\n"); fprintf(stdout, "\n"); fprintf(stdout, "Both input and output filenames can be set to - to use stdin/stdout.\n"); fprintf(stdout, " <infile> input sound file (any format supported by libsndfile)\n"); fprintf(stdout, " <outfile> output bit stream of encoded audio\n"); fprintf(stdout, "\nInput Options\n"); fprintf(stdout, "\t-r, --raw-input input is raw 16-bit signed PCM audio\n"); fprintf(stdout, "\t-x, --byte-swap force byte-swapping of input\n"); fprintf(stdout, "\t-s, --samplerate srate sampling frequency of raw input (kHz)\n"); fprintf(stdout, "\t-N, --channels nch number of channels in raw input\n"); fprintf(stdout, "\t-g, --swap-channels swap channels of input file\n"); fprintf(stdout, "\t --scale value scale input (multiply PCM data)\n"); fprintf(stdout, "\t --scale-l value scale channel 0 (left) input\n"); fprintf(stdout, "\t --scale-r value scale channel 1 (right) input\n"); fprintf(stdout, "\nOutput Options\n"); fprintf(stdout, "\t-m, --mode mode (s)tereo, (j)oint, (m)ono or (a)uto\n"); fprintf(stdout, "\t-a, --downmix downmix from stereo to mono file for mono encoding\n"); fprintf(stdout, "\t-b, --bitrate br total bitrate in kbps (default 192 for 44.1kHz)\n"); fprintf(stdout, "\t-P, --psyc-mode psyc psychoacoustic model -1 to 3 (default 3)\n"); fprintf(stdout, "\t-v, --vbr enable VBR mode\n"); fprintf(stdout, "\t-V, --vbr-level lev enable VBR and set VBR level -50 to 50 (default 5)\n"); fprintf(stdout, "\t-B, --max-bitrate rate set the upper bitrate when in VBR mode\n"); fprintf(stdout, "\t-l, --ath lev ATH level (default 0)\n"); fprintf(stdout, "\t-q, --quick num only calculate psy model every num frames\n"); fprintf(stdout, "\t-S, --single-frame only encode a single frame of MPEG Audio\n"); fprintf(stdout, "\nMiscellaneous Options\n"); fprintf(stdout, "\t-c, --copyright mark as copyright\n"); fprintf(stdout, "\t-o, --non-original mark as non-original\n"); fprintf(stdout, "\t --original mark as original (default)\n"); fprintf(stdout, "\t-p, --protect enable CRC error protection\n"); fprintf(stdout, "\t-d, --padding force padding bit/frame on\n"); fprintf(stdout, "\t-R, --reserve-bits num set number of reserved bits in each frame\n"); fprintf(stdout, "\t-e, --deemphasis emp de-emphasis n/5/c (default: (n)one)\n"); fprintf(stdout, "\t-E, --energy turn on energy level extensions\n"); fprintf(stdout, "\nVerbosity Options\n"); fprintf(stdout, "\t-t, --talkativity num talkativity 0-10 (default is 2)\n"); fprintf(stdout, "\t --quiet same as --talkativity=0\n"); fprintf(stdout, "\t --brief same as --talkativity=1\n"); fprintf(stdout, "\t --verbose same as --talkativity=4\n"); fprintf(stdout, "\n"); fprintf(stdout, "\nAllowable bitrates for 32, 44.1 and 48kHz sample input (MPEG-1)\n"); fprintf(stdout, " 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384\n"); fprintf(stdout, "\nAllowable bitrates for 16, 22.05 and 24kHz sample input (MPEG-2)\n"); fprintf(stdout, " 8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160\n"); fprintf(stdout, "\n"); exit(ERR_NO_ENCODE); }
// Print the library version and // encoder parameter settings to STDERR void twolame_print_config(twolame_options *glopts) { FILE* fd = stderr; // Are we being silent ? if (glopts->verbosity<=0) return; // Are we being brief ? if (glopts->verbosity==1) { fprintf(fd, "LibTwoLame version %s (%s)\n", get_twolame_version(), get_twolame_url()); fprintf (fd, "Encoding as %dHz, ", twolame_get_out_samplerate(glopts)); fprintf (fd, "%d kbps, ", twolame_get_bitrate(glopts) ); if (twolame_get_VBR(glopts)) fprintf (fd, "VBR, " ); else fprintf (fd, "CBR, " ); fprintf (fd, "%s Layer II\n", twolame_get_version_name(glopts)); } else { fprintf (fd, "---------------------------------------------------------\n"); fprintf (fd, "LibTwoLame %s (%s)\n", get_twolame_version(), get_twolame_url()); fprintf (fd, "Input : %d Hz, %d channels\n", twolame_get_in_samplerate(glopts), twolame_get_num_channels(glopts)); fprintf (fd, "Output: %d Hz, %s\n", twolame_get_out_samplerate(glopts), twolame_get_mode_name(glopts)); fprintf (fd, "%d kbps ", twolame_get_bitrate(glopts) ); if (twolame_get_VBR(glopts)) fprintf (fd, "VBR " ); else fprintf (fd, "CBR " ); fprintf (fd, "%s Layer II ", twolame_get_version_name(glopts)); fprintf (fd, "psycho model=%d \n", twolame_get_psymodel(glopts)); fprintf (fd, "[De-emph:%s Copyright:%s Original:%s]\n", ((twolame_get_emphasis(glopts)) ? "On " : "Off"), ((twolame_get_copyright(glopts)) ? "Yes" : "No "), ((twolame_get_original(glopts)) ? "Yes" : "No ")); fprintf (fd, "[Padding:%s CRC:%s DAB:%s ]\n", ((twolame_get_padding(glopts)) ? "Normal" : "Off "), ((twolame_get_error_protection(glopts)) ? "On " : "Off"), ((twolame_get_DAB(glopts)) ? "On " : "Off")); if (glopts->verbosity>=3) { if (twolame_get_VBR(glopts)) { fprintf (fd, " - VBR Enabled. Using MNR boost of %f\n", twolame_get_VBR_level(glopts)); fprintf (fd, " - VBR bitrate index limits [%i -> %i]\n", glopts->lower_index, glopts->upper_index); } fprintf(fd," - ATH adjustment %f\n", twolame_get_ATH_level(glopts)); fprintf(fd," - Reserving %i Ancillary bits\n", twolame_get_num_ancillary_bits(glopts)); if (twolame_get_scale(glopts)!=1.0f) fprintf(fd," - Scaling audio by %f\n", twolame_get_scale(glopts)); if (twolame_get_scale_left(glopts)!=1.0f) fprintf(fd," - Scaling left channel by %f\n", twolame_get_scale_left(glopts)); if (twolame_get_scale_right(glopts)!=1.0f) fprintf(fd," - Scaling right channel by %f\n", twolame_get_scale_right(glopts)); //if (glopts->num_channels_in == 2 && glopts->num_channels_out == 1 ) { // fprintf(fd, " - Downmixing from stereo to mono.\n"); //} else if (glopts->num_channels_in == 1 && glopts->num_channels_out == 2 ) { // fprintf(fd, " - Upmixing from mono to stereo.\n"); //} } fprintf (fd, "---------------------------------------------------------\n"); } }