libxcoder  5.2.0
ni_rsrc_api.h File Reference

Public definitions for managing NETINT video processing devices. More...

#include "ni_defs.h"

Go to the source code of this file.

Data Structures

struct  _ni_rsrc_video_ref_cap
 
struct  _ni_device_queue
 
struct  _ni_device_video_capability
 
struct  _ni_sw_instance_info
 
struct  _ni_device_pool
 
struct  _ni_device_info
 
struct  _ni_device
 
struct  _ni_device_context
 
struct  _ni_card_info_quadra
 
struct  _ni_hw_device_info_quadra
 
struct  _ni_hw_device_info_quadra_encoder_param
 
struct  _ni_hw_device_info_quadra_decoder_param
 
struct  _ni_hw_device_info_quadra_scaler_param
 
struct  _ni_hw_device_info_quadra_ai_param
 
struct  _ni_hw_device_info_quadra_threshold_param
 
struct  _ni_hw_device_info_quadra_coder_param
 
struct  _ni_device_vf_ns_id
 
struct  _ni_device_temp
 
struct  _ni_device_extra_info
 

Macros

#define NI_PROFILES_SUPP_STR_LEN   128
 
#define NI_LEVELS_SUPP_STR_LEN   64
 
#define NI_ADDITIONAL_INFO_STR_LEN   64
 

Typedefs

typedef struct _ni_rsrc_video_ref_cap ni_rsrc_device_video_ref_cap_t
 
typedef struct _ni_device_queue ni_device_queue_t
 
typedef struct _ni_device_video_capability ni_device_video_capability_t
 
typedef struct _ni_sw_instance_info ni_sw_instance_info_t
 
typedef struct _ni_device_pool ni_device_pool_t
 
typedef struct _ni_device_info ni_device_info_t
 
typedef struct _ni_device ni_device_t
 
typedef struct _ni_device_context ni_device_context_t
 
typedef struct _ni_card_info_quadra ni_card_info_quadra_t
 
typedef struct _ni_hw_device_info_quadra ni_hw_device_info_quadra_t
 
typedef struct _ni_hw_device_info_quadra_encoder_param ni_hw_device_info_quadra_encoder_param_t
 
typedef struct _ni_hw_device_info_quadra_decoder_param ni_hw_device_info_quadra_decoder_param_t
 
typedef struct _ni_hw_device_info_quadra_scaler_param ni_hw_device_info_quadra_scaler_param_t
 
typedef struct _ni_hw_device_info_quadra_ai_param ni_hw_device_info_quadra_ai_param_t
 
typedef struct _ni_hw_device_info_quadra_threshold_param ni_hw_device_info_quadra_threshold_param_t
 
typedef struct _ni_hw_device_info_quadra_coder_param ni_hw_device_info_quadra_coder_param_t
 
typedef struct _ni_device_vf_ns_id ni_device_vf_ns_id_t
 
typedef struct _ni_device_temp ni_device_temp_t
 
typedef struct _ni_device_extra_info ni_device_extra_info_t
 

Enumerations

enum  ni_codec_t {
  EN_INVALID = -1, EN_H264 = 0, EN_H265, EN_VP9,
  EN_JPEG, EN_AV1, EN_CODEC_MAX
}
 
enum  ni_sw_instance_status_t { EN_IDLE, EN_ACTIVE }
 
enum  ni_alloc_rule_t { EN_ALLOC_LEAST_LOAD, EN_ALLOC_LEAST_INSTANCE }
 

Functions

LIB_API int ni_rsrc_init (int should_match_rev, int timeout_seconds)
 Initialize and create all resources required to work with NETINT NVMe transcoder devices. This is a high level API function which is used mostly with user application like FFmpeg that relies on those resources. In case of custom application integration, revised functionality might be necessary utilizing coresponding API functions. More...
 
LIB_API ni_retcode_t ni_rsrc_refresh (int should_match_rev)
 Scan and refresh all resources on the host, taking into account hot-plugged and pulled out cards. More...
 
LIB_API NI_DEPRECATED int ni_rsrc_get_local_device_list (char ni_devices[][NI_MAX_DEVICE_NAME_LEN], int max_handles)
 Scans system for all NVMe devices and returns the system device names to the user which were identified as NETINT transcoder deivices. Names are suitable for OpenFile api usage afterwards This function had been replaced by ni_rsrc_get_local_device_list2 This function can't be callback with multi thread. More...
 
