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, DUMMY_DATASPACE, DUMMY_ROTATION) { 32 33 } 34 35 Camera3DummyStream::~Camera3DummyStream() { 36 37 } 38 39 status_t Camera3DummyStream::getBufferLocked(camera3_stream_buffer *, 40 const std::vector<size_t>&) { 41 ATRACE_CALL(); 42 ALOGE("%s: Stream %d: Dummy stream cannot produce buffers!", __FUNCTION__, mId); 43 return INVALID_OPERATION; 44 } 45 46 status_t Camera3DummyStream::returnBufferLocked( 47 const camera3_stream_buffer &, 48 nsecs_t) { 49 ATRACE_CALL(); 50 ALOGE("%s: Stream %d: Dummy stream cannot return buffers!", __FUNCTION__, mId); 51 return INVALID_OPERATION; 52 } 53 54 status_t Camera3DummyStream::returnBufferCheckedLocked( 55 const camera3_stream_buffer &, 56 nsecs_t, 57 bool, 58 /*out*/ 59 sp<Fence>*) { 60 ATRACE_CALL(); 61 ALOGE("%s: Stream %d: Dummy stream cannot return buffers!", __FUNCTION__, mId); 62 return INVALID_OPERATION; 63 } 64 65 void Camera3DummyStream::dump(int fd, const Vector<String16> &args) const { 66 (void) args; 67 String8 lines; 68 lines.appendFormat(" Stream[%d]: Dummy\n", mId); 69 write(fd, lines.string(), lines.size()); 70 71 Camera3IOStreamBase::dump(fd, args); 72 } 73 74 status_t Camera3DummyStream::setTransform(int) { 75 ATRACE_CALL(); 76 // Do nothing 77 return OK; 78 } 79 80 status_t Camera3DummyStream::detachBuffer(sp<GraphicBuffer>* buffer, int* fenceFd) { 81 (void) buffer; 82 (void) fenceFd; 83 // Do nothing 84 return OK; 85 } 86 87 status_t Camera3DummyStream::configureQueueLocked() { 88 // Do nothing 89 return OK; 90 } 91 92 status_t Camera3DummyStream::disconnectLocked() { 93 mState = (mState == STATE_IN_RECONFIG) ? STATE_IN_CONFIG 94 : STATE_CONSTRUCTED; 95 return OK; 96 } 97 98 status_t Camera3DummyStream::getEndpointUsage(uint32_t *usage) const { 99 *usage = DUMMY_USAGE; 100 return OK; 101 } 102 103 bool Camera3DummyStream::isVideoStream() const { 104 return false; 105 } 106 107 bool Camera3DummyStream::isConsumerConfigurationDeferred(size_t /*surface_id*/) const { 108 return false; 109 } 110 111 status_t Camera3DummyStream::setConsumers(const std::vector<sp<Surface>>& /*consumers*/) { 112 ALOGE("%s: Stream %d: Dummy stream doesn't support set consumer surface!", 113 __FUNCTION__, mId); 114 return INVALID_OPERATION; 115 } 116 }; // namespace camera3 117 118 }; // namespace android 119