OLD | NEW |
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 // Windows specific implementation of VideoCaptureDevice. | 5 // Windows specific implementation of VideoCaptureDevice. |
6 // DirectShow is used for capturing. DirectShow provide its own threads | 6 // DirectShow is used for capturing. DirectShow provide its own threads |
7 // for capturing. | 7 // for capturing. |
8 | 8 |
9 #ifndef MEDIA_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_MF_WIN_H_ | 9 #ifndef MEDIA_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_MF_WIN_H_ |
10 #define MEDIA_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_MF_WIN_H_ | 10 #define MEDIA_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_MF_WIN_H_ |
11 | 11 |
12 #include <mfidl.h> | 12 #include <mfidl.h> |
13 #include <mfreadwrite.h> | 13 #include <mfreadwrite.h> |
14 | 14 |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
18 #include "base/threading/non_thread_safe.h" | 18 #include "base/threading/non_thread_safe.h" |
19 #include "base/win/scoped_comptr.h" | 19 #include "base/win/scoped_comptr.h" |
20 #include "media/base/media_export.h" | 20 #include "media/base/media_export.h" |
21 #include "media/capture/video/video_capture_device.h" | 21 #include "media/capture/video/video_capture_device.h" |
22 | 22 |
23 interface IMFSourceReader; | 23 interface IMFSourceReader; |
24 | 24 |
| 25 namespace tracked_objects { |
| 26 class Location; |
| 27 } // namespace tracked_objects |
| 28 |
25 namespace media { | 29 namespace media { |
26 | 30 |
27 class MFReaderCallback; | 31 class MFReaderCallback; |
28 | 32 |
29 const DWORD kFirstVideoStream = | 33 const DWORD kFirstVideoStream = |
30 static_cast<DWORD>(MF_SOURCE_READER_FIRST_VIDEO_STREAM); | 34 static_cast<DWORD>(MF_SOURCE_READER_FIRST_VIDEO_STREAM); |
31 | 35 |
32 class MEDIA_EXPORT VideoCaptureDeviceMFWin : public base::NonThreadSafe, | 36 class MEDIA_EXPORT VideoCaptureDeviceMFWin : public base::NonThreadSafe, |
33 public VideoCaptureDevice { | 37 public VideoCaptureDevice { |
34 public: | 38 public: |
(...skipping 10 matching lines...) Expand all Loading... |
45 scoped_ptr<VideoCaptureDevice::Client> client) override; | 49 scoped_ptr<VideoCaptureDevice::Client> client) override; |
46 void StopAndDeAllocate() override; | 50 void StopAndDeAllocate() override; |
47 | 51 |
48 // Captured new video data. | 52 // Captured new video data. |
49 void OnIncomingCapturedData(const uint8* data, | 53 void OnIncomingCapturedData(const uint8* data, |
50 int length, | 54 int length, |
51 int rotation, | 55 int rotation, |
52 const base::TimeTicks& time_stamp); | 56 const base::TimeTicks& time_stamp); |
53 | 57 |
54 private: | 58 private: |
55 void OnError(HRESULT hr); | 59 void OnError(const tracked_objects::Location& from_here, HRESULT hr); |
56 | 60 |
57 Name name_; | 61 Name name_; |
58 base::win::ScopedComPtr<IMFActivate> device_; | 62 base::win::ScopedComPtr<IMFActivate> device_; |
59 scoped_refptr<MFReaderCallback> callback_; | 63 scoped_refptr<MFReaderCallback> callback_; |
60 | 64 |
61 base::Lock lock_; // Used to guard the below variables. | 65 base::Lock lock_; // Used to guard the below variables. |
62 scoped_ptr<VideoCaptureDevice::Client> client_; | 66 scoped_ptr<VideoCaptureDevice::Client> client_; |
63 base::win::ScopedComPtr<IMFSourceReader> reader_; | 67 base::win::ScopedComPtr<IMFSourceReader> reader_; |
64 VideoCaptureFormat capture_format_; | 68 VideoCaptureFormat capture_format_; |
65 bool capture_; | 69 bool capture_; |
66 | 70 |
67 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceMFWin); | 71 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceMFWin); |
68 }; | 72 }; |
69 | 73 |
70 } // namespace media | 74 } // namespace media |
71 | 75 |
72 #endif // MEDIA_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_MF_WIN_H_ | 76 #endif // MEDIA_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_MF_WIN_H_ |
OLD | NEW |