• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright 2022 Collabora Ltd.
4  *
5  * AUTOMATICALLY GENERATED BY v4l2-tracer-gen.pl DO NOT EDIT
6  */
7 
8 #include "v4l2-tracer-common.h"
9 
trace_v4l2_ctrl_h264_sps_gen(void * ptr,json_object * parent_obj)10 void trace_v4l2_ctrl_h264_sps_gen(void *ptr, json_object *parent_obj)
11 {
12 	json_object *v4l2_ctrl_h264_sps_obj = json_object_new_object();
13 	struct v4l2_ctrl_h264_sps *p = static_cast<struct v4l2_ctrl_h264_sps*>(ptr);
14 	json_object_object_add(v4l2_ctrl_h264_sps_obj, "profile_idc", json_object_new_int(p->profile_idc));
15 	json_object_object_add(v4l2_ctrl_h264_sps_obj, "constraint_set_flags", json_object_new_string(fl2s(p->constraint_set_flags, v4l2_h264_sps_flag_def).c_str()));
16 	json_object_object_add(v4l2_ctrl_h264_sps_obj, "level_idc", json_object_new_int(p->level_idc));
17 	json_object_object_add(v4l2_ctrl_h264_sps_obj, "seq_parameter_set_id", json_object_new_int(p->seq_parameter_set_id));
18 	json_object_object_add(v4l2_ctrl_h264_sps_obj, "chroma_format_idc", json_object_new_int(p->chroma_format_idc));
19 	json_object_object_add(v4l2_ctrl_h264_sps_obj, "bit_depth_luma_minus8", json_object_new_int(p->bit_depth_luma_minus8));
20 	json_object_object_add(v4l2_ctrl_h264_sps_obj, "bit_depth_chroma_minus8", json_object_new_int(p->bit_depth_chroma_minus8));
21 	json_object_object_add(v4l2_ctrl_h264_sps_obj, "log2_max_frame_num_minus4", json_object_new_int(p->log2_max_frame_num_minus4));
22 	json_object_object_add(v4l2_ctrl_h264_sps_obj, "pic_order_cnt_type", json_object_new_int(p->pic_order_cnt_type));
23 	json_object_object_add(v4l2_ctrl_h264_sps_obj, "log2_max_pic_order_cnt_lsb_minus4", json_object_new_int(p->log2_max_pic_order_cnt_lsb_minus4));
24 	json_object_object_add(v4l2_ctrl_h264_sps_obj, "max_num_ref_frames", json_object_new_int(p->max_num_ref_frames));
25 	json_object_object_add(v4l2_ctrl_h264_sps_obj, "num_ref_frames_in_pic_order_cnt_cycle", json_object_new_int(p->num_ref_frames_in_pic_order_cnt_cycle));
26 	/* __s32 offset_for_ref_frame[255] */
27 	json_object *offset_for_ref_frame_obj = json_object_new_array();
28 	for (size_t i = 0; i < 255; i++) {
29 		json_object_array_add(offset_for_ref_frame_obj, json_object_new_int(p->offset_for_ref_frame[i]));
30 	}
31 	json_object_object_add(v4l2_ctrl_h264_sps_obj, "offset_for_ref_frame", offset_for_ref_frame_obj);
32 
33 	json_object_object_add(v4l2_ctrl_h264_sps_obj, "offset_for_non_ref_pic", json_object_new_int(p->offset_for_non_ref_pic));
34 	json_object_object_add(v4l2_ctrl_h264_sps_obj, "offset_for_top_to_bottom_field", json_object_new_int(p->offset_for_top_to_bottom_field));
35 	json_object_object_add(v4l2_ctrl_h264_sps_obj, "pic_width_in_mbs_minus1", json_object_new_int(p->pic_width_in_mbs_minus1));
36 	json_object_object_add(v4l2_ctrl_h264_sps_obj, "pic_height_in_map_units_minus1", json_object_new_int(p->pic_height_in_map_units_minus1));
37 	json_object_object_add(v4l2_ctrl_h264_sps_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_h264_sps_flag_def).c_str()));
38 	json_object_object_add(parent_obj, "v4l2_ctrl_h264_sps", v4l2_ctrl_h264_sps_obj);
39 }
40 
trace_v4l2_ctrl_h264_pps_gen(void * ptr,json_object * parent_obj)41 void trace_v4l2_ctrl_h264_pps_gen(void *ptr, json_object *parent_obj)
42 {
43 	json_object *v4l2_ctrl_h264_pps_obj = json_object_new_object();
44 	struct v4l2_ctrl_h264_pps *p = static_cast<struct v4l2_ctrl_h264_pps*>(ptr);
45 	json_object_object_add(v4l2_ctrl_h264_pps_obj, "pic_parameter_set_id", json_object_new_int(p->pic_parameter_set_id));
46 	json_object_object_add(v4l2_ctrl_h264_pps_obj, "seq_parameter_set_id", json_object_new_int(p->seq_parameter_set_id));
47 	json_object_object_add(v4l2_ctrl_h264_pps_obj, "num_slice_groups_minus1", json_object_new_int(p->num_slice_groups_minus1));
48 	json_object_object_add(v4l2_ctrl_h264_pps_obj, "num_ref_idx_l0_default_active_minus1", json_object_new_int(p->num_ref_idx_l0_default_active_minus1));
49 	json_object_object_add(v4l2_ctrl_h264_pps_obj, "num_ref_idx_l1_default_active_minus1", json_object_new_int(p->num_ref_idx_l1_default_active_minus1));
50 	json_object_object_add(v4l2_ctrl_h264_pps_obj, "weighted_bipred_idc", json_object_new_int(p->weighted_bipred_idc));
51 	json_object_object_add(v4l2_ctrl_h264_pps_obj, "pic_init_qp_minus26", json_object_new_int(p->pic_init_qp_minus26));
52 	json_object_object_add(v4l2_ctrl_h264_pps_obj, "pic_init_qs_minus26", json_object_new_int(p->pic_init_qs_minus26));
53 	json_object_object_add(v4l2_ctrl_h264_pps_obj, "chroma_qp_index_offset", json_object_new_int(p->chroma_qp_index_offset));
54 	json_object_object_add(v4l2_ctrl_h264_pps_obj, "second_chroma_qp_index_offset", json_object_new_int(p->second_chroma_qp_index_offset));
55 	json_object_object_add(v4l2_ctrl_h264_pps_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_h264_pps_flag_def).c_str()));
56 	json_object_object_add(parent_obj, "v4l2_ctrl_h264_pps", v4l2_ctrl_h264_pps_obj);
57 }
58 
trace_v4l2_ctrl_h264_scaling_matrix_gen(void * ptr,json_object * parent_obj)59 void trace_v4l2_ctrl_h264_scaling_matrix_gen(void *ptr, json_object *parent_obj)
60 {
61 	json_object *v4l2_ctrl_h264_scaling_matrix_obj = json_object_new_object();
62 	struct v4l2_ctrl_h264_scaling_matrix *p = static_cast<struct v4l2_ctrl_h264_scaling_matrix*>(ptr);
63 	/* __u8 scaling_list_4x4[6][16] */
64 	json_object *scaling_list_4x4_obj = json_object_new_array();
65 	for (size_t i = 0; i < 6; i++) {
66 		for (size_t j = 0; j < 16; j++) {
67 			json_object_array_add(scaling_list_4x4_obj, json_object_new_int(p->scaling_list_4x4[i][j]));
68 		}
69 	}
70 	json_object_object_add(v4l2_ctrl_h264_scaling_matrix_obj, "scaling_list_4x4", scaling_list_4x4_obj);
71 
72 	/* __u8 scaling_list_8x8[6][64] */
73 	json_object *scaling_list_8x8_obj = json_object_new_array();
74 	for (size_t i = 0; i < 6; i++) {
75 		for (size_t j = 0; j < 64; j++) {
76 			json_object_array_add(scaling_list_8x8_obj, json_object_new_int(p->scaling_list_8x8[i][j]));
77 		}
78 	}
79 	json_object_object_add(v4l2_ctrl_h264_scaling_matrix_obj, "scaling_list_8x8", scaling_list_8x8_obj);
80 
81 	json_object_object_add(parent_obj, "v4l2_ctrl_h264_scaling_matrix", v4l2_ctrl_h264_scaling_matrix_obj);
82 }
83 
trace_v4l2_h264_weight_factors_gen(void * ptr,json_object * parent_obj)84 void trace_v4l2_h264_weight_factors_gen(void *ptr, json_object *parent_obj)
85 {
86 	json_object *v4l2_h264_weight_factors_obj = json_object_new_object();
87 	struct v4l2_h264_weight_factors *p = static_cast<struct v4l2_h264_weight_factors*>(ptr);
88 	/* __s16 luma_weight[32] */
89 	json_object *luma_weight_obj = json_object_new_array();
90 	for (size_t i = 0; i < 32; i++) {
91 		json_object_array_add(luma_weight_obj, json_object_new_int(p->luma_weight[i]));
92 	}
93 	json_object_object_add(v4l2_h264_weight_factors_obj, "luma_weight", luma_weight_obj);
94 
95 	/* __s16 luma_offset[32] */
96 	json_object *luma_offset_obj = json_object_new_array();
97 	for (size_t i = 0; i < 32; i++) {
98 		json_object_array_add(luma_offset_obj, json_object_new_int(p->luma_offset[i]));
99 	}
100 	json_object_object_add(v4l2_h264_weight_factors_obj, "luma_offset", luma_offset_obj);
101 
102 	/* __s16 chroma_weight[32][2] */
103 	json_object *chroma_weight_obj = json_object_new_array();
104 	for (size_t i = 0; i < 32; i++) {
105 		for (size_t j = 0; j < 2; j++) {
106 			json_object_array_add(chroma_weight_obj, json_object_new_int(p->chroma_weight[i][j]));
107 		}
108 	}
109 	json_object_object_add(v4l2_h264_weight_factors_obj, "chroma_weight", chroma_weight_obj);
110 
111 	/* __s16 chroma_offset[32][2] */
112 	json_object *chroma_offset_obj = json_object_new_array();
113 	for (size_t i = 0; i < 32; i++) {
114 		for (size_t j = 0; j < 2; j++) {
115 			json_object_array_add(chroma_offset_obj, json_object_new_int(p->chroma_offset[i][j]));
116 		}
117 	}
118 	json_object_object_add(v4l2_h264_weight_factors_obj, "chroma_offset", chroma_offset_obj);
119 
120 	json_object_object_add(parent_obj, "v4l2_h264_weight_factors", v4l2_h264_weight_factors_obj);
121 }
122 
trace_v4l2_ctrl_h264_pred_weights_gen(void * ptr,json_object * parent_obj)123 void trace_v4l2_ctrl_h264_pred_weights_gen(void *ptr, json_object *parent_obj)
124 {
125 	json_object *v4l2_ctrl_h264_pred_weights_obj = json_object_new_object();
126 	struct v4l2_ctrl_h264_pred_weights *p = static_cast<struct v4l2_ctrl_h264_pred_weights*>(ptr);
127 	json_object_object_add(v4l2_ctrl_h264_pred_weights_obj, "luma_log2_weight_denom", json_object_new_int(p->luma_log2_weight_denom));
128 	json_object_object_add(v4l2_ctrl_h264_pred_weights_obj, "chroma_log2_weight_denom", json_object_new_int(p->chroma_log2_weight_denom));
129 	/* struct v4l2_h264_weight_factors weight_factors[2] */
130 	json_object *weight_factors_obj = json_object_new_array();
131 	for (size_t i = 0; i < 2; i++) {
132 		json_object *element_obj = json_object_new_object();
133 		trace_v4l2_h264_weight_factors_gen(&(p->weight_factors[i]), element_obj);
134 		json_object *element_no_key_obj;
135 		json_object_object_get_ex(element_obj, "v4l2_h264_weight_factors", &element_no_key_obj);
136 		json_object_array_add(weight_factors_obj, element_no_key_obj);
137 	}
138 	json_object_object_add(v4l2_ctrl_h264_pred_weights_obj, "weight_factors", weight_factors_obj);
139 
140 	json_object_object_add(parent_obj, "v4l2_ctrl_h264_pred_weights", v4l2_ctrl_h264_pred_weights_obj);
141 }
142 
trace_v4l2_h264_reference_gen(void * ptr,json_object * parent_obj)143 void trace_v4l2_h264_reference_gen(void *ptr, json_object *parent_obj)
144 {
145 	json_object *v4l2_h264_reference_obj = json_object_new_object();
146 	struct v4l2_h264_reference *p = static_cast<struct v4l2_h264_reference*>(ptr);
147 	json_object_object_add(v4l2_h264_reference_obj, "fields", json_object_new_int(p->fields));
148 	json_object_object_add(v4l2_h264_reference_obj, "index", json_object_new_int(p->index));
149 	json_object_object_add(parent_obj, "v4l2_h264_reference", v4l2_h264_reference_obj);
150 }
151 
trace_v4l2_ctrl_h264_slice_params_gen(void * ptr,json_object * parent_obj)152 void trace_v4l2_ctrl_h264_slice_params_gen(void *ptr, json_object *parent_obj)
153 {
154 	json_object *v4l2_ctrl_h264_slice_params_obj = json_object_new_object();
155 	struct v4l2_ctrl_h264_slice_params *p = static_cast<struct v4l2_ctrl_h264_slice_params*>(ptr);
156 	json_object_object_add(v4l2_ctrl_h264_slice_params_obj, "header_bit_size", json_object_new_int64(p->header_bit_size));
157 	json_object_object_add(v4l2_ctrl_h264_slice_params_obj, "first_mb_in_slice", json_object_new_int64(p->first_mb_in_slice));
158 	json_object_object_add(v4l2_ctrl_h264_slice_params_obj, "slice_type", json_object_new_int(p->slice_type));
159 	json_object_object_add(v4l2_ctrl_h264_slice_params_obj, "colour_plane_id", json_object_new_int(p->colour_plane_id));
160 	json_object_object_add(v4l2_ctrl_h264_slice_params_obj, "redundant_pic_cnt", json_object_new_int(p->redundant_pic_cnt));
161 	json_object_object_add(v4l2_ctrl_h264_slice_params_obj, "cabac_init_idc", json_object_new_int(p->cabac_init_idc));
162 	json_object_object_add(v4l2_ctrl_h264_slice_params_obj, "slice_qp_delta", json_object_new_int(p->slice_qp_delta));
163 	json_object_object_add(v4l2_ctrl_h264_slice_params_obj, "slice_qs_delta", json_object_new_int(p->slice_qs_delta));
164 	json_object_object_add(v4l2_ctrl_h264_slice_params_obj, "disable_deblocking_filter_idc", json_object_new_int(p->disable_deblocking_filter_idc));
165 	json_object_object_add(v4l2_ctrl_h264_slice_params_obj, "slice_alpha_c0_offset_div2", json_object_new_int(p->slice_alpha_c0_offset_div2));
166 	json_object_object_add(v4l2_ctrl_h264_slice_params_obj, "slice_beta_offset_div2", json_object_new_int(p->slice_beta_offset_div2));
167 	json_object_object_add(v4l2_ctrl_h264_slice_params_obj, "num_ref_idx_l0_active_minus1", json_object_new_int(p->num_ref_idx_l0_active_minus1));
168 	json_object_object_add(v4l2_ctrl_h264_slice_params_obj, "num_ref_idx_l1_active_minus1", json_object_new_int(p->num_ref_idx_l1_active_minus1));
169 	/* struct v4l2_h264_reference ref_pic_list0[V4L2_H264_REF_LIST_LEN] */
170 	json_object *ref_pic_list0_obj = json_object_new_array();
171 	for (size_t i = 0; i < V4L2_H264_REF_LIST_LEN; i++) {
172 		json_object *element_obj = json_object_new_object();
173 		trace_v4l2_h264_reference_gen(&(p->ref_pic_list0[i]), element_obj);
174 		json_object *element_no_key_obj;
175 		json_object_object_get_ex(element_obj, "v4l2_h264_reference", &element_no_key_obj);
176 		json_object_array_add(ref_pic_list0_obj, element_no_key_obj);
177 	}
178 	json_object_object_add(v4l2_ctrl_h264_slice_params_obj, "ref_pic_list0", ref_pic_list0_obj);
179 
180 	/* struct v4l2_h264_reference ref_pic_list1[V4L2_H264_REF_LIST_LEN] */
181 	json_object *ref_pic_list1_obj = json_object_new_array();
182 	for (size_t i = 0; i < V4L2_H264_REF_LIST_LEN; i++) {
183 		json_object *element_obj = json_object_new_object();
184 		trace_v4l2_h264_reference_gen(&(p->ref_pic_list1[i]), element_obj);
185 		json_object *element_no_key_obj;
186 		json_object_object_get_ex(element_obj, "v4l2_h264_reference", &element_no_key_obj);
187 		json_object_array_add(ref_pic_list1_obj, element_no_key_obj);
188 	}
189 	json_object_object_add(v4l2_ctrl_h264_slice_params_obj, "ref_pic_list1", ref_pic_list1_obj);
190 
191 	json_object_object_add(v4l2_ctrl_h264_slice_params_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_h264_slice_flag_def).c_str()));
192 	json_object_object_add(parent_obj, "v4l2_ctrl_h264_slice_params", v4l2_ctrl_h264_slice_params_obj);
193 }
194 
trace_v4l2_h264_dpb_entry_gen(void * ptr,json_object * parent_obj)195 void trace_v4l2_h264_dpb_entry_gen(void *ptr, json_object *parent_obj)
196 {
197 	json_object *v4l2_h264_dpb_entry_obj = json_object_new_object();
198 	struct v4l2_h264_dpb_entry *p = static_cast<struct v4l2_h264_dpb_entry*>(ptr);
199 	json_object_object_add(v4l2_h264_dpb_entry_obj, "reference_ts", json_object_new_uint64(p->reference_ts));
200 	json_object_object_add(v4l2_h264_dpb_entry_obj, "pic_num", json_object_new_int64(p->pic_num));
201 	json_object_object_add(v4l2_h264_dpb_entry_obj, "frame_num", json_object_new_int(p->frame_num));
202 	json_object_object_add(v4l2_h264_dpb_entry_obj, "fields", json_object_new_int(p->fields));
203 	json_object_object_add(v4l2_h264_dpb_entry_obj, "top_field_order_cnt", json_object_new_int(p->top_field_order_cnt));
204 	json_object_object_add(v4l2_h264_dpb_entry_obj, "bottom_field_order_cnt", json_object_new_int(p->bottom_field_order_cnt));
205 	json_object_object_add(v4l2_h264_dpb_entry_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_h264_dpb_entry_flag_def).c_str()));
206 	json_object_object_add(parent_obj, "v4l2_h264_dpb_entry", v4l2_h264_dpb_entry_obj);
207 }
208 
trace_v4l2_ctrl_h264_decode_params_gen(void * ptr,json_object * parent_obj)209 void trace_v4l2_ctrl_h264_decode_params_gen(void *ptr, json_object *parent_obj)
210 {
211 	json_object *v4l2_ctrl_h264_decode_params_obj = json_object_new_object();
212 	struct v4l2_ctrl_h264_decode_params *p = static_cast<struct v4l2_ctrl_h264_decode_params*>(ptr);
213 	/* struct v4l2_h264_dpb_entry dpb[V4L2_H264_NUM_DPB_ENTRIES] */
214 	json_object *dpb_obj = json_object_new_array();
215 	for (size_t i = 0; i < V4L2_H264_NUM_DPB_ENTRIES; i++) {
216 		json_object *element_obj = json_object_new_object();
217 		trace_v4l2_h264_dpb_entry_gen(&(p->dpb[i]), element_obj);
218 		json_object *element_no_key_obj;
219 		json_object_object_get_ex(element_obj, "v4l2_h264_dpb_entry", &element_no_key_obj);
220 		json_object_array_add(dpb_obj, element_no_key_obj);
221 	}
222 	json_object_object_add(v4l2_ctrl_h264_decode_params_obj, "dpb", dpb_obj);
223 
224 	json_object_object_add(v4l2_ctrl_h264_decode_params_obj, "nal_ref_idc", json_object_new_int(p->nal_ref_idc));
225 	json_object_object_add(v4l2_ctrl_h264_decode_params_obj, "frame_num", json_object_new_int(p->frame_num));
226 	json_object_object_add(v4l2_ctrl_h264_decode_params_obj, "top_field_order_cnt", json_object_new_int(p->top_field_order_cnt));
227 	json_object_object_add(v4l2_ctrl_h264_decode_params_obj, "bottom_field_order_cnt", json_object_new_int(p->bottom_field_order_cnt));
228 	json_object_object_add(v4l2_ctrl_h264_decode_params_obj, "idr_pic_id", json_object_new_int(p->idr_pic_id));
229 	json_object_object_add(v4l2_ctrl_h264_decode_params_obj, "pic_order_cnt_lsb", json_object_new_int(p->pic_order_cnt_lsb));
230 	json_object_object_add(v4l2_ctrl_h264_decode_params_obj, "delta_pic_order_cnt_bottom", json_object_new_int(p->delta_pic_order_cnt_bottom));
231 	json_object_object_add(v4l2_ctrl_h264_decode_params_obj, "delta_pic_order_cnt0", json_object_new_int(p->delta_pic_order_cnt0));
232 	json_object_object_add(v4l2_ctrl_h264_decode_params_obj, "delta_pic_order_cnt1", json_object_new_int(p->delta_pic_order_cnt1));
233 	json_object_object_add(v4l2_ctrl_h264_decode_params_obj, "dec_ref_pic_marking_bit_size", json_object_new_int64(p->dec_ref_pic_marking_bit_size));
234 	json_object_object_add(v4l2_ctrl_h264_decode_params_obj, "pic_order_cnt_bit_size", json_object_new_int64(p->pic_order_cnt_bit_size));
235 	json_object_object_add(v4l2_ctrl_h264_decode_params_obj, "slice_group_change_cycle", json_object_new_int64(p->slice_group_change_cycle));
236 	json_object_object_add(v4l2_ctrl_h264_decode_params_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_h264_decode_param_flag_def).c_str()));
237 	json_object_object_add(parent_obj, "v4l2_ctrl_h264_decode_params", v4l2_ctrl_h264_decode_params_obj);
238 }
239 
trace_v4l2_ctrl_fwht_params_gen(void * ptr,json_object * parent_obj)240 void trace_v4l2_ctrl_fwht_params_gen(void *ptr, json_object *parent_obj)
241 {
242 	json_object *v4l2_ctrl_fwht_params_obj = json_object_new_object();
243 	struct v4l2_ctrl_fwht_params *p = static_cast<struct v4l2_ctrl_fwht_params*>(ptr);
244 	json_object_object_add(v4l2_ctrl_fwht_params_obj, "backward_ref_ts", json_object_new_uint64(p->backward_ref_ts));
245 	json_object_object_add(v4l2_ctrl_fwht_params_obj, "version", json_object_new_int64(p->version));
246 	json_object_object_add(v4l2_ctrl_fwht_params_obj, "width", json_object_new_int64(p->width));
247 	json_object_object_add(v4l2_ctrl_fwht_params_obj, "height", json_object_new_int64(p->height));
248 	json_object_object_add(v4l2_ctrl_fwht_params_obj, "flags", json_object_new_string(fl2s_fwht(p->flags).c_str()));
249 	json_object_object_add(v4l2_ctrl_fwht_params_obj, "colorspace", json_object_new_string(val2s(p->colorspace, v4l2_colorspace_val_def).c_str()));
250 	json_object_object_add(v4l2_ctrl_fwht_params_obj, "xfer_func", json_object_new_string(val2s(p->xfer_func, v4l2_xfer_func_val_def).c_str()));
251 	json_object_object_add(v4l2_ctrl_fwht_params_obj, "ycbcr_enc", json_object_new_string(val2s(p->ycbcr_enc, v4l2_ycbcr_encoding_val_def).c_str()));
252 	json_object_object_add(v4l2_ctrl_fwht_params_obj, "quantization", json_object_new_string(val2s(p->quantization, v4l2_quantization_val_def).c_str()));
253 	json_object_object_add(parent_obj, "v4l2_ctrl_fwht_params", v4l2_ctrl_fwht_params_obj);
254 }
255 
trace_v4l2_vp8_segment_gen(void * ptr,json_object * parent_obj)256 void trace_v4l2_vp8_segment_gen(void *ptr, json_object *parent_obj)
257 {
258 	json_object *v4l2_vp8_segment_obj = json_object_new_object();
259 	struct v4l2_vp8_segment *p = static_cast<struct v4l2_vp8_segment*>(ptr);
260 	/* __s8 quant_update[4] */
261 	json_object *quant_update_obj = json_object_new_array();
262 	for (size_t i = 0; i < 4; i++) {
263 		json_object_array_add(quant_update_obj, json_object_new_int(p->quant_update[i]));
264 	}
265 	json_object_object_add(v4l2_vp8_segment_obj, "quant_update", quant_update_obj);
266 
267 	/* __s8 lf_update[4] */
268 	json_object *lf_update_obj = json_object_new_array();
269 	for (size_t i = 0; i < 4; i++) {
270 		json_object_array_add(lf_update_obj, json_object_new_int(p->lf_update[i]));
271 	}
272 	json_object_object_add(v4l2_vp8_segment_obj, "lf_update", lf_update_obj);
273 
274 	/* __u8 segment_probs[3] */
275 	json_object *segment_probs_obj = json_object_new_array();
276 	for (size_t i = 0; i < 3; i++) {
277 		json_object_array_add(segment_probs_obj, json_object_new_int(p->segment_probs[i]));
278 	}
279 	json_object_object_add(v4l2_vp8_segment_obj, "segment_probs", segment_probs_obj);
280 
281 	json_object_object_add(v4l2_vp8_segment_obj, "padding", json_object_new_int(p->padding));
282 	json_object_object_add(v4l2_vp8_segment_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_vp8_segment_flag_def).c_str()));
283 	json_object_object_add(parent_obj, "v4l2_vp8_segment", v4l2_vp8_segment_obj);
284 }
285 
trace_v4l2_vp8_loop_filter_gen(void * ptr,json_object * parent_obj)286 void trace_v4l2_vp8_loop_filter_gen(void *ptr, json_object *parent_obj)
287 {
288 	json_object *v4l2_vp8_loop_filter_obj = json_object_new_object();
289 	struct v4l2_vp8_loop_filter *p = static_cast<struct v4l2_vp8_loop_filter*>(ptr);
290 	/* __s8 ref_frm_delta[4] */
291 	json_object *ref_frm_delta_obj = json_object_new_array();
292 	for (size_t i = 0; i < 4; i++) {
293 		json_object_array_add(ref_frm_delta_obj, json_object_new_int(p->ref_frm_delta[i]));
294 	}
295 	json_object_object_add(v4l2_vp8_loop_filter_obj, "ref_frm_delta", ref_frm_delta_obj);
296 
297 	/* __s8 mb_mode_delta[4] */
298 	json_object *mb_mode_delta_obj = json_object_new_array();
299 	for (size_t i = 0; i < 4; i++) {
300 		json_object_array_add(mb_mode_delta_obj, json_object_new_int(p->mb_mode_delta[i]));
301 	}
302 	json_object_object_add(v4l2_vp8_loop_filter_obj, "mb_mode_delta", mb_mode_delta_obj);
303 
304 	json_object_object_add(v4l2_vp8_loop_filter_obj, "sharpness_level", json_object_new_int(p->sharpness_level));
305 	json_object_object_add(v4l2_vp8_loop_filter_obj, "level", json_object_new_int(p->level));
306 	json_object_object_add(v4l2_vp8_loop_filter_obj, "padding", json_object_new_int(p->padding));
307 	json_object_object_add(v4l2_vp8_loop_filter_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_vp8_loop_filter_flag_def).c_str()));
308 	json_object_object_add(parent_obj, "v4l2_vp8_loop_filter", v4l2_vp8_loop_filter_obj);
309 }
310 
trace_v4l2_vp8_quantization_gen(void * ptr,json_object * parent_obj)311 void trace_v4l2_vp8_quantization_gen(void *ptr, json_object *parent_obj)
312 {
313 	json_object *v4l2_vp8_quantization_obj = json_object_new_object();
314 	struct v4l2_vp8_quantization *p = static_cast<struct v4l2_vp8_quantization*>(ptr);
315 	json_object_object_add(v4l2_vp8_quantization_obj, "y_ac_qi", json_object_new_int(p->y_ac_qi));
316 	json_object_object_add(v4l2_vp8_quantization_obj, "y_dc_delta", json_object_new_int(p->y_dc_delta));
317 	json_object_object_add(v4l2_vp8_quantization_obj, "y2_dc_delta", json_object_new_int(p->y2_dc_delta));
318 	json_object_object_add(v4l2_vp8_quantization_obj, "y2_ac_delta", json_object_new_int(p->y2_ac_delta));
319 	json_object_object_add(v4l2_vp8_quantization_obj, "uv_dc_delta", json_object_new_int(p->uv_dc_delta));
320 	json_object_object_add(v4l2_vp8_quantization_obj, "uv_ac_delta", json_object_new_int(p->uv_ac_delta));
321 	json_object_object_add(v4l2_vp8_quantization_obj, "padding", json_object_new_int(p->padding));
322 	json_object_object_add(parent_obj, "v4l2_vp8_quantization", v4l2_vp8_quantization_obj);
323 }
324 
trace_v4l2_vp8_entropy_gen(void * ptr,json_object * parent_obj)325 void trace_v4l2_vp8_entropy_gen(void *ptr, json_object *parent_obj)
326 {
327 	json_object *v4l2_vp8_entropy_obj = json_object_new_object();
328 	struct v4l2_vp8_entropy *p = static_cast<struct v4l2_vp8_entropy*>(ptr);
329 	/* __u8 coeff_probs[4][8][3][V4L2_VP8_COEFF_PROB_CNT] */
330 	json_object *coeff_probs_obj = json_object_new_array();
331 	for (size_t i = 0; i < 4; i++) {
332 		for (size_t j = 0; j < 8; j++) {
333 			for (size_t k = 0; k < 3; k++) {
334 				for (size_t l = 0; l < V4L2_VP8_COEFF_PROB_CNT; l++) {
335 					json_object_array_add(coeff_probs_obj, json_object_new_int(p->coeff_probs[i][j][k][l]));
336 				}
337 			}
338 		}
339 	}
340 	json_object_object_add(v4l2_vp8_entropy_obj, "coeff_probs", coeff_probs_obj);
341 
342 	/* __u8 y_mode_probs[4] */
343 	json_object *y_mode_probs_obj = json_object_new_array();
344 	for (size_t i = 0; i < 4; i++) {
345 		json_object_array_add(y_mode_probs_obj, json_object_new_int(p->y_mode_probs[i]));
346 	}
347 	json_object_object_add(v4l2_vp8_entropy_obj, "y_mode_probs", y_mode_probs_obj);
348 
349 	/* __u8 uv_mode_probs[3] */
350 	json_object *uv_mode_probs_obj = json_object_new_array();
351 	for (size_t i = 0; i < 3; i++) {
352 		json_object_array_add(uv_mode_probs_obj, json_object_new_int(p->uv_mode_probs[i]));
353 	}
354 	json_object_object_add(v4l2_vp8_entropy_obj, "uv_mode_probs", uv_mode_probs_obj);
355 
356 	/* __u8 mv_probs[2][V4L2_VP8_MV_PROB_CNT] */
357 	json_object *mv_probs_obj = json_object_new_array();
358 	for (size_t i = 0; i < 2; i++) {
359 		for (size_t j = 0; j < V4L2_VP8_MV_PROB_CNT; j++) {
360 			json_object_array_add(mv_probs_obj, json_object_new_int(p->mv_probs[i][j]));
361 		}
362 	}
363 	json_object_object_add(v4l2_vp8_entropy_obj, "mv_probs", mv_probs_obj);
364 
365 	/* __u8 padding[3] */
366 	json_object *padding_obj = json_object_new_array();
367 	for (size_t i = 0; i < 3; i++) {
368 		json_object_array_add(padding_obj, json_object_new_int(p->padding[i]));
369 	}
370 	json_object_object_add(v4l2_vp8_entropy_obj, "padding", padding_obj);
371 
372 	json_object_object_add(parent_obj, "v4l2_vp8_entropy", v4l2_vp8_entropy_obj);
373 }
374 
trace_v4l2_vp8_entropy_coder_state_gen(void * ptr,json_object * parent_obj)375 void trace_v4l2_vp8_entropy_coder_state_gen(void *ptr, json_object *parent_obj)
376 {
377 	json_object *v4l2_vp8_entropy_coder_state_obj = json_object_new_object();
378 	struct v4l2_vp8_entropy_coder_state *p = static_cast<struct v4l2_vp8_entropy_coder_state*>(ptr);
379 	json_object_object_add(v4l2_vp8_entropy_coder_state_obj, "range", json_object_new_int(p->range));
380 	json_object_object_add(v4l2_vp8_entropy_coder_state_obj, "value", json_object_new_int(p->value));
381 	json_object_object_add(v4l2_vp8_entropy_coder_state_obj, "bit_count", json_object_new_int(p->bit_count));
382 	json_object_object_add(v4l2_vp8_entropy_coder_state_obj, "padding", json_object_new_int(p->padding));
383 	json_object_object_add(parent_obj, "v4l2_vp8_entropy_coder_state", v4l2_vp8_entropy_coder_state_obj);
384 }
385 
trace_v4l2_ctrl_vp8_frame_gen(void * ptr,json_object * parent_obj)386 void trace_v4l2_ctrl_vp8_frame_gen(void *ptr, json_object *parent_obj)
387 {
388 	json_object *v4l2_ctrl_vp8_frame_obj = json_object_new_object();
389 	struct v4l2_ctrl_vp8_frame *p = static_cast<struct v4l2_ctrl_vp8_frame*>(ptr);
390 	/* struct v4l2_vp8_segment segment */
391 	trace_v4l2_vp8_segment_gen(&p->segment, v4l2_ctrl_vp8_frame_obj);
392 	/* struct v4l2_vp8_loop_filter lf */
393 	trace_v4l2_vp8_loop_filter_gen(&p->lf, v4l2_ctrl_vp8_frame_obj);
394 	/* struct v4l2_vp8_quantization quant */
395 	trace_v4l2_vp8_quantization_gen(&p->quant, v4l2_ctrl_vp8_frame_obj);
396 	/* struct v4l2_vp8_entropy entropy */
397 	trace_v4l2_vp8_entropy_gen(&p->entropy, v4l2_ctrl_vp8_frame_obj);
398 	/* struct v4l2_vp8_entropy_coder_state coder_state */
399 	trace_v4l2_vp8_entropy_coder_state_gen(&p->coder_state, v4l2_ctrl_vp8_frame_obj);
400 	json_object_object_add(v4l2_ctrl_vp8_frame_obj, "width", json_object_new_int(p->width));
401 	json_object_object_add(v4l2_ctrl_vp8_frame_obj, "height", json_object_new_int(p->height));
402 	json_object_object_add(v4l2_ctrl_vp8_frame_obj, "horizontal_scale", json_object_new_int(p->horizontal_scale));
403 	json_object_object_add(v4l2_ctrl_vp8_frame_obj, "vertical_scale", json_object_new_int(p->vertical_scale));
404 	json_object_object_add(v4l2_ctrl_vp8_frame_obj, "version", json_object_new_int(p->version));
405 	json_object_object_add(v4l2_ctrl_vp8_frame_obj, "prob_skip_false", json_object_new_int(p->prob_skip_false));
406 	json_object_object_add(v4l2_ctrl_vp8_frame_obj, "prob_intra", json_object_new_int(p->prob_intra));
407 	json_object_object_add(v4l2_ctrl_vp8_frame_obj, "prob_last", json_object_new_int(p->prob_last));
408 	json_object_object_add(v4l2_ctrl_vp8_frame_obj, "prob_gf", json_object_new_int(p->prob_gf));
409 	json_object_object_add(v4l2_ctrl_vp8_frame_obj, "num_dct_parts", json_object_new_int(p->num_dct_parts));
410 	json_object_object_add(v4l2_ctrl_vp8_frame_obj, "first_part_size", json_object_new_int64(p->first_part_size));
411 	json_object_object_add(v4l2_ctrl_vp8_frame_obj, "first_part_header_bits", json_object_new_int64(p->first_part_header_bits));
412 	/* __u32 dct_part_sizes[8] */
413 	json_object *dct_part_sizes_obj = json_object_new_array();
414 	for (size_t i = 0; i < 8; i++) {
415 		json_object_array_add(dct_part_sizes_obj, json_object_new_int64(p->dct_part_sizes[i]));
416 	}
417 	json_object_object_add(v4l2_ctrl_vp8_frame_obj, "dct_part_sizes", dct_part_sizes_obj);
418 
419 	json_object_object_add(v4l2_ctrl_vp8_frame_obj, "last_frame_ts", json_object_new_uint64(p->last_frame_ts));
420 	json_object_object_add(v4l2_ctrl_vp8_frame_obj, "golden_frame_ts", json_object_new_uint64(p->golden_frame_ts));
421 	json_object_object_add(v4l2_ctrl_vp8_frame_obj, "alt_frame_ts", json_object_new_uint64(p->alt_frame_ts));
422 	json_object_object_add(v4l2_ctrl_vp8_frame_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_vp8_frame_flag_def).c_str()));
423 	json_object_object_add(parent_obj, "v4l2_ctrl_vp8_frame", v4l2_ctrl_vp8_frame_obj);
424 }
425 
trace_v4l2_ctrl_mpeg2_sequence_gen(void * ptr,json_object * parent_obj)426 void trace_v4l2_ctrl_mpeg2_sequence_gen(void *ptr, json_object *parent_obj)
427 {
428 	json_object *v4l2_ctrl_mpeg2_sequence_obj = json_object_new_object();
429 	struct v4l2_ctrl_mpeg2_sequence *p = static_cast<struct v4l2_ctrl_mpeg2_sequence*>(ptr);
430 	json_object_object_add(v4l2_ctrl_mpeg2_sequence_obj, "horizontal_size", json_object_new_int(p->horizontal_size));
431 	json_object_object_add(v4l2_ctrl_mpeg2_sequence_obj, "vertical_size", json_object_new_int(p->vertical_size));
432 	json_object_object_add(v4l2_ctrl_mpeg2_sequence_obj, "vbv_buffer_size", json_object_new_int64(p->vbv_buffer_size));
433 	json_object_object_add(v4l2_ctrl_mpeg2_sequence_obj, "profile_and_level_indication", json_object_new_int(p->profile_and_level_indication));
434 	json_object_object_add(v4l2_ctrl_mpeg2_sequence_obj, "chroma_format", json_object_new_int(p->chroma_format));
435 	json_object_object_add(v4l2_ctrl_mpeg2_sequence_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_mpeg2_seq_flag_def).c_str()));
436 	json_object_object_add(parent_obj, "v4l2_ctrl_mpeg2_sequence", v4l2_ctrl_mpeg2_sequence_obj);
437 }
438 
trace_v4l2_ctrl_mpeg2_picture_gen(void * ptr,json_object * parent_obj)439 void trace_v4l2_ctrl_mpeg2_picture_gen(void *ptr, json_object *parent_obj)
440 {
441 	json_object *v4l2_ctrl_mpeg2_picture_obj = json_object_new_object();
442 	struct v4l2_ctrl_mpeg2_picture *p = static_cast<struct v4l2_ctrl_mpeg2_picture*>(ptr);
443 	json_object_object_add(v4l2_ctrl_mpeg2_picture_obj, "backward_ref_ts", json_object_new_uint64(p->backward_ref_ts));
444 	json_object_object_add(v4l2_ctrl_mpeg2_picture_obj, "forward_ref_ts", json_object_new_uint64(p->forward_ref_ts));
445 	json_object_object_add(v4l2_ctrl_mpeg2_picture_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_mpeg2_pic_flag_def).c_str()));
446 	/* __u8	f_code[2][2] */
447 	json_object *f_code_obj = json_object_new_array();
448 	for (size_t i = 0; i < 2; i++) {
449 		for (size_t j = 0; j < 2; j++) {
450 			json_object_array_add(f_code_obj, json_object_new_int(p->f_code[i][j]));
451 		}
452 	}
453 	json_object_object_add(v4l2_ctrl_mpeg2_picture_obj, "f_code", f_code_obj);
454 
455 	json_object_object_add(v4l2_ctrl_mpeg2_picture_obj, "picture_coding_type", json_object_new_int(p->picture_coding_type));
456 	json_object_object_add(v4l2_ctrl_mpeg2_picture_obj, "picture_structure", json_object_new_int(p->picture_structure));
457 	json_object_object_add(v4l2_ctrl_mpeg2_picture_obj, "intra_dc_precision", json_object_new_int(p->intra_dc_precision));
458 	json_object_object_add(parent_obj, "v4l2_ctrl_mpeg2_picture", v4l2_ctrl_mpeg2_picture_obj);
459 }
460 
trace_v4l2_ctrl_mpeg2_quantisation_gen(void * ptr,json_object * parent_obj)461 void trace_v4l2_ctrl_mpeg2_quantisation_gen(void *ptr, json_object *parent_obj)
462 {
463 	json_object *v4l2_ctrl_mpeg2_quantisation_obj = json_object_new_object();
464 	struct v4l2_ctrl_mpeg2_quantisation *p = static_cast<struct v4l2_ctrl_mpeg2_quantisation*>(ptr);
465 	/* __u8	intra_quantiser_matrix[64] */
466 	json_object *intra_quantiser_matrix_obj = json_object_new_array();
467 	for (size_t i = 0; i < 64; i++) {
468 		json_object_array_add(intra_quantiser_matrix_obj, json_object_new_int(p->intra_quantiser_matrix[i]));
469 	}
470 	json_object_object_add(v4l2_ctrl_mpeg2_quantisation_obj, "intra_quantiser_matrix", intra_quantiser_matrix_obj);
471 
472 	/* __u8	non_intra_quantiser_matrix[64] */
473 	json_object *non_intra_quantiser_matrix_obj = json_object_new_array();
474 	for (size_t i = 0; i < 64; i++) {
475 		json_object_array_add(non_intra_quantiser_matrix_obj, json_object_new_int(p->non_intra_quantiser_matrix[i]));
476 	}
477 	json_object_object_add(v4l2_ctrl_mpeg2_quantisation_obj, "non_intra_quantiser_matrix", non_intra_quantiser_matrix_obj);
478 
479 	/* __u8	chroma_intra_quantiser_matrix[64] */
480 	json_object *chroma_intra_quantiser_matrix_obj = json_object_new_array();
481 	for (size_t i = 0; i < 64; i++) {
482 		json_object_array_add(chroma_intra_quantiser_matrix_obj, json_object_new_int(p->chroma_intra_quantiser_matrix[i]));
483 	}
484 	json_object_object_add(v4l2_ctrl_mpeg2_quantisation_obj, "chroma_intra_quantiser_matrix", chroma_intra_quantiser_matrix_obj);
485 
486 	/* __u8	chroma_non_intra_quantiser_matrix[64] */
487 	json_object *chroma_non_intra_quantiser_matrix_obj = json_object_new_array();
488 	for (size_t i = 0; i < 64; i++) {
489 		json_object_array_add(chroma_non_intra_quantiser_matrix_obj, json_object_new_int(p->chroma_non_intra_quantiser_matrix[i]));
490 	}
491 	json_object_object_add(v4l2_ctrl_mpeg2_quantisation_obj, "chroma_non_intra_quantiser_matrix", chroma_non_intra_quantiser_matrix_obj);
492 
493 	json_object_object_add(parent_obj, "v4l2_ctrl_mpeg2_quantisation", v4l2_ctrl_mpeg2_quantisation_obj);
494 }
495 
trace_v4l2_ctrl_hevc_sps_gen(void * ptr,json_object * parent_obj)496 void trace_v4l2_ctrl_hevc_sps_gen(void *ptr, json_object *parent_obj)
497 {
498 	json_object *v4l2_ctrl_hevc_sps_obj = json_object_new_object();
499 	struct v4l2_ctrl_hevc_sps *p = static_cast<struct v4l2_ctrl_hevc_sps*>(ptr);
500 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "video_parameter_set_id", json_object_new_int(p->video_parameter_set_id));
501 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "seq_parameter_set_id", json_object_new_int(p->seq_parameter_set_id));
502 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "pic_width_in_luma_samples", json_object_new_int(p->pic_width_in_luma_samples));
503 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "pic_height_in_luma_samples", json_object_new_int(p->pic_height_in_luma_samples));
504 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "bit_depth_luma_minus8", json_object_new_int(p->bit_depth_luma_minus8));
505 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "bit_depth_chroma_minus8", json_object_new_int(p->bit_depth_chroma_minus8));
506 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "log2_max_pic_order_cnt_lsb_minus4", json_object_new_int(p->log2_max_pic_order_cnt_lsb_minus4));
507 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "sps_max_dec_pic_buffering_minus1", json_object_new_int(p->sps_max_dec_pic_buffering_minus1));
508 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "sps_max_num_reorder_pics", json_object_new_int(p->sps_max_num_reorder_pics));
509 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "sps_max_latency_increase_plus1", json_object_new_int(p->sps_max_latency_increase_plus1));
510 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "log2_min_luma_coding_block_size_minus3", json_object_new_int(p->log2_min_luma_coding_block_size_minus3));
511 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "log2_diff_max_min_luma_coding_block_size", json_object_new_int(p->log2_diff_max_min_luma_coding_block_size));
512 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "log2_min_luma_transform_block_size_minus2", json_object_new_int(p->log2_min_luma_transform_block_size_minus2));
513 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "log2_diff_max_min_luma_transform_block_size", json_object_new_int(p->log2_diff_max_min_luma_transform_block_size));
514 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "max_transform_hierarchy_depth_inter", json_object_new_int(p->max_transform_hierarchy_depth_inter));
515 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "max_transform_hierarchy_depth_intra", json_object_new_int(p->max_transform_hierarchy_depth_intra));
516 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "pcm_sample_bit_depth_luma_minus1", json_object_new_int(p->pcm_sample_bit_depth_luma_minus1));
517 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "pcm_sample_bit_depth_chroma_minus1", json_object_new_int(p->pcm_sample_bit_depth_chroma_minus1));
518 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "log2_min_pcm_luma_coding_block_size_minus3", json_object_new_int(p->log2_min_pcm_luma_coding_block_size_minus3));
519 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "log2_diff_max_min_pcm_luma_coding_block_size", json_object_new_int(p->log2_diff_max_min_pcm_luma_coding_block_size));
520 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "num_short_term_ref_pic_sets", json_object_new_int(p->num_short_term_ref_pic_sets));
521 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "num_long_term_ref_pics_sps", json_object_new_int(p->num_long_term_ref_pics_sps));
522 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "chroma_format_idc", json_object_new_int(p->chroma_format_idc));
523 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "sps_max_sub_layers_minus1", json_object_new_int(p->sps_max_sub_layers_minus1));
524 	json_object_object_add(v4l2_ctrl_hevc_sps_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_hevc_sps_flag_def).c_str()));
525 	json_object_object_add(parent_obj, "v4l2_ctrl_hevc_sps", v4l2_ctrl_hevc_sps_obj);
526 }
527 
trace_v4l2_ctrl_hevc_pps_gen(void * ptr,json_object * parent_obj)528 void trace_v4l2_ctrl_hevc_pps_gen(void *ptr, json_object *parent_obj)
529 {
530 	json_object *v4l2_ctrl_hevc_pps_obj = json_object_new_object();
531 	struct v4l2_ctrl_hevc_pps *p = static_cast<struct v4l2_ctrl_hevc_pps*>(ptr);
532 	json_object_object_add(v4l2_ctrl_hevc_pps_obj, "pic_parameter_set_id", json_object_new_int(p->pic_parameter_set_id));
533 	json_object_object_add(v4l2_ctrl_hevc_pps_obj, "num_extra_slice_header_bits", json_object_new_int(p->num_extra_slice_header_bits));
534 	json_object_object_add(v4l2_ctrl_hevc_pps_obj, "num_ref_idx_l0_default_active_minus1", json_object_new_int(p->num_ref_idx_l0_default_active_minus1));
535 	json_object_object_add(v4l2_ctrl_hevc_pps_obj, "num_ref_idx_l1_default_active_minus1", json_object_new_int(p->num_ref_idx_l1_default_active_minus1));
536 	json_object_object_add(v4l2_ctrl_hevc_pps_obj, "init_qp_minus26", json_object_new_int(p->init_qp_minus26));
537 	json_object_object_add(v4l2_ctrl_hevc_pps_obj, "diff_cu_qp_delta_depth", json_object_new_int(p->diff_cu_qp_delta_depth));
538 	json_object_object_add(v4l2_ctrl_hevc_pps_obj, "pps_cb_qp_offset", json_object_new_int(p->pps_cb_qp_offset));
539 	json_object_object_add(v4l2_ctrl_hevc_pps_obj, "pps_cr_qp_offset", json_object_new_int(p->pps_cr_qp_offset));
540 	json_object_object_add(v4l2_ctrl_hevc_pps_obj, "num_tile_columns_minus1", json_object_new_int(p->num_tile_columns_minus1));
541 	json_object_object_add(v4l2_ctrl_hevc_pps_obj, "num_tile_rows_minus1", json_object_new_int(p->num_tile_rows_minus1));
542 	/* __u8	column_width_minus1[20] */
543 	json_object *column_width_minus1_obj = json_object_new_array();
544 	for (size_t i = 0; i < 20; i++) {
545 		json_object_array_add(column_width_minus1_obj, json_object_new_int(p->column_width_minus1[i]));
546 	}
547 	json_object_object_add(v4l2_ctrl_hevc_pps_obj, "column_width_minus1", column_width_minus1_obj);
548 
549 	/* __u8	row_height_minus1[22] */
550 	json_object *row_height_minus1_obj = json_object_new_array();
551 	for (size_t i = 0; i < 22; i++) {
552 		json_object_array_add(row_height_minus1_obj, json_object_new_int(p->row_height_minus1[i]));
553 	}
554 	json_object_object_add(v4l2_ctrl_hevc_pps_obj, "row_height_minus1", row_height_minus1_obj);
555 
556 	json_object_object_add(v4l2_ctrl_hevc_pps_obj, "pps_beta_offset_div2", json_object_new_int(p->pps_beta_offset_div2));
557 	json_object_object_add(v4l2_ctrl_hevc_pps_obj, "pps_tc_offset_div2", json_object_new_int(p->pps_tc_offset_div2));
558 	json_object_object_add(v4l2_ctrl_hevc_pps_obj, "log2_parallel_merge_level_minus2", json_object_new_int(p->log2_parallel_merge_level_minus2));
559 	json_object_object_add(v4l2_ctrl_hevc_pps_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_hevc_pps_flag_def).c_str()));
560 	json_object_object_add(parent_obj, "v4l2_ctrl_hevc_pps", v4l2_ctrl_hevc_pps_obj);
561 }
562 
trace_v4l2_hevc_dpb_entry_gen(void * ptr,json_object * parent_obj)563 void trace_v4l2_hevc_dpb_entry_gen(void *ptr, json_object *parent_obj)
564 {
565 	json_object *v4l2_hevc_dpb_entry_obj = json_object_new_object();
566 	struct v4l2_hevc_dpb_entry *p = static_cast<struct v4l2_hevc_dpb_entry*>(ptr);
567 	json_object_object_add(v4l2_hevc_dpb_entry_obj, "timestamp", json_object_new_uint64(p->timestamp));
568 	json_object_object_add(v4l2_hevc_dpb_entry_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_hevc_pps_flag_def).c_str()));
569 	json_object_object_add(v4l2_hevc_dpb_entry_obj, "field_pic", json_object_new_int(p->field_pic));
570 	json_object_object_add(v4l2_hevc_dpb_entry_obj, "pic_order_cnt_val", json_object_new_int(p->pic_order_cnt_val));
571 	json_object_object_add(parent_obj, "v4l2_hevc_dpb_entry", v4l2_hevc_dpb_entry_obj);
572 }
573 
trace_v4l2_hevc_pred_weight_table_gen(void * ptr,json_object * parent_obj)574 void trace_v4l2_hevc_pred_weight_table_gen(void *ptr, json_object *parent_obj)
575 {
576 	json_object *v4l2_hevc_pred_weight_table_obj = json_object_new_object();
577 	struct v4l2_hevc_pred_weight_table *p = static_cast<struct v4l2_hevc_pred_weight_table*>(ptr);
578 	/* __s8	delta_luma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
579 	json_object *delta_luma_weight_l0_obj = json_object_new_array();
580 	for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
581 		json_object_array_add(delta_luma_weight_l0_obj, json_object_new_int(p->delta_luma_weight_l0[i]));
582 	}
583 	json_object_object_add(v4l2_hevc_pred_weight_table_obj, "delta_luma_weight_l0", delta_luma_weight_l0_obj);
584 
585 	/* __s8	luma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
586 	json_object *luma_offset_l0_obj = json_object_new_array();
587 	for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
588 		json_object_array_add(luma_offset_l0_obj, json_object_new_int(p->luma_offset_l0[i]));
589 	}
590 	json_object_object_add(v4l2_hevc_pred_weight_table_obj, "luma_offset_l0", luma_offset_l0_obj);
591 
592 	/* __s8	delta_chroma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2] */
593 	json_object *delta_chroma_weight_l0_obj = json_object_new_array();
594 	for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
595 		for (size_t j = 0; j < 2; j++) {
596 			json_object_array_add(delta_chroma_weight_l0_obj, json_object_new_int(p->delta_chroma_weight_l0[i][j]));
597 		}
598 	}
599 	json_object_object_add(v4l2_hevc_pred_weight_table_obj, "delta_chroma_weight_l0", delta_chroma_weight_l0_obj);
600 
601 	/* __s8	chroma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2] */
602 	json_object *chroma_offset_l0_obj = json_object_new_array();
603 	for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
604 		for (size_t j = 0; j < 2; j++) {
605 			json_object_array_add(chroma_offset_l0_obj, json_object_new_int(p->chroma_offset_l0[i][j]));
606 		}
607 	}
608 	json_object_object_add(v4l2_hevc_pred_weight_table_obj, "chroma_offset_l0", chroma_offset_l0_obj);
609 
610 	/* __s8	delta_luma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
611 	json_object *delta_luma_weight_l1_obj = json_object_new_array();
612 	for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
613 		json_object_array_add(delta_luma_weight_l1_obj, json_object_new_int(p->delta_luma_weight_l1[i]));
614 	}
615 	json_object_object_add(v4l2_hevc_pred_weight_table_obj, "delta_luma_weight_l1", delta_luma_weight_l1_obj);
616 
617 	/* __s8	luma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
618 	json_object *luma_offset_l1_obj = json_object_new_array();
619 	for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
620 		json_object_array_add(luma_offset_l1_obj, json_object_new_int(p->luma_offset_l1[i]));
621 	}
622 	json_object_object_add(v4l2_hevc_pred_weight_table_obj, "luma_offset_l1", luma_offset_l1_obj);
623 
624 	/* __s8	delta_chroma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2] */
625 	json_object *delta_chroma_weight_l1_obj = json_object_new_array();
626 	for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
627 		for (size_t j = 0; j < 2; j++) {
628 			json_object_array_add(delta_chroma_weight_l1_obj, json_object_new_int(p->delta_chroma_weight_l1[i][j]));
629 		}
630 	}
631 	json_object_object_add(v4l2_hevc_pred_weight_table_obj, "delta_chroma_weight_l1", delta_chroma_weight_l1_obj);
632 
633 	/* __s8	chroma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2] */
634 	json_object *chroma_offset_l1_obj = json_object_new_array();
635 	for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
636 		for (size_t j = 0; j < 2; j++) {
637 			json_object_array_add(chroma_offset_l1_obj, json_object_new_int(p->chroma_offset_l1[i][j]));
638 		}
639 	}
640 	json_object_object_add(v4l2_hevc_pred_weight_table_obj, "chroma_offset_l1", chroma_offset_l1_obj);
641 
642 	json_object_object_add(v4l2_hevc_pred_weight_table_obj, "luma_log2_weight_denom", json_object_new_int(p->luma_log2_weight_denom));
643 	json_object_object_add(v4l2_hevc_pred_weight_table_obj, "delta_chroma_log2_weight_denom", json_object_new_int(p->delta_chroma_log2_weight_denom));
644 	json_object_object_add(parent_obj, "v4l2_hevc_pred_weight_table", v4l2_hevc_pred_weight_table_obj);
645 }
646 
trace_v4l2_ctrl_hevc_slice_params_gen(void * ptr,json_object * parent_obj)647 void trace_v4l2_ctrl_hevc_slice_params_gen(void *ptr, json_object *parent_obj)
648 {
649 	json_object *v4l2_ctrl_hevc_slice_params_obj = json_object_new_object();
650 	struct v4l2_ctrl_hevc_slice_params *p = static_cast<struct v4l2_ctrl_hevc_slice_params*>(ptr);
651 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "bit_size", json_object_new_int64(p->bit_size));
652 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "data_byte_offset", json_object_new_int64(p->data_byte_offset));
653 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "num_entry_point_offsets", json_object_new_int64(p->num_entry_point_offsets));
654 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "nal_unit_type", json_object_new_int(p->nal_unit_type));
655 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "nuh_temporal_id_plus1", json_object_new_int(p->nuh_temporal_id_plus1));
656 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "slice_type", json_object_new_int(p->slice_type));
657 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "colour_plane_id", json_object_new_int(p->colour_plane_id));
658 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "slice_pic_order_cnt", json_object_new_int(p->slice_pic_order_cnt));
659 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "num_ref_idx_l0_active_minus1", json_object_new_int(p->num_ref_idx_l0_active_minus1));
660 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "num_ref_idx_l1_active_minus1", json_object_new_int(p->num_ref_idx_l1_active_minus1));
661 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "collocated_ref_idx", json_object_new_int(p->collocated_ref_idx));
662 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "five_minus_max_num_merge_cand", json_object_new_int(p->five_minus_max_num_merge_cand));
663 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "slice_qp_delta", json_object_new_int(p->slice_qp_delta));
664 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "slice_cb_qp_offset", json_object_new_int(p->slice_cb_qp_offset));
665 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "slice_cr_qp_offset", json_object_new_int(p->slice_cr_qp_offset));
666 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "slice_act_y_qp_offset", json_object_new_int(p->slice_act_y_qp_offset));
667 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "slice_act_cb_qp_offset", json_object_new_int(p->slice_act_cb_qp_offset));
668 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "slice_act_cr_qp_offset", json_object_new_int(p->slice_act_cr_qp_offset));
669 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "slice_beta_offset_div2", json_object_new_int(p->slice_beta_offset_div2));
670 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "slice_tc_offset_div2", json_object_new_int(p->slice_tc_offset_div2));
671 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "pic_struct", json_object_new_int(p->pic_struct));
672 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "slice_segment_addr", json_object_new_int64(p->slice_segment_addr));
673 	/* __u8	ref_idx_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
674 	json_object *ref_idx_l0_obj = json_object_new_array();
675 	for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
676 		json_object_array_add(ref_idx_l0_obj, json_object_new_int(p->ref_idx_l0[i]));
677 	}
678 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "ref_idx_l0", ref_idx_l0_obj);
679 
680 	/* __u8	ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
681 	json_object *ref_idx_l1_obj = json_object_new_array();
682 	for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
683 		json_object_array_add(ref_idx_l1_obj, json_object_new_int(p->ref_idx_l1[i]));
684 	}
685 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "ref_idx_l1", ref_idx_l1_obj);
686 
687 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "short_term_ref_pic_set_size", json_object_new_int(p->short_term_ref_pic_set_size));
688 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "long_term_ref_pic_set_size", json_object_new_int(p->long_term_ref_pic_set_size));
689 	/* struct v4l2_hevc_pred_weight_table pred_weight_table */
690 	trace_v4l2_hevc_pred_weight_table_gen(&p->pred_weight_table, v4l2_ctrl_hevc_slice_params_obj);
691 	json_object_object_add(v4l2_ctrl_hevc_slice_params_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_hevc_slice_params_flag_def).c_str()));
692 	json_object_object_add(parent_obj, "v4l2_ctrl_hevc_slice_params", v4l2_ctrl_hevc_slice_params_obj);
693 }
694 
trace_v4l2_ctrl_hevc_decode_params_gen(void * ptr,json_object * parent_obj)695 void trace_v4l2_ctrl_hevc_decode_params_gen(void *ptr, json_object *parent_obj)
696 {
697 	json_object *v4l2_ctrl_hevc_decode_params_obj = json_object_new_object();
698 	struct v4l2_ctrl_hevc_decode_params *p = static_cast<struct v4l2_ctrl_hevc_decode_params*>(ptr);
699 	json_object_object_add(v4l2_ctrl_hevc_decode_params_obj, "pic_order_cnt_val", json_object_new_int(p->pic_order_cnt_val));
700 	json_object_object_add(v4l2_ctrl_hevc_decode_params_obj, "short_term_ref_pic_set_size", json_object_new_int(p->short_term_ref_pic_set_size));
701 	json_object_object_add(v4l2_ctrl_hevc_decode_params_obj, "long_term_ref_pic_set_size", json_object_new_int(p->long_term_ref_pic_set_size));
702 	json_object_object_add(v4l2_ctrl_hevc_decode_params_obj, "num_active_dpb_entries", json_object_new_int(p->num_active_dpb_entries));
703 	json_object_object_add(v4l2_ctrl_hevc_decode_params_obj, "num_poc_st_curr_before", json_object_new_int(p->num_poc_st_curr_before));
704 	json_object_object_add(v4l2_ctrl_hevc_decode_params_obj, "num_poc_st_curr_after", json_object_new_int(p->num_poc_st_curr_after));
705 	json_object_object_add(v4l2_ctrl_hevc_decode_params_obj, "num_poc_lt_curr", json_object_new_int(p->num_poc_lt_curr));
706 	/* __u8	poc_st_curr_before[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
707 	json_object *poc_st_curr_before_obj = json_object_new_array();
708 	for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
709 		json_object_array_add(poc_st_curr_before_obj, json_object_new_int(p->poc_st_curr_before[i]));
710 	}
711 	json_object_object_add(v4l2_ctrl_hevc_decode_params_obj, "poc_st_curr_before", poc_st_curr_before_obj);
712 
713 	/* __u8	poc_st_curr_after[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
714 	json_object *poc_st_curr_after_obj = json_object_new_array();
715 	for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
716 		json_object_array_add(poc_st_curr_after_obj, json_object_new_int(p->poc_st_curr_after[i]));
717 	}
718 	json_object_object_add(v4l2_ctrl_hevc_decode_params_obj, "poc_st_curr_after", poc_st_curr_after_obj);
719 
720 	/* __u8	poc_lt_curr[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
721 	json_object *poc_lt_curr_obj = json_object_new_array();
722 	for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
723 		json_object_array_add(poc_lt_curr_obj, json_object_new_int(p->poc_lt_curr[i]));
724 	}
725 	json_object_object_add(v4l2_ctrl_hevc_decode_params_obj, "poc_lt_curr", poc_lt_curr_obj);
726 
727 	json_object_object_add(v4l2_ctrl_hevc_decode_params_obj, "num_delta_pocs_of_ref_rps_idx", json_object_new_int(p->num_delta_pocs_of_ref_rps_idx));
728 	/* struct	v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
729 	json_object *dpb_obj = json_object_new_array();
730 	for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
731 		json_object *element_obj = json_object_new_object();
732 		trace_v4l2_hevc_dpb_entry_gen(&(p->dpb[i]), element_obj);
733 		json_object *element_no_key_obj;
734 		json_object_object_get_ex(element_obj, "v4l2_hevc_dpb_entry", &element_no_key_obj);
735 		json_object_array_add(dpb_obj, element_no_key_obj);
736 	}
737 	json_object_object_add(v4l2_ctrl_hevc_decode_params_obj, "dpb", dpb_obj);
738 
739 	json_object_object_add(v4l2_ctrl_hevc_decode_params_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_hevc_decode_param_flag_def).c_str()));
740 	json_object_object_add(parent_obj, "v4l2_ctrl_hevc_decode_params", v4l2_ctrl_hevc_decode_params_obj);
741 }
742 
trace_v4l2_ctrl_hevc_scaling_matrix_gen(void * ptr,json_object * parent_obj)743 void trace_v4l2_ctrl_hevc_scaling_matrix_gen(void *ptr, json_object *parent_obj)
744 {
745 	json_object *v4l2_ctrl_hevc_scaling_matrix_obj = json_object_new_object();
746 	struct v4l2_ctrl_hevc_scaling_matrix *p = static_cast<struct v4l2_ctrl_hevc_scaling_matrix*>(ptr);
747 	/* __u8	scaling_list_4x4[6][16] */
748 	json_object *scaling_list_4x4_obj = json_object_new_array();
749 	for (size_t i = 0; i < 6; i++) {
750 		for (size_t j = 0; j < 16; j++) {
751 			json_object_array_add(scaling_list_4x4_obj, json_object_new_int(p->scaling_list_4x4[i][j]));
752 		}
753 	}
754 	json_object_object_add(v4l2_ctrl_hevc_scaling_matrix_obj, "scaling_list_4x4", scaling_list_4x4_obj);
755 
756 	/* __u8	scaling_list_8x8[6][64] */
757 	json_object *scaling_list_8x8_obj = json_object_new_array();
758 	for (size_t i = 0; i < 6; i++) {
759 		for (size_t j = 0; j < 64; j++) {
760 			json_object_array_add(scaling_list_8x8_obj, json_object_new_int(p->scaling_list_8x8[i][j]));
761 		}
762 	}
763 	json_object_object_add(v4l2_ctrl_hevc_scaling_matrix_obj, "scaling_list_8x8", scaling_list_8x8_obj);
764 
765 	/* __u8	scaling_list_16x16[6][64] */
766 	json_object *scaling_list_16x16_obj = json_object_new_array();
767 	for (size_t i = 0; i < 6; i++) {
768 		for (size_t j = 0; j < 64; j++) {
769 			json_object_array_add(scaling_list_16x16_obj, json_object_new_int(p->scaling_list_16x16[i][j]));
770 		}
771 	}
772 	json_object_object_add(v4l2_ctrl_hevc_scaling_matrix_obj, "scaling_list_16x16", scaling_list_16x16_obj);
773 
774 	/* __u8	scaling_list_32x32[2][64] */
775 	json_object *scaling_list_32x32_obj = json_object_new_array();
776 	for (size_t i = 0; i < 2; i++) {
777 		for (size_t j = 0; j < 64; j++) {
778 			json_object_array_add(scaling_list_32x32_obj, json_object_new_int(p->scaling_list_32x32[i][j]));
779 		}
780 	}
781 	json_object_object_add(v4l2_ctrl_hevc_scaling_matrix_obj, "scaling_list_32x32", scaling_list_32x32_obj);
782 
783 	/* __u8	scaling_list_dc_coef_16x16[6] */
784 	json_object *scaling_list_dc_coef_16x16_obj = json_object_new_array();
785 	for (size_t i = 0; i < 6; i++) {
786 		json_object_array_add(scaling_list_dc_coef_16x16_obj, json_object_new_int(p->scaling_list_dc_coef_16x16[i]));
787 	}
788 	json_object_object_add(v4l2_ctrl_hevc_scaling_matrix_obj, "scaling_list_dc_coef_16x16", scaling_list_dc_coef_16x16_obj);
789 
790 	/* __u8	scaling_list_dc_coef_32x32[2] */
791 	json_object *scaling_list_dc_coef_32x32_obj = json_object_new_array();
792 	for (size_t i = 0; i < 2; i++) {
793 		json_object_array_add(scaling_list_dc_coef_32x32_obj, json_object_new_int(p->scaling_list_dc_coef_32x32[i]));
794 	}
795 	json_object_object_add(v4l2_ctrl_hevc_scaling_matrix_obj, "scaling_list_dc_coef_32x32", scaling_list_dc_coef_32x32_obj);
796 
797 	json_object_object_add(parent_obj, "v4l2_ctrl_hevc_scaling_matrix", v4l2_ctrl_hevc_scaling_matrix_obj);
798 }
799 
trace_v4l2_ctrl_hdr10_cll_info_gen(void * ptr,json_object * parent_obj)800 void trace_v4l2_ctrl_hdr10_cll_info_gen(void *ptr, json_object *parent_obj)
801 {
802 	json_object *v4l2_ctrl_hdr10_cll_info_obj = json_object_new_object();
803 	struct v4l2_ctrl_hdr10_cll_info *p = static_cast<struct v4l2_ctrl_hdr10_cll_info*>(ptr);
804 	json_object_object_add(v4l2_ctrl_hdr10_cll_info_obj, "max_content_light_level", json_object_new_int(p->max_content_light_level));
805 	json_object_object_add(v4l2_ctrl_hdr10_cll_info_obj, "max_pic_average_light_level", json_object_new_int(p->max_pic_average_light_level));
806 	json_object_object_add(parent_obj, "v4l2_ctrl_hdr10_cll_info", v4l2_ctrl_hdr10_cll_info_obj);
807 }
808 
trace_v4l2_ctrl_hdr10_mastering_display_gen(void * ptr,json_object * parent_obj)809 void trace_v4l2_ctrl_hdr10_mastering_display_gen(void *ptr, json_object *parent_obj)
810 {
811 	json_object *v4l2_ctrl_hdr10_mastering_display_obj = json_object_new_object();
812 	struct v4l2_ctrl_hdr10_mastering_display *p = static_cast<struct v4l2_ctrl_hdr10_mastering_display*>(ptr);
813 	/* __u16 display_primaries_x[3] */
814 	json_object *display_primaries_x_obj = json_object_new_array();
815 	for (size_t i = 0; i < 3; i++) {
816 		json_object_array_add(display_primaries_x_obj, json_object_new_int(p->display_primaries_x[i]));
817 	}
818 	json_object_object_add(v4l2_ctrl_hdr10_mastering_display_obj, "display_primaries_x", display_primaries_x_obj);
819 
820 	/* __u16 display_primaries_y[3] */
821 	json_object *display_primaries_y_obj = json_object_new_array();
822 	for (size_t i = 0; i < 3; i++) {
823 		json_object_array_add(display_primaries_y_obj, json_object_new_int(p->display_primaries_y[i]));
824 	}
825 	json_object_object_add(v4l2_ctrl_hdr10_mastering_display_obj, "display_primaries_y", display_primaries_y_obj);
826 
827 	json_object_object_add(v4l2_ctrl_hdr10_mastering_display_obj, "white_point_x", json_object_new_int(p->white_point_x));
828 	json_object_object_add(v4l2_ctrl_hdr10_mastering_display_obj, "white_point_y", json_object_new_int(p->white_point_y));
829 	json_object_object_add(v4l2_ctrl_hdr10_mastering_display_obj, "max_display_mastering_luminance", json_object_new_int64(p->max_display_mastering_luminance));
830 	json_object_object_add(v4l2_ctrl_hdr10_mastering_display_obj, "min_display_mastering_luminance", json_object_new_int64(p->min_display_mastering_luminance));
831 	json_object_object_add(parent_obj, "v4l2_ctrl_hdr10_mastering_display", v4l2_ctrl_hdr10_mastering_display_obj);
832 }
833 
trace_v4l2_vp9_loop_filter_gen(void * ptr,json_object * parent_obj)834 void trace_v4l2_vp9_loop_filter_gen(void *ptr, json_object *parent_obj)
835 {
836 	json_object *v4l2_vp9_loop_filter_obj = json_object_new_object();
837 	struct v4l2_vp9_loop_filter *p = static_cast<struct v4l2_vp9_loop_filter*>(ptr);
838 	/* __s8 ref_deltas[4] */
839 	json_object *ref_deltas_obj = json_object_new_array();
840 	for (size_t i = 0; i < 4; i++) {
841 		json_object_array_add(ref_deltas_obj, json_object_new_int(p->ref_deltas[i]));
842 	}
843 	json_object_object_add(v4l2_vp9_loop_filter_obj, "ref_deltas", ref_deltas_obj);
844 
845 	/* __s8 mode_deltas[2] */
846 	json_object *mode_deltas_obj = json_object_new_array();
847 	for (size_t i = 0; i < 2; i++) {
848 		json_object_array_add(mode_deltas_obj, json_object_new_int(p->mode_deltas[i]));
849 	}
850 	json_object_object_add(v4l2_vp9_loop_filter_obj, "mode_deltas", mode_deltas_obj);
851 
852 	json_object_object_add(v4l2_vp9_loop_filter_obj, "level", json_object_new_int(p->level));
853 	json_object_object_add(v4l2_vp9_loop_filter_obj, "sharpness", json_object_new_int(p->sharpness));
854 	json_object_object_add(v4l2_vp9_loop_filter_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_vp9_loop_filter_flag_def).c_str()));
855 	json_object_object_add(parent_obj, "v4l2_vp9_loop_filter", v4l2_vp9_loop_filter_obj);
856 }
857 
trace_v4l2_vp9_quantization_gen(void * ptr,json_object * parent_obj)858 void trace_v4l2_vp9_quantization_gen(void *ptr, json_object *parent_obj)
859 {
860 	json_object *v4l2_vp9_quantization_obj = json_object_new_object();
861 	struct v4l2_vp9_quantization *p = static_cast<struct v4l2_vp9_quantization*>(ptr);
862 	json_object_object_add(v4l2_vp9_quantization_obj, "base_q_idx", json_object_new_int(p->base_q_idx));
863 	json_object_object_add(v4l2_vp9_quantization_obj, "delta_q_y_dc", json_object_new_int(p->delta_q_y_dc));
864 	json_object_object_add(v4l2_vp9_quantization_obj, "delta_q_uv_dc", json_object_new_int(p->delta_q_uv_dc));
865 	json_object_object_add(v4l2_vp9_quantization_obj, "delta_q_uv_ac", json_object_new_int(p->delta_q_uv_ac));
866 	json_object_object_add(parent_obj, "v4l2_vp9_quantization", v4l2_vp9_quantization_obj);
867 }
868 
trace_v4l2_vp9_segmentation_gen(void * ptr,json_object * parent_obj)869 void trace_v4l2_vp9_segmentation_gen(void *ptr, json_object *parent_obj)
870 {
871 	json_object *v4l2_vp9_segmentation_obj = json_object_new_object();
872 	struct v4l2_vp9_segmentation *p = static_cast<struct v4l2_vp9_segmentation*>(ptr);
873 	/* __s16 feature_data[8][4] */
874 	json_object *feature_data_obj = json_object_new_array();
875 	for (size_t i = 0; i < 8; i++) {
876 		for (size_t j = 0; j < 4; j++) {
877 			json_object_array_add(feature_data_obj, json_object_new_int(p->feature_data[i][j]));
878 		}
879 	}
880 	json_object_object_add(v4l2_vp9_segmentation_obj, "feature_data", feature_data_obj);
881 
882 	/* __u8 feature_enabled[8] */
883 	json_object *feature_enabled_obj = json_object_new_array();
884 	for (size_t i = 0; i < 8; i++) {
885 		json_object_array_add(feature_enabled_obj, json_object_new_int(p->feature_enabled[i]));
886 	}
887 	json_object_object_add(v4l2_vp9_segmentation_obj, "feature_enabled", feature_enabled_obj);
888 
889 	/* __u8 tree_probs[7] */
890 	json_object *tree_probs_obj = json_object_new_array();
891 	for (size_t i = 0; i < 7; i++) {
892 		json_object_array_add(tree_probs_obj, json_object_new_int(p->tree_probs[i]));
893 	}
894 	json_object_object_add(v4l2_vp9_segmentation_obj, "tree_probs", tree_probs_obj);
895 
896 	/* __u8 pred_probs[3] */
897 	json_object *pred_probs_obj = json_object_new_array();
898 	for (size_t i = 0; i < 3; i++) {
899 		json_object_array_add(pred_probs_obj, json_object_new_int(p->pred_probs[i]));
900 	}
901 	json_object_object_add(v4l2_vp9_segmentation_obj, "pred_probs", pred_probs_obj);
902 
903 	json_object_object_add(v4l2_vp9_segmentation_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_vp9_segmentation_flag_def).c_str()));
904 	json_object_object_add(parent_obj, "v4l2_vp9_segmentation", v4l2_vp9_segmentation_obj);
905 }
906 
trace_v4l2_ctrl_vp9_frame_gen(void * ptr,json_object * parent_obj)907 void trace_v4l2_ctrl_vp9_frame_gen(void *ptr, json_object *parent_obj)
908 {
909 	json_object *v4l2_ctrl_vp9_frame_obj = json_object_new_object();
910 	struct v4l2_ctrl_vp9_frame *p = static_cast<struct v4l2_ctrl_vp9_frame*>(ptr);
911 	/* struct v4l2_vp9_loop_filter lf */
912 	trace_v4l2_vp9_loop_filter_gen(&p->lf, v4l2_ctrl_vp9_frame_obj);
913 	/* struct v4l2_vp9_quantization quant */
914 	trace_v4l2_vp9_quantization_gen(&p->quant, v4l2_ctrl_vp9_frame_obj);
915 	/* struct v4l2_vp9_segmentation seg */
916 	trace_v4l2_vp9_segmentation_gen(&p->seg, v4l2_ctrl_vp9_frame_obj);
917 	json_object_object_add(v4l2_ctrl_vp9_frame_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_vp9_frame_flag_def).c_str()));
918 	json_object_object_add(v4l2_ctrl_vp9_frame_obj, "compressed_header_size", json_object_new_int(p->compressed_header_size));
919 	json_object_object_add(v4l2_ctrl_vp9_frame_obj, "uncompressed_header_size", json_object_new_int(p->uncompressed_header_size));
920 	json_object_object_add(v4l2_ctrl_vp9_frame_obj, "frame_width_minus_1", json_object_new_int(p->frame_width_minus_1));
921 	json_object_object_add(v4l2_ctrl_vp9_frame_obj, "frame_height_minus_1", json_object_new_int(p->frame_height_minus_1));
922 	json_object_object_add(v4l2_ctrl_vp9_frame_obj, "render_width_minus_1", json_object_new_int(p->render_width_minus_1));
923 	json_object_object_add(v4l2_ctrl_vp9_frame_obj, "render_height_minus_1", json_object_new_int(p->render_height_minus_1));
924 	json_object_object_add(v4l2_ctrl_vp9_frame_obj, "last_frame_ts", json_object_new_uint64(p->last_frame_ts));
925 	json_object_object_add(v4l2_ctrl_vp9_frame_obj, "golden_frame_ts", json_object_new_uint64(p->golden_frame_ts));
926 	json_object_object_add(v4l2_ctrl_vp9_frame_obj, "alt_frame_ts", json_object_new_uint64(p->alt_frame_ts));
927 	json_object_object_add(v4l2_ctrl_vp9_frame_obj, "ref_frame_sign_bias", json_object_new_int(p->ref_frame_sign_bias));
928 	json_object_object_add(v4l2_ctrl_vp9_frame_obj, "reset_frame_context", json_object_new_int(p->reset_frame_context));
929 	json_object_object_add(v4l2_ctrl_vp9_frame_obj, "frame_context_idx", json_object_new_int(p->frame_context_idx));
930 	json_object_object_add(v4l2_ctrl_vp9_frame_obj, "profile", json_object_new_int(p->profile));
931 	json_object_object_add(v4l2_ctrl_vp9_frame_obj, "bit_depth", json_object_new_int(p->bit_depth));
932 	json_object_object_add(v4l2_ctrl_vp9_frame_obj, "interpolation_filter", json_object_new_int(p->interpolation_filter));
933 	json_object_object_add(v4l2_ctrl_vp9_frame_obj, "tile_cols_log2", json_object_new_int(p->tile_cols_log2));
934 	json_object_object_add(v4l2_ctrl_vp9_frame_obj, "tile_rows_log2", json_object_new_int(p->tile_rows_log2));
935 	json_object_object_add(v4l2_ctrl_vp9_frame_obj, "reference_mode", json_object_new_int(p->reference_mode));
936 	json_object_object_add(parent_obj, "v4l2_ctrl_vp9_frame", v4l2_ctrl_vp9_frame_obj);
937 }
938 
trace_v4l2_vp9_mv_probs_gen(void * ptr,json_object * parent_obj)939 void trace_v4l2_vp9_mv_probs_gen(void *ptr, json_object *parent_obj)
940 {
941 	json_object *v4l2_vp9_mv_probs_obj = json_object_new_object();
942 	struct v4l2_vp9_mv_probs *p = static_cast<struct v4l2_vp9_mv_probs*>(ptr);
943 	/* __u8 joint[3] */
944 	json_object *joint_obj = json_object_new_array();
945 	for (size_t i = 0; i < 3; i++) {
946 		json_object_array_add(joint_obj, json_object_new_int(p->joint[i]));
947 	}
948 	json_object_object_add(v4l2_vp9_mv_probs_obj, "joint", joint_obj);
949 
950 	/* __u8 sign[2] */
951 	json_object *sign_obj = json_object_new_array();
952 	for (size_t i = 0; i < 2; i++) {
953 		json_object_array_add(sign_obj, json_object_new_int(p->sign[i]));
954 	}
955 	json_object_object_add(v4l2_vp9_mv_probs_obj, "sign", sign_obj);
956 
957 	/* __u8 classes[2][10] */
958 	json_object *classes_obj = json_object_new_array();
959 	for (size_t i = 0; i < 2; i++) {
960 		for (size_t j = 0; j < 10; j++) {
961 			json_object_array_add(classes_obj, json_object_new_int(p->classes[i][j]));
962 		}
963 	}
964 	json_object_object_add(v4l2_vp9_mv_probs_obj, "classes", classes_obj);
965 
966 	/* __u8 class0_bit[2] */
967 	json_object *class0_bit_obj = json_object_new_array();
968 	for (size_t i = 0; i < 2; i++) {
969 		json_object_array_add(class0_bit_obj, json_object_new_int(p->class0_bit[i]));
970 	}
971 	json_object_object_add(v4l2_vp9_mv_probs_obj, "class0_bit", class0_bit_obj);
972 
973 	/* __u8 bits[2][10] */
974 	json_object *bits_obj = json_object_new_array();
975 	for (size_t i = 0; i < 2; i++) {
976 		for (size_t j = 0; j < 10; j++) {
977 			json_object_array_add(bits_obj, json_object_new_int(p->bits[i][j]));
978 		}
979 	}
980 	json_object_object_add(v4l2_vp9_mv_probs_obj, "bits", bits_obj);
981 
982 	/* __u8 class0_fr[2][2][3] */
983 	json_object *class0_fr_obj = json_object_new_array();
984 	for (size_t i = 0; i < 2; i++) {
985 		for (size_t j = 0; j < 2; j++) {
986 			for (size_t k = 0; k < 3; k++) {
987 				json_object_array_add(class0_fr_obj, json_object_new_int(p->class0_fr[i][j][k]));
988 			}
989 		}
990 	}
991 	json_object_object_add(v4l2_vp9_mv_probs_obj, "class0_fr", class0_fr_obj);
992 
993 	/* __u8 fr[2][3] */
994 	json_object *fr_obj = json_object_new_array();
995 	for (size_t i = 0; i < 2; i++) {
996 		for (size_t j = 0; j < 3; j++) {
997 			json_object_array_add(fr_obj, json_object_new_int(p->fr[i][j]));
998 		}
999 	}
1000 	json_object_object_add(v4l2_vp9_mv_probs_obj, "fr", fr_obj);
1001 
1002 	/* __u8 class0_hp[2] */
1003 	json_object *class0_hp_obj = json_object_new_array();
1004 	for (size_t i = 0; i < 2; i++) {
1005 		json_object_array_add(class0_hp_obj, json_object_new_int(p->class0_hp[i]));
1006 	}
1007 	json_object_object_add(v4l2_vp9_mv_probs_obj, "class0_hp", class0_hp_obj);
1008 
1009 	/* __u8 hp[2] */
1010 	json_object *hp_obj = json_object_new_array();
1011 	for (size_t i = 0; i < 2; i++) {
1012 		json_object_array_add(hp_obj, json_object_new_int(p->hp[i]));
1013 	}
1014 	json_object_object_add(v4l2_vp9_mv_probs_obj, "hp", hp_obj);
1015 
1016 	json_object_object_add(parent_obj, "v4l2_vp9_mv_probs", v4l2_vp9_mv_probs_obj);
1017 }
1018 
trace_v4l2_ctrl_vp9_compressed_hdr_gen(void * ptr,json_object * parent_obj)1019 void trace_v4l2_ctrl_vp9_compressed_hdr_gen(void *ptr, json_object *parent_obj)
1020 {
1021 	json_object *v4l2_ctrl_vp9_compressed_hdr_obj = json_object_new_object();
1022 	struct v4l2_ctrl_vp9_compressed_hdr *p = static_cast<struct v4l2_ctrl_vp9_compressed_hdr*>(ptr);
1023 	json_object_object_add(v4l2_ctrl_vp9_compressed_hdr_obj, "tx_mode", json_object_new_int(p->tx_mode));
1024 	/* __u8 tx8[2][1] */
1025 	json_object *tx8_obj = json_object_new_array();
1026 	for (size_t i = 0; i < 2; i++) {
1027 		for (size_t j = 0; j < 1; j++) {
1028 			json_object_array_add(tx8_obj, json_object_new_int(p->tx8[i][j]));
1029 		}
1030 	}
1031 	json_object_object_add(v4l2_ctrl_vp9_compressed_hdr_obj, "tx8", tx8_obj);
1032 
1033 	/* __u8 tx16[2][2] */
1034 	json_object *tx16_obj = json_object_new_array();
1035 	for (size_t i = 0; i < 2; i++) {
1036 		for (size_t j = 0; j < 2; j++) {
1037 			json_object_array_add(tx16_obj, json_object_new_int(p->tx16[i][j]));
1038 		}
1039 	}
1040 	json_object_object_add(v4l2_ctrl_vp9_compressed_hdr_obj, "tx16", tx16_obj);
1041 
1042 	/* __u8 tx32[2][3] */
1043 	json_object *tx32_obj = json_object_new_array();
1044 	for (size_t i = 0; i < 2; i++) {
1045 		for (size_t j = 0; j < 3; j++) {
1046 			json_object_array_add(tx32_obj, json_object_new_int(p->tx32[i][j]));
1047 		}
1048 	}
1049 	json_object_object_add(v4l2_ctrl_vp9_compressed_hdr_obj, "tx32", tx32_obj);
1050 
1051 	/* __u8 coef[4][2][2][6][6][3] */
1052 	json_object *coef_obj = json_object_new_array();
1053 	for (size_t i = 0; i < 4; i++) {
1054 		for (size_t j = 0; j < 2; j++) {
1055 			for (size_t k = 0; k < 2; k++) {
1056 				for (size_t l = 0; l < 6; l++) {
1057 					for (size_t m = 0; m < 6; m++) {
1058 						for (size_t n = 0; n < 3; n++) {
1059 							json_object_array_add(coef_obj, json_object_new_int(p->coef[i][j][k][l][m][n]));
1060 						}
1061 					}
1062 				}
1063 			}
1064 		}
1065 	}
1066 	json_object_object_add(v4l2_ctrl_vp9_compressed_hdr_obj, "coef", coef_obj);
1067 
1068 	/* __u8 skip[3] */
1069 	json_object *skip_obj = json_object_new_array();
1070 	for (size_t i = 0; i < 3; i++) {
1071 		json_object_array_add(skip_obj, json_object_new_int(p->skip[i]));
1072 	}
1073 	json_object_object_add(v4l2_ctrl_vp9_compressed_hdr_obj, "skip", skip_obj);
1074 
1075 	/* __u8 inter_mode[7][3] */
1076 	json_object *inter_mode_obj = json_object_new_array();
1077 	for (size_t i = 0; i < 7; i++) {
1078 		for (size_t j = 0; j < 3; j++) {
1079 			json_object_array_add(inter_mode_obj, json_object_new_int(p->inter_mode[i][j]));
1080 		}
1081 	}
1082 	json_object_object_add(v4l2_ctrl_vp9_compressed_hdr_obj, "inter_mode", inter_mode_obj);
1083 
1084 	/* __u8 interp_filter[4][2] */
1085 	json_object *interp_filter_obj = json_object_new_array();
1086 	for (size_t i = 0; i < 4; i++) {
1087 		for (size_t j = 0; j < 2; j++) {
1088 			json_object_array_add(interp_filter_obj, json_object_new_int(p->interp_filter[i][j]));
1089 		}
1090 	}
1091 	json_object_object_add(v4l2_ctrl_vp9_compressed_hdr_obj, "interp_filter", interp_filter_obj);
1092 
1093 	/* __u8 is_inter[4] */
1094 	json_object *is_inter_obj = json_object_new_array();
1095 	for (size_t i = 0; i < 4; i++) {
1096 		json_object_array_add(is_inter_obj, json_object_new_int(p->is_inter[i]));
1097 	}
1098 	json_object_object_add(v4l2_ctrl_vp9_compressed_hdr_obj, "is_inter", is_inter_obj);
1099 
1100 	/* __u8 comp_mode[5] */
1101 	json_object *comp_mode_obj = json_object_new_array();
1102 	for (size_t i = 0; i < 5; i++) {
1103 		json_object_array_add(comp_mode_obj, json_object_new_int(p->comp_mode[i]));
1104 	}
1105 	json_object_object_add(v4l2_ctrl_vp9_compressed_hdr_obj, "comp_mode", comp_mode_obj);
1106 
1107 	/* __u8 single_ref[5][2] */
1108 	json_object *single_ref_obj = json_object_new_array();
1109 	for (size_t i = 0; i < 5; i++) {
1110 		for (size_t j = 0; j < 2; j++) {
1111 			json_object_array_add(single_ref_obj, json_object_new_int(p->single_ref[i][j]));
1112 		}
1113 	}
1114 	json_object_object_add(v4l2_ctrl_vp9_compressed_hdr_obj, "single_ref", single_ref_obj);
1115 
1116 	/* __u8 comp_ref[5] */
1117 	json_object *comp_ref_obj = json_object_new_array();
1118 	for (size_t i = 0; i < 5; i++) {
1119 		json_object_array_add(comp_ref_obj, json_object_new_int(p->comp_ref[i]));
1120 	}
1121 	json_object_object_add(v4l2_ctrl_vp9_compressed_hdr_obj, "comp_ref", comp_ref_obj);
1122 
1123 	/* __u8 y_mode[4][9] */
1124 	json_object *y_mode_obj = json_object_new_array();
1125 	for (size_t i = 0; i < 4; i++) {
1126 		for (size_t j = 0; j < 9; j++) {
1127 			json_object_array_add(y_mode_obj, json_object_new_int(p->y_mode[i][j]));
1128 		}
1129 	}
1130 	json_object_object_add(v4l2_ctrl_vp9_compressed_hdr_obj, "y_mode", y_mode_obj);
1131 
1132 	/* __u8 uv_mode[10][9] */
1133 	json_object *uv_mode_obj = json_object_new_array();
1134 	for (size_t i = 0; i < 10; i++) {
1135 		for (size_t j = 0; j < 9; j++) {
1136 			json_object_array_add(uv_mode_obj, json_object_new_int(p->uv_mode[i][j]));
1137 		}
1138 	}
1139 	json_object_object_add(v4l2_ctrl_vp9_compressed_hdr_obj, "uv_mode", uv_mode_obj);
1140 
1141 	/* __u8 partition[16][3] */
1142 	json_object *partition_obj = json_object_new_array();
1143 	for (size_t i = 0; i < 16; i++) {
1144 		for (size_t j = 0; j < 3; j++) {
1145 			json_object_array_add(partition_obj, json_object_new_int(p->partition[i][j]));
1146 		}
1147 	}
1148 	json_object_object_add(v4l2_ctrl_vp9_compressed_hdr_obj, "partition", partition_obj);
1149 
1150 	/* struct v4l2_vp9_mv_probs mv */
1151 	trace_v4l2_vp9_mv_probs_gen(&p->mv, v4l2_ctrl_vp9_compressed_hdr_obj);
1152 	json_object_object_add(parent_obj, "v4l2_ctrl_vp9_compressed_hdr", v4l2_ctrl_vp9_compressed_hdr_obj);
1153 }
1154 
trace_v4l2_ctrl_av1_sequence_gen(void * ptr,json_object * parent_obj)1155 void trace_v4l2_ctrl_av1_sequence_gen(void *ptr, json_object *parent_obj)
1156 {
1157 	json_object *v4l2_ctrl_av1_sequence_obj = json_object_new_object();
1158 	struct v4l2_ctrl_av1_sequence *p = static_cast<struct v4l2_ctrl_av1_sequence*>(ptr);
1159 	json_object_object_add(v4l2_ctrl_av1_sequence_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_av1_sequence_flag_def).c_str()));
1160 	json_object_object_add(v4l2_ctrl_av1_sequence_obj, "seq_profile", json_object_new_int(p->seq_profile));
1161 	json_object_object_add(v4l2_ctrl_av1_sequence_obj, "order_hint_bits", json_object_new_int(p->order_hint_bits));
1162 	json_object_object_add(v4l2_ctrl_av1_sequence_obj, "bit_depth", json_object_new_int(p->bit_depth));
1163 	json_object_object_add(v4l2_ctrl_av1_sequence_obj, "max_frame_width_minus_1", json_object_new_int(p->max_frame_width_minus_1));
1164 	json_object_object_add(v4l2_ctrl_av1_sequence_obj, "max_frame_height_minus_1", json_object_new_int(p->max_frame_height_minus_1));
1165 	json_object_object_add(parent_obj, "v4l2_ctrl_av1_sequence", v4l2_ctrl_av1_sequence_obj);
1166 }
1167 
trace_v4l2_ctrl_av1_tile_group_entry_gen(void * ptr,json_object * parent_obj)1168 void trace_v4l2_ctrl_av1_tile_group_entry_gen(void *ptr, json_object *parent_obj)
1169 {
1170 	json_object *v4l2_ctrl_av1_tile_group_entry_obj = json_object_new_object();
1171 	struct v4l2_ctrl_av1_tile_group_entry *p = static_cast<struct v4l2_ctrl_av1_tile_group_entry*>(ptr);
1172 	json_object_object_add(v4l2_ctrl_av1_tile_group_entry_obj, "tile_offset", json_object_new_int64(p->tile_offset));
1173 	json_object_object_add(v4l2_ctrl_av1_tile_group_entry_obj, "tile_size", json_object_new_int64(p->tile_size));
1174 	json_object_object_add(v4l2_ctrl_av1_tile_group_entry_obj, "tile_row", json_object_new_int64(p->tile_row));
1175 	json_object_object_add(v4l2_ctrl_av1_tile_group_entry_obj, "tile_col", json_object_new_int64(p->tile_col));
1176 	json_object_object_add(parent_obj, "v4l2_ctrl_av1_tile_group_entry", v4l2_ctrl_av1_tile_group_entry_obj);
1177 }
1178 
trace_v4l2_av1_global_motion_gen(void * ptr,json_object * parent_obj)1179 void trace_v4l2_av1_global_motion_gen(void *ptr, json_object *parent_obj)
1180 {
1181 	json_object *v4l2_av1_global_motion_obj = json_object_new_object();
1182 	struct v4l2_av1_global_motion *p = static_cast<struct v4l2_av1_global_motion*>(ptr);
1183 	/* __u8 flags[V4L2_AV1_TOTAL_REFS_PER_FRAME] */
1184 	json_object *flags_obj = json_object_new_array();
1185 	for (size_t i = 0; i < V4L2_AV1_TOTAL_REFS_PER_FRAME; i++) {
1186 		json_object_array_add(flags_obj, json_object_new_int(p->flags[i]));
1187 	}
1188 	json_object_object_add(v4l2_av1_global_motion_obj, "flags", flags_obj);
1189 
1190 	/* enum v4l2_av1_warp_model type[V4L2_AV1_TOTAL_REFS_PER_FRAME] */
1191 	json_object *type_obj = json_object_new_array();
1192 	for (size_t i = 0; i < V4L2_AV1_TOTAL_REFS_PER_FRAME; i++) {
1193 		json_object_array_add(type_obj, json_object_new_int(p->type[i]));
1194 	}
1195 	json_object_object_add(v4l2_av1_global_motion_obj, "type", type_obj);
1196 
1197 	/* __s32 params[V4L2_AV1_TOTAL_REFS_PER_FRAME][6] */
1198 	json_object *params_obj = json_object_new_array();
1199 	for (size_t i = 0; i < V4L2_AV1_TOTAL_REFS_PER_FRAME; i++) {
1200 		for (size_t j = 0; j < 6; j++) {
1201 			json_object_array_add(params_obj, json_object_new_int(p->params[i][j]));
1202 		}
1203 	}
1204 	json_object_object_add(v4l2_av1_global_motion_obj, "params", params_obj);
1205 
1206 	json_object_object_add(v4l2_av1_global_motion_obj, "invalid", json_object_new_int(p->invalid));
1207 	json_object_object_add(parent_obj, "v4l2_av1_global_motion", v4l2_av1_global_motion_obj);
1208 }
1209 
trace_v4l2_av1_loop_restoration_gen(void * ptr,json_object * parent_obj)1210 void trace_v4l2_av1_loop_restoration_gen(void *ptr, json_object *parent_obj)
1211 {
1212 	json_object *v4l2_av1_loop_restoration_obj = json_object_new_object();
1213 	struct v4l2_av1_loop_restoration *p = static_cast<struct v4l2_av1_loop_restoration*>(ptr);
1214 	json_object_object_add(v4l2_av1_loop_restoration_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_av1_loop_restoration_flag_def).c_str()));
1215 	json_object_object_add(v4l2_av1_loop_restoration_obj, "lr_unit_shift", json_object_new_int(p->lr_unit_shift));
1216 	json_object_object_add(v4l2_av1_loop_restoration_obj, "lr_uv_shift", json_object_new_int(p->lr_uv_shift));
1217 	/* enum v4l2_av1_frame_restoration_type frame_restoration_type[V4L2_AV1_NUM_PLANES_MAX] */
1218 	json_object *frame_restoration_type_obj = json_object_new_array();
1219 	for (size_t i = 0; i < V4L2_AV1_NUM_PLANES_MAX; i++) {
1220 		json_object_array_add(frame_restoration_type_obj, json_object_new_int(p->frame_restoration_type[i]));
1221 	}
1222 	json_object_object_add(v4l2_av1_loop_restoration_obj, "frame_restoration_type", frame_restoration_type_obj);
1223 
1224 	/* __u32 loop_restoration_size[V4L2_AV1_MAX_NUM_PLANES] */
1225 	json_object *loop_restoration_size_obj = json_object_new_array();
1226 	for (size_t i = 0; i < V4L2_AV1_MAX_NUM_PLANES; i++) {
1227 		json_object_array_add(loop_restoration_size_obj, json_object_new_int64(p->loop_restoration_size[i]));
1228 	}
1229 	json_object_object_add(v4l2_av1_loop_restoration_obj, "loop_restoration_size", loop_restoration_size_obj);
1230 
1231 	json_object_object_add(parent_obj, "v4l2_av1_loop_restoration", v4l2_av1_loop_restoration_obj);
1232 }
1233 
trace_v4l2_av1_cdef_gen(void * ptr,json_object * parent_obj)1234 void trace_v4l2_av1_cdef_gen(void *ptr, json_object *parent_obj)
1235 {
1236 	json_object *v4l2_av1_cdef_obj = json_object_new_object();
1237 	struct v4l2_av1_cdef *p = static_cast<struct v4l2_av1_cdef*>(ptr);
1238 	json_object_object_add(v4l2_av1_cdef_obj, "damping_minus_3", json_object_new_int(p->damping_minus_3));
1239 	json_object_object_add(v4l2_av1_cdef_obj, "bits", json_object_new_int(p->bits));
1240 	/* __u8 y_pri_strength[V4L2_AV1_CDEF_MAX] */
1241 	json_object *y_pri_strength_obj = json_object_new_array();
1242 	for (size_t i = 0; i < V4L2_AV1_CDEF_MAX; i++) {
1243 		json_object_array_add(y_pri_strength_obj, json_object_new_int(p->y_pri_strength[i]));
1244 	}
1245 	json_object_object_add(v4l2_av1_cdef_obj, "y_pri_strength", y_pri_strength_obj);
1246 
1247 	/* __u8 y_sec_strength[V4L2_AV1_CDEF_MAX] */
1248 	json_object *y_sec_strength_obj = json_object_new_array();
1249 	for (size_t i = 0; i < V4L2_AV1_CDEF_MAX; i++) {
1250 		json_object_array_add(y_sec_strength_obj, json_object_new_int(p->y_sec_strength[i]));
1251 	}
1252 	json_object_object_add(v4l2_av1_cdef_obj, "y_sec_strength", y_sec_strength_obj);
1253 
1254 	/* __u8 uv_pri_strength[V4L2_AV1_CDEF_MAX] */
1255 	json_object *uv_pri_strength_obj = json_object_new_array();
1256 	for (size_t i = 0; i < V4L2_AV1_CDEF_MAX; i++) {
1257 		json_object_array_add(uv_pri_strength_obj, json_object_new_int(p->uv_pri_strength[i]));
1258 	}
1259 	json_object_object_add(v4l2_av1_cdef_obj, "uv_pri_strength", uv_pri_strength_obj);
1260 
1261 	/* __u8 uv_sec_strength[V4L2_AV1_CDEF_MAX] */
1262 	json_object *uv_sec_strength_obj = json_object_new_array();
1263 	for (size_t i = 0; i < V4L2_AV1_CDEF_MAX; i++) {
1264 		json_object_array_add(uv_sec_strength_obj, json_object_new_int(p->uv_sec_strength[i]));
1265 	}
1266 	json_object_object_add(v4l2_av1_cdef_obj, "uv_sec_strength", uv_sec_strength_obj);
1267 
1268 	json_object_object_add(parent_obj, "v4l2_av1_cdef", v4l2_av1_cdef_obj);
1269 }
1270 
trace_v4l2_av1_segmentation_gen(void * ptr,json_object * parent_obj)1271 void trace_v4l2_av1_segmentation_gen(void *ptr, json_object *parent_obj)
1272 {
1273 	json_object *v4l2_av1_segmentation_obj = json_object_new_object();
1274 	struct v4l2_av1_segmentation *p = static_cast<struct v4l2_av1_segmentation*>(ptr);
1275 	json_object_object_add(v4l2_av1_segmentation_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_av1_segmentation_flag_def).c_str()));
1276 	json_object_object_add(v4l2_av1_segmentation_obj, "last_active_seg_id", json_object_new_int(p->last_active_seg_id));
1277 	/* __u8 feature_enabled[V4L2_AV1_MAX_SEGMENTS] */
1278 	json_object *feature_enabled_obj = json_object_new_array();
1279 	for (size_t i = 0; i < V4L2_AV1_MAX_SEGMENTS; i++) {
1280 		json_object_array_add(feature_enabled_obj, json_object_new_int(p->feature_enabled[i]));
1281 	}
1282 	json_object_object_add(v4l2_av1_segmentation_obj, "feature_enabled", feature_enabled_obj);
1283 
1284 	/* __s16 feature_data[V4L2_AV1_MAX_SEGMENTS][V4L2_AV1_SEG_LVL_MAX] */
1285 	json_object *feature_data_obj = json_object_new_array();
1286 	for (size_t i = 0; i < V4L2_AV1_MAX_SEGMENTS; i++) {
1287 		for (size_t j = 0; j < V4L2_AV1_SEG_LVL_MAX; j++) {
1288 			json_object_array_add(feature_data_obj, json_object_new_int(p->feature_data[i][j]));
1289 		}
1290 	}
1291 	json_object_object_add(v4l2_av1_segmentation_obj, "feature_data", feature_data_obj);
1292 
1293 	json_object_object_add(parent_obj, "v4l2_av1_segmentation", v4l2_av1_segmentation_obj);
1294 }
1295 
trace_v4l2_av1_loop_filter_gen(void * ptr,json_object * parent_obj)1296 void trace_v4l2_av1_loop_filter_gen(void *ptr, json_object *parent_obj)
1297 {
1298 	json_object *v4l2_av1_loop_filter_obj = json_object_new_object();
1299 	struct v4l2_av1_loop_filter *p = static_cast<struct v4l2_av1_loop_filter*>(ptr);
1300 	json_object_object_add(v4l2_av1_loop_filter_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_av1_loop_filter_flag_def).c_str()));
1301 	/* __u8 level[4] */
1302 	json_object *level_obj = json_object_new_array();
1303 	for (size_t i = 0; i < 4; i++) {
1304 		json_object_array_add(level_obj, json_object_new_int(p->level[i]));
1305 	}
1306 	json_object_object_add(v4l2_av1_loop_filter_obj, "level", level_obj);
1307 
1308 	json_object_object_add(v4l2_av1_loop_filter_obj, "sharpness", json_object_new_int(p->sharpness));
1309 	/* __s8 ref_deltas[V4L2_AV1_TOTAL_REFS_PER_FRAME] */
1310 	json_object *ref_deltas_obj = json_object_new_array();
1311 	for (size_t i = 0; i < V4L2_AV1_TOTAL_REFS_PER_FRAME; i++) {
1312 		json_object_array_add(ref_deltas_obj, json_object_new_int(p->ref_deltas[i]));
1313 	}
1314 	json_object_object_add(v4l2_av1_loop_filter_obj, "ref_deltas", ref_deltas_obj);
1315 
1316 	/* __s8 mode_deltas[2] */
1317 	json_object *mode_deltas_obj = json_object_new_array();
1318 	for (size_t i = 0; i < 2; i++) {
1319 		json_object_array_add(mode_deltas_obj, json_object_new_int(p->mode_deltas[i]));
1320 	}
1321 	json_object_object_add(v4l2_av1_loop_filter_obj, "mode_deltas", mode_deltas_obj);
1322 
1323 	json_object_object_add(v4l2_av1_loop_filter_obj, "delta_lf_res", json_object_new_int(p->delta_lf_res));
1324 	json_object_object_add(parent_obj, "v4l2_av1_loop_filter", v4l2_av1_loop_filter_obj);
1325 }
1326 
trace_v4l2_av1_quantization_gen(void * ptr,json_object * parent_obj)1327 void trace_v4l2_av1_quantization_gen(void *ptr, json_object *parent_obj)
1328 {
1329 	json_object *v4l2_av1_quantization_obj = json_object_new_object();
1330 	struct v4l2_av1_quantization *p = static_cast<struct v4l2_av1_quantization*>(ptr);
1331 	json_object_object_add(v4l2_av1_quantization_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_av1_quantization_flag_def).c_str()));
1332 	json_object_object_add(v4l2_av1_quantization_obj, "base_q_idx", json_object_new_int(p->base_q_idx));
1333 	json_object_object_add(v4l2_av1_quantization_obj, "delta_q_y_dc", json_object_new_int(p->delta_q_y_dc));
1334 	json_object_object_add(v4l2_av1_quantization_obj, "delta_q_u_dc", json_object_new_int(p->delta_q_u_dc));
1335 	json_object_object_add(v4l2_av1_quantization_obj, "delta_q_u_ac", json_object_new_int(p->delta_q_u_ac));
1336 	json_object_object_add(v4l2_av1_quantization_obj, "delta_q_v_dc", json_object_new_int(p->delta_q_v_dc));
1337 	json_object_object_add(v4l2_av1_quantization_obj, "delta_q_v_ac", json_object_new_int(p->delta_q_v_ac));
1338 	json_object_object_add(v4l2_av1_quantization_obj, "qm_y", json_object_new_int(p->qm_y));
1339 	json_object_object_add(v4l2_av1_quantization_obj, "qm_u", json_object_new_int(p->qm_u));
1340 	json_object_object_add(v4l2_av1_quantization_obj, "qm_v", json_object_new_int(p->qm_v));
1341 	json_object_object_add(v4l2_av1_quantization_obj, "delta_q_res", json_object_new_int(p->delta_q_res));
1342 	json_object_object_add(parent_obj, "v4l2_av1_quantization", v4l2_av1_quantization_obj);
1343 }
1344 
trace_v4l2_av1_tile_info_gen(void * ptr,json_object * parent_obj)1345 void trace_v4l2_av1_tile_info_gen(void *ptr, json_object *parent_obj)
1346 {
1347 	json_object *v4l2_av1_tile_info_obj = json_object_new_object();
1348 	struct v4l2_av1_tile_info *p = static_cast<struct v4l2_av1_tile_info*>(ptr);
1349 	json_object_object_add(v4l2_av1_tile_info_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_av1_tile_info_flag_def).c_str()));
1350 	json_object_object_add(v4l2_av1_tile_info_obj, "context_update_tile_id", json_object_new_int(p->context_update_tile_id));
1351 	json_object_object_add(v4l2_av1_tile_info_obj, "tile_cols", json_object_new_int(p->tile_cols));
1352 	json_object_object_add(v4l2_av1_tile_info_obj, "tile_rows", json_object_new_int(p->tile_rows));
1353 	/* __u32 mi_col_starts[V4L2_AV1_MAX_TILE_COLS + 1] */
1354 	json_object *mi_col_starts_obj = json_object_new_array();
1355 	for (size_t i = 0; i < V4L2_AV1_MAX_TILE_COLS + 1; i++) {
1356 		json_object_array_add(mi_col_starts_obj, json_object_new_int64(p->mi_col_starts[i]));
1357 	}
1358 	json_object_object_add(v4l2_av1_tile_info_obj, "mi_col_starts", mi_col_starts_obj);
1359 
1360 	/* __u32 mi_row_starts[V4L2_AV1_MAX_TILE_ROWS + 1] */
1361 	json_object *mi_row_starts_obj = json_object_new_array();
1362 	for (size_t i = 0; i < V4L2_AV1_MAX_TILE_ROWS + 1; i++) {
1363 		json_object_array_add(mi_row_starts_obj, json_object_new_int64(p->mi_row_starts[i]));
1364 	}
1365 	json_object_object_add(v4l2_av1_tile_info_obj, "mi_row_starts", mi_row_starts_obj);
1366 
1367 	/* __u32 width_in_sbs_minus_1[V4L2_AV1_MAX_TILE_COLS] */
1368 	json_object *width_in_sbs_minus_1_obj = json_object_new_array();
1369 	for (size_t i = 0; i < V4L2_AV1_MAX_TILE_COLS; i++) {
1370 		json_object_array_add(width_in_sbs_minus_1_obj, json_object_new_int64(p->width_in_sbs_minus_1[i]));
1371 	}
1372 	json_object_object_add(v4l2_av1_tile_info_obj, "width_in_sbs_minus_1", width_in_sbs_minus_1_obj);
1373 
1374 	/* __u32 height_in_sbs_minus_1[V4L2_AV1_MAX_TILE_ROWS] */
1375 	json_object *height_in_sbs_minus_1_obj = json_object_new_array();
1376 	for (size_t i = 0; i < V4L2_AV1_MAX_TILE_ROWS; i++) {
1377 		json_object_array_add(height_in_sbs_minus_1_obj, json_object_new_int64(p->height_in_sbs_minus_1[i]));
1378 	}
1379 	json_object_object_add(v4l2_av1_tile_info_obj, "height_in_sbs_minus_1", height_in_sbs_minus_1_obj);
1380 
1381 	json_object_object_add(v4l2_av1_tile_info_obj, "tile_size_bytes", json_object_new_int(p->tile_size_bytes));
1382 	json_object_object_add(parent_obj, "v4l2_av1_tile_info", v4l2_av1_tile_info_obj);
1383 }
1384 
trace_v4l2_ctrl_av1_frame_gen(void * ptr,json_object * parent_obj)1385 void trace_v4l2_ctrl_av1_frame_gen(void *ptr, json_object *parent_obj)
1386 {
1387 	json_object *v4l2_ctrl_av1_frame_obj = json_object_new_object();
1388 	struct v4l2_ctrl_av1_frame *p = static_cast<struct v4l2_ctrl_av1_frame*>(ptr);
1389 	/* struct v4l2_av1_tile_info tile_info */
1390 	trace_v4l2_av1_tile_info_gen(&p->tile_info, v4l2_ctrl_av1_frame_obj);
1391 	/* struct v4l2_av1_quantization quantization */
1392 	trace_v4l2_av1_quantization_gen(&p->quantization, v4l2_ctrl_av1_frame_obj);
1393 	json_object_object_add(v4l2_ctrl_av1_frame_obj, "superres_denom", json_object_new_int(p->superres_denom));
1394 	/* struct v4l2_av1_segmentation segmentation */
1395 	trace_v4l2_av1_segmentation_gen(&p->segmentation, v4l2_ctrl_av1_frame_obj);
1396 	/* struct v4l2_av1_loop_filter loop_filter */
1397 	trace_v4l2_av1_loop_filter_gen(&p->loop_filter, v4l2_ctrl_av1_frame_obj);
1398 	/* struct v4l2_av1_cdef cdef */
1399 	trace_v4l2_av1_cdef_gen(&p->cdef, v4l2_ctrl_av1_frame_obj);
1400 	/* __u8 skip_mode_frame[2] */
1401 	json_object *skip_mode_frame_obj = json_object_new_array();
1402 	for (size_t i = 0; i < 2; i++) {
1403 		json_object_array_add(skip_mode_frame_obj, json_object_new_int(p->skip_mode_frame[i]));
1404 	}
1405 	json_object_object_add(v4l2_ctrl_av1_frame_obj, "skip_mode_frame", skip_mode_frame_obj);
1406 
1407 	json_object_object_add(v4l2_ctrl_av1_frame_obj, "primary_ref_frame", json_object_new_int(p->primary_ref_frame));
1408 	/* struct v4l2_av1_loop_restoration loop_restoration */
1409 	trace_v4l2_av1_loop_restoration_gen(&p->loop_restoration, v4l2_ctrl_av1_frame_obj);
1410 	/* struct v4l2_av1_global_motion global_motion */
1411 	trace_v4l2_av1_global_motion_gen(&p->global_motion, v4l2_ctrl_av1_frame_obj);
1412 	json_object_object_add(v4l2_ctrl_av1_frame_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_av1_frame_flag_def).c_str()));
1413 	json_object_object_add(v4l2_ctrl_av1_frame_obj, "frame_type", json_object_new_int(p->frame_type));
1414 	json_object_object_add(v4l2_ctrl_av1_frame_obj, "order_hint", json_object_new_int64(p->order_hint));
1415 	json_object_object_add(v4l2_ctrl_av1_frame_obj, "upscaled_width", json_object_new_int64(p->upscaled_width));
1416 	json_object_object_add(v4l2_ctrl_av1_frame_obj, "interpolation_filter", json_object_new_int(p->interpolation_filter));
1417 	json_object_object_add(v4l2_ctrl_av1_frame_obj, "tx_mode", json_object_new_int(p->tx_mode));
1418 	json_object_object_add(v4l2_ctrl_av1_frame_obj, "frame_width_minus_1", json_object_new_int64(p->frame_width_minus_1));
1419 	json_object_object_add(v4l2_ctrl_av1_frame_obj, "frame_height_minus_1", json_object_new_int64(p->frame_height_minus_1));
1420 	json_object_object_add(v4l2_ctrl_av1_frame_obj, "render_width_minus_1", json_object_new_int(p->render_width_minus_1));
1421 	json_object_object_add(v4l2_ctrl_av1_frame_obj, "render_height_minus_1", json_object_new_int(p->render_height_minus_1));
1422 	json_object_object_add(v4l2_ctrl_av1_frame_obj, "current_frame_id", json_object_new_int64(p->current_frame_id));
1423 	/* __u32 buffer_removal_time[V4L2_AV1_MAX_OPERATING_POINTS] */
1424 	json_object *buffer_removal_time_obj = json_object_new_array();
1425 	for (size_t i = 0; i < V4L2_AV1_MAX_OPERATING_POINTS; i++) {
1426 		json_object_array_add(buffer_removal_time_obj, json_object_new_int64(p->buffer_removal_time[i]));
1427 	}
1428 	json_object_object_add(v4l2_ctrl_av1_frame_obj, "buffer_removal_time", buffer_removal_time_obj);
1429 
1430 	/* __u32 order_hints[V4L2_AV1_TOTAL_REFS_PER_FRAME] */
1431 	json_object *order_hints_obj = json_object_new_array();
1432 	for (size_t i = 0; i < V4L2_AV1_TOTAL_REFS_PER_FRAME; i++) {
1433 		json_object_array_add(order_hints_obj, json_object_new_int64(p->order_hints[i]));
1434 	}
1435 	json_object_object_add(v4l2_ctrl_av1_frame_obj, "order_hints", order_hints_obj);
1436 
1437 	/* __u64 reference_frame_ts[V4L2_AV1_TOTAL_REFS_PER_FRAME] */
1438 	json_object *reference_frame_ts_obj = json_object_new_array();
1439 	for (size_t i = 0; i < V4L2_AV1_TOTAL_REFS_PER_FRAME; i++) {
1440 		json_object_array_add(reference_frame_ts_obj, json_object_new_uint64(p->reference_frame_ts[i]));
1441 	}
1442 	json_object_object_add(v4l2_ctrl_av1_frame_obj, "reference_frame_ts", reference_frame_ts_obj);
1443 
1444 	/* __s8 ref_frame_idx[V4L2_AV1_REFS_PER_FRAME] */
1445 	json_object *ref_frame_idx_obj = json_object_new_array();
1446 	for (size_t i = 0; i < V4L2_AV1_REFS_PER_FRAME; i++) {
1447 		json_object_array_add(ref_frame_idx_obj, json_object_new_int(p->ref_frame_idx[i]));
1448 	}
1449 	json_object_object_add(v4l2_ctrl_av1_frame_obj, "ref_frame_idx", ref_frame_idx_obj);
1450 
1451 	json_object_object_add(v4l2_ctrl_av1_frame_obj, "refresh_frame_flags", json_object_new_string(fl2s(p->refresh_frame_flags, v4l2_av1_frame_flag_def).c_str()));
1452 	json_object_object_add(parent_obj, "v4l2_ctrl_av1_frame", v4l2_ctrl_av1_frame_obj);
1453 }
1454 
trace_v4l2_ctrl_av1_film_grain_gen(void * ptr,json_object * parent_obj)1455 void trace_v4l2_ctrl_av1_film_grain_gen(void *ptr, json_object *parent_obj)
1456 {
1457 	json_object *v4l2_ctrl_av1_film_grain_obj = json_object_new_object();
1458 	struct v4l2_ctrl_av1_film_grain *p = static_cast<struct v4l2_ctrl_av1_film_grain*>(ptr);
1459 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_av1_film_grain_flag_def).c_str()));
1460 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "cr_mult", json_object_new_int(p->cr_mult));
1461 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "grain_seed", json_object_new_int(p->grain_seed));
1462 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "film_grain_params_ref_idx", json_object_new_int(p->film_grain_params_ref_idx));
1463 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "num_y_points", json_object_new_int(p->num_y_points));
1464 	/* __u8 point_y_value[V4L2_AV1_MAX_NUM_Y_POINTS] */
1465 	json_object *point_y_value_obj = json_object_new_array();
1466 	for (size_t i = 0; i < V4L2_AV1_MAX_NUM_Y_POINTS; i++) {
1467 		json_object_array_add(point_y_value_obj, json_object_new_int(p->point_y_value[i]));
1468 	}
1469 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "point_y_value", point_y_value_obj);
1470 
1471 	/* __u8 point_y_scaling[V4L2_AV1_MAX_NUM_Y_POINTS] */
1472 	json_object *point_y_scaling_obj = json_object_new_array();
1473 	for (size_t i = 0; i < V4L2_AV1_MAX_NUM_Y_POINTS; i++) {
1474 		json_object_array_add(point_y_scaling_obj, json_object_new_int(p->point_y_scaling[i]));
1475 	}
1476 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "point_y_scaling", point_y_scaling_obj);
1477 
1478 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "num_cb_points", json_object_new_int(p->num_cb_points));
1479 	/* __u8 point_cb_value[V4L2_AV1_MAX_NUM_CB_POINTS] */
1480 	json_object *point_cb_value_obj = json_object_new_array();
1481 	for (size_t i = 0; i < V4L2_AV1_MAX_NUM_CB_POINTS; i++) {
1482 		json_object_array_add(point_cb_value_obj, json_object_new_int(p->point_cb_value[i]));
1483 	}
1484 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "point_cb_value", point_cb_value_obj);
1485 
1486 	/* __u8 point_cb_scaling[V4L2_AV1_MAX_NUM_CB_POINTS] */
1487 	json_object *point_cb_scaling_obj = json_object_new_array();
1488 	for (size_t i = 0; i < V4L2_AV1_MAX_NUM_CB_POINTS; i++) {
1489 		json_object_array_add(point_cb_scaling_obj, json_object_new_int(p->point_cb_scaling[i]));
1490 	}
1491 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "point_cb_scaling", point_cb_scaling_obj);
1492 
1493 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "num_cr_points", json_object_new_int(p->num_cr_points));
1494 	/* __u8 point_cr_value[V4L2_AV1_MAX_NUM_CR_POINTS] */
1495 	json_object *point_cr_value_obj = json_object_new_array();
1496 	for (size_t i = 0; i < V4L2_AV1_MAX_NUM_CR_POINTS; i++) {
1497 		json_object_array_add(point_cr_value_obj, json_object_new_int(p->point_cr_value[i]));
1498 	}
1499 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "point_cr_value", point_cr_value_obj);
1500 
1501 	/* __u8 point_cr_scaling[V4L2_AV1_MAX_NUM_CR_POINTS] */
1502 	json_object *point_cr_scaling_obj = json_object_new_array();
1503 	for (size_t i = 0; i < V4L2_AV1_MAX_NUM_CR_POINTS; i++) {
1504 		json_object_array_add(point_cr_scaling_obj, json_object_new_int(p->point_cr_scaling[i]));
1505 	}
1506 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "point_cr_scaling", point_cr_scaling_obj);
1507 
1508 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "grain_scaling_minus_8", json_object_new_int(p->grain_scaling_minus_8));
1509 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "ar_coeff_lag", json_object_new_int(p->ar_coeff_lag));
1510 	/* __u8 ar_coeffs_y_plus_128[V4L2_AV1_AR_COEFFS_SIZE] */
1511 	json_object *ar_coeffs_y_plus_128_obj = json_object_new_array();
1512 	for (size_t i = 0; i < V4L2_AV1_AR_COEFFS_SIZE; i++) {
1513 		json_object_array_add(ar_coeffs_y_plus_128_obj, json_object_new_int(p->ar_coeffs_y_plus_128[i]));
1514 	}
1515 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "ar_coeffs_y_plus_128", ar_coeffs_y_plus_128_obj);
1516 
1517 	/* __u8 ar_coeffs_cb_plus_128[V4L2_AV1_AR_COEFFS_SIZE] */
1518 	json_object *ar_coeffs_cb_plus_128_obj = json_object_new_array();
1519 	for (size_t i = 0; i < V4L2_AV1_AR_COEFFS_SIZE; i++) {
1520 		json_object_array_add(ar_coeffs_cb_plus_128_obj, json_object_new_int(p->ar_coeffs_cb_plus_128[i]));
1521 	}
1522 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "ar_coeffs_cb_plus_128", ar_coeffs_cb_plus_128_obj);
1523 
1524 	/* __u8 ar_coeffs_cr_plus_128[V4L2_AV1_AR_COEFFS_SIZE] */
1525 	json_object *ar_coeffs_cr_plus_128_obj = json_object_new_array();
1526 	for (size_t i = 0; i < V4L2_AV1_AR_COEFFS_SIZE; i++) {
1527 		json_object_array_add(ar_coeffs_cr_plus_128_obj, json_object_new_int(p->ar_coeffs_cr_plus_128[i]));
1528 	}
1529 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "ar_coeffs_cr_plus_128", ar_coeffs_cr_plus_128_obj);
1530 
1531 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "ar_coeff_shift_minus_6", json_object_new_int(p->ar_coeff_shift_minus_6));
1532 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "grain_scale_shift", json_object_new_int(p->grain_scale_shift));
1533 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "cb_mult", json_object_new_int(p->cb_mult));
1534 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "cb_luma_mult", json_object_new_int(p->cb_luma_mult));
1535 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "cr_luma_mult", json_object_new_int(p->cr_luma_mult));
1536 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "cb_offset", json_object_new_int(p->cb_offset));
1537 	json_object_object_add(v4l2_ctrl_av1_film_grain_obj, "cr_offset", json_object_new_int(p->cr_offset));
1538 	json_object_object_add(parent_obj, "v4l2_ctrl_av1_film_grain", v4l2_ctrl_av1_film_grain_obj);
1539 }
1540 
trace_v4l2_rect_gen(void * arg,json_object * parent_obj,std::string key_name="")1541 void trace_v4l2_rect_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1542 {
1543 	json_object *v4l2_rect_obj = json_object_new_object();
1544 	struct v4l2_rect *p = static_cast<struct v4l2_rect*>(arg);
1545 
1546 	json_object_object_add(v4l2_rect_obj, "left", json_object_new_int(p->left));
1547 	json_object_object_add(v4l2_rect_obj, "top", json_object_new_int(p->top));
1548 	json_object_object_add(v4l2_rect_obj, "width", json_object_new_int64(p->width));
1549 	json_object_object_add(v4l2_rect_obj, "height", json_object_new_int64(p->height));
1550 
1551 	if (key_name.empty())
1552 		json_object_object_add(parent_obj, "v4l2_rect", v4l2_rect_obj);
1553 	else
1554 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_rect_obj);
1555 }
1556 
trace_v4l2_fract_gen(void * arg,json_object * parent_obj,std::string key_name="")1557 void trace_v4l2_fract_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1558 {
1559 	json_object *v4l2_fract_obj = json_object_new_object();
1560 	struct v4l2_fract *p = static_cast<struct v4l2_fract*>(arg);
1561 
1562 	json_object_object_add(v4l2_fract_obj, "numerator", json_object_new_int64(p->numerator));
1563 	json_object_object_add(v4l2_fract_obj, "denominator", json_object_new_int64(p->denominator));
1564 
1565 	if (key_name.empty())
1566 		json_object_object_add(parent_obj, "v4l2_fract", v4l2_fract_obj);
1567 	else
1568 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_fract_obj);
1569 }
1570 
trace_v4l2_area_gen(void * arg,json_object * parent_obj,std::string key_name="")1571 void trace_v4l2_area_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1572 {
1573 	json_object *v4l2_area_obj = json_object_new_object();
1574 	struct v4l2_area *p = static_cast<struct v4l2_area*>(arg);
1575 
1576 	json_object_object_add(v4l2_area_obj, "width", json_object_new_int64(p->width));
1577 	json_object_object_add(v4l2_area_obj, "height", json_object_new_int64(p->height));
1578 
1579 	if (key_name.empty())
1580 		json_object_object_add(parent_obj, "v4l2_area", v4l2_area_obj);
1581 	else
1582 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_area_obj);
1583 }
1584 
trace_v4l2_capability_gen(void * arg,json_object * parent_obj,std::string key_name="")1585 void trace_v4l2_capability_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1586 {
1587 	json_object *v4l2_capability_obj = json_object_new_object();
1588 	struct v4l2_capability *p = static_cast<struct v4l2_capability*>(arg);
1589 
1590 	json_object_object_add(v4l2_capability_obj, "driver", json_object_new_string(reinterpret_cast<const char *>(p->driver)));
1591 	json_object_object_add(v4l2_capability_obj, "card", json_object_new_string(reinterpret_cast<const char *>(p->card)));
1592 	json_object_object_add(v4l2_capability_obj, "bus_info", json_object_new_string(reinterpret_cast<const char *>(p->bus_info)));
1593 	json_object_object_add(v4l2_capability_obj, "version", json_object_new_string(ver2s(p->version).c_str()));
1594 	json_object_object_add(v4l2_capability_obj, "capabilities", json_object_new_string(fl2s(p->capabilities, v4l2_cap_flag_def).c_str()));
1595 	json_object_object_add(v4l2_capability_obj, "device_caps", json_object_new_string(fl2s(p->device_caps, v4l2_cap_flag_def).c_str()));
1596 
1597 	if (key_name.empty())
1598 		json_object_object_add(parent_obj, "v4l2_capability", v4l2_capability_obj);
1599 	else
1600 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_capability_obj);
1601 }
1602 
trace_v4l2_pix_format_gen(void * arg,json_object * parent_obj,std::string key_name="")1603 void trace_v4l2_pix_format_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1604 {
1605 	json_object *v4l2_pix_format_obj = json_object_new_object();
1606 	struct v4l2_pix_format *p = static_cast<struct v4l2_pix_format*>(arg);
1607 
1608 	json_object_object_add(v4l2_pix_format_obj, "width", json_object_new_int64(p->width));
1609 	json_object_object_add(v4l2_pix_format_obj, "height", json_object_new_int64(p->height));
1610 	json_object_object_add(v4l2_pix_format_obj, "pixelformat", json_object_new_string(val2s(p->pixelformat, v4l2_pix_fmt_val_def).c_str()));
1611 	json_object_object_add(v4l2_pix_format_obj, "field", json_object_new_string(val2s(p->field, v4l2_field_val_def).c_str()));
1612 	json_object_object_add(v4l2_pix_format_obj, "bytesperline", json_object_new_int64(p->bytesperline));
1613 	json_object_object_add(v4l2_pix_format_obj, "sizeimage", json_object_new_int64(p->sizeimage));
1614 	json_object_object_add(v4l2_pix_format_obj, "colorspace", json_object_new_string(val2s(p->colorspace, v4l2_colorspace_val_def).c_str()));
1615 	if (p->priv == V4L2_PIX_FMT_PRIV_MAGIC)
1616 		json_object_object_add(v4l2_pix_format_obj, "priv", json_object_new_string("V4L2_PIX_FMT_PRIV_MAGIC"));
1617 	else
1618 		json_object_object_add(v4l2_pix_format_obj, "priv", json_object_new_string(""));
1619 	json_object_object_add(v4l2_pix_format_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_pix_fmt_flag_def).c_str()));
1620 	//union
1621 	json_object_object_add(v4l2_pix_format_obj, "ycbcr_enc", json_object_new_string(val2s(p->ycbcr_enc, v4l2_ycbcr_encoding_val_def).c_str()));
1622 	json_object_object_add(v4l2_pix_format_obj, "hsv_enc", json_object_new_int64(p->hsv_enc));
1623 	//end of union 	};
1624 	json_object_object_add(v4l2_pix_format_obj, "quantization", json_object_new_string(val2s(p->quantization, v4l2_quantization_val_def).c_str()));
1625 	json_object_object_add(v4l2_pix_format_obj, "xfer_func", json_object_new_string(val2s(p->xfer_func, v4l2_xfer_func_val_def).c_str()));
1626 
1627 	if (key_name.empty())
1628 		json_object_object_add(parent_obj, "v4l2_pix_format", v4l2_pix_format_obj);
1629 	else
1630 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_pix_format_obj);
1631 }
1632 
trace_v4l2_fmtdesc_gen(void * arg,json_object * parent_obj,std::string key_name="")1633 void trace_v4l2_fmtdesc_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1634 {
1635 	json_object *v4l2_fmtdesc_obj = json_object_new_object();
1636 	struct v4l2_fmtdesc *p = static_cast<struct v4l2_fmtdesc*>(arg);
1637 
1638 	json_object_object_add(v4l2_fmtdesc_obj, "index", json_object_new_int64(p->index));
1639 	json_object_object_add(v4l2_fmtdesc_obj, "type", json_object_new_string(val2s(p->type, v4l2_buf_type_val_def).c_str()));
1640 	json_object_object_add(v4l2_fmtdesc_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_fmt_flag_def).c_str()));
1641 	json_object_object_add(v4l2_fmtdesc_obj, "description", json_object_new_string(reinterpret_cast<const char *>(p->description)));
1642 	json_object_object_add(v4l2_fmtdesc_obj, "pixelformat", json_object_new_string(val2s(p->pixelformat, v4l2_pix_fmt_val_def).c_str()));
1643 	json_object_object_add(v4l2_fmtdesc_obj, "mbus_code", json_object_new_int64(p->mbus_code));
1644 
1645 	if (key_name.empty())
1646 		json_object_object_add(parent_obj, "v4l2_fmtdesc", v4l2_fmtdesc_obj);
1647 	else
1648 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_fmtdesc_obj);
1649 }
1650 
trace_v4l2_frmsize_discrete_gen(void * arg,json_object * parent_obj,std::string key_name="")1651 void trace_v4l2_frmsize_discrete_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1652 {
1653 	json_object *v4l2_frmsize_discrete_obj = json_object_new_object();
1654 	struct v4l2_frmsize_discrete *p = static_cast<struct v4l2_frmsize_discrete*>(arg);
1655 
1656 	json_object_object_add(v4l2_frmsize_discrete_obj, "width", json_object_new_int64(p->width));
1657 	json_object_object_add(v4l2_frmsize_discrete_obj, "height", json_object_new_int64(p->height));
1658 
1659 	if (key_name.empty())
1660 		json_object_object_add(parent_obj, "v4l2_frmsize_discrete", v4l2_frmsize_discrete_obj);
1661 	else
1662 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_frmsize_discrete_obj);
1663 }
1664 
trace_v4l2_frmsize_stepwise_gen(void * arg,json_object * parent_obj,std::string key_name="")1665 void trace_v4l2_frmsize_stepwise_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1666 {
1667 	json_object *v4l2_frmsize_stepwise_obj = json_object_new_object();
1668 	struct v4l2_frmsize_stepwise *p = static_cast<struct v4l2_frmsize_stepwise*>(arg);
1669 
1670 	json_object_object_add(v4l2_frmsize_stepwise_obj, "min_width", json_object_new_int64(p->min_width));
1671 	json_object_object_add(v4l2_frmsize_stepwise_obj, "max_width", json_object_new_int64(p->max_width));
1672 	json_object_object_add(v4l2_frmsize_stepwise_obj, "step_width", json_object_new_int64(p->step_width));
1673 	json_object_object_add(v4l2_frmsize_stepwise_obj, "min_height", json_object_new_int64(p->min_height));
1674 	json_object_object_add(v4l2_frmsize_stepwise_obj, "max_height", json_object_new_int64(p->max_height));
1675 	json_object_object_add(v4l2_frmsize_stepwise_obj, "step_height", json_object_new_int64(p->step_height));
1676 
1677 	if (key_name.empty())
1678 		json_object_object_add(parent_obj, "v4l2_frmsize_stepwise", v4l2_frmsize_stepwise_obj);
1679 	else
1680 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_frmsize_stepwise_obj);
1681 }
1682 
trace_v4l2_frmsizeenum_gen(void * arg,json_object * parent_obj,std::string key_name="")1683 void trace_v4l2_frmsizeenum_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1684 {
1685 	json_object *v4l2_frmsizeenum_obj = json_object_new_object();
1686 	struct v4l2_frmsizeenum *p = static_cast<struct v4l2_frmsizeenum*>(arg);
1687 
1688 	json_object_object_add(v4l2_frmsizeenum_obj, "index", json_object_new_int64(p->index));
1689 	json_object_object_add(v4l2_frmsizeenum_obj, "pixel_format", json_object_new_string(val2s(p->pixel_format, v4l2_pix_fmt_val_def).c_str()));
1690 	json_object_object_add(v4l2_frmsizeenum_obj, "type", json_object_new_string(val2s(p->type, v4l2_frmsizetypes_val_def).c_str()));
1691 	//union
1692 	switch (p->type) {
1693 	case V4L2_FRMSIZE_TYPE_DISCRETE:
1694 		trace_v4l2_frmsize_discrete_gen(&p->discrete, v4l2_frmsizeenum_obj);
1695 		break;
1696 	case V4L2_FRMSIZE_TYPE_STEPWISE:
1697 	case V4L2_FRMSIZE_TYPE_CONTINUOUS:
1698 		trace_v4l2_frmsize_stepwise_gen(&p->stepwise, v4l2_frmsizeenum_obj);
1699 		break;
1700 	default:
1701 		break;
1702 	}
1703 	//struct v4l2_frmsize_discrete	discrete;
1704 	//struct v4l2_frmsize_stepwise	stepwise;
1705 	//end of union 	};
1706 
1707 	if (key_name.empty())
1708 		json_object_object_add(parent_obj, "v4l2_frmsizeenum", v4l2_frmsizeenum_obj);
1709 	else
1710 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_frmsizeenum_obj);
1711 }
1712 
trace_v4l2_frmival_stepwise_gen(void * arg,json_object * parent_obj,std::string key_name="")1713 void trace_v4l2_frmival_stepwise_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1714 {
1715 	json_object *v4l2_frmival_stepwise_obj = json_object_new_object();
1716 	struct v4l2_frmival_stepwise *p = static_cast<struct v4l2_frmival_stepwise*>(arg);
1717 
1718 	//struct v4l2_fract	min;
1719 	trace_v4l2_fract_gen(&p->min, v4l2_frmival_stepwise_obj, "min");
1720 	//struct v4l2_fract	max;
1721 	trace_v4l2_fract_gen(&p->max, v4l2_frmival_stepwise_obj, "max");
1722 	//struct v4l2_fract	step;
1723 	trace_v4l2_fract_gen(&p->step, v4l2_frmival_stepwise_obj, "step");
1724 
1725 	if (key_name.empty())
1726 		json_object_object_add(parent_obj, "v4l2_frmival_stepwise", v4l2_frmival_stepwise_obj);
1727 	else
1728 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_frmival_stepwise_obj);
1729 }
1730 
trace_v4l2_frmivalenum_gen(void * arg,json_object * parent_obj,std::string key_name="")1731 void trace_v4l2_frmivalenum_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1732 {
1733 	json_object *v4l2_frmivalenum_obj = json_object_new_object();
1734 	struct v4l2_frmivalenum *p = static_cast<struct v4l2_frmivalenum*>(arg);
1735 
1736 	json_object_object_add(v4l2_frmivalenum_obj, "index", json_object_new_int64(p->index));
1737 	json_object_object_add(v4l2_frmivalenum_obj, "pixel_format", json_object_new_string(val2s(p->pixel_format, v4l2_pix_fmt_val_def).c_str()));
1738 	json_object_object_add(v4l2_frmivalenum_obj, "width", json_object_new_int64(p->width));
1739 	json_object_object_add(v4l2_frmivalenum_obj, "height", json_object_new_int64(p->height));
1740 	json_object_object_add(v4l2_frmivalenum_obj, "type", json_object_new_string(val2s(p->type, v4l2_frmivaltypes_val_def).c_str()));
1741 	//union
1742 	switch (p->type) {
1743 	case V4L2_FRMIVAL_TYPE_DISCRETE:
1744 		trace_v4l2_fract_gen(&p->discrete, v4l2_frmivalenum_obj);
1745 		break;
1746 	case V4L2_FRMIVAL_TYPE_STEPWISE:
1747 	case V4L2_FRMIVAL_TYPE_CONTINUOUS:
1748 		trace_v4l2_frmival_stepwise_gen(&p->stepwise, v4l2_frmivalenum_obj);
1749 		break;
1750 	default:
1751 		break;
1752 	}
1753 	//struct v4l2_fract		discrete;
1754 	//struct v4l2_frmival_stepwise	stepwise;
1755 	//end of union 	};
1756 
1757 	if (key_name.empty())
1758 		json_object_object_add(parent_obj, "v4l2_frmivalenum", v4l2_frmivalenum_obj);
1759 	else
1760 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_frmivalenum_obj);
1761 }
1762 
trace_v4l2_timecode_gen(void * arg,json_object * parent_obj,std::string key_name="")1763 void trace_v4l2_timecode_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1764 {
1765 	json_object *v4l2_timecode_obj = json_object_new_object();
1766 	struct v4l2_timecode *p = static_cast<struct v4l2_timecode*>(arg);
1767 
1768 	json_object_object_add(v4l2_timecode_obj, "type", json_object_new_string(val2s(p->type, nullptr).c_str()));
1769 	json_object_object_add(v4l2_timecode_obj, "flags", json_object_new_string(fl2s(p->flags, nullptr).c_str()));
1770 	json_object_object_add(v4l2_timecode_obj, "frames", json_object_new_int(p->frames));
1771 	json_object_object_add(v4l2_timecode_obj, "seconds", json_object_new_int(p->seconds));
1772 	json_object_object_add(v4l2_timecode_obj, "minutes", json_object_new_int(p->minutes));
1773 	json_object_object_add(v4l2_timecode_obj, "hours", json_object_new_int(p->hours));
1774 	json_object_object_add(v4l2_timecode_obj, "userbits", json_object_new_string(reinterpret_cast<const char *>(p->userbits)));
1775 
1776 	if (key_name.empty())
1777 		json_object_object_add(parent_obj, "v4l2_timecode", v4l2_timecode_obj);
1778 	else
1779 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_timecode_obj);
1780 }
1781 
trace_v4l2_jpegcompression_gen(void * arg,json_object * parent_obj,std::string key_name="")1782 void trace_v4l2_jpegcompression_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1783 {
1784 	json_object *v4l2_jpegcompression_obj = json_object_new_object();
1785 	struct v4l2_jpegcompression *p = static_cast<struct v4l2_jpegcompression*>(arg);
1786 
1787 	json_object_object_add(v4l2_jpegcompression_obj, "quality", json_object_new_int(p->quality));
1788 	json_object_object_add(v4l2_jpegcompression_obj, "APPn", json_object_new_int(p->APPn));
1789 	json_object_object_add(v4l2_jpegcompression_obj, "APP_len", json_object_new_int(p->APP_len));
1790 	json_object_object_add(v4l2_jpegcompression_obj, "APP_data", json_object_new_string(reinterpret_cast<const char *>(p->APP_data)));
1791 	json_object_object_add(v4l2_jpegcompression_obj, "COM_len", json_object_new_int(p->COM_len));
1792 	json_object_object_add(v4l2_jpegcompression_obj, "COM_data", json_object_new_string(reinterpret_cast<const char *>(p->COM_data)));
1793 	json_object_object_add(v4l2_jpegcompression_obj, "jpeg_markers", json_object_new_int64(p->jpeg_markers));
1794 
1795 	if (key_name.empty())
1796 		json_object_object_add(parent_obj, "v4l2_jpegcompression", v4l2_jpegcompression_obj);
1797 	else
1798 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_jpegcompression_obj);
1799 }
1800 
trace_v4l2_requestbuffers_gen(void * arg,json_object * parent_obj,std::string key_name="")1801 void trace_v4l2_requestbuffers_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1802 {
1803 	json_object *v4l2_requestbuffers_obj = json_object_new_object();
1804 	struct v4l2_requestbuffers *p = static_cast<struct v4l2_requestbuffers*>(arg);
1805 
1806 	json_object_object_add(v4l2_requestbuffers_obj, "count", json_object_new_int64(p->count));
1807 	json_object_object_add(v4l2_requestbuffers_obj, "type", json_object_new_string(val2s(p->type, v4l2_buf_type_val_def).c_str()));
1808 	json_object_object_add(v4l2_requestbuffers_obj, "memory", json_object_new_string(val2s(p->memory, v4l2_memory_val_def).c_str()));
1809 	json_object_object_add(v4l2_requestbuffers_obj, "capabilities", json_object_new_string(fl2s(p->capabilities, v4l2_buf_cap_flag_def).c_str()));
1810 	json_object_object_add(v4l2_requestbuffers_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_memory_flag_def).c_str()));
1811 
1812 	if (key_name.empty())
1813 		json_object_object_add(parent_obj, "v4l2_requestbuffers", v4l2_requestbuffers_obj);
1814 	else
1815 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_requestbuffers_obj);
1816 }
1817 
trace_v4l2_plane_gen(void * arg,json_object * parent_obj,std::string key_name="")1818 void trace_v4l2_plane_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1819 {
1820 	json_object *v4l2_plane_obj = json_object_new_object();
1821 	struct v4l2_plane *p = static_cast<struct v4l2_plane*>(arg);
1822 
1823 	json_object_object_add(v4l2_plane_obj, "bytesused", json_object_new_int64(p->bytesused));
1824 	json_object_object_add(v4l2_plane_obj, "length", json_object_new_int64(p->length));
1825 	//union
1826 	//__u32		mem_offset;
1827 	//unsigned long	userptr;
1828 	//__s32		fd;
1829 	//end of union 	} m;
1830 	json_object_object_add(v4l2_plane_obj, "data_offset", json_object_new_int64(p->data_offset));
1831 
1832 	if (key_name.empty())
1833 		json_object_object_add(parent_obj, "v4l2_plane", v4l2_plane_obj);
1834 	else
1835 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_plane_obj);
1836 }
1837 
trace_v4l2_buffer_gen(void * arg,json_object * parent_obj,std::string key_name="")1838 void trace_v4l2_buffer_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1839 {
1840 	json_object *v4l2_buffer_obj = json_object_new_object();
1841 	struct v4l2_buffer *p = static_cast<struct v4l2_buffer*>(arg);
1842 
1843 	json_object_object_add(v4l2_buffer_obj, "index", json_object_new_int64(p->index));
1844 	json_object_object_add(v4l2_buffer_obj, "type", json_object_new_string(val2s(p->type, v4l2_buf_type_val_def).c_str()));
1845 	json_object_object_add(v4l2_buffer_obj, "bytesused", json_object_new_int64(p->bytesused));
1846 	json_object_object_add(v4l2_buffer_obj, "flags", json_object_new_string(fl2s_buffer(p->flags).c_str()));
1847 	json_object_object_add(v4l2_buffer_obj, "field", json_object_new_string(val2s(p->field, v4l2_field_val_def).c_str()));
1848 	//struct timeval		timestamp;
1849 	//struct v4l2_timecode	timecode;
1850 	trace_v4l2_timecode_gen(&p->timecode, v4l2_buffer_obj, "timecode");
1851 	json_object_object_add(v4l2_buffer_obj, "sequence", json_object_new_int64(p->sequence));
1852 	json_object_object_add(v4l2_buffer_obj, "memory", json_object_new_string(val2s(p->memory, v4l2_memory_val_def).c_str()));
1853 	//union
1854 	//__u32           offset;
1855 	//unsigned long   userptr;
1856 	//struct v4l2_plane *planes;
1857 	//__s32		fd;
1858 	//end of union 	} m;
1859 	json_object_object_add(v4l2_buffer_obj, "length", json_object_new_int64(p->length));
1860 	//union
1861 	//__s32		request_fd;
1862 	//end of union 	};
1863 
1864 	if (key_name.empty())
1865 		json_object_object_add(parent_obj, "v4l2_buffer", v4l2_buffer_obj);
1866 	else
1867 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_buffer_obj);
1868 }
1869 
trace_v4l2_exportbuffer_gen(void * arg,json_object * parent_obj,std::string key_name="")1870 void trace_v4l2_exportbuffer_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1871 {
1872 	json_object *v4l2_exportbuffer_obj = json_object_new_object();
1873 	struct v4l2_exportbuffer *p = static_cast<struct v4l2_exportbuffer*>(arg);
1874 
1875 	json_object_object_add(v4l2_exportbuffer_obj, "type", json_object_new_string(val2s(p->type, v4l2_buf_type_val_def).c_str()));
1876 	json_object_object_add(v4l2_exportbuffer_obj, "index", json_object_new_int64(p->index));
1877 	json_object_object_add(v4l2_exportbuffer_obj, "plane", json_object_new_int64(p->plane));
1878 	json_object_object_add(v4l2_exportbuffer_obj, "flags", json_object_new_string(fl2s(p->flags, nullptr).c_str()));
1879 	json_object_object_add(v4l2_exportbuffer_obj, "fd", json_object_new_int(p->fd));
1880 
1881 	if (key_name.empty())
1882 		json_object_object_add(parent_obj, "v4l2_exportbuffer", v4l2_exportbuffer_obj);
1883 	else
1884 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_exportbuffer_obj);
1885 }
1886 
trace_v4l2_framebuffer_gen(void * arg,json_object * parent_obj,std::string key_name="")1887 void trace_v4l2_framebuffer_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1888 {
1889 	json_object *v4l2_framebuffer_obj = json_object_new_object();
1890 	struct v4l2_framebuffer *p = static_cast<struct v4l2_framebuffer*>(arg);
1891 
1892 	json_object_object_add(v4l2_framebuffer_obj, "capability", json_object_new_int64(p->capability));
1893 	json_object_object_add(v4l2_framebuffer_obj, "flags", json_object_new_string(fl2s(p->flags, nullptr).c_str()));
1894 	//void                    *base;
1895 	//struct {
1896 	//__u32		width;
1897 	//__u32		height;
1898 	//__u32		pixelformat;
1899 	//__u32		field;
1900 	//__u32		bytesperline;
1901 	//__u32		sizeimage;
1902 	//__u32		colorspace;
1903 	//__u32		priv;
1904 	//end of struct 	} fmt;
1905 
1906 	if (key_name.empty())
1907 		json_object_object_add(parent_obj, "v4l2_framebuffer", v4l2_framebuffer_obj);
1908 	else
1909 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_framebuffer_obj);
1910 }
1911 
trace_v4l2_clip_gen(void * arg,json_object * parent_obj,std::string key_name="")1912 void trace_v4l2_clip_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1913 {
1914 	json_object *v4l2_clip_obj = json_object_new_object();
1915 	struct v4l2_clip *p = static_cast<struct v4l2_clip*>(arg);
1916 
1917 	//struct v4l2_rect        c;
1918 	trace_v4l2_rect_gen(&p->c, v4l2_clip_obj, "c");
1919 	//struct v4l2_clip	*next;
1920 
1921 	if (key_name.empty())
1922 		json_object_object_add(parent_obj, "v4l2_clip", v4l2_clip_obj);
1923 	else
1924 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_clip_obj);
1925 }
1926 
trace_v4l2_window_gen(void * arg,json_object * parent_obj,std::string key_name="")1927 void trace_v4l2_window_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1928 {
1929 	json_object *v4l2_window_obj = json_object_new_object();
1930 	struct v4l2_window *p = static_cast<struct v4l2_window*>(arg);
1931 
1932 	//struct v4l2_rect        w;
1933 	trace_v4l2_rect_gen(&p->w, v4l2_window_obj, "w");
1934 	json_object_object_add(v4l2_window_obj, "field", json_object_new_string(val2s(p->field, v4l2_field_val_def).c_str()));
1935 	json_object_object_add(v4l2_window_obj, "chromakey", json_object_new_int64(p->chromakey));
1936 	//struct v4l2_clip	*clips;
1937 	json_object_object_add(v4l2_window_obj, "clipcount", json_object_new_int64(p->clipcount));
1938 	//void			*bitmap;
1939 	json_object_object_add(v4l2_window_obj, "global_alpha", json_object_new_int(p->global_alpha));
1940 
1941 	if (key_name.empty())
1942 		json_object_object_add(parent_obj, "v4l2_window", v4l2_window_obj);
1943 	else
1944 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_window_obj);
1945 }
1946 
trace_v4l2_captureparm_gen(void * arg,json_object * parent_obj,std::string key_name="")1947 void trace_v4l2_captureparm_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1948 {
1949 	json_object *v4l2_captureparm_obj = json_object_new_object();
1950 	struct v4l2_captureparm *p = static_cast<struct v4l2_captureparm*>(arg);
1951 
1952 	json_object_object_add(v4l2_captureparm_obj, "capability", json_object_new_string(val2s(p->capability, streamparm_val_def).c_str()));
1953 	json_object_object_add(v4l2_captureparm_obj, "capturemode", json_object_new_string(val2s(p->capturemode, streamparm_val_def).c_str()));
1954 	//struct v4l2_fract  timeperframe;
1955 	trace_v4l2_fract_gen(&p->timeperframe, v4l2_captureparm_obj, "timeperframe");
1956 	json_object_object_add(v4l2_captureparm_obj, "extendedmode", json_object_new_int64(p->extendedmode));
1957 	json_object_object_add(v4l2_captureparm_obj, "readbuffers", json_object_new_int64(p->readbuffers));
1958 
1959 	if (key_name.empty())
1960 		json_object_object_add(parent_obj, "v4l2_captureparm", v4l2_captureparm_obj);
1961 	else
1962 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_captureparm_obj);
1963 }
1964 
trace_v4l2_outputparm_gen(void * arg,json_object * parent_obj,std::string key_name="")1965 void trace_v4l2_outputparm_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1966 {
1967 	json_object *v4l2_outputparm_obj = json_object_new_object();
1968 	struct v4l2_outputparm *p = static_cast<struct v4l2_outputparm*>(arg);
1969 
1970 	json_object_object_add(v4l2_outputparm_obj, "capability", json_object_new_string(val2s(p->capability, streamparm_val_def).c_str()));
1971 	json_object_object_add(v4l2_outputparm_obj, "outputmode", json_object_new_string(val2s(p->outputmode, streamparm_val_def).c_str()));
1972 	//struct v4l2_fract  timeperframe;
1973 	trace_v4l2_fract_gen(&p->timeperframe, v4l2_outputparm_obj, "timeperframe");
1974 	json_object_object_add(v4l2_outputparm_obj, "extendedmode", json_object_new_int64(p->extendedmode));
1975 	json_object_object_add(v4l2_outputparm_obj, "writebuffers", json_object_new_int64(p->writebuffers));
1976 
1977 	if (key_name.empty())
1978 		json_object_object_add(parent_obj, "v4l2_outputparm", v4l2_outputparm_obj);
1979 	else
1980 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_outputparm_obj);
1981 }
1982 
trace_v4l2_cropcap_gen(void * arg,json_object * parent_obj,std::string key_name="")1983 void trace_v4l2_cropcap_gen(void *arg, json_object *parent_obj, std::string key_name = "")
1984 {
1985 	json_object *v4l2_cropcap_obj = json_object_new_object();
1986 	struct v4l2_cropcap *p = static_cast<struct v4l2_cropcap*>(arg);
1987 
1988 	json_object_object_add(v4l2_cropcap_obj, "type", json_object_new_string(val2s(p->type, v4l2_buf_type_val_def).c_str()));
1989 	//struct v4l2_rect        bounds;
1990 	trace_v4l2_rect_gen(&p->bounds, v4l2_cropcap_obj, "bounds");
1991 	//struct v4l2_rect        defrect;
1992 	trace_v4l2_rect_gen(&p->defrect, v4l2_cropcap_obj, "defrect");
1993 	//struct v4l2_fract       pixelaspect;
1994 	trace_v4l2_fract_gen(&p->pixelaspect, v4l2_cropcap_obj, "pixelaspect");
1995 
1996 	if (key_name.empty())
1997 		json_object_object_add(parent_obj, "v4l2_cropcap", v4l2_cropcap_obj);
1998 	else
1999 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_cropcap_obj);
2000 }
2001 
trace_v4l2_crop_gen(void * arg,json_object * parent_obj,std::string key_name="")2002 void trace_v4l2_crop_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2003 {
2004 	json_object *v4l2_crop_obj = json_object_new_object();
2005 	struct v4l2_crop *p = static_cast<struct v4l2_crop*>(arg);
2006 
2007 	json_object_object_add(v4l2_crop_obj, "type", json_object_new_string(val2s(p->type, v4l2_buf_type_val_def).c_str()));
2008 	//struct v4l2_rect        c;
2009 	trace_v4l2_rect_gen(&p->c, v4l2_crop_obj, "c");
2010 
2011 	if (key_name.empty())
2012 		json_object_object_add(parent_obj, "v4l2_crop", v4l2_crop_obj);
2013 	else
2014 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_crop_obj);
2015 }
2016 
trace_v4l2_selection_gen(void * arg,json_object * parent_obj,std::string key_name="")2017 void trace_v4l2_selection_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2018 {
2019 	json_object *v4l2_selection_obj = json_object_new_object();
2020 	struct v4l2_selection *p = static_cast<struct v4l2_selection*>(arg);
2021 
2022 	json_object_object_add(v4l2_selection_obj, "type", json_object_new_string(val2s(p->type, v4l2_buf_type_val_def).c_str()));
2023 	json_object_object_add(v4l2_selection_obj, "target", json_object_new_string(val2s(p->target, selection_target_val_def).c_str()));
2024 	json_object_object_add(v4l2_selection_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_sel_flag_def).c_str()));
2025 	//struct v4l2_rect        r;
2026 	trace_v4l2_rect_gen(&p->r, v4l2_selection_obj, "r");
2027 
2028 	if (key_name.empty())
2029 		json_object_object_add(parent_obj, "v4l2_selection", v4l2_selection_obj);
2030 	else
2031 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_selection_obj);
2032 }
2033 
trace_v4l2_standard_gen(void * arg,json_object * parent_obj,std::string key_name="")2034 void trace_v4l2_standard_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2035 {
2036 	json_object *v4l2_standard_obj = json_object_new_object();
2037 	struct v4l2_standard *p = static_cast<struct v4l2_standard*>(arg);
2038 
2039 	json_object_object_add(v4l2_standard_obj, "index", json_object_new_int64(p->index));
2040 	json_object_object_add(v4l2_standard_obj, "id", json_object_new_string(val2s(p->id, nullptr).c_str()));
2041 	json_object_object_add(v4l2_standard_obj, "name", json_object_new_string(reinterpret_cast<const char *>(p->name)));
2042 	//struct v4l2_fract    frameperiod;
2043 	trace_v4l2_fract_gen(&p->frameperiod, v4l2_standard_obj, "frameperiod");
2044 	json_object_object_add(v4l2_standard_obj, "framelines", json_object_new_int64(p->framelines));
2045 
2046 	if (key_name.empty())
2047 		json_object_object_add(parent_obj, "v4l2_standard", v4l2_standard_obj);
2048 	else
2049 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_standard_obj);
2050 }
2051 
trace_v4l2_bt_timings_gen(void * arg,json_object * parent_obj,std::string key_name="")2052 void trace_v4l2_bt_timings_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2053 {
2054 	json_object *v4l2_bt_timings_obj = json_object_new_object();
2055 	struct v4l2_bt_timings *p = static_cast<struct v4l2_bt_timings*>(arg);
2056 
2057 	json_object_object_add(v4l2_bt_timings_obj, "width", json_object_new_int64(p->width));
2058 	json_object_object_add(v4l2_bt_timings_obj, "height", json_object_new_int64(p->height));
2059 	json_object_object_add(v4l2_bt_timings_obj, "interlaced", json_object_new_int64(p->interlaced));
2060 	json_object_object_add(v4l2_bt_timings_obj, "polarities", json_object_new_int64(p->polarities));
2061 	json_object_object_add(v4l2_bt_timings_obj, "pixelclock", json_object_new_uint64(p->pixelclock));
2062 	json_object_object_add(v4l2_bt_timings_obj, "hfrontporch", json_object_new_int64(p->hfrontporch));
2063 	json_object_object_add(v4l2_bt_timings_obj, "hsync", json_object_new_int64(p->hsync));
2064 	json_object_object_add(v4l2_bt_timings_obj, "hbackporch", json_object_new_int64(p->hbackporch));
2065 	json_object_object_add(v4l2_bt_timings_obj, "vfrontporch", json_object_new_int64(p->vfrontporch));
2066 	json_object_object_add(v4l2_bt_timings_obj, "vsync", json_object_new_int64(p->vsync));
2067 	json_object_object_add(v4l2_bt_timings_obj, "vbackporch", json_object_new_int64(p->vbackporch));
2068 	json_object_object_add(v4l2_bt_timings_obj, "il_vfrontporch", json_object_new_int64(p->il_vfrontporch));
2069 	json_object_object_add(v4l2_bt_timings_obj, "il_vsync", json_object_new_int64(p->il_vsync));
2070 	json_object_object_add(v4l2_bt_timings_obj, "il_vbackporch", json_object_new_int64(p->il_vbackporch));
2071 	json_object_object_add(v4l2_bt_timings_obj, "standards", json_object_new_int64(p->standards));
2072 	json_object_object_add(v4l2_bt_timings_obj, "flags", json_object_new_string(fl2s(p->flags, nullptr).c_str()));
2073 	//struct v4l2_fract picture_aspect;
2074 	trace_v4l2_fract_gen(&p->picture_aspect, v4l2_bt_timings_obj, "picture_aspect");
2075 	json_object_object_add(v4l2_bt_timings_obj, "cea861_vic", json_object_new_int(p->cea861_vic));
2076 	json_object_object_add(v4l2_bt_timings_obj, "hdmi_vic", json_object_new_int(p->hdmi_vic));
2077 
2078 	if (key_name.empty())
2079 		json_object_object_add(parent_obj, "v4l2_bt_timings", v4l2_bt_timings_obj);
2080 	else
2081 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_bt_timings_obj);
2082 }
2083 
trace_v4l2_dv_timings_gen(void * arg,json_object * parent_obj,std::string key_name="")2084 void trace_v4l2_dv_timings_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2085 {
2086 	json_object *v4l2_dv_timings_obj = json_object_new_object();
2087 	struct v4l2_dv_timings *p = static_cast<struct v4l2_dv_timings*>(arg);
2088 
2089 	json_object_object_add(v4l2_dv_timings_obj, "type", json_object_new_string(val2s(p->type, nullptr).c_str()));
2090 	//union
2091 	//struct v4l2_bt_timings	bt;
2092 	//end of union 	};
2093 
2094 	if (key_name.empty())
2095 		json_object_object_add(parent_obj, "v4l2_dv_timings", v4l2_dv_timings_obj);
2096 	else
2097 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_dv_timings_obj);
2098 }
2099 
trace_v4l2_enum_dv_timings_gen(void * arg,json_object * parent_obj,std::string key_name="")2100 void trace_v4l2_enum_dv_timings_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2101 {
2102 	json_object *v4l2_enum_dv_timings_obj = json_object_new_object();
2103 	struct v4l2_enum_dv_timings *p = static_cast<struct v4l2_enum_dv_timings*>(arg);
2104 
2105 	json_object_object_add(v4l2_enum_dv_timings_obj, "index", json_object_new_int64(p->index));
2106 	json_object_object_add(v4l2_enum_dv_timings_obj, "pad", json_object_new_int64(p->pad));
2107 	//struct v4l2_dv_timings timings;
2108 	trace_v4l2_dv_timings_gen(&p->timings, v4l2_enum_dv_timings_obj, "timings");
2109 
2110 	if (key_name.empty())
2111 		json_object_object_add(parent_obj, "v4l2_enum_dv_timings", v4l2_enum_dv_timings_obj);
2112 	else
2113 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_enum_dv_timings_obj);
2114 }
2115 
trace_v4l2_bt_timings_cap_gen(void * arg,json_object * parent_obj,std::string key_name="")2116 void trace_v4l2_bt_timings_cap_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2117 {
2118 	json_object *v4l2_bt_timings_cap_obj = json_object_new_object();
2119 	struct v4l2_bt_timings_cap *p = static_cast<struct v4l2_bt_timings_cap*>(arg);
2120 
2121 	json_object_object_add(v4l2_bt_timings_cap_obj, "min_width", json_object_new_int64(p->min_width));
2122 	json_object_object_add(v4l2_bt_timings_cap_obj, "max_width", json_object_new_int64(p->max_width));
2123 	json_object_object_add(v4l2_bt_timings_cap_obj, "min_height", json_object_new_int64(p->min_height));
2124 	json_object_object_add(v4l2_bt_timings_cap_obj, "max_height", json_object_new_int64(p->max_height));
2125 	json_object_object_add(v4l2_bt_timings_cap_obj, "min_pixelclock", json_object_new_uint64(p->min_pixelclock));
2126 	json_object_object_add(v4l2_bt_timings_cap_obj, "max_pixelclock", json_object_new_uint64(p->max_pixelclock));
2127 	json_object_object_add(v4l2_bt_timings_cap_obj, "standards", json_object_new_int64(p->standards));
2128 	json_object_object_add(v4l2_bt_timings_cap_obj, "capabilities", json_object_new_int64(p->capabilities));
2129 
2130 	if (key_name.empty())
2131 		json_object_object_add(parent_obj, "v4l2_bt_timings_cap", v4l2_bt_timings_cap_obj);
2132 	else
2133 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_bt_timings_cap_obj);
2134 }
2135 
trace_v4l2_dv_timings_cap_gen(void * arg,json_object * parent_obj,std::string key_name="")2136 void trace_v4l2_dv_timings_cap_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2137 {
2138 	json_object *v4l2_dv_timings_cap_obj = json_object_new_object();
2139 	struct v4l2_dv_timings_cap *p = static_cast<struct v4l2_dv_timings_cap*>(arg);
2140 
2141 	json_object_object_add(v4l2_dv_timings_cap_obj, "type", json_object_new_string(val2s(p->type, nullptr).c_str()));
2142 	json_object_object_add(v4l2_dv_timings_cap_obj, "pad", json_object_new_int64(p->pad));
2143 	//union
2144 	//struct v4l2_bt_timings_cap bt;
2145 	//end of union 	};
2146 
2147 	if (key_name.empty())
2148 		json_object_object_add(parent_obj, "v4l2_dv_timings_cap", v4l2_dv_timings_cap_obj);
2149 	else
2150 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_dv_timings_cap_obj);
2151 }
2152 
trace_v4l2_input_gen(void * arg,json_object * parent_obj,std::string key_name="")2153 void trace_v4l2_input_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2154 {
2155 	json_object *v4l2_input_obj = json_object_new_object();
2156 	struct v4l2_input *p = static_cast<struct v4l2_input*>(arg);
2157 
2158 	json_object_object_add(v4l2_input_obj, "index", json_object_new_int64(p->index));
2159 	json_object_object_add(v4l2_input_obj, "name", json_object_new_string(reinterpret_cast<const char *>(p->name)));
2160 	json_object_object_add(v4l2_input_obj, "type", json_object_new_string(val2s(p->type, input_type_val_def).c_str()));
2161 	json_object_object_add(v4l2_input_obj, "audioset", json_object_new_int64(p->audioset));
2162 	json_object_object_add(v4l2_input_obj, "tuner", json_object_new_int64(p->tuner));
2163 	json_object_object_add(v4l2_input_obj, "std", json_object_new_uint64(p->std));
2164 	json_object_object_add(v4l2_input_obj, "status", json_object_new_int64(p->status));
2165 	json_object_object_add(v4l2_input_obj, "capabilities", json_object_new_int64(p->capabilities));
2166 
2167 	if (key_name.empty())
2168 		json_object_object_add(parent_obj, "v4l2_input", v4l2_input_obj);
2169 	else
2170 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_input_obj);
2171 }
2172 
trace_v4l2_output_gen(void * arg,json_object * parent_obj,std::string key_name="")2173 void trace_v4l2_output_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2174 {
2175 	json_object *v4l2_output_obj = json_object_new_object();
2176 	struct v4l2_output *p = static_cast<struct v4l2_output*>(arg);
2177 
2178 	json_object_object_add(v4l2_output_obj, "index", json_object_new_int64(p->index));
2179 	json_object_object_add(v4l2_output_obj, "name", json_object_new_string(reinterpret_cast<const char *>(p->name)));
2180 	json_object_object_add(v4l2_output_obj, "type", json_object_new_string(val2s(p->type, output_type_val_def).c_str()));
2181 	json_object_object_add(v4l2_output_obj, "audioset", json_object_new_int64(p->audioset));
2182 	json_object_object_add(v4l2_output_obj, "modulator", json_object_new_int64(p->modulator));
2183 	json_object_object_add(v4l2_output_obj, "std", json_object_new_uint64(p->std));
2184 	json_object_object_add(v4l2_output_obj, "capabilities", json_object_new_int64(p->capabilities));
2185 
2186 	if (key_name.empty())
2187 		json_object_object_add(parent_obj, "v4l2_output", v4l2_output_obj);
2188 	else
2189 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_output_obj);
2190 }
2191 
trace_v4l2_control_gen(void * arg,json_object * parent_obj,std::string key_name="")2192 void trace_v4l2_control_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2193 {
2194 	json_object *v4l2_control_obj = json_object_new_object();
2195 	struct v4l2_control *p = static_cast<struct v4l2_control*>(arg);
2196 
2197 	json_object_object_add(v4l2_control_obj, "id", json_object_new_string(val2s(p->id, control_val_def).c_str()));
2198 	json_object_object_add(v4l2_control_obj, "value", json_object_new_int(p->value));
2199 
2200 	if (key_name.empty())
2201 		json_object_object_add(parent_obj, "v4l2_control", v4l2_control_obj);
2202 	else
2203 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_control_obj);
2204 }
2205 
trace_v4l2_ext_control_gen(void * arg,json_object * parent_obj,std::string key_name="")2206 void trace_v4l2_ext_control_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2207 {
2208 	json_object *v4l2_ext_control_obj = json_object_new_object();
2209 	struct v4l2_ext_control *p = static_cast<struct v4l2_ext_control*>(arg);
2210 
2211 	json_object_object_add(v4l2_ext_control_obj, "id", json_object_new_string(val2s(p->id, control_val_def).c_str()));
2212 	json_object_object_add(v4l2_ext_control_obj, "size", json_object_new_int64(p->size));
2213 	//union
2214 	//__s32 value;
2215 	//__s64 value64;
2216 	//char *string;
2217 	//__u8 *p_u8;
2218 	//__u16 *p_u16;
2219 	//__u32 *p_u32;
2220 	//__s32 *p_s32;
2221 	//__s64 *p_s64;
2222 	//struct v4l2_area *p_area;
2223 	//struct v4l2_ctrl_h264_sps *p_h264_sps;
2224 	//struct v4l2_ctrl_h264_pps *p_h264_pps;
2225 	//struct v4l2_ctrl_h264_scaling_matrix *p_h264_scaling_matrix;
2226 	//struct v4l2_ctrl_h264_pred_weights *p_h264_pred_weights;
2227 	//struct v4l2_ctrl_h264_slice_params *p_h264_slice_params;
2228 	//struct v4l2_ctrl_h264_decode_params *p_h264_decode_params;
2229 	//struct v4l2_ctrl_fwht_params *p_fwht_params;
2230 	//struct v4l2_ctrl_vp8_frame *p_vp8_frame;
2231 	//struct v4l2_ctrl_mpeg2_sequence *p_mpeg2_sequence;
2232 	//struct v4l2_ctrl_mpeg2_picture *p_mpeg2_picture;
2233 	//struct v4l2_ctrl_mpeg2_quantisation *p_mpeg2_quantisation;
2234 	//struct v4l2_ctrl_vp9_compressed_hdr *p_vp9_compressed_hdr_probs;
2235 	//struct v4l2_ctrl_vp9_frame *p_vp9_frame;
2236 	//struct v4l2_ctrl_hevc_sps *p_hevc_sps;
2237 	//struct v4l2_ctrl_hevc_pps *p_hevc_pps;
2238 	//struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params;
2239 	//struct v4l2_ctrl_hevc_scaling_matrix *p_hevc_scaling_matrix;
2240 	//struct v4l2_ctrl_hevc_decode_params *p_hevc_decode_params;
2241 	//struct v4l2_ctrl_av1_sequence *p_av1_sequence;
2242 	//struct v4l2_ctrl_av1_tile_group_entry *p_av1_tile_group_entry;
2243 	//struct v4l2_ctrl_av1_frame *p_av1_frame;
2244 	//struct v4l2_ctrl_av1_film_grain *p_av1_film_grain;
2245 	//struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll_info;
2246 	//struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering_display;
2247 	//void *ptr;
2248 	//end of union 	} __attribute__ ((packed));
2249 
2250 	if (key_name.empty())
2251 		json_object_object_add(parent_obj, "v4l2_ext_control", v4l2_ext_control_obj);
2252 	else
2253 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_ext_control_obj);
2254 }
2255 
trace_v4l2_ext_controls_gen(void * arg,json_object * parent_obj,std::string key_name="")2256 void trace_v4l2_ext_controls_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2257 {
2258 	json_object *v4l2_ext_controls_obj = json_object_new_object();
2259 	struct v4l2_ext_controls *p = static_cast<struct v4l2_ext_controls*>(arg);
2260 
2261 	//union
2262 	//__u32 ctrl_class;
2263 	//__u32 which;
2264 	//end of union 	};
2265 	json_object_object_add(v4l2_ext_controls_obj, "count", json_object_new_int64(p->count));
2266 	json_object_object_add(v4l2_ext_controls_obj, "error_idx", json_object_new_int64(p->error_idx));
2267 	json_object_object_add(v4l2_ext_controls_obj, "request_fd", json_object_new_int(p->request_fd));
2268 	//struct v4l2_ext_control *controls;
2269 
2270 	if (key_name.empty())
2271 		json_object_object_add(parent_obj, "v4l2_ext_controls", v4l2_ext_controls_obj);
2272 	else
2273 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_ext_controls_obj);
2274 }
2275 
trace_v4l2_queryctrl_gen(void * arg,json_object * parent_obj,std::string key_name="")2276 void trace_v4l2_queryctrl_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2277 {
2278 	json_object *v4l2_queryctrl_obj = json_object_new_object();
2279 	struct v4l2_queryctrl *p = static_cast<struct v4l2_queryctrl*>(arg);
2280 
2281 	json_object_object_add(v4l2_queryctrl_obj, "id", json_object_new_string(val2s(p->id, control_val_def).c_str()));
2282 	json_object_object_add(v4l2_queryctrl_obj, "type", json_object_new_string(val2s(p->type, v4l2_ctrl_type_val_def).c_str()));
2283 	json_object_object_add(v4l2_queryctrl_obj, "name", json_object_new_string(reinterpret_cast<const char *>(p->name)));
2284 	json_object_object_add(v4l2_queryctrl_obj, "minimum", json_object_new_int(p->minimum));
2285 	json_object_object_add(v4l2_queryctrl_obj, "maximum", json_object_new_int(p->maximum));
2286 	json_object_object_add(v4l2_queryctrl_obj, "step", json_object_new_int(p->step));
2287 	json_object_object_add(v4l2_queryctrl_obj, "default_value", json_object_new_int(p->default_value));
2288 	json_object_object_add(v4l2_queryctrl_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_ctrl_flag_def).c_str()));
2289 
2290 	if (key_name.empty())
2291 		json_object_object_add(parent_obj, "v4l2_queryctrl", v4l2_queryctrl_obj);
2292 	else
2293 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_queryctrl_obj);
2294 }
2295 
trace_v4l2_query_ext_ctrl_gen(void * arg,json_object * parent_obj,std::string key_name="")2296 void trace_v4l2_query_ext_ctrl_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2297 {
2298 	json_object *v4l2_query_ext_ctrl_obj = json_object_new_object();
2299 	struct v4l2_query_ext_ctrl *p = static_cast<struct v4l2_query_ext_ctrl*>(arg);
2300 
2301 	json_object_object_add(v4l2_query_ext_ctrl_obj, "id", json_object_new_string(val2s(p->id, control_val_def).c_str()));
2302 	json_object_object_add(v4l2_query_ext_ctrl_obj, "type", json_object_new_string(val2s(p->type, v4l2_ctrl_type_val_def).c_str()));
2303 	json_object_object_add(v4l2_query_ext_ctrl_obj, "name", json_object_new_string(reinterpret_cast<const char *>(p->name)));
2304 	json_object_object_add(v4l2_query_ext_ctrl_obj, "minimum", json_object_new_int64(p->minimum));
2305 	json_object_object_add(v4l2_query_ext_ctrl_obj, "maximum", json_object_new_int64(p->maximum));
2306 	json_object_object_add(v4l2_query_ext_ctrl_obj, "step", json_object_new_uint64(p->step));
2307 	json_object_object_add(v4l2_query_ext_ctrl_obj, "default_value", json_object_new_int64(p->default_value));
2308 	json_object_object_add(v4l2_query_ext_ctrl_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_ctrl_flag_def).c_str()));
2309 	json_object_object_add(v4l2_query_ext_ctrl_obj, "elem_size", json_object_new_int64(p->elem_size));
2310 	json_object_object_add(v4l2_query_ext_ctrl_obj, "elems", json_object_new_int64(p->elems));
2311 	json_object_object_add(v4l2_query_ext_ctrl_obj, "nr_of_dims", json_object_new_int64(p->nr_of_dims));
2312 	/* __u32                dims[V4L2_CTRL_MAX_DIMS]; */
2313 	json_object *dims_obj = json_object_new_array();
2314 	for (int i = 0; i < (std::min((int) p->nr_of_dims, V4L2_CTRL_MAX_DIMS)); i++) {
2315 		json_object_array_add(dims_obj, json_object_new_int64(p->dims[i]));
2316 	}
2317 	json_object_object_add(v4l2_query_ext_ctrl_obj, "dims", dims_obj);
2318 
2319 	if (key_name.empty())
2320 		json_object_object_add(parent_obj, "v4l2_query_ext_ctrl", v4l2_query_ext_ctrl_obj);
2321 	else
2322 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_query_ext_ctrl_obj);
2323 }
2324 
trace_v4l2_querymenu_gen(void * arg,json_object * parent_obj,std::string key_name="")2325 void trace_v4l2_querymenu_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2326 {
2327 	json_object *v4l2_querymenu_obj = json_object_new_object();
2328 	struct v4l2_querymenu *p = static_cast<struct v4l2_querymenu*>(arg);
2329 
2330 	json_object_object_add(v4l2_querymenu_obj, "id", json_object_new_string(val2s(p->id, control_val_def).c_str()));
2331 	json_object_object_add(v4l2_querymenu_obj, "index", json_object_new_int64(p->index));
2332 	//union
2333 	//__u8	name[32];
2334 	//__s64	value;
2335 	//end of union 	};
2336 
2337 	if (key_name.empty())
2338 		json_object_object_add(parent_obj, "v4l2_querymenu", v4l2_querymenu_obj);
2339 	else
2340 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_querymenu_obj);
2341 }
2342 
trace_v4l2_tuner_gen(void * arg,json_object * parent_obj,std::string key_name="")2343 void trace_v4l2_tuner_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2344 {
2345 	json_object *v4l2_tuner_obj = json_object_new_object();
2346 	struct v4l2_tuner *p = static_cast<struct v4l2_tuner*>(arg);
2347 
2348 	json_object_object_add(v4l2_tuner_obj, "index", json_object_new_int64(p->index));
2349 	json_object_object_add(v4l2_tuner_obj, "name", json_object_new_string(reinterpret_cast<const char *>(p->name)));
2350 	json_object_object_add(v4l2_tuner_obj, "type", json_object_new_string(val2s(p->type, v4l2_tuner_type_val_def).c_str()));
2351 	json_object_object_add(v4l2_tuner_obj, "capability", json_object_new_string(fl2s(p->capability, tuner_cap_flag_def).c_str()));
2352 	json_object_object_add(v4l2_tuner_obj, "rangelow", json_object_new_int64(p->rangelow));
2353 	json_object_object_add(v4l2_tuner_obj, "rangehigh", json_object_new_int64(p->rangehigh));
2354 	json_object_object_add(v4l2_tuner_obj, "rxsubchans", json_object_new_string(fl2s(p->rxsubchans, tuner_rxsub_flag_def).c_str()));
2355 	json_object_object_add(v4l2_tuner_obj, "audmode", json_object_new_string(val2s(p->audmode, tuner_audmode_val_def).c_str()));
2356 	json_object_object_add(v4l2_tuner_obj, "signal", json_object_new_int(p->signal));
2357 	json_object_object_add(v4l2_tuner_obj, "afc", json_object_new_int(p->afc));
2358 
2359 	if (key_name.empty())
2360 		json_object_object_add(parent_obj, "v4l2_tuner", v4l2_tuner_obj);
2361 	else
2362 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_tuner_obj);
2363 }
2364 
trace_v4l2_modulator_gen(void * arg,json_object * parent_obj,std::string key_name="")2365 void trace_v4l2_modulator_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2366 {
2367 	json_object *v4l2_modulator_obj = json_object_new_object();
2368 	struct v4l2_modulator *p = static_cast<struct v4l2_modulator*>(arg);
2369 
2370 	json_object_object_add(v4l2_modulator_obj, "index", json_object_new_int64(p->index));
2371 	json_object_object_add(v4l2_modulator_obj, "name", json_object_new_string(reinterpret_cast<const char *>(p->name)));
2372 	json_object_object_add(v4l2_modulator_obj, "capability", json_object_new_int64(p->capability));
2373 	json_object_object_add(v4l2_modulator_obj, "rangelow", json_object_new_int64(p->rangelow));
2374 	json_object_object_add(v4l2_modulator_obj, "rangehigh", json_object_new_int64(p->rangehigh));
2375 	json_object_object_add(v4l2_modulator_obj, "txsubchans", json_object_new_int64(p->txsubchans));
2376 	json_object_object_add(v4l2_modulator_obj, "type", json_object_new_string(val2s(p->type, nullptr).c_str()));
2377 
2378 	if (key_name.empty())
2379 		json_object_object_add(parent_obj, "v4l2_modulator", v4l2_modulator_obj);
2380 	else
2381 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_modulator_obj);
2382 }
2383 
trace_v4l2_frequency_gen(void * arg,json_object * parent_obj,std::string key_name="")2384 void trace_v4l2_frequency_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2385 {
2386 	json_object *v4l2_frequency_obj = json_object_new_object();
2387 	struct v4l2_frequency *p = static_cast<struct v4l2_frequency*>(arg);
2388 
2389 	json_object_object_add(v4l2_frequency_obj, "tuner", json_object_new_int64(p->tuner));
2390 	json_object_object_add(v4l2_frequency_obj, "type", json_object_new_string(val2s(p->type, v4l2_tuner_type_val_def).c_str()));
2391 	json_object_object_add(v4l2_frequency_obj, "frequency", json_object_new_int64(p->frequency));
2392 
2393 	if (key_name.empty())
2394 		json_object_object_add(parent_obj, "v4l2_frequency", v4l2_frequency_obj);
2395 	else
2396 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_frequency_obj);
2397 }
2398 
trace_v4l2_frequency_band_gen(void * arg,json_object * parent_obj,std::string key_name="")2399 void trace_v4l2_frequency_band_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2400 {
2401 	json_object *v4l2_frequency_band_obj = json_object_new_object();
2402 	struct v4l2_frequency_band *p = static_cast<struct v4l2_frequency_band*>(arg);
2403 
2404 	json_object_object_add(v4l2_frequency_band_obj, "tuner", json_object_new_int64(p->tuner));
2405 	json_object_object_add(v4l2_frequency_band_obj, "type", json_object_new_string(val2s(p->type, nullptr).c_str()));
2406 	json_object_object_add(v4l2_frequency_band_obj, "index", json_object_new_int64(p->index));
2407 	json_object_object_add(v4l2_frequency_band_obj, "capability", json_object_new_int64(p->capability));
2408 	json_object_object_add(v4l2_frequency_band_obj, "rangelow", json_object_new_int64(p->rangelow));
2409 	json_object_object_add(v4l2_frequency_band_obj, "rangehigh", json_object_new_int64(p->rangehigh));
2410 	json_object_object_add(v4l2_frequency_band_obj, "modulation", json_object_new_int64(p->modulation));
2411 
2412 	if (key_name.empty())
2413 		json_object_object_add(parent_obj, "v4l2_frequency_band", v4l2_frequency_band_obj);
2414 	else
2415 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_frequency_band_obj);
2416 }
2417 
trace_v4l2_hw_freq_seek_gen(void * arg,json_object * parent_obj,std::string key_name="")2418 void trace_v4l2_hw_freq_seek_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2419 {
2420 	json_object *v4l2_hw_freq_seek_obj = json_object_new_object();
2421 	struct v4l2_hw_freq_seek *p = static_cast<struct v4l2_hw_freq_seek*>(arg);
2422 
2423 	json_object_object_add(v4l2_hw_freq_seek_obj, "tuner", json_object_new_int64(p->tuner));
2424 	json_object_object_add(v4l2_hw_freq_seek_obj, "type", json_object_new_string(val2s(p->type, nullptr).c_str()));
2425 	json_object_object_add(v4l2_hw_freq_seek_obj, "seek_upward", json_object_new_int64(p->seek_upward));
2426 	json_object_object_add(v4l2_hw_freq_seek_obj, "wrap_around", json_object_new_int64(p->wrap_around));
2427 	json_object_object_add(v4l2_hw_freq_seek_obj, "spacing", json_object_new_int64(p->spacing));
2428 	json_object_object_add(v4l2_hw_freq_seek_obj, "rangelow", json_object_new_int64(p->rangelow));
2429 	json_object_object_add(v4l2_hw_freq_seek_obj, "rangehigh", json_object_new_int64(p->rangehigh));
2430 
2431 	if (key_name.empty())
2432 		json_object_object_add(parent_obj, "v4l2_hw_freq_seek", v4l2_hw_freq_seek_obj);
2433 	else
2434 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_hw_freq_seek_obj);
2435 }
2436 
trace_v4l2_rds_data_gen(void * arg,json_object * parent_obj,std::string key_name="")2437 void trace_v4l2_rds_data_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2438 {
2439 	json_object *v4l2_rds_data_obj = json_object_new_object();
2440 	struct v4l2_rds_data *p = static_cast<struct v4l2_rds_data*>(arg);
2441 
2442 	json_object_object_add(v4l2_rds_data_obj, "lsb", json_object_new_int(p->lsb));
2443 	json_object_object_add(v4l2_rds_data_obj, "msb", json_object_new_int(p->msb));
2444 	json_object_object_add(v4l2_rds_data_obj, "block", json_object_new_int(p->block));
2445 
2446 	if (key_name.empty())
2447 		json_object_object_add(parent_obj, "v4l2_rds_data", v4l2_rds_data_obj);
2448 	else
2449 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_rds_data_obj);
2450 }
2451 
trace_v4l2_audio_gen(void * arg,json_object * parent_obj,std::string key_name="")2452 void trace_v4l2_audio_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2453 {
2454 	json_object *v4l2_audio_obj = json_object_new_object();
2455 	struct v4l2_audio *p = static_cast<struct v4l2_audio*>(arg);
2456 
2457 	json_object_object_add(v4l2_audio_obj, "index", json_object_new_int64(p->index));
2458 	json_object_object_add(v4l2_audio_obj, "name", json_object_new_string(reinterpret_cast<const char *>(p->name)));
2459 	json_object_object_add(v4l2_audio_obj, "capability", json_object_new_int64(p->capability));
2460 	json_object_object_add(v4l2_audio_obj, "mode", json_object_new_int64(p->mode));
2461 
2462 	if (key_name.empty())
2463 		json_object_object_add(parent_obj, "v4l2_audio", v4l2_audio_obj);
2464 	else
2465 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_audio_obj);
2466 }
2467 
trace_v4l2_audioout_gen(void * arg,json_object * parent_obj,std::string key_name="")2468 void trace_v4l2_audioout_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2469 {
2470 	json_object *v4l2_audioout_obj = json_object_new_object();
2471 	struct v4l2_audioout *p = static_cast<struct v4l2_audioout*>(arg);
2472 
2473 	json_object_object_add(v4l2_audioout_obj, "index", json_object_new_int64(p->index));
2474 	json_object_object_add(v4l2_audioout_obj, "name", json_object_new_string(reinterpret_cast<const char *>(p->name)));
2475 	json_object_object_add(v4l2_audioout_obj, "capability", json_object_new_int64(p->capability));
2476 	json_object_object_add(v4l2_audioout_obj, "mode", json_object_new_int64(p->mode));
2477 
2478 	if (key_name.empty())
2479 		json_object_object_add(parent_obj, "v4l2_audioout", v4l2_audioout_obj);
2480 	else
2481 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_audioout_obj);
2482 }
2483 
trace_v4l2_enc_idx_entry_gen(void * arg,json_object * parent_obj,std::string key_name="")2484 void trace_v4l2_enc_idx_entry_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2485 {
2486 	json_object *v4l2_enc_idx_entry_obj = json_object_new_object();
2487 	struct v4l2_enc_idx_entry *p = static_cast<struct v4l2_enc_idx_entry*>(arg);
2488 
2489 	json_object_object_add(v4l2_enc_idx_entry_obj, "offset", json_object_new_uint64(p->offset));
2490 	json_object_object_add(v4l2_enc_idx_entry_obj, "pts", json_object_new_uint64(p->pts));
2491 	json_object_object_add(v4l2_enc_idx_entry_obj, "length", json_object_new_int64(p->length));
2492 	json_object_object_add(v4l2_enc_idx_entry_obj, "flags", json_object_new_string(fl2s(p->flags, nullptr).c_str()));
2493 
2494 	if (key_name.empty())
2495 		json_object_object_add(parent_obj, "v4l2_enc_idx_entry", v4l2_enc_idx_entry_obj);
2496 	else
2497 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_enc_idx_entry_obj);
2498 }
2499 
trace_v4l2_enc_idx_gen(void * arg,json_object * parent_obj,std::string key_name="")2500 void trace_v4l2_enc_idx_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2501 {
2502 	json_object *v4l2_enc_idx_obj = json_object_new_object();
2503 	struct v4l2_enc_idx *p = static_cast<struct v4l2_enc_idx*>(arg);
2504 
2505 	json_object_object_add(v4l2_enc_idx_obj, "entries", json_object_new_int64(p->entries));
2506 	json_object_object_add(v4l2_enc_idx_obj, "entries_cap", json_object_new_int64(p->entries_cap));
2507 	//struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES];
2508 
2509 	if (key_name.empty())
2510 		json_object_object_add(parent_obj, "v4l2_enc_idx", v4l2_enc_idx_obj);
2511 	else
2512 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_enc_idx_obj);
2513 }
2514 
trace_v4l2_encoder_cmd_gen(void * arg,json_object * parent_obj,std::string key_name="")2515 void trace_v4l2_encoder_cmd_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2516 {
2517 	json_object *v4l2_encoder_cmd_obj = json_object_new_object();
2518 	struct v4l2_encoder_cmd *p = static_cast<struct v4l2_encoder_cmd*>(arg);
2519 
2520 	json_object_object_add(v4l2_encoder_cmd_obj, "cmd", json_object_new_string(val2s(p->cmd, encoder_cmd_val_def).c_str()));
2521 	json_object_object_add(v4l2_encoder_cmd_obj, "flags", json_object_new_string(fl2s(p->flags, nullptr).c_str()));
2522 	//union
2523 	//struct {
2524 	//__u32 data[8];
2525 	//end of union 		} raw;
2526 
2527 	if (key_name.empty())
2528 		json_object_object_add(parent_obj, "v4l2_encoder_cmd", v4l2_encoder_cmd_obj);
2529 	else
2530 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_encoder_cmd_obj);
2531 }
2532 
trace_v4l2_decoder_cmd_gen(void * arg,json_object * parent_obj,std::string key_name="")2533 void trace_v4l2_decoder_cmd_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2534 {
2535 	json_object *v4l2_decoder_cmd_obj = json_object_new_object();
2536 	struct v4l2_decoder_cmd *p = static_cast<struct v4l2_decoder_cmd*>(arg);
2537 
2538 	json_object_object_add(v4l2_decoder_cmd_obj, "cmd", json_object_new_string(val2s(p->cmd, decoder_cmd_val_def).c_str()));
2539 	json_object_object_add(v4l2_decoder_cmd_obj, "flags", json_object_new_string(fl2s(p->flags, nullptr).c_str()));
2540 	//union
2541 	//struct {
2542 	//__u64 pts;
2543 	//end of union 		} stop;
2544 	//struct {
2545 	//__s32 speed;
2546 	//__u32 format;
2547 	//end of struct 		} start;
2548 	//struct {
2549 	//__u32 data[16];
2550 	//end of struct 		} raw;
2551 
2552 	if (key_name.empty())
2553 		json_object_object_add(parent_obj, "v4l2_decoder_cmd", v4l2_decoder_cmd_obj);
2554 	else
2555 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_decoder_cmd_obj);
2556 }
2557 
trace_v4l2_vbi_format_gen(void * arg,json_object * parent_obj,std::string key_name="")2558 void trace_v4l2_vbi_format_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2559 {
2560 	json_object *v4l2_vbi_format_obj = json_object_new_object();
2561 	struct v4l2_vbi_format *p = static_cast<struct v4l2_vbi_format*>(arg);
2562 
2563 	json_object_object_add(v4l2_vbi_format_obj, "sampling_rate", json_object_new_int64(p->sampling_rate));
2564 	json_object_object_add(v4l2_vbi_format_obj, "offset", json_object_new_int64(p->offset));
2565 	json_object_object_add(v4l2_vbi_format_obj, "samples_per_line", json_object_new_int64(p->samples_per_line));
2566 	json_object_object_add(v4l2_vbi_format_obj, "sample_format", json_object_new_int64(p->sample_format));
2567 	json_object_object_add(v4l2_vbi_format_obj, "start", json_object_new_string(reinterpret_cast<const char *>(p->start)));
2568 	json_object_object_add(v4l2_vbi_format_obj, "count", json_object_new_string(reinterpret_cast<const char *>(p->count)));
2569 	json_object_object_add(v4l2_vbi_format_obj, "flags", json_object_new_string(fl2s(p->flags, nullptr).c_str()));
2570 
2571 	if (key_name.empty())
2572 		json_object_object_add(parent_obj, "v4l2_vbi_format", v4l2_vbi_format_obj);
2573 	else
2574 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_vbi_format_obj);
2575 }
2576 
trace_v4l2_sliced_vbi_format_gen(void * arg,json_object * parent_obj,std::string key_name="")2577 void trace_v4l2_sliced_vbi_format_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2578 {
2579 	json_object *v4l2_sliced_vbi_format_obj = json_object_new_object();
2580 	struct v4l2_sliced_vbi_format *p = static_cast<struct v4l2_sliced_vbi_format*>(arg);
2581 
2582 	json_object_object_add(v4l2_sliced_vbi_format_obj, "service_set", json_object_new_int(p->service_set));
2583 	//__u16   service_lines[2][24];
2584 	json_object_object_add(v4l2_sliced_vbi_format_obj, "io_size", json_object_new_int64(p->io_size));
2585 
2586 	if (key_name.empty())
2587 		json_object_object_add(parent_obj, "v4l2_sliced_vbi_format", v4l2_sliced_vbi_format_obj);
2588 	else
2589 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_sliced_vbi_format_obj);
2590 }
2591 
trace_v4l2_sliced_vbi_cap_gen(void * arg,json_object * parent_obj,std::string key_name="")2592 void trace_v4l2_sliced_vbi_cap_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2593 {
2594 	json_object *v4l2_sliced_vbi_cap_obj = json_object_new_object();
2595 	struct v4l2_sliced_vbi_cap *p = static_cast<struct v4l2_sliced_vbi_cap*>(arg);
2596 
2597 	json_object_object_add(v4l2_sliced_vbi_cap_obj, "service_set", json_object_new_int(p->service_set));
2598 	//__u16   service_lines[2][24];
2599 	json_object_object_add(v4l2_sliced_vbi_cap_obj, "type", json_object_new_string(val2s(p->type, v4l2_buf_type_val_def).c_str()));
2600 
2601 	if (key_name.empty())
2602 		json_object_object_add(parent_obj, "v4l2_sliced_vbi_cap", v4l2_sliced_vbi_cap_obj);
2603 	else
2604 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_sliced_vbi_cap_obj);
2605 }
2606 
trace_v4l2_sliced_vbi_data_gen(void * arg,json_object * parent_obj,std::string key_name="")2607 void trace_v4l2_sliced_vbi_data_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2608 {
2609 	json_object *v4l2_sliced_vbi_data_obj = json_object_new_object();
2610 	struct v4l2_sliced_vbi_data *p = static_cast<struct v4l2_sliced_vbi_data*>(arg);
2611 
2612 	json_object_object_add(v4l2_sliced_vbi_data_obj, "id", json_object_new_string(val2s(p->id, nullptr).c_str()));
2613 	json_object_object_add(v4l2_sliced_vbi_data_obj, "field", json_object_new_string(val2s(p->field, nullptr).c_str()));
2614 	json_object_object_add(v4l2_sliced_vbi_data_obj, "line", json_object_new_int64(p->line));
2615 	json_object_object_add(v4l2_sliced_vbi_data_obj, "data", json_object_new_string(reinterpret_cast<const char *>(p->data)));
2616 
2617 	if (key_name.empty())
2618 		json_object_object_add(parent_obj, "v4l2_sliced_vbi_data", v4l2_sliced_vbi_data_obj);
2619 	else
2620 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_sliced_vbi_data_obj);
2621 }
2622 
trace_v4l2_mpeg_vbi_itv0_line_gen(void * arg,json_object * parent_obj,std::string key_name="")2623 void trace_v4l2_mpeg_vbi_itv0_line_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2624 {
2625 	json_object *v4l2_mpeg_vbi_itv0_line_obj = json_object_new_object();
2626 	struct v4l2_mpeg_vbi_itv0_line *p = static_cast<struct v4l2_mpeg_vbi_itv0_line*>(arg);
2627 
2628 	json_object_object_add(v4l2_mpeg_vbi_itv0_line_obj, "id", json_object_new_string(val2s(p->id, nullptr).c_str()));
2629 	json_object_object_add(v4l2_mpeg_vbi_itv0_line_obj, "data", json_object_new_string(reinterpret_cast<const char *>(p->data)));
2630 
2631 	if (key_name.empty())
2632 		json_object_object_add(parent_obj, "v4l2_mpeg_vbi_itv0_line", v4l2_mpeg_vbi_itv0_line_obj);
2633 	else
2634 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_mpeg_vbi_itv0_line_obj);
2635 }
2636 
trace_v4l2_mpeg_vbi_itv0_gen(void * arg,json_object * parent_obj,std::string key_name="")2637 void trace_v4l2_mpeg_vbi_itv0_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2638 {
2639 	json_object *v4l2_mpeg_vbi_itv0_obj = json_object_new_object();
2640 	struct v4l2_mpeg_vbi_itv0 *p = static_cast<struct v4l2_mpeg_vbi_itv0*>(arg);
2641 
2642 	json_object_object_add(v4l2_mpeg_vbi_itv0_obj, "linemask", json_object_new_string(reinterpret_cast<const char *>(p->linemask)));
2643 	//struct v4l2_mpeg_vbi_itv0_line line[35];
2644 
2645 	if (key_name.empty())
2646 		json_object_object_add(parent_obj, "v4l2_mpeg_vbi_itv0", v4l2_mpeg_vbi_itv0_obj);
2647 	else
2648 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_mpeg_vbi_itv0_obj);
2649 }
2650 
trace_v4l2_mpeg_vbi_fmt_ivtv_gen(void * arg,json_object * parent_obj,std::string key_name="")2651 void trace_v4l2_mpeg_vbi_fmt_ivtv_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2652 {
2653 	json_object *v4l2_mpeg_vbi_fmt_ivtv_obj = json_object_new_object();
2654 	struct v4l2_mpeg_vbi_fmt_ivtv *p = static_cast<struct v4l2_mpeg_vbi_fmt_ivtv*>(arg);
2655 
2656 	json_object_object_add(v4l2_mpeg_vbi_fmt_ivtv_obj, "magic", json_object_new_string(reinterpret_cast<const char *>(p->magic)));
2657 	//union
2658 	//struct v4l2_mpeg_vbi_itv0 itv0;
2659 	//struct v4l2_mpeg_vbi_ITV0 ITV0;
2660 	//end of union 	};
2661 
2662 	if (key_name.empty())
2663 		json_object_object_add(parent_obj, "v4l2_mpeg_vbi_fmt_ivtv", v4l2_mpeg_vbi_fmt_ivtv_obj);
2664 	else
2665 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_mpeg_vbi_fmt_ivtv_obj);
2666 }
2667 
trace_v4l2_plane_pix_format_gen(void * arg,json_object * parent_obj,std::string key_name="")2668 void trace_v4l2_plane_pix_format_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2669 {
2670 	json_object *v4l2_plane_pix_format_obj = json_object_new_object();
2671 	struct v4l2_plane_pix_format *p = static_cast<struct v4l2_plane_pix_format*>(arg);
2672 
2673 	json_object_object_add(v4l2_plane_pix_format_obj, "sizeimage", json_object_new_int64(p->sizeimage));
2674 	json_object_object_add(v4l2_plane_pix_format_obj, "bytesperline", json_object_new_int64(p->bytesperline));
2675 
2676 	if (key_name.empty())
2677 		json_object_object_add(parent_obj, "v4l2_plane_pix_format", v4l2_plane_pix_format_obj);
2678 	else
2679 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_plane_pix_format_obj);
2680 }
2681 
trace_v4l2_pix_format_mplane_gen(void * arg,json_object * parent_obj,std::string key_name="")2682 void trace_v4l2_pix_format_mplane_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2683 {
2684 	json_object *v4l2_pix_format_mplane_obj = json_object_new_object();
2685 	struct v4l2_pix_format_mplane *p = static_cast<struct v4l2_pix_format_mplane*>(arg);
2686 
2687 	json_object_object_add(v4l2_pix_format_mplane_obj, "width", json_object_new_int64(p->width));
2688 	json_object_object_add(v4l2_pix_format_mplane_obj, "height", json_object_new_int64(p->height));
2689 	json_object_object_add(v4l2_pix_format_mplane_obj, "pixelformat", json_object_new_string(val2s(p->pixelformat, v4l2_pix_fmt_val_def).c_str()));
2690 	json_object_object_add(v4l2_pix_format_mplane_obj, "field", json_object_new_string(val2s(p->field, v4l2_field_val_def).c_str()));
2691 	json_object_object_add(v4l2_pix_format_mplane_obj, "colorspace", json_object_new_string(val2s(p->colorspace, v4l2_colorspace_val_def).c_str()));
2692 	//struct v4l2_plane_pix_format	plane_fmt[VIDEO_MAX_PLANES];
2693 	json_object_object_add(v4l2_pix_format_mplane_obj, "num_planes", json_object_new_int(p->num_planes));
2694 	json_object *plane_fmt_obj = json_object_new_array();
2695 	for (int i = 0; i < (std::min((int) p->num_planes, VIDEO_MAX_PLANES)); i++) {
2696 		json_object *element_obj = json_object_new_object();
2697 		trace_v4l2_plane_pix_format_gen(&(p->plane_fmt[i]), element_obj);
2698 		json_object *element_no_key_obj;
2699 		json_object_object_get_ex(element_obj, "v4l2_plane_pix_format", &element_no_key_obj);
2700 		json_object_array_add(plane_fmt_obj, element_no_key_obj);
2701 	}
2702 	json_object_object_add(v4l2_pix_format_mplane_obj, "plane_fmt", plane_fmt_obj);
2703 
2704 	json_object_object_add(v4l2_pix_format_mplane_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_pix_fmt_flag_def).c_str()));
2705 	//union
2706 	json_object_object_add(v4l2_pix_format_mplane_obj, "ycbcr_enc", json_object_new_string(val2s(p->ycbcr_enc, v4l2_ycbcr_encoding_val_def).c_str()));
2707 	json_object_object_add(v4l2_pix_format_mplane_obj, "hsv_enc", json_object_new_int(p->hsv_enc));
2708 	//end of union 	};
2709 	json_object_object_add(v4l2_pix_format_mplane_obj, "quantization", json_object_new_string(val2s(p->quantization, v4l2_quantization_val_def).c_str()));
2710 	json_object_object_add(v4l2_pix_format_mplane_obj, "xfer_func", json_object_new_string(val2s(p->xfer_func, v4l2_xfer_func_val_def).c_str()));
2711 
2712 	if (key_name.empty())
2713 		json_object_object_add(parent_obj, "v4l2_pix_format_mplane", v4l2_pix_format_mplane_obj);
2714 	else
2715 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_pix_format_mplane_obj);
2716 }
2717 
trace_v4l2_sdr_format_gen(void * arg,json_object * parent_obj,std::string key_name="")2718 void trace_v4l2_sdr_format_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2719 {
2720 	json_object *v4l2_sdr_format_obj = json_object_new_object();
2721 	struct v4l2_sdr_format *p = static_cast<struct v4l2_sdr_format*>(arg);
2722 
2723 	json_object_object_add(v4l2_sdr_format_obj, "pixelformat", json_object_new_string(val2s(p->pixelformat, v4l2_pix_fmt_val_def).c_str()));
2724 	json_object_object_add(v4l2_sdr_format_obj, "buffersize", json_object_new_int64(p->buffersize));
2725 
2726 	if (key_name.empty())
2727 		json_object_object_add(parent_obj, "v4l2_sdr_format", v4l2_sdr_format_obj);
2728 	else
2729 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_sdr_format_obj);
2730 }
2731 
trace_v4l2_meta_format_gen(void * arg,json_object * parent_obj,std::string key_name="")2732 void trace_v4l2_meta_format_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2733 {
2734 	json_object *v4l2_meta_format_obj = json_object_new_object();
2735 	struct v4l2_meta_format *p = static_cast<struct v4l2_meta_format*>(arg);
2736 
2737 	json_object_object_add(v4l2_meta_format_obj, "dataformat", json_object_new_int64(p->dataformat));
2738 	json_object_object_add(v4l2_meta_format_obj, "buffersize", json_object_new_int64(p->buffersize));
2739 	json_object_object_add(v4l2_meta_format_obj, "width", json_object_new_int64(p->width));
2740 	json_object_object_add(v4l2_meta_format_obj, "height", json_object_new_int64(p->height));
2741 	json_object_object_add(v4l2_meta_format_obj, "bytesperline", json_object_new_int64(p->bytesperline));
2742 
2743 	if (key_name.empty())
2744 		json_object_object_add(parent_obj, "v4l2_meta_format", v4l2_meta_format_obj);
2745 	else
2746 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_meta_format_obj);
2747 }
2748 
trace_v4l2_format_gen(void * arg,json_object * parent_obj,std::string key_name="")2749 void trace_v4l2_format_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2750 {
2751 	json_object *v4l2_format_obj = json_object_new_object();
2752 	struct v4l2_format *p = static_cast<struct v4l2_format*>(arg);
2753 
2754 	json_object_object_add(v4l2_format_obj, "type", json_object_new_string(val2s(p->type, v4l2_buf_type_val_def).c_str()));
2755 	//union
2756 	switch (p->type) {
2757 	case V4L2_BUF_TYPE_VIDEO_CAPTURE:
2758 	case V4L2_BUF_TYPE_VIDEO_OUTPUT:
2759 		trace_v4l2_pix_format_gen(&p->fmt.pix, v4l2_format_obj);
2760 		break;
2761 	case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
2762 	case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
2763 		trace_v4l2_pix_format_mplane_gen(&p->fmt.pix, v4l2_format_obj);
2764 		break;
2765 	default:
2766 		break;
2767 	}
2768 	//struct v4l2_pix_format		pix;
2769 	//struct v4l2_pix_format_mplane	pix_mp;
2770 	//struct v4l2_window		win;
2771 	//struct v4l2_vbi_format		vbi;
2772 	//struct v4l2_sliced_vbi_format	sliced;
2773 	//struct v4l2_sdr_format		sdr;
2774 	//struct v4l2_meta_format		meta;
2775 	//end of union 	} fmt;
2776 
2777 	if (key_name.empty())
2778 		json_object_object_add(parent_obj, "v4l2_format", v4l2_format_obj);
2779 	else
2780 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_format_obj);
2781 }
2782 
trace_v4l2_streamparm_gen(void * arg,json_object * parent_obj,std::string key_name="")2783 void trace_v4l2_streamparm_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2784 {
2785 	json_object *v4l2_streamparm_obj = json_object_new_object();
2786 	struct v4l2_streamparm *p = static_cast<struct v4l2_streamparm*>(arg);
2787 
2788 	json_object_object_add(v4l2_streamparm_obj, "type", json_object_new_string(val2s(p->type, v4l2_buf_type_val_def).c_str()));
2789 	//union
2790 	//struct v4l2_captureparm	capture;
2791 	//struct v4l2_outputparm	output;
2792 	//end of union 	} parm;
2793 
2794 	if (key_name.empty())
2795 		json_object_object_add(parent_obj, "v4l2_streamparm", v4l2_streamparm_obj);
2796 	else
2797 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_streamparm_obj);
2798 }
2799 
trace_v4l2_event_vsync_gen(void * arg,json_object * parent_obj,std::string key_name="")2800 void trace_v4l2_event_vsync_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2801 {
2802 	json_object *v4l2_event_vsync_obj = json_object_new_object();
2803 	struct v4l2_event_vsync *p = static_cast<struct v4l2_event_vsync*>(arg);
2804 
2805 	json_object_object_add(v4l2_event_vsync_obj, "field", json_object_new_string(val2s(p->field, v4l2_field_val_def).c_str()));
2806 
2807 	if (key_name.empty())
2808 		json_object_object_add(parent_obj, "v4l2_event_vsync", v4l2_event_vsync_obj);
2809 	else
2810 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_event_vsync_obj);
2811 }
2812 
trace_v4l2_event_ctrl_gen(void * arg,json_object * parent_obj,std::string key_name="")2813 void trace_v4l2_event_ctrl_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2814 {
2815 	json_object *v4l2_event_ctrl_obj = json_object_new_object();
2816 	struct v4l2_event_ctrl *p = static_cast<struct v4l2_event_ctrl*>(arg);
2817 
2818 	json_object_object_add(v4l2_event_ctrl_obj, "changes", json_object_new_string(fl2s(p->changes, v4l2_event_ctrl_ch_flag_def).c_str()));
2819 	json_object_object_add(v4l2_event_ctrl_obj, "type", json_object_new_string(val2s(p->type, v4l2_ctrl_type_val_def).c_str()));
2820 	//union
2821 	//__s32 value;
2822 	//__s64 value64;
2823 	//end of union 	};
2824 	json_object_object_add(v4l2_event_ctrl_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_ctrl_flag_def).c_str()));
2825 	json_object_object_add(v4l2_event_ctrl_obj, "minimum", json_object_new_int(p->minimum));
2826 	json_object_object_add(v4l2_event_ctrl_obj, "maximum", json_object_new_int(p->maximum));
2827 	json_object_object_add(v4l2_event_ctrl_obj, "step", json_object_new_int(p->step));
2828 	json_object_object_add(v4l2_event_ctrl_obj, "default_value", json_object_new_int(p->default_value));
2829 
2830 	if (key_name.empty())
2831 		json_object_object_add(parent_obj, "v4l2_event_ctrl", v4l2_event_ctrl_obj);
2832 	else
2833 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_event_ctrl_obj);
2834 }
2835 
trace_v4l2_event_frame_sync_gen(void * arg,json_object * parent_obj,std::string key_name="")2836 void trace_v4l2_event_frame_sync_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2837 {
2838 	json_object *v4l2_event_frame_sync_obj = json_object_new_object();
2839 	struct v4l2_event_frame_sync *p = static_cast<struct v4l2_event_frame_sync*>(arg);
2840 
2841 	json_object_object_add(v4l2_event_frame_sync_obj, "frame_sequence", json_object_new_int64(p->frame_sequence));
2842 
2843 	if (key_name.empty())
2844 		json_object_object_add(parent_obj, "v4l2_event_frame_sync", v4l2_event_frame_sync_obj);
2845 	else
2846 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_event_frame_sync_obj);
2847 }
2848 
trace_v4l2_event_src_change_gen(void * arg,json_object * parent_obj,std::string key_name="")2849 void trace_v4l2_event_src_change_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2850 {
2851 	json_object *v4l2_event_src_change_obj = json_object_new_object();
2852 	struct v4l2_event_src_change *p = static_cast<struct v4l2_event_src_change*>(arg);
2853 
2854 	json_object_object_add(v4l2_event_src_change_obj, "changes", json_object_new_int64(p->changes));
2855 
2856 	if (key_name.empty())
2857 		json_object_object_add(parent_obj, "v4l2_event_src_change", v4l2_event_src_change_obj);
2858 	else
2859 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_event_src_change_obj);
2860 }
2861 
trace_v4l2_event_motion_det_gen(void * arg,json_object * parent_obj,std::string key_name="")2862 void trace_v4l2_event_motion_det_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2863 {
2864 	json_object *v4l2_event_motion_det_obj = json_object_new_object();
2865 	struct v4l2_event_motion_det *p = static_cast<struct v4l2_event_motion_det*>(arg);
2866 
2867 	json_object_object_add(v4l2_event_motion_det_obj, "flags", json_object_new_string(fl2s(p->flags, nullptr).c_str()));
2868 	json_object_object_add(v4l2_event_motion_det_obj, "frame_sequence", json_object_new_int64(p->frame_sequence));
2869 	json_object_object_add(v4l2_event_motion_det_obj, "region_mask", json_object_new_int64(p->region_mask));
2870 
2871 	if (key_name.empty())
2872 		json_object_object_add(parent_obj, "v4l2_event_motion_det", v4l2_event_motion_det_obj);
2873 	else
2874 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_event_motion_det_obj);
2875 }
2876 
trace_v4l2_event_gen(void * arg,json_object * parent_obj,std::string key_name="")2877 void trace_v4l2_event_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2878 {
2879 	json_object *v4l2_event_obj = json_object_new_object();
2880 	struct v4l2_event *p = static_cast<struct v4l2_event*>(arg);
2881 
2882 	json_object_object_add(v4l2_event_obj, "type", json_object_new_string(val2s(p->type, event_val_def).c_str()));
2883 	//union
2884 	switch (p->type) {
2885 	case V4L2_EVENT_VSYNC:
2886 		trace_v4l2_event_vsync_gen(&p->u, v4l2_event_obj);
2887 		break;
2888 	case V4L2_EVENT_CTRL:
2889 		trace_v4l2_event_ctrl_gen(&p->u, v4l2_event_obj);
2890 		break;
2891 	case V4L2_EVENT_FRAME_SYNC:
2892 		trace_v4l2_event_frame_sync_gen(&p->u, v4l2_event_obj);
2893 		break;
2894 	case V4L2_EVENT_SOURCE_CHANGE:
2895 		trace_v4l2_event_src_change_gen(&p->u, v4l2_event_obj);
2896 		break;
2897 	case V4L2_EVENT_MOTION_DET:
2898 		trace_v4l2_event_motion_det_gen(&p->u, v4l2_event_obj);
2899 		break;
2900 	default:
2901 		break;
2902 	}
2903 	//struct v4l2_event_vsync		vsync;
2904 	//struct v4l2_event_ctrl		ctrl;
2905 	//struct v4l2_event_frame_sync	frame_sync;
2906 	//struct v4l2_event_src_change	src_change;
2907 	//struct v4l2_event_motion_det	motion_det;
2908 	//__u8				data[64];
2909 	//end of union 	} u;
2910 	json_object_object_add(v4l2_event_obj, "pending", json_object_new_int64(p->pending));
2911 	json_object_object_add(v4l2_event_obj, "sequence", json_object_new_int64(p->sequence));
2912 	//struct timespec			timestamp;
2913 	json_object_object_add(v4l2_event_obj, "id", json_object_new_string(val2s(p->id, nullptr).c_str()));
2914 
2915 	if (key_name.empty())
2916 		json_object_object_add(parent_obj, "v4l2_event", v4l2_event_obj);
2917 	else
2918 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_event_obj);
2919 }
2920 
trace_v4l2_event_subscription_gen(void * arg,json_object * parent_obj,std::string key_name="")2921 void trace_v4l2_event_subscription_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2922 {
2923 	json_object *v4l2_event_subscription_obj = json_object_new_object();
2924 	struct v4l2_event_subscription *p = static_cast<struct v4l2_event_subscription*>(arg);
2925 
2926 	json_object_object_add(v4l2_event_subscription_obj, "type", json_object_new_string(val2s(p->type, event_val_def).c_str()));
2927 	json_object_object_add(v4l2_event_subscription_obj, "id", json_object_new_string(val2s(p->id, nullptr).c_str()));
2928 	json_object_object_add(v4l2_event_subscription_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_event_sub_flag_def).c_str()));
2929 
2930 	if (key_name.empty())
2931 		json_object_object_add(parent_obj, "v4l2_event_subscription", v4l2_event_subscription_obj);
2932 	else
2933 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_event_subscription_obj);
2934 }
2935 
trace_v4l2_dbg_match_gen(void * arg,json_object * parent_obj,std::string key_name="")2936 void trace_v4l2_dbg_match_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2937 {
2938 	json_object *v4l2_dbg_match_obj = json_object_new_object();
2939 	struct v4l2_dbg_match *p = static_cast<struct v4l2_dbg_match*>(arg);
2940 
2941 	json_object_object_add(v4l2_dbg_match_obj, "type", json_object_new_string(val2s(p->type, nullptr).c_str()));
2942 	//union
2943 	//__u32 addr;
2944 	//char name[32];
2945 	//end of union 	};
2946 
2947 	if (key_name.empty())
2948 		json_object_object_add(parent_obj, "v4l2_dbg_match", v4l2_dbg_match_obj);
2949 	else
2950 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_dbg_match_obj);
2951 }
2952 
trace_v4l2_dbg_register_gen(void * arg,json_object * parent_obj,std::string key_name="")2953 void trace_v4l2_dbg_register_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2954 {
2955 	json_object *v4l2_dbg_register_obj = json_object_new_object();
2956 	struct v4l2_dbg_register *p = static_cast<struct v4l2_dbg_register*>(arg);
2957 
2958 	//struct v4l2_dbg_match match;
2959 	trace_v4l2_dbg_match_gen(&p->match, v4l2_dbg_register_obj, "match");
2960 	json_object_object_add(v4l2_dbg_register_obj, "size", json_object_new_int64(p->size));
2961 	json_object_object_add(v4l2_dbg_register_obj, "reg", json_object_new_uint64(p->reg));
2962 	json_object_object_add(v4l2_dbg_register_obj, "val", json_object_new_uint64(p->val));
2963 
2964 	if (key_name.empty())
2965 		json_object_object_add(parent_obj, "v4l2_dbg_register", v4l2_dbg_register_obj);
2966 	else
2967 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_dbg_register_obj);
2968 }
2969 
trace_v4l2_dbg_chip_info_gen(void * arg,json_object * parent_obj,std::string key_name="")2970 void trace_v4l2_dbg_chip_info_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2971 {
2972 	json_object *v4l2_dbg_chip_info_obj = json_object_new_object();
2973 	struct v4l2_dbg_chip_info *p = static_cast<struct v4l2_dbg_chip_info*>(arg);
2974 
2975 	//struct v4l2_dbg_match match;
2976 	trace_v4l2_dbg_match_gen(&p->match, v4l2_dbg_chip_info_obj, "match");
2977 	json_object_object_add(v4l2_dbg_chip_info_obj, "name", json_object_new_string(reinterpret_cast<const char *>(p->name)));
2978 	json_object_object_add(v4l2_dbg_chip_info_obj, "flags", json_object_new_string(fl2s(p->flags, nullptr).c_str()));
2979 
2980 	if (key_name.empty())
2981 		json_object_object_add(parent_obj, "v4l2_dbg_chip_info", v4l2_dbg_chip_info_obj);
2982 	else
2983 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_dbg_chip_info_obj);
2984 }
2985 
trace_v4l2_create_buffers_gen(void * arg,json_object * parent_obj,std::string key_name="")2986 void trace_v4l2_create_buffers_gen(void *arg, json_object *parent_obj, std::string key_name = "")
2987 {
2988 	json_object *v4l2_create_buffers_obj = json_object_new_object();
2989 	struct v4l2_create_buffers *p = static_cast<struct v4l2_create_buffers*>(arg);
2990 
2991 	json_object_object_add(v4l2_create_buffers_obj, "index", json_object_new_int64(p->index));
2992 	json_object_object_add(v4l2_create_buffers_obj, "count", json_object_new_int64(p->count));
2993 	json_object_object_add(v4l2_create_buffers_obj, "memory", json_object_new_string(val2s(p->memory, v4l2_memory_val_def).c_str()));
2994 	//struct v4l2_format	format;
2995 	trace_v4l2_format_gen(&p->format, v4l2_create_buffers_obj, "format");
2996 	json_object_object_add(v4l2_create_buffers_obj, "capabilities", json_object_new_string(fl2s(p->capabilities, v4l2_buf_cap_flag_def).c_str()));
2997 	json_object_object_add(v4l2_create_buffers_obj, "flags", json_object_new_string(fl2s(p->flags, v4l2_memory_flag_def).c_str()));
2998 	json_object_object_add(v4l2_create_buffers_obj, "max_num_buffers", json_object_new_int64(p->max_num_buffers));
2999 
3000 	if (key_name.empty())
3001 		json_object_object_add(parent_obj, "v4l2_create_buffers", v4l2_create_buffers_obj);
3002 	else
3003 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_create_buffers_obj);
3004 }
3005 
trace_v4l2_remove_buffers_gen(void * arg,json_object * parent_obj,std::string key_name="")3006 void trace_v4l2_remove_buffers_gen(void *arg, json_object *parent_obj, std::string key_name = "")
3007 {
3008 	json_object *v4l2_remove_buffers_obj = json_object_new_object();
3009 	struct v4l2_remove_buffers *p = static_cast<struct v4l2_remove_buffers*>(arg);
3010 
3011 	json_object_object_add(v4l2_remove_buffers_obj, "index", json_object_new_int64(p->index));
3012 	json_object_object_add(v4l2_remove_buffers_obj, "count", json_object_new_int64(p->count));
3013 	json_object_object_add(v4l2_remove_buffers_obj, "type", json_object_new_string(val2s(p->type, nullptr).c_str()));
3014 
3015 	if (key_name.empty())
3016 		json_object_object_add(parent_obj, "v4l2_remove_buffers", v4l2_remove_buffers_obj);
3017 	else
3018 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_remove_buffers_obj);
3019 }
3020 
trace_media_device_info_gen(void * arg,json_object * parent_obj,std::string key_name="")3021 void trace_media_device_info_gen(void *arg, json_object *parent_obj, std::string key_name = "")
3022 {
3023 	json_object *media_device_info_obj = json_object_new_object();
3024 	struct media_device_info *p = static_cast<struct media_device_info*>(arg);
3025 
3026 	json_object_object_add(media_device_info_obj, "driver", json_object_new_string(reinterpret_cast<const char *>(p->driver)));
3027 	json_object_object_add(media_device_info_obj, "model", json_object_new_string(reinterpret_cast<const char *>(p->model)));
3028 	json_object_object_add(media_device_info_obj, "serial", json_object_new_string(reinterpret_cast<const char *>(p->serial)));
3029 	json_object_object_add(media_device_info_obj, "bus_info", json_object_new_string(reinterpret_cast<const char *>(p->bus_info)));
3030 	json_object_object_add(media_device_info_obj, "media_version", json_object_new_string(ver2s(p->media_version).c_str()));
3031 	json_object_object_add(media_device_info_obj, "hw_revision", json_object_new_int64(p->hw_revision));
3032 	json_object_object_add(media_device_info_obj, "driver_version", json_object_new_string(ver2s(p->driver_version).c_str()));
3033 
3034 	if (key_name.empty())
3035 		json_object_object_add(parent_obj, "media_device_info", media_device_info_obj);
3036 	else
3037 		json_object_object_add(parent_obj, key_name.c_str(), media_device_info_obj);
3038 }
3039 
trace_media_entity_desc_gen(void * arg,json_object * parent_obj,std::string key_name="")3040 void trace_media_entity_desc_gen(void *arg, json_object *parent_obj, std::string key_name = "")
3041 {
3042 	json_object *media_entity_desc_obj = json_object_new_object();
3043 	struct media_entity_desc *p = static_cast<struct media_entity_desc*>(arg);
3044 
3045 	json_object_object_add(media_entity_desc_obj, "id", json_object_new_string(val2s(p->id, nullptr).c_str()));
3046 	json_object_object_add(media_entity_desc_obj, "name", json_object_new_string(reinterpret_cast<const char *>(p->name)));
3047 	json_object_object_add(media_entity_desc_obj, "type", json_object_new_string(val2s(p->type, nullptr).c_str()));
3048 	json_object_object_add(media_entity_desc_obj, "revision", json_object_new_int64(p->revision));
3049 	json_object_object_add(media_entity_desc_obj, "flags", json_object_new_string(fl2s(p->flags, nullptr).c_str()));
3050 	json_object_object_add(media_entity_desc_obj, "group_id", json_object_new_int64(p->group_id));
3051 	json_object_object_add(media_entity_desc_obj, "pads", json_object_new_int(p->pads));
3052 	json_object_object_add(media_entity_desc_obj, "links", json_object_new_int(p->links));
3053 	//union
3054 	//struct {
3055 	//__u32 major;
3056 	//__u32 minor;
3057 	//end of union 		} dev;
3058 	//struct {
3059 	//__u32 card;
3060 	//__u32 device;
3061 	//__u32 subdevice;
3062 	//end of struct 		} alsa;
3063 	//struct {
3064 	//__u32 major;
3065 	//__u32 minor;
3066 	//end of struct 		} v4l;
3067 	//struct {
3068 	//__u32 major;
3069 	//__u32 minor;
3070 	//end of struct 		} fb;
3071 	json_object_object_add(media_entity_desc_obj, "dvb", json_object_new_int(p->dvb));
3072 	json_object_object_add(media_entity_desc_obj, "raw", json_object_new_string(reinterpret_cast<const char *>(p->raw)));
3073 
3074 	if (key_name.empty())
3075 		json_object_object_add(parent_obj, "media_entity_desc", media_entity_desc_obj);
3076 	else
3077 		json_object_object_add(parent_obj, key_name.c_str(), media_entity_desc_obj);
3078 }
3079 
trace_media_pad_desc_gen(void * arg,json_object * parent_obj,std::string key_name="")3080 void trace_media_pad_desc_gen(void *arg, json_object *parent_obj, std::string key_name = "")
3081 {
3082 	json_object *media_pad_desc_obj = json_object_new_object();
3083 	struct media_pad_desc *p = static_cast<struct media_pad_desc*>(arg);
3084 
3085 	json_object_object_add(media_pad_desc_obj, "entity", json_object_new_int64(p->entity));
3086 	json_object_object_add(media_pad_desc_obj, "index", json_object_new_int(p->index));
3087 	json_object_object_add(media_pad_desc_obj, "flags", json_object_new_string(fl2s(p->flags, nullptr).c_str()));
3088 
3089 	if (key_name.empty())
3090 		json_object_object_add(parent_obj, "media_pad_desc", media_pad_desc_obj);
3091 	else
3092 		json_object_object_add(parent_obj, key_name.c_str(), media_pad_desc_obj);
3093 }
3094 
trace_media_link_desc_gen(void * arg,json_object * parent_obj,std::string key_name="")3095 void trace_media_link_desc_gen(void *arg, json_object *parent_obj, std::string key_name = "")
3096 {
3097 	json_object *media_link_desc_obj = json_object_new_object();
3098 	struct media_link_desc *p = static_cast<struct media_link_desc*>(arg);
3099 
3100 	//struct media_pad_desc source;
3101 	trace_media_pad_desc_gen(&p->source, media_link_desc_obj, "source");
3102 	//struct media_pad_desc sink;
3103 	trace_media_pad_desc_gen(&p->sink, media_link_desc_obj, "sink");
3104 	json_object_object_add(media_link_desc_obj, "flags", json_object_new_string(fl2s(p->flags, nullptr).c_str()));
3105 
3106 	if (key_name.empty())
3107 		json_object_object_add(parent_obj, "media_link_desc", media_link_desc_obj);
3108 	else
3109 		json_object_object_add(parent_obj, key_name.c_str(), media_link_desc_obj);
3110 }
3111 
trace_media_links_enum_gen(void * arg,json_object * parent_obj,std::string key_name="")3112 void trace_media_links_enum_gen(void *arg, json_object *parent_obj, std::string key_name = "")
3113 {
3114 	json_object *media_links_enum_obj = json_object_new_object();
3115 	struct media_links_enum *p = static_cast<struct media_links_enum*>(arg);
3116 
3117 	json_object_object_add(media_links_enum_obj, "entity", json_object_new_int64(p->entity));
3118 	//struct media_pad_desc *pads;
3119 	//struct media_link_desc *links;
3120 
3121 	if (key_name.empty())
3122 		json_object_object_add(parent_obj, "media_links_enum", media_links_enum_obj);
3123 	else
3124 		json_object_object_add(parent_obj, key_name.c_str(), media_links_enum_obj);
3125 }
3126 
trace_media_v2_entity_gen(void * arg,json_object * parent_obj,std::string key_name="")3127 void trace_media_v2_entity_gen(void *arg, json_object *parent_obj, std::string key_name = "")
3128 {
3129 	json_object *media_v2_entity_obj = json_object_new_object();
3130 	struct media_v2_entity *p = static_cast<struct media_v2_entity*>(arg);
3131 
3132 	json_object_object_add(media_v2_entity_obj, "id", json_object_new_string(val2s(p->id, nullptr).c_str()));
3133 	json_object_object_add(media_v2_entity_obj, "name", json_object_new_string(reinterpret_cast<const char *>(p->name)));
3134 	json_object_object_add(media_v2_entity_obj, "function", json_object_new_int64(p->function));
3135 	json_object_object_add(media_v2_entity_obj, "flags", json_object_new_string(fl2s(p->flags, nullptr).c_str()));
3136 
3137 	if (key_name.empty())
3138 		json_object_object_add(parent_obj, "media_v2_entity", media_v2_entity_obj);
3139 	else
3140 		json_object_object_add(parent_obj, key_name.c_str(), media_v2_entity_obj);
3141 }
3142 
trace_media_v2_intf_devnode_gen(void * arg,json_object * parent_obj,std::string key_name="")3143 void trace_media_v2_intf_devnode_gen(void *arg, json_object *parent_obj, std::string key_name = "")
3144 {
3145 	json_object *media_v2_intf_devnode_obj = json_object_new_object();
3146 	struct media_v2_intf_devnode *p = static_cast<struct media_v2_intf_devnode*>(arg);
3147 
3148 	json_object_object_add(media_v2_intf_devnode_obj, "major", json_object_new_int64(p->major));
3149 	json_object_object_add(media_v2_intf_devnode_obj, "minor", json_object_new_int64(p->minor));
3150 
3151 	if (key_name.empty())
3152 		json_object_object_add(parent_obj, "media_v2_intf_devnode", media_v2_intf_devnode_obj);
3153 	else
3154 		json_object_object_add(parent_obj, key_name.c_str(), media_v2_intf_devnode_obj);
3155 }
3156 
trace_media_v2_interface_gen(void * arg,json_object * parent_obj,std::string key_name="")3157 void trace_media_v2_interface_gen(void *arg, json_object *parent_obj, std::string key_name = "")
3158 {
3159 	json_object *media_v2_interface_obj = json_object_new_object();
3160 	struct media_v2_interface *p = static_cast<struct media_v2_interface*>(arg);
3161 
3162 	json_object_object_add(media_v2_interface_obj, "id", json_object_new_string(val2s(p->id, nullptr).c_str()));
3163 	json_object_object_add(media_v2_interface_obj, "intf_type", json_object_new_int64(p->intf_type));
3164 	json_object_object_add(media_v2_interface_obj, "flags", json_object_new_string(fl2s(p->flags, nullptr).c_str()));
3165 	//union
3166 	//struct media_v2_intf_devnode devnode;
3167 	//__u32 raw[16];
3168 	//end of union 	};
3169 
3170 	if (key_name.empty())
3171 		json_object_object_add(parent_obj, "media_v2_interface", media_v2_interface_obj);
3172 	else
3173 		json_object_object_add(parent_obj, key_name.c_str(), media_v2_interface_obj);
3174 }
3175 
trace_media_v2_pad_gen(void * arg,json_object * parent_obj,std::string key_name="")3176 void trace_media_v2_pad_gen(void *arg, json_object *parent_obj, std::string key_name = "")
3177 {
3178 	json_object *media_v2_pad_obj = json_object_new_object();
3179 	struct media_v2_pad *p = static_cast<struct media_v2_pad*>(arg);
3180 
3181 	json_object_object_add(media_v2_pad_obj, "id", json_object_new_string(val2s(p->id, nullptr).c_str()));
3182 	json_object_object_add(media_v2_pad_obj, "entity_id", json_object_new_int64(p->entity_id));
3183 	json_object_object_add(media_v2_pad_obj, "flags", json_object_new_string(fl2s(p->flags, nullptr).c_str()));
3184 	json_object_object_add(media_v2_pad_obj, "index", json_object_new_int64(p->index));
3185 
3186 	if (key_name.empty())
3187 		json_object_object_add(parent_obj, "media_v2_pad", media_v2_pad_obj);
3188 	else
3189 		json_object_object_add(parent_obj, key_name.c_str(), media_v2_pad_obj);
3190 }
3191 
trace_media_v2_link_gen(void * arg,json_object * parent_obj,std::string key_name="")3192 void trace_media_v2_link_gen(void *arg, json_object *parent_obj, std::string key_name = "")
3193 {
3194 	json_object *media_v2_link_obj = json_object_new_object();
3195 	struct media_v2_link *p = static_cast<struct media_v2_link*>(arg);
3196 
3197 	json_object_object_add(media_v2_link_obj, "id", json_object_new_string(val2s(p->id, nullptr).c_str()));
3198 	json_object_object_add(media_v2_link_obj, "source_id", json_object_new_int64(p->source_id));
3199 	json_object_object_add(media_v2_link_obj, "sink_id", json_object_new_int64(p->sink_id));
3200 	json_object_object_add(media_v2_link_obj, "flags", json_object_new_string(fl2s(p->flags, nullptr).c_str()));
3201 
3202 	if (key_name.empty())
3203 		json_object_object_add(parent_obj, "media_v2_link", media_v2_link_obj);
3204 	else
3205 		json_object_object_add(parent_obj, key_name.c_str(), media_v2_link_obj);
3206 }
3207 
trace_media_v2_topology_gen(void * arg,json_object * parent_obj,std::string key_name="")3208 void trace_media_v2_topology_gen(void *arg, json_object *parent_obj, std::string key_name = "")
3209 {
3210 	json_object *media_v2_topology_obj = json_object_new_object();
3211 	struct media_v2_topology *p = static_cast<struct media_v2_topology*>(arg);
3212 
3213 	json_object_object_add(media_v2_topology_obj, "topology_version", json_object_new_string(ver2s(p->topology_version).c_str()));
3214 	json_object_object_add(media_v2_topology_obj, "num_entities", json_object_new_int64(p->num_entities));
3215 	json_object_object_add(media_v2_topology_obj, "ptr_entities", json_object_new_uint64(p->ptr_entities));
3216 	json_object_object_add(media_v2_topology_obj, "num_interfaces", json_object_new_int64(p->num_interfaces));
3217 	json_object_object_add(media_v2_topology_obj, "ptr_interfaces", json_object_new_uint64(p->ptr_interfaces));
3218 	json_object_object_add(media_v2_topology_obj, "num_pads", json_object_new_int64(p->num_pads));
3219 	json_object_object_add(media_v2_topology_obj, "ptr_pads", json_object_new_uint64(p->ptr_pads));
3220 	json_object_object_add(media_v2_topology_obj, "num_links", json_object_new_int64(p->num_links));
3221 	json_object_object_add(media_v2_topology_obj, "ptr_links", json_object_new_uint64(p->ptr_links));
3222 
3223 	if (key_name.empty())
3224 		json_object_object_add(parent_obj, "media_v2_topology", media_v2_topology_obj);
3225 	else
3226 		json_object_object_add(parent_obj, key_name.c_str(), media_v2_topology_obj);
3227 }
3228 
trace_v4l2_edid_gen(void * arg,json_object * parent_obj,std::string key_name="")3229 void trace_v4l2_edid_gen(void *arg, json_object *parent_obj, std::string key_name = "")
3230 {
3231 	json_object *v4l2_edid_obj = json_object_new_object();
3232 	struct v4l2_edid *p = static_cast<struct v4l2_edid*>(arg);
3233 
3234 	json_object_object_add(v4l2_edid_obj, "pad", json_object_new_int64(p->pad));
3235 	json_object_object_add(v4l2_edid_obj, "start_block", json_object_new_int64(p->start_block));
3236 	json_object_object_add(v4l2_edid_obj, "blocks", json_object_new_int64(p->blocks));
3237 	//__u8  *edid;
3238 
3239 	if (key_name.empty())
3240 		json_object_object_add(parent_obj, "v4l2_edid", v4l2_edid_obj);
3241 	else
3242 		json_object_object_add(parent_obj, key_name.c_str(), v4l2_edid_obj);
3243 }
3244