camlib
Documentation for camlib is still a work-in-progress
Loading...
Searching...
No Matches
cl_ops.h
Go to the documentation of this file.
1
2#ifndef OPERATIONS_H
3#define OPERATIONS_H
4
5enum PtpLiveViewType {
6 PTP_LV_NONE = 0,
7 PTP_LV_EOS = 1,
8 PTP_LV_CANON = 2,
9 // ptpview v1, Old 360x240 manually computed 7fps liveview
10 PTP_LV_ML = 3,
11 // ptpview v2, only has bmp menu graphics
12 PTP_LV_EOS_ML_BMP = 4,
13};
14
15enum PtpLiveViewFormat {
16 PTP_LV_JPEG,
17};
18
20 uint32_t payload_offset_to_data;
21 enum PtpLiveViewFormat format;
22};
23
28
29int ptp_liveview_params(struct PtpRuntime *r, struct PtpLiveviewParams *params);
30
33int ptp_set_generic_property(struct PtpRuntime *r, const char *name, int value);
34
38int ptp_pre_take_picture(struct PtpRuntime *r);
39
41int ptp_take_picture(struct PtpRuntime *r);
42
44int ptp_open_session(struct PtpRuntime *r);
45
46int ptp_close_session(struct PtpRuntime *r);
47
48int ptp_get_device_info(struct PtpRuntime *r, struct PtpDeviceInfo *di);
49
52int ptp_get_storage_ids(struct PtpRuntime *r, struct PtpArray **a);
53
54int ptp_init_capture(struct PtpRuntime *r, int storage_id, int object_format);
55
56int ptp_init_open_capture(struct PtpRuntime *r, int storage_id, int object_format);
57
58int ptp_terminate_open_capture(struct PtpRuntime *r, int trans);
59
60int ptp_get_storage_info(struct PtpRuntime *r, int id, struct PtpStorageInfo *si);
61
62int ptp_send_object_info(struct PtpRuntime *r, int storage_id, int handle, struct PtpObjectInfo *oi);
63
64int ptp_get_prop_value(struct PtpRuntime *r, int code);
65
67int ptp_set_prop_value(struct PtpRuntime *r, int code, int value);
69int ptp_set_prop_value16(struct PtpRuntime *r, int code, uint16_t value);
70
71int ptp_set_prop_value_data(struct PtpRuntime *r, int code, void *data, int length);
72
73int ptp_get_prop_desc(struct PtpRuntime *r, int code, struct PtpPropDesc *pd);
74
76// @param id storage ID
77// @param format Can specify file format ID, or zero for all IDs
78// @param in Can be folder object ID, or 0 for recursive (entire filesystem)
79// @param[out] a Output array is a pointer to data packet, and will be overwritten by new operations
80int ptp_get_object_handles(struct PtpRuntime *r, int id, int format, int in, struct PtpArray **a);
81
82int ptp_get_object_info(struct PtpRuntime *r, uint32_t handle, struct PtpObjectInfo *oi);
83
84int ptp_move_object(struct PtpRuntime *r, int storage_id, int handle, int folder);
85
86int ptp_delete_object(struct PtpRuntime *r, int handle, int format_code);
87
90int ptp_get_thumbnail(struct PtpRuntime *r, int handle);
91
93int ptp_get_partial_object(struct PtpRuntime *r, uint32_t handle, int offset, int max);
94
96int ptp_get_object(struct PtpRuntime *r, int handle);
97
99int ptp_download_object(struct PtpRuntime *r, int handle, FILE *stream, size_t max);
100
105int ptp_get_all_known(struct PtpRuntime *r, struct PtpGenericEvent **s, int *length);
106
108int ptpip_init_events(struct PtpRuntime *r);
109
111int ptpip_init_command_request(struct PtpRuntime *r, const char *device_name);
112
113// EOS Only functions - not for Canon point and shoot
114int ptp_eos_get_viewfinder_data(struct PtpRuntime *r);
115int ptp_eos_set_remote_mode(struct PtpRuntime *r, int mode);
116int ptp_eos_set_prop_value(struct PtpRuntime *r, int code, int value);
117int ptp_eos_set_event_mode(struct PtpRuntime *r, int mode);
118int ptp_eos_remote_release_off(struct PtpRuntime *r, int mode);
119int ptp_eos_remote_release_on(struct PtpRuntime *r, int mode);
120int ptp_eos_get_event(struct PtpRuntime *r);
121int ptp_eos_hdd_capacity_push(struct PtpRuntime *r);
122int ptp_eos_hdd_capacity_pop(struct PtpRuntime *r);
123int ptp_eos_get_prop_value(struct PtpRuntime *r, int code);
124int ptp_eos_bulb_start(struct PtpRuntime *r);
125int ptp_eos_bulb_stop(struct PtpRuntime *r);
126int ptp_eos_set_ui_lock(struct PtpRuntime *r);
127int ptp_eos_reset_ui_lock(struct PtpRuntime *r);
128int ptp_eos_cancel_af(struct PtpRuntime *r);
129// steps can be between -3 and 3
130int ptp_eos_drive_lens(struct PtpRuntime *r, int steps);
131int ptp_eos_ping(struct PtpRuntime *r);
132
133// Get max expected size of liveview, for allocations only
134int ptp_liveview_size(struct PtpRuntime *r);
135// Runs vendor-specific commands for the liveview
136int ptp_liveview_init(struct PtpRuntime *r);
137int ptp_liveview_deinit(struct PtpRuntime *r);
138// Get a frame directly into a buffer. Size is expected to be from ptp_liveview_size()
139int ptp_liveview_frame(struct PtpRuntime *r, void *buffer);
140int ptp_liveview_type(struct PtpRuntime *r);
141
142// Get Magic Lantern transparent menus buffer - see https://github.com/petabyt/ptpview
143int ptp_ml_init_bmp_lv(struct PtpRuntime *r);
144int ptp_ml_get_bmp_lv(struct PtpRuntime *r, uint32_t **buffer_ptr);
145int ptp_ml_get_liveview_v1(struct PtpRuntime *r);
146
147int ptp_chdk_get_version(struct PtpRuntime *r);
148int ptp_chdk_upload_file(struct PtpRuntime *r, char *input, char *dest);
149
150// Canon advanced extensions - available in canon-adv.c
151int ptp_eos_activate_command(struct PtpRuntime *r);
152int ptp_eos_exec_evproc(struct PtpRuntime *r, void *data, int length, int expect_return);
153int ptp_eos_evproc_run(struct PtpRuntime *r, char *fmt, ...);
154int ptp_eos_evproc_return_data(struct PtpRuntime *r);
155int ptp_eos_fa_get_build_version(struct PtpRuntime *r, char *buffer, int max);
156
158int ptp_eos_get_liveview(struct PtpRuntime *r);
159
162#endif
int ptp_get_thumbnail(struct PtpRuntime *r, int handle)
Raw JPEG data is accessible from ptp_get_payload()
int ptp_set_generic_property(struct PtpRuntime *r, const char *name, int value)
Set a generic property - abstraction over SetDeviceProp.
int ptp_get_partial_object(struct PtpRuntime *r, uint32_t handle, int offset, int max)
int ptp_set_prop_value(struct PtpRuntime *r, int code, int value)
Sets 32 bit value of a property.
int ptpip_init_command_request(struct PtpRuntime *r, const char *device_name)
int ptp_download_object(struct PtpRuntime *r, int handle, FILE *stream, size_t max)
Download an object from handle, to a local file (uses GetPartialObject)
int ptp_get_storage_ids(struct PtpRuntime *r, struct PtpArray **a)
Returns allocated array of storage IDs call free() afterwards.
int ptp_set_prop_value16(struct PtpRuntime *r, int code, uint16_t value)
Sets 16 bit value of a property.
int ptp_pre_take_picture(struct PtpRuntime *r)
Call before taking a picture - this is generally for 'focusing' On some cameras this does nothing.
int ptpip_init_events(struct PtpRuntime *r)
int ptp_take_picture(struct PtpRuntime *r)
Call after calling ptp_pre_take_picture - this time a picture will be taken.
int ptp_get_object(struct PtpRuntime *r, int handle)
Download an object.
int ptp_open_session(struct PtpRuntime *r)
Open a new session - required for most commands.
int ptp_get_object_handles(struct PtpRuntime *r, int id, int format, int in, struct PtpArray **a)
Gets a list of object handles in a storage device or folder.
int ptp_get_all_known(struct PtpRuntime *r, struct PtpGenericEvent **s, int *length)
Recieve a generic list of all properties received in DeviceInfo This is similar to getting all events...
int ptp_eos_get_liveview(struct PtpRuntime *r)