Files
external_libcamera/include/libcamera/camera.h
Niklas Söderlund bd38112b77 libcamera: camera: Extend the interface to support capture
In order to support capture, the camera needs methods to allocate and
free buffers, to start and stop the capture and to queue requests.
Define those interfaces in the Camera class and implement them to call
the corresponding pipeline handler methods.

Once a camera is started the pipeline handler of the camera will begin
processing requests queued to the camera by the application until it
gets stopped.

Once a request is created it can be queued to the camera and the
application will be notified asynchronously once the request is
completed and be able to process all the buffers involved in the
request.

At this point the request objects don't support controls. This will be
extended in the future.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-02-06 07:41:51 +02:00

77 lines
1.6 KiB
C++

/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2018, Google Inc.
*
* camera.h - Camera object interface
*/
#ifndef __LIBCAMERA_CAMERA_H__
#define __LIBCAMERA_CAMERA_H__
#include <map>
#include <memory>
#include <string>
#include <libcamera/request.h>
#include <libcamera/signal.h>
namespace libcamera {
class Buffer;
class PipelineHandler;
class Request;
class Stream;
class StreamConfiguration;
class Camera final
{
public:
static std::shared_ptr<Camera> create(PipelineHandler *pipe,
const std::string &name,
const std::vector<Stream *> &streams);
Camera(const Camera &) = delete;
Camera &operator=(const Camera &) = delete;
const std::string &name() const;
Signal<Request *, const std::map<Stream *, Buffer *> &> requestCompleted;
Signal<Camera *> disconnected;
int acquire();
void release();
const std::vector<Stream *> &streams() const;
std::map<Stream *, StreamConfiguration>
streamConfiguration(std::vector<Stream *> &streams);
int configureStreams(std::map<Stream *, StreamConfiguration> &config);
int allocateBuffers();
void freeBuffers();
Request *createRequest();
int queueRequest(Request *request);
int start();
int stop();
private:
Camera(PipelineHandler *pipe, const std::string &name);
~Camera();
friend class PipelineHandler;
void disconnect();
int exclusiveAccess();
std::shared_ptr<PipelineHandler> pipe_;
std::string name_;
std::vector<Stream *> streams_;
std::vector<Stream *> activeStreams_;
bool acquired_;
bool disconnected_;
};
} /* namespace libcamera */
#endif /* __LIBCAMERA_CAMERA_H__ */