1 /* 2 * Copyright (C) 2012 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 /** 18 * This file includes various basic structures that are needed by multiple parts 19 * of the fake camera 2 implementation. 20 */ 21 22 #ifndef HW_EMULATOR_CAMERA2_BASE_H 23 #define HW_EMULATOR_CAMERA2_BASE_H 24 25 #include <hardware/camera2.h> 26 #include <utils/Vector.h> 27 28 namespace android { 29 30 /* Internal structure for passing buffers across threads */ 31 struct StreamBuffer { 32 // Positive numbers are output streams 33 // Negative numbers are input reprocess streams 34 // Zero is an auxillary buffer 35 int streamId; 36 uint32_t width, height; 37 uint32_t format; 38 uint32_t dataSpace; 39 uint32_t stride; 40 buffer_handle_t *buffer; 41 uint8_t *img; 42 }; 43 typedef Vector<StreamBuffer> Buffers; 44 45 struct Stream { 46 const camera2_stream_ops_t *ops; 47 uint32_t width, height; 48 int32_t format; 49 uint32_t stride; 50 }; 51 52 struct ReprocessStream { 53 const camera2_stream_in_ops_t *ops; 54 uint32_t width, height; 55 int32_t format; 56 uint32_t stride; 57 // -1 if the reprocessing stream is independent 58 int32_t sourceStreamId; 59 }; 60 61 } // namespace android 62 63 #endif 64