OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_BROWSER_MEDIA_STREAM_MEDIA_STREAM_PROVIDER_H_ | |
6 #define CONTENT_BROWSER_MEDIA_STREAM_MEDIA_STREAM_PROVIDER_H_ | |
7 | |
8 #include <list> | |
9 #include <string> | |
10 | |
11 namespace media_stream { | |
12 | |
13 typedef int MediaCaptureSessionId; | |
wjia(left Chromium)
2011/05/06 00:11:31
Is this the same SessionId received by VideoCaptur
mflodman1
2011/05/06 11:52:38
Yes it is. We need to discuss where to put the typ
| |
14 | |
15 enum MediaStreamType { | |
16 kNoService = 0, | |
17 kAudioCapture, | |
18 kVideoCapture | |
19 }; | |
20 | |
21 enum MediaStreamProviderError { | |
22 kMediaStreamOk = 0, | |
23 kInvalidMediaStreamType, | |
24 kInvalidSession, | |
25 kUnknownSession, | |
26 kDeviceNotAvailable, | |
27 kDeviceAlreadyInUse, | |
28 kUnknownError | |
29 }; | |
30 | |
31 struct MediaCaptureDeviceInfo { | |
32 MediaStreamType stream_type; | |
33 std::string name; | |
34 std::string device_id; | |
35 bool in_use; | |
36 | |
37 MediaCaptureDeviceInfo() : stream_type(kNoService), name(), device_id(), | |
38 in_use(false) {} | |
39 MediaCaptureDeviceInfo(MediaStreamType service_param, | |
40 const std::string name_param, | |
41 const std::string device_param, | |
42 bool opened) | |
43 : stream_type(service_param), | |
44 name(name_param), | |
45 device_id(device_param), | |
46 in_use(opened) {} | |
47 }; | |
48 | |
49 typedef std::list<MediaCaptureDeviceInfo> MediaCaptureDevices; | |
50 | |
51 // Feedback class | |
52 class MediaStreamProviderListener { | |
wjia(left Chromium)
2011/05/06 00:11:31
Could you add comments on those API's?
mflodman1
2011/05/06 11:52:38
Done.
| |
53 public: | |
54 virtual void Opened(MediaStreamType stream_type, | |
55 MediaCaptureSessionId capture_session_id) = 0; | |
56 | |
57 virtual void Closed(MediaStreamType stream_type, | |
58 MediaCaptureSessionId capture_session_id) = 0; | |
59 | |
60 virtual void DevicesEnumerated(MediaStreamType stream_type, | |
61 const MediaCaptureDevices& devices) = 0; | |
62 | |
63 virtual void Error(MediaStreamType stream_type, | |
64 MediaCaptureSessionId capture_session_id, | |
65 MediaStreamProviderError error) = 0; | |
66 | |
67 protected: | |
68 virtual ~MediaStreamProviderListener() {} | |
69 }; | |
70 | |
71 class MediaStreamProvider { | |
72 public: | |
73 virtual int Register(MediaStreamType service_type, | |
74 MediaStreamProviderListener* listener) = 0; | |
75 | |
76 virtual void Unregister(MediaStreamType stream_type, | |
77 MediaStreamProviderListener* listener) = 0; | |
78 | |
79 virtual void EnumerateDevices(MediaStreamType stream_type) = 0; | |
80 | |
81 virtual MediaCaptureSessionId Open(MediaStreamType stream_type, | |
82 const MediaCaptureDeviceInfo& device) = 0; | |
83 | |
84 virtual void Close(MediaStreamType stream_type, | |
85 MediaCaptureSessionId capture_session_id) = 0; | |
86 | |
87 protected: | |
88 virtual ~MediaStreamProvider() {} | |
89 }; | |
wjia(left Chromium)
2011/05/06 00:11:31
one empty line here.
mflodman1
2011/05/06 11:52:38
Done.
| |
90 } // namespace media_stream | |
91 | |
92 #endif // CONTENT_BROWSER_MEDIA_STREAM_MEDIA_STREAM_PROVIDER_H_ | |
mflodman1
2011/05/05 11:11:22
Will add newline in next upload
mflodman1
2011/05/06 11:52:38
Done.
| |
OLD | NEW |