OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ | |
6 #define MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ | |
7 | |
8 #include <jni.h> | |
9 #include <string> | |
10 | |
11 #include "base/android/scoped_java_ref.h" | |
12 #include "base/synchronization/lock.h" | |
13 #include "base/threading/thread.h" | |
14 #include "media/video/capture/video_capture_device.h" | |
15 | |
16 namespace media { | |
17 | |
18 class VideoCaptureDeviceAndroid : public VideoCaptureDevice { | |
19 public: | |
20 explicit VideoCaptureDeviceAndroid(const Name& device_name); | |
21 virtual ~VideoCaptureDeviceAndroid(); | |
22 | |
23 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
| |
24 | |
25 // VideoCaptureDevice implementation. | |
26 virtual void Allocate(int width, int height, int frame_rate, | |
27 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.
| |
28 virtual void Start() OVERRIDE; | |
29 virtual void Stop() OVERRIDE; | |
30 virtual void DeAllocate() OVERRIDE; | |
31 virtual const Name& device_name() OVERRIDE; | |
32 | |
33 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.
| |
34 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.
| |
35 jbyteArray data, jint length, | |
36 jint rotation, jboolean flip_vert, jboolean flip_horiz); | |
37 | |
38 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.
| |
39 | |
40 private: | |
41 enum InternalState { | |
42 kIdle, // The device is opened but not in use. | |
43 kAllocated, // All resouces have been allocated and camera can be started. | |
44 kCapturing, // Video is being captured. | |
45 kError // Hit error. User needs to recover by destroying the object. | |
46 }; | |
47 | |
48 void SetErrorState(const std::string& reason); | |
49 | |
50 base::Lock lock_; | |
51 InternalState state_; | |
52 VideoCaptureDevice::EventHandler* observer_; | |
53 Name device_name_; | |
54 VideoCaptureCapability current_settings_; | |
55 scoped_ptr<uint8[]> rotation_buffer_; | |
56 int rotation_; | |
57 | |
58 // Java VideoCaptureAndroid instance. | |
59 base::android::ScopedJavaGlobalRef<jobject> j_capture_; | |
60 | |
61 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceAndroid); | |
62 }; | |
63 | |
64 } // namespace media | |
65 | |
66 #endif // MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ | |
OLD | NEW |