H.264 Codec for ESP32-S3
Loading...
Searching...
No Matches
esp_h264_dec.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 Decoder configure information
17 */
18typedef struct {
19 esp_h264_raw_format_t pic_type; /*<! Data format after decoding */
20} esp_h264_dec_cfg_t;
21
22/**
23 * @brief H.264 stream decoder handle
24 */
26
27/**
28 * @brief The H.264 stream decoder interface
29 */
30typedef struct esp_h264_dec_if {
31 esp_h264_err_t (*open)(esp_h264_dec_handle_t dec); /*<! The open function */
32 esp_h264_err_t (*process)(esp_h264_dec_handle_t dec, esp_h264_dec_in_frame_t *in_frame,
33 esp_h264_dec_out_frame_t *out_frame); /*<! The process function */
34 esp_h264_err_t (*close)(esp_h264_dec_handle_t dec); /*<! The close function */
35 esp_h264_err_t (*del)(esp_h264_dec_handle_t dec); /*<! The delete function */
36} esp_h264_dec_t;
37
38/**
39 * @brief This function opens an H.264 decoder in stream
40 *
41 * @param[in] dec A pointer to the H.264 decoder instance
42 *
43 * @return
44 * - ESP_H264_ERR_OK Succeeded
45 * - ESP_H264_ERR_FAIL Failed
46 * - ESP_H264_ERR_ARG Invalid arguments passed
47 * - ESP_H264_ERR_UNSUPPORTED Open feature is not supported by the decoder
48 */
50
51/**
52 * @brief This function performs decoding of H.264 video frames.
53 *
54 * @param[in] dec A pointer to the H.264 decoder instance
55 * @param[in] in_frame A pointer to encoded input frame
56 * @param[in/out] out_frame A pointer to store decoded output frame.
57 * The `out_frame->outbuf` will store an image data address after decoding.
58 * This address will be re-used in `esp_h264_dec_process`.
59 * Users, ensure to retrieve the data in the address promptly.
60 * If the NALU is not related to image data like SPS, PPS, etc., `out_frame->out_size` will return 0.
61 *
62 * @return
63 * - ESP_H264_ERR_OK Succeeded
64 * - ESP_H264_ERR_ARG Invalid arguments passed
65 * - ESP_H264_ERR_MEM Insufficient memory
66 * - ESP_H264_ERR_FAIL Failed
67 * - ESP_H264_ERR_UNSUPPORTED Process feature is not supported by the decoder
68 */
69esp_h264_err_t esp_h264_dec_process(esp_h264_dec_handle_t dec, esp_h264_dec_in_frame_t *in_frame, esp_h264_dec_out_frame_t *out_frame);
70
71/**
72 * @brief This function closes the H.264 decoder instance specified by `dec`
73 *
74 * @param[in] dec A pointer to the H.264 decoder instance
75 *
76 * @return
77 * - ESP_H264_ERR_OK Succeeded
78 * - ESP_H264_ERR_ARG Invalid arguments passed
79 * - ESP_H264_ERR_UNSUPPORTED Close feature is not supported by the decoder
80 */
82
83/**
84 * @brief This function is used to delete an H.264 decoder
85 *
86 * @param[in] dec A pointer to the H.264 decoder instance
87 *
88 * @return
89 * - ESP_H264_ERR_OK Succeeded
90 * - ESP_H264_ERR_ARG Invalid arguments passed
91 * - ESP_H264_ERR_UNSUPPORTED Delete feature is not supported by the decoder
92 */
93esp_h264_err_t esp_h264_dec_del(esp_h264_dec_handle_t dec);
94
95#ifdef __cplusplus
96}
97#endif
esp_h264_err_t esp_h264_dec_process(esp_h264_dec_handle_t dec, esp_h264_dec_in_frame_t *in_frame, esp_h264_dec_out_frame_t *out_frame)
This function performs decoding of H.264 video frames.
Definition: esp_h264_dec.c:19
esp_h264_err_t esp_h264_dec_del(esp_h264_dec_handle_t dec)
This function is used to delete an H.264 decoder.
Definition: esp_h264_dec.c:34
esp_h264_err_t esp_h264_dec_open(esp_h264_dec_handle_t dec)
This function opens an H.264 decoder in stream.
Definition: esp_h264_dec.c:12
esp_h264_err_t esp_h264_dec_close(esp_h264_dec_handle_t dec)
This function closes the H.264 decoder instance specified by dec
Definition: esp_h264_dec.c:27
struct esp_h264_dec_if * esp_h264_dec_handle_t
H.264 stream decoder handle.
Definition: esp_h264_dec.h:25
esp_h264_raw_format_t pic_type
Definition: esp_h264_dec.h:19
The H.264 stream decoder interface.
Definition: esp_h264_dec.h:30