📄 parse.c
字号:
return 0;}static void display_bitrate ( FILE* const fp, const char* const version, const int d, const int indx ){ int i; fprintf ( fp, "\nMPEG-%-3s layer III sample frequencies (kHz): %2d %2d %g\n" "bitrates (kbps):", version, 32/d, 48/d, 44.1/d ); for (i = 1; i <= 14; i++ ) /* 14 numbers are printed, not 15, and it was a bug of me */ fprintf ( fp, " %2i", bitrate_table [indx] [i] ); fprintf ( fp, "\n" );}int display_bitrates ( FILE* const fp ){ display_bitrate ( fp, "1" , 1, 1 ); display_bitrate ( fp, "2" , 2, 0 ); display_bitrate ( fp, "2.5", 4, 0 ); fprintf ( fp, "\n" ); fflush ( fp ); return 0;}/* note: for presets it would be better to externalize them in a file. suggestion: lame --preset <file-name> ... or: lame --preset my-setting ... and my-setting is defined in lame.ini */ /*Note from GB on 08/25/2002:I am merging --presets and --alt-presets. Old presets are now aliases forcorresponding abr values from old alt-presets. This way we now have a unified preset system, and I hope than more people will use the new tunedpresets instead of the old unmaintained ones.*/ /************************************************************************** usage** PURPOSE: Writes presetting info to #stdout#*************************************************************************/static void presets_longinfo_dm ( FILE* msgfp ){ fprintf ( msgfp, "\n" "The --preset switches are designed to provide the highest possible quality.\n" "\n" "They have for the most part been subject to and tuned via rigorous double blind\n" "listening tests to verify and achieve this objective.\n" "\n" ); fprintf ( msgfp, "These are continually updated to coincide with the latest developments that\n" "occur and as a result should provide you with nearly the best quality\n" "currently possible from LAME.\n" "\n" ); fprintf ( msgfp, "To activate these presets:\n" "\n" " For VBR modes (generally highest quality):\n" "\n" ); fprintf ( msgfp, " \"--preset medium\" This preset should provide near transparency\n" " to most people on most music.\n" "\n" " \"--preset standard\" This preset should generally be transparent\n" " to most people on most music and is already\n" " quite high in quality.\n" "\n" ); fprintf ( msgfp, " \"--preset extreme\" If you have extremely good hearing and similar\n" " equipment, this preset will generally provide\n" " slightly higher quality than the \"standard\"\n" " mode.\n" "\n" ); fprintf ( msgfp, " For CBR 320kbps (highest quality possible from the --preset switches):\n" "\n" " \"--preset insane\" This preset will usually be overkill for most\n" " people and most situations, but if you must\n" " have the absolute highest quality with no\n" " regard to filesize, this is the way to go.\n" "\n" ); fprintf ( msgfp, " For ABR modes (high quality per given bitrate but not as high as VBR):\n" "\n" " \"--preset <kbps>\" Using this preset will usually give you good\n" " quality at a specified bitrate. Depending on the\n" " bitrate entered, this preset will determine the\n" ); fprintf ( msgfp, " optimal settings for that particular situation.\n" " While this approach works, it is not nearly as\n" " flexible as VBR, and usually will not attain the\n" " same level of quality as VBR at higher bitrates.\n" "\n" ); fprintf ( msgfp, "The following options are also available for the corresponding profiles:\n" "\n" " <fast> standard\n" " <fast> extreme\n" " insane\n" " <cbr> (ABR Mode) - The ABR Mode is implied. To use it,\n" " simply specify a bitrate. For example:\n" " \"--preset 185\" activates this\n" " preset and uses 185 as an average kbps.\n" "\n" ); fprintf ( msgfp, " \"fast\" - Enables the new fast VBR for a particular profile. The\n" " disadvantage to the speed switch is that often times the\n" " bitrate will be slightly higher than with the normal mode\n" " and quality may be slightly lower also.\n" "\n" ); fprintf ( msgfp, " \"cbr\" - If you use the ABR mode (read above) with a significant\n" " bitrate such as 80, 96, 112, 128, 160, 192, 224, 256, 320,\n" " you can use the \"cbr\" option to force CBR mode encoding\n" " instead of the standard abr mode. ABR does provide higher\n" " quality but CBR may be useful in situations such as when\n" " streaming an mp3 over the internet may be important.\n" "\n" ); fprintf ( msgfp, " For example:\n" "\n" " \"--preset fast standard <input file> <output file>\"\n" " or \"--preset cbr 192 <input file> <output file>\"\n" " or \"--preset 172 <input file> <output file>\"\n" " or \"--preset extreme <input file> <output file>\"\n" "\n" "\n" ); fprintf ( msgfp, "A few aliases are available for ABR mode:\n" "phone => 16kbps/mono phon+/lw/mw-eu/sw => 24kbps/mono\n" "mw-us => 40kbps/mono voice => 56kbps/mono\n" "fm/radio/tape => 112kbps hifi => 160kbps\n" "cd => 192kbps studio => 256kbps\n");}extern void lame_set_msfix( lame_t gfp, double msfix );static int presets_set( lame_t gfp, int fast, int cbr, const char* preset_name, const char* ProgramName ){ int mono = 0; if ((strcmp(preset_name, "help") == 0) && (fast < 1) && (cbr < 1)) { lame_version_print ( stdout ); presets_longinfo_dm( stdout ); return -1; } /*aliases for compatibility with old presets */ if (strcmp(preset_name, "phone") == 0) { preset_name = "16"; mono = 1; } if ( (strcmp(preset_name, "phon+") == 0) || (strcmp(preset_name, "lw") == 0) || (strcmp(preset_name, "mw-eu") == 0) || (strcmp(preset_name, "sw") == 0)) { preset_name = "24"; mono = 1; } if (strcmp(preset_name, "mw-us") == 0) { preset_name = "40"; mono = 1; } if (strcmp(preset_name, "voice") == 0) { preset_name = "56"; mono = 1; } if (strcmp(preset_name, "fm") == 0) { preset_name = "112"; } if ( (strcmp(preset_name, "radio") == 0) || (strcmp(preset_name, "tape") == 0)) { preset_name = "112"; } if (strcmp(preset_name, "hifi") == 0) { preset_name = "160"; } if (strcmp(preset_name, "cd") == 0) { preset_name = "192"; } if (strcmp(preset_name, "studio") == 0) { preset_name = "256"; } if (strcmp(preset_name, "medium") == 0) { lame_set_VBR_q(gfp, 4); if (fast > 0) { lame_set_VBR(gfp, vbr_mtrh); } else { lame_set_VBR(gfp, vbr_rh); } return 0; } if (strcmp(preset_name, "standard") == 0) { lame_set_VBR_q(gfp, 2); if (fast > 0) { lame_set_VBR(gfp, vbr_mtrh); } else { lame_set_VBR(gfp, vbr_rh); } return 0; } else if (strcmp(preset_name, "extreme") == 0){ lame_set_VBR_q(gfp, 0); if (fast > 0) { lame_set_VBR(gfp, vbr_mtrh); } else { lame_set_VBR(gfp, vbr_rh); } return 0; } else if (((strcmp(preset_name, "insane") == 0) || (strcmp(preset_name, "320" ) == 0)) && (fast < 1)) { lame_set_preset(gfp, INSANE); return 0; } /* Generic ABR Preset */ if (((atoi(preset_name)) > 0) && (fast < 1)) { if ((atoi(preset_name)) >= 8 && (atoi(preset_name)) <= 320){ lame_set_preset(gfp, atoi(preset_name)); if (cbr == 1 ) lame_set_VBR(gfp, vbr_off); if (mono == 1 ) { lame_set_mode(gfp, MONO); } return 0; } else { lame_version_print ( stderr ); fprintf(stderr,"Error: The bitrate specified is out of the valid range for this preset\n" "\n" "When using this mode you must enter a value between \"32\" and \"320\"\n" "\n" "For further information try: \"%s --preset help\"\n" , ProgramName ); return -1; } } lame_version_print ( stderr ); fprintf(stderr,"Error: You did not enter a valid profile and/or options with --preset\n" "\n" "Available profiles are:\n" "\n" " <fast> medium\n" " <fast> standard\n" " <fast> extreme\n" " insane\n" " <cbr> (ABR Mode) - The ABR Mode is implied. To use it,\n" " simply specify a bitrate. For example:\n" " \"--preset 185\" activates this\n" " preset and uses 185 as an average kbps.\n" "\n" ); fprintf ( stderr, " Some examples:\n" "\n" " or \"%s --preset fast standard <input file> <output file>\"\n" " or \"%s --preset cbr 192 <input file> <output file>\"\n" " or \"%s --preset 172 <input file> <output file>\"\n" " or \"%s --preset extreme <input file> <output file>\"\n" "\n" "For further information try: \"%s --preset help\"\n" , ProgramName, ProgramName, ProgramName, ProgramName, ProgramName ); return -1;}static void genre_list_handler (int num,const char *name, void* cookie){ printf ("%3d %s\n", num, name);}/************************************************************************** parse_args** PURPOSE: Sets encoding parameters to the specifications of the* command line. Default settings are used for parameters* not specified in the command line.** If the input file is in WAVE or AIFF format, the sampling frequency is read* from the AIFF header.** The input and output filenames are read into #inpath# and #outpath#.*************************************************************************//* would use real "strcasecmp" but it isn't portable */static int local_strcasecmp ( const char* s1, const char* s2 ){ unsigned char c1; unsigned char c2;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -