libxcoder  5.2.0
ni_xcoder_decode.c
Go to the documentation of this file.
1 /*******************************************************************************
2  *
3  * Copyright (C) 2022 NETINT Technologies
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy
6  * of this software and associated documentation files (the "Software"), to deal
7  * in the Software without restriction, including without limitation the rights
8  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9  * copies of the Software, and to permit persons to whom the Software is
10  * furnished to do so, subject to the following conditions:
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18  * SOFTWARE.
19  *
20  ******************************************************************************/
21 
22 /*!*****************************************************************************
23  * \file ni_xcoder_decode.c
24  *
25  * \brief Video decoding demo application directly using Netint Libxcoder API
26  ******************************************************************************/
27 
28 #include "ni_generic_utils.h"
29 #include "ni_decode_utils.h"
30 #include "ni_log.h"
31 #include "ni_util.h"
32 
33 #ifdef _WIN32
34 #include "ni_getopt.h"
35 #elif __linux__ || __APPLE__
36 #include <getopt.h>
37 #endif
38 
39 static void print_usage(void)
40 {
42  "Video decoding demo application directly using Netint Libxcoder version %s\n"
43  "Usage: ni_xcoder_decode [options]\n"
44  "\n"
45  "options:\n"
46  "-h | --help Show this message.\n"
47  "-v | --version Print version info.\n"
48  "-i | --input (Required) Input file path.\n"
49  "-o | --output (Required) Output file path.\n"
50  "-m | --dec-codec (Required) Decoder codec format. Must match the codec of input file.\n"
51  " [a|avc, h|hevc, v|vp9]\n"
52  "-l | --loglevel Set loglevel of this application and libxcoder API.\n"
53  " [none, fatal, error, info, debug, trace]\n"
54  " (Default: info)\n"
55  "-c | --card Set card index to use.\n"
56  " See `ni_rsrc_mon` for info of cards on system.\n"
57  " (Default: 0)\n"
58  "-r | --repeat To loop input X times. Must be a positive integer\n"
59  " (Default: 1)\n"
60  "-d | --decoder-params Decoding params. See \"Decoding Parameters\" chapter in\n"
61  " QuadraIntegration&ProgrammingGuide*.pdf for help.\n"
62  " (Default: \"\")\n"
64 }
65 
66 int main(int argc, char *argv[])
67 {
68  int i, ret = 0;
69  ni_demo_context_t ctx = {0};
70  char in_filename[FILE_NAME_LEN] = {0};
71  char out_filename[FILE_NAME_LEN] = {0};
72  FILE *output_fp = NULL;
73  int video_width, video_height, bit_depth;
74  int dec_codec_format = -1;
75  ni_log_level_t log_level;
76  int xcoderGUID = 0;
77  char *n;
78  char dec_conf_params[2048] = {0};
79  ni_h264_sps_t avc_sps = {0};
80  ni_h265_sps_t hevc_sps = {0};
81  ni_vp9_header_info_t vp9_info = {0};
82  int send_rc = NI_TEST_RETCODE_SUCCESS, receive_rc = NI_TEST_RETCODE_SUCCESS, rx_size = 0;
83  ni_xcoder_params_t *p_dec_api_param = NULL;
84  ni_session_context_t dec_ctx = {0};
85  ni_frame_t *p_ni_frame;
86  niFrameSurface1_t * p_hwframe;
87  void *p_stream_info = NULL;
88  ni_session_data_io_t in_pkt = {0};
89  ni_session_data_io_t out_frame = {0};
90  uint64_t current_time, previous_time;
91 
92  int opt;
93  int opt_index;
94  const char *opt_string = "hvi:o:m:l:c:r:d:";
95  static struct option long_options[] = {
96  {"help", no_argument, NULL, 'h'},
97  {"version", no_argument, NULL, 'v'},
98  {"input", required_argument, NULL, 'i'},
99  {"output", required_argument, NULL, 'o'},
100  {"dec-codec", required_argument, NULL, 'm'},
101  {"loglevel", required_argument, NULL, 'l'},
102  {"card", required_argument, NULL, 'c'},
103  {"repeat", required_argument, NULL, 'r'},
104  {"decoder-params", required_argument, NULL, 'd'},
105  {NULL, 0, NULL, 0},
106  };
107 
108  while ((opt = getopt_long(argc, argv, opt_string, long_options, &opt_index)) != -1)
109  {
110  switch (opt)
111  {
112  case 'h':
113  print_usage();
114  ret = 0;
115  goto end;
116  case 'v':
117  print_version();
118  ret = 0;
119  goto end;
120  case 'i':
121  strcpy(in_filename, optarg);
122  break;
123  case 'o':
124  strcpy(out_filename, optarg);
125  break;
126  case 'm':
127  // Accept both upper and lower case
128  for (i = 0; i < strlen(optarg); i++)
129  {
130  optarg[i] = (char)tolower((unsigned char)optarg[i]);
131  }
132  if (strcmp(optarg, "a") == 0 || strcmp(optarg, "avc") == 0)
133  {
134  dec_codec_format = NI_CODEC_FORMAT_H264;
135  }
136  else if (strcmp(optarg, "h") == 0 || strcmp(optarg, "hevc") == 0)
137  {
138  dec_codec_format = NI_CODEC_FORMAT_H265;
139  }
140  else if (strcmp(optarg, "v") == 0 || strcmp(optarg, "vp9") == 0)
141  {
142  dec_codec_format = NI_CODEC_FORMAT_VP9;
143  }
144  else
145  {
146  ni_log(NI_LOG_ERROR, "Error: Invalid value \"%s\" for -m | --dec-codec option\n"
147  "Must be one of [a|avc, h|hevc, v|vp9]\n", optarg);
148  ret = -1;
149  goto end;
150  }
151  break;
152  case 'l':
153  log_level = arg_to_ni_log_level(optarg);
154  if (log_level != NI_LOG_INVALID)
155  {
156  ni_log_set_level(log_level);
157  }
158  else
159  {
160  ni_log(NI_LOG_ERROR, "Error: Invalid value \"%s\" for -l | --loglevel option\n"
161  "Must be one of [none, fatal, error, info, debug, trace]\n", optarg);
162  ret = -1;
163  goto end;
164  }
165  break;
166  case 'c':
167  xcoderGUID = (int)strtol(optarg, &n, 10);
168  if (n == optarg || *n != '\0' || xcoderGUID < 0)
169  {
170  ni_log(NI_LOG_ERROR, "Error: Invalid value \"%s\" for -c | --card option\n"
171  "Must be a non-negative integer\n", optarg);
172  ret = -1;
173  goto end;
174  }
175  break;
176  case 'r':
177  ctx.loops_left = strtol(optarg, &n, 10);
178  if (n == optarg || *n != '\0' || ctx.loops_left <= 0)
179  {
180  ni_log(NI_LOG_ERROR, "Error: Invalid value \"%s\" for -r | --repeat option\n"
181  "Must be a positive integer\n", optarg);
182  ret = -1;
183  goto end;
184  }
185  break;
186  case 'd':
187  strcpy(dec_conf_params, optarg);
188  break;
189  default:
190  print_usage();
191  ret = -1;
192  goto end;
193  }
194  }
195 
196  if (!in_filename[0]) {
197  ni_log(NI_LOG_ERROR, "Error: Missing input file argument (-i | --input)\n");
198  ret = -1;
199  goto end;
200  }
201 
202  if (!out_filename[0]) {
203  ni_log(NI_LOG_ERROR, "Error: Missing output file argument (-o | --output)\n");
204  ret = -1;
205  goto end;
206  }
207 
208  if (dec_codec_format == -1) {
209  ni_log(NI_LOG_ERROR, "Error: Missing decoder codec argument (-m | --dec-codec)\n");
210  ret = -1;
211  goto end;
212  }
213 
214  p_dec_api_param = malloc(sizeof(ni_xcoder_params_t));
215  if (!p_dec_api_param)
216  {
217  ni_log(NI_LOG_ERROR, "Error: failed to allocate p_dec_api_param\n");
218  ret = -1;
219  goto end;
220  }
221 
222  ret = read_and_cache_file(&ctx, in_filename);
223  if (ret)
224  {
225  ni_log(NI_LOG_ERROR, "Error: Read input file failure\n");
226  goto end;
227  }
228 
229  if (strcmp(out_filename, "null") != 0 &&
230  strcmp(out_filename, "/dev/null") != 0)
231  {
232  output_fp = fopen(out_filename, "wb");
233  if (!output_fp)
234  {
235  ni_log(NI_LOG_ERROR, "Error: Failed to open %s\n", out_filename);
236  ret = -1;
237  goto end;
238  }
239  ni_log(NI_LOG_INFO, "Opened output file: %s\n", out_filename);
240  } else
241  {
242  output_fp = NULL;
243  ni_log(NI_LOG_INFO, "Note: Requested NULL output, no output file will be generated\n");
244  }
245 
246  if (dec_codec_format == NI_CODEC_FORMAT_H264)
247  {
248  ret = probe_h264_stream_info(&ctx, &avc_sps);
249  if (ret)
250  {
252  "ERROR: Failed to probe input file as H.264, file format not supported!\n");
253  goto end;
254  }
255 
256  bit_depth = avc_sps.bit_depth_luma;
257  video_width = avc_sps.width;
258  video_height = avc_sps.height;
259  ni_log(NI_LOG_DEBUG, "Using probed H.264 source info: %d bits, resolution %dx%d\n",
260  bit_depth, video_width, video_height);
261  } else if (dec_codec_format == NI_CODEC_FORMAT_H265)
262  {
263  ret = probe_h265_stream_info(&ctx, &hevc_sps);
264  if (ret)
265  {
267  "ERROR: Failed to probe input file as H.265, file format not supported!\n");
268  goto end;
269  }
270  bit_depth = hevc_sps.bit_depth_chroma;
271  video_width = (int)(hevc_sps.width -
272  (hevc_sps.pic_conf_win.left_offset +
273  hevc_sps.pic_conf_win.right_offset));
274  video_height = (int)(hevc_sps.height -
275  (hevc_sps.pic_conf_win.top_offset +
276  hevc_sps.pic_conf_win.bottom_offset));
277  ni_log(NI_LOG_INFO, "Using probed H.265 source info: %d bits, resolution %dx%d\n",
278  bit_depth, video_width, video_height);
279  } else if (dec_codec_format == NI_CODEC_FORMAT_VP9)
280  {
281  ret = probe_vp9_stream_info(&ctx, &vp9_info);
282  if (ret)
283  {
285  "ERROR: Failed to probe input file as VP9, file format not supported!\n");
286  goto end;
287  }
288  bit_depth = vp9_info.profile ? 10 : 8;
289  video_width = vp9_info.width;
290  video_height = vp9_info.height;
292  "Using probed VP9 source info: %d bits, resolution %dx%d, timebase %u/%u\n",
293  bit_depth, video_width, video_height,
294  vp9_info.timebase.den, vp9_info.timebase.num);
295  }
296 
297  // set up decoder config params with some hard-coded values
298  ret = ni_decoder_init_default_params(p_dec_api_param, 25, 1, 200000, video_width, video_height);
299  if (ret)
300  {
301  ni_log(NI_LOG_ERROR, "Error: Failed to init default decoder config\n");
302  goto end;
303  }
304 
305  ret = ni_device_session_context_init(&dec_ctx);
306  if (ret)
307  {
308  ni_log(NI_LOG_ERROR, "Error: Failed to init decoder context\n");
309  goto end;
310  }
311 
312  dec_ctx.codec_format = dec_codec_format;
313  dec_ctx.src_bit_depth = bit_depth;
314  dec_ctx.bit_depth_factor = 1;
315  if (10 == dec_ctx.src_bit_depth)
316  {
317  dec_ctx.bit_depth_factor = 2;
318  }
319 
320  // check and set ni_decoder_params from --xcoder-params
321  ret = ni_retrieve_decoder_params(dec_conf_params, p_dec_api_param, &dec_ctx);
322  if (ret)
323  {
324  ni_log(NI_LOG_ERROR, "Error: decoder config params parsing error\n");
325  goto end;
326  }
327 
328  // Decode, use all the parameters specified by user
329  ret = decoder_open_session(&dec_ctx, xcoderGUID, p_dec_api_param);
330  if (ret)
331  {
332  ni_log(NI_LOG_ERROR, "Error: Failed to open decoder session\n");
333  goto end;
334  }
335 
336  ni_log(NI_LOG_INFO, "Starting to decode: HWFrames %d\n", dec_ctx.hw_action);
337 
338  if (dec_codec_format == NI_CODEC_FORMAT_H264)
339  p_stream_info = &avc_sps;
340  else if (dec_codec_format == NI_CODEC_FORMAT_H265)
341  p_stream_info = &hevc_sps;
342  else if (dec_codec_format == NI_CODEC_FORMAT_VP9)
343  p_stream_info = &vp9_info;
344 
345  ctx.start_time = ni_gettime_ns();
347 
348  while (send_rc == NI_TEST_RETCODE_SUCCESS || receive_rc == NI_TEST_RETCODE_SUCCESS ||
349  (send_rc == NI_TEST_RETCODE_EAGAIN && receive_rc == NI_TEST_RETCODE_EAGAIN))
350  {
351  // Sending
352  send_rc = decoder_send_data(&ctx, &dec_ctx, &in_pkt, video_width,
353  video_height, p_stream_info);
354  if (send_rc < 0)
355  {
357  "Error: decoder_send_data() failed, rc: %d\n",
358  send_rc);
359  break;
360  }
361 
362  // Receiving
363  do
364  {
365  rx_size = 0;
366  receive_rc = decoder_receive_data(&ctx, &dec_ctx, &out_frame, video_width, video_height,
367  output_fp, 1, &rx_size);
368 
369  if (dec_ctx.hw_action == NI_CODEC_HW_ENABLE)
370  {
371  if (receive_rc != NI_TEST_RETCODE_EAGAIN &&
372  receive_rc != NI_TEST_RETCODE_END_OF_STREAM)
373  {
374  p_ni_frame = &out_frame.data.frame;
375  p_hwframe = (niFrameSurface1_t *)p_ni_frame->p_data[3];
376  ni_log(NI_LOG_DEBUG, "decoder_receive_data HW decode-only. recycle HW frame idx %u\n", p_hwframe->ui16FrameIdx);
377  ni_hwframe_buffer_recycle2(p_hwframe);
378  ni_frame_buffer_free(p_ni_frame);
379  }
380  }
381  else
382  {
384  }
385 
386  // Error or eos
387  if (receive_rc < 0 || out_frame.data.frame.end_of_stream)
388  {
389  break;
390  }
391 
393  if (current_time - previous_time >= (uint64_t)1000000000)
394  {
395  ni_log(NI_LOG_INFO, "Decoder stats: received %u frames, fps %.2f, total bytes %u\n",
396  ctx.num_frames_received,
397  (float)ctx.num_frames_received / (float)(current_time - ctx.start_time) * (float)1000000000,
400  }
401 
402  } while (!dec_ctx.decoder_low_delay && rx_size > 0); //drain consecutive outputs
403 
404  // Error or eos
405  if (receive_rc < 0 || out_frame.data.frame.end_of_stream)
406  {
407  break;
408  }
409  }
410 
411  decoder_stat_report_and_close(&ctx, &dec_ctx);
412 
413 end:
414  ni_packet_buffer_free(&(in_pkt.data.packet));
415  if (dec_ctx.hw_action == NI_CODEC_HW_ENABLE)
416  {
417  ni_frame_buffer_free(&out_frame.data.frame);
418  } else
419  {
421  }
422 
424 
425  free(p_dec_api_param);
426  free(ctx.file_cache);
427  if (output_fp != NULL)
428  {
429  fclose(output_fp);
430  }
431 
432  return ret;
433 }
ni_decode_utils.h
ni_log_level_t
ni_log_level_t
Definition: ni_log.h:55
_ni_session_context::decoder_low_delay
int decoder_low_delay
Definition: ni_device_api.h:1594
_ni_demo_context::loops_left
uint64_t loops_left
Definition: ni_generic_utils.h:117
_ni_h265_sps_t::bit_depth_chroma
int bit_depth_chroma
Definition: ni_decode_utils.h:251
ni_frame_buffer_free
ni_retcode_t ni_frame_buffer_free(ni_frame_t *p_frame)
Free frame buffer that was previously allocated with either ni_frame_buffer_alloc or ni_encoder_frame...
Definition: ni_device_api.c:3561
_ni_vp9_header_info::den
uint32_t den
Definition: ni_decode_utils.h:347
probe_h264_stream_info
int probe_h264_stream_info(ni_demo_context_t *p_ctx, ni_h264_sps_t *sps)
Definition: ni_decode_utils.c:715
ni_generic_utils.h
print_version
void print_version(void)
Definition: ni_generic_utils.c:70
_ni_session_data_io::packet
ni_packet_t packet
Definition: ni_device_api.h:2871
ni_log_set_level
void ni_log_set_level(ni_log_level_t level)
Set ni_log_level.
Definition: ni_log.c:202
ni_gettime_ns
uint64_t ni_gettime_ns(void)
Definition: ni_util.c:1998
_ni_h265_window_t::bottom_offset
unsigned int bottom_offset
Definition: ni_decode_utils.h:141
required_argument
#define required_argument
Definition: ni_getopt.h:86
NI_XCODER_REVISION
#define NI_XCODER_REVISION
Definition: ni_defs.h:95
probe_h265_stream_info
int probe_h265_stream_info(ni_demo_context_t *p_ctx, ni_h265_sps_t *sps)
Definition: ni_decode_utils.c:1994
ni_packet_buffer_free
ni_retcode_t ni_packet_buffer_free(ni_packet_t *p_packet)
Free packet buffer that was previously allocated with ni_packet_buffer_alloc.
Definition: ni_device_api.c:3843
_ni_h265_window_t::left_offset
unsigned int left_offset
Definition: ni_decode_utils.h:138
no_argument
#define no_argument
Definition: ni_getopt.h:85
_ni_session_context::bit_depth_factor
int bit_depth_factor
Definition: ni_device_api.h:1494
_ni_h265_sps_t::width
int width
Definition: ni_decode_utils.h:317
decoder_receive_data
int decoder_receive_data(ni_demo_context_t *p_ctx, ni_session_context_t *p_dec_ctx, ni_session_data_io_t *p_out_data, int output_video_width, int output_video_height, FILE *p_file, int write_to_file, int *p_rx_size)
Receive decoded output data from decoder.
Definition: ni_decode_utils.c:2416
FILE_NAME_LEN
#define FILE_NAME_LEN
Definition: ni_generic_utils.h:46
probe_vp9_stream_info
int probe_vp9_stream_info(ni_demo_context_t *p_ctx, ni_vp9_header_info_t *vp9_info)
Definition: ni_decode_utils.c:2180
ni_log.h
Logging definitions.
_niFrameSurface1::ui16FrameIdx
uint16_t ui16FrameIdx
Definition: ni_device_api.h:2795
_ni_demo_context
Definition: ni_generic_utils.h:109
_ni_vp9_header_info
Definition: ni_decode_utils.h:339
NI_LOG_INFO
@ NI_LOG_INFO
Definition: ni_log.h:61
arg_to_ni_log_level
ni_log_level_t arg_to_ni_log_level(const char *arg_str)
Convert terminal arg string to ni_log_level_t.
Definition: ni_log.c:262
decoder_stat_report_and_close
void decoder_stat_report_and_close(ni_demo_context_t *p_ctx, ni_session_context_t *p_dec_ctx)
Definition: ni_decode_utils.c:2612
NI_LOG_ERROR
@ NI_LOG_ERROR
Definition: ni_log.h:60
_ni_session_context::src_bit_depth
int src_bit_depth
Definition: ni_device_api.h:1492
NI_TEST_RETCODE_END_OF_STREAM
#define NI_TEST_RETCODE_END_OF_STREAM
Definition: ni_generic_utils.h:52
read_and_cache_file
int read_and_cache_file(ni_demo_context_t *ctx, char *filename)
Definition: ni_generic_utils.c:259
_ni_vp9_header_info::timebase
struct _ni_vp9_header_info::@3 timebase
print_usage
void print_usage(void)
Print usage information.
Definition: ni_p2p_test.c:833
_ni_demo_context::num_frames_received
uint64_t num_frames_received
Definition: ni_generic_utils.h:128
_ni_h264_sps_t
Definition: ni_decode_utils.h:70
_ni_vp9_header_info::num
uint32_t num
Definition: ni_decode_utils.h:348
NI_TEST_RETCODE_EAGAIN
#define NI_TEST_RETCODE_EAGAIN
Definition: ni_generic_utils.h:53
decoder_open_session
int decoder_open_session(ni_session_context_t *p_dec_ctx, int iXcoderGUID, ni_xcoder_params_t *p_dec_params)
decoder session open
Definition: ni_decode_utils.c:2575
_ni_h265_sps_t::height
int height
Definition: ni_decode_utils.h:318
previous_time
struct timeval previous_time
Definition: ni_p2p_test.c:63
_ni_frame::end_of_stream
uint32_t end_of_stream
Definition: ni_device_api.h:2608
current_time
struct timeval current_time
Definition: ni_p2p_test.c:64
_ni_h265_sps_t::pic_conf_win
ni_h265_window_t pic_conf_win
Definition: ni_decode_utils.h:248
_ni_h265_window_t::right_offset
unsigned int right_offset
Definition: ni_decode_utils.h:139
_ni_session_data_io
Definition: ni_device_api.h:2866
_ni_h265_sps_t
Definition: ni_decode_utils.h:241
ni_log
void ni_log(ni_log_level_t level, const char *fmt,...)
print log message using ni_log_callback
Definition: ni_log.c:183
NI_LOG_INVALID
@ NI_LOG_INVALID
Definition: ni_log.h:57
NI_TEST_RETCODE_SUCCESS
#define NI_TEST_RETCODE_SUCCESS
Definition: ni_generic_utils.h:51
_ni_h264_sps_t::width
int width
Definition: ni_decode_utils.h:72
getopt_long
int getopt_long(int argc, char *argv[], const char *optstring, const struct option *longopts, int *longindex)
Definition: ni_getopt.c:99
_ni_h264_sps_t::bit_depth_luma
int bit_depth_luma
bit_depth_luma_minus8 + 8
Definition: ni_decode_utils.h:128
_ni_vp9_header_info::profile
int profile
Definition: ni_decode_utils.h:341
decoder_send_data
int decoder_send_data(ni_demo_context_t *p_ctx, ni_session_context_t *p_dec_ctx, ni_session_data_io_t *p_in_data, int input_video_width, int input_video_height, void *stream_info)
Send decoder input data.
Definition: ni_decode_utils.c:2228
_ni_h265_window_t::top_offset
unsigned int top_offset
Definition: ni_decode_utils.h:140
ni_device_session_context_clear
void ni_device_session_context_clear(ni_session_context_t *p_ctx)
Clear already allocated session context.
Definition: ni_device_api.c:249
_ni_frame::p_data
uint8_t * p_data[NI_MAX_NUM_DATA_POINTERS]
Definition: ni_device_api.h:2663
ni_hwframe_buffer_recycle2
ni_retcode_t ni_hwframe_buffer_recycle2(niFrameSurface1_t *surface)
Recycle a frame buffer on card, only hwframe descriptor is needed.
Definition: ni_device_api.c:8517
optarg
char * optarg
Definition: ni_getopt.c:33
NI_CODEC_FORMAT_VP9
@ NI_CODEC_FORMAT_VP9
Definition: ni_device_api.h:913
_ni_vp9_header_info::height
uint16_t height
Definition: ni_decode_utils.h:344
ni_decoder_init_default_params
ni_retcode_t ni_decoder_init_default_params(ni_xcoder_params_t *p_param, int fps_num, int fps_denom, long bit_rate, int width, int height)
Initialize default decoder parameters.
Definition: ni_device_api.c:4546
_ni_vp9_header_info::width
uint16_t width
Definition: ni_decode_utils.h:343
_ni_session_context::hw_action
int hw_action
Definition: ni_device_api.h:1609
_ni_session_context
Definition: ni_device_api.h:1408
_niFrameSurface1
Definition: ni_device_api.h:2793
NI_CODEC_HW_ENABLE
@ NI_CODEC_HW_ENABLE
Definition: ni_device_api.h:940
_ni_session_data_io::data
union _ni_session_data_io::@19 data
_ni_frame
Definition: ni_device_api.h:2601
_ni_demo_context::start_time
uint64_t start_time
Definition: ni_generic_utils.h:132
_ni_xcoder_params
Definition: ni_device_api.h:2713
option
Definition: ni_getopt.h:73
_ni_demo_context::file_cache
uint8_t * file_cache
Definition: ni_generic_utils.h:114
_ni_session_context::codec_format
uint32_t codec_format
Definition: ni_device_api.h:1486
_ni_demo_context::dec_total_bytes_received
uint64_t dec_total_bytes_received
Definition: ni_generic_utils.h:125
_ni_session_data_io::frame
ni_frame_t frame
Definition: ni_device_api.h:2870
ni_util.h
Utility definitions.
NI_CODEC_FORMAT_H264
@ NI_CODEC_FORMAT_H264
Definition: ni_device_api.h:911
_ni_h264_sps_t::height
int height
Definition: ni_decode_utils.h:73
ni_device_session_context_init
ni_retcode_t ni_device_session_context_init(ni_session_context_t *p_ctx)
Initialize already allocated session context to a known state.
Definition: ni_device_api.c:156
ni_retrieve_decoder_params
int ni_retrieve_decoder_params(char xcoderParams[], ni_xcoder_params_t *params, ni_session_context_t *ctx)
retrieve decoder config parameter values from –decoder-params
Definition: ni_util.c:3931
main
int main(int argc, char *argv[])
Definition: ni_xcoder_decode.c:66
NI_LOG_DEBUG
@ NI_LOG_DEBUG
Definition: ni_log.h:62
ni_getopt.h
Implementation of getopt() and getopt_long() for Windows environment.
ni_decoder_frame_buffer_free
ni_retcode_t ni_decoder_frame_buffer_free(ni_frame_t *p_frame)
Free decoder frame buffer that was previously allocated with ni_decoder_frame_buffer_alloc,...
Definition: ni_device_api.c:3644
NI_CODEC_FORMAT_H265
@ NI_CODEC_FORMAT_H265
Definition: ni_device_api.h:912