I'd like to start implementing remote capture with remote target (i.e. PC). Some months ago I did some research, as you may remember
Question: Is this actually worthwhile compared to letting the camera save to disk and downloading the file ? It could be faster, but what is the use case where saving to disk is too slow, and this isn't ?
I'm not against it, just wondering if you have a specific application in mind.
What I don't know is the PTP part of all this, and how should scripting be involved. Do you have an idea?
To capture raw (and presumably the other options) you will need to do something like the how the raw hook in capt_seq blocks and waits for spytask. Since PTP transfers can only be initiated by the PC side, I think it will have to go like this (for raw, if you hook some other place the sequence should be similar):
1) Before shot, PC sends a command to tell the camera it wants to transfer the next image over PTP. This just sets a flag for cap_seq_task
2) The raw hook (or spytask raw code) sees the flag, sets another other flag to say raw is available, and waits
3) in the meantime, the PC polls waiting for the raw available flag
4) when the PC sees the raw available, it initiates a command that has a camera->pc data phase to transfer the data
5) when the transfer is complete, it clears the flag that has been blocking the raw hook, and everything continues as normal.
Some additional notes:
1) In my experience, sending uncached data is much faster than cached. So if you send the raw buffer, you should use the uncached address.
2) For the options other than jpeg, it could be useful to be able to request only a sub-image. Practically, the overhead of individual send calls is such that you'd probably send entire lines.
3) Should think about error cases, e.g. if the client requests a remote capture but fails to load the data... so #2 in the preceding list should maybe time out eventually.
4) The "flags" above should probably just be one state variable.
So I see this as at least 3 additional PTP commands (or 1 command with 3 sub commands, but I prefer to separate things that have data phases from ones that don't), something like
RemoteCaptureInit - called before exposure, tells CHDK we want the data over PTP. No data phase, may specify type (e.g. jpeg, raw, yuv) and sub-image.
RemoteCaptureIsReady - Polled after above, no data phase, just tells if data is available.
RemoteCaptureGetData - called after the preceding, has a cam->pc data phase
Re scripting:
We could put the functionality of RemoteCaptureInit and RemoteCaptureIsReady in script, but this just seems like added complexity to me.
Other questions:
Should the transferred data include meta data ? If so, how much in what form ? For raw, it might make sense to send the whole DNG exif ?