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
retrace_v4l2_ctrl_h264_sps_gen(json_object * ctrl_obj)10 struct v4l2_ctrl_h264_sps *retrace_v4l2_ctrl_h264_sps_gen(json_object *ctrl_obj)
11 {
12 struct v4l2_ctrl_h264_sps *p = (struct v4l2_ctrl_h264_sps *) calloc(1, sizeof(v4l2_ctrl_h264_sps));
13 json_object *v4l2_ctrl_h264_sps_obj;
14 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_h264_sps", &v4l2_ctrl_h264_sps_obj))
15 v4l2_ctrl_h264_sps_obj = ctrl_obj;
16
17 json_object *profile_idc_obj;
18 if (json_object_object_get_ex(v4l2_ctrl_h264_sps_obj, "profile_idc", &profile_idc_obj))
19 p->profile_idc = (__u8) json_object_get_int(profile_idc_obj);
20
21 json_object *constraint_set_flags_obj;
22 if (json_object_object_get_ex(v4l2_ctrl_h264_sps_obj, "constraint_set_flags", &constraint_set_flags_obj))
23 p->constraint_set_flags = (__u8) s2flags(json_object_get_string(constraint_set_flags_obj), v4l2_h264_sps_flag_def);
24
25 json_object *level_idc_obj;
26 if (json_object_object_get_ex(v4l2_ctrl_h264_sps_obj, "level_idc", &level_idc_obj))
27 p->level_idc = (__u8) json_object_get_int(level_idc_obj);
28
29 json_object *seq_parameter_set_id_obj;
30 if (json_object_object_get_ex(v4l2_ctrl_h264_sps_obj, "seq_parameter_set_id", &seq_parameter_set_id_obj))
31 p->seq_parameter_set_id = (__u8) json_object_get_int(seq_parameter_set_id_obj);
32
33 json_object *chroma_format_idc_obj;
34 if (json_object_object_get_ex(v4l2_ctrl_h264_sps_obj, "chroma_format_idc", &chroma_format_idc_obj))
35 p->chroma_format_idc = (__u8) json_object_get_int(chroma_format_idc_obj);
36
37 json_object *bit_depth_luma_minus8_obj;
38 if (json_object_object_get_ex(v4l2_ctrl_h264_sps_obj, "bit_depth_luma_minus8", &bit_depth_luma_minus8_obj))
39 p->bit_depth_luma_minus8 = (__u8) json_object_get_int(bit_depth_luma_minus8_obj);
40
41 json_object *bit_depth_chroma_minus8_obj;
42 if (json_object_object_get_ex(v4l2_ctrl_h264_sps_obj, "bit_depth_chroma_minus8", &bit_depth_chroma_minus8_obj))
43 p->bit_depth_chroma_minus8 = (__u8) json_object_get_int(bit_depth_chroma_minus8_obj);
44
45 json_object *log2_max_frame_num_minus4_obj;
46 if (json_object_object_get_ex(v4l2_ctrl_h264_sps_obj, "log2_max_frame_num_minus4", &log2_max_frame_num_minus4_obj))
47 p->log2_max_frame_num_minus4 = (__u8) json_object_get_int(log2_max_frame_num_minus4_obj);
48
49 json_object *pic_order_cnt_type_obj;
50 if (json_object_object_get_ex(v4l2_ctrl_h264_sps_obj, "pic_order_cnt_type", &pic_order_cnt_type_obj))
51 p->pic_order_cnt_type = (__u8) json_object_get_int(pic_order_cnt_type_obj);
52
53 json_object *log2_max_pic_order_cnt_lsb_minus4_obj;
54 if (json_object_object_get_ex(v4l2_ctrl_h264_sps_obj, "log2_max_pic_order_cnt_lsb_minus4", &log2_max_pic_order_cnt_lsb_minus4_obj))
55 p->log2_max_pic_order_cnt_lsb_minus4 = (__u8) json_object_get_int(log2_max_pic_order_cnt_lsb_minus4_obj);
56
57 json_object *max_num_ref_frames_obj;
58 if (json_object_object_get_ex(v4l2_ctrl_h264_sps_obj, "max_num_ref_frames", &max_num_ref_frames_obj))
59 p->max_num_ref_frames = (__u8) json_object_get_int(max_num_ref_frames_obj);
60
61 json_object *num_ref_frames_in_pic_order_cnt_cycle_obj;
62 if (json_object_object_get_ex(v4l2_ctrl_h264_sps_obj, "num_ref_frames_in_pic_order_cnt_cycle", &num_ref_frames_in_pic_order_cnt_cycle_obj))
63 p->num_ref_frames_in_pic_order_cnt_cycle = (__u8) json_object_get_int(num_ref_frames_in_pic_order_cnt_cycle_obj);
64
65 /* __s32 offset_for_ref_frame[255] */
66 json_object *offset_for_ref_frame_obj;
67 if (json_object_object_get_ex(v4l2_ctrl_h264_sps_obj, "offset_for_ref_frame", &offset_for_ref_frame_obj)) {
68 for (size_t i = 0; i < 255; i++) {
69 if (json_object_array_get_idx(offset_for_ref_frame_obj, i))
70 p->offset_for_ref_frame[i] = (__s32) json_object_get_int(json_object_array_get_idx(offset_for_ref_frame_obj, i));
71 }
72 }
73
74 json_object *offset_for_non_ref_pic_obj;
75 if (json_object_object_get_ex(v4l2_ctrl_h264_sps_obj, "offset_for_non_ref_pic", &offset_for_non_ref_pic_obj))
76 p->offset_for_non_ref_pic = (__s32) json_object_get_int(offset_for_non_ref_pic_obj);
77
78 json_object *offset_for_top_to_bottom_field_obj;
79 if (json_object_object_get_ex(v4l2_ctrl_h264_sps_obj, "offset_for_top_to_bottom_field", &offset_for_top_to_bottom_field_obj))
80 p->offset_for_top_to_bottom_field = (__s32) json_object_get_int(offset_for_top_to_bottom_field_obj);
81
82 json_object *pic_width_in_mbs_minus1_obj;
83 if (json_object_object_get_ex(v4l2_ctrl_h264_sps_obj, "pic_width_in_mbs_minus1", &pic_width_in_mbs_minus1_obj))
84 p->pic_width_in_mbs_minus1 = (__u16) json_object_get_int(pic_width_in_mbs_minus1_obj);
85
86 json_object *pic_height_in_map_units_minus1_obj;
87 if (json_object_object_get_ex(v4l2_ctrl_h264_sps_obj, "pic_height_in_map_units_minus1", &pic_height_in_map_units_minus1_obj))
88 p->pic_height_in_map_units_minus1 = (__u16) json_object_get_int(pic_height_in_map_units_minus1_obj);
89
90 json_object *flags_obj;
91 if (json_object_object_get_ex(v4l2_ctrl_h264_sps_obj, "flags", &flags_obj))
92 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_h264_sps_flag_def);
93
94 return p;
95 }
96
retrace_v4l2_ctrl_h264_pps_gen(json_object * ctrl_obj)97 struct v4l2_ctrl_h264_pps *retrace_v4l2_ctrl_h264_pps_gen(json_object *ctrl_obj)
98 {
99 struct v4l2_ctrl_h264_pps *p = (struct v4l2_ctrl_h264_pps *) calloc(1, sizeof(v4l2_ctrl_h264_pps));
100 json_object *v4l2_ctrl_h264_pps_obj;
101 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_h264_pps", &v4l2_ctrl_h264_pps_obj))
102 v4l2_ctrl_h264_pps_obj = ctrl_obj;
103
104 json_object *pic_parameter_set_id_obj;
105 if (json_object_object_get_ex(v4l2_ctrl_h264_pps_obj, "pic_parameter_set_id", &pic_parameter_set_id_obj))
106 p->pic_parameter_set_id = (__u8) json_object_get_int(pic_parameter_set_id_obj);
107
108 json_object *seq_parameter_set_id_obj;
109 if (json_object_object_get_ex(v4l2_ctrl_h264_pps_obj, "seq_parameter_set_id", &seq_parameter_set_id_obj))
110 p->seq_parameter_set_id = (__u8) json_object_get_int(seq_parameter_set_id_obj);
111
112 json_object *num_slice_groups_minus1_obj;
113 if (json_object_object_get_ex(v4l2_ctrl_h264_pps_obj, "num_slice_groups_minus1", &num_slice_groups_minus1_obj))
114 p->num_slice_groups_minus1 = (__u8) json_object_get_int(num_slice_groups_minus1_obj);
115
116 json_object *num_ref_idx_l0_default_active_minus1_obj;
117 if (json_object_object_get_ex(v4l2_ctrl_h264_pps_obj, "num_ref_idx_l0_default_active_minus1", &num_ref_idx_l0_default_active_minus1_obj))
118 p->num_ref_idx_l0_default_active_minus1 = (__u8) json_object_get_int(num_ref_idx_l0_default_active_minus1_obj);
119
120 json_object *num_ref_idx_l1_default_active_minus1_obj;
121 if (json_object_object_get_ex(v4l2_ctrl_h264_pps_obj, "num_ref_idx_l1_default_active_minus1", &num_ref_idx_l1_default_active_minus1_obj))
122 p->num_ref_idx_l1_default_active_minus1 = (__u8) json_object_get_int(num_ref_idx_l1_default_active_minus1_obj);
123
124 json_object *weighted_bipred_idc_obj;
125 if (json_object_object_get_ex(v4l2_ctrl_h264_pps_obj, "weighted_bipred_idc", &weighted_bipred_idc_obj))
126 p->weighted_bipred_idc = (__u8) json_object_get_int(weighted_bipred_idc_obj);
127
128 json_object *pic_init_qp_minus26_obj;
129 if (json_object_object_get_ex(v4l2_ctrl_h264_pps_obj, "pic_init_qp_minus26", &pic_init_qp_minus26_obj))
130 p->pic_init_qp_minus26 = (__s8) json_object_get_int(pic_init_qp_minus26_obj);
131
132 json_object *pic_init_qs_minus26_obj;
133 if (json_object_object_get_ex(v4l2_ctrl_h264_pps_obj, "pic_init_qs_minus26", &pic_init_qs_minus26_obj))
134 p->pic_init_qs_minus26 = (__s8) json_object_get_int(pic_init_qs_minus26_obj);
135
136 json_object *chroma_qp_index_offset_obj;
137 if (json_object_object_get_ex(v4l2_ctrl_h264_pps_obj, "chroma_qp_index_offset", &chroma_qp_index_offset_obj))
138 p->chroma_qp_index_offset = (__s8) json_object_get_int(chroma_qp_index_offset_obj);
139
140 json_object *second_chroma_qp_index_offset_obj;
141 if (json_object_object_get_ex(v4l2_ctrl_h264_pps_obj, "second_chroma_qp_index_offset", &second_chroma_qp_index_offset_obj))
142 p->second_chroma_qp_index_offset = (__s8) json_object_get_int(second_chroma_qp_index_offset_obj);
143
144 json_object *flags_obj;
145 if (json_object_object_get_ex(v4l2_ctrl_h264_pps_obj, "flags", &flags_obj))
146 p->flags = (__u16) s2flags(json_object_get_string(flags_obj), v4l2_h264_pps_flag_def);
147
148 return p;
149 }
150
retrace_v4l2_ctrl_h264_scaling_matrix_gen(json_object * ctrl_obj)151 struct v4l2_ctrl_h264_scaling_matrix *retrace_v4l2_ctrl_h264_scaling_matrix_gen(json_object *ctrl_obj)
152 {
153 struct v4l2_ctrl_h264_scaling_matrix *p = (struct v4l2_ctrl_h264_scaling_matrix *) calloc(1, sizeof(v4l2_ctrl_h264_scaling_matrix));
154 json_object *v4l2_ctrl_h264_scaling_matrix_obj;
155 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_h264_scaling_matrix", &v4l2_ctrl_h264_scaling_matrix_obj))
156 v4l2_ctrl_h264_scaling_matrix_obj = ctrl_obj;
157
158 /* __u8 scaling_list_4x4[6][16] */
159 int count_scaling_list_4x4 = 0;
160 json_object *scaling_list_4x4_obj;
161 if (json_object_object_get_ex(v4l2_ctrl_h264_scaling_matrix_obj, "scaling_list_4x4", &scaling_list_4x4_obj)) {
162 for (size_t i = 0; i < 6; i++) {
163 for (size_t j = 0; j < 16; j++) {
164 if (json_object_array_get_idx(scaling_list_4x4_obj, count_scaling_list_4x4))
165 p->scaling_list_4x4[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(scaling_list_4x4_obj, count_scaling_list_4x4++));
166 }
167 }
168 }
169
170 /* __u8 scaling_list_8x8[6][64] */
171 int count_scaling_list_8x8 = 0;
172 json_object *scaling_list_8x8_obj;
173 if (json_object_object_get_ex(v4l2_ctrl_h264_scaling_matrix_obj, "scaling_list_8x8", &scaling_list_8x8_obj)) {
174 for (size_t i = 0; i < 6; i++) {
175 for (size_t j = 0; j < 64; j++) {
176 if (json_object_array_get_idx(scaling_list_8x8_obj, count_scaling_list_8x8))
177 p->scaling_list_8x8[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(scaling_list_8x8_obj, count_scaling_list_8x8++));
178 }
179 }
180 }
181
182 return p;
183 }
184
retrace_v4l2_h264_weight_factors_gen(json_object * ctrl_obj)185 struct v4l2_h264_weight_factors *retrace_v4l2_h264_weight_factors_gen(json_object *ctrl_obj)
186 {
187 struct v4l2_h264_weight_factors *p = (struct v4l2_h264_weight_factors *) calloc(1, sizeof(v4l2_h264_weight_factors));
188 json_object *v4l2_h264_weight_factors_obj;
189 if (!json_object_object_get_ex(ctrl_obj, "v4l2_h264_weight_factors", &v4l2_h264_weight_factors_obj))
190 v4l2_h264_weight_factors_obj = ctrl_obj;
191
192 /* __s16 luma_weight[32] */
193 json_object *luma_weight_obj;
194 if (json_object_object_get_ex(v4l2_h264_weight_factors_obj, "luma_weight", &luma_weight_obj)) {
195 for (size_t i = 0; i < 32; i++) {
196 if (json_object_array_get_idx(luma_weight_obj, i))
197 p->luma_weight[i] = (__s16) json_object_get_int(json_object_array_get_idx(luma_weight_obj, i));
198 }
199 }
200
201 /* __s16 luma_offset[32] */
202 json_object *luma_offset_obj;
203 if (json_object_object_get_ex(v4l2_h264_weight_factors_obj, "luma_offset", &luma_offset_obj)) {
204 for (size_t i = 0; i < 32; i++) {
205 if (json_object_array_get_idx(luma_offset_obj, i))
206 p->luma_offset[i] = (__s16) json_object_get_int(json_object_array_get_idx(luma_offset_obj, i));
207 }
208 }
209
210 /* __s16 chroma_weight[32][2] */
211 int count_chroma_weight = 0;
212 json_object *chroma_weight_obj;
213 if (json_object_object_get_ex(v4l2_h264_weight_factors_obj, "chroma_weight", &chroma_weight_obj)) {
214 for (size_t i = 0; i < 32; i++) {
215 for (size_t j = 0; j < 2; j++) {
216 if (json_object_array_get_idx(chroma_weight_obj, count_chroma_weight))
217 p->chroma_weight[i][j] = (__s16) json_object_get_int(json_object_array_get_idx(chroma_weight_obj, count_chroma_weight++));
218 }
219 }
220 }
221
222 /* __s16 chroma_offset[32][2] */
223 int count_chroma_offset = 0;
224 json_object *chroma_offset_obj;
225 if (json_object_object_get_ex(v4l2_h264_weight_factors_obj, "chroma_offset", &chroma_offset_obj)) {
226 for (size_t i = 0; i < 32; i++) {
227 for (size_t j = 0; j < 2; j++) {
228 if (json_object_array_get_idx(chroma_offset_obj, count_chroma_offset))
229 p->chroma_offset[i][j] = (__s16) json_object_get_int(json_object_array_get_idx(chroma_offset_obj, count_chroma_offset++));
230 }
231 }
232 }
233
234 return p;
235 }
236
retrace_v4l2_ctrl_h264_pred_weights_gen(json_object * ctrl_obj)237 struct v4l2_ctrl_h264_pred_weights *retrace_v4l2_ctrl_h264_pred_weights_gen(json_object *ctrl_obj)
238 {
239 struct v4l2_ctrl_h264_pred_weights *p = (struct v4l2_ctrl_h264_pred_weights *) calloc(1, sizeof(v4l2_ctrl_h264_pred_weights));
240 json_object *v4l2_ctrl_h264_pred_weights_obj;
241 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_h264_pred_weights", &v4l2_ctrl_h264_pred_weights_obj))
242 v4l2_ctrl_h264_pred_weights_obj = ctrl_obj;
243
244 json_object *luma_log2_weight_denom_obj;
245 if (json_object_object_get_ex(v4l2_ctrl_h264_pred_weights_obj, "luma_log2_weight_denom", &luma_log2_weight_denom_obj))
246 p->luma_log2_weight_denom = (__u16) json_object_get_int(luma_log2_weight_denom_obj);
247
248 json_object *chroma_log2_weight_denom_obj;
249 if (json_object_object_get_ex(v4l2_ctrl_h264_pred_weights_obj, "chroma_log2_weight_denom", &chroma_log2_weight_denom_obj))
250 p->chroma_log2_weight_denom = (__u16) json_object_get_int(chroma_log2_weight_denom_obj);
251
252 /* struct v4l2_h264_weight_factors weight_factors[2] */
253 json_object *weight_factors_obj;
254 if (json_object_object_get_ex(v4l2_ctrl_h264_pred_weights_obj, "weight_factors", &weight_factors_obj)) {
255 for (size_t i = 0; i < 2; i++) {
256 void *weight_factors_ptr = (void *) retrace_v4l2_h264_weight_factors_gen(json_object_array_get_idx(weight_factors_obj, i));
257 p->weight_factors[i] = *static_cast<struct v4l2_h264_weight_factors*>(weight_factors_ptr);
258 free(weight_factors_ptr);
259 }
260 }
261
262 return p;
263 }
264
retrace_v4l2_h264_reference_gen(json_object * ctrl_obj)265 struct v4l2_h264_reference *retrace_v4l2_h264_reference_gen(json_object *ctrl_obj)
266 {
267 struct v4l2_h264_reference *p = (struct v4l2_h264_reference *) calloc(1, sizeof(v4l2_h264_reference));
268 json_object *v4l2_h264_reference_obj;
269 if (!json_object_object_get_ex(ctrl_obj, "v4l2_h264_reference", &v4l2_h264_reference_obj))
270 v4l2_h264_reference_obj = ctrl_obj;
271
272 json_object *fields_obj;
273 if (json_object_object_get_ex(v4l2_h264_reference_obj, "fields", &fields_obj))
274 p->fields = (__u8) json_object_get_int(fields_obj);
275
276 json_object *index_obj;
277 if (json_object_object_get_ex(v4l2_h264_reference_obj, "index", &index_obj))
278 p->index = (__u8) json_object_get_int(index_obj);
279
280 return p;
281 }
282
retrace_v4l2_ctrl_h264_slice_params_gen(json_object * ctrl_obj)283 struct v4l2_ctrl_h264_slice_params *retrace_v4l2_ctrl_h264_slice_params_gen(json_object *ctrl_obj)
284 {
285 struct v4l2_ctrl_h264_slice_params *p = (struct v4l2_ctrl_h264_slice_params *) calloc(1, sizeof(v4l2_ctrl_h264_slice_params));
286 json_object *v4l2_ctrl_h264_slice_params_obj;
287 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_h264_slice_params", &v4l2_ctrl_h264_slice_params_obj))
288 v4l2_ctrl_h264_slice_params_obj = ctrl_obj;
289
290 json_object *header_bit_size_obj;
291 if (json_object_object_get_ex(v4l2_ctrl_h264_slice_params_obj, "header_bit_size", &header_bit_size_obj))
292 p->header_bit_size = (__u32) json_object_get_int64(header_bit_size_obj);
293
294 json_object *first_mb_in_slice_obj;
295 if (json_object_object_get_ex(v4l2_ctrl_h264_slice_params_obj, "first_mb_in_slice", &first_mb_in_slice_obj))
296 p->first_mb_in_slice = (__u32) json_object_get_int64(first_mb_in_slice_obj);
297
298 json_object *slice_type_obj;
299 if (json_object_object_get_ex(v4l2_ctrl_h264_slice_params_obj, "slice_type", &slice_type_obj))
300 p->slice_type = (__u8) json_object_get_int(slice_type_obj);
301
302 json_object *colour_plane_id_obj;
303 if (json_object_object_get_ex(v4l2_ctrl_h264_slice_params_obj, "colour_plane_id", &colour_plane_id_obj))
304 p->colour_plane_id = (__u8) json_object_get_int(colour_plane_id_obj);
305
306 json_object *redundant_pic_cnt_obj;
307 if (json_object_object_get_ex(v4l2_ctrl_h264_slice_params_obj, "redundant_pic_cnt", &redundant_pic_cnt_obj))
308 p->redundant_pic_cnt = (__u8) json_object_get_int(redundant_pic_cnt_obj);
309
310 json_object *cabac_init_idc_obj;
311 if (json_object_object_get_ex(v4l2_ctrl_h264_slice_params_obj, "cabac_init_idc", &cabac_init_idc_obj))
312 p->cabac_init_idc = (__u8) json_object_get_int(cabac_init_idc_obj);
313
314 json_object *slice_qp_delta_obj;
315 if (json_object_object_get_ex(v4l2_ctrl_h264_slice_params_obj, "slice_qp_delta", &slice_qp_delta_obj))
316 p->slice_qp_delta = (__s8) json_object_get_int(slice_qp_delta_obj);
317
318 json_object *slice_qs_delta_obj;
319 if (json_object_object_get_ex(v4l2_ctrl_h264_slice_params_obj, "slice_qs_delta", &slice_qs_delta_obj))
320 p->slice_qs_delta = (__s8) json_object_get_int(slice_qs_delta_obj);
321
322 json_object *disable_deblocking_filter_idc_obj;
323 if (json_object_object_get_ex(v4l2_ctrl_h264_slice_params_obj, "disable_deblocking_filter_idc", &disable_deblocking_filter_idc_obj))
324 p->disable_deblocking_filter_idc = (__u8) json_object_get_int(disable_deblocking_filter_idc_obj);
325
326 json_object *slice_alpha_c0_offset_div2_obj;
327 if (json_object_object_get_ex(v4l2_ctrl_h264_slice_params_obj, "slice_alpha_c0_offset_div2", &slice_alpha_c0_offset_div2_obj))
328 p->slice_alpha_c0_offset_div2 = (__s8) json_object_get_int(slice_alpha_c0_offset_div2_obj);
329
330 json_object *slice_beta_offset_div2_obj;
331 if (json_object_object_get_ex(v4l2_ctrl_h264_slice_params_obj, "slice_beta_offset_div2", &slice_beta_offset_div2_obj))
332 p->slice_beta_offset_div2 = (__s8) json_object_get_int(slice_beta_offset_div2_obj);
333
334 json_object *num_ref_idx_l0_active_minus1_obj;
335 if (json_object_object_get_ex(v4l2_ctrl_h264_slice_params_obj, "num_ref_idx_l0_active_minus1", &num_ref_idx_l0_active_minus1_obj))
336 p->num_ref_idx_l0_active_minus1 = (__u8) json_object_get_int(num_ref_idx_l0_active_minus1_obj);
337
338 json_object *num_ref_idx_l1_active_minus1_obj;
339 if (json_object_object_get_ex(v4l2_ctrl_h264_slice_params_obj, "num_ref_idx_l1_active_minus1", &num_ref_idx_l1_active_minus1_obj))
340 p->num_ref_idx_l1_active_minus1 = (__u8) json_object_get_int(num_ref_idx_l1_active_minus1_obj);
341
342 /* struct v4l2_h264_reference ref_pic_list0[V4L2_H264_REF_LIST_LEN] */
343 json_object *ref_pic_list0_obj;
344 if (json_object_object_get_ex(v4l2_ctrl_h264_slice_params_obj, "ref_pic_list0", &ref_pic_list0_obj)) {
345 for (size_t i = 0; i < V4L2_H264_REF_LIST_LEN; i++) {
346 void *ref_pic_list0_ptr = (void *) retrace_v4l2_h264_reference_gen(json_object_array_get_idx(ref_pic_list0_obj, i));
347 p->ref_pic_list0[i] = *static_cast<struct v4l2_h264_reference*>(ref_pic_list0_ptr);
348 free(ref_pic_list0_ptr);
349 }
350 }
351
352 /* struct v4l2_h264_reference ref_pic_list1[V4L2_H264_REF_LIST_LEN] */
353 json_object *ref_pic_list1_obj;
354 if (json_object_object_get_ex(v4l2_ctrl_h264_slice_params_obj, "ref_pic_list1", &ref_pic_list1_obj)) {
355 for (size_t i = 0; i < V4L2_H264_REF_LIST_LEN; i++) {
356 void *ref_pic_list1_ptr = (void *) retrace_v4l2_h264_reference_gen(json_object_array_get_idx(ref_pic_list1_obj, i));
357 p->ref_pic_list1[i] = *static_cast<struct v4l2_h264_reference*>(ref_pic_list1_ptr);
358 free(ref_pic_list1_ptr);
359 }
360 }
361
362 json_object *flags_obj;
363 if (json_object_object_get_ex(v4l2_ctrl_h264_slice_params_obj, "flags", &flags_obj))
364 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_h264_slice_flag_def);
365
366 return p;
367 }
368
retrace_v4l2_h264_dpb_entry_gen(json_object * ctrl_obj)369 struct v4l2_h264_dpb_entry *retrace_v4l2_h264_dpb_entry_gen(json_object *ctrl_obj)
370 {
371 struct v4l2_h264_dpb_entry *p = (struct v4l2_h264_dpb_entry *) calloc(1, sizeof(v4l2_h264_dpb_entry));
372 json_object *v4l2_h264_dpb_entry_obj;
373 if (!json_object_object_get_ex(ctrl_obj, "v4l2_h264_dpb_entry", &v4l2_h264_dpb_entry_obj))
374 v4l2_h264_dpb_entry_obj = ctrl_obj;
375
376 json_object *reference_ts_obj;
377 if (json_object_object_get_ex(v4l2_h264_dpb_entry_obj, "reference_ts", &reference_ts_obj))
378 p->reference_ts = (__u64) json_object_get_uint64(reference_ts_obj);
379
380 json_object *pic_num_obj;
381 if (json_object_object_get_ex(v4l2_h264_dpb_entry_obj, "pic_num", &pic_num_obj))
382 p->pic_num = (__u32) json_object_get_int64(pic_num_obj);
383
384 json_object *frame_num_obj;
385 if (json_object_object_get_ex(v4l2_h264_dpb_entry_obj, "frame_num", &frame_num_obj))
386 p->frame_num = (__u16) json_object_get_int(frame_num_obj);
387
388 json_object *fields_obj;
389 if (json_object_object_get_ex(v4l2_h264_dpb_entry_obj, "fields", &fields_obj))
390 p->fields = (__u8) json_object_get_int(fields_obj);
391
392 json_object *top_field_order_cnt_obj;
393 if (json_object_object_get_ex(v4l2_h264_dpb_entry_obj, "top_field_order_cnt", &top_field_order_cnt_obj))
394 p->top_field_order_cnt = (__s32) json_object_get_int(top_field_order_cnt_obj);
395
396 json_object *bottom_field_order_cnt_obj;
397 if (json_object_object_get_ex(v4l2_h264_dpb_entry_obj, "bottom_field_order_cnt", &bottom_field_order_cnt_obj))
398 p->bottom_field_order_cnt = (__s32) json_object_get_int(bottom_field_order_cnt_obj);
399
400 json_object *flags_obj;
401 if (json_object_object_get_ex(v4l2_h264_dpb_entry_obj, "flags", &flags_obj))
402 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_h264_dpb_entry_flag_def);
403
404 return p;
405 }
406
retrace_v4l2_ctrl_h264_decode_params_gen(json_object * ctrl_obj)407 struct v4l2_ctrl_h264_decode_params *retrace_v4l2_ctrl_h264_decode_params_gen(json_object *ctrl_obj)
408 {
409 struct v4l2_ctrl_h264_decode_params *p = (struct v4l2_ctrl_h264_decode_params *) calloc(1, sizeof(v4l2_ctrl_h264_decode_params));
410 json_object *v4l2_ctrl_h264_decode_params_obj;
411 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_h264_decode_params", &v4l2_ctrl_h264_decode_params_obj))
412 v4l2_ctrl_h264_decode_params_obj = ctrl_obj;
413
414 /* struct v4l2_h264_dpb_entry dpb[V4L2_H264_NUM_DPB_ENTRIES] */
415 json_object *dpb_obj;
416 if (json_object_object_get_ex(v4l2_ctrl_h264_decode_params_obj, "dpb", &dpb_obj)) {
417 for (size_t i = 0; i < V4L2_H264_NUM_DPB_ENTRIES; i++) {
418 void *dpb_ptr = (void *) retrace_v4l2_h264_dpb_entry_gen(json_object_array_get_idx(dpb_obj, i));
419 p->dpb[i] = *static_cast<struct v4l2_h264_dpb_entry*>(dpb_ptr);
420 free(dpb_ptr);
421 }
422 }
423
424 json_object *nal_ref_idc_obj;
425 if (json_object_object_get_ex(v4l2_ctrl_h264_decode_params_obj, "nal_ref_idc", &nal_ref_idc_obj))
426 p->nal_ref_idc = (__u16) json_object_get_int(nal_ref_idc_obj);
427
428 json_object *frame_num_obj;
429 if (json_object_object_get_ex(v4l2_ctrl_h264_decode_params_obj, "frame_num", &frame_num_obj))
430 p->frame_num = (__u16) json_object_get_int(frame_num_obj);
431
432 json_object *top_field_order_cnt_obj;
433 if (json_object_object_get_ex(v4l2_ctrl_h264_decode_params_obj, "top_field_order_cnt", &top_field_order_cnt_obj))
434 p->top_field_order_cnt = (__s32) json_object_get_int(top_field_order_cnt_obj);
435
436 json_object *bottom_field_order_cnt_obj;
437 if (json_object_object_get_ex(v4l2_ctrl_h264_decode_params_obj, "bottom_field_order_cnt", &bottom_field_order_cnt_obj))
438 p->bottom_field_order_cnt = (__s32) json_object_get_int(bottom_field_order_cnt_obj);
439
440 json_object *idr_pic_id_obj;
441 if (json_object_object_get_ex(v4l2_ctrl_h264_decode_params_obj, "idr_pic_id", &idr_pic_id_obj))
442 p->idr_pic_id = (__u16) json_object_get_int(idr_pic_id_obj);
443
444 json_object *pic_order_cnt_lsb_obj;
445 if (json_object_object_get_ex(v4l2_ctrl_h264_decode_params_obj, "pic_order_cnt_lsb", &pic_order_cnt_lsb_obj))
446 p->pic_order_cnt_lsb = (__u16) json_object_get_int(pic_order_cnt_lsb_obj);
447
448 json_object *delta_pic_order_cnt_bottom_obj;
449 if (json_object_object_get_ex(v4l2_ctrl_h264_decode_params_obj, "delta_pic_order_cnt_bottom", &delta_pic_order_cnt_bottom_obj))
450 p->delta_pic_order_cnt_bottom = (__s32) json_object_get_int(delta_pic_order_cnt_bottom_obj);
451
452 json_object *delta_pic_order_cnt0_obj;
453 if (json_object_object_get_ex(v4l2_ctrl_h264_decode_params_obj, "delta_pic_order_cnt0", &delta_pic_order_cnt0_obj))
454 p->delta_pic_order_cnt0 = (__s32) json_object_get_int(delta_pic_order_cnt0_obj);
455
456 json_object *delta_pic_order_cnt1_obj;
457 if (json_object_object_get_ex(v4l2_ctrl_h264_decode_params_obj, "delta_pic_order_cnt1", &delta_pic_order_cnt1_obj))
458 p->delta_pic_order_cnt1 = (__s32) json_object_get_int(delta_pic_order_cnt1_obj);
459
460 json_object *dec_ref_pic_marking_bit_size_obj;
461 if (json_object_object_get_ex(v4l2_ctrl_h264_decode_params_obj, "dec_ref_pic_marking_bit_size", &dec_ref_pic_marking_bit_size_obj))
462 p->dec_ref_pic_marking_bit_size = (__u32) json_object_get_int64(dec_ref_pic_marking_bit_size_obj);
463
464 json_object *pic_order_cnt_bit_size_obj;
465 if (json_object_object_get_ex(v4l2_ctrl_h264_decode_params_obj, "pic_order_cnt_bit_size", &pic_order_cnt_bit_size_obj))
466 p->pic_order_cnt_bit_size = (__u32) json_object_get_int64(pic_order_cnt_bit_size_obj);
467
468 json_object *slice_group_change_cycle_obj;
469 if (json_object_object_get_ex(v4l2_ctrl_h264_decode_params_obj, "slice_group_change_cycle", &slice_group_change_cycle_obj))
470 p->slice_group_change_cycle = (__u32) json_object_get_int64(slice_group_change_cycle_obj);
471
472 json_object *flags_obj;
473 if (json_object_object_get_ex(v4l2_ctrl_h264_decode_params_obj, "flags", &flags_obj))
474 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_h264_decode_param_flag_def);
475
476 return p;
477 }
478
retrace_v4l2_ctrl_fwht_params_gen(json_object * ctrl_obj)479 struct v4l2_ctrl_fwht_params *retrace_v4l2_ctrl_fwht_params_gen(json_object *ctrl_obj)
480 {
481 struct v4l2_ctrl_fwht_params *p = (struct v4l2_ctrl_fwht_params *) calloc(1, sizeof(v4l2_ctrl_fwht_params));
482 json_object *v4l2_ctrl_fwht_params_obj;
483 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_fwht_params", &v4l2_ctrl_fwht_params_obj))
484 v4l2_ctrl_fwht_params_obj = ctrl_obj;
485
486 json_object *backward_ref_ts_obj;
487 if (json_object_object_get_ex(v4l2_ctrl_fwht_params_obj, "backward_ref_ts", &backward_ref_ts_obj))
488 p->backward_ref_ts = (__u64) json_object_get_uint64(backward_ref_ts_obj);
489
490 json_object *version_obj;
491 if (json_object_object_get_ex(v4l2_ctrl_fwht_params_obj, "version", &version_obj))
492 p->version = (__u32) json_object_get_int64(version_obj);
493
494 json_object *width_obj;
495 if (json_object_object_get_ex(v4l2_ctrl_fwht_params_obj, "width", &width_obj))
496 p->width = (__u32) json_object_get_int64(width_obj);
497
498 json_object *height_obj;
499 if (json_object_object_get_ex(v4l2_ctrl_fwht_params_obj, "height", &height_obj))
500 p->height = (__u32) json_object_get_int64(height_obj);
501
502 json_object *flags_obj;
503 if (json_object_object_get_ex(v4l2_ctrl_fwht_params_obj, "flags", &flags_obj))
504 p->flags = (__u32) s2flags_fwht(json_object_get_string(flags_obj));
505
506 json_object *colorspace_obj;
507 if (json_object_object_get_ex(v4l2_ctrl_fwht_params_obj, "colorspace", &colorspace_obj))
508 p->colorspace = (__u32) s2val(json_object_get_string(colorspace_obj), v4l2_colorspace_val_def);
509
510 json_object *xfer_func_obj;
511 if (json_object_object_get_ex(v4l2_ctrl_fwht_params_obj, "xfer_func", &xfer_func_obj))
512 p->xfer_func = (__u32) s2val(json_object_get_string(xfer_func_obj), v4l2_xfer_func_val_def);
513
514 json_object *ycbcr_enc_obj;
515 if (json_object_object_get_ex(v4l2_ctrl_fwht_params_obj, "ycbcr_enc", &ycbcr_enc_obj))
516 p->ycbcr_enc = (__u32) s2val(json_object_get_string(ycbcr_enc_obj), v4l2_ycbcr_encoding_val_def);
517
518 json_object *quantization_obj;
519 if (json_object_object_get_ex(v4l2_ctrl_fwht_params_obj, "quantization", &quantization_obj))
520 p->quantization = (__u32) s2val(json_object_get_string(quantization_obj), v4l2_quantization_val_def);
521
522 return p;
523 }
524
retrace_v4l2_vp8_segment_gen(json_object * ctrl_obj)525 struct v4l2_vp8_segment *retrace_v4l2_vp8_segment_gen(json_object *ctrl_obj)
526 {
527 struct v4l2_vp8_segment *p = (struct v4l2_vp8_segment *) calloc(1, sizeof(v4l2_vp8_segment));
528 json_object *v4l2_vp8_segment_obj;
529 if (!json_object_object_get_ex(ctrl_obj, "v4l2_vp8_segment", &v4l2_vp8_segment_obj))
530 v4l2_vp8_segment_obj = ctrl_obj;
531
532 /* __s8 quant_update[4] */
533 json_object *quant_update_obj;
534 if (json_object_object_get_ex(v4l2_vp8_segment_obj, "quant_update", &quant_update_obj)) {
535 for (size_t i = 0; i < 4; i++) {
536 if (json_object_array_get_idx(quant_update_obj, i))
537 p->quant_update[i] = (__s8) json_object_get_int(json_object_array_get_idx(quant_update_obj, i));
538 }
539 }
540
541 /* __s8 lf_update[4] */
542 json_object *lf_update_obj;
543 if (json_object_object_get_ex(v4l2_vp8_segment_obj, "lf_update", &lf_update_obj)) {
544 for (size_t i = 0; i < 4; i++) {
545 if (json_object_array_get_idx(lf_update_obj, i))
546 p->lf_update[i] = (__s8) json_object_get_int(json_object_array_get_idx(lf_update_obj, i));
547 }
548 }
549
550 /* __u8 segment_probs[3] */
551 json_object *segment_probs_obj;
552 if (json_object_object_get_ex(v4l2_vp8_segment_obj, "segment_probs", &segment_probs_obj)) {
553 for (size_t i = 0; i < 3; i++) {
554 if (json_object_array_get_idx(segment_probs_obj, i))
555 p->segment_probs[i] = (__u8) json_object_get_int(json_object_array_get_idx(segment_probs_obj, i));
556 }
557 }
558
559 json_object *padding_obj;
560 if (json_object_object_get_ex(v4l2_vp8_segment_obj, "padding", &padding_obj))
561 p->padding = (__u8) json_object_get_int(padding_obj);
562
563 json_object *flags_obj;
564 if (json_object_object_get_ex(v4l2_vp8_segment_obj, "flags", &flags_obj))
565 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_vp8_segment_flag_def);
566
567 return p;
568 }
569
retrace_v4l2_vp8_loop_filter_gen(json_object * ctrl_obj)570 struct v4l2_vp8_loop_filter *retrace_v4l2_vp8_loop_filter_gen(json_object *ctrl_obj)
571 {
572 struct v4l2_vp8_loop_filter *p = (struct v4l2_vp8_loop_filter *) calloc(1, sizeof(v4l2_vp8_loop_filter));
573 json_object *v4l2_vp8_loop_filter_obj;
574 if (!json_object_object_get_ex(ctrl_obj, "v4l2_vp8_loop_filter", &v4l2_vp8_loop_filter_obj))
575 v4l2_vp8_loop_filter_obj = ctrl_obj;
576
577 /* __s8 ref_frm_delta[4] */
578 json_object *ref_frm_delta_obj;
579 if (json_object_object_get_ex(v4l2_vp8_loop_filter_obj, "ref_frm_delta", &ref_frm_delta_obj)) {
580 for (size_t i = 0; i < 4; i++) {
581 if (json_object_array_get_idx(ref_frm_delta_obj, i))
582 p->ref_frm_delta[i] = (__s8) json_object_get_int(json_object_array_get_idx(ref_frm_delta_obj, i));
583 }
584 }
585
586 /* __s8 mb_mode_delta[4] */
587 json_object *mb_mode_delta_obj;
588 if (json_object_object_get_ex(v4l2_vp8_loop_filter_obj, "mb_mode_delta", &mb_mode_delta_obj)) {
589 for (size_t i = 0; i < 4; i++) {
590 if (json_object_array_get_idx(mb_mode_delta_obj, i))
591 p->mb_mode_delta[i] = (__s8) json_object_get_int(json_object_array_get_idx(mb_mode_delta_obj, i));
592 }
593 }
594
595 json_object *sharpness_level_obj;
596 if (json_object_object_get_ex(v4l2_vp8_loop_filter_obj, "sharpness_level", &sharpness_level_obj))
597 p->sharpness_level = (__u8) json_object_get_int(sharpness_level_obj);
598
599 json_object *level_obj;
600 if (json_object_object_get_ex(v4l2_vp8_loop_filter_obj, "level", &level_obj))
601 p->level = (__u8) json_object_get_int(level_obj);
602
603 json_object *padding_obj;
604 if (json_object_object_get_ex(v4l2_vp8_loop_filter_obj, "padding", &padding_obj))
605 p->padding = (__u16) json_object_get_int(padding_obj);
606
607 json_object *flags_obj;
608 if (json_object_object_get_ex(v4l2_vp8_loop_filter_obj, "flags", &flags_obj))
609 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_vp8_loop_filter_flag_def);
610
611 return p;
612 }
613
retrace_v4l2_vp8_quantization_gen(json_object * ctrl_obj)614 struct v4l2_vp8_quantization *retrace_v4l2_vp8_quantization_gen(json_object *ctrl_obj)
615 {
616 struct v4l2_vp8_quantization *p = (struct v4l2_vp8_quantization *) calloc(1, sizeof(v4l2_vp8_quantization));
617 json_object *v4l2_vp8_quantization_obj;
618 if (!json_object_object_get_ex(ctrl_obj, "v4l2_vp8_quantization", &v4l2_vp8_quantization_obj))
619 v4l2_vp8_quantization_obj = ctrl_obj;
620
621 json_object *y_ac_qi_obj;
622 if (json_object_object_get_ex(v4l2_vp8_quantization_obj, "y_ac_qi", &y_ac_qi_obj))
623 p->y_ac_qi = (__u8) json_object_get_int(y_ac_qi_obj);
624
625 json_object *y_dc_delta_obj;
626 if (json_object_object_get_ex(v4l2_vp8_quantization_obj, "y_dc_delta", &y_dc_delta_obj))
627 p->y_dc_delta = (__s8) json_object_get_int(y_dc_delta_obj);
628
629 json_object *y2_dc_delta_obj;
630 if (json_object_object_get_ex(v4l2_vp8_quantization_obj, "y2_dc_delta", &y2_dc_delta_obj))
631 p->y2_dc_delta = (__s8) json_object_get_int(y2_dc_delta_obj);
632
633 json_object *y2_ac_delta_obj;
634 if (json_object_object_get_ex(v4l2_vp8_quantization_obj, "y2_ac_delta", &y2_ac_delta_obj))
635 p->y2_ac_delta = (__s8) json_object_get_int(y2_ac_delta_obj);
636
637 json_object *uv_dc_delta_obj;
638 if (json_object_object_get_ex(v4l2_vp8_quantization_obj, "uv_dc_delta", &uv_dc_delta_obj))
639 p->uv_dc_delta = (__s8) json_object_get_int(uv_dc_delta_obj);
640
641 json_object *uv_ac_delta_obj;
642 if (json_object_object_get_ex(v4l2_vp8_quantization_obj, "uv_ac_delta", &uv_ac_delta_obj))
643 p->uv_ac_delta = (__s8) json_object_get_int(uv_ac_delta_obj);
644
645 json_object *padding_obj;
646 if (json_object_object_get_ex(v4l2_vp8_quantization_obj, "padding", &padding_obj))
647 p->padding = (__u16) json_object_get_int(padding_obj);
648
649 return p;
650 }
651
retrace_v4l2_vp8_entropy_gen(json_object * ctrl_obj)652 struct v4l2_vp8_entropy *retrace_v4l2_vp8_entropy_gen(json_object *ctrl_obj)
653 {
654 struct v4l2_vp8_entropy *p = (struct v4l2_vp8_entropy *) calloc(1, sizeof(v4l2_vp8_entropy));
655 json_object *v4l2_vp8_entropy_obj;
656 if (!json_object_object_get_ex(ctrl_obj, "v4l2_vp8_entropy", &v4l2_vp8_entropy_obj))
657 v4l2_vp8_entropy_obj = ctrl_obj;
658
659 /* __u8 coeff_probs[4][8][3][V4L2_VP8_COEFF_PROB_CNT] */
660 int count_coeff_probs = 0;
661 json_object *coeff_probs_obj;
662 if (json_object_object_get_ex(v4l2_vp8_entropy_obj, "coeff_probs", &coeff_probs_obj)) {
663 for (size_t i = 0; i < 4; i++) {
664 for (size_t j = 0; j < 8; j++) {
665 for (size_t k = 0; k < 3; k++) {
666 for (size_t l = 0; l < V4L2_VP8_COEFF_PROB_CNT; l++) {
667 if (json_object_array_get_idx(coeff_probs_obj, count_coeff_probs))
668 p->coeff_probs[i][j][k][l] = (__u8) json_object_get_int(json_object_array_get_idx(coeff_probs_obj, count_coeff_probs++));
669 }
670 }
671 }
672 }
673 }
674
675 /* __u8 y_mode_probs[4] */
676 json_object *y_mode_probs_obj;
677 if (json_object_object_get_ex(v4l2_vp8_entropy_obj, "y_mode_probs", &y_mode_probs_obj)) {
678 for (size_t i = 0; i < 4; i++) {
679 if (json_object_array_get_idx(y_mode_probs_obj, i))
680 p->y_mode_probs[i] = (__u8) json_object_get_int(json_object_array_get_idx(y_mode_probs_obj, i));
681 }
682 }
683
684 /* __u8 uv_mode_probs[3] */
685 json_object *uv_mode_probs_obj;
686 if (json_object_object_get_ex(v4l2_vp8_entropy_obj, "uv_mode_probs", &uv_mode_probs_obj)) {
687 for (size_t i = 0; i < 3; i++) {
688 if (json_object_array_get_idx(uv_mode_probs_obj, i))
689 p->uv_mode_probs[i] = (__u8) json_object_get_int(json_object_array_get_idx(uv_mode_probs_obj, i));
690 }
691 }
692
693 /* __u8 mv_probs[2][V4L2_VP8_MV_PROB_CNT] */
694 int count_mv_probs = 0;
695 json_object *mv_probs_obj;
696 if (json_object_object_get_ex(v4l2_vp8_entropy_obj, "mv_probs", &mv_probs_obj)) {
697 for (size_t i = 0; i < 2; i++) {
698 for (size_t j = 0; j < V4L2_VP8_MV_PROB_CNT; j++) {
699 if (json_object_array_get_idx(mv_probs_obj, count_mv_probs))
700 p->mv_probs[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(mv_probs_obj, count_mv_probs++));
701 }
702 }
703 }
704
705 /* __u8 padding[3] */
706 json_object *padding_obj;
707 if (json_object_object_get_ex(v4l2_vp8_entropy_obj, "padding", &padding_obj)) {
708 for (size_t i = 0; i < 3; i++) {
709 if (json_object_array_get_idx(padding_obj, i))
710 p->padding[i] = (__u8) json_object_get_int(json_object_array_get_idx(padding_obj, i));
711 }
712 }
713
714 return p;
715 }
716
retrace_v4l2_vp8_entropy_coder_state_gen(json_object * ctrl_obj)717 struct v4l2_vp8_entropy_coder_state *retrace_v4l2_vp8_entropy_coder_state_gen(json_object *ctrl_obj)
718 {
719 struct v4l2_vp8_entropy_coder_state *p = (struct v4l2_vp8_entropy_coder_state *) calloc(1, sizeof(v4l2_vp8_entropy_coder_state));
720 json_object *v4l2_vp8_entropy_coder_state_obj;
721 if (!json_object_object_get_ex(ctrl_obj, "v4l2_vp8_entropy_coder_state", &v4l2_vp8_entropy_coder_state_obj))
722 v4l2_vp8_entropy_coder_state_obj = ctrl_obj;
723
724 json_object *range_obj;
725 if (json_object_object_get_ex(v4l2_vp8_entropy_coder_state_obj, "range", &range_obj))
726 p->range = (__u8) json_object_get_int(range_obj);
727
728 json_object *value_obj;
729 if (json_object_object_get_ex(v4l2_vp8_entropy_coder_state_obj, "value", &value_obj))
730 p->value = (__u8) json_object_get_int(value_obj);
731
732 json_object *bit_count_obj;
733 if (json_object_object_get_ex(v4l2_vp8_entropy_coder_state_obj, "bit_count", &bit_count_obj))
734 p->bit_count = (__u8) json_object_get_int(bit_count_obj);
735
736 json_object *padding_obj;
737 if (json_object_object_get_ex(v4l2_vp8_entropy_coder_state_obj, "padding", &padding_obj))
738 p->padding = (__u8) json_object_get_int(padding_obj);
739
740 return p;
741 }
742
retrace_v4l2_ctrl_vp8_frame_gen(json_object * ctrl_obj)743 struct v4l2_ctrl_vp8_frame *retrace_v4l2_ctrl_vp8_frame_gen(json_object *ctrl_obj)
744 {
745 struct v4l2_ctrl_vp8_frame *p = (struct v4l2_ctrl_vp8_frame *) calloc(1, sizeof(v4l2_ctrl_vp8_frame));
746 json_object *v4l2_ctrl_vp8_frame_obj;
747 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_vp8_frame", &v4l2_ctrl_vp8_frame_obj))
748 v4l2_ctrl_vp8_frame_obj = ctrl_obj;
749
750 /* struct v4l2_vp8_segment segment */
751 json_object *segment_obj;
752 if (!json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "v4l2_vp8_segment", &segment_obj))
753 return p;
754 void *segment_ptr = (void *) retrace_v4l2_vp8_segment_gen(segment_obj);
755 p->segment = *static_cast<struct v4l2_vp8_segment*>(segment_ptr);
756 free(segment_ptr);
757
758 /* struct v4l2_vp8_loop_filter lf */
759 json_object *lf_obj;
760 if (!json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "v4l2_vp8_loop_filter", &lf_obj))
761 return p;
762 void *lf_ptr = (void *) retrace_v4l2_vp8_loop_filter_gen(lf_obj);
763 p->lf = *static_cast<struct v4l2_vp8_loop_filter*>(lf_ptr);
764 free(lf_ptr);
765
766 /* struct v4l2_vp8_quantization quant */
767 json_object *quant_obj;
768 if (!json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "v4l2_vp8_quantization", &quant_obj))
769 return p;
770 void *quant_ptr = (void *) retrace_v4l2_vp8_quantization_gen(quant_obj);
771 p->quant = *static_cast<struct v4l2_vp8_quantization*>(quant_ptr);
772 free(quant_ptr);
773
774 /* struct v4l2_vp8_entropy entropy */
775 json_object *entropy_obj;
776 if (!json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "v4l2_vp8_entropy", &entropy_obj))
777 return p;
778 void *entropy_ptr = (void *) retrace_v4l2_vp8_entropy_gen(entropy_obj);
779 p->entropy = *static_cast<struct v4l2_vp8_entropy*>(entropy_ptr);
780 free(entropy_ptr);
781
782 /* struct v4l2_vp8_entropy_coder_state coder_state */
783 json_object *coder_state_obj;
784 if (!json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "v4l2_vp8_entropy_coder_state", &coder_state_obj))
785 return p;
786 void *coder_state_ptr = (void *) retrace_v4l2_vp8_entropy_coder_state_gen(coder_state_obj);
787 p->coder_state = *static_cast<struct v4l2_vp8_entropy_coder_state*>(coder_state_ptr);
788 free(coder_state_ptr);
789
790 json_object *width_obj;
791 if (json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "width", &width_obj))
792 p->width = (__u16) json_object_get_int(width_obj);
793
794 json_object *height_obj;
795 if (json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "height", &height_obj))
796 p->height = (__u16) json_object_get_int(height_obj);
797
798 json_object *horizontal_scale_obj;
799 if (json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "horizontal_scale", &horizontal_scale_obj))
800 p->horizontal_scale = (__u8) json_object_get_int(horizontal_scale_obj);
801
802 json_object *vertical_scale_obj;
803 if (json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "vertical_scale", &vertical_scale_obj))
804 p->vertical_scale = (__u8) json_object_get_int(vertical_scale_obj);
805
806 json_object *version_obj;
807 if (json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "version", &version_obj))
808 p->version = (__u8) json_object_get_int(version_obj);
809
810 json_object *prob_skip_false_obj;
811 if (json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "prob_skip_false", &prob_skip_false_obj))
812 p->prob_skip_false = (__u8) json_object_get_int(prob_skip_false_obj);
813
814 json_object *prob_intra_obj;
815 if (json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "prob_intra", &prob_intra_obj))
816 p->prob_intra = (__u8) json_object_get_int(prob_intra_obj);
817
818 json_object *prob_last_obj;
819 if (json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "prob_last", &prob_last_obj))
820 p->prob_last = (__u8) json_object_get_int(prob_last_obj);
821
822 json_object *prob_gf_obj;
823 if (json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "prob_gf", &prob_gf_obj))
824 p->prob_gf = (__u8) json_object_get_int(prob_gf_obj);
825
826 json_object *num_dct_parts_obj;
827 if (json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "num_dct_parts", &num_dct_parts_obj))
828 p->num_dct_parts = (__u8) json_object_get_int(num_dct_parts_obj);
829
830 json_object *first_part_size_obj;
831 if (json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "first_part_size", &first_part_size_obj))
832 p->first_part_size = (__u32) json_object_get_int64(first_part_size_obj);
833
834 json_object *first_part_header_bits_obj;
835 if (json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "first_part_header_bits", &first_part_header_bits_obj))
836 p->first_part_header_bits = (__u32) json_object_get_int64(first_part_header_bits_obj);
837
838 /* __u32 dct_part_sizes[8] */
839 json_object *dct_part_sizes_obj;
840 if (json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "dct_part_sizes", &dct_part_sizes_obj)) {
841 for (size_t i = 0; i < 8; i++) {
842 if (json_object_array_get_idx(dct_part_sizes_obj, i))
843 p->dct_part_sizes[i] = (__u32) json_object_get_int64(json_object_array_get_idx(dct_part_sizes_obj, i));
844 }
845 }
846
847 json_object *last_frame_ts_obj;
848 if (json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "last_frame_ts", &last_frame_ts_obj))
849 p->last_frame_ts = (__u64) json_object_get_uint64(last_frame_ts_obj);
850
851 json_object *golden_frame_ts_obj;
852 if (json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "golden_frame_ts", &golden_frame_ts_obj))
853 p->golden_frame_ts = (__u64) json_object_get_uint64(golden_frame_ts_obj);
854
855 json_object *alt_frame_ts_obj;
856 if (json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "alt_frame_ts", &alt_frame_ts_obj))
857 p->alt_frame_ts = (__u64) json_object_get_uint64(alt_frame_ts_obj);
858
859 json_object *flags_obj;
860 if (json_object_object_get_ex(v4l2_ctrl_vp8_frame_obj, "flags", &flags_obj))
861 p->flags = (__u64) s2flags(json_object_get_string(flags_obj), v4l2_vp8_frame_flag_def);
862
863 return p;
864 }
865
retrace_v4l2_ctrl_mpeg2_sequence_gen(json_object * ctrl_obj)866 struct v4l2_ctrl_mpeg2_sequence *retrace_v4l2_ctrl_mpeg2_sequence_gen(json_object *ctrl_obj)
867 {
868 struct v4l2_ctrl_mpeg2_sequence *p = (struct v4l2_ctrl_mpeg2_sequence *) calloc(1, sizeof(v4l2_ctrl_mpeg2_sequence));
869 json_object *v4l2_ctrl_mpeg2_sequence_obj;
870 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_mpeg2_sequence", &v4l2_ctrl_mpeg2_sequence_obj))
871 v4l2_ctrl_mpeg2_sequence_obj = ctrl_obj;
872
873 json_object *horizontal_size_obj;
874 if (json_object_object_get_ex(v4l2_ctrl_mpeg2_sequence_obj, "horizontal_size", &horizontal_size_obj))
875 p->horizontal_size = (__u16) json_object_get_int(horizontal_size_obj);
876
877 json_object *vertical_size_obj;
878 if (json_object_object_get_ex(v4l2_ctrl_mpeg2_sequence_obj, "vertical_size", &vertical_size_obj))
879 p->vertical_size = (__u16) json_object_get_int(vertical_size_obj);
880
881 json_object *vbv_buffer_size_obj;
882 if (json_object_object_get_ex(v4l2_ctrl_mpeg2_sequence_obj, "vbv_buffer_size", &vbv_buffer_size_obj))
883 p->vbv_buffer_size = (__u32) json_object_get_int64(vbv_buffer_size_obj);
884
885 json_object *profile_and_level_indication_obj;
886 if (json_object_object_get_ex(v4l2_ctrl_mpeg2_sequence_obj, "profile_and_level_indication", &profile_and_level_indication_obj))
887 p->profile_and_level_indication = (__u16) json_object_get_int(profile_and_level_indication_obj);
888
889 json_object *chroma_format_obj;
890 if (json_object_object_get_ex(v4l2_ctrl_mpeg2_sequence_obj, "chroma_format", &chroma_format_obj))
891 p->chroma_format = (__u8) json_object_get_int(chroma_format_obj);
892
893 json_object *flags_obj;
894 if (json_object_object_get_ex(v4l2_ctrl_mpeg2_sequence_obj, "flags", &flags_obj))
895 p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_mpeg2_seq_flag_def);
896
897 return p;
898 }
899
retrace_v4l2_ctrl_mpeg2_picture_gen(json_object * ctrl_obj)900 struct v4l2_ctrl_mpeg2_picture *retrace_v4l2_ctrl_mpeg2_picture_gen(json_object *ctrl_obj)
901 {
902 struct v4l2_ctrl_mpeg2_picture *p = (struct v4l2_ctrl_mpeg2_picture *) calloc(1, sizeof(v4l2_ctrl_mpeg2_picture));
903 json_object *v4l2_ctrl_mpeg2_picture_obj;
904 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_mpeg2_picture", &v4l2_ctrl_mpeg2_picture_obj))
905 v4l2_ctrl_mpeg2_picture_obj = ctrl_obj;
906
907 json_object *backward_ref_ts_obj;
908 if (json_object_object_get_ex(v4l2_ctrl_mpeg2_picture_obj, "backward_ref_ts", &backward_ref_ts_obj))
909 p->backward_ref_ts = (__u64) json_object_get_uint64(backward_ref_ts_obj);
910
911 json_object *forward_ref_ts_obj;
912 if (json_object_object_get_ex(v4l2_ctrl_mpeg2_picture_obj, "forward_ref_ts", &forward_ref_ts_obj))
913 p->forward_ref_ts = (__u64) json_object_get_uint64(forward_ref_ts_obj);
914
915 json_object *flags_obj;
916 if (json_object_object_get_ex(v4l2_ctrl_mpeg2_picture_obj, "flags", &flags_obj))
917 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_mpeg2_pic_flag_def);
918
919 /* __u8 f_code[2][2] */
920 int count_f_code = 0;
921 json_object *f_code_obj;
922 if (json_object_object_get_ex(v4l2_ctrl_mpeg2_picture_obj, "f_code", &f_code_obj)) {
923 for (size_t i = 0; i < 2; i++) {
924 for (size_t j = 0; j < 2; j++) {
925 if (json_object_array_get_idx(f_code_obj, count_f_code))
926 p->f_code[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(f_code_obj, count_f_code++));
927 }
928 }
929 }
930
931 json_object *picture_coding_type_obj;
932 if (json_object_object_get_ex(v4l2_ctrl_mpeg2_picture_obj, "picture_coding_type", &picture_coding_type_obj))
933 p->picture_coding_type = (__u8) json_object_get_int(picture_coding_type_obj);
934
935 json_object *picture_structure_obj;
936 if (json_object_object_get_ex(v4l2_ctrl_mpeg2_picture_obj, "picture_structure", &picture_structure_obj))
937 p->picture_structure = (__u8) json_object_get_int(picture_structure_obj);
938
939 json_object *intra_dc_precision_obj;
940 if (json_object_object_get_ex(v4l2_ctrl_mpeg2_picture_obj, "intra_dc_precision", &intra_dc_precision_obj))
941 p->intra_dc_precision = (__u8) json_object_get_int(intra_dc_precision_obj);
942
943 return p;
944 }
945
retrace_v4l2_ctrl_mpeg2_quantisation_gen(json_object * ctrl_obj)946 struct v4l2_ctrl_mpeg2_quantisation *retrace_v4l2_ctrl_mpeg2_quantisation_gen(json_object *ctrl_obj)
947 {
948 struct v4l2_ctrl_mpeg2_quantisation *p = (struct v4l2_ctrl_mpeg2_quantisation *) calloc(1, sizeof(v4l2_ctrl_mpeg2_quantisation));
949 json_object *v4l2_ctrl_mpeg2_quantisation_obj;
950 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_mpeg2_quantisation", &v4l2_ctrl_mpeg2_quantisation_obj))
951 v4l2_ctrl_mpeg2_quantisation_obj = ctrl_obj;
952
953 /* __u8 intra_quantiser_matrix[64] */
954 json_object *intra_quantiser_matrix_obj;
955 if (json_object_object_get_ex(v4l2_ctrl_mpeg2_quantisation_obj, "intra_quantiser_matrix", &intra_quantiser_matrix_obj)) {
956 for (size_t i = 0; i < 64; i++) {
957 if (json_object_array_get_idx(intra_quantiser_matrix_obj, i))
958 p->intra_quantiser_matrix[i] = (__u8) json_object_get_int(json_object_array_get_idx(intra_quantiser_matrix_obj, i));
959 }
960 }
961
962 /* __u8 non_intra_quantiser_matrix[64] */
963 json_object *non_intra_quantiser_matrix_obj;
964 if (json_object_object_get_ex(v4l2_ctrl_mpeg2_quantisation_obj, "non_intra_quantiser_matrix", &non_intra_quantiser_matrix_obj)) {
965 for (size_t i = 0; i < 64; i++) {
966 if (json_object_array_get_idx(non_intra_quantiser_matrix_obj, i))
967 p->non_intra_quantiser_matrix[i] = (__u8) json_object_get_int(json_object_array_get_idx(non_intra_quantiser_matrix_obj, i));
968 }
969 }
970
971 /* __u8 chroma_intra_quantiser_matrix[64] */
972 json_object *chroma_intra_quantiser_matrix_obj;
973 if (json_object_object_get_ex(v4l2_ctrl_mpeg2_quantisation_obj, "chroma_intra_quantiser_matrix", &chroma_intra_quantiser_matrix_obj)) {
974 for (size_t i = 0; i < 64; i++) {
975 if (json_object_array_get_idx(chroma_intra_quantiser_matrix_obj, i))
976 p->chroma_intra_quantiser_matrix[i] = (__u8) json_object_get_int(json_object_array_get_idx(chroma_intra_quantiser_matrix_obj, i));
977 }
978 }
979
980 /* __u8 chroma_non_intra_quantiser_matrix[64] */
981 json_object *chroma_non_intra_quantiser_matrix_obj;
982 if (json_object_object_get_ex(v4l2_ctrl_mpeg2_quantisation_obj, "chroma_non_intra_quantiser_matrix", &chroma_non_intra_quantiser_matrix_obj)) {
983 for (size_t i = 0; i < 64; i++) {
984 if (json_object_array_get_idx(chroma_non_intra_quantiser_matrix_obj, i))
985 p->chroma_non_intra_quantiser_matrix[i] = (__u8) json_object_get_int(json_object_array_get_idx(chroma_non_intra_quantiser_matrix_obj, i));
986 }
987 }
988
989 return p;
990 }
991
retrace_v4l2_ctrl_hevc_sps_gen(json_object * ctrl_obj)992 struct v4l2_ctrl_hevc_sps *retrace_v4l2_ctrl_hevc_sps_gen(json_object *ctrl_obj)
993 {
994 struct v4l2_ctrl_hevc_sps *p = (struct v4l2_ctrl_hevc_sps *) calloc(1, sizeof(v4l2_ctrl_hevc_sps));
995 json_object *v4l2_ctrl_hevc_sps_obj;
996 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_hevc_sps", &v4l2_ctrl_hevc_sps_obj))
997 v4l2_ctrl_hevc_sps_obj = ctrl_obj;
998
999 json_object *video_parameter_set_id_obj;
1000 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "video_parameter_set_id", &video_parameter_set_id_obj))
1001 p->video_parameter_set_id = (__u8) json_object_get_int(video_parameter_set_id_obj);
1002
1003 json_object *seq_parameter_set_id_obj;
1004 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "seq_parameter_set_id", &seq_parameter_set_id_obj))
1005 p->seq_parameter_set_id = (__u8) json_object_get_int(seq_parameter_set_id_obj);
1006
1007 json_object *pic_width_in_luma_samples_obj;
1008 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "pic_width_in_luma_samples", &pic_width_in_luma_samples_obj))
1009 p->pic_width_in_luma_samples = (__u16) json_object_get_int(pic_width_in_luma_samples_obj);
1010
1011 json_object *pic_height_in_luma_samples_obj;
1012 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "pic_height_in_luma_samples", &pic_height_in_luma_samples_obj))
1013 p->pic_height_in_luma_samples = (__u16) json_object_get_int(pic_height_in_luma_samples_obj);
1014
1015 json_object *bit_depth_luma_minus8_obj;
1016 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "bit_depth_luma_minus8", &bit_depth_luma_minus8_obj))
1017 p->bit_depth_luma_minus8 = (__u8) json_object_get_int(bit_depth_luma_minus8_obj);
1018
1019 json_object *bit_depth_chroma_minus8_obj;
1020 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "bit_depth_chroma_minus8", &bit_depth_chroma_minus8_obj))
1021 p->bit_depth_chroma_minus8 = (__u8) json_object_get_int(bit_depth_chroma_minus8_obj);
1022
1023 json_object *log2_max_pic_order_cnt_lsb_minus4_obj;
1024 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "log2_max_pic_order_cnt_lsb_minus4", &log2_max_pic_order_cnt_lsb_minus4_obj))
1025 p->log2_max_pic_order_cnt_lsb_minus4 = (__u8) json_object_get_int(log2_max_pic_order_cnt_lsb_minus4_obj);
1026
1027 json_object *sps_max_dec_pic_buffering_minus1_obj;
1028 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "sps_max_dec_pic_buffering_minus1", &sps_max_dec_pic_buffering_minus1_obj))
1029 p->sps_max_dec_pic_buffering_minus1 = (__u8) json_object_get_int(sps_max_dec_pic_buffering_minus1_obj);
1030
1031 json_object *sps_max_num_reorder_pics_obj;
1032 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "sps_max_num_reorder_pics", &sps_max_num_reorder_pics_obj))
1033 p->sps_max_num_reorder_pics = (__u8) json_object_get_int(sps_max_num_reorder_pics_obj);
1034
1035 json_object *sps_max_latency_increase_plus1_obj;
1036 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "sps_max_latency_increase_plus1", &sps_max_latency_increase_plus1_obj))
1037 p->sps_max_latency_increase_plus1 = (__u8) json_object_get_int(sps_max_latency_increase_plus1_obj);
1038
1039 json_object *log2_min_luma_coding_block_size_minus3_obj;
1040 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "log2_min_luma_coding_block_size_minus3", &log2_min_luma_coding_block_size_minus3_obj))
1041 p->log2_min_luma_coding_block_size_minus3 = (__u8) json_object_get_int(log2_min_luma_coding_block_size_minus3_obj);
1042
1043 json_object *log2_diff_max_min_luma_coding_block_size_obj;
1044 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "log2_diff_max_min_luma_coding_block_size", &log2_diff_max_min_luma_coding_block_size_obj))
1045 p->log2_diff_max_min_luma_coding_block_size = (__u8) json_object_get_int(log2_diff_max_min_luma_coding_block_size_obj);
1046
1047 json_object *log2_min_luma_transform_block_size_minus2_obj;
1048 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "log2_min_luma_transform_block_size_minus2", &log2_min_luma_transform_block_size_minus2_obj))
1049 p->log2_min_luma_transform_block_size_minus2 = (__u8) json_object_get_int(log2_min_luma_transform_block_size_minus2_obj);
1050
1051 json_object *log2_diff_max_min_luma_transform_block_size_obj;
1052 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "log2_diff_max_min_luma_transform_block_size", &log2_diff_max_min_luma_transform_block_size_obj))
1053 p->log2_diff_max_min_luma_transform_block_size = (__u8) json_object_get_int(log2_diff_max_min_luma_transform_block_size_obj);
1054
1055 json_object *max_transform_hierarchy_depth_inter_obj;
1056 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "max_transform_hierarchy_depth_inter", &max_transform_hierarchy_depth_inter_obj))
1057 p->max_transform_hierarchy_depth_inter = (__u8) json_object_get_int(max_transform_hierarchy_depth_inter_obj);
1058
1059 json_object *max_transform_hierarchy_depth_intra_obj;
1060 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "max_transform_hierarchy_depth_intra", &max_transform_hierarchy_depth_intra_obj))
1061 p->max_transform_hierarchy_depth_intra = (__u8) json_object_get_int(max_transform_hierarchy_depth_intra_obj);
1062
1063 json_object *pcm_sample_bit_depth_luma_minus1_obj;
1064 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "pcm_sample_bit_depth_luma_minus1", &pcm_sample_bit_depth_luma_minus1_obj))
1065 p->pcm_sample_bit_depth_luma_minus1 = (__u8) json_object_get_int(pcm_sample_bit_depth_luma_minus1_obj);
1066
1067 json_object *pcm_sample_bit_depth_chroma_minus1_obj;
1068 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "pcm_sample_bit_depth_chroma_minus1", &pcm_sample_bit_depth_chroma_minus1_obj))
1069 p->pcm_sample_bit_depth_chroma_minus1 = (__u8) json_object_get_int(pcm_sample_bit_depth_chroma_minus1_obj);
1070
1071 json_object *log2_min_pcm_luma_coding_block_size_minus3_obj;
1072 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "log2_min_pcm_luma_coding_block_size_minus3", &log2_min_pcm_luma_coding_block_size_minus3_obj))
1073 p->log2_min_pcm_luma_coding_block_size_minus3 = (__u8) json_object_get_int(log2_min_pcm_luma_coding_block_size_minus3_obj);
1074
1075 json_object *log2_diff_max_min_pcm_luma_coding_block_size_obj;
1076 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "log2_diff_max_min_pcm_luma_coding_block_size", &log2_diff_max_min_pcm_luma_coding_block_size_obj))
1077 p->log2_diff_max_min_pcm_luma_coding_block_size = (__u8) json_object_get_int(log2_diff_max_min_pcm_luma_coding_block_size_obj);
1078
1079 json_object *num_short_term_ref_pic_sets_obj;
1080 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "num_short_term_ref_pic_sets", &num_short_term_ref_pic_sets_obj))
1081 p->num_short_term_ref_pic_sets = (__u8) json_object_get_int(num_short_term_ref_pic_sets_obj);
1082
1083 json_object *num_long_term_ref_pics_sps_obj;
1084 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "num_long_term_ref_pics_sps", &num_long_term_ref_pics_sps_obj))
1085 p->num_long_term_ref_pics_sps = (__u8) json_object_get_int(num_long_term_ref_pics_sps_obj);
1086
1087 json_object *chroma_format_idc_obj;
1088 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "chroma_format_idc", &chroma_format_idc_obj))
1089 p->chroma_format_idc = (__u8) json_object_get_int(chroma_format_idc_obj);
1090
1091 json_object *sps_max_sub_layers_minus1_obj;
1092 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "sps_max_sub_layers_minus1", &sps_max_sub_layers_minus1_obj))
1093 p->sps_max_sub_layers_minus1 = (__u8) json_object_get_int(sps_max_sub_layers_minus1_obj);
1094
1095 json_object *flags_obj;
1096 if (json_object_object_get_ex(v4l2_ctrl_hevc_sps_obj, "flags", &flags_obj))
1097 p->flags = (__u64) s2flags(json_object_get_string(flags_obj), v4l2_hevc_sps_flag_def);
1098
1099 return p;
1100 }
1101
retrace_v4l2_ctrl_hevc_pps_gen(json_object * ctrl_obj)1102 struct v4l2_ctrl_hevc_pps *retrace_v4l2_ctrl_hevc_pps_gen(json_object *ctrl_obj)
1103 {
1104 struct v4l2_ctrl_hevc_pps *p = (struct v4l2_ctrl_hevc_pps *) calloc(1, sizeof(v4l2_ctrl_hevc_pps));
1105 json_object *v4l2_ctrl_hevc_pps_obj;
1106 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_hevc_pps", &v4l2_ctrl_hevc_pps_obj))
1107 v4l2_ctrl_hevc_pps_obj = ctrl_obj;
1108
1109 json_object *pic_parameter_set_id_obj;
1110 if (json_object_object_get_ex(v4l2_ctrl_hevc_pps_obj, "pic_parameter_set_id", &pic_parameter_set_id_obj))
1111 p->pic_parameter_set_id = (__u8) json_object_get_int(pic_parameter_set_id_obj);
1112
1113 json_object *num_extra_slice_header_bits_obj;
1114 if (json_object_object_get_ex(v4l2_ctrl_hevc_pps_obj, "num_extra_slice_header_bits", &num_extra_slice_header_bits_obj))
1115 p->num_extra_slice_header_bits = (__u8) json_object_get_int(num_extra_slice_header_bits_obj);
1116
1117 json_object *num_ref_idx_l0_default_active_minus1_obj;
1118 if (json_object_object_get_ex(v4l2_ctrl_hevc_pps_obj, "num_ref_idx_l0_default_active_minus1", &num_ref_idx_l0_default_active_minus1_obj))
1119 p->num_ref_idx_l0_default_active_minus1 = (__u8) json_object_get_int(num_ref_idx_l0_default_active_minus1_obj);
1120
1121 json_object *num_ref_idx_l1_default_active_minus1_obj;
1122 if (json_object_object_get_ex(v4l2_ctrl_hevc_pps_obj, "num_ref_idx_l1_default_active_minus1", &num_ref_idx_l1_default_active_minus1_obj))
1123 p->num_ref_idx_l1_default_active_minus1 = (__u8) json_object_get_int(num_ref_idx_l1_default_active_minus1_obj);
1124
1125 json_object *init_qp_minus26_obj;
1126 if (json_object_object_get_ex(v4l2_ctrl_hevc_pps_obj, "init_qp_minus26", &init_qp_minus26_obj))
1127 p->init_qp_minus26 = (__s8) json_object_get_int(init_qp_minus26_obj);
1128
1129 json_object *diff_cu_qp_delta_depth_obj;
1130 if (json_object_object_get_ex(v4l2_ctrl_hevc_pps_obj, "diff_cu_qp_delta_depth", &diff_cu_qp_delta_depth_obj))
1131 p->diff_cu_qp_delta_depth = (__u8) json_object_get_int(diff_cu_qp_delta_depth_obj);
1132
1133 json_object *pps_cb_qp_offset_obj;
1134 if (json_object_object_get_ex(v4l2_ctrl_hevc_pps_obj, "pps_cb_qp_offset", &pps_cb_qp_offset_obj))
1135 p->pps_cb_qp_offset = (__s8) json_object_get_int(pps_cb_qp_offset_obj);
1136
1137 json_object *pps_cr_qp_offset_obj;
1138 if (json_object_object_get_ex(v4l2_ctrl_hevc_pps_obj, "pps_cr_qp_offset", &pps_cr_qp_offset_obj))
1139 p->pps_cr_qp_offset = (__s8) json_object_get_int(pps_cr_qp_offset_obj);
1140
1141 json_object *num_tile_columns_minus1_obj;
1142 if (json_object_object_get_ex(v4l2_ctrl_hevc_pps_obj, "num_tile_columns_minus1", &num_tile_columns_minus1_obj))
1143 p->num_tile_columns_minus1 = (__u8) json_object_get_int(num_tile_columns_minus1_obj);
1144
1145 json_object *num_tile_rows_minus1_obj;
1146 if (json_object_object_get_ex(v4l2_ctrl_hevc_pps_obj, "num_tile_rows_minus1", &num_tile_rows_minus1_obj))
1147 p->num_tile_rows_minus1 = (__u8) json_object_get_int(num_tile_rows_minus1_obj);
1148
1149 /* __u8 column_width_minus1[20] */
1150 json_object *column_width_minus1_obj;
1151 if (json_object_object_get_ex(v4l2_ctrl_hevc_pps_obj, "column_width_minus1", &column_width_minus1_obj)) {
1152 for (size_t i = 0; i < 20; i++) {
1153 if (json_object_array_get_idx(column_width_minus1_obj, i))
1154 p->column_width_minus1[i] = (__u8) json_object_get_int(json_object_array_get_idx(column_width_minus1_obj, i));
1155 }
1156 }
1157
1158 /* __u8 row_height_minus1[22] */
1159 json_object *row_height_minus1_obj;
1160 if (json_object_object_get_ex(v4l2_ctrl_hevc_pps_obj, "row_height_minus1", &row_height_minus1_obj)) {
1161 for (size_t i = 0; i < 22; i++) {
1162 if (json_object_array_get_idx(row_height_minus1_obj, i))
1163 p->row_height_minus1[i] = (__u8) json_object_get_int(json_object_array_get_idx(row_height_minus1_obj, i));
1164 }
1165 }
1166
1167 json_object *pps_beta_offset_div2_obj;
1168 if (json_object_object_get_ex(v4l2_ctrl_hevc_pps_obj, "pps_beta_offset_div2", &pps_beta_offset_div2_obj))
1169 p->pps_beta_offset_div2 = (__s8) json_object_get_int(pps_beta_offset_div2_obj);
1170
1171 json_object *pps_tc_offset_div2_obj;
1172 if (json_object_object_get_ex(v4l2_ctrl_hevc_pps_obj, "pps_tc_offset_div2", &pps_tc_offset_div2_obj))
1173 p->pps_tc_offset_div2 = (__s8) json_object_get_int(pps_tc_offset_div2_obj);
1174
1175 json_object *log2_parallel_merge_level_minus2_obj;
1176 if (json_object_object_get_ex(v4l2_ctrl_hevc_pps_obj, "log2_parallel_merge_level_minus2", &log2_parallel_merge_level_minus2_obj))
1177 p->log2_parallel_merge_level_minus2 = (__u8) json_object_get_int(log2_parallel_merge_level_minus2_obj);
1178
1179 json_object *flags_obj;
1180 if (json_object_object_get_ex(v4l2_ctrl_hevc_pps_obj, "flags", &flags_obj))
1181 p->flags = (__u64) s2flags(json_object_get_string(flags_obj), v4l2_hevc_pps_flag_def);
1182
1183 return p;
1184 }
1185
retrace_v4l2_hevc_dpb_entry_gen(json_object * ctrl_obj)1186 struct v4l2_hevc_dpb_entry *retrace_v4l2_hevc_dpb_entry_gen(json_object *ctrl_obj)
1187 {
1188 struct v4l2_hevc_dpb_entry *p = (struct v4l2_hevc_dpb_entry *) calloc(1, sizeof(v4l2_hevc_dpb_entry));
1189 json_object *v4l2_hevc_dpb_entry_obj;
1190 if (!json_object_object_get_ex(ctrl_obj, "v4l2_hevc_dpb_entry", &v4l2_hevc_dpb_entry_obj))
1191 v4l2_hevc_dpb_entry_obj = ctrl_obj;
1192
1193 json_object *timestamp_obj;
1194 if (json_object_object_get_ex(v4l2_hevc_dpb_entry_obj, "timestamp", ×tamp_obj))
1195 p->timestamp = (__u64) json_object_get_uint64(timestamp_obj);
1196
1197 json_object *flags_obj;
1198 if (json_object_object_get_ex(v4l2_hevc_dpb_entry_obj, "flags", &flags_obj))
1199 p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_hevc_pps_flag_def);
1200
1201 json_object *field_pic_obj;
1202 if (json_object_object_get_ex(v4l2_hevc_dpb_entry_obj, "field_pic", &field_pic_obj))
1203 p->field_pic = (__u8) json_object_get_int(field_pic_obj);
1204
1205 json_object *pic_order_cnt_val_obj;
1206 if (json_object_object_get_ex(v4l2_hevc_dpb_entry_obj, "pic_order_cnt_val", &pic_order_cnt_val_obj))
1207 p->pic_order_cnt_val = (__s32) json_object_get_int(pic_order_cnt_val_obj);
1208
1209 return p;
1210 }
1211
retrace_v4l2_hevc_pred_weight_table_gen(json_object * ctrl_obj)1212 struct v4l2_hevc_pred_weight_table *retrace_v4l2_hevc_pred_weight_table_gen(json_object *ctrl_obj)
1213 {
1214 struct v4l2_hevc_pred_weight_table *p = (struct v4l2_hevc_pred_weight_table *) calloc(1, sizeof(v4l2_hevc_pred_weight_table));
1215 json_object *v4l2_hevc_pred_weight_table_obj;
1216 if (!json_object_object_get_ex(ctrl_obj, "v4l2_hevc_pred_weight_table", &v4l2_hevc_pred_weight_table_obj))
1217 v4l2_hevc_pred_weight_table_obj = ctrl_obj;
1218
1219 /* __s8 delta_luma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
1220 json_object *delta_luma_weight_l0_obj;
1221 if (json_object_object_get_ex(v4l2_hevc_pred_weight_table_obj, "delta_luma_weight_l0", &delta_luma_weight_l0_obj)) {
1222 for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
1223 if (json_object_array_get_idx(delta_luma_weight_l0_obj, i))
1224 p->delta_luma_weight_l0[i] = (__s8) json_object_get_int(json_object_array_get_idx(delta_luma_weight_l0_obj, i));
1225 }
1226 }
1227
1228 /* __s8 luma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
1229 json_object *luma_offset_l0_obj;
1230 if (json_object_object_get_ex(v4l2_hevc_pred_weight_table_obj, "luma_offset_l0", &luma_offset_l0_obj)) {
1231 for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
1232 if (json_object_array_get_idx(luma_offset_l0_obj, i))
1233 p->luma_offset_l0[i] = (__s8) json_object_get_int(json_object_array_get_idx(luma_offset_l0_obj, i));
1234 }
1235 }
1236
1237 /* __s8 delta_chroma_weight_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2] */
1238 int count_delta_chroma_weight_l0 = 0;
1239 json_object *delta_chroma_weight_l0_obj;
1240 if (json_object_object_get_ex(v4l2_hevc_pred_weight_table_obj, "delta_chroma_weight_l0", &delta_chroma_weight_l0_obj)) {
1241 for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
1242 for (size_t j = 0; j < 2; j++) {
1243 if (json_object_array_get_idx(delta_chroma_weight_l0_obj, count_delta_chroma_weight_l0))
1244 p->delta_chroma_weight_l0[i][j] = (__s8) json_object_get_int(json_object_array_get_idx(delta_chroma_weight_l0_obj, count_delta_chroma_weight_l0++));
1245 }
1246 }
1247 }
1248
1249 /* __s8 chroma_offset_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2] */
1250 int count_chroma_offset_l0 = 0;
1251 json_object *chroma_offset_l0_obj;
1252 if (json_object_object_get_ex(v4l2_hevc_pred_weight_table_obj, "chroma_offset_l0", &chroma_offset_l0_obj)) {
1253 for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
1254 for (size_t j = 0; j < 2; j++) {
1255 if (json_object_array_get_idx(chroma_offset_l0_obj, count_chroma_offset_l0))
1256 p->chroma_offset_l0[i][j] = (__s8) json_object_get_int(json_object_array_get_idx(chroma_offset_l0_obj, count_chroma_offset_l0++));
1257 }
1258 }
1259 }
1260
1261 /* __s8 delta_luma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
1262 json_object *delta_luma_weight_l1_obj;
1263 if (json_object_object_get_ex(v4l2_hevc_pred_weight_table_obj, "delta_luma_weight_l1", &delta_luma_weight_l1_obj)) {
1264 for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
1265 if (json_object_array_get_idx(delta_luma_weight_l1_obj, i))
1266 p->delta_luma_weight_l1[i] = (__s8) json_object_get_int(json_object_array_get_idx(delta_luma_weight_l1_obj, i));
1267 }
1268 }
1269
1270 /* __s8 luma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
1271 json_object *luma_offset_l1_obj;
1272 if (json_object_object_get_ex(v4l2_hevc_pred_weight_table_obj, "luma_offset_l1", &luma_offset_l1_obj)) {
1273 for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
1274 if (json_object_array_get_idx(luma_offset_l1_obj, i))
1275 p->luma_offset_l1[i] = (__s8) json_object_get_int(json_object_array_get_idx(luma_offset_l1_obj, i));
1276 }
1277 }
1278
1279 /* __s8 delta_chroma_weight_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2] */
1280 int count_delta_chroma_weight_l1 = 0;
1281 json_object *delta_chroma_weight_l1_obj;
1282 if (json_object_object_get_ex(v4l2_hevc_pred_weight_table_obj, "delta_chroma_weight_l1", &delta_chroma_weight_l1_obj)) {
1283 for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
1284 for (size_t j = 0; j < 2; j++) {
1285 if (json_object_array_get_idx(delta_chroma_weight_l1_obj, count_delta_chroma_weight_l1))
1286 p->delta_chroma_weight_l1[i][j] = (__s8) json_object_get_int(json_object_array_get_idx(delta_chroma_weight_l1_obj, count_delta_chroma_weight_l1++));
1287 }
1288 }
1289 }
1290
1291 /* __s8 chroma_offset_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX][2] */
1292 int count_chroma_offset_l1 = 0;
1293 json_object *chroma_offset_l1_obj;
1294 if (json_object_object_get_ex(v4l2_hevc_pred_weight_table_obj, "chroma_offset_l1", &chroma_offset_l1_obj)) {
1295 for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
1296 for (size_t j = 0; j < 2; j++) {
1297 if (json_object_array_get_idx(chroma_offset_l1_obj, count_chroma_offset_l1))
1298 p->chroma_offset_l1[i][j] = (__s8) json_object_get_int(json_object_array_get_idx(chroma_offset_l1_obj, count_chroma_offset_l1++));
1299 }
1300 }
1301 }
1302
1303 json_object *luma_log2_weight_denom_obj;
1304 if (json_object_object_get_ex(v4l2_hevc_pred_weight_table_obj, "luma_log2_weight_denom", &luma_log2_weight_denom_obj))
1305 p->luma_log2_weight_denom = (__u8) json_object_get_int(luma_log2_weight_denom_obj);
1306
1307 json_object *delta_chroma_log2_weight_denom_obj;
1308 if (json_object_object_get_ex(v4l2_hevc_pred_weight_table_obj, "delta_chroma_log2_weight_denom", &delta_chroma_log2_weight_denom_obj))
1309 p->delta_chroma_log2_weight_denom = (__s8) json_object_get_int(delta_chroma_log2_weight_denom_obj);
1310
1311 return p;
1312 }
1313
retrace_v4l2_ctrl_hevc_slice_params_gen(json_object * ctrl_obj)1314 struct v4l2_ctrl_hevc_slice_params *retrace_v4l2_ctrl_hevc_slice_params_gen(json_object *ctrl_obj)
1315 {
1316 struct v4l2_ctrl_hevc_slice_params *p = (struct v4l2_ctrl_hevc_slice_params *) calloc(1, sizeof(v4l2_ctrl_hevc_slice_params));
1317 json_object *v4l2_ctrl_hevc_slice_params_obj;
1318 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_hevc_slice_params", &v4l2_ctrl_hevc_slice_params_obj))
1319 v4l2_ctrl_hevc_slice_params_obj = ctrl_obj;
1320
1321 json_object *bit_size_obj;
1322 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "bit_size", &bit_size_obj))
1323 p->bit_size = (__u32) json_object_get_int64(bit_size_obj);
1324
1325 json_object *data_byte_offset_obj;
1326 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "data_byte_offset", &data_byte_offset_obj))
1327 p->data_byte_offset = (__u32) json_object_get_int64(data_byte_offset_obj);
1328
1329 json_object *num_entry_point_offsets_obj;
1330 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "num_entry_point_offsets", &num_entry_point_offsets_obj))
1331 p->num_entry_point_offsets = (__u32) json_object_get_int64(num_entry_point_offsets_obj);
1332
1333 json_object *nal_unit_type_obj;
1334 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "nal_unit_type", &nal_unit_type_obj))
1335 p->nal_unit_type = (__u8) json_object_get_int(nal_unit_type_obj);
1336
1337 json_object *nuh_temporal_id_plus1_obj;
1338 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "nuh_temporal_id_plus1", &nuh_temporal_id_plus1_obj))
1339 p->nuh_temporal_id_plus1 = (__u8) json_object_get_int(nuh_temporal_id_plus1_obj);
1340
1341 json_object *slice_type_obj;
1342 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "slice_type", &slice_type_obj))
1343 p->slice_type = (__u8) json_object_get_int(slice_type_obj);
1344
1345 json_object *colour_plane_id_obj;
1346 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "colour_plane_id", &colour_plane_id_obj))
1347 p->colour_plane_id = (__u8) json_object_get_int(colour_plane_id_obj);
1348
1349 json_object *slice_pic_order_cnt_obj;
1350 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "slice_pic_order_cnt", &slice_pic_order_cnt_obj))
1351 p->slice_pic_order_cnt = (__s32) json_object_get_int(slice_pic_order_cnt_obj);
1352
1353 json_object *num_ref_idx_l0_active_minus1_obj;
1354 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "num_ref_idx_l0_active_minus1", &num_ref_idx_l0_active_minus1_obj))
1355 p->num_ref_idx_l0_active_minus1 = (__u8) json_object_get_int(num_ref_idx_l0_active_minus1_obj);
1356
1357 json_object *num_ref_idx_l1_active_minus1_obj;
1358 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "num_ref_idx_l1_active_minus1", &num_ref_idx_l1_active_minus1_obj))
1359 p->num_ref_idx_l1_active_minus1 = (__u8) json_object_get_int(num_ref_idx_l1_active_minus1_obj);
1360
1361 json_object *collocated_ref_idx_obj;
1362 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "collocated_ref_idx", &collocated_ref_idx_obj))
1363 p->collocated_ref_idx = (__u8) json_object_get_int(collocated_ref_idx_obj);
1364
1365 json_object *five_minus_max_num_merge_cand_obj;
1366 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "five_minus_max_num_merge_cand", &five_minus_max_num_merge_cand_obj))
1367 p->five_minus_max_num_merge_cand = (__u8) json_object_get_int(five_minus_max_num_merge_cand_obj);
1368
1369 json_object *slice_qp_delta_obj;
1370 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "slice_qp_delta", &slice_qp_delta_obj))
1371 p->slice_qp_delta = (__s8) json_object_get_int(slice_qp_delta_obj);
1372
1373 json_object *slice_cb_qp_offset_obj;
1374 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "slice_cb_qp_offset", &slice_cb_qp_offset_obj))
1375 p->slice_cb_qp_offset = (__s8) json_object_get_int(slice_cb_qp_offset_obj);
1376
1377 json_object *slice_cr_qp_offset_obj;
1378 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "slice_cr_qp_offset", &slice_cr_qp_offset_obj))
1379 p->slice_cr_qp_offset = (__s8) json_object_get_int(slice_cr_qp_offset_obj);
1380
1381 json_object *slice_act_y_qp_offset_obj;
1382 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "slice_act_y_qp_offset", &slice_act_y_qp_offset_obj))
1383 p->slice_act_y_qp_offset = (__s8) json_object_get_int(slice_act_y_qp_offset_obj);
1384
1385 json_object *slice_act_cb_qp_offset_obj;
1386 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "slice_act_cb_qp_offset", &slice_act_cb_qp_offset_obj))
1387 p->slice_act_cb_qp_offset = (__s8) json_object_get_int(slice_act_cb_qp_offset_obj);
1388
1389 json_object *slice_act_cr_qp_offset_obj;
1390 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "slice_act_cr_qp_offset", &slice_act_cr_qp_offset_obj))
1391 p->slice_act_cr_qp_offset = (__s8) json_object_get_int(slice_act_cr_qp_offset_obj);
1392
1393 json_object *slice_beta_offset_div2_obj;
1394 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "slice_beta_offset_div2", &slice_beta_offset_div2_obj))
1395 p->slice_beta_offset_div2 = (__s8) json_object_get_int(slice_beta_offset_div2_obj);
1396
1397 json_object *slice_tc_offset_div2_obj;
1398 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "slice_tc_offset_div2", &slice_tc_offset_div2_obj))
1399 p->slice_tc_offset_div2 = (__s8) json_object_get_int(slice_tc_offset_div2_obj);
1400
1401 json_object *pic_struct_obj;
1402 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "pic_struct", &pic_struct_obj))
1403 p->pic_struct = (__u8) json_object_get_int(pic_struct_obj);
1404
1405 json_object *slice_segment_addr_obj;
1406 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "slice_segment_addr", &slice_segment_addr_obj))
1407 p->slice_segment_addr = (__u32) json_object_get_int64(slice_segment_addr_obj);
1408
1409 /* __u8 ref_idx_l0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
1410 json_object *ref_idx_l0_obj;
1411 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "ref_idx_l0", &ref_idx_l0_obj)) {
1412 for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
1413 if (json_object_array_get_idx(ref_idx_l0_obj, i))
1414 p->ref_idx_l0[i] = (__u8) json_object_get_int(json_object_array_get_idx(ref_idx_l0_obj, i));
1415 }
1416 }
1417
1418 /* __u8 ref_idx_l1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
1419 json_object *ref_idx_l1_obj;
1420 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "ref_idx_l1", &ref_idx_l1_obj)) {
1421 for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
1422 if (json_object_array_get_idx(ref_idx_l1_obj, i))
1423 p->ref_idx_l1[i] = (__u8) json_object_get_int(json_object_array_get_idx(ref_idx_l1_obj, i));
1424 }
1425 }
1426
1427 json_object *short_term_ref_pic_set_size_obj;
1428 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "short_term_ref_pic_set_size", &short_term_ref_pic_set_size_obj))
1429 p->short_term_ref_pic_set_size = (__u16) json_object_get_int(short_term_ref_pic_set_size_obj);
1430
1431 json_object *long_term_ref_pic_set_size_obj;
1432 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "long_term_ref_pic_set_size", &long_term_ref_pic_set_size_obj))
1433 p->long_term_ref_pic_set_size = (__u16) json_object_get_int(long_term_ref_pic_set_size_obj);
1434
1435 /* struct v4l2_hevc_pred_weight_table pred_weight_table */
1436 json_object *pred_weight_table_obj;
1437 if (!json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "v4l2_hevc_pred_weight_table", &pred_weight_table_obj))
1438 return p;
1439 void *pred_weight_table_ptr = (void *) retrace_v4l2_hevc_pred_weight_table_gen(pred_weight_table_obj);
1440 p->pred_weight_table = *static_cast<struct v4l2_hevc_pred_weight_table*>(pred_weight_table_ptr);
1441 free(pred_weight_table_ptr);
1442
1443 json_object *flags_obj;
1444 if (json_object_object_get_ex(v4l2_ctrl_hevc_slice_params_obj, "flags", &flags_obj))
1445 p->flags = (__u64) s2flags(json_object_get_string(flags_obj), v4l2_hevc_slice_params_flag_def);
1446
1447 return p;
1448 }
1449
retrace_v4l2_ctrl_hevc_decode_params_gen(json_object * ctrl_obj)1450 struct v4l2_ctrl_hevc_decode_params *retrace_v4l2_ctrl_hevc_decode_params_gen(json_object *ctrl_obj)
1451 {
1452 struct v4l2_ctrl_hevc_decode_params *p = (struct v4l2_ctrl_hevc_decode_params *) calloc(1, sizeof(v4l2_ctrl_hevc_decode_params));
1453 json_object *v4l2_ctrl_hevc_decode_params_obj;
1454 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_hevc_decode_params", &v4l2_ctrl_hevc_decode_params_obj))
1455 v4l2_ctrl_hevc_decode_params_obj = ctrl_obj;
1456
1457 json_object *pic_order_cnt_val_obj;
1458 if (json_object_object_get_ex(v4l2_ctrl_hevc_decode_params_obj, "pic_order_cnt_val", &pic_order_cnt_val_obj))
1459 p->pic_order_cnt_val = (__s32) json_object_get_int(pic_order_cnt_val_obj);
1460
1461 json_object *short_term_ref_pic_set_size_obj;
1462 if (json_object_object_get_ex(v4l2_ctrl_hevc_decode_params_obj, "short_term_ref_pic_set_size", &short_term_ref_pic_set_size_obj))
1463 p->short_term_ref_pic_set_size = (__u16) json_object_get_int(short_term_ref_pic_set_size_obj);
1464
1465 json_object *long_term_ref_pic_set_size_obj;
1466 if (json_object_object_get_ex(v4l2_ctrl_hevc_decode_params_obj, "long_term_ref_pic_set_size", &long_term_ref_pic_set_size_obj))
1467 p->long_term_ref_pic_set_size = (__u16) json_object_get_int(long_term_ref_pic_set_size_obj);
1468
1469 json_object *num_active_dpb_entries_obj;
1470 if (json_object_object_get_ex(v4l2_ctrl_hevc_decode_params_obj, "num_active_dpb_entries", &num_active_dpb_entries_obj))
1471 p->num_active_dpb_entries = (__u8) json_object_get_int(num_active_dpb_entries_obj);
1472
1473 json_object *num_poc_st_curr_before_obj;
1474 if (json_object_object_get_ex(v4l2_ctrl_hevc_decode_params_obj, "num_poc_st_curr_before", &num_poc_st_curr_before_obj))
1475 p->num_poc_st_curr_before = (__u8) json_object_get_int(num_poc_st_curr_before_obj);
1476
1477 json_object *num_poc_st_curr_after_obj;
1478 if (json_object_object_get_ex(v4l2_ctrl_hevc_decode_params_obj, "num_poc_st_curr_after", &num_poc_st_curr_after_obj))
1479 p->num_poc_st_curr_after = (__u8) json_object_get_int(num_poc_st_curr_after_obj);
1480
1481 json_object *num_poc_lt_curr_obj;
1482 if (json_object_object_get_ex(v4l2_ctrl_hevc_decode_params_obj, "num_poc_lt_curr", &num_poc_lt_curr_obj))
1483 p->num_poc_lt_curr = (__u8) json_object_get_int(num_poc_lt_curr_obj);
1484
1485 /* __u8 poc_st_curr_before[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
1486 json_object *poc_st_curr_before_obj;
1487 if (json_object_object_get_ex(v4l2_ctrl_hevc_decode_params_obj, "poc_st_curr_before", &poc_st_curr_before_obj)) {
1488 for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
1489 if (json_object_array_get_idx(poc_st_curr_before_obj, i))
1490 p->poc_st_curr_before[i] = (__u8) json_object_get_int(json_object_array_get_idx(poc_st_curr_before_obj, i));
1491 }
1492 }
1493
1494 /* __u8 poc_st_curr_after[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
1495 json_object *poc_st_curr_after_obj;
1496 if (json_object_object_get_ex(v4l2_ctrl_hevc_decode_params_obj, "poc_st_curr_after", &poc_st_curr_after_obj)) {
1497 for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
1498 if (json_object_array_get_idx(poc_st_curr_after_obj, i))
1499 p->poc_st_curr_after[i] = (__u8) json_object_get_int(json_object_array_get_idx(poc_st_curr_after_obj, i));
1500 }
1501 }
1502
1503 /* __u8 poc_lt_curr[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
1504 json_object *poc_lt_curr_obj;
1505 if (json_object_object_get_ex(v4l2_ctrl_hevc_decode_params_obj, "poc_lt_curr", &poc_lt_curr_obj)) {
1506 for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
1507 if (json_object_array_get_idx(poc_lt_curr_obj, i))
1508 p->poc_lt_curr[i] = (__u8) json_object_get_int(json_object_array_get_idx(poc_lt_curr_obj, i));
1509 }
1510 }
1511
1512 json_object *num_delta_pocs_of_ref_rps_idx_obj;
1513 if (json_object_object_get_ex(v4l2_ctrl_hevc_decode_params_obj, "num_delta_pocs_of_ref_rps_idx", &num_delta_pocs_of_ref_rps_idx_obj))
1514 p->num_delta_pocs_of_ref_rps_idx = (__u8) json_object_get_int(num_delta_pocs_of_ref_rps_idx_obj);
1515
1516 /* struct v4l2_hevc_dpb_entry dpb[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] */
1517 json_object *dpb_obj;
1518 if (json_object_object_get_ex(v4l2_ctrl_hevc_decode_params_obj, "dpb", &dpb_obj)) {
1519 for (size_t i = 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) {
1520 void *dpb_ptr = (void *) retrace_v4l2_hevc_dpb_entry_gen(json_object_array_get_idx(dpb_obj, i));
1521 p->dpb[i] = *static_cast<struct v4l2_hevc_dpb_entry*>(dpb_ptr);
1522 free(dpb_ptr);
1523 }
1524 }
1525
1526 json_object *flags_obj;
1527 if (json_object_object_get_ex(v4l2_ctrl_hevc_decode_params_obj, "flags", &flags_obj))
1528 p->flags = (__u64) s2flags(json_object_get_string(flags_obj), v4l2_hevc_decode_param_flag_def);
1529
1530 return p;
1531 }
1532
retrace_v4l2_ctrl_hevc_scaling_matrix_gen(json_object * ctrl_obj)1533 struct v4l2_ctrl_hevc_scaling_matrix *retrace_v4l2_ctrl_hevc_scaling_matrix_gen(json_object *ctrl_obj)
1534 {
1535 struct v4l2_ctrl_hevc_scaling_matrix *p = (struct v4l2_ctrl_hevc_scaling_matrix *) calloc(1, sizeof(v4l2_ctrl_hevc_scaling_matrix));
1536 json_object *v4l2_ctrl_hevc_scaling_matrix_obj;
1537 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_hevc_scaling_matrix", &v4l2_ctrl_hevc_scaling_matrix_obj))
1538 v4l2_ctrl_hevc_scaling_matrix_obj = ctrl_obj;
1539
1540 /* __u8 scaling_list_4x4[6][16] */
1541 int count_scaling_list_4x4 = 0;
1542 json_object *scaling_list_4x4_obj;
1543 if (json_object_object_get_ex(v4l2_ctrl_hevc_scaling_matrix_obj, "scaling_list_4x4", &scaling_list_4x4_obj)) {
1544 for (size_t i = 0; i < 6; i++) {
1545 for (size_t j = 0; j < 16; j++) {
1546 if (json_object_array_get_idx(scaling_list_4x4_obj, count_scaling_list_4x4))
1547 p->scaling_list_4x4[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(scaling_list_4x4_obj, count_scaling_list_4x4++));
1548 }
1549 }
1550 }
1551
1552 /* __u8 scaling_list_8x8[6][64] */
1553 int count_scaling_list_8x8 = 0;
1554 json_object *scaling_list_8x8_obj;
1555 if (json_object_object_get_ex(v4l2_ctrl_hevc_scaling_matrix_obj, "scaling_list_8x8", &scaling_list_8x8_obj)) {
1556 for (size_t i = 0; i < 6; i++) {
1557 for (size_t j = 0; j < 64; j++) {
1558 if (json_object_array_get_idx(scaling_list_8x8_obj, count_scaling_list_8x8))
1559 p->scaling_list_8x8[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(scaling_list_8x8_obj, count_scaling_list_8x8++));
1560 }
1561 }
1562 }
1563
1564 /* __u8 scaling_list_16x16[6][64] */
1565 int count_scaling_list_16x16 = 0;
1566 json_object *scaling_list_16x16_obj;
1567 if (json_object_object_get_ex(v4l2_ctrl_hevc_scaling_matrix_obj, "scaling_list_16x16", &scaling_list_16x16_obj)) {
1568 for (size_t i = 0; i < 6; i++) {
1569 for (size_t j = 0; j < 64; j++) {
1570 if (json_object_array_get_idx(scaling_list_16x16_obj, count_scaling_list_16x16))
1571 p->scaling_list_16x16[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(scaling_list_16x16_obj, count_scaling_list_16x16++));
1572 }
1573 }
1574 }
1575
1576 /* __u8 scaling_list_32x32[2][64] */
1577 int count_scaling_list_32x32 = 0;
1578 json_object *scaling_list_32x32_obj;
1579 if (json_object_object_get_ex(v4l2_ctrl_hevc_scaling_matrix_obj, "scaling_list_32x32", &scaling_list_32x32_obj)) {
1580 for (size_t i = 0; i < 2; i++) {
1581 for (size_t j = 0; j < 64; j++) {
1582 if (json_object_array_get_idx(scaling_list_32x32_obj, count_scaling_list_32x32))
1583 p->scaling_list_32x32[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(scaling_list_32x32_obj, count_scaling_list_32x32++));
1584 }
1585 }
1586 }
1587
1588 /* __u8 scaling_list_dc_coef_16x16[6] */
1589 json_object *scaling_list_dc_coef_16x16_obj;
1590 if (json_object_object_get_ex(v4l2_ctrl_hevc_scaling_matrix_obj, "scaling_list_dc_coef_16x16", &scaling_list_dc_coef_16x16_obj)) {
1591 for (size_t i = 0; i < 6; i++) {
1592 if (json_object_array_get_idx(scaling_list_dc_coef_16x16_obj, i))
1593 p->scaling_list_dc_coef_16x16[i] = (__u8) json_object_get_int(json_object_array_get_idx(scaling_list_dc_coef_16x16_obj, i));
1594 }
1595 }
1596
1597 /* __u8 scaling_list_dc_coef_32x32[2] */
1598 json_object *scaling_list_dc_coef_32x32_obj;
1599 if (json_object_object_get_ex(v4l2_ctrl_hevc_scaling_matrix_obj, "scaling_list_dc_coef_32x32", &scaling_list_dc_coef_32x32_obj)) {
1600 for (size_t i = 0; i < 2; i++) {
1601 if (json_object_array_get_idx(scaling_list_dc_coef_32x32_obj, i))
1602 p->scaling_list_dc_coef_32x32[i] = (__u8) json_object_get_int(json_object_array_get_idx(scaling_list_dc_coef_32x32_obj, i));
1603 }
1604 }
1605
1606 return p;
1607 }
1608
retrace_v4l2_ctrl_hdr10_cll_info_gen(json_object * ctrl_obj)1609 struct v4l2_ctrl_hdr10_cll_info *retrace_v4l2_ctrl_hdr10_cll_info_gen(json_object *ctrl_obj)
1610 {
1611 struct v4l2_ctrl_hdr10_cll_info *p = (struct v4l2_ctrl_hdr10_cll_info *) calloc(1, sizeof(v4l2_ctrl_hdr10_cll_info));
1612 json_object *v4l2_ctrl_hdr10_cll_info_obj;
1613 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_hdr10_cll_info", &v4l2_ctrl_hdr10_cll_info_obj))
1614 v4l2_ctrl_hdr10_cll_info_obj = ctrl_obj;
1615
1616 json_object *max_content_light_level_obj;
1617 if (json_object_object_get_ex(v4l2_ctrl_hdr10_cll_info_obj, "max_content_light_level", &max_content_light_level_obj))
1618 p->max_content_light_level = (__u16) json_object_get_int(max_content_light_level_obj);
1619
1620 json_object *max_pic_average_light_level_obj;
1621 if (json_object_object_get_ex(v4l2_ctrl_hdr10_cll_info_obj, "max_pic_average_light_level", &max_pic_average_light_level_obj))
1622 p->max_pic_average_light_level = (__u16) json_object_get_int(max_pic_average_light_level_obj);
1623
1624 return p;
1625 }
1626
retrace_v4l2_ctrl_hdr10_mastering_display_gen(json_object * ctrl_obj)1627 struct v4l2_ctrl_hdr10_mastering_display *retrace_v4l2_ctrl_hdr10_mastering_display_gen(json_object *ctrl_obj)
1628 {
1629 struct v4l2_ctrl_hdr10_mastering_display *p = (struct v4l2_ctrl_hdr10_mastering_display *) calloc(1, sizeof(v4l2_ctrl_hdr10_mastering_display));
1630 json_object *v4l2_ctrl_hdr10_mastering_display_obj;
1631 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_hdr10_mastering_display", &v4l2_ctrl_hdr10_mastering_display_obj))
1632 v4l2_ctrl_hdr10_mastering_display_obj = ctrl_obj;
1633
1634 /* __u16 display_primaries_x[3] */
1635 json_object *display_primaries_x_obj;
1636 if (json_object_object_get_ex(v4l2_ctrl_hdr10_mastering_display_obj, "display_primaries_x", &display_primaries_x_obj)) {
1637 for (size_t i = 0; i < 3; i++) {
1638 if (json_object_array_get_idx(display_primaries_x_obj, i))
1639 p->display_primaries_x[i] = (__u16) json_object_get_int(json_object_array_get_idx(display_primaries_x_obj, i));
1640 }
1641 }
1642
1643 /* __u16 display_primaries_y[3] */
1644 json_object *display_primaries_y_obj;
1645 if (json_object_object_get_ex(v4l2_ctrl_hdr10_mastering_display_obj, "display_primaries_y", &display_primaries_y_obj)) {
1646 for (size_t i = 0; i < 3; i++) {
1647 if (json_object_array_get_idx(display_primaries_y_obj, i))
1648 p->display_primaries_y[i] = (__u16) json_object_get_int(json_object_array_get_idx(display_primaries_y_obj, i));
1649 }
1650 }
1651
1652 json_object *white_point_x_obj;
1653 if (json_object_object_get_ex(v4l2_ctrl_hdr10_mastering_display_obj, "white_point_x", &white_point_x_obj))
1654 p->white_point_x = (__u16) json_object_get_int(white_point_x_obj);
1655
1656 json_object *white_point_y_obj;
1657 if (json_object_object_get_ex(v4l2_ctrl_hdr10_mastering_display_obj, "white_point_y", &white_point_y_obj))
1658 p->white_point_y = (__u16) json_object_get_int(white_point_y_obj);
1659
1660 json_object *max_display_mastering_luminance_obj;
1661 if (json_object_object_get_ex(v4l2_ctrl_hdr10_mastering_display_obj, "max_display_mastering_luminance", &max_display_mastering_luminance_obj))
1662 p->max_display_mastering_luminance = (__u32) json_object_get_int64(max_display_mastering_luminance_obj);
1663
1664 json_object *min_display_mastering_luminance_obj;
1665 if (json_object_object_get_ex(v4l2_ctrl_hdr10_mastering_display_obj, "min_display_mastering_luminance", &min_display_mastering_luminance_obj))
1666 p->min_display_mastering_luminance = (__u32) json_object_get_int64(min_display_mastering_luminance_obj);
1667
1668 return p;
1669 }
1670
retrace_v4l2_vp9_loop_filter_gen(json_object * ctrl_obj)1671 struct v4l2_vp9_loop_filter *retrace_v4l2_vp9_loop_filter_gen(json_object *ctrl_obj)
1672 {
1673 struct v4l2_vp9_loop_filter *p = (struct v4l2_vp9_loop_filter *) calloc(1, sizeof(v4l2_vp9_loop_filter));
1674 json_object *v4l2_vp9_loop_filter_obj;
1675 if (!json_object_object_get_ex(ctrl_obj, "v4l2_vp9_loop_filter", &v4l2_vp9_loop_filter_obj))
1676 v4l2_vp9_loop_filter_obj = ctrl_obj;
1677
1678 /* __s8 ref_deltas[4] */
1679 json_object *ref_deltas_obj;
1680 if (json_object_object_get_ex(v4l2_vp9_loop_filter_obj, "ref_deltas", &ref_deltas_obj)) {
1681 for (size_t i = 0; i < 4; i++) {
1682 if (json_object_array_get_idx(ref_deltas_obj, i))
1683 p->ref_deltas[i] = (__s8) json_object_get_int(json_object_array_get_idx(ref_deltas_obj, i));
1684 }
1685 }
1686
1687 /* __s8 mode_deltas[2] */
1688 json_object *mode_deltas_obj;
1689 if (json_object_object_get_ex(v4l2_vp9_loop_filter_obj, "mode_deltas", &mode_deltas_obj)) {
1690 for (size_t i = 0; i < 2; i++) {
1691 if (json_object_array_get_idx(mode_deltas_obj, i))
1692 p->mode_deltas[i] = (__s8) json_object_get_int(json_object_array_get_idx(mode_deltas_obj, i));
1693 }
1694 }
1695
1696 json_object *level_obj;
1697 if (json_object_object_get_ex(v4l2_vp9_loop_filter_obj, "level", &level_obj))
1698 p->level = (__u8) json_object_get_int(level_obj);
1699
1700 json_object *sharpness_obj;
1701 if (json_object_object_get_ex(v4l2_vp9_loop_filter_obj, "sharpness", &sharpness_obj))
1702 p->sharpness = (__u8) json_object_get_int(sharpness_obj);
1703
1704 json_object *flags_obj;
1705 if (json_object_object_get_ex(v4l2_vp9_loop_filter_obj, "flags", &flags_obj))
1706 p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_vp9_loop_filter_flag_def);
1707
1708 return p;
1709 }
1710
retrace_v4l2_vp9_quantization_gen(json_object * ctrl_obj)1711 struct v4l2_vp9_quantization *retrace_v4l2_vp9_quantization_gen(json_object *ctrl_obj)
1712 {
1713 struct v4l2_vp9_quantization *p = (struct v4l2_vp9_quantization *) calloc(1, sizeof(v4l2_vp9_quantization));
1714 json_object *v4l2_vp9_quantization_obj;
1715 if (!json_object_object_get_ex(ctrl_obj, "v4l2_vp9_quantization", &v4l2_vp9_quantization_obj))
1716 v4l2_vp9_quantization_obj = ctrl_obj;
1717
1718 json_object *base_q_idx_obj;
1719 if (json_object_object_get_ex(v4l2_vp9_quantization_obj, "base_q_idx", &base_q_idx_obj))
1720 p->base_q_idx = (__u8) json_object_get_int(base_q_idx_obj);
1721
1722 json_object *delta_q_y_dc_obj;
1723 if (json_object_object_get_ex(v4l2_vp9_quantization_obj, "delta_q_y_dc", &delta_q_y_dc_obj))
1724 p->delta_q_y_dc = (__s8) json_object_get_int(delta_q_y_dc_obj);
1725
1726 json_object *delta_q_uv_dc_obj;
1727 if (json_object_object_get_ex(v4l2_vp9_quantization_obj, "delta_q_uv_dc", &delta_q_uv_dc_obj))
1728 p->delta_q_uv_dc = (__s8) json_object_get_int(delta_q_uv_dc_obj);
1729
1730 json_object *delta_q_uv_ac_obj;
1731 if (json_object_object_get_ex(v4l2_vp9_quantization_obj, "delta_q_uv_ac", &delta_q_uv_ac_obj))
1732 p->delta_q_uv_ac = (__s8) json_object_get_int(delta_q_uv_ac_obj);
1733
1734 return p;
1735 }
1736
retrace_v4l2_vp9_segmentation_gen(json_object * ctrl_obj)1737 struct v4l2_vp9_segmentation *retrace_v4l2_vp9_segmentation_gen(json_object *ctrl_obj)
1738 {
1739 struct v4l2_vp9_segmentation *p = (struct v4l2_vp9_segmentation *) calloc(1, sizeof(v4l2_vp9_segmentation));
1740 json_object *v4l2_vp9_segmentation_obj;
1741 if (!json_object_object_get_ex(ctrl_obj, "v4l2_vp9_segmentation", &v4l2_vp9_segmentation_obj))
1742 v4l2_vp9_segmentation_obj = ctrl_obj;
1743
1744 /* __s16 feature_data[8][4] */
1745 int count_feature_data = 0;
1746 json_object *feature_data_obj;
1747 if (json_object_object_get_ex(v4l2_vp9_segmentation_obj, "feature_data", &feature_data_obj)) {
1748 for (size_t i = 0; i < 8; i++) {
1749 for (size_t j = 0; j < 4; j++) {
1750 if (json_object_array_get_idx(feature_data_obj, count_feature_data))
1751 p->feature_data[i][j] = (__s16) json_object_get_int(json_object_array_get_idx(feature_data_obj, count_feature_data++));
1752 }
1753 }
1754 }
1755
1756 /* __u8 feature_enabled[8] */
1757 json_object *feature_enabled_obj;
1758 if (json_object_object_get_ex(v4l2_vp9_segmentation_obj, "feature_enabled", &feature_enabled_obj)) {
1759 for (size_t i = 0; i < 8; i++) {
1760 if (json_object_array_get_idx(feature_enabled_obj, i))
1761 p->feature_enabled[i] = (__u8) json_object_get_int(json_object_array_get_idx(feature_enabled_obj, i));
1762 }
1763 }
1764
1765 /* __u8 tree_probs[7] */
1766 json_object *tree_probs_obj;
1767 if (json_object_object_get_ex(v4l2_vp9_segmentation_obj, "tree_probs", &tree_probs_obj)) {
1768 for (size_t i = 0; i < 7; i++) {
1769 if (json_object_array_get_idx(tree_probs_obj, i))
1770 p->tree_probs[i] = (__u8) json_object_get_int(json_object_array_get_idx(tree_probs_obj, i));
1771 }
1772 }
1773
1774 /* __u8 pred_probs[3] */
1775 json_object *pred_probs_obj;
1776 if (json_object_object_get_ex(v4l2_vp9_segmentation_obj, "pred_probs", &pred_probs_obj)) {
1777 for (size_t i = 0; i < 3; i++) {
1778 if (json_object_array_get_idx(pred_probs_obj, i))
1779 p->pred_probs[i] = (__u8) json_object_get_int(json_object_array_get_idx(pred_probs_obj, i));
1780 }
1781 }
1782
1783 json_object *flags_obj;
1784 if (json_object_object_get_ex(v4l2_vp9_segmentation_obj, "flags", &flags_obj))
1785 p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_vp9_segmentation_flag_def);
1786
1787 return p;
1788 }
1789
retrace_v4l2_ctrl_vp9_frame_gen(json_object * ctrl_obj)1790 struct v4l2_ctrl_vp9_frame *retrace_v4l2_ctrl_vp9_frame_gen(json_object *ctrl_obj)
1791 {
1792 struct v4l2_ctrl_vp9_frame *p = (struct v4l2_ctrl_vp9_frame *) calloc(1, sizeof(v4l2_ctrl_vp9_frame));
1793 json_object *v4l2_ctrl_vp9_frame_obj;
1794 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_vp9_frame", &v4l2_ctrl_vp9_frame_obj))
1795 v4l2_ctrl_vp9_frame_obj = ctrl_obj;
1796
1797 /* struct v4l2_vp9_loop_filter lf */
1798 json_object *lf_obj;
1799 if (!json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "v4l2_vp9_loop_filter", &lf_obj))
1800 return p;
1801 void *lf_ptr = (void *) retrace_v4l2_vp9_loop_filter_gen(lf_obj);
1802 p->lf = *static_cast<struct v4l2_vp9_loop_filter*>(lf_ptr);
1803 free(lf_ptr);
1804
1805 /* struct v4l2_vp9_quantization quant */
1806 json_object *quant_obj;
1807 if (!json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "v4l2_vp9_quantization", &quant_obj))
1808 return p;
1809 void *quant_ptr = (void *) retrace_v4l2_vp9_quantization_gen(quant_obj);
1810 p->quant = *static_cast<struct v4l2_vp9_quantization*>(quant_ptr);
1811 free(quant_ptr);
1812
1813 /* struct v4l2_vp9_segmentation seg */
1814 json_object *seg_obj;
1815 if (!json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "v4l2_vp9_segmentation", &seg_obj))
1816 return p;
1817 void *seg_ptr = (void *) retrace_v4l2_vp9_segmentation_gen(seg_obj);
1818 p->seg = *static_cast<struct v4l2_vp9_segmentation*>(seg_ptr);
1819 free(seg_ptr);
1820
1821 json_object *flags_obj;
1822 if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "flags", &flags_obj))
1823 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_vp9_frame_flag_def);
1824
1825 json_object *compressed_header_size_obj;
1826 if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "compressed_header_size", &compressed_header_size_obj))
1827 p->compressed_header_size = (__u16) json_object_get_int(compressed_header_size_obj);
1828
1829 json_object *uncompressed_header_size_obj;
1830 if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "uncompressed_header_size", &uncompressed_header_size_obj))
1831 p->uncompressed_header_size = (__u16) json_object_get_int(uncompressed_header_size_obj);
1832
1833 json_object *frame_width_minus_1_obj;
1834 if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "frame_width_minus_1", &frame_width_minus_1_obj))
1835 p->frame_width_minus_1 = (__u16) json_object_get_int(frame_width_minus_1_obj);
1836
1837 json_object *frame_height_minus_1_obj;
1838 if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "frame_height_minus_1", &frame_height_minus_1_obj))
1839 p->frame_height_minus_1 = (__u16) json_object_get_int(frame_height_minus_1_obj);
1840
1841 json_object *render_width_minus_1_obj;
1842 if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "render_width_minus_1", &render_width_minus_1_obj))
1843 p->render_width_minus_1 = (__u16) json_object_get_int(render_width_minus_1_obj);
1844
1845 json_object *render_height_minus_1_obj;
1846 if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "render_height_minus_1", &render_height_minus_1_obj))
1847 p->render_height_minus_1 = (__u16) json_object_get_int(render_height_minus_1_obj);
1848
1849 json_object *last_frame_ts_obj;
1850 if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "last_frame_ts", &last_frame_ts_obj))
1851 p->last_frame_ts = (__u64) json_object_get_uint64(last_frame_ts_obj);
1852
1853 json_object *golden_frame_ts_obj;
1854 if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "golden_frame_ts", &golden_frame_ts_obj))
1855 p->golden_frame_ts = (__u64) json_object_get_uint64(golden_frame_ts_obj);
1856
1857 json_object *alt_frame_ts_obj;
1858 if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "alt_frame_ts", &alt_frame_ts_obj))
1859 p->alt_frame_ts = (__u64) json_object_get_uint64(alt_frame_ts_obj);
1860
1861 json_object *ref_frame_sign_bias_obj;
1862 if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "ref_frame_sign_bias", &ref_frame_sign_bias_obj))
1863 p->ref_frame_sign_bias = (__u8) json_object_get_int(ref_frame_sign_bias_obj);
1864
1865 json_object *reset_frame_context_obj;
1866 if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "reset_frame_context", &reset_frame_context_obj))
1867 p->reset_frame_context = (__u8) json_object_get_int(reset_frame_context_obj);
1868
1869 json_object *frame_context_idx_obj;
1870 if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "frame_context_idx", &frame_context_idx_obj))
1871 p->frame_context_idx = (__u8) json_object_get_int(frame_context_idx_obj);
1872
1873 json_object *profile_obj;
1874 if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "profile", &profile_obj))
1875 p->profile = (__u8) json_object_get_int(profile_obj);
1876
1877 json_object *bit_depth_obj;
1878 if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "bit_depth", &bit_depth_obj))
1879 p->bit_depth = (__u8) json_object_get_int(bit_depth_obj);
1880
1881 json_object *interpolation_filter_obj;
1882 if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "interpolation_filter", &interpolation_filter_obj))
1883 p->interpolation_filter = (__u8) json_object_get_int(interpolation_filter_obj);
1884
1885 json_object *tile_cols_log2_obj;
1886 if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "tile_cols_log2", &tile_cols_log2_obj))
1887 p->tile_cols_log2 = (__u8) json_object_get_int(tile_cols_log2_obj);
1888
1889 json_object *tile_rows_log2_obj;
1890 if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "tile_rows_log2", &tile_rows_log2_obj))
1891 p->tile_rows_log2 = (__u8) json_object_get_int(tile_rows_log2_obj);
1892
1893 json_object *reference_mode_obj;
1894 if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "reference_mode", &reference_mode_obj))
1895 p->reference_mode = (__u8) json_object_get_int(reference_mode_obj);
1896
1897 return p;
1898 }
1899
retrace_v4l2_vp9_mv_probs_gen(json_object * ctrl_obj)1900 struct v4l2_vp9_mv_probs *retrace_v4l2_vp9_mv_probs_gen(json_object *ctrl_obj)
1901 {
1902 struct v4l2_vp9_mv_probs *p = (struct v4l2_vp9_mv_probs *) calloc(1, sizeof(v4l2_vp9_mv_probs));
1903 json_object *v4l2_vp9_mv_probs_obj;
1904 if (!json_object_object_get_ex(ctrl_obj, "v4l2_vp9_mv_probs", &v4l2_vp9_mv_probs_obj))
1905 v4l2_vp9_mv_probs_obj = ctrl_obj;
1906
1907 /* __u8 joint[3] */
1908 json_object *joint_obj;
1909 if (json_object_object_get_ex(v4l2_vp9_mv_probs_obj, "joint", &joint_obj)) {
1910 for (size_t i = 0; i < 3; i++) {
1911 if (json_object_array_get_idx(joint_obj, i))
1912 p->joint[i] = (__u8) json_object_get_int(json_object_array_get_idx(joint_obj, i));
1913 }
1914 }
1915
1916 /* __u8 sign[2] */
1917 json_object *sign_obj;
1918 if (json_object_object_get_ex(v4l2_vp9_mv_probs_obj, "sign", &sign_obj)) {
1919 for (size_t i = 0; i < 2; i++) {
1920 if (json_object_array_get_idx(sign_obj, i))
1921 p->sign[i] = (__u8) json_object_get_int(json_object_array_get_idx(sign_obj, i));
1922 }
1923 }
1924
1925 /* __u8 classes[2][10] */
1926 int count_classes = 0;
1927 json_object *classes_obj;
1928 if (json_object_object_get_ex(v4l2_vp9_mv_probs_obj, "classes", &classes_obj)) {
1929 for (size_t i = 0; i < 2; i++) {
1930 for (size_t j = 0; j < 10; j++) {
1931 if (json_object_array_get_idx(classes_obj, count_classes))
1932 p->classes[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(classes_obj, count_classes++));
1933 }
1934 }
1935 }
1936
1937 /* __u8 class0_bit[2] */
1938 json_object *class0_bit_obj;
1939 if (json_object_object_get_ex(v4l2_vp9_mv_probs_obj, "class0_bit", &class0_bit_obj)) {
1940 for (size_t i = 0; i < 2; i++) {
1941 if (json_object_array_get_idx(class0_bit_obj, i))
1942 p->class0_bit[i] = (__u8) json_object_get_int(json_object_array_get_idx(class0_bit_obj, i));
1943 }
1944 }
1945
1946 /* __u8 bits[2][10] */
1947 int count_bits = 0;
1948 json_object *bits_obj;
1949 if (json_object_object_get_ex(v4l2_vp9_mv_probs_obj, "bits", &bits_obj)) {
1950 for (size_t i = 0; i < 2; i++) {
1951 for (size_t j = 0; j < 10; j++) {
1952 if (json_object_array_get_idx(bits_obj, count_bits))
1953 p->bits[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(bits_obj, count_bits++));
1954 }
1955 }
1956 }
1957
1958 /* __u8 class0_fr[2][2][3] */
1959 int count_class0_fr = 0;
1960 json_object *class0_fr_obj;
1961 if (json_object_object_get_ex(v4l2_vp9_mv_probs_obj, "class0_fr", &class0_fr_obj)) {
1962 for (size_t i = 0; i < 2; i++) {
1963 for (size_t j = 0; j < 2; j++) {
1964 for (size_t k = 0; k < 3; k++) {
1965 if (json_object_array_get_idx(class0_fr_obj, count_class0_fr))
1966 p->class0_fr[i][j][k] = (__u8) json_object_get_int(json_object_array_get_idx(class0_fr_obj, count_class0_fr++));
1967 }
1968 }
1969 }
1970 }
1971
1972 /* __u8 fr[2][3] */
1973 int count_fr = 0;
1974 json_object *fr_obj;
1975 if (json_object_object_get_ex(v4l2_vp9_mv_probs_obj, "fr", &fr_obj)) {
1976 for (size_t i = 0; i < 2; i++) {
1977 for (size_t j = 0; j < 3; j++) {
1978 if (json_object_array_get_idx(fr_obj, count_fr))
1979 p->fr[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(fr_obj, count_fr++));
1980 }
1981 }
1982 }
1983
1984 /* __u8 class0_hp[2] */
1985 json_object *class0_hp_obj;
1986 if (json_object_object_get_ex(v4l2_vp9_mv_probs_obj, "class0_hp", &class0_hp_obj)) {
1987 for (size_t i = 0; i < 2; i++) {
1988 if (json_object_array_get_idx(class0_hp_obj, i))
1989 p->class0_hp[i] = (__u8) json_object_get_int(json_object_array_get_idx(class0_hp_obj, i));
1990 }
1991 }
1992
1993 /* __u8 hp[2] */
1994 json_object *hp_obj;
1995 if (json_object_object_get_ex(v4l2_vp9_mv_probs_obj, "hp", &hp_obj)) {
1996 for (size_t i = 0; i < 2; i++) {
1997 if (json_object_array_get_idx(hp_obj, i))
1998 p->hp[i] = (__u8) json_object_get_int(json_object_array_get_idx(hp_obj, i));
1999 }
2000 }
2001
2002 return p;
2003 }
2004
retrace_v4l2_ctrl_vp9_compressed_hdr_gen(json_object * ctrl_obj)2005 struct v4l2_ctrl_vp9_compressed_hdr *retrace_v4l2_ctrl_vp9_compressed_hdr_gen(json_object *ctrl_obj)
2006 {
2007 struct v4l2_ctrl_vp9_compressed_hdr *p = (struct v4l2_ctrl_vp9_compressed_hdr *) calloc(1, sizeof(v4l2_ctrl_vp9_compressed_hdr));
2008 json_object *v4l2_ctrl_vp9_compressed_hdr_obj;
2009 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_vp9_compressed_hdr", &v4l2_ctrl_vp9_compressed_hdr_obj))
2010 v4l2_ctrl_vp9_compressed_hdr_obj = ctrl_obj;
2011
2012 json_object *tx_mode_obj;
2013 if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "tx_mode", &tx_mode_obj))
2014 p->tx_mode = (__u8) json_object_get_int(tx_mode_obj);
2015
2016 /* __u8 tx8[2][1] */
2017 int count_tx8 = 0;
2018 json_object *tx8_obj;
2019 if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "tx8", &tx8_obj)) {
2020 for (size_t i = 0; i < 2; i++) {
2021 for (size_t j = 0; j < 1; j++) {
2022 if (json_object_array_get_idx(tx8_obj, count_tx8))
2023 p->tx8[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(tx8_obj, count_tx8++));
2024 }
2025 }
2026 }
2027
2028 /* __u8 tx16[2][2] */
2029 int count_tx16 = 0;
2030 json_object *tx16_obj;
2031 if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "tx16", &tx16_obj)) {
2032 for (size_t i = 0; i < 2; i++) {
2033 for (size_t j = 0; j < 2; j++) {
2034 if (json_object_array_get_idx(tx16_obj, count_tx16))
2035 p->tx16[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(tx16_obj, count_tx16++));
2036 }
2037 }
2038 }
2039
2040 /* __u8 tx32[2][3] */
2041 int count_tx32 = 0;
2042 json_object *tx32_obj;
2043 if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "tx32", &tx32_obj)) {
2044 for (size_t i = 0; i < 2; i++) {
2045 for (size_t j = 0; j < 3; j++) {
2046 if (json_object_array_get_idx(tx32_obj, count_tx32))
2047 p->tx32[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(tx32_obj, count_tx32++));
2048 }
2049 }
2050 }
2051
2052 /* __u8 coef[4][2][2][6][6][3] */
2053 int count_coef = 0;
2054 json_object *coef_obj;
2055 if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "coef", &coef_obj)) {
2056 for (size_t i = 0; i < 4; i++) {
2057 for (size_t j = 0; j < 2; j++) {
2058 for (size_t k = 0; k < 2; k++) {
2059 for (size_t l = 0; l < 6; l++) {
2060 for (size_t m = 0; m < 6; m++) {
2061 for (size_t n = 0; n < 3; n++) {
2062 if (json_object_array_get_idx(coef_obj, count_coef))
2063 p->coef[i][j][k][l][m][n] = (__u8) json_object_get_int(json_object_array_get_idx(coef_obj, count_coef++));
2064 }
2065 }
2066 }
2067 }
2068 }
2069 }
2070 }
2071
2072 /* __u8 skip[3] */
2073 json_object *skip_obj;
2074 if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "skip", &skip_obj)) {
2075 for (size_t i = 0; i < 3; i++) {
2076 if (json_object_array_get_idx(skip_obj, i))
2077 p->skip[i] = (__u8) json_object_get_int(json_object_array_get_idx(skip_obj, i));
2078 }
2079 }
2080
2081 /* __u8 inter_mode[7][3] */
2082 int count_inter_mode = 0;
2083 json_object *inter_mode_obj;
2084 if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "inter_mode", &inter_mode_obj)) {
2085 for (size_t i = 0; i < 7; i++) {
2086 for (size_t j = 0; j < 3; j++) {
2087 if (json_object_array_get_idx(inter_mode_obj, count_inter_mode))
2088 p->inter_mode[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(inter_mode_obj, count_inter_mode++));
2089 }
2090 }
2091 }
2092
2093 /* __u8 interp_filter[4][2] */
2094 int count_interp_filter = 0;
2095 json_object *interp_filter_obj;
2096 if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "interp_filter", &interp_filter_obj)) {
2097 for (size_t i = 0; i < 4; i++) {
2098 for (size_t j = 0; j < 2; j++) {
2099 if (json_object_array_get_idx(interp_filter_obj, count_interp_filter))
2100 p->interp_filter[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(interp_filter_obj, count_interp_filter++));
2101 }
2102 }
2103 }
2104
2105 /* __u8 is_inter[4] */
2106 json_object *is_inter_obj;
2107 if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "is_inter", &is_inter_obj)) {
2108 for (size_t i = 0; i < 4; i++) {
2109 if (json_object_array_get_idx(is_inter_obj, i))
2110 p->is_inter[i] = (__u8) json_object_get_int(json_object_array_get_idx(is_inter_obj, i));
2111 }
2112 }
2113
2114 /* __u8 comp_mode[5] */
2115 json_object *comp_mode_obj;
2116 if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "comp_mode", &comp_mode_obj)) {
2117 for (size_t i = 0; i < 5; i++) {
2118 if (json_object_array_get_idx(comp_mode_obj, i))
2119 p->comp_mode[i] = (__u8) json_object_get_int(json_object_array_get_idx(comp_mode_obj, i));
2120 }
2121 }
2122
2123 /* __u8 single_ref[5][2] */
2124 int count_single_ref = 0;
2125 json_object *single_ref_obj;
2126 if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "single_ref", &single_ref_obj)) {
2127 for (size_t i = 0; i < 5; i++) {
2128 for (size_t j = 0; j < 2; j++) {
2129 if (json_object_array_get_idx(single_ref_obj, count_single_ref))
2130 p->single_ref[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(single_ref_obj, count_single_ref++));
2131 }
2132 }
2133 }
2134
2135 /* __u8 comp_ref[5] */
2136 json_object *comp_ref_obj;
2137 if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "comp_ref", &comp_ref_obj)) {
2138 for (size_t i = 0; i < 5; i++) {
2139 if (json_object_array_get_idx(comp_ref_obj, i))
2140 p->comp_ref[i] = (__u8) json_object_get_int(json_object_array_get_idx(comp_ref_obj, i));
2141 }
2142 }
2143
2144 /* __u8 y_mode[4][9] */
2145 int count_y_mode = 0;
2146 json_object *y_mode_obj;
2147 if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "y_mode", &y_mode_obj)) {
2148 for (size_t i = 0; i < 4; i++) {
2149 for (size_t j = 0; j < 9; j++) {
2150 if (json_object_array_get_idx(y_mode_obj, count_y_mode))
2151 p->y_mode[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(y_mode_obj, count_y_mode++));
2152 }
2153 }
2154 }
2155
2156 /* __u8 uv_mode[10][9] */
2157 int count_uv_mode = 0;
2158 json_object *uv_mode_obj;
2159 if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "uv_mode", &uv_mode_obj)) {
2160 for (size_t i = 0; i < 10; i++) {
2161 for (size_t j = 0; j < 9; j++) {
2162 if (json_object_array_get_idx(uv_mode_obj, count_uv_mode))
2163 p->uv_mode[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(uv_mode_obj, count_uv_mode++));
2164 }
2165 }
2166 }
2167
2168 /* __u8 partition[16][3] */
2169 int count_partition = 0;
2170 json_object *partition_obj;
2171 if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "partition", &partition_obj)) {
2172 for (size_t i = 0; i < 16; i++) {
2173 for (size_t j = 0; j < 3; j++) {
2174 if (json_object_array_get_idx(partition_obj, count_partition))
2175 p->partition[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(partition_obj, count_partition++));
2176 }
2177 }
2178 }
2179
2180 /* struct v4l2_vp9_mv_probs mv */
2181 json_object *mv_obj;
2182 if (!json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "v4l2_vp9_mv_probs", &mv_obj))
2183 return p;
2184 void *mv_ptr = (void *) retrace_v4l2_vp9_mv_probs_gen(mv_obj);
2185 p->mv = *static_cast<struct v4l2_vp9_mv_probs*>(mv_ptr);
2186 free(mv_ptr);
2187
2188 return p;
2189 }
2190
retrace_v4l2_ctrl_av1_sequence_gen(json_object * ctrl_obj)2191 struct v4l2_ctrl_av1_sequence *retrace_v4l2_ctrl_av1_sequence_gen(json_object *ctrl_obj)
2192 {
2193 struct v4l2_ctrl_av1_sequence *p = (struct v4l2_ctrl_av1_sequence *) calloc(1, sizeof(v4l2_ctrl_av1_sequence));
2194 json_object *v4l2_ctrl_av1_sequence_obj;
2195 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_av1_sequence", &v4l2_ctrl_av1_sequence_obj))
2196 v4l2_ctrl_av1_sequence_obj = ctrl_obj;
2197
2198 json_object *flags_obj;
2199 if (json_object_object_get_ex(v4l2_ctrl_av1_sequence_obj, "flags", &flags_obj))
2200 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_av1_sequence_flag_def);
2201
2202 json_object *seq_profile_obj;
2203 if (json_object_object_get_ex(v4l2_ctrl_av1_sequence_obj, "seq_profile", &seq_profile_obj))
2204 p->seq_profile = (__u8) json_object_get_int(seq_profile_obj);
2205
2206 json_object *order_hint_bits_obj;
2207 if (json_object_object_get_ex(v4l2_ctrl_av1_sequence_obj, "order_hint_bits", &order_hint_bits_obj))
2208 p->order_hint_bits = (__u8) json_object_get_int(order_hint_bits_obj);
2209
2210 json_object *bit_depth_obj;
2211 if (json_object_object_get_ex(v4l2_ctrl_av1_sequence_obj, "bit_depth", &bit_depth_obj))
2212 p->bit_depth = (__u8) json_object_get_int(bit_depth_obj);
2213
2214 json_object *max_frame_width_minus_1_obj;
2215 if (json_object_object_get_ex(v4l2_ctrl_av1_sequence_obj, "max_frame_width_minus_1", &max_frame_width_minus_1_obj))
2216 p->max_frame_width_minus_1 = (__u16) json_object_get_int(max_frame_width_minus_1_obj);
2217
2218 json_object *max_frame_height_minus_1_obj;
2219 if (json_object_object_get_ex(v4l2_ctrl_av1_sequence_obj, "max_frame_height_minus_1", &max_frame_height_minus_1_obj))
2220 p->max_frame_height_minus_1 = (__u16) json_object_get_int(max_frame_height_minus_1_obj);
2221
2222 return p;
2223 }
2224
retrace_v4l2_ctrl_av1_tile_group_entry_gen(json_object * ctrl_obj)2225 struct v4l2_ctrl_av1_tile_group_entry *retrace_v4l2_ctrl_av1_tile_group_entry_gen(json_object *ctrl_obj)
2226 {
2227 struct v4l2_ctrl_av1_tile_group_entry *p = (struct v4l2_ctrl_av1_tile_group_entry *) calloc(1, sizeof(v4l2_ctrl_av1_tile_group_entry));
2228 json_object *v4l2_ctrl_av1_tile_group_entry_obj;
2229 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_av1_tile_group_entry", &v4l2_ctrl_av1_tile_group_entry_obj))
2230 v4l2_ctrl_av1_tile_group_entry_obj = ctrl_obj;
2231
2232 json_object *tile_offset_obj;
2233 if (json_object_object_get_ex(v4l2_ctrl_av1_tile_group_entry_obj, "tile_offset", &tile_offset_obj))
2234 p->tile_offset = (__u32) json_object_get_int64(tile_offset_obj);
2235
2236 json_object *tile_size_obj;
2237 if (json_object_object_get_ex(v4l2_ctrl_av1_tile_group_entry_obj, "tile_size", &tile_size_obj))
2238 p->tile_size = (__u32) json_object_get_int64(tile_size_obj);
2239
2240 json_object *tile_row_obj;
2241 if (json_object_object_get_ex(v4l2_ctrl_av1_tile_group_entry_obj, "tile_row", &tile_row_obj))
2242 p->tile_row = (__u32) json_object_get_int64(tile_row_obj);
2243
2244 json_object *tile_col_obj;
2245 if (json_object_object_get_ex(v4l2_ctrl_av1_tile_group_entry_obj, "tile_col", &tile_col_obj))
2246 p->tile_col = (__u32) json_object_get_int64(tile_col_obj);
2247
2248 return p;
2249 }
2250
retrace_v4l2_av1_global_motion_gen(json_object * ctrl_obj)2251 struct v4l2_av1_global_motion *retrace_v4l2_av1_global_motion_gen(json_object *ctrl_obj)
2252 {
2253 struct v4l2_av1_global_motion *p = (struct v4l2_av1_global_motion *) calloc(1, sizeof(v4l2_av1_global_motion));
2254 json_object *v4l2_av1_global_motion_obj;
2255 if (!json_object_object_get_ex(ctrl_obj, "v4l2_av1_global_motion", &v4l2_av1_global_motion_obj))
2256 v4l2_av1_global_motion_obj = ctrl_obj;
2257
2258 /* __u8 flags[V4L2_AV1_TOTAL_REFS_PER_FRAME] */
2259 json_object *flags_obj;
2260 if (json_object_object_get_ex(v4l2_av1_global_motion_obj, "flags", &flags_obj)) {
2261 for (size_t i = 0; i < V4L2_AV1_TOTAL_REFS_PER_FRAME; i++) {
2262 if (json_object_array_get_idx(flags_obj, i))
2263 p->flags[i] = (__u8) json_object_get_int(json_object_array_get_idx(flags_obj, i));
2264 }
2265 }
2266
2267 /* enum v4l2_av1_warp_model type[V4L2_AV1_TOTAL_REFS_PER_FRAME] */
2268 json_object *type_obj;
2269 if (json_object_object_get_ex(v4l2_av1_global_motion_obj, "type", &type_obj)) {
2270 for (size_t i = 0; i < V4L2_AV1_TOTAL_REFS_PER_FRAME; i++) {
2271 if (json_object_array_get_idx(type_obj, i))
2272 p->type[i] = (v4l2_av1_warp_model) json_object_get_int(json_object_array_get_idx(type_obj, i));
2273 }
2274 }
2275
2276 /* __s32 params[V4L2_AV1_TOTAL_REFS_PER_FRAME][6] */
2277 int count_params = 0;
2278 json_object *params_obj;
2279 if (json_object_object_get_ex(v4l2_av1_global_motion_obj, "params", ¶ms_obj)) {
2280 for (size_t i = 0; i < V4L2_AV1_TOTAL_REFS_PER_FRAME; i++) {
2281 for (size_t j = 0; j < 6; j++) {
2282 if (json_object_array_get_idx(params_obj, count_params))
2283 p->params[i][j] = (__s32) json_object_get_int(json_object_array_get_idx(params_obj, count_params++));
2284 }
2285 }
2286 }
2287
2288 json_object *invalid_obj;
2289 if (json_object_object_get_ex(v4l2_av1_global_motion_obj, "invalid", &invalid_obj))
2290 p->invalid = (__u8) json_object_get_int(invalid_obj);
2291
2292 return p;
2293 }
2294
retrace_v4l2_av1_loop_restoration_gen(json_object * ctrl_obj)2295 struct v4l2_av1_loop_restoration *retrace_v4l2_av1_loop_restoration_gen(json_object *ctrl_obj)
2296 {
2297 struct v4l2_av1_loop_restoration *p = (struct v4l2_av1_loop_restoration *) calloc(1, sizeof(v4l2_av1_loop_restoration));
2298 json_object *v4l2_av1_loop_restoration_obj;
2299 if (!json_object_object_get_ex(ctrl_obj, "v4l2_av1_loop_restoration", &v4l2_av1_loop_restoration_obj))
2300 v4l2_av1_loop_restoration_obj = ctrl_obj;
2301
2302 json_object *flags_obj;
2303 if (json_object_object_get_ex(v4l2_av1_loop_restoration_obj, "flags", &flags_obj))
2304 p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_av1_loop_restoration_flag_def);
2305
2306 json_object *lr_unit_shift_obj;
2307 if (json_object_object_get_ex(v4l2_av1_loop_restoration_obj, "lr_unit_shift", &lr_unit_shift_obj))
2308 p->lr_unit_shift = (__u8) json_object_get_int(lr_unit_shift_obj);
2309
2310 json_object *lr_uv_shift_obj;
2311 if (json_object_object_get_ex(v4l2_av1_loop_restoration_obj, "lr_uv_shift", &lr_uv_shift_obj))
2312 p->lr_uv_shift = (__u8) json_object_get_int(lr_uv_shift_obj);
2313
2314 /* enum v4l2_av1_frame_restoration_type frame_restoration_type[V4L2_AV1_NUM_PLANES_MAX] */
2315 json_object *frame_restoration_type_obj;
2316 if (json_object_object_get_ex(v4l2_av1_loop_restoration_obj, "frame_restoration_type", &frame_restoration_type_obj)) {
2317 for (size_t i = 0; i < V4L2_AV1_NUM_PLANES_MAX; i++) {
2318 if (json_object_array_get_idx(frame_restoration_type_obj, i))
2319 p->frame_restoration_type[i] = (v4l2_av1_frame_restoration_type) json_object_get_int(json_object_array_get_idx(frame_restoration_type_obj, i));
2320 }
2321 }
2322
2323 /* __u32 loop_restoration_size[V4L2_AV1_MAX_NUM_PLANES] */
2324 json_object *loop_restoration_size_obj;
2325 if (json_object_object_get_ex(v4l2_av1_loop_restoration_obj, "loop_restoration_size", &loop_restoration_size_obj)) {
2326 for (size_t i = 0; i < V4L2_AV1_MAX_NUM_PLANES; i++) {
2327 if (json_object_array_get_idx(loop_restoration_size_obj, i))
2328 p->loop_restoration_size[i] = (__u32) json_object_get_int64(json_object_array_get_idx(loop_restoration_size_obj, i));
2329 }
2330 }
2331
2332 return p;
2333 }
2334
retrace_v4l2_av1_cdef_gen(json_object * ctrl_obj)2335 struct v4l2_av1_cdef *retrace_v4l2_av1_cdef_gen(json_object *ctrl_obj)
2336 {
2337 struct v4l2_av1_cdef *p = (struct v4l2_av1_cdef *) calloc(1, sizeof(v4l2_av1_cdef));
2338 json_object *v4l2_av1_cdef_obj;
2339 if (!json_object_object_get_ex(ctrl_obj, "v4l2_av1_cdef", &v4l2_av1_cdef_obj))
2340 v4l2_av1_cdef_obj = ctrl_obj;
2341
2342 json_object *damping_minus_3_obj;
2343 if (json_object_object_get_ex(v4l2_av1_cdef_obj, "damping_minus_3", &damping_minus_3_obj))
2344 p->damping_minus_3 = (__u8) json_object_get_int(damping_minus_3_obj);
2345
2346 json_object *bits_obj;
2347 if (json_object_object_get_ex(v4l2_av1_cdef_obj, "bits", &bits_obj))
2348 p->bits = (__u8) json_object_get_int(bits_obj);
2349
2350 /* __u8 y_pri_strength[V4L2_AV1_CDEF_MAX] */
2351 json_object *y_pri_strength_obj;
2352 if (json_object_object_get_ex(v4l2_av1_cdef_obj, "y_pri_strength", &y_pri_strength_obj)) {
2353 for (size_t i = 0; i < V4L2_AV1_CDEF_MAX; i++) {
2354 if (json_object_array_get_idx(y_pri_strength_obj, i))
2355 p->y_pri_strength[i] = (__u8) json_object_get_int(json_object_array_get_idx(y_pri_strength_obj, i));
2356 }
2357 }
2358
2359 /* __u8 y_sec_strength[V4L2_AV1_CDEF_MAX] */
2360 json_object *y_sec_strength_obj;
2361 if (json_object_object_get_ex(v4l2_av1_cdef_obj, "y_sec_strength", &y_sec_strength_obj)) {
2362 for (size_t i = 0; i < V4L2_AV1_CDEF_MAX; i++) {
2363 if (json_object_array_get_idx(y_sec_strength_obj, i))
2364 p->y_sec_strength[i] = (__u8) json_object_get_int(json_object_array_get_idx(y_sec_strength_obj, i));
2365 }
2366 }
2367
2368 /* __u8 uv_pri_strength[V4L2_AV1_CDEF_MAX] */
2369 json_object *uv_pri_strength_obj;
2370 if (json_object_object_get_ex(v4l2_av1_cdef_obj, "uv_pri_strength", &uv_pri_strength_obj)) {
2371 for (size_t i = 0; i < V4L2_AV1_CDEF_MAX; i++) {
2372 if (json_object_array_get_idx(uv_pri_strength_obj, i))
2373 p->uv_pri_strength[i] = (__u8) json_object_get_int(json_object_array_get_idx(uv_pri_strength_obj, i));
2374 }
2375 }
2376
2377 /* __u8 uv_sec_strength[V4L2_AV1_CDEF_MAX] */
2378 json_object *uv_sec_strength_obj;
2379 if (json_object_object_get_ex(v4l2_av1_cdef_obj, "uv_sec_strength", &uv_sec_strength_obj)) {
2380 for (size_t i = 0; i < V4L2_AV1_CDEF_MAX; i++) {
2381 if (json_object_array_get_idx(uv_sec_strength_obj, i))
2382 p->uv_sec_strength[i] = (__u8) json_object_get_int(json_object_array_get_idx(uv_sec_strength_obj, i));
2383 }
2384 }
2385
2386 return p;
2387 }
2388
retrace_v4l2_av1_segmentation_gen(json_object * ctrl_obj)2389 struct v4l2_av1_segmentation *retrace_v4l2_av1_segmentation_gen(json_object *ctrl_obj)
2390 {
2391 struct v4l2_av1_segmentation *p = (struct v4l2_av1_segmentation *) calloc(1, sizeof(v4l2_av1_segmentation));
2392 json_object *v4l2_av1_segmentation_obj;
2393 if (!json_object_object_get_ex(ctrl_obj, "v4l2_av1_segmentation", &v4l2_av1_segmentation_obj))
2394 v4l2_av1_segmentation_obj = ctrl_obj;
2395
2396 json_object *flags_obj;
2397 if (json_object_object_get_ex(v4l2_av1_segmentation_obj, "flags", &flags_obj))
2398 p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_av1_segmentation_flag_def);
2399
2400 json_object *last_active_seg_id_obj;
2401 if (json_object_object_get_ex(v4l2_av1_segmentation_obj, "last_active_seg_id", &last_active_seg_id_obj))
2402 p->last_active_seg_id = (__u8) json_object_get_int(last_active_seg_id_obj);
2403
2404 /* __u8 feature_enabled[V4L2_AV1_MAX_SEGMENTS] */
2405 json_object *feature_enabled_obj;
2406 if (json_object_object_get_ex(v4l2_av1_segmentation_obj, "feature_enabled", &feature_enabled_obj)) {
2407 for (size_t i = 0; i < V4L2_AV1_MAX_SEGMENTS; i++) {
2408 if (json_object_array_get_idx(feature_enabled_obj, i))
2409 p->feature_enabled[i] = (__u8) json_object_get_int(json_object_array_get_idx(feature_enabled_obj, i));
2410 }
2411 }
2412
2413 /* __s16 feature_data[V4L2_AV1_MAX_SEGMENTS][V4L2_AV1_SEG_LVL_MAX] */
2414 int count_feature_data = 0;
2415 json_object *feature_data_obj;
2416 if (json_object_object_get_ex(v4l2_av1_segmentation_obj, "feature_data", &feature_data_obj)) {
2417 for (size_t i = 0; i < V4L2_AV1_MAX_SEGMENTS; i++) {
2418 for (size_t j = 0; j < V4L2_AV1_SEG_LVL_MAX; j++) {
2419 if (json_object_array_get_idx(feature_data_obj, count_feature_data))
2420 p->feature_data[i][j] = (__s16) json_object_get_int(json_object_array_get_idx(feature_data_obj, count_feature_data++));
2421 }
2422 }
2423 }
2424
2425 return p;
2426 }
2427
retrace_v4l2_av1_loop_filter_gen(json_object * ctrl_obj)2428 struct v4l2_av1_loop_filter *retrace_v4l2_av1_loop_filter_gen(json_object *ctrl_obj)
2429 {
2430 struct v4l2_av1_loop_filter *p = (struct v4l2_av1_loop_filter *) calloc(1, sizeof(v4l2_av1_loop_filter));
2431 json_object *v4l2_av1_loop_filter_obj;
2432 if (!json_object_object_get_ex(ctrl_obj, "v4l2_av1_loop_filter", &v4l2_av1_loop_filter_obj))
2433 v4l2_av1_loop_filter_obj = ctrl_obj;
2434
2435 json_object *flags_obj;
2436 if (json_object_object_get_ex(v4l2_av1_loop_filter_obj, "flags", &flags_obj))
2437 p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_av1_loop_filter_flag_def);
2438
2439 /* __u8 level[4] */
2440 json_object *level_obj;
2441 if (json_object_object_get_ex(v4l2_av1_loop_filter_obj, "level", &level_obj)) {
2442 for (size_t i = 0; i < 4; i++) {
2443 if (json_object_array_get_idx(level_obj, i))
2444 p->level[i] = (__u8) json_object_get_int(json_object_array_get_idx(level_obj, i));
2445 }
2446 }
2447
2448 json_object *sharpness_obj;
2449 if (json_object_object_get_ex(v4l2_av1_loop_filter_obj, "sharpness", &sharpness_obj))
2450 p->sharpness = (__u8) json_object_get_int(sharpness_obj);
2451
2452 /* __s8 ref_deltas[V4L2_AV1_TOTAL_REFS_PER_FRAME] */
2453 json_object *ref_deltas_obj;
2454 if (json_object_object_get_ex(v4l2_av1_loop_filter_obj, "ref_deltas", &ref_deltas_obj)) {
2455 for (size_t i = 0; i < V4L2_AV1_TOTAL_REFS_PER_FRAME; i++) {
2456 if (json_object_array_get_idx(ref_deltas_obj, i))
2457 p->ref_deltas[i] = (__s8) json_object_get_int(json_object_array_get_idx(ref_deltas_obj, i));
2458 }
2459 }
2460
2461 /* __s8 mode_deltas[2] */
2462 json_object *mode_deltas_obj;
2463 if (json_object_object_get_ex(v4l2_av1_loop_filter_obj, "mode_deltas", &mode_deltas_obj)) {
2464 for (size_t i = 0; i < 2; i++) {
2465 if (json_object_array_get_idx(mode_deltas_obj, i))
2466 p->mode_deltas[i] = (__s8) json_object_get_int(json_object_array_get_idx(mode_deltas_obj, i));
2467 }
2468 }
2469
2470 json_object *delta_lf_res_obj;
2471 if (json_object_object_get_ex(v4l2_av1_loop_filter_obj, "delta_lf_res", &delta_lf_res_obj))
2472 p->delta_lf_res = (__u8) json_object_get_int(delta_lf_res_obj);
2473
2474 return p;
2475 }
2476
retrace_v4l2_av1_quantization_gen(json_object * ctrl_obj)2477 struct v4l2_av1_quantization *retrace_v4l2_av1_quantization_gen(json_object *ctrl_obj)
2478 {
2479 struct v4l2_av1_quantization *p = (struct v4l2_av1_quantization *) calloc(1, sizeof(v4l2_av1_quantization));
2480 json_object *v4l2_av1_quantization_obj;
2481 if (!json_object_object_get_ex(ctrl_obj, "v4l2_av1_quantization", &v4l2_av1_quantization_obj))
2482 v4l2_av1_quantization_obj = ctrl_obj;
2483
2484 json_object *flags_obj;
2485 if (json_object_object_get_ex(v4l2_av1_quantization_obj, "flags", &flags_obj))
2486 p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_av1_quantization_flag_def);
2487
2488 json_object *base_q_idx_obj;
2489 if (json_object_object_get_ex(v4l2_av1_quantization_obj, "base_q_idx", &base_q_idx_obj))
2490 p->base_q_idx = (__u8) json_object_get_int(base_q_idx_obj);
2491
2492 json_object *delta_q_y_dc_obj;
2493 if (json_object_object_get_ex(v4l2_av1_quantization_obj, "delta_q_y_dc", &delta_q_y_dc_obj))
2494 p->delta_q_y_dc = (__s8) json_object_get_int(delta_q_y_dc_obj);
2495
2496 json_object *delta_q_u_dc_obj;
2497 if (json_object_object_get_ex(v4l2_av1_quantization_obj, "delta_q_u_dc", &delta_q_u_dc_obj))
2498 p->delta_q_u_dc = (__s8) json_object_get_int(delta_q_u_dc_obj);
2499
2500 json_object *delta_q_u_ac_obj;
2501 if (json_object_object_get_ex(v4l2_av1_quantization_obj, "delta_q_u_ac", &delta_q_u_ac_obj))
2502 p->delta_q_u_ac = (__s8) json_object_get_int(delta_q_u_ac_obj);
2503
2504 json_object *delta_q_v_dc_obj;
2505 if (json_object_object_get_ex(v4l2_av1_quantization_obj, "delta_q_v_dc", &delta_q_v_dc_obj))
2506 p->delta_q_v_dc = (__s8) json_object_get_int(delta_q_v_dc_obj);
2507
2508 json_object *delta_q_v_ac_obj;
2509 if (json_object_object_get_ex(v4l2_av1_quantization_obj, "delta_q_v_ac", &delta_q_v_ac_obj))
2510 p->delta_q_v_ac = (__s8) json_object_get_int(delta_q_v_ac_obj);
2511
2512 json_object *qm_y_obj;
2513 if (json_object_object_get_ex(v4l2_av1_quantization_obj, "qm_y", &qm_y_obj))
2514 p->qm_y = (__u8) json_object_get_int(qm_y_obj);
2515
2516 json_object *qm_u_obj;
2517 if (json_object_object_get_ex(v4l2_av1_quantization_obj, "qm_u", &qm_u_obj))
2518 p->qm_u = (__u8) json_object_get_int(qm_u_obj);
2519
2520 json_object *qm_v_obj;
2521 if (json_object_object_get_ex(v4l2_av1_quantization_obj, "qm_v", &qm_v_obj))
2522 p->qm_v = (__u8) json_object_get_int(qm_v_obj);
2523
2524 json_object *delta_q_res_obj;
2525 if (json_object_object_get_ex(v4l2_av1_quantization_obj, "delta_q_res", &delta_q_res_obj))
2526 p->delta_q_res = (__u8) json_object_get_int(delta_q_res_obj);
2527
2528 return p;
2529 }
2530
retrace_v4l2_av1_tile_info_gen(json_object * ctrl_obj)2531 struct v4l2_av1_tile_info *retrace_v4l2_av1_tile_info_gen(json_object *ctrl_obj)
2532 {
2533 struct v4l2_av1_tile_info *p = (struct v4l2_av1_tile_info *) calloc(1, sizeof(v4l2_av1_tile_info));
2534 json_object *v4l2_av1_tile_info_obj;
2535 if (!json_object_object_get_ex(ctrl_obj, "v4l2_av1_tile_info", &v4l2_av1_tile_info_obj))
2536 v4l2_av1_tile_info_obj = ctrl_obj;
2537
2538 json_object *flags_obj;
2539 if (json_object_object_get_ex(v4l2_av1_tile_info_obj, "flags", &flags_obj))
2540 p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_av1_tile_info_flag_def);
2541
2542 json_object *context_update_tile_id_obj;
2543 if (json_object_object_get_ex(v4l2_av1_tile_info_obj, "context_update_tile_id", &context_update_tile_id_obj))
2544 p->context_update_tile_id = (__u8) json_object_get_int(context_update_tile_id_obj);
2545
2546 json_object *tile_cols_obj;
2547 if (json_object_object_get_ex(v4l2_av1_tile_info_obj, "tile_cols", &tile_cols_obj))
2548 p->tile_cols = (__u8) json_object_get_int(tile_cols_obj);
2549
2550 json_object *tile_rows_obj;
2551 if (json_object_object_get_ex(v4l2_av1_tile_info_obj, "tile_rows", &tile_rows_obj))
2552 p->tile_rows = (__u8) json_object_get_int(tile_rows_obj);
2553
2554 /* __u32 mi_col_starts[V4L2_AV1_MAX_TILE_COLS + 1] */
2555 json_object *mi_col_starts_obj;
2556 if (json_object_object_get_ex(v4l2_av1_tile_info_obj, "mi_col_starts", &mi_col_starts_obj)) {
2557 for (size_t i = 0; i < V4L2_AV1_MAX_TILE_COLS + 1; i++) {
2558 if (json_object_array_get_idx(mi_col_starts_obj, i))
2559 p->mi_col_starts[i] = (__u32) json_object_get_int64(json_object_array_get_idx(mi_col_starts_obj, i));
2560 }
2561 }
2562
2563 /* __u32 mi_row_starts[V4L2_AV1_MAX_TILE_ROWS + 1] */
2564 json_object *mi_row_starts_obj;
2565 if (json_object_object_get_ex(v4l2_av1_tile_info_obj, "mi_row_starts", &mi_row_starts_obj)) {
2566 for (size_t i = 0; i < V4L2_AV1_MAX_TILE_ROWS + 1; i++) {
2567 if (json_object_array_get_idx(mi_row_starts_obj, i))
2568 p->mi_row_starts[i] = (__u32) json_object_get_int64(json_object_array_get_idx(mi_row_starts_obj, i));
2569 }
2570 }
2571
2572 /* __u32 width_in_sbs_minus_1[V4L2_AV1_MAX_TILE_COLS] */
2573 json_object *width_in_sbs_minus_1_obj;
2574 if (json_object_object_get_ex(v4l2_av1_tile_info_obj, "width_in_sbs_minus_1", &width_in_sbs_minus_1_obj)) {
2575 for (size_t i = 0; i < V4L2_AV1_MAX_TILE_COLS; i++) {
2576 if (json_object_array_get_idx(width_in_sbs_minus_1_obj, i))
2577 p->width_in_sbs_minus_1[i] = (__u32) json_object_get_int64(json_object_array_get_idx(width_in_sbs_minus_1_obj, i));
2578 }
2579 }
2580
2581 /* __u32 height_in_sbs_minus_1[V4L2_AV1_MAX_TILE_ROWS] */
2582 json_object *height_in_sbs_minus_1_obj;
2583 if (json_object_object_get_ex(v4l2_av1_tile_info_obj, "height_in_sbs_minus_1", &height_in_sbs_minus_1_obj)) {
2584 for (size_t i = 0; i < V4L2_AV1_MAX_TILE_ROWS; i++) {
2585 if (json_object_array_get_idx(height_in_sbs_minus_1_obj, i))
2586 p->height_in_sbs_minus_1[i] = (__u32) json_object_get_int64(json_object_array_get_idx(height_in_sbs_minus_1_obj, i));
2587 }
2588 }
2589
2590 json_object *tile_size_bytes_obj;
2591 if (json_object_object_get_ex(v4l2_av1_tile_info_obj, "tile_size_bytes", &tile_size_bytes_obj))
2592 p->tile_size_bytes = (__u8) json_object_get_int(tile_size_bytes_obj);
2593
2594 return p;
2595 }
2596
retrace_v4l2_ctrl_av1_frame_gen(json_object * ctrl_obj)2597 struct v4l2_ctrl_av1_frame *retrace_v4l2_ctrl_av1_frame_gen(json_object *ctrl_obj)
2598 {
2599 struct v4l2_ctrl_av1_frame *p = (struct v4l2_ctrl_av1_frame *) calloc(1, sizeof(v4l2_ctrl_av1_frame));
2600 json_object *v4l2_ctrl_av1_frame_obj;
2601 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_av1_frame", &v4l2_ctrl_av1_frame_obj))
2602 v4l2_ctrl_av1_frame_obj = ctrl_obj;
2603
2604 /* struct v4l2_av1_tile_info tile_info */
2605 json_object *tile_info_obj;
2606 if (!json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "v4l2_av1_tile_info", &tile_info_obj))
2607 return p;
2608 void *tile_info_ptr = (void *) retrace_v4l2_av1_tile_info_gen(tile_info_obj);
2609 p->tile_info = *static_cast<struct v4l2_av1_tile_info*>(tile_info_ptr);
2610 free(tile_info_ptr);
2611
2612 /* struct v4l2_av1_quantization quantization */
2613 json_object *quantization_obj;
2614 if (!json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "v4l2_av1_quantization", &quantization_obj))
2615 return p;
2616 void *quantization_ptr = (void *) retrace_v4l2_av1_quantization_gen(quantization_obj);
2617 p->quantization = *static_cast<struct v4l2_av1_quantization*>(quantization_ptr);
2618 free(quantization_ptr);
2619
2620 json_object *superres_denom_obj;
2621 if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "superres_denom", &superres_denom_obj))
2622 p->superres_denom = (__u8) json_object_get_int(superres_denom_obj);
2623
2624 /* struct v4l2_av1_segmentation segmentation */
2625 json_object *segmentation_obj;
2626 if (!json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "v4l2_av1_segmentation", &segmentation_obj))
2627 return p;
2628 void *segmentation_ptr = (void *) retrace_v4l2_av1_segmentation_gen(segmentation_obj);
2629 p->segmentation = *static_cast<struct v4l2_av1_segmentation*>(segmentation_ptr);
2630 free(segmentation_ptr);
2631
2632 /* struct v4l2_av1_loop_filter loop_filter */
2633 json_object *loop_filter_obj;
2634 if (!json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "v4l2_av1_loop_filter", &loop_filter_obj))
2635 return p;
2636 void *loop_filter_ptr = (void *) retrace_v4l2_av1_loop_filter_gen(loop_filter_obj);
2637 p->loop_filter = *static_cast<struct v4l2_av1_loop_filter*>(loop_filter_ptr);
2638 free(loop_filter_ptr);
2639
2640 /* struct v4l2_av1_cdef cdef */
2641 json_object *cdef_obj;
2642 if (!json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "v4l2_av1_cdef", &cdef_obj))
2643 return p;
2644 void *cdef_ptr = (void *) retrace_v4l2_av1_cdef_gen(cdef_obj);
2645 p->cdef = *static_cast<struct v4l2_av1_cdef*>(cdef_ptr);
2646 free(cdef_ptr);
2647
2648 /* __u8 skip_mode_frame[2] */
2649 json_object *skip_mode_frame_obj;
2650 if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "skip_mode_frame", &skip_mode_frame_obj)) {
2651 for (size_t i = 0; i < 2; i++) {
2652 if (json_object_array_get_idx(skip_mode_frame_obj, i))
2653 p->skip_mode_frame[i] = (__u8) json_object_get_int(json_object_array_get_idx(skip_mode_frame_obj, i));
2654 }
2655 }
2656
2657 json_object *primary_ref_frame_obj;
2658 if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "primary_ref_frame", &primary_ref_frame_obj))
2659 p->primary_ref_frame = (__u8) json_object_get_int(primary_ref_frame_obj);
2660
2661 /* struct v4l2_av1_loop_restoration loop_restoration */
2662 json_object *loop_restoration_obj;
2663 if (!json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "v4l2_av1_loop_restoration", &loop_restoration_obj))
2664 return p;
2665 void *loop_restoration_ptr = (void *) retrace_v4l2_av1_loop_restoration_gen(loop_restoration_obj);
2666 p->loop_restoration = *static_cast<struct v4l2_av1_loop_restoration*>(loop_restoration_ptr);
2667 free(loop_restoration_ptr);
2668
2669 /* struct v4l2_av1_global_motion global_motion */
2670 json_object *global_motion_obj;
2671 if (!json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "v4l2_av1_global_motion", &global_motion_obj))
2672 return p;
2673 void *global_motion_ptr = (void *) retrace_v4l2_av1_global_motion_gen(global_motion_obj);
2674 p->global_motion = *static_cast<struct v4l2_av1_global_motion*>(global_motion_ptr);
2675 free(global_motion_ptr);
2676
2677 json_object *flags_obj;
2678 if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "flags", &flags_obj))
2679 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_av1_frame_flag_def);
2680
2681 json_object *frame_type_obj;
2682 if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "frame_type", &frame_type_obj))
2683 p->frame_type = (v4l2_av1_frame_type) json_object_get_int(frame_type_obj);
2684
2685 json_object *order_hint_obj;
2686 if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "order_hint", &order_hint_obj))
2687 p->order_hint = (__u32) json_object_get_int64(order_hint_obj);
2688
2689 json_object *upscaled_width_obj;
2690 if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "upscaled_width", &upscaled_width_obj))
2691 p->upscaled_width = (__u32) json_object_get_int64(upscaled_width_obj);
2692
2693 json_object *interpolation_filter_obj;
2694 if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "interpolation_filter", &interpolation_filter_obj))
2695 p->interpolation_filter = (v4l2_av1_interpolation_filter) json_object_get_int(interpolation_filter_obj);
2696
2697 json_object *tx_mode_obj;
2698 if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "tx_mode", &tx_mode_obj))
2699 p->tx_mode = (v4l2_av1_tx_mode) json_object_get_int(tx_mode_obj);
2700
2701 json_object *frame_width_minus_1_obj;
2702 if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "frame_width_minus_1", &frame_width_minus_1_obj))
2703 p->frame_width_minus_1 = (__u32) json_object_get_int64(frame_width_minus_1_obj);
2704
2705 json_object *frame_height_minus_1_obj;
2706 if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "frame_height_minus_1", &frame_height_minus_1_obj))
2707 p->frame_height_minus_1 = (__u32) json_object_get_int64(frame_height_minus_1_obj);
2708
2709 json_object *render_width_minus_1_obj;
2710 if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "render_width_minus_1", &render_width_minus_1_obj))
2711 p->render_width_minus_1 = (__u16) json_object_get_int(render_width_minus_1_obj);
2712
2713 json_object *render_height_minus_1_obj;
2714 if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "render_height_minus_1", &render_height_minus_1_obj))
2715 p->render_height_minus_1 = (__u16) json_object_get_int(render_height_minus_1_obj);
2716
2717 json_object *current_frame_id_obj;
2718 if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "current_frame_id", ¤t_frame_id_obj))
2719 p->current_frame_id = (__u32) json_object_get_int64(current_frame_id_obj);
2720
2721 /* __u32 buffer_removal_time[V4L2_AV1_MAX_OPERATING_POINTS] */
2722 json_object *buffer_removal_time_obj;
2723 if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "buffer_removal_time", &buffer_removal_time_obj)) {
2724 for (size_t i = 0; i < V4L2_AV1_MAX_OPERATING_POINTS; i++) {
2725 if (json_object_array_get_idx(buffer_removal_time_obj, i))
2726 p->buffer_removal_time[i] = (__u32) json_object_get_int64(json_object_array_get_idx(buffer_removal_time_obj, i));
2727 }
2728 }
2729
2730 /* __u32 order_hints[V4L2_AV1_TOTAL_REFS_PER_FRAME] */
2731 json_object *order_hints_obj;
2732 if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "order_hints", &order_hints_obj)) {
2733 for (size_t i = 0; i < V4L2_AV1_TOTAL_REFS_PER_FRAME; i++) {
2734 if (json_object_array_get_idx(order_hints_obj, i))
2735 p->order_hints[i] = (__u32) json_object_get_int64(json_object_array_get_idx(order_hints_obj, i));
2736 }
2737 }
2738
2739 /* __u64 reference_frame_ts[V4L2_AV1_TOTAL_REFS_PER_FRAME] */
2740 json_object *reference_frame_ts_obj;
2741 if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "reference_frame_ts", &reference_frame_ts_obj)) {
2742 for (size_t i = 0; i < V4L2_AV1_TOTAL_REFS_PER_FRAME; i++) {
2743 if (json_object_array_get_idx(reference_frame_ts_obj, i))
2744 p->reference_frame_ts[i] = (__u64) json_object_get_uint64(json_object_array_get_idx(reference_frame_ts_obj, i));
2745 }
2746 }
2747
2748 /* __s8 ref_frame_idx[V4L2_AV1_REFS_PER_FRAME] */
2749 json_object *ref_frame_idx_obj;
2750 if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "ref_frame_idx", &ref_frame_idx_obj)) {
2751 for (size_t i = 0; i < V4L2_AV1_REFS_PER_FRAME; i++) {
2752 if (json_object_array_get_idx(ref_frame_idx_obj, i))
2753 p->ref_frame_idx[i] = (__s8) json_object_get_int(json_object_array_get_idx(ref_frame_idx_obj, i));
2754 }
2755 }
2756
2757 json_object *refresh_frame_flags_obj;
2758 if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "refresh_frame_flags", &refresh_frame_flags_obj))
2759 p->refresh_frame_flags = (__u8) s2flags(json_object_get_string(refresh_frame_flags_obj), v4l2_av1_frame_flag_def);
2760
2761 return p;
2762 }
2763
retrace_v4l2_ctrl_av1_film_grain_gen(json_object * ctrl_obj)2764 struct v4l2_ctrl_av1_film_grain *retrace_v4l2_ctrl_av1_film_grain_gen(json_object *ctrl_obj)
2765 {
2766 struct v4l2_ctrl_av1_film_grain *p = (struct v4l2_ctrl_av1_film_grain *) calloc(1, sizeof(v4l2_ctrl_av1_film_grain));
2767 json_object *v4l2_ctrl_av1_film_grain_obj;
2768 if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_av1_film_grain", &v4l2_ctrl_av1_film_grain_obj))
2769 v4l2_ctrl_av1_film_grain_obj = ctrl_obj;
2770
2771 json_object *flags_obj;
2772 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "flags", &flags_obj))
2773 p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_av1_film_grain_flag_def);
2774
2775 json_object *cr_mult_obj;
2776 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "cr_mult", &cr_mult_obj))
2777 p->cr_mult = (__u8) json_object_get_int(cr_mult_obj);
2778
2779 json_object *grain_seed_obj;
2780 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "grain_seed", &grain_seed_obj))
2781 p->grain_seed = (__u16) json_object_get_int(grain_seed_obj);
2782
2783 json_object *film_grain_params_ref_idx_obj;
2784 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "film_grain_params_ref_idx", &film_grain_params_ref_idx_obj))
2785 p->film_grain_params_ref_idx = (__u8) json_object_get_int(film_grain_params_ref_idx_obj);
2786
2787 json_object *num_y_points_obj;
2788 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "num_y_points", &num_y_points_obj))
2789 p->num_y_points = (__u8) json_object_get_int(num_y_points_obj);
2790
2791 /* __u8 point_y_value[V4L2_AV1_MAX_NUM_Y_POINTS] */
2792 json_object *point_y_value_obj;
2793 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "point_y_value", &point_y_value_obj)) {
2794 for (size_t i = 0; i < V4L2_AV1_MAX_NUM_Y_POINTS; i++) {
2795 if (json_object_array_get_idx(point_y_value_obj, i))
2796 p->point_y_value[i] = (__u8) json_object_get_int(json_object_array_get_idx(point_y_value_obj, i));
2797 }
2798 }
2799
2800 /* __u8 point_y_scaling[V4L2_AV1_MAX_NUM_Y_POINTS] */
2801 json_object *point_y_scaling_obj;
2802 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "point_y_scaling", &point_y_scaling_obj)) {
2803 for (size_t i = 0; i < V4L2_AV1_MAX_NUM_Y_POINTS; i++) {
2804 if (json_object_array_get_idx(point_y_scaling_obj, i))
2805 p->point_y_scaling[i] = (__u8) json_object_get_int(json_object_array_get_idx(point_y_scaling_obj, i));
2806 }
2807 }
2808
2809 json_object *num_cb_points_obj;
2810 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "num_cb_points", &num_cb_points_obj))
2811 p->num_cb_points = (__u8) json_object_get_int(num_cb_points_obj);
2812
2813 /* __u8 point_cb_value[V4L2_AV1_MAX_NUM_CB_POINTS] */
2814 json_object *point_cb_value_obj;
2815 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "point_cb_value", &point_cb_value_obj)) {
2816 for (size_t i = 0; i < V4L2_AV1_MAX_NUM_CB_POINTS; i++) {
2817 if (json_object_array_get_idx(point_cb_value_obj, i))
2818 p->point_cb_value[i] = (__u8) json_object_get_int(json_object_array_get_idx(point_cb_value_obj, i));
2819 }
2820 }
2821
2822 /* __u8 point_cb_scaling[V4L2_AV1_MAX_NUM_CB_POINTS] */
2823 json_object *point_cb_scaling_obj;
2824 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "point_cb_scaling", &point_cb_scaling_obj)) {
2825 for (size_t i = 0; i < V4L2_AV1_MAX_NUM_CB_POINTS; i++) {
2826 if (json_object_array_get_idx(point_cb_scaling_obj, i))
2827 p->point_cb_scaling[i] = (__u8) json_object_get_int(json_object_array_get_idx(point_cb_scaling_obj, i));
2828 }
2829 }
2830
2831 json_object *num_cr_points_obj;
2832 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "num_cr_points", &num_cr_points_obj))
2833 p->num_cr_points = (__u8) json_object_get_int(num_cr_points_obj);
2834
2835 /* __u8 point_cr_value[V4L2_AV1_MAX_NUM_CR_POINTS] */
2836 json_object *point_cr_value_obj;
2837 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "point_cr_value", &point_cr_value_obj)) {
2838 for (size_t i = 0; i < V4L2_AV1_MAX_NUM_CR_POINTS; i++) {
2839 if (json_object_array_get_idx(point_cr_value_obj, i))
2840 p->point_cr_value[i] = (__u8) json_object_get_int(json_object_array_get_idx(point_cr_value_obj, i));
2841 }
2842 }
2843
2844 /* __u8 point_cr_scaling[V4L2_AV1_MAX_NUM_CR_POINTS] */
2845 json_object *point_cr_scaling_obj;
2846 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "point_cr_scaling", &point_cr_scaling_obj)) {
2847 for (size_t i = 0; i < V4L2_AV1_MAX_NUM_CR_POINTS; i++) {
2848 if (json_object_array_get_idx(point_cr_scaling_obj, i))
2849 p->point_cr_scaling[i] = (__u8) json_object_get_int(json_object_array_get_idx(point_cr_scaling_obj, i));
2850 }
2851 }
2852
2853 json_object *grain_scaling_minus_8_obj;
2854 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "grain_scaling_minus_8", &grain_scaling_minus_8_obj))
2855 p->grain_scaling_minus_8 = (__u8) json_object_get_int(grain_scaling_minus_8_obj);
2856
2857 json_object *ar_coeff_lag_obj;
2858 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "ar_coeff_lag", &ar_coeff_lag_obj))
2859 p->ar_coeff_lag = (__u8) json_object_get_int(ar_coeff_lag_obj);
2860
2861 /* __u8 ar_coeffs_y_plus_128[V4L2_AV1_AR_COEFFS_SIZE] */
2862 json_object *ar_coeffs_y_plus_128_obj;
2863 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "ar_coeffs_y_plus_128", &ar_coeffs_y_plus_128_obj)) {
2864 for (size_t i = 0; i < V4L2_AV1_AR_COEFFS_SIZE; i++) {
2865 if (json_object_array_get_idx(ar_coeffs_y_plus_128_obj, i))
2866 p->ar_coeffs_y_plus_128[i] = (__u8) json_object_get_int(json_object_array_get_idx(ar_coeffs_y_plus_128_obj, i));
2867 }
2868 }
2869
2870 /* __u8 ar_coeffs_cb_plus_128[V4L2_AV1_AR_COEFFS_SIZE] */
2871 json_object *ar_coeffs_cb_plus_128_obj;
2872 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "ar_coeffs_cb_plus_128", &ar_coeffs_cb_plus_128_obj)) {
2873 for (size_t i = 0; i < V4L2_AV1_AR_COEFFS_SIZE; i++) {
2874 if (json_object_array_get_idx(ar_coeffs_cb_plus_128_obj, i))
2875 p->ar_coeffs_cb_plus_128[i] = (__u8) json_object_get_int(json_object_array_get_idx(ar_coeffs_cb_plus_128_obj, i));
2876 }
2877 }
2878
2879 /* __u8 ar_coeffs_cr_plus_128[V4L2_AV1_AR_COEFFS_SIZE] */
2880 json_object *ar_coeffs_cr_plus_128_obj;
2881 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "ar_coeffs_cr_plus_128", &ar_coeffs_cr_plus_128_obj)) {
2882 for (size_t i = 0; i < V4L2_AV1_AR_COEFFS_SIZE; i++) {
2883 if (json_object_array_get_idx(ar_coeffs_cr_plus_128_obj, i))
2884 p->ar_coeffs_cr_plus_128[i] = (__u8) json_object_get_int(json_object_array_get_idx(ar_coeffs_cr_plus_128_obj, i));
2885 }
2886 }
2887
2888 json_object *ar_coeff_shift_minus_6_obj;
2889 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "ar_coeff_shift_minus_6", &ar_coeff_shift_minus_6_obj))
2890 p->ar_coeff_shift_minus_6 = (__u8) json_object_get_int(ar_coeff_shift_minus_6_obj);
2891
2892 json_object *grain_scale_shift_obj;
2893 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "grain_scale_shift", &grain_scale_shift_obj))
2894 p->grain_scale_shift = (__u8) json_object_get_int(grain_scale_shift_obj);
2895
2896 json_object *cb_mult_obj;
2897 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "cb_mult", &cb_mult_obj))
2898 p->cb_mult = (__u8) json_object_get_int(cb_mult_obj);
2899
2900 json_object *cb_luma_mult_obj;
2901 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "cb_luma_mult", &cb_luma_mult_obj))
2902 p->cb_luma_mult = (__u8) json_object_get_int(cb_luma_mult_obj);
2903
2904 json_object *cr_luma_mult_obj;
2905 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "cr_luma_mult", &cr_luma_mult_obj))
2906 p->cr_luma_mult = (__u8) json_object_get_int(cr_luma_mult_obj);
2907
2908 json_object *cb_offset_obj;
2909 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "cb_offset", &cb_offset_obj))
2910 p->cb_offset = (__u16) json_object_get_int(cb_offset_obj);
2911
2912 json_object *cr_offset_obj;
2913 if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "cr_offset", &cr_offset_obj))
2914 p->cr_offset = (__u16) json_object_get_int(cr_offset_obj);
2915
2916 return p;
2917 }
2918
retrace_v4l2_rect_gen(json_object * parent_obj,std::string key_name="")2919 struct v4l2_rect *retrace_v4l2_rect_gen(json_object *parent_obj, std::string key_name = "")
2920 {
2921 struct v4l2_rect *p = (struct v4l2_rect *) calloc(1, sizeof(v4l2_rect));
2922
2923 json_object *v4l2_rect_obj;
2924 if (key_name.empty())
2925 json_object_object_get_ex(parent_obj, "v4l2_rect", &v4l2_rect_obj);
2926 else
2927 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_rect_obj);
2928
2929 json_object *left_obj;
2930 if (json_object_object_get_ex(v4l2_rect_obj, "left", &left_obj))
2931 p->left = (__s32) json_object_get_int(left_obj);
2932
2933 json_object *top_obj;
2934 if (json_object_object_get_ex(v4l2_rect_obj, "top", &top_obj))
2935 p->top = (__s32) json_object_get_int(top_obj);
2936
2937 json_object *width_obj;
2938 if (json_object_object_get_ex(v4l2_rect_obj, "width", &width_obj))
2939 p->width = (__u32) json_object_get_int64(width_obj);
2940
2941 json_object *height_obj;
2942 if (json_object_object_get_ex(v4l2_rect_obj, "height", &height_obj))
2943 p->height = (__u32) json_object_get_int64(height_obj);
2944
2945 return p;
2946 }
retrace_v4l2_fract_gen(json_object * parent_obj,std::string key_name="")2947 struct v4l2_fract *retrace_v4l2_fract_gen(json_object *parent_obj, std::string key_name = "")
2948 {
2949 struct v4l2_fract *p = (struct v4l2_fract *) calloc(1, sizeof(v4l2_fract));
2950
2951 json_object *v4l2_fract_obj;
2952 if (key_name.empty())
2953 json_object_object_get_ex(parent_obj, "v4l2_fract", &v4l2_fract_obj);
2954 else
2955 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_fract_obj);
2956
2957 json_object *numerator_obj;
2958 if (json_object_object_get_ex(v4l2_fract_obj, "numerator", &numerator_obj))
2959 p->numerator = (__u32) json_object_get_int64(numerator_obj);
2960
2961 json_object *denominator_obj;
2962 if (json_object_object_get_ex(v4l2_fract_obj, "denominator", &denominator_obj))
2963 p->denominator = (__u32) json_object_get_int64(denominator_obj);
2964
2965 return p;
2966 }
retrace_v4l2_area_gen(json_object * parent_obj,std::string key_name="")2967 struct v4l2_area *retrace_v4l2_area_gen(json_object *parent_obj, std::string key_name = "")
2968 {
2969 struct v4l2_area *p = (struct v4l2_area *) calloc(1, sizeof(v4l2_area));
2970
2971 json_object *v4l2_area_obj;
2972 if (key_name.empty())
2973 json_object_object_get_ex(parent_obj, "v4l2_area", &v4l2_area_obj);
2974 else
2975 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_area_obj);
2976
2977 json_object *width_obj;
2978 if (json_object_object_get_ex(v4l2_area_obj, "width", &width_obj))
2979 p->width = (__u32) json_object_get_int64(width_obj);
2980
2981 json_object *height_obj;
2982 if (json_object_object_get_ex(v4l2_area_obj, "height", &height_obj))
2983 p->height = (__u32) json_object_get_int64(height_obj);
2984
2985 return p;
2986 }
retrace_v4l2_capability_gen(json_object * parent_obj,std::string key_name="")2987 struct v4l2_capability *retrace_v4l2_capability_gen(json_object *parent_obj, std::string key_name = "")
2988 {
2989 struct v4l2_capability *p = (struct v4l2_capability *) calloc(1, sizeof(v4l2_capability));
2990
2991 json_object *v4l2_capability_obj;
2992 if (key_name.empty())
2993 json_object_object_get_ex(parent_obj, "v4l2_capability", &v4l2_capability_obj);
2994 else
2995 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_capability_obj);
2996
2997 json_object *driver_obj;
2998 if (json_object_object_get_ex(v4l2_capability_obj, "driver", &driver_obj))
2999 if (json_object_get_string(driver_obj) != nullptr)
3000 memcpy(p->driver, json_object_get_string(driver_obj), 16);
3001
3002 json_object *card_obj;
3003 if (json_object_object_get_ex(v4l2_capability_obj, "card", &card_obj))
3004 if (json_object_get_string(card_obj) != nullptr)
3005 memcpy(p->card, json_object_get_string(card_obj), 32);
3006
3007 json_object *bus_info_obj;
3008 if (json_object_object_get_ex(v4l2_capability_obj, "bus_info", &bus_info_obj))
3009 if (json_object_get_string(bus_info_obj) != nullptr)
3010 memcpy(p->bus_info, json_object_get_string(bus_info_obj), 32);
3011
3012 json_object *version_obj;
3013 if (json_object_object_get_ex(v4l2_capability_obj, "version", &version_obj))
3014 memset(&p->version, 0, sizeof(p->version));
3015
3016 json_object *capabilities_obj;
3017 if (json_object_object_get_ex(v4l2_capability_obj, "capabilities", &capabilities_obj))
3018 p->capabilities = (__u32) s2flags(json_object_get_string(capabilities_obj), v4l2_cap_flag_def);
3019
3020 json_object *device_caps_obj;
3021 if (json_object_object_get_ex(v4l2_capability_obj, "device_caps", &device_caps_obj))
3022 p->device_caps = (__u32) s2flags(json_object_get_string(device_caps_obj), v4l2_cap_flag_def);
3023
3024 return p;
3025 }
retrace_v4l2_pix_format_gen(json_object * parent_obj,std::string key_name="")3026 struct v4l2_pix_format *retrace_v4l2_pix_format_gen(json_object *parent_obj, std::string key_name = "")
3027 {
3028 struct v4l2_pix_format *p = (struct v4l2_pix_format *) calloc(1, sizeof(v4l2_pix_format));
3029
3030 json_object *v4l2_pix_format_obj;
3031 if (key_name.empty())
3032 json_object_object_get_ex(parent_obj, "v4l2_pix_format", &v4l2_pix_format_obj);
3033 else
3034 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_pix_format_obj);
3035
3036 json_object *width_obj;
3037 if (json_object_object_get_ex(v4l2_pix_format_obj, "width", &width_obj))
3038 p->width = (__u32) json_object_get_int64(width_obj);
3039
3040 json_object *height_obj;
3041 if (json_object_object_get_ex(v4l2_pix_format_obj, "height", &height_obj))
3042 p->height = (__u32) json_object_get_int64(height_obj);
3043
3044 json_object *pixelformat_obj;
3045 if (json_object_object_get_ex(v4l2_pix_format_obj, "pixelformat", &pixelformat_obj))
3046 p->pixelformat = (__u32) s2val(json_object_get_string(pixelformat_obj), v4l2_pix_fmt_val_def);
3047 json_object *field_obj;
3048 if (json_object_object_get_ex(v4l2_pix_format_obj, "field", &field_obj))
3049 p->field = (__u32) s2val(json_object_get_string(field_obj), v4l2_field_val_def);
3050 json_object *bytesperline_obj;
3051 if (json_object_object_get_ex(v4l2_pix_format_obj, "bytesperline", &bytesperline_obj))
3052 p->bytesperline = (__u32) json_object_get_int64(bytesperline_obj);
3053
3054 json_object *sizeimage_obj;
3055 if (json_object_object_get_ex(v4l2_pix_format_obj, "sizeimage", &sizeimage_obj))
3056 p->sizeimage = (__u32) json_object_get_int64(sizeimage_obj);
3057
3058 json_object *colorspace_obj;
3059 if (json_object_object_get_ex(v4l2_pix_format_obj, "colorspace", &colorspace_obj))
3060 p->colorspace = (__u32) s2val(json_object_get_string(colorspace_obj), v4l2_colorspace_val_def);
3061 json_object *priv_obj;
3062 if (json_object_object_get_ex(v4l2_pix_format_obj, "priv", &priv_obj)) {
3063 if (json_object_get_string(priv_obj) == nullptr)
3064 return p;
3065 std::string priv_str = json_object_get_string(priv_obj);
3066 if (!priv_str.empty())
3067 p->priv = V4L2_PIX_FMT_PRIV_MAGIC;
3068 }
3069 json_object *flags_obj;
3070 if (json_object_object_get_ex(v4l2_pix_format_obj, "flags", &flags_obj))
3071 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_pix_fmt_flag_def);
3072
3073 //union
3074 json_object *ycbcr_enc_obj;
3075 if (json_object_object_get_ex(v4l2_pix_format_obj, "ycbcr_enc", &ycbcr_enc_obj))
3076 p->ycbcr_enc = (__u32) s2val(json_object_get_string(ycbcr_enc_obj), v4l2_ycbcr_encoding_val_def);
3077 json_object *hsv_enc_obj;
3078 if (json_object_object_get_ex(v4l2_pix_format_obj, "hsv_enc", &hsv_enc_obj))
3079 p->hsv_enc = (__u32) json_object_get_int64(hsv_enc_obj);
3080
3081 //end of union };
3082 json_object *quantization_obj;
3083 if (json_object_object_get_ex(v4l2_pix_format_obj, "quantization", &quantization_obj))
3084 p->quantization = (__u32) s2val(json_object_get_string(quantization_obj), v4l2_quantization_val_def);
3085 json_object *xfer_func_obj;
3086 if (json_object_object_get_ex(v4l2_pix_format_obj, "xfer_func", &xfer_func_obj))
3087 p->xfer_func = (__u32) s2val(json_object_get_string(xfer_func_obj), v4l2_xfer_func_val_def);
3088 return p;
3089 }
retrace_v4l2_fmtdesc_gen(json_object * parent_obj,std::string key_name="")3090 struct v4l2_fmtdesc *retrace_v4l2_fmtdesc_gen(json_object *parent_obj, std::string key_name = "")
3091 {
3092 struct v4l2_fmtdesc *p = (struct v4l2_fmtdesc *) calloc(1, sizeof(v4l2_fmtdesc));
3093
3094 json_object *v4l2_fmtdesc_obj;
3095 if (key_name.empty())
3096 json_object_object_get_ex(parent_obj, "v4l2_fmtdesc", &v4l2_fmtdesc_obj);
3097 else
3098 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_fmtdesc_obj);
3099
3100 json_object *index_obj;
3101 if (json_object_object_get_ex(v4l2_fmtdesc_obj, "index", &index_obj))
3102 p->index = (__u32) json_object_get_int64(index_obj);
3103
3104 json_object *type_obj;
3105 if (json_object_object_get_ex(v4l2_fmtdesc_obj, "type", &type_obj))
3106 p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_buf_type_val_def);
3107 json_object *flags_obj;
3108 if (json_object_object_get_ex(v4l2_fmtdesc_obj, "flags", &flags_obj))
3109 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_fmt_flag_def);
3110
3111 json_object *description_obj;
3112 if (json_object_object_get_ex(v4l2_fmtdesc_obj, "description", &description_obj))
3113 if (json_object_get_string(description_obj) != nullptr)
3114 memcpy(p->description, json_object_get_string(description_obj), 32);
3115
3116 json_object *pixelformat_obj;
3117 if (json_object_object_get_ex(v4l2_fmtdesc_obj, "pixelformat", &pixelformat_obj))
3118 p->pixelformat = (__u32) s2val(json_object_get_string(pixelformat_obj), v4l2_pix_fmt_val_def);
3119 json_object *mbus_code_obj;
3120 if (json_object_object_get_ex(v4l2_fmtdesc_obj, "mbus_code", &mbus_code_obj))
3121 p->mbus_code = (__u32) json_object_get_int64(mbus_code_obj);
3122
3123 return p;
3124 }
retrace_v4l2_frmsize_discrete_gen(json_object * parent_obj,std::string key_name="")3125 struct v4l2_frmsize_discrete *retrace_v4l2_frmsize_discrete_gen(json_object *parent_obj, std::string key_name = "")
3126 {
3127 struct v4l2_frmsize_discrete *p = (struct v4l2_frmsize_discrete *) calloc(1, sizeof(v4l2_frmsize_discrete));
3128
3129 json_object *v4l2_frmsize_discrete_obj;
3130 if (key_name.empty())
3131 json_object_object_get_ex(parent_obj, "v4l2_frmsize_discrete", &v4l2_frmsize_discrete_obj);
3132 else
3133 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_frmsize_discrete_obj);
3134
3135 json_object *width_obj;
3136 if (json_object_object_get_ex(v4l2_frmsize_discrete_obj, "width", &width_obj))
3137 p->width = (__u32) json_object_get_int64(width_obj);
3138
3139 json_object *height_obj;
3140 if (json_object_object_get_ex(v4l2_frmsize_discrete_obj, "height", &height_obj))
3141 p->height = (__u32) json_object_get_int64(height_obj);
3142
3143 return p;
3144 }
retrace_v4l2_frmsize_stepwise_gen(json_object * parent_obj,std::string key_name="")3145 struct v4l2_frmsize_stepwise *retrace_v4l2_frmsize_stepwise_gen(json_object *parent_obj, std::string key_name = "")
3146 {
3147 struct v4l2_frmsize_stepwise *p = (struct v4l2_frmsize_stepwise *) calloc(1, sizeof(v4l2_frmsize_stepwise));
3148
3149 json_object *v4l2_frmsize_stepwise_obj;
3150 if (key_name.empty())
3151 json_object_object_get_ex(parent_obj, "v4l2_frmsize_stepwise", &v4l2_frmsize_stepwise_obj);
3152 else
3153 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_frmsize_stepwise_obj);
3154
3155 json_object *min_width_obj;
3156 if (json_object_object_get_ex(v4l2_frmsize_stepwise_obj, "min_width", &min_width_obj))
3157 p->min_width = (__u32) json_object_get_int64(min_width_obj);
3158
3159 json_object *max_width_obj;
3160 if (json_object_object_get_ex(v4l2_frmsize_stepwise_obj, "max_width", &max_width_obj))
3161 p->max_width = (__u32) json_object_get_int64(max_width_obj);
3162
3163 json_object *step_width_obj;
3164 if (json_object_object_get_ex(v4l2_frmsize_stepwise_obj, "step_width", &step_width_obj))
3165 p->step_width = (__u32) json_object_get_int64(step_width_obj);
3166
3167 json_object *min_height_obj;
3168 if (json_object_object_get_ex(v4l2_frmsize_stepwise_obj, "min_height", &min_height_obj))
3169 p->min_height = (__u32) json_object_get_int64(min_height_obj);
3170
3171 json_object *max_height_obj;
3172 if (json_object_object_get_ex(v4l2_frmsize_stepwise_obj, "max_height", &max_height_obj))
3173 p->max_height = (__u32) json_object_get_int64(max_height_obj);
3174
3175 json_object *step_height_obj;
3176 if (json_object_object_get_ex(v4l2_frmsize_stepwise_obj, "step_height", &step_height_obj))
3177 p->step_height = (__u32) json_object_get_int64(step_height_obj);
3178
3179 return p;
3180 }
retrace_v4l2_frmsizeenum_gen(json_object * parent_obj,std::string key_name="")3181 struct v4l2_frmsizeenum *retrace_v4l2_frmsizeenum_gen(json_object *parent_obj, std::string key_name = "")
3182 {
3183 struct v4l2_frmsizeenum *p = (struct v4l2_frmsizeenum *) calloc(1, sizeof(v4l2_frmsizeenum));
3184
3185 json_object *v4l2_frmsizeenum_obj;
3186 if (key_name.empty())
3187 json_object_object_get_ex(parent_obj, "v4l2_frmsizeenum", &v4l2_frmsizeenum_obj);
3188 else
3189 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_frmsizeenum_obj);
3190
3191 json_object *index_obj;
3192 if (json_object_object_get_ex(v4l2_frmsizeenum_obj, "index", &index_obj))
3193 p->index = (__u32) json_object_get_int64(index_obj);
3194
3195 json_object *pixel_format_obj;
3196 if (json_object_object_get_ex(v4l2_frmsizeenum_obj, "pixel_format", &pixel_format_obj))
3197 p->pixel_format = (__u32) s2val(json_object_get_string(pixel_format_obj), v4l2_pix_fmt_val_def);
3198 json_object *type_obj;
3199 if (json_object_object_get_ex(v4l2_frmsizeenum_obj, "type", &type_obj))
3200 p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_frmsizetypes_val_def);
3201 //union
3202 //struct v4l2_frmsize_discrete discrete;
3203 //struct v4l2_frmsize_stepwise stepwise;
3204 //end of union };
3205 return p;
3206 }
retrace_v4l2_frmival_stepwise_gen(json_object * parent_obj,std::string key_name="")3207 struct v4l2_frmival_stepwise *retrace_v4l2_frmival_stepwise_gen(json_object *parent_obj, std::string key_name = "")
3208 {
3209 struct v4l2_frmival_stepwise *p = (struct v4l2_frmival_stepwise *) calloc(1, sizeof(v4l2_frmival_stepwise));
3210
3211 json_object *v4l2_frmival_stepwise_obj;
3212 if (key_name.empty())
3213 json_object_object_get_ex(parent_obj, "v4l2_frmival_stepwise", &v4l2_frmival_stepwise_obj);
3214 else
3215 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_frmival_stepwise_obj);
3216
3217 //struct v4l2_fract min;
3218 void *min_ptr = (void *) retrace_v4l2_fract_gen(v4l2_frmival_stepwise_obj, "min");
3219 p->min = *static_cast<struct v4l2_fract*>(min_ptr);
3220 free(min_ptr);
3221
3222 //struct v4l2_fract max;
3223 void *max_ptr = (void *) retrace_v4l2_fract_gen(v4l2_frmival_stepwise_obj, "max");
3224 p->max = *static_cast<struct v4l2_fract*>(max_ptr);
3225 free(max_ptr);
3226
3227 //struct v4l2_fract step;
3228 void *step_ptr = (void *) retrace_v4l2_fract_gen(v4l2_frmival_stepwise_obj, "step");
3229 p->step = *static_cast<struct v4l2_fract*>(step_ptr);
3230 free(step_ptr);
3231
3232 return p;
3233 }
retrace_v4l2_frmivalenum_gen(json_object * parent_obj,std::string key_name="")3234 struct v4l2_frmivalenum *retrace_v4l2_frmivalenum_gen(json_object *parent_obj, std::string key_name = "")
3235 {
3236 struct v4l2_frmivalenum *p = (struct v4l2_frmivalenum *) calloc(1, sizeof(v4l2_frmivalenum));
3237
3238 json_object *v4l2_frmivalenum_obj;
3239 if (key_name.empty())
3240 json_object_object_get_ex(parent_obj, "v4l2_frmivalenum", &v4l2_frmivalenum_obj);
3241 else
3242 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_frmivalenum_obj);
3243
3244 json_object *index_obj;
3245 if (json_object_object_get_ex(v4l2_frmivalenum_obj, "index", &index_obj))
3246 p->index = (__u32) json_object_get_int64(index_obj);
3247
3248 json_object *pixel_format_obj;
3249 if (json_object_object_get_ex(v4l2_frmivalenum_obj, "pixel_format", &pixel_format_obj))
3250 p->pixel_format = (__u32) s2val(json_object_get_string(pixel_format_obj), v4l2_pix_fmt_val_def);
3251 json_object *width_obj;
3252 if (json_object_object_get_ex(v4l2_frmivalenum_obj, "width", &width_obj))
3253 p->width = (__u32) json_object_get_int64(width_obj);
3254
3255 json_object *height_obj;
3256 if (json_object_object_get_ex(v4l2_frmivalenum_obj, "height", &height_obj))
3257 p->height = (__u32) json_object_get_int64(height_obj);
3258
3259 json_object *type_obj;
3260 if (json_object_object_get_ex(v4l2_frmivalenum_obj, "type", &type_obj))
3261 p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_frmivaltypes_val_def);
3262 //union
3263 //struct v4l2_fract discrete;
3264 //struct v4l2_frmival_stepwise stepwise;
3265 //end of union };
3266 return p;
3267 }
retrace_v4l2_timecode_gen(json_object * parent_obj,std::string key_name="")3268 struct v4l2_timecode *retrace_v4l2_timecode_gen(json_object *parent_obj, std::string key_name = "")
3269 {
3270 struct v4l2_timecode *p = (struct v4l2_timecode *) calloc(1, sizeof(v4l2_timecode));
3271
3272 json_object *v4l2_timecode_obj;
3273 if (key_name.empty())
3274 json_object_object_get_ex(parent_obj, "v4l2_timecode", &v4l2_timecode_obj);
3275 else
3276 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_timecode_obj);
3277
3278 json_object *type_obj;
3279 if (json_object_object_get_ex(v4l2_timecode_obj, "type", &type_obj))
3280 p->type = (__u32) s2val(json_object_get_string(type_obj), nullptr);
3281 json_object *flags_obj;
3282 if (json_object_object_get_ex(v4l2_timecode_obj, "flags", &flags_obj))
3283 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr);
3284
3285 json_object *frames_obj;
3286 if (json_object_object_get_ex(v4l2_timecode_obj, "frames", &frames_obj))
3287 p->frames = (__u8) json_object_get_int(frames_obj);
3288
3289 json_object *seconds_obj;
3290 if (json_object_object_get_ex(v4l2_timecode_obj, "seconds", &seconds_obj))
3291 p->seconds = (__u8) json_object_get_int(seconds_obj);
3292
3293 json_object *minutes_obj;
3294 if (json_object_object_get_ex(v4l2_timecode_obj, "minutes", &minutes_obj))
3295 p->minutes = (__u8) json_object_get_int(minutes_obj);
3296
3297 json_object *hours_obj;
3298 if (json_object_object_get_ex(v4l2_timecode_obj, "hours", &hours_obj))
3299 p->hours = (__u8) json_object_get_int(hours_obj);
3300
3301 json_object *userbits_obj;
3302 if (json_object_object_get_ex(v4l2_timecode_obj, "userbits", &userbits_obj))
3303 if (json_object_get_string(userbits_obj) != nullptr)
3304 memcpy(p->userbits, json_object_get_string(userbits_obj), 4);
3305
3306 return p;
3307 }
retrace_v4l2_jpegcompression_gen(json_object * parent_obj,std::string key_name="")3308 struct v4l2_jpegcompression *retrace_v4l2_jpegcompression_gen(json_object *parent_obj, std::string key_name = "")
3309 {
3310 struct v4l2_jpegcompression *p = (struct v4l2_jpegcompression *) calloc(1, sizeof(v4l2_jpegcompression));
3311
3312 json_object *v4l2_jpegcompression_obj;
3313 if (key_name.empty())
3314 json_object_object_get_ex(parent_obj, "v4l2_jpegcompression", &v4l2_jpegcompression_obj);
3315 else
3316 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_jpegcompression_obj);
3317
3318 json_object *quality_obj;
3319 if (json_object_object_get_ex(v4l2_jpegcompression_obj, "quality", &quality_obj))
3320 p->quality = (int) json_object_get_int(quality_obj);
3321
3322 json_object *APPn_obj;
3323 if (json_object_object_get_ex(v4l2_jpegcompression_obj, "APPn", &APPn_obj))
3324 p->APPn = (int) json_object_get_int(APPn_obj);
3325
3326 json_object *APP_len_obj;
3327 if (json_object_object_get_ex(v4l2_jpegcompression_obj, "APP_len", &APP_len_obj))
3328 p->APP_len = (int) json_object_get_int(APP_len_obj);
3329
3330 json_object *APP_data_obj;
3331 if (json_object_object_get_ex(v4l2_jpegcompression_obj, "APP_data", &APP_data_obj))
3332 if (json_object_get_string(APP_data_obj) != nullptr)
3333 memcpy(p->APP_data, json_object_get_string(APP_data_obj), 60);
3334
3335 json_object *COM_len_obj;
3336 if (json_object_object_get_ex(v4l2_jpegcompression_obj, "COM_len", &COM_len_obj))
3337 p->COM_len = (int) json_object_get_int(COM_len_obj);
3338
3339 json_object *COM_data_obj;
3340 if (json_object_object_get_ex(v4l2_jpegcompression_obj, "COM_data", &COM_data_obj))
3341 if (json_object_get_string(COM_data_obj) != nullptr)
3342 memcpy(p->COM_data, json_object_get_string(COM_data_obj), 60);
3343
3344 json_object *jpeg_markers_obj;
3345 if (json_object_object_get_ex(v4l2_jpegcompression_obj, "jpeg_markers", &jpeg_markers_obj))
3346 p->jpeg_markers = (__u32) json_object_get_int64(jpeg_markers_obj);
3347
3348 return p;
3349 }
retrace_v4l2_requestbuffers_gen(json_object * parent_obj,std::string key_name="")3350 struct v4l2_requestbuffers *retrace_v4l2_requestbuffers_gen(json_object *parent_obj, std::string key_name = "")
3351 {
3352 struct v4l2_requestbuffers *p = (struct v4l2_requestbuffers *) calloc(1, sizeof(v4l2_requestbuffers));
3353
3354 json_object *v4l2_requestbuffers_obj;
3355 if (key_name.empty())
3356 json_object_object_get_ex(parent_obj, "v4l2_requestbuffers", &v4l2_requestbuffers_obj);
3357 else
3358 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_requestbuffers_obj);
3359
3360 json_object *count_obj;
3361 if (json_object_object_get_ex(v4l2_requestbuffers_obj, "count", &count_obj))
3362 p->count = (__u32) json_object_get_int64(count_obj);
3363
3364 json_object *type_obj;
3365 if (json_object_object_get_ex(v4l2_requestbuffers_obj, "type", &type_obj))
3366 p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_buf_type_val_def);
3367 json_object *memory_obj;
3368 if (json_object_object_get_ex(v4l2_requestbuffers_obj, "memory", &memory_obj))
3369 p->memory = (__u32) s2val(json_object_get_string(memory_obj), v4l2_memory_val_def);
3370 json_object *capabilities_obj;
3371 if (json_object_object_get_ex(v4l2_requestbuffers_obj, "capabilities", &capabilities_obj))
3372 p->capabilities = (__u32) s2flags(json_object_get_string(capabilities_obj), v4l2_buf_cap_flag_def);
3373
3374 json_object *flags_obj;
3375 if (json_object_object_get_ex(v4l2_requestbuffers_obj, "flags", &flags_obj))
3376 p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_memory_flag_def);
3377
3378 return p;
3379 }
retrace_v4l2_plane_gen(json_object * parent_obj,std::string key_name="")3380 struct v4l2_plane *retrace_v4l2_plane_gen(json_object *parent_obj, std::string key_name = "")
3381 {
3382 struct v4l2_plane *p = (struct v4l2_plane *) calloc(1, sizeof(v4l2_plane));
3383
3384 json_object *v4l2_plane_obj;
3385 if (key_name.empty())
3386 json_object_object_get_ex(parent_obj, "v4l2_plane", &v4l2_plane_obj);
3387 else
3388 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_plane_obj);
3389
3390 json_object *bytesused_obj;
3391 if (json_object_object_get_ex(v4l2_plane_obj, "bytesused", &bytesused_obj))
3392 p->bytesused = (__u32) json_object_get_int64(bytesused_obj);
3393
3394 json_object *length_obj;
3395 if (json_object_object_get_ex(v4l2_plane_obj, "length", &length_obj))
3396 p->length = (__u32) json_object_get_int64(length_obj);
3397
3398 //union
3399 //__u32 mem_offset;
3400 //unsigned long userptr;
3401 //__s32 fd;
3402 //end of union } m;
3403 json_object *data_offset_obj;
3404 if (json_object_object_get_ex(v4l2_plane_obj, "data_offset", &data_offset_obj))
3405 p->data_offset = (__u32) json_object_get_int64(data_offset_obj);
3406
3407 return p;
3408 }
retrace_v4l2_buffer_gen(json_object * parent_obj,std::string key_name="")3409 struct v4l2_buffer *retrace_v4l2_buffer_gen(json_object *parent_obj, std::string key_name = "")
3410 {
3411 struct v4l2_buffer *p = (struct v4l2_buffer *) calloc(1, sizeof(v4l2_buffer));
3412
3413 json_object *v4l2_buffer_obj;
3414 if (key_name.empty())
3415 json_object_object_get_ex(parent_obj, "v4l2_buffer", &v4l2_buffer_obj);
3416 else
3417 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_buffer_obj);
3418
3419 json_object *index_obj;
3420 if (json_object_object_get_ex(v4l2_buffer_obj, "index", &index_obj))
3421 p->index = (__u32) json_object_get_int64(index_obj);
3422
3423 json_object *type_obj;
3424 if (json_object_object_get_ex(v4l2_buffer_obj, "type", &type_obj))
3425 p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_buf_type_val_def);
3426 json_object *bytesused_obj;
3427 if (json_object_object_get_ex(v4l2_buffer_obj, "bytesused", &bytesused_obj))
3428 p->bytesused = (__u32) json_object_get_int64(bytesused_obj);
3429
3430 json_object *flags_obj;
3431 if (json_object_object_get_ex(v4l2_buffer_obj, "flags", &flags_obj))
3432 p->flags = (__u32) s2flags_buffer(json_object_get_string(flags_obj));
3433
3434 json_object *field_obj;
3435 if (json_object_object_get_ex(v4l2_buffer_obj, "field", &field_obj))
3436 p->field = (__u32) s2val(json_object_get_string(field_obj), v4l2_field_val_def);
3437 //struct timeval timestamp;
3438 //struct v4l2_timecode timecode;
3439 void *timecode_ptr = (void *) retrace_v4l2_timecode_gen(v4l2_buffer_obj, "timecode");
3440 p->timecode = *static_cast<struct v4l2_timecode*>(timecode_ptr);
3441 free(timecode_ptr);
3442
3443 json_object *sequence_obj;
3444 if (json_object_object_get_ex(v4l2_buffer_obj, "sequence", &sequence_obj))
3445 p->sequence = (__u32) json_object_get_int64(sequence_obj);
3446
3447 json_object *memory_obj;
3448 if (json_object_object_get_ex(v4l2_buffer_obj, "memory", &memory_obj))
3449 p->memory = (__u32) s2val(json_object_get_string(memory_obj), v4l2_memory_val_def);
3450 //union
3451 //__u32 offset;
3452 //unsigned long userptr;
3453 //struct v4l2_plane *planes;
3454 //__s32 fd;
3455 //end of union } m;
3456 json_object *length_obj;
3457 if (json_object_object_get_ex(v4l2_buffer_obj, "length", &length_obj))
3458 p->length = (__u32) json_object_get_int64(length_obj);
3459
3460 //union
3461 //__s32 request_fd;
3462 //end of union };
3463 return p;
3464 }
retrace_v4l2_exportbuffer_gen(json_object * parent_obj,std::string key_name="")3465 struct v4l2_exportbuffer *retrace_v4l2_exportbuffer_gen(json_object *parent_obj, std::string key_name = "")
3466 {
3467 struct v4l2_exportbuffer *p = (struct v4l2_exportbuffer *) calloc(1, sizeof(v4l2_exportbuffer));
3468
3469 json_object *v4l2_exportbuffer_obj;
3470 if (key_name.empty())
3471 json_object_object_get_ex(parent_obj, "v4l2_exportbuffer", &v4l2_exportbuffer_obj);
3472 else
3473 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_exportbuffer_obj);
3474
3475 json_object *type_obj;
3476 if (json_object_object_get_ex(v4l2_exportbuffer_obj, "type", &type_obj))
3477 p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_buf_type_val_def);
3478 json_object *index_obj;
3479 if (json_object_object_get_ex(v4l2_exportbuffer_obj, "index", &index_obj))
3480 p->index = (__u32) json_object_get_int64(index_obj);
3481
3482 json_object *plane_obj;
3483 if (json_object_object_get_ex(v4l2_exportbuffer_obj, "plane", &plane_obj))
3484 p->plane = (__u32) json_object_get_int64(plane_obj);
3485
3486 json_object *flags_obj;
3487 if (json_object_object_get_ex(v4l2_exportbuffer_obj, "flags", &flags_obj))
3488 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr);
3489
3490 json_object *fd_obj;
3491 if (json_object_object_get_ex(v4l2_exportbuffer_obj, "fd", &fd_obj))
3492 p->fd = (__s32) json_object_get_int(fd_obj);
3493
3494 return p;
3495 }
retrace_v4l2_framebuffer_gen(json_object * parent_obj,std::string key_name="")3496 struct v4l2_framebuffer *retrace_v4l2_framebuffer_gen(json_object *parent_obj, std::string key_name = "")
3497 {
3498 struct v4l2_framebuffer *p = (struct v4l2_framebuffer *) calloc(1, sizeof(v4l2_framebuffer));
3499
3500 json_object *v4l2_framebuffer_obj;
3501 if (key_name.empty())
3502 json_object_object_get_ex(parent_obj, "v4l2_framebuffer", &v4l2_framebuffer_obj);
3503 else
3504 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_framebuffer_obj);
3505
3506 json_object *capability_obj;
3507 if (json_object_object_get_ex(v4l2_framebuffer_obj, "capability", &capability_obj))
3508 p->capability = (__u32) json_object_get_int64(capability_obj);
3509
3510 json_object *flags_obj;
3511 if (json_object_object_get_ex(v4l2_framebuffer_obj, "flags", &flags_obj))
3512 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr);
3513
3514 //void *base;
3515 //struct {
3516 //__u32 width;
3517 //__u32 height;
3518 //__u32 pixelformat;
3519 //__u32 field;
3520 //__u32 bytesperline;
3521 //__u32 sizeimage;
3522 //__u32 colorspace;
3523 //__u32 priv;
3524 //end of struct } fmt;
3525 return p;
3526 }
retrace_v4l2_clip_gen(json_object * parent_obj,std::string key_name="")3527 struct v4l2_clip *retrace_v4l2_clip_gen(json_object *parent_obj, std::string key_name = "")
3528 {
3529 struct v4l2_clip *p = (struct v4l2_clip *) calloc(1, sizeof(v4l2_clip));
3530
3531 json_object *v4l2_clip_obj;
3532 if (key_name.empty())
3533 json_object_object_get_ex(parent_obj, "v4l2_clip", &v4l2_clip_obj);
3534 else
3535 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_clip_obj);
3536
3537 //struct v4l2_rect c;
3538 void *c_ptr = (void *) retrace_v4l2_rect_gen(v4l2_clip_obj, "c");
3539 p->c = *static_cast<struct v4l2_rect*>(c_ptr);
3540 free(c_ptr);
3541
3542 //struct v4l2_clip *next;
3543 return p;
3544 }
retrace_v4l2_window_gen(json_object * parent_obj,std::string key_name="")3545 struct v4l2_window *retrace_v4l2_window_gen(json_object *parent_obj, std::string key_name = "")
3546 {
3547 struct v4l2_window *p = (struct v4l2_window *) calloc(1, sizeof(v4l2_window));
3548
3549 json_object *v4l2_window_obj;
3550 if (key_name.empty())
3551 json_object_object_get_ex(parent_obj, "v4l2_window", &v4l2_window_obj);
3552 else
3553 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_window_obj);
3554
3555 //struct v4l2_rect w;
3556 void *w_ptr = (void *) retrace_v4l2_rect_gen(v4l2_window_obj, "w");
3557 p->w = *static_cast<struct v4l2_rect*>(w_ptr);
3558 free(w_ptr);
3559
3560 json_object *field_obj;
3561 if (json_object_object_get_ex(v4l2_window_obj, "field", &field_obj))
3562 p->field = (__u32) s2val(json_object_get_string(field_obj), v4l2_field_val_def);
3563 json_object *chromakey_obj;
3564 if (json_object_object_get_ex(v4l2_window_obj, "chromakey", &chromakey_obj))
3565 p->chromakey = (__u32) json_object_get_int64(chromakey_obj);
3566
3567 //struct v4l2_clip *clips;
3568 json_object *clipcount_obj;
3569 if (json_object_object_get_ex(v4l2_window_obj, "clipcount", &clipcount_obj))
3570 p->clipcount = (__u32) json_object_get_int64(clipcount_obj);
3571
3572 //void *bitmap;
3573 json_object *global_alpha_obj;
3574 if (json_object_object_get_ex(v4l2_window_obj, "global_alpha", &global_alpha_obj))
3575 p->global_alpha = (__u8) json_object_get_int(global_alpha_obj);
3576
3577 return p;
3578 }
retrace_v4l2_captureparm_gen(json_object * parent_obj,std::string key_name="")3579 struct v4l2_captureparm *retrace_v4l2_captureparm_gen(json_object *parent_obj, std::string key_name = "")
3580 {
3581 struct v4l2_captureparm *p = (struct v4l2_captureparm *) calloc(1, sizeof(v4l2_captureparm));
3582
3583 json_object *v4l2_captureparm_obj;
3584 if (key_name.empty())
3585 json_object_object_get_ex(parent_obj, "v4l2_captureparm", &v4l2_captureparm_obj);
3586 else
3587 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_captureparm_obj);
3588
3589 json_object *capability_obj;
3590 if (json_object_object_get_ex(v4l2_captureparm_obj, "capability", &capability_obj))
3591 p->capability = (__u32) s2val(json_object_get_string(capability_obj), streamparm_val_def);
3592 json_object *capturemode_obj;
3593 if (json_object_object_get_ex(v4l2_captureparm_obj, "capturemode", &capturemode_obj))
3594 p->capturemode = (__u32) s2val(json_object_get_string(capturemode_obj), streamparm_val_def);
3595 //struct v4l2_fract timeperframe;
3596 void *timeperframe_ptr = (void *) retrace_v4l2_fract_gen(v4l2_captureparm_obj, "timeperframe");
3597 p->timeperframe = *static_cast<struct v4l2_fract*>(timeperframe_ptr);
3598 free(timeperframe_ptr);
3599
3600 json_object *extendedmode_obj;
3601 if (json_object_object_get_ex(v4l2_captureparm_obj, "extendedmode", &extendedmode_obj))
3602 p->extendedmode = (__u32) json_object_get_int64(extendedmode_obj);
3603
3604 json_object *readbuffers_obj;
3605 if (json_object_object_get_ex(v4l2_captureparm_obj, "readbuffers", &readbuffers_obj))
3606 p->readbuffers = (__u32) json_object_get_int64(readbuffers_obj);
3607
3608 return p;
3609 }
retrace_v4l2_outputparm_gen(json_object * parent_obj,std::string key_name="")3610 struct v4l2_outputparm *retrace_v4l2_outputparm_gen(json_object *parent_obj, std::string key_name = "")
3611 {
3612 struct v4l2_outputparm *p = (struct v4l2_outputparm *) calloc(1, sizeof(v4l2_outputparm));
3613
3614 json_object *v4l2_outputparm_obj;
3615 if (key_name.empty())
3616 json_object_object_get_ex(parent_obj, "v4l2_outputparm", &v4l2_outputparm_obj);
3617 else
3618 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_outputparm_obj);
3619
3620 json_object *capability_obj;
3621 if (json_object_object_get_ex(v4l2_outputparm_obj, "capability", &capability_obj))
3622 p->capability = (__u32) s2val(json_object_get_string(capability_obj), streamparm_val_def);
3623 json_object *outputmode_obj;
3624 if (json_object_object_get_ex(v4l2_outputparm_obj, "outputmode", &outputmode_obj))
3625 p->outputmode = (__u32) s2val(json_object_get_string(outputmode_obj), streamparm_val_def);
3626 //struct v4l2_fract timeperframe;
3627 void *timeperframe_ptr = (void *) retrace_v4l2_fract_gen(v4l2_outputparm_obj, "timeperframe");
3628 p->timeperframe = *static_cast<struct v4l2_fract*>(timeperframe_ptr);
3629 free(timeperframe_ptr);
3630
3631 json_object *extendedmode_obj;
3632 if (json_object_object_get_ex(v4l2_outputparm_obj, "extendedmode", &extendedmode_obj))
3633 p->extendedmode = (__u32) json_object_get_int64(extendedmode_obj);
3634
3635 json_object *writebuffers_obj;
3636 if (json_object_object_get_ex(v4l2_outputparm_obj, "writebuffers", &writebuffers_obj))
3637 p->writebuffers = (__u32) json_object_get_int64(writebuffers_obj);
3638
3639 return p;
3640 }
retrace_v4l2_cropcap_gen(json_object * parent_obj,std::string key_name="")3641 struct v4l2_cropcap *retrace_v4l2_cropcap_gen(json_object *parent_obj, std::string key_name = "")
3642 {
3643 struct v4l2_cropcap *p = (struct v4l2_cropcap *) calloc(1, sizeof(v4l2_cropcap));
3644
3645 json_object *v4l2_cropcap_obj;
3646 if (key_name.empty())
3647 json_object_object_get_ex(parent_obj, "v4l2_cropcap", &v4l2_cropcap_obj);
3648 else
3649 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_cropcap_obj);
3650
3651 json_object *type_obj;
3652 if (json_object_object_get_ex(v4l2_cropcap_obj, "type", &type_obj))
3653 p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_buf_type_val_def);
3654 //struct v4l2_rect bounds;
3655 void *bounds_ptr = (void *) retrace_v4l2_rect_gen(v4l2_cropcap_obj, "bounds");
3656 p->bounds = *static_cast<struct v4l2_rect*>(bounds_ptr);
3657 free(bounds_ptr);
3658
3659 //struct v4l2_rect defrect;
3660 void *defrect_ptr = (void *) retrace_v4l2_rect_gen(v4l2_cropcap_obj, "defrect");
3661 p->defrect = *static_cast<struct v4l2_rect*>(defrect_ptr);
3662 free(defrect_ptr);
3663
3664 //struct v4l2_fract pixelaspect;
3665 void *pixelaspect_ptr = (void *) retrace_v4l2_fract_gen(v4l2_cropcap_obj, "pixelaspect");
3666 p->pixelaspect = *static_cast<struct v4l2_fract*>(pixelaspect_ptr);
3667 free(pixelaspect_ptr);
3668
3669 return p;
3670 }
retrace_v4l2_crop_gen(json_object * parent_obj,std::string key_name="")3671 struct v4l2_crop *retrace_v4l2_crop_gen(json_object *parent_obj, std::string key_name = "")
3672 {
3673 struct v4l2_crop *p = (struct v4l2_crop *) calloc(1, sizeof(v4l2_crop));
3674
3675 json_object *v4l2_crop_obj;
3676 if (key_name.empty())
3677 json_object_object_get_ex(parent_obj, "v4l2_crop", &v4l2_crop_obj);
3678 else
3679 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_crop_obj);
3680
3681 json_object *type_obj;
3682 if (json_object_object_get_ex(v4l2_crop_obj, "type", &type_obj))
3683 p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_buf_type_val_def);
3684 //struct v4l2_rect c;
3685 void *c_ptr = (void *) retrace_v4l2_rect_gen(v4l2_crop_obj, "c");
3686 p->c = *static_cast<struct v4l2_rect*>(c_ptr);
3687 free(c_ptr);
3688
3689 return p;
3690 }
retrace_v4l2_selection_gen(json_object * parent_obj,std::string key_name="")3691 struct v4l2_selection *retrace_v4l2_selection_gen(json_object *parent_obj, std::string key_name = "")
3692 {
3693 struct v4l2_selection *p = (struct v4l2_selection *) calloc(1, sizeof(v4l2_selection));
3694
3695 json_object *v4l2_selection_obj;
3696 if (key_name.empty())
3697 json_object_object_get_ex(parent_obj, "v4l2_selection", &v4l2_selection_obj);
3698 else
3699 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_selection_obj);
3700
3701 json_object *type_obj;
3702 if (json_object_object_get_ex(v4l2_selection_obj, "type", &type_obj))
3703 p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_buf_type_val_def);
3704 json_object *target_obj;
3705 if (json_object_object_get_ex(v4l2_selection_obj, "target", &target_obj))
3706 p->target = (__u32) s2val(json_object_get_string(target_obj), selection_target_val_def);
3707 json_object *flags_obj;
3708 if (json_object_object_get_ex(v4l2_selection_obj, "flags", &flags_obj))
3709 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_sel_flag_def);
3710
3711 //struct v4l2_rect r;
3712 void *r_ptr = (void *) retrace_v4l2_rect_gen(v4l2_selection_obj, "r");
3713 p->r = *static_cast<struct v4l2_rect*>(r_ptr);
3714 free(r_ptr);
3715
3716 return p;
3717 }
retrace_v4l2_standard_gen(json_object * parent_obj,std::string key_name="")3718 struct v4l2_standard *retrace_v4l2_standard_gen(json_object *parent_obj, std::string key_name = "")
3719 {
3720 struct v4l2_standard *p = (struct v4l2_standard *) calloc(1, sizeof(v4l2_standard));
3721
3722 json_object *v4l2_standard_obj;
3723 if (key_name.empty())
3724 json_object_object_get_ex(parent_obj, "v4l2_standard", &v4l2_standard_obj);
3725 else
3726 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_standard_obj);
3727
3728 json_object *index_obj;
3729 if (json_object_object_get_ex(v4l2_standard_obj, "index", &index_obj))
3730 p->index = (__u32) json_object_get_int64(index_obj);
3731
3732 json_object *id_obj;
3733 if (json_object_object_get_ex(v4l2_standard_obj, "id", &id_obj))
3734 p->id = (v4l2_std_id) s2val(json_object_get_string(id_obj), nullptr);
3735 json_object *name_obj;
3736 if (json_object_object_get_ex(v4l2_standard_obj, "name", &name_obj))
3737 if (json_object_get_string(name_obj) != nullptr)
3738 memcpy(p->name, json_object_get_string(name_obj), 24);
3739
3740 //struct v4l2_fract frameperiod;
3741 void *frameperiod_ptr = (void *) retrace_v4l2_fract_gen(v4l2_standard_obj, "frameperiod");
3742 p->frameperiod = *static_cast<struct v4l2_fract*>(frameperiod_ptr);
3743 free(frameperiod_ptr);
3744
3745 json_object *framelines_obj;
3746 if (json_object_object_get_ex(v4l2_standard_obj, "framelines", &framelines_obj))
3747 p->framelines = (__u32) json_object_get_int64(framelines_obj);
3748
3749 return p;
3750 }
retrace_v4l2_bt_timings_gen(json_object * parent_obj,std::string key_name="")3751 struct v4l2_bt_timings *retrace_v4l2_bt_timings_gen(json_object *parent_obj, std::string key_name = "")
3752 {
3753 struct v4l2_bt_timings *p = (struct v4l2_bt_timings *) calloc(1, sizeof(v4l2_bt_timings));
3754
3755 json_object *v4l2_bt_timings_obj;
3756 if (key_name.empty())
3757 json_object_object_get_ex(parent_obj, "v4l2_bt_timings", &v4l2_bt_timings_obj);
3758 else
3759 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_bt_timings_obj);
3760
3761 json_object *width_obj;
3762 if (json_object_object_get_ex(v4l2_bt_timings_obj, "width", &width_obj))
3763 p->width = (__u32) json_object_get_int64(width_obj);
3764
3765 json_object *height_obj;
3766 if (json_object_object_get_ex(v4l2_bt_timings_obj, "height", &height_obj))
3767 p->height = (__u32) json_object_get_int64(height_obj);
3768
3769 json_object *interlaced_obj;
3770 if (json_object_object_get_ex(v4l2_bt_timings_obj, "interlaced", &interlaced_obj))
3771 p->interlaced = (__u32) json_object_get_int64(interlaced_obj);
3772
3773 json_object *polarities_obj;
3774 if (json_object_object_get_ex(v4l2_bt_timings_obj, "polarities", &polarities_obj))
3775 p->polarities = (__u32) json_object_get_int64(polarities_obj);
3776
3777 json_object *pixelclock_obj;
3778 if (json_object_object_get_ex(v4l2_bt_timings_obj, "pixelclock", &pixelclock_obj))
3779 p->pixelclock = (__u64) json_object_get_uint64(pixelclock_obj);
3780
3781 json_object *hfrontporch_obj;
3782 if (json_object_object_get_ex(v4l2_bt_timings_obj, "hfrontporch", &hfrontporch_obj))
3783 p->hfrontporch = (__u32) json_object_get_int64(hfrontporch_obj);
3784
3785 json_object *hsync_obj;
3786 if (json_object_object_get_ex(v4l2_bt_timings_obj, "hsync", &hsync_obj))
3787 p->hsync = (__u32) json_object_get_int64(hsync_obj);
3788
3789 json_object *hbackporch_obj;
3790 if (json_object_object_get_ex(v4l2_bt_timings_obj, "hbackporch", &hbackporch_obj))
3791 p->hbackporch = (__u32) json_object_get_int64(hbackporch_obj);
3792
3793 json_object *vfrontporch_obj;
3794 if (json_object_object_get_ex(v4l2_bt_timings_obj, "vfrontporch", &vfrontporch_obj))
3795 p->vfrontporch = (__u32) json_object_get_int64(vfrontporch_obj);
3796
3797 json_object *vsync_obj;
3798 if (json_object_object_get_ex(v4l2_bt_timings_obj, "vsync", &vsync_obj))
3799 p->vsync = (__u32) json_object_get_int64(vsync_obj);
3800
3801 json_object *vbackporch_obj;
3802 if (json_object_object_get_ex(v4l2_bt_timings_obj, "vbackporch", &vbackporch_obj))
3803 p->vbackporch = (__u32) json_object_get_int64(vbackporch_obj);
3804
3805 json_object *il_vfrontporch_obj;
3806 if (json_object_object_get_ex(v4l2_bt_timings_obj, "il_vfrontporch", &il_vfrontporch_obj))
3807 p->il_vfrontporch = (__u32) json_object_get_int64(il_vfrontporch_obj);
3808
3809 json_object *il_vsync_obj;
3810 if (json_object_object_get_ex(v4l2_bt_timings_obj, "il_vsync", &il_vsync_obj))
3811 p->il_vsync = (__u32) json_object_get_int64(il_vsync_obj);
3812
3813 json_object *il_vbackporch_obj;
3814 if (json_object_object_get_ex(v4l2_bt_timings_obj, "il_vbackporch", &il_vbackporch_obj))
3815 p->il_vbackporch = (__u32) json_object_get_int64(il_vbackporch_obj);
3816
3817 json_object *standards_obj;
3818 if (json_object_object_get_ex(v4l2_bt_timings_obj, "standards", &standards_obj))
3819 p->standards = (__u32) json_object_get_int64(standards_obj);
3820
3821 json_object *flags_obj;
3822 if (json_object_object_get_ex(v4l2_bt_timings_obj, "flags", &flags_obj))
3823 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr);
3824
3825 //struct v4l2_fract picture_aspect;
3826 void *picture_aspect_ptr = (void *) retrace_v4l2_fract_gen(v4l2_bt_timings_obj, "picture_aspect");
3827 p->picture_aspect = *static_cast<struct v4l2_fract*>(picture_aspect_ptr);
3828 free(picture_aspect_ptr);
3829
3830 json_object *cea861_vic_obj;
3831 if (json_object_object_get_ex(v4l2_bt_timings_obj, "cea861_vic", &cea861_vic_obj))
3832 p->cea861_vic = (__u8) json_object_get_int(cea861_vic_obj);
3833
3834 json_object *hdmi_vic_obj;
3835 if (json_object_object_get_ex(v4l2_bt_timings_obj, "hdmi_vic", &hdmi_vic_obj))
3836 p->hdmi_vic = (__u8) json_object_get_int(hdmi_vic_obj);
3837
3838 return p;
3839 }
retrace_v4l2_dv_timings_gen(json_object * parent_obj,std::string key_name="")3840 struct v4l2_dv_timings *retrace_v4l2_dv_timings_gen(json_object *parent_obj, std::string key_name = "")
3841 {
3842 struct v4l2_dv_timings *p = (struct v4l2_dv_timings *) calloc(1, sizeof(v4l2_dv_timings));
3843
3844 json_object *v4l2_dv_timings_obj;
3845 if (key_name.empty())
3846 json_object_object_get_ex(parent_obj, "v4l2_dv_timings", &v4l2_dv_timings_obj);
3847 else
3848 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_dv_timings_obj);
3849
3850 json_object *type_obj;
3851 if (json_object_object_get_ex(v4l2_dv_timings_obj, "type", &type_obj))
3852 p->type = (__u32) s2val(json_object_get_string(type_obj), nullptr);
3853 //union
3854 //struct v4l2_bt_timings bt;
3855 //end of union };
3856 return p;
3857 }
retrace_v4l2_enum_dv_timings_gen(json_object * parent_obj,std::string key_name="")3858 struct v4l2_enum_dv_timings *retrace_v4l2_enum_dv_timings_gen(json_object *parent_obj, std::string key_name = "")
3859 {
3860 struct v4l2_enum_dv_timings *p = (struct v4l2_enum_dv_timings *) calloc(1, sizeof(v4l2_enum_dv_timings));
3861
3862 json_object *v4l2_enum_dv_timings_obj;
3863 if (key_name.empty())
3864 json_object_object_get_ex(parent_obj, "v4l2_enum_dv_timings", &v4l2_enum_dv_timings_obj);
3865 else
3866 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_enum_dv_timings_obj);
3867
3868 json_object *index_obj;
3869 if (json_object_object_get_ex(v4l2_enum_dv_timings_obj, "index", &index_obj))
3870 p->index = (__u32) json_object_get_int64(index_obj);
3871
3872 json_object *pad_obj;
3873 if (json_object_object_get_ex(v4l2_enum_dv_timings_obj, "pad", &pad_obj))
3874 p->pad = (__u32) json_object_get_int64(pad_obj);
3875
3876 //struct v4l2_dv_timings timings;
3877 void *timings_ptr = (void *) retrace_v4l2_dv_timings_gen(v4l2_enum_dv_timings_obj, "timings");
3878 p->timings = *static_cast<struct v4l2_dv_timings*>(timings_ptr);
3879 free(timings_ptr);
3880
3881 return p;
3882 }
retrace_v4l2_bt_timings_cap_gen(json_object * parent_obj,std::string key_name="")3883 struct v4l2_bt_timings_cap *retrace_v4l2_bt_timings_cap_gen(json_object *parent_obj, std::string key_name = "")
3884 {
3885 struct v4l2_bt_timings_cap *p = (struct v4l2_bt_timings_cap *) calloc(1, sizeof(v4l2_bt_timings_cap));
3886
3887 json_object *v4l2_bt_timings_cap_obj;
3888 if (key_name.empty())
3889 json_object_object_get_ex(parent_obj, "v4l2_bt_timings_cap", &v4l2_bt_timings_cap_obj);
3890 else
3891 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_bt_timings_cap_obj);
3892
3893 json_object *min_width_obj;
3894 if (json_object_object_get_ex(v4l2_bt_timings_cap_obj, "min_width", &min_width_obj))
3895 p->min_width = (__u32) json_object_get_int64(min_width_obj);
3896
3897 json_object *max_width_obj;
3898 if (json_object_object_get_ex(v4l2_bt_timings_cap_obj, "max_width", &max_width_obj))
3899 p->max_width = (__u32) json_object_get_int64(max_width_obj);
3900
3901 json_object *min_height_obj;
3902 if (json_object_object_get_ex(v4l2_bt_timings_cap_obj, "min_height", &min_height_obj))
3903 p->min_height = (__u32) json_object_get_int64(min_height_obj);
3904
3905 json_object *max_height_obj;
3906 if (json_object_object_get_ex(v4l2_bt_timings_cap_obj, "max_height", &max_height_obj))
3907 p->max_height = (__u32) json_object_get_int64(max_height_obj);
3908
3909 json_object *min_pixelclock_obj;
3910 if (json_object_object_get_ex(v4l2_bt_timings_cap_obj, "min_pixelclock", &min_pixelclock_obj))
3911 p->min_pixelclock = (__u64) json_object_get_uint64(min_pixelclock_obj);
3912
3913 json_object *max_pixelclock_obj;
3914 if (json_object_object_get_ex(v4l2_bt_timings_cap_obj, "max_pixelclock", &max_pixelclock_obj))
3915 p->max_pixelclock = (__u64) json_object_get_uint64(max_pixelclock_obj);
3916
3917 json_object *standards_obj;
3918 if (json_object_object_get_ex(v4l2_bt_timings_cap_obj, "standards", &standards_obj))
3919 p->standards = (__u32) json_object_get_int64(standards_obj);
3920
3921 json_object *capabilities_obj;
3922 if (json_object_object_get_ex(v4l2_bt_timings_cap_obj, "capabilities", &capabilities_obj))
3923 p->capabilities = (__u32) json_object_get_int64(capabilities_obj);
3924
3925 return p;
3926 }
retrace_v4l2_dv_timings_cap_gen(json_object * parent_obj,std::string key_name="")3927 struct v4l2_dv_timings_cap *retrace_v4l2_dv_timings_cap_gen(json_object *parent_obj, std::string key_name = "")
3928 {
3929 struct v4l2_dv_timings_cap *p = (struct v4l2_dv_timings_cap *) calloc(1, sizeof(v4l2_dv_timings_cap));
3930
3931 json_object *v4l2_dv_timings_cap_obj;
3932 if (key_name.empty())
3933 json_object_object_get_ex(parent_obj, "v4l2_dv_timings_cap", &v4l2_dv_timings_cap_obj);
3934 else
3935 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_dv_timings_cap_obj);
3936
3937 json_object *type_obj;
3938 if (json_object_object_get_ex(v4l2_dv_timings_cap_obj, "type", &type_obj))
3939 p->type = (__u32) s2val(json_object_get_string(type_obj), nullptr);
3940 json_object *pad_obj;
3941 if (json_object_object_get_ex(v4l2_dv_timings_cap_obj, "pad", &pad_obj))
3942 p->pad = (__u32) json_object_get_int64(pad_obj);
3943
3944 //union
3945 //struct v4l2_bt_timings_cap bt;
3946 //end of union };
3947 return p;
3948 }
retrace_v4l2_input_gen(json_object * parent_obj,std::string key_name="")3949 struct v4l2_input *retrace_v4l2_input_gen(json_object *parent_obj, std::string key_name = "")
3950 {
3951 struct v4l2_input *p = (struct v4l2_input *) calloc(1, sizeof(v4l2_input));
3952
3953 json_object *v4l2_input_obj;
3954 if (key_name.empty())
3955 json_object_object_get_ex(parent_obj, "v4l2_input", &v4l2_input_obj);
3956 else
3957 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_input_obj);
3958
3959 json_object *index_obj;
3960 if (json_object_object_get_ex(v4l2_input_obj, "index", &index_obj))
3961 p->index = (__u32) json_object_get_int64(index_obj);
3962
3963 json_object *name_obj;
3964 if (json_object_object_get_ex(v4l2_input_obj, "name", &name_obj))
3965 if (json_object_get_string(name_obj) != nullptr)
3966 memcpy(p->name, json_object_get_string(name_obj), 32);
3967
3968 json_object *type_obj;
3969 if (json_object_object_get_ex(v4l2_input_obj, "type", &type_obj))
3970 p->type = (__u32) s2val(json_object_get_string(type_obj), input_type_val_def);
3971 json_object *audioset_obj;
3972 if (json_object_object_get_ex(v4l2_input_obj, "audioset", &audioset_obj))
3973 p->audioset = (__u32) json_object_get_int64(audioset_obj);
3974
3975 json_object *tuner_obj;
3976 if (json_object_object_get_ex(v4l2_input_obj, "tuner", &tuner_obj))
3977 p->tuner = (__u32) json_object_get_int64(tuner_obj);
3978
3979 json_object *std_obj;
3980 if (json_object_object_get_ex(v4l2_input_obj, "std", &std_obj))
3981 p->std = (v4l2_std_id) json_object_get_uint64(std_obj);
3982
3983 json_object *status_obj;
3984 if (json_object_object_get_ex(v4l2_input_obj, "status", &status_obj))
3985 p->status = (__u32) json_object_get_int64(status_obj);
3986
3987 json_object *capabilities_obj;
3988 if (json_object_object_get_ex(v4l2_input_obj, "capabilities", &capabilities_obj))
3989 p->capabilities = (__u32) json_object_get_int64(capabilities_obj);
3990
3991 return p;
3992 }
retrace_v4l2_output_gen(json_object * parent_obj,std::string key_name="")3993 struct v4l2_output *retrace_v4l2_output_gen(json_object *parent_obj, std::string key_name = "")
3994 {
3995 struct v4l2_output *p = (struct v4l2_output *) calloc(1, sizeof(v4l2_output));
3996
3997 json_object *v4l2_output_obj;
3998 if (key_name.empty())
3999 json_object_object_get_ex(parent_obj, "v4l2_output", &v4l2_output_obj);
4000 else
4001 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_output_obj);
4002
4003 json_object *index_obj;
4004 if (json_object_object_get_ex(v4l2_output_obj, "index", &index_obj))
4005 p->index = (__u32) json_object_get_int64(index_obj);
4006
4007 json_object *name_obj;
4008 if (json_object_object_get_ex(v4l2_output_obj, "name", &name_obj))
4009 if (json_object_get_string(name_obj) != nullptr)
4010 memcpy(p->name, json_object_get_string(name_obj), 32);
4011
4012 json_object *type_obj;
4013 if (json_object_object_get_ex(v4l2_output_obj, "type", &type_obj))
4014 p->type = (__u32) s2val(json_object_get_string(type_obj), output_type_val_def);
4015 json_object *audioset_obj;
4016 if (json_object_object_get_ex(v4l2_output_obj, "audioset", &audioset_obj))
4017 p->audioset = (__u32) json_object_get_int64(audioset_obj);
4018
4019 json_object *modulator_obj;
4020 if (json_object_object_get_ex(v4l2_output_obj, "modulator", &modulator_obj))
4021 p->modulator = (__u32) json_object_get_int64(modulator_obj);
4022
4023 json_object *std_obj;
4024 if (json_object_object_get_ex(v4l2_output_obj, "std", &std_obj))
4025 p->std = (v4l2_std_id) json_object_get_uint64(std_obj);
4026
4027 json_object *capabilities_obj;
4028 if (json_object_object_get_ex(v4l2_output_obj, "capabilities", &capabilities_obj))
4029 p->capabilities = (__u32) json_object_get_int64(capabilities_obj);
4030
4031 return p;
4032 }
retrace_v4l2_control_gen(json_object * parent_obj,std::string key_name="")4033 struct v4l2_control *retrace_v4l2_control_gen(json_object *parent_obj, std::string key_name = "")
4034 {
4035 struct v4l2_control *p = (struct v4l2_control *) calloc(1, sizeof(v4l2_control));
4036
4037 json_object *v4l2_control_obj;
4038 if (key_name.empty())
4039 json_object_object_get_ex(parent_obj, "v4l2_control", &v4l2_control_obj);
4040 else
4041 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_control_obj);
4042
4043 json_object *id_obj;
4044 if (json_object_object_get_ex(v4l2_control_obj, "id", &id_obj))
4045 p->id = (__u32) s2val(json_object_get_string(id_obj), control_val_def);
4046 json_object *value_obj;
4047 if (json_object_object_get_ex(v4l2_control_obj, "value", &value_obj))
4048 p->value = (__s32) json_object_get_int(value_obj);
4049
4050 return p;
4051 }
retrace_v4l2_ext_control_gen(json_object * parent_obj,std::string key_name="")4052 struct v4l2_ext_control *retrace_v4l2_ext_control_gen(json_object *parent_obj, std::string key_name = "")
4053 {
4054 struct v4l2_ext_control *p = (struct v4l2_ext_control *) calloc(1, sizeof(v4l2_ext_control));
4055
4056 json_object *v4l2_ext_control_obj;
4057 if (key_name.empty())
4058 json_object_object_get_ex(parent_obj, "v4l2_ext_control", &v4l2_ext_control_obj);
4059 else
4060 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_ext_control_obj);
4061
4062 json_object *id_obj;
4063 if (json_object_object_get_ex(v4l2_ext_control_obj, "id", &id_obj))
4064 p->id = (__u32) s2val(json_object_get_string(id_obj), control_val_def);
4065 json_object *size_obj;
4066 if (json_object_object_get_ex(v4l2_ext_control_obj, "size", &size_obj))
4067 p->size = (__u32) json_object_get_int64(size_obj);
4068
4069 //union
4070 //__s32 value;
4071 //__s64 value64;
4072 //char *string;
4073 //__u8 *p_u8;
4074 //__u16 *p_u16;
4075 //__u32 *p_u32;
4076 //__s32 *p_s32;
4077 //__s64 *p_s64;
4078 //struct v4l2_area *p_area;
4079 //struct v4l2_ctrl_h264_sps *p_h264_sps;
4080 //struct v4l2_ctrl_h264_pps *p_h264_pps;
4081 //struct v4l2_ctrl_h264_scaling_matrix *p_h264_scaling_matrix;
4082 //struct v4l2_ctrl_h264_pred_weights *p_h264_pred_weights;
4083 //struct v4l2_ctrl_h264_slice_params *p_h264_slice_params;
4084 //struct v4l2_ctrl_h264_decode_params *p_h264_decode_params;
4085 //struct v4l2_ctrl_fwht_params *p_fwht_params;
4086 //struct v4l2_ctrl_vp8_frame *p_vp8_frame;
4087 //struct v4l2_ctrl_mpeg2_sequence *p_mpeg2_sequence;
4088 //struct v4l2_ctrl_mpeg2_picture *p_mpeg2_picture;
4089 //struct v4l2_ctrl_mpeg2_quantisation *p_mpeg2_quantisation;
4090 //struct v4l2_ctrl_vp9_compressed_hdr *p_vp9_compressed_hdr_probs;
4091 //struct v4l2_ctrl_vp9_frame *p_vp9_frame;
4092 //struct v4l2_ctrl_hevc_sps *p_hevc_sps;
4093 //struct v4l2_ctrl_hevc_pps *p_hevc_pps;
4094 //struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params;
4095 //struct v4l2_ctrl_hevc_scaling_matrix *p_hevc_scaling_matrix;
4096 //struct v4l2_ctrl_hevc_decode_params *p_hevc_decode_params;
4097 //struct v4l2_ctrl_av1_sequence *p_av1_sequence;
4098 //struct v4l2_ctrl_av1_tile_group_entry *p_av1_tile_group_entry;
4099 //struct v4l2_ctrl_av1_frame *p_av1_frame;
4100 //struct v4l2_ctrl_av1_film_grain *p_av1_film_grain;
4101 //struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll_info;
4102 //struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering_display;
4103 //void *ptr;
4104 //end of union } __attribute__ ((packed));
4105 return p;
4106 }
retrace_v4l2_ext_controls_gen(json_object * parent_obj,std::string key_name="")4107 struct v4l2_ext_controls *retrace_v4l2_ext_controls_gen(json_object *parent_obj, std::string key_name = "")
4108 {
4109 struct v4l2_ext_controls *p = (struct v4l2_ext_controls *) calloc(1, sizeof(v4l2_ext_controls));
4110
4111 json_object *v4l2_ext_controls_obj;
4112 if (key_name.empty())
4113 json_object_object_get_ex(parent_obj, "v4l2_ext_controls", &v4l2_ext_controls_obj);
4114 else
4115 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_ext_controls_obj);
4116
4117 //union
4118 //__u32 ctrl_class;
4119 //__u32 which;
4120 //end of union };
4121 json_object *count_obj;
4122 if (json_object_object_get_ex(v4l2_ext_controls_obj, "count", &count_obj))
4123 p->count = (__u32) json_object_get_int64(count_obj);
4124
4125 json_object *error_idx_obj;
4126 if (json_object_object_get_ex(v4l2_ext_controls_obj, "error_idx", &error_idx_obj))
4127 p->error_idx = (__u32) json_object_get_int64(error_idx_obj);
4128
4129 json_object *request_fd_obj;
4130 if (json_object_object_get_ex(v4l2_ext_controls_obj, "request_fd", &request_fd_obj))
4131 p->request_fd = (__s32) json_object_get_int(request_fd_obj);
4132
4133 //struct v4l2_ext_control *controls;
4134 return p;
4135 }
retrace_v4l2_queryctrl_gen(json_object * parent_obj,std::string key_name="")4136 struct v4l2_queryctrl *retrace_v4l2_queryctrl_gen(json_object *parent_obj, std::string key_name = "")
4137 {
4138 struct v4l2_queryctrl *p = (struct v4l2_queryctrl *) calloc(1, sizeof(v4l2_queryctrl));
4139
4140 json_object *v4l2_queryctrl_obj;
4141 if (key_name.empty())
4142 json_object_object_get_ex(parent_obj, "v4l2_queryctrl", &v4l2_queryctrl_obj);
4143 else
4144 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_queryctrl_obj);
4145
4146 json_object *id_obj;
4147 if (json_object_object_get_ex(v4l2_queryctrl_obj, "id", &id_obj))
4148 p->id = (__u32) s2val(json_object_get_string(id_obj), control_val_def);
4149 json_object *type_obj;
4150 if (json_object_object_get_ex(v4l2_queryctrl_obj, "type", &type_obj))
4151 p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_ctrl_type_val_def);
4152 json_object *name_obj;
4153 if (json_object_object_get_ex(v4l2_queryctrl_obj, "name", &name_obj))
4154 if (json_object_get_string(name_obj) != nullptr)
4155 memcpy(p->name, json_object_get_string(name_obj), 32);
4156
4157 json_object *minimum_obj;
4158 if (json_object_object_get_ex(v4l2_queryctrl_obj, "minimum", &minimum_obj))
4159 p->minimum = (__s32) json_object_get_int(minimum_obj);
4160
4161 json_object *maximum_obj;
4162 if (json_object_object_get_ex(v4l2_queryctrl_obj, "maximum", &maximum_obj))
4163 p->maximum = (__s32) json_object_get_int(maximum_obj);
4164
4165 json_object *step_obj;
4166 if (json_object_object_get_ex(v4l2_queryctrl_obj, "step", &step_obj))
4167 p->step = (__s32) json_object_get_int(step_obj);
4168
4169 json_object *default_value_obj;
4170 if (json_object_object_get_ex(v4l2_queryctrl_obj, "default_value", &default_value_obj))
4171 p->default_value = (__s32) json_object_get_int(default_value_obj);
4172
4173 json_object *flags_obj;
4174 if (json_object_object_get_ex(v4l2_queryctrl_obj, "flags", &flags_obj))
4175 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_ctrl_flag_def);
4176
4177 return p;
4178 }
retrace_v4l2_query_ext_ctrl_gen(json_object * parent_obj,std::string key_name="")4179 struct v4l2_query_ext_ctrl *retrace_v4l2_query_ext_ctrl_gen(json_object *parent_obj, std::string key_name = "")
4180 {
4181 struct v4l2_query_ext_ctrl *p = (struct v4l2_query_ext_ctrl *) calloc(1, sizeof(v4l2_query_ext_ctrl));
4182
4183 json_object *v4l2_query_ext_ctrl_obj;
4184 if (key_name.empty())
4185 json_object_object_get_ex(parent_obj, "v4l2_query_ext_ctrl", &v4l2_query_ext_ctrl_obj);
4186 else
4187 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_query_ext_ctrl_obj);
4188
4189 json_object *id_obj;
4190 if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "id", &id_obj))
4191 p->id = (__u32) s2val(json_object_get_string(id_obj), control_val_def);
4192 json_object *type_obj;
4193 if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "type", &type_obj))
4194 p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_ctrl_type_val_def);
4195 json_object *name_obj;
4196 if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "name", &name_obj))
4197 if (json_object_get_string(name_obj) != nullptr)
4198 memcpy(p->name, json_object_get_string(name_obj), 32);
4199
4200 json_object *minimum_obj;
4201 if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "minimum", &minimum_obj))
4202 p->minimum = (__s64) json_object_get_int64(minimum_obj);
4203
4204 json_object *maximum_obj;
4205 if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "maximum", &maximum_obj))
4206 p->maximum = (__s64) json_object_get_int64(maximum_obj);
4207
4208 json_object *step_obj;
4209 if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "step", &step_obj))
4210 p->step = (__u64) json_object_get_uint64(step_obj);
4211
4212 json_object *default_value_obj;
4213 if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "default_value", &default_value_obj))
4214 p->default_value = (__s64) json_object_get_int64(default_value_obj);
4215
4216 json_object *flags_obj;
4217 if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "flags", &flags_obj))
4218 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_ctrl_flag_def);
4219
4220 json_object *elem_size_obj;
4221 if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "elem_size", &elem_size_obj))
4222 p->elem_size = (__u32) json_object_get_int64(elem_size_obj);
4223
4224 json_object *elems_obj;
4225 if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "elems", &elems_obj))
4226 p->elems = (__u32) json_object_get_int64(elems_obj);
4227
4228 json_object *nr_of_dims_obj;
4229 if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "nr_of_dims", &nr_of_dims_obj))
4230 p->nr_of_dims = (__u32) json_object_get_int64(nr_of_dims_obj);
4231
4232 /* __u32 dims[V4L2_CTRL_MAX_DIMS]; */
4233 json_object *dims_obj;
4234 if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "dims", &dims_obj)) {
4235 for (int i = 0; i < (std::min((int) p->nr_of_dims, V4L2_CTRL_MAX_DIMS)); i++) {
4236 if (json_object_array_get_idx(dims_obj, i))
4237 p->dims[i] = (__u32) json_object_get_int64(json_object_array_get_idx(dims_obj, i));
4238 }
4239 }
4240 return p;
4241 }
retrace_v4l2_querymenu_gen(json_object * parent_obj,std::string key_name="")4242 struct v4l2_querymenu *retrace_v4l2_querymenu_gen(json_object *parent_obj, std::string key_name = "")
4243 {
4244 struct v4l2_querymenu *p = (struct v4l2_querymenu *) calloc(1, sizeof(v4l2_querymenu));
4245
4246 json_object *v4l2_querymenu_obj;
4247 if (key_name.empty())
4248 json_object_object_get_ex(parent_obj, "v4l2_querymenu", &v4l2_querymenu_obj);
4249 else
4250 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_querymenu_obj);
4251
4252 json_object *id_obj;
4253 if (json_object_object_get_ex(v4l2_querymenu_obj, "id", &id_obj))
4254 p->id = (__u32) s2val(json_object_get_string(id_obj), control_val_def);
4255 json_object *index_obj;
4256 if (json_object_object_get_ex(v4l2_querymenu_obj, "index", &index_obj))
4257 p->index = (__u32) json_object_get_int64(index_obj);
4258
4259 //union
4260 //__u8 name[32];
4261 //__s64 value;
4262 //end of union };
4263 return p;
4264 }
retrace_v4l2_tuner_gen(json_object * parent_obj,std::string key_name="")4265 struct v4l2_tuner *retrace_v4l2_tuner_gen(json_object *parent_obj, std::string key_name = "")
4266 {
4267 struct v4l2_tuner *p = (struct v4l2_tuner *) calloc(1, sizeof(v4l2_tuner));
4268
4269 json_object *v4l2_tuner_obj;
4270 if (key_name.empty())
4271 json_object_object_get_ex(parent_obj, "v4l2_tuner", &v4l2_tuner_obj);
4272 else
4273 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_tuner_obj);
4274
4275 json_object *index_obj;
4276 if (json_object_object_get_ex(v4l2_tuner_obj, "index", &index_obj))
4277 p->index = (__u32) json_object_get_int64(index_obj);
4278
4279 json_object *name_obj;
4280 if (json_object_object_get_ex(v4l2_tuner_obj, "name", &name_obj))
4281 if (json_object_get_string(name_obj) != nullptr)
4282 memcpy(p->name, json_object_get_string(name_obj), 32);
4283
4284 json_object *type_obj;
4285 if (json_object_object_get_ex(v4l2_tuner_obj, "type", &type_obj))
4286 p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_tuner_type_val_def);
4287 json_object *capability_obj;
4288 if (json_object_object_get_ex(v4l2_tuner_obj, "capability", &capability_obj))
4289 p->capability = (__u32) s2flags(json_object_get_string(capability_obj), tuner_cap_flag_def);
4290
4291 json_object *rangelow_obj;
4292 if (json_object_object_get_ex(v4l2_tuner_obj, "rangelow", &rangelow_obj))
4293 p->rangelow = (__u32) json_object_get_int64(rangelow_obj);
4294
4295 json_object *rangehigh_obj;
4296 if (json_object_object_get_ex(v4l2_tuner_obj, "rangehigh", &rangehigh_obj))
4297 p->rangehigh = (__u32) json_object_get_int64(rangehigh_obj);
4298
4299 json_object *rxsubchans_obj;
4300 if (json_object_object_get_ex(v4l2_tuner_obj, "rxsubchans", &rxsubchans_obj))
4301 p->rxsubchans = (__u32) s2flags(json_object_get_string(rxsubchans_obj), tuner_rxsub_flag_def);
4302
4303 json_object *audmode_obj;
4304 if (json_object_object_get_ex(v4l2_tuner_obj, "audmode", &audmode_obj))
4305 p->audmode = (__u32) s2val(json_object_get_string(audmode_obj), tuner_audmode_val_def);
4306 json_object *signal_obj;
4307 if (json_object_object_get_ex(v4l2_tuner_obj, "signal", &signal_obj))
4308 p->signal = (__s32) json_object_get_int(signal_obj);
4309
4310 json_object *afc_obj;
4311 if (json_object_object_get_ex(v4l2_tuner_obj, "afc", &afc_obj))
4312 p->afc = (__s32) json_object_get_int(afc_obj);
4313
4314 return p;
4315 }
retrace_v4l2_modulator_gen(json_object * parent_obj,std::string key_name="")4316 struct v4l2_modulator *retrace_v4l2_modulator_gen(json_object *parent_obj, std::string key_name = "")
4317 {
4318 struct v4l2_modulator *p = (struct v4l2_modulator *) calloc(1, sizeof(v4l2_modulator));
4319
4320 json_object *v4l2_modulator_obj;
4321 if (key_name.empty())
4322 json_object_object_get_ex(parent_obj, "v4l2_modulator", &v4l2_modulator_obj);
4323 else
4324 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_modulator_obj);
4325
4326 json_object *index_obj;
4327 if (json_object_object_get_ex(v4l2_modulator_obj, "index", &index_obj))
4328 p->index = (__u32) json_object_get_int64(index_obj);
4329
4330 json_object *name_obj;
4331 if (json_object_object_get_ex(v4l2_modulator_obj, "name", &name_obj))
4332 if (json_object_get_string(name_obj) != nullptr)
4333 memcpy(p->name, json_object_get_string(name_obj), 32);
4334
4335 json_object *capability_obj;
4336 if (json_object_object_get_ex(v4l2_modulator_obj, "capability", &capability_obj))
4337 p->capability = (__u32) json_object_get_int64(capability_obj);
4338
4339 json_object *rangelow_obj;
4340 if (json_object_object_get_ex(v4l2_modulator_obj, "rangelow", &rangelow_obj))
4341 p->rangelow = (__u32) json_object_get_int64(rangelow_obj);
4342
4343 json_object *rangehigh_obj;
4344 if (json_object_object_get_ex(v4l2_modulator_obj, "rangehigh", &rangehigh_obj))
4345 p->rangehigh = (__u32) json_object_get_int64(rangehigh_obj);
4346
4347 json_object *txsubchans_obj;
4348 if (json_object_object_get_ex(v4l2_modulator_obj, "txsubchans", &txsubchans_obj))
4349 p->txsubchans = (__u32) json_object_get_int64(txsubchans_obj);
4350
4351 json_object *type_obj;
4352 if (json_object_object_get_ex(v4l2_modulator_obj, "type", &type_obj))
4353 p->type = (__u32) s2val(json_object_get_string(type_obj), nullptr);
4354 return p;
4355 }
retrace_v4l2_frequency_gen(json_object * parent_obj,std::string key_name="")4356 struct v4l2_frequency *retrace_v4l2_frequency_gen(json_object *parent_obj, std::string key_name = "")
4357 {
4358 struct v4l2_frequency *p = (struct v4l2_frequency *) calloc(1, sizeof(v4l2_frequency));
4359
4360 json_object *v4l2_frequency_obj;
4361 if (key_name.empty())
4362 json_object_object_get_ex(parent_obj, "v4l2_frequency", &v4l2_frequency_obj);
4363 else
4364 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_frequency_obj);
4365
4366 json_object *tuner_obj;
4367 if (json_object_object_get_ex(v4l2_frequency_obj, "tuner", &tuner_obj))
4368 p->tuner = (__u32) json_object_get_int64(tuner_obj);
4369
4370 json_object *type_obj;
4371 if (json_object_object_get_ex(v4l2_frequency_obj, "type", &type_obj))
4372 p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_tuner_type_val_def);
4373 json_object *frequency_obj;
4374 if (json_object_object_get_ex(v4l2_frequency_obj, "frequency", &frequency_obj))
4375 p->frequency = (__u32) json_object_get_int64(frequency_obj);
4376
4377 return p;
4378 }
retrace_v4l2_frequency_band_gen(json_object * parent_obj,std::string key_name="")4379 struct v4l2_frequency_band *retrace_v4l2_frequency_band_gen(json_object *parent_obj, std::string key_name = "")
4380 {
4381 struct v4l2_frequency_band *p = (struct v4l2_frequency_band *) calloc(1, sizeof(v4l2_frequency_band));
4382
4383 json_object *v4l2_frequency_band_obj;
4384 if (key_name.empty())
4385 json_object_object_get_ex(parent_obj, "v4l2_frequency_band", &v4l2_frequency_band_obj);
4386 else
4387 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_frequency_band_obj);
4388
4389 json_object *tuner_obj;
4390 if (json_object_object_get_ex(v4l2_frequency_band_obj, "tuner", &tuner_obj))
4391 p->tuner = (__u32) json_object_get_int64(tuner_obj);
4392
4393 json_object *type_obj;
4394 if (json_object_object_get_ex(v4l2_frequency_band_obj, "type", &type_obj))
4395 p->type = (__u32) s2val(json_object_get_string(type_obj), nullptr);
4396 json_object *index_obj;
4397 if (json_object_object_get_ex(v4l2_frequency_band_obj, "index", &index_obj))
4398 p->index = (__u32) json_object_get_int64(index_obj);
4399
4400 json_object *capability_obj;
4401 if (json_object_object_get_ex(v4l2_frequency_band_obj, "capability", &capability_obj))
4402 p->capability = (__u32) json_object_get_int64(capability_obj);
4403
4404 json_object *rangelow_obj;
4405 if (json_object_object_get_ex(v4l2_frequency_band_obj, "rangelow", &rangelow_obj))
4406 p->rangelow = (__u32) json_object_get_int64(rangelow_obj);
4407
4408 json_object *rangehigh_obj;
4409 if (json_object_object_get_ex(v4l2_frequency_band_obj, "rangehigh", &rangehigh_obj))
4410 p->rangehigh = (__u32) json_object_get_int64(rangehigh_obj);
4411
4412 json_object *modulation_obj;
4413 if (json_object_object_get_ex(v4l2_frequency_band_obj, "modulation", &modulation_obj))
4414 p->modulation = (__u32) json_object_get_int64(modulation_obj);
4415
4416 return p;
4417 }
retrace_v4l2_hw_freq_seek_gen(json_object * parent_obj,std::string key_name="")4418 struct v4l2_hw_freq_seek *retrace_v4l2_hw_freq_seek_gen(json_object *parent_obj, std::string key_name = "")
4419 {
4420 struct v4l2_hw_freq_seek *p = (struct v4l2_hw_freq_seek *) calloc(1, sizeof(v4l2_hw_freq_seek));
4421
4422 json_object *v4l2_hw_freq_seek_obj;
4423 if (key_name.empty())
4424 json_object_object_get_ex(parent_obj, "v4l2_hw_freq_seek", &v4l2_hw_freq_seek_obj);
4425 else
4426 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_hw_freq_seek_obj);
4427
4428 json_object *tuner_obj;
4429 if (json_object_object_get_ex(v4l2_hw_freq_seek_obj, "tuner", &tuner_obj))
4430 p->tuner = (__u32) json_object_get_int64(tuner_obj);
4431
4432 json_object *type_obj;
4433 if (json_object_object_get_ex(v4l2_hw_freq_seek_obj, "type", &type_obj))
4434 p->type = (__u32) s2val(json_object_get_string(type_obj), nullptr);
4435 json_object *seek_upward_obj;
4436 if (json_object_object_get_ex(v4l2_hw_freq_seek_obj, "seek_upward", &seek_upward_obj))
4437 p->seek_upward = (__u32) json_object_get_int64(seek_upward_obj);
4438
4439 json_object *wrap_around_obj;
4440 if (json_object_object_get_ex(v4l2_hw_freq_seek_obj, "wrap_around", &wrap_around_obj))
4441 p->wrap_around = (__u32) json_object_get_int64(wrap_around_obj);
4442
4443 json_object *spacing_obj;
4444 if (json_object_object_get_ex(v4l2_hw_freq_seek_obj, "spacing", &spacing_obj))
4445 p->spacing = (__u32) json_object_get_int64(spacing_obj);
4446
4447 json_object *rangelow_obj;
4448 if (json_object_object_get_ex(v4l2_hw_freq_seek_obj, "rangelow", &rangelow_obj))
4449 p->rangelow = (__u32) json_object_get_int64(rangelow_obj);
4450
4451 json_object *rangehigh_obj;
4452 if (json_object_object_get_ex(v4l2_hw_freq_seek_obj, "rangehigh", &rangehigh_obj))
4453 p->rangehigh = (__u32) json_object_get_int64(rangehigh_obj);
4454
4455 return p;
4456 }
retrace_v4l2_rds_data_gen(json_object * parent_obj,std::string key_name="")4457 struct v4l2_rds_data *retrace_v4l2_rds_data_gen(json_object *parent_obj, std::string key_name = "")
4458 {
4459 struct v4l2_rds_data *p = (struct v4l2_rds_data *) calloc(1, sizeof(v4l2_rds_data));
4460
4461 json_object *v4l2_rds_data_obj;
4462 if (key_name.empty())
4463 json_object_object_get_ex(parent_obj, "v4l2_rds_data", &v4l2_rds_data_obj);
4464 else
4465 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_rds_data_obj);
4466
4467 json_object *lsb_obj;
4468 if (json_object_object_get_ex(v4l2_rds_data_obj, "lsb", &lsb_obj))
4469 p->lsb = (__u8) json_object_get_int(lsb_obj);
4470
4471 json_object *msb_obj;
4472 if (json_object_object_get_ex(v4l2_rds_data_obj, "msb", &msb_obj))
4473 p->msb = (__u8) json_object_get_int(msb_obj);
4474
4475 json_object *block_obj;
4476 if (json_object_object_get_ex(v4l2_rds_data_obj, "block", &block_obj))
4477 p->block = (__u8) json_object_get_int(block_obj);
4478
4479 return p;
4480 }
retrace_v4l2_audio_gen(json_object * parent_obj,std::string key_name="")4481 struct v4l2_audio *retrace_v4l2_audio_gen(json_object *parent_obj, std::string key_name = "")
4482 {
4483 struct v4l2_audio *p = (struct v4l2_audio *) calloc(1, sizeof(v4l2_audio));
4484
4485 json_object *v4l2_audio_obj;
4486 if (key_name.empty())
4487 json_object_object_get_ex(parent_obj, "v4l2_audio", &v4l2_audio_obj);
4488 else
4489 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_audio_obj);
4490
4491 json_object *index_obj;
4492 if (json_object_object_get_ex(v4l2_audio_obj, "index", &index_obj))
4493 p->index = (__u32) json_object_get_int64(index_obj);
4494
4495 json_object *name_obj;
4496 if (json_object_object_get_ex(v4l2_audio_obj, "name", &name_obj))
4497 if (json_object_get_string(name_obj) != nullptr)
4498 memcpy(p->name, json_object_get_string(name_obj), 32);
4499
4500 json_object *capability_obj;
4501 if (json_object_object_get_ex(v4l2_audio_obj, "capability", &capability_obj))
4502 p->capability = (__u32) json_object_get_int64(capability_obj);
4503
4504 json_object *mode_obj;
4505 if (json_object_object_get_ex(v4l2_audio_obj, "mode", &mode_obj))
4506 p->mode = (__u32) json_object_get_int64(mode_obj);
4507
4508 return p;
4509 }
retrace_v4l2_audioout_gen(json_object * parent_obj,std::string key_name="")4510 struct v4l2_audioout *retrace_v4l2_audioout_gen(json_object *parent_obj, std::string key_name = "")
4511 {
4512 struct v4l2_audioout *p = (struct v4l2_audioout *) calloc(1, sizeof(v4l2_audioout));
4513
4514 json_object *v4l2_audioout_obj;
4515 if (key_name.empty())
4516 json_object_object_get_ex(parent_obj, "v4l2_audioout", &v4l2_audioout_obj);
4517 else
4518 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_audioout_obj);
4519
4520 json_object *index_obj;
4521 if (json_object_object_get_ex(v4l2_audioout_obj, "index", &index_obj))
4522 p->index = (__u32) json_object_get_int64(index_obj);
4523
4524 json_object *name_obj;
4525 if (json_object_object_get_ex(v4l2_audioout_obj, "name", &name_obj))
4526 if (json_object_get_string(name_obj) != nullptr)
4527 memcpy(p->name, json_object_get_string(name_obj), 32);
4528
4529 json_object *capability_obj;
4530 if (json_object_object_get_ex(v4l2_audioout_obj, "capability", &capability_obj))
4531 p->capability = (__u32) json_object_get_int64(capability_obj);
4532
4533 json_object *mode_obj;
4534 if (json_object_object_get_ex(v4l2_audioout_obj, "mode", &mode_obj))
4535 p->mode = (__u32) json_object_get_int64(mode_obj);
4536
4537 return p;
4538 }
retrace_v4l2_enc_idx_entry_gen(json_object * parent_obj,std::string key_name="")4539 struct v4l2_enc_idx_entry *retrace_v4l2_enc_idx_entry_gen(json_object *parent_obj, std::string key_name = "")
4540 {
4541 struct v4l2_enc_idx_entry *p = (struct v4l2_enc_idx_entry *) calloc(1, sizeof(v4l2_enc_idx_entry));
4542
4543 json_object *v4l2_enc_idx_entry_obj;
4544 if (key_name.empty())
4545 json_object_object_get_ex(parent_obj, "v4l2_enc_idx_entry", &v4l2_enc_idx_entry_obj);
4546 else
4547 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_enc_idx_entry_obj);
4548
4549 json_object *offset_obj;
4550 if (json_object_object_get_ex(v4l2_enc_idx_entry_obj, "offset", &offset_obj))
4551 p->offset = (__u64) json_object_get_uint64(offset_obj);
4552
4553 json_object *pts_obj;
4554 if (json_object_object_get_ex(v4l2_enc_idx_entry_obj, "pts", &pts_obj))
4555 p->pts = (__u64) json_object_get_uint64(pts_obj);
4556
4557 json_object *length_obj;
4558 if (json_object_object_get_ex(v4l2_enc_idx_entry_obj, "length", &length_obj))
4559 p->length = (__u32) json_object_get_int64(length_obj);
4560
4561 json_object *flags_obj;
4562 if (json_object_object_get_ex(v4l2_enc_idx_entry_obj, "flags", &flags_obj))
4563 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr);
4564
4565 return p;
4566 }
retrace_v4l2_enc_idx_gen(json_object * parent_obj,std::string key_name="")4567 struct v4l2_enc_idx *retrace_v4l2_enc_idx_gen(json_object *parent_obj, std::string key_name = "")
4568 {
4569 struct v4l2_enc_idx *p = (struct v4l2_enc_idx *) calloc(1, sizeof(v4l2_enc_idx));
4570
4571 json_object *v4l2_enc_idx_obj;
4572 if (key_name.empty())
4573 json_object_object_get_ex(parent_obj, "v4l2_enc_idx", &v4l2_enc_idx_obj);
4574 else
4575 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_enc_idx_obj);
4576
4577 json_object *entries_obj;
4578 if (json_object_object_get_ex(v4l2_enc_idx_obj, "entries", &entries_obj))
4579 p->entries = (__u32) json_object_get_int64(entries_obj);
4580
4581 json_object *entries_cap_obj;
4582 if (json_object_object_get_ex(v4l2_enc_idx_obj, "entries_cap", &entries_cap_obj))
4583 p->entries_cap = (__u32) json_object_get_int64(entries_cap_obj);
4584
4585 //struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES];
4586 return p;
4587 }
retrace_v4l2_encoder_cmd_gen(json_object * parent_obj,std::string key_name="")4588 struct v4l2_encoder_cmd *retrace_v4l2_encoder_cmd_gen(json_object *parent_obj, std::string key_name = "")
4589 {
4590 struct v4l2_encoder_cmd *p = (struct v4l2_encoder_cmd *) calloc(1, sizeof(v4l2_encoder_cmd));
4591
4592 json_object *v4l2_encoder_cmd_obj;
4593 if (key_name.empty())
4594 json_object_object_get_ex(parent_obj, "v4l2_encoder_cmd", &v4l2_encoder_cmd_obj);
4595 else
4596 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_encoder_cmd_obj);
4597
4598 json_object *cmd_obj;
4599 if (json_object_object_get_ex(v4l2_encoder_cmd_obj, "cmd", &cmd_obj))
4600 p->cmd = (__u32) s2val(json_object_get_string(cmd_obj), encoder_cmd_val_def);
4601 json_object *flags_obj;
4602 if (json_object_object_get_ex(v4l2_encoder_cmd_obj, "flags", &flags_obj))
4603 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr);
4604
4605 //union
4606 //struct {
4607 //__u32 data[8];
4608 //end of union } raw;
4609 return p;
4610 }
retrace_v4l2_decoder_cmd_gen(json_object * parent_obj,std::string key_name="")4611 struct v4l2_decoder_cmd *retrace_v4l2_decoder_cmd_gen(json_object *parent_obj, std::string key_name = "")
4612 {
4613 struct v4l2_decoder_cmd *p = (struct v4l2_decoder_cmd *) calloc(1, sizeof(v4l2_decoder_cmd));
4614
4615 json_object *v4l2_decoder_cmd_obj;
4616 if (key_name.empty())
4617 json_object_object_get_ex(parent_obj, "v4l2_decoder_cmd", &v4l2_decoder_cmd_obj);
4618 else
4619 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_decoder_cmd_obj);
4620
4621 json_object *cmd_obj;
4622 if (json_object_object_get_ex(v4l2_decoder_cmd_obj, "cmd", &cmd_obj))
4623 p->cmd = (__u32) s2val(json_object_get_string(cmd_obj), decoder_cmd_val_def);
4624 json_object *flags_obj;
4625 if (json_object_object_get_ex(v4l2_decoder_cmd_obj, "flags", &flags_obj))
4626 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr);
4627
4628 //union
4629 //struct {
4630 //__u64 pts;
4631 //end of union } stop;
4632 //struct {
4633 //__s32 speed;
4634 //__u32 format;
4635 //end of struct } start;
4636 //struct {
4637 //__u32 data[16];
4638 //end of struct } raw;
4639 return p;
4640 }
retrace_v4l2_vbi_format_gen(json_object * parent_obj,std::string key_name="")4641 struct v4l2_vbi_format *retrace_v4l2_vbi_format_gen(json_object *parent_obj, std::string key_name = "")
4642 {
4643 struct v4l2_vbi_format *p = (struct v4l2_vbi_format *) calloc(1, sizeof(v4l2_vbi_format));
4644
4645 json_object *v4l2_vbi_format_obj;
4646 if (key_name.empty())
4647 json_object_object_get_ex(parent_obj, "v4l2_vbi_format", &v4l2_vbi_format_obj);
4648 else
4649 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_vbi_format_obj);
4650
4651 json_object *sampling_rate_obj;
4652 if (json_object_object_get_ex(v4l2_vbi_format_obj, "sampling_rate", &sampling_rate_obj))
4653 p->sampling_rate = (__u32) json_object_get_int64(sampling_rate_obj);
4654
4655 json_object *offset_obj;
4656 if (json_object_object_get_ex(v4l2_vbi_format_obj, "offset", &offset_obj))
4657 p->offset = (__u32) json_object_get_int64(offset_obj);
4658
4659 json_object *samples_per_line_obj;
4660 if (json_object_object_get_ex(v4l2_vbi_format_obj, "samples_per_line", &samples_per_line_obj))
4661 p->samples_per_line = (__u32) json_object_get_int64(samples_per_line_obj);
4662
4663 json_object *sample_format_obj;
4664 if (json_object_object_get_ex(v4l2_vbi_format_obj, "sample_format", &sample_format_obj))
4665 p->sample_format = (__u32) json_object_get_int64(sample_format_obj);
4666
4667 json_object *start_obj;
4668 if (json_object_object_get_ex(v4l2_vbi_format_obj, "start", &start_obj))
4669 if (json_object_get_string(start_obj) != nullptr)
4670 memcpy(p->start, json_object_get_string(start_obj), 2);
4671
4672 json_object *count_obj;
4673 if (json_object_object_get_ex(v4l2_vbi_format_obj, "count", &count_obj))
4674 if (json_object_get_string(count_obj) != nullptr)
4675 memcpy(p->count, json_object_get_string(count_obj), 2);
4676
4677 json_object *flags_obj;
4678 if (json_object_object_get_ex(v4l2_vbi_format_obj, "flags", &flags_obj))
4679 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr);
4680
4681 return p;
4682 }
retrace_v4l2_sliced_vbi_format_gen(json_object * parent_obj,std::string key_name="")4683 struct v4l2_sliced_vbi_format *retrace_v4l2_sliced_vbi_format_gen(json_object *parent_obj, std::string key_name = "")
4684 {
4685 struct v4l2_sliced_vbi_format *p = (struct v4l2_sliced_vbi_format *) calloc(1, sizeof(v4l2_sliced_vbi_format));
4686
4687 json_object *v4l2_sliced_vbi_format_obj;
4688 if (key_name.empty())
4689 json_object_object_get_ex(parent_obj, "v4l2_sliced_vbi_format", &v4l2_sliced_vbi_format_obj);
4690 else
4691 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_sliced_vbi_format_obj);
4692
4693 json_object *service_set_obj;
4694 if (json_object_object_get_ex(v4l2_sliced_vbi_format_obj, "service_set", &service_set_obj))
4695 p->service_set = (__u16) json_object_get_int(service_set_obj);
4696
4697 //__u16 service_lines[2][24];
4698 json_object *io_size_obj;
4699 if (json_object_object_get_ex(v4l2_sliced_vbi_format_obj, "io_size", &io_size_obj))
4700 p->io_size = (__u32) json_object_get_int64(io_size_obj);
4701
4702 return p;
4703 }
retrace_v4l2_sliced_vbi_cap_gen(json_object * parent_obj,std::string key_name="")4704 struct v4l2_sliced_vbi_cap *retrace_v4l2_sliced_vbi_cap_gen(json_object *parent_obj, std::string key_name = "")
4705 {
4706 struct v4l2_sliced_vbi_cap *p = (struct v4l2_sliced_vbi_cap *) calloc(1, sizeof(v4l2_sliced_vbi_cap));
4707
4708 json_object *v4l2_sliced_vbi_cap_obj;
4709 if (key_name.empty())
4710 json_object_object_get_ex(parent_obj, "v4l2_sliced_vbi_cap", &v4l2_sliced_vbi_cap_obj);
4711 else
4712 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_sliced_vbi_cap_obj);
4713
4714 json_object *service_set_obj;
4715 if (json_object_object_get_ex(v4l2_sliced_vbi_cap_obj, "service_set", &service_set_obj))
4716 p->service_set = (__u16) json_object_get_int(service_set_obj);
4717
4718 //__u16 service_lines[2][24];
4719 json_object *type_obj;
4720 if (json_object_object_get_ex(v4l2_sliced_vbi_cap_obj, "type", &type_obj))
4721 p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_buf_type_val_def);
4722 return p;
4723 }
retrace_v4l2_sliced_vbi_data_gen(json_object * parent_obj,std::string key_name="")4724 struct v4l2_sliced_vbi_data *retrace_v4l2_sliced_vbi_data_gen(json_object *parent_obj, std::string key_name = "")
4725 {
4726 struct v4l2_sliced_vbi_data *p = (struct v4l2_sliced_vbi_data *) calloc(1, sizeof(v4l2_sliced_vbi_data));
4727
4728 json_object *v4l2_sliced_vbi_data_obj;
4729 if (key_name.empty())
4730 json_object_object_get_ex(parent_obj, "v4l2_sliced_vbi_data", &v4l2_sliced_vbi_data_obj);
4731 else
4732 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_sliced_vbi_data_obj);
4733
4734 json_object *id_obj;
4735 if (json_object_object_get_ex(v4l2_sliced_vbi_data_obj, "id", &id_obj))
4736 p->id = (__u32) s2val(json_object_get_string(id_obj), nullptr);
4737 json_object *field_obj;
4738 if (json_object_object_get_ex(v4l2_sliced_vbi_data_obj, "field", &field_obj))
4739 p->field = (__u32) s2val(json_object_get_string(field_obj), nullptr);
4740 json_object *line_obj;
4741 if (json_object_object_get_ex(v4l2_sliced_vbi_data_obj, "line", &line_obj))
4742 p->line = (__u32) json_object_get_int64(line_obj);
4743
4744 json_object *data_obj;
4745 if (json_object_object_get_ex(v4l2_sliced_vbi_data_obj, "data", &data_obj))
4746 if (json_object_get_string(data_obj) != nullptr)
4747 memcpy(p->data, json_object_get_string(data_obj), 48);
4748
4749 return p;
4750 }
retrace_v4l2_mpeg_vbi_itv0_line_gen(json_object * parent_obj,std::string key_name="")4751 struct v4l2_mpeg_vbi_itv0_line *retrace_v4l2_mpeg_vbi_itv0_line_gen(json_object *parent_obj, std::string key_name = "")
4752 {
4753 struct v4l2_mpeg_vbi_itv0_line *p = (struct v4l2_mpeg_vbi_itv0_line *) calloc(1, sizeof(v4l2_mpeg_vbi_itv0_line));
4754
4755 json_object *v4l2_mpeg_vbi_itv0_line_obj;
4756 if (key_name.empty())
4757 json_object_object_get_ex(parent_obj, "v4l2_mpeg_vbi_itv0_line", &v4l2_mpeg_vbi_itv0_line_obj);
4758 else
4759 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_mpeg_vbi_itv0_line_obj);
4760
4761 json_object *id_obj;
4762 if (json_object_object_get_ex(v4l2_mpeg_vbi_itv0_line_obj, "id", &id_obj))
4763 p->id = (__u8) s2val(json_object_get_string(id_obj), nullptr);
4764 json_object *data_obj;
4765 if (json_object_object_get_ex(v4l2_mpeg_vbi_itv0_line_obj, "data", &data_obj))
4766 if (json_object_get_string(data_obj) != nullptr)
4767 memcpy(p->data, json_object_get_string(data_obj), 42);
4768
4769 return p;
4770 }
retrace_v4l2_mpeg_vbi_itv0_gen(json_object * parent_obj,std::string key_name="")4771 struct v4l2_mpeg_vbi_itv0 *retrace_v4l2_mpeg_vbi_itv0_gen(json_object *parent_obj, std::string key_name = "")
4772 {
4773 struct v4l2_mpeg_vbi_itv0 *p = (struct v4l2_mpeg_vbi_itv0 *) calloc(1, sizeof(v4l2_mpeg_vbi_itv0));
4774
4775 json_object *v4l2_mpeg_vbi_itv0_obj;
4776 if (key_name.empty())
4777 json_object_object_get_ex(parent_obj, "v4l2_mpeg_vbi_itv0", &v4l2_mpeg_vbi_itv0_obj);
4778 else
4779 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_mpeg_vbi_itv0_obj);
4780
4781 json_object *linemask_obj;
4782 if (json_object_object_get_ex(v4l2_mpeg_vbi_itv0_obj, "linemask", &linemask_obj))
4783 if (json_object_get_string(linemask_obj) != nullptr)
4784 memcpy(p->linemask, json_object_get_string(linemask_obj), 2);
4785
4786 //struct v4l2_mpeg_vbi_itv0_line line[35];
4787 return p;
4788 }
retrace_v4l2_mpeg_vbi_fmt_ivtv_gen(json_object * parent_obj,std::string key_name="")4789 struct v4l2_mpeg_vbi_fmt_ivtv *retrace_v4l2_mpeg_vbi_fmt_ivtv_gen(json_object *parent_obj, std::string key_name = "")
4790 {
4791 struct v4l2_mpeg_vbi_fmt_ivtv *p = (struct v4l2_mpeg_vbi_fmt_ivtv *) calloc(1, sizeof(v4l2_mpeg_vbi_fmt_ivtv));
4792
4793 json_object *v4l2_mpeg_vbi_fmt_ivtv_obj;
4794 if (key_name.empty())
4795 json_object_object_get_ex(parent_obj, "v4l2_mpeg_vbi_fmt_ivtv", &v4l2_mpeg_vbi_fmt_ivtv_obj);
4796 else
4797 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_mpeg_vbi_fmt_ivtv_obj);
4798
4799 json_object *magic_obj;
4800 if (json_object_object_get_ex(v4l2_mpeg_vbi_fmt_ivtv_obj, "magic", &magic_obj))
4801 if (json_object_get_string(magic_obj) != nullptr)
4802 memcpy(p->magic, json_object_get_string(magic_obj), 4);
4803
4804 //union
4805 //struct v4l2_mpeg_vbi_itv0 itv0;
4806 //struct v4l2_mpeg_vbi_ITV0 ITV0;
4807 //end of union };
4808 return p;
4809 }
retrace_v4l2_plane_pix_format_gen(json_object * parent_obj,std::string key_name="")4810 struct v4l2_plane_pix_format *retrace_v4l2_plane_pix_format_gen(json_object *parent_obj, std::string key_name = "")
4811 {
4812 struct v4l2_plane_pix_format *p = (struct v4l2_plane_pix_format *) calloc(1, sizeof(v4l2_plane_pix_format));
4813
4814 json_object *v4l2_plane_pix_format_obj;
4815 if (key_name.empty())
4816 json_object_object_get_ex(parent_obj, "v4l2_plane_pix_format", &v4l2_plane_pix_format_obj);
4817 else
4818 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_plane_pix_format_obj);
4819
4820 json_object *sizeimage_obj;
4821 if (json_object_object_get_ex(v4l2_plane_pix_format_obj, "sizeimage", &sizeimage_obj))
4822 p->sizeimage = (__u32) json_object_get_int64(sizeimage_obj);
4823
4824 json_object *bytesperline_obj;
4825 if (json_object_object_get_ex(v4l2_plane_pix_format_obj, "bytesperline", &bytesperline_obj))
4826 p->bytesperline = (__u32) json_object_get_int64(bytesperline_obj);
4827
4828 return p;
4829 }
retrace_v4l2_pix_format_mplane_gen(json_object * parent_obj,std::string key_name="")4830 struct v4l2_pix_format_mplane *retrace_v4l2_pix_format_mplane_gen(json_object *parent_obj, std::string key_name = "")
4831 {
4832 struct v4l2_pix_format_mplane *p = (struct v4l2_pix_format_mplane *) calloc(1, sizeof(v4l2_pix_format_mplane));
4833
4834 json_object *v4l2_pix_format_mplane_obj;
4835 if (key_name.empty())
4836 json_object_object_get_ex(parent_obj, "v4l2_pix_format_mplane", &v4l2_pix_format_mplane_obj);
4837 else
4838 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_pix_format_mplane_obj);
4839
4840 json_object *width_obj;
4841 if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "width", &width_obj))
4842 p->width = (__u32) json_object_get_int64(width_obj);
4843
4844 json_object *height_obj;
4845 if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "height", &height_obj))
4846 p->height = (__u32) json_object_get_int64(height_obj);
4847
4848 json_object *pixelformat_obj;
4849 if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "pixelformat", &pixelformat_obj))
4850 p->pixelformat = (__u32) s2val(json_object_get_string(pixelformat_obj), v4l2_pix_fmt_val_def);
4851 json_object *field_obj;
4852 if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "field", &field_obj))
4853 p->field = (__u32) s2val(json_object_get_string(field_obj), v4l2_field_val_def);
4854 json_object *colorspace_obj;
4855 if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "colorspace", &colorspace_obj))
4856 p->colorspace = (__u32) s2val(json_object_get_string(colorspace_obj), v4l2_colorspace_val_def);
4857 //struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES];
4858 json_object *num_planes_obj;
4859 if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "num_planes", &num_planes_obj))
4860 p->num_planes = (__u8) json_object_get_int(num_planes_obj);
4861
4862 json_object *plane_fmt_obj;
4863 if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "plane_fmt", &plane_fmt_obj)) {
4864 for (int i = 0; i < (std::min((int) p->num_planes, VIDEO_MAX_PLANES)); i++) {
4865 if (json_object_array_get_idx(plane_fmt_obj, i)) {
4866 json_object *element_obj = json_object_new_object();
4867 json_object_object_add(element_obj, "v4l2_plane_pix_format", json_object_array_get_idx(plane_fmt_obj, i));
4868 void *ptr = (void *) retrace_v4l2_plane_pix_format_gen(element_obj);
4869 p->plane_fmt[i] = *static_cast<struct v4l2_plane_pix_format *>(ptr);
4870 free(ptr);
4871 }
4872 }
4873 }
4874
4875 json_object *flags_obj;
4876 if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "flags", &flags_obj))
4877 p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_pix_fmt_flag_def);
4878
4879 //union
4880 json_object *ycbcr_enc_obj;
4881 if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "ycbcr_enc", &ycbcr_enc_obj))
4882 p->ycbcr_enc = (__u8) s2val(json_object_get_string(ycbcr_enc_obj), v4l2_ycbcr_encoding_val_def);
4883 json_object *hsv_enc_obj;
4884 if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "hsv_enc", &hsv_enc_obj))
4885 p->hsv_enc = (__u8) json_object_get_int(hsv_enc_obj);
4886
4887 //end of union };
4888 json_object *quantization_obj;
4889 if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "quantization", &quantization_obj))
4890 p->quantization = (__u8) s2val(json_object_get_string(quantization_obj), v4l2_quantization_val_def);
4891 json_object *xfer_func_obj;
4892 if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "xfer_func", &xfer_func_obj))
4893 p->xfer_func = (__u8) s2val(json_object_get_string(xfer_func_obj), v4l2_xfer_func_val_def);
4894 return p;
4895 }
retrace_v4l2_sdr_format_gen(json_object * parent_obj,std::string key_name="")4896 struct v4l2_sdr_format *retrace_v4l2_sdr_format_gen(json_object *parent_obj, std::string key_name = "")
4897 {
4898 struct v4l2_sdr_format *p = (struct v4l2_sdr_format *) calloc(1, sizeof(v4l2_sdr_format));
4899
4900 json_object *v4l2_sdr_format_obj;
4901 if (key_name.empty())
4902 json_object_object_get_ex(parent_obj, "v4l2_sdr_format", &v4l2_sdr_format_obj);
4903 else
4904 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_sdr_format_obj);
4905
4906 json_object *pixelformat_obj;
4907 if (json_object_object_get_ex(v4l2_sdr_format_obj, "pixelformat", &pixelformat_obj))
4908 p->pixelformat = (__u32) s2val(json_object_get_string(pixelformat_obj), v4l2_pix_fmt_val_def);
4909 json_object *buffersize_obj;
4910 if (json_object_object_get_ex(v4l2_sdr_format_obj, "buffersize", &buffersize_obj))
4911 p->buffersize = (__u32) json_object_get_int64(buffersize_obj);
4912
4913 return p;
4914 }
retrace_v4l2_meta_format_gen(json_object * parent_obj,std::string key_name="")4915 struct v4l2_meta_format *retrace_v4l2_meta_format_gen(json_object *parent_obj, std::string key_name = "")
4916 {
4917 struct v4l2_meta_format *p = (struct v4l2_meta_format *) calloc(1, sizeof(v4l2_meta_format));
4918
4919 json_object *v4l2_meta_format_obj;
4920 if (key_name.empty())
4921 json_object_object_get_ex(parent_obj, "v4l2_meta_format", &v4l2_meta_format_obj);
4922 else
4923 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_meta_format_obj);
4924
4925 json_object *dataformat_obj;
4926 if (json_object_object_get_ex(v4l2_meta_format_obj, "dataformat", &dataformat_obj))
4927 p->dataformat = (__u32) json_object_get_int64(dataformat_obj);
4928
4929 json_object *buffersize_obj;
4930 if (json_object_object_get_ex(v4l2_meta_format_obj, "buffersize", &buffersize_obj))
4931 p->buffersize = (__u32) json_object_get_int64(buffersize_obj);
4932
4933 json_object *width_obj;
4934 if (json_object_object_get_ex(v4l2_meta_format_obj, "width", &width_obj))
4935 p->width = (__u32) json_object_get_int64(width_obj);
4936
4937 json_object *height_obj;
4938 if (json_object_object_get_ex(v4l2_meta_format_obj, "height", &height_obj))
4939 p->height = (__u32) json_object_get_int64(height_obj);
4940
4941 json_object *bytesperline_obj;
4942 if (json_object_object_get_ex(v4l2_meta_format_obj, "bytesperline", &bytesperline_obj))
4943 p->bytesperline = (__u32) json_object_get_int64(bytesperline_obj);
4944
4945 return p;
4946 }
retrace_v4l2_format_gen(json_object * parent_obj,std::string key_name="")4947 struct v4l2_format *retrace_v4l2_format_gen(json_object *parent_obj, std::string key_name = "")
4948 {
4949 struct v4l2_format *p = (struct v4l2_format *) calloc(1, sizeof(v4l2_format));
4950
4951 json_object *v4l2_format_obj;
4952 if (key_name.empty())
4953 json_object_object_get_ex(parent_obj, "v4l2_format", &v4l2_format_obj);
4954 else
4955 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_format_obj);
4956
4957 json_object *type_obj;
4958 if (json_object_object_get_ex(v4l2_format_obj, "type", &type_obj))
4959 p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_buf_type_val_def);
4960 //union
4961 switch (p->type) {
4962 case V4L2_BUF_TYPE_VIDEO_CAPTURE:
4963 case V4L2_BUF_TYPE_VIDEO_OUTPUT: {
4964 void *pix_ptr = (void *) retrace_v4l2_pix_format_gen(v4l2_format_obj);
4965 p->fmt.pix = *static_cast<struct v4l2_pix_format*>(pix_ptr);
4966 free(pix_ptr);
4967 break;
4968 }
4969 case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
4970 case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: {
4971 void *pix_mp_ptr = (void *) retrace_v4l2_pix_format_mplane_gen(v4l2_format_obj);
4972 p->fmt.pix_mp = *static_cast<struct v4l2_pix_format_mplane*>(pix_mp_ptr);
4973 free(pix_mp_ptr);
4974 break;
4975 }
4976 default:
4977 break;
4978 }
4979 //struct v4l2_pix_format pix;
4980 //struct v4l2_pix_format_mplane pix_mp;
4981 //struct v4l2_window win;
4982 //struct v4l2_vbi_format vbi;
4983 //struct v4l2_sliced_vbi_format sliced;
4984 //struct v4l2_sdr_format sdr;
4985 //struct v4l2_meta_format meta;
4986 //end of union } fmt;
4987 return p;
4988 }
retrace_v4l2_streamparm_gen(json_object * parent_obj,std::string key_name="")4989 struct v4l2_streamparm *retrace_v4l2_streamparm_gen(json_object *parent_obj, std::string key_name = "")
4990 {
4991 struct v4l2_streamparm *p = (struct v4l2_streamparm *) calloc(1, sizeof(v4l2_streamparm));
4992
4993 json_object *v4l2_streamparm_obj;
4994 if (key_name.empty())
4995 json_object_object_get_ex(parent_obj, "v4l2_streamparm", &v4l2_streamparm_obj);
4996 else
4997 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_streamparm_obj);
4998
4999 json_object *type_obj;
5000 if (json_object_object_get_ex(v4l2_streamparm_obj, "type", &type_obj))
5001 p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_buf_type_val_def);
5002 //union
5003 //struct v4l2_captureparm capture;
5004 //struct v4l2_outputparm output;
5005 //end of union } parm;
5006 return p;
5007 }
retrace_v4l2_event_vsync_gen(json_object * parent_obj,std::string key_name="")5008 struct v4l2_event_vsync *retrace_v4l2_event_vsync_gen(json_object *parent_obj, std::string key_name = "")
5009 {
5010 struct v4l2_event_vsync *p = (struct v4l2_event_vsync *) calloc(1, sizeof(v4l2_event_vsync));
5011
5012 json_object *v4l2_event_vsync_obj;
5013 if (key_name.empty())
5014 json_object_object_get_ex(parent_obj, "v4l2_event_vsync", &v4l2_event_vsync_obj);
5015 else
5016 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_event_vsync_obj);
5017
5018 json_object *field_obj;
5019 if (json_object_object_get_ex(v4l2_event_vsync_obj, "field", &field_obj))
5020 p->field = (__u8) s2val(json_object_get_string(field_obj), v4l2_field_val_def);
5021 return p;
5022 }
retrace_v4l2_event_ctrl_gen(json_object * parent_obj,std::string key_name="")5023 struct v4l2_event_ctrl *retrace_v4l2_event_ctrl_gen(json_object *parent_obj, std::string key_name = "")
5024 {
5025 struct v4l2_event_ctrl *p = (struct v4l2_event_ctrl *) calloc(1, sizeof(v4l2_event_ctrl));
5026
5027 json_object *v4l2_event_ctrl_obj;
5028 if (key_name.empty())
5029 json_object_object_get_ex(parent_obj, "v4l2_event_ctrl", &v4l2_event_ctrl_obj);
5030 else
5031 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_event_ctrl_obj);
5032
5033 json_object *changes_obj;
5034 if (json_object_object_get_ex(v4l2_event_ctrl_obj, "changes", &changes_obj))
5035 p->changes = (__u32) s2flags(json_object_get_string(changes_obj), v4l2_event_ctrl_ch_flag_def);
5036
5037 json_object *type_obj;
5038 if (json_object_object_get_ex(v4l2_event_ctrl_obj, "type", &type_obj))
5039 p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_ctrl_type_val_def);
5040 //union
5041 //__s32 value;
5042 //__s64 value64;
5043 //end of union };
5044 json_object *flags_obj;
5045 if (json_object_object_get_ex(v4l2_event_ctrl_obj, "flags", &flags_obj))
5046 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_ctrl_flag_def);
5047
5048 json_object *minimum_obj;
5049 if (json_object_object_get_ex(v4l2_event_ctrl_obj, "minimum", &minimum_obj))
5050 p->minimum = (__s32) json_object_get_int(minimum_obj);
5051
5052 json_object *maximum_obj;
5053 if (json_object_object_get_ex(v4l2_event_ctrl_obj, "maximum", &maximum_obj))
5054 p->maximum = (__s32) json_object_get_int(maximum_obj);
5055
5056 json_object *step_obj;
5057 if (json_object_object_get_ex(v4l2_event_ctrl_obj, "step", &step_obj))
5058 p->step = (__s32) json_object_get_int(step_obj);
5059
5060 json_object *default_value_obj;
5061 if (json_object_object_get_ex(v4l2_event_ctrl_obj, "default_value", &default_value_obj))
5062 p->default_value = (__s32) json_object_get_int(default_value_obj);
5063
5064 return p;
5065 }
retrace_v4l2_event_frame_sync_gen(json_object * parent_obj,std::string key_name="")5066 struct v4l2_event_frame_sync *retrace_v4l2_event_frame_sync_gen(json_object *parent_obj, std::string key_name = "")
5067 {
5068 struct v4l2_event_frame_sync *p = (struct v4l2_event_frame_sync *) calloc(1, sizeof(v4l2_event_frame_sync));
5069
5070 json_object *v4l2_event_frame_sync_obj;
5071 if (key_name.empty())
5072 json_object_object_get_ex(parent_obj, "v4l2_event_frame_sync", &v4l2_event_frame_sync_obj);
5073 else
5074 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_event_frame_sync_obj);
5075
5076 json_object *frame_sequence_obj;
5077 if (json_object_object_get_ex(v4l2_event_frame_sync_obj, "frame_sequence", &frame_sequence_obj))
5078 p->frame_sequence = (__u32) json_object_get_int64(frame_sequence_obj);
5079
5080 return p;
5081 }
retrace_v4l2_event_src_change_gen(json_object * parent_obj,std::string key_name="")5082 struct v4l2_event_src_change *retrace_v4l2_event_src_change_gen(json_object *parent_obj, std::string key_name = "")
5083 {
5084 struct v4l2_event_src_change *p = (struct v4l2_event_src_change *) calloc(1, sizeof(v4l2_event_src_change));
5085
5086 json_object *v4l2_event_src_change_obj;
5087 if (key_name.empty())
5088 json_object_object_get_ex(parent_obj, "v4l2_event_src_change", &v4l2_event_src_change_obj);
5089 else
5090 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_event_src_change_obj);
5091
5092 json_object *changes_obj;
5093 if (json_object_object_get_ex(v4l2_event_src_change_obj, "changes", &changes_obj))
5094 p->changes = (__u32) json_object_get_int64(changes_obj);
5095
5096 return p;
5097 }
retrace_v4l2_event_motion_det_gen(json_object * parent_obj,std::string key_name="")5098 struct v4l2_event_motion_det *retrace_v4l2_event_motion_det_gen(json_object *parent_obj, std::string key_name = "")
5099 {
5100 struct v4l2_event_motion_det *p = (struct v4l2_event_motion_det *) calloc(1, sizeof(v4l2_event_motion_det));
5101
5102 json_object *v4l2_event_motion_det_obj;
5103 if (key_name.empty())
5104 json_object_object_get_ex(parent_obj, "v4l2_event_motion_det", &v4l2_event_motion_det_obj);
5105 else
5106 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_event_motion_det_obj);
5107
5108 json_object *flags_obj;
5109 if (json_object_object_get_ex(v4l2_event_motion_det_obj, "flags", &flags_obj))
5110 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr);
5111
5112 json_object *frame_sequence_obj;
5113 if (json_object_object_get_ex(v4l2_event_motion_det_obj, "frame_sequence", &frame_sequence_obj))
5114 p->frame_sequence = (__u32) json_object_get_int64(frame_sequence_obj);
5115
5116 json_object *region_mask_obj;
5117 if (json_object_object_get_ex(v4l2_event_motion_det_obj, "region_mask", ®ion_mask_obj))
5118 p->region_mask = (__u32) json_object_get_int64(region_mask_obj);
5119
5120 return p;
5121 }
retrace_v4l2_event_gen(json_object * parent_obj,std::string key_name="")5122 struct v4l2_event *retrace_v4l2_event_gen(json_object *parent_obj, std::string key_name = "")
5123 {
5124 struct v4l2_event *p = (struct v4l2_event *) calloc(1, sizeof(v4l2_event));
5125
5126 json_object *v4l2_event_obj;
5127 if (key_name.empty())
5128 json_object_object_get_ex(parent_obj, "v4l2_event", &v4l2_event_obj);
5129 else
5130 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_event_obj);
5131
5132 json_object *type_obj;
5133 if (json_object_object_get_ex(v4l2_event_obj, "type", &type_obj))
5134 p->type = (__u32) s2val(json_object_get_string(type_obj), event_val_def);
5135 //union
5136 //struct v4l2_event_vsync vsync;
5137 //struct v4l2_event_ctrl ctrl;
5138 //struct v4l2_event_frame_sync frame_sync;
5139 //struct v4l2_event_src_change src_change;
5140 //struct v4l2_event_motion_det motion_det;
5141 //__u8 data[64];
5142 //end of union } u;
5143 json_object *pending_obj;
5144 if (json_object_object_get_ex(v4l2_event_obj, "pending", &pending_obj))
5145 p->pending = (__u32) json_object_get_int64(pending_obj);
5146
5147 json_object *sequence_obj;
5148 if (json_object_object_get_ex(v4l2_event_obj, "sequence", &sequence_obj))
5149 p->sequence = (__u32) json_object_get_int64(sequence_obj);
5150
5151 //struct timespec timestamp;
5152 json_object *id_obj;
5153 if (json_object_object_get_ex(v4l2_event_obj, "id", &id_obj))
5154 p->id = (__u32) s2val(json_object_get_string(id_obj), nullptr);
5155 return p;
5156 }
retrace_v4l2_event_subscription_gen(json_object * parent_obj,std::string key_name="")5157 struct v4l2_event_subscription *retrace_v4l2_event_subscription_gen(json_object *parent_obj, std::string key_name = "")
5158 {
5159 struct v4l2_event_subscription *p = (struct v4l2_event_subscription *) calloc(1, sizeof(v4l2_event_subscription));
5160
5161 json_object *v4l2_event_subscription_obj;
5162 if (key_name.empty())
5163 json_object_object_get_ex(parent_obj, "v4l2_event_subscription", &v4l2_event_subscription_obj);
5164 else
5165 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_event_subscription_obj);
5166
5167 json_object *type_obj;
5168 if (json_object_object_get_ex(v4l2_event_subscription_obj, "type", &type_obj))
5169 p->type = (__u32) s2val(json_object_get_string(type_obj), event_val_def);
5170 json_object *id_obj;
5171 if (json_object_object_get_ex(v4l2_event_subscription_obj, "id", &id_obj))
5172 p->id = (__u32) s2val(json_object_get_string(id_obj), nullptr);
5173 json_object *flags_obj;
5174 if (json_object_object_get_ex(v4l2_event_subscription_obj, "flags", &flags_obj))
5175 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_event_sub_flag_def);
5176
5177 return p;
5178 }
retrace_v4l2_dbg_match_gen(json_object * parent_obj,std::string key_name="")5179 struct v4l2_dbg_match *retrace_v4l2_dbg_match_gen(json_object *parent_obj, std::string key_name = "")
5180 {
5181 struct v4l2_dbg_match *p = (struct v4l2_dbg_match *) calloc(1, sizeof(v4l2_dbg_match));
5182
5183 json_object *v4l2_dbg_match_obj;
5184 if (key_name.empty())
5185 json_object_object_get_ex(parent_obj, "v4l2_dbg_match", &v4l2_dbg_match_obj);
5186 else
5187 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_dbg_match_obj);
5188
5189 json_object *type_obj;
5190 if (json_object_object_get_ex(v4l2_dbg_match_obj, "type", &type_obj))
5191 p->type = (__u32) s2val(json_object_get_string(type_obj), nullptr);
5192 //union
5193 //__u32 addr;
5194 //char name[32];
5195 //end of union };
5196 return p;
5197 }
retrace_v4l2_dbg_register_gen(json_object * parent_obj,std::string key_name="")5198 struct v4l2_dbg_register *retrace_v4l2_dbg_register_gen(json_object *parent_obj, std::string key_name = "")
5199 {
5200 struct v4l2_dbg_register *p = (struct v4l2_dbg_register *) calloc(1, sizeof(v4l2_dbg_register));
5201
5202 json_object *v4l2_dbg_register_obj;
5203 if (key_name.empty())
5204 json_object_object_get_ex(parent_obj, "v4l2_dbg_register", &v4l2_dbg_register_obj);
5205 else
5206 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_dbg_register_obj);
5207
5208 //struct v4l2_dbg_match match;
5209 void *match_ptr = (void *) retrace_v4l2_dbg_match_gen(v4l2_dbg_register_obj, "match");
5210 p->match = *static_cast<struct v4l2_dbg_match*>(match_ptr);
5211 free(match_ptr);
5212
5213 json_object *size_obj;
5214 if (json_object_object_get_ex(v4l2_dbg_register_obj, "size", &size_obj))
5215 p->size = (__u32) json_object_get_int64(size_obj);
5216
5217 json_object *reg_obj;
5218 if (json_object_object_get_ex(v4l2_dbg_register_obj, "reg", ®_obj))
5219 p->reg = (__u64) json_object_get_uint64(reg_obj);
5220
5221 json_object *val_obj;
5222 if (json_object_object_get_ex(v4l2_dbg_register_obj, "val", &val_obj))
5223 p->val = (__u64) json_object_get_uint64(val_obj);
5224
5225 return p;
5226 }
retrace_v4l2_dbg_chip_info_gen(json_object * parent_obj,std::string key_name="")5227 struct v4l2_dbg_chip_info *retrace_v4l2_dbg_chip_info_gen(json_object *parent_obj, std::string key_name = "")
5228 {
5229 struct v4l2_dbg_chip_info *p = (struct v4l2_dbg_chip_info *) calloc(1, sizeof(v4l2_dbg_chip_info));
5230
5231 json_object *v4l2_dbg_chip_info_obj;
5232 if (key_name.empty())
5233 json_object_object_get_ex(parent_obj, "v4l2_dbg_chip_info", &v4l2_dbg_chip_info_obj);
5234 else
5235 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_dbg_chip_info_obj);
5236
5237 //struct v4l2_dbg_match match;
5238 void *match_ptr = (void *) retrace_v4l2_dbg_match_gen(v4l2_dbg_chip_info_obj, "match");
5239 p->match = *static_cast<struct v4l2_dbg_match*>(match_ptr);
5240 free(match_ptr);
5241
5242 json_object *name_obj;
5243 if (json_object_object_get_ex(v4l2_dbg_chip_info_obj, "name", &name_obj))
5244 if (json_object_get_string(name_obj) != nullptr)
5245 memcpy(p->name, json_object_get_string(name_obj), 32);
5246
5247 json_object *flags_obj;
5248 if (json_object_object_get_ex(v4l2_dbg_chip_info_obj, "flags", &flags_obj))
5249 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr);
5250
5251 return p;
5252 }
retrace_v4l2_create_buffers_gen(json_object * parent_obj,std::string key_name="")5253 struct v4l2_create_buffers *retrace_v4l2_create_buffers_gen(json_object *parent_obj, std::string key_name = "")
5254 {
5255 struct v4l2_create_buffers *p = (struct v4l2_create_buffers *) calloc(1, sizeof(v4l2_create_buffers));
5256
5257 json_object *v4l2_create_buffers_obj;
5258 if (key_name.empty())
5259 json_object_object_get_ex(parent_obj, "v4l2_create_buffers", &v4l2_create_buffers_obj);
5260 else
5261 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_create_buffers_obj);
5262
5263 json_object *index_obj;
5264 if (json_object_object_get_ex(v4l2_create_buffers_obj, "index", &index_obj))
5265 p->index = (__u32) json_object_get_int64(index_obj);
5266
5267 json_object *count_obj;
5268 if (json_object_object_get_ex(v4l2_create_buffers_obj, "count", &count_obj))
5269 p->count = (__u32) json_object_get_int64(count_obj);
5270
5271 json_object *memory_obj;
5272 if (json_object_object_get_ex(v4l2_create_buffers_obj, "memory", &memory_obj))
5273 p->memory = (__u32) s2val(json_object_get_string(memory_obj), v4l2_memory_val_def);
5274 //struct v4l2_format format;
5275 void *format_ptr = (void *) retrace_v4l2_format_gen(v4l2_create_buffers_obj, "format");
5276 p->format = *static_cast<struct v4l2_format*>(format_ptr);
5277 free(format_ptr);
5278
5279 json_object *capabilities_obj;
5280 if (json_object_object_get_ex(v4l2_create_buffers_obj, "capabilities", &capabilities_obj))
5281 p->capabilities = (__u32) s2flags(json_object_get_string(capabilities_obj), v4l2_buf_cap_flag_def);
5282
5283 json_object *flags_obj;
5284 if (json_object_object_get_ex(v4l2_create_buffers_obj, "flags", &flags_obj))
5285 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_memory_flag_def);
5286
5287 json_object *max_num_buffers_obj;
5288 if (json_object_object_get_ex(v4l2_create_buffers_obj, "max_num_buffers", &max_num_buffers_obj))
5289 p->max_num_buffers = (__u32) json_object_get_int64(max_num_buffers_obj);
5290
5291 return p;
5292 }
retrace_v4l2_remove_buffers_gen(json_object * parent_obj,std::string key_name="")5293 struct v4l2_remove_buffers *retrace_v4l2_remove_buffers_gen(json_object *parent_obj, std::string key_name = "")
5294 {
5295 struct v4l2_remove_buffers *p = (struct v4l2_remove_buffers *) calloc(1, sizeof(v4l2_remove_buffers));
5296
5297 json_object *v4l2_remove_buffers_obj;
5298 if (key_name.empty())
5299 json_object_object_get_ex(parent_obj, "v4l2_remove_buffers", &v4l2_remove_buffers_obj);
5300 else
5301 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_remove_buffers_obj);
5302
5303 json_object *index_obj;
5304 if (json_object_object_get_ex(v4l2_remove_buffers_obj, "index", &index_obj))
5305 p->index = (__u32) json_object_get_int64(index_obj);
5306
5307 json_object *count_obj;
5308 if (json_object_object_get_ex(v4l2_remove_buffers_obj, "count", &count_obj))
5309 p->count = (__u32) json_object_get_int64(count_obj);
5310
5311 json_object *type_obj;
5312 if (json_object_object_get_ex(v4l2_remove_buffers_obj, "type", &type_obj))
5313 p->type = (__u32) s2val(json_object_get_string(type_obj), nullptr);
5314 return p;
5315 }
retrace_media_device_info_gen(json_object * parent_obj,std::string key_name="")5316 struct media_device_info *retrace_media_device_info_gen(json_object *parent_obj, std::string key_name = "")
5317 {
5318 struct media_device_info *p = (struct media_device_info *) calloc(1, sizeof(media_device_info));
5319
5320 json_object *media_device_info_obj;
5321 if (key_name.empty())
5322 json_object_object_get_ex(parent_obj, "media_device_info", &media_device_info_obj);
5323 else
5324 json_object_object_get_ex(parent_obj, key_name.c_str(), &media_device_info_obj);
5325
5326 json_object *driver_obj;
5327 if (json_object_object_get_ex(media_device_info_obj, "driver", &driver_obj))
5328 if (json_object_get_string(driver_obj) != nullptr)
5329 memcpy(p->driver, json_object_get_string(driver_obj), 16);
5330
5331 json_object *model_obj;
5332 if (json_object_object_get_ex(media_device_info_obj, "model", &model_obj))
5333 if (json_object_get_string(model_obj) != nullptr)
5334 memcpy(p->model, json_object_get_string(model_obj), 32);
5335
5336 json_object *serial_obj;
5337 if (json_object_object_get_ex(media_device_info_obj, "serial", &serial_obj))
5338 if (json_object_get_string(serial_obj) != nullptr)
5339 memcpy(p->serial, json_object_get_string(serial_obj), 40);
5340
5341 json_object *bus_info_obj;
5342 if (json_object_object_get_ex(media_device_info_obj, "bus_info", &bus_info_obj))
5343 if (json_object_get_string(bus_info_obj) != nullptr)
5344 memcpy(p->bus_info, json_object_get_string(bus_info_obj), 32);
5345
5346 json_object *media_version_obj;
5347 if (json_object_object_get_ex(media_device_info_obj, "media_version", &media_version_obj))
5348 memset(&p->media_version, 0, sizeof(p->media_version));
5349
5350 json_object *hw_revision_obj;
5351 if (json_object_object_get_ex(media_device_info_obj, "hw_revision", &hw_revision_obj))
5352 p->hw_revision = (__u32) json_object_get_int64(hw_revision_obj);
5353
5354 json_object *driver_version_obj;
5355 if (json_object_object_get_ex(media_device_info_obj, "driver_version", &driver_version_obj))
5356 memset(&p->driver_version, 0, sizeof(p->driver_version));
5357
5358 return p;
5359 }
retrace_media_entity_desc_gen(json_object * parent_obj,std::string key_name="")5360 struct media_entity_desc *retrace_media_entity_desc_gen(json_object *parent_obj, std::string key_name = "")
5361 {
5362 struct media_entity_desc *p = (struct media_entity_desc *) calloc(1, sizeof(media_entity_desc));
5363
5364 json_object *media_entity_desc_obj;
5365 if (key_name.empty())
5366 json_object_object_get_ex(parent_obj, "media_entity_desc", &media_entity_desc_obj);
5367 else
5368 json_object_object_get_ex(parent_obj, key_name.c_str(), &media_entity_desc_obj);
5369
5370 json_object *id_obj;
5371 if (json_object_object_get_ex(media_entity_desc_obj, "id", &id_obj))
5372 p->id = (__u32) s2val(json_object_get_string(id_obj), nullptr);
5373 json_object *name_obj;
5374 if (json_object_object_get_ex(media_entity_desc_obj, "name", &name_obj))
5375 if (json_object_get_string(name_obj) != nullptr)
5376 memcpy(p->name, json_object_get_string(name_obj), 32);
5377
5378 json_object *type_obj;
5379 if (json_object_object_get_ex(media_entity_desc_obj, "type", &type_obj))
5380 p->type = (__u32) s2val(json_object_get_string(type_obj), nullptr);
5381 json_object *revision_obj;
5382 if (json_object_object_get_ex(media_entity_desc_obj, "revision", &revision_obj))
5383 p->revision = (__u32) json_object_get_int64(revision_obj);
5384
5385 json_object *flags_obj;
5386 if (json_object_object_get_ex(media_entity_desc_obj, "flags", &flags_obj))
5387 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr);
5388
5389 json_object *group_id_obj;
5390 if (json_object_object_get_ex(media_entity_desc_obj, "group_id", &group_id_obj))
5391 p->group_id = (__u32) json_object_get_int64(group_id_obj);
5392
5393 json_object *pads_obj;
5394 if (json_object_object_get_ex(media_entity_desc_obj, "pads", &pads_obj))
5395 p->pads = (__u16) json_object_get_int(pads_obj);
5396
5397 json_object *links_obj;
5398 if (json_object_object_get_ex(media_entity_desc_obj, "links", &links_obj))
5399 p->links = (__u16) json_object_get_int(links_obj);
5400
5401 //union
5402 //struct {
5403 //__u32 major;
5404 //__u32 minor;
5405 //end of union } dev;
5406 //struct {
5407 //__u32 card;
5408 //__u32 device;
5409 //__u32 subdevice;
5410 //end of struct } alsa;
5411 //struct {
5412 //__u32 major;
5413 //__u32 minor;
5414 //end of struct } v4l;
5415 //struct {
5416 //__u32 major;
5417 //__u32 minor;
5418 //end of struct } fb;
5419 json_object *dvb_obj;
5420 if (json_object_object_get_ex(media_entity_desc_obj, "dvb", &dvb_obj))
5421 p->dvb = (int) json_object_get_int(dvb_obj);
5422
5423 json_object *raw_obj;
5424 if (json_object_object_get_ex(media_entity_desc_obj, "raw", &raw_obj))
5425 if (json_object_get_string(raw_obj) != nullptr)
5426 memcpy(p->raw, json_object_get_string(raw_obj), 184);
5427
5428 return p;
5429 }
retrace_media_pad_desc_gen(json_object * parent_obj,std::string key_name="")5430 struct media_pad_desc *retrace_media_pad_desc_gen(json_object *parent_obj, std::string key_name = "")
5431 {
5432 struct media_pad_desc *p = (struct media_pad_desc *) calloc(1, sizeof(media_pad_desc));
5433
5434 json_object *media_pad_desc_obj;
5435 if (key_name.empty())
5436 json_object_object_get_ex(parent_obj, "media_pad_desc", &media_pad_desc_obj);
5437 else
5438 json_object_object_get_ex(parent_obj, key_name.c_str(), &media_pad_desc_obj);
5439
5440 json_object *entity_obj;
5441 if (json_object_object_get_ex(media_pad_desc_obj, "entity", &entity_obj))
5442 p->entity = (__u32) json_object_get_int64(entity_obj);
5443
5444 json_object *index_obj;
5445 if (json_object_object_get_ex(media_pad_desc_obj, "index", &index_obj))
5446 p->index = (__u16) json_object_get_int(index_obj);
5447
5448 json_object *flags_obj;
5449 if (json_object_object_get_ex(media_pad_desc_obj, "flags", &flags_obj))
5450 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr);
5451
5452 return p;
5453 }
retrace_media_link_desc_gen(json_object * parent_obj,std::string key_name="")5454 struct media_link_desc *retrace_media_link_desc_gen(json_object *parent_obj, std::string key_name = "")
5455 {
5456 struct media_link_desc *p = (struct media_link_desc *) calloc(1, sizeof(media_link_desc));
5457
5458 json_object *media_link_desc_obj;
5459 if (key_name.empty())
5460 json_object_object_get_ex(parent_obj, "media_link_desc", &media_link_desc_obj);
5461 else
5462 json_object_object_get_ex(parent_obj, key_name.c_str(), &media_link_desc_obj);
5463
5464 //struct media_pad_desc source;
5465 void *source_ptr = (void *) retrace_media_pad_desc_gen(media_link_desc_obj, "source");
5466 p->source = *static_cast<struct media_pad_desc*>(source_ptr);
5467 free(source_ptr);
5468
5469 //struct media_pad_desc sink;
5470 void *sink_ptr = (void *) retrace_media_pad_desc_gen(media_link_desc_obj, "sink");
5471 p->sink = *static_cast<struct media_pad_desc*>(sink_ptr);
5472 free(sink_ptr);
5473
5474 json_object *flags_obj;
5475 if (json_object_object_get_ex(media_link_desc_obj, "flags", &flags_obj))
5476 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr);
5477
5478 return p;
5479 }
retrace_media_links_enum_gen(json_object * parent_obj,std::string key_name="")5480 struct media_links_enum *retrace_media_links_enum_gen(json_object *parent_obj, std::string key_name = "")
5481 {
5482 struct media_links_enum *p = (struct media_links_enum *) calloc(1, sizeof(media_links_enum));
5483
5484 json_object *media_links_enum_obj;
5485 if (key_name.empty())
5486 json_object_object_get_ex(parent_obj, "media_links_enum", &media_links_enum_obj);
5487 else
5488 json_object_object_get_ex(parent_obj, key_name.c_str(), &media_links_enum_obj);
5489
5490 json_object *entity_obj;
5491 if (json_object_object_get_ex(media_links_enum_obj, "entity", &entity_obj))
5492 p->entity = (__u32) json_object_get_int64(entity_obj);
5493
5494 //struct media_pad_desc *pads;
5495 //struct media_link_desc *links;
5496 return p;
5497 }
retrace_media_v2_entity_gen(json_object * parent_obj,std::string key_name="")5498 struct media_v2_entity *retrace_media_v2_entity_gen(json_object *parent_obj, std::string key_name = "")
5499 {
5500 struct media_v2_entity *p = (struct media_v2_entity *) calloc(1, sizeof(media_v2_entity));
5501
5502 json_object *media_v2_entity_obj;
5503 if (key_name.empty())
5504 json_object_object_get_ex(parent_obj, "media_v2_entity", &media_v2_entity_obj);
5505 else
5506 json_object_object_get_ex(parent_obj, key_name.c_str(), &media_v2_entity_obj);
5507
5508 json_object *id_obj;
5509 if (json_object_object_get_ex(media_v2_entity_obj, "id", &id_obj))
5510 p->id = (__u32) s2val(json_object_get_string(id_obj), nullptr);
5511 json_object *name_obj;
5512 if (json_object_object_get_ex(media_v2_entity_obj, "name", &name_obj))
5513 if (json_object_get_string(name_obj) != nullptr)
5514 memcpy(p->name, json_object_get_string(name_obj), 64);
5515
5516 json_object *function_obj;
5517 if (json_object_object_get_ex(media_v2_entity_obj, "function", &function_obj))
5518 p->function = (__u32) json_object_get_int64(function_obj);
5519
5520 json_object *flags_obj;
5521 if (json_object_object_get_ex(media_v2_entity_obj, "flags", &flags_obj))
5522 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr);
5523
5524 return p;
5525 }
retrace_media_v2_intf_devnode_gen(json_object * parent_obj,std::string key_name="")5526 struct media_v2_intf_devnode *retrace_media_v2_intf_devnode_gen(json_object *parent_obj, std::string key_name = "")
5527 {
5528 struct media_v2_intf_devnode *p = (struct media_v2_intf_devnode *) calloc(1, sizeof(media_v2_intf_devnode));
5529
5530 json_object *media_v2_intf_devnode_obj;
5531 if (key_name.empty())
5532 json_object_object_get_ex(parent_obj, "media_v2_intf_devnode", &media_v2_intf_devnode_obj);
5533 else
5534 json_object_object_get_ex(parent_obj, key_name.c_str(), &media_v2_intf_devnode_obj);
5535
5536 json_object *major_obj;
5537 if (json_object_object_get_ex(media_v2_intf_devnode_obj, "major", &major_obj))
5538 p->major = (__u32) json_object_get_int64(major_obj);
5539
5540 json_object *minor_obj;
5541 if (json_object_object_get_ex(media_v2_intf_devnode_obj, "minor", &minor_obj))
5542 p->minor = (__u32) json_object_get_int64(minor_obj);
5543
5544 return p;
5545 }
retrace_media_v2_interface_gen(json_object * parent_obj,std::string key_name="")5546 struct media_v2_interface *retrace_media_v2_interface_gen(json_object *parent_obj, std::string key_name = "")
5547 {
5548 struct media_v2_interface *p = (struct media_v2_interface *) calloc(1, sizeof(media_v2_interface));
5549
5550 json_object *media_v2_interface_obj;
5551 if (key_name.empty())
5552 json_object_object_get_ex(parent_obj, "media_v2_interface", &media_v2_interface_obj);
5553 else
5554 json_object_object_get_ex(parent_obj, key_name.c_str(), &media_v2_interface_obj);
5555
5556 json_object *id_obj;
5557 if (json_object_object_get_ex(media_v2_interface_obj, "id", &id_obj))
5558 p->id = (__u32) s2val(json_object_get_string(id_obj), nullptr);
5559 json_object *intf_type_obj;
5560 if (json_object_object_get_ex(media_v2_interface_obj, "intf_type", &intf_type_obj))
5561 p->intf_type = (__u32) json_object_get_int64(intf_type_obj);
5562
5563 json_object *flags_obj;
5564 if (json_object_object_get_ex(media_v2_interface_obj, "flags", &flags_obj))
5565 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr);
5566
5567 //union
5568 //struct media_v2_intf_devnode devnode;
5569 //__u32 raw[16];
5570 //end of union };
5571 return p;
5572 }
retrace_media_v2_pad_gen(json_object * parent_obj,std::string key_name="")5573 struct media_v2_pad *retrace_media_v2_pad_gen(json_object *parent_obj, std::string key_name = "")
5574 {
5575 struct media_v2_pad *p = (struct media_v2_pad *) calloc(1, sizeof(media_v2_pad));
5576
5577 json_object *media_v2_pad_obj;
5578 if (key_name.empty())
5579 json_object_object_get_ex(parent_obj, "media_v2_pad", &media_v2_pad_obj);
5580 else
5581 json_object_object_get_ex(parent_obj, key_name.c_str(), &media_v2_pad_obj);
5582
5583 json_object *id_obj;
5584 if (json_object_object_get_ex(media_v2_pad_obj, "id", &id_obj))
5585 p->id = (__u32) s2val(json_object_get_string(id_obj), nullptr);
5586 json_object *entity_id_obj;
5587 if (json_object_object_get_ex(media_v2_pad_obj, "entity_id", &entity_id_obj))
5588 p->entity_id = (__u32) json_object_get_int64(entity_id_obj);
5589
5590 json_object *flags_obj;
5591 if (json_object_object_get_ex(media_v2_pad_obj, "flags", &flags_obj))
5592 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr);
5593
5594 json_object *index_obj;
5595 if (json_object_object_get_ex(media_v2_pad_obj, "index", &index_obj))
5596 p->index = (__u32) json_object_get_int64(index_obj);
5597
5598 return p;
5599 }
retrace_media_v2_link_gen(json_object * parent_obj,std::string key_name="")5600 struct media_v2_link *retrace_media_v2_link_gen(json_object *parent_obj, std::string key_name = "")
5601 {
5602 struct media_v2_link *p = (struct media_v2_link *) calloc(1, sizeof(media_v2_link));
5603
5604 json_object *media_v2_link_obj;
5605 if (key_name.empty())
5606 json_object_object_get_ex(parent_obj, "media_v2_link", &media_v2_link_obj);
5607 else
5608 json_object_object_get_ex(parent_obj, key_name.c_str(), &media_v2_link_obj);
5609
5610 json_object *id_obj;
5611 if (json_object_object_get_ex(media_v2_link_obj, "id", &id_obj))
5612 p->id = (__u32) s2val(json_object_get_string(id_obj), nullptr);
5613 json_object *source_id_obj;
5614 if (json_object_object_get_ex(media_v2_link_obj, "source_id", &source_id_obj))
5615 p->source_id = (__u32) json_object_get_int64(source_id_obj);
5616
5617 json_object *sink_id_obj;
5618 if (json_object_object_get_ex(media_v2_link_obj, "sink_id", &sink_id_obj))
5619 p->sink_id = (__u32) json_object_get_int64(sink_id_obj);
5620
5621 json_object *flags_obj;
5622 if (json_object_object_get_ex(media_v2_link_obj, "flags", &flags_obj))
5623 p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr);
5624
5625 return p;
5626 }
retrace_media_v2_topology_gen(json_object * parent_obj,std::string key_name="")5627 struct media_v2_topology *retrace_media_v2_topology_gen(json_object *parent_obj, std::string key_name = "")
5628 {
5629 struct media_v2_topology *p = (struct media_v2_topology *) calloc(1, sizeof(media_v2_topology));
5630
5631 json_object *media_v2_topology_obj;
5632 if (key_name.empty())
5633 json_object_object_get_ex(parent_obj, "media_v2_topology", &media_v2_topology_obj);
5634 else
5635 json_object_object_get_ex(parent_obj, key_name.c_str(), &media_v2_topology_obj);
5636
5637 json_object *topology_version_obj;
5638 if (json_object_object_get_ex(media_v2_topology_obj, "topology_version", &topology_version_obj))
5639 memset(&p->topology_version, 0, sizeof(p->topology_version));
5640
5641 json_object *num_entities_obj;
5642 if (json_object_object_get_ex(media_v2_topology_obj, "num_entities", &num_entities_obj))
5643 p->num_entities = (__u32) json_object_get_int64(num_entities_obj);
5644
5645 json_object *ptr_entities_obj;
5646 if (json_object_object_get_ex(media_v2_topology_obj, "ptr_entities", &ptr_entities_obj))
5647 p->ptr_entities = (__u64) json_object_get_uint64(ptr_entities_obj);
5648
5649 json_object *num_interfaces_obj;
5650 if (json_object_object_get_ex(media_v2_topology_obj, "num_interfaces", &num_interfaces_obj))
5651 p->num_interfaces = (__u32) json_object_get_int64(num_interfaces_obj);
5652
5653 json_object *ptr_interfaces_obj;
5654 if (json_object_object_get_ex(media_v2_topology_obj, "ptr_interfaces", &ptr_interfaces_obj))
5655 p->ptr_interfaces = (__u64) json_object_get_uint64(ptr_interfaces_obj);
5656
5657 json_object *num_pads_obj;
5658 if (json_object_object_get_ex(media_v2_topology_obj, "num_pads", &num_pads_obj))
5659 p->num_pads = (__u32) json_object_get_int64(num_pads_obj);
5660
5661 json_object *ptr_pads_obj;
5662 if (json_object_object_get_ex(media_v2_topology_obj, "ptr_pads", &ptr_pads_obj))
5663 p->ptr_pads = (__u64) json_object_get_uint64(ptr_pads_obj);
5664
5665 json_object *num_links_obj;
5666 if (json_object_object_get_ex(media_v2_topology_obj, "num_links", &num_links_obj))
5667 p->num_links = (__u32) json_object_get_int64(num_links_obj);
5668
5669 json_object *ptr_links_obj;
5670 if (json_object_object_get_ex(media_v2_topology_obj, "ptr_links", &ptr_links_obj))
5671 p->ptr_links = (__u64) json_object_get_uint64(ptr_links_obj);
5672
5673 return p;
5674 }
retrace_v4l2_edid_gen(json_object * parent_obj,std::string key_name="")5675 struct v4l2_edid *retrace_v4l2_edid_gen(json_object *parent_obj, std::string key_name = "")
5676 {
5677 struct v4l2_edid *p = (struct v4l2_edid *) calloc(1, sizeof(v4l2_edid));
5678
5679 json_object *v4l2_edid_obj;
5680 if (key_name.empty())
5681 json_object_object_get_ex(parent_obj, "v4l2_edid", &v4l2_edid_obj);
5682 else
5683 json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_edid_obj);
5684
5685 json_object *pad_obj;
5686 if (json_object_object_get_ex(v4l2_edid_obj, "pad", &pad_obj))
5687 p->pad = (__u32) json_object_get_int64(pad_obj);
5688
5689 json_object *start_block_obj;
5690 if (json_object_object_get_ex(v4l2_edid_obj, "start_block", &start_block_obj))
5691 p->start_block = (__u32) json_object_get_int64(start_block_obj);
5692
5693 json_object *blocks_obj;
5694 if (json_object_object_get_ex(v4l2_edid_obj, "blocks", &blocks_obj))
5695 p->blocks = (__u32) json_object_get_int64(blocks_obj);
5696
5697 //__u8 *edid;
5698 return p;
5699 }
5700