camlib
Documentation for camlib is still a work-in-progress
Loading...
Searching...
No Matches
cl_data.h
Go to the documentation of this file.
1
2// PTP data structures - some very similar to the exact MTP/PTP spec.
3#ifndef CL_DATA_H
4#define CL_DATA_H
5
10
12 uint32_t length;
13 uint32_t data[4];
14};
15
16// TODO: Rename PtpUintArray
17struct UintArray {
18 uint32_t length;
19 uint32_t data[];
20};
21
22// To store unpacked device info data, after parsing
24 uint16_t standard_version;
25 uint32_t vendor_ext_id;
26 uint16_t version;
27 char extensions[128];
28 uint16_t functional_mode;
29
30 int ops_supported_length;
31 uint16_t ops_supported[256];
32
33 int events_supported_length;
34 uint16_t events_supported[256];
35
36 int props_supported_length;
37 uint16_t props_supported[256];
38
39 int capture_formats_length;
40 uint16_t capture_formats[32];
41
42 int playback_formats_length;
43 uint16_t playback_formats[32];
44
45 char manufacturer[128];
46 char model[128];
47 char device_version[64];
48 char serial_number[128];
49};
50
52 uint16_t storage_type;
53 uint16_t fs_type;
54 uint16_t access_capability;
55 uint64_t max_capacity;
56 uint64_t free_space;
57 uint32_t free_objects;
58};
59
61 uint32_t storage_id;
62 uint16_t obj_format;
63 uint16_t protection;
64 uint32_t compressed_size;
65 uint16_t thumb_format;
66 uint32_t thumb_compressed_size;
67 uint32_t thumb_width;
68 uint32_t thumb_height;
69 uint32_t img_width;
70 uint32_t img_height;
71 uint32_t img_bit_depth;
72 uint32_t parent_obj;
73 uint16_t assoc_type; // association
74 uint32_t assoc_desc;
75 uint32_t sequence_num;
76
77 char filename[64];
78 char date_created[32];
79 char date_modified[32];
80 char keywords[64];
81};
82
84 uint16_t length;
85 uint8_t data[];
86};
87
89 int min;
90 int max;
91 int step;
92};
93
95 uint16_t code;
96 uint16_t data_type;
97 uint8_t read_only; // (get/set)
98
99 // uint32_t variables will be used for all types <= 4 bytes
100 uint32_t default_value32;
101 uint32_t current_value32;
102 void *current_value;
103 void *default_value;
104
105 uint8_t form_type;
106 struct PtpRangeForm range_form;
107 struct PtpEnumerationForm *enum_form;
108};
109
111 uint32_t property_code;
112 uint32_t data_type;
113 uint8_t get_set;
114 uint32_t default_value;
115 uint32_t group_code;
116 uint32_t form_flag;
117 // mystery data type follows if form_flag == 0
118};
119
121 int type;
122 int code;
123 int value;
124 int def;
125};
126
128 uint32_t length;
129 uint32_t type;
130 // standard JPG follows
131};
132
134 uint32_t a;
135 uint32_t b;
136 uint32_t c;
137 uint32_t d;
138 uint32_t e;
139};
140
142 uint32_t lv_pitch;
143 uint32_t lv_width;
144 uint32_t lcd_palette[256];
145};
146
148 uint8_t digic;
149 uint8_t v1;
150 uint8_t v2;
151 uint8_t v3;
152};
153
154enum PtpMlBmpLvOption {
155 PTP_ML_BMP_LV_GET_FRAME = 0,
156 PTP_ML_BMP_LV_GET_SPEC = 1,
157};
158
159enum PtpCHDKCommands {
160 PTP_CHDK_Version = 0,
161 PTP_CHDK_UploadFile = 5,
162};
163
164int ptp_pack_object_info(struct PtpRuntime *r, struct PtpObjectInfo *oi, uint8_t *buf, int max);
165
166int ptp_parse_prop_value(struct PtpRuntime *r);
167int ptp_parse_device_info(struct PtpRuntime *r, struct PtpDeviceInfo *di);
168int ptp_device_info_json(const struct PtpDeviceInfo *di, char *buffer, int max);
169int ptp_parse_prop_desc(struct PtpRuntime *r, struct PtpPropDesc *oi);
170int ptp_prop_desc_json(const struct PtpPropDesc *pd, char *buffer, int max);
171int ptp_parse_object_info(struct PtpRuntime *r, struct PtpObjectInfo *oi);
172int ptp_storage_info_json(const struct PtpStorageInfo *so, char *buffer, int max);
173int ptp_object_info_json(const struct PtpObjectInfo *so, char *buffer, int max);
174
175int ptp_eos_events(struct PtpRuntime *r, struct PtpGenericEvent **p);
176void *ptp_open_eos_events(struct PtpRuntime *r);
177void *ptp_get_eos_event(struct PtpRuntime *r, void *e, struct PtpCanonEvent *ce);
178
179int ptp_eos_events_json(struct PtpRuntime *r, char *buffer, int max);
180
181// Standard property value converters (conv.c)
182int ptp_eos_get_shutter(int data, int dir);
183int ptp_eos_get_iso(int data, int dir);
184int ptp_eos_get_aperture(int data, int dir);
185int ptp_eos_get_white_balance(int data, int dir);
186int ptp_eos_get_imgformat_value(uint32_t data[5]);
187
188void *ptp_pack_chdk_upload_file(struct PtpRuntime *r, char *in, char *out, int *length);
189
190#endif