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

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

Issue 2214533002: move //media/capture to //device/capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
(Empty)
1 // Copyright (c) 2012 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 // Linux specific implementation of VideoCaptureDevice.
6 // V4L2 is used for capturing. V4L2 does not provide its own thread for
7 // capturing so this implementation uses a Chromium thread for fetching frames
8 // from V4L2.
9
10 #ifndef MEDIA_CAPTURE_VIDEO_LINUX_VIDEO_CAPTURE_DEVICE_LINUX_H_
11 #define MEDIA_CAPTURE_VIDEO_LINUX_VIDEO_CAPTURE_DEVICE_LINUX_H_
12
13 #include <stdint.h>
14
15 #include <string>
16
17 #include "base/files/file_util.h"
18 #include "base/files/scoped_file.h"
19 #include "base/macros.h"
20 #include "base/threading/thread.h"
21 #include "media/base/video_capture_types.h"
22 #include "media/capture/video/video_capture_device.h"
23
24 namespace media {
25
26 class V4L2CaptureDelegate;
27
28 // Linux V4L2 implementation of VideoCaptureDevice.
29 class VideoCaptureDeviceLinux : public VideoCaptureDevice {
30 public:
31 static VideoPixelFormat V4l2FourCcToChromiumPixelFormat(uint32_t v4l2_fourcc);
32 static std::list<uint32_t> GetListOfUsableFourCCs(bool favour_mjpeg);
33
34 explicit VideoCaptureDeviceLinux(
35 const VideoCaptureDeviceDescriptor& device_descriptor);
36 ~VideoCaptureDeviceLinux() override;
37
38 // VideoCaptureDevice implementation.
39 void AllocateAndStart(const VideoCaptureParams& params,
40 std::unique_ptr<Client> client) override;
41 void StopAndDeAllocate() override;
42
43 protected:
44 void SetRotation(int rotation);
45
46 private:
47 static int TranslatePowerLineFrequencyToV4L2(PowerLineFrequency frequency);
48
49 // Internal delegate doing the actual capture setting, buffer allocation and
50 // circulation with the V4L2 API. Created and deleted in the thread where
51 // VideoCaptureDeviceLinux lives but otherwise operating on |v4l2_thread_|.
52 scoped_refptr<V4L2CaptureDelegate> capture_impl_;
53
54 base::Thread v4l2_thread_; // Thread used for reading data from the device.
55
56 const VideoCaptureDeviceDescriptor device_descriptor_;
57
58 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceLinux);
59 };
60
61 } // namespace media
62
63 #endif // MEDIA_CAPTURE_VIDEO_LINUX_VIDEO_CAPTURE_DEVICE_LINUX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698