RDK-V RMF AudioCapture HAL 0.2.0
 
Loading...
Searching...
No Matches
RMF Audio Capture HAL
Collaboration diagram for RMF Audio Capture HAL:

Data Structures

struct  RMF_AudioCapture_Settings
 Configuration parameters of audio capture interface. More...
 
struct  RMF_AudioCapture_Status
 Status of audio capture interface. More...
 

Macros

#define RMF_ERROR   (1)
 
#define RMF_INVALID_PARM   (2)
 
#define RMF_AC_TYPE_PRIMARY   "primary"
 Primary audio that is currently selected to play with video.
 
#define RMF_AC_TYPE_AUXILIARY   "auxiliary"
 Audio source that is different from primary audio - can be audio track with a different language.
 

Typedefs

typedef struct RMF_AudioCapture_Struct * RMF_AudioCaptureHandle
 Opaque handle to an instance of RMF AudioCapture interface.
 
typedef char * RMF_AudioCaptureType
 Audio source to be captured. Options are RMF_AC_TYPE_PRIMARY or RMF_AC_TYPE_AUXILIARY.
 
typedef enum RMF_AudioCapture_Format racFormat
 Describes more specifics about the audio parameters to be used for audio samples.
 
typedef enum RMF_AudioCapture_Freq racFreq
 Audio sampling rate.
 
typedef rmf_Error(* RMF_AudioCaptureBufferReadyCb) (void *cbBufferReadyParm, void *AudioCaptureBuffer, unsigned int AudioCaptureBufferSize)
 Callbacks.
 
typedef rmf_Error(* RMF_AudioCapture_StatusChangeCb) (void *cbStatusParm)
 Callback for underlying implementation to signal a change in status.
 
typedef struct RMF_AudioCapture_Settings RMF_AudioCapture_Settings
 Configuration parameters of audio capture interface.
 
typedef struct RMF_AudioCapture_Status RMF_AudioCapture_Status
 Status of audio capture interface.
 

Enumerations

enum  RMF_AudioCapture_Format {
  racFormat_e16BitStereo , racFormat_e24BitStereo , racFormat_e16BitMonoLeft , racFormat_e16BitMonoRight ,
  racFormat_e16BitMono , racFormat_e24Bit5_1 , racFormat_eMax
}
 Describes more specifics about the audio parameters to be used for audio samples. More...
 
enum  RMF_AudioCapture_Freq {
  racFreq_e16000 , racFreq_e22050 , racFreq_e24000 , racFreq_e32000 ,
  racFreq_e44100 , racFreq_e48000 , racFreq_eMax
}
 Audio sampling rate. More...
 

Functions

rmf_Error RMF_AudioCapture_Open (RMF_AudioCaptureHandle *handle)
 Opens the audio capture interface for primary audio.
 
rmf_Error RMF_AudioCapture_Open_Type (RMF_AudioCaptureHandle *handle, RMF_AudioCaptureType rmfAcType)
 Opens the audio capture interface for specified audio source.
 
rmf_Error RMF_AudioCapture_GetStatus (RMF_AudioCaptureHandle handle, RMF_AudioCapture_Status *status)
 Gets the current status of audio capture interface.
 
rmf_Error RMF_AudioCapture_GetDefaultSettings (RMF_AudioCapture_Settings *settings)
 Returns friendly default values for RMF_AudioCapture_Settings.
 
rmf_Error RMF_AudioCapture_GetCurrentSettings (RMF_AudioCaptureHandle handle, RMF_AudioCapture_Settings *settings)
 Returns current values of RMF_AudioCapture_Settings in effect.
 
rmf_Error RMF_AudioCapture_Start (RMF_AudioCaptureHandle handle, RMF_AudioCapture_Settings *settings)
 Starts audio capture.
 
rmf_Error RMF_AudioCapture_Stop (RMF_AudioCaptureHandle handle)
 Stops audio capture.
 
