| 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 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 // Request a new media stream to be created. | 41 // Request a new media stream to be created. |
| 42 // This can be used either by WebKit or a plugin. | 42 // This can be used either by WebKit or a plugin. |
| 43 // Note: The event_handler must be valid for as long as the stream exists. | 43 // Note: The event_handler must be valid for as long as the stream exists. |
| 44 virtual void GenerateStream( | 44 virtual void GenerateStream( |
| 45 int request_id, | 45 int request_id, |
| 46 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, | 46 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, |
| 47 const StreamOptions& components, | 47 const StreamOptions& components, |
| 48 const GURL& security_origin); | 48 const GURL& security_origin); |
| 49 | 49 |
| 50 // Cancel the request for a new media stream to be created. | 50 // Cancel the request for a new media stream to be created. |
| 51 virtual void CancelGenerateStream(int request_id); | 51 virtual void CancelGenerateStream( |
| 52 int request_id, |
| 53 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler); |
| 52 | 54 |
| 53 // Stop a started stream. Label is the label provided in OnStreamGenerated. | 55 // Stop a started stream. Label is the label provided in OnStreamGenerated. |
| 54 virtual void StopStream(const std::string& label); | 56 virtual void StopStream(const std::string& label); |
| 55 | 57 |
| 56 // Request to enumerate devices. | 58 // Request to enumerate devices. |
| 57 void EnumerateDevices( | 59 void EnumerateDevices( |
| 58 int request_id, | 60 int request_id, |
| 59 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, | 61 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, |
| 60 MediaStreamType type, | 62 MediaStreamType type, |
| 61 const GURL& security_origin); | 63 const GURL& security_origin); |
| 62 | 64 |
| 63 // Request to stop enumerating devices. | 65 // Request to stop enumerating devices. |
| 64 void StopEnumerateDevices( | 66 void StopEnumerateDevices( |
| 65 int request_id, | 67 int request_id, |
| 66 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler); | 68 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler); |
| 67 | 69 |
| 68 // Request to open a device. | 70 // Request to open a device. |
| 69 void OpenDevice( | 71 void OpenDevice( |
| 70 int request_id, | 72 int request_id, |
| 71 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, | 73 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler, |
| 72 const std::string& device_id, | 74 const std::string& device_id, |
| 73 MediaStreamType type, | 75 MediaStreamType type, |
| 74 const GURL& security_origin); | 76 const GURL& security_origin); |
| 75 | 77 |
| 78 // Cancel the request to open a device. |
| 79 virtual void CancelOpenDevice( |
| 80 int request_id, |
| 81 const base::WeakPtr<MediaStreamDispatcherEventHandler>& event_handler); |
| 82 |
| 76 // Close a started device. |label| is provided in OnDeviceOpened. | 83 // Close a started device. |label| is provided in OnDeviceOpened. |
| 77 void CloseDevice(const std::string& label); | 84 void CloseDevice(const std::string& label); |
| 78 | 85 |
| 79 // Check if the label is a valid stream. | 86 // Check if the label is a valid stream. |
| 80 virtual bool IsStream(const std::string& label); | 87 virtual bool IsStream(const std::string& label); |
| 81 // Get the video session_id given a label. The label identifies a stream. | 88 // Get the video session_id given a label. The label identifies a stream. |
| 82 // index is the index in the video_device_array of the stream. | 89 // index is the index in the video_device_array of the stream. |
| 83 virtual int video_session_id(const std::string& label, int index); | 90 virtual int video_session_id(const std::string& label, int index); |
| 84 // Returns an audio session_id given a label and an index. | 91 // Returns an audio session_id given a label and an index. |
| 85 virtual int audio_session_id(const std::string& label, int index); | 92 virtual int audio_session_id(const std::string& label, int index); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // List of calls made to GenerateStream that have not yet completed. | 169 // List of calls made to GenerateStream that have not yet completed. |
| 163 typedef std::list<Request> RequestList; | 170 typedef std::list<Request> RequestList; |
| 164 RequestList requests_; | 171 RequestList requests_; |
| 165 | 172 |
| 166 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcher); | 173 DISALLOW_COPY_AND_ASSIGN(MediaStreamDispatcher); |
| 167 }; | 174 }; |
| 168 | 175 |
| 169 } // namespace content | 176 } // namespace content |
| 170 | 177 |
| 171 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ | 178 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_DISPATCHER_H_ |
| OLD | NEW |