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

Side by Side Diff: content/browser/media_stream/media_stream_provider.h

Issue 6946001: VideoCaptureManager opens/closes, starts/stops and enumerates video capture devices. VideoCapture... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: VideoCaptureManager.cc error check changes Created 9 years, 7 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
(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 // TODO(mflodman) Create a common type to use for all video capture and media
14 // stream classes.
15 typedef int MediaCaptureSessionId;
16
17 enum MediaStreamType {
18 kNoService = 0,
19 kAudioCapture,
20 kVideoCapture
21 };
22
23 enum MediaStreamProviderError {
24 kMediaStreamOk = 0,
25 kInvalidMediaStreamType,
26 kInvalidSession,
27 kUnknownSession,
28 kDeviceNotAvailable,
29 kDeviceAlreadyInUse,
30 kUnknownError
31 };
32
33 struct MediaCaptureDeviceInfo {
34 MediaStreamType stream_type;
35 std::string name;
36 std::string device_id;
37 bool in_use;
38
39 MediaCaptureDeviceInfo() : stream_type(kNoService), name(), device_id(),
40 in_use(false) {}
41 MediaCaptureDeviceInfo(MediaStreamType service_param,
42 const std::string name_param,
43 const std::string device_param,
44 bool opened)
45 : stream_type(service_param),
46 name(name_param),
47 device_id(device_param),
48 in_use(opened) {}
49 };
50
51 typedef std::list<MediaCaptureDeviceInfo> MediaCaptureDevices;
52
53 // Feedback class used by MediaStreamProvider.
John Knottenbelt 2011/05/11 11:36:35 Optional: perhaps "Callback class" might better in
mflodman1 2011/05/15 20:24:00 Done.
54 class MediaStreamProviderListener {
55 public:
56 // Called by a MediaStreamProvider when a stream has been opened.
57 virtual void Opened(MediaStreamType stream_type,
John Knottenbelt 2011/05/11 11:36:35 Question: Since the MediaCaptureSessionId is being
mflodman1 2011/05/15 20:24:00 The plan is to have the MediaStreamManager instanc
58 MediaCaptureSessionId capture_session_id) = 0;
59
60 // Called by a MediaStreamProvider when a stream has been closed.
61 virtual void Closed(MediaStreamType stream_type,
62 MediaCaptureSessionId capture_session_id) = 0;
63
64 // Called by a MediaStreamProvider when available devices has been enumerated.
65 virtual void DevicesEnumerated(MediaStreamType stream_type,
66 const MediaCaptureDevices& devices) = 0;
67
68 // Called by a MediaStreamProvider when an error has occured.
69 virtual void Error(MediaStreamType stream_type,
70 MediaCaptureSessionId capture_session_id,
71 MediaStreamProviderError error) = 0;
72
73 protected:
74 virtual ~MediaStreamProviderListener() {}
75 };
76
77 // Implemented by a manager class providing captured media.
78 class MediaStreamProvider {
79 public:
80 // Registers a listener, only one listener is allowed.
John Knottenbelt 2011/05/11 11:36:35 Please clarify: is this one listener per service t
mflodman1 2011/05/15 20:24:00 There can be only one listener registered per Medi
81 virtual bool Register(MediaStreamType service_type,
82 MediaStreamProviderListener* listener) = 0;
83
84 // Unregisters the previously registered listener.
85 virtual void Unregister(MediaStreamType stream_type,
86 MediaStreamProviderListener* listener) = 0;
87
88 // Enumerates existing capture devices and calls |DevicesEnumerated|.
89 virtual void EnumerateDevices(MediaStreamType stream_type) = 0;
90
91 // Opens the specified device. The device is not started and it is still
92 // possible for other applications to open the device before the device is
93 // started. |Opened| is called when the device is opened.
94 virtual MediaCaptureSessionId Open(MediaStreamType stream_type,
95 const MediaCaptureDeviceInfo& device) = 0;
96
97 // Closes the specified device and calls |Closed| when done.
98 virtual void Close(MediaStreamType stream_type,
99 MediaCaptureSessionId capture_session_id) = 0;
100
101 protected:
102 virtual ~MediaStreamProvider() {}
103 };
104
105 } // namespace media_stream
106
107 #endif // CONTENT_BROWSER_MEDIA_STREAM_MEDIA_STREAM_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698