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

Side by Side Diff: media/video/capture/video_capture_device.h

Issue 8304017: enable video capture to support sharing across multiple renderer processes (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // VideoCaptureDevice is the abstract base class for realizing video capture 5 // VideoCaptureDevice is the abstract base class for realizing video capture
6 // device support in Chromium. It provides the interface for OS dependent 6 // device support in Chromium. It provides the interface for OS dependent
7 // implementations. 7 // implementations.
8 // The class is created and functions are invoked on a thread owned by 8 // The class is created and functions are invoked on a thread owned by
9 // VideoCaptureManager. Capturing is done on other threads depended on the OS 9 // VideoCaptureManager. Capturing is done on other threads depended on the OS
10 // specific implementation. 10 // specific implementation.
11 11
12 #ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ 12 #ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_
13 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ 13 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_
14 14
15 #include <list> 15 #include <list>
16 #include <string> 16 #include <string>
17 17
18 #include "base/time.h" 18 #include "base/time.h"
19 #include "media/base/media_export.h" 19 #include "media/base/media_export.h"
20 20
21 namespace media { 21 namespace media {
22 22
23 class MEDIA_EXPORT VideoCaptureDevice { 23 class MEDIA_EXPORT VideoCaptureDevice {
24 public: 24 public:
25
26 struct Name { 25 struct Name {
27 // Friendly name of a device 26 // Friendly name of a device
28 std::string device_name; 27 std::string device_name;
29 28
30 // Unique name of a device. Even if there are multiple devices with the same 29 // Unique name of a device. Even if there are multiple devices with the same
31 // friendly name connected to the computer this will be unique. 30 // friendly name connected to the computer this will be unique.
32 std::string unique_id; 31 std::string unique_id;
33 }; 32 };
34 typedef std::list<Name> Names; 33 typedef std::list<Name> Names;
35 34
(...skipping 26 matching lines...) Expand all
62 // Captured a new video frame. 61 // Captured a new video frame.
63 virtual void OnIncomingCapturedFrame(const uint8* data, 62 virtual void OnIncomingCapturedFrame(const uint8* data,
64 int length, 63 int length,
65 base::Time timestamp) = 0; 64 base::Time timestamp) = 0;
66 // An error has occurred that can not be handled 65 // An error has occurred that can not be handled
67 // and VideoCaptureDevice must be DeAllocated. 66 // and VideoCaptureDevice must be DeAllocated.
68 virtual void OnError() = 0; 67 virtual void OnError() = 0;
69 // Called when VideoCaptureDevice::Allocate has been called 68 // Called when VideoCaptureDevice::Allocate has been called
70 // to inform of the resulting frame size and color format. 69 // to inform of the resulting frame size and color format.
71 virtual void OnFrameInfo(const Capability& info) = 0; 70 virtual void OnFrameInfo(const Capability& info) = 0;
71 // Notify handler of state of the device.
72 virtual void OnDeviceState(bool in_use) = 0;
perkj_chrome 2011/10/17 08:39:43 Why does the device need to know? Should be handle
wjia(left Chromium) 2011/10/21 00:56:13 See explanation in video_capture_device_linux.cc
72 73
73 protected: 74 protected:
74 virtual ~EventHandler() {} 75 virtual ~EventHandler() {}
75 }; 76 };
76 // Creates a VideoCaptureDevice object. 77 // Creates a VideoCaptureDevice object.
77 // Return NULL if the hardware is not available. 78 // Return NULL if the hardware is not available.
78 static VideoCaptureDevice* Create(const Name& device_name); 79 static VideoCaptureDevice* Create(const Name& device_name);
79 virtual ~VideoCaptureDevice() {} 80 virtual ~VideoCaptureDevice() {}
80 81
81 // Gets the names of all video capture devices connected to this computer. 82 // Gets the names of all video capture devices connected to this computer.
(...skipping 20 matching lines...) Expand all
102 // state it was when created. 103 // state it was when created.
103 virtual void DeAllocate() = 0; 104 virtual void DeAllocate() = 0;
104 105
105 // Get the name of the capture device. 106 // Get the name of the capture device.
106 virtual const Name& device_name() = 0; 107 virtual const Name& device_name() = 0;
107 }; 108 };
108 109
109 } // namespace media 110 } // namespace media
110 111
111 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_ 112 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_DEVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698