1 /*
2  * Copyright (C) 2013 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 VENDOR_TAGS_H_
18 #define VENDOR_TAGS_H_
19 
20 #include <hardware/camera_common.h>
21 #include <system/camera_metadata.h>
22 
23 namespace default_camera_hal {
24 
25 // VendorTags contains all vendor-specific metadata tag functionality
26 class VendorTags {
27     public:
28         VendorTags();
29         ~VendorTags();
30 
31         // Vendor Tags Operations (see <hardware/camera_common.h>)
32         int getTagCount(const vendor_tag_ops_t* ops);
33         void getAllTags(const vendor_tag_ops_t* ops, uint32_t* tag_array);
34         const char* getSectionName(const vendor_tag_ops_t* ops, uint32_t tag);
35         const char* getTagName(const vendor_tag_ops_t* ops, uint32_t tag);
36         int getTagType(const vendor_tag_ops_t* ops, uint32_t tag);
37 
38     private:
39         // Total number of vendor tags
40         int mTagCount;
41 };
42 
43 // Tag sections start at the beginning of vendor tags (0x8000_0000)
44 // See <system/camera_metadata.h>
45 enum {
46     DEMO_WIZARDRY,
47     DEMO_SORCERY,
48     DEMO_MAGIC,
49     DEMO_SECTION_COUNT
50 };
51 
52 const uint32_t vendor_section_start = VENDOR_SECTION_START;
53 
54 // Each section starts at increments of 0x1_0000
55 const uint32_t demo_wizardry_start = (DEMO_WIZARDRY + VENDOR_SECTION) << 16;
56 const uint32_t demo_sorcery_start  = (DEMO_SORCERY  + VENDOR_SECTION) << 16;
57 const uint32_t demo_magic_start    = (DEMO_MAGIC    + VENDOR_SECTION) << 16;
58 
59 // Vendor Tag values, start value begins each section
60 const uint32_t demo_wizardry_dimension_size = demo_wizardry_start;
61 const uint32_t demo_wizardry_dimensions = demo_wizardry_start + 1;
62 const uint32_t demo_wizardry_familiar = demo_wizardry_start + 2;
63 const uint32_t demo_wizardry_fire = demo_wizardry_start + 3;
64 const uint32_t demo_wizardry_end = demo_wizardry_start + 4;
65 
66 const uint32_t demo_sorcery_difficulty = demo_sorcery_start;
67 const uint32_t demo_sorcery_light = demo_sorcery_start + 1;
68 const uint32_t demo_sorcery_end = demo_sorcery_start + 2;
69 
70 const uint32_t demo_magic_card_trick = demo_magic_start;
71 const uint32_t demo_magic_levitation = demo_magic_start + 1;
72 const uint32_t demo_magic_end = demo_magic_start + 2;
73 
74 } // namespace default_camera_hal
75 
76 #endif // VENDOR_TAGS_H_
77