1d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk/*
2d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk * Copyright (C) 2014 The Android Open Source Project
3d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk *
4d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk * Licensed under the Apache License, Version 2.0 (the "License");
5d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk * you may not use this file except in compliance with the License.
6d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk * You may obtain a copy of the License at
7d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk *
8d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk *      http://www.apache.org/licenses/LICENSE-2.0
9d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk *
10d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk * Unless required by applicable law or agreed to in writing, software
11d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk * distributed under the License is distributed on an "AS IS" BASIS,
12d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk * See the License for the specific language governing permissions and
14d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk * limitations under the License.
15d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk */
16d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk
17d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk#ifndef VENDOR_TAG_DESCRIPTOR_H
18d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk
19d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala#include <binder/Parcelable.h>
20f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk#include <utils/Vector.h>
21d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk#include <utils/KeyedVector.h>
22d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk#include <utils/String8.h>
23d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk#include <utils/RefBase.h>
24d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk#include <system/camera_vendor_tags.h>
2571c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev#include <unordered_map>
26d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk#include <stdint.h>
27d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk
28d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunknamespace android {
29d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk
30d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvalaclass VendorTagDescriptor;
31d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala
32d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvalanamespace hardware {
33d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvalanamespace camera2 {
34d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvalanamespace params {
35d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk
36d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk/**
37d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk * VendorTagDescriptor objects are parcelable containers for the vendor tag
38d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk * definitions provided, and are typically used to pass the vendor tag
39d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk * information enumerated by the HAL to clients of the camera service.
40d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk */
41d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvalaclass VendorTagDescriptor : public Parcelable {
42d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk    public:
43d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk        virtual ~VendorTagDescriptor();
44d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk
45d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala        VendorTagDescriptor();
46d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala        VendorTagDescriptor(const VendorTagDescriptor& src);
47d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala        VendorTagDescriptor& operator=(const VendorTagDescriptor& rhs);
48d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala
49d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala        void copyFrom(const VendorTagDescriptor& src);
50d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala
51d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk        /**
52d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk         * The following 'get*' methods implement the corresponding
53d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk         * functions defined in
54d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk         * system/media/camera/include/system/camera_vendor_tags.h
55d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk         */
56d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk
57d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk        // Returns the number of vendor tags defined.
58d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk        int getTagCount() const;
59d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk
60d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk        // Returns an array containing the id's of vendor tags defined.
61d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk        void getTagArray(uint32_t* tagArray) const;
62d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk
63d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk        // Returns the section name string for a given vendor tag id.
64d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk        const char* getSectionName(uint32_t tag) const;
65d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk
66d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk        // Returns the tag name string for a given vendor tag id.
67d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk        const char* getTagName(uint32_t tag) const;
68d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk
69d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk        // Returns the tag type for a given vendor tag id.
70d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk        int getTagType(uint32_t tag) const;
71d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk
72d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk        /**
73d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk         * Write the VendorTagDescriptor object into the given parcel.
74d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk         *
75d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk         * Returns OK on success, or a negative error code.
76d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk         */
77d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala        virtual status_t writeToParcel(
78e1445da74730473a66a3ae8414e940aebfe6585dIgor Murashkin                /*out*/
79f51fca277eb5b86bd0b2e3fc90ecb2b63089de29Eino-Ville Talvala                android::Parcel* parcel) const override;
80d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk
81f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk        /**
82f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk         * Convenience method to get a vector containing all vendor tag
83f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk         * sections, or an empty vector if none are defined.
844d453830b6a8fb7571a88a9a241eabd50a483c44Eino-Ville Talvala         * The pointer is valid for the lifetime of the VendorTagDescriptor,
854d453830b6a8fb7571a88a9a241eabd50a483c44Eino-Ville Talvala         * or until readParcel or copyFrom is invoked.
86f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk         */
874d453830b6a8fb7571a88a9a241eabd50a483c44Eino-Ville Talvala        const SortedVector<String8>* getAllSectionNames() const;
88f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk
89f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk        /**
90f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk         * Lookup the tag id for a given tag name and section.
91f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk         *
92f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk         * Returns OK on success, or a negative error code.
93f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk         */
948b0b971b1416738f22488a80be726d1ec12552a8Chih-Hung Hsieh        status_t lookupTag(const String8& name, const String8& section, /*out*/uint32_t* tag) const;
95f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk
96f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk        /**
97f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk         * Dump the currently configured vendor tags to a file descriptor.
98f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk         */
99f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk        void dump(int fd, int verbosity, int indentation) const;
100f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk
101d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk        /**
102d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala         * Read values VendorTagDescriptor object from the given parcel.
103d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk         *
104d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk         * Returns OK on success, or a negative error code.
105d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk         */
106f51fca277eb5b86bd0b2e3fc90ecb2b63089de29Eino-Ville Talvala        virtual status_t readFromParcel(const android::Parcel* parcel) override;
107d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk
108d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk    protected:
109f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk        KeyedVector<String8, KeyedVector<String8, uint32_t>*> mReverseMapping;
110d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk        KeyedVector<uint32_t, String8> mTagToNameMap;
111f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk        KeyedVector<uint32_t, uint32_t> mTagToSectionMap; // Value is offset in mSections
112d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk        KeyedVector<uint32_t, int32_t> mTagToTypeMap;
113f81648ec38ff63f1f35516fa27c1c24d846e9ba5Ruben Brunk        SortedVector<String8> mSections;
114d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk        // must be int32_t to be compatible with Parcel::writeInt32
115d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk        int32_t mTagCount;
116d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala
117d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk        vendor_tag_ops mVendorOps;
118d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk};
119d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala} /* namespace params */
120d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala} /* namespace camera2 */
121d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala} /* namespace hardware */
122d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala
123d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala/**
124d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala * This version of VendorTagDescriptor must be stored in Android sp<>, and adds support for using it
125d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala * as a global tag descriptor.
126d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala *
127d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala * It's a child class of the basic hardware::camera2::params::VendorTagDescriptor since basic
128d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala * Parcelable objects cannot require being kept in an sp<> and still work with auto-generated AIDL
129d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala * interface implementations.
130d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala */
131d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvalaclass VendorTagDescriptor :
132d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala            public ::android::hardware::camera2::params::VendorTagDescriptor,
133d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala            public LightRefBase<VendorTagDescriptor> {
134d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala
135d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala  public:
136d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala
137d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala    /**
138d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala     * Create a VendorTagDescriptor object from the given vendor_tag_ops_t
139d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala     * struct.
140d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala     *
141d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala     * Returns OK on success, or a negative error code.
142d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala     */
143d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala    static status_t createDescriptorFromOps(const vendor_tag_ops_t* vOps,
144d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala            /*out*/
145d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala            sp<VendorTagDescriptor>& descriptor);
146d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala
147d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala    /**
148d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala     * Sets the global vendor tag descriptor to use for this process.
149d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala     * Camera metadata operations that access vendor tags will use the
150d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala     * vendor tag definitions set this way.
151d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala     *
152d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala     * Returns OK on success, or a negative error code.
153d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala     */
154d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala    static status_t setAsGlobalVendorTagDescriptor(const sp<VendorTagDescriptor>& desc);
155d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala
156d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala    /**
157d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala     * Returns the global vendor tag descriptor used by this process.
158d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala     * This will contain NULL if no vendor tags are defined.
159d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala     */
160d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala    static sp<VendorTagDescriptor> getGlobalVendorTagDescriptor();
161d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala
162d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala    /**
163d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala     * Clears the global vendor tag descriptor used by this process.
164d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala     */
165d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala    static void clearGlobalVendorTagDescriptor();
166d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala
167d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala};
168d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk
16971c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peevnamespace hardware {
17071c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peevnamespace camera2 {
17171c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peevnamespace params {
17271c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev
17371c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peevclass VendorTagDescriptorCache : public Parcelable {
17471c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev  public:
17571c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev
17671c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    VendorTagDescriptorCache() {};
17771c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev
17871c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    int32_t addVendorDescriptor(metadata_vendor_id_t id,
17971c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev            sp<android::VendorTagDescriptor> desc);
18071c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev
18171c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    int32_t getVendorTagDescriptor(
18271c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev            metadata_vendor_id_t id,
18371c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev            sp<android::VendorTagDescriptor> *desc /*out*/);
18471c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev
18571c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    // Parcelable interface
18671c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    status_t writeToParcel(Parcel* parcel) const override;
18771c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    status_t readFromParcel(const Parcel* parcel) override;
18871c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev
18971c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    // Returns the number of vendor tags defined.
19071c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    int getTagCount(metadata_vendor_id_t id) const;
19171c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev
19271c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    // Returns an array containing the id's of vendor tags defined.
19371c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    void getTagArray(uint32_t* tagArray, metadata_vendor_id_t id) const;
19471c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev
19571c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    // Returns the section name string for a given vendor tag id.
19671c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    const char* getSectionName(uint32_t tag, metadata_vendor_id_t id) const;
19771c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev
19871c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    // Returns the tag name string for a given vendor tag id.
19971c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    const char* getTagName(uint32_t tag, metadata_vendor_id_t id) const;
20071c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev
20171c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    // Returns the tag type for a given vendor tag id.
20271c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    int getTagType(uint32_t tag, metadata_vendor_id_t id) const;
20371c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev
20471c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    /**
20571c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev     * Dump the currently configured vendor tags to a file descriptor.
20671c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev     */
20771c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    void dump(int fd, int verbosity, int indentation) const;
20871c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev
20971c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev  protected:
21071c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    std::unordered_map<metadata_vendor_id_t, sp<android::VendorTagDescriptor>> mVendorMap;
21171c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    struct vendor_tag_cache_ops mVendorCacheOps;
21271c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev};
21371c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev
21471c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev} /* namespace params */
21571c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev} /* namespace camera2 */
21671c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev} /* namespace hardware */
21771c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev
21871c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peevclass VendorTagDescriptorCache :
21971c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev        public ::android::hardware::camera2::params::VendorTagDescriptorCache,
22071c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev        public LightRefBase<VendorTagDescriptorCache> {
22171c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev  public:
22271c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev
22371c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    /**
22471c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev     * Sets the global vendor tag descriptor cache to use for this process.
22571c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev     * Camera metadata operations that access vendor tags will use the
22671c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev     * vendor tag definitions set this way.
22771c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev     *
22871c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev     * Returns OK on success, or a negative error code.
22971c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev     */
23071c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    static status_t setAsGlobalVendorTagCache(
23171c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev            const sp<VendorTagDescriptorCache>& cache);
23271c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev
23371c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    /**
23471c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev     * Returns the global vendor tag cache used by this process.
23571c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev     * This will contain NULL if no vendor tags are defined.
23671c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev     */
23771c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    static sp<VendorTagDescriptorCache> getGlobalVendorTagCache();
238d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk
23971c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    /**
24071c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev     * Clears the global vendor tag cache used by this process.
24171c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev     */
24271c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev    static void clearGlobalVendorTagCache();
24371c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev
24471c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev};
24571c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev
24671c73a2985a7ac65ee597be3441ab300fa56e22eEmilian Peev} /* namespace android */
247d56db1d2bee182d1851097a9c712712fc094d117Eino-Ville Talvala
248d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk#define VENDOR_TAG_DESCRIPTOR_H
249d1176ef16677b6c94fb893edb6a864cdccc0b190Ruben Brunk#endif /* VENDOR_TAG_DESCRIPTOR_H */
250