summaryrefslogtreecommitdiff
path: root/utils/hooks/pre-commit
blob: 7a4cb6257dec614e0acdf01e9f97267a921c0473 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

# SPDX-License-Identifier: GPL-2.0-or-later

# Execute the checkstyle script before committing any code. This will fail the
# commit in case of style issues, ensuring that the developer will notice them.
# The pre-commit hook can be bypassed with git commit -n to ignore selective
# changes.
#
# To utilise this hook, install this file with:
#   cp utils/hooks/pre-commit .git/hooks/pre-commit

if ps -ocommand= -p $PPID | grep -- "--amend"
then
	args="--amend"
else
	args="--staged"
fi

./utils/checkstyle.py $args
31 32 33 34 35 36 37 38 39 40 41 42 43 44
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * Copyright (C) 2019, Google Inc.
 *
 * capture.h - Cam capture
 */
#ifndef __CAM_CAPTURE_H__
#define __CAM_CAPTURE_H__

#include <chrono>
#include <memory>

#include <libcamera/buffer.h>
#include <libcamera/camera.h>
#include <libcamera/framebuffer_allocator.h>
#include <libcamera/request.h>
#include <libcamera/stream.h>

#include "buffer_writer.h"
#include "event_loop.h"
#include "options.h"

class Capture
{
public:
	Capture(std::shared_ptr<libcamera::Camera> camera,
		libcamera::CameraConfiguration *config);

	int run(EventLoop *loop, const OptionsParser::Options &options);
private:
	int capture(EventLoop *loop,
		    libcamera::FrameBufferAllocator *allocator);

	void requestComplete(libcamera::Request *request);

	std::shared_ptr<libcamera::Camera> camera_;
	libcamera::CameraConfiguration *config_;

	std::map<libcamera::Stream *, std::string> streamName_;
	BufferWriter *writer_;
	std::chrono::steady_clock::time_point last_;
};

#endif /* __CAM_CAPTURE_H__ */