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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // Notify client that a buffer is available. | 63 // Notify client that a buffer is available. |
64 virtual void OnBufferReady(VideoCapture* capture, | 64 virtual void OnBufferReady(VideoCapture* capture, |
65 scoped_refptr<VideoFrameBuffer> buffer) = 0; | 65 scoped_refptr<VideoFrameBuffer> buffer) = 0; |
66 | 66 |
67 // Notify client about device info. | 67 // Notify client about device info. |
68 virtual void OnDeviceInfoReceived( | 68 virtual void OnDeviceInfoReceived( |
69 VideoCapture* capture, | 69 VideoCapture* capture, |
70 const VideoCaptureParams& device_info) = 0; | 70 const VideoCaptureParams& device_info) = 0; |
71 }; | 71 }; |
72 | 72 |
73 // TODO(wjia): merge with similar struct in browser process and move it to | |
74 // video_capture_types.h. | |
75 struct VideoCaptureCapability { | |
76 int width; // desired width. | |
77 int height; // desired height. | |
78 int max_fps; // desired maximum frame rate. | |
79 int expected_capture_delay; // expected delay in millisecond. | |
80 media::VideoFrame::Format raw_type; // desired video type. | |
81 bool interlaced; // need interlace format. | |
82 }; | |
83 | |
84 VideoCapture() {} | 73 VideoCapture() {} |
85 virtual ~VideoCapture() {} | 74 virtual ~VideoCapture() {} |
86 | 75 |
87 // Request video capture to start capturing with |capability|. | 76 // Request video capture to start capturing with |capability|. |
88 // Also register |handler| with video capture for event handling. | 77 // Also register |handler| with video capture for event handling. |
89 // |handler| must remain valid until it has received |OnRemoved()|. | 78 // |handler| must remain valid until it has received |OnRemoved()|. |
90 virtual void StartCapture(EventHandler* handler, | 79 virtual void StartCapture(EventHandler* handler, |
91 const VideoCaptureCapability& capability) = 0; | 80 const VideoCaptureCapability& capability) = 0; |
92 | 81 |
93 // Request video capture to stop capturing for client |handler|. | 82 // Request video capture to stop capturing for client |handler|. |
94 // |handler| must remain valid until it has received |OnRemoved()|. | 83 // |handler| must remain valid until it has received |OnRemoved()|. |
95 virtual void StopCapture(EventHandler* handler) = 0; | 84 virtual void StopCapture(EventHandler* handler) = 0; |
96 | 85 |
97 // Feed buffer to video capture when done with it. | 86 // Feed buffer to video capture when done with it. |
98 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) = 0; | 87 virtual void FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) = 0; |
99 | 88 |
100 virtual bool CaptureStarted() = 0; | 89 virtual bool CaptureStarted() = 0; |
101 virtual int CaptureWidth() = 0; | 90 virtual int CaptureWidth() = 0; |
102 virtual int CaptureHeight() = 0; | 91 virtual int CaptureHeight() = 0; |
103 virtual int CaptureFrameRate() = 0; | 92 virtual int CaptureFrameRate() = 0; |
104 | 93 |
105 private: | 94 private: |
106 DISALLOW_COPY_AND_ASSIGN(VideoCapture); | 95 DISALLOW_COPY_AND_ASSIGN(VideoCapture); |
107 }; | 96 }; |
108 | 97 |
109 } // namespace media | 98 } // namespace media |
110 | 99 |
111 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ | 100 #endif // MEDIA_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ |
OLD | NEW |