deepstream源码

杂记、typedef—typedef int INTERGER 相当于用INTERGER来代表int类型; 或 typedef float REAL 用REAL来代表float
一、deepstream_sdk_v4.0_jetson/sources/apps/apps-common/src
从配置文件里面拿东西,装到h文件里定义的结构体内。用dpm_app.c将结构体激活起作用,通过管道,连成一条线
1、dpm_common.c
1)link_element_to_tee_src_pad
2)link_element_to_streammux_sink_pad
3)取消链接 unlink_element_from_streammux_sink_pad
4)link_element_to_demux_src_pad
5)str_replace
2、dpm_config_file_parser.c

里面是所有解析[ ]那组数据的方法,key和value一一对应,包括自定义的ds-example你也可以加入新的key

1)里面有所有大配置里的宏定义。例如:
#define CONFIG_GROUP_SOURCE_CAMERA_WIDTH "camera-width"
这些定义代表着管道中的各个插件,你可以在这里定义自己的插件,比如:
#define CONFIG_GROUP_DSEXAMPLE "ds-example"
2)get_absolute_file_path
3)parse_labels_file 解析标签files,类别class
4)parse_source 解析摄像头,视频源那个方面
5)parse_streammux,parse_dsexample,parse_osd,parse_dewarper,parse_gie,parse_tracker,parse_sink,parse_tiled_display

3、dpm_dewarper_bin.c
deepstream-dewarper-test
├ 演示单个或多个360度摄像机流的扭曲功能。从CSV文件读取相机校准参数,
├ 并在显示屏上渲染过道和斑点表面。
1)create_dewarper_bin
4、dpm_dsexample.c
1)create_dsexample_bin
5、dpm_osd_bin.c
1)create_osd_bin
7、dpm_perf.c
1)sink_bin_buf_probe //Buffer probe探查 function on sink element
2)perf_measurement_callback 性能测量回调
3)pause_perf_measurement,resume_perf_measurement,enable_perf_measurement
8、dpm_primary_gie_bin.c
1)write_infer_output_to_file //infer 推断
2)create_primary_gie_bin //gie 网络
9、dpm_secondary_gie_bin.c
1)wait_queue_buf_probe //等待为了所有第二阶段推理能平行进行
2)wait_queue_buf_probe1 //捕获EOS event,这样就可以停止等待所有次要任务完成
3)write_infer_output_to_file //output 输出
4)create_secondary_gie //Create secondary infer sub bin and sets properties mentioned in configuration file.
5)should_create_secondary_gie //This decides if secondary infer sub bin should be created or not
如果创建了第三级或更高级别的推断,则应以这样的方式创建对gie-id和unique-id的操作,即对second的输出执行第三个推断,对primary的输出执行第二个操作,依此类推
6)create_secondary_gie_bin
7)destroy_secondary_gie_bin

10、dpm_sink_bin.c
1)create_render_bin
2)create_encode_file_bin //Function to create sink bin to generate encoded output
3)start_rtsp_streaming
4)create_udpsink_bin
5)create_sink_bin

11、dpm_source_bin.c
1)set_camera_csi_params
2)set_camera_v4l2_params
3)create_camera_source_bin分情况,看是csi,v4l2还是不支持source type
4)cb_newpad —Decodebin linked to pipeline连接到管道的解码器;
cb_newpad2 cb_newpad3
5)cb_sourcesetup — latency延迟
6)seek_decode — Function to seek the source stream to start,It is required to play the stream in loop.
7)restart_stream_buf_prob 探测函数用于删除某些事件,以支持每个源流循环的自定义逻辑。prob探查
8)decodebin_child_added
9)create_rtsp_src_bin
10)create_uridecode_src_bin
11)create_source_bin
12)create_multi_source_bin
13)reset_source_pipeline
14)set_source_to_playing
15)reset_encodebin

12、dpm_streammux.c
1)set_streammux_properties // Create bin, add queue and the element, link all elements and ghost pads,Set the element properties from the parsed config解析配置

13、dpm_tiled_display_bin.c
1)create_tiled_display_bin tiled 平铺

14、dpm_tracker_bin.c
1)create_tracking_bin //ll-config-file ll-lib-file


