| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 // This file contains abstract classes used for media filter to handle video | 5 // This file contains abstract classes used for media filter to handle video |
| 6 // capture devices. | 6 // capture devices. |
| 7 | 7 |
| 8 #ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ | 8 #ifndef MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ |
| 9 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ | 9 #define MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 // Notify client that video capture has been stopped. | 60 // Notify client that video capture has been stopped. |
| 61 virtual void OnStopped(VideoCapture* capture) = 0; | 61 virtual void OnStopped(VideoCapture* capture) = 0; |
| 62 | 62 |
| 63 // Notify client that video capture has been paused. | 63 // Notify client that video capture has been paused. |
| 64 virtual void OnPaused(VideoCapture* capture) = 0; | 64 virtual void OnPaused(VideoCapture* capture) = 0; |
| 65 | 65 |
| 66 // Notify client that video capture has hit some error |error_code|. | 66 // Notify client that video capture has hit some error |error_code|. |
| 67 virtual void OnError(VideoCapture* capture, int error_code) = 0; | 67 virtual void OnError(VideoCapture* capture, int error_code) = 0; |
| 68 | 68 |
| 69 // Notify client that the client has been removed and no more calls will be |
| 70 // received. |
| 71 virtual void OnRemoved(VideoCapture* capture) = 0; |
| 72 |
| 69 // Notify client that a buffer is available. | 73 // Notify client that a buffer is available. |
| 70 virtual void OnBufferReady(VideoCapture* capture, | 74 virtual void OnBufferReady(VideoCapture* capture, |
| 71 scoped_refptr<VideoFrameBuffer> buffer) = 0; | 75 scoped_refptr<VideoFrameBuffer> buffer) = 0; |
| 72 | 76 |
| 73 // Notify client about device info. | 77 // Notify client about device info. |
| 74 virtual void OnDeviceInfoReceived( | 78 virtual void OnDeviceInfoReceived( |
| 75 VideoCapture* capture, | 79 VideoCapture* capture, |
| 76 const VideoCaptureParams& device_info) = 0; | 80 const VideoCaptureParams& device_info) = 0; |
| 77 }; | 81 }; |
| 78 | 82 |
| 79 // TODO(wjia): merge with similar struct in browser process and move it to | 83 // TODO(wjia): merge with similar struct in browser process and move it to |
| 80 // video_capture_types.h. | 84 // video_capture_types.h. |
| 81 struct VideoCaptureCapability { | 85 struct VideoCaptureCapability { |
| 82 int width; // desired width. | 86 int width; // desired width. |
| 83 int height; // desired height. | 87 int height; // desired height. |
| 84 int max_fps; // desired maximum frame rate. | 88 int max_fps; // desired maximum frame rate. |
| 85 int expected_capture_delay; // expected delay in millisecond. | 89 int expected_capture_delay; // expected delay in millisecond. |
| 86 media::VideoFrame::Format raw_type; // desired video type. | 90 media::VideoFrame::Format raw_type; // desired video type. |
| 87 bool interlaced; // need interlace format. | 91 bool interlaced; // need interlace format. |
| 88 bool resolution_fixed; // indicate requested resolution can't be altered. | 92 bool resolution_fixed; // indicate requested resolution can't be altered. |
| 89 }; | 93 }; |
| 90 | 94 |
| 91 VideoCapture() {} | 95 VideoCapture() {} |
| 92 virtual ~VideoCapture() {} | 96 virtual ~VideoCapture() {} |
| 93 | 97 |
| 94 // Request video capture to start capturing with |capability|. | 98 // Request video capture to start capturing with |capability|. |
| 95 // Also register |handler| with video capture for event handling. | 99 // Also register |handler| with video capture for event handling. |
| 100 // |handler| must remain valid until it has received |OnRemoved()|. |
| 96 virtual void StartCapture(EventHandler* handler, | 101 virtual void StartCapture(EventHandler* handler, |
| 97 const VideoCaptureCapability& capability) = 0; | 102 const VideoCaptureCapability& capability) = 0; |
| 98 | 103 |
| 99 // Request video capture to stop capturing for client |handler|. | 104 // Request video capture to stop capturing for client |handler|. |
| 105 // |handler| must remain valid until it has received |OnRemoved()|. |
| 100 virtual void StopCapture(EventHandler* handler) = 0; | 106 virtual void StopCapture(EventHandler* handler) = 0; |
| 101 | 107 |
| 102 // Feed buffer to video capture when done with it. | 108 // Feed buffer to video capture when done with it. |
| 103 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) = 0; | 109 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) = 0; |
| 104 | 110 |
| 105 virtual bool CaptureStarted() = 0; | 111 virtual bool CaptureStarted() = 0; |
| 106 virtual int CaptureWidth() = 0; | 112 virtual int CaptureWidth() = 0; |
| 107 virtual int CaptureHeight() = 0; | 113 virtual int CaptureHeight() = 0; |
| 108 virtual int CaptureFrameRate() = 0; | 114 virtual int CaptureFrameRate() = 0; |
| 109 | 115 |
| 110 private: | 116 private: |
| 111 DISALLOW_COPY_AND_ASSIGN(VideoCapture); | 117 DISALLOW_COPY_AND_ASSIGN(VideoCapture); |
| 112 }; | 118 }; |
| 113 | 119 |
| 114 } // namespace media | 120 } // namespace media |
| 115 | 121 |
| 116 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ | 122 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ |
| OLD | NEW |