| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 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 |
|
| 1609 |
struct v4l2_vp9_loop_filter *retrace_v4l2_vp9_loop_filter_gen(json_object *ctrl_obj) |
| 1610 |
{ |
| 1611 |
struct v4l2_vp9_loop_filter *p = (struct v4l2_vp9_loop_filter *) calloc(1, sizeof(v4l2_vp9_loop_filter)); |
| 1612 |
json_object *v4l2_vp9_loop_filter_obj; |
| 1613 |
if (!json_object_object_get_ex(ctrl_obj, "v4l2_vp9_loop_filter", &v4l2_vp9_loop_filter_obj)) |
| 1614 |
v4l2_vp9_loop_filter_obj = ctrl_obj; |
| 1615 |
|
| 1616 |
/* __s8 ref_deltas[4] */ |
| 1617 |
json_object *ref_deltas_obj; |
| 1618 |
if (json_object_object_get_ex(v4l2_vp9_loop_filter_obj, "ref_deltas", &ref_deltas_obj)) { |
| 1619 |
for (size_t i = 0; i < 4; i++) { |
| 1620 |
if (json_object_array_get_idx(ref_deltas_obj, i)) |
| 1621 |
p->ref_deltas[i] = (__s8) json_object_get_int(json_object_array_get_idx(ref_deltas_obj, i)); |
| 1622 |
} |
| 1623 |
} |
| 1624 |
|
| 1625 |
/* __s8 mode_deltas[2] */ |
| 1626 |
json_object *mode_deltas_obj; |
| 1627 |
if (json_object_object_get_ex(v4l2_vp9_loop_filter_obj, "mode_deltas", &mode_deltas_obj)) { |
| 1628 |
for (size_t i = 0; i < 2; i++) { |
| 1629 |
if (json_object_array_get_idx(mode_deltas_obj, i)) |
| 1630 |
p->mode_deltas[i] = (__s8) json_object_get_int(json_object_array_get_idx(mode_deltas_obj, i)); |
| 1631 |
} |
| 1632 |
} |
| 1633 |
|
| 1634 |
json_object *level_obj; |
| 1635 |
if (json_object_object_get_ex(v4l2_vp9_loop_filter_obj, "level", &level_obj)) |
| 1636 |
p->level = (__u8) json_object_get_int(level_obj); |
| 1637 |
|
| 1638 |
json_object *sharpness_obj; |
| 1639 |
if (json_object_object_get_ex(v4l2_vp9_loop_filter_obj, "sharpness", &sharpness_obj)) |
| 1640 |
p->sharpness = (__u8) json_object_get_int(sharpness_obj); |
| 1641 |
|
| 1642 |
json_object *flags_obj; |
| 1643 |
if (json_object_object_get_ex(v4l2_vp9_loop_filter_obj, "flags", &flags_obj)) |
| 1644 |
p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_vp9_loop_filter_flag_def); |
| 1645 |
|
| 1646 |
return p; |
| 1647 |
} |
| 1648 |
|
| 1649 |
struct v4l2_vp9_quantization *retrace_v4l2_vp9_quantization_gen(json_object *ctrl_obj) |
| 1650 |
{ |
| 1651 |
struct v4l2_vp9_quantization *p = (struct v4l2_vp9_quantization *) calloc(1, sizeof(v4l2_vp9_quantization)); |
| 1652 |
json_object *v4l2_vp9_quantization_obj; |
| 1653 |
if (!json_object_object_get_ex(ctrl_obj, "v4l2_vp9_quantization", &v4l2_vp9_quantization_obj)) |
| 1654 |
v4l2_vp9_quantization_obj = ctrl_obj; |
| 1655 |
|
| 1656 |
json_object *base_q_idx_obj; |
| 1657 |
if (json_object_object_get_ex(v4l2_vp9_quantization_obj, "base_q_idx", &base_q_idx_obj)) |
| 1658 |
p->base_q_idx = (__u8) json_object_get_int(base_q_idx_obj); |
| 1659 |
|
| 1660 |
json_object *delta_q_y_dc_obj; |
| 1661 |
if (json_object_object_get_ex(v4l2_vp9_quantization_obj, "delta_q_y_dc", &delta_q_y_dc_obj)) |
| 1662 |
p->delta_q_y_dc = (__s8) json_object_get_int(delta_q_y_dc_obj); |
| 1663 |
|
| 1664 |
json_object *delta_q_uv_dc_obj; |
| 1665 |
if (json_object_object_get_ex(v4l2_vp9_quantization_obj, "delta_q_uv_dc", &delta_q_uv_dc_obj)) |
| 1666 |
p->delta_q_uv_dc = (__s8) json_object_get_int(delta_q_uv_dc_obj); |
| 1667 |
|
| 1668 |
json_object *delta_q_uv_ac_obj; |
| 1669 |
if (json_object_object_get_ex(v4l2_vp9_quantization_obj, "delta_q_uv_ac", &delta_q_uv_ac_obj)) |
| 1670 |
p->delta_q_uv_ac = (__s8) json_object_get_int(delta_q_uv_ac_obj); |
| 1671 |
|
| 1672 |
return p; |
| 1673 |
} |
| 1674 |
|
| 1675 |
struct v4l2_vp9_segmentation *retrace_v4l2_vp9_segmentation_gen(json_object *ctrl_obj) |
| 1676 |
{ |
| 1677 |
struct v4l2_vp9_segmentation *p = (struct v4l2_vp9_segmentation *) calloc(1, sizeof(v4l2_vp9_segmentation)); |
| 1678 |
json_object *v4l2_vp9_segmentation_obj; |
| 1679 |
if (!json_object_object_get_ex(ctrl_obj, "v4l2_vp9_segmentation", &v4l2_vp9_segmentation_obj)) |
| 1680 |
v4l2_vp9_segmentation_obj = ctrl_obj; |
| 1681 |
|
| 1682 |
/* __s16 feature_data[8][4] */ |
| 1683 |
int count_feature_data = 0; |
| 1684 |
json_object *feature_data_obj; |
| 1685 |
if (json_object_object_get_ex(v4l2_vp9_segmentation_obj, "feature_data", &feature_data_obj)) { |
| 1686 |
for (size_t i = 0; i < 8; i++) { |
| 1687 |
for (size_t j = 0; j < 4; j++) { |
| 1688 |
if (json_object_array_get_idx(feature_data_obj, count_feature_data)) |
| 1689 |
p->feature_data[i][j] = (__s16) json_object_get_int(json_object_array_get_idx(feature_data_obj, count_feature_data++)); |
| 1690 |
} |
| 1691 |
} |
| 1692 |
} |
| 1693 |
|
| 1694 |
/* __u8 feature_enabled[8] */ |
| 1695 |
json_object *feature_enabled_obj; |
| 1696 |
if (json_object_object_get_ex(v4l2_vp9_segmentation_obj, "feature_enabled", &feature_enabled_obj)) { |
| 1697 |
for (size_t i = 0; i < 8; i++) { |
| 1698 |
if (json_object_array_get_idx(feature_enabled_obj, i)) |
| 1699 |
p->feature_enabled[i] = (__u8) json_object_get_int(json_object_array_get_idx(feature_enabled_obj, i)); |
| 1700 |
} |
| 1701 |
} |
| 1702 |
|
| 1703 |
/* __u8 tree_probs[7] */ |
| 1704 |
json_object *tree_probs_obj; |
| 1705 |
if (json_object_object_get_ex(v4l2_vp9_segmentation_obj, "tree_probs", &tree_probs_obj)) { |
| 1706 |
for (size_t i = 0; i < 7; i++) { |
| 1707 |
if (json_object_array_get_idx(tree_probs_obj, i)) |
| 1708 |
p->tree_probs[i] = (__u8) json_object_get_int(json_object_array_get_idx(tree_probs_obj, i)); |
| 1709 |
} |
| 1710 |
} |
| 1711 |
|
| 1712 |
/* __u8 pred_probs[3] */ |
| 1713 |
json_object *pred_probs_obj; |
| 1714 |
if (json_object_object_get_ex(v4l2_vp9_segmentation_obj, "pred_probs", &pred_probs_obj)) { |
| 1715 |
for (size_t i = 0; i < 3; i++) { |
| 1716 |
if (json_object_array_get_idx(pred_probs_obj, i)) |
| 1717 |
p->pred_probs[i] = (__u8) json_object_get_int(json_object_array_get_idx(pred_probs_obj, i)); |
| 1718 |
} |
| 1719 |
} |
| 1720 |
|
| 1721 |
json_object *flags_obj; |
| 1722 |
if (json_object_object_get_ex(v4l2_vp9_segmentation_obj, "flags", &flags_obj)) |
| 1723 |
p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_vp9_segmentation_flag_def); |
| 1724 |
|
| 1725 |
return p; |
| 1726 |
} |
| 1727 |
|
| 1728 |
struct v4l2_ctrl_vp9_frame *retrace_v4l2_ctrl_vp9_frame_gen(json_object *ctrl_obj) |
| 1729 |
{ |
| 1730 |
struct v4l2_ctrl_vp9_frame *p = (struct v4l2_ctrl_vp9_frame *) calloc(1, sizeof(v4l2_ctrl_vp9_frame)); |
| 1731 |
json_object *v4l2_ctrl_vp9_frame_obj; |
| 1732 |
if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_vp9_frame", &v4l2_ctrl_vp9_frame_obj)) |
| 1733 |
v4l2_ctrl_vp9_frame_obj = ctrl_obj; |
| 1734 |
|
| 1735 |
/* struct v4l2_vp9_loop_filter lf */ |
| 1736 |
json_object *lf_obj; |
| 1737 |
if (!json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "v4l2_vp9_loop_filter", &lf_obj)) |
| 1738 |
return p; |
| 1739 |
void *lf_ptr = (void *) retrace_v4l2_vp9_loop_filter_gen(lf_obj); |
| 1740 |
p->lf = *static_cast<struct v4l2_vp9_loop_filter*>(lf_ptr); |
| 1741 |
free(lf_ptr); |
| 1742 |
|
| 1743 |
/* struct v4l2_vp9_quantization quant */ |
| 1744 |
json_object *quant_obj; |
| 1745 |
if (!json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "v4l2_vp9_quantization", &quant_obj)) |
| 1746 |
return p; |
| 1747 |
void *quant_ptr = (void *) retrace_v4l2_vp9_quantization_gen(quant_obj); |
| 1748 |
p->quant = *static_cast<struct v4l2_vp9_quantization*>(quant_ptr); |
| 1749 |
free(quant_ptr); |
| 1750 |
|
| 1751 |
/* struct v4l2_vp9_segmentation seg */ |
| 1752 |
json_object *seg_obj; |
| 1753 |
if (!json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "v4l2_vp9_segmentation", &seg_obj)) |
| 1754 |
return p; |
| 1755 |
void *seg_ptr = (void *) retrace_v4l2_vp9_segmentation_gen(seg_obj); |
| 1756 |
p->seg = *static_cast<struct v4l2_vp9_segmentation*>(seg_ptr); |
| 1757 |
free(seg_ptr); |
| 1758 |
|
| 1759 |
json_object *flags_obj; |
| 1760 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "flags", &flags_obj)) |
| 1761 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_vp9_frame_flag_def); |
| 1762 |
|
| 1763 |
json_object *compressed_header_size_obj; |
| 1764 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "compressed_header_size", &compressed_header_size_obj)) |
| 1765 |
p->compressed_header_size = (__u16) json_object_get_int(compressed_header_size_obj); |
| 1766 |
|
| 1767 |
json_object *uncompressed_header_size_obj; |
| 1768 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "uncompressed_header_size", &uncompressed_header_size_obj)) |
| 1769 |
p->uncompressed_header_size = (__u16) json_object_get_int(uncompressed_header_size_obj); |
| 1770 |
|
| 1771 |
json_object *frame_width_minus_1_obj; |
| 1772 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "frame_width_minus_1", &frame_width_minus_1_obj)) |
| 1773 |
p->frame_width_minus_1 = (__u16) json_object_get_int(frame_width_minus_1_obj); |
| 1774 |
|
| 1775 |
json_object *frame_height_minus_1_obj; |
| 1776 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "frame_height_minus_1", &frame_height_minus_1_obj)) |
| 1777 |
p->frame_height_minus_1 = (__u16) json_object_get_int(frame_height_minus_1_obj); |
| 1778 |
|
| 1779 |
json_object *render_width_minus_1_obj; |
| 1780 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "render_width_minus_1", &render_width_minus_1_obj)) |
| 1781 |
p->render_width_minus_1 = (__u16) json_object_get_int(render_width_minus_1_obj); |
| 1782 |
|
| 1783 |
json_object *render_height_minus_1_obj; |
| 1784 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "render_height_minus_1", &render_height_minus_1_obj)) |
| 1785 |
p->render_height_minus_1 = (__u16) json_object_get_int(render_height_minus_1_obj); |
| 1786 |
|
| 1787 |
json_object *last_frame_ts_obj; |
| 1788 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "last_frame_ts", &last_frame_ts_obj)) |
| 1789 |
p->last_frame_ts = (__u64) json_object_get_uint64(last_frame_ts_obj); |
| 1790 |
|
| 1791 |
json_object *golden_frame_ts_obj; |
| 1792 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "golden_frame_ts", &golden_frame_ts_obj)) |
| 1793 |
p->golden_frame_ts = (__u64) json_object_get_uint64(golden_frame_ts_obj); |
| 1794 |
|
| 1795 |
json_object *alt_frame_ts_obj; |
| 1796 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "alt_frame_ts", &alt_frame_ts_obj)) |
| 1797 |
p->alt_frame_ts = (__u64) json_object_get_uint64(alt_frame_ts_obj); |
| 1798 |
|
| 1799 |
json_object *ref_frame_sign_bias_obj; |
| 1800 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "ref_frame_sign_bias", &ref_frame_sign_bias_obj)) |
| 1801 |
p->ref_frame_sign_bias = (__u8) json_object_get_int(ref_frame_sign_bias_obj); |
| 1802 |
|
| 1803 |
json_object *reset_frame_context_obj; |
| 1804 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "reset_frame_context", &reset_frame_context_obj)) |
| 1805 |
p->reset_frame_context = (__u8) json_object_get_int(reset_frame_context_obj); |
| 1806 |
|
| 1807 |
json_object *frame_context_idx_obj; |
| 1808 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "frame_context_idx", &frame_context_idx_obj)) |
| 1809 |
p->frame_context_idx = (__u8) json_object_get_int(frame_context_idx_obj); |
| 1810 |
|
| 1811 |
json_object *profile_obj; |
| 1812 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "profile", &profile_obj)) |
| 1813 |
p->profile = (__u8) json_object_get_int(profile_obj); |
| 1814 |
|
| 1815 |
json_object *bit_depth_obj; |
| 1816 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "bit_depth", &bit_depth_obj)) |
| 1817 |
p->bit_depth = (__u8) json_object_get_int(bit_depth_obj); |
| 1818 |
|
| 1819 |
json_object *interpolation_filter_obj; |
| 1820 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "interpolation_filter", &interpolation_filter_obj)) |
| 1821 |
p->interpolation_filter = (__u8) json_object_get_int(interpolation_filter_obj); |
| 1822 |
|
| 1823 |
json_object *tile_cols_log2_obj; |
| 1824 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "tile_cols_log2", &tile_cols_log2_obj)) |
| 1825 |
p->tile_cols_log2 = (__u8) json_object_get_int(tile_cols_log2_obj); |
| 1826 |
|
| 1827 |
json_object *tile_rows_log2_obj; |
| 1828 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "tile_rows_log2", &tile_rows_log2_obj)) |
| 1829 |
p->tile_rows_log2 = (__u8) json_object_get_int(tile_rows_log2_obj); |
| 1830 |
|
| 1831 |
json_object *reference_mode_obj; |
| 1832 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_frame_obj, "reference_mode", &reference_mode_obj)) |
| 1833 |
p->reference_mode = (__u8) json_object_get_int(reference_mode_obj); |
| 1834 |
|
| 1835 |
return p; |
| 1836 |
} |
| 1837 |
|
| 1838 |
struct v4l2_vp9_mv_probs *retrace_v4l2_vp9_mv_probs_gen(json_object *ctrl_obj) |
| 1839 |
{ |
| 1840 |
struct v4l2_vp9_mv_probs *p = (struct v4l2_vp9_mv_probs *) calloc(1, sizeof(v4l2_vp9_mv_probs)); |
| 1841 |
json_object *v4l2_vp9_mv_probs_obj; |
| 1842 |
if (!json_object_object_get_ex(ctrl_obj, "v4l2_vp9_mv_probs", &v4l2_vp9_mv_probs_obj)) |
| 1843 |
v4l2_vp9_mv_probs_obj = ctrl_obj; |
| 1844 |
|
| 1845 |
/* __u8 joint[3] */ |
| 1846 |
json_object *joint_obj; |
| 1847 |
if (json_object_object_get_ex(v4l2_vp9_mv_probs_obj, "joint", &joint_obj)) { |
| 1848 |
for (size_t i = 0; i < 3; i++) { |
| 1849 |
if (json_object_array_get_idx(joint_obj, i)) |
| 1850 |
p->joint[i] = (__u8) json_object_get_int(json_object_array_get_idx(joint_obj, i)); |
| 1851 |
} |
| 1852 |
} |
| 1853 |
|
| 1854 |
/* __u8 sign[2] */ |
| 1855 |
json_object *sign_obj; |
| 1856 |
if (json_object_object_get_ex(v4l2_vp9_mv_probs_obj, "sign", &sign_obj)) { |
| 1857 |
for (size_t i = 0; i < 2; i++) { |
| 1858 |
if (json_object_array_get_idx(sign_obj, i)) |
| 1859 |
p->sign[i] = (__u8) json_object_get_int(json_object_array_get_idx(sign_obj, i)); |
| 1860 |
} |
| 1861 |
} |
| 1862 |
|
| 1863 |
/* __u8 classes[2][10] */ |
| 1864 |
int count_classes = 0; |
| 1865 |
json_object *classes_obj; |
| 1866 |
if (json_object_object_get_ex(v4l2_vp9_mv_probs_obj, "classes", &classes_obj)) { |
| 1867 |
for (size_t i = 0; i < 2; i++) { |
| 1868 |
for (size_t j = 0; j < 10; j++) { |
| 1869 |
if (json_object_array_get_idx(classes_obj, count_classes)) |
| 1870 |
p->classes[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(classes_obj, count_classes++)); |
| 1871 |
} |
| 1872 |
} |
| 1873 |
} |
| 1874 |
|
| 1875 |
/* __u8 class0_bit[2] */ |
| 1876 |
json_object *class0_bit_obj; |
| 1877 |
if (json_object_object_get_ex(v4l2_vp9_mv_probs_obj, "class0_bit", &class0_bit_obj)) { |
| 1878 |
for (size_t i = 0; i < 2; i++) { |
| 1879 |
if (json_object_array_get_idx(class0_bit_obj, i)) |
| 1880 |
p->class0_bit[i] = (__u8) json_object_get_int(json_object_array_get_idx(class0_bit_obj, i)); |
| 1881 |
} |
| 1882 |
} |
| 1883 |
|
| 1884 |
/* __u8 bits[2][10] */ |
| 1885 |
int count_bits = 0; |
| 1886 |
json_object *bits_obj; |
| 1887 |
if (json_object_object_get_ex(v4l2_vp9_mv_probs_obj, "bits", &bits_obj)) { |
| 1888 |
for (size_t i = 0; i < 2; i++) { |
| 1889 |
for (size_t j = 0; j < 10; j++) { |
| 1890 |
if (json_object_array_get_idx(bits_obj, count_bits)) |
| 1891 |
p->bits[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(bits_obj, count_bits++)); |
| 1892 |
} |
| 1893 |
} |
| 1894 |
} |
| 1895 |
|
| 1896 |
/* __u8 class0_fr[2][2][3] */ |
| 1897 |
int count_class0_fr = 0; |
| 1898 |
json_object *class0_fr_obj; |
| 1899 |
if (json_object_object_get_ex(v4l2_vp9_mv_probs_obj, "class0_fr", &class0_fr_obj)) { |
| 1900 |
for (size_t i = 0; i < 2; i++) { |
| 1901 |
for (size_t j = 0; j < 2; j++) { |
| 1902 |
for (size_t k = 0; k < 3; k++) { |
| 1903 |
if (json_object_array_get_idx(class0_fr_obj, count_class0_fr)) |
| 1904 |
p->class0_fr[i][j][k] = (__u8) json_object_get_int(json_object_array_get_idx(class0_fr_obj, count_class0_fr++)); |
| 1905 |
} |
| 1906 |
} |
| 1907 |
} |
| 1908 |
} |
| 1909 |
|
| 1910 |
/* __u8 fr[2][3] */ |
| 1911 |
int count_fr = 0; |
| 1912 |
json_object *fr_obj; |
| 1913 |
if (json_object_object_get_ex(v4l2_vp9_mv_probs_obj, "fr", &fr_obj)) { |
| 1914 |
for (size_t i = 0; i < 2; i++) { |
| 1915 |
for (size_t j = 0; j < 3; j++) { |
| 1916 |
if (json_object_array_get_idx(fr_obj, count_fr)) |
| 1917 |
p->fr[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(fr_obj, count_fr++)); |
| 1918 |
} |
| 1919 |
} |
| 1920 |
} |
| 1921 |
|
| 1922 |
/* __u8 class0_hp[2] */ |
| 1923 |
json_object *class0_hp_obj; |
| 1924 |
if (json_object_object_get_ex(v4l2_vp9_mv_probs_obj, "class0_hp", &class0_hp_obj)) { |
| 1925 |
for (size_t i = 0; i < 2; i++) { |
| 1926 |
if (json_object_array_get_idx(class0_hp_obj, i)) |
| 1927 |
p->class0_hp[i] = (__u8) json_object_get_int(json_object_array_get_idx(class0_hp_obj, i)); |
| 1928 |
} |
| 1929 |
} |
| 1930 |
|
| 1931 |
/* __u8 hp[2] */ |
| 1932 |
json_object *hp_obj; |
| 1933 |
if (json_object_object_get_ex(v4l2_vp9_mv_probs_obj, "hp", &hp_obj)) { |
| 1934 |
for (size_t i = 0; i < 2; i++) { |
| 1935 |
if (json_object_array_get_idx(hp_obj, i)) |
| 1936 |
p->hp[i] = (__u8) json_object_get_int(json_object_array_get_idx(hp_obj, i)); |
| 1937 |
} |
| 1938 |
} |
| 1939 |
|
| 1940 |
return p; |
| 1941 |
} |
| 1942 |
|
| 1943 |
struct v4l2_ctrl_vp9_compressed_hdr *retrace_v4l2_ctrl_vp9_compressed_hdr_gen(json_object *ctrl_obj) |
| 1944 |
{ |
| 1945 |
struct v4l2_ctrl_vp9_compressed_hdr *p = (struct v4l2_ctrl_vp9_compressed_hdr *) calloc(1, sizeof(v4l2_ctrl_vp9_compressed_hdr)); |
| 1946 |
json_object *v4l2_ctrl_vp9_compressed_hdr_obj; |
| 1947 |
if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_vp9_compressed_hdr", &v4l2_ctrl_vp9_compressed_hdr_obj)) |
| 1948 |
v4l2_ctrl_vp9_compressed_hdr_obj = ctrl_obj; |
| 1949 |
|
| 1950 |
json_object *tx_mode_obj; |
| 1951 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "tx_mode", &tx_mode_obj)) |
| 1952 |
p->tx_mode = (__u8) json_object_get_int(tx_mode_obj); |
| 1953 |
|
| 1954 |
/* __u8 tx8[2][1] */ |
| 1955 |
int count_tx8 = 0; |
| 1956 |
json_object *tx8_obj; |
| 1957 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "tx8", &tx8_obj)) { |
| 1958 |
for (size_t i = 0; i < 2; i++) { |
| 1959 |
for (size_t j = 0; j < 1; j++) { |
| 1960 |
if (json_object_array_get_idx(tx8_obj, count_tx8)) |
| 1961 |
p->tx8[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(tx8_obj, count_tx8++)); |
| 1962 |
} |
| 1963 |
} |
| 1964 |
} |
| 1965 |
|
| 1966 |
/* __u8 tx16[2][2] */ |
| 1967 |
int count_tx16 = 0; |
| 1968 |
json_object *tx16_obj; |
| 1969 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "tx16", &tx16_obj)) { |
| 1970 |
for (size_t i = 0; i < 2; i++) { |
| 1971 |
for (size_t j = 0; j < 2; j++) { |
| 1972 |
if (json_object_array_get_idx(tx16_obj, count_tx16)) |
| 1973 |
p->tx16[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(tx16_obj, count_tx16++)); |
| 1974 |
} |
| 1975 |
} |
| 1976 |
} |
| 1977 |
|
| 1978 |
/* __u8 tx32[2][3] */ |
| 1979 |
int count_tx32 = 0; |
| 1980 |
json_object *tx32_obj; |
| 1981 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "tx32", &tx32_obj)) { |
| 1982 |
for (size_t i = 0; i < 2; i++) { |
| 1983 |
for (size_t j = 0; j < 3; j++) { |
| 1984 |
if (json_object_array_get_idx(tx32_obj, count_tx32)) |
| 1985 |
p->tx32[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(tx32_obj, count_tx32++)); |
| 1986 |
} |
| 1987 |
} |
| 1988 |
} |
| 1989 |
|
| 1990 |
/* __u8 coef[4][2][2][6][6][3] */ |
| 1991 |
int count_coef = 0; |
| 1992 |
json_object *coef_obj; |
| 1993 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "coef", &coef_obj)) { |
| 1994 |
for (size_t i = 0; i < 4; i++) { |
| 1995 |
for (size_t j = 0; j < 2; j++) { |
| 1996 |
for (size_t k = 0; k < 2; k++) { |
| 1997 |
for (size_t l = 0; l < 6; l++) { |
| 1998 |
for (size_t m = 0; m < 6; m++) { |
| 1999 |
for (size_t n = 0; n < 3; n++) { |
| 2000 |
if (json_object_array_get_idx(coef_obj, count_coef)) |
| 2001 |
p->coef[i][j][k][l][m][n] = (__u8) json_object_get_int(json_object_array_get_idx(coef_obj, count_coef++)); |
| 2002 |
} |
| 2003 |
} |
| 2004 |
} |
| 2005 |
} |
| 2006 |
} |
| 2007 |
} |
| 2008 |
} |
| 2009 |
|
| 2010 |
/* __u8 skip[3] */ |
| 2011 |
json_object *skip_obj; |
| 2012 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "skip", &skip_obj)) { |
| 2013 |
for (size_t i = 0; i < 3; i++) { |
| 2014 |
if (json_object_array_get_idx(skip_obj, i)) |
| 2015 |
p->skip[i] = (__u8) json_object_get_int(json_object_array_get_idx(skip_obj, i)); |
| 2016 |
} |
| 2017 |
} |
| 2018 |
|
| 2019 |
/* __u8 inter_mode[7][3] */ |
| 2020 |
int count_inter_mode = 0; |
| 2021 |
json_object *inter_mode_obj; |
| 2022 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "inter_mode", &inter_mode_obj)) { |
| 2023 |
for (size_t i = 0; i < 7; i++) { |
| 2024 |
for (size_t j = 0; j < 3; j++) { |
| 2025 |
if (json_object_array_get_idx(inter_mode_obj, count_inter_mode)) |
| 2026 |
p->inter_mode[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(inter_mode_obj, count_inter_mode++)); |
| 2027 |
} |
| 2028 |
} |
| 2029 |
} |
| 2030 |
|
| 2031 |
/* __u8 interp_filter[4][2] */ |
| 2032 |
int count_interp_filter = 0; |
| 2033 |
json_object *interp_filter_obj; |
| 2034 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "interp_filter", &interp_filter_obj)) { |
| 2035 |
for (size_t i = 0; i < 4; i++) { |
| 2036 |
for (size_t j = 0; j < 2; j++) { |
| 2037 |
if (json_object_array_get_idx(interp_filter_obj, count_interp_filter)) |
| 2038 |
p->interp_filter[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(interp_filter_obj, count_interp_filter++)); |
| 2039 |
} |
| 2040 |
} |
| 2041 |
} |
| 2042 |
|
| 2043 |
/* __u8 is_inter[4] */ |
| 2044 |
json_object *is_inter_obj; |
| 2045 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "is_inter", &is_inter_obj)) { |
| 2046 |
for (size_t i = 0; i < 4; i++) { |
| 2047 |
if (json_object_array_get_idx(is_inter_obj, i)) |
| 2048 |
p->is_inter[i] = (__u8) json_object_get_int(json_object_array_get_idx(is_inter_obj, i)); |
| 2049 |
} |
| 2050 |
} |
| 2051 |
|
| 2052 |
/* __u8 comp_mode[5] */ |
| 2053 |
json_object *comp_mode_obj; |
| 2054 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "comp_mode", &comp_mode_obj)) { |
| 2055 |
for (size_t i = 0; i < 5; i++) { |
| 2056 |
if (json_object_array_get_idx(comp_mode_obj, i)) |
| 2057 |
p->comp_mode[i] = (__u8) json_object_get_int(json_object_array_get_idx(comp_mode_obj, i)); |
| 2058 |
} |
| 2059 |
} |
| 2060 |
|
| 2061 |
/* __u8 single_ref[5][2] */ |
| 2062 |
int count_single_ref = 0; |
| 2063 |
json_object *single_ref_obj; |
| 2064 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "single_ref", &single_ref_obj)) { |
| 2065 |
for (size_t i = 0; i < 5; i++) { |
| 2066 |
for (size_t j = 0; j < 2; j++) { |
| 2067 |
if (json_object_array_get_idx(single_ref_obj, count_single_ref)) |
| 2068 |
p->single_ref[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(single_ref_obj, count_single_ref++)); |
| 2069 |
} |
| 2070 |
} |
| 2071 |
} |
| 2072 |
|
| 2073 |
/* __u8 comp_ref[5] */ |
| 2074 |
json_object *comp_ref_obj; |
| 2075 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "comp_ref", &comp_ref_obj)) { |
| 2076 |
for (size_t i = 0; i < 5; i++) { |
| 2077 |
if (json_object_array_get_idx(comp_ref_obj, i)) |
| 2078 |
p->comp_ref[i] = (__u8) json_object_get_int(json_object_array_get_idx(comp_ref_obj, i)); |
| 2079 |
} |
| 2080 |
} |
| 2081 |
|
| 2082 |
/* __u8 y_mode[4][9] */ |
| 2083 |
int count_y_mode = 0; |
| 2084 |
json_object *y_mode_obj; |
| 2085 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "y_mode", &y_mode_obj)) { |
| 2086 |
for (size_t i = 0; i < 4; i++) { |
| 2087 |
for (size_t j = 0; j < 9; j++) { |
| 2088 |
if (json_object_array_get_idx(y_mode_obj, count_y_mode)) |
| 2089 |
p->y_mode[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(y_mode_obj, count_y_mode++)); |
| 2090 |
} |
| 2091 |
} |
| 2092 |
} |
| 2093 |
|
| 2094 |
/* __u8 uv_mode[10][9] */ |
| 2095 |
int count_uv_mode = 0; |
| 2096 |
json_object *uv_mode_obj; |
| 2097 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "uv_mode", &uv_mode_obj)) { |
| 2098 |
for (size_t i = 0; i < 10; i++) { |
| 2099 |
for (size_t j = 0; j < 9; j++) { |
| 2100 |
if (json_object_array_get_idx(uv_mode_obj, count_uv_mode)) |
| 2101 |
p->uv_mode[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(uv_mode_obj, count_uv_mode++)); |
| 2102 |
} |
| 2103 |
} |
| 2104 |
} |
| 2105 |
|
| 2106 |
/* __u8 partition[16][3] */ |
| 2107 |
int count_partition = 0; |
| 2108 |
json_object *partition_obj; |
| 2109 |
if (json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "partition", &partition_obj)) { |
| 2110 |
for (size_t i = 0; i < 16; i++) { |
| 2111 |
for (size_t j = 0; j < 3; j++) { |
| 2112 |
if (json_object_array_get_idx(partition_obj, count_partition)) |
| 2113 |
p->partition[i][j] = (__u8) json_object_get_int(json_object_array_get_idx(partition_obj, count_partition++)); |
| 2114 |
} |
| 2115 |
} |
| 2116 |
} |
| 2117 |
|
| 2118 |
/* struct v4l2_vp9_mv_probs mv */ |
| 2119 |
json_object *mv_obj; |
| 2120 |
if (!json_object_object_get_ex(v4l2_ctrl_vp9_compressed_hdr_obj, "v4l2_vp9_mv_probs", &mv_obj)) |
| 2121 |
return p; |
| 2122 |
void *mv_ptr = (void *) retrace_v4l2_vp9_mv_probs_gen(mv_obj); |
| 2123 |
p->mv = *static_cast<struct v4l2_vp9_mv_probs*>(mv_ptr); |
| 2124 |
free(mv_ptr); |
| 2125 |
|
| 2126 |
return p; |
| 2127 |
} |
| 2128 |
|
| 2129 |
struct v4l2_ctrl_av1_sequence *retrace_v4l2_ctrl_av1_sequence_gen(json_object *ctrl_obj) |
| 2130 |
{ |
| 2131 |
struct v4l2_ctrl_av1_sequence *p = (struct v4l2_ctrl_av1_sequence *) calloc(1, sizeof(v4l2_ctrl_av1_sequence)); |
| 2132 |
json_object *v4l2_ctrl_av1_sequence_obj; |
| 2133 |
if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_av1_sequence", &v4l2_ctrl_av1_sequence_obj)) |
| 2134 |
v4l2_ctrl_av1_sequence_obj = ctrl_obj; |
| 2135 |
|
| 2136 |
json_object *flags_obj; |
| 2137 |
if (json_object_object_get_ex(v4l2_ctrl_av1_sequence_obj, "flags", &flags_obj)) |
| 2138 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_av1_sequence_flag_def); |
| 2139 |
|
| 2140 |
json_object *seq_profile_obj; |
| 2141 |
if (json_object_object_get_ex(v4l2_ctrl_av1_sequence_obj, "seq_profile", &seq_profile_obj)) |
| 2142 |
p->seq_profile = (__u8) json_object_get_int(seq_profile_obj); |
| 2143 |
|
| 2144 |
json_object *order_hint_bits_obj; |
| 2145 |
if (json_object_object_get_ex(v4l2_ctrl_av1_sequence_obj, "order_hint_bits", &order_hint_bits_obj)) |
| 2146 |
p->order_hint_bits = (__u8) json_object_get_int(order_hint_bits_obj); |
| 2147 |
|
| 2148 |
json_object *bit_depth_obj; |
| 2149 |
if (json_object_object_get_ex(v4l2_ctrl_av1_sequence_obj, "bit_depth", &bit_depth_obj)) |
| 2150 |
p->bit_depth = (__u8) json_object_get_int(bit_depth_obj); |
| 2151 |
|
| 2152 |
json_object *max_frame_width_minus_1_obj; |
| 2153 |
if (json_object_object_get_ex(v4l2_ctrl_av1_sequence_obj, "max_frame_width_minus_1", &max_frame_width_minus_1_obj)) |
| 2154 |
p->max_frame_width_minus_1 = (__u16) json_object_get_int(max_frame_width_minus_1_obj); |
| 2155 |
|
| 2156 |
json_object *max_frame_height_minus_1_obj; |
| 2157 |
if (json_object_object_get_ex(v4l2_ctrl_av1_sequence_obj, "max_frame_height_minus_1", &max_frame_height_minus_1_obj)) |
| 2158 |
p->max_frame_height_minus_1 = (__u16) json_object_get_int(max_frame_height_minus_1_obj); |
| 2159 |
|
| 2160 |
return p; |
| 2161 |
} |
| 2162 |
|
| 2163 |
struct v4l2_ctrl_av1_tile_group_entry *retrace_v4l2_ctrl_av1_tile_group_entry_gen(json_object *ctrl_obj) |
| 2164 |
{ |
| 2165 |
struct v4l2_ctrl_av1_tile_group_entry *p = (struct v4l2_ctrl_av1_tile_group_entry *) calloc(1, sizeof(v4l2_ctrl_av1_tile_group_entry)); |
| 2166 |
json_object *v4l2_ctrl_av1_tile_group_entry_obj; |
| 2167 |
if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_av1_tile_group_entry", &v4l2_ctrl_av1_tile_group_entry_obj)) |
| 2168 |
v4l2_ctrl_av1_tile_group_entry_obj = ctrl_obj; |
| 2169 |
|
| 2170 |
json_object *tile_offset_obj; |
| 2171 |
if (json_object_object_get_ex(v4l2_ctrl_av1_tile_group_entry_obj, "tile_offset", &tile_offset_obj)) |
| 2172 |
p->tile_offset = (__u32) json_object_get_int64(tile_offset_obj); |
| 2173 |
|
| 2174 |
json_object *tile_size_obj; |
| 2175 |
if (json_object_object_get_ex(v4l2_ctrl_av1_tile_group_entry_obj, "tile_size", &tile_size_obj)) |
| 2176 |
p->tile_size = (__u32) json_object_get_int64(tile_size_obj); |
| 2177 |
|
| 2178 |
json_object *tile_row_obj; |
| 2179 |
if (json_object_object_get_ex(v4l2_ctrl_av1_tile_group_entry_obj, "tile_row", &tile_row_obj)) |
| 2180 |
p->tile_row = (__u32) json_object_get_int64(tile_row_obj); |
| 2181 |
|
| 2182 |
json_object *tile_col_obj; |
| 2183 |
if (json_object_object_get_ex(v4l2_ctrl_av1_tile_group_entry_obj, "tile_col", &tile_col_obj)) |
| 2184 |
p->tile_col = (__u32) json_object_get_int64(tile_col_obj); |
| 2185 |
|
| 2186 |
return p; |
| 2187 |
} |
| 2188 |
|
| 2189 |
struct v4l2_av1_global_motion *retrace_v4l2_av1_global_motion_gen(json_object *ctrl_obj) |
| 2190 |
{ |
| 2191 |
struct v4l2_av1_global_motion *p = (struct v4l2_av1_global_motion *) calloc(1, sizeof(v4l2_av1_global_motion)); |
| 2192 |
json_object *v4l2_av1_global_motion_obj; |
| 2193 |
if (!json_object_object_get_ex(ctrl_obj, "v4l2_av1_global_motion", &v4l2_av1_global_motion_obj)) |
| 2194 |
v4l2_av1_global_motion_obj = ctrl_obj; |
| 2195 |
|
| 2196 |
/* __u8 flags[V4L2_AV1_TOTAL_REFS_PER_FRAME] */ |
| 2197 |
json_object *flags_obj; |
| 2198 |
if (json_object_object_get_ex(v4l2_av1_global_motion_obj, "flags", &flags_obj)) { |
| 2199 |
for (size_t i = 0; i < V4L2_AV1_TOTAL_REFS_PER_FRAME; i++) { |
| 2200 |
if (json_object_array_get_idx(flags_obj, i)) |
| 2201 |
p->flags[i] = (__u8) json_object_get_int(json_object_array_get_idx(flags_obj, i)); |
| 2202 |
} |
| 2203 |
} |
| 2204 |
|
| 2205 |
/* enum v4l2_av1_warp_model type[V4L2_AV1_TOTAL_REFS_PER_FRAME] */ |
| 2206 |
json_object *type_obj; |
| 2207 |
if (json_object_object_get_ex(v4l2_av1_global_motion_obj, "type", &type_obj)) { |
| 2208 |
for (size_t i = 0; i < V4L2_AV1_TOTAL_REFS_PER_FRAME; i++) { |
| 2209 |
if (json_object_array_get_idx(type_obj, i)) |
| 2210 |
p->type[i] = (v4l2_av1_warp_model) json_object_get_int(json_object_array_get_idx(type_obj, i)); |
| 2211 |
} |
| 2212 |
} |
| 2213 |
|
| 2214 |
/* __s32 params[V4L2_AV1_TOTAL_REFS_PER_FRAME][6] */ |
| 2215 |
int count_params = 0; |
| 2216 |
json_object *params_obj; |
| 2217 |
if (json_object_object_get_ex(v4l2_av1_global_motion_obj, "params", ¶ms_obj)) { |
| 2218 |
for (size_t i = 0; i < V4L2_AV1_TOTAL_REFS_PER_FRAME; i++) { |
| 2219 |
for (size_t j = 0; j < 6; j++) { |
| 2220 |
if (json_object_array_get_idx(params_obj, count_params)) |
| 2221 |
p->params[i][j] = (__s32) json_object_get_int(json_object_array_get_idx(params_obj, count_params++)); |
| 2222 |
} |
| 2223 |
} |
| 2224 |
} |
| 2225 |
|
| 2226 |
json_object *invalid_obj; |
| 2227 |
if (json_object_object_get_ex(v4l2_av1_global_motion_obj, "invalid", &invalid_obj)) |
| 2228 |
p->invalid = (__u8) json_object_get_int(invalid_obj); |
| 2229 |
|
| 2230 |
return p; |
| 2231 |
} |
| 2232 |
|
| 2233 |
struct v4l2_av1_loop_restoration *retrace_v4l2_av1_loop_restoration_gen(json_object *ctrl_obj) |
| 2234 |
{ |
| 2235 |
struct v4l2_av1_loop_restoration *p = (struct v4l2_av1_loop_restoration *) calloc(1, sizeof(v4l2_av1_loop_restoration)); |
| 2236 |
json_object *v4l2_av1_loop_restoration_obj; |
| 2237 |
if (!json_object_object_get_ex(ctrl_obj, "v4l2_av1_loop_restoration", &v4l2_av1_loop_restoration_obj)) |
| 2238 |
v4l2_av1_loop_restoration_obj = ctrl_obj; |
| 2239 |
|
| 2240 |
json_object *flags_obj; |
| 2241 |
if (json_object_object_get_ex(v4l2_av1_loop_restoration_obj, "flags", &flags_obj)) |
| 2242 |
p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_av1_loop_restoration_flag_def); |
| 2243 |
|
| 2244 |
json_object *lr_unit_shift_obj; |
| 2245 |
if (json_object_object_get_ex(v4l2_av1_loop_restoration_obj, "lr_unit_shift", &lr_unit_shift_obj)) |
| 2246 |
p->lr_unit_shift = (__u8) json_object_get_int(lr_unit_shift_obj); |
| 2247 |
|
| 2248 |
json_object *lr_uv_shift_obj; |
| 2249 |
if (json_object_object_get_ex(v4l2_av1_loop_restoration_obj, "lr_uv_shift", &lr_uv_shift_obj)) |
| 2250 |
p->lr_uv_shift = (__u8) json_object_get_int(lr_uv_shift_obj); |
| 2251 |
|
| 2252 |
/* enum v4l2_av1_frame_restoration_type frame_restoration_type[V4L2_AV1_NUM_PLANES_MAX] */ |
| 2253 |
json_object *frame_restoration_type_obj; |
| 2254 |
if (json_object_object_get_ex(v4l2_av1_loop_restoration_obj, "frame_restoration_type", &frame_restoration_type_obj)) { |
| 2255 |
for (size_t i = 0; i < V4L2_AV1_NUM_PLANES_MAX; i++) { |
| 2256 |
if (json_object_array_get_idx(frame_restoration_type_obj, i)) |
| 2257 |
p->frame_restoration_type[i] = (v4l2_av1_frame_restoration_type) json_object_get_int(json_object_array_get_idx(frame_restoration_type_obj, i)); |
| 2258 |
} |
| 2259 |
} |
| 2260 |
|
| 2261 |
/* __u32 loop_restoration_size[V4L2_AV1_MAX_NUM_PLANES] */ |
| 2262 |
json_object *loop_restoration_size_obj; |
| 2263 |
if (json_object_object_get_ex(v4l2_av1_loop_restoration_obj, "loop_restoration_size", &loop_restoration_size_obj)) { |
| 2264 |
for (size_t i = 0; i < V4L2_AV1_MAX_NUM_PLANES; i++) { |
| 2265 |
if (json_object_array_get_idx(loop_restoration_size_obj, i)) |
| 2266 |
p->loop_restoration_size[i] = (__u32) json_object_get_int64(json_object_array_get_idx(loop_restoration_size_obj, i)); |
| 2267 |
} |
| 2268 |
} |
| 2269 |
|
| 2270 |
return p; |
| 2271 |
} |
| 2272 |
|
| 2273 |
struct v4l2_av1_cdef *retrace_v4l2_av1_cdef_gen(json_object *ctrl_obj) |
| 2274 |
{ |
| 2275 |
struct v4l2_av1_cdef *p = (struct v4l2_av1_cdef *) calloc(1, sizeof(v4l2_av1_cdef)); |
| 2276 |
json_object *v4l2_av1_cdef_obj; |
| 2277 |
if (!json_object_object_get_ex(ctrl_obj, "v4l2_av1_cdef", &v4l2_av1_cdef_obj)) |
| 2278 |
v4l2_av1_cdef_obj = ctrl_obj; |
| 2279 |
|
| 2280 |
json_object *damping_minus_3_obj; |
| 2281 |
if (json_object_object_get_ex(v4l2_av1_cdef_obj, "damping_minus_3", &damping_minus_3_obj)) |
| 2282 |
p->damping_minus_3 = (__u8) json_object_get_int(damping_minus_3_obj); |
| 2283 |
|
| 2284 |
json_object *bits_obj; |
| 2285 |
if (json_object_object_get_ex(v4l2_av1_cdef_obj, "bits", &bits_obj)) |
| 2286 |
p->bits = (__u8) json_object_get_int(bits_obj); |
| 2287 |
|
| 2288 |
/* __u8 y_pri_strength[V4L2_AV1_CDEF_MAX] */ |
| 2289 |
json_object *y_pri_strength_obj; |
| 2290 |
if (json_object_object_get_ex(v4l2_av1_cdef_obj, "y_pri_strength", &y_pri_strength_obj)) { |
| 2291 |
for (size_t i = 0; i < V4L2_AV1_CDEF_MAX; i++) { |
| 2292 |
if (json_object_array_get_idx(y_pri_strength_obj, i)) |
| 2293 |
p->y_pri_strength[i] = (__u8) json_object_get_int(json_object_array_get_idx(y_pri_strength_obj, i)); |
| 2294 |
} |
| 2295 |
} |
| 2296 |
|
| 2297 |
/* __u8 y_sec_strength[V4L2_AV1_CDEF_MAX] */ |
| 2298 |
json_object *y_sec_strength_obj; |
| 2299 |
if (json_object_object_get_ex(v4l2_av1_cdef_obj, "y_sec_strength", &y_sec_strength_obj)) { |
| 2300 |
for (size_t i = 0; i < V4L2_AV1_CDEF_MAX; i++) { |
| 2301 |
if (json_object_array_get_idx(y_sec_strength_obj, i)) |
| 2302 |
p->y_sec_strength[i] = (__u8) json_object_get_int(json_object_array_get_idx(y_sec_strength_obj, i)); |
| 2303 |
} |
| 2304 |
} |
| 2305 |
|
| 2306 |
/* __u8 uv_pri_strength[V4L2_AV1_CDEF_MAX] */ |
| 2307 |
json_object *uv_pri_strength_obj; |
| 2308 |
if (json_object_object_get_ex(v4l2_av1_cdef_obj, "uv_pri_strength", &uv_pri_strength_obj)) { |
| 2309 |
for (size_t i = 0; i < V4L2_AV1_CDEF_MAX; i++) { |
| 2310 |
if (json_object_array_get_idx(uv_pri_strength_obj, i)) |
| 2311 |
p->uv_pri_strength[i] = (__u8) json_object_get_int(json_object_array_get_idx(uv_pri_strength_obj, i)); |
| 2312 |
} |
| 2313 |
} |
| 2314 |
|
| 2315 |
/* __u8 uv_sec_strength[V4L2_AV1_CDEF_MAX] */ |
| 2316 |
json_object *uv_sec_strength_obj; |
| 2317 |
if (json_object_object_get_ex(v4l2_av1_cdef_obj, "uv_sec_strength", &uv_sec_strength_obj)) { |
| 2318 |
for (size_t i = 0; i < V4L2_AV1_CDEF_MAX; i++) { |
| 2319 |
if (json_object_array_get_idx(uv_sec_strength_obj, i)) |
| 2320 |
p->uv_sec_strength[i] = (__u8) json_object_get_int(json_object_array_get_idx(uv_sec_strength_obj, i)); |
| 2321 |
} |
| 2322 |
} |
| 2323 |
|
| 2324 |
return p; |
| 2325 |
} |
| 2326 |
|
| 2327 |
struct v4l2_av1_segmentation *retrace_v4l2_av1_segmentation_gen(json_object *ctrl_obj) |
| 2328 |
{ |
| 2329 |
struct v4l2_av1_segmentation *p = (struct v4l2_av1_segmentation *) calloc(1, sizeof(v4l2_av1_segmentation)); |
| 2330 |
json_object *v4l2_av1_segmentation_obj; |
| 2331 |
if (!json_object_object_get_ex(ctrl_obj, "v4l2_av1_segmentation", &v4l2_av1_segmentation_obj)) |
| 2332 |
v4l2_av1_segmentation_obj = ctrl_obj; |
| 2333 |
|
| 2334 |
json_object *flags_obj; |
| 2335 |
if (json_object_object_get_ex(v4l2_av1_segmentation_obj, "flags", &flags_obj)) |
| 2336 |
p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_av1_segmentation_flag_def); |
| 2337 |
|
| 2338 |
json_object *last_active_seg_id_obj; |
| 2339 |
if (json_object_object_get_ex(v4l2_av1_segmentation_obj, "last_active_seg_id", &last_active_seg_id_obj)) |
| 2340 |
p->last_active_seg_id = (__u8) json_object_get_int(last_active_seg_id_obj); |
| 2341 |
|
| 2342 |
/* __u8 feature_enabled[V4L2_AV1_MAX_SEGMENTS] */ |
| 2343 |
json_object *feature_enabled_obj; |
| 2344 |
if (json_object_object_get_ex(v4l2_av1_segmentation_obj, "feature_enabled", &feature_enabled_obj)) { |
| 2345 |
for (size_t i = 0; i < V4L2_AV1_MAX_SEGMENTS; i++) { |
| 2346 |
if (json_object_array_get_idx(feature_enabled_obj, i)) |
| 2347 |
p->feature_enabled[i] = (__u8) json_object_get_int(json_object_array_get_idx(feature_enabled_obj, i)); |
| 2348 |
} |
| 2349 |
} |
| 2350 |
|
| 2351 |
/* __s16 feature_data[V4L2_AV1_MAX_SEGMENTS][V4L2_AV1_SEG_LVL_MAX] */ |
| 2352 |
int count_feature_data = 0; |
| 2353 |
json_object *feature_data_obj; |
| 2354 |
if (json_object_object_get_ex(v4l2_av1_segmentation_obj, "feature_data", &feature_data_obj)) { |
| 2355 |
for (size_t i = 0; i < V4L2_AV1_MAX_SEGMENTS; i++) { |
| 2356 |
for (size_t j = 0; j < V4L2_AV1_SEG_LVL_MAX; j++) { |
| 2357 |
if (json_object_array_get_idx(feature_data_obj, count_feature_data)) |
| 2358 |
p->feature_data[i][j] = (__s16) json_object_get_int(json_object_array_get_idx(feature_data_obj, count_feature_data++)); |
| 2359 |
} |
| 2360 |
} |
| 2361 |
} |
| 2362 |
|
| 2363 |
return p; |
| 2364 |
} |
| 2365 |
|
| 2366 |
struct v4l2_av1_loop_filter *retrace_v4l2_av1_loop_filter_gen(json_object *ctrl_obj) |
| 2367 |
{ |
| 2368 |
struct v4l2_av1_loop_filter *p = (struct v4l2_av1_loop_filter *) calloc(1, sizeof(v4l2_av1_loop_filter)); |
| 2369 |
json_object *v4l2_av1_loop_filter_obj; |
| 2370 |
if (!json_object_object_get_ex(ctrl_obj, "v4l2_av1_loop_filter", &v4l2_av1_loop_filter_obj)) |
| 2371 |
v4l2_av1_loop_filter_obj = ctrl_obj; |
| 2372 |
|
| 2373 |
json_object *flags_obj; |
| 2374 |
if (json_object_object_get_ex(v4l2_av1_loop_filter_obj, "flags", &flags_obj)) |
| 2375 |
p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_av1_loop_filter_flag_def); |
| 2376 |
|
| 2377 |
/* __u8 level[4] */ |
| 2378 |
json_object *level_obj; |
| 2379 |
if (json_object_object_get_ex(v4l2_av1_loop_filter_obj, "level", &level_obj)) { |
| 2380 |
for (size_t i = 0; i < 4; i++) { |
| 2381 |
if (json_object_array_get_idx(level_obj, i)) |
| 2382 |
p->level[i] = (__u8) json_object_get_int(json_object_array_get_idx(level_obj, i)); |
| 2383 |
} |
| 2384 |
} |
| 2385 |
|
| 2386 |
json_object *sharpness_obj; |
| 2387 |
if (json_object_object_get_ex(v4l2_av1_loop_filter_obj, "sharpness", &sharpness_obj)) |
| 2388 |
p->sharpness = (__u8) json_object_get_int(sharpness_obj); |
| 2389 |
|
| 2390 |
/* __s8 ref_deltas[V4L2_AV1_TOTAL_REFS_PER_FRAME] */ |
| 2391 |
json_object *ref_deltas_obj; |
| 2392 |
if (json_object_object_get_ex(v4l2_av1_loop_filter_obj, "ref_deltas", &ref_deltas_obj)) { |
| 2393 |
for (size_t i = 0; i < V4L2_AV1_TOTAL_REFS_PER_FRAME; i++) { |
| 2394 |
if (json_object_array_get_idx(ref_deltas_obj, i)) |
| 2395 |
p->ref_deltas[i] = (__s8) json_object_get_int(json_object_array_get_idx(ref_deltas_obj, i)); |
| 2396 |
} |
| 2397 |
} |
| 2398 |
|
| 2399 |
/* __s8 mode_deltas[2] */ |
| 2400 |
json_object *mode_deltas_obj; |
| 2401 |
if (json_object_object_get_ex(v4l2_av1_loop_filter_obj, "mode_deltas", &mode_deltas_obj)) { |
| 2402 |
for (size_t i = 0; i < 2; i++) { |
| 2403 |
if (json_object_array_get_idx(mode_deltas_obj, i)) |
| 2404 |
p->mode_deltas[i] = (__s8) json_object_get_int(json_object_array_get_idx(mode_deltas_obj, i)); |
| 2405 |
} |
| 2406 |
} |
| 2407 |
|
| 2408 |
json_object *delta_lf_res_obj; |
| 2409 |
if (json_object_object_get_ex(v4l2_av1_loop_filter_obj, "delta_lf_res", &delta_lf_res_obj)) |
| 2410 |
p->delta_lf_res = (__u8) json_object_get_int(delta_lf_res_obj); |
| 2411 |
|
| 2412 |
return p; |
| 2413 |
} |
| 2414 |
|
| 2415 |
struct v4l2_av1_quantization *retrace_v4l2_av1_quantization_gen(json_object *ctrl_obj) |
| 2416 |
{ |
| 2417 |
struct v4l2_av1_quantization *p = (struct v4l2_av1_quantization *) calloc(1, sizeof(v4l2_av1_quantization)); |
| 2418 |
json_object *v4l2_av1_quantization_obj; |
| 2419 |
if (!json_object_object_get_ex(ctrl_obj, "v4l2_av1_quantization", &v4l2_av1_quantization_obj)) |
| 2420 |
v4l2_av1_quantization_obj = ctrl_obj; |
| 2421 |
|
| 2422 |
json_object *flags_obj; |
| 2423 |
if (json_object_object_get_ex(v4l2_av1_quantization_obj, "flags", &flags_obj)) |
| 2424 |
p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_av1_quantization_flag_def); |
| 2425 |
|
| 2426 |
json_object *base_q_idx_obj; |
| 2427 |
if (json_object_object_get_ex(v4l2_av1_quantization_obj, "base_q_idx", &base_q_idx_obj)) |
| 2428 |
p->base_q_idx = (__u8) json_object_get_int(base_q_idx_obj); |
| 2429 |
|
| 2430 |
json_object *delta_q_y_dc_obj; |
| 2431 |
if (json_object_object_get_ex(v4l2_av1_quantization_obj, "delta_q_y_dc", &delta_q_y_dc_obj)) |
| 2432 |
p->delta_q_y_dc = (__s8) json_object_get_int(delta_q_y_dc_obj); |
| 2433 |
|
| 2434 |
json_object *delta_q_u_dc_obj; |
| 2435 |
if (json_object_object_get_ex(v4l2_av1_quantization_obj, "delta_q_u_dc", &delta_q_u_dc_obj)) |
| 2436 |
p->delta_q_u_dc = (__s8) json_object_get_int(delta_q_u_dc_obj); |
| 2437 |
|
| 2438 |
json_object *delta_q_u_ac_obj; |
| 2439 |
if (json_object_object_get_ex(v4l2_av1_quantization_obj, "delta_q_u_ac", &delta_q_u_ac_obj)) |
| 2440 |
p->delta_q_u_ac = (__s8) json_object_get_int(delta_q_u_ac_obj); |
| 2441 |
|
| 2442 |
json_object *delta_q_v_dc_obj; |
| 2443 |
if (json_object_object_get_ex(v4l2_av1_quantization_obj, "delta_q_v_dc", &delta_q_v_dc_obj)) |
| 2444 |
p->delta_q_v_dc = (__s8) json_object_get_int(delta_q_v_dc_obj); |
| 2445 |
|
| 2446 |
json_object *delta_q_v_ac_obj; |
| 2447 |
if (json_object_object_get_ex(v4l2_av1_quantization_obj, "delta_q_v_ac", &delta_q_v_ac_obj)) |
| 2448 |
p->delta_q_v_ac = (__s8) json_object_get_int(delta_q_v_ac_obj); |
| 2449 |
|
| 2450 |
json_object *qm_y_obj; |
| 2451 |
if (json_object_object_get_ex(v4l2_av1_quantization_obj, "qm_y", &qm_y_obj)) |
| 2452 |
p->qm_y = (__u8) json_object_get_int(qm_y_obj); |
| 2453 |
|
| 2454 |
json_object *qm_u_obj; |
| 2455 |
if (json_object_object_get_ex(v4l2_av1_quantization_obj, "qm_u", &qm_u_obj)) |
| 2456 |
p->qm_u = (__u8) json_object_get_int(qm_u_obj); |
| 2457 |
|
| 2458 |
json_object *qm_v_obj; |
| 2459 |
if (json_object_object_get_ex(v4l2_av1_quantization_obj, "qm_v", &qm_v_obj)) |
| 2460 |
p->qm_v = (__u8) json_object_get_int(qm_v_obj); |
| 2461 |
|
| 2462 |
json_object *delta_q_res_obj; |
| 2463 |
if (json_object_object_get_ex(v4l2_av1_quantization_obj, "delta_q_res", &delta_q_res_obj)) |
| 2464 |
p->delta_q_res = (__u8) json_object_get_int(delta_q_res_obj); |
| 2465 |
|
| 2466 |
return p; |
| 2467 |
} |
| 2468 |
|
| 2469 |
struct v4l2_av1_tile_info *retrace_v4l2_av1_tile_info_gen(json_object *ctrl_obj) |
| 2470 |
{ |
| 2471 |
struct v4l2_av1_tile_info *p = (struct v4l2_av1_tile_info *) calloc(1, sizeof(v4l2_av1_tile_info)); |
| 2472 |
json_object *v4l2_av1_tile_info_obj; |
| 2473 |
if (!json_object_object_get_ex(ctrl_obj, "v4l2_av1_tile_info", &v4l2_av1_tile_info_obj)) |
| 2474 |
v4l2_av1_tile_info_obj = ctrl_obj; |
| 2475 |
|
| 2476 |
json_object *flags_obj; |
| 2477 |
if (json_object_object_get_ex(v4l2_av1_tile_info_obj, "flags", &flags_obj)) |
| 2478 |
p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_av1_tile_info_flag_def); |
| 2479 |
|
| 2480 |
json_object *context_update_tile_id_obj; |
| 2481 |
if (json_object_object_get_ex(v4l2_av1_tile_info_obj, "context_update_tile_id", &context_update_tile_id_obj)) |
| 2482 |
p->context_update_tile_id = (__u8) json_object_get_int(context_update_tile_id_obj); |
| 2483 |
|
| 2484 |
json_object *tile_cols_obj; |
| 2485 |
if (json_object_object_get_ex(v4l2_av1_tile_info_obj, "tile_cols", &tile_cols_obj)) |
| 2486 |
p->tile_cols = (__u8) json_object_get_int(tile_cols_obj); |
| 2487 |
|
| 2488 |
json_object *tile_rows_obj; |
| 2489 |
if (json_object_object_get_ex(v4l2_av1_tile_info_obj, "tile_rows", &tile_rows_obj)) |
| 2490 |
p->tile_rows = (__u8) json_object_get_int(tile_rows_obj); |
| 2491 |
|
| 2492 |
/* __u32 mi_col_starts[V4L2_AV1_MAX_TILE_COLS + 1] */ |
| 2493 |
json_object *mi_col_starts_obj; |
| 2494 |
if (json_object_object_get_ex(v4l2_av1_tile_info_obj, "mi_col_starts", &mi_col_starts_obj)) { |
| 2495 |
for (size_t i = 0; i < V4L2_AV1_MAX_TILE_COLS + 1; i++) { |
| 2496 |
if (json_object_array_get_idx(mi_col_starts_obj, i)) |
| 2497 |
p->mi_col_starts[i] = (__u32) json_object_get_int64(json_object_array_get_idx(mi_col_starts_obj, i)); |
| 2498 |
} |
| 2499 |
} |
| 2500 |
|
| 2501 |
/* __u32 mi_row_starts[V4L2_AV1_MAX_TILE_ROWS + 1] */ |
| 2502 |
json_object *mi_row_starts_obj; |
| 2503 |
if (json_object_object_get_ex(v4l2_av1_tile_info_obj, "mi_row_starts", &mi_row_starts_obj)) { |
| 2504 |
for (size_t i = 0; i < V4L2_AV1_MAX_TILE_ROWS + 1; i++) { |
| 2505 |
if (json_object_array_get_idx(mi_row_starts_obj, i)) |
| 2506 |
p->mi_row_starts[i] = (__u32) json_object_get_int64(json_object_array_get_idx(mi_row_starts_obj, i)); |
| 2507 |
} |
| 2508 |
} |
| 2509 |
|
| 2510 |
/* __u32 width_in_sbs_minus_1[V4L2_AV1_MAX_TILE_COLS] */ |
| 2511 |
json_object *width_in_sbs_minus_1_obj; |
| 2512 |
if (json_object_object_get_ex(v4l2_av1_tile_info_obj, "width_in_sbs_minus_1", &width_in_sbs_minus_1_obj)) { |
| 2513 |
for (size_t i = 0; i < V4L2_AV1_MAX_TILE_COLS; i++) { |
| 2514 |
if (json_object_array_get_idx(width_in_sbs_minus_1_obj, i)) |
| 2515 |
p->width_in_sbs_minus_1[i] = (__u32) json_object_get_int64(json_object_array_get_idx(width_in_sbs_minus_1_obj, i)); |
| 2516 |
} |
| 2517 |
} |
| 2518 |
|
| 2519 |
/* __u32 height_in_sbs_minus_1[V4L2_AV1_MAX_TILE_ROWS] */ |
| 2520 |
json_object *height_in_sbs_minus_1_obj; |
| 2521 |
if (json_object_object_get_ex(v4l2_av1_tile_info_obj, "height_in_sbs_minus_1", &height_in_sbs_minus_1_obj)) { |
| 2522 |
for (size_t i = 0; i < V4L2_AV1_MAX_TILE_ROWS; i++) { |
| 2523 |
if (json_object_array_get_idx(height_in_sbs_minus_1_obj, i)) |
| 2524 |
p->height_in_sbs_minus_1[i] = (__u32) json_object_get_int64(json_object_array_get_idx(height_in_sbs_minus_1_obj, i)); |
| 2525 |
} |
| 2526 |
} |
| 2527 |
|
| 2528 |
json_object *tile_size_bytes_obj; |
| 2529 |
if (json_object_object_get_ex(v4l2_av1_tile_info_obj, "tile_size_bytes", &tile_size_bytes_obj)) |
| 2530 |
p->tile_size_bytes = (__u8) json_object_get_int(tile_size_bytes_obj); |
| 2531 |
|
| 2532 |
return p; |
| 2533 |
} |
| 2534 |
|
| 2535 |
struct v4l2_ctrl_av1_frame *retrace_v4l2_ctrl_av1_frame_gen(json_object *ctrl_obj) |
| 2536 |
{ |
| 2537 |
struct v4l2_ctrl_av1_frame *p = (struct v4l2_ctrl_av1_frame *) calloc(1, sizeof(v4l2_ctrl_av1_frame)); |
| 2538 |
json_object *v4l2_ctrl_av1_frame_obj; |
| 2539 |
if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_av1_frame", &v4l2_ctrl_av1_frame_obj)) |
| 2540 |
v4l2_ctrl_av1_frame_obj = ctrl_obj; |
| 2541 |
|
| 2542 |
/* struct v4l2_av1_tile_info tile_info */ |
| 2543 |
json_object *tile_info_obj; |
| 2544 |
if (!json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "v4l2_av1_tile_info", &tile_info_obj)) |
| 2545 |
return p; |
| 2546 |
void *tile_info_ptr = (void *) retrace_v4l2_av1_tile_info_gen(tile_info_obj); |
| 2547 |
p->tile_info = *static_cast<struct v4l2_av1_tile_info*>(tile_info_ptr); |
| 2548 |
free(tile_info_ptr); |
| 2549 |
|
| 2550 |
/* struct v4l2_av1_quantization quantization */ |
| 2551 |
json_object *quantization_obj; |
| 2552 |
if (!json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "v4l2_av1_quantization", &quantization_obj)) |
| 2553 |
return p; |
| 2554 |
void *quantization_ptr = (void *) retrace_v4l2_av1_quantization_gen(quantization_obj); |
| 2555 |
p->quantization = *static_cast<struct v4l2_av1_quantization*>(quantization_ptr); |
| 2556 |
free(quantization_ptr); |
| 2557 |
|
| 2558 |
json_object *superres_denom_obj; |
| 2559 |
if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "superres_denom", &superres_denom_obj)) |
| 2560 |
p->superres_denom = (__u8) json_object_get_int(superres_denom_obj); |
| 2561 |
|
| 2562 |
/* struct v4l2_av1_segmentation segmentation */ |
| 2563 |
json_object *segmentation_obj; |
| 2564 |
if (!json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "v4l2_av1_segmentation", &segmentation_obj)) |
| 2565 |
return p; |
| 2566 |
void *segmentation_ptr = (void *) retrace_v4l2_av1_segmentation_gen(segmentation_obj); |
| 2567 |
p->segmentation = *static_cast<struct v4l2_av1_segmentation*>(segmentation_ptr); |
| 2568 |
free(segmentation_ptr); |
| 2569 |
|
| 2570 |
/* struct v4l2_av1_loop_filter loop_filter */ |
| 2571 |
json_object *loop_filter_obj; |
| 2572 |
if (!json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "v4l2_av1_loop_filter", &loop_filter_obj)) |
| 2573 |
return p; |
| 2574 |
void *loop_filter_ptr = (void *) retrace_v4l2_av1_loop_filter_gen(loop_filter_obj); |
| 2575 |
p->loop_filter = *static_cast<struct v4l2_av1_loop_filter*>(loop_filter_ptr); |
| 2576 |
free(loop_filter_ptr); |
| 2577 |
|
| 2578 |
/* struct v4l2_av1_cdef cdef */ |
| 2579 |
json_object *cdef_obj; |
| 2580 |
if (!json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "v4l2_av1_cdef", &cdef_obj)) |
| 2581 |
return p; |
| 2582 |
void *cdef_ptr = (void *) retrace_v4l2_av1_cdef_gen(cdef_obj); |
| 2583 |
p->cdef = *static_cast<struct v4l2_av1_cdef*>(cdef_ptr); |
| 2584 |
free(cdef_ptr); |
| 2585 |
|
| 2586 |
/* __u8 skip_mode_frame[2] */ |
| 2587 |
json_object *skip_mode_frame_obj; |
| 2588 |
if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "skip_mode_frame", &skip_mode_frame_obj)) { |
| 2589 |
for (size_t i = 0; i < 2; i++) { |
| 2590 |
if (json_object_array_get_idx(skip_mode_frame_obj, i)) |
| 2591 |
p->skip_mode_frame[i] = (__u8) json_object_get_int(json_object_array_get_idx(skip_mode_frame_obj, i)); |
| 2592 |
} |
| 2593 |
} |
| 2594 |
|
| 2595 |
json_object *primary_ref_frame_obj; |
| 2596 |
if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "primary_ref_frame", &primary_ref_frame_obj)) |
| 2597 |
p->primary_ref_frame = (__u8) json_object_get_int(primary_ref_frame_obj); |
| 2598 |
|
| 2599 |
/* struct v4l2_av1_loop_restoration loop_restoration */ |
| 2600 |
json_object *loop_restoration_obj; |
| 2601 |
if (!json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "v4l2_av1_loop_restoration", &loop_restoration_obj)) |
| 2602 |
return p; |
| 2603 |
void *loop_restoration_ptr = (void *) retrace_v4l2_av1_loop_restoration_gen(loop_restoration_obj); |
| 2604 |
p->loop_restoration = *static_cast<struct v4l2_av1_loop_restoration*>(loop_restoration_ptr); |
| 2605 |
free(loop_restoration_ptr); |
| 2606 |
|
| 2607 |
/* struct v4l2_av1_global_motion global_motion */ |
| 2608 |
json_object *global_motion_obj; |
| 2609 |
if (!json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "v4l2_av1_global_motion", &global_motion_obj)) |
| 2610 |
return p; |
| 2611 |
void *global_motion_ptr = (void *) retrace_v4l2_av1_global_motion_gen(global_motion_obj); |
| 2612 |
p->global_motion = *static_cast<struct v4l2_av1_global_motion*>(global_motion_ptr); |
| 2613 |
free(global_motion_ptr); |
| 2614 |
|
| 2615 |
json_object *flags_obj; |
| 2616 |
if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "flags", &flags_obj)) |
| 2617 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_av1_frame_flag_def); |
| 2618 |
|
| 2619 |
json_object *frame_type_obj; |
| 2620 |
if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "frame_type", &frame_type_obj)) |
| 2621 |
p->frame_type = (v4l2_av1_frame_type) json_object_get_int(frame_type_obj); |
| 2622 |
|
| 2623 |
json_object *order_hint_obj; |
| 2624 |
if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "order_hint", &order_hint_obj)) |
| 2625 |
p->order_hint = (__u32) json_object_get_int64(order_hint_obj); |
| 2626 |
|
| 2627 |
json_object *upscaled_width_obj; |
| 2628 |
if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "upscaled_width", &upscaled_width_obj)) |
| 2629 |
p->upscaled_width = (__u32) json_object_get_int64(upscaled_width_obj); |
| 2630 |
|
| 2631 |
json_object *interpolation_filter_obj; |
| 2632 |
if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "interpolation_filter", &interpolation_filter_obj)) |
| 2633 |
p->interpolation_filter = (v4l2_av1_interpolation_filter) json_object_get_int(interpolation_filter_obj); |
| 2634 |
|
| 2635 |
json_object *tx_mode_obj; |
| 2636 |
if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "tx_mode", &tx_mode_obj)) |
| 2637 |
p->tx_mode = (v4l2_av1_tx_mode) json_object_get_int(tx_mode_obj); |
| 2638 |
|
| 2639 |
json_object *frame_width_minus_1_obj; |
| 2640 |
if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "frame_width_minus_1", &frame_width_minus_1_obj)) |
| 2641 |
p->frame_width_minus_1 = (__u32) json_object_get_int64(frame_width_minus_1_obj); |
| 2642 |
|
| 2643 |
json_object *frame_height_minus_1_obj; |
| 2644 |
if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "frame_height_minus_1", &frame_height_minus_1_obj)) |
| 2645 |
p->frame_height_minus_1 = (__u32) json_object_get_int64(frame_height_minus_1_obj); |
| 2646 |
|
| 2647 |
json_object *render_width_minus_1_obj; |
| 2648 |
if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "render_width_minus_1", &render_width_minus_1_obj)) |
| 2649 |
p->render_width_minus_1 = (__u16) json_object_get_int(render_width_minus_1_obj); |
| 2650 |
|
| 2651 |
json_object *render_height_minus_1_obj; |
| 2652 |
if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "render_height_minus_1", &render_height_minus_1_obj)) |
| 2653 |
p->render_height_minus_1 = (__u16) json_object_get_int(render_height_minus_1_obj); |
| 2654 |
|
| 2655 |
json_object *current_frame_id_obj; |
| 2656 |
if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "current_frame_id", ¤t_frame_id_obj)) |
| 2657 |
p->current_frame_id = (__u32) json_object_get_int64(current_frame_id_obj); |
| 2658 |
|
| 2659 |
/* __u32 buffer_removal_time[V4L2_AV1_MAX_OPERATING_POINTS] */ |
| 2660 |
json_object *buffer_removal_time_obj; |
| 2661 |
if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "buffer_removal_time", &buffer_removal_time_obj)) { |
| 2662 |
for (size_t i = 0; i < V4L2_AV1_MAX_OPERATING_POINTS; i++) { |
| 2663 |
if (json_object_array_get_idx(buffer_removal_time_obj, i)) |
| 2664 |
p->buffer_removal_time[i] = (__u32) json_object_get_int64(json_object_array_get_idx(buffer_removal_time_obj, i)); |
| 2665 |
} |
| 2666 |
} |
| 2667 |
|
| 2668 |
/* __u32 order_hints[V4L2_AV1_TOTAL_REFS_PER_FRAME] */ |
| 2669 |
json_object *order_hints_obj; |
| 2670 |
if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "order_hints", &order_hints_obj)) { |
| 2671 |
for (size_t i = 0; i < V4L2_AV1_TOTAL_REFS_PER_FRAME; i++) { |
| 2672 |
if (json_object_array_get_idx(order_hints_obj, i)) |
| 2673 |
p->order_hints[i] = (__u32) json_object_get_int64(json_object_array_get_idx(order_hints_obj, i)); |
| 2674 |
} |
| 2675 |
} |
| 2676 |
|
| 2677 |
/* __u64 reference_frame_ts[V4L2_AV1_TOTAL_REFS_PER_FRAME] */ |
| 2678 |
json_object *reference_frame_ts_obj; |
| 2679 |
if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "reference_frame_ts", &reference_frame_ts_obj)) { |
| 2680 |
for (size_t i = 0; i < V4L2_AV1_TOTAL_REFS_PER_FRAME; i++) { |
| 2681 |
if (json_object_array_get_idx(reference_frame_ts_obj, i)) |
| 2682 |
p->reference_frame_ts[i] = (__u64) json_object_get_uint64(json_object_array_get_idx(reference_frame_ts_obj, i)); |
| 2683 |
} |
| 2684 |
} |
| 2685 |
|
| 2686 |
/* __s8 ref_frame_idx[V4L2_AV1_REFS_PER_FRAME] */ |
| 2687 |
json_object *ref_frame_idx_obj; |
| 2688 |
if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "ref_frame_idx", &ref_frame_idx_obj)) { |
| 2689 |
for (size_t i = 0; i < V4L2_AV1_REFS_PER_FRAME; i++) { |
| 2690 |
if (json_object_array_get_idx(ref_frame_idx_obj, i)) |
| 2691 |
p->ref_frame_idx[i] = (__s8) json_object_get_int(json_object_array_get_idx(ref_frame_idx_obj, i)); |
| 2692 |
} |
| 2693 |
} |
| 2694 |
|
| 2695 |
json_object *refresh_frame_flags_obj; |
| 2696 |
if (json_object_object_get_ex(v4l2_ctrl_av1_frame_obj, "refresh_frame_flags", &refresh_frame_flags_obj)) |
| 2697 |
p->refresh_frame_flags = (__u8) s2flags(json_object_get_string(refresh_frame_flags_obj), v4l2_av1_frame_flag_def); |
| 2698 |
|
| 2699 |
return p; |
| 2700 |
} |
| 2701 |
|
| 2702 |
struct v4l2_ctrl_av1_film_grain *retrace_v4l2_ctrl_av1_film_grain_gen(json_object *ctrl_obj) |
| 2703 |
{ |
| 2704 |
struct v4l2_ctrl_av1_film_grain *p = (struct v4l2_ctrl_av1_film_grain *) calloc(1, sizeof(v4l2_ctrl_av1_film_grain)); |
| 2705 |
json_object *v4l2_ctrl_av1_film_grain_obj; |
| 2706 |
if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_av1_film_grain", &v4l2_ctrl_av1_film_grain_obj)) |
| 2707 |
v4l2_ctrl_av1_film_grain_obj = ctrl_obj; |
| 2708 |
|
| 2709 |
json_object *flags_obj; |
| 2710 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "flags", &flags_obj)) |
| 2711 |
p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_av1_film_grain_flag_def); |
| 2712 |
|
| 2713 |
json_object *cr_mult_obj; |
| 2714 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "cr_mult", &cr_mult_obj)) |
| 2715 |
p->cr_mult = (__u8) json_object_get_int(cr_mult_obj); |
| 2716 |
|
| 2717 |
json_object *grain_seed_obj; |
| 2718 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "grain_seed", &grain_seed_obj)) |
| 2719 |
p->grain_seed = (__u16) json_object_get_int(grain_seed_obj); |
| 2720 |
|
| 2721 |
json_object *film_grain_params_ref_idx_obj; |
| 2722 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "film_grain_params_ref_idx", &film_grain_params_ref_idx_obj)) |
| 2723 |
p->film_grain_params_ref_idx = (__u8) json_object_get_int(film_grain_params_ref_idx_obj); |
| 2724 |
|
| 2725 |
json_object *num_y_points_obj; |
| 2726 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "num_y_points", &num_y_points_obj)) |
| 2727 |
p->num_y_points = (__u8) json_object_get_int(num_y_points_obj); |
| 2728 |
|
| 2729 |
/* __u8 point_y_value[V4L2_AV1_MAX_NUM_Y_POINTS] */ |
| 2730 |
json_object *point_y_value_obj; |
| 2731 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "point_y_value", &point_y_value_obj)) { |
| 2732 |
for (size_t i = 0; i < V4L2_AV1_MAX_NUM_Y_POINTS; i++) { |
| 2733 |
if (json_object_array_get_idx(point_y_value_obj, i)) |
| 2734 |
p->point_y_value[i] = (__u8) json_object_get_int(json_object_array_get_idx(point_y_value_obj, i)); |
| 2735 |
} |
| 2736 |
} |
| 2737 |
|
| 2738 |
/* __u8 point_y_scaling[V4L2_AV1_MAX_NUM_Y_POINTS] */ |
| 2739 |
json_object *point_y_scaling_obj; |
| 2740 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "point_y_scaling", &point_y_scaling_obj)) { |
| 2741 |
for (size_t i = 0; i < V4L2_AV1_MAX_NUM_Y_POINTS; i++) { |
| 2742 |
if (json_object_array_get_idx(point_y_scaling_obj, i)) |
| 2743 |
p->point_y_scaling[i] = (__u8) json_object_get_int(json_object_array_get_idx(point_y_scaling_obj, i)); |
| 2744 |
} |
| 2745 |
} |
| 2746 |
|
| 2747 |
json_object *num_cb_points_obj; |
| 2748 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "num_cb_points", &num_cb_points_obj)) |
| 2749 |
p->num_cb_points = (__u8) json_object_get_int(num_cb_points_obj); |
| 2750 |
|
| 2751 |
/* __u8 point_cb_value[V4L2_AV1_MAX_NUM_CB_POINTS] */ |
| 2752 |
json_object *point_cb_value_obj; |
| 2753 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "point_cb_value", &point_cb_value_obj)) { |
| 2754 |
for (size_t i = 0; i < V4L2_AV1_MAX_NUM_CB_POINTS; i++) { |
| 2755 |
if (json_object_array_get_idx(point_cb_value_obj, i)) |
| 2756 |
p->point_cb_value[i] = (__u8) json_object_get_int(json_object_array_get_idx(point_cb_value_obj, i)); |
| 2757 |
} |
| 2758 |
} |
| 2759 |
|
| 2760 |
/* __u8 point_cb_scaling[V4L2_AV1_MAX_NUM_CB_POINTS] */ |
| 2761 |
json_object *point_cb_scaling_obj; |
| 2762 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "point_cb_scaling", &point_cb_scaling_obj)) { |
| 2763 |
for (size_t i = 0; i < V4L2_AV1_MAX_NUM_CB_POINTS; i++) { |
| 2764 |
if (json_object_array_get_idx(point_cb_scaling_obj, i)) |
| 2765 |
p->point_cb_scaling[i] = (__u8) json_object_get_int(json_object_array_get_idx(point_cb_scaling_obj, i)); |
| 2766 |
} |
| 2767 |
} |
| 2768 |
|
| 2769 |
json_object *num_cr_points_obj; |
| 2770 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "num_cr_points", &num_cr_points_obj)) |
| 2771 |
p->num_cr_points = (__u8) json_object_get_int(num_cr_points_obj); |
| 2772 |
|
| 2773 |
/* __u8 point_cr_value[V4L2_AV1_MAX_NUM_CR_POINTS] */ |
| 2774 |
json_object *point_cr_value_obj; |
| 2775 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "point_cr_value", &point_cr_value_obj)) { |
| 2776 |
for (size_t i = 0; i < V4L2_AV1_MAX_NUM_CR_POINTS; i++) { |
| 2777 |
if (json_object_array_get_idx(point_cr_value_obj, i)) |
| 2778 |
p->point_cr_value[i] = (__u8) json_object_get_int(json_object_array_get_idx(point_cr_value_obj, i)); |
| 2779 |
} |
| 2780 |
} |
| 2781 |
|
| 2782 |
/* __u8 point_cr_scaling[V4L2_AV1_MAX_NUM_CR_POINTS] */ |
| 2783 |
json_object *point_cr_scaling_obj; |
| 2784 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "point_cr_scaling", &point_cr_scaling_obj)) { |
| 2785 |
for (size_t i = 0; i < V4L2_AV1_MAX_NUM_CR_POINTS; i++) { |
| 2786 |
if (json_object_array_get_idx(point_cr_scaling_obj, i)) |
| 2787 |
p->point_cr_scaling[i] = (__u8) json_object_get_int(json_object_array_get_idx(point_cr_scaling_obj, i)); |
| 2788 |
} |
| 2789 |
} |
| 2790 |
|
| 2791 |
json_object *grain_scaling_minus_8_obj; |
| 2792 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "grain_scaling_minus_8", &grain_scaling_minus_8_obj)) |
| 2793 |
p->grain_scaling_minus_8 = (__u8) json_object_get_int(grain_scaling_minus_8_obj); |
| 2794 |
|
| 2795 |
json_object *ar_coeff_lag_obj; |
| 2796 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "ar_coeff_lag", &ar_coeff_lag_obj)) |
| 2797 |
p->ar_coeff_lag = (__u8) json_object_get_int(ar_coeff_lag_obj); |
| 2798 |
|
| 2799 |
/* __u8 ar_coeffs_y_plus_128[V4L2_AV1_AR_COEFFS_SIZE] */ |
| 2800 |
json_object *ar_coeffs_y_plus_128_obj; |
| 2801 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "ar_coeffs_y_plus_128", &ar_coeffs_y_plus_128_obj)) { |
| 2802 |
for (size_t i = 0; i < V4L2_AV1_AR_COEFFS_SIZE; i++) { |
| 2803 |
if (json_object_array_get_idx(ar_coeffs_y_plus_128_obj, i)) |
| 2804 |
p->ar_coeffs_y_plus_128[i] = (__u8) json_object_get_int(json_object_array_get_idx(ar_coeffs_y_plus_128_obj, i)); |
| 2805 |
} |
| 2806 |
} |
| 2807 |
|
| 2808 |
/* __u8 ar_coeffs_cb_plus_128[V4L2_AV1_AR_COEFFS_SIZE] */ |
| 2809 |
json_object *ar_coeffs_cb_plus_128_obj; |
| 2810 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "ar_coeffs_cb_plus_128", &ar_coeffs_cb_plus_128_obj)) { |
| 2811 |
for (size_t i = 0; i < V4L2_AV1_AR_COEFFS_SIZE; i++) { |
| 2812 |
if (json_object_array_get_idx(ar_coeffs_cb_plus_128_obj, i)) |
| 2813 |
p->ar_coeffs_cb_plus_128[i] = (__u8) json_object_get_int(json_object_array_get_idx(ar_coeffs_cb_plus_128_obj, i)); |
| 2814 |
} |
| 2815 |
} |
| 2816 |
|
| 2817 |
/* __u8 ar_coeffs_cr_plus_128[V4L2_AV1_AR_COEFFS_SIZE] */ |
| 2818 |
json_object *ar_coeffs_cr_plus_128_obj; |
| 2819 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "ar_coeffs_cr_plus_128", &ar_coeffs_cr_plus_128_obj)) { |
| 2820 |
for (size_t i = 0; i < V4L2_AV1_AR_COEFFS_SIZE; i++) { |
| 2821 |
if (json_object_array_get_idx(ar_coeffs_cr_plus_128_obj, i)) |
| 2822 |
p->ar_coeffs_cr_plus_128[i] = (__u8) json_object_get_int(json_object_array_get_idx(ar_coeffs_cr_plus_128_obj, i)); |
| 2823 |
} |
| 2824 |
} |
| 2825 |
|
| 2826 |
json_object *ar_coeff_shift_minus_6_obj; |
| 2827 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "ar_coeff_shift_minus_6", &ar_coeff_shift_minus_6_obj)) |
| 2828 |
p->ar_coeff_shift_minus_6 = (__u8) json_object_get_int(ar_coeff_shift_minus_6_obj); |
| 2829 |
|
| 2830 |
json_object *grain_scale_shift_obj; |
| 2831 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "grain_scale_shift", &grain_scale_shift_obj)) |
| 2832 |
p->grain_scale_shift = (__u8) json_object_get_int(grain_scale_shift_obj); |
| 2833 |
|
| 2834 |
json_object *cb_mult_obj; |
| 2835 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "cb_mult", &cb_mult_obj)) |
| 2836 |
p->cb_mult = (__u8) json_object_get_int(cb_mult_obj); |
| 2837 |
|
| 2838 |
json_object *cb_luma_mult_obj; |
| 2839 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "cb_luma_mult", &cb_luma_mult_obj)) |
| 2840 |
p->cb_luma_mult = (__u8) json_object_get_int(cb_luma_mult_obj); |
| 2841 |
|
| 2842 |
json_object *cr_luma_mult_obj; |
| 2843 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "cr_luma_mult", &cr_luma_mult_obj)) |
| 2844 |
p->cr_luma_mult = (__u8) json_object_get_int(cr_luma_mult_obj); |
| 2845 |
|
| 2846 |
json_object *cb_offset_obj; |
| 2847 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "cb_offset", &cb_offset_obj)) |
| 2848 |
p->cb_offset = (__u16) json_object_get_int(cb_offset_obj); |
| 2849 |
|
| 2850 |
json_object *cr_offset_obj; |
| 2851 |
if (json_object_object_get_ex(v4l2_ctrl_av1_film_grain_obj, "cr_offset", &cr_offset_obj)) |
| 2852 |
p->cr_offset = (__u16) json_object_get_int(cr_offset_obj); |
| 2853 |
|
| 2854 |
return p; |
| 2855 |
} |
| 2856 |
|
| 2857 |
struct v4l2_ctrl_hdr10_cll_info *retrace_v4l2_ctrl_hdr10_cll_info_gen(json_object *ctrl_obj) |
| 2858 |
{ |
| 2859 |
struct v4l2_ctrl_hdr10_cll_info *p = (struct v4l2_ctrl_hdr10_cll_info *) calloc(1, sizeof(v4l2_ctrl_hdr10_cll_info)); |
| 2860 |
json_object *v4l2_ctrl_hdr10_cll_info_obj; |
| 2861 |
if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_hdr10_cll_info", &v4l2_ctrl_hdr10_cll_info_obj)) |
| 2862 |
v4l2_ctrl_hdr10_cll_info_obj = ctrl_obj; |
| 2863 |
|
| 2864 |
json_object *max_content_light_level_obj; |
| 2865 |
if (json_object_object_get_ex(v4l2_ctrl_hdr10_cll_info_obj, "max_content_light_level", &max_content_light_level_obj)) |
| 2866 |
p->max_content_light_level = (__u16) json_object_get_int(max_content_light_level_obj); |
| 2867 |
|
| 2868 |
json_object *max_pic_average_light_level_obj; |
| 2869 |
if (json_object_object_get_ex(v4l2_ctrl_hdr10_cll_info_obj, "max_pic_average_light_level", &max_pic_average_light_level_obj)) |
| 2870 |
p->max_pic_average_light_level = (__u16) json_object_get_int(max_pic_average_light_level_obj); |
| 2871 |
|
| 2872 |
return p; |
| 2873 |
} |
| 2874 |
|
| 2875 |
struct v4l2_ctrl_hdr10_mastering_display *retrace_v4l2_ctrl_hdr10_mastering_display_gen(json_object *ctrl_obj) |
| 2876 |
{ |
| 2877 |
struct v4l2_ctrl_hdr10_mastering_display *p = (struct v4l2_ctrl_hdr10_mastering_display *) calloc(1, sizeof(v4l2_ctrl_hdr10_mastering_display)); |
| 2878 |
json_object *v4l2_ctrl_hdr10_mastering_display_obj; |
| 2879 |
if (!json_object_object_get_ex(ctrl_obj, "v4l2_ctrl_hdr10_mastering_display", &v4l2_ctrl_hdr10_mastering_display_obj)) |
| 2880 |
v4l2_ctrl_hdr10_mastering_display_obj = ctrl_obj; |
| 2881 |
|
| 2882 |
/* __u16 display_primaries_x[3] */ |
| 2883 |
json_object *display_primaries_x_obj; |
| 2884 |
if (json_object_object_get_ex(v4l2_ctrl_hdr10_mastering_display_obj, "display_primaries_x", &display_primaries_x_obj)) { |
| 2885 |
for (size_t i = 0; i < 3; i++) { |
| 2886 |
if (json_object_array_get_idx(display_primaries_x_obj, i)) |
| 2887 |
p->display_primaries_x[i] = (__u16) json_object_get_int(json_object_array_get_idx(display_primaries_x_obj, i)); |
| 2888 |
} |
| 2889 |
} |
| 2890 |
|
| 2891 |
/* __u16 display_primaries_y[3] */ |
| 2892 |
json_object *display_primaries_y_obj; |
| 2893 |
if (json_object_object_get_ex(v4l2_ctrl_hdr10_mastering_display_obj, "display_primaries_y", &display_primaries_y_obj)) { |
| 2894 |
for (size_t i = 0; i < 3; i++) { |
| 2895 |
if (json_object_array_get_idx(display_primaries_y_obj, i)) |
| 2896 |
p->display_primaries_y[i] = (__u16) json_object_get_int(json_object_array_get_idx(display_primaries_y_obj, i)); |
| 2897 |
} |
| 2898 |
} |
| 2899 |
|
| 2900 |
json_object *white_point_x_obj; |
| 2901 |
if (json_object_object_get_ex(v4l2_ctrl_hdr10_mastering_display_obj, "white_point_x", &white_point_x_obj)) |
| 2902 |
p->white_point_x = (__u16) json_object_get_int(white_point_x_obj); |
| 2903 |
|
| 2904 |
json_object *white_point_y_obj; |
| 2905 |
if (json_object_object_get_ex(v4l2_ctrl_hdr10_mastering_display_obj, "white_point_y", &white_point_y_obj)) |
| 2906 |
p->white_point_y = (__u16) json_object_get_int(white_point_y_obj); |
| 2907 |
|
| 2908 |
json_object *max_display_mastering_luminance_obj; |
| 2909 |
if (json_object_object_get_ex(v4l2_ctrl_hdr10_mastering_display_obj, "max_display_mastering_luminance", &max_display_mastering_luminance_obj)) |
| 2910 |
p->max_display_mastering_luminance = (__u32) json_object_get_int64(max_display_mastering_luminance_obj); |
| 2911 |
|
| 2912 |
json_object *min_display_mastering_luminance_obj; |
| 2913 |
if (json_object_object_get_ex(v4l2_ctrl_hdr10_mastering_display_obj, "min_display_mastering_luminance", &min_display_mastering_luminance_obj)) |
| 2914 |
p->min_display_mastering_luminance = (__u32) json_object_get_int64(min_display_mastering_luminance_obj); |
| 2915 |
|
| 2916 |
return p; |
| 2917 |
} |
| 2918 |
|
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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 |
} |
| 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_rect *p_rect; |
| 4080 |
//struct v4l2_ctrl_h264_sps *p_h264_sps; |
| 4081 |
//struct v4l2_ctrl_h264_pps *p_h264_pps; |
| 4082 |
//struct v4l2_ctrl_h264_scaling_matrix *p_h264_scaling_matrix; |
| 4083 |
//struct v4l2_ctrl_h264_pred_weights *p_h264_pred_weights; |
| 4084 |
//struct v4l2_ctrl_h264_slice_params *p_h264_slice_params; |
| 4085 |
//struct v4l2_ctrl_h264_decode_params *p_h264_decode_params; |
| 4086 |
//struct v4l2_ctrl_fwht_params *p_fwht_params; |
| 4087 |
//struct v4l2_ctrl_vp8_frame *p_vp8_frame; |
| 4088 |
//struct v4l2_ctrl_mpeg2_sequence *p_mpeg2_sequence; |
| 4089 |
//struct v4l2_ctrl_mpeg2_picture *p_mpeg2_picture; |
| 4090 |
//struct v4l2_ctrl_mpeg2_quantisation *p_mpeg2_quantisation; |
| 4091 |
//struct v4l2_ctrl_vp9_compressed_hdr *p_vp9_compressed_hdr_probs; |
| 4092 |
//struct v4l2_ctrl_vp9_frame *p_vp9_frame; |
| 4093 |
//struct v4l2_ctrl_hevc_sps *p_hevc_sps; |
| 4094 |
//struct v4l2_ctrl_hevc_pps *p_hevc_pps; |
| 4095 |
//struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params; |
| 4096 |
//struct v4l2_ctrl_hevc_scaling_matrix *p_hevc_scaling_matrix; |
| 4097 |
//struct v4l2_ctrl_hevc_decode_params *p_hevc_decode_params; |
| 4098 |
//struct v4l2_ctrl_av1_sequence *p_av1_sequence; |
| 4099 |
//struct v4l2_ctrl_av1_tile_group_entry *p_av1_tile_group_entry; |
| 4100 |
//struct v4l2_ctrl_av1_frame *p_av1_frame; |
| 4101 |
//struct v4l2_ctrl_av1_film_grain *p_av1_film_grain; |
| 4102 |
//struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll_info; |
| 4103 |
//struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering_display; |
| 4104 |
//void *ptr; |
| 4105 |
//end of union } __attribute__ ((packed)); |
| 4106 |
return p; |
| 4107 |
} |
| 4108 |
struct v4l2_ext_controls *retrace_v4l2_ext_controls_gen(json_object *parent_obj, std::string key_name = "") |
| 4109 |
{ |
| 4110 |
struct v4l2_ext_controls *p = (struct v4l2_ext_controls *) calloc(1, sizeof(v4l2_ext_controls)); |
| 4111 |
|
| 4112 |
json_object *v4l2_ext_controls_obj; |
| 4113 |
if (key_name.empty()) |
| 4114 |
json_object_object_get_ex(parent_obj, "v4l2_ext_controls", &v4l2_ext_controls_obj); |
| 4115 |
else |
| 4116 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_ext_controls_obj); |
| 4117 |
|
| 4118 |
//union |
| 4119 |
//__u32 ctrl_class; |
| 4120 |
//__u32 which; |
| 4121 |
//end of union }; |
| 4122 |
json_object *count_obj; |
| 4123 |
if (json_object_object_get_ex(v4l2_ext_controls_obj, "count", &count_obj)) |
| 4124 |
p->count = (__u32) json_object_get_int64(count_obj); |
| 4125 |
|
| 4126 |
json_object *error_idx_obj; |
| 4127 |
if (json_object_object_get_ex(v4l2_ext_controls_obj, "error_idx", &error_idx_obj)) |
| 4128 |
p->error_idx = (__u32) json_object_get_int64(error_idx_obj); |
| 4129 |
|
| 4130 |
json_object *request_fd_obj; |
| 4131 |
if (json_object_object_get_ex(v4l2_ext_controls_obj, "request_fd", &request_fd_obj)) |
| 4132 |
p->request_fd = (__s32) json_object_get_int(request_fd_obj); |
| 4133 |
|
| 4134 |
//struct v4l2_ext_control *controls; |
| 4135 |
return p; |
| 4136 |
} |
| 4137 |
struct v4l2_queryctrl *retrace_v4l2_queryctrl_gen(json_object *parent_obj, std::string key_name = "") |
| 4138 |
{ |
| 4139 |
struct v4l2_queryctrl *p = (struct v4l2_queryctrl *) calloc(1, sizeof(v4l2_queryctrl)); |
| 4140 |
|
| 4141 |
json_object *v4l2_queryctrl_obj; |
| 4142 |
if (key_name.empty()) |
| 4143 |
json_object_object_get_ex(parent_obj, "v4l2_queryctrl", &v4l2_queryctrl_obj); |
| 4144 |
else |
| 4145 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_queryctrl_obj); |
| 4146 |
|
| 4147 |
json_object *id_obj; |
| 4148 |
if (json_object_object_get_ex(v4l2_queryctrl_obj, "id", &id_obj)) |
| 4149 |
p->id = (__u32) s2val(json_object_get_string(id_obj), control_val_def); |
| 4150 |
json_object *type_obj; |
| 4151 |
if (json_object_object_get_ex(v4l2_queryctrl_obj, "type", &type_obj)) |
| 4152 |
p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_ctrl_type_val_def); |
| 4153 |
json_object *name_obj; |
| 4154 |
if (json_object_object_get_ex(v4l2_queryctrl_obj, "name", &name_obj)) |
| 4155 |
if (json_object_get_string(name_obj) != nullptr) |
| 4156 |
memcpy(p->name, json_object_get_string(name_obj), 32); |
| 4157 |
|
| 4158 |
json_object *minimum_obj; |
| 4159 |
if (json_object_object_get_ex(v4l2_queryctrl_obj, "minimum", &minimum_obj)) |
| 4160 |
p->minimum = (__s32) json_object_get_int(minimum_obj); |
| 4161 |
|
| 4162 |
json_object *maximum_obj; |
| 4163 |
if (json_object_object_get_ex(v4l2_queryctrl_obj, "maximum", &maximum_obj)) |
| 4164 |
p->maximum = (__s32) json_object_get_int(maximum_obj); |
| 4165 |
|
| 4166 |
json_object *step_obj; |
| 4167 |
if (json_object_object_get_ex(v4l2_queryctrl_obj, "step", &step_obj)) |
| 4168 |
p->step = (__s32) json_object_get_int(step_obj); |
| 4169 |
|
| 4170 |
json_object *default_value_obj; |
| 4171 |
if (json_object_object_get_ex(v4l2_queryctrl_obj, "default_value", &default_value_obj)) |
| 4172 |
p->default_value = (__s32) json_object_get_int(default_value_obj); |
| 4173 |
|
| 4174 |
json_object *flags_obj; |
| 4175 |
if (json_object_object_get_ex(v4l2_queryctrl_obj, "flags", &flags_obj)) |
| 4176 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_ctrl_flag_def); |
| 4177 |
|
| 4178 |
return p; |
| 4179 |
} |
| 4180 |
struct v4l2_query_ext_ctrl *retrace_v4l2_query_ext_ctrl_gen(json_object *parent_obj, std::string key_name = "") |
| 4181 |
{ |
| 4182 |
struct v4l2_query_ext_ctrl *p = (struct v4l2_query_ext_ctrl *) calloc(1, sizeof(v4l2_query_ext_ctrl)); |
| 4183 |
|
| 4184 |
json_object *v4l2_query_ext_ctrl_obj; |
| 4185 |
if (key_name.empty()) |
| 4186 |
json_object_object_get_ex(parent_obj, "v4l2_query_ext_ctrl", &v4l2_query_ext_ctrl_obj); |
| 4187 |
else |
| 4188 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_query_ext_ctrl_obj); |
| 4189 |
|
| 4190 |
json_object *id_obj; |
| 4191 |
if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "id", &id_obj)) |
| 4192 |
p->id = (__u32) s2val(json_object_get_string(id_obj), control_val_def); |
| 4193 |
json_object *type_obj; |
| 4194 |
if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "type", &type_obj)) |
| 4195 |
p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_ctrl_type_val_def); |
| 4196 |
json_object *name_obj; |
| 4197 |
if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "name", &name_obj)) |
| 4198 |
if (json_object_get_string(name_obj) != nullptr) |
| 4199 |
memcpy(p->name, json_object_get_string(name_obj), 32); |
| 4200 |
|
| 4201 |
json_object *minimum_obj; |
| 4202 |
if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "minimum", &minimum_obj)) |
| 4203 |
p->minimum = (__s64) json_object_get_int64(minimum_obj); |
| 4204 |
|
| 4205 |
json_object *maximum_obj; |
| 4206 |
if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "maximum", &maximum_obj)) |
| 4207 |
p->maximum = (__s64) json_object_get_int64(maximum_obj); |
| 4208 |
|
| 4209 |
json_object *step_obj; |
| 4210 |
if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "step", &step_obj)) |
| 4211 |
p->step = (__u64) json_object_get_uint64(step_obj); |
| 4212 |
|
| 4213 |
json_object *default_value_obj; |
| 4214 |
if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "default_value", &default_value_obj)) |
| 4215 |
p->default_value = (__s64) json_object_get_int64(default_value_obj); |
| 4216 |
|
| 4217 |
json_object *flags_obj; |
| 4218 |
if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "flags", &flags_obj)) |
| 4219 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_ctrl_flag_def); |
| 4220 |
|
| 4221 |
json_object *elem_size_obj; |
| 4222 |
if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "elem_size", &elem_size_obj)) |
| 4223 |
p->elem_size = (__u32) json_object_get_int64(elem_size_obj); |
| 4224 |
|
| 4225 |
json_object *elems_obj; |
| 4226 |
if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "elems", &elems_obj)) |
| 4227 |
p->elems = (__u32) json_object_get_int64(elems_obj); |
| 4228 |
|
| 4229 |
json_object *nr_of_dims_obj; |
| 4230 |
if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "nr_of_dims", &nr_of_dims_obj)) |
| 4231 |
p->nr_of_dims = (__u32) json_object_get_int64(nr_of_dims_obj); |
| 4232 |
|
| 4233 |
/* __u32 dims[V4L2_CTRL_MAX_DIMS]; */ |
| 4234 |
json_object *dims_obj; |
| 4235 |
if (json_object_object_get_ex(v4l2_query_ext_ctrl_obj, "dims", &dims_obj)) { |
| 4236 |
for (int i = 0; i < (std::min((int) p->nr_of_dims, V4L2_CTRL_MAX_DIMS)); i++) { |
| 4237 |
if (json_object_array_get_idx(dims_obj, i)) |
| 4238 |
p->dims[i] = (__u32) json_object_get_int64(json_object_array_get_idx(dims_obj, i)); |
| 4239 |
} |
| 4240 |
} |
| 4241 |
return p; |
| 4242 |
} |
| 4243 |
struct v4l2_querymenu *retrace_v4l2_querymenu_gen(json_object *parent_obj, std::string key_name = "") |
| 4244 |
{ |
| 4245 |
struct v4l2_querymenu *p = (struct v4l2_querymenu *) calloc(1, sizeof(v4l2_querymenu)); |
| 4246 |
|
| 4247 |
json_object *v4l2_querymenu_obj; |
| 4248 |
if (key_name.empty()) |
| 4249 |
json_object_object_get_ex(parent_obj, "v4l2_querymenu", &v4l2_querymenu_obj); |
| 4250 |
else |
| 4251 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_querymenu_obj); |
| 4252 |
|
| 4253 |
json_object *id_obj; |
| 4254 |
if (json_object_object_get_ex(v4l2_querymenu_obj, "id", &id_obj)) |
| 4255 |
p->id = (__u32) s2val(json_object_get_string(id_obj), control_val_def); |
| 4256 |
json_object *index_obj; |
| 4257 |
if (json_object_object_get_ex(v4l2_querymenu_obj, "index", &index_obj)) |
| 4258 |
p->index = (__u32) json_object_get_int64(index_obj); |
| 4259 |
|
| 4260 |
//union |
| 4261 |
//__u8 name[32]; |
| 4262 |
//__s64 value; |
| 4263 |
//end of union }; |
| 4264 |
return p; |
| 4265 |
} |
| 4266 |
struct v4l2_tuner *retrace_v4l2_tuner_gen(json_object *parent_obj, std::string key_name = "") |
| 4267 |
{ |
| 4268 |
struct v4l2_tuner *p = (struct v4l2_tuner *) calloc(1, sizeof(v4l2_tuner)); |
| 4269 |
|
| 4270 |
json_object *v4l2_tuner_obj; |
| 4271 |
if (key_name.empty()) |
| 4272 |
json_object_object_get_ex(parent_obj, "v4l2_tuner", &v4l2_tuner_obj); |
| 4273 |
else |
| 4274 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_tuner_obj); |
| 4275 |
|
| 4276 |
json_object *index_obj; |
| 4277 |
if (json_object_object_get_ex(v4l2_tuner_obj, "index", &index_obj)) |
| 4278 |
p->index = (__u32) json_object_get_int64(index_obj); |
| 4279 |
|
| 4280 |
json_object *name_obj; |
| 4281 |
if (json_object_object_get_ex(v4l2_tuner_obj, "name", &name_obj)) |
| 4282 |
if (json_object_get_string(name_obj) != nullptr) |
| 4283 |
memcpy(p->name, json_object_get_string(name_obj), 32); |
| 4284 |
|
| 4285 |
json_object *type_obj; |
| 4286 |
if (json_object_object_get_ex(v4l2_tuner_obj, "type", &type_obj)) |
| 4287 |
p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_tuner_type_val_def); |
| 4288 |
json_object *capability_obj; |
| 4289 |
if (json_object_object_get_ex(v4l2_tuner_obj, "capability", &capability_obj)) |
| 4290 |
p->capability = (__u32) s2flags(json_object_get_string(capability_obj), tuner_cap_flag_def); |
| 4291 |
|
| 4292 |
json_object *rangelow_obj; |
| 4293 |
if (json_object_object_get_ex(v4l2_tuner_obj, "rangelow", &rangelow_obj)) |
| 4294 |
p->rangelow = (__u32) json_object_get_int64(rangelow_obj); |
| 4295 |
|
| 4296 |
json_object *rangehigh_obj; |
| 4297 |
if (json_object_object_get_ex(v4l2_tuner_obj, "rangehigh", &rangehigh_obj)) |
| 4298 |
p->rangehigh = (__u32) json_object_get_int64(rangehigh_obj); |
| 4299 |
|
| 4300 |
json_object *rxsubchans_obj; |
| 4301 |
if (json_object_object_get_ex(v4l2_tuner_obj, "rxsubchans", &rxsubchans_obj)) |
| 4302 |
p->rxsubchans = (__u32) s2flags(json_object_get_string(rxsubchans_obj), tuner_rxsub_flag_def); |
| 4303 |
|
| 4304 |
json_object *audmode_obj; |
| 4305 |
if (json_object_object_get_ex(v4l2_tuner_obj, "audmode", &audmode_obj)) |
| 4306 |
p->audmode = (__u32) s2val(json_object_get_string(audmode_obj), tuner_audmode_val_def); |
| 4307 |
json_object *signal_obj; |
| 4308 |
if (json_object_object_get_ex(v4l2_tuner_obj, "signal", &signal_obj)) |
| 4309 |
p->signal = (__s32) json_object_get_int(signal_obj); |
| 4310 |
|
| 4311 |
json_object *afc_obj; |
| 4312 |
if (json_object_object_get_ex(v4l2_tuner_obj, "afc", &afc_obj)) |
| 4313 |
p->afc = (__s32) json_object_get_int(afc_obj); |
| 4314 |
|
| 4315 |
return p; |
| 4316 |
} |
| 4317 |
struct v4l2_modulator *retrace_v4l2_modulator_gen(json_object *parent_obj, std::string key_name = "") |
| 4318 |
{ |
| 4319 |
struct v4l2_modulator *p = (struct v4l2_modulator *) calloc(1, sizeof(v4l2_modulator)); |
| 4320 |
|
| 4321 |
json_object *v4l2_modulator_obj; |
| 4322 |
if (key_name.empty()) |
| 4323 |
json_object_object_get_ex(parent_obj, "v4l2_modulator", &v4l2_modulator_obj); |
| 4324 |
else |
| 4325 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_modulator_obj); |
| 4326 |
|
| 4327 |
json_object *index_obj; |
| 4328 |
if (json_object_object_get_ex(v4l2_modulator_obj, "index", &index_obj)) |
| 4329 |
p->index = (__u32) json_object_get_int64(index_obj); |
| 4330 |
|
| 4331 |
json_object *name_obj; |
| 4332 |
if (json_object_object_get_ex(v4l2_modulator_obj, "name", &name_obj)) |
| 4333 |
if (json_object_get_string(name_obj) != nullptr) |
| 4334 |
memcpy(p->name, json_object_get_string(name_obj), 32); |
| 4335 |
|
| 4336 |
json_object *capability_obj; |
| 4337 |
if (json_object_object_get_ex(v4l2_modulator_obj, "capability", &capability_obj)) |
| 4338 |
p->capability = (__u32) json_object_get_int64(capability_obj); |
| 4339 |
|
| 4340 |
json_object *rangelow_obj; |
| 4341 |
if (json_object_object_get_ex(v4l2_modulator_obj, "rangelow", &rangelow_obj)) |
| 4342 |
p->rangelow = (__u32) json_object_get_int64(rangelow_obj); |
| 4343 |
|
| 4344 |
json_object *rangehigh_obj; |
| 4345 |
if (json_object_object_get_ex(v4l2_modulator_obj, "rangehigh", &rangehigh_obj)) |
| 4346 |
p->rangehigh = (__u32) json_object_get_int64(rangehigh_obj); |
| 4347 |
|
| 4348 |
json_object *txsubchans_obj; |
| 4349 |
if (json_object_object_get_ex(v4l2_modulator_obj, "txsubchans", &txsubchans_obj)) |
| 4350 |
p->txsubchans = (__u32) json_object_get_int64(txsubchans_obj); |
| 4351 |
|
| 4352 |
json_object *type_obj; |
| 4353 |
if (json_object_object_get_ex(v4l2_modulator_obj, "type", &type_obj)) |
| 4354 |
p->type = (__u32) s2val(json_object_get_string(type_obj), nullptr); |
| 4355 |
return p; |
| 4356 |
} |
| 4357 |
struct v4l2_frequency *retrace_v4l2_frequency_gen(json_object *parent_obj, std::string key_name = "") |
| 4358 |
{ |
| 4359 |
struct v4l2_frequency *p = (struct v4l2_frequency *) calloc(1, sizeof(v4l2_frequency)); |
| 4360 |
|
| 4361 |
json_object *v4l2_frequency_obj; |
| 4362 |
if (key_name.empty()) |
| 4363 |
json_object_object_get_ex(parent_obj, "v4l2_frequency", &v4l2_frequency_obj); |
| 4364 |
else |
| 4365 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_frequency_obj); |
| 4366 |
|
| 4367 |
json_object *tuner_obj; |
| 4368 |
if (json_object_object_get_ex(v4l2_frequency_obj, "tuner", &tuner_obj)) |
| 4369 |
p->tuner = (__u32) json_object_get_int64(tuner_obj); |
| 4370 |
|
| 4371 |
json_object *type_obj; |
| 4372 |
if (json_object_object_get_ex(v4l2_frequency_obj, "type", &type_obj)) |
| 4373 |
p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_tuner_type_val_def); |
| 4374 |
json_object *frequency_obj; |
| 4375 |
if (json_object_object_get_ex(v4l2_frequency_obj, "frequency", &frequency_obj)) |
| 4376 |
p->frequency = (__u32) json_object_get_int64(frequency_obj); |
| 4377 |
|
| 4378 |
return p; |
| 4379 |
} |
| 4380 |
struct v4l2_frequency_band *retrace_v4l2_frequency_band_gen(json_object *parent_obj, std::string key_name = "") |
| 4381 |
{ |
| 4382 |
struct v4l2_frequency_band *p = (struct v4l2_frequency_band *) calloc(1, sizeof(v4l2_frequency_band)); |
| 4383 |
|
| 4384 |
json_object *v4l2_frequency_band_obj; |
| 4385 |
if (key_name.empty()) |
| 4386 |
json_object_object_get_ex(parent_obj, "v4l2_frequency_band", &v4l2_frequency_band_obj); |
| 4387 |
else |
| 4388 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_frequency_band_obj); |
| 4389 |
|
| 4390 |
json_object *tuner_obj; |
| 4391 |
if (json_object_object_get_ex(v4l2_frequency_band_obj, "tuner", &tuner_obj)) |
| 4392 |
p->tuner = (__u32) json_object_get_int64(tuner_obj); |
| 4393 |
|
| 4394 |
json_object *type_obj; |
| 4395 |
if (json_object_object_get_ex(v4l2_frequency_band_obj, "type", &type_obj)) |
| 4396 |
p->type = (__u32) s2val(json_object_get_string(type_obj), nullptr); |
| 4397 |
json_object *index_obj; |
| 4398 |
if (json_object_object_get_ex(v4l2_frequency_band_obj, "index", &index_obj)) |
| 4399 |
p->index = (__u32) json_object_get_int64(index_obj); |
| 4400 |
|
| 4401 |
json_object *capability_obj; |
| 4402 |
if (json_object_object_get_ex(v4l2_frequency_band_obj, "capability", &capability_obj)) |
| 4403 |
p->capability = (__u32) json_object_get_int64(capability_obj); |
| 4404 |
|
| 4405 |
json_object *rangelow_obj; |
| 4406 |
if (json_object_object_get_ex(v4l2_frequency_band_obj, "rangelow", &rangelow_obj)) |
| 4407 |
p->rangelow = (__u32) json_object_get_int64(rangelow_obj); |
| 4408 |
|
| 4409 |
json_object *rangehigh_obj; |
| 4410 |
if (json_object_object_get_ex(v4l2_frequency_band_obj, "rangehigh", &rangehigh_obj)) |
| 4411 |
p->rangehigh = (__u32) json_object_get_int64(rangehigh_obj); |
| 4412 |
|
| 4413 |
json_object *modulation_obj; |
| 4414 |
if (json_object_object_get_ex(v4l2_frequency_band_obj, "modulation", &modulation_obj)) |
| 4415 |
p->modulation = (__u32) json_object_get_int64(modulation_obj); |
| 4416 |
|
| 4417 |
return p; |
| 4418 |
} |
| 4419 |
struct v4l2_hw_freq_seek *retrace_v4l2_hw_freq_seek_gen(json_object *parent_obj, std::string key_name = "") |
| 4420 |
{ |
| 4421 |
struct v4l2_hw_freq_seek *p = (struct v4l2_hw_freq_seek *) calloc(1, sizeof(v4l2_hw_freq_seek)); |
| 4422 |
|
| 4423 |
json_object *v4l2_hw_freq_seek_obj; |
| 4424 |
if (key_name.empty()) |
| 4425 |
json_object_object_get_ex(parent_obj, "v4l2_hw_freq_seek", &v4l2_hw_freq_seek_obj); |
| 4426 |
else |
| 4427 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_hw_freq_seek_obj); |
| 4428 |
|
| 4429 |
json_object *tuner_obj; |
| 4430 |
if (json_object_object_get_ex(v4l2_hw_freq_seek_obj, "tuner", &tuner_obj)) |
| 4431 |
p->tuner = (__u32) json_object_get_int64(tuner_obj); |
| 4432 |
|
| 4433 |
json_object *type_obj; |
| 4434 |
if (json_object_object_get_ex(v4l2_hw_freq_seek_obj, "type", &type_obj)) |
| 4435 |
p->type = (__u32) s2val(json_object_get_string(type_obj), nullptr); |
| 4436 |
json_object *seek_upward_obj; |
| 4437 |
if (json_object_object_get_ex(v4l2_hw_freq_seek_obj, "seek_upward", &seek_upward_obj)) |
| 4438 |
p->seek_upward = (__u32) json_object_get_int64(seek_upward_obj); |
| 4439 |
|
| 4440 |
json_object *wrap_around_obj; |
| 4441 |
if (json_object_object_get_ex(v4l2_hw_freq_seek_obj, "wrap_around", &wrap_around_obj)) |
| 4442 |
p->wrap_around = (__u32) json_object_get_int64(wrap_around_obj); |
| 4443 |
|
| 4444 |
json_object *spacing_obj; |
| 4445 |
if (json_object_object_get_ex(v4l2_hw_freq_seek_obj, "spacing", &spacing_obj)) |
| 4446 |
p->spacing = (__u32) json_object_get_int64(spacing_obj); |
| 4447 |
|
| 4448 |
json_object *rangelow_obj; |
| 4449 |
if (json_object_object_get_ex(v4l2_hw_freq_seek_obj, "rangelow", &rangelow_obj)) |
| 4450 |
p->rangelow = (__u32) json_object_get_int64(rangelow_obj); |
| 4451 |
|
| 4452 |
json_object *rangehigh_obj; |
| 4453 |
if (json_object_object_get_ex(v4l2_hw_freq_seek_obj, "rangehigh", &rangehigh_obj)) |
| 4454 |
p->rangehigh = (__u32) json_object_get_int64(rangehigh_obj); |
| 4455 |
|
| 4456 |
return p; |
| 4457 |
} |
| 4458 |
struct v4l2_rds_data *retrace_v4l2_rds_data_gen(json_object *parent_obj, std::string key_name = "") |
| 4459 |
{ |
| 4460 |
struct v4l2_rds_data *p = (struct v4l2_rds_data *) calloc(1, sizeof(v4l2_rds_data)); |
| 4461 |
|
| 4462 |
json_object *v4l2_rds_data_obj; |
| 4463 |
if (key_name.empty()) |
| 4464 |
json_object_object_get_ex(parent_obj, "v4l2_rds_data", &v4l2_rds_data_obj); |
| 4465 |
else |
| 4466 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_rds_data_obj); |
| 4467 |
|
| 4468 |
json_object *lsb_obj; |
| 4469 |
if (json_object_object_get_ex(v4l2_rds_data_obj, "lsb", &lsb_obj)) |
| 4470 |
p->lsb = (__u8) json_object_get_int(lsb_obj); |
| 4471 |
|
| 4472 |
json_object *msb_obj; |
| 4473 |
if (json_object_object_get_ex(v4l2_rds_data_obj, "msb", &msb_obj)) |
| 4474 |
p->msb = (__u8) json_object_get_int(msb_obj); |
| 4475 |
|
| 4476 |
json_object *block_obj; |
| 4477 |
if (json_object_object_get_ex(v4l2_rds_data_obj, "block", &block_obj)) |
| 4478 |
p->block = (__u8) json_object_get_int(block_obj); |
| 4479 |
|
| 4480 |
return p; |
| 4481 |
} |
| 4482 |
struct v4l2_audio *retrace_v4l2_audio_gen(json_object *parent_obj, std::string key_name = "") |
| 4483 |
{ |
| 4484 |
struct v4l2_audio *p = (struct v4l2_audio *) calloc(1, sizeof(v4l2_audio)); |
| 4485 |
|
| 4486 |
json_object *v4l2_audio_obj; |
| 4487 |
if (key_name.empty()) |
| 4488 |
json_object_object_get_ex(parent_obj, "v4l2_audio", &v4l2_audio_obj); |
| 4489 |
else |
| 4490 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_audio_obj); |
| 4491 |
|
| 4492 |
json_object *index_obj; |
| 4493 |
if (json_object_object_get_ex(v4l2_audio_obj, "index", &index_obj)) |
| 4494 |
p->index = (__u32) json_object_get_int64(index_obj); |
| 4495 |
|
| 4496 |
json_object *name_obj; |
| 4497 |
if (json_object_object_get_ex(v4l2_audio_obj, "name", &name_obj)) |
| 4498 |
if (json_object_get_string(name_obj) != nullptr) |
| 4499 |
memcpy(p->name, json_object_get_string(name_obj), 32); |
| 4500 |
|
| 4501 |
json_object *capability_obj; |
| 4502 |
if (json_object_object_get_ex(v4l2_audio_obj, "capability", &capability_obj)) |
| 4503 |
p->capability = (__u32) json_object_get_int64(capability_obj); |
| 4504 |
|
| 4505 |
json_object *mode_obj; |
| 4506 |
if (json_object_object_get_ex(v4l2_audio_obj, "mode", &mode_obj)) |
| 4507 |
p->mode = (__u32) json_object_get_int64(mode_obj); |
| 4508 |
|
| 4509 |
return p; |
| 4510 |
} |
| 4511 |
struct v4l2_audioout *retrace_v4l2_audioout_gen(json_object *parent_obj, std::string key_name = "") |
| 4512 |
{ |
| 4513 |
struct v4l2_audioout *p = (struct v4l2_audioout *) calloc(1, sizeof(v4l2_audioout)); |
| 4514 |
|
| 4515 |
json_object *v4l2_audioout_obj; |
| 4516 |
if (key_name.empty()) |
| 4517 |
json_object_object_get_ex(parent_obj, "v4l2_audioout", &v4l2_audioout_obj); |
| 4518 |
else |
| 4519 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_audioout_obj); |
| 4520 |
|
| 4521 |
json_object *index_obj; |
| 4522 |
if (json_object_object_get_ex(v4l2_audioout_obj, "index", &index_obj)) |
| 4523 |
p->index = (__u32) json_object_get_int64(index_obj); |
| 4524 |
|
| 4525 |
json_object *name_obj; |
| 4526 |
if (json_object_object_get_ex(v4l2_audioout_obj, "name", &name_obj)) |
| 4527 |
if (json_object_get_string(name_obj) != nullptr) |
| 4528 |
memcpy(p->name, json_object_get_string(name_obj), 32); |
| 4529 |
|
| 4530 |
json_object *capability_obj; |
| 4531 |
if (json_object_object_get_ex(v4l2_audioout_obj, "capability", &capability_obj)) |
| 4532 |
p->capability = (__u32) json_object_get_int64(capability_obj); |
| 4533 |
|
| 4534 |
json_object *mode_obj; |
| 4535 |
if (json_object_object_get_ex(v4l2_audioout_obj, "mode", &mode_obj)) |
| 4536 |
p->mode = (__u32) json_object_get_int64(mode_obj); |
| 4537 |
|
| 4538 |
return p; |
| 4539 |
} |
| 4540 |
struct v4l2_enc_idx_entry *retrace_v4l2_enc_idx_entry_gen(json_object *parent_obj, std::string key_name = "") |
| 4541 |
{ |
| 4542 |
struct v4l2_enc_idx_entry *p = (struct v4l2_enc_idx_entry *) calloc(1, sizeof(v4l2_enc_idx_entry)); |
| 4543 |
|
| 4544 |
json_object *v4l2_enc_idx_entry_obj; |
| 4545 |
if (key_name.empty()) |
| 4546 |
json_object_object_get_ex(parent_obj, "v4l2_enc_idx_entry", &v4l2_enc_idx_entry_obj); |
| 4547 |
else |
| 4548 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_enc_idx_entry_obj); |
| 4549 |
|
| 4550 |
json_object *offset_obj; |
| 4551 |
if (json_object_object_get_ex(v4l2_enc_idx_entry_obj, "offset", &offset_obj)) |
| 4552 |
p->offset = (__u64) json_object_get_uint64(offset_obj); |
| 4553 |
|
| 4554 |
json_object *pts_obj; |
| 4555 |
if (json_object_object_get_ex(v4l2_enc_idx_entry_obj, "pts", &pts_obj)) |
| 4556 |
p->pts = (__u64) json_object_get_uint64(pts_obj); |
| 4557 |
|
| 4558 |
json_object *length_obj; |
| 4559 |
if (json_object_object_get_ex(v4l2_enc_idx_entry_obj, "length", &length_obj)) |
| 4560 |
p->length = (__u32) json_object_get_int64(length_obj); |
| 4561 |
|
| 4562 |
json_object *flags_obj; |
| 4563 |
if (json_object_object_get_ex(v4l2_enc_idx_entry_obj, "flags", &flags_obj)) |
| 4564 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr); |
| 4565 |
|
| 4566 |
return p; |
| 4567 |
} |
| 4568 |
struct v4l2_enc_idx *retrace_v4l2_enc_idx_gen(json_object *parent_obj, std::string key_name = "") |
| 4569 |
{ |
| 4570 |
struct v4l2_enc_idx *p = (struct v4l2_enc_idx *) calloc(1, sizeof(v4l2_enc_idx)); |
| 4571 |
|
| 4572 |
json_object *v4l2_enc_idx_obj; |
| 4573 |
if (key_name.empty()) |
| 4574 |
json_object_object_get_ex(parent_obj, "v4l2_enc_idx", &v4l2_enc_idx_obj); |
| 4575 |
else |
| 4576 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_enc_idx_obj); |
| 4577 |
|
| 4578 |
json_object *entries_obj; |
| 4579 |
if (json_object_object_get_ex(v4l2_enc_idx_obj, "entries", &entries_obj)) |
| 4580 |
p->entries = (__u32) json_object_get_int64(entries_obj); |
| 4581 |
|
| 4582 |
json_object *entries_cap_obj; |
| 4583 |
if (json_object_object_get_ex(v4l2_enc_idx_obj, "entries_cap", &entries_cap_obj)) |
| 4584 |
p->entries_cap = (__u32) json_object_get_int64(entries_cap_obj); |
| 4585 |
|
| 4586 |
//struct v4l2_enc_idx_entry entry[V4L2_ENC_IDX_ENTRIES]; |
| 4587 |
return p; |
| 4588 |
} |
| 4589 |
struct v4l2_encoder_cmd *retrace_v4l2_encoder_cmd_gen(json_object *parent_obj, std::string key_name = "") |
| 4590 |
{ |
| 4591 |
struct v4l2_encoder_cmd *p = (struct v4l2_encoder_cmd *) calloc(1, sizeof(v4l2_encoder_cmd)); |
| 4592 |
|
| 4593 |
json_object *v4l2_encoder_cmd_obj; |
| 4594 |
if (key_name.empty()) |
| 4595 |
json_object_object_get_ex(parent_obj, "v4l2_encoder_cmd", &v4l2_encoder_cmd_obj); |
| 4596 |
else |
| 4597 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_encoder_cmd_obj); |
| 4598 |
|
| 4599 |
json_object *cmd_obj; |
| 4600 |
if (json_object_object_get_ex(v4l2_encoder_cmd_obj, "cmd", &cmd_obj)) |
| 4601 |
p->cmd = (__u32) s2val(json_object_get_string(cmd_obj), encoder_cmd_val_def); |
| 4602 |
json_object *flags_obj; |
| 4603 |
if (json_object_object_get_ex(v4l2_encoder_cmd_obj, "flags", &flags_obj)) |
| 4604 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr); |
| 4605 |
|
| 4606 |
//union |
| 4607 |
//struct { |
| 4608 |
//__u32 data[8]; |
| 4609 |
//end of union } raw; |
| 4610 |
return p; |
| 4611 |
} |
| 4612 |
struct v4l2_decoder_cmd *retrace_v4l2_decoder_cmd_gen(json_object *parent_obj, std::string key_name = "") |
| 4613 |
{ |
| 4614 |
struct v4l2_decoder_cmd *p = (struct v4l2_decoder_cmd *) calloc(1, sizeof(v4l2_decoder_cmd)); |
| 4615 |
|
| 4616 |
json_object *v4l2_decoder_cmd_obj; |
| 4617 |
if (key_name.empty()) |
| 4618 |
json_object_object_get_ex(parent_obj, "v4l2_decoder_cmd", &v4l2_decoder_cmd_obj); |
| 4619 |
else |
| 4620 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_decoder_cmd_obj); |
| 4621 |
|
| 4622 |
json_object *cmd_obj; |
| 4623 |
if (json_object_object_get_ex(v4l2_decoder_cmd_obj, "cmd", &cmd_obj)) |
| 4624 |
p->cmd = (__u32) s2val(json_object_get_string(cmd_obj), decoder_cmd_val_def); |
| 4625 |
json_object *flags_obj; |
| 4626 |
if (json_object_object_get_ex(v4l2_decoder_cmd_obj, "flags", &flags_obj)) |
| 4627 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr); |
| 4628 |
|
| 4629 |
//union |
| 4630 |
//struct { |
| 4631 |
//__u64 pts; |
| 4632 |
//end of union } stop; |
| 4633 |
//struct { |
| 4634 |
//__s32 speed; |
| 4635 |
//__u32 format; |
| 4636 |
//end of struct } start; |
| 4637 |
//struct { |
| 4638 |
//__u32 data[16]; |
| 4639 |
//end of struct } raw; |
| 4640 |
return p; |
| 4641 |
} |
| 4642 |
struct v4l2_vbi_format *retrace_v4l2_vbi_format_gen(json_object *parent_obj, std::string key_name = "") |
| 4643 |
{ |
| 4644 |
struct v4l2_vbi_format *p = (struct v4l2_vbi_format *) calloc(1, sizeof(v4l2_vbi_format)); |
| 4645 |
|
| 4646 |
json_object *v4l2_vbi_format_obj; |
| 4647 |
if (key_name.empty()) |
| 4648 |
json_object_object_get_ex(parent_obj, "v4l2_vbi_format", &v4l2_vbi_format_obj); |
| 4649 |
else |
| 4650 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_vbi_format_obj); |
| 4651 |
|
| 4652 |
json_object *sampling_rate_obj; |
| 4653 |
if (json_object_object_get_ex(v4l2_vbi_format_obj, "sampling_rate", &sampling_rate_obj)) |
| 4654 |
p->sampling_rate = (__u32) json_object_get_int64(sampling_rate_obj); |
| 4655 |
|
| 4656 |
json_object *offset_obj; |
| 4657 |
if (json_object_object_get_ex(v4l2_vbi_format_obj, "offset", &offset_obj)) |
| 4658 |
p->offset = (__u32) json_object_get_int64(offset_obj); |
| 4659 |
|
| 4660 |
json_object *samples_per_line_obj; |
| 4661 |
if (json_object_object_get_ex(v4l2_vbi_format_obj, "samples_per_line", &samples_per_line_obj)) |
| 4662 |
p->samples_per_line = (__u32) json_object_get_int64(samples_per_line_obj); |
| 4663 |
|
| 4664 |
json_object *sample_format_obj; |
| 4665 |
if (json_object_object_get_ex(v4l2_vbi_format_obj, "sample_format", &sample_format_obj)) |
| 4666 |
p->sample_format = (__u32) json_object_get_int64(sample_format_obj); |
| 4667 |
|
| 4668 |
json_object *start_obj; |
| 4669 |
if (json_object_object_get_ex(v4l2_vbi_format_obj, "start", &start_obj)) |
| 4670 |
if (json_object_get_string(start_obj) != nullptr) |
| 4671 |
memcpy(p->start, json_object_get_string(start_obj), 2); |
| 4672 |
|
| 4673 |
json_object *count_obj; |
| 4674 |
if (json_object_object_get_ex(v4l2_vbi_format_obj, "count", &count_obj)) |
| 4675 |
if (json_object_get_string(count_obj) != nullptr) |
| 4676 |
memcpy(p->count, json_object_get_string(count_obj), 2); |
| 4677 |
|
| 4678 |
json_object *flags_obj; |
| 4679 |
if (json_object_object_get_ex(v4l2_vbi_format_obj, "flags", &flags_obj)) |
| 4680 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr); |
| 4681 |
|
| 4682 |
return p; |
| 4683 |
} |
| 4684 |
struct v4l2_sliced_vbi_format *retrace_v4l2_sliced_vbi_format_gen(json_object *parent_obj, std::string key_name = "") |
| 4685 |
{ |
| 4686 |
struct v4l2_sliced_vbi_format *p = (struct v4l2_sliced_vbi_format *) calloc(1, sizeof(v4l2_sliced_vbi_format)); |
| 4687 |
|
| 4688 |
json_object *v4l2_sliced_vbi_format_obj; |
| 4689 |
if (key_name.empty()) |
| 4690 |
json_object_object_get_ex(parent_obj, "v4l2_sliced_vbi_format", &v4l2_sliced_vbi_format_obj); |
| 4691 |
else |
| 4692 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_sliced_vbi_format_obj); |
| 4693 |
|
| 4694 |
json_object *service_set_obj; |
| 4695 |
if (json_object_object_get_ex(v4l2_sliced_vbi_format_obj, "service_set", &service_set_obj)) |
| 4696 |
p->service_set = (__u16) json_object_get_int(service_set_obj); |
| 4697 |
|
| 4698 |
//__u16 service_lines[2][24]; |
| 4699 |
json_object *io_size_obj; |
| 4700 |
if (json_object_object_get_ex(v4l2_sliced_vbi_format_obj, "io_size", &io_size_obj)) |
| 4701 |
p->io_size = (__u32) json_object_get_int64(io_size_obj); |
| 4702 |
|
| 4703 |
return p; |
| 4704 |
} |
| 4705 |
struct v4l2_sliced_vbi_cap *retrace_v4l2_sliced_vbi_cap_gen(json_object *parent_obj, std::string key_name = "") |
| 4706 |
{ |
| 4707 |
struct v4l2_sliced_vbi_cap *p = (struct v4l2_sliced_vbi_cap *) calloc(1, sizeof(v4l2_sliced_vbi_cap)); |
| 4708 |
|
| 4709 |
json_object *v4l2_sliced_vbi_cap_obj; |
| 4710 |
if (key_name.empty()) |
| 4711 |
json_object_object_get_ex(parent_obj, "v4l2_sliced_vbi_cap", &v4l2_sliced_vbi_cap_obj); |
| 4712 |
else |
| 4713 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_sliced_vbi_cap_obj); |
| 4714 |
|
| 4715 |
json_object *service_set_obj; |
| 4716 |
if (json_object_object_get_ex(v4l2_sliced_vbi_cap_obj, "service_set", &service_set_obj)) |
| 4717 |
p->service_set = (__u16) json_object_get_int(service_set_obj); |
| 4718 |
|
| 4719 |
//__u16 service_lines[2][24]; |
| 4720 |
json_object *type_obj; |
| 4721 |
if (json_object_object_get_ex(v4l2_sliced_vbi_cap_obj, "type", &type_obj)) |
| 4722 |
p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_buf_type_val_def); |
| 4723 |
return p; |
| 4724 |
} |
| 4725 |
struct v4l2_sliced_vbi_data *retrace_v4l2_sliced_vbi_data_gen(json_object *parent_obj, std::string key_name = "") |
| 4726 |
{ |
| 4727 |
struct v4l2_sliced_vbi_data *p = (struct v4l2_sliced_vbi_data *) calloc(1, sizeof(v4l2_sliced_vbi_data)); |
| 4728 |
|
| 4729 |
json_object *v4l2_sliced_vbi_data_obj; |
| 4730 |
if (key_name.empty()) |
| 4731 |
json_object_object_get_ex(parent_obj, "v4l2_sliced_vbi_data", &v4l2_sliced_vbi_data_obj); |
| 4732 |
else |
| 4733 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_sliced_vbi_data_obj); |
| 4734 |
|
| 4735 |
json_object *id_obj; |
| 4736 |
if (json_object_object_get_ex(v4l2_sliced_vbi_data_obj, "id", &id_obj)) |
| 4737 |
p->id = (__u32) s2val(json_object_get_string(id_obj), nullptr); |
| 4738 |
json_object *field_obj; |
| 4739 |
if (json_object_object_get_ex(v4l2_sliced_vbi_data_obj, "field", &field_obj)) |
| 4740 |
p->field = (__u32) s2val(json_object_get_string(field_obj), nullptr); |
| 4741 |
json_object *line_obj; |
| 4742 |
if (json_object_object_get_ex(v4l2_sliced_vbi_data_obj, "line", &line_obj)) |
| 4743 |
p->line = (__u32) json_object_get_int64(line_obj); |
| 4744 |
|
| 4745 |
json_object *data_obj; |
| 4746 |
if (json_object_object_get_ex(v4l2_sliced_vbi_data_obj, "data", &data_obj)) |
| 4747 |
if (json_object_get_string(data_obj) != nullptr) |
| 4748 |
memcpy(p->data, json_object_get_string(data_obj), 48); |
| 4749 |
|
| 4750 |
return p; |
| 4751 |
} |
| 4752 |
struct v4l2_mpeg_vbi_itv0_line *retrace_v4l2_mpeg_vbi_itv0_line_gen(json_object *parent_obj, std::string key_name = "") |
| 4753 |
{ |
| 4754 |
struct v4l2_mpeg_vbi_itv0_line *p = (struct v4l2_mpeg_vbi_itv0_line *) calloc(1, sizeof(v4l2_mpeg_vbi_itv0_line)); |
| 4755 |
|
| 4756 |
json_object *v4l2_mpeg_vbi_itv0_line_obj; |
| 4757 |
if (key_name.empty()) |
| 4758 |
json_object_object_get_ex(parent_obj, "v4l2_mpeg_vbi_itv0_line", &v4l2_mpeg_vbi_itv0_line_obj); |
| 4759 |
else |
| 4760 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_mpeg_vbi_itv0_line_obj); |
| 4761 |
|
| 4762 |
json_object *id_obj; |
| 4763 |
if (json_object_object_get_ex(v4l2_mpeg_vbi_itv0_line_obj, "id", &id_obj)) |
| 4764 |
p->id = (__u8) s2val(json_object_get_string(id_obj), nullptr); |
| 4765 |
json_object *data_obj; |
| 4766 |
if (json_object_object_get_ex(v4l2_mpeg_vbi_itv0_line_obj, "data", &data_obj)) |
| 4767 |
if (json_object_get_string(data_obj) != nullptr) |
| 4768 |
memcpy(p->data, json_object_get_string(data_obj), 42); |
| 4769 |
|
| 4770 |
return p; |
| 4771 |
} |
| 4772 |
struct v4l2_mpeg_vbi_itv0 *retrace_v4l2_mpeg_vbi_itv0_gen(json_object *parent_obj, std::string key_name = "") |
| 4773 |
{ |
| 4774 |
struct v4l2_mpeg_vbi_itv0 *p = (struct v4l2_mpeg_vbi_itv0 *) calloc(1, sizeof(v4l2_mpeg_vbi_itv0)); |
| 4775 |
|
| 4776 |
json_object *v4l2_mpeg_vbi_itv0_obj; |
| 4777 |
if (key_name.empty()) |
| 4778 |
json_object_object_get_ex(parent_obj, "v4l2_mpeg_vbi_itv0", &v4l2_mpeg_vbi_itv0_obj); |
| 4779 |
else |
| 4780 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_mpeg_vbi_itv0_obj); |
| 4781 |
|
| 4782 |
json_object *linemask_obj; |
| 4783 |
if (json_object_object_get_ex(v4l2_mpeg_vbi_itv0_obj, "linemask", &linemask_obj)) |
| 4784 |
if (json_object_get_string(linemask_obj) != nullptr) |
| 4785 |
memcpy(p->linemask, json_object_get_string(linemask_obj), 2); |
| 4786 |
|
| 4787 |
//struct v4l2_mpeg_vbi_itv0_line line[35]; |
| 4788 |
return p; |
| 4789 |
} |
| 4790 |
struct v4l2_mpeg_vbi_fmt_ivtv *retrace_v4l2_mpeg_vbi_fmt_ivtv_gen(json_object *parent_obj, std::string key_name = "") |
| 4791 |
{ |
| 4792 |
struct v4l2_mpeg_vbi_fmt_ivtv *p = (struct v4l2_mpeg_vbi_fmt_ivtv *) calloc(1, sizeof(v4l2_mpeg_vbi_fmt_ivtv)); |
| 4793 |
|
| 4794 |
json_object *v4l2_mpeg_vbi_fmt_ivtv_obj; |
| 4795 |
if (key_name.empty()) |
| 4796 |
json_object_object_get_ex(parent_obj, "v4l2_mpeg_vbi_fmt_ivtv", &v4l2_mpeg_vbi_fmt_ivtv_obj); |
| 4797 |
else |
| 4798 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_mpeg_vbi_fmt_ivtv_obj); |
| 4799 |
|
| 4800 |
json_object *magic_obj; |
| 4801 |
if (json_object_object_get_ex(v4l2_mpeg_vbi_fmt_ivtv_obj, "magic", &magic_obj)) |
| 4802 |
if (json_object_get_string(magic_obj) != nullptr) |
| 4803 |
memcpy(p->magic, json_object_get_string(magic_obj), 4); |
| 4804 |
|
| 4805 |
//union |
| 4806 |
//struct v4l2_mpeg_vbi_itv0 itv0; |
| 4807 |
//struct v4l2_mpeg_vbi_ITV0 ITV0; |
| 4808 |
//end of union }; |
| 4809 |
return p; |
| 4810 |
} |
| 4811 |
struct v4l2_plane_pix_format *retrace_v4l2_plane_pix_format_gen(json_object *parent_obj, std::string key_name = "") |
| 4812 |
{ |
| 4813 |
struct v4l2_plane_pix_format *p = (struct v4l2_plane_pix_format *) calloc(1, sizeof(v4l2_plane_pix_format)); |
| 4814 |
|
| 4815 |
json_object *v4l2_plane_pix_format_obj; |
| 4816 |
if (key_name.empty()) |
| 4817 |
json_object_object_get_ex(parent_obj, "v4l2_plane_pix_format", &v4l2_plane_pix_format_obj); |
| 4818 |
else |
| 4819 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_plane_pix_format_obj); |
| 4820 |
|
| 4821 |
json_object *sizeimage_obj; |
| 4822 |
if (json_object_object_get_ex(v4l2_plane_pix_format_obj, "sizeimage", &sizeimage_obj)) |
| 4823 |
p->sizeimage = (__u32) json_object_get_int64(sizeimage_obj); |
| 4824 |
|
| 4825 |
json_object *bytesperline_obj; |
| 4826 |
if (json_object_object_get_ex(v4l2_plane_pix_format_obj, "bytesperline", &bytesperline_obj)) |
| 4827 |
p->bytesperline = (__u32) json_object_get_int64(bytesperline_obj); |
| 4828 |
|
| 4829 |
return p; |
| 4830 |
} |
| 4831 |
struct v4l2_pix_format_mplane *retrace_v4l2_pix_format_mplane_gen(json_object *parent_obj, std::string key_name = "") |
| 4832 |
{ |
| 4833 |
struct v4l2_pix_format_mplane *p = (struct v4l2_pix_format_mplane *) calloc(1, sizeof(v4l2_pix_format_mplane)); |
| 4834 |
|
| 4835 |
json_object *v4l2_pix_format_mplane_obj; |
| 4836 |
if (key_name.empty()) |
| 4837 |
json_object_object_get_ex(parent_obj, "v4l2_pix_format_mplane", &v4l2_pix_format_mplane_obj); |
| 4838 |
else |
| 4839 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_pix_format_mplane_obj); |
| 4840 |
|
| 4841 |
json_object *width_obj; |
| 4842 |
if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "width", &width_obj)) |
| 4843 |
p->width = (__u32) json_object_get_int64(width_obj); |
| 4844 |
|
| 4845 |
json_object *height_obj; |
| 4846 |
if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "height", &height_obj)) |
| 4847 |
p->height = (__u32) json_object_get_int64(height_obj); |
| 4848 |
|
| 4849 |
json_object *pixelformat_obj; |
| 4850 |
if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "pixelformat", &pixelformat_obj)) |
| 4851 |
p->pixelformat = (__u32) s2val(json_object_get_string(pixelformat_obj), v4l2_pix_fmt_val_def); |
| 4852 |
json_object *field_obj; |
| 4853 |
if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "field", &field_obj)) |
| 4854 |
p->field = (__u32) s2val(json_object_get_string(field_obj), v4l2_field_val_def); |
| 4855 |
json_object *colorspace_obj; |
| 4856 |
if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "colorspace", &colorspace_obj)) |
| 4857 |
p->colorspace = (__u32) s2val(json_object_get_string(colorspace_obj), v4l2_colorspace_val_def); |
| 4858 |
//struct v4l2_plane_pix_format plane_fmt[VIDEO_MAX_PLANES]; |
| 4859 |
json_object *num_planes_obj; |
| 4860 |
if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "num_planes", &num_planes_obj)) |
| 4861 |
p->num_planes = (__u8) json_object_get_int(num_planes_obj); |
| 4862 |
|
| 4863 |
json_object *plane_fmt_obj; |
| 4864 |
if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "plane_fmt", &plane_fmt_obj)) { |
| 4865 |
for (int i = 0; i < (std::min((int) p->num_planes, VIDEO_MAX_PLANES)); i++) { |
| 4866 |
if (json_object_array_get_idx(plane_fmt_obj, i)) { |
| 4867 |
json_object *element_obj = json_object_new_object(); |
| 4868 |
json_object_object_add(element_obj, "v4l2_plane_pix_format", json_object_array_get_idx(plane_fmt_obj, i)); |
| 4869 |
void *ptr = (void *) retrace_v4l2_plane_pix_format_gen(element_obj); |
| 4870 |
p->plane_fmt[i] = *static_cast<struct v4l2_plane_pix_format *>(ptr); |
| 4871 |
free(ptr); |
| 4872 |
} |
| 4873 |
} |
| 4874 |
} |
| 4875 |
|
| 4876 |
json_object *flags_obj; |
| 4877 |
if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "flags", &flags_obj)) |
| 4878 |
p->flags = (__u8) s2flags(json_object_get_string(flags_obj), v4l2_pix_fmt_flag_def); |
| 4879 |
|
| 4880 |
//union |
| 4881 |
json_object *ycbcr_enc_obj; |
| 4882 |
if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "ycbcr_enc", &ycbcr_enc_obj)) |
| 4883 |
p->ycbcr_enc = (__u8) s2val(json_object_get_string(ycbcr_enc_obj), v4l2_ycbcr_encoding_val_def); |
| 4884 |
json_object *hsv_enc_obj; |
| 4885 |
if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "hsv_enc", &hsv_enc_obj)) |
| 4886 |
p->hsv_enc = (__u8) json_object_get_int(hsv_enc_obj); |
| 4887 |
|
| 4888 |
//end of union }; |
| 4889 |
json_object *quantization_obj; |
| 4890 |
if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "quantization", &quantization_obj)) |
| 4891 |
p->quantization = (__u8) s2val(json_object_get_string(quantization_obj), v4l2_quantization_val_def); |
| 4892 |
json_object *xfer_func_obj; |
| 4893 |
if (json_object_object_get_ex(v4l2_pix_format_mplane_obj, "xfer_func", &xfer_func_obj)) |
| 4894 |
p->xfer_func = (__u8) s2val(json_object_get_string(xfer_func_obj), v4l2_xfer_func_val_def); |
| 4895 |
return p; |
| 4896 |
} |
| 4897 |
struct v4l2_sdr_format *retrace_v4l2_sdr_format_gen(json_object *parent_obj, std::string key_name = "") |
| 4898 |
{ |
| 4899 |
struct v4l2_sdr_format *p = (struct v4l2_sdr_format *) calloc(1, sizeof(v4l2_sdr_format)); |
| 4900 |
|
| 4901 |
json_object *v4l2_sdr_format_obj; |
| 4902 |
if (key_name.empty()) |
| 4903 |
json_object_object_get_ex(parent_obj, "v4l2_sdr_format", &v4l2_sdr_format_obj); |
| 4904 |
else |
| 4905 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_sdr_format_obj); |
| 4906 |
|
| 4907 |
json_object *pixelformat_obj; |
| 4908 |
if (json_object_object_get_ex(v4l2_sdr_format_obj, "pixelformat", &pixelformat_obj)) |
| 4909 |
p->pixelformat = (__u32) s2val(json_object_get_string(pixelformat_obj), v4l2_pix_fmt_val_def); |
| 4910 |
json_object *buffersize_obj; |
| 4911 |
if (json_object_object_get_ex(v4l2_sdr_format_obj, "buffersize", &buffersize_obj)) |
| 4912 |
p->buffersize = (__u32) json_object_get_int64(buffersize_obj); |
| 4913 |
|
| 4914 |
return p; |
| 4915 |
} |
| 4916 |
struct v4l2_meta_format *retrace_v4l2_meta_format_gen(json_object *parent_obj, std::string key_name = "") |
| 4917 |
{ |
| 4918 |
struct v4l2_meta_format *p = (struct v4l2_meta_format *) calloc(1, sizeof(v4l2_meta_format)); |
| 4919 |
|
| 4920 |
json_object *v4l2_meta_format_obj; |
| 4921 |
if (key_name.empty()) |
| 4922 |
json_object_object_get_ex(parent_obj, "v4l2_meta_format", &v4l2_meta_format_obj); |
| 4923 |
else |
| 4924 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_meta_format_obj); |
| 4925 |
|
| 4926 |
json_object *dataformat_obj; |
| 4927 |
if (json_object_object_get_ex(v4l2_meta_format_obj, "dataformat", &dataformat_obj)) |
| 4928 |
p->dataformat = (__u32) json_object_get_int64(dataformat_obj); |
| 4929 |
|
| 4930 |
json_object *buffersize_obj; |
| 4931 |
if (json_object_object_get_ex(v4l2_meta_format_obj, "buffersize", &buffersize_obj)) |
| 4932 |
p->buffersize = (__u32) json_object_get_int64(buffersize_obj); |
| 4933 |
|
| 4934 |
json_object *width_obj; |
| 4935 |
if (json_object_object_get_ex(v4l2_meta_format_obj, "width", &width_obj)) |
| 4936 |
p->width = (__u32) json_object_get_int64(width_obj); |
| 4937 |
|
| 4938 |
json_object *height_obj; |
| 4939 |
if (json_object_object_get_ex(v4l2_meta_format_obj, "height", &height_obj)) |
| 4940 |
p->height = (__u32) json_object_get_int64(height_obj); |
| 4941 |
|
| 4942 |
json_object *bytesperline_obj; |
| 4943 |
if (json_object_object_get_ex(v4l2_meta_format_obj, "bytesperline", &bytesperline_obj)) |
| 4944 |
p->bytesperline = (__u32) json_object_get_int64(bytesperline_obj); |
| 4945 |
|
| 4946 |
return p; |
| 4947 |
} |
| 4948 |
struct v4l2_format *retrace_v4l2_format_gen(json_object *parent_obj, std::string key_name = "") |
| 4949 |
{ |
| 4950 |
struct v4l2_format *p = (struct v4l2_format *) calloc(1, sizeof(v4l2_format)); |
| 4951 |
|
| 4952 |
json_object *v4l2_format_obj; |
| 4953 |
if (key_name.empty()) |
| 4954 |
json_object_object_get_ex(parent_obj, "v4l2_format", &v4l2_format_obj); |
| 4955 |
else |
| 4956 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_format_obj); |
| 4957 |
|
| 4958 |
json_object *type_obj; |
| 4959 |
if (json_object_object_get_ex(v4l2_format_obj, "type", &type_obj)) |
| 4960 |
p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_buf_type_val_def); |
| 4961 |
//union |
| 4962 |
switch (p->type) { |
| 4963 |
case V4L2_BUF_TYPE_VIDEO_CAPTURE: |
| 4964 |
case V4L2_BUF_TYPE_VIDEO_OUTPUT: { |
| 4965 |
void *pix_ptr = (void *) retrace_v4l2_pix_format_gen(v4l2_format_obj); |
| 4966 |
p->fmt.pix = *static_cast<struct v4l2_pix_format*>(pix_ptr); |
| 4967 |
free(pix_ptr); |
| 4968 |
break; |
| 4969 |
} |
| 4970 |
case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: |
| 4971 |
case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: { |
| 4972 |
void *pix_mp_ptr = (void *) retrace_v4l2_pix_format_mplane_gen(v4l2_format_obj); |
| 4973 |
p->fmt.pix_mp = *static_cast<struct v4l2_pix_format_mplane*>(pix_mp_ptr); |
| 4974 |
free(pix_mp_ptr); |
| 4975 |
break; |
| 4976 |
} |
| 4977 |
default: |
| 4978 |
break; |
| 4979 |
} |
| 4980 |
//struct v4l2_pix_format pix; |
| 4981 |
//struct v4l2_pix_format_mplane pix_mp; |
| 4982 |
//struct v4l2_window win; |
| 4983 |
//struct v4l2_vbi_format vbi; |
| 4984 |
//struct v4l2_sliced_vbi_format sliced; |
| 4985 |
//struct v4l2_sdr_format sdr; |
| 4986 |
//struct v4l2_meta_format meta; |
| 4987 |
//end of union } fmt; |
| 4988 |
return p; |
| 4989 |
} |
| 4990 |
struct v4l2_streamparm *retrace_v4l2_streamparm_gen(json_object *parent_obj, std::string key_name = "") |
| 4991 |
{ |
| 4992 |
struct v4l2_streamparm *p = (struct v4l2_streamparm *) calloc(1, sizeof(v4l2_streamparm)); |
| 4993 |
|
| 4994 |
json_object *v4l2_streamparm_obj; |
| 4995 |
if (key_name.empty()) |
| 4996 |
json_object_object_get_ex(parent_obj, "v4l2_streamparm", &v4l2_streamparm_obj); |
| 4997 |
else |
| 4998 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_streamparm_obj); |
| 4999 |
|
| 5000 |
json_object *type_obj; |
| 5001 |
if (json_object_object_get_ex(v4l2_streamparm_obj, "type", &type_obj)) |
| 5002 |
p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_buf_type_val_def); |
| 5003 |
//union |
| 5004 |
//struct v4l2_captureparm capture; |
| 5005 |
//struct v4l2_outputparm output; |
| 5006 |
//end of union } parm; |
| 5007 |
return p; |
| 5008 |
} |
| 5009 |
struct v4l2_event_vsync *retrace_v4l2_event_vsync_gen(json_object *parent_obj, std::string key_name = "") |
| 5010 |
{ |
| 5011 |
struct v4l2_event_vsync *p = (struct v4l2_event_vsync *) calloc(1, sizeof(v4l2_event_vsync)); |
| 5012 |
|
| 5013 |
json_object *v4l2_event_vsync_obj; |
| 5014 |
if (key_name.empty()) |
| 5015 |
json_object_object_get_ex(parent_obj, "v4l2_event_vsync", &v4l2_event_vsync_obj); |
| 5016 |
else |
| 5017 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_event_vsync_obj); |
| 5018 |
|
| 5019 |
json_object *field_obj; |
| 5020 |
if (json_object_object_get_ex(v4l2_event_vsync_obj, "field", &field_obj)) |
| 5021 |
p->field = (__u8) s2val(json_object_get_string(field_obj), v4l2_field_val_def); |
| 5022 |
return p; |
| 5023 |
} |
| 5024 |
struct v4l2_event_ctrl *retrace_v4l2_event_ctrl_gen(json_object *parent_obj, std::string key_name = "") |
| 5025 |
{ |
| 5026 |
struct v4l2_event_ctrl *p = (struct v4l2_event_ctrl *) calloc(1, sizeof(v4l2_event_ctrl)); |
| 5027 |
|
| 5028 |
json_object *v4l2_event_ctrl_obj; |
| 5029 |
if (key_name.empty()) |
| 5030 |
json_object_object_get_ex(parent_obj, "v4l2_event_ctrl", &v4l2_event_ctrl_obj); |
| 5031 |
else |
| 5032 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_event_ctrl_obj); |
| 5033 |
|
| 5034 |
json_object *changes_obj; |
| 5035 |
if (json_object_object_get_ex(v4l2_event_ctrl_obj, "changes", &changes_obj)) |
| 5036 |
p->changes = (__u32) s2flags(json_object_get_string(changes_obj), v4l2_event_ctrl_ch_flag_def); |
| 5037 |
|
| 5038 |
json_object *type_obj; |
| 5039 |
if (json_object_object_get_ex(v4l2_event_ctrl_obj, "type", &type_obj)) |
| 5040 |
p->type = (__u32) s2val(json_object_get_string(type_obj), v4l2_ctrl_type_val_def); |
| 5041 |
//union |
| 5042 |
//__s32 value; |
| 5043 |
//__s64 value64; |
| 5044 |
//end of union }; |
| 5045 |
json_object *flags_obj; |
| 5046 |
if (json_object_object_get_ex(v4l2_event_ctrl_obj, "flags", &flags_obj)) |
| 5047 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_ctrl_flag_def); |
| 5048 |
|
| 5049 |
json_object *minimum_obj; |
| 5050 |
if (json_object_object_get_ex(v4l2_event_ctrl_obj, "minimum", &minimum_obj)) |
| 5051 |
p->minimum = (__s32) json_object_get_int(minimum_obj); |
| 5052 |
|
| 5053 |
json_object *maximum_obj; |
| 5054 |
if (json_object_object_get_ex(v4l2_event_ctrl_obj, "maximum", &maximum_obj)) |
| 5055 |
p->maximum = (__s32) json_object_get_int(maximum_obj); |
| 5056 |
|
| 5057 |
json_object *step_obj; |
| 5058 |
if (json_object_object_get_ex(v4l2_event_ctrl_obj, "step", &step_obj)) |
| 5059 |
p->step = (__s32) json_object_get_int(step_obj); |
| 5060 |
|
| 5061 |
json_object *default_value_obj; |
| 5062 |
if (json_object_object_get_ex(v4l2_event_ctrl_obj, "default_value", &default_value_obj)) |
| 5063 |
p->default_value = (__s32) json_object_get_int(default_value_obj); |
| 5064 |
|
| 5065 |
return p; |
| 5066 |
} |
| 5067 |
struct v4l2_event_frame_sync *retrace_v4l2_event_frame_sync_gen(json_object *parent_obj, std::string key_name = "") |
| 5068 |
{ |
| 5069 |
struct v4l2_event_frame_sync *p = (struct v4l2_event_frame_sync *) calloc(1, sizeof(v4l2_event_frame_sync)); |
| 5070 |
|
| 5071 |
json_object *v4l2_event_frame_sync_obj; |
| 5072 |
if (key_name.empty()) |
| 5073 |
json_object_object_get_ex(parent_obj, "v4l2_event_frame_sync", &v4l2_event_frame_sync_obj); |
| 5074 |
else |
| 5075 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_event_frame_sync_obj); |
| 5076 |
|
| 5077 |
json_object *frame_sequence_obj; |
| 5078 |
if (json_object_object_get_ex(v4l2_event_frame_sync_obj, "frame_sequence", &frame_sequence_obj)) |
| 5079 |
p->frame_sequence = (__u32) json_object_get_int64(frame_sequence_obj); |
| 5080 |
|
| 5081 |
return p; |
| 5082 |
} |
| 5083 |
struct v4l2_event_src_change *retrace_v4l2_event_src_change_gen(json_object *parent_obj, std::string key_name = "") |
| 5084 |
{ |
| 5085 |
struct v4l2_event_src_change *p = (struct v4l2_event_src_change *) calloc(1, sizeof(v4l2_event_src_change)); |
| 5086 |
|
| 5087 |
json_object *v4l2_event_src_change_obj; |
| 5088 |
if (key_name.empty()) |
| 5089 |
json_object_object_get_ex(parent_obj, "v4l2_event_src_change", &v4l2_event_src_change_obj); |
| 5090 |
else |
| 5091 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_event_src_change_obj); |
| 5092 |
|
| 5093 |
json_object *changes_obj; |
| 5094 |
if (json_object_object_get_ex(v4l2_event_src_change_obj, "changes", &changes_obj)) |
| 5095 |
p->changes = (__u32) json_object_get_int64(changes_obj); |
| 5096 |
|
| 5097 |
return p; |
| 5098 |
} |
| 5099 |
struct v4l2_event_motion_det *retrace_v4l2_event_motion_det_gen(json_object *parent_obj, std::string key_name = "") |
| 5100 |
{ |
| 5101 |
struct v4l2_event_motion_det *p = (struct v4l2_event_motion_det *) calloc(1, sizeof(v4l2_event_motion_det)); |
| 5102 |
|
| 5103 |
json_object *v4l2_event_motion_det_obj; |
| 5104 |
if (key_name.empty()) |
| 5105 |
json_object_object_get_ex(parent_obj, "v4l2_event_motion_det", &v4l2_event_motion_det_obj); |
| 5106 |
else |
| 5107 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_event_motion_det_obj); |
| 5108 |
|
| 5109 |
json_object *flags_obj; |
| 5110 |
if (json_object_object_get_ex(v4l2_event_motion_det_obj, "flags", &flags_obj)) |
| 5111 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr); |
| 5112 |
|
| 5113 |
json_object *frame_sequence_obj; |
| 5114 |
if (json_object_object_get_ex(v4l2_event_motion_det_obj, "frame_sequence", &frame_sequence_obj)) |
| 5115 |
p->frame_sequence = (__u32) json_object_get_int64(frame_sequence_obj); |
| 5116 |
|
| 5117 |
json_object *region_mask_obj; |
| 5118 |
if (json_object_object_get_ex(v4l2_event_motion_det_obj, "region_mask", ®ion_mask_obj)) |
| 5119 |
p->region_mask = (__u32) json_object_get_int64(region_mask_obj); |
| 5120 |
|
| 5121 |
return p; |
| 5122 |
} |
| 5123 |
struct v4l2_event *retrace_v4l2_event_gen(json_object *parent_obj, std::string key_name = "") |
| 5124 |
{ |
| 5125 |
struct v4l2_event *p = (struct v4l2_event *) calloc(1, sizeof(v4l2_event)); |
| 5126 |
|
| 5127 |
json_object *v4l2_event_obj; |
| 5128 |
if (key_name.empty()) |
| 5129 |
json_object_object_get_ex(parent_obj, "v4l2_event", &v4l2_event_obj); |
| 5130 |
else |
| 5131 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_event_obj); |
| 5132 |
|
| 5133 |
json_object *type_obj; |
| 5134 |
if (json_object_object_get_ex(v4l2_event_obj, "type", &type_obj)) |
| 5135 |
p->type = (__u32) s2val(json_object_get_string(type_obj), event_val_def); |
| 5136 |
//union |
| 5137 |
//struct v4l2_event_vsync vsync; |
| 5138 |
//struct v4l2_event_ctrl ctrl; |
| 5139 |
//struct v4l2_event_frame_sync frame_sync; |
| 5140 |
//struct v4l2_event_src_change src_change; |
| 5141 |
//struct v4l2_event_motion_det motion_det; |
| 5142 |
//__u8 data[64]; |
| 5143 |
//end of union } u; |
| 5144 |
json_object *pending_obj; |
| 5145 |
if (json_object_object_get_ex(v4l2_event_obj, "pending", &pending_obj)) |
| 5146 |
p->pending = (__u32) json_object_get_int64(pending_obj); |
| 5147 |
|
| 5148 |
json_object *sequence_obj; |
| 5149 |
if (json_object_object_get_ex(v4l2_event_obj, "sequence", &sequence_obj)) |
| 5150 |
p->sequence = (__u32) json_object_get_int64(sequence_obj); |
| 5151 |
|
| 5152 |
//struct timespec timestamp; |
| 5153 |
json_object *id_obj; |
| 5154 |
if (json_object_object_get_ex(v4l2_event_obj, "id", &id_obj)) |
| 5155 |
p->id = (__u32) s2val(json_object_get_string(id_obj), nullptr); |
| 5156 |
return p; |
| 5157 |
} |
| 5158 |
struct v4l2_event_subscription *retrace_v4l2_event_subscription_gen(json_object *parent_obj, std::string key_name = "") |
| 5159 |
{ |
| 5160 |
struct v4l2_event_subscription *p = (struct v4l2_event_subscription *) calloc(1, sizeof(v4l2_event_subscription)); |
| 5161 |
|
| 5162 |
json_object *v4l2_event_subscription_obj; |
| 5163 |
if (key_name.empty()) |
| 5164 |
json_object_object_get_ex(parent_obj, "v4l2_event_subscription", &v4l2_event_subscription_obj); |
| 5165 |
else |
| 5166 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_event_subscription_obj); |
| 5167 |
|
| 5168 |
json_object *type_obj; |
| 5169 |
if (json_object_object_get_ex(v4l2_event_subscription_obj, "type", &type_obj)) |
| 5170 |
p->type = (__u32) s2val(json_object_get_string(type_obj), event_val_def); |
| 5171 |
json_object *id_obj; |
| 5172 |
if (json_object_object_get_ex(v4l2_event_subscription_obj, "id", &id_obj)) |
| 5173 |
p->id = (__u32) s2val(json_object_get_string(id_obj), nullptr); |
| 5174 |
json_object *flags_obj; |
| 5175 |
if (json_object_object_get_ex(v4l2_event_subscription_obj, "flags", &flags_obj)) |
| 5176 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_event_sub_flag_def); |
| 5177 |
|
| 5178 |
return p; |
| 5179 |
} |
| 5180 |
struct v4l2_dbg_match *retrace_v4l2_dbg_match_gen(json_object *parent_obj, std::string key_name = "") |
| 5181 |
{ |
| 5182 |
struct v4l2_dbg_match *p = (struct v4l2_dbg_match *) calloc(1, sizeof(v4l2_dbg_match)); |
| 5183 |
|
| 5184 |
json_object *v4l2_dbg_match_obj; |
| 5185 |
if (key_name.empty()) |
| 5186 |
json_object_object_get_ex(parent_obj, "v4l2_dbg_match", &v4l2_dbg_match_obj); |
| 5187 |
else |
| 5188 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_dbg_match_obj); |
| 5189 |
|
| 5190 |
json_object *type_obj; |
| 5191 |
if (json_object_object_get_ex(v4l2_dbg_match_obj, "type", &type_obj)) |
| 5192 |
p->type = (__u32) s2val(json_object_get_string(type_obj), nullptr); |
| 5193 |
//union |
| 5194 |
//__u32 addr; |
| 5195 |
//char name[32]; |
| 5196 |
//end of union }; |
| 5197 |
return p; |
| 5198 |
} |
| 5199 |
struct v4l2_dbg_register *retrace_v4l2_dbg_register_gen(json_object *parent_obj, std::string key_name = "") |
| 5200 |
{ |
| 5201 |
struct v4l2_dbg_register *p = (struct v4l2_dbg_register *) calloc(1, sizeof(v4l2_dbg_register)); |
| 5202 |
|
| 5203 |
json_object *v4l2_dbg_register_obj; |
| 5204 |
if (key_name.empty()) |
| 5205 |
json_object_object_get_ex(parent_obj, "v4l2_dbg_register", &v4l2_dbg_register_obj); |
| 5206 |
else |
| 5207 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_dbg_register_obj); |
| 5208 |
|
| 5209 |
//struct v4l2_dbg_match match; |
| 5210 |
void *match_ptr = (void *) retrace_v4l2_dbg_match_gen(v4l2_dbg_register_obj, "match"); |
| 5211 |
p->match = *static_cast<struct v4l2_dbg_match*>(match_ptr); |
| 5212 |
free(match_ptr); |
| 5213 |
|
| 5214 |
json_object *size_obj; |
| 5215 |
if (json_object_object_get_ex(v4l2_dbg_register_obj, "size", &size_obj)) |
| 5216 |
p->size = (__u32) json_object_get_int64(size_obj); |
| 5217 |
|
| 5218 |
json_object *reg_obj; |
| 5219 |
if (json_object_object_get_ex(v4l2_dbg_register_obj, "reg", ®_obj)) |
| 5220 |
p->reg = (__u64) json_object_get_uint64(reg_obj); |
| 5221 |
|
| 5222 |
json_object *val_obj; |
| 5223 |
if (json_object_object_get_ex(v4l2_dbg_register_obj, "val", &val_obj)) |
| 5224 |
p->val = (__u64) json_object_get_uint64(val_obj); |
| 5225 |
|
| 5226 |
return p; |
| 5227 |
} |
| 5228 |
struct v4l2_dbg_chip_info *retrace_v4l2_dbg_chip_info_gen(json_object *parent_obj, std::string key_name = "") |
| 5229 |
{ |
| 5230 |
struct v4l2_dbg_chip_info *p = (struct v4l2_dbg_chip_info *) calloc(1, sizeof(v4l2_dbg_chip_info)); |
| 5231 |
|
| 5232 |
json_object *v4l2_dbg_chip_info_obj; |
| 5233 |
if (key_name.empty()) |
| 5234 |
json_object_object_get_ex(parent_obj, "v4l2_dbg_chip_info", &v4l2_dbg_chip_info_obj); |
| 5235 |
else |
| 5236 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_dbg_chip_info_obj); |
| 5237 |
|
| 5238 |
//struct v4l2_dbg_match match; |
| 5239 |
void *match_ptr = (void *) retrace_v4l2_dbg_match_gen(v4l2_dbg_chip_info_obj, "match"); |
| 5240 |
p->match = *static_cast<struct v4l2_dbg_match*>(match_ptr); |
| 5241 |
free(match_ptr); |
| 5242 |
|
| 5243 |
json_object *name_obj; |
| 5244 |
if (json_object_object_get_ex(v4l2_dbg_chip_info_obj, "name", &name_obj)) |
| 5245 |
if (json_object_get_string(name_obj) != nullptr) |
| 5246 |
memcpy(p->name, json_object_get_string(name_obj), 32); |
| 5247 |
|
| 5248 |
json_object *flags_obj; |
| 5249 |
if (json_object_object_get_ex(v4l2_dbg_chip_info_obj, "flags", &flags_obj)) |
| 5250 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr); |
| 5251 |
|
| 5252 |
return p; |
| 5253 |
} |
| 5254 |
struct v4l2_create_buffers *retrace_v4l2_create_buffers_gen(json_object *parent_obj, std::string key_name = "") |
| 5255 |
{ |
| 5256 |
struct v4l2_create_buffers *p = (struct v4l2_create_buffers *) calloc(1, sizeof(v4l2_create_buffers)); |
| 5257 |
|
| 5258 |
json_object *v4l2_create_buffers_obj; |
| 5259 |
if (key_name.empty()) |
| 5260 |
json_object_object_get_ex(parent_obj, "v4l2_create_buffers", &v4l2_create_buffers_obj); |
| 5261 |
else |
| 5262 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_create_buffers_obj); |
| 5263 |
|
| 5264 |
json_object *index_obj; |
| 5265 |
if (json_object_object_get_ex(v4l2_create_buffers_obj, "index", &index_obj)) |
| 5266 |
p->index = (__u32) json_object_get_int64(index_obj); |
| 5267 |
|
| 5268 |
json_object *count_obj; |
| 5269 |
if (json_object_object_get_ex(v4l2_create_buffers_obj, "count", &count_obj)) |
| 5270 |
p->count = (__u32) json_object_get_int64(count_obj); |
| 5271 |
|
| 5272 |
json_object *memory_obj; |
| 5273 |
if (json_object_object_get_ex(v4l2_create_buffers_obj, "memory", &memory_obj)) |
| 5274 |
p->memory = (__u32) s2val(json_object_get_string(memory_obj), v4l2_memory_val_def); |
| 5275 |
//struct v4l2_format format; |
| 5276 |
void *format_ptr = (void *) retrace_v4l2_format_gen(v4l2_create_buffers_obj, "format"); |
| 5277 |
p->format = *static_cast<struct v4l2_format*>(format_ptr); |
| 5278 |
free(format_ptr); |
| 5279 |
|
| 5280 |
json_object *capabilities_obj; |
| 5281 |
if (json_object_object_get_ex(v4l2_create_buffers_obj, "capabilities", &capabilities_obj)) |
| 5282 |
p->capabilities = (__u32) s2flags(json_object_get_string(capabilities_obj), v4l2_buf_cap_flag_def); |
| 5283 |
|
| 5284 |
json_object *flags_obj; |
| 5285 |
if (json_object_object_get_ex(v4l2_create_buffers_obj, "flags", &flags_obj)) |
| 5286 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), v4l2_memory_flag_def); |
| 5287 |
|
| 5288 |
json_object *max_num_buffers_obj; |
| 5289 |
if (json_object_object_get_ex(v4l2_create_buffers_obj, "max_num_buffers", &max_num_buffers_obj)) |
| 5290 |
p->max_num_buffers = (__u32) json_object_get_int64(max_num_buffers_obj); |
| 5291 |
|
| 5292 |
return p; |
| 5293 |
} |
| 5294 |
struct v4l2_remove_buffers *retrace_v4l2_remove_buffers_gen(json_object *parent_obj, std::string key_name = "") |
| 5295 |
{ |
| 5296 |
struct v4l2_remove_buffers *p = (struct v4l2_remove_buffers *) calloc(1, sizeof(v4l2_remove_buffers)); |
| 5297 |
|
| 5298 |
json_object *v4l2_remove_buffers_obj; |
| 5299 |
if (key_name.empty()) |
| 5300 |
json_object_object_get_ex(parent_obj, "v4l2_remove_buffers", &v4l2_remove_buffers_obj); |
| 5301 |
else |
| 5302 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_remove_buffers_obj); |
| 5303 |
|
| 5304 |
json_object *index_obj; |
| 5305 |
if (json_object_object_get_ex(v4l2_remove_buffers_obj, "index", &index_obj)) |
| 5306 |
p->index = (__u32) json_object_get_int64(index_obj); |
| 5307 |
|
| 5308 |
json_object *count_obj; |
| 5309 |
if (json_object_object_get_ex(v4l2_remove_buffers_obj, "count", &count_obj)) |
| 5310 |
p->count = (__u32) json_object_get_int64(count_obj); |
| 5311 |
|
| 5312 |
json_object *type_obj; |
| 5313 |
if (json_object_object_get_ex(v4l2_remove_buffers_obj, "type", &type_obj)) |
| 5314 |
p->type = (__u32) s2val(json_object_get_string(type_obj), nullptr); |
| 5315 |
return p; |
| 5316 |
} |
| 5317 |
struct media_device_info *retrace_media_device_info_gen(json_object *parent_obj, std::string key_name = "") |
| 5318 |
{ |
| 5319 |
struct media_device_info *p = (struct media_device_info *) calloc(1, sizeof(media_device_info)); |
| 5320 |
|
| 5321 |
json_object *media_device_info_obj; |
| 5322 |
if (key_name.empty()) |
| 5323 |
json_object_object_get_ex(parent_obj, "media_device_info", &media_device_info_obj); |
| 5324 |
else |
| 5325 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &media_device_info_obj); |
| 5326 |
|
| 5327 |
json_object *driver_obj; |
| 5328 |
if (json_object_object_get_ex(media_device_info_obj, "driver", &driver_obj)) |
| 5329 |
if (json_object_get_string(driver_obj) != nullptr) |
| 5330 |
memcpy(p->driver, json_object_get_string(driver_obj), 16); |
| 5331 |
|
| 5332 |
json_object *model_obj; |
| 5333 |
if (json_object_object_get_ex(media_device_info_obj, "model", &model_obj)) |
| 5334 |
if (json_object_get_string(model_obj) != nullptr) |
| 5335 |
memcpy(p->model, json_object_get_string(model_obj), 32); |
| 5336 |
|
| 5337 |
json_object *serial_obj; |
| 5338 |
if (json_object_object_get_ex(media_device_info_obj, "serial", &serial_obj)) |
| 5339 |
if (json_object_get_string(serial_obj) != nullptr) |
| 5340 |
memcpy(p->serial, json_object_get_string(serial_obj), 40); |
| 5341 |
|
| 5342 |
json_object *bus_info_obj; |
| 5343 |
if (json_object_object_get_ex(media_device_info_obj, "bus_info", &bus_info_obj)) |
| 5344 |
if (json_object_get_string(bus_info_obj) != nullptr) |
| 5345 |
memcpy(p->bus_info, json_object_get_string(bus_info_obj), 32); |
| 5346 |
|
| 5347 |
json_object *media_version_obj; |
| 5348 |
if (json_object_object_get_ex(media_device_info_obj, "media_version", &media_version_obj)) |
| 5349 |
memset(&p->media_version, 0, sizeof(p->media_version)); |
| 5350 |
|
| 5351 |
json_object *hw_revision_obj; |
| 5352 |
if (json_object_object_get_ex(media_device_info_obj, "hw_revision", &hw_revision_obj)) |
| 5353 |
p->hw_revision = (__u32) json_object_get_int64(hw_revision_obj); |
| 5354 |
|
| 5355 |
json_object *driver_version_obj; |
| 5356 |
if (json_object_object_get_ex(media_device_info_obj, "driver_version", &driver_version_obj)) |
| 5357 |
memset(&p->driver_version, 0, sizeof(p->driver_version)); |
| 5358 |
|
| 5359 |
return p; |
| 5360 |
} |
| 5361 |
struct media_entity_desc *retrace_media_entity_desc_gen(json_object *parent_obj, std::string key_name = "") |
| 5362 |
{ |
| 5363 |
struct media_entity_desc *p = (struct media_entity_desc *) calloc(1, sizeof(media_entity_desc)); |
| 5364 |
|
| 5365 |
json_object *media_entity_desc_obj; |
| 5366 |
if (key_name.empty()) |
| 5367 |
json_object_object_get_ex(parent_obj, "media_entity_desc", &media_entity_desc_obj); |
| 5368 |
else |
| 5369 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &media_entity_desc_obj); |
| 5370 |
|
| 5371 |
json_object *id_obj; |
| 5372 |
if (json_object_object_get_ex(media_entity_desc_obj, "id", &id_obj)) |
| 5373 |
p->id = (__u32) s2val(json_object_get_string(id_obj), nullptr); |
| 5374 |
json_object *name_obj; |
| 5375 |
if (json_object_object_get_ex(media_entity_desc_obj, "name", &name_obj)) |
| 5376 |
if (json_object_get_string(name_obj) != nullptr) |
| 5377 |
memcpy(p->name, json_object_get_string(name_obj), 32); |
| 5378 |
|
| 5379 |
json_object *type_obj; |
| 5380 |
if (json_object_object_get_ex(media_entity_desc_obj, "type", &type_obj)) |
| 5381 |
p->type = (__u32) s2val(json_object_get_string(type_obj), nullptr); |
| 5382 |
json_object *revision_obj; |
| 5383 |
if (json_object_object_get_ex(media_entity_desc_obj, "revision", &revision_obj)) |
| 5384 |
p->revision = (__u32) json_object_get_int64(revision_obj); |
| 5385 |
|
| 5386 |
json_object *flags_obj; |
| 5387 |
if (json_object_object_get_ex(media_entity_desc_obj, "flags", &flags_obj)) |
| 5388 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr); |
| 5389 |
|
| 5390 |
json_object *group_id_obj; |
| 5391 |
if (json_object_object_get_ex(media_entity_desc_obj, "group_id", &group_id_obj)) |
| 5392 |
p->group_id = (__u32) json_object_get_int64(group_id_obj); |
| 5393 |
|
| 5394 |
json_object *pads_obj; |
| 5395 |
if (json_object_object_get_ex(media_entity_desc_obj, "pads", &pads_obj)) |
| 5396 |
p->pads = (__u16) json_object_get_int(pads_obj); |
| 5397 |
|
| 5398 |
json_object *links_obj; |
| 5399 |
if (json_object_object_get_ex(media_entity_desc_obj, "links", &links_obj)) |
| 5400 |
p->links = (__u16) json_object_get_int(links_obj); |
| 5401 |
|
| 5402 |
//union |
| 5403 |
//struct { |
| 5404 |
//__u32 major; |
| 5405 |
//__u32 minor; |
| 5406 |
//end of union } dev; |
| 5407 |
//struct { |
| 5408 |
//__u32 card; |
| 5409 |
//__u32 device; |
| 5410 |
//__u32 subdevice; |
| 5411 |
//end of struct } alsa; |
| 5412 |
//struct { |
| 5413 |
//__u32 major; |
| 5414 |
//__u32 minor; |
| 5415 |
//end of struct } v4l; |
| 5416 |
//struct { |
| 5417 |
//__u32 major; |
| 5418 |
//__u32 minor; |
| 5419 |
//end of struct } fb; |
| 5420 |
json_object *dvb_obj; |
| 5421 |
if (json_object_object_get_ex(media_entity_desc_obj, "dvb", &dvb_obj)) |
| 5422 |
p->dvb = (int) json_object_get_int(dvb_obj); |
| 5423 |
|
| 5424 |
json_object *raw_obj; |
| 5425 |
if (json_object_object_get_ex(media_entity_desc_obj, "raw", &raw_obj)) |
| 5426 |
if (json_object_get_string(raw_obj) != nullptr) |
| 5427 |
memcpy(p->raw, json_object_get_string(raw_obj), 184); |
| 5428 |
|
| 5429 |
return p; |
| 5430 |
} |
| 5431 |
struct media_pad_desc *retrace_media_pad_desc_gen(json_object *parent_obj, std::string key_name = "") |
| 5432 |
{ |
| 5433 |
struct media_pad_desc *p = (struct media_pad_desc *) calloc(1, sizeof(media_pad_desc)); |
| 5434 |
|
| 5435 |
json_object *media_pad_desc_obj; |
| 5436 |
if (key_name.empty()) |
| 5437 |
json_object_object_get_ex(parent_obj, "media_pad_desc", &media_pad_desc_obj); |
| 5438 |
else |
| 5439 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &media_pad_desc_obj); |
| 5440 |
|
| 5441 |
json_object *entity_obj; |
| 5442 |
if (json_object_object_get_ex(media_pad_desc_obj, "entity", &entity_obj)) |
| 5443 |
p->entity = (__u32) json_object_get_int64(entity_obj); |
| 5444 |
|
| 5445 |
json_object *index_obj; |
| 5446 |
if (json_object_object_get_ex(media_pad_desc_obj, "index", &index_obj)) |
| 5447 |
p->index = (__u16) json_object_get_int(index_obj); |
| 5448 |
|
| 5449 |
json_object *flags_obj; |
| 5450 |
if (json_object_object_get_ex(media_pad_desc_obj, "flags", &flags_obj)) |
| 5451 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr); |
| 5452 |
|
| 5453 |
return p; |
| 5454 |
} |
| 5455 |
struct media_link_desc *retrace_media_link_desc_gen(json_object *parent_obj, std::string key_name = "") |
| 5456 |
{ |
| 5457 |
struct media_link_desc *p = (struct media_link_desc *) calloc(1, sizeof(media_link_desc)); |
| 5458 |
|
| 5459 |
json_object *media_link_desc_obj; |
| 5460 |
if (key_name.empty()) |
| 5461 |
json_object_object_get_ex(parent_obj, "media_link_desc", &media_link_desc_obj); |
| 5462 |
else |
| 5463 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &media_link_desc_obj); |
| 5464 |
|
| 5465 |
//struct media_pad_desc source; |
| 5466 |
void *source_ptr = (void *) retrace_media_pad_desc_gen(media_link_desc_obj, "source"); |
| 5467 |
p->source = *static_cast<struct media_pad_desc*>(source_ptr); |
| 5468 |
free(source_ptr); |
| 5469 |
|
| 5470 |
//struct media_pad_desc sink; |
| 5471 |
void *sink_ptr = (void *) retrace_media_pad_desc_gen(media_link_desc_obj, "sink"); |
| 5472 |
p->sink = *static_cast<struct media_pad_desc*>(sink_ptr); |
| 5473 |
free(sink_ptr); |
| 5474 |
|
| 5475 |
json_object *flags_obj; |
| 5476 |
if (json_object_object_get_ex(media_link_desc_obj, "flags", &flags_obj)) |
| 5477 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr); |
| 5478 |
|
| 5479 |
return p; |
| 5480 |
} |
| 5481 |
struct media_links_enum *retrace_media_links_enum_gen(json_object *parent_obj, std::string key_name = "") |
| 5482 |
{ |
| 5483 |
struct media_links_enum *p = (struct media_links_enum *) calloc(1, sizeof(media_links_enum)); |
| 5484 |
|
| 5485 |
json_object *media_links_enum_obj; |
| 5486 |
if (key_name.empty()) |
| 5487 |
json_object_object_get_ex(parent_obj, "media_links_enum", &media_links_enum_obj); |
| 5488 |
else |
| 5489 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &media_links_enum_obj); |
| 5490 |
|
| 5491 |
json_object *entity_obj; |
| 5492 |
if (json_object_object_get_ex(media_links_enum_obj, "entity", &entity_obj)) |
| 5493 |
p->entity = (__u32) json_object_get_int64(entity_obj); |
| 5494 |
|
| 5495 |
//struct media_pad_desc *pads; |
| 5496 |
//struct media_link_desc *links; |
| 5497 |
return p; |
| 5498 |
} |
| 5499 |
struct media_v2_entity *retrace_media_v2_entity_gen(json_object *parent_obj, std::string key_name = "") |
| 5500 |
{ |
| 5501 |
struct media_v2_entity *p = (struct media_v2_entity *) calloc(1, sizeof(media_v2_entity)); |
| 5502 |
|
| 5503 |
json_object *media_v2_entity_obj; |
| 5504 |
if (key_name.empty()) |
| 5505 |
json_object_object_get_ex(parent_obj, "media_v2_entity", &media_v2_entity_obj); |
| 5506 |
else |
| 5507 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &media_v2_entity_obj); |
| 5508 |
|
| 5509 |
json_object *id_obj; |
| 5510 |
if (json_object_object_get_ex(media_v2_entity_obj, "id", &id_obj)) |
| 5511 |
p->id = (__u32) s2val(json_object_get_string(id_obj), nullptr); |
| 5512 |
json_object *name_obj; |
| 5513 |
if (json_object_object_get_ex(media_v2_entity_obj, "name", &name_obj)) |
| 5514 |
if (json_object_get_string(name_obj) != nullptr) |
| 5515 |
memcpy(p->name, json_object_get_string(name_obj), 64); |
| 5516 |
|
| 5517 |
json_object *function_obj; |
| 5518 |
if (json_object_object_get_ex(media_v2_entity_obj, "function", &function_obj)) |
| 5519 |
p->function = (__u32) json_object_get_int64(function_obj); |
| 5520 |
|
| 5521 |
json_object *flags_obj; |
| 5522 |
if (json_object_object_get_ex(media_v2_entity_obj, "flags", &flags_obj)) |
| 5523 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr); |
| 5524 |
|
| 5525 |
return p; |
| 5526 |
} |
| 5527 |
struct media_v2_intf_devnode *retrace_media_v2_intf_devnode_gen(json_object *parent_obj, std::string key_name = "") |
| 5528 |
{ |
| 5529 |
struct media_v2_intf_devnode *p = (struct media_v2_intf_devnode *) calloc(1, sizeof(media_v2_intf_devnode)); |
| 5530 |
|
| 5531 |
json_object *media_v2_intf_devnode_obj; |
| 5532 |
if (key_name.empty()) |
| 5533 |
json_object_object_get_ex(parent_obj, "media_v2_intf_devnode", &media_v2_intf_devnode_obj); |
| 5534 |
else |
| 5535 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &media_v2_intf_devnode_obj); |
| 5536 |
|
| 5537 |
json_object *major_obj; |
| 5538 |
if (json_object_object_get_ex(media_v2_intf_devnode_obj, "major", &major_obj)) |
| 5539 |
p->major = (__u32) json_object_get_int64(major_obj); |
| 5540 |
|
| 5541 |
json_object *minor_obj; |
| 5542 |
if (json_object_object_get_ex(media_v2_intf_devnode_obj, "minor", &minor_obj)) |
| 5543 |
p->minor = (__u32) json_object_get_int64(minor_obj); |
| 5544 |
|
| 5545 |
return p; |
| 5546 |
} |
| 5547 |
struct media_v2_interface *retrace_media_v2_interface_gen(json_object *parent_obj, std::string key_name = "") |
| 5548 |
{ |
| 5549 |
struct media_v2_interface *p = (struct media_v2_interface *) calloc(1, sizeof(media_v2_interface)); |
| 5550 |
|
| 5551 |
json_object *media_v2_interface_obj; |
| 5552 |
if (key_name.empty()) |
| 5553 |
json_object_object_get_ex(parent_obj, "media_v2_interface", &media_v2_interface_obj); |
| 5554 |
else |
| 5555 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &media_v2_interface_obj); |
| 5556 |
|
| 5557 |
json_object *id_obj; |
| 5558 |
if (json_object_object_get_ex(media_v2_interface_obj, "id", &id_obj)) |
| 5559 |
p->id = (__u32) s2val(json_object_get_string(id_obj), nullptr); |
| 5560 |
json_object *intf_type_obj; |
| 5561 |
if (json_object_object_get_ex(media_v2_interface_obj, "intf_type", &intf_type_obj)) |
| 5562 |
p->intf_type = (__u32) json_object_get_int64(intf_type_obj); |
| 5563 |
|
| 5564 |
json_object *flags_obj; |
| 5565 |
if (json_object_object_get_ex(media_v2_interface_obj, "flags", &flags_obj)) |
| 5566 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr); |
| 5567 |
|
| 5568 |
//union |
| 5569 |
//struct media_v2_intf_devnode devnode; |
| 5570 |
//__u32 raw[16]; |
| 5571 |
//end of union }; |
| 5572 |
return p; |
| 5573 |
} |
| 5574 |
struct media_v2_pad *retrace_media_v2_pad_gen(json_object *parent_obj, std::string key_name = "") |
| 5575 |
{ |
| 5576 |
struct media_v2_pad *p = (struct media_v2_pad *) calloc(1, sizeof(media_v2_pad)); |
| 5577 |
|
| 5578 |
json_object *media_v2_pad_obj; |
| 5579 |
if (key_name.empty()) |
| 5580 |
json_object_object_get_ex(parent_obj, "media_v2_pad", &media_v2_pad_obj); |
| 5581 |
else |
| 5582 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &media_v2_pad_obj); |
| 5583 |
|
| 5584 |
json_object *id_obj; |
| 5585 |
if (json_object_object_get_ex(media_v2_pad_obj, "id", &id_obj)) |
| 5586 |
p->id = (__u32) s2val(json_object_get_string(id_obj), nullptr); |
| 5587 |
json_object *entity_id_obj; |
| 5588 |
if (json_object_object_get_ex(media_v2_pad_obj, "entity_id", &entity_id_obj)) |
| 5589 |
p->entity_id = (__u32) json_object_get_int64(entity_id_obj); |
| 5590 |
|
| 5591 |
json_object *flags_obj; |
| 5592 |
if (json_object_object_get_ex(media_v2_pad_obj, "flags", &flags_obj)) |
| 5593 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr); |
| 5594 |
|
| 5595 |
json_object *index_obj; |
| 5596 |
if (json_object_object_get_ex(media_v2_pad_obj, "index", &index_obj)) |
| 5597 |
p->index = (__u32) json_object_get_int64(index_obj); |
| 5598 |
|
| 5599 |
return p; |
| 5600 |
} |
| 5601 |
struct media_v2_link *retrace_media_v2_link_gen(json_object *parent_obj, std::string key_name = "") |
| 5602 |
{ |
| 5603 |
struct media_v2_link *p = (struct media_v2_link *) calloc(1, sizeof(media_v2_link)); |
| 5604 |
|
| 5605 |
json_object *media_v2_link_obj; |
| 5606 |
if (key_name.empty()) |
| 5607 |
json_object_object_get_ex(parent_obj, "media_v2_link", &media_v2_link_obj); |
| 5608 |
else |
| 5609 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &media_v2_link_obj); |
| 5610 |
|
| 5611 |
json_object *id_obj; |
| 5612 |
if (json_object_object_get_ex(media_v2_link_obj, "id", &id_obj)) |
| 5613 |
p->id = (__u32) s2val(json_object_get_string(id_obj), nullptr); |
| 5614 |
json_object *source_id_obj; |
| 5615 |
if (json_object_object_get_ex(media_v2_link_obj, "source_id", &source_id_obj)) |
| 5616 |
p->source_id = (__u32) json_object_get_int64(source_id_obj); |
| 5617 |
|
| 5618 |
json_object *sink_id_obj; |
| 5619 |
if (json_object_object_get_ex(media_v2_link_obj, "sink_id", &sink_id_obj)) |
| 5620 |
p->sink_id = (__u32) json_object_get_int64(sink_id_obj); |
| 5621 |
|
| 5622 |
json_object *flags_obj; |
| 5623 |
if (json_object_object_get_ex(media_v2_link_obj, "flags", &flags_obj)) |
| 5624 |
p->flags = (__u32) s2flags(json_object_get_string(flags_obj), nullptr); |
| 5625 |
|
| 5626 |
return p; |
| 5627 |
} |
| 5628 |
struct media_v2_topology *retrace_media_v2_topology_gen(json_object *parent_obj, std::string key_name = "") |
| 5629 |
{ |
| 5630 |
struct media_v2_topology *p = (struct media_v2_topology *) calloc(1, sizeof(media_v2_topology)); |
| 5631 |
|
| 5632 |
json_object *media_v2_topology_obj; |
| 5633 |
if (key_name.empty()) |
| 5634 |
json_object_object_get_ex(parent_obj, "media_v2_topology", &media_v2_topology_obj); |
| 5635 |
else |
| 5636 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &media_v2_topology_obj); |
| 5637 |
|
| 5638 |
json_object *topology_version_obj; |
| 5639 |
if (json_object_object_get_ex(media_v2_topology_obj, "topology_version", &topology_version_obj)) |
| 5640 |
memset(&p->topology_version, 0, sizeof(p->topology_version)); |
| 5641 |
|
| 5642 |
json_object *num_entities_obj; |
| 5643 |
if (json_object_object_get_ex(media_v2_topology_obj, "num_entities", &num_entities_obj)) |
| 5644 |
p->num_entities = (__u32) json_object_get_int64(num_entities_obj); |
| 5645 |
|
| 5646 |
json_object *ptr_entities_obj; |
| 5647 |
if (json_object_object_get_ex(media_v2_topology_obj, "ptr_entities", &ptr_entities_obj)) |
| 5648 |
p->ptr_entities = (__u64) json_object_get_uint64(ptr_entities_obj); |
| 5649 |
|
| 5650 |
json_object *num_interfaces_obj; |
| 5651 |
if (json_object_object_get_ex(media_v2_topology_obj, "num_interfaces", &num_interfaces_obj)) |
| 5652 |
p->num_interfaces = (__u32) json_object_get_int64(num_interfaces_obj); |
| 5653 |
|
| 5654 |
json_object *ptr_interfaces_obj; |
| 5655 |
if (json_object_object_get_ex(media_v2_topology_obj, "ptr_interfaces", &ptr_interfaces_obj)) |
| 5656 |
p->ptr_interfaces = (__u64) json_object_get_uint64(ptr_interfaces_obj); |
| 5657 |
|
| 5658 |
json_object *num_pads_obj; |
| 5659 |
if (json_object_object_get_ex(media_v2_topology_obj, "num_pads", &num_pads_obj)) |
| 5660 |
p->num_pads = (__u32) json_object_get_int64(num_pads_obj); |
| 5661 |
|
| 5662 |
json_object *ptr_pads_obj; |
| 5663 |
if (json_object_object_get_ex(media_v2_topology_obj, "ptr_pads", &ptr_pads_obj)) |
| 5664 |
p->ptr_pads = (__u64) json_object_get_uint64(ptr_pads_obj); |
| 5665 |
|
| 5666 |
json_object *num_links_obj; |
| 5667 |
if (json_object_object_get_ex(media_v2_topology_obj, "num_links", &num_links_obj)) |
| 5668 |
p->num_links = (__u32) json_object_get_int64(num_links_obj); |
| 5669 |
|
| 5670 |
json_object *ptr_links_obj; |
| 5671 |
if (json_object_object_get_ex(media_v2_topology_obj, "ptr_links", &ptr_links_obj)) |
| 5672 |
p->ptr_links = (__u64) json_object_get_uint64(ptr_links_obj); |
| 5673 |
|
| 5674 |
return p; |
| 5675 |
} |
| 5676 |
struct v4l2_edid *retrace_v4l2_edid_gen(json_object *parent_obj, std::string key_name = "") |
| 5677 |
{ |
| 5678 |
struct v4l2_edid *p = (struct v4l2_edid *) calloc(1, sizeof(v4l2_edid)); |
| 5679 |
|
| 5680 |
json_object *v4l2_edid_obj; |
| 5681 |
if (key_name.empty()) |
| 5682 |
json_object_object_get_ex(parent_obj, "v4l2_edid", &v4l2_edid_obj); |
| 5683 |
else |
| 5684 |
json_object_object_get_ex(parent_obj, key_name.c_str(), &v4l2_edid_obj); |
| 5685 |
|
| 5686 |
json_object *pad_obj; |
| 5687 |
if (json_object_object_get_ex(v4l2_edid_obj, "pad", &pad_obj)) |
| 5688 |
p->pad = (__u32) json_object_get_int64(pad_obj); |
| 5689 |
|
| 5690 |
json_object *start_block_obj; |
| 5691 |
if (json_object_object_get_ex(v4l2_edid_obj, "start_block", &start_block_obj)) |
| 5692 |
p->start_block = (__u32) json_object_get_int64(start_block_obj); |
| 5693 |
|
| 5694 |
json_object *blocks_obj; |
| 5695 |
if (json_object_object_get_ex(v4l2_edid_obj, "blocks", &blocks_obj)) |
| 5696 |
p->blocks = (__u32) json_object_get_int64(blocks_obj); |
| 5697 |
|
| 5698 |
//__u8 *edid; |
| 5699 |
return p; |
| 5700 |
} |