Eino-Ville Talvala | 16a2ada | 2014-08-27 14:41:33 -0700 | [diff] [blame] | 1 | /* |
Shuzhen Wang | c28189a | 2017-11-27 23:05:10 -0800 | [diff] [blame] | 2 | * Copyright (C) 2014-2018 The Android Open Source Project |
Eino-Ville Talvala | 16a2ada | 2014-08-27 14:41:33 -0700 | [diff] [blame] | 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 | |
Shuzhen Wang | c28189a | 2017-11-27 23:05:10 -0800 | [diff] [blame] | 29 | const String8 Camera3DummyStream::DUMMY_ID; |
| 30 | |
Eino-Ville Talvala | 16a2ada | 2014-08-27 14:41:33 -0700 | [diff] [blame] | 31 | Camera3DummyStream::Camera3DummyStream(int id) : |
| 32 | Camera3IOStreamBase(id, CAMERA3_STREAM_OUTPUT, DUMMY_WIDTH, DUMMY_HEIGHT, |
Shuzhen Wang | c28189a | 2017-11-27 23:05:10 -0800 | [diff] [blame] | 33 | /*maxSize*/0, DUMMY_FORMAT, DUMMY_DATASPACE, DUMMY_ROTATION, |
| 34 | DUMMY_ID) { |
Eino-Ville Talvala | 16a2ada | 2014-08-27 14:41:33 -0700 | [diff] [blame] | 35 | |
| 36 | } |
| 37 | |
| 38 | Camera3DummyStream::~Camera3DummyStream() { |
| 39 | |
| 40 | } |
| 41 | |
Shuzhen Wang | bee0f0a | 2017-01-24 14:51:37 -0800 | [diff] [blame] | 42 | status_t Camera3DummyStream::getBufferLocked(camera3_stream_buffer *, |
| 43 | const std::vector<size_t>&) { |
Eino-Ville Talvala | 16a2ada | 2014-08-27 14:41:33 -0700 | [diff] [blame] | 44 | ATRACE_CALL(); |
Zhijun He | 125684a | 2015-12-26 15:07:30 -0800 | [diff] [blame] | 45 | ALOGE("%s: Stream %d: Dummy stream cannot produce buffers!", __FUNCTION__, mId); |
Eino-Ville Talvala | 16a2ada | 2014-08-27 14:41:33 -0700 | [diff] [blame] | 46 | return INVALID_OPERATION; |
| 47 | } |
| 48 | |
| 49 | status_t Camera3DummyStream::returnBufferLocked( |
Eino-Ville Talvala | 02bf032 | 2016-02-18 12:41:10 -0800 | [diff] [blame] | 50 | const camera3_stream_buffer &, |
| 51 | nsecs_t) { |
Eino-Ville Talvala | 16a2ada | 2014-08-27 14:41:33 -0700 | [diff] [blame] | 52 | ATRACE_CALL(); |
Zhijun He | 125684a | 2015-12-26 15:07:30 -0800 | [diff] [blame] | 53 | ALOGE("%s: Stream %d: Dummy stream cannot return buffers!", __FUNCTION__, mId); |
Eino-Ville Talvala | 16a2ada | 2014-08-27 14:41:33 -0700 | [diff] [blame] | 54 | return INVALID_OPERATION; |
| 55 | } |
| 56 | |
| 57 | status_t Camera3DummyStream::returnBufferCheckedLocked( |
Eino-Ville Talvala | 02bf032 | 2016-02-18 12:41:10 -0800 | [diff] [blame] | 58 | const camera3_stream_buffer &, |
| 59 | nsecs_t, |
| 60 | bool, |
Eino-Ville Talvala | 16a2ada | 2014-08-27 14:41:33 -0700 | [diff] [blame] | 61 | /*out*/ |
Eino-Ville Talvala | 02bf032 | 2016-02-18 12:41:10 -0800 | [diff] [blame] | 62 | sp<Fence>*) { |
Eino-Ville Talvala | 16a2ada | 2014-08-27 14:41:33 -0700 | [diff] [blame] | 63 | ATRACE_CALL(); |
Zhijun He | 125684a | 2015-12-26 15:07:30 -0800 | [diff] [blame] | 64 | ALOGE("%s: Stream %d: Dummy stream cannot return buffers!", __FUNCTION__, mId); |
Eino-Ville Talvala | 16a2ada | 2014-08-27 14:41:33 -0700 | [diff] [blame] | 65 | return INVALID_OPERATION; |
| 66 | } |
| 67 | |
| 68 | void Camera3DummyStream::dump(int fd, const Vector<String16> &args) const { |
| 69 | (void) args; |
| 70 | String8 lines; |
| 71 | lines.appendFormat(" Stream[%d]: Dummy\n", mId); |
| 72 | write(fd, lines.string(), lines.size()); |
| 73 | |
| 74 | Camera3IOStreamBase::dump(fd, args); |
| 75 | } |
| 76 | |
Eino-Ville Talvala | 02bf032 | 2016-02-18 12:41:10 -0800 | [diff] [blame] | 77 | status_t Camera3DummyStream::setTransform(int) { |
Eino-Ville Talvala | 16a2ada | 2014-08-27 14:41:33 -0700 | [diff] [blame] | 78 | ATRACE_CALL(); |
| 79 | // Do nothing |
| 80 | return OK; |
| 81 | } |
| 82 | |
Eino-Ville Talvala | 77c1a35 | 2016-06-13 12:32:43 -0700 | [diff] [blame] | 83 | status_t Camera3DummyStream::detachBuffer(sp<GraphicBuffer>* buffer, int* fenceFd) { |
| 84 | (void) buffer; |
| 85 | (void) fenceFd; |
| 86 | // Do nothing |
| 87 | return OK; |
| 88 | } |
| 89 | |
Eino-Ville Talvala | 16a2ada | 2014-08-27 14:41:33 -0700 | [diff] [blame] | 90 | status_t Camera3DummyStream::configureQueueLocked() { |
| 91 | // Do nothing |
| 92 | return OK; |
| 93 | } |
| 94 | |
| 95 | status_t Camera3DummyStream::disconnectLocked() { |
| 96 | mState = (mState == STATE_IN_RECONFIG) ? STATE_IN_CONFIG |
| 97 | : STATE_CONSTRUCTED; |
| 98 | return OK; |
| 99 | } |
| 100 | |
Emilian Peev | 050f5dc | 2017-05-18 14:43:56 +0100 | [diff] [blame] | 101 | status_t Camera3DummyStream::getEndpointUsage(uint64_t *usage) const { |
Eino-Ville Talvala | 16a2ada | 2014-08-27 14:41:33 -0700 | [diff] [blame] | 102 | *usage = DUMMY_USAGE; |
| 103 | return OK; |
| 104 | } |
| 105 | |
Chien-Yu Chen | 85a6455 | 2015-08-28 15:46:12 -0700 | [diff] [blame] | 106 | bool Camera3DummyStream::isVideoStream() const { |
| 107 | return false; |
| 108 | } |
| 109 | |
Shuzhen Wang | 0129d52 | 2016-10-30 22:43:41 -0700 | [diff] [blame] | 110 | bool Camera3DummyStream::isConsumerConfigurationDeferred(size_t /*surface_id*/) const { |
Zhijun He | 5d677d1 | 2016-05-29 16:52:39 -0700 | [diff] [blame] | 111 | return false; |
| 112 | } |
| 113 | |
Chien-Yu Chen | a936ac2 | 2017-10-23 15:59:49 -0700 | [diff] [blame] | 114 | status_t Camera3DummyStream::dropBuffers(bool /*dropping*/) { |
| 115 | return OK; |
| 116 | } |
| 117 | |
Shuzhen Wang | 5c22c15 | 2017-12-31 17:12:25 -0800 | [diff] [blame] | 118 | const String8& Camera3DummyStream::getPhysicalCameraId() const { |
| 119 | return DUMMY_ID; |
| 120 | } |
| 121 | |
Shuzhen Wang | 758c215 | 2017-01-10 18:26:18 -0800 | [diff] [blame] | 122 | status_t Camera3DummyStream::setConsumers(const std::vector<sp<Surface>>& /*consumers*/) { |
| 123 | ALOGE("%s: Stream %d: Dummy stream doesn't support set consumer surface!", |
| 124 | __FUNCTION__, mId); |
Zhijun He | 5d677d1 | 2016-05-29 16:52:39 -0700 | [diff] [blame] | 125 | return INVALID_OPERATION; |
| 126 | } |
Emilian Peev | 40ead60 | 2017-09-26 15:46:36 +0100 | [diff] [blame] | 127 | |
| 128 | status_t Camera3DummyStream::updateStream(const std::vector<sp<Surface>> &/*outputSurfaces*/, |
| 129 | const std::vector<OutputStreamInfo> &/*outputInfo*/, |
| 130 | const std::vector<size_t> &/*removedSurfaceIds*/, |
| 131 | KeyedVector<sp<Surface>, size_t> * /*outputMap*/) { |
| 132 | ALOGE("%s: this method is not supported!", __FUNCTION__); |
| 133 | return INVALID_OPERATION; |
| 134 | } |
| 135 | |
Eino-Ville Talvala | 16a2ada | 2014-08-27 14:41:33 -0700 | [diff] [blame] | 136 | }; // namespace camera3 |
| 137 | |
| 138 | }; // namespace android |