LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/video_capture - video_capture.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 26 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 15 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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_VIDEO_CAPTURE_H_
      12             : #define WEBRTC_MODULES_VIDEO_CAPTURE_VIDEO_CAPTURE_H_
      13             : 
      14             : #include "webrtc/modules/audio_processing/include/config.h"
      15             : #include "webrtc/api/video/video_rotation.h"
      16             : #include "webrtc/media/base/videosinkinterface.h"
      17             : #include "webrtc/modules/include/module.h"
      18             : #include "webrtc/modules/video_capture/video_capture_defines.h"
      19             : 
      20             : #if defined(ANDROID) && !defined(WEBRTC_GONK)
      21             : #include <jni.h>
      22             : #endif
      23             : 
      24             : namespace webrtc {
      25             : 
      26             : // Mozilla addition
      27             : enum class CaptureDeviceType {
      28             :   Camera = 0,
      29             :   Screen = 1,
      30             :   Application = 2,
      31             :   Window = 3,
      32             :   Browser = 4
      33             : };
      34             : // Mozilla addition
      35             : 
      36             : struct CaptureDeviceInfo {
      37             :   CaptureDeviceType type;
      38             : 
      39           0 :   CaptureDeviceInfo() : type(CaptureDeviceType::Camera) {}
      40           0 :   CaptureDeviceInfo(CaptureDeviceType t) : type(t) {}
      41             : 
      42             :   static const ConfigOptionID identifier = ConfigOptionID::kCaptureDeviceInfo;
      43           0 :   const char * TypeName() const
      44             :   {
      45           0 :     switch(type) {
      46             :     case CaptureDeviceType::Camera: {
      47           0 :       return "Camera";
      48             :     }
      49             :     case CaptureDeviceType::Screen: {
      50           0 :       return "Screen";
      51             :     }
      52             :     case CaptureDeviceType::Application: {
      53           0 :       return "Application";
      54             :     }
      55             :     case CaptureDeviceType::Window: {
      56           0 :       return "Window";
      57             :     }
      58             :     case CaptureDeviceType::Browser: {
      59           0 :       return "Browser";
      60             :     }
      61             :     }
      62           0 :     assert(false);
      63             :     return "UNKOWN-CaptureDeviceType!";
      64             :   }
      65             : };
      66             : 
      67           0 : class VideoInputFeedBack
      68             : {
      69             : public:
      70             :     virtual void OnDeviceChange() = 0;
      71             : protected:
      72           0 :     virtual ~VideoInputFeedBack(){}
      73             : };
      74             : 
      75             : #if defined(ANDROID) && !defined(WEBRTC_CHROMIUM_BUILD)
      76             :   int32_t SetCaptureAndroidVM(JavaVM* javaVM);
      77             : #endif
      78             : 
      79           0 : class VideoCaptureModule: public rtc::RefCountInterface {
      80             :  public:
      81             :   // Interface for receiving information about available camera devices.
      82           0 :   class DeviceInfo {
      83             :    public:
      84             :     virtual uint32_t NumberOfDevices() = 0;
      85             :     virtual int32_t Refresh() = 0;
      86           0 :     virtual void DeviceChange() {
      87           0 :      if (_inputCallBack)
      88           0 :       _inputCallBack->OnDeviceChange();
      89           0 :     }
      90           0 :     virtual void RegisterVideoInputFeedBack(VideoInputFeedBack& callBack) {
      91           0 :      _inputCallBack = &callBack;
      92           0 :     }
      93           0 :     virtual void DeRegisterVideoInputFeedBack() {
      94           0 :      _inputCallBack = NULL;
      95           0 :     }
      96             : 
      97             :     // Returns the available capture devices.
      98             :     // deviceNumber   - Index of capture device.
      99             :     // deviceNameUTF8 - Friendly name of the capture device.
     100             :     // deviceUniqueIdUTF8 - Unique name of the capture device if it exist.
     101             :     //                      Otherwise same as deviceNameUTF8.
     102             :     // productUniqueIdUTF8 - Unique product id if it exist.
     103             :     //                       Null terminated otherwise.
     104             :     virtual int32_t GetDeviceName(
     105             :         uint32_t deviceNumber,
     106             :         char* deviceNameUTF8,
     107             :         uint32_t deviceNameLength,
     108             :         char* deviceUniqueIdUTF8,
     109             :         uint32_t deviceUniqueIdUTF8Length,
     110             :         char* productUniqueIdUTF8 = 0,
     111             :         uint32_t productUniqueIdUTF8Length = 0,
     112             :         pid_t* pid = 0) = 0;
     113             : 
     114             : 
     115             :     // Returns the number of capabilities this device.
     116             :     virtual int32_t NumberOfCapabilities(
     117             :         const char* deviceUniqueIdUTF8) = 0;
     118             : 
     119             :     // Gets the capabilities of the named device.
     120             :     virtual int32_t GetCapability(
     121             :         const char* deviceUniqueIdUTF8,
     122             :         const uint32_t deviceCapabilityNumber,
     123             :         VideoCaptureCapability& capability) = 0;
     124             : 
     125             :     // Gets clockwise angle the captured frames should be rotated in order
     126             :     // to be displayed correctly on a normally rotated display.
     127             :     virtual int32_t GetOrientation(const char* deviceUniqueIdUTF8,
     128             :                                    VideoRotation& orientation) = 0;
     129             : 
     130             :     // Gets the capability that best matches the requested width, height and
     131             :     // frame rate.
     132             :     // Returns the deviceCapabilityNumber on success.
     133             :     virtual int32_t GetBestMatchedCapability(
     134             :         const char* deviceUniqueIdUTF8,
     135             :         const VideoCaptureCapability& requested,
     136             :         VideoCaptureCapability& resulting) = 0;
     137             : 
     138             :      // Display OS /capture device specific settings dialog
     139             :     virtual int32_t DisplayCaptureSettingsDialogBox(
     140             :         const char* deviceUniqueIdUTF8,
     141             :         const char* dialogTitleUTF8,
     142             :         void* parentWindow,
     143             :         uint32_t positionX,
     144             :         uint32_t positionY) = 0;
     145             : 
     146           0 :     virtual ~DeviceInfo() {}
     147             :    private:
     148             :     VideoInputFeedBack* _inputCallBack = NULL;
     149             :   };
     150             : 
     151             :   //   Register capture data callback
     152             :   virtual void RegisterCaptureDataCallback(
     153             :       rtc::VideoSinkInterface<VideoFrame> *dataCallback) = 0;
     154             : 
     155             :   //  Remove capture data callback
     156             :   virtual void DeRegisterCaptureDataCallback() = 0;
     157             : 
     158             :   // Start capture device
     159             :   virtual int32_t StartCapture(
     160             :       const VideoCaptureCapability& capability) = 0;
     161             : 
     162             :   virtual int32_t StopCapture() = 0;
     163             : 
     164             :   // Returns the name of the device used by this module.
     165             :   virtual const char* CurrentDeviceName() const = 0;
     166             : 
     167             :   // Returns true if the capture device is running
     168             :   virtual bool CaptureStarted() = 0;
     169             : 
     170             :   // Gets the current configuration.
     171             :   virtual int32_t CaptureSettings(VideoCaptureCapability& settings) = 0;
     172             : 
     173             :   // Set the rotation of the captured frames.
     174             :   // If the rotation is set to the same as returned by
     175             :   // DeviceInfo::GetOrientation the captured frames are
     176             :   // displayed correctly if rendered.
     177             :   virtual int32_t SetCaptureRotation(VideoRotation rotation) = 0;
     178             : 
     179             :   // Tells the capture module whether to apply the pending rotation. By default,
     180             :   // the rotation is applied and the generated frame is up right. When set to
     181             :   // false, generated frames will carry the rotation information from
     182             :   // SetCaptureRotation. Return value indicates whether this operation succeeds.
     183             :   virtual bool SetApplyRotation(bool enable) = 0;
     184             : 
     185             :   // Return whether the rotation is applied or left pending.
     186             :   virtual bool GetApplyRotation() = 0;
     187             : 
     188             : protected:
     189           0 :   virtual ~VideoCaptureModule() {};
     190             : };
     191             : 
     192             : }  // namespace webrtc
     193             : #endif  // WEBRTC_MODULES_VIDEO_CAPTURE_VIDEO_CAPTURE_H_

Generated by: LCOV version 1.13