Updating XTBs based on .GRDs from branch master
[chromium-blink-merge.git] / media / capture / video / linux / v4l2_capture_delegate_multi_plane.h
blobee6cad31476b82f7b730e053fe38cfece4e10773
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef MEDIA_VIDEO_CAPTURE_LINUX_V4L2_CAPTURE_DELEGATE_MULTI_PLANE_H_
6 #define MEDIA_VIDEO_CAPTURE_LINUX_V4L2_CAPTURE_DELEGATE_MULTI_PLANE_H_
8 #include "base/memory/ref_counted.h"
9 #include "media/capture/video/linux/v4l2_capture_delegate.h"
11 #if defined(OS_OPENBSD)
12 #error "OpenBSD does not support MPlane capture API."
13 #endif
15 namespace base {
16 class SingleThreadTaskRunner;
17 } // namespace base
19 namespace media {
21 // V4L2 specifics for MPLANE API.
22 class V4L2CaptureDelegateMultiPlane final : public V4L2CaptureDelegate {
23 public:
24 V4L2CaptureDelegateMultiPlane(
25 const VideoCaptureDevice::Name& device_name,
26 const scoped_refptr<base::SingleThreadTaskRunner>& v4l2_task_runner,
27 int power_line_frequency);
29 private:
30 // BufferTracker derivation to implement construction semantics for MPLANE.
31 class BufferTrackerMPlane final : public BufferTracker {
32 public:
33 bool Init(int fd, const v4l2_buffer& buffer) override;
35 private:
36 ~BufferTrackerMPlane() override {}
39 ~V4L2CaptureDelegateMultiPlane() override;
41 // V4L2CaptureDelegate virtual methods implementation.
42 scoped_refptr<BufferTracker> CreateBufferTracker() const override;
43 bool FillV4L2Format(v4l2_format* format,
44 uint32_t width,
45 uint32_t height,
46 uint32_t pixelformat_fourcc) const override;
47 void FinishFillingV4L2Buffer(v4l2_buffer* buffer) const override;
48 void SetPayloadSize(const scoped_refptr<BufferTracker>& buffer_tracker,
49 const v4l2_buffer& buffer) const override;
50 void SendBuffer(const scoped_refptr<BufferTracker>& buffer_tracker,
51 const v4l2_format& format) const override;
53 // Vector to allocate and track as many v4l2_plane structs as planes, needed
54 // for v4l2_buffer.m.planes. This is a scratchpad marked mutable to enable
55 // using it in otherwise const methods.
56 mutable std::vector<struct v4l2_plane> v4l2_planes_;
59 } // namespace media
61 #endif // MEDIA_VIDEO_CAPTURE_LINUX_V4L2_CAPTURE_DELEGATE_SINGLE_PLANE_H_