libxcoder  3.5.1
ni_dec_api_logan.h
Go to the documentation of this file.
1 #pragma once
2 #ifdef __cplusplus
3 extern "C"
4 {
5 #endif
6 #include <errno.h>
7 #include <stddef.h>
8 #include "ni_defs_logan.h"
9 #include "ni_rsrc_api_logan.h"
10 #include "ni_util_logan.h"
11 #include "ni_device_api_logan.h"
12 #include "ni_av_codec_logan.h"
13 
14 #define NI_LOGAN_NAL_VPS_BIT (0x01)
15 #define NI_LOGAN_NAL_SPS_BIT (0x01<<1)
16 #define NI_LOGAN_NAL_PPS_BIT (0x01<<2)
17 #define NI_LOGAN_GENERATE_ALL_NAL_HEADER_BIT (0x01<<3)
18 /* enum for decode flush buffers status */
19 typedef enum
20 {
24 };
25 
26 typedef struct _ni_logan_dec_context_t {
27  /* below are sync up from ffmpeg */
28  char *dev_xcoder; /* from the user command, which device allocation method we use */
29  char *dev_xcoder_name; /* dev name of the xcoder card to use */
30  char *blk_xcoder_name; /* blk name of the xcoder card to use */
31  int dev_dec_idx; /* index of the decoder on the xcoder card */
32  char *dev_dec_name; /* name of the decoder on the xcoder card */
33  int keep_alive_timeout; /* keep alive timeout setting */
34  int set_high_priority; /* set_high_priority */
35  int ff_log_level; /* ffmpeg log level */
36  char *xcoder_opts;
38  int enable_check_packet; // check source packet. Skip SEI payloads after VCL
40  int low_delay;
42  int fps_num;
43  int fps_denom;
44  long bit_rate;
45  int width;
46  int height;
50 
52  int dec_wait; // in us
53 
55  void *p_param;
58 
59  // stream header copied/saved from AVCodecContext.extradata
61  uint8_t *extradata;
63 
64  int64_t current_pts;
65  /* offset of the cur. pkt relative to the start of the bit stream. used to */
66  /* track the returned decoded frame and retrieve its saved pts */
67  unsigned long long offset;
68 
69  int started;
70  int draining;
71  int flushing;
72  int eos;
76 
77 /*!*****************************************************************************
78  * \brief Initialize decode parameters and open decoder device
79  * including ni_logan_dec_context_t,
80  * ni_logan_session_context_t,
81  * ni_logan_decoder_params_t
82  *
83  * \param[in/out] ni_dec_ctx Pointer to ni_logan_dec_context_t
84  *
85  * \return On success
86  * NI_LOGAN_RETCODE_SUCCESS
87  * On failure
88  * NI_LOGAN_RETCODE_FAILURE
89  * NI_LOGAN_RETCODE_INVALID_PARAM,
90  * NI_LOGAN_RETCODE_ERROR_MEM_ALOC, etc
91  ******************************************************************************/
92 LIB_API int ni_logan_dec_init(ni_logan_dec_context_t *ni_dec_ctx);
93 
94 /*!*****************************************************************************
95  * \brief Initialize init device session_context and init default params
96  * including ni_logan_dec_context_t,
97  * ni_logan_session_context_t,
98  * ni_logan_decoder_params_t
99  *
100  * \param[in/out] ni_dec_ctx Pointer to ni_logan_dec_context_t
101  *
102  * \return On success
103  * NI_LOGAN_RETCODE_SUCCESS
104  * On failure
105  * NI_LOGAN_RETCODE_FAILURE
106  * NI_LOGAN_RETCODE_INVALID_PARAM,
107  * NI_LOGAN_RETCODE_ERROR_MEM_ALOC, etc
108  ******************************************************************************/
109 LIB_API int ni_logan_setup_decoder(ni_logan_dec_context_t *ni_dec_ctx);
110 
111 
112 /*!*****************************************************************************
113  * \brief Parse the packet and send the packet to decode device
114  *
115  * \param[in/out] ni_dec_ctx Pointer to ni_logan_dec_context_t
116  *
117  * \param[in/out] flag flag=0 or 1 to do something.
118  * \param[in] pkt_data Pointer to input packet data
119  * \param[in] pkt_size packet size
120  * \param[in] pkt_flags packet flags
121  * \param[in] pkt_pts packet pts
122  * \param[in] pkt_dts packet dts
123  * \param[in] avctx_width avctx width
124  * \param[in] avctx_height avctx height
125  * \param[in] extradata Pointer to uint8_t
126  * \param[in] extradata_size extradata size
127  * \return On success
128  * NI_LOGAN_RETCODE_SUCCESS
129  * On failure
130  * NI_LOGAN_RETCODE_FAILURE
131  * NI_LOGAN_RETCODE_INVALID_PARAM,
132  * NI_LOGAN_RETCODE_ERROR_MEM_ALOC, etc
133  ******************************************************************************/
134 LIB_API int ni_logan_dec_send(ni_logan_dec_context_t *ni_dec_ctx,
135  uint8_t *pkt_data, int pkt_size, int pkt_flags,
136  long long pkt_pts, long long pkt_dts,
137  int avctx_width, int avctx_height,
138  uint8_t *extradata, int extradata_size);
139 
140 /*!*****************************************************************************
141  * \brief Decode is flushing or not, including ni_logan_dec_context_t,
142  *
143  * \param[in/out] ni_dec_ctx Pointer to ni_logan_dec_context_t
144  *
145  * \return On 1
146  * HW dosn't do decode flushing
147  * On 0
148  * HW is doing decode flushing
149  ******************************************************************************/
150 LIB_API int ni_logan_dec_is_flushing(ni_logan_dec_context_t *ni_dec_ctx);
151 
152 /*!*****************************************************************************
153  * \brief Receive decoded data from decoder, including ni_logan_dec_context_t,
154  *
155  * \param[in/out] ni_dec_ctx Pointer to ni_logan_dec_context_t
156  * \param[in/out] p_session_data Pointer to ni_logan_session_data_io_t
157  * \param[in] avctx_width avctx width
158  * \param[in] avctx_height avctx height
159  * \return On success
160  * NI_LOGAN_RETCODE_SUCCESS
161  * On failure
162  * NI_LOGAN_RETCODE_FAILURE
163  ******************************************************************************/
164 LIB_API int ni_logan_dec_receive(ni_logan_dec_context_t *ni_dec_ctx,
165  ni_logan_session_data_io_t *p_session_data,
166  int avctx_width,
167  int avctx_height);
168 
169 /*!*****************************************************************************
170  * \brief Decode close, including ni_logan_dec_context_t,
171  *
172  * \param[in/out] ni_dec_ctx Pointer to ni_logan_dec_context_t
173  *
174  ******************************************************************************/
175 LIB_API void ni_logan_dec_close(ni_logan_dec_context_t *ni_dec_ctx);
176 
177 /*!*****************************************************************************
178  * \brief decoder frame buffer pool free, including void*
179  *
180  * \param[in] opaque parameter to be got for processing or passed to free
181  * \param[in] data data array
182  *
183  ******************************************************************************/
184 LIB_API void ni_logan_buf_pool_free(void *opaque, uint8_t *data);
185 
186 /*!*****************************************************************************
187  * \brief decoder flush buffers
188  *
189  * \param[in/out] ni_dec_ctx Pointer to ni_logan_dec_context_t
190  *
191  ******************************************************************************/
192 LIB_API void ni_logan_decode_flush_buffers(ni_logan_dec_context_t *ni_dec_ctx);
193 
194 #ifdef __cplusplus
195 }
196 #endif
NETINT audio/video related utility functions.
@ NI_LOGAN_DECODE_FLUSH_STATUS_FLUSHING
@ NI_LOGAN_DECODE_FLUSH_STATUS_START
@ NI_LOGAN_DECODE_FLUSH_STATUS_OFF
LIB_API int ni_logan_setup_decoder(ni_logan_dec_context_t *ni_dec_ctx)
Initialize init device session_context and init default params including ni_logan_dec_context_t,...
LIB_API void ni_logan_decode_flush_buffers(ni_logan_dec_context_t *ni_dec_ctx)
decoder flush buffers
LIB_API void ni_logan_buf_pool_free(void *opaque, uint8_t *data)
decoder frame buffer pool free, including void*
LIB_API void ni_logan_dec_close(ni_logan_dec_context_t *ni_dec_ctx)
Decode close, including ni_logan_dec_context_t,.
LIB_API int ni_logan_dec_send(ni_logan_dec_context_t *ni_dec_ctx, uint8_t *pkt_data, int pkt_size, int pkt_flags, long long pkt_pts, long long pkt_dts, int avctx_width, int avctx_height, uint8_t *extradata, int extradata_size)
Parse the packet and send the packet to decode device.
LIB_API int ni_logan_dec_is_flushing(ni_logan_dec_context_t *ni_dec_ctx)
Decode is flushing or not, including ni_logan_dec_context_t,.
LIB_API int ni_logan_dec_receive(ni_logan_dec_context_t *ni_dec_ctx, ni_logan_session_data_io_t *p_session_data, int avctx_width, int avctx_height)
Receive decoded data from decoder, including ni_logan_dec_context_t,.
struct _ni_logan_dec_context_t ni_logan_dec_context_t
LIB_API int ni_logan_dec_init(ni_logan_dec_context_t *ni_dec_ctx)
Initialize decode parameters and open decoder device including ni_logan_dec_context_t,...
Common NETINT definitions used by all modules.
Main NETINT device API header file provides the ability to communicate with NI T-408 type hardware tr...
Exported definitions related to resource management of NI T-408 devices.
Exported utility routines definition.
ni_logan_fifo_buffer_t * input_data_fifo
unsigned long long offset
ni_logan_packet_t seq_hdr_pkt