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_PARTIAL_METADATA_INTERFACE_H_
18 #define V4L2_CAMERA_HAL_METADATA_PARTIAL_METADATA_INTERFACE_H_
19 
20 #include <vector>
21 
22 #include <camera/CameraMetadata.h>
23 
24 namespace v4l2_camera_hal {
25 
26 // A subset of metadata.
27 class PartialMetadataInterface {
28  public:
~PartialMetadataInterface()29   virtual ~PartialMetadataInterface(){};
30 
31   // The metadata tags this partial metadata is responsible for.
32   // See system/media/camera/docs/docs.html for descriptions of each tag.
33   virtual std::vector<int32_t> StaticTags() const = 0;
34   virtual std::vector<int32_t> ControlTags() const = 0;
35   virtual std::vector<int32_t> DynamicTags() const = 0;
36 
37   // Add all the static properties this partial metadata
38   // is responsible for to |metadata|.
39   virtual int PopulateStaticFields(android::CameraMetadata* metadata) const = 0;
40   // Add all the dynamic states this partial metadata
41   // is responsible for to |metadata|.
42   virtual int PopulateDynamicFields(
43       android::CameraMetadata* metadata) const = 0;
44   // Add default request values for a given template type for all the controls
45   // this partial metadata owns.
46   virtual int PopulateTemplateRequest(
47       int template_type, android::CameraMetadata* metadata) const = 0;
48   // Check if the requested control values from |metadata| (for controls
49   // this partial metadata owns) are supported. Empty/null values for owned
50   // control tags indicate no change, and are thus inherently supported.
51   // If |metadata| is empty all controls are implicitly supported.
52   virtual bool SupportsRequestValues(
53       const android::CameraMetadata& metadata) const = 0;
54   // Set all the controls this partial metadata
55   // is responsible for from |metadata|. Empty/null values for owned control
56   // tags indicate no change. If |metadata| is empty no controls should
57   // be changed.
58   virtual int SetRequestValues(const android::CameraMetadata& metadata) = 0;
59 };
60 
61 }  // namespace v4l2_camera_hal
62 
63 #endif  // V4L2_CAMERA_HAL_METADATA_PARTIAL_METADATA_INTERFACE_H_
64