rmf_Error RMF_AudioCapture_Close (RMF_AudioCaptureHandle handle)
 Closes the audio capture interface.
 

Detailed Description

Macro Definition Documentation

◆ RMF_AC_TYPE_AUXILIARY

#define RMF_AC_TYPE_AUXILIARY   "auxiliary"

Audio source that is different from primary audio - can be audio track with a different language.

◆ RMF_AC_TYPE_PRIMARY

#define RMF_AC_TYPE_PRIMARY   "primary"

Primary audio that is currently selected to play with video.

◆ RMF_ERROR

#define RMF_ERROR   (1)

◆ RMF_INVALID_PARM

#define RMF_INVALID_PARM   (2)

Typedef Documentation

◆ racFormat

Describes more specifics about the audio parameters to be used for audio samples.

◆ racFreq

Audio sampling rate.

◆ RMF_AudioCapture_Settings

typedef struct RMF_AudioCapture_Settings RMF_AudioCapture_Settings

Configuration parameters of audio capture interface.

◆ RMF_AudioCapture_Status

typedef struct RMF_AudioCapture_Status RMF_AudioCapture_Status

Status of audio capture interface.

◆ RMF_AudioCapture_StatusChangeCb

typedef rmf_Error(* RMF_AudioCapture_StatusChangeCb) (void *cbStatusParm)

Callback for underlying implementation to signal a change in status.

RDK may then call RMF_AudioCapture_GetStatus() to get more details

Parameters
[in]cbStatusParm- Caller context data passed back (optional) in the callback
Returns
Indicates an error if a non-zero value is returned.
Return values
RMF_ERRORGeneral error
RMF_INVALID_PARMInvalid parameter
See also
RMF_AudioCapture_Settings, RMF_AudioCapture_Start()

◆ RMF_AudioCaptureBufferReadyCb

typedef rmf_Error(* RMF_AudioCaptureBufferReadyCb) (void *cbBufferReadyParm, void *AudioCaptureBuffer, unsigned int AudioCaptureBufferSize)

Callbacks.

Callback via which SoC will send captured audio samples

The callback will not take ownership of AudioCaptureBuffer. It will consume the audio data completely before returning and it is the responsibility of the caller to free/manage this memory.

Parameters
[in]cbBufferReadyParm- Caller context data passed back (optional) in the callback
[in]AudioCaptureBuffer- Pointer to the buffer holding audio data
[in]AudioCaptureBufferSize- Size of audio data available in buffer
Returns
Indicates an error if a non-zero value is returned
Return values
RMF_ERRORGeneral error
RMF_INVALID_PARMInvalid parameter
See also
RMF_AudioCapture_Settings, RMF_AudioCapture_Start()

◆ RMF_AudioCaptureHandle

typedef struct RMF_AudioCapture_Struct* RMF_AudioCaptureHandle

Opaque handle to an instance of RMF AudioCapture interface.

◆ RMF_AudioCaptureType

typedef char* RMF_AudioCaptureType

Audio source to be captured. Options are RMF_AC_TYPE_PRIMARY or RMF_AC_TYPE_AUXILIARY.

Enumeration Type Documentation

◆ RMF_AudioCapture_Format

Describes more specifics about the audio parameters to be used for audio samples.

Enumerator
racFormat_e16BitStereo 

Stereo, 16 bits per sample interleaved into a 32-bit word.

racFormat_e24BitStereo 

Stereo, 24 bits per sample. The data is aligned to 32-bits left-justified. Left and right channels will interleave one sample per 32-bit word.

racFormat_e16BitMonoLeft 

Mono, 16 bits per sample interleaved into a 32-bit word. Left channel samples only.

racFormat_e16BitMonoRight 

Mono, 16 bits per sample interleaved into a 32-bit word. Right channel samples only.

racFormat_e16BitMono 

Mono, 16 bits per sample interleaved into a 32-bit word. Left and Right channels mixed.

racFormat_e24Bit5_1 

