blob: fe04eb1c39434f562390511986e4c6ee2af4b58d [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
39status_t Camera3DummyStream::getBufferLocked(camera3_stream_buffer *buffer) {
40 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(
46 const camera3_stream_buffer &buffer,
47 nsecs_t timestamp) {
48 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(
54 const camera3_stream_buffer &buffer,
55 nsecs_t timestamp,
56 bool output,
57 /*out*/
58 sp<Fence> *releaseFenceOut) {
59 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
73status_t Camera3DummyStream::setTransform(int transform) {
74 ATRACE_CALL();
75 // Do nothing
76 return OK;
77}
78
79status_t Camera3DummyStream::configureQueueLocked() {
80 // Do nothing
81 return OK;
82}
83
84status_t Camera3DummyStream::disconnectLocked() {
85 mState = (mState == STATE_IN_RECONFIG) ? STATE_IN_CONFIG
86 : STATE_CONSTRUCTED;
87 return OK;
88}
89
Eino-Ville Talvala4d44cad2015-04-11 13:15:45 -070090status_t Camera3DummyStream::getEndpointUsage(uint32_t *usage) const {
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070091 *usage = DUMMY_USAGE;
92 return OK;
93}
94
Chien-Yu Chen85a64552015-08-28 15:46:12 -070095bool Camera3DummyStream::isVideoStream() const {
96 return false;
97}
98
Eino-Ville Talvala16a2ada2014-08-27 14:41:33 -070099}; // namespace camera3
100
101}; // namespace android