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

📄 parse_audio_cmdline.c

📁 Sample code for use on smp 863x processor.
💻 C
📖 第 1 页 / 共 5 页
字号:
#include "sample_os.h"#define ALLOW_OS_CODE 1#include "../rua/include/rua.h"#include "../dcc/include/dcc.h"#include "../emhwlib_hal/pll/include/pll_hal.h"#include "common.h"// to enable or disable the debug messages of this source file, put 1 or 0 below#if 1#define LOCALDBG ENABLE#else#define LOCALDBG DISABLE#endif#define NUM_DBC 4  // how many DBCs to allocateextern RMbool manutest;typedef struct _chanEntry {	const char*					szEntryName;	enum AudioOutputChannels_type	eEntryType;} CHANNEL_ENTRY;static CHANNEL_ENTRY	channelTable[] = {	{	"C",		Audio_Out_Ch_C, },	{	"LR",		Audio_Out_Ch_LR, },	{	"LCR",		Audio_Out_Ch_LCR, },	{	"LRS",		Audio_Out_Ch_LRS, },	{	"LCRS",		Audio_Out_Ch_LCRS, },	{	"LRLsRs",	Audio_Out_Ch_LRLsRs, },	{	"LCRLsRs",	Audio_Out_Ch_LCRLsRs, },	{	"LCRLsRsSs",	Audio_Out_Ch_LCRLsRsSs, },	{	"LRLsRsLssRss",	Audio_Out_Ch_LRLsRsLssRss, },	{	"LCRLsRsLssRss",	Audio_Out_Ch_LCRLsRsLssRss, },};#define CHANNELTABLE_NUM_ELEM	(sizeof(channelTable)/sizeof(CHANNEL_ENTRY))#if 1//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// example of customized downmixing table// 5.1ch to LoRo output// Please refer to PostProcInterface.docRMuint32 dmx_table_5dot1_to_LR[64] ={	0x6A09E66, 0x4AFB0CC*2, 0, 0x4AFB0CC, 0, 0, 0, 0,	//L	0, 0, 0, 0, 0, 0, 0, 0, 	0, 0x4AFB0CC*2, 0x6A09E66, 0, 0x4AFB0CC,	0, 0, 0, //R	0, 0, 0, 0, 0, 0, 0, 0, 	0, 0, 0, 0, 0, 0, 0, 0, 	0, 0, 0, 0, 0, 0x6A09E66, 0, 0, //lfe	0, 0, 0, 0, 0, 0, 0, 0, 	0, 0, 0, 0, 0, 0, 0, 0,	};// initialize downmixing table// David// 4/29/2007static struct AudioEngine_Downmixing_tables_type audio_dmx_5dot1_to_LR = {	AudioEngine_dmx_tables_LCRLsRs_2_LoRo,	(RMuint32)dmx_table_5dot1_to_LR,};//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#endifenum AudioOutputChannels_type get_channel_mask(const RMascii* szValue) {	enum AudioOutputChannels_type	type = Audio_Out_Ch_LR;	size_t						i;	RMbool						bFound = FALSE;		for (i = 0 ; i < CHANNELTABLE_NUM_ELEM ; i++) {		if (strcmp(szValue, channelTable[i].szEntryName) == 0) {			type = channelTable[i].eEntryType;			bFound = TRUE;			break;		}			}	if (!bFound) {		fprintf(stderr, "WARNING: Invalid channel mask. Using default [LR]!\n");	}	RMDBGLOG((LOCALDBG, "type = %d\n", (int)type));		return type;}void show_audio_options(void){	fprintf(stderr, "AUDIO OPTIONS (default values inside brackets)\n"		"\t-ae audio engine: selects the audio engine (DSP) to be used, 0 or 1 [0]\n"		"\t-ad audio decoder: selects the audio decoder on the DSP to use. [0]\n"		"\t-c codec: Sets the codec\n"		"\t\t[ac3=ac3_20] ac3_32 ec3\n"		"\t\tbsac\n"		"\t\tmpeg\n"				"\t\t[aac0=adif] [aac1=adts] [aac2=dsi] [aac3=latm]\n"		"\t\twma wmapro wmats\n"				"\t\tdvda\n"		"\t\t[dts] dts_cd\n"		"\t\tpcm[24,20,16 = bit per sample]_[1,2,... = channel assign]\n"		"\t\tlpcm[24,20,16 = bit per sample]_[1,2,... = channel assign]\n"		"\t\tlpcma[24,20,16 = bit per sample]_[1,2,..= channel assign], \n"		"\t\tbdlpcm[Bluray LPCM audio]\n"		"\t\tttone[test tone]\n"		"\t\tauto\n"		"\t-lsbfirst used only for audio pcm wave\n"		"\t-afreq: Sets the output audio frequency [44100]\n"		"\t-sfg1: Sets sampling frequency of PCM group1 [output frequency].\n"		"\t-audioin: Configures for pcm audioin function [FALSE]\n"		"\t-extclk: take audio playback clock from RClk0 input (useful with\n"		"\t\t-audioin) [FALSE]\n"		"\t-aialign alignment: align value for the audio input (e.g. 1 for 24\n"		"\t\tbit, 0 for 32 bit)[1]\n"		"\t-ailsbfirst: LSB first instead of MSB first on audio input [FALSE]\n"		"\t-source: capture_source: [0=I2S] 1=SPDIF 2=SPDIF from I2S data pin\n"		"\t-capture_bts: bitstream number in captured SPDIF stream, [0]..7\n"		"\t-delay capture_delay: Delay to start capturing [1824]\n"		"\t-type capture type: 0=Not Specified, 1=PCM, 2=Compressed [PCM]\n"		"\t-spdif mode: Sets the spdif mode\n"		"\t\tn=no [u=uncompressed] c=compressed cnd=compressed no decode\n"		"\t-hdmi_pass: Enable HDMI passthrough mode (compressed audio on I2S)\n"		"\t-hdmi_lines lines: Set the number of I2S lines to be used for HDMI passthrough, [1]..4\n"		"\t-hdmi_hbr [<ID>]: Enable HDMI HighBitRate audio, ID: optional 4 bit HBR packet header ID\n"		"\t-dual mode: [stereo] left right mix\n"		"\t-lfe: enable LFE channel - for AC3 codec\n"		"\t-acmod2dual: dual mode for acmod2 - for AC3/AAC/MPEG codec\n"		"\t-so: Enables/Disables the serial out [1=enable] 0=disable\n"		"\t-i2salign alignment: align value for the i2s audio output (e.g. 1\n"		"\t\tfor 24 bit, 0 for 32 bit)[1]\n"		"\t-i2ssclknormal: don't invert SClk on i2s audio output [FALSE]\n"		"\t-i2sframenormal: don't invert frame on i2s audio output [FALSE]\n"		"\t-i2slsbfirst: LSB first instead of MSB first on i2s audio output [FALSE]\n"		"\t-i2s16bit: 16 bit sample width instead of 32 bit on i2s audio output [FALSE]\n"		"\t-chan: Sets the channel mask\n"		"\t\tC [LR] LCR LRS LCRS LRLsRs LCRLsRs\n"		"\t-unsigned: Unsigned PCM data\n"		"\t-downsample: For DVD PCM playback protection by converting 24 bit to 16 bit PCM Format\n"		"\t-afifo size: select the audio bitstream fifo size in KB. Default is application dependent\n"		"\t-axfer count: select the audio xfer fifo count. Default is application dependent\n"		"\t-rclkmclk n: provide the current MClk on RClkOut n (0..3)\n"		"\t-askip_first_n_bytes: bytes to skip when reading the file from the beginning\n"		"\t-asend_n_bytes: bytes to send\n"		"\t-bassmode: [0] 0 1 2 3 4 5 6 7\n"		"\t-afs [0] 1:  let audio uCode parse and set sample frequency from stream\n"		"\t-channel_delay: [0] 0...7 [0] 0...33, e.g., '-channel 1 23' means put 2.3 ms delay for channel 1\n"		"\t-audio_cp: set audio copy protection 'C' bit in SPDIF and HDMI audio header\n"		"\t-channel_status mask value: [0] [0] used to set all bits, including 'C' bit in SPDIF and HDMI audio header\n"		"\t-mclk <x>: 128 [256] Audio Master Clock factor, either 128*fs or 256*fs\n"		"\t-audio_hdmi2c: OBSOLETE, do not use.\n"		"\t\tspeed: optional, I2C bus speed in kHz\n"		"\t-aplay n: [0] 0-3:0=disable,1=play_from,2=play_to,3=play_from_to\n"		"\t\t-astart n: [0] 0...MAX(uint64) play start PTS\n"		"\t\t-astop n: [0] 0...MAX(uint64) play stop PTS\n"		"\t-ltrt: force LtRt downmix mode\n"		"\t-ppdmx: to for PostProcessing module to do downmixing\n"		"\t-centerup: boost 6dB up in certer channel\n"        "\t-i2s_spdif n: [0] 1,2,3,4 copy i2s data to SPDIF 0=no copy 1=LR 2=CLfe 3=LsRs 4=LssRss\n"		"\t-ac3compmode mode: 0=analog, 1=digital, 2=line out, 3=RF [line_out]\n"		"\t-ac3dynhi scale: Dynamic scale hi 4.28 hex representation\n"		"\t-ac3dynlo scale: Dynamic scale lo 4.28 hex representation\n"		"\t-ac3pcmscale scale: pcm scale lo 4.28 hex representation\n"		"\t-x n: [2] 6 8 Channel Config [TrueHD] \n"		"\t-drc n: [1] 1 2 DRC Enable [TrueHD]\n"		"\t-boost n: [100] 0-100 DRC Boost [TrueHD]\n"		"\t-cut n: [100] 0-100  DRC Cut [TrueHD]\n"		"\t-dialref n: [-31] 1 to -31 DRC DialRef [TrueHD]\n"		"\t-lossless: Lossless mode [TrueHD]\n"		"\t-pl2x_mode: ProLogic IIx mode: [3] 0=PLE 1=VC 2=Music 3=Movie 4=Matrix 4=DDEX\n"		"\t-mute <gpio> <H|L>: GPIO number of the audio mute and polarity when muted\n"		"\t-cdmx: customized downmixing enable\n"		"\t-nosync: To disable sync to STC per decoder\n"		"\t-ttone_type n:[0],1, 0=white noise, 1=other\n"		"\t-ttone_mask h:[0],Hex, 0=disable, mask in hex, 0x1=left, 0x2=right, 0x4=center 0x8=lfe 0x10=Lss 0x20=Rss 0x40=Lss 0x80=Rss\n"		);}#define DEFAULT_ENGINE  0#define DEFAULT_DECODER 0#define DEFAULT_CODEC AudioDecoder_Codec_AC3#define DEFAULT_SUBCODEC 0xFF#define DEFAULT_SAMPLE_RATE 44100#define DEFAULT_SAMPLING_FREQ 0#define DEFAULT_FORCE_SAMPLE_RATE FALSE#define DEFAULT_CAPTURE_SOURCE 0#define DEFAULT_CAPTURE_BITSTREAM 0#define DEFAULT_CAPTURE_TYPE 1#define DEFAULT_CAPTURE_DELAY 0#define DEFAULT_SERIAL_OUT TRUE#define DEFAULT_EXTERNAL_CLK FALSE#define DEFAULT_AUDIO_IN FALSE#define DEFAULT_AUDIO_IN_ALIGN 1#define DEFAULT_AUDIO_IN_LSB_FIRST FALSE#define DEFAULT_I2S_ALIGN 1#define DEFAULT_I2S_SCLK_NORMAL FALSE#define DEFAULT_I2S_FRAME_NORMAL FALSE#define DEFAULT_I2S_LSB_FIRST FALSE#define DEFAULT_I2S_16BIT FALSE#define DEFAULT_OUTPUT_CHANNEL_EXPLICIT_ASSIGN FALSE#define DEFAULT_OUTPUT_CHANNELS Audio_Out_Ch_LR#define DEFAULT_OUTPUT_DUALMODE DualMode_Stereo#define DEFAULT_SPDIF OutputSpdif_Uncompressed#define DEFAULT_OUTPUT_LFE FALSE#define DEFAULT_SIGNED_PCM TRUE#define DEFAULT_BASSMODE 0#define DEFAULT_AAC_INPUT_FORMAT 0#define DEFAULT_AAC_OUTPUT_CHANNELS Aac_LR#define DEFAULT_AAC_OUTPUT_SURROUND20 SurroundAsStream#define DEFAULT_AC3_OUTPUT_SURROUND20 SurroundAsStream#define DEFAULT_AC3_OUTPUT_LFE FALSE#define DEFAULT_AC3_OUTPUT_CHANNELS Ac3_LR#define DEFAULT_AC3_ACMOD2DUALMODE FALSE#define DEFAULT_AC3_COMPMODE CompMode_line_out#define DEFAULT_AC3_DYN_SCALE_HI 0x10000000#define DEFAULT_AC3_DYN_SCALE_LO 0x10000000#define DEFAULT_AC3_PCM_SCALE 0x10000000#define DEFAULT_PCMCDA_CHANNELS_ASSIGN PcmCda2_LR#define DEFAULT_PCMCDA_BITS_PER_SAMPLE 24#define DEFAULT_PCMCDA_MSB_FIRST TRUE#define DEFAULT_PCMCDA_OUTPUT_SOURROUND20 SurroundAsStream#define DEFAULT_LPCMVOB_CHANNEL_ASSIGN LpcmVob2_LR#define DEFAULT_LPCMVOB_BITS_PER_SAMPLE 24#define DEFAULT_LPCMVOB_DOWNMIX FALSE#define DEFAULT_LPCMVOB_OUTPUT_SOURROUND20 SurroundAsStream #define DEFAULT_LPCMAOB_CHANNEL_ASSIGN LpcmAob20_LR#define DEFAULT_LPCMAOB_BITS_PER_SAMPLE_GROUP1 24#define DEFAULT_LPCMAOB_BITS_PER_SAMPLE_GROUP2 24#define DEFAULT_LPCMAOB_DOWNMIX FALSE#define DEFAULT_LPCMAOB_GROUP2SHIFT 0#define DEFAULT_LPCMAOB_PHASELR 0#define DEFAULT_LPCMAOB_DOWNSAMPLE 0#define DEFAULT_LPCMAOB_OUTPUT_SOURROUND20 SurroundAsStream#define DEFAULT_LPCMBD_CHANNEL_ASSIGN PcmCda2_LR#define DEFAULT_LPCMBD_BITS_PER_SAMPLE 16#define DEFAULT_LPCMBD_OUTPUT_SOURROUND20 SurroundAsStream#define DEFAULT_WMA_OUTPUT_CHANNELS Audio_Out_Ch_LR#define DEFAULT_WMA_VALID_DOWNMIX_COEF FALSE#define DEFAULT_WMA_DYNAMIC_RANGE_CONTROL Drc_high#define DEFAULT_WMA_OUTPUT_SOURROUND20 SurroundAsStream#define DEFAULT_MPEG_OUTPUTSOURROUND20 SurroundAsStream#define DEFAULT_DTS_OUTPOUT_CHANNELS Dts_LR#define DEFAULT_FIFO_SIZE 0#define DEFAULT_XFER_COUNT 0#define DEFAULT_SKIP_FIRST_N_BYTES 0#define DEFAULT_MCLK_ON_RCLK 0#define DEFAULT_TRANSCODE_EC3_TO_AC3 FALSE#define DEFAULT_AUDIO_FREQ_FROM_STREAM -1#define DEFAULT_AUTO_DETECT_CODEC FALSE#define DEFAULT_AUDIO_CP FALSE#define DEFAULT_INDEPENDENT_PDH FALSE#define DEFAULT_USE_HDMI FALSE#define DEFAULT_I2C_MODULE 0#define DEFAULT_AUDIO_INSTANCES 1RMstatus init_audio_options(struct audio_cmdline *options){	RMDBGLOG((LOCALDBG, "init_audio_options\n"));	RMMemset(options, 0, sizeof(struct audio_cmdline));		options->AudioEngineID = 0;	options->AudioDecoderID = 0;	options->Codec = AudioDecoder_Codec_AC3;	options->SubCodec = 0xFF;	options->SampleRate = 44100;	options->SamplingFrequency = 0;	options->ForceSampleRate = FALSE;	options->CaptureSource = DEFAULT_CAPTURE_SOURCE;	options->CaptureBitstream = DEFAULT_CAPTURE_BITSTREAM;	options->CaptureType = DEFAULT_CAPTURE_TYPE;	options->CaptureDelay = DEFAULT_CAPTURE_DELAY;	options->SerialOut = TRUE;		options->ExternalClk = FALSE;	options->ExternalClkFreq = 0; 	options->AudioIn = FALSE; 	options->AudioInAlign = 1; 	options->AudioInLSBfirst = FALSE; 	 	options->I2SAlign = 1; 	options->I2SSClkNormal = FALSE; 	options->I2SFrameNormal = FALSE; 	options->I2SLSBFirst = FALSE; 	options->I2S16Bit = FALSE;	options->OutputChannelsExplicitAssign = FALSE; 	options->OutputChannels = Audio_Out_Ch_LR;	options->OutputDualMode = DualMode_Stereo;	options->Spdif 		= OutputSpdif_Uncompressed;	options->dh_info = NULL;	options->dh_check = TRUE;	options->HDMIPassThrough = FALSE;	options->HDMIPassThroughI2SLines = 1;	options->HBR_Enable = FALSE;  // TRUE if HDMI HighBitRate audio is used (for Dolby TrueHD, e.g.)	options->HBR_Compressed = TRUE;	options->HBR_HeaderID = 0x09;  // 4 bit HBR packet header ID	options->OutputLfe 	= FALSE;	options->SignedPCM 	= TRUE;	options->BassMode	= 0;	options->DownSample = FALSE;			options->AACParams.InputFormat 		= 0;	// adif, no sync word//	options->AACParams.OutputLfe 		= FALSE;	options->AACParams.OutputChannels	= Aac_LR;	options->AACParams.OutputSurround20 = SurroundAsStream;	options->AACParams.Acmod2DualMode = FALSE;	//	options->BSACParams.InputFormat 	= 0;   // similar to AAC	options->BSACParams.OutputChannels	= Aac_LR;				options->Ac3Params.OutputSurround20 = SurroundAsStream;	options->Ac3Params.OutputLfe = FALSE;	options->Ac3Params.OutputChannels = Ac3_LR;	options->Ac3Params.Acmod2DualMode = FALSE;	options->Ac3Params.CompMode = CompMode_line_out;	options->Ac3Params.DynScaleHi = 0x10000000;	options->Ac3Params.DynScaleLo = 0x10000000;	options->Ac3Params.PcmScale = 0x10000000;	options->DtsParams.dts_CD = FALSE;	options->PcmCdaParams.ChannelAssign = PcmCda2_LR;	options->PcmCdaParams.BitsPerSample = 24;	options->PcmCdaParams.MsbFirst = TRUE;	options->PcmCdaParams.OutputSurround20 = SurroundAsStream;	options->LpcmVobParams.ChannelAssign = LpcmVob2_LR;	options->LpcmVobParams.BitsPerSample = 24;	options->LpcmVobParams.DownMix = FALSE;	// downmixing not yet implemented	RMMemset(options->LpcmVobParams.CoefLR, 0, sizeof(options->LpcmVobParams.CoefLR));	options->LpcmVobParams.OutputSurround20 = SurroundAsStream;	options->LpcmAobParams.ChannelAssign = LpcmAob20_LR;	options->LpcmAobParams.BitsPerSampleGroup1 = 24;	options->LpcmAobParams.BitsPerSampleGroup2 = 24;	options->LpcmAobParams.DownMix = FALSE;	// downmixing not yet implemented	options->LpcmAobParams.Group2Shift = 0;	options->LpcmAobParams.PhaseLR = 0;	options->LpcmAobParams.DownSample = 0; //no downsampling	RMMemset(options->LpcmAobParams.CoefLR, 0, sizeof(options->LpcmAobParams.CoefLR));	options->LpcmAobParams.OutputSurround20 = SurroundAsStream;	options->LpcmBDParams.ChannelAssign = PcmCda2_LR;	options->LpcmBDParams.BitsPerSample = 16;	options->LpcmBDParams.OutputSurround20 = SurroundAsStream;	options->WmaParams.OutputChannels = Audio_Out_Ch_LR;	options->WmaParams.ValidDownMixCoef = FALSE;	RMMemset(options->WmaParams.DownMixCoef, 0, sizeof(options->WmaParams.DownMixCoef));	options->WmaParams.DynamicRangeControl = Drc_high;	options->WmaParams.OutputSurround20 = SurroundAsStream;		options->MpegParams.OutputSurround20 = SurroundAsStream;	options->MpegParams.Acmod2DualMode = FALSE;	options->TToneParams.TToneType = Ttone_WhiteNoise;	options->TToneParams.TToneChannelMask = 0xff;	options->DtsParams.OutputChannels = Dts_LR;	options->DtsParams.OutputSurround20 = SurroundAsStream;	options->fifo_size = 0;	options->xfer_count = 0;	options->skip_first_n_bytes = 0;	options->send_n_bytes = 0;	options->mclk_on_rclk = 0;

⌨️ 快捷键说明

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