5.1 Multichannel, 24 bits per sample. The data is aligned to 32-bits, left-justified. Channels will interleave one sample per 32-bit word, ordered L,R,Ls,Rs,C,LFE

racFormat_eMax 

◆ RMF_AudioCapture_Freq

Audio sampling rate.

Enumerator
racFreq_e16000 

16KHz

racFreq_e22050 

22.05KHz

racFreq_e24000 

24KHz

racFreq_e32000 

32KHz

racFreq_e44100 

44.1KHz

racFreq_e48000 

48KHz

racFreq_eMax 

Function Documentation

◆ RMF_AudioCapture_Close()

rmf_Error RMF_AudioCapture_Close ( RMF_AudioCaptureHandle handle)

Closes the audio capture interface.

This call must free all resources acquired since RMF_AudioCapture_Open() call and will invalidate the handle. The caller will not go directly from STARTED to CLOSED state; it will call stop beforehand. RMF_AudioCapture may choose to open the interface again using RMF_AudioCapture_Open() in future.

Parameters
[in]handle- Handle of the audio capture interface.
Returns
rmf_Error
Return values
RMF_ERRORGeneral error
See also
RMF_AudioCapture_Start(), RMF_AudioCapture_Close(), RMF_AudioCapture_Open()
Precondition
Must call RMF_AudioCapture_Open() before invoking this function
If RMF_AudioCapture_Start() was invoked, capture must be stopped by calling RMF_AudioCapture_Stop() first

◆ RMF_AudioCapture_GetCurrentSettings()

rmf_Error RMF_AudioCapture_GetCurrentSettings ( RMF_AudioCaptureHandle handle,
RMF_AudioCapture_Settings * settings )

Returns current values of RMF_AudioCapture_Settings in effect.

The output should match the configuration previously set successfully via RMF_AudioCapture_Start()

Parameters
[in]handle- Handle of the audio capture interface.
[out]settings- current values of audio capture Settings. The life-cycle of settings will be managed by the caller.
Returns
rmf_Error
Return values
RMF_ERRORGeneral error
RMF_INVALID_PARMInvalid parameter
See also
RMF_AudioCapture_Start()
Precondition
Must call RMF_AudioCapture_Start() before invoking this function

◆ RMF_AudioCapture_GetDefaultSettings()

rmf_Error RMF_AudioCapture_GetDefaultSettings ( RMF_AudioCapture_Settings * settings)

Returns friendly default values for RMF_AudioCapture_Settings.

Caller will use this to understand what audio-related parameters preferable for this interface. Caller may then use this structure as a baseline and tweak only stricly necessary parameters before passing it with RMF_AudioCapture_Start(). The defaults are not expected to change no matter how the capture interface was configured by caller previously (if at all). Caller will only call this API when the interface is in OPEN or STARTED state.

Parameters
[out]settings- Default values for audio capture settings. The life-cycle of settings will be managed by the caller.
Returns
rmf_Error
Return values
RMF_ERRORGeneral error
RMF_INVALID_PARMInvalid parameter
See also
RMF_AudioCapture_Start()

◆ RMF_AudioCapture_GetStatus()

rmf_Error RMF_AudioCapture_GetStatus ( RMF_AudioCaptureHandle handle,
RMF_AudioCapture_Status * status )

Gets the current status of audio capture interface.

This API can be called as long as a valid handle is available (after opening and before close). API may be invoked as a resonse to RMF_AudioCapture_StatusChangeCb(), possibly inside the callback itself.

Parameters
[in]handle- Handle of the audio capture interface.
[out]status- Status returned by the underlying implementation. The life-cycle of status will be managed by the caller.
Returns
rmf_Error
Return values
RMF_ERRORGeneral error
RMF_INVALID_PARMInvalid parameter
Precondition
Must possess a valid handle obtained using RMF_AudioCapture_Open() before invoking this function.
See also
RMF_AudioCapture_Open()

◆ RMF_AudioCapture_Open()

rmf_Error RMF_AudioCapture_Open ( RMF_AudioCaptureHandle * handle)

