blob: 1a730d6200db453a008b8bcd00330094f612eb1d [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
Eino-Ville Talvala02bf0322016-02-18 12:41:10 -080039status_t Camera3DummyStream::getBufferLocked(camera3_stream_buffer *) {
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070040 ATRACE_CALL();
Zhijun He125684a2015-12-26 15:07:30 -080041 ALOGE("%s: Stream %d: Dummy stream cannot produce buffers!", __FUNCTION__, mId);
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070042 return INVALID_OPERATION;
43}
44
45status_t Camera3DummyStream::returnBufferLocked(
Eino-Ville Talvala02bf0322016-02-18 12:41:10 -080046 const camera3_stream_buffer &,
47 nsecs_t) {
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070048 ATRACE_CALL();
Zhijun He125684a2015-12-26 15:07:30 -080049 ALOGE("%s: Stream %d: Dummy stream cannot return buffers!", __FUNCTION__, mId);
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070050 return INVALID_OPERATION;
51}
52
53status_t Camera3DummyStream::returnBufferCheckedLocked(
Eino-Ville Talvala02bf0322016-02-18 12:41:10 -080054 const camera3_stream_buffer &,
55 nsecs_t,
56 bool,
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070057 /*out*/
Eino-Ville Talvala02bf0322016-02-18 12:41:10 -080058 sp<Fence>*) {
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070059 ATRACE_CALL();
Zhijun He125684a2015-12-26 15:07:30 -080060 ALOGE("%s: Stream %d: Dummy stream cannot return buffers!", __FUNCTION__, mId);
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070061 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
Eino-Ville Talvala02bf0322016-02-18 12:41:10 -080073status_t Camera3DummyStream::setTransform(int) {
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070074 ATRACE_CALL();
75 // Do nothing
76 return OK;
77}
78
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -070079status_t Camera3DummyStream::detachBuffer(sp<GraphicBuffer>* buffer, int* fenceFd) {
80 (void) buffer;
81 (void) fenceFd;
82 // Do nothing
83 return OK;
84}
85
Shuzhen Wang0129d522016-10-30 22:43:41 -070086status_t Camera3DummyStream::notifyRequestedSurfaces(uint32_t frame_number,
87 const std::vector<size_t>& surface_ids) {
88 (void) frame_number;
89 (void) surface_ids;
90 // Do nothing
91 return OK;
92}
93
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070094status_t Camera3DummyStream::configureQueueLocked() {
95 // Do nothing
96 return OK;
97}
98
99status_t Camera3DummyStream::disconnectLocked() {
100 mState = (mState == STATE_IN_RECONFIG) ? STATE_IN_CONFIG
101 : STATE_CONSTRUCTED;
102 return OK;
103}
104
Eino-Ville Talvala4d44cad2015-04-11 13:15:45 -0700105status_t Camera3DummyStream::getEndpointUsage(uint32_t *usage) const {
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -0700106 *usage = DUMMY_USAGE;
107 return OK;
108}
109
Chien-Yu Chen85a64552015-08-28 15:46:12 -0700110bool Camera3DummyStream::isVideoStream() const {
111 return false;
112}
113
Shuzhen Wang0129d522016-10-30 22:43:41 -0700114bool Camera3DummyStream::isConsumerConfigurationDeferred(size_t /*surface_id*/) const {
Zhijun He5d677d12016-05-29 16:52:39 -0700115 return false;
116}
117
Shuzhen Wang758c2152017-01-10 18:26:18 -0800118status_t Camera3DummyStream::setConsumers(const std::vector<sp<Surface>>& /*consumers*/) {
119 ALOGE("%s: Stream %d: Dummy stream doesn't support set consumer surface!",
120 __FUNCTION__, mId);
Zhijun He5d677d12016-05-29 16:52:39 -0700121 return INVALID_OPERATION;
122}
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -0700123}; // namespace camera3
124
125}; // namespace android