二、deepstream_sdk_v4.0_jetson/sources/apps/apps-common/includes
这些头文件定义里一群结构体


三、deepstream_sdk_v4.0_jetson/sources/apps/sample_apps/deepstream-app
1、dpm_app.h将includes文件夹里面的结构体们组装成了新的大结构体
1)create_pipeline,pause_pipeline,resume_pipeline,seek_pipeline 声明
2)toggle_show_bbox_text
3)destroy_pipeline,restart_pipeline
4)这里是根据大config文件中的cfg_file_path读取小config里的properties.
parse_config_file

2、dpm_app.c
1)watch_source_status //This function try to reconnect the source by resetting that source pipeline.
2)bus_callback //从管道里收消息,然后做处理
EOS就是释放资源、退出循环,等待所有管道完工
3)bus_sync_handler //bus同步处理
4)write_kitti_output,write_kitti_track_output
5)component_id_compare_func
6)process_meta 处理元数据
7)process_buffer 处理推断buffer和元数据
8)gie_primary_processing_done_buf_prob //得到初步推断的结果
9)gie_processing_done_buf_prob //探针函数得到 Primary + Secondary推理的结果
10)tracking_done_buf_prob //在tracker后的buffer探针函数
11)latency_measurement_buf_prob //延迟测量
12)create_processing_instance //单独的缓冲区上工作
13)create_common_elements //Function to create common elements(Primary infer, tracker, secondary infer) of the pipeline.These components operate on muxed混合的 data from all the streams. So they are independent of number of streams in the pipeline.
14)create_pipeline 暂停,继续,毁掉都在这里//dpm_app.h里声明的方法在这里实现了

3、dpm_app_config_parser.c
1)#define CONFIG_GROUP_APP “application”
#define CONFIG_GROUP_APP_ENABLE_PERF_MEASUREMENT “enable-perf-measurement”
#define CONFIG_GROUP_TESTS “tests”
#define CONFIG_GROUP_TESTS_FILE_LOOP “file-loop”
2)parse_tests
3)parse_app
4)parse_config_file

4、dpm_app_main.c
1)all_bbox_generated // Callback function to be called once all inferences (Primary + Secondary) are done.不需要可以全部移除
2)_intr_handler //处理中断信号
3)perf_cb //callback function to print the performance性能 numbers of each stream是
4)check_for_interrupt //用于检查中断状态的循环函数
_intr_setup //Function to install custom handler for program interrupt signal
5)kbhit,changemode //用于启用/禁用终端规范模式的函数
print_runtime_commands
6)event_thread_func //循环功能检查键盘输入和每个管道的状态
7)get_source_id_from_coordinates //是平铺显示时候源的id吗?
8)nvds_x_event_thread //Thread to monitor监视 X window events.按下prq有反应?
9)overlay_graphics //关于最后显示字体,字间距什么的
10)main 一些终端的打印和开启整个程序

四、dpm-image-decode-test
1、dpm_image_decode_app.c
1)输出屏幕大小
2)gchar pgie_classes_str[4][32] = { “Vehicle”, “TwoWheeler”, “Person”,
“RoadSign”};
3)tiler_sink_pad_buffer_probe 将提取OSD sink pad上接收到的元数据,并更新绘制矩形、对象信息等的参数。 循环得到"Frame Number = %d Number of objects = %d "
“Vehicle Count = %d Person Count = %d\n”
4)buss_call //里面case GST_MESSAGE_WARNING,ERROR,ELEMENT啥的
5)create_source_bin //factory_make了 soure,jpeg-parser,nvv4l2-decoder
6)main gstnvdsmeta.h gst-nvmessage.h
建立里pipeline来连接elements,factory_make出来stream-muxer element来接收源—一系列操作–建立element engine nvtiler converter display transform renderer----
接下来配置这个element根据宏定义和config文件----将bus配备好buscall音箱(时刻报告前方消息)开到pipeline上----将所有element放到pipeline上,链接起来,就像站点—开通pipeline,buffer船装着源元素开始在pipeline里流动,在osd最后的element出口sink pad上,元素已经组装完整,加入探针告诉全世界完整元素生成—关闭管道

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章