Opens the audio capture interface for primary audio.

This function or RMF_AudioCapture_Open_Type() will be the first call when this library is used. Any other interface exposed by this library. Underlying implementation must acquire the necessary hardware and software resources necessary to capture audio. RMF_AudioCapture doesn't expect more than one primary capture session to be available concurrently and will close the open session before calling open again.

Parameters
[out]handle- An opaque capture interface handle, which should not be modified by caller and has to be passed as an argument for all subsequent API calls.
Returns
rmf_Error
Return values
RMF_ERRORGeneral error
RMF_INVALID_PARMInvalid parameter
See also
RMF_AudioCapture_Close()
Note
Should the application crash, it's recommended that the HAL be capable of automatically releasing any hardware resources, either when terminating or when the application restarts and RMF_AudioCapture_Open()/RMF_AudioCapture_Open_Type() again

◆ RMF_AudioCapture_Open_Type()

rmf_Error RMF_AudioCapture_Open_Type ( RMF_AudioCaptureHandle * handle,
RMF_AudioCaptureType rmfAcType )

Opens the audio capture interface for specified audio source.

This function or RMF_AudioCapture_Open() will be the first call when this library is used. Underlying implementation must acquire the necessary hardware and software resources to capture audio. RMF_AudioCapture may have both primary and auxiliary capture sessions open at the same time. There will not be more than one capture session open for the same capture type at any point of time.

Parameters
[out]handle- An opaque capture interface handle, which should not be modified by caller and has to be passed as an argument for all subsequent API calls.
[in]rmfAcType- Source of audio to be captured (primary or auxiliary).
Returns
rmf_Error
Return values
RMF_ERRORGeneral error
RMF_INVALID_PARMInvalid parameter
See also
RMF_AudioCapture_Close()
Note
Should the application crash, it's recommended that the HAL be capable of automatically releasing any hardware resources, either when terminating or when the application restarts and calls RMF_AudioCapture_Open()/RMF_AudioCapture_Open_Type() again.

◆ RMF_AudioCapture_Start()

rmf_Error RMF_AudioCapture_Start ( RMF_AudioCaptureHandle handle,
RMF_AudioCapture_Settings * settings )

Starts audio capture.

HAL must apply the new settings before starting audio capture. Underlying implementation must invoke RMF_AudioCaptureBufferReadyCb() repeatedly to deliver the data in accordance with the FIFO thresholds set. This process must continue until RMF_AudioCapture_Stop() is called. Once stopped, RMF_AudioCapture may call RMF_AudioCapture_Start() again so long as RMF_AudioCapture_Close() hasn't been invoked yet. settings.cbBufferReady is not allowed to be NULL.

Parameters
[in]handle- Handle of the audio capture interface.
[in]settings- Capture settings to use. The life-cycle of settings will be managed by the caller.
Returns
rmf_Error
Return values
RMF_ERRORGeneral error
RMF_INVALID_PARMInvalid settings
See also
RMF_AudioCapture_Stop(), RMF_AudioCaptureBufferReadyCb(), RMF_AudioCapture_GetDefaultSettings(), RMF_AudioCapture_Close()
Precondition
Must call RMF_AudioCapture_Open() before invoking this function

◆ RMF_AudioCapture_Stop()

rmf_Error RMF_AudioCapture_Stop ( RMF_AudioCaptureHandle handle)

Stops audio capture.

Underlying implementation must no longer generate RMF_AudioCaptureBufferReadyCb() calls after this. Caller may choose to call RMF_AudioCapture_Start() again to restart capture as long as RMF_AudioCapture_Close() hasn't been called.

Parameters
[in]handle- Handle of the audio capture interface.
Returns
rmf_Error
Return values
RMF_ERRORGeneral error.
See also
RMF_AudioCapture_Start(), RMF_AudioCaptureBufferReadyCb(), RMF_AudioCapture_Close()
Precondition
Must call RMF_AudioCapture_Start() before invoking this function