OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ | 5 #ifndef MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ |
6 #define MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ | 6 #define MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
12 #include "base/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "media/base/media_export.h" | 15 #include "media/base/media_export.h" |
16 #include "media/video/capture/video_capture_device.h" | 16 #include "media/video/capture/video_capture_device.h" |
17 | 17 |
18 namespace media { | 18 namespace media { |
19 | 19 |
20 // VideoCaptureDevice on Android. The VideoCaptureDevice API's are called | 20 // VideoCaptureDevice on Android. The VideoCaptureDevice API's are called |
21 // by VideoCaptureManager on its own thread, while OnFrameAvailable is called | 21 // by VideoCaptureManager on its own thread, while OnFrameAvailable is called |
22 // on JAVA thread (i.e., UI thread). Both will access |state_| and |client_|, | 22 // on JAVA thread (i.e., UI thread). Both will access |state_| and |client_|, |
23 // but only VideoCaptureManager would change their value. | 23 // but only VideoCaptureManager would change their value. |
24 class MEDIA_EXPORT VideoCaptureDeviceAndroid : public VideoCaptureDevice { | 24 class MEDIA_EXPORT VideoCaptureDeviceAndroid : public VideoCaptureDevice { |
25 public: | 25 public: |
26 // Automatically generated enum to interface with Java world. | 26 // Automatically generated enum to interface with Java world. |
| 27 // |
| 28 // A Java counterpart will be generated for this enum. |
| 29 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.media |
27 enum AndroidImageFormat { | 30 enum AndroidImageFormat { |
28 #define DEFINE_ANDROID_IMAGEFORMAT(name, value) name = value, | 31 // Android graphics ImageFormat mapping, see reference in: |
29 #include "media/video/capture/android/imageformat_list.h" | 32 // http://developer.android.com/reference/android/graphics/ImageFormat.html |
30 #undef DEFINE_ANDROID_IMAGEFORMAT | 33 ANDROID_IMAGE_FORMAT_NV21 = 17, |
| 34 ANDROID_IMAGE_FORMAT_YV12 = 842094169, |
| 35 ANDROID_IMAGE_FORMAT_UNKNOWN = 0, |
31 }; | 36 }; |
32 | 37 |
33 explicit VideoCaptureDeviceAndroid(const Name& device_name); | 38 explicit VideoCaptureDeviceAndroid(const Name& device_name); |
34 virtual ~VideoCaptureDeviceAndroid(); | 39 virtual ~VideoCaptureDeviceAndroid(); |
35 | 40 |
36 static VideoCaptureDevice* Create(const Name& device_name); | 41 static VideoCaptureDevice* Create(const Name& device_name); |
37 static bool RegisterVideoCaptureDevice(JNIEnv* env); | 42 static bool RegisterVideoCaptureDevice(JNIEnv* env); |
38 | 43 |
39 // Registers the Java VideoCaptureDevice pointer, used by the rest of the | 44 // Registers the Java VideoCaptureDevice pointer, used by the rest of the |
40 // methods of the class to operate the Java capture code. This method must be | 45 // methods of the class to operate the Java capture code. This method must be |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 | 83 |
79 // Java VideoCaptureAndroid instance. | 84 // Java VideoCaptureAndroid instance. |
80 base::android::ScopedJavaLocalRef<jobject> j_capture_; | 85 base::android::ScopedJavaLocalRef<jobject> j_capture_; |
81 | 86 |
82 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceAndroid); | 87 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceAndroid); |
83 }; | 88 }; |
84 | 89 |
85 } // namespace media | 90 } // namespace media |
86 | 91 |
87 #endif // MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ | 92 #endif // MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ |
OLD | NEW |