This function performs dual encoding of H.264 video frames. The encoder supports dual channels where each channel can have a different configuration. It allows for one image encoder per channel and cannot code multiple images consecutively per channel. For IDR frame, the encoder will automatically add SPS and PPS NALU.
- Note
- The function will return ESP_H264_ERR_TIMEOUT, if
out_frame.raw_data.len is less than actual encoded data length using hardware encoder. If the width or height of image is not multi of 16, please do the follow operation. width = ((width +15) >> 4 << 4); height = ((height+15) >> 4 << 4); in_frame.raw_data.len = ( width * height + (width * height >> 1)); in_frame.raw_data.buffer = heap_caps_aligned_calloc(16, 1, in_frame.raw_data.len, &in_frame.raw_data.len, MALLOC_CAP_DEFAULT); The out_frame.raw_data.buffer should be allocated by the user for in_frame.raw_data.len bytes to avoid the encoded image size exceeding the out_frame.raw_data.buffer size. If the encoder image size is larger than out_frame.raw_data.buffer, it will result in ESP_H264_ERR_MEM.
- Parameters
-
| [in] | enc | A pointer to the H.264 dual encoder instance |
| [in] | in_frame | An array of two pointers to unencoded input frames |
| [in/out] | out_frame An array of two pointers to encoded output frames |
- Returns
-
- ESP_H264_ERR_OK Succeeded
- ESP_H264_ERR_ARG Invalid arguments passed
- ESP_H264_ERR_MEM Insufficient memory
- ESP_H264_ERR_FAIL Failed
- ESP_H264_ERR_TIMEOUT Timeout
- ESP_H264_ERR_OVERFLOW The size of encoder image is greater than
in_frame.raw_data.len
- ESP_H264_ERR_UNSUPPORTED Process feature is not supported by the encoder