LIB_API int ni_rsrc_get_local_device_list2 (char ni_devices[][NI_MAX_DEVICE_NAME_LEN], int max_handles, char **xcoder_refresh_dev_names, int xcoder_refresh_dev_count)
 Scans system for all NVMe devices and returns the system device names to the user which were identified as NETINT transcoder devices. Names are suitable for resource management API usage afterwards This function had replaced ni_rsrc_get_local_device_list This function can be callback with multi thread. More...
 
LIB_API ni_device_context_tni_rsrc_get_device_context (ni_device_type_t type, int guid)
 Allocates and returns a pointer to ni_device_context_t struct based on provided device_type and guid. To be used for load update and codec query. More...
 
LIB_API void ni_rsrc_free_device_context (ni_device_context_t *p_ctxt)
 Free previously allocated device context. More...
 
LIB_API ni_retcode_t ni_rsrc_list_devices (ni_device_type_t device_type, ni_device_info_t *p_device_info, int *p_device_count)
 List device(s) based on device type with full information including s/w instances on the system. More...
 
LIB_API ni_retcode_t ni_rsrc_list_all_devices (ni_device_t *p_device)
 List all devices with full information including s/w instances on the system. More...
 
LIB_API ni_retcode_t ni_rsrc_list_all_devices2 (ni_device_t *p_device, bool list_uninitialized)
 Grabs information for every initialized and uninitialized device. More...
 
LIB_API void ni_rsrc_print_all_devices_capability (void)
 Print detailed capability information of all devices on the system. More...
 
LIB_API void ni_rsrc_print_all_devices_capability2 (bool list_uninitialized)
 Prints detailed capability information for all initialized devices and general information about uninitialized devices. More...
 
LIB_API ni_device_info_tni_rsrc_get_device_info (ni_device_type_t device_type, int guid)
 Query a specific device with detailed information on the system. More...
 
LIB_API int ni_rsrc_get_device_by_block_name (const char *blk_name, ni_device_type_t device_type)
 Get GUID of the device by block device name and type. More...
 
int ni_rsrc_update_device_load (ni_device_context_t *p_ctxt, int load, int sw_instance_cnt, const ni_sw_instance_info_t sw_instance_info[])
 Update the load value and s/w instances info of a specific decoder or encoder. This is used by resource management daemon to update periodically. More...
 
ni_device_context_tni_rsrc_allocate_simple_direct (ni_device_type_t device_type, int guid)
 Allocate resources for decoding/encoding, by designating explicitly the device to use. do not track the load on the host side. More...
 
LIB_API void ni_rsrc_release_resource (ni_device_context_t *p_ctxt, uint64_t load)
 Release resources allocated for decoding/encoding. function This must be called at the end of transcoding with previously assigned load value by allocate* functions. More...
 
LIB_API int ni_rsrc_check_hw_available (int guid, ni_device_type_t device_type)
 check the NetInt h/w device in resource pool on the host. More...
 
LIB_API int ni_rsrc_remove_device (const char *p_dev)
 Remove an NetInt h/w device from resource pool on the host. More...
 
LIB_API int ni_rsrc_remove_all_devices (void)
 Remove all NetInt h/w devices from resource pool on the host. More...
 
LIB_API int ni_rsrc_add_device (const char *p_dev, int should_match_rev)
 Add an NetInt h/w device into resource pool on the host. More...
 
LIB_API ni_device_pool_tni_rsrc_get_device_pool (void)
 Create and return the allocated ni_device_pool_t struct. More...
 
LIB_API void ni_rsrc_free_device_pool (ni_device_pool_t *p_device_pool)
 Free all resources taken by the device pool. More...
 
LIB_API void ni_rsrc_print_device_info (const ni_device_info_t *p_device_info)
 Print the content of the ni_device_info_t struct. More...
 
LIB_API int ni_rsrc_lock_and_open (int device_type, ni_lock_handle_t *lock)
 lock a file lock and open a session on a device More...
 
LIB_API int ni_rsrc_unlock (int device_type, ni_lock_handle_t lock)
 unlock a file lock More...
 
LIB_API int ni_rsrc_is_fw_compat (uint8_t fw_rev[8])
 check if device FW revision is compatible with SW API More...
 
