blob: 51f17effd988645d929d9ceb1a7747e407bc779c [file] [log] [blame]
// camera/mojo/camera3.mojom-shared.h is auto generated by mojom_bindings_generator.py, do not edit
// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CAMERA_MOJO_CAMERA3_MOJOM_SHARED_H_
#define CAMERA_MOJO_CAMERA3_MOJOM_SHARED_H_
#include <stdint.h>
#include <functional>
#include <iosfwd>
#include <type_traits>
#include <utility>
#include "mojo/public/cpp/bindings/array_data_view.h"
#include "mojo/public/cpp/bindings/enum_traits.h"
#include "mojo/public/cpp/bindings/interface_data_view.h"
#include "mojo/public/cpp/bindings/lib/bindings_internal.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"
#include "mojo/public/cpp/bindings/map_data_view.h"
#include "mojo/public/cpp/bindings/string_data_view.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h"
#include "camera/mojo/camera3.mojom-shared-internal.h"
#include "camera/mojo/camera_features.mojom-shared.h"
#include "camera/mojo/camera_metadata.mojom-shared.h"
#include "mojo/public/cpp/bindings/lib/interface_serialization.h"
#include "mojo/public/cpp/system/data_pipe.h"
namespace cros::mojom {
class CropRotateScaleInfoDataView;
class Camera3StreamDataView;
class Camera3StreamConfigurationDataView;
class CameraBufferHandleDataView;
class Camera3StreamBufferDataView;
class Camera3ErrorMsgDataView;
class Camera3ShutterMsgDataView;
class Camera3NotifyMsgDataView;
class Camera3BufferRequestDataView;
class Camera3StreamBufferRetDataView;
class Camera3PhyscamMetadataDataView;
class Camera3CaptureRequestDataView;
class Camera3CaptureResultDataView;
class Camera3NotifyMsgMessageDataView;
} // cros::mojom
namespace mojo {
namespace internal {
template <>
struct MojomTypeTraits<::cros::mojom::CropRotateScaleInfoDataView> {
using Data = ::cros::mojom::internal::CropRotateScaleInfo_Data;
using DataAsArrayElement = Pointer<Data>;
static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};
template <>
struct MojomTypeTraits<::cros::mojom::Camera3StreamDataView> {
using Data = ::cros::mojom::internal::Camera3Stream_Data;
using DataAsArrayElement = Pointer<Data>;
static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};
template <>
struct MojomTypeTraits<::cros::mojom::Camera3StreamConfigurationDataView> {
using Data = ::cros::mojom::internal::Camera3StreamConfiguration_Data;
using DataAsArrayElement = Pointer<Data>;
static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};
template <>
struct MojomTypeTraits<::cros::mojom::CameraBufferHandleDataView> {
using Data = ::cros::mojom::internal::CameraBufferHandle_Data;
using DataAsArrayElement = Pointer<Data>;
static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};
template <>
struct MojomTypeTraits<::cros::mojom::Camera3StreamBufferDataView> {
using Data = ::cros::mojom::internal::Camera3StreamBuffer_Data;
using DataAsArrayElement = Pointer<Data>;
static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};
template <>
struct MojomTypeTraits<::cros::mojom::Camera3ErrorMsgDataView> {
using Data = ::cros::mojom::internal::Camera3ErrorMsg_Data;
using DataAsArrayElement = Pointer<Data>;
static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};
template <>
struct MojomTypeTraits<::cros::mojom::Camera3ShutterMsgDataView> {
using Data = ::cros::mojom::internal::Camera3ShutterMsg_Data;
using DataAsArrayElement = Pointer<Data>;
static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};
template <>
struct MojomTypeTraits<::cros::mojom::Camera3NotifyMsgDataView> {
using Data = ::cros::mojom::internal::Camera3NotifyMsg_Data;
using DataAsArrayElement = Pointer<Data>;
static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};
template <>
struct MojomTypeTraits<::cros::mojom::Camera3BufferRequestDataView> {
using Data = ::cros::mojom::internal::Camera3BufferRequest_Data;
using DataAsArrayElement = Pointer<Data>;
static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};
template <>
struct MojomTypeTraits<::cros::mojom::Camera3StreamBufferRetDataView> {
using Data = ::cros::mojom::internal::Camera3StreamBufferRet_Data;
using DataAsArrayElement = Pointer<Data>;
static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};
template <>
struct MojomTypeTraits<::cros::mojom::Camera3PhyscamMetadataDataView> {
using Data = ::cros::mojom::internal::Camera3PhyscamMetadata_Data;
using DataAsArrayElement = Pointer<Data>;
static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};
template <>
struct MojomTypeTraits<::cros::mojom::Camera3CaptureRequestDataView> {
using Data = ::cros::mojom::internal::Camera3CaptureRequest_Data;
using DataAsArrayElement = Pointer<Data>;
static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};
template <>
struct MojomTypeTraits<::cros::mojom::Camera3CaptureResultDataView> {
using Data = ::cros::mojom::internal::Camera3CaptureResult_Data;
using DataAsArrayElement = Pointer<Data>;
static constexpr MojomTypeCategory category = MojomTypeCategory::kStruct;
};
template <>
struct MojomTypeTraits<::cros::mojom::Camera3NotifyMsgMessageDataView> {
using Data = ::cros::mojom::internal::Camera3NotifyMsgMessage_Data;
using DataAsArrayElement = Data;
static constexpr MojomTypeCategory category = MojomTypeCategory::kUnion;
};
} // namespace internal
} // namespace mojo
namespace cros::mojom {
enum class HalPixelFormat : int32_t {
HAL_PIXEL_FORMAT_RGBA_8888 = 1,
HAL_PIXEL_FORMAT_RGBX_8888 = 2,
HAL_PIXEL_FORMAT_BGRA_8888 = 5,
HAL_PIXEL_FORMAT_YCrCb_420_SP = 17,
HAL_PIXEL_FORMAT_YCbCr_422_I = 20,
HAL_PIXEL_FORMAT_BLOB = 33,
HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED = 34,
HAL_PIXEL_FORMAT_YCbCr_420_888 = 35,
HAL_PIXEL_FORMAT_YV12 = 842094169,
kMinValue = 1,
kMaxValue = 842094169,
};
std::ostream& operator<<(std::ostream& os, HalPixelFormat value);
inline bool IsKnownEnumValue(HalPixelFormat value) {
return internal::HalPixelFormat_Data::IsKnownValue(
static_cast<int32_t>(value));
}
enum class Camera3StreamType : int32_t {
CAMERA3_STREAM_OUTPUT = 0,
CAMERA3_STREAM_INPUT = 1,
CAMERA3_STREAM_BIDIRECTIONAL = 2,
kMinValue = 0,
kMaxValue = 2,
};
std::ostream& operator<<(std::ostream& os, Camera3StreamType value);
inline bool IsKnownEnumValue(Camera3StreamType value) {
return internal::Camera3StreamType_Data::IsKnownValue(
static_cast<int32_t>(value));
}
enum class Camera3StreamRotation : int32_t {
CAMERA3_STREAM_ROTATION_0 = 0,
CAMERA3_STREAM_ROTATION_90 = 1,
CAMERA3_STREAM_ROTATION_180 = 2,
CAMERA3_STREAM_ROTATION_270 = 3,
kMinValue = 0,
kMaxValue = 3,
};
std::ostream& operator<<(std::ostream& os, Camera3StreamRotation value);
inline bool IsKnownEnumValue(Camera3StreamRotation value) {
return internal::Camera3StreamRotation_Data::IsKnownValue(
static_cast<int32_t>(value));
}
enum class Camera3StreamConfigurationMode : int32_t {
CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE = 0,
CAMERA3_STREAM_CONFIGURATION_CONSTRAINED_HIGH_SPEED_MODE = 1,
kMinValue = 0,
kMaxValue = 1,
};
std::ostream& operator<<(std::ostream& os, Camera3StreamConfigurationMode value);
inline bool IsKnownEnumValue(Camera3StreamConfigurationMode value) {
return internal::Camera3StreamConfigurationMode_Data::IsKnownValue(
static_cast<int32_t>(value));
}
enum class Camera3BufferStatus : int32_t {
CAMERA3_BUFFER_STATUS_OK = 0,
CAMERA3_BUFFER_STATUS_ERROR = 1,
kMinValue = 0,
kMaxValue = 1,
};
std::ostream& operator<<(std::ostream& os, Camera3BufferStatus value);
inline bool IsKnownEnumValue(Camera3BufferStatus value) {
return internal::Camera3BufferStatus_Data::IsKnownValue(
static_cast<int32_t>(value));
}
enum class Camera3MsgType : int32_t {
CAMERA3_MSG_ERROR = 1,
CAMERA3_MSG_SHUTTER = 2,
kMinValue = 1,
kMaxValue = 2,
};
std::ostream& operator<<(std::ostream& os, Camera3MsgType value);
inline bool IsKnownEnumValue(Camera3MsgType value) {
return internal::Camera3MsgType_Data::IsKnownValue(
static_cast<int32_t>(value));
}
enum class Camera3ErrorMsgCode : int32_t {
CAMERA3_MSG_ERROR_DEVICE = 1,
CAMERA3_MSG_ERROR_REQUEST = 2,
CAMERA3_MSG_ERROR_RESULT = 3,
CAMERA3_MSG_ERROR_BUFFER = 4,
kMinValue = 1,
kMaxValue = 4,
};
std::ostream& operator<<(std::ostream& os, Camera3ErrorMsgCode value);
inline bool IsKnownEnumValue(Camera3ErrorMsgCode value) {
return internal::Camera3ErrorMsgCode_Data::IsKnownValue(
static_cast<int32_t>(value));
}
enum class Camera3BufferRequestStatus : int32_t {
CAMERA3_BUF_REQ_OK = 0,
CAMERA3_BUF_REQ_FAILED_PARTIAL = 1,
CAMERA3_BUF_REQ_FAILED_CONFIGURING = 2,
CAMERA3_BUF_REQ_FAILED_ILLEGAL_ARGUMENTS = 3,
CAMERA3_BUF_REQ_FAILED_UNKNOWN = 4,
kMinValue = 0,
kMaxValue = 4,
};
std::ostream& operator<<(std::ostream& os, Camera3BufferRequestStatus value);
inline bool IsKnownEnumValue(Camera3BufferRequestStatus value) {
return internal::Camera3BufferRequestStatus_Data::IsKnownValue(
static_cast<int32_t>(value));
}
enum class Camera3StreamBufferReqStatus : int32_t {
CAMERA3_PS_BUF_REQ_OK = 0,
CAMERA3_PS_BUF_REQ_NO_BUFFER_AVAILABLE = 1,
CAMERA3_PS_BUF_REQ_MAX_BUFFER_EXCEEDED = 2,
CAMERA3_PS_BUF_REQ_STREAM_DISCONNECTED = 3,
CAMERA3_PS_BUF_REQ_UNKNOWN_ERROR = 4,
kMinValue = 0,
kMaxValue = 4,
};
std::ostream& operator<<(std::ostream& os, Camera3StreamBufferReqStatus value);
inline bool IsKnownEnumValue(Camera3StreamBufferReqStatus value) {
return internal::Camera3StreamBufferReqStatus_Data::IsKnownValue(
static_cast<int32_t>(value));
}
enum class Camera3RequestTemplate : int32_t {
CAMERA3_TEMPLATE_PREVIEW = 1,
CAMERA3_TEMPLATE_STILL_CAPTURE = 2,
CAMERA3_TEMPLATE_VIDEO_RECORD = 3,
CAMERA3_TEMPLATE_VIDEO_SNAPSHOT = 4,
CAMERA3_TEMPLATE_ZERO_SHUTTER_LAG = 5,
CAMERA3_TEMPLATE_MANUAL = 6,
CAMERA3_TEMPLATE_COUNT = 7,
kMinValue = 1,
kMaxValue = 7,
};
std::ostream& operator<<(std::ostream& os, Camera3RequestTemplate value);
inline bool IsKnownEnumValue(Camera3RequestTemplate value) {
return internal::Camera3RequestTemplate_Data::IsKnownValue(
static_cast<int32_t>(value));
}
enum class Camera3DeviceOps_BufferType : int32_t {
DMABUF = 0,
SHM = 1,
kMinValue = 0,
kMaxValue = 1,
};
std::ostream& operator<<(std::ostream& os, Camera3DeviceOps_BufferType value);
inline bool IsKnownEnumValue(Camera3DeviceOps_BufferType value) {
return internal::Camera3DeviceOps_BufferType_Data::IsKnownValue(
static_cast<int32_t>(value));
}
// Interface base classes. They are used for type safety check.
class Camera3CallbackOpsInterfaceBase {};
using Camera3CallbackOpsPtrDataView =
mojo::InterfacePtrDataView<Camera3CallbackOpsInterfaceBase>;
using Camera3CallbackOpsRequestDataView =
mojo::InterfaceRequestDataView<Camera3CallbackOpsInterfaceBase>;
using Camera3CallbackOpsAssociatedPtrInfoDataView =
mojo::AssociatedInterfacePtrInfoDataView<Camera3CallbackOpsInterfaceBase>;
using Camera3CallbackOpsAssociatedRequestDataView =
mojo::AssociatedInterfaceRequestDataView<Camera3CallbackOpsInterfaceBase>;
class Camera3DeviceOpsInterfaceBase {};
using Camera3DeviceOpsPtrDataView =
mojo::InterfacePtrDataView<Camera3DeviceOpsInterfaceBase>;
using Camera3DeviceOpsRequestDataView =
mojo::InterfaceRequestDataView<Camera3DeviceOpsInterfaceBase>;
using Camera3DeviceOpsAssociatedPtrInfoDataView =
mojo::AssociatedInterfacePtrInfoDataView<Camera3DeviceOpsInterfaceBase>;
using Camera3DeviceOpsAssociatedRequestDataView =
mojo::AssociatedInterfaceRequestDataView<Camera3DeviceOpsInterfaceBase>;
class CropRotateScaleInfoDataView {
public:
CropRotateScaleInfoDataView() = default;
CropRotateScaleInfoDataView(
internal::CropRotateScaleInfo_Data* data,
mojo::Message* message)
: data_(data) {}
bool is_null() const { return !data_; }
template <typename UserType>
[[nodiscard]] bool ReadCropRotateScaleDegrees(UserType* output) const {
auto data_value = data_->crop_rotate_scale_degrees;
return mojo::internal::Deserialize<::cros::mojom::Camera3StreamRotation>(
data_value, output);
}
Camera3StreamRotation crop_rotate_scale_degrees() const {
return ::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::Camera3StreamRotation>(data_->crop_rotate_scale_degrees));
}
private:
internal::CropRotateScaleInfo_Data* data_ = nullptr;
};
class Camera3StreamDataView {
public:
Camera3StreamDataView() = default;
Camera3StreamDataView(
internal::Camera3Stream_Data* data,
mojo::Message* message)
: data_(data), message_(message) {}
bool is_null() const { return !data_; }
uint64_t id() const {
return data_->id;
}
template <typename UserType>
[[nodiscard]] bool ReadStreamType(UserType* output) const {
auto data_value = data_->stream_type;
return mojo::internal::Deserialize<::cros::mojom::Camera3StreamType>(
data_value, output);
}
Camera3StreamType stream_type() const {
return ::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::Camera3StreamType>(data_->stream_type));
}
uint32_t width() const {
return data_->width;
}
uint32_t height() const {
return data_->height;
}
template <typename UserType>
[[nodiscard]] bool ReadFormat(UserType* output) const {
auto data_value = data_->format;
return mojo::internal::Deserialize<::cros::mojom::HalPixelFormat>(
data_value, output);
}
HalPixelFormat format() const {
return ::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::HalPixelFormat>(data_->format));
}
uint32_t usage() const {
return data_->usage;
}
uint32_t max_buffers() const {
return data_->max_buffers;
}
uint32_t data_space() const {
return data_->data_space;
}
template <typename UserType>
[[nodiscard]] bool ReadRotation(UserType* output) const {
auto data_value = data_->rotation;
return mojo::internal::Deserialize<::cros::mojom::Camera3StreamRotation>(
data_value, output);
}
Camera3StreamRotation rotation() const {
return ::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::Camera3StreamRotation>(data_->rotation));
}
inline void GetCropRotateScaleInfoDataView(
CropRotateScaleInfoDataView* output);
template <typename UserType>
[[nodiscard]] bool ReadCropRotateScaleInfo(UserType* output) {
static_assert(
mojo::internal::IsValidUserTypeForOptionalValue<
::cros::mojom::CropRotateScaleInfoDataView, UserType>(),
"Attempting to read the optional `crop_rotate_scale_info` field into a type which "
"cannot represent a null value. Either wrap the destination object "
"with std::optional, ensure that any corresponding "
"{Struct/Union/Array/String}Traits define the necessary IsNull and "
"SetToNull methods, or use `MaybeReadCropRotateScaleInfo` instead "
"of `ReadCropRotateScaleInfo if you're fine with null values being "
"silently ignored in this case.");
auto* pointer = data_->header_.version >= 1
? data_->crop_rotate_scale_info.Get() : nullptr;
return mojo::internal::Deserialize<::cros::mojom::CropRotateScaleInfoDataView>(
pointer, output, message_);
}
inline void GetPhysicalCameraIdDataView(
mojo::StringDataView* output);
template <typename UserType>
[[nodiscard]] bool ReadPhysicalCameraId(UserType* output) {
static_assert(
mojo::internal::IsValidUserTypeForOptionalValue<
mojo::StringDataView, UserType>(),
"Attempting to read the optional `physical_camera_id` field into a type which "
"cannot represent a null value. Either wrap the destination object "
"with std::optional, ensure that any corresponding "
"{Struct/Union/Array/String}Traits define the necessary IsNull and "
"SetToNull methods, or use `MaybeReadPhysicalCameraId` instead "
"of `ReadPhysicalCameraId if you're fine with null values being "
"silently ignored in this case.");
auto* pointer = data_->header_.version >= 4
? data_->physical_camera_id.Get() : nullptr;
return mojo::internal::Deserialize<mojo::StringDataView>(
pointer, output, message_);
}
inline void GetEffectsDataView(
mojo::ArrayDataView<::cros::mojom::Camera3StreamEffectDataView>* output);
template <typename UserType>
[[nodiscard]] bool ReadEffects(UserType* output) {
static_assert(
mojo::internal::IsValidUserTypeForOptionalValue<
mojo::ArrayDataView<::cros::mojom::Camera3StreamEffectDataView>, UserType>(),
"Attempting to read the optional `effects` field into a type which "
"cannot represent a null value. Either wrap the destination object "
"with std::optional, ensure that any corresponding "
"{Struct/Union/Array/String}Traits define the necessary IsNull and "
"SetToNull methods, or use `MaybeReadEffects` instead "
"of `ReadEffects if you're fine with null values being "
"silently ignored in this case.");
auto* pointer = data_->header_.version >= 6
? data_->effects.Get() : nullptr;
return mojo::internal::Deserialize<mojo::ArrayDataView<::cros::mojom::Camera3StreamEffectDataView>>(
pointer, output, message_);
}
private:
internal::Camera3Stream_Data* data_ = nullptr;
mojo::Message* message_ = nullptr;
};
class Camera3StreamConfigurationDataView {
public:
Camera3StreamConfigurationDataView() = default;
Camera3StreamConfigurationDataView(
internal::Camera3StreamConfiguration_Data* data,
mojo::Message* message)
: data_(data), message_(message) {}
bool is_null() const { return !data_; }
inline void GetStreamsDataView(
mojo::ArrayDataView<Camera3StreamDataView>* output);
template <typename UserType>
[[nodiscard]] bool ReadStreams(UserType* output) {
auto* pointer = data_->streams.Get();
return mojo::internal::Deserialize<mojo::ArrayDataView<::cros::mojom::Camera3StreamDataView>>(
pointer, output, message_);
}
template <typename UserType>
[[nodiscard]] bool ReadOperationMode(UserType* output) const {
auto data_value = data_->operation_mode;
return mojo::internal::Deserialize<::cros::mojom::Camera3StreamConfigurationMode>(
data_value, output);
}
Camera3StreamConfigurationMode operation_mode() const {
return ::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::Camera3StreamConfigurationMode>(data_->operation_mode));
}
inline void GetSessionParametersDataView(
::cros::mojom::CameraMetadataDataView* output);
template <typename UserType>
[[nodiscard]] bool ReadSessionParameters(UserType* output) {
static_assert(
mojo::internal::IsValidUserTypeForOptionalValue<
::cros::mojom::CameraMetadataDataView, UserType>(),
"Attempting to read the optional `session_parameters` field into a type which "
"cannot represent a null value. Either wrap the destination object "
"with std::optional, ensure that any corresponding "
"{Struct/Union/Array/String}Traits define the necessary IsNull and "
"SetToNull methods, or use `MaybeReadSessionParameters` instead "
"of `ReadSessionParameters if you're fine with null values being "
"silently ignored in this case.");
auto* pointer = data_->header_.version >= 4
? data_->session_parameters.Get() : nullptr;
return mojo::internal::Deserialize<::cros::mojom::CameraMetadataDataView>(
pointer, output, message_);
}
private:
internal::Camera3StreamConfiguration_Data* data_ = nullptr;
mojo::Message* message_ = nullptr;
};
class CameraBufferHandleDataView {
public:
CameraBufferHandleDataView() = default;
CameraBufferHandleDataView(
internal::CameraBufferHandle_Data* data,
mojo::Message* message)
: data_(data), message_(message) {}
bool is_null() const { return !data_; }
uint64_t buffer_id() const {
return data_->buffer_id;
}
inline void GetFdsDataView(
mojo::ArrayDataView<mojo::ScopedHandle>* output);
template <typename UserType>
[[nodiscard]] bool ReadFds(UserType* output) {
auto* pointer = data_->fds.Get();
return mojo::internal::Deserialize<mojo::ArrayDataView<mojo::ScopedHandle>>(
pointer, output, message_);
}
uint32_t drm_format() const {
return data_->drm_format;
}
template <typename UserType>
[[nodiscard]] bool ReadHalPixelFormat(UserType* output) const {
auto data_value = data_->hal_pixel_format;
return mojo::internal::Deserialize<::cros::mojom::HalPixelFormat>(
data_value, output);
}
HalPixelFormat hal_pixel_format() const {
return ::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::HalPixelFormat>(data_->hal_pixel_format));
}
uint32_t width() const {
return data_->width;
}
uint32_t height() const {
return data_->height;
}
inline void GetStridesDataView(
mojo::ArrayDataView<uint32_t>* output);
template <typename UserType>
[[nodiscard]] bool ReadStrides(UserType* output) {
auto* pointer = data_->strides.Get();
return mojo::internal::Deserialize<mojo::ArrayDataView<uint32_t>>(
pointer, output, message_);
}
inline void GetOffsetsDataView(
mojo::ArrayDataView<uint32_t>* output);
template <typename UserType>
[[nodiscard]] bool ReadOffsets(UserType* output) {
auto* pointer = data_->offsets.Get();
return mojo::internal::Deserialize<mojo::ArrayDataView<uint32_t>>(
pointer, output, message_);
}
inline void GetSizesDataView(
mojo::ArrayDataView<uint32_t>* output);
template <typename UserType>
[[nodiscard]] bool ReadSizes(UserType* output) {
static_assert(
mojo::internal::IsValidUserTypeForOptionalValue<
mojo::ArrayDataView<uint32_t>, UserType>(),
"Attempting to read the optional `sizes` field into a type which "
"cannot represent a null value. Either wrap the destination object "
"with std::optional, ensure that any corresponding "
"{Struct/Union/Array/String}Traits define the necessary IsNull and "
"SetToNull methods, or use `MaybeReadSizes` instead "
"of `ReadSizes if you're fine with null values being "
"silently ignored in this case.");
auto* pointer = data_->header_.version >= 3
? data_->sizes.Get() : nullptr;
return mojo::internal::Deserialize<mojo::ArrayDataView<uint32_t>>(
pointer, output, message_);
}
bool has_modifier() const {
if (data_->header_.version < 7)
return bool{};
return data_->has_modifier;
}
uint64_t modifier() const {
if (data_->header_.version < 7)
return uint64_t{};
return data_->modifier;
}
private:
internal::CameraBufferHandle_Data* data_ = nullptr;
mojo::Message* message_ = nullptr;
};
class Camera3StreamBufferDataView {
public:
Camera3StreamBufferDataView() = default;
Camera3StreamBufferDataView(
internal::Camera3StreamBuffer_Data* data,
mojo::Message* message)
: data_(data), message_(message) {}
bool is_null() const { return !data_; }
uint64_t stream_id() const {
return data_->stream_id;
}
uint64_t buffer_id() const {
return data_->buffer_id;
}
template <typename UserType>
[[nodiscard]] bool ReadStatus(UserType* output) const {
auto data_value = data_->status;
return mojo::internal::Deserialize<::cros::mojom::Camera3BufferStatus>(
data_value, output);
}
Camera3BufferStatus status() const {
return ::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::Camera3BufferStatus>(data_->status));
}
mojo::ScopedHandle TakeAcquireFence() {
mojo::ScopedHandle result;
bool ret =
mojo::internal::Deserialize<mojo::ScopedHandle>(
&data_->acquire_fence, &result, message_);
DCHECK(ret);
return result;
}
mojo::ScopedHandle TakeReleaseFence() {
mojo::ScopedHandle result;
bool ret =
mojo::internal::Deserialize<mojo::ScopedHandle>(
&data_->release_fence, &result, message_);
DCHECK(ret);
return result;
}
inline void GetBufferHandleDataView(
CameraBufferHandleDataView* output);
template <typename UserType>
[[nodiscard]] bool ReadBufferHandle(UserType* output) {
static_assert(
mojo::internal::IsValidUserTypeForOptionalValue<
::cros::mojom::CameraBufferHandleDataView, UserType>(),
"Attempting to read the optional `buffer_handle` field into a type which "
"cannot represent a null value. Either wrap the destination object "
"with std::optional, ensure that any corresponding "
"{Struct/Union/Array/String}Traits define the necessary IsNull and "
"SetToNull methods, or use `MaybeReadBufferHandle` instead "
"of `ReadBufferHandle if you're fine with null values being "
"silently ignored in this case.");
auto* pointer = data_->header_.version >= 2
? data_->buffer_handle.Get() : nullptr;
return mojo::internal::Deserialize<::cros::mojom::CameraBufferHandleDataView>(
pointer, output, message_);
}
private:
internal::Camera3StreamBuffer_Data* data_ = nullptr;
mojo::Message* message_ = nullptr;
};
class Camera3ErrorMsgDataView {
public:
Camera3ErrorMsgDataView() = default;
Camera3ErrorMsgDataView(
internal::Camera3ErrorMsg_Data* data,
mojo::Message* message)
: data_(data) {}
bool is_null() const { return !data_; }
uint32_t frame_number() const {
return data_->frame_number;
}
uint64_t error_stream_id() const {
return data_->error_stream_id;
}
template <typename UserType>
[[nodiscard]] bool ReadErrorCode(UserType* output) const {
auto data_value = data_->error_code;
return mojo::internal::Deserialize<::cros::mojom::Camera3ErrorMsgCode>(
data_value, output);
}
Camera3ErrorMsgCode error_code() const {
return ::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::Camera3ErrorMsgCode>(data_->error_code));
}
private:
internal::Camera3ErrorMsg_Data* data_ = nullptr;
};
class Camera3ShutterMsgDataView {
public:
Camera3ShutterMsgDataView() = default;
Camera3ShutterMsgDataView(
internal::Camera3ShutterMsg_Data* data,
mojo::Message* message)
: data_(data) {}
bool is_null() const { return !data_; }
uint32_t frame_number() const {
return data_->frame_number;
}
uint64_t timestamp() const {
return data_->timestamp;
}
private:
internal::Camera3ShutterMsg_Data* data_ = nullptr;
};
class Camera3NotifyMsgDataView {
public:
Camera3NotifyMsgDataView() = default;
Camera3NotifyMsgDataView(
internal::Camera3NotifyMsg_Data* data,
mojo::Message* message)
: data_(data), message_(message) {}
bool is_null() const { return !data_; }
template <typename UserType>
[[nodiscard]] bool ReadType(UserType* output) const {
auto data_value = data_->type;
return mojo::internal::Deserialize<::cros::mojom::Camera3MsgType>(
data_value, output);
}
Camera3MsgType type() const {
return ::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::Camera3MsgType>(data_->type));
}
inline void GetMessageDataView(
Camera3NotifyMsgMessageDataView* output);
template <typename UserType>
[[nodiscard]] bool ReadMessage(UserType* output) {
auto* pointer = !data_->message.is_null() ? &data_->message : nullptr;
return mojo::internal::Deserialize<::cros::mojom::Camera3NotifyMsgMessageDataView>(
pointer, output, message_);
}
private:
internal::Camera3NotifyMsg_Data* data_ = nullptr;
mojo::Message* message_ = nullptr;
};
class Camera3BufferRequestDataView {
public:
Camera3BufferRequestDataView() = default;
Camera3BufferRequestDataView(
internal::Camera3BufferRequest_Data* data,
mojo::Message* message)
: data_(data) {}
bool is_null() const { return !data_; }
uint64_t stream_id() const {
return data_->stream_id;
}
uint32_t num_buffers_requested() const {
return data_->num_buffers_requested;
}
private:
internal::Camera3BufferRequest_Data* data_ = nullptr;
};
class Camera3StreamBufferRetDataView {
public:
Camera3StreamBufferRetDataView() = default;
Camera3StreamBufferRetDataView(
internal::Camera3StreamBufferRet_Data* data,
mojo::Message* message)
: data_(data), message_(message) {}
bool is_null() const { return !data_; }
uint64_t stream_id() const {
return data_->stream_id;
}
template <typename UserType>
[[nodiscard]] bool ReadStatus(UserType* output) const {
auto data_value = data_->status;
return mojo::internal::Deserialize<::cros::mojom::Camera3StreamBufferReqStatus>(
data_value, output);
}
Camera3StreamBufferReqStatus status() const {
return ::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::Camera3StreamBufferReqStatus>(data_->status));
}
inline void GetOutputBuffersDataView(
mojo::ArrayDataView<Camera3StreamBufferDataView>* output);
template <typename UserType>
[[nodiscard]] bool ReadOutputBuffers(UserType* output) {
static_assert(
mojo::internal::IsValidUserTypeForOptionalValue<
mojo::ArrayDataView<::cros::mojom::Camera3StreamBufferDataView>, UserType>(),
"Attempting to read the optional `output_buffers` field into a type which "
"cannot represent a null value. Either wrap the destination object "
"with std::optional, ensure that any corresponding "
"{Struct/Union/Array/String}Traits define the necessary IsNull and "
"SetToNull methods, or use `MaybeReadOutputBuffers` instead "
"of `ReadOutputBuffers if you're fine with null values being "
"silently ignored in this case.");
auto* pointer = data_->output_buffers.Get();
return mojo::internal::Deserialize<mojo::ArrayDataView<::cros::mojom::Camera3StreamBufferDataView>>(
pointer, output, message_);
}
private:
internal::Camera3StreamBufferRet_Data* data_ = nullptr;
mojo::Message* message_ = nullptr;
};
class Camera3PhyscamMetadataDataView {
public:
Camera3PhyscamMetadataDataView() = default;
Camera3PhyscamMetadataDataView(
internal::Camera3PhyscamMetadata_Data* data,
mojo::Message* message)
: data_(data), message_(message) {}
bool is_null() const { return !data_; }
int32_t id() const {
return data_->id;
}
inline void GetMetadataDataView(
::cros::mojom::CameraMetadataDataView* output);
template <typename UserType>
[[nodiscard]] bool ReadMetadata(UserType* output) {
auto* pointer = data_->metadata.Get();
return mojo::internal::Deserialize<::cros::mojom::CameraMetadataDataView>(
pointer, output, message_);
}
private:
internal::Camera3PhyscamMetadata_Data* data_ = nullptr;
mojo::Message* message_ = nullptr;
};
class Camera3CaptureRequestDataView {
public:
Camera3CaptureRequestDataView() = default;
Camera3CaptureRequestDataView(
internal::Camera3CaptureRequest_Data* data,
mojo::Message* message)
: data_(data), message_(message) {}
bool is_null() const { return !data_; }
uint32_t frame_number() const {
return data_->frame_number;
}
inline void GetSettingsDataView(
::cros::mojom::CameraMetadataDataView* output);
template <typename UserType>
[[nodiscard]] bool ReadSettings(UserType* output) {
auto* pointer = data_->settings.Get();
return mojo::internal::Deserialize<::cros::mojom::CameraMetadataDataView>(
pointer, output, message_);
}
inline void GetInputBufferDataView(
Camera3StreamBufferDataView* output);
template <typename UserType>
[[nodiscard]] bool ReadInputBuffer(UserType* output) {
static_assert(
mojo::internal::IsValidUserTypeForOptionalValue<
::cros::mojom::Camera3StreamBufferDataView, UserType>(),
"Attempting to read the optional `input_buffer` field into a type which "
"cannot represent a null value. Either wrap the destination object "
"with std::optional, ensure that any corresponding "
"{Struct/Union/Array/String}Traits define the necessary IsNull and "
"SetToNull methods, or use `MaybeReadInputBuffer` instead "
"of `ReadInputBuffer if you're fine with null values being "
"silently ignored in this case.");
auto* pointer = data_->input_buffer.Get();
return mojo::internal::Deserialize<::cros::mojom::Camera3StreamBufferDataView>(
pointer, output, message_);
}
inline void GetOutputBuffersDataView(
mojo::ArrayDataView<Camera3StreamBufferDataView>* output);
template <typename UserType>
[[nodiscard]] bool ReadOutputBuffers(UserType* output) {
auto* pointer = data_->output_buffers.Get();
return mojo::internal::Deserialize<mojo::ArrayDataView<::cros::mojom::Camera3StreamBufferDataView>>(
pointer, output, message_);
}
inline void GetPhyscamSettingsDataView(
mojo::ArrayDataView<Camera3PhyscamMetadataDataView>* output);
template <typename UserType>
[[nodiscard]] bool ReadPhyscamSettings(UserType* output) {
static_assert(
mojo::internal::IsValidUserTypeForOptionalValue<
mojo::ArrayDataView<::cros::mojom::Camera3PhyscamMetadataDataView>, UserType>(),
"Attempting to read the optional `physcam_settings` field into a type which "
"cannot represent a null value. Either wrap the destination object "
"with std::optional, ensure that any corresponding "
"{Struct/Union/Array/String}Traits define the necessary IsNull and "
"SetToNull methods, or use `MaybeReadPhyscamSettings` instead "
"of `ReadPhyscamSettings if you're fine with null values being "
"silently ignored in this case.");
auto* pointer = data_->header_.version >= 4
? data_->physcam_settings.Get() : nullptr;
return mojo::internal::Deserialize<mojo::ArrayDataView<::cros::mojom::Camera3PhyscamMetadataDataView>>(
pointer, output, message_);
}
private:
internal::Camera3CaptureRequest_Data* data_ = nullptr;
mojo::Message* message_ = nullptr;
};
class Camera3CaptureResultDataView {
public:
Camera3CaptureResultDataView() = default;
Camera3CaptureResultDataView(
internal::Camera3CaptureResult_Data* data,
mojo::Message* message)
: data_(data), message_(message) {}
bool is_null() const { return !data_; }
uint32_t frame_number() const {
return data_->frame_number;
}
inline void GetResultDataView(
::cros::mojom::CameraMetadataDataView* output);
template <typename UserType>
[[nodiscard]] bool ReadResult(UserType* output) {
auto* pointer = data_->result.Get();
return mojo::internal::Deserialize<::cros::mojom::CameraMetadataDataView>(
pointer, output, message_);
}
inline void GetOutputBuffersDataView(
mojo::ArrayDataView<Camera3StreamBufferDataView>* output);
template <typename UserType>
[[nodiscard]] bool ReadOutputBuffers(UserType* output) {
static_assert(
mojo::internal::IsValidUserTypeForOptionalValue<
mojo::ArrayDataView<::cros::mojom::Camera3StreamBufferDataView>, UserType>(),
"Attempting to read the optional `output_buffers` field into a type which "
"cannot represent a null value. Either wrap the destination object "
"with std::optional, ensure that any corresponding "
"{Struct/Union/Array/String}Traits define the necessary IsNull and "
"SetToNull methods, or use `MaybeReadOutputBuffers` instead "
"of `ReadOutputBuffers if you're fine with null values being "
"silently ignored in this case.");
auto* pointer = data_->output_buffers.Get();
return mojo::internal::Deserialize<mojo::ArrayDataView<::cros::mojom::Camera3StreamBufferDataView>>(
pointer, output, message_);
}
inline void GetInputBufferDataView(
Camera3StreamBufferDataView* output);
template <typename UserType>
[[nodiscard]] bool ReadInputBuffer(UserType* output) {
static_assert(
mojo::internal::IsValidUserTypeForOptionalValue<
::cros::mojom::Camera3StreamBufferDataView, UserType>(),
"Attempting to read the optional `input_buffer` field into a type which "
"cannot represent a null value. Either wrap the destination object "
"with std::optional, ensure that any corresponding "
"{Struct/Union/Array/String}Traits define the necessary IsNull and "
"SetToNull methods, or use `MaybeReadInputBuffer` instead "
"of `ReadInputBuffer if you're fine with null values being "
"silently ignored in this case.");
auto* pointer = data_->input_buffer.Get();
return mojo::internal::Deserialize<::cros::mojom::Camera3StreamBufferDataView>(
pointer, output, message_);
}
uint32_t partial_result() const {
return data_->partial_result;
}
inline void GetPhyscamMetadataDataView(
mojo::ArrayDataView<Camera3PhyscamMetadataDataView>* output);
template <typename UserType>
[[nodiscard]] bool ReadPhyscamMetadata(UserType* output) {
static_assert(
mojo::internal::IsValidUserTypeForOptionalValue<
mojo::ArrayDataView<::cros::mojom::Camera3PhyscamMetadataDataView>, UserType>(),
"Attempting to read the optional `physcam_metadata` field into a type which "
"cannot represent a null value. Either wrap the destination object "
"with std::optional, ensure that any corresponding "
"{Struct/Union/Array/String}Traits define the necessary IsNull and "
"SetToNull methods, or use `MaybeReadPhyscamMetadata` instead "
"of `ReadPhyscamMetadata if you're fine with null values being "
"silently ignored in this case.");
auto* pointer = data_->header_.version >= 4
? data_->physcam_metadata.Get() : nullptr;
return mojo::internal::Deserialize<mojo::ArrayDataView<::cros::mojom::Camera3PhyscamMetadataDataView>>(
pointer, output, message_);
}
private:
internal::Camera3CaptureResult_Data* data_ = nullptr;
mojo::Message* message_ = nullptr;
};
class Camera3NotifyMsgMessageDataView {
public:
using Tag = internal::Camera3NotifyMsgMessage_Data::Camera3NotifyMsgMessage_Tag;
Camera3NotifyMsgMessageDataView() = default;
Camera3NotifyMsgMessageDataView(
internal::Camera3NotifyMsgMessage_Data* data,
mojo::Message* message)
: data_(data), message_(message) {}
bool is_null() const {
// For inlined unions, |data_| is always non-null. In that case we need to
// check |data_->is_null()|.
return !data_ || data_->is_null();
}
Tag tag() const { return data_->tag; }
bool is_error() const { return data_->tag == Tag::kError; }
inline void GetErrorDataView(
Camera3ErrorMsgDataView* output) const;
template <typename UserType>
[[nodiscard]] bool ReadError(UserType* output) const {
CHECK(is_error());
return mojo::internal::Deserialize<::cros::mojom::Camera3ErrorMsgDataView>(
data_->data.f_error.Get(), output, message_);
}
bool is_shutter() const { return data_->tag == Tag::kShutter; }
inline void GetShutterDataView(
Camera3ShutterMsgDataView* output) const;
template <typename UserType>
[[nodiscard]] bool ReadShutter(UserType* output) const {
CHECK(is_shutter());
return mojo::internal::Deserialize<::cros::mojom::Camera3ShutterMsgDataView>(
data_->data.f_shutter.Get(), output, message_);
}
bool is_generic() const { return data_->tag == Tag::kGeneric; }
inline void GetGenericDataView(
mojo::ArrayDataView<uint8_t>* output) const;
template <typename UserType>
[[nodiscard]] bool ReadGeneric(UserType* output) const {
CHECK(is_generic());
return mojo::internal::Deserialize<mojo::ArrayDataView<uint8_t>>(
data_->data.f_generic.Get(), output, message_);
}
private:
internal::Camera3NotifyMsgMessage_Data* data_ = nullptr;
mojo::Message* message_ = nullptr;
};
} // cros::mojom
namespace std {
template <>
struct hash<::cros::mojom::HalPixelFormat>
: public mojo::internal::EnumHashImpl<::cros::mojom::HalPixelFormat> {};
template <>
struct hash<::cros::mojom::Camera3StreamType>
: public mojo::internal::EnumHashImpl<::cros::mojom::Camera3StreamType> {};
template <>
struct hash<::cros::mojom::Camera3StreamRotation>
: public mojo::internal::EnumHashImpl<::cros::mojom::Camera3StreamRotation> {};
template <>
struct hash<::cros::mojom::Camera3StreamConfigurationMode>
: public mojo::internal::EnumHashImpl<::cros::mojom::Camera3StreamConfigurationMode> {};
template <>
struct hash<::cros::mojom::Camera3BufferStatus>
: public mojo::internal::EnumHashImpl<::cros::mojom::Camera3BufferStatus> {};
template <>
struct hash<::cros::mojom::Camera3MsgType>
: public mojo::internal::EnumHashImpl<::cros::mojom::Camera3MsgType> {};
template <>
struct hash<::cros::mojom::Camera3ErrorMsgCode>
: public mojo::internal::EnumHashImpl<::cros::mojom::Camera3ErrorMsgCode> {};
template <>
struct hash<::cros::mojom::Camera3BufferRequestStatus>
: public mojo::internal::EnumHashImpl<::cros::mojom::Camera3BufferRequestStatus> {};
template <>
struct hash<::cros::mojom::Camera3StreamBufferReqStatus>
: public mojo::internal::EnumHashImpl<::cros::mojom::Camera3StreamBufferReqStatus> {};
template <>
struct hash<::cros::mojom::Camera3RequestTemplate>
: public mojo::internal::EnumHashImpl<::cros::mojom::Camera3RequestTemplate> {};
template <>
struct hash<::cros::mojom::Camera3DeviceOps_BufferType>
: public mojo::internal::EnumHashImpl<::cros::mojom::Camera3DeviceOps_BufferType> {};
} // namespace std
namespace mojo {
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::HalPixelFormat, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = EnumTraits<::cros::mojom::HalPixelFormat, UserType>;
static void Serialize(UserType input, int32_t* output) {
*output = static_cast<int32_t>(Traits::ToMojom(input));
}
static bool Deserialize(int32_t input, UserType* output) {
return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::HalPixelFormat>(input)), output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3StreamType, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = EnumTraits<::cros::mojom::Camera3StreamType, UserType>;
static void Serialize(UserType input, int32_t* output) {
*output = static_cast<int32_t>(Traits::ToMojom(input));
}
static bool Deserialize(int32_t input, UserType* output) {
return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::Camera3StreamType>(input)), output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3StreamRotation, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = EnumTraits<::cros::mojom::Camera3StreamRotation, UserType>;
static void Serialize(UserType input, int32_t* output) {
*output = static_cast<int32_t>(Traits::ToMojom(input));
}
static bool Deserialize(int32_t input, UserType* output) {
return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::Camera3StreamRotation>(input)), output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3StreamConfigurationMode, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = EnumTraits<::cros::mojom::Camera3StreamConfigurationMode, UserType>;
static void Serialize(UserType input, int32_t* output) {
*output = static_cast<int32_t>(Traits::ToMojom(input));
}
static bool Deserialize(int32_t input, UserType* output) {
return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::Camera3StreamConfigurationMode>(input)), output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3BufferStatus, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = EnumTraits<::cros::mojom::Camera3BufferStatus, UserType>;
static void Serialize(UserType input, int32_t* output) {
*output = static_cast<int32_t>(Traits::ToMojom(input));
}
static bool Deserialize(int32_t input, UserType* output) {
return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::Camera3BufferStatus>(input)), output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3MsgType, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = EnumTraits<::cros::mojom::Camera3MsgType, UserType>;
static void Serialize(UserType input, int32_t* output) {
*output = static_cast<int32_t>(Traits::ToMojom(input));
}
static bool Deserialize(int32_t input, UserType* output) {
return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::Camera3MsgType>(input)), output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3ErrorMsgCode, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = EnumTraits<::cros::mojom::Camera3ErrorMsgCode, UserType>;
static void Serialize(UserType input, int32_t* output) {
*output = static_cast<int32_t>(Traits::ToMojom(input));
}
static bool Deserialize(int32_t input, UserType* output) {
return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::Camera3ErrorMsgCode>(input)), output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3BufferRequestStatus, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = EnumTraits<::cros::mojom::Camera3BufferRequestStatus, UserType>;
static void Serialize(UserType input, int32_t* output) {
*output = static_cast<int32_t>(Traits::ToMojom(input));
}
static bool Deserialize(int32_t input, UserType* output) {
return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::Camera3BufferRequestStatus>(input)), output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3StreamBufferReqStatus, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = EnumTraits<::cros::mojom::Camera3StreamBufferReqStatus, UserType>;
static void Serialize(UserType input, int32_t* output) {
*output = static_cast<int32_t>(Traits::ToMojom(input));
}
static bool Deserialize(int32_t input, UserType* output) {
return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::Camera3StreamBufferReqStatus>(input)), output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3RequestTemplate, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = EnumTraits<::cros::mojom::Camera3RequestTemplate, UserType>;
static void Serialize(UserType input, int32_t* output) {
*output = static_cast<int32_t>(Traits::ToMojom(input));
}
static bool Deserialize(int32_t input, UserType* output) {
return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::Camera3RequestTemplate>(input)), output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3DeviceOps_BufferType, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = EnumTraits<::cros::mojom::Camera3DeviceOps_BufferType, UserType>;
static void Serialize(UserType input, int32_t* output) {
*output = static_cast<int32_t>(Traits::ToMojom(input));
}
static bool Deserialize(int32_t input, UserType* output) {
return Traits::FromMojom(::mojo::internal::ToKnownEnumValueHelper(
static_cast<::cros::mojom::Camera3DeviceOps_BufferType>(input)), output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::CropRotateScaleInfoDataView, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = StructTraits<::cros::mojom::CropRotateScaleInfoDataView, UserType>;
static void Serialize(
MaybeConstUserType& input,
mojo::internal::MessageFragment<::cros::mojom::internal::CropRotateScaleInfo_Data>& fragment) {
if (CallIsNullIfExists<Traits>(input))
return;
fragment.Allocate();
mojo::internal::Serialize<::cros::mojom::Camera3StreamRotation>(
Traits::crop_rotate_scale_degrees(input), &fragment->crop_rotate_scale_degrees);
}
static bool Deserialize(::cros::mojom::internal::CropRotateScaleInfo_Data* input,
UserType* output,
Message* message) {
if (!input)
return CallSetToNullIfExists<Traits>(output);
::cros::mojom::CropRotateScaleInfoDataView data_view(input, message);
return Traits::Read(data_view, output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3StreamDataView, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = StructTraits<::cros::mojom::Camera3StreamDataView, UserType>;
static void Serialize(
MaybeConstUserType& input,
mojo::internal::MessageFragment<::cros::mojom::internal::Camera3Stream_Data>& fragment) {
if (CallIsNullIfExists<Traits>(input))
return;
fragment.Allocate();
fragment->id = Traits::id(input);
mojo::internal::Serialize<::cros::mojom::Camera3StreamType>(
Traits::stream_type(input), &fragment->stream_type);
fragment->width = Traits::width(input);
fragment->height = Traits::height(input);
mojo::internal::Serialize<::cros::mojom::HalPixelFormat>(
Traits::format(input), &fragment->format);
fragment->usage = Traits::usage(input);
fragment->max_buffers = Traits::max_buffers(input);
fragment->data_space = Traits::data_space(input);
mojo::internal::Serialize<::cros::mojom::Camera3StreamRotation>(
Traits::rotation(input), &fragment->rotation);
decltype(Traits::crop_rotate_scale_info(input)) in_crop_rotate_scale_info = Traits::crop_rotate_scale_info(input);
mojo::internal::MessageFragment<
typename decltype(fragment->crop_rotate_scale_info)::BaseType> crop_rotate_scale_info_fragment(
fragment.message());
mojo::internal::Serialize<::cros::mojom::CropRotateScaleInfoDataView>(
in_crop_rotate_scale_info, crop_rotate_scale_info_fragment);
fragment->crop_rotate_scale_info.Set(
crop_rotate_scale_info_fragment.is_null() ? nullptr : crop_rotate_scale_info_fragment.data());
decltype(Traits::physical_camera_id(input)) in_physical_camera_id = Traits::physical_camera_id(input);
mojo::internal::MessageFragment<
typename decltype(fragment->physical_camera_id)::BaseType> physical_camera_id_fragment(
fragment.message());
mojo::internal::Serialize<mojo::StringDataView>(
in_physical_camera_id, physical_camera_id_fragment);
fragment->physical_camera_id.Set(
physical_camera_id_fragment.is_null() ? nullptr : physical_camera_id_fragment.data());
decltype(Traits::effects(input)) in_effects = Traits::effects(input);
mojo::internal::MessageFragment<
typename decltype(fragment->effects)::BaseType>
effects_fragment(fragment.message());
constexpr const mojo::internal::ContainerValidateParams& effects_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
mojo::internal::Serialize<mojo::ArrayDataView<::cros::mojom::Camera3StreamEffectDataView>>(
in_effects, effects_fragment, &effects_validate_params);
fragment->effects.Set(
effects_fragment.is_null() ? nullptr : effects_fragment.data());
}
static bool Deserialize(::cros::mojom::internal::Camera3Stream_Data* input,
UserType* output,
Message* message) {
if (!input)
return CallSetToNullIfExists<Traits>(output);
::cros::mojom::Camera3StreamDataView data_view(input, message);
return Traits::Read(data_view, output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3StreamConfigurationDataView, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = StructTraits<::cros::mojom::Camera3StreamConfigurationDataView, UserType>;
static void Serialize(
MaybeConstUserType& input,
mojo::internal::MessageFragment<::cros::mojom::internal::Camera3StreamConfiguration_Data>& fragment) {
if (CallIsNullIfExists<Traits>(input))
return;
fragment.Allocate();
decltype(Traits::streams(input)) in_streams = Traits::streams(input);
mojo::internal::MessageFragment<
typename decltype(fragment->streams)::BaseType>
streams_fragment(fragment.message());
constexpr const mojo::internal::ContainerValidateParams& streams_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
mojo::internal::Serialize<mojo::ArrayDataView<::cros::mojom::Camera3StreamDataView>>(
in_streams, streams_fragment, &streams_validate_params);
fragment->streams.Set(
streams_fragment.is_null() ? nullptr : streams_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
fragment->streams.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null streams in Camera3StreamConfiguration struct");
mojo::internal::Serialize<::cros::mojom::Camera3StreamConfigurationMode>(
Traits::operation_mode(input), &fragment->operation_mode);
decltype(Traits::session_parameters(input)) in_session_parameters = Traits::session_parameters(input);
mojo::internal::MessageFragment<
typename decltype(fragment->session_parameters)::BaseType> session_parameters_fragment(
fragment.message());
mojo::internal::Serialize<::cros::mojom::CameraMetadataDataView>(
in_session_parameters, session_parameters_fragment);
fragment->session_parameters.Set(
session_parameters_fragment.is_null() ? nullptr : session_parameters_fragment.data());
}
static bool Deserialize(::cros::mojom::internal::Camera3StreamConfiguration_Data* input,
UserType* output,
Message* message) {
if (!input)
return CallSetToNullIfExists<Traits>(output);
::cros::mojom::Camera3StreamConfigurationDataView data_view(input, message);
return Traits::Read(data_view, output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::CameraBufferHandleDataView, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = StructTraits<::cros::mojom::CameraBufferHandleDataView, UserType>;
static void Serialize(
MaybeConstUserType& input,
mojo::internal::MessageFragment<::cros::mojom::internal::CameraBufferHandle_Data>& fragment) {
if (CallIsNullIfExists<Traits>(input))
return;
fragment.Allocate();
fragment->buffer_id = Traits::buffer_id(input);
decltype(Traits::fds(input)) in_fds = Traits::fds(input);
mojo::internal::MessageFragment<
typename decltype(fragment->fds)::BaseType>
fds_fragment(fragment.message());
constexpr const mojo::internal::ContainerValidateParams& fds_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
mojo::internal::Serialize<mojo::ArrayDataView<mojo::ScopedHandle>>(
in_fds, fds_fragment, &fds_validate_params);
fragment->fds.Set(
fds_fragment.is_null() ? nullptr : fds_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
fragment->fds.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null fds in CameraBufferHandle struct");
fragment->drm_format = Traits::drm_format(input);
mojo::internal::Serialize<::cros::mojom::HalPixelFormat>(
Traits::hal_pixel_format(input), &fragment->hal_pixel_format);
fragment->width = Traits::width(input);
fragment->height = Traits::height(input);
decltype(Traits::strides(input)) in_strides = Traits::strides(input);
mojo::internal::MessageFragment<
typename decltype(fragment->strides)::BaseType>
strides_fragment(fragment.message());
constexpr const mojo::internal::ContainerValidateParams& strides_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
mojo::internal::Serialize<mojo::ArrayDataView<uint32_t>>(
in_strides, strides_fragment, &strides_validate_params);
fragment->strides.Set(
strides_fragment.is_null() ? nullptr : strides_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
fragment->strides.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null strides in CameraBufferHandle struct");
decltype(Traits::offsets(input)) in_offsets = Traits::offsets(input);
mojo::internal::MessageFragment<
typename decltype(fragment->offsets)::BaseType>
offsets_fragment(fragment.message());
constexpr const mojo::internal::ContainerValidateParams& offsets_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
mojo::internal::Serialize<mojo::ArrayDataView<uint32_t>>(
in_offsets, offsets_fragment, &offsets_validate_params);
fragment->offsets.Set(
offsets_fragment.is_null() ? nullptr : offsets_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
fragment->offsets.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null offsets in CameraBufferHandle struct");
decltype(Traits::sizes(input)) in_sizes = Traits::sizes(input);
mojo::internal::MessageFragment<
typename decltype(fragment->sizes)::BaseType>
sizes_fragment(fragment.message());
constexpr const mojo::internal::ContainerValidateParams& sizes_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
mojo::internal::Serialize<mojo::ArrayDataView<uint32_t>>(
in_sizes, sizes_fragment, &sizes_validate_params);
fragment->sizes.Set(
sizes_fragment.is_null() ? nullptr : sizes_fragment.data());
fragment->has_modifier = Traits::has_modifier(input);
fragment->modifier = Traits::modifier(input);
}
static bool Deserialize(::cros::mojom::internal::CameraBufferHandle_Data* input,
UserType* output,
Message* message) {
if (!input)
return CallSetToNullIfExists<Traits>(output);
::cros::mojom::CameraBufferHandleDataView data_view(input, message);
return Traits::Read(data_view, output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3StreamBufferDataView, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = StructTraits<::cros::mojom::Camera3StreamBufferDataView, UserType>;
static void Serialize(
MaybeConstUserType& input,
mojo::internal::MessageFragment<::cros::mojom::internal::Camera3StreamBuffer_Data>& fragment) {
if (CallIsNullIfExists<Traits>(input))
return;
fragment.Allocate();
fragment->stream_id = Traits::stream_id(input);
fragment->buffer_id = Traits::buffer_id(input);
mojo::internal::Serialize<::cros::mojom::Camera3BufferStatus>(
Traits::status(input), &fragment->status);
decltype(Traits::acquire_fence(input)) in_acquire_fence = Traits::acquire_fence(input);
mojo::internal::Serialize<mojo::ScopedHandle>(
in_acquire_fence, &fragment->acquire_fence, &fragment.message());
decltype(Traits::release_fence(input)) in_release_fence = Traits::release_fence(input);
mojo::internal::Serialize<mojo::ScopedHandle>(
in_release_fence, &fragment->release_fence, &fragment.message());
decltype(Traits::buffer_handle(input)) in_buffer_handle = Traits::buffer_handle(input);
mojo::internal::MessageFragment<
typename decltype(fragment->buffer_handle)::BaseType> buffer_handle_fragment(
fragment.message());
mojo::internal::Serialize<::cros::mojom::CameraBufferHandleDataView>(
in_buffer_handle, buffer_handle_fragment);
fragment->buffer_handle.Set(
buffer_handle_fragment.is_null() ? nullptr : buffer_handle_fragment.data());
}
static bool Deserialize(::cros::mojom::internal::Camera3StreamBuffer_Data* input,
UserType* output,
Message* message) {
if (!input)
return CallSetToNullIfExists<Traits>(output);
::cros::mojom::Camera3StreamBufferDataView data_view(input, message);
return Traits::Read(data_view, output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3ErrorMsgDataView, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = StructTraits<::cros::mojom::Camera3ErrorMsgDataView, UserType>;
static void Serialize(
MaybeConstUserType& input,
mojo::internal::MessageFragment<::cros::mojom::internal::Camera3ErrorMsg_Data>& fragment) {
if (CallIsNullIfExists<Traits>(input))
return;
fragment.Allocate();
fragment->frame_number = Traits::frame_number(input);
fragment->error_stream_id = Traits::error_stream_id(input);
mojo::internal::Serialize<::cros::mojom::Camera3ErrorMsgCode>(
Traits::error_code(input), &fragment->error_code);
}
static bool Deserialize(::cros::mojom::internal::Camera3ErrorMsg_Data* input,
UserType* output,
Message* message) {
if (!input)
return CallSetToNullIfExists<Traits>(output);
::cros::mojom::Camera3ErrorMsgDataView data_view(input, message);
return Traits::Read(data_view, output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3ShutterMsgDataView, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = StructTraits<::cros::mojom::Camera3ShutterMsgDataView, UserType>;
static void Serialize(
MaybeConstUserType& input,
mojo::internal::MessageFragment<::cros::mojom::internal::Camera3ShutterMsg_Data>& fragment) {
if (CallIsNullIfExists<Traits>(input))
return;
fragment.Allocate();
fragment->frame_number = Traits::frame_number(input);
fragment->timestamp = Traits::timestamp(input);
}
static bool Deserialize(::cros::mojom::internal::Camera3ShutterMsg_Data* input,
UserType* output,
Message* message) {
if (!input)
return CallSetToNullIfExists<Traits>(output);
::cros::mojom::Camera3ShutterMsgDataView data_view(input, message);
return Traits::Read(data_view, output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3NotifyMsgDataView, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = StructTraits<::cros::mojom::Camera3NotifyMsgDataView, UserType>;
static void Serialize(
MaybeConstUserType& input,
mojo::internal::MessageFragment<::cros::mojom::internal::Camera3NotifyMsg_Data>& fragment) {
if (CallIsNullIfExists<Traits>(input))
return;
fragment.Allocate();
mojo::internal::Serialize<::cros::mojom::Camera3MsgType>(
Traits::type(input), &fragment->type);
decltype(Traits::message(input)) in_message = Traits::message(input);
mojo::internal::MessageFragment<decltype(fragment->message)>
message_fragment(fragment.message());
message_fragment.Claim(&fragment->message);
mojo::internal::Serialize<::cros::mojom::Camera3NotifyMsgMessageDataView>(
in_message, message_fragment, true);
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
fragment->message.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null message in Camera3NotifyMsg struct");
}
static bool Deserialize(::cros::mojom::internal::Camera3NotifyMsg_Data* input,
UserType* output,
Message* message) {
if (!input)
return CallSetToNullIfExists<Traits>(output);
::cros::mojom::Camera3NotifyMsgDataView data_view(input, message);
return Traits::Read(data_view, output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3BufferRequestDataView, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = StructTraits<::cros::mojom::Camera3BufferRequestDataView, UserType>;
static void Serialize(
MaybeConstUserType& input,
mojo::internal::MessageFragment<::cros::mojom::internal::Camera3BufferRequest_Data>& fragment) {
if (CallIsNullIfExists<Traits>(input))
return;
fragment.Allocate();
fragment->stream_id = Traits::stream_id(input);
fragment->num_buffers_requested = Traits::num_buffers_requested(input);
}
static bool Deserialize(::cros::mojom::internal::Camera3BufferRequest_Data* input,
UserType* output,
Message* message) {
if (!input)
return CallSetToNullIfExists<Traits>(output);
::cros::mojom::Camera3BufferRequestDataView data_view(input, message);
return Traits::Read(data_view, output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3StreamBufferRetDataView, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = StructTraits<::cros::mojom::Camera3StreamBufferRetDataView, UserType>;
static void Serialize(
MaybeConstUserType& input,
mojo::internal::MessageFragment<::cros::mojom::internal::Camera3StreamBufferRet_Data>& fragment) {
if (CallIsNullIfExists<Traits>(input))
return;
fragment.Allocate();
fragment->stream_id = Traits::stream_id(input);
mojo::internal::Serialize<::cros::mojom::Camera3StreamBufferReqStatus>(
Traits::status(input), &fragment->status);
decltype(Traits::output_buffers(input)) in_output_buffers = Traits::output_buffers(input);
mojo::internal::MessageFragment<
typename decltype(fragment->output_buffers)::BaseType>
output_buffers_fragment(fragment.message());
constexpr const mojo::internal::ContainerValidateParams& output_buffers_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
mojo::internal::Serialize<mojo::ArrayDataView<::cros::mojom::Camera3StreamBufferDataView>>(
in_output_buffers, output_buffers_fragment, &output_buffers_validate_params);
fragment->output_buffers.Set(
output_buffers_fragment.is_null() ? nullptr : output_buffers_fragment.data());
}
static bool Deserialize(::cros::mojom::internal::Camera3StreamBufferRet_Data* input,
UserType* output,
Message* message) {
if (!input)
return CallSetToNullIfExists<Traits>(output);
::cros::mojom::Camera3StreamBufferRetDataView data_view(input, message);
return Traits::Read(data_view, output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3PhyscamMetadataDataView, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = StructTraits<::cros::mojom::Camera3PhyscamMetadataDataView, UserType>;
static void Serialize(
MaybeConstUserType& input,
mojo::internal::MessageFragment<::cros::mojom::internal::Camera3PhyscamMetadata_Data>& fragment) {
if (CallIsNullIfExists<Traits>(input))
return;
fragment.Allocate();
fragment->id = Traits::id(input);
decltype(Traits::metadata(input)) in_metadata = Traits::metadata(input);
mojo::internal::MessageFragment<
typename decltype(fragment->metadata)::BaseType> metadata_fragment(
fragment.message());
mojo::internal::Serialize<::cros::mojom::CameraMetadataDataView>(
in_metadata, metadata_fragment);
fragment->metadata.Set(
metadata_fragment.is_null() ? nullptr : metadata_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
fragment->metadata.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null metadata in Camera3PhyscamMetadata struct");
}
static bool Deserialize(::cros::mojom::internal::Camera3PhyscamMetadata_Data* input,
UserType* output,
Message* message) {
if (!input)
return CallSetToNullIfExists<Traits>(output);
::cros::mojom::Camera3PhyscamMetadataDataView data_view(input, message);
return Traits::Read(data_view, output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3CaptureRequestDataView, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = StructTraits<::cros::mojom::Camera3CaptureRequestDataView, UserType>;
static void Serialize(
MaybeConstUserType& input,
mojo::internal::MessageFragment<::cros::mojom::internal::Camera3CaptureRequest_Data>& fragment) {
if (CallIsNullIfExists<Traits>(input))
return;
fragment.Allocate();
fragment->frame_number = Traits::frame_number(input);
decltype(Traits::settings(input)) in_settings = Traits::settings(input);
mojo::internal::MessageFragment<
typename decltype(fragment->settings)::BaseType> settings_fragment(
fragment.message());
mojo::internal::Serialize<::cros::mojom::CameraMetadataDataView>(
in_settings, settings_fragment);
fragment->settings.Set(
settings_fragment.is_null() ? nullptr : settings_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
fragment->settings.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null settings in Camera3CaptureRequest struct");
decltype(Traits::input_buffer(input)) in_input_buffer = Traits::input_buffer(input);
mojo::internal::MessageFragment<
typename decltype(fragment->input_buffer)::BaseType> input_buffer_fragment(
fragment.message());
mojo::internal::Serialize<::cros::mojom::Camera3StreamBufferDataView>(
in_input_buffer, input_buffer_fragment);
fragment->input_buffer.Set(
input_buffer_fragment.is_null() ? nullptr : input_buffer_fragment.data());
decltype(Traits::output_buffers(input)) in_output_buffers = Traits::output_buffers(input);
mojo::internal::MessageFragment<
typename decltype(fragment->output_buffers)::BaseType>
output_buffers_fragment(fragment.message());
constexpr const mojo::internal::ContainerValidateParams& output_buffers_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
mojo::internal::Serialize<mojo::ArrayDataView<::cros::mojom::Camera3StreamBufferDataView>>(
in_output_buffers, output_buffers_fragment, &output_buffers_validate_params);
fragment->output_buffers.Set(
output_buffers_fragment.is_null() ? nullptr : output_buffers_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
fragment->output_buffers.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null output_buffers in Camera3CaptureRequest struct");
decltype(Traits::physcam_settings(input)) in_physcam_settings = Traits::physcam_settings(input);
mojo::internal::MessageFragment<
typename decltype(fragment->physcam_settings)::BaseType>
physcam_settings_fragment(fragment.message());
constexpr const mojo::internal::ContainerValidateParams& physcam_settings_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
mojo::internal::Serialize<mojo::ArrayDataView<::cros::mojom::Camera3PhyscamMetadataDataView>>(
in_physcam_settings, physcam_settings_fragment, &physcam_settings_validate_params);
fragment->physcam_settings.Set(
physcam_settings_fragment.is_null() ? nullptr : physcam_settings_fragment.data());
}
static bool Deserialize(::cros::mojom::internal::Camera3CaptureRequest_Data* input,
UserType* output,
Message* message) {
if (!input)
return CallSetToNullIfExists<Traits>(output);
::cros::mojom::Camera3CaptureRequestDataView data_view(input, message);
return Traits::Read(data_view, output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3CaptureResultDataView, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = StructTraits<::cros::mojom::Camera3CaptureResultDataView, UserType>;
static void Serialize(
MaybeConstUserType& input,
mojo::internal::MessageFragment<::cros::mojom::internal::Camera3CaptureResult_Data>& fragment) {
if (CallIsNullIfExists<Traits>(input))
return;
fragment.Allocate();
fragment->frame_number = Traits::frame_number(input);
decltype(Traits::result(input)) in_result = Traits::result(input);
mojo::internal::MessageFragment<
typename decltype(fragment->result)::BaseType> result_fragment(
fragment.message());
mojo::internal::Serialize<::cros::mojom::CameraMetadataDataView>(
in_result, result_fragment);
fragment->result.Set(
result_fragment.is_null() ? nullptr : result_fragment.data());
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
fragment->result.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null result in Camera3CaptureResult struct");
decltype(Traits::output_buffers(input)) in_output_buffers = Traits::output_buffers(input);
mojo::internal::MessageFragment<
typename decltype(fragment->output_buffers)::BaseType>
output_buffers_fragment(fragment.message());
constexpr const mojo::internal::ContainerValidateParams& output_buffers_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
mojo::internal::Serialize<mojo::ArrayDataView<::cros::mojom::Camera3StreamBufferDataView>>(
in_output_buffers, output_buffers_fragment, &output_buffers_validate_params);
fragment->output_buffers.Set(
output_buffers_fragment.is_null() ? nullptr : output_buffers_fragment.data());
decltype(Traits::input_buffer(input)) in_input_buffer = Traits::input_buffer(input);
mojo::internal::MessageFragment<
typename decltype(fragment->input_buffer)::BaseType> input_buffer_fragment(
fragment.message());
mojo::internal::Serialize<::cros::mojom::Camera3StreamBufferDataView>(
in_input_buffer, input_buffer_fragment);
fragment->input_buffer.Set(
input_buffer_fragment.is_null() ? nullptr : input_buffer_fragment.data());
fragment->partial_result = Traits::partial_result(input);
decltype(Traits::physcam_metadata(input)) in_physcam_metadata = Traits::physcam_metadata(input);
mojo::internal::MessageFragment<
typename decltype(fragment->physcam_metadata)::BaseType>
physcam_metadata_fragment(fragment.message());
constexpr const mojo::internal::ContainerValidateParams& physcam_metadata_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
mojo::internal::Serialize<mojo::ArrayDataView<::cros::mojom::Camera3PhyscamMetadataDataView>>(
in_physcam_metadata, physcam_metadata_fragment, &physcam_metadata_validate_params);
fragment->physcam_metadata.Set(
physcam_metadata_fragment.is_null() ? nullptr : physcam_metadata_fragment.data());
}
static bool Deserialize(::cros::mojom::internal::Camera3CaptureResult_Data* input,
UserType* output,
Message* message) {
if (!input)
return CallSetToNullIfExists<Traits>(output);
::cros::mojom::Camera3CaptureResultDataView data_view(input, message);
return Traits::Read(data_view, output);
}
};
} // namespace internal
namespace internal {
template <typename MaybeConstUserType>
struct Serializer<::cros::mojom::Camera3NotifyMsgMessageDataView, MaybeConstUserType> {
using UserType = typename std::remove_const<MaybeConstUserType>::type;
using Traits = UnionTraits<::cros::mojom::Camera3NotifyMsgMessageDataView, UserType>;
static void Serialize(MaybeConstUserType& input,
MessageFragment<::cros::mojom::internal::Camera3NotifyMsgMessage_Data>& fragment,
bool inlined) {
if (CallIsNullIfExists<Traits>(input)) {
if (inlined)
fragment->set_null();
return;
}
if (!inlined)
fragment.Allocate();
// TODO(azani): Handle unknown and objects.
// Set the not-null flag.
fragment->size = kUnionDataSize;
fragment->tag = Traits::GetTag(input);
switch (fragment->tag) {
case ::cros::mojom::Camera3NotifyMsgMessageDataView::Tag::kError: {
decltype(Traits::error(input))
in_error = Traits::error(input);
mojo::internal::MessageFragment<
typename decltype(fragment->data.f_error)::BaseType>
value_fragment(fragment.message());
mojo::internal::Serialize<::cros::mojom::Camera3ErrorMsgDataView>(
in_error, value_fragment);
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
value_fragment.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null error in Camera3NotifyMsgMessage union");
fragment->data.f_error.Set(
value_fragment.is_null() ? nullptr : value_fragment.data());
break;
}
case ::cros::mojom::Camera3NotifyMsgMessageDataView::Tag::kShutter: {
decltype(Traits::shutter(input))
in_shutter = Traits::shutter(input);
mojo::internal::MessageFragment<
typename decltype(fragment->data.f_shutter)::BaseType>
value_fragment(fragment.message());
mojo::internal::Serialize<::cros::mojom::Camera3ShutterMsgDataView>(
in_shutter, value_fragment);
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
value_fragment.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null shutter in Camera3NotifyMsgMessage union");
fragment->data.f_shutter.Set(
value_fragment.is_null() ? nullptr : value_fragment.data());
break;
}
case ::cros::mojom::Camera3NotifyMsgMessageDataView::Tag::kGeneric: {
decltype(Traits::generic(input))
in_generic = Traits::generic(input);
mojo::internal::MessageFragment<
typename decltype(fragment->data.f_generic)::BaseType>
value_fragment(fragment.message());
constexpr const mojo::internal::ContainerValidateParams& generic_validate_params =
mojo::internal::GetArrayValidator<0, false, nullptr>();
mojo::internal::Serialize<mojo::ArrayDataView<uint8_t>>(
in_generic, value_fragment, &generic_validate_params);
MOJO_INTERNAL_DLOG_SERIALIZATION_WARNING(
value_fragment.is_null(),
mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
"null generic in Camera3NotifyMsgMessage union");
fragment->data.f_generic.Set(
value_fragment.is_null() ? nullptr : value_fragment.data());
break;
}
}
}
static bool Deserialize(::cros::mojom::internal::Camera3NotifyMsgMessage_Data* input,
UserType* output,
Message* message) {
if (!input || input->is_null())
return CallSetToNullIfExists<Traits>(output);
::cros::mojom::Camera3NotifyMsgMessageDataView data_view(input, message);
return Traits::Read(data_view, output);
}
};
} // namespace internal
} // namespace mojo
namespace cros::mojom {
inline void Camera3StreamDataView::GetCropRotateScaleInfoDataView(
CropRotateScaleInfoDataView* output) {
auto pointer = data_->header_.version >= 1
? data_->crop_rotate_scale_info.Get() : nullptr;
*output = CropRotateScaleInfoDataView(pointer, message_);
}
inline void Camera3StreamDataView::GetPhysicalCameraIdDataView(
mojo::StringDataView* output) {
auto pointer = data_->header_.version >= 4
? data_->physical_camera_id.Get() : nullptr;
*output = mojo::StringDataView(pointer, message_);
}
inline void Camera3StreamDataView::GetEffectsDataView(
mojo::ArrayDataView<::cros::mojom::Camera3StreamEffectDataView>* output) {
auto pointer = data_->header_.version >= 6
? data_->effects.Get() : nullptr;
*output = mojo::ArrayDataView<::cros::mojom::Camera3StreamEffectDataView>(pointer, message_);
}
inline void Camera3StreamConfigurationDataView::GetStreamsDataView(
mojo::ArrayDataView<Camera3StreamDataView>* output) {
auto pointer = data_->streams.Get();
*output = mojo::ArrayDataView<Camera3StreamDataView>(pointer, message_);
}
inline void Camera3StreamConfigurationDataView::GetSessionParametersDataView(
::cros::mojom::CameraMetadataDataView* output) {
auto pointer = data_->header_.version >= 4
? data_->session_parameters.Get() : nullptr;
*output = ::cros::mojom::CameraMetadataDataView(pointer, message_);
}
inline void CameraBufferHandleDataView::GetFdsDataView(
mojo::ArrayDataView<mojo::ScopedHandle>* output) {
auto pointer = data_->fds.Get();
*output = mojo::ArrayDataView<mojo::ScopedHandle>(pointer, message_);
}
inline void CameraBufferHandleDataView::GetStridesDataView(
mojo::ArrayDataView<uint32_t>* output) {
auto pointer = data_->strides.Get();
*output = mojo::ArrayDataView<uint32_t>(pointer, message_);
}
inline void CameraBufferHandleDataView::GetOffsetsDataView(
mojo::ArrayDataView<uint32_t>* output) {
auto pointer = data_->offsets.Get();
*output = mojo::ArrayDataView<uint32_t>(pointer, message_);
}
inline void CameraBufferHandleDataView::GetSizesDataView(
mojo::ArrayDataView<uint32_t>* output) {
auto pointer = data_->header_.version >= 3
? data_->sizes.Get() : nullptr;
*output = mojo::ArrayDataView<uint32_t>(pointer, message_);
}
inline void Camera3StreamBufferDataView::GetBufferHandleDataView(
CameraBufferHandleDataView* output) {
auto pointer = data_->header_.version >= 2
? data_->buffer_handle.Get() : nullptr;
*output = CameraBufferHandleDataView(pointer, message_);
}
inline void Camera3NotifyMsgDataView::GetMessageDataView(
Camera3NotifyMsgMessageDataView* output) {
auto pointer = &data_->message;
*output = Camera3NotifyMsgMessageDataView(pointer, message_);
}
inline void Camera3StreamBufferRetDataView::GetOutputBuffersDataView(
mojo::ArrayDataView<Camera3StreamBufferDataView>* output) {
auto pointer = data_->output_buffers.Get();
*output = mojo::ArrayDataView<Camera3StreamBufferDataView>(pointer, message_);
}
inline void Camera3PhyscamMetadataDataView::GetMetadataDataView(
::cros::mojom::CameraMetadataDataView* output) {
auto pointer = data_->metadata.Get();
*output = ::cros::mojom::CameraMetadataDataView(pointer, message_);
}
inline void Camera3CaptureRequestDataView::GetSettingsDataView(
::cros::mojom::CameraMetadataDataView* output) {
auto pointer = data_->settings.Get();
*output = ::cros::mojom::CameraMetadataDataView(pointer, message_);
}
inline void Camera3CaptureRequestDataView::GetInputBufferDataView(
Camera3StreamBufferDataView* output) {
auto pointer = data_->input_buffer.Get();
*output = Camera3StreamBufferDataView(pointer, message_);
}
inline void Camera3CaptureRequestDataView::GetOutputBuffersDataView(
mojo::ArrayDataView<Camera3StreamBufferDataView>* output) {
auto pointer = data_->output_buffers.Get();
*output = mojo::ArrayDataView<Camera3StreamBufferDataView>(pointer, message_);
}
inline void Camera3CaptureRequestDataView::GetPhyscamSettingsDataView(
mojo::ArrayDataView<Camera3PhyscamMetadataDataView>* output) {
auto pointer = data_->header_.version >= 4
? data_->physcam_settings.Get() : nullptr;
*output = mojo::ArrayDataView<Camera3PhyscamMetadataDataView>(pointer, message_);
}
inline void Camera3CaptureResultDataView::GetResultDataView(
::cros::mojom::CameraMetadataDataView* output) {
auto pointer = data_->result.Get();
*output = ::cros::mojom::CameraMetadataDataView(pointer, message_);
}
inline void Camera3CaptureResultDataView::GetOutputBuffersDataView(
mojo::ArrayDataView<Camera3StreamBufferDataView>* output) {
auto pointer = data_->output_buffers.Get();
*output = mojo::ArrayDataView<Camera3StreamBufferDataView>(pointer, message_);
}
inline void Camera3CaptureResultDataView::GetInputBufferDataView(
Camera3StreamBufferDataView* output) {
auto pointer = data_->input_buffer.Get();
*output = Camera3StreamBufferDataView(pointer, message_);
}
inline void Camera3CaptureResultDataView::GetPhyscamMetadataDataView(
mojo::ArrayDataView<Camera3PhyscamMetadataDataView>* output) {
auto pointer = data_->header_.version >= 4
? data_->physcam_metadata.Get() : nullptr;
*output = mojo::ArrayDataView<Camera3PhyscamMetadataDataView>(pointer, message_);
}
inline void Camera3NotifyMsgMessageDataView::GetErrorDataView(
Camera3ErrorMsgDataView* output) const {
CHECK(is_error());
*output = Camera3ErrorMsgDataView(data_->data.f_error.Get(), message_);
}
inline void Camera3NotifyMsgMessageDataView::GetShutterDataView(
Camera3ShutterMsgDataView* output) const {
CHECK(is_shutter());
*output = Camera3ShutterMsgDataView(data_->data.f_shutter.Get(), message_);
}
inline void Camera3NotifyMsgMessageDataView::GetGenericDataView(
mojo::ArrayDataView<uint8_t>* output) const {
CHECK(is_generic());
*output = mojo::ArrayDataView<uint8_t>(data_->data.f_generic.Get(), message_);
}
} // cros::mojom
// Declare TraceFormatTraits for enums, which should be defined in ::perfetto
// namespace.
namespace perfetto {
template <>
struct TraceFormatTraits<::cros::mojom::HalPixelFormat> {
static void WriteIntoTrace(perfetto::TracedValue context, ::cros::mojom::HalPixelFormat value);
};
} // namespace perfetto
namespace perfetto {
template <>
struct TraceFormatTraits<::cros::mojom::Camera3StreamType> {
static void WriteIntoTrace(perfetto::TracedValue context, ::cros::mojom::Camera3StreamType value);
};
} // namespace perfetto
namespace perfetto {
template <>
struct TraceFormatTraits<::cros::mojom::Camera3StreamRotation> {
static void WriteIntoTrace(perfetto::TracedValue context, ::cros::mojom::Camera3StreamRotation value);
};
} // namespace perfetto
namespace perfetto {
template <>
struct TraceFormatTraits<::cros::mojom::Camera3StreamConfigurationMode> {
static void WriteIntoTrace(perfetto::TracedValue context, ::cros::mojom::Camera3StreamConfigurationMode value);
};
} // namespace perfetto
namespace perfetto {
template <>
struct TraceFormatTraits<::cros::mojom::Camera3BufferStatus> {
static void WriteIntoTrace(perfetto::TracedValue context, ::cros::mojom::Camera3BufferStatus value);
};
} // namespace perfetto
namespace perfetto {
template <>
struct TraceFormatTraits<::cros::mojom::Camera3MsgType> {
static void WriteIntoTrace(perfetto::TracedValue context, ::cros::mojom::Camera3MsgType value);
};
} // namespace perfetto
namespace perfetto {
template <>
struct TraceFormatTraits<::cros::mojom::Camera3ErrorMsgCode> {
static void WriteIntoTrace(perfetto::TracedValue context, ::cros::mojom::Camera3ErrorMsgCode value);
};
} // namespace perfetto
namespace perfetto {
template <>
struct TraceFormatTraits<::cros::mojom::Camera3BufferRequestStatus> {
static void WriteIntoTrace(perfetto::TracedValue context, ::cros::mojom::Camera3BufferRequestStatus value);
};
} // namespace perfetto
namespace perfetto {
template <>
struct TraceFormatTraits<::cros::mojom::Camera3StreamBufferReqStatus> {
static void WriteIntoTrace(perfetto::TracedValue context, ::cros::mojom::Camera3StreamBufferReqStatus value);
};
} // namespace perfetto
namespace perfetto {
template <>
struct TraceFormatTraits<::cros::mojom::Camera3RequestTemplate> {
static void WriteIntoTrace(perfetto::TracedValue context, ::cros::mojom::Camera3RequestTemplate value);
};
} // namespace perfetto
namespace perfetto {
template <>
struct TraceFormatTraits<::cros::mojom::Camera3DeviceOps_BufferType> {
static void WriteIntoTrace(perfetto::TracedValue context, ::cros::mojom::Camera3DeviceOps_BufferType value);
};
} // namespace perfetto
#endif // CAMERA_MOJO_CAMERA3_MOJOM_SHARED_H_