blob: 9c951b748cd721f49e1115580575868b130822f4 [file] [log] [blame]
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -07001/*
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,
Yin-Chia Yehb97babb2015-03-12 13:42:44 -070031 /*maxSize*/0, DUMMY_FORMAT, DUMMY_DATASPACE, DUMMY_ROTATION) {
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070032
33}
34
35Camera3DummyStream::~Camera3DummyStream() {
36
37}
38
Shuzhen Wangbee0f0a2017-01-24 14:51:37 -080039status_t Camera3DummyStream::getBufferLocked(camera3_stream_buffer *,
40 const std::vector<size_t>&) {
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070041 ATRACE_CALL();
Zhijun He125684a2015-12-26 15:07:30 -080042 ALOGE("%s: Stream %d: Dummy stream cannot produce buffers!", __FUNCTION__, mId);
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070043 return INVALID_OPERATION;
44}
45
46status_t Camera3DummyStream::returnBufferLocked(
Eino-Ville Talvala02bf0322016-02-18 12:41:10 -080047 const camera3_stream_buffer &,
48 nsecs_t) {
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070049 ATRACE_CALL();
Zhijun He125684a2015-12-26 15:07:30 -080050 ALOGE("%s: Stream %d: Dummy stream cannot return buffers!", __FUNCTION__, mId);
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070051 return INVALID_OPERATION;
52}
53
54status_t Camera3DummyStream::returnBufferCheckedLocked(
Eino-Ville Talvala02bf0322016-02-18 12:41:10 -080055 const camera3_stream_buffer &,
56 nsecs_t,
57 bool,
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070058 /*out*/
Eino-Ville Talvala02bf0322016-02-18 12:41:10 -080059 sp<Fence>*) {
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070060 ATRACE_CALL();
Zhijun He125684a2015-12-26 15:07:30 -080061 ALOGE("%s: Stream %d: Dummy stream cannot return buffers!", __FUNCTION__, mId);
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070062 return INVALID_OPERATION;
63}
64
65void 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
Eino-Ville Talvala02bf0322016-02-18 12:41:10 -080074status_t Camera3DummyStream::setTransform(int) {
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070075 ATRACE_CALL();
76 // Do nothing
77 return OK;
78}
79
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -070080status_t Camera3DummyStream::detachBuffer(sp<GraphicBuffer>* buffer, int* fenceFd) {
81 (void) buffer;
82 (void) fenceFd;
83 // Do nothing
84 return OK;
85}
86
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070087status_t Camera3DummyStream::configureQueueLocked() {
88 // Do nothing
89 return OK;
90}
91
92status_t Camera3DummyStream::disconnectLocked() {
93 mState = (mState == STATE_IN_RECONFIG) ? STATE_IN_CONFIG
94 : STATE_CONSTRUCTED;
95 return OK;
96}
97
Eino-Ville Talvala4d44cad2015-04-11 13:15:45 -070098status_t Camera3DummyStream::getEndpointUsage(uint32_t *usage) const {
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070099 *usage = DUMMY_USAGE;
100 return OK;
101}
102
Chien-Yu Chen85a64552015-08-28 15:46:12 -0700103bool Camera3DummyStream::isVideoStream() const {
104 return false;
105}
106
Shuzhen Wang0129d522016-10-30 22:43:41 -0700107bool Camera3DummyStream::isConsumerConfigurationDeferred(size_t /*surface_id*/) const {
Zhijun He5d677d12016-05-29 16:52:39 -0700108 return false;
109}
110
Shuzhen Wang758c2152017-01-10 18:26:18 -0800111status_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);
Zhijun He5d677d12016-05-29 16:52:39 -0700114 return INVALID_OPERATION;
115}
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -0700116}; // namespace camera3
117
118}; // namespace android