LIB_API ni_hw_device_info_quadra_coder_param_tni_create_hw_device_info_quadra_coder_param (int mode)
 Create a pointer to hw_device_info_coder_param_t instance .This instance will be created and set to default vaule by param mode.You may change the resolution fps bit_8_10 or other vaule you want to set. More...
 
LIB_API void ni_destory_hw_device_info_quadra_coder_param (ni_hw_device_info_quadra_coder_param_t *p_hw_device_info_quadra_coder_param)
 Release a pointer to hw_device_info_coder_param_t instance created by create_hw_device_info_coder_param. More...
 
LIB_API ni_hw_device_info_quadra_tni_hw_device_info_alloc_quadra (int device_type_num, int avaliable_card_num)
 Create a pointer to ni_hw_device_info_quadra_t instance . More...
 
LIB_API void ni_hw_device_info_free_quadra (ni_hw_device_info_quadra_t *p_hw_device_info)
 Release a pointer to ni_hw_device_info_quadra_t instance created by create_hw_device_info_coder_param. More...
 
LIB_API int ni_check_hw_info (ni_hw_device_info_quadra_t **pointer_to_p_hw_device_info, int task_mode, ni_hw_device_info_quadra_threshold_param_t *hw_info_threshold_param, ni_device_type_t preferential_device_type, ni_hw_device_info_quadra_coder_param_t *coder_param, int hw_mode, int consider_mem)
 check hw info, return the appropriate card number to use depends on the load&task_num&used resource More...
 
LIB_API ni_device_context_tni_rsrc_allocate_auto (ni_device_type_t device_type, ni_alloc_rule_t rule, ni_codec_t codec, int width, int height, int frame_rate, uint64_t *p_load)
 Allocate resources for decoding/encoding, based on the provided rule. More...
 

Variables

bool g_device_in_ctxt
 
ni_device_handle_t g_dev_handle
 

Detailed Description

Public definitions for managing NETINT video processing devices.


Definition in file ni_rsrc_api.h.

Macro Definition Documentation

◆ NI_ADDITIONAL_INFO_STR_LEN

#define NI_ADDITIONAL_INFO_STR_LEN   64

Definition at line 38 of file ni_rsrc_api.h.

◆ NI_LEVELS_SUPP_STR_LEN

#define NI_LEVELS_SUPP_STR_LEN   64

Definition at line 37 of file ni_rsrc_api.h.

◆ NI_PROFILES_SUPP_STR_LEN

#define NI_PROFILES_SUPP_STR_LEN   128

Definition at line 36 of file ni_rsrc_api.h.

Typedef Documentation

◆ ni_card_info_quadra_t

◆ ni_device_context_t

◆ ni_device_extra_info_t

◆ ni_device_info_t

◆ ni_device_pool_t

◆ ni_device_queue_t

◆ ni_device_t

typedef struct _ni_device ni_device_t

◆ ni_device_temp_t

◆ ni_device_vf_ns_id_t

◆ ni_device_video_capability_t

◆ ni_hw_device_info_quadra_ai_param_t

◆ ni_hw_device_info_quadra_coder_param_t

◆ ni_hw_device_info_quadra_decoder_param_t

◆ ni_hw_device_info_quadra_encoder_param_t

◆ ni_hw_device_info_quadra_scaler_param_t

◆ ni_hw_device_info_quadra_t

◆ ni_hw_device_info_quadra_threshold_param_t

◆ ni_rsrc_device_video_ref_cap_t

◆ ni_sw_instance_info_t

Enumeration Type Documentation

◆ ni_alloc_rule_t

Enumerator
EN_ALLOC_LEAST_LOAD 
EN_ALLOC_LEAST_INSTANCE 

Definition at line 252 of file ni_rsrc_api.h.

◆ ni_codec_t

enum ni_codec_t
Enumerator
EN_INVALID 
EN_H264 
EN_H265 
EN_VP9 
EN_JPEG 
EN_AV1 
EN_CODEC_MAX 

Definition at line 47 of file ni_rsrc_api.h.

◆ ni_sw_instance_status_t

Enumerator
EN_IDLE 
EN_ACTIVE 

Definition at line 61 of file ni_rsrc_api.h.

Function Documentation

◆ ni_check_hw_info()

LIB_API int ni_check_hw_info ( ni_hw_device_info_quadra_t **  pointer_to_p_hw_device_info,
int  task_mode,
ni_hw_device_info_quadra_threshold_param_t hw_info_threshold_param,
ni_device_type_t  preferential_device_type,
ni_hw_device_info_quadra_coder_param_t coder_param,
int  hw_mode,
int  consider_mem 
)

