| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef MEDIA_VIDEO_CAPTURE_LINUX_V4L2_CAPTURE_DELEGATE_MULTI_PLANE_H_ | |
| 6 #define MEDIA_VIDEO_CAPTURE_LINUX_V4L2_CAPTURE_DELEGATE_MULTI_PLANE_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "build/build_config.h" | |
| 12 #include "media/capture/video/linux/v4l2_capture_delegate.h" | |
| 13 | |
| 14 #if defined(OS_OPENBSD) | |
| 15 #error "OpenBSD does not support MPlane capture API." | |
| 16 #endif | |
| 17 | |
| 18 namespace base { | |
| 19 class SingleThreadTaskRunner; | |
| 20 } // namespace base | |
| 21 | |
| 22 namespace media { | |
| 23 | |
| 24 // V4L2 specifics for MPLANE API. | |
| 25 class V4L2CaptureDelegateMultiPlane final : public V4L2CaptureDelegate { | |
| 26 public: | |
| 27 V4L2CaptureDelegateMultiPlane( | |
| 28 const VideoCaptureDevice::Name& device_name, | |
| 29 const scoped_refptr<base::SingleThreadTaskRunner>& v4l2_task_runner, | |
| 30 int power_line_frequency); | |
| 31 | |
| 32 private: | |
| 33 // BufferTracker derivation to implement construction semantics for MPLANE. | |
| 34 class BufferTrackerMPlane final : public BufferTracker { | |
| 35 public: | |
| 36 bool Init(int fd, const v4l2_buffer& buffer) override; | |
| 37 | |
| 38 private: | |
| 39 ~BufferTrackerMPlane() override {} | |
| 40 }; | |
| 41 | |
| 42 ~V4L2CaptureDelegateMultiPlane() override; | |
| 43 | |
| 44 // V4L2CaptureDelegate virtual methods implementation. | |
| 45 scoped_refptr<BufferTracker> CreateBufferTracker() const override; | |
| 46 bool FillV4L2Format(v4l2_format* format, | |
| 47 uint32_t width, | |
| 48 uint32_t height, | |
| 49 uint32_t pixelformat_fourcc) const override; | |
| 50 void FinishFillingV4L2Buffer(v4l2_buffer* buffer) const override; | |
| 51 void SetPayloadSize(const scoped_refptr<BufferTracker>& buffer_tracker, | |
| 52 const v4l2_buffer& buffer) const override; | |
| 53 void SendBuffer(const scoped_refptr<BufferTracker>& buffer_tracker, | |
| 54 const v4l2_format& format) const override; | |
| 55 | |
| 56 // Vector to allocate and track as many v4l2_plane structs as planes, needed | |
| 57 // for v4l2_buffer.m.planes. This is a scratchpad marked mutable to enable | |
| 58 // using it in otherwise const methods. | |
| 59 mutable std::vector<struct v4l2_plane> v4l2_planes_; | |
| 60 }; | |
| 61 | |
| 62 } // namespace media | |
| 63 | |
| 64 #endif // MEDIA_VIDEO_CAPTURE_LINUX_V4L2_CAPTURE_DELEGATE_SINGLE_PLANE_H_ | |
| OLD | NEW |