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

Side by Side Diff: media/video/capture/win/video_capture_device_pxc_win.h

Issue 262383003: Add Intel Perceptual Computing SDK based depth video capture for Windows Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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) 2014 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 #ifndef MEDIA_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_PXC_WIN_H_
6 #define MEDIA_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_PXC_WIN_H_
7
8 // Intel Perceptual Computing SDK headers.
9 #include <pxccapture.h>
10 #include <pxcsmartptr.h>
11
12 #include <string>
13
14 #include "base/threading/thread.h"
15 #include "media/video/capture/video_capture_device.h"
16 #include "media/video/capture/video_capture_types.h"
17
18 namespace media {
19
20 // PXCCapture based implementation of VideoCaptureDevice for "depth" camera.
21 // PXCCapture does not provide its own thread for capturing so this
22 // implementation uses a Chromium thread for fetching frames.
23
24 class VideoCaptureDevicePXCWin : public VideoCaptureDevice {
25 public:
26 explicit VideoCaptureDevicePXCWin(const Name& device_name);
27 virtual ~VideoCaptureDevicePXCWin();
28
29 // Create the PXCCapture::Device.
30 // This function is used by the static VideoCaptureDevice::Create function.
31 bool Init();
32
33 // VideoCaptureDevice implementation.
34 virtual void AllocateAndStart(const VideoCaptureParams& params,
35 scoped_ptr<Client> client) OVERRIDE;
36
37 virtual void StopAndDeAllocate() OVERRIDE;
38
39 static bool PlatformSupported();
40 static void AppendDeviceNames(Names* device_names);
41 static bool IsDepthDevice(const Name& device_name);
42 static void GetDeviceSupportedFormats(const Name& device,
43 VideoCaptureFormats* formats);
44
45 private:
46 enum InternalState {
47 kIdle, // The device is created but the camera is not in use.
48 kCapturing, // Video is being captured.
49 kError // Error reported by PXCCapture API.
50 };
51
52 // Called on the pxc_capture_thread_.
53 void OnAllocateAndStart(int width,
54 int height,
55 int frame_rate,
56 scoped_ptr<Client> client);
57 void OnStopAndDeAllocate();
58 void OnCaptureTask();
59
60 void SetErrorState(const std::string& reason);
61
62 InternalState state_;
63 scoped_ptr<VideoCaptureDevice::Client> client_;
64 Name device_name_;
65
66 // Thread used for reading data from the device.
67 base::Thread pxc_capture_thread_;
68
69 PXCSmartPtr<PXCCapture::VideoStream> stream_;
70 VideoCaptureFormat capture_format_;
71
72 // Depth camera properties.
73 pxcF32 depth_saturation_value_;
74 pxcF32 depth_low_confidence_value_;
75 pxcF32 depth_unit_in_micrometers_;
76 PXCRangeF32 depth_range_in_millimeters_;
77
78 // Depth image in YV12 format.
79 scoped_ptr<uint8[]> yv12_image_;
80
81 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDevicePXCWin);
82 };
83
84 } // namespace media
85
86 #endif // MEDIA_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_PXC_WIN_H_
87
OLDNEW
« no previous file with comments | « media/video/capture/video_capture_device.h ('k') | media/video/capture/win/video_capture_device_pxc_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698