Index: media/video/capture/android/video_capture_device_android.h |
=================================================================== |
--- media/video/capture/android/video_capture_device_android.h (revision 0) |
+++ media/video/capture/android/video_capture_device_android.h (revision 0) |
@@ -0,0 +1,66 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ |
+#define MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ |
+ |
+#include <jni.h> |
+#include <string> |
+ |
+#include "base/android/scoped_java_ref.h" |
+#include "base/synchronization/lock.h" |
+#include "base/threading/thread.h" |
+#include "media/video/capture/video_capture_device.h" |
+ |
+namespace media { |
+ |
+class VideoCaptureDeviceAndroid : public VideoCaptureDevice { |
+ public: |
+ explicit VideoCaptureDeviceAndroid(const Name& device_name); |
+ virtual ~VideoCaptureDeviceAndroid(); |
+ |
+ static bool RegisterVideoCaptureDevice(JNIEnv* env); |
Ami GONE FROM CHROMIUM
2013/01/28 23:55:47
drop VideoCaptureDevice from the name, given it's
wjia(left Chromium)
2013/01/30 18:25:47
I was following http://code.google.com/searchframe
|
+ |
+ // VideoCaptureDevice implementation. |
+ virtual void Allocate(int width, int height, int frame_rate, |
+ EventHandler* observer) OVERRIDE; |
Ami GONE FROM CHROMIUM
2013/01/28 23:55:47
this wrapping is meh - either all params should be
wjia(left Chromium)
2013/01/30 18:25:47
Done.
|
+ virtual void Start() OVERRIDE; |
+ virtual void Stop() OVERRIDE; |
+ virtual void DeAllocate() OVERRIDE; |
+ virtual const Name& device_name() OVERRIDE; |
+ |
+ bool Init(); |
Ami GONE FROM CHROMIUM
2013/01/28 23:55:47
It is unfortunate that you end up with a public, u
wjia(left Chromium)
2013/01/30 18:25:47
Done.
|
+ void OnFrameAvailable(JNIEnv* env, jobject obj, |
Ami GONE FROM CHROMIUM
2013/01/28 23:55:47
Doco this as implementing org.chromium.media.Video
wjia(left Chromium)
2013/01/30 18:25:47
Done.
|
+ jbyteArray data, jint length, |
+ jint rotation, jboolean flip_vert, jboolean flip_horiz); |
+ |
+ jobject java_capture_object() { return j_capture_.obj(); } |
Ami GONE FROM CHROMIUM
2013/01/28 23:55:47
What calls this? I think you can drop it, or else
Yaron
2013/01/28 23:58:51
This is unused (and likely shouldn't be exposed)
wjia(left Chromium)
2013/01/30 18:25:47
Removed.
wjia(left Chromium)
2013/01/30 18:25:47
Done.
|
+ |
+ private: |
+ enum InternalState { |
+ kIdle, // The device is opened but not in use. |
+ kAllocated, // All resouces have been allocated and camera can be started. |
+ kCapturing, // Video is being captured. |
+ kError // Hit error. User needs to recover by destroying the object. |
+ }; |
+ |
+ void SetErrorState(const std::string& reason); |
+ |
+ base::Lock lock_; |
+ InternalState state_; |
+ VideoCaptureDevice::EventHandler* observer_; |
+ Name device_name_; |
+ VideoCaptureCapability current_settings_; |
+ scoped_ptr<uint8[]> rotation_buffer_; |
+ int rotation_; |
+ |
+ // Java VideoCaptureAndroid instance. |
+ base::android::ScopedJavaGlobalRef<jobject> j_capture_; |
+ |
+ DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceAndroid); |
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ |