1/* 2 * Copyright (C) 2014 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#define LOG_TAG "Camera3-DummyStream" 18#define ATRACE_TAG ATRACE_TAG_CAMERA 19//#define LOG_NDEBUG 0 20 21#include <utils/Log.h> 22#include <utils/Trace.h> 23#include "Camera3DummyStream.h" 24 25namespace android { 26 27namespace camera3 { 28 29Camera3DummyStream::Camera3DummyStream(int id) : 30 Camera3IOStreamBase(id, CAMERA3_STREAM_OUTPUT, DUMMY_WIDTH, DUMMY_HEIGHT, 31 /*maxSize*/0, DUMMY_FORMAT, DUMMY_DATASPACE, DUMMY_ROTATION) { 32 33} 34 35Camera3DummyStream::~Camera3DummyStream() { 36 37} 38 39status_t Camera3DummyStream::getBufferLocked(camera3_stream_buffer *) { 40 ATRACE_CALL(); 41 ALOGE("%s: Stream %d: Dummy stream cannot produce buffers!", __FUNCTION__, mId); 42 return INVALID_OPERATION; 43} 44 45status_t Camera3DummyStream::returnBufferLocked( 46 const camera3_stream_buffer &, 47 nsecs_t) { 48 ATRACE_CALL(); 49 ALOGE("%s: Stream %d: Dummy stream cannot return buffers!", __FUNCTION__, mId); 50 return INVALID_OPERATION; 51} 52 53status_t Camera3DummyStream::returnBufferCheckedLocked( 54 const camera3_stream_buffer &, 55 nsecs_t, 56 bool, 57 /*out*/ 58 sp<Fence>*) { 59 ATRACE_CALL(); 60 ALOGE("%s: Stream %d: Dummy stream cannot return buffers!", __FUNCTION__, mId); 61 return INVALID_OPERATION; 62} 63 64void Camera3DummyStream::dump(int fd, const Vector<String16> &args) const { 65 (void) args; 66 String8 lines; 67 lines.appendFormat(" Stream[%d]: Dummy\n", mId); 68 write(fd, lines.string(), lines.size()); 69 70 Camera3IOStreamBase::dump(fd, args); 71} 72 73status_t Camera3DummyStream::setTransform(int) { 74 ATRACE_CALL(); 75 // Do nothing 76 return OK; 77} 78 79status_t Camera3DummyStream::detachBuffer(sp<GraphicBuffer>* buffer, int* fenceFd) { 80 (void) buffer; 81 (void) fenceFd; 82 // Do nothing 83 return OK; 84} 85 86status_t Camera3DummyStream::configureQueueLocked() { 87 // Do nothing 88 return OK; 89} 90 91status_t Camera3DummyStream::disconnectLocked() { 92 mState = (mState == STATE_IN_RECONFIG) ? STATE_IN_CONFIG 93 : STATE_CONSTRUCTED; 94 return OK; 95} 96 97status_t Camera3DummyStream::getEndpointUsage(uint32_t *usage) const { 98 *usage = DUMMY_USAGE; 99 return OK; 100} 101 102bool Camera3DummyStream::isVideoStream() const { 103 return false; 104} 105 106}; // namespace camera3 107 108}; // namespace android 109