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

📄 parse_audio_cmdline.c

📁 Sample code for use on smp 863x processor.
💻 C
📖 第 1 页 / 共 5 页
字号:
		options[i].auto_detect_codec = FALSE;				options[i].AudioCP = FALSE;		options[i].mclk = MClkFactor_256Xfs;				options[i].thisAudioInstance = i;		options[i].audioInstances = 1;#endif	}	return RM_OK;}/* *****************************   this api will soon change to:   RMstatus parse_audio_cmdline(int argc, char **argv, int *index, struct audio_cmdline *options, RMuint32 optionsCount, RMuint32 *currentInstance)*/RMstatus parse_audio_cmdline2(int argc, char **argv, int *index, struct audio_cmdline options[], RMuint32 optionsCount, RMuint32 *currentInstance){	RMstatus err = RM_PENDING;	int i = *index;	RMDBGLOG((DISABLE, "parsing option[%lu]='%s'\n", i, argv[i]));	if ( ! strcmp(argv[i], "-audio_instance")) {		if (argc > i+1) {			RMuint32 instance;			instance = strtol(argv[i+1], NULL, 10);			i += 2;			if (*currentInstance != instance) {				RMuint32 j, totalInstances;				totalInstances = options[0].audioInstances;				totalInstances++;				if (totalInstances > optionsCount)					err = RM_ERROR;				else {					for (j = 0; j < totalInstances; j++)						options[j].audioInstances = totalInstances;										*currentInstance = instance;					RMDBGLOG((LOCALDBG, "parsing instance %lu\n", *currentInstance));				}			}			else				RMDBGLOG((LOCALDBG, "already parsing instance %lu\n", *currentInstance));						err = RM_OK;		}		else			err = RM_ERROR;	}		else if ( ! strcmp(argv[i], "-afs")) {		if (argc > i+1) {			options[*currentInstance].AudioFreqFromStream = strtol(argv[i+1], NULL, 10);			i+=2;			err = RM_OK;		}		else			err = RM_ERROR;	}	else if ( ! strcmp(argv[i], "-ae")) {		if (argc > i+1) {			options[*currentInstance].AudioEngineID = strtol(argv[i+1], NULL, 10);			i+=2;			err = RM_OK;		}		else			err = RM_ERROR;	}	else if ( ! strcmp(argv[i], "-ad")) {		if (argc > i+1) {			options[*currentInstance].AudioDecoderID = strtol(argv[i+1], NULL, 10);			i+=2;			err = RM_OK;		}		else			err = RM_ERROR;	} else if ( ! strcmp(argv[i], "-chan")) {		if (argc > i+1) {			options[*currentInstance].OutputChannels =  get_channel_mask(argv[i+1]);			options[*currentInstance].OutputChannelsExplicitAssign = TRUE;			i += 2;			err = RM_OK;		} else			err = RM_ERROR;	} else if (! strcmp(argv[i], "-ac3compmode")) {		if (argc > i+1) {			options[*currentInstance].Ac3Params.CompMode = (enum Ac3CompMode_type)atoi(argv[i+1]);			i+=2;			err = RM_OK;		} else 			err = RM_ERROR;	} else if (! strcmp(argv[i], "-ac3dynhi")) {		if (argc > i+1) {			RMuint32	dynhi;			sscanf((const char*)argv[i+1], (const char*)"0x%08lx", &dynhi);			options[*currentInstance].Ac3Params.DynScaleHi = dynhi;			i += 2;			err = RM_OK;		} else			err = RM_ERROR;	} else if (! strcmp(argv[i], "-ac3dynlo")) {		if (argc > i+1) {			RMuint32	dynlo;			sscanf((const char*)argv[i+1], (const char*)"0x%08lx", &dynlo);			options[*currentInstance].Ac3Params.DynScaleLo = dynlo;			i += 2;			err = RM_OK;		} else			err = RM_ERROR;	} else if (! strcmp(argv[i], "-ac3pcmscale")) {		if (argc > i+1) {			RMuint32	PcmScale;			sscanf((const char*)argv[i+1], (const char*)"0x%08lx", &PcmScale);			options[*currentInstance].Ac3Params.PcmScale = PcmScale;			i += 2;			err = RM_OK;		} else			err = RM_ERROR;	} 	else if (! strcmp(argv[i], "-ttone_type")){		if(argc > i+1) {			RMuint32 ttone_type;			sscanf((const char*)argv[i+1], (const char*)"0x%lx", &ttone_type);			options[*currentInstance].TToneParams.TToneType = ttone_type;			i += 2;			err = RM_OK;		}		else			err = RM_ERROR;	}	else if (! strcmp(argv[i], "-ttone_mask")){		if(argc > i+1) {			RMuint32 ttone_chmask;			sscanf((const char*)argv[i+1], (const char*)"0x%lx", &ttone_chmask);			options[*currentInstance].TToneParams.TToneChannelMask = ttone_chmask;			i += 2;			err = RM_OK;		}		else			err = RM_ERROR;	}	else if (! strcmp(argv[i], "-c")) {		if (argc > i+1) {			if ( !(strcmp(argv[i+1], "auto"))) {				options[*currentInstance].auto_detect_codec = TRUE;				RMDBGLOG((LOCALDBG, "\n\n\n\n\n********************** AUDIO CODEC: AUTO ***************\n\n\n\n"));			}			else if ( ! (strcmp(argv[i+1], "ac3")) || ! (strcmp(argv[i+1], "ac3_20"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_AC3;				options[*currentInstance].Ac3Params.OutputChannels = Ac3_LR;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LR;			} 			else if ( ! (strcmp(argv[i+1], "ac3_32"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_AC3;				options[*currentInstance].Ac3Params.OutputChannels = Ac3_LCRLsRs;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LCRLsRs;			} 			else if ( ! (strcmp(argv[i+1], "ec3"))) {				RMDBGLOG((LOCALDBG, "ec3 codec: will set codec to ac3 and use rmec3transcode lib\n"));				options[*currentInstance].Codec = AudioDecoder_Codec_AC3;				options[*currentInstance].Ac3Params.OutputChannels = Ac3_LR;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LR;				options[*currentInstance].transcode_ec3_to_ac3 = TRUE;			} 			else if ( ! (strcmp(argv[i+1], "mpeg"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_MPEG1;			}						else if ( ! (strcmp(argv[i+1], "aac0")) || ! (strcmp(argv[i+1], "aac0_20"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_AAC;				options[*currentInstance].AACParams.InputFormat = 0;	// adif, no sync word				options[*currentInstance].AACParams.OutputChannels = Aac_LR;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LR;			}			else if ( ! (strcmp(argv[i+1], "aac0_32"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_AAC;				options[*currentInstance].AACParams.InputFormat = 0;	// adif, no sync word				options[*currentInstance].AACParams.OutputChannels = Aac_LCRLsRs;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LCRLsRs;			}			else if ( ! (strcmp(argv[i+1], "aac1")) || ! (strcmp(argv[i+1], "aac1_20"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_AAC;				options[*currentInstance].AACParams.InputFormat = 1;	// adif, no sync word				options[*currentInstance].AACParams.OutputChannels = Aac_LR;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LR;			}			else if ( ! (strcmp(argv[i+1], "aac1_32"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_AAC;				options[*currentInstance].AACParams.InputFormat = 1;	// adif, no sync word				options[*currentInstance].AACParams.OutputChannels = Aac_LCRLsRs;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LCRLsRs;			}			else if ( ! (strcmp(argv[i+1], "aac2")) || ! (strcmp(argv[i+1], "aac2_20"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_AAC;				options[*currentInstance].AACParams.InputFormat = 2;	// adif, no sync word				options[*currentInstance].AACParams.OutputChannels = Aac_LR;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LR;			}			else if ( ! (strcmp(argv[i+1], "aac2_32"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_AAC;				options[*currentInstance].AACParams.InputFormat = 2;	// adif, no sync word				options[*currentInstance].AACParams.OutputChannels = Aac_LCRLsRs;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LCRLsRs;			}			else if ( ! (strcmp(argv[i+1], "aac3")) || ! (strcmp(argv[i+1], "aac3_20"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_AAC;				options[*currentInstance].AACParams.InputFormat = 3;	// adif, no sync word				options[*currentInstance].AACParams.OutputChannels = Aac_LR;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LR;			}			else if ( ! (strcmp(argv[i+1], "aac3_32"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_AAC;				options[*currentInstance].AACParams.InputFormat = 3;	// adif, no sync word				options[*currentInstance].AACParams.OutputChannels = Aac_LCRLsRs;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LCRLsRs;			}			else if ( ! (strcmp(argv[i+1], "bsac"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_BSAC;				options[*currentInstance].BSACParams.InputFormat = 1;	// adif, no sync word				options[*currentInstance].BSACParams.OutputChannels = Dts_LR;       // need to be updated !!!			}			else if ( ! (strcmp(argv[i+1], "pcm24")) || ! (strcmp(argv[i+1], "pcm24_2"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_PCM;				options[*currentInstance].SubCodec = 0;				options[*currentInstance].PcmCdaParams.ChannelAssign = PcmCda2_LR;				options[*currentInstance].PcmCdaParams.BitsPerSample = 24;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LR;			}			else if ( ! (strcmp(argv[i+1], "pcmx"))) { //pcmx codec, all information need to be written in header				options[*currentInstance].Codec = AudioDecoder_Codec_PCMX;			}			else if ( ! (strcmp(argv[i+1], "pcm24_6"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_PCM;				options[*currentInstance].SubCodec = 0;				options[*currentInstance].PcmCdaParams.ChannelAssign = PcmCda6_LfRfCLfeLsRs;				options[*currentInstance].PcmCdaParams.BitsPerSample = 24;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LCRLsRs;			}			else if ( ! (strcmp(argv[i+1], "pcm16_2"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_PCM;				options[*currentInstance].SubCodec = 0;				options[*currentInstance].PcmCdaParams.ChannelAssign = PcmCda2_LR;				options[*currentInstance].PcmCdaParams.BitsPerSample = 16;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LR;			}			else if ( ! (strcmp(argv[i+1], "pcm16_1"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_PCM;				options[*currentInstance].SubCodec = 0;				options[*currentInstance].PcmCdaParams.ChannelAssign = PcmCda1_C;				options[*currentInstance].PcmCdaParams.BitsPerSample = 16;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LR;			}			else if ( ! (strcmp(argv[i+1], "pcm16_6"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_PCM;				options[*currentInstance].SubCodec = 0;				options[*currentInstance].PcmCdaParams.ChannelAssign = PcmCda6_LfRfCLfeLsRs;				options[*currentInstance].PcmCdaParams.BitsPerSample = 16;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LCRLsRs;			}			else if ( ! (strcmp(argv[i+1], "pcm8_2"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_PCM;				options[*currentInstance].SubCodec = 0;				options[*currentInstance].PcmCdaParams.ChannelAssign = PcmCda2_LR;				options[*currentInstance].PcmCdaParams.BitsPerSample = 8;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels = Audio_Out_Ch_LR;			}			else if ( ! (strcmp(argv[i+1], "pcm8_1"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_PCM;				options[*currentInstance].SubCodec = 0;				options[*currentInstance].PcmCdaParams.ChannelAssign = PcmCda1_C;				options[*currentInstance].PcmCdaParams.BitsPerSample = 8;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LR;										}			else if ( ! (strcmp(argv[i+1], "lpcm24")) || ! (strcmp(argv[i+1], "lpcm24_2"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_PCM;				options[*currentInstance].SubCodec = 1;				options[*currentInstance].LpcmVobParams.ChannelAssign = LpcmVob2_LR;				options[*currentInstance].LpcmVobParams.BitsPerSample = 24;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LR;			}			else if ( ! (strcmp(argv[i+1], "lpcm20")) || ! (strcmp(argv[i+1], "lpcm20_2"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_PCM;				options[*currentInstance].SubCodec = 1;				options[*currentInstance].LpcmVobParams.ChannelAssign = LpcmVob2_LR;				options[*currentInstance].LpcmVobParams.BitsPerSample = 20;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LR;			}			else if ( ! (strcmp(argv[i+1], "lpcm16")) || ! (strcmp(argv[i+1], "lpcm16_2"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_PCM;				options[*currentInstance].SubCodec = 1;				options[*currentInstance].LpcmVobParams.ChannelAssign = LpcmVob2_LR;				options[*currentInstance].LpcmVobParams.BitsPerSample = 16;				if (!options[*currentInstance].OutputChannelsExplicitAssign) {					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LR;					RMDBGLOG((LOCALDBG, ">>>>>>>>>>>>lpcm16_2 Cmdline Speaker Configure = %0x\n", options[*currentInstance].OutputChannels));				}			}			else if ( ! (strcmp(argv[i+1], "lpcm16_1"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_PCM;				options[*currentInstance].SubCodec = 1;				options[*currentInstance].LpcmVobParams.ChannelAssign = LpcmVob1_C;				options[*currentInstance].LpcmVobParams.BitsPerSample = 16;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LR;			}			else if ( ! (strcmp(argv[i+1], "lpcma24")) || ! (strcmp(argv[i+1], "lpcma24_2"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_PCM;				options[*currentInstance].SubCodec = 2;				options[*currentInstance].LpcmAobParams.ChannelAssign = LpcmAob20_LR;				options[*currentInstance].LpcmAobParams.BitsPerSampleGroup1 = 24;				options[*currentInstance].LpcmAobParams.BitsPerSampleGroup2 = 0;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LR;			}			else if ( ! (strcmp(argv[i+1], "lpcma16_2"))) {				options[*currentInstance].Codec = AudioDecoder_Codec_PCM;				options[*currentInstance].SubCodec = 2;				options[*currentInstance].LpcmAobParams.ChannelAssign = LpcmAob20_LR;				options[*currentInstance].LpcmAobParams.BitsPerSampleGroup1 = 16;				options[*currentInstance].LpcmAobParams.BitsPerSampleGroup2 = 0;				if (!options[*currentInstance].OutputChannelsExplicitAssign)					options[*currentInstance].OutputChannels	= Audio_Out_Ch_LR;			}			else if ( ! (strcmp(argv[i+1], "lpcma16_1"))) {				options[*currentInstance].Codec = AudioDeco

⌨️ 快捷键说明

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