blob: 0ec75011d36036bcc2c9e2a629fc747ed59fa946 [file] [log] [blame]
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -07001/*
2 * Copyright (C) 2011 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 HW_EMULATOR_CAMERA_EMULATED_CAMERA_COMMON_H
18#define HW_EMULATOR_CAMERA_EMULATED_CAMERA_COMMON_H
19
20/*
21 * Contains common declarations that are used across the camera emulation.
22 */
23
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070024#include <hardware/camera.h>
Greg Hartmanffd70fc2018-01-04 19:32:38 -080025#include <linux/videodev2.h>
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070026
27/* A helper class that tracks a routine execution.
28 * Basically, it dumps an enry message in its constructor, and an exit message
29 * in its destructor. Use LOGRE() macro (declared bellow) to create instances
30 * of this class at the beginning of the tracked routines / methods.
31 */
32class HWERoutineTracker {
Greg Hartmanffd70fc2018-01-04 19:32:38 -080033 public:
34 /* Constructor that prints an "entry" trace message. */
35 explicit HWERoutineTracker(const char* name) : mName(name) {
36 ALOGV("Entering %s", mName);
37 }
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070038
Greg Hartmanffd70fc2018-01-04 19:32:38 -080039 /* Destructor that prints a "leave" trace message. */
40 ~HWERoutineTracker() { ALOGV("Leaving %s", mName); }
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070041
Greg Hartmanffd70fc2018-01-04 19:32:38 -080042 private:
43 /* Stores the routine name. */
44 const char* mName;
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070045};
46
47/* Logs an execution of a routine / method. */
48#define LOGRE() HWERoutineTracker hwertracker_##__LINE__(__FUNCTION__)
49
50/*
51 * min / max macros
52 */
53
Greg Hartmanffd70fc2018-01-04 19:32:38 -080054#define min(a, b) (((a) < (b)) ? (a) : (b))
55#define max(a, b) (((a) > (b)) ? (a) : (b))
Tomasz Wiszkowski5f73a252017-09-22 11:29:30 -070056
Greg Hartmanffd70fc2018-01-04 19:32:38 -080057#endif /* HW_EMULATOR_CAMERA_EMULATED_CAMERA_COMMON_H */