check hw info, return the appropriate card number to use depends on the load&task_num&used resource


Parameters
[out]pointer_to_p_hw_device_info: pointer to user-supplied ni_hw_device_info_quadra_t (allocated by ni_hw_device_info_alloc). May be a ponter to NULL ,in which case a ni_hw_device_info_quadra_coder_param_t is allocated by this function and written to pointer_to_p_hw_device_info. record the device info, including available card num and which card to select, and each card's informaton, such as, the load, task num, device type
[in]task_modeaffect the scheduling strategy, 1 - both the load_num and task_num should consider, usually applied to live scenes 0 - only consider the task_num, don not care the load_num
[in]hw_info_threshold_param: an array of threshold including device type task threshold and load threshold in hw_mode fill the arry with both encoder and decoder threshold or fill the arry with preferential device type threshold when don not in hw_mode load threshold in range[0:100] task num threshold in range [0:32]
[in]preferential_device_type: which device type is preferential 0:decode 1:encode . This need to set to encoder/decoder even if in sw_mode to check whether coder_param is wrong.
[in]coder_param: encoder and decoder information that helps to choose card .This coder_param can be created and set to default value by function hw_device_info_coder_param_t * create_hw_device_info_coder_param(). You may change the resolution fps bit_8_10 or other vaule you want to use
[in]hw_mode:Set1 then this function will choose encoder and decoder in just one card . When no card meets the conditions ,NO card will be choosed. You can try to use set hw_mode 0 to use sw_mode to do encoder/decoder in different card when hw_mode reports an error In hw_mode set both encoder_param and decoder_param in coder_param. Set 0 then just consider sw_mode to choose which card to do encode/decode, In sw_mode set one param in coder_param the other one will be set to NULL.
[in]consider_mem: set 1 this function will consider memory usage extra set 0 this function will not consider memory usage
Returns
0-error 1-success

Definition at line 3401 of file ni_rsrc_api.cpp.

◆ ni_create_hw_device_info_quadra_coder_param()

LIB_API ni_hw_device_info_quadra_coder_param_t* ni_create_hw_device_info_quadra_coder_param ( int  mode)

Create a pointer to hw_device_info_coder_param_t instance .This instance will be created and set to default vaule by param mode.You may change the resolution fps bit_8_10 or other vaule you want to set.


Parameters
[in]mode:0:createinstance with decoder_param ,encoder_param, scaler_param and ai_param will be set to NULL 1:create instance with encoder_param ,decoder_param, scaler_param and ai_param will be set to NULL 2:create instance with scaler_param ,decoder_param, encoder_param and ai_param will be set to NULL 3:create instance with ai_param ,decoder_param, encoder_param and scaler_param will be set to NULL >= 4:create instance with decoder_param encoder_param scaler_param and ai_param for ni_check_hw_info() hw_mode
Returns
NULL-error,pointer to an instance when success

Create a pointer to hw_device_info_coder_param_t instance .This instance will be created and set to default vaule by param mode.You may change the resolution fps bit_8_10 or other vaule you want to set.


Parameters
[in]mode0 for decoder,1 for encoder,2 for scaler,3 for AI, >= 4 for hw_mode
Returns
a pointer to ni_hw_device_info_quadra_coder_param_t on success,NULL for otherwise

Definition at line 3118 of file ni_rsrc_api.cpp.

◆ ni_destory_hw_device_info_quadra_coder_param()

LIB_API void ni_destory_hw_device_info_quadra_coder_param ( ni_hw_device_info_quadra_coder_param_t p_hw_device_info_quadra_coder_param)

Release a pointer to hw_device_info_coder_param_t instance created by create_hw_device_info_coder_param.


Parameters
[in]p_hw_device_info_coder_param:pointerto a hw_device_info_coder_param_t instance created by create_hw_device_info_coder_param

Release a pointer to hw_device_info_coder_param_t instance created by create_hw_device_info_coder_param.


Parameters
[in]device_type_num
[in]avaliable_card_num
Returns
a pointer to ni_hw_device_info_quadra_t on success,NULL for otherwise

Definition at line 3271 of file ni_rsrc_api.cpp.

◆ ni_hw_device_info_alloc_quadra()

LIB_API ni_hw_device_info_quadra_t* ni_hw_device_info_alloc_quadra ( int  device_type_num,
int  avaliable_card_num 
)

