| OLD | NEW |
| 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 // 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. |
| 11 | 11 |
| 12 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_PROVIDER_H_ | 12 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_PROVIDER_H_ |
| 13 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_PROVIDER_H_ | 13 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_PROVIDER_H_ |
| 14 | 14 |
| 15 #include <list> | 15 #include <list> |
| 16 #include <string> | 16 #include <string> |
| 17 | 17 |
| 18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
| 19 #include "content/common/media/media_stream_options.h" | 19 #include "content/common/media/media_stream_options.h" |
| 20 | 20 |
| 21 namespace base { |
| 22 class MessageLoopProxy; |
| 23 } |
| 24 |
| 21 namespace media_stream { | 25 namespace media_stream { |
| 22 | 26 |
| 23 enum MediaStreamProviderError { | 27 enum MediaStreamProviderError { |
| 24 kMediaStreamOk = 0, | 28 kMediaStreamOk = 0, |
| 25 kInvalidMediaStreamType, | 29 kInvalidMediaStreamType, |
| 26 kInvalidSession, | 30 kInvalidSession, |
| 27 kUnknownSession, | 31 kUnknownSession, |
| 28 kDeviceNotAvailable, | 32 kDeviceNotAvailable, |
| 29 kDeviceAlreadyInUse, | 33 kDeviceAlreadyInUse, |
| 30 kUnknownError | 34 kUnknownError |
| (...skipping 21 matching lines...) Expand all Loading... |
| 52 int capture_session_id, | 56 int capture_session_id, |
| 53 MediaStreamProviderError error) = 0; | 57 MediaStreamProviderError error) = 0; |
| 54 | 58 |
| 55 protected: | 59 protected: |
| 56 virtual ~MediaStreamProviderListener() {} | 60 virtual ~MediaStreamProviderListener() {} |
| 57 }; | 61 }; |
| 58 | 62 |
| 59 // Implemented by a manager class providing captured media. | 63 // Implemented by a manager class providing captured media. |
| 60 class CONTENT_EXPORT MediaStreamProvider { | 64 class CONTENT_EXPORT MediaStreamProvider { |
| 61 public: | 65 public: |
| 62 // Registers a listener, only one listener is allowed. | 66 // Registers a listener and a device message loop. |
| 63 virtual void Register(MediaStreamProviderListener* listener) = 0; | 67 virtual void Register(MediaStreamProviderListener* listener, |
| 68 base::MessageLoopProxy* device_thread_loop) = 0; |
| 64 | 69 |
| 65 // Unregisters the previously registered listener. | 70 // Unregisters the previously registered listener. |
| 66 virtual void Unregister() = 0; | 71 virtual void Unregister() = 0; |
| 67 | 72 |
| 68 // Enumerates existing capture devices and calls |DevicesEnumerated|. | 73 // Enumerates existing capture devices and calls |DevicesEnumerated|. |
| 69 virtual void EnumerateDevices() = 0; | 74 virtual void EnumerateDevices() = 0; |
| 70 | 75 |
| 71 // Opens the specified device. The device is not started and it is still | 76 // Opens the specified device. The device is not started and it is still |
| 72 // possible for other applications to open the device before the device is | 77 // possible for other applications to open the device before the device is |
| 73 // started. |Opened| is called when the device is opened. | 78 // started. |Opened| is called when the device is opened. |
| 74 // kInvalidMediaCaptureSessionId is returned on error. | 79 // kInvalidMediaCaptureSessionId is returned on error. |
| 75 virtual int Open(const StreamDeviceInfo& device) = 0; | 80 virtual int Open(const StreamDeviceInfo& device) = 0; |
| 76 | 81 |
| 77 // Closes the specified device and calls |Closed| when done. | 82 // Closes the specified device and calls |Closed| when done. |
| 78 virtual void Close(int capture_session_id) = 0; | 83 virtual void Close(int capture_session_id) = 0; |
| 79 | 84 |
| 80 protected: | 85 protected: |
| 81 virtual ~MediaStreamProvider() {} | 86 virtual ~MediaStreamProvider() {} |
| 82 }; | 87 }; |
| 83 | 88 |
| 84 } // namespace media_stream | 89 } // namespace media_stream |
| 85 | 90 |
| 86 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_PROVIDER_H_ | 91 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_MEDIA_STREAM_PROVIDER_H_ |
| OLD | NEW |