android: camera_device: Support MJPEG stream construction

MJPEG streams must be created referencing a libcamera stream.
This stream may already be provided by the request configuration,
in which case the existing stream is utilised.

If no compatible stream is available to encode, a new stream is requested
from the libcamera configuration.

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
Kieran Bingham 2020-07-03 12:34:59 +01:00
parent 998f4de65e
commit 83ae84eb13
2 changed files with 233 additions and 9 deletions

View file

@ -23,15 +23,25 @@
#include "libcamera/internal/log.h"
#include "libcamera/internal/message.h"
#include "jpeg/encoder.h"
class CameraMetadata;
struct CameraStream {
CameraStream(libcamera::PixelFormat, libcamera::Size);
~CameraStream();
/*
* The index of the libcamera StreamConfiguration as added during
* configureStreams(). A single libcamera Stream may be used to deliver
* one or more streams to the Android framework.
*/
unsigned int index;
libcamera::PixelFormat format;
libcamera::Size size;
Encoder *jpeg;
};
class CameraDevice : protected libcamera::Loggable
@ -105,6 +115,8 @@ private:
int facing_;
int orientation_;
unsigned int maxJpegBufferSize_;
};
#endif /* __ANDROID_CAMERA_DEVICE_H__ */