Create a pointer to ni_hw_device_info_quadra_t instance .


Parameters
[in]device_type_num:numberof device type to be allocated in this function
[in]avaliable_card_num:numberof avaliable card per device to be allocated in this function
Returns
NULL-error,pointer to an instance when success

Create a pointer to ni_hw_device_info_quadra_t instance .


Parameters
[in]device_type_num
[in]avaliable_card_num
Returns
a pointer to ni_hw_device_info_quadra_t on success,NULL for otherwise

Definition at line 3310 of file ni_rsrc_api.cpp.

◆ ni_hw_device_info_free_quadra()

LIB_API void ni_hw_device_info_free_quadra ( ni_hw_device_info_quadra_t p_hw_device_info)

Release a pointer to ni_hw_device_info_quadra_t instance created by create_hw_device_info_coder_param.


Parameters
[in]p_hw_device_info:pointerto a ni_hw_device_info_quadra_t instance created by create_hw_device_info_coder_param

Release a pointer to ni_hw_device_info_quadra_t instance created by create_hw_device_info_coder_param.


Parameters
[in]p_hw_device_infoPoiner to a ni_hw_device_info_quadra_t struct
Returns
None

Definition at line 3381 of file ni_rsrc_api.cpp.

◆ ni_rsrc_add_device()

LIB_API int ni_rsrc_add_device ( const char *  dev,
int  should_match_rev 
)

Add an NetInt h/w device into resource pool on the host.


Parameters
[in]p_devthe NVMe device name
[in]should_match_rev0: transcoder firmware revision matching the library's version is NOT required for placing the transcoder into resource pool; 1: otherwise
Returns
NI_RETCODE_SUCCESS NI_RETCODE_INVALID_PARAM NI_RETCODE_FAILURE

Parameters
[in]p_devDevice name represented as C string. ex "/dev/nvme0"
[in]should_match_rev0: transcoder firmware revision matching the library's version is NOT required for placing the transcoder into resource pool; 1: otherwise
Returns
NI_RETCODE_SUCCESS NI_RETCODE_INVALID_PARAM NI_RETCODE_FAILURE

Definition at line 2523 of file ni_rsrc_api.cpp.

◆ ni_rsrc_allocate_auto()

LIB_API ni_device_context_t* ni_rsrc_allocate_auto ( ni_device_type_t  device_type,
ni_alloc_rule_t  rule,
ni_codec_t  codec,
int  width,
int  height,
int  frame_rate,
uint64_t *  p_load 
)

Allocate resources for decoding/encoding, based on the provided rule.


Parameters
[in]device_typeNI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
[in]ruleallocation rule
[in]codecEN_H264 or EN_H265
[in]widthwidth of video resolution
[in]heightheight of video resolution
[in]frame_ratevideo stream frame rate
[out]p_loadthe load that will be generated by this encoding task. Returned only for encoder for now.
Returns
pointer to ni_device_context_t if found, NULL otherwise

Note: codec, width, height, fps need to be supplied for NI_DEVICE_TYPE_ENCODER only, they are ignored otherwize. Note: the returned ni_device_context_t content is not supposed to be used by caller directly: should only be passed to API in the subsequent calls; also after its use, the context should be released by calling ni_rsrc_free_device_context.


Parameters
[in]device_typeNI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
[in]ruleallocation rule
[in]codecEN_H264 or EN_H265
[in]widthwidth of video resolution
[in]heightheight of video resolution
[in]frame_ratevideo stream frame rate
[out]p_loadthe p_load that will be generated by this encoding task. Returned only for encoder for now.
Returns
pointer to ni_device_context_t if found, NULL otherwise

Note: codec, width, height, fps need to be supplied for NI_DEVICE_TYPE_ENCODER only, they are ignored otherwize. Note: the returned ni_device_context_t content is not supposed to be used by caller directly: should only be passed to API in the subsequent calls; also after its use, the context should be released by calling ni_rsrc_free_device_context.

retrieve the record and based on the allocation rule specified, find the least loaded or least number of s/w instances among the coders

get the individual device_info info and check the load/num-of-instances

Definition at line 4103 of file ni_rsrc_api.cpp.

◆ ni_rsrc_allocate_simple_direct()

ni_device_context_t* ni_rsrc_allocate_simple_direct ( ni_device_type_t  device_type,
int  guid 
)

