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

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

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

Powered by Google App Engine
This is Rietveld 408576698