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. | |
viettrungluu
2011/09/27 00:04:58
"[...] has been removed and no more calls will be
wjia(left Chromium)
2011/09/27 00:26:17
Done.
| |
70 virtual void OnRemoved(VideoCapture* capture) = 0; | |
71 | |
69 // Notify client that a buffer is available. | 72 // Notify client that a buffer is available. |
70 virtual void OnBufferReady(VideoCapture* capture, | 73 virtual void OnBufferReady(VideoCapture* capture, |
71 scoped_refptr<VideoFrameBuffer> buffer) = 0; | 74 scoped_refptr<VideoFrameBuffer> buffer) = 0; |
72 | 75 |
73 // Notify client about device info. | 76 // Notify client about device info. |
74 virtual void OnDeviceInfoReceived( | 77 virtual void OnDeviceInfoReceived( |
75 VideoCapture* capture, | 78 VideoCapture* capture, |
76 const VideoCaptureParams& device_info) = 0; | 79 const VideoCaptureParams& device_info) = 0; |
77 }; | 80 }; |
78 | 81 |
79 // TODO(wjia): merge with similar struct in browser process and move it to | 82 // TODO(wjia): merge with similar struct in browser process and move it to |
80 // video_capture_types.h. | 83 // video_capture_types.h. |
81 struct VideoCaptureCapability { | 84 struct VideoCaptureCapability { |
82 int width; // desired width. | 85 int width; // desired width. |
83 int height; // desired height. | 86 int height; // desired height. |
84 int max_fps; // desired maximum frame rate. | 87 int max_fps; // desired maximum frame rate. |
85 int expected_capture_delay; // expected delay in millisecond. | 88 int expected_capture_delay; // expected delay in millisecond. |
86 media::VideoFrame::Format raw_type; // desired video type. | 89 media::VideoFrame::Format raw_type; // desired video type. |
87 bool interlaced; // need interlace format. | 90 bool interlaced; // need interlace format. |
88 bool resolution_fixed; // indicate requested resolution can't be altered. | 91 bool resolution_fixed; // indicate requested resolution can't be altered. |
89 }; | 92 }; |
90 | 93 |
91 VideoCapture() {} | 94 VideoCapture() {} |
92 virtual ~VideoCapture() {} | 95 virtual ~VideoCapture() {} |
93 | 96 |
94 // Request video capture to start capturing with |capability|. | 97 // Request video capture to start capturing with |capability|. |
95 // Also register |handler| with video capture for event handling. | 98 // Also register |handler| with video capture for event handling. |
96 virtual void StartCapture(EventHandler* handler, | 99 virtual void StartCapture(EventHandler* handler, |
viettrungluu
2011/09/27 00:04:58
Maybe add here: "|handler| must remain valid until
wjia(left Chromium)
2011/09/27 00:26:17
Done.
| |
97 const VideoCaptureCapability& capability) = 0; | 100 const VideoCaptureCapability& capability) = 0; |
98 | 101 |
99 // Request video capture to stop capturing for client |handler|. | 102 // Request video capture to stop capturing for client |handler|. |
100 virtual void StopCapture(EventHandler* handler) = 0; | 103 virtual void StopCapture(EventHandler* handler) = 0; |
101 | 104 |
102 // Feed buffer to video capture when done with it. | 105 // Feed buffer to video capture when done with it. |
103 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) = 0; | 106 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) = 0; |
104 | 107 |
105 virtual bool CaptureStarted() = 0; | 108 virtual bool CaptureStarted() = 0; |
106 virtual int CaptureWidth() = 0; | 109 virtual int CaptureWidth() = 0; |
107 virtual int CaptureHeight() = 0; | 110 virtual int CaptureHeight() = 0; |
108 virtual int CaptureFrameRate() = 0; | 111 virtual int CaptureFrameRate() = 0; |
109 | 112 |
110 private: | 113 private: |
111 DISALLOW_COPY_AND_ASSIGN(VideoCapture); | 114 DISALLOW_COPY_AND_ASSIGN(VideoCapture); |
112 }; | 115 }; |
113 | 116 |
114 } // namespace media | 117 } // namespace media |
115 | 118 |
116 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ | 119 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ |
OLD | NEW |