Allocate resources for decoding/encoding, by designating explicitly the device to use. do not track the load on the host side.


Parameters
[in]device_typeNI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
[in]guidunique device (decoder or encoder) module id
Returns
pointer to ni_device_context_t if found, NULL otherwise

Note: only need to specify the device type and guid and codec type

Note: the returned ni_device_context_t content is not supposed to be used by caller directly: should only be passed to API in the subsequent calls; also after its use, the context should be released by calling ni_rsrc_free_device_context.

Definition at line 1932 of file ni_rsrc_api.cpp.

◆ ni_rsrc_check_hw_available()

LIB_API int ni_rsrc_check_hw_available ( int  guid,
ni_device_type_t  device_type 
)

check the NetInt h/w device in resource pool on the host.


Parameters
[in]guidthe global unique device index in resource pool device_type NI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
Returns
NI_RETCODE_SUCCESS

Definition at line 2016 of file ni_rsrc_api.cpp.

◆ ni_rsrc_free_device_context()

LIB_API void ni_rsrc_free_device_context ( ni_device_context_t p_device_context)

Free previously allocated device context.


Parameters
p_device_contextPointer to previously allocated device context
Returns
None

Definition at line 1310 of file ni_rsrc_api.cpp.

◆ ni_rsrc_free_device_pool()

LIB_API void ni_rsrc_free_device_pool ( ni_device_pool_t p_device_pool)

Free all resources taken by the device pool.


Parameters
[in]p_device_poolPoiner to a device pool struct
Returns
None

Definition at line 2621 of file ni_rsrc_api.cpp.

◆ ni_rsrc_get_device_by_block_name()

LIB_API int ni_rsrc_get_device_by_block_name ( const char *  blk_name,
ni_device_type_t  device_type 
)

Get GUID of the device by block device name and type.


Parameters
[in]blk_namedevice's block name
[in]typedevice type
Returns
device GUID (>= 0) if found, NI_RETCODE_FAILURE (-1) otherwise

Definition at line 1799 of file ni_rsrc_api.cpp.

◆ ni_rsrc_get_device_context()

LIB_API ni_device_context_t* ni_rsrc_get_device_context ( ni_device_type_t  type,
int  guid 
)

Allocates and returns a pointer to ni_device_context_t struct based on provided device_type and guid. To be used for load update and codec query.


Parameters
[in]device_typeNI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
[in]guidGUID of the encoder or decoder device
Returns
pointer to ni_device_context_t if found, NULL otherwise

Note: The returned ni_device_context_t content is not supposed to be used by caller directly: should only be passed to API in the subsequent calls; also after its use, the context should be released by calling ni_rsrc_free_device_context.

◆ ni_rsrc_get_device_info()

LIB_API ni_device_info_t* ni_rsrc_get_device_info ( ni_device_type_t  device_type,
int  guid 
)

Query a specific device with detailed information on the system.


Parameters
[in]device_typeNI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
[in]guidunique device(decoder or encoder) id
Returns
pointer to ni_device_info_t if found NULL otherwise

Note: Caller is responsible for releasing memory that was allocated for the returned pointer

Definition at line 1748 of file ni_rsrc_api.cpp.

◆ ni_rsrc_get_device_pool()

LIB_API ni_device_pool_t* ni_rsrc_get_device_pool ( void  )

Create and return the allocated ni_device_pool_t struct.


Parameters
None
Returns
Pointer to ni_device_pool_t struct on success, or NULL on failure

◆ ni_rsrc_get_local_device_list()

LIB_API NI_DEPRECATED int ni_rsrc_get_local_device_list ( char  ni_devices[][NI_MAX_DEVICE_NAME_LEN],
int  max_handles 
)

Scans system for all NVMe devices and returns the system device names to the user which were identified as NETINT transcoder deivices. Names are suitable for OpenFile api usage afterwards This function had been replaced by ni_rsrc_get_local_device_list2 This function can't be callback with multi thread.


Parameters
[out]ni_devicesList of device names identified as NETINT NVMe transcoders
[in]max_handlesMax number of device names to return
Returns
Number if devices found if successfull operation completed 0 if no NETINT NVMe transcoder devices were found NI_RETCODE_ERROR_MEM_ALOC if memory allocation failed

◆ ni_rsrc_get_local_device_list2()

