Ari Hausman-Cohen | 10481a3 | 2016-08-02 10:41:27 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2016 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 | |
| 17 | #ifndef V4L2_CAMERA_HAL_METADATA_H_ |
| 18 | #define V4L2_CAMERA_HAL_METADATA_H_ |
| 19 | |
| 20 | #include <hardware/camera3.h> |
| 21 | |
| 22 | #include "../common.h" |
| 23 | #include "partial_metadata_interface.h" |
| 24 | |
| 25 | namespace v4l2_camera_hal { |
| 26 | class Metadata { |
| 27 | public: |
| 28 | Metadata(); |
| 29 | virtual ~Metadata(); |
| 30 | |
| 31 | int FillStaticMetadata(camera_metadata_t** metadata); |
| 32 | bool IsValidRequest(const camera_metadata_t* metadata); |
| 33 | int SetRequestSettings(const camera_metadata_t* metadata); |
| 34 | int FillResultMetadata(camera_metadata_t** metadata); |
| 35 | |
| 36 | protected: |
| 37 | // Helper for the child constructors to fill in metadata components. |
| 38 | void AddComponent(std::unique_ptr<PartialMetadataInterface> component); |
| 39 | |
| 40 | private: |
| 41 | // The overall metadata is broken down into several distinct pieces. |
| 42 | // Note: it is undefined behavior if multiple components share tags. |
| 43 | std::vector<std::unique_ptr<PartialMetadataInterface>> components_; |
| 44 | |
| 45 | friend class MetadataTest; |
| 46 | |
| 47 | DISALLOW_COPY_AND_ASSIGN(Metadata); |
| 48 | }; |
| 49 | |
| 50 | } // namespace v4l2_camera_hal |
| 51 | |
| 52 | #endif // V4L2_CAMERA_HAL_V4L2_METADATA_H_ |