Chromium Code Reviews| Index: content/browser/renderer_host/video_capture_controller.h |
| =================================================================== |
| --- content/browser/renderer_host/video_capture_controller.h (revision 87318) |
| +++ content/browser/renderer_host/video_capture_controller.h (working copy) |
| @@ -26,55 +26,57 @@ |
| #include "media/video/capture/video_capture_types.h" |
| #include "ui/gfx/surface/transport_dib.h" |
| -class VideoCaptureController |
| - : public base::RefCountedThreadSafe<VideoCaptureController>, |
| - public media::VideoCaptureDevice::EventHandler { |
| +// Id used for identifying an object of VideoCaptureController. |
| +typedef std::pair<int32, int> VideoCaptureControllerId; |
|
scherkus (not reviewing)
2011/05/31 19:37:23
nit: while you're changing this stuff... Id -> ID
wjia(left Chromium)
2011/05/31 20:38:00
Done.
|
| + |
| +class VideoCaptureControllerEventHandler { |
|
jam
2011/05/31 19:00:08
nit: this should be in its own file
wjia(left Chromium)
2011/05/31 20:38:00
Done.
|
| public: |
| - // Id used for identifying an object of VideoCaptureController. |
| - typedef std::pair<int32, int> ControllerId; |
| - class EventHandler { |
| - public: |
| - // An Error have occurred in the VideoCaptureDevice. |
| - virtual void OnError(ControllerId id) = 0; |
| + // An Error have occurred in the VideoCaptureDevice. |
| + virtual void OnError(VideoCaptureControllerId id) = 0; |
| - // An TransportDIB have been filled with I420 video. |
| - virtual void OnBufferReady(ControllerId id, |
| - TransportDIB::Handle handle, |
| - base::Time timestamp) = 0; |
| + // An TransportDIB have been filled with I420 video. |
| + virtual void OnBufferReady(VideoCaptureControllerId id, |
| + TransportDIB::Handle handle, |
| + base::Time timestamp) = 0; |
| - // The frame resolution the VideoCaptureDevice capture video in. |
| - virtual void OnFrameInfo(ControllerId id, |
| - int width, |
| - int height, |
| - int frame_rate) = 0; |
| + // The frame resolution the VideoCaptureDevice capture video in. |
| + virtual void OnFrameInfo(VideoCaptureControllerId id, |
| + int width, |
| + int height, |
| + int frame_rate) = 0; |
| - // Report that this object can be deleted. |
| - virtual void OnReadyToDelete(ControllerId id) = 0; |
| + // Report that this object can be deleted. |
| + virtual void OnReadyToDelete(VideoCaptureControllerId id) = 0; |
| - protected: |
| - virtual ~EventHandler() {} |
| - }; |
| + protected: |
| + virtual ~VideoCaptureControllerEventHandler() {} |
| +}; |
| - VideoCaptureController(ControllerId id, |
| +class VideoCaptureController |
| + : public base::RefCountedThreadSafe<VideoCaptureController>, |
| + public media::VideoCaptureDevice::EventHandler { |
| + public: |
| + VideoCaptureController(VideoCaptureControllerId id, |
| base::ProcessHandle render_process, |
| - EventHandler* event_handler); |
| + VideoCaptureControllerEventHandler* event_handler); |
| virtual ~VideoCaptureController(); |
| // Starts video capturing and tries to use the resolution specified in |
| // params. |
| - // When capturing has started EventHandler::OnFrameInfo is called with |
| - // resolution that best matches the requested that the video capture device |
| - // support. |
| + // When capturing has started VideoCaptureControllerEventHandler::OnFrameInfo |
| + // is called with resolution that best matches the requested that the video |
| + // capture device support. |
| void StartCapture(const media::VideoCaptureParams& params); |
| // Stop video capture. |
| // When the capture is stopped and all TransportDIBS have been returned |
| - // EventHandler::OnReadyToDelete will be called. |
| + // VideoCaptureControllerEventHandler::OnReadyToDelete will be called. |
| // stopped_task may be null but it can be used to get a notification when the |
| // device is stopped. |
| void StopCapture(Task* stopped_task); |
| - // Return a DIB previously given in EventHandler::OnBufferReady. |
| + // Return a DIB previously given in |
| + // VideoCaptureControllerEventHandler::OnBufferReady. |
| void ReturnTransportDIB(TransportDIB::Handle handle); |
| // Implement media::VideoCaptureDevice::EventHandler. |
| @@ -101,13 +103,13 @@ |
| // All DIBS created by this object. |
| DIBMap owned_dibs_; |
| - EventHandler* event_handler_; |
| + VideoCaptureControllerEventHandler* event_handler_; |
| // The parameter that was requested when starting the capture device. |
| media::VideoCaptureParams params_; |
| // Id used for identifying this object. |
| - ControllerId id_; |
| + VideoCaptureControllerId id_; |
| media::VideoCaptureDevice::Capability frame_info_; |
| DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureController); |