2 * Copyright (C) 2011 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef HW_EMULATOR_CAMERA_EMULATED_CAMERA_COMMON_H
18 #define HW_EMULATOR_CAMERA_EMULATED_CAMERA_COMMON_H
21 * Contains common declarations that are used across the camera emulation.
24 #include <linux/videodev2.h>
25 #include <hardware/camera.h>
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.
32 class HWERoutineTracker {
34 /* Constructor that prints an "entry" trace message. */
35 explicit HWERoutineTracker(const char* name)
37 ALOGV("Entering %s", mName);
40 /* Destructor that prints a "leave" trace message. */
41 ~HWERoutineTracker() {
42 ALOGV("Leaving %s", mName);
46 /* Stores the routine name. */
50 /* Logs an execution of a routine / method. */
51 #define LOGRE() HWERoutineTracker hwertracker_##__LINE__(__FUNCTION__)
57 #define min(a,b) (((a) < (b)) ? (a) : (b))
58 #define max(a,b) (((a) > (b)) ? (a) : (b))
60 #endif /* HW_EMULATOR_CAMERA_EMULATED_CAMERA_COMMON_H */