blob: e0af0090040911c41169ac29a5ce554c6efa6f35 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* buffer.h - Buffer handling
*/
#ifndef __LIBCAMERA_BUFFER_H__
#define __LIBCAMERA_BUFFER_H__
#include <stdint.h>
#include <vector>
#include <libcamera/class.h>
#include <libcamera/file_descriptor.h>
namespace libcamera {
class Request;
struct FrameMetadata {
enum Status {
FrameSuccess,
FrameError,
FrameCancelled,
};
struct Plane {
unsigned int bytesused;
};
Status status;
unsigned int sequence;
uint64_t timestamp;
std::vector<Plane> planes;
};
class FrameBuffer final
{
public:
struct Plane {
FileDescriptor fd;
unsigned int length;
};
FrameBuffer(const std::vector<Plane> &planes, unsigned int cookie = 0);
const std::vector<Plane> &planes() const { return planes_; }
Request *request() const { return request_; }
void setRequest(Request *request) { request_ = request; }
const FrameMetadata &metadata() const { return metadata_; }
unsigned int cookie() const { return cookie_; }
void setCookie(unsigned int cookie) { cookie_ = cookie; }
void cancel() { metadata_.status = FrameMetadata::FrameCancelled; }
private:
LIBCAMERA_DISABLE_COPY_AND_MOVE(FrameBuffer)
friend class V4L2VideoDevice; /* Needed to update metadata_. */
std::vector<Plane> planes_;
Request *request_;
FrameMetadata metadata_;
unsigned int cookie_;
};
} /* namespace libcamera */
#endif /* __LIBCAMERA_BUFFER_H__ */
|