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 25 namespace android { 26 27 namespace camera3 { 28 29 Camera3DummyStream::Camera3DummyStream(int id) : 30 Camera3IOStreamBase(id, CAMERA3_STREAM_OUTPUT, DUMMY_WIDTH, DUMMY_HEIGHT, 31 /*maxSize*/0, DUMMY_FORMAT) { 32 33 } 34 35 Camera3DummyStream::~Camera3DummyStream() { 36 37 } 38 39 status_t Camera3DummyStream::getBufferLocked(camera3_stream_buffer *buffer) { 40 ATRACE_CALL(); 41 ALOGE("%s: Stream %d: Dummy stream cannot produce buffers!", mId); 42 return INVALID_OPERATION; 43 } 44 45 status_t Camera3DummyStream::returnBufferLocked( 46 const camera3_stream_buffer &buffer, 47 nsecs_t timestamp) { 48 ATRACE_CALL(); 49 ALOGE("%s: Stream %d: Dummy stream cannot return buffers!", mId); 50 return INVALID_OPERATION; 51 } 52 53 status_t Camera3DummyStream::returnBufferCheckedLocked( 54 const camera3_stream_buffer &buffer, 55 nsecs_t timestamp, 56 bool output, 57 /*out*/ 58 sp<Fence> *releaseFenceOut) { 59 ATRACE_CALL(); 60 ALOGE("%s: Stream %d: Dummy stream cannot return buffers!", mId); 61 return INVALID_OPERATION; 62 } 63 64 void 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 73 status_t Camera3DummyStream::setTransform(int transform) { 74 ATRACE_CALL(); 75 // Do nothing 76 return OK; 77 } 78 79 status_t Camera3DummyStream::configureQueueLocked() { 80 // Do nothing 81 return OK; 82 } 83 84 status_t Camera3DummyStream::disconnectLocked() { 85 mState = (mState == STATE_IN_RECONFIG) ? STATE_IN_CONFIG 86 : STATE_CONSTRUCTED; 87 return OK; 88 } 89 90 status_t Camera3DummyStream::getEndpointUsage(uint32_t *usage) { 91 *usage = DUMMY_USAGE; 92 return OK; 93 } 94 95 }; // namespace camera3 96 97 }; // namespace android 98