TODO:
- see what we can do about using Rust's memory allocator instead of
vcos
? malloc - try to reduce unsafe rust to minimum
- anything else unsafe?
Note that these C types should actually be wrappers, not raw types or they are likely to cause memory management fun.
There should be settings for brightness, exposure, burst mode, image format etc etc.
Should we provide a preview API?
What API should be used for getting camera info? Note that this lists both cameras and "flashes".
This is a companion for the above. Useful if the user already has a MMAL_PARAMETER_CAMERA_INFO_CAMERA_T
. Does it provide enough value?
Start the camera. Useful for metering etc.
Take a still picture.
What about burst mode? capture_burst() -> Stream<[u8], MMAL_STATUS_T>
?
Record a video and return a stream of frames.
Should this return a Result<(), ?>
so that we can error if not already recording a video?
Is there much need for Result
when we have MMAL_SUCCESS
? Not really but Result
is Rust-like and MMAL_SUCCESS
is C-like.
How should we represent errors? Is just MMAL_STATUS_T
ok?
Is this informative? Should we have a CameraError
type with a code property? Is this better? Is it enough?
What happens when there are multiple libmmal calls inside a method? Is it clear which the error comes from or what it means?
Should this actually create camera objects? (it does now)
Should this take the camera number?
Should this take a MMAL_PARAMETER_CAMERA_INFO_CAMERA_T
?
If constructor doesn't take a camera number or camera info, we should get one here.
Users or SimpleCamera shouldn't care about any of the following APIs except take()
.
Users shouldn't have to pass this in.
Users shouldn't have to pass this in and certainly not twice.
Rename to capture?
CameraInfo::info() -> Result<CameraInfo, MMAL_STATUS_T>
convert --version
Version: ImageMagick 6.9.7-4 Q16 arm 20170114 http://www.imagemagick.org
Copyright: © 1999-2017 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib
To test rgb output:
convert -size 96x96 -depth 8 -colorspace RGB rgb:test.rgb out.png
Note that mmal_port_parameter_get
and mmal_port_parameter_set
use memcpy into our struct so params
should be owned by rust.
https://github.com/raspberrypi/userland/blob/a1b89e91f393c7134b4cdc36431f863bb3333163/interface/mmal/vc/mmal_vc_api.c#L1222