⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 wince下著名的视频播放器源码
💻 C
📖 第 1 页 / 共 5 页
字号:
		show_version();		return 0;	}	else if(option_values.show_explain) {		show_explain();		return 0;	}	else if(option_values.show_help) {		show_help();		return 0;	}	else {		if(option_values.num_files == 0) {			if(flac__utils_verbosity_ >= 1)				short_usage();			return 0;		}		/*		 * tweak options; validate the values		 */		if(!option_values.mode_decode) {			if(option_values.blocksize < 0) {				if(option_values.max_lpc_order == 0)					option_values.blocksize = 1152;				else					option_values.blocksize = 4608;			}			if(option_values.max_residual_partition_order < 0) {				if(option_values.blocksize <= 1152)					option_values.max_residual_partition_order = 2;				else if(option_values.blocksize <= 2304)					option_values.max_residual_partition_order = 3;				else if(option_values.blocksize <= 4608)					option_values.max_residual_partition_order = 3;				else					option_values.max_residual_partition_order = 4;				option_values.min_residual_partition_order = option_values.max_residual_partition_order;			}			if(option_values.rice_parameter_search_dist < 0) {				option_values.rice_parameter_search_dist = 0;			}			if(0 != option_values.cue_specification)				return usage_error("ERROR: --cue is not allowed in test mode\n");		}		else {			if(option_values.test_only) {				if(0 != option_values.skip_specification)					return usage_error("ERROR: --skip is not allowed in test mode\n");				if(0 != option_values.until_specification)					return usage_error("ERROR: --until is not allowed in test mode\n");				if(0 != option_values.cue_specification)					return usage_error("ERROR: --cue is not allowed in test mode\n");			}		}		if(0 != option_values.cue_specification && (0 != option_values.skip_specification || 0 != option_values.until_specification))			return usage_error("ERROR: --cue may not be combined with --skip or --until\n");		FLAC__ASSERT(option_values.blocksize >= 0 || option_values.mode_decode);		if(option_values.format_channels >= 0) {			if(option_values.format_channels == 0 || (unsigned)option_values.format_channels > FLAC__MAX_CHANNELS)				return usage_error("ERROR: invalid number of channels '%u', must be > 0 and <= %u\n", option_values.format_channels, FLAC__MAX_CHANNELS);		}		if(option_values.format_bps >= 0) {			if(option_values.format_bps != 8 && option_values.format_bps != 16 && option_values.format_bps != 24)				return usage_error("ERROR: invalid bits per sample '%u' (must be 8/16/24)\n", option_values.format_bps);		}		if(option_values.format_sample_rate >= 0) {			if(!FLAC__format_sample_rate_is_valid(option_values.format_sample_rate))				return usage_error("ERROR: invalid sample rate '%u', must be > 0 and <= %u\n", option_values.format_sample_rate, FLAC__MAX_SAMPLE_RATE);		}		if(option_values.force_raw_format && option_values.force_aiff_format)			return usage_error("ERROR: only one of --force-raw-format and --force-aiff-format allowed\n");		if(option_values.mode_decode) {			if(!option_values.force_raw_format) {				if(option_values.format_is_big_endian >= 0)					return usage_error("ERROR: --endian only allowed with --force-raw-format\n");				if(option_values.format_is_unsigned_samples >= 0)					return usage_error("ERROR: --sign only allowed with --force-raw-format\n");			}			if(option_values.format_channels >= 0)				return usage_error("ERROR: --channels not allowed with --decode\n");			if(option_values.format_bps >= 0)				return usage_error("ERROR: --bps not allowed with --decode\n");			if(option_values.format_sample_rate >= 0)				return usage_error("ERROR: --sample-rate not allowed with --decode\n");		}		if(!option_values.mode_decode && ((unsigned)option_values.blocksize < FLAC__MIN_BLOCK_SIZE || (unsigned)option_values.blocksize > FLAC__MAX_BLOCK_SIZE)) {			return usage_error("ERROR: invalid blocksize '%u', must be >= %u and <= %u\n", (unsigned)option_values.blocksize, FLAC__MIN_BLOCK_SIZE, FLAC__MAX_BLOCK_SIZE);		}		if(option_values.qlp_coeff_precision > 0 && option_values.qlp_coeff_precision < FLAC__MIN_QLP_COEFF_PRECISION) {			return usage_error("ERROR: invalid value '%u' for qlp coeff precision, must be 0 or >= %u\n", option_values.qlp_coeff_precision, FLAC__MIN_QLP_COEFF_PRECISION);		}		if(option_values.sector_align) {			if(option_values.mode_decode)				return usage_error("ERROR: --sector-align only allowed for encoding\n");			if(0 != option_values.skip_specification)				return usage_error("ERROR: --sector-align not allowed with --skip\n");			if(0 != option_values.until_specification)				return usage_error("ERROR: --sector-align not allowed with --until\n");			if(0 != option_values.cue_specification)				return usage_error("ERROR: --sector-align not allowed with --cue\n");			if(option_values.format_channels >= 0 && option_values.format_channels != 2)				return usage_error("ERROR: --sector-align can only be done with stereo input\n");			if(option_values.format_bps >= 0 && option_values.format_bps != 16)				return usage_error("ERROR: --sector-align can only be done with 16-bit samples\n");			if(option_values.format_sample_rate >= 0 && option_values.format_sample_rate != 44100)				return usage_error("ERROR: --sector-align can only be done with a sample rate of 44100\n");		}		if(option_values.replay_gain) {			if(option_values.force_to_stdout)				return usage_error("ERROR: --replay-gain not allowed with -c/--stdout\n");			if(option_values.mode_decode)				return usage_error("ERROR: --replay-gain only allowed for encoding\n");			if(option_values.format_channels > 2)				return usage_error("ERROR: --replay-gain can only be done with mono/stereo input\n");			if(option_values.format_sample_rate >= 0 && !grabbag__replaygain_is_valid_sample_frequency(option_values.format_sample_rate))				return usage_error("ERROR: invalid sample rate used with --replay-gain\n");			/*			 * We want to reserve padding space for the ReplayGain			 * tags that we will set later, to avoid rewriting the			 * whole file.			 */			if(option_values.padding < 0) {				flac__utils_printf(stderr, 1, "NOTE: --replay-gain may leave a small PADDING block even with --no-padding\n");				option_values.padding = GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED;			}			else {				option_values.padding += GRABBAG__REPLAYGAIN_MAX_TAG_SPACE_REQUIRED;			}		}		if(option_values.num_files > 1 && option_values.cmdline_forced_outfilename) {			return usage_error("ERROR: -o/--output-name cannot be used with multiple files\n");		}		if(option_values.cmdline_forced_outfilename && option_values.output_prefix) {			return usage_error("ERROR: --output-prefix conflicts with -o/--output-name\n");		}		if(!option_values.mode_decode && 0 != option_values.cuesheet_filename && option_values.num_files > 1) {			return usage_error("ERROR: --cuesheet cannot be used when encoding multiple files\n");		}	}	flac__utils_printf(stderr, 2, "\n");	flac__utils_printf(stderr, 2, "flac %s, Copyright (C) 2000,2001,2002,2003,2004,2005  Josh Coalson\n", FLAC__VERSION_STRING);	flac__utils_printf(stderr, 2, "flac comes with ABSOLUTELY NO WARRANTY.  This is free software, and you are\n");	flac__utils_printf(stderr, 2, "welcome to redistribute it under certain conditions.  Type `flac' for details.\n\n");	if(!option_values.mode_decode) {		char padopt[16];		if(option_values.padding < 0)			strcpy(padopt, "-");		else			sprintf(padopt, " %d", option_values.padding);		flac__utils_printf(stderr, 2,			"options:%s%s%s%s -P%s -b %u%s -l %u%s%s%s -q %u -r %u,%u%s\n",			option_values.delete_input?" --delete-input-file":"",			option_values.sector_align?" --sector-align":"",			option_values.use_ogg?" --ogg":"",			option_values.lax?" --lax":"",			padopt,			(unsigned)option_values.blocksize,			option_values.loose_mid_side?" -M":option_values.do_mid_side?" -m":"",			option_values.max_lpc_order,			option_values.do_exhaustive_model_search?" -e":"",			option_values.do_escape_coding?" -E":"",			option_values.do_qlp_coeff_prec_search?" -p":"",			option_values.qlp_coeff_precision,			(unsigned)option_values.min_residual_partition_order,			(unsigned)option_values.max_residual_partition_order,			option_values.verify? " -V":""		);	}	if(option_values.mode_decode) {		FLAC__bool first = true;		if(option_values.num_files == 0) {			retval = decode_file("-");		}		else {			unsigned i;			if(option_values.num_files > 1)				option_values.cmdline_forced_outfilename = 0;			for(i = 0, retval = 0; i < option_values.num_files; i++) {				if(0 == strcmp(option_values.filenames[i], "-") && !first)					continue;				retval |= decode_file(option_values.filenames[i]);				first = false;			}		}	}	else { /* encode */		FLAC__bool first = true;		if(option_values.num_files == 0) {			retval = encode_file("-", first, true);		}		else {			unsigned i;			if(option_values.num_files > 1)				option_values.cmdline_forced_outfilename = 0;			for(i = 0, retval = 0; i < option_values.num_files; i++) {				if(0 == strcmp(option_values.filenames[i], "-") && !first)					continue;				retval |= encode_file(option_values.filenames[i], first, i == (option_values.num_files-1));				first = false;			}			if(option_values.replay_gain && retval == 0) {				float album_gain, album_peak;				grabbag__replaygain_get_album(&album_gain, &album_peak);				for(i = 0; i < option_values.num_files; i++) {					const char *error, *outfilename = get_encoded_outfilename(option_values.filenames[i]);					if(0 == outfilename) {						flac__utils_printf(stderr, 1, "ERROR: filename too long: %s", option_values.filenames[i]);						return 1;					}					if(0 == strcmp(option_values.filenames[i], "-")) {						FLAC__ASSERT(0);						/* double protection */						flac__utils_printf(stderr, 1, "internal error\n");						return 2;					}					if(0 != (error = grabbag__replaygain_store_to_file_album(outfilename, album_gain, album_peak, /*preserve_modtime=*/true))) {						flac__utils_printf(stderr, 1, "%s: ERROR writing ReplayGain album tags\n", outfilename);						retval = 1;					}				}			}		}	}	return retval;}FLAC__bool init_options(){	option_values.show_help = false;	option_values.show_explain = false;	option_values.mode_decode = false;	option_values.verify = false;	option_values.force_file_overwrite = false;	option_values.continue_through_decode_errors = false;	option_values.replaygain_synthesis_spec.apply = false;	option_values.replaygain_synthesis_spec.use_album_gain = true;	option_values.replaygain_synthesis_spec.limiter = RGSS_LIMIT__HARD;	option_values.replaygain_synthesis_spec.noise_shaping = NOISE_SHAPING_LOW;	option_values.replaygain_synthesis_spec.preamp = 0.0;	option_values.lax = false;	option_values.test_only = false;	option_values.analyze = false;	option_values.use_ogg = false;	option_values.has_serial_number = false;	option_values.serial_number = 0;	option_values.do_mid_side = true;	option_values.loose_mid_side = false;	option_values.do_exhaustive_model_search = false;	option_values.do_escape_coding = false;	option_values.do_qlp_coeff_prec_search = false;	option_values.force_to_stdout = false;	option_values.force_aiff_format = false;	option_values.force_raw_format = false;	option_values.delete_input = false;	option_values.replay_gain = false;	option_values.sector_align = false;	option_values.cmdline_forced_outfilename = 0;	option_values.output_prefix = 0;	option_values.aopts.do_residual_text = false;	option_values.aopts.do_residual_gnuplot = false;	option_values.padding = 4096;	option_values.max_lpc_order = 8;	option_values.qlp_coeff_precision = 0;	option_values.skip_specification = 0;	option_values.until_specification = 0;	option_values.cue_specification = 0;	option_values.format_is_big_endian = -1;	option_values.format_is_unsigned_samples = -1;	option_values.format_channels = -1;	option_values.format_bps = -1;	option_values.format_sample_rate = -1;	option_values.format_input_size = -1;	option_values.blocksize = -1;	option_values.min_residual_partition_order = -1;	option_values.max_residual_partition_order = -1;	option_values.rice_parameter_search_dist = -1;	option_values.requested_seek_points[0] = '\0';	option_values.num_requested_seek_points = -1;	option_values.cuesheet_filename = 0;	option_values.cued_seekpoints = true;	option_values.num_files = 0;	option_values.filenames = 0;	if(0 == (option_values.vorbis_comment = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT)))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -