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

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

Issue 11419200: Video capture implementation using the Media Foundation API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ready for review Created 8 years 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 | Annotate | Revision Log
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_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_MF_WIN_H_
10 #define MEDIA_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_MF_WIN_H_
11
12 #include <mfapi.h>
darin (slow to review) 2012/11/29 00:28:05 nit: can you avoid including these headers here, b
tommi (sloooow) - chröme 2012/11/29 11:02:58 Agreed. I could get rid of the mfapi.h header, but
13 #include <mfidl.h>
14 #include <mfreadwrite.h>
15
16 #include <vector>
17
18 #include "base/synchronization/lock.h"
19 #include "base/threading/non_thread_safe.h"
20 #include "base/win/scoped_comptr.h"
21 #include "media/video/capture/video_capture_device.h"
22
23 interface IMFSourceReader;
24
25 namespace media {
26
27 class MFReaderCallback;
28
29 class VideoCaptureDeviceMFWin
30 : public base::NonThreadSafe,
31 public VideoCaptureDevice {
32 public:
33 explicit VideoCaptureDeviceMFWin(const Name& device_name);
34 virtual ~VideoCaptureDeviceMFWin();
35
36 // Opens the device driver for this device.
37 // This function is used by the static VideoCaptureDevice::Create function.
38 bool Init();
39
40 // VideoCaptureDevice implementation.
41 virtual void Allocate(int width,
42 int height,
43 int frame_rate,
44 VideoCaptureDevice::EventHandler* observer) OVERRIDE;
45 virtual void Start() OVERRIDE;
46 virtual void Stop() OVERRIDE;
47 virtual void DeAllocate() OVERRIDE;
48 virtual const Name& device_name() OVERRIDE;
49
50 static void GetDeviceNames(Names* device_names);
51
52 // Captured a new video frame.
53 void OnIncomingCapturedFrame(const uint8* data, int length,
54 const base::Time& time_stamp);
55
56 private:
57 void OnError(HRESULT hr);
58
59 Name name_;
60 base::win::ScopedComPtr<IMFActivate> device_;
61 scoped_refptr<MFReaderCallback> callback_;
62
63 base::Lock lock_; // Used to guard the below variables.
64 VideoCaptureDevice::EventHandler* observer_;
65 base::win::ScopedComPtr<IMFSourceReader> reader_;
66 bool capture_;
67
68 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceMFWin);
69 };
70
71 } // namespace media
72
73 #endif // MEDIA_VIDEO_CAPTURE_WIN_VIDEO_CAPTURE_DEVICE_MF_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698