1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #pragma once 17 18 #include <CameraMetadata.h> 19 #include <android/hardware/camera/device/3.2/ICameraDevice.h> 20 21 namespace android::hardware::camera::device::V3_4::implementation { 22 23 // Small wrappers for mostly hard-coded camera metadata 24 // Some parameters are calculated from remote camera frame size and fps 25 using ::android::hardware::camera::common::V1_0::helper::CameraMetadata; 26 class VsockCameraMetadata : public CameraMetadata { 27 public: 28 VsockCameraMetadata(int32_t width, int32_t height, int32_t fps); 29 getPreferredWidth()30 int32_t getPreferredWidth() const { return width_; } getPreferredHeight()31 int32_t getPreferredHeight() const { return height_; } getPreferredFps()32 int32_t getPreferredFps() const { return fps_; } 33 34 private: 35 int32_t width_; 36 int32_t height_; 37 int32_t fps_; 38 }; 39 40 using ::android::hardware::camera::device::V3_2::RequestTemplate; 41 class VsockCameraRequestMetadata : public CameraMetadata { 42 public: 43 VsockCameraRequestMetadata(int32_t fps, RequestTemplate type); 44 // Tells whether the metadata has been successfully constructed 45 // from the parameters isValid()46 bool isValid() const { return is_valid_; } 47 48 private: 49 bool is_valid_; 50 }; 51 52 } // namespace android::hardware::camera::device::V3_4::implementation 53