OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_MODULES_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ | 11 #ifndef WEBRTC_MODULES_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ |
12 #define WEBRTC_MODULES_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ | 12 #define WEBRTC_MODULES_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ |
13 | 13 |
14 #include "webrtc/common_video/rotation.h" | 14 #include "webrtc/common_video/rotation.h" |
| 15 #include "webrtc/media/base/videosinkinterface.h" |
15 #include "webrtc/modules/include/module.h" | 16 #include "webrtc/modules/include/module.h" |
16 #include "webrtc/modules/video_capture/video_capture_defines.h" | 17 #include "webrtc/modules/video_capture/video_capture_defines.h" |
17 | 18 |
18 namespace webrtc { | 19 namespace webrtc { |
19 | 20 |
20 class VideoCaptureModule: public RefCountedModule { | 21 class VideoCaptureModule: public rtc::RefCountInterface { |
21 public: | 22 public: |
22 // Interface for receiving information about available camera devices. | 23 // Interface for receiving information about available camera devices. |
23 class DeviceInfo { | 24 class DeviceInfo { |
24 public: | 25 public: |
25 virtual uint32_t NumberOfDevices() = 0; | 26 virtual uint32_t NumberOfDevices() = 0; |
26 | 27 |
27 // Returns the available capture devices. | 28 // Returns the available capture devices. |
28 // deviceNumber - Index of capture device. | 29 // deviceNumber - Index of capture device. |
29 // deviceNameUTF8 - Friendly name of the capture device. | 30 // deviceNameUTF8 - Friendly name of the capture device. |
30 // deviceUniqueIdUTF8 - Unique name of the capture device if it exist. | 31 // deviceUniqueIdUTF8 - Unique name of the capture device if it exist. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 virtual int32_t DisplayCaptureSettingsDialogBox( | 69 virtual int32_t DisplayCaptureSettingsDialogBox( |
69 const char* deviceUniqueIdUTF8, | 70 const char* deviceUniqueIdUTF8, |
70 const char* dialogTitleUTF8, | 71 const char* dialogTitleUTF8, |
71 void* parentWindow, | 72 void* parentWindow, |
72 uint32_t positionX, | 73 uint32_t positionX, |
73 uint32_t positionY) = 0; | 74 uint32_t positionY) = 0; |
74 | 75 |
75 virtual ~DeviceInfo() {} | 76 virtual ~DeviceInfo() {} |
76 }; | 77 }; |
77 | 78 |
78 class VideoCaptureEncodeInterface { | |
79 public: | |
80 virtual int32_t ConfigureEncoder(const VideoCodec& codec, | |
81 uint32_t maxPayloadSize) = 0; | |
82 // Inform the encoder about the new target bit rate. | |
83 // - newBitRate : New target bit rate in Kbit/s. | |
84 // - frameRate : The target frame rate. | |
85 virtual int32_t SetRates(int32_t newBitRate, int32_t frameRate) = 0; | |
86 // Inform the encoder about the packet loss and the round-trip time. | |
87 // - packetLoss : Fraction lost | |
88 // (loss rate in percent = 100 * packetLoss / 255). | |
89 // - rtt : Round-trip time in milliseconds. | |
90 virtual int32_t SetChannelParameters(uint32_t packetLoss, int64_t rtt) = 0; | |
91 | |
92 // Encode the next frame as key frame. | |
93 virtual int32_t EncodeFrameType(const FrameType type) = 0; | |
94 protected: | |
95 virtual ~VideoCaptureEncodeInterface() { | |
96 } | |
97 }; | |
98 | |
99 // Register capture data callback | 79 // Register capture data callback |
100 virtual void RegisterCaptureDataCallback( | 80 virtual void RegisterCaptureDataCallback( |
101 VideoCaptureDataCallback& dataCallback) = 0; | 81 rtc::VideoSinkInterface<VideoFrame> *dataCallback) = 0; |
102 | 82 |
103 // Remove capture data callback | 83 // Remove capture data callback |
104 virtual void DeRegisterCaptureDataCallback() = 0; | 84 virtual void DeRegisterCaptureDataCallback() = 0; |
105 | 85 |
106 // Register capture callback. | |
107 virtual void RegisterCaptureCallback(VideoCaptureFeedBack& callBack) = 0; | |
108 | |
109 // Remove capture callback. | |
110 virtual void DeRegisterCaptureCallback() = 0; | |
111 | |
112 // Start capture device | 86 // Start capture device |
113 virtual int32_t StartCapture( | 87 virtual int32_t StartCapture( |
114 const VideoCaptureCapability& capability) = 0; | 88 const VideoCaptureCapability& capability) = 0; |
115 | 89 |
116 virtual int32_t StopCapture() = 0; | 90 virtual int32_t StopCapture() = 0; |
117 | 91 |
118 // Returns the name of the device used by this module. | 92 // Returns the name of the device used by this module. |
119 virtual const char* CurrentDeviceName() const = 0; | 93 virtual const char* CurrentDeviceName() const = 0; |
120 | 94 |
121 // Returns true if the capture device is running | 95 // Returns true if the capture device is running |
122 virtual bool CaptureStarted() = 0; | 96 virtual bool CaptureStarted() = 0; |
123 | 97 |
124 // Gets the current configuration. | 98 // Gets the current configuration. |
125 virtual int32_t CaptureSettings(VideoCaptureCapability& settings) = 0; | 99 virtual int32_t CaptureSettings(VideoCaptureCapability& settings) = 0; |
126 | 100 |
127 virtual void SetCaptureDelay(int32_t delayMS) = 0; | |
128 | |
129 // Returns the current CaptureDelay. Only valid when the camera is running. | |
130 virtual int32_t CaptureDelay() = 0; | |
131 | |
132 // Set the rotation of the captured frames. | 101 // Set the rotation of the captured frames. |
133 // If the rotation is set to the same as returned by | 102 // If the rotation is set to the same as returned by |
134 // DeviceInfo::GetOrientation the captured frames are | 103 // DeviceInfo::GetOrientation the captured frames are |
135 // displayed correctly if rendered. | 104 // displayed correctly if rendered. |
136 virtual int32_t SetCaptureRotation(VideoRotation rotation) = 0; | 105 virtual int32_t SetCaptureRotation(VideoRotation rotation) = 0; |
137 | 106 |
138 // Tells the capture module whether to apply the pending rotation. By default, | 107 // Tells the capture module whether to apply the pending rotation. By default, |
139 // the rotation is applied and the generated frame is up right. When set to | 108 // the rotation is applied and the generated frame is up right. When set to |
140 // false, generated frames will carry the rotation information from | 109 // false, generated frames will carry the rotation information from |
141 // SetCaptureRotation. Return value indicates whether this operation succeeds. | 110 // SetCaptureRotation. Return value indicates whether this operation succeeds. |
142 virtual bool SetApplyRotation(bool enable) = 0; | 111 virtual bool SetApplyRotation(bool enable) = 0; |
143 | 112 |
144 // Return whether the rotation is applied or left pending. | 113 // Return whether the rotation is applied or left pending. |
145 virtual bool GetApplyRotation() = 0; | 114 virtual bool GetApplyRotation() = 0; |
146 | 115 |
147 // Gets a pointer to an encode interface if the capture device supports the | |
148 // requested type and size. NULL otherwise. | |
149 virtual VideoCaptureEncodeInterface* GetEncodeInterface( | |
150 const VideoCodec& codec) = 0; | |
151 | |
152 virtual void EnableFrameRateCallback(const bool enable) = 0; | |
153 virtual void EnableNoPictureAlarm(const bool enable) = 0; | |
154 | |
155 protected: | 116 protected: |
156 virtual ~VideoCaptureModule() {}; | 117 virtual ~VideoCaptureModule() {}; |
157 }; | 118 }; |
158 | 119 |
159 } // namespace webrtc | 120 } // namespace webrtc |
160 #endif // WEBRTC_MODULES_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ | 121 #endif // WEBRTC_MODULES_VIDEO_CAPTURE_VIDEO_CAPTURE_H_ |
OLD | NEW |