Skip to content

NET_SDK_EncodeAudioFrame

Interface Definition

1
2
3
4
5
6
BOOL NET_SDK_EncodeAudioFrame(
    POINTERHANDLE lEncodeHandle,
    unsigned char* pInBuffer,
    LONG inLen,
    unsigned char* pOutBuffer,
    int* pOutLen);
1
2
3
4
5
6
public static extern bool NET_SDK_EncodeAudioFrame(
    POINTERHANDLE lEncodeHandle,
    IntPtr pInBuffer,
    int inLen,
    IntPtr pOutBuffer,
    ref int pOutLen);

Function Description

Audio encoding.

Parameter Description

Parameters Type Remark
lEncodeHandlein POINTERHANDLE Audio encoder handle, the return value of NET_SDK_InitAudioEncoder.
pInBufferin unsigned char* The input buffer obtains PCM audio data according to the sampling standard (sampling frequency is 16000Hz, 16-bit sampling, single channel), and the size of the input data is specified to be 1280 bytes.
inLenin LONG The length of the input buffer pInBuffer.
pOutBufferout unsigned char* Output buffer, the encoded output data size is 80 bytes.
pOutLenout int* The length of the output buffer pOutBuffer.

Return Value

  • type:BOOL

  • remark:Returns TRUE if successful, FALSE if failed.

Remarks

It is mainly set to cooperate with the voice intercom and forwarding functions. When the original audio data of the client needs to be sent to the device, the audio encoding function can be used to compress and encode the original data before sending it to the device. The client obtains the compressed code stream sent by the device and can call the audio decoding function NET_SDK_DecodeAudioFrame to decode the data. Before calling the encoding and decoding function, you need to do the corresponding initialization operation, and after the call, you need to release the resources.

Error Code