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 // MediaStreamProvider is used to capture media of the types defined in | 5 // MediaStreamProvider is used to capture media of the types defined in |
6 // MediaStreamType. There is only one MediaStreamProvider instance per media | 6 // MediaStreamType. There is only one MediaStreamProvider instance per media |
7 // type and a MediaStreamProvider instance can have only one registered | 7 // type and a MediaStreamProvider instance can have only one registered |
8 // listener. | 8 // listener. |
9 // The MediaStreamManager is expected to be called on Browser::IO thread and | 9 // The MediaStreamManager is expected to be called on Browser::IO thread and |
10 // the listener will be called on the same thread. | 10 // the listener will be called on the same thread. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 // Implemented by a manager class providing captured media. | 61 // Implemented by a manager class providing captured media. |
62 class CONTENT_EXPORT MediaStreamProvider | 62 class CONTENT_EXPORT MediaStreamProvider |
63 : public base::RefCountedThreadSafe<MediaStreamProvider> { | 63 : public base::RefCountedThreadSafe<MediaStreamProvider> { |
64 public: | 64 public: |
65 // Registers a listener and a device message loop. | 65 // Registers a listener and a device message loop. |
66 virtual void Register(MediaStreamProviderListener* listener, | 66 virtual void Register(MediaStreamProviderListener* listener, |
67 const scoped_refptr<base::SingleThreadTaskRunner>& | 67 const scoped_refptr<base::SingleThreadTaskRunner>& |
68 device_task_runner) = 0; | 68 device_task_runner) = 0; |
69 | 69 |
70 // Unregisters the previously registered listener. | |
71 virtual void Unregister() = 0; | |
72 | |
73 // Enumerates existing capture devices and calls |DevicesEnumerated|. | 70 // Enumerates existing capture devices and calls |DevicesEnumerated|. |
74 virtual void EnumerateDevices(MediaStreamType stream_type) = 0; | 71 virtual void EnumerateDevices(MediaStreamType stream_type) = 0; |
75 | 72 |
76 // Opens the specified device. The device is not started and it is still | 73 // Opens the specified device. The device is not started and it is still |
77 // possible for other applications to open the device before the device is | 74 // possible for other applications to open the device before the device is |
78 // started. |Opened| is called when the device is opened. | 75 // started. |Opened| is called when the device is opened. |
79 // kInvalidMediaCaptureSessionId is returned on error. | 76 // kInvalidMediaCaptureSessionId is returned on error. |
80 virtual int Open(const StreamDeviceInfo& device) = 0; | 77 virtual int Open(const StreamDeviceInfo& device) = 0; |
81 | 78 |
82 // Closes the specified device and calls |Closed| when done. | 79 // Closes the specified device and calls |Closed| when done. |
83 virtual void Close(int capture_session_id) = 0; | 80 virtual void Close(int capture_session_id) = 0; |
84 | 81 |
85 protected: | 82 protected: |
86 friend class base::RefCountedThreadSafe<MediaStreamProvider>; | 83 friend class base::RefCountedThreadSafe<MediaStreamProvider>; |
87 virtual ~MediaStreamProvider() {} | 84 virtual ~MediaStreamProvider() {} |
88 }; | 85 }; |
89 | 86 |
90 } // namespace content | 87 } // namespace content |
91 | 88 |
92 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_PROVIDER_H_ | 89 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_PROVIDER_H_ |
OLD | NEW |