| 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 // 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 // VideoCaptureImpl is also a delegate of VideoCaptureMessageFilter which relays | 9 // VideoCaptureImpl is also a delegate of VideoCaptureMessageFilter which relays |
| 10 // operation of a capture device to the browser process and receives responses | 10 // operation of a capture device to the browser process and receives responses |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 namespace media { | 42 namespace media { |
| 43 class VideoFrame; | 43 class VideoFrame; |
| 44 } // namespace media | 44 } // namespace media |
| 45 | 45 |
| 46 namespace content { | 46 namespace content { |
| 47 | 47 |
| 48 class CONTENT_EXPORT VideoCaptureImpl | 48 class CONTENT_EXPORT VideoCaptureImpl |
| 49 : public VideoCaptureMessageFilter::Delegate { | 49 : public VideoCaptureMessageFilter::Delegate { |
| 50 public: | 50 public: |
| 51 virtual ~VideoCaptureImpl(); | 51 ~VideoCaptureImpl() override; |
| 52 | 52 |
| 53 VideoCaptureImpl(media::VideoCaptureSessionId session_id, | 53 VideoCaptureImpl(media::VideoCaptureSessionId session_id, |
| 54 VideoCaptureMessageFilter* filter); | 54 VideoCaptureMessageFilter* filter); |
| 55 | 55 |
| 56 // Start listening to IPC messages. | 56 // Start listening to IPC messages. |
| 57 void Init(); | 57 void Init(); |
| 58 | 58 |
| 59 // Stop listening to IPC messages. | 59 // Stop listening to IPC messages. |
| 60 void DeInit(); | 60 void DeInit(); |
| 61 | 61 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 struct ClientInfo { | 101 struct ClientInfo { |
| 102 ClientInfo(); | 102 ClientInfo(); |
| 103 ~ClientInfo(); | 103 ~ClientInfo(); |
| 104 media::VideoCaptureParams params; | 104 media::VideoCaptureParams params; |
| 105 VideoCaptureStateUpdateCB state_update_cb; | 105 VideoCaptureStateUpdateCB state_update_cb; |
| 106 VideoCaptureDeliverFrameCB deliver_frame_cb; | 106 VideoCaptureDeliverFrameCB deliver_frame_cb; |
| 107 }; | 107 }; |
| 108 typedef std::map<int, ClientInfo> ClientInfoMap; | 108 typedef std::map<int, ClientInfo> ClientInfoMap; |
| 109 | 109 |
| 110 // VideoCaptureMessageFilter::Delegate interface. | 110 // VideoCaptureMessageFilter::Delegate interface. |
| 111 virtual void OnBufferCreated(base::SharedMemoryHandle handle, | 111 void OnBufferCreated(base::SharedMemoryHandle handle, |
| 112 int length, | 112 int length, |
| 113 int buffer_id) override; | 113 int buffer_id) override; |
| 114 virtual void OnBufferDestroyed(int buffer_id) override; | 114 void OnBufferDestroyed(int buffer_id) override; |
| 115 virtual void OnBufferReceived(int buffer_id, | 115 void OnBufferReceived(int buffer_id, |
| 116 const media::VideoCaptureFormat& format, | 116 const media::VideoCaptureFormat& format, |
| 117 const gfx::Rect& visible_rect, | 117 const gfx::Rect& visible_rect, |
| 118 base::TimeTicks) override; | 118 base::TimeTicks) override; |
| 119 virtual void OnMailboxBufferReceived(int buffer_id, | 119 void OnMailboxBufferReceived(int buffer_id, |
| 120 const gpu::MailboxHolder& mailbox_holder, | 120 const gpu::MailboxHolder& mailbox_holder, |
| 121 const media::VideoCaptureFormat& format, | 121 const media::VideoCaptureFormat& format, |
| 122 base::TimeTicks timestamp) override; | 122 base::TimeTicks timestamp) override; |
| 123 virtual void OnStateChanged(VideoCaptureState state) override; | 123 void OnStateChanged(VideoCaptureState state) override; |
| 124 virtual void OnDeviceSupportedFormatsEnumerated( | 124 void OnDeviceSupportedFormatsEnumerated( |
| 125 const media::VideoCaptureFormats& supported_formats) override; | 125 const media::VideoCaptureFormats& supported_formats) override; |
| 126 virtual void OnDeviceFormatsInUseReceived( | 126 void OnDeviceFormatsInUseReceived( |
| 127 const media::VideoCaptureFormats& formats_in_use) override; | 127 const media::VideoCaptureFormats& formats_in_use) override; |
| 128 virtual void OnDelegateAdded(int32 device_id) override; | 128 void OnDelegateAdded(int32 device_id) override; |
| 129 | 129 |
| 130 // Sends an IPC message to browser process when all clients are done with the | 130 // Sends an IPC message to browser process when all clients are done with the |
| 131 // buffer. | 131 // buffer. |
| 132 void OnClientBufferFinished(int buffer_id, | 132 void OnClientBufferFinished(int buffer_id, |
| 133 const scoped_refptr<ClientBuffer>& buffer, | 133 const scoped_refptr<ClientBuffer>& buffer, |
| 134 uint32 release_sync_point); | 134 uint32 release_sync_point); |
| 135 | 135 |
| 136 void StopDevice(); | 136 void StopDevice(); |
| 137 void RestartCapture(); | 137 void RestartCapture(); |
| 138 void StartCaptureInternal(); | 138 void StartCaptureInternal(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // in |client_buffers_|. | 182 // in |client_buffers_|. |
| 183 // NOTE: Weak pointers must be invalidated before all other member variables. | 183 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 184 base::WeakPtrFactory<VideoCaptureImpl> weak_factory_; | 184 base::WeakPtrFactory<VideoCaptureImpl> weak_factory_; |
| 185 | 185 |
| 186 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); | 186 DISALLOW_COPY_AND_ASSIGN(VideoCaptureImpl); |
| 187 }; | 187 }; |
| 188 | 188 |
| 189 } // namespace content | 189 } // namespace content |
| 190 | 190 |
| 191 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ | 191 #endif // CONTENT_RENDERER_MEDIA_VIDEO_CAPTURE_IMPL_H_ |
| OLD | NEW |