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

Side by Side Diff: media/capture/video/win/video_capture_device_mf_win.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 // Windows specific implementation of VideoCaptureDevice.
6 // DirectShow is used for capturing. DirectShow provide its own threads
7 // for capturing.
8
9 #ifndef MEDIA_CAPTURE_VIDEO_WIN_VIDEO_CAPTURE_DEVICE_MF_WIN_H_
10 #define MEDIA_CAPTURE_VIDEO_WIN_VIDEO_CAPTURE_DEVICE_MF_WIN_H_
11
12 #include <mfidl.h>
13 #include <mfreadwrite.h>
14 #include <stdint.h>
15
16 #include <vector>
17
18 #include "base/macros.h"
19 #include "base/synchronization/lock.h"
20 #include "base/threading/non_thread_safe.h"
21 #include "base/win/scoped_comptr.h"
22 #include "media/capture/capture_export.h"
23 #include "media/capture/video/video_capture_device.h"
24
25 interface IMFSourceReader;
26
27 namespace tracked_objects {
28 class Location;
29 } // namespace tracked_objects
30
31 namespace media {
32
33 class MFReaderCallback;
34
35 const DWORD kFirstVideoStream =
36 static_cast<DWORD>(MF_SOURCE_READER_FIRST_VIDEO_STREAM);
37
38 class CAPTURE_EXPORT VideoCaptureDeviceMFWin : public base::NonThreadSafe,
39 public VideoCaptureDevice {
40 public:
41 static bool FormatFromGuid(const GUID& guid, VideoPixelFormat* format);
42
43 explicit VideoCaptureDeviceMFWin(
44 const VideoCaptureDeviceDescriptor& device_descriptor);
45 ~VideoCaptureDeviceMFWin() override;
46
47 // Opens the device driver for this device.
48 bool Init(const base::win::ScopedComPtr<IMFMediaSource>& source);
49
50 // VideoCaptureDevice implementation.
51 void AllocateAndStart(
52 const VideoCaptureParams& params,
53 std::unique_ptr<VideoCaptureDevice::Client> client) override;
54 void StopAndDeAllocate() override;
55
56 // Captured new video data.
57 void OnIncomingCapturedData(const uint8_t* data,
58 int length,
59 int rotation,
60 base::TimeTicks reference_time,
61 base::TimeDelta timestamp);
62
63 private:
64 void OnError(const tracked_objects::Location& from_here, HRESULT hr);
65
66 VideoCaptureDeviceDescriptor descriptor_;
67 base::win::ScopedComPtr<IMFActivate> device_;
68 scoped_refptr<MFReaderCallback> callback_;
69
70 base::Lock lock_; // Used to guard the below variables.
71 std::unique_ptr<VideoCaptureDevice::Client> client_;
72 base::win::ScopedComPtr<IMFSourceReader> reader_;
73 VideoCaptureFormat capture_format_;
74 bool capture_;
75
76 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceMFWin);
77 };
78
79 } // namespace media
80
81 #endif // MEDIA_CAPTURE_VIDEO_WIN_VIDEO_CAPTURE_DEVICE_MF_WIN_H_
OLDNEW
« no previous file with comments | « media/capture/video/win/video_capture_device_factory_win.cc ('k') | media/capture/video/win/video_capture_device_mf_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698