Home | History | Annotate | Download | only in android
      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_MAIN_SOURCE_ANDROID_DEVICE_INFO_ANDROID_H_
     12 #define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_ANDROID_DEVICE_INFO_ANDROID_H_
     13 
     14 #include <jni.h>
     15 
     16 #include "webrtc/modules/video_capture/device_info_impl.h"
     17 #include "webrtc/modules/video_capture/video_capture_impl.h"
     18 
     19 namespace webrtc
     20 {
     21 namespace videocapturemodule
     22 {
     23 
     24 class DeviceInfoAndroid : public DeviceInfoImpl {
     25  public:
     26   static void Initialize(JNIEnv* env);
     27   static void DeInitialize();
     28 
     29   DeviceInfoAndroid(int32_t id);
     30   virtual ~DeviceInfoAndroid();
     31 
     32   // Set |*index| to the index of the camera matching |deviceUniqueIdUTF8|, or
     33   // return false if no match.
     34   bool FindCameraIndex(const char* deviceUniqueIdUTF8, size_t* index);
     35 
     36   virtual int32_t Init();
     37   virtual uint32_t NumberOfDevices();
     38   virtual int32_t GetDeviceName(
     39       uint32_t deviceNumber,
     40       char* deviceNameUTF8,
     41       uint32_t deviceNameLength,
     42       char* deviceUniqueIdUTF8,
     43       uint32_t deviceUniqueIdUTF8Length,
     44       char* productUniqueIdUTF8 = 0,
     45       uint32_t productUniqueIdUTF8Length = 0);
     46   virtual int32_t CreateCapabilityMap(const char* deviceUniqueIdUTF8);
     47 
     48   virtual int32_t DisplayCaptureSettingsDialogBox(
     49       const char* /*deviceUniqueIdUTF8*/,
     50       const char* /*dialogTitleUTF8*/,
     51       void* /*parentWindow*/,
     52       uint32_t /*positionX*/,
     53       uint32_t /*positionY*/) { return -1; }
     54   virtual int32_t GetOrientation(const char* deviceUniqueIdUTF8,
     55                                  VideoCaptureRotation& orientation);
     56 
     57   // Populate |min_mfps| and |max_mfps| with the closest supported range of the
     58   // device to |max_fps_to_match|.
     59   void GetMFpsRange(const char* deviceUniqueIdUTF8,
     60                     int max_fps_to_match,
     61                     int* min_mfps,
     62                     int* max_mfps);
     63 
     64  private:
     65   enum { kExpectedCaptureDelay = 190};
     66 };
     67 
     68 }  // namespace videocapturemodule
     69 }  // namespace webrtc
     70 
     71 #endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_ANDROID_DEVICE_INFO_ANDROID_H_
     72