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

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

Issue 10108009: Move VideoCapture::VideoCaptureCapability to video_capture_types.h (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix content_unittests build failure Created 8 years, 8 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
OLDNEW
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 // VideoCaptureImpl represents a capture device in renderer process. It provides 5 // VideoCaptureImpl represents a capture device in renderer process. It provides
6 // interfaces for clients to Start/Stop capture. It also communicates to clients 6 // interfaces for clients to Start/Stop capture. It also communicates to clients
7 // when buffer is ready, state of capture device is changed. 7 // when buffer is ready, state of capture device is changed.
8 8
9 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ 9 #ifndef CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_
10 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ 10 #define CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_
11 11
12 #include <list> 12 #include <list>
13 #include <map> 13 #include <map>
14 14
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "content/common/media/video_capture.h" 16 #include "content/common/media/video_capture.h"
17 #include "content/renderer/media/video_capture_message_filter.h" 17 #include "content/renderer/media/video_capture_message_filter.h"
18 #include "media/video/capture/video_capture.h" 18 #include "media/video/capture/video_capture.h"
19 #include "media/video/capture/video_capture_types.h"
19 20
20 namespace base { 21 namespace base {
21 class MessageLoopProxy; 22 class MessageLoopProxy;
22 } 23 }
23 24
24 class CONTENT_EXPORT VideoCaptureImpl 25 class CONTENT_EXPORT VideoCaptureImpl
25 : public media::VideoCapture, public VideoCaptureMessageFilter::Delegate { 26 : public media::VideoCapture, public VideoCaptureMessageFilter::Delegate {
26 public: 27 public:
27 // media::VideoCapture interface. 28 // media::VideoCapture interface.
28 virtual void StartCapture(media::VideoCapture::EventHandler* handler, 29 virtual void StartCapture(
29 const VideoCaptureCapability& capability) OVERRIDE; 30 media::VideoCapture::EventHandler* handler,
31 const media::VideoCaptureCapability& capability) OVERRIDE;
30 virtual void StopCapture(media::VideoCapture::EventHandler* handler) OVERRIDE; 32 virtual void StopCapture(media::VideoCapture::EventHandler* handler) OVERRIDE;
31 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE; 33 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) OVERRIDE;
32 virtual bool CaptureStarted() OVERRIDE; 34 virtual bool CaptureStarted() OVERRIDE;
33 virtual int CaptureWidth() OVERRIDE; 35 virtual int CaptureWidth() OVERRIDE;
34 virtual int CaptureHeight() OVERRIDE; 36 virtual int CaptureHeight() OVERRIDE;
35 virtual int CaptureFrameRate() OVERRIDE; 37 virtual int CaptureFrameRate() OVERRIDE;
36 38
37 // VideoCaptureMessageFilter::Delegate interface. 39 // VideoCaptureMessageFilter::Delegate interface.
38 virtual void OnBufferCreated(base::SharedMemoryHandle handle, 40 virtual void OnBufferCreated(base::SharedMemoryHandle handle,
39 int length, int buffer_id) OVERRIDE; 41 int length, int buffer_id) OVERRIDE;
40 virtual void OnBufferReceived(int buffer_id, base::Time timestamp) OVERRIDE; 42 virtual void OnBufferReceived(int buffer_id, base::Time timestamp) OVERRIDE;
41 virtual void OnStateChanged(video_capture::State state) OVERRIDE; 43 virtual void OnStateChanged(video_capture::State state) OVERRIDE;
42 virtual void OnDeviceInfoReceived( 44 virtual void OnDeviceInfoReceived(
43 const media::VideoCaptureParams& device_info) OVERRIDE; 45 const media::VideoCaptureParams& device_info) OVERRIDE;
44 virtual void OnDelegateAdded(int32 device_id) OVERRIDE; 46 virtual void OnDelegateAdded(int32 device_id) OVERRIDE;
45 47
46 private: 48 private:
47 friend class VideoCaptureImplManager; 49 friend class VideoCaptureImplManager;
48 friend class VideoCaptureImplTest; 50 friend class VideoCaptureImplTest;
49 friend class MockVideoCaptureImpl; 51 friend class MockVideoCaptureImpl;
50 52
51 struct DIBBuffer; 53 struct DIBBuffer;
52 54
53 VideoCaptureImpl(media::VideoCaptureSessionId id, 55 VideoCaptureImpl(media::VideoCaptureSessionId id,
54 base::MessageLoopProxy* capture_message_loop_proxy, 56 base::MessageLoopProxy* capture_message_loop_proxy,
55 VideoCaptureMessageFilter* filter); 57 VideoCaptureMessageFilter* filter);
56 virtual ~VideoCaptureImpl(); 58 virtual ~VideoCaptureImpl();
57 59
58 void DoStartCapture(media::VideoCapture::EventHandler* handler, 60 void DoStartCapture(media::VideoCapture::EventHandler* handler,
59 const VideoCaptureCapability& capability); 61 const media::VideoCaptureCapability& capability);
60 void DoStopCapture(media::VideoCapture::EventHandler* handler); 62 void DoStopCapture(media::VideoCapture::EventHandler* handler);
61 void DoFeedBuffer(scoped_refptr<VideoFrameBuffer> buffer); 63 void DoFeedBuffer(scoped_refptr<VideoFrameBuffer> buffer);
62 64
63 void DoBufferCreated(base::SharedMemoryHandle handle, 65 void DoBufferCreated(base::SharedMemoryHandle handle,
64 int length, int buffer_id); 66 int length, int buffer_id);
65 void DoBufferReceived(int buffer_id, base::Time timestamp); 67 void DoBufferReceived(int buffer_id, base::Time timestamp);
66 void DoStateChanged(video_capture::State state); 68 void DoStateChanged(video_capture::State state);
67 void DoDeviceInfoReceived(const media::VideoCaptureParams& device_info); 69 void DoDeviceInfoReceived(const media::VideoCaptureParams& device_info);
68 void DoDelegateAdded(int32 device_id); 70 void DoDelegateAdded(int32 device_id);
69 71
(...skipping 12 matching lines...) Expand all
82 84
83 scoped_refptr<VideoCaptureMessageFilter> message_filter_; 85 scoped_refptr<VideoCaptureMessageFilter> message_filter_;
84 scoped_refptr<base::MessageLoopProxy> capture_message_loop_proxy_; 86 scoped_refptr<base::MessageLoopProxy> capture_message_loop_proxy_;
85 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; 87 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
86 int device_id_; 88 int device_id_;
87 89
88 // Pool of DIBs. 90 // Pool of DIBs.
89 typedef std::map<int /* buffer_id */, DIBBuffer*> CachedDIB; 91 typedef std::map<int /* buffer_id */, DIBBuffer*> CachedDIB;
90 CachedDIB cached_dibs_; 92 CachedDIB cached_dibs_;
91 93
92 typedef std::map<media::VideoCapture::EventHandler*, VideoCaptureCapability> 94 typedef std::map<media::VideoCapture::EventHandler*,
93 ClientInfo; 95 media::VideoCaptureCapability> ClientInfo;
94 ClientInfo clients_; 96 ClientInfo clients_;
95 97
96 ClientInfo clients_pending_on_filter_; 98 ClientInfo clients_pending_on_filter_;
97 ClientInfo clients_pending_on_restart_; 99 ClientInfo clients_pending_on_restart_;
98 100
99 media::VideoFrame::Format video_type_; 101 media::VideoFrame::Format video_type_;
100 102
101 // The parameter is being used in current capture session. A capture session 103 // The parameter is being used in current capture session. A capture session
102 // starts with StartCapture and ends with StopCapture. 104 // starts with StartCapture and ends with StopCapture.
103 media::VideoCaptureParams current_params_; 105 media::VideoCaptureParams current_params_;
104 106
105 // The information about the device sent from browser process side. 107 // The information about the device sent from browser process side.
106 media::VideoCaptureParams device_info_; 108 media::VideoCaptureParams device_info_;
107 bool device_info_available_; 109 bool device_info_available_;
108 110
109 video_capture::State state_; 111 video_capture::State state_;
110 112
111 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); 113 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl);
112 }; 114 };
113 115
114 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ 116 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_impl.cc ('k') | content/renderer/media/video_capture_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698