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

Side by Side Diff: content/renderer/media/video_capture_impl_manager.h

Issue 6902166: Add VideoCaptureImpl (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: add time out for StartCapture 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
Property Changes:
Added: svn:eol-style
+ LF
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 // VideoCaptureImplManager manages video capture devices in renderer process.
6 // The video capture clients use AddDevice() to get a pointer to
7 // video capture device. VideoCaputreImplManager supports multiple clients
8 // accessing same device.
9
10 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_
11 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_
12
13 #include <list>
14 #include <map>
15
16 #include "base/message_loop_proxy.h"
17 #include "base/synchronization/lock.h"
18 #include "content/renderer/media/video_capture_impl.h"
19 #include "content/renderer/video_capture_message_filter.h"
20 #include "media/base/callback.h"
21 #include "media/base/message_loop_factory.h"
22 #include "media/video/capture/video_capture.h"
23
24 class VideoCaptureImplManager {
25 public:
26 VideoCaptureImplManager();
27 ~VideoCaptureImplManager();
28
29 // Called by video capture client |handler| to add device referenced
30 // by |id| to VideoCaptureImplManager's list of opened device list.
31 // A pointer to VideoCapture is returned to client so that client can
32 // operate on that pointer, such as StartCaptrue, StopCapture.
33 static media::VideoCapture* AddDevice(
34 media::VideoCaptureSessionId id,
35 media::VideoCapture::EventHandler* handler);
36
37 // Called by video capture client |handler| to remove device referenced
38 // by |id| from VideoCaptureImplManager's list of opened device list.
39 static void RemoveDevice(media::VideoCaptureSessionId id,
40 media::VideoCapture::EventHandler* handler);
41
42 static VideoCaptureImplManager* GetInstance();
43
44 private:
45 struct Device {
46 Device();
47 Device(VideoCaptureImpl* device,
48 media::VideoCapture::EventHandler* handler);
49
50 VideoCaptureImpl* vc;
51 std::list<media::VideoCapture::EventHandler*> clients;
52 };
53
54 void FreeDevice(VideoCaptureImpl* vc);
55
56 typedef std::map<media::VideoCaptureSessionId, Device> Devices;
57 Devices devices_;
58 base::Lock lock_;
59 scoped_refptr<base::MessageLoopProxy> ml_proxy_;
60 scoped_ptr<media::MessageLoopFactory> ml_factory_;
61
62 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImplManager);
63 };
64
65 DISABLE_RUNNABLE_METHOD_REFCOUNT(VideoCaptureImplManager);
66
67 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698