blob: 3fd7e64b16403cdf1e25165f8b39d4c54e8f301f [file] [log] [blame]
andrew@webrtc.orga7b57da2012-10-22 18:19:23 +00001/*
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_VIDEO_CAPTURE_ANDROID_H_
12#define WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_ANDROID_VIDEO_CAPTURE_ANDROID_H_
13
14#include <jni.h>
15#include "device_info_android.h"
16#include "../video_capture_impl.h"
17
18#define AndroidJavaCaptureClass "org/webrtc/videoengine/VideoCaptureAndroid"
19
20namespace webrtc {
21namespace videocapturemodule {
22
23class VideoCaptureAndroid : public VideoCaptureImpl {
24 public:
25 static WebRtc_Word32 SetAndroidObjects(void* javaVM, void* javaContext);
26 static WebRtc_Word32 AttachAndUseAndroidDeviceInfoObjects(
27 JNIEnv*& env,
28 jclass& javaCmDevInfoClass,
29 jobject& javaCmDevInfoObject,
30 bool& attached);
31 static WebRtc_Word32 ReleaseAndroidDeviceInfoObjects(bool attached);
32
33 VideoCaptureAndroid(const WebRtc_Word32 id);
34 virtual WebRtc_Word32 Init(const WebRtc_Word32 id,
35 const char* deviceUniqueIdUTF8);
36
37
38 virtual WebRtc_Word32 StartCapture(
39 const VideoCaptureCapability& capability);
40 virtual WebRtc_Word32 StopCapture();
41 virtual bool CaptureStarted();
42 virtual WebRtc_Word32 CaptureSettings(VideoCaptureCapability& settings);
43 virtual WebRtc_Word32 SetCaptureRotation(VideoCaptureRotation rotation);
44
45 protected:
46 virtual ~VideoCaptureAndroid();
47 static void JNICALL ProvideCameraFrame (JNIEnv * env,
48 jobject,
49 jbyteArray javaCameraFrame,
50 jint length, jlong context);
51 DeviceInfoAndroid _capInfo;
52 jobject _javaCaptureObj; // Java Camera object.
53 VideoCaptureCapability _frameInfo;
54 bool _captureStarted;
55
56 static JavaVM* g_jvm;
57 static jclass g_javaCmClass;
58 static jclass g_javaCmDevInfoClass;
59 //Static java object implementing the needed device info functions;
60 static jobject g_javaCmDevInfoObject;
61 static jobject g_javaContext; // Java Application context
62};
63
64} // namespace videocapturemodule
65} // namespace webrtc
66#endif // WEBRTC_MODULES_VIDEO_CAPTURE_MAIN_SOURCE_ANDROID_VIDEO_CAPTURE_ANDROID_H_