LIB_API int ni_rsrc_get_local_device_list2 ( char  ni_devices[][NI_MAX_DEVICE_NAME_LEN],
int  max_handles,
char **  xcoder_refresh_dev_names,
int  xcoder_refresh_dev_count 
)

Scans system for all NVMe devices and returns the system device names to the user which were identified as NETINT transcoder devices. Names are suitable for resource management API usage afterwards This function had replaced ni_rsrc_get_local_device_list This function can be callback with multi thread.


Parameters
[out]ni_devicesList of device names identified as NETINT NVMe transcoders
[in]max_handlesMax number of device names to return
[in]xcoder_refresh_dev_namesXcoder fresh device name
[in]xcoder_refresh_dev_countXcoder fresh device number count
Returns
Number of devices found. 0 if unsucessful.

◆ ni_rsrc_init()

LIB_API int ni_rsrc_init ( int  should_match_rev,
int  timeout_seconds 
)

Initialize and create all resources required to work with NETINT NVMe transcoder devices. This is a high level API function which is used mostly with user application like FFmpeg that relies on those resources. In case of custom application integration, revised functionality might be necessary utilizing coresponding API functions.


Parameters
[in]should_match_rev0: transcoder firmware revision matching the library's version is NOT required for placing the transcoder into resource pool; 1: otherwise timeout_seconds 0: No timeout amount, loop until init success or fail; else: timeout will fail init once reached
Returns
NI_RETCODE_SUCCESS on success NI_RETCODE_FAILURE on failure

◆ ni_rsrc_is_fw_compat()

LIB_API int ni_rsrc_is_fw_compat ( uint8_t  fw_rev[8])

check if device FW revision is compatible with SW API


Parameters
fw_rev
Returns
1 for full compatibility, 2 for partial, 0 for none

Definition at line 2784 of file ni_rsrc_api.cpp.

◆ ni_rsrc_list_all_devices()

LIB_API ni_retcode_t ni_rsrc_list_all_devices ( ni_device_t p_device)

List all devices with full information including s/w instances on the system.


Parameters
[out]p_deviceThe device information returned.
Returns
NI_RETCODE_SUCCESS NI_RETCODE_INVALID_PARAM NI_RETCODE_FAILURE

Note: Caller is responsible for allocating memory for "p_device".

Definition at line 1445 of file ni_rsrc_api.cpp.

◆ ni_rsrc_list_all_devices2()

LIB_API ni_retcode_t ni_rsrc_list_all_devices2 ( ni_device_t p_device,
bool  list_uninitialized 
)

Grabs information for every initialized and uninitialized device.


Parameters
[out]p_deviceThe device information returned.
list_uninitializedFlag to determine if uninitialized devices should be grabbed.
Returns
NI_RETCODE_SUCCESS NI_RETCODE_INVALID_PARAM NI_RETCODE_FAILURE

Note: Caller is responsible for allocating memory for "p_device".


Parameters
list_uninitializedFlag to determine if uninitialized devices should be grabbed.
Returns
NI_RETCODE_SUCCESS NI_RETCODE_INVALID_PARAM NI_RETCODE_FAILURE

Note: Caller is responsible for allocating memory for "p_device".

Definition at line 1487 of file ni_rsrc_api.cpp.

◆ ni_rsrc_list_devices()

LIB_API ni_retcode_t ni_rsrc_list_devices ( ni_device_type_t  device_type,
ni_device_info_t p_device_info,
int *  p_device_count 
)

List device(s) based on device type with full information including s/w instances on the system.


Parameters
[in]device_typeNI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
[out]p_deviceThe device information returned.
[out]p_device_countThe number of ni_device_info_t structs returned.
Returns

NI_RETCODE_SUCCESS NI_RETCODE_FAILURE

Note: Caller is responsible for allocating memory for "p_device".


Parameters
[in]device_typeNI_DEVICE_TYPE_DECODER or NI_DEVICE_TYPE_ENCODER
[out]p_deviceThe device information returned.
[out]p_device_countThe number of ni_device_info_t structs returned.
Returns
NI_RETCODE_SUCCESS NI_RETCODE_FAILURE

Note: Caller is responsible for allocating memory for "p_device".

Definition at line 1340 of file ni_rsrc_api.cpp.

◆ ni_rsrc_lock_and_open()

LIB_API int ni_rsrc_lock_and_open ( int  device_type,
ni_lock_handle_t *  lock 
)

lock a file lock and open a session on a device


Parameters
device_type
lock
Returns
None

Definition at line 2652 of file ni_rsrc_api.cpp.

◆ ni_rsrc_print_all_devices_capability()

LIB_API void ni_rsrc_print_all_devices_capability ( void  )

Print detailed capability information of all devices on the system.


Parameters
none
Returns
none

Definition at line 1681 of file ni_rsrc_api.cpp.

◆ ni_rsrc_print_all_devices_capability2()

LIB_API void ni_rsrc_print_all_devices_capability2 ( bool  list_uninitialized)

Prints detailed capability information for all initialized devices and general information about uninitialized devices.


Parameters
list_uninitializedFlag to determine if uninitialized devices should be grabbed.
Returns
none

Definition at line 1713 of file ni_rsrc_api.cpp.

◆ ni_rsrc_print_device_info()

LIB_API void ni_rsrc_print_device_info ( const ni_device_info_t p_device_info)

Print the content of the ni_device_info_t struct.


Parameters
p_device_info- pointer to the ni_device_info_t struct to print
Returns
None

Definition at line 1600 of file ni_rsrc_api.cpp.

◆ ni_rsrc_refresh()

LIB_API ni_retcode_t ni_rsrc_refresh ( int  should_match_rev)

Scan and refresh all resources on the host, taking into account hot-plugged and pulled out cards.


Parameters
[in]should_match_rev0: transcoder firmware revision matching the library's version is NOT required for placing the transcoder into resource pool; 1: otherwise
Returns
NI_RETCODE_SUCCESS on success NI_RETCODE_FAILURE on failure

Definition at line 159 of file ni_rsrc_api.cpp.

◆ ni_rsrc_release_resource()

LIB_API void ni_rsrc_release_resource ( ni_device_context_t p_device_context,
uint64_t  load 
)

Release resources allocated for decoding/encoding. function This must be called at the end of transcoding with previously assigned load value by allocate* functions.


Parameters
[in/out]p_ctxt the device context
[in]loadthe load value returned by allocate* functions
Returns
None

Definition at line 1953 of file ni_rsrc_api.cpp.

◆ ni_rsrc_remove_all_devices()

LIB_API int ni_rsrc_remove_all_devices ( void  )

Remove all NetInt h/w devices from resource pool on the host.


Parameters
none
Returns
NI_RETCODE_SUCCESS NI_RETCODE_FAILURE

Definition at line 2407 of file ni_rsrc_api.cpp.

◆ ni_rsrc_remove_device()

LIB_API int ni_rsrc_remove_device ( const char *  dev)

Remove an NetInt h/w device from resource pool on the host.


Parameters
[in]p_devthe NVMe device name
Returns
NI_RETCODE_SUCCESS NI_RETCODE_FAILURE

Definition at line 2203 of file ni_rsrc_api.cpp.

◆ ni_rsrc_unlock()

LIB_API int ni_rsrc_unlock ( int  device_type,
ni_lock_handle_t  lock 
)

unlock a file lock


Parameters
device_type
lock
Returns
None

Definition at line 2738 of file ni_rsrc_api.cpp.

◆ ni_rsrc_update_device_load()

int ni_rsrc_update_device_load ( ni_device_context_t p_device_context,
int  load,
int  sw_instance_cnt,
const ni_sw_instance_info_t  sw_instance_info[] 
)

Update the load value and s/w instances info of a specific decoder or encoder. This is used by resource management daemon to update periodically.


Parameters
[in]p_ctxtThe device context returned by ni_rsrc_get_device_context
[in]p_loadThe latest load value to update
[in]sw_instance_cntNumber of s/w instances
[in]sw_instance_infoInfo of s/w instances
Returns

NI_RETCODE_SUCCESS NI_RETCODE_FAILURE

Parameters
[in]p_ctxtThe device context returned by ni_rsrc_get_device_context
[in]p_loadThe latest load value to update
[in]sw_instance_cntNumber of s/w instances
[in]sw_instance_infoInfo of s/w instances
Returns
NI_RETCODE_SUCCESS NI_RETCODE_FAILURE

Definition at line 1878 of file ni_rsrc_api.cpp.

Variable Documentation

◆ g_dev_handle

ni_device_handle_t g_dev_handle

Definition at line 63 of file ni_rsrc_api.cpp.

◆ g_device_in_ctxt

bool g_device_in_ctxt

Definition at line 62 of file ni_rsrc_api.cpp.