Home | History | Annotate | Download | only in metadata
      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_PROPERTY_H_
     18 #define V4L2_CAMERA_HAL_METADATA_PROPERTY_H_
     19 
     20 #include "../common.h"
     21 #include "metadata_common.h"
     22 #include "partial_metadata_interface.h"
     23 
     24 namespace v4l2_camera_hal {
     25 
     26 // A Property is a PartialMetadata that only has a single static tag.
     27 template <typename T>
     28 class Property : public PartialMetadataInterface {
     29  public:
     30   Property(int32_t tag, T value) : tag_(tag), value_(std::move(value)){};
     31 
     32   virtual std::vector<int32_t> StaticTags() const override { return {tag_}; };
     33 
     34   virtual std::vector<int32_t> ControlTags() const override { return {}; };
     35 
     36   virtual std::vector<int32_t> DynamicTags() const override { return {}; };
     37 
     38   virtual int PopulateStaticFields(
     39       android::CameraMetadata* metadata) const override {
     40     return UpdateMetadata(metadata, tag_, value_);
     41   };
     42 
     43   virtual int PopulateDynamicFields(
     44       android::CameraMetadata* metadata) const override {
     45     return 0;
     46   };
     47 
     48   virtual int PopulateTemplateRequest(
     49       int template_type, android::CameraMetadata* metadata) const override {
     50     return 0;
     51   };
     52 
     53   virtual bool SupportsRequestValues(
     54       const android::CameraMetadata& metadata) const override {
     55     return true;
     56   };
     57 
     58   virtual int SetRequestValues(
     59       const android::CameraMetadata& metadata) override {
     60     return 0;
     61   };
     62 
     63  private:
     64   int32_t tag_;
     65   T value_;
     66 };
     67 
     68 }  // namespace v4l2_camera_hal
     69 
     70 #endif  // V4L2_CAMERA_HAL_METADATA_PROPERTY_H_
     71