To be able to use the array macros in PTP and GP error "contexts", this
makes translate_ptp_result() tolerate both "types" of errors.
I added a comment regarding the use of the GP_ERROR_NO_MEMORY use. This is
related to #1008.
This adds a set of macros implementing a generic array or list of TYPE.
This is basically a TYPE* pointer and a length integer. This structure
together with the typical use-cases repeats regularly throughout the
codebase. It raises the level of abstraction and improves code
readabilty. I'm a c++ developer and miss my STL ;).
I'm starting here with PTPObjectHandles and PTPStorageIDs as those were
already modeling an array abstraction. There are other arrays of stuff
that can benefit from this later.
This should better be fixed once and for all by replacing the heap
allocated `char* Filename` with a statically sized buffer. If only I
knew the 'correct' size for that.
See also here: 20fb75a086 (r147761481)
The (Object) Handle member is not part of the "ObjectInfo dataset" in the
specification but added here to avoid having to carry it around by
separate means throughout the code base, as it is regularly required in
combination. While the spec always refers to this item as "ObjectHandle",
the term "Handle" is only used in this context, so we omit the
"Object"-prefix for brevity.
Switching from oid/ObjectID, which is nowere to be found the spec,
increases consistency with the spec and the rest of the code base.
This allows to remove the struct _PTPCanon_New_Object from the codebase.
@msmeissn I added 2 TODO comments for you take a close look, pointing out:
* a memory leak that I did not want to touch because I can't test it
* a presumed bug fix where newobject was 0 when passed to ptp_getobject
The "_len"-suffix to denote the length of an array of values is more
readable than the "nrof"-prefix and also used 3 times more often in the
rest of the code base.
Also replace the params->deviceproperties name with params->dpd_cache to
make it clearer what it actually is: an array of cached DevicePropDesc
structs.
The PTPDeviceInfo struct contains information about the Operations, Events,
DeviceProperties, ImageFormats and CaptureFormats. With 3 of those 5 the
variables contained the additional "Supported" string, which does not add
any discriminating value and only makes for very long and therefore less
readable code lines and it is inconsistent.
Also use the term "DeviceProps" here as well for brevity and consistency.
There are lots of other symbols like GetDevicePropValue that use the short
version "PropValue" already. Also the variables of this type are also most
often called "propval".
The terms ObjectCompressedSize and ThumbCompressedSize come from the PTP
specification. But I find them to be overly verbose because there is no
other size than this "compressed" size.
Other places like the CameraFileInfoFile struct also use the term "size"
instead of "compressed_size" for the same thing.
With the re-enabled FocusInfoEx, the 5Ds spams the log and the
--wait-event console output with a 64 entry long focus info list.
Assuming no tooling is dependent on the particular string format of the
FocusInfoEx value, since it seems to only ever contain a no-empty
set of selected AF-points at the beginning of the capture process, where
the event is 'swollowed' by the focus detection code. This changeset
strips it down to only contain the list of selected AF-points, meaning
without focus, we now get a simple "{}".
Furthermore, the olcmask 0x0100 (FocusInfo) data of the 5Ds, R8 and R5m2
has been analyzed and the in-focus detection code during trigger_capture
has been improved. See code comments for details.