📄 audio.h
字号:
/* * * Copyright (c) 2001-2007 Sigma Designs, Inc. * All Rights Reserved. Proprietary and Confidential. * *//** @file audio.h @brief functions to set up the emhwlib audio passthrough (no external chip interaction) @author Christian Wolff Sean.Sekwon.Choi*/#ifndef __AUDIO_H__#define __AUDIO_H__struct cap_audio_instance;/*enum audio_state { audio_state_off, // no audio present audio_state_request, // request audio, wait up to 200 mSec for stable clock audio_state_on // audio is running};*//* parameter for the audio capture */struct cap_audio_setup { RMuint32 AudioEngineID; // index of the emhwlib module AudioEngine RMuint32 AudioCaptureID; // index of the emhwlib module AudioCapture RMuint32 AudioDecoderID; // index of the emhwlib module AudioDecoder RMuint32 VideoCaptureModuleID; // emhwlib module ID of the video/graphic input RMuint32 STCTimerNumber; // STC timer to be used RMuint32 BitsPerSample; // for PCM, 16 or 24 bits per sample RMuint32 SampleRate; // nominal sample rate of the captured audio RMuint32 CaptureSource; // 0=I2S, 1=SPDIF 2=SPDIF from I2S pin RMuint32 CaptureBitstream; // selected bit stream number in the SPDIF header RMuint32 CaptureType; // PCM or compressed ??? (unused) RMuint32 CaptureDelay; // delay between the audio capture and playback, in units of 90 kHz RMbool ExternalClk; // FALSE: use internallly generated clock to play back captured audio, TRUE: use external clock from RClkIn0 pin RMuint32 ExternalClkFreq; // If ExternalClk==TRUE, nominal frequency of the clock at RClkIn0 pin RMbool AudioInTandem; // TODO: If TRUE, play back captured audio on both audio engines (not yet implemented) RMuint32 AudioInAlign; // I2S bit alignment for the capture (0..31) RMbool AudioInLSBfirst; // I2S bit order (FALSE: MSB first, TRUE: LSB first) RMbool AudioInFrameInvert; // I2S sample order (FALSE: left sample on low LRClk, TRUE: left sample on high) RMbool AudioInSClkNegEdge; // I2S clock polarity (FALSE: bit sampled on rising edge, TRUE: bit sampled on falling edge) RMbool audio_free_run; // TRUE: don't syncronize audio playback to the PTS's of the capture, rely on the audio clock coherency instead};/* create the audio instace */RMstatus cap_audio_open( struct RUA *pRUA, struct DCC *pDCC, struct rmcapture_options *cap_opt, struct cap_audio_instance **ppAudio);/* destroy the audio instance, close open capture */RMstatus cap_audio_close( struct cap_audio_instance *pAudio);/* provide setup info to the audio capture */RMstatus cap_audio_setup( struct cap_audio_instance *pAudio, struct cap_audio_setup *pSetup); // necessary info for the audio capture/* retreive current SPDIF channel status and payload header info from em8xxx */RMstatus cap_audio_get_spdif_channel_status( struct cap_audio_instance *pAudio, struct AudioEngine_InputSPDIFStatus_type *pStat);/* Stops capture */RMstatus cap_audio_stop_capture( struct cap_audio_instance *pAudio);/* Initializes and starts capture */RMstatus cap_audio_start_capture( struct cap_audio_instance *pAudio);void cap_audio_print_bitstream_fifo_info( struct cap_audio_instance *pAudio, RMuint32 threshold);/* Stops capture, and playback of captured audio */RMstatus cap_audio_stop_passthrough( struct cap_audio_instance *pAudio);/* Initializes and starts capture, and playback of captured audio *//* This function needs audio_opt for the audio playback *//* If your application is using a different method to set up the audio decoder, follow this example for the passthrough */RMstatus cap_audio_start_passthrough( struct cap_audio_instance *pAudio);/** Detetct audio codec from 86xx SI channel status and from Pc/Pe values parsed by audio uCode Input: stat->ChannelStatus stat->Pc stat->Pe pAudio->Setup.BitsPerSample (capture 16 or 24 bit from I2S) Fills in: pAudio->auto_detect_codec (TRUE: codec could not be determined) pAudio->audio_opt->Codec pAudio->audio_opt optional values for that codec pAudio->audio_opt->OutputChannels (PCM only)*//* This function needs audio_opt for the audio playback */RMstatus cap_audio_get_codec_from_spdif_info( struct cap_audio_instance *pAudio, struct AudioEngine_InputSPDIFStatus_type *stat);/** set up auto-detection of audio codec. if capturing from SPDIF, start audio passthrough to enable parsing of Pc/Pd values from stream *//* This function needs audio_opt for the audio playback */RMstatus start_detect_audio( struct cap_audio_instance *pAudio);/* transition to a new audio state, and perform the necessary actions of that transition */RMstatus cap_audio_set_state( struct cap_audio_instance *pAudio, enum audio_state audio_state);/* handle steps of the audio state machine */RMstatus cap_audio_check_state( struct cap_audio_instance *pAudio);#endif // __AUDIO_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -