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