blob: c4b5dd9cc81d0684505096ea6fea1bda6137328d [file] [log] [blame]
Eino-Ville Talvala8be20f52013-03-06 16:20:06 -08001/*
2 * Copyright (C) 2013 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#ifndef ANDROID_SERVERS_CAMERA3_INPUT_STREAM_H
18#define ANDROID_SERVERS_CAMERA3_INPUT_STREAM_H
19
20#include <utils/RefBase.h>
21#include <gui/Surface.h>
22#include <gui/BufferItemConsumer.h>
23
24#include "Camera3Stream.h"
25
26namespace android {
27
28namespace camera3 {
29
30/**
31 * A class for managing a single stream of input data to the camera device.
32 */
33class Camera3InputStream : public Camera3Stream {
34 public:
35 /**
36 * Set up a stream for formats that have fixed size, such as RAW and YUV.
37 */
38 Camera3InputStream(int id, uint32_t width, uint32_t height, int format);
39
40 virtual status_t waitUntilIdle(nsecs_t timeout);
41 virtual void dump(int fd, const Vector<String16> &args) const;
42
43 /**
44 * Get the producer interface for this stream, to hand off to a producer.
45 * The producer must be connected to the provided interface before
46 * finishConfigure is called on this stream.
47 */
48 sp<IGraphicBufferProducer> getProducerInterface() const;
49
50 private:
51
52 sp<BufferItemConsumer> mConsumer;
53
54 /**
55 * Camera3Stream interface
56 */
57
58 virtual status_t getBufferLocked(camera3_stream_buffer *buffer);
59 virtual status_t returnBufferLocked(const camera3_stream_buffer &buffer,
60 nsecs_t timestamp);
61 virtual bool hasOutstandingBuffersLocked() const;
62 virtual status_t disconnectLocked();
63
64}; // class Camera3InputStream
65
66}; // namespace camera3
67
68}; // namespace android
69
70#endif