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

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

Issue 2143903003: [WIP] Move media/capture to device/capture (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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(const Name& device_name);
35 ~VideoCaptureDeviceLinux() override;
36
37 // VideoCaptureDevice implementation.
38 void AllocateAndStart(const VideoCaptureParams& params,
39 std::unique_ptr<Client> client) override;
40 void StopAndDeAllocate() override;
41
42 protected:
43 void SetRotation(int rotation);
44
45 private:
46 static int TranslatePowerLineFrequencyToV4L2(PowerLineFrequency frequency);
47
48 // Internal delegate doing the actual capture setting, buffer allocation and
49 // circulation with the V4L2 API. Created and deleted in the thread where
50 // VideoCaptureDeviceLinux lives but otherwise operating on |v4l2_thread_|.
51 scoped_refptr<V4L2CaptureDelegate> capture_impl_;
52
53 base::Thread v4l2_thread_; // Thread used for reading data from the device.
54
55 const Name device_name_;
56
57 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceLinux);
58 };
59
60 } // namespace media
61
62 #endif // MEDIA_CAPTURE_VIDEO_LINUX_VIDEO_CAPTURE_DEVICE_LINUX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698