Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(148)

Side by Side Diff: media/video/capture/linux/v4l2_capture_delegate_single_plane.h

Issue 1124723006: VideoCaptureDeviceLinux: Add support for SPLANE+DMABUF V4L2 type capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_VIDEO_CAPTURE_LINUX_V4L2_CAPTURE_DELEGATE_SINGLE_PLANE_H_ 5 #ifndef MEDIA_VIDEO_CAPTURE_LINUX_V4L2_CAPTURE_DELEGATE_SINGLE_PLANE_H_
6 #define MEDIA_VIDEO_CAPTURE_LINUX_V4L2_CAPTURE_DELEGATE_SINGLE_PLANE_H_ 6 #define MEDIA_VIDEO_CAPTURE_LINUX_V4L2_CAPTURE_DELEGATE_SINGLE_PLANE_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "media/video/capture/linux/v4l2_capture_delegate.h" 9 #include "media/video/capture/linux/v4l2_capture_delegate.h"
10 #include "media/video/capture/video_capture_device.h" 10 #include "media/video/capture/video_capture_device.h"
11 11
12 namespace base { 12 namespace base {
13 class SingleThreadTaskRunner; 13 class SingleThreadTaskRunner;
14 } // namespace base 14 } // namespace base
15 15
16 namespace media { 16 namespace media {
17 17
18 // V4L2 specifics for SPLANE API. 18 // V4L2 specifics for SPLANE API.
19 class V4L2CaptureDelegateSinglePlane final : public V4L2CaptureDelegate { 19 class V4L2CaptureDelegateSinglePlane : public V4L2CaptureDelegate {
20 public: 20 public:
21 V4L2CaptureDelegateSinglePlane( 21 V4L2CaptureDelegateSinglePlane(
22 const VideoCaptureDevice::Name& device_name, 22 const VideoCaptureDevice::Name& device_name,
23 const scoped_refptr<base::SingleThreadTaskRunner>& v4l2_task_runner, 23 const scoped_refptr<base::SingleThreadTaskRunner>& v4l2_task_runner,
24 int power_line_frequency) 24 int power_line_frequency,
25 : V4L2CaptureDelegate(device_name, 25 bool try_to_use_dma_buf);
Pawel Osciak 2015/06/15 10:34:55 This is not really "try", but "use dmabuf or fail"
mcasas 2015/06/17 01:30:53 Is a "try" and if you can't, is fine. Changed to |
26 v4l2_task_runner,
27 power_line_frequency) {}
28 26
29 private: 27 protected:
30 // BufferTracker derivation to implement construction semantics for SPLANE. 28 // BufferTracker derivation to implement construction semantics for SPLANE.
31 class BufferTrackerSPlane final : public BufferTracker { 29 class BufferTrackerSPlane : public BufferTracker {
32 public: 30 public:
33 bool Init(int fd, const v4l2_buffer& buffer) override; 31 bool Init(int fd, const v4l2_buffer& buffer) override;
34 32
35 private: 33 protected:
36 ~BufferTrackerSPlane() override {} 34 ~BufferTrackerSPlane() override {}
37 }; 35 };
38 36
39 ~V4L2CaptureDelegateSinglePlane() override {} 37 ~V4L2CaptureDelegateSinglePlane() override;
40 38
41 // V4L2CaptureDelegate virtual methods implementation. 39 // V4L2CaptureDelegate virtual methods implementation.
42 scoped_refptr<BufferTracker> CreateBufferTracker() const override; 40 scoped_refptr<BufferTracker> CreateBufferTracker() const override;
43 bool FillV4L2Format(v4l2_format* format, 41 bool FillV4L2Format(v4l2_format* format,
44 uint32_t width, 42 uint32_t width,
45 uint32_t height, 43 uint32_t height,
46 uint32_t pixelformat_fourcc) const override; 44 uint32_t pixelformat_fourcc) const override;
47 void FinishFillingV4L2Buffer(v4l2_buffer* buffer) const override;
48 void SetPayloadSize(const scoped_refptr<BufferTracker>& buffer_tracker, 45 void SetPayloadSize(const scoped_refptr<BufferTracker>& buffer_tracker,
49 const v4l2_buffer& buffer) const override; 46 const v4l2_buffer& buffer) const override;
47 void FinishFillingV4L2Buffer(v4l2_buffer* buffer,
48 bool for_enqueue) const override;
49 void FinishFillingV4L2RequestBuffers(
50 v4l2_requestbuffers* request) const override;
50 void SendBuffer(const scoped_refptr<BufferTracker>& buffer_tracker, 51 void SendBuffer(const scoped_refptr<BufferTracker>& buffer_tracker,
51 const v4l2_format& format) const override; 52 const v4l2_format& format) const override;
53
54 private:
55 // Memory Type configured on ctor, mappable or not.
56 v4l2_memory memory_type_;
Pawel Osciak 2015/06/15 10:34:55 This should be a member of V4l2CaptureDelegate. We
mcasas 2015/06/17 01:30:53 Done.
57
58 mutable ScopedVector<VideoCaptureDevice::Client::Buffer> allocated_buffers_;
52 }; 59 };
53 60
54 } // namespace media 61 } // namespace media
55 62
56 #endif // MEDIA_VIDEO_CAPTURE_LINUX_V4L2_CAPTURE_DELEGATE_MULTI_PLANE_H_ 63 #endif // MEDIA_VIDEO_CAPTURE_LINUX_V4L2_CAPTURE_DELEGATE_MULTI_PLANE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698