diff options
author | mcasas <mcasas@chromium.org> | 2015-03-20 12:15:13 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-20 19:16:32 +0000 |
commit | d3d37d0f3493dd28cd687fe9285b0aac81a61dae (patch) | |
tree | 2eb8b1a6a73110e90d82d09f57cccda35e056a19 /media/media.gyp | |
parent | d5c5bf15d23b854079b1494e0a44210e30cce79f (diff) | |
download | chromium_src-d3d37d0f3493dd28cd687fe9285b0aac81a61dae.zip chromium_src-d3d37d0f3493dd28cd687fe9285b0aac81a61dae.tar.gz chromium_src-d3d37d0f3493dd28cd687fe9285b0aac81a61dae.tar.bz2 |
Linux Video Capture: Add V4L2VideoCaptureDelegate{Single,Multi}Plane.
This CL adds support for V4L2 MPLANE Capture Api.
Only supported format is YUV420M triplanar.
A new method is added to VideoCaptureDeviceClient,
namely OnIncomingCapturedYuvData(...), which forces
adding MOCKing here and there, and its own
implementation.
V4L2 MMAP API works via user mmap()ing a number of
buffer allocated by V4L2 capture device. If those
buffers are not correctly munmap()ed, bad things (c)
happen. In light of this, the manual buffer lifetime
management is changed to automatic one. Construction
(mmap()ing) of those called BufferTracker is
planarity specific (i.e. there's one such ctor in
each of BufferTracker{S,M}Plane), while the dtor
is generic and the same.
ToT class diagram:
+------------------------------------+
| VideoCaptureDeviceLinux |
| +----------------------+|
| <<ref>> -->| V4L2CaptureDelegate ||
| cnt | (struct Buffer) ||
| +----------------------+|
+------------------------------------+
This CL class scheme:
+--------------------------+
| VideoCaptureDeviceLinux |
| |
| <<ref_cnt>> ---+ |
+----------------|---------+
+----------------v-----------+ v4l2_capture_delegate.{cc,h}
| +-----------------------+ |
| |V4L2CaptureDelegate | |
| | (class BufferTracker)| |
| +-----------------------+ |
+-------^------------------^-+
| |
+----|-------+ +--------|--+ v4l2_capture_delegate_multi_plane.{cc,h}
| SPlane | | MPlane |
| (BTSplane) | | (BTMPlane)|
| | +-----------+
+------------+ v4l2_capture_delegate_single_plane.{cc,h}
- VCDevice works on the premise that its calls into
VCDevice::Client::OnIncomingWhatever() are synchronous.
That assumption is respected here.
- A bit of cleanup is done in OnIncomingCaptureData(),
in what regards rotation/crop/odd sizes. A unit test
is subsequently added.
- VideoCaptureDeviceFactory labels the devices as
Single or Multi Planar. That labeling capture_api_type()
needs to ripple through a bunch of files, causing some
otherwise uninteresting changes in the patchsets.
BUG=441836
TEST= Compile and insmod vivid.ko into a kernel,
with options for supporting MPLANE api (multiplanar=2)
then capture using patched Chromium. Current vivid
does _not_ support any common Mplane format, needs
a patch:
https://github.com/miguelao/linux/tree/adding_yu12_yv12_nv12_nv21___mplane_formats___with_mods_for_kernel_3_13
that needs to be compiled against ubuntu sources 3.13 etc.
For even better coverage, use a normal WebCam and
navigate to http://goo.gl/fUcIiP, then open both
the MPlane camera mentioned in the previous paragraph
and the "normal" webcam (this is,partially, how I
try it).
Review URL: https://codereview.chromium.org/967793002
Cr-Commit-Position: refs/heads/master@{#321612}
Diffstat (limited to 'media/media.gyp')
-rw-r--r-- | media/media.gyp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/media/media.gyp b/media/media.gyp index d012137..798e08d 100644 --- a/media/media.gyp +++ b/media/media.gyp @@ -568,6 +568,12 @@ 'video/capture/file_video_capture_device.h', 'video/capture/file_video_capture_device_factory.cc', 'video/capture/file_video_capture_device_factory.h', + 'video/capture/linux/v4l2_capture_delegate.cc', + 'video/capture/linux/v4l2_capture_delegate.h', + 'video/capture/linux/v4l2_capture_delegate_multi_plane.cc', + 'video/capture/linux/v4l2_capture_delegate_multi_plane.h', + 'video/capture/linux/v4l2_capture_delegate_single_plane.cc', + 'video/capture/linux/v4l2_capture_delegate_single_plane.h', 'video/capture/linux/video_capture_device_chromeos.cc', 'video/capture/linux/video_capture_device_chromeos.h', 'video/capture/linux/video_capture_device_factory_linux.cc', @@ -758,6 +764,11 @@ 'audio/openbsd/audio_manager_openbsd.cc', 'audio/openbsd/audio_manager_openbsd.h', ], + }, { # else: openbsd==1 + 'sources!': [ + 'video/capture/linux/v4l2_capture_delegate_multi_plane.cc', + 'video/capture/linux/v4l2_capture_delegate_multi_plane.h', + ], }], ['OS=="linux"', { 'conditions': [ |