H.264 Codec for ESP32-S3
Loading...
Searching...
No Matches
esp_h264_enc_param.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#pragma once
8
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15/**
16 * @brief It is a pointer to the H.264 encoding parameters structure
17 */
19
20/**
21 * @brief The H.264 encoder parameter interface
22 */
23typedef struct esp_h264_enc_param_if {
24 esp_h264_err_t (*get_res)(esp_h264_enc_param_handle_t handle, esp_h264_resolution_t *res); /*<! Get resolution function */
25 esp_h264_err_t (*set_fps)(esp_h264_enc_param_handle_t handle, uint8_t fps); /*<! Set frames per second(FPS) function */
26 esp_h264_err_t (*get_fps)(esp_h264_enc_param_handle_t handle, uint8_t *fps); /*<! Get frames per second(FPS) function */
27 esp_h264_err_t (*set_gop)(esp_h264_enc_param_handle_t handle, uint8_t gop); /*<! Set group of picture(GOP) function */
28 esp_h264_err_t (*get_gop)(esp_h264_enc_param_handle_t handle, uint8_t *gop); /*<! Get group of picture(GOP) function */
29 esp_h264_err_t (*set_bitrate)(esp_h264_enc_param_handle_t handle, uint32_t bitrate); /*<! Set bitrate function */
30 esp_h264_err_t (*get_bitrate)(esp_h264_enc_param_handle_t handle, uint32_t *bitrate); /*<! Get bitrate function */
31} esp_h264_enc_param_t;
32
33/**
34 * @brief This function retrieves the resolution of the video encoder specified by the handle parameter
35 * The encoder's resolution is stored in the `res`, which is of type esp_h264_resolution_t
36 *
37 * @param[in] handle It is a pointer to the H.264 encoding parameters structure
38 * @param[out] out_res A pointer to the resolution structure where the encoder's resolution will be stored
39 *
40 * @return
41 * - ESP_H264_ERR_OK Succeeded
42 * - ESP_H264_ERR_ARG Invalid arguments passed
43 * - ESP_H264_ERR_UNSUPPORTED Get resolution feature is not supported by the encoder
44 */
45esp_h264_err_t esp_h264_enc_get_resolution(esp_h264_enc_param_handle_t handle, esp_h264_resolution_t *out_res);
46
47/**
48 * @brief This function sets the frames per second (FPS) parameter for the H.264 encoder
49 *
50 * @note The higher FPS, the more coherent and realistic the video.
51 * When FPS is greater than 24, the general video seems coherent.
52 * When FPS is greater than 30, the game video seems coherent.
53 * When FPS is greater than 75, increase FPS, the video fluency improvement isn't obvious.
54 * Ensure the `fps` value is within the range of 1 to 255.
55 * This function may return ESP_H264_ERR_ARG if `fps` value is out of range.
56 *
57 * @param[in] handle It is a pointer to the H.264 encoding parameters structure
58 * @param[in] fps The desired FPS value (a single byte)
59 *
60 * @return
61 * - ESP_H264_ERR_OK Succeeded
62 * - ESP_H264_ERR_ARG Invalid arguments passed
63 * - ESP_H264_ERR_UNSUPPORTED Set FPS feature is not supported by the encoder
64 */
65esp_h264_err_t esp_h264_enc_set_fps(esp_h264_enc_param_handle_t handle, uint8_t fps);
66
67/**
68 * @brief This function is used to retrieve the frames per second (FPS) from the encoder
69 *
70 * @param[in] handle It is a pointer to the H.264 encoding parameters structure
71 * @param[out] out_fps Pointer to a variable to store the retrieved FPS value
72 *
73 * @return
74 * - ESP_H264_ERR_OK Succeeded
75 * - ESP_H264_ERR_ARG Invalid arguments passed
76 * - ESP_H264_ERR_UNSUPPORTED Get FPS feature is not supported by the encoder
77 */
78esp_h264_err_t esp_h264_enc_get_fps(esp_h264_enc_param_handle_t handle, uint8_t *out_fps);
79
80/**
81 * @brief This function sets the group of picture(GOP) parameter for the H.264 encoder
82 *
83 * @note GOP is usually set to the number of frames per second output by the encoder,
84 * that is, the GOP, which is generally 25 or 30, but other values can also be set.
85 * Ensure the `gop` value is within the range of 1 to 255.
86 * This function may return ESP_H264_ERR_ARG if `gop` value is out of range.
87 *
88 * @param[in] handle It is a pointer to the H.264 encoding parameters structure.
89 * @param[in] gop The desired GOP value (a single byte)
90 *
91 * @return
92 * - ESP_H264_ERR_OK Succeeded
93 * - ESP_H264_ERR_ARG Invalid arguments passed
94 * - ESP_H264_ERR_UNSUPPORTED Set GOP feature is not supported by the encoder
95 */
96esp_h264_err_t esp_h264_enc_set_gop(esp_h264_enc_param_handle_t handle, uint8_t gop);
97
98/**
99 * @brief This function is used to retrieve the group of picture(GOP) from the encoder.
100 *
101 * @param[in] handle It is a pointer to the H.264 encoding parameters structure.
102 * @param[out] out_gop Pointer to a variable to store the retrieved GOP value
103 *
104 * @return
105 * - ESP_H264_ERR_OK Succeeded
106 * - ESP_H264_ERR_ARG Invalid arguments passed
107 * - ESP_H264_ERR_UNSUPPORTED Get GOP feature is not supported by the encoder
108 */
109esp_h264_err_t esp_h264_enc_get_gop(esp_h264_enc_param_handle_t handle, uint8_t *out_gop);
110
111/**
112 * @brief This function sets the bitrate parameter for the H.264 encoder
113 *
114 * @param[in] handle It is a pointer to the H.264 encoding parameters structure
115 * @param[in] bitrate The desired bitrate value
116 *
117 * @return
118 * - ESP_H264_ERR_OK Succeeded
119 * - ESP_H264_ERR_ARG Invalid arguments passed
120 * - ESP_H264_ERR_UNSUPPORTED Set bitrate feature is not supported by the encoder
121 */
122esp_h264_err_t esp_h264_enc_set_bitrate(esp_h264_enc_param_handle_t handle, uint32_t bitrate);
123
124/**
125 * @brief This function is used to retrieve the bitrate from the encoder
126 *
127 * @param[in] handle It is a pointer to the H.264 encoding parameters structure
128 * @param[out] out_bitrate Pointer to a variable to store the retrieved bitrate value
129 *
130 * @return
131 * - ESP_H264_ERR_OK Succeeded
132 * - ESP_H264_ERR_ARG Invalid arguments passed
133 * - ESP_H264_ERR_UNSUPPORTED Get bitrate feature is not supported by the encoder
134 */
135esp_h264_err_t esp_h264_enc_get_bitrate(esp_h264_enc_param_handle_t handle, uint32_t *out_bitrate);
136
137/**
138 * @brief This function is used to retrieve the bits per pixel from the encoder
139 *
140 * @param[in] handle It is a pointer to the H.264 encoding parameters structure
141 * @param[out] out_bpp Pointer to a variable to store the retrieved bits per pixel value
142 *
143 * @return
144 * - ESP_H264_ERR_OK Succeeded
145 * - ESP_H264_ERR_ARG Invalid arguments passed
146 */
147esp_h264_err_t esp_h264_enc_get_bpp(esp_h264_enc_param_handle_t handle, float *out_bpp);
148
149#ifdef __cplusplus
150}
151#endif
esp_h264_err_t esp_h264_enc_get_bitrate(esp_h264_enc_param_handle_t handle, uint32_t *out_bitrate)
This function is used to retrieve the bitrate from the encoder.
Definition: esp_h264_enc_param.c:59
esp_h264_err_t esp_h264_enc_set_bitrate(esp_h264_enc_param_handle_t handle, uint32_t bitrate)
This function sets the bitrate parameter for the H.264 encoder.
Definition: esp_h264_enc_param.c:52
esp_h264_err_t esp_h264_enc_get_gop(esp_h264_enc_param_handle_t handle, uint8_t *out_gop)
This function is used to retrieve the group of picture(GOP) from the encoder.
Definition: esp_h264_enc_param.c:44
esp_h264_err_t esp_h264_enc_set_gop(esp_h264_enc_param_handle_t handle, uint8_t gop)
This function sets the group of picture(GOP) parameter for the H.264 encoder.
Definition: esp_h264_enc_param.c:36
esp_h264_err_t esp_h264_enc_get_resolution(esp_h264_enc_param_handle_t handle, esp_h264_resolution_t *out_res)
This function retrieves the resolution of the video encoder specified by the handle parameter The enc...
Definition: esp_h264_enc_param.c:12
esp_h264_err_t esp_h264_enc_set_fps(esp_h264_enc_param_handle_t handle, uint8_t fps)
This function sets the frames per second (FPS) parameter for the H.264 encoder.
Definition: esp_h264_enc_param.c:20
esp_h264_err_t esp_h264_enc_get_fps(esp_h264_enc_param_handle_t handle, uint8_t *out_fps)
This function is used to retrieve the frames per second (FPS) from the encoder.
Definition: esp_h264_enc_param.c:28
esp_h264_err_t esp_h264_enc_get_bpp(esp_h264_enc_param_handle_t handle, float *out_bpp)
This function is used to retrieve the bits per pixel from the encoder.
struct esp_h264_enc_param_if * esp_h264_enc_param_handle_t
It is a pointer to the H.264 encoding parameters structure.
Definition: esp_h264_enc_param.h:18
The H.264 encoder parameter interface.
Definition: esp_h264_enc_param.h:23