blob: a55e9e05977a2dd3fcbcbd837a7b53a8fdb6b3de [file] [log] [blame]
Ari Hausman-Cohenf45f8d42016-09-07 15:35:53 -07001/*
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#include "static_properties.h"
18
19// #define LOG_NDEBUG 0
20#define LOG_TAG "StaticProperties"
21#include <cutils/log.h>
22#include <system/camera.h>
23
24#include "metadata/metadata_reader.h"
25
26namespace default_camera_hal {
27
28StaticProperties* StaticProperties::NewStaticProperties(
29 std::unique_ptr<const MetadataReader> metadata_reader) {
30 int facing = 0;
31 int orientation = 0;
32 // If reading any data returns an error, something is wrong.
33 if (metadata_reader->Facing(&facing) ||
34 metadata_reader->Orientation(&orientation)) {
35 return nullptr;
36 }
37
38 return new StaticProperties(std::move(metadata_reader), facing, orientation);
39}
40
41StaticProperties::StaticProperties(
42 std::unique_ptr<const MetadataReader> metadata_reader,
43 int facing,
44 int orientation)
45 : metadata_reader_(std::move(metadata_reader)),
46 facing_(facing),
47 orientation_(orientation) {}
48
49} // namespace default_camera_hal