summaryrefslogtreecommitdiff
path: root/src/qcam/assets/feathericons/voicemail.svg
blob: 5d78a8e794f504dd52853e12e858d3df011b9195 (plain)
1
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-voicemail"><circle cx="5.5" cy="11.5" r="4.5"></circle><circle cx="18.5" cy="11.5" r="4.5"></circle><line x1="5.5" y1="16" x2="18.5" y2="16"></line></svg>
58 59 60 61 62 63 64 65 66
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Copyright (C) 2020-2021, Google Inc.
 *
 * simple_capture.h - Simple capture helper
 */

#pragma once

#include <memory>

#include <libcamera/libcamera.h>

#include "../common/event_loop.h"

class SimpleCapture
{
public:
	void configure(libcamera::StreamRole role);

protected:
	SimpleCapture(std::shared_ptr<libcamera::Camera> camera);
	virtual ~SimpleCapture();

	void start();
	void stop();

	virtual void requestComplete(libcamera::Request *request) = 0;

	EventLoop *loop_;

	std::shared_ptr<libcamera::Camera> camera_;
	std::unique_ptr<libcamera::FrameBufferAllocator> allocator_;
	std::unique_ptr<libcamera::CameraConfiguration> config_;
	std::vector<std::unique_ptr<libcamera::Request>> requests_;
};

class SimpleCaptureBalanced : public SimpleCapture
{
public:
	SimpleCaptureBalanced(std::shared_ptr<libcamera::Camera> camera);

	void capture(unsigned int numRequests);

private:
	int queueRequest(libcamera::Request *request);
	void requestComplete(libcamera::Request *request) override;

	unsigned int queueCount_;
	unsigned int captureCount_;
	unsigned int captureLimit_;
};

class SimpleCaptureUnbalanced : public SimpleCapture
{
public:
	SimpleCaptureUnbalanced(std::shared_ptr<libcamera::Camera> camera);

	void capture(unsigned int numRequests);

private:
	void requestComplete(libcamera::Request *request) override;

	unsigned int captureCount_;
	unsigned int captureLimit_;
};