android: camera_device: Initialize stream configuration

Initialize the stream configuration map by applying the Android Camera3
requested resolutions and formats to the libcamera Camera device.

For each required format test a list of required and optional
resolutions, construct a map to translate from Android format to the
libcamera formats and store the available stream configuration to
be provided to the Android framework through static metadata.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Jacopo Mondi 2020-05-23 18:53:54 +02:00
parent cd1f258af9
commit 117588b371
2 changed files with 235 additions and 0 deletions

View file

@ -7,12 +7,15 @@
#ifndef __ANDROID_CAMERA_DEVICE_H__
#define __ANDROID_CAMERA_DEVICE_H__
#include <map>
#include <memory>
#include <vector>
#include <hardware/camera3.h>
#include <libcamera/buffer.h>
#include <libcamera/camera.h>
#include <libcamera/geometry.h>
#include <libcamera/request.h>
#include <libcamera/stream.h>
@ -59,6 +62,12 @@ private:
camera3_stream_buffer_t *buffers;
};
struct Camera3StreamConfiguration {
libcamera::Size resolution;
int androidScalerCode;
};
int initializeStreamConfigurations();
void notifyShutter(uint32_t frameNumber, uint64_t timestamp);
void notifyError(uint32_t frameNumber, camera3_stream_t *stream);
std::unique_ptr<CameraMetadata> getResultMetadata(int frame_number,
@ -75,6 +84,9 @@ private:
std::map<unsigned int, CameraMetadata *> requestTemplates_;
const camera3_callback_ops_t *callbacks_;
std::vector<Camera3StreamConfiguration> streamConfigurations_;
std::map<int, libcamera::PixelFormat> formatsMap_;
int facing_;
int orientation_;
};