blob: 8f4aead029387753bef9eb463a0995bb55fa6e97 [file] [log] [blame]
/*
* Copyright (C) 2014-2017 Intel Corporation
* Copyright (c) 2017, Fuzhou Rockchip Electronics Co., Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _CAMERA3_HAL_CAMERASTREAMNODE_H_
#define _CAMERA3_HAL_CAMERASTREAMNODE_H_
#include <vector>
#include "hardware/camera3.h"
#include "CameraBuffer.h"
#include "FrameInfo.h"
NAMESPACE_DECLARATION {
/* Forward declaration */
class Camera3Request;
class CameraStreamNode {
public:
CameraStreamNode() : mConsumer(nullptr),
mProducer(nullptr) {};
virtual ~CameraStreamNode(){};
static void bind(CameraStreamNode *consumer, CameraStreamNode *producer) {
consumer->mProducer = producer;
producer->mConsumer = consumer;
if(consumer->configure() == NO_ERROR)
producer->configure();
};
static void unbind(CameraStreamNode *consumer, CameraStreamNode *producer) {
if (consumer)
consumer->mProducer = nullptr;
if (producer)
producer->mConsumer = nullptr;
};
virtual int usage(void) const { return 0; }
virtual status_t query(FrameInfo * info) = 0;
virtual status_t capture(std::shared_ptr<CameraBuffer> aBuffer,
Camera3Request* request) = 0;
virtual status_t captureDone(std::shared_ptr<CameraBuffer> buffer,
Camera3Request* request) = 0;
virtual status_t reprocess(std::shared_ptr<CameraBuffer> buffer,
Camera3Request* request) = 0;
virtual void dump(int fd) const = 0;
protected:
// the data will be used by the consumer, if it's nullptr, it means that there
// is no other back stream will use it.
CameraStreamNode *mConsumer;
// the data will be generated by the producer, if it's nullptr, it means that
//this node is just used to generate the data
CameraStreamNode *mProducer;
private:
virtual status_t configure(void) = 0;
};
} NAMESPACE_DECLARATION_END
#endif /* _CAMERA3_HAL_CAMERASTREAMNODE_H_ */