diff options
author | Ruben Brunk <rubenbrunk@google.com> | 2014-02-21 10:51:38 -0800 |
---|---|---|
committer | Ruben Brunk <rubenbrunk@google.com> | 2014-03-13 12:09:22 -0700 |
commit | d1176ef16677b6c94fb893edb6a864cdccc0b190 (patch) | |
tree | 8cc18e17c4e32633d20e8c2b7fc9e397cc1791ac /include | |
parent | 3a005b3b19b750afe24577ae322aff4602ca2740 (diff) | |
download | frameworks_av-d1176ef16677b6c94fb893edb6a864cdccc0b190.zip frameworks_av-d1176ef16677b6c94fb893edb6a864cdccc0b190.tar.gz frameworks_av-d1176ef16677b6c94fb893edb6a864cdccc0b190.tar.bz2 |
camera3: Pass vendor tags through binder.
Bug: 12134423
- Adds a class for parceling vendor tag definitions.
- Passes vendor tag definitions to clients of the camera service.
- Switches over to new vendor tag mechanism when reading from HAL.
Change-Id: Icef3fe9e67160767bdb8244ac49c85b68b497123
Diffstat (limited to 'include')
-rw-r--r-- | include/camera/ICameraService.h | 4 | ||||
-rw-r--r-- | include/camera/VendorTagDescriptor.h | 122 |
2 files changed, 126 insertions, 0 deletions
diff --git a/include/camera/ICameraService.h b/include/camera/ICameraService.h index f342122..6ccbf67 100644 --- a/include/camera/ICameraService.h +++ b/include/camera/ICameraService.h @@ -31,6 +31,7 @@ class ICameraServiceListener; class ICameraDeviceUser; class ICameraDeviceCallbacks; class CameraMetadata; +class VendorTagDescriptor; class ICameraService : public IInterface { @@ -47,6 +48,7 @@ public: ADD_LISTENER, REMOVE_LISTENER, GET_CAMERA_CHARACTERISTICS, + GET_CAMERA_VENDOR_TAG_DESCRIPTOR, }; enum { @@ -63,6 +65,8 @@ public: virtual status_t getCameraCharacteristics(int cameraId, CameraMetadata* cameraInfo) = 0; + virtual status_t getCameraVendorTagDescriptor(sp<VendorTagDescriptor>& desc) = 0; + // Returns 'OK' if operation succeeded // - Errors: ALREADY_EXISTS if the listener was already added virtual status_t addListener(const sp<ICameraServiceListener>& listener) diff --git a/include/camera/VendorTagDescriptor.h b/include/camera/VendorTagDescriptor.h new file mode 100644 index 0000000..0fefe1a --- /dev/null +++ b/include/camera/VendorTagDescriptor.h @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef VENDOR_TAG_DESCRIPTOR_H + +#include <utils/KeyedVector.h> +#include <utils/String8.h> +#include <utils/RefBase.h> +#include <system/camera_vendor_tags.h> + +#include <stdint.h> + +namespace android { + +class Parcel; + +/** + * VendorTagDescriptor objects are parcelable containers for the vendor tag + * definitions provided, and are typically used to pass the vendor tag + * information enumerated by the HAL to clients of the camera service. + */ +class VendorTagDescriptor + : public LightRefBase<VendorTagDescriptor> { + public: + virtual ~VendorTagDescriptor(); + + /** + * The following 'get*' methods implement the corresponding + * functions defined in + * system/media/camera/include/system/camera_vendor_tags.h + */ + + // Returns the number of vendor tags defined. + int getTagCount() const; + + // Returns an array containing the id's of vendor tags defined. + void getTagArray(uint32_t* tagArray) const; + + // Returns the section name string for a given vendor tag id. + const char* getSectionName(uint32_t tag) const; + + // Returns the tag name string for a given vendor tag id. + const char* getTagName(uint32_t tag) const; + + // Returns the tag type for a given vendor tag id. + int getTagType(uint32_t tag) const; + + /** + * Write the VendorTagDescriptor object into the given parcel. + * + * Returns OK on success, or a negative error code. + */ + status_t writeToParcel(/*out*/Parcel* parcel) const; + + // Static methods: + + /** + * Create a VendorTagDescriptor object from the given parcel. + * + * Returns OK on success, or a negative error code. + */ + static status_t createFromParcel(const Parcel* parcel, + /*out*/ + sp<VendorTagDescriptor>& descriptor); + + /** + * Create a VendorTagDescriptor object from the given vendor_tag_ops_t + * struct. + * + * Returns OK on success, or a negative error code. + */ + static status_t createDescriptorFromOps(const vendor_tag_ops_t* vOps, + /*out*/ + sp<VendorTagDescriptor>& descriptor); + + /** + * Sets the global vendor tag descriptor to use for this process. + * Camera metadata operations that access vendor tags will use the + * vendor tag definitions set this way. + * + * Returns OK on success, or a negative error code. + */ + static status_t setAsGlobalVendorTagDescriptor(sp<VendorTagDescriptor>& desc); + + /** + * Clears the global vendor tag descriptor used by this process. + */ + static void clearGlobalVendorTagDescriptor(); + + /** + * Returns the global vendor tag descriptor used by this process. + * This will contain NULL if no vendor tags are defined. + */ + static sp<VendorTagDescriptor> getGlobalVendorTagDescriptor(); + protected: + VendorTagDescriptor(); + KeyedVector<uint32_t, String8> mTagToNameMap; + KeyedVector<uint32_t, String8> mTagToSectionMap; + KeyedVector<uint32_t, int32_t> mTagToTypeMap; + // must be int32_t to be compatible with Parcel::writeInt32 + int32_t mTagCount; + private: + vendor_tag_ops mVendorOps; +}; + +} /* namespace android */ + +#define VENDOR_TAG_DESCRIPTOR_H +#endif /* VENDOR_TAG_DESCRIPTOR_H */ |