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[512];
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 char storage_desc[128];
59 char volume_identifier[128];
60};
61
63 uint32_t storage_id;
64 uint16_t obj_format;
65 uint16_t protection;
66 uint32_t compressed_size;
67 uint16_t thumb_format;
68 uint32_t thumb_compressed_size;
69 uint32_t thumb_width;
70 uint32_t thumb_height;
71 uint32_t img_width;
72 uint32_t img_height;
73 uint32_t img_bit_depth;
74 uint32_t parent_obj;
75 uint16_t assoc_type; // association
76 uint32_t assoc_desc;
77 uint32_t sequence_num;
78
79 char filename[64];
80 char date_created[32];
81 char date_modified[32];
82 char keywords[64];
83};
84
86 uint16_t length;
87 uint8_t data[];
88};
89
91 int min;
92 int max;
93 int step;
94};
95
97 uint16_t code;
98 uint16_t data_type;
99 uint8_t read_only; // (get/set)
100
101 // uint32_t variables will be used for all types <= 4 bytes
102 uint32_t default_value32;
103 uint32_t current_value32;
104 void *current_value;
105 void *default_value;
106
107 uint8_t form_type;
108 struct PtpRangeForm range_form;
109 struct PtpEnumerationForm *enum_form;
110};
111
113 uint32_t property_code;
114 uint32_t data_type;
115 uint8_t get_set;
116 uint32_t default_value;
117 uint32_t group_code;
118 uint32_t form_flag;
119 // mystery data type follows if form_flag == 0
120};
121
123 int type;
124 int code;
125 int value;
126 int def;
127};
128
130 uint32_t length;
131 uint32_t type;
132 // standard JPG follows
133};
134
136 uint32_t a;
137 uint32_t b;
138 uint32_t c;
139 uint32_t d;
140 uint32_t e;
141};
142
144 uint32_t lv_pitch;
145 uint32_t lv_width;
146 uint32_t lcd_palette[256];
147};
148
150 uint8_t digic;
151 uint8_t v1;
152 uint8_t v2;
153 uint8_t v3;
154};
155
156enum PtpMlBmpLvOption {
157 PTP_ML_BMP_LV_GET_FRAME = 0,
158 PTP_ML_BMP_LV_GET_SPEC = 1,
159};
160
161enum PtpCHDKCommands {
162 PTP_CHDK_Version = 0,
163 PTP_CHDK_UploadFile = 5,
164};
165
166int ptp_pack_object_info(struct PtpRuntime *r, struct PtpObjectInfo *oi, uint8_t *buf, int max);
167
168int ptp_parse_prop_value(struct PtpRuntime *r);
169int ptp_parse_device_info(struct PtpRuntime *r, struct PtpDeviceInfo *di);
170int ptp_device_info_json(const struct PtpDeviceInfo *di, char *buffer, int max);
171int ptp_parse_prop_desc(struct PtpRuntime *r, struct PtpPropDesc *oi);
172int ptp_prop_desc_json(const struct PtpPropDesc *pd, char *buffer, int max);
173int ptp_parse_object_info(struct PtpRuntime *r, struct PtpObjectInfo *oi);
174int ptp_storage_info_json(const struct PtpStorageInfo *so, char *buffer, int max);
175int ptp_object_info_json(const struct PtpObjectInfo *so, char *buffer, int max);
176int ptp_parse_storage_info(struct PtpRuntime *r, struct PtpStorageInfo *si);
177int ptp_eos_events(struct PtpRuntime *r, struct PtpGenericEvent **p);
178void *ptp_open_eos_events(struct PtpRuntime *r);
179void *ptp_get_eos_event(struct PtpRuntime *r, void *e, struct PtpCanonEvent *ce);
180
181int ptp_eos_events_json(struct PtpRuntime *r, char *buffer, int max);
182
183// Standard property value converters (conv.c)
184int ptp_eos_get_shutter(int data, int dir);
185int ptp_eos_get_iso(int data, int dir);
186int ptp_eos_get_aperture(int data, int dir);
187int ptp_eos_get_white_balance(int data, int dir);
188int ptp_eos_get_imgformat_value(uint32_t data[5]);
189
190void *ptp_pack_chdk_upload_file(struct PtpRuntime *r, char *in, char *out, int *length);
191
192#endif