android: camera_device: Use HAL_PIXEL_FORMAT_* defines for formats

The documentation says the HAL_PIXEL_FORMAT_* defines shall be used for
formats instead of ANDROID_SCALER_AVAILABLE_FORMATS_* for the
ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS and
ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS tags.

This have worked in the past as the numerical value of the two sets are
the same for the formats supported.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
Niklas Söderlund 2020-07-23 18:32:23 +02:00
parent 3530614fbf
commit 142a9ee3f8
2 changed files with 5 additions and 5 deletions

View file

@ -317,14 +317,14 @@ int CameraDevice::initializeStreamConfigurations()
status != CameraConfiguration::Valid) status != CameraConfiguration::Valid)
continue; continue;
streamConfigurations_.push_back({ res, camera3Format.scalerFormat }); streamConfigurations_.push_back({ res, androidFormat });
} }
} }
LOG(HAL, Debug) << "Collected stream configuration map: "; LOG(HAL, Debug) << "Collected stream configuration map: ";
for (const auto &entry : streamConfigurations_) for (const auto &entry : streamConfigurations_)
LOG(HAL, Debug) << "{ " << entry.resolution.toString() << " - " LOG(HAL, Debug) << "{ " << entry.resolution.toString() << " - "
<< utils::hex(entry.androidScalerCode) << " }"; << utils::hex(entry.androidFormat) << " }";
return 0; return 0;
} }
@ -658,7 +658,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
std::vector<uint32_t> availableStreamConfigurations; std::vector<uint32_t> availableStreamConfigurations;
availableStreamConfigurations.reserve(streamConfigurations_.size() * 4); availableStreamConfigurations.reserve(streamConfigurations_.size() * 4);
for (const auto &entry : streamConfigurations_) { for (const auto &entry : streamConfigurations_) {
availableStreamConfigurations.push_back(entry.androidScalerCode); availableStreamConfigurations.push_back(entry.androidFormat);
availableStreamConfigurations.push_back(entry.resolution.width); availableStreamConfigurations.push_back(entry.resolution.width);
availableStreamConfigurations.push_back(entry.resolution.height); availableStreamConfigurations.push_back(entry.resolution.height);
availableStreamConfigurations.push_back( availableStreamConfigurations.push_back(
@ -679,7 +679,7 @@ const camera_metadata_t *CameraDevice::getStaticMetadata()
std::vector<int64_t> minFrameDurations; std::vector<int64_t> minFrameDurations;
minFrameDurations.reserve(streamConfigurations_.size() * 4); minFrameDurations.reserve(streamConfigurations_.size() * 4);
for (const auto &entry : streamConfigurations_) { for (const auto &entry : streamConfigurations_) {
minFrameDurations.push_back(entry.androidScalerCode); minFrameDurations.push_back(entry.androidFormat);
minFrameDurations.push_back(entry.resolution.width); minFrameDurations.push_back(entry.resolution.width);
minFrameDurations.push_back(entry.resolution.height); minFrameDurations.push_back(entry.resolution.height);
minFrameDurations.push_back(33333333); minFrameDurations.push_back(33333333);

View file

@ -75,7 +75,7 @@ private:
struct Camera3StreamConfiguration { struct Camera3StreamConfiguration {
libcamera::Size resolution; libcamera::Size resolution;
int androidScalerCode; int androidFormat;
}; };
int initializeStreamConfigurations(); int initializeStreamConfigurations();