| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #ifndef WEBRTC_MODULES_VIDEO_CAPTURE_INCLUDE_VIDEO_CAPTURE_H_ | |
| 12 #define WEBRTC_MODULES_VIDEO_CAPTURE_INCLUDE_VIDEO_CAPTURE_H_ | |
| 13 | |
| 14 #include "webrtc/common_video/rotation.h" | |
| 15 #include "webrtc/modules/include/module.h" | |
| 16 #include "webrtc/modules/video_capture/include/video_capture_defines.h" | |
| 17 | |
| 18 namespace webrtc { | |
| 19 | |
| 20 class VideoCaptureModule: public RefCountedModule { | |
| 21 public: | |
| 22 // Interface for receiving information about available camera devices. | |
| 23 class DeviceInfo { | |
| 24 public: | |
| 25 virtual uint32_t NumberOfDevices() = 0; | |
| 26 | |
| 27 // Returns the available capture devices. | |
| 28 // deviceNumber - Index of capture device. | |
| 29 // deviceNameUTF8 - Friendly name of the capture device. | |
| 30 // deviceUniqueIdUTF8 - Unique name of the capture device if it exist. | |
| 31 // Otherwise same as deviceNameUTF8. | |
| 32 // productUniqueIdUTF8 - Unique product id if it exist. | |
| 33 // Null terminated otherwise. | |
| 34 virtual int32_t GetDeviceName( | |
| 35 uint32_t deviceNumber, | |
| 36 char* deviceNameUTF8, | |
| 37 uint32_t deviceNameLength, | |
| 38 char* deviceUniqueIdUTF8, | |
| 39 uint32_t deviceUniqueIdUTF8Length, | |
| 40 char* productUniqueIdUTF8 = 0, | |
| 41 uint32_t productUniqueIdUTF8Length = 0) = 0; | |
| 42 | |
| 43 | |
| 44 // Returns the number of capabilities this device. | |
| 45 virtual int32_t NumberOfCapabilities( | |
| 46 const char* deviceUniqueIdUTF8) = 0; | |
| 47 | |
| 48 // Gets the capabilities of the named device. | |
| 49 virtual int32_t GetCapability( | |
| 50 const char* deviceUniqueIdUTF8, | |
| 51 const uint32_t deviceCapabilityNumber, | |
| 52 VideoCaptureCapability& capability) = 0; | |
| 53 | |
| 54 // Gets clockwise angle the captured frames should be rotated in order | |
| 55 // to be displayed correctly on a normally rotated display. | |
| 56 virtual int32_t GetOrientation(const char* deviceUniqueIdUTF8, | |
| 57 VideoRotation& orientation) = 0; | |
| 58 | |
| 59 // Gets the capability that best matches the requested width, height and | |
| 60 // frame rate. | |
| 61 // Returns the deviceCapabilityNumber on success. | |
| 62 virtual int32_t GetBestMatchedCapability( | |
| 63 const char* deviceUniqueIdUTF8, | |
| 64 const VideoCaptureCapability& requested, | |
| 65 VideoCaptureCapability& resulting) = 0; | |
| 66 | |
| 67 // Display OS /capture device specific settings dialog | |
| 68 virtual int32_t DisplayCaptureSettingsDialogBox( | |
| 69 const char* deviceUniqueIdUTF8, | |
| 70 const char* dialogTitleUTF8, | |
| 71 void* parentWindow, | |
| 72 uint32_t positionX, | |
| 73 uint32_t positionY) = 0; | |
| 74 | |
| 75 virtual ~DeviceInfo() {} | |
| 76 }; | |
| 77 | |
| 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 | |
| 100 virtual void RegisterCaptureDataCallback( | |
| 101 VideoCaptureDataCallback& dataCallback) = 0; | |
| 102 | |
| 103 // Remove capture data callback | |
| 104 virtual void DeRegisterCaptureDataCallback() = 0; | |
| 105 | |
| 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 | |
| 113 virtual int32_t StartCapture( | |
| 114 const VideoCaptureCapability& capability) = 0; | |
| 115 | |
| 116 virtual int32_t StopCapture() = 0; | |
| 117 | |
| 118 // Returns the name of the device used by this module. | |
| 119 virtual const char* CurrentDeviceName() const = 0; | |
| 120 | |
| 121 // Returns true if the capture device is running | |
| 122 virtual bool CaptureStarted() = 0; | |
| 123 | |
| 124 // Gets the current configuration. | |
| 125 virtual int32_t CaptureSettings(VideoCaptureCapability& settings) = 0; | |
| 126 | |
| 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. | |
| 133 // If the rotation is set to the same as returned by | |
| 134 // DeviceInfo::GetOrientation the captured frames are | |
| 135 // displayed correctly if rendered. | |
| 136 virtual int32_t SetCaptureRotation(VideoRotation rotation) = 0; | |
| 137 | |
| 138 // 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 | |
| 140 // false, generated frames will carry the rotation information from | |
| 141 // SetCaptureRotation. Return value indicates whether this operation succeeds. | |
| 142 virtual bool SetApplyRotation(bool enable) = 0; | |
| 143 | |
| 144 // Return whether the rotation is applied or left pending. | |
| 145 virtual bool GetApplyRotation() = 0; | |
| 146 | |
| 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: | |
| 156 virtual ~VideoCaptureModule() {}; | |
| 157 }; | |
| 158 | |
| 159 } // namespace webrtc | |
| 160 #endif // WEBRTC_MODULES_VIDEO_CAPTURE_INCLUDE_VIDEO_CAPTURE_H_ | |
| OLD | NEW |