📄 params.cpp
字号:
/*////////////////////////////////////////////////////////////////////////////////// INTEL CORPORATION PROPRIETARY INFORMATION// This software is supplied under the terms of a license agreement or// nondisclosure agreement with Intel Corporation and may not be copied// or disclosed except in accordance with the terms of that agreement.// Copyright(c) 2004-2005 Intel Corporation. All Rights Reserved.//*/#include <stdio.h>#include <stdlib.h>#include <string.h>#include "params.h"int params_fill_by_default(sProgramParameters * p_param){ memset((void *)p_param->input_file, 0, sizeof(p_param->input_file)); memset((void *)p_param->output_file, 0, sizeof(p_param->output_file)); memset((void *)p_param->output_txt, 0, sizeof(p_param->output_txt)); memset((void *)p_param->codec_name, 0, sizeof(p_param->codec_name)); p_param->bitrate = 128; p_param->is_text_out = 0; p_param->enumerate = 0;#ifdef EX_PARAM p_param->ModeDecode = 0; //HQ mode p_param->ModeDownSample = 0; //DownSample OFF#endif (p_param->ac3dec_params).out_acmod = 7; (p_param->ac3dec_params).outlfeon = 1; return 0;}int params_parse_command_line(sProgramParameters * p_param, int argc, vm_char *argv[]){ int i; if (argc < 2) return 1; for (i = 1; i < argc; i++) { if (argv[i][0] == '-') { if (argv[i][1] == '-') {#ifdef EX_PARAM if (argv[i][2] == 'h') { p_param->ModeDecode = 0; //HQ mode } else if (argv[i][2] == 'l') { p_param->ModeDecode = 1; //LP mode } else if (argv[i][2] == 's') { p_param->ModeDownSample = 1; //DownSample ON } else if (argv[i][2] == 'w') { p_param->ModeDownSample = 0; //DownSample OFF }#endif } else {// / Program specific command line papameters ! if (argv[i][1] == 'c' && argv[i][2] == 't') { i++; vm_string_strcpy(p_param->codec_name, (vm_char *)argv[i]); } else if (argv[i][1] == 'b' && argv[i][2] == 'r') { i++; p_param->bitrate = vm_string_atoi(argv[i]); } else if (argv[i][1] == 'd' && argv[i][2] == 't') { i++; vm_string_strcpy(p_param->output_txt, (vm_char *)argv[i]); p_param->is_text_out = 1; } else if (argv[i][1] == 'e') { p_param->enumerate = 1; } else if (!vm_string_strncmp((vm_char*)argv[i], VM_STRING("-aac_p"), 6)) { i++; if (!vm_string_strncmp((vm_char*)argv[i], VM_STRING("AAC_LC"), 6)) { (p_param->aacenc_params).audioObjectType = AOT_AAC_LC; } else if (!vm_string_strncmp((vm_char*)argv[i], VM_STRING("AAC_LTP"), 7)) { (p_param->aacenc_params).audioObjectType = AOT_AAC_LTP; } else { (p_param->aacenc_params).audioObjectType = AOT_UNDEF; } }#ifndef _WIN32_WCE else if (!vm_string_strncmp((vm_char*)argv[i], VM_STRING("-ac3_u"), 6)) { i++; (p_param->ac3dec_params).dualmonomode = atoi(argv[i]); } else if (!vm_string_strncmp((vm_char*)argv[i], VM_STRING("-ac3_m"), 6)) { i++; (p_param->ac3dec_params).out_acmod = atoi(argv[i]); } else if (!vm_string_strncmp((vm_char*)argv[i], VM_STRING("-ac3_lfe_off"), 12)) { (p_param->ac3dec_params).outlfeon = 0; } else if (!vm_string_strncmp((vm_char*)argv[i], VM_STRING("-ac3_k"), 6)) { i++; (p_param->ac3dec_params).out_compmod = atoi(argv[i]); } else if (!vm_string_strncmp((vm_char*)argv[i], VM_STRING("-ac3_c"), 6)) { i++; (p_param->ac3dec_params).karaokeCapable = atoi(argv[i]); } else if (!vm_string_strncmp((vm_char*)argv[i], VM_STRING("-ac3_y"), 6)) { i++; (p_param->ac3dec_params).drc_scaleLow = atof(argv[i]); } else if (!vm_string_strncmp((vm_char*)argv[i], VM_STRING("-ac3_x"), 6)) { i++; (p_param->ac3dec_params).drc_scaleHigh = atof(argv[i]); }#endif /* _WIN32_WCE */ } } else { if (p_param->input_file[0] != 0) vm_string_strcpy(p_param->output_file, (vm_char *)argv[i]); else vm_string_strcpy(p_param->input_file, (vm_char *)argv[i]); } } if (!p_param->output_file[0]) { vm_string_strcpy(p_param->output_file,__VM_STRING("tmp.out")); } return 0;}int params_check_input(sProgramParameters * p_param){ return 0;}void params_print_usage(void){ vm_string_printf(__VM_STRING("Usage:\n")); vm_string_printf(__VM_STRING("audio_codec.exe -ct <codec type> [-keys] input-file [output-file]\n")); vm_string_printf(__VM_STRING("-ct - codec type. Possible values are the following:\n")); vm_string_printf(__VM_STRING(" ac3_dec, mp3_dec, mp3_dec_i, mp3_enc, mp3_enc_i\n")); vm_string_printf(__VM_STRING(" aac_dec, aac_dec_i, aac_enc_i, aac_enc_i\n")); vm_string_printf(__VM_STRING("-br - desired bitrate in kbps (valubale for encoders only)\n")); vm_string_printf(__VM_STRING("-aac_p - desired profile (AAC_LC or AAC_LTP) (valubale for AAC encoder only)\n"));#ifdef EX_PARAM vm_string_printf(__VM_STRING("--h - HQ mode HE-AACdec \n")); vm_string_printf(__VM_STRING("--l - LP mode HE-AACdec \n")); vm_string_printf(__VM_STRING("--s - ON SampleDown mode HE-AACdec \n")); vm_string_printf(__VM_STRING("--w - OFF SampleDown mode HE-AACdec \n"));#endif vm_string_printf(__VM_STRING("-ac3_u - AC3 decoder dualmonomode (default mode - 0)\n")); vm_string_printf(__VM_STRING(" 0 - STEREO\n")); vm_string_printf(__VM_STRING(" 1 - LEFTMONO\n")); vm_string_printf(__VM_STRING(" 2 - RGHTMONO\n")); vm_string_printf(__VM_STRING(" 3 - MIXMONO\n \n")); vm_string_printf(__VM_STRING("-ac3_m - AC3 decoder output channel configuration\n")); vm_string_printf(__VM_STRING(" (see AC3 standard) (default configuration - 7)\n")); vm_string_printf(__VM_STRING(" 0 - (Ch1, Ch2) Dolby Surround compatible\n")); vm_string_printf(__VM_STRING(" 1 - (C)\n")); vm_string_printf(__VM_STRING(" 2 - (L, R)\n")); vm_string_printf(__VM_STRING(" 3 - (L, C, R)")); vm_string_printf(__VM_STRING(" 4 - (L, R, S)\n")); vm_string_printf(__VM_STRING(" 5 - (L, C, R, S)\n")); vm_string_printf(__VM_STRING(" 6 - (L, R, l, SR)\n")); vm_string_printf(__VM_STRING(" 7 - (L, C, R, SL, SR)\n")); vm_string_printf(__VM_STRING("-ac3_k - AC3 decoder DRC mode (default mode - 2)\n")); vm_string_printf(__VM_STRING("-ac3_c - AC3 decoder karaoke capable mode (default mode - 3)\n")); vm_string_printf(__VM_STRING(" 0 - no V channels\n")); vm_string_printf(__VM_STRING(" 1 - left V channel\n")); vm_string_printf(__VM_STRING(" 2 - right V channel\n")); vm_string_printf(__VM_STRING(" 3 - both V channels\n")); vm_string_printf(__VM_STRING("-ac3_y - AC3 decoder DRC high scale factor (default - 1.0)\n")); vm_string_printf(__VM_STRING("-ac3_x - AC3 decoder DRC low scale factor (default - 1.0)\n")); vm_string_printf(__VM_STRING("-ac3_lfe_off - AC3 decoder LFE channel off (default - on)\n")); vm_string_printf(__VM_STRING("\n"));}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -