Chromium Code Reviews| 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(); | |
|
qinmin
2013/01/24 18:41:34
do we need virtual? anyone inherits this?
wjia(left Chromium)
2013/01/24 22:18:58
To make clang happy:
[chromium-style] Overriding m
| |
| 22 | |
| 23 static bool RegisterVideoCaptureDevice(JNIEnv* env); | |
| 24 | |
| 25 // VideoCaptureDevice implementation. | |
| 26 virtual void Allocate(int width, int height, int frame_rate, | |
| 27 EventHandler* observer) OVERRIDE; | |
| 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(); | |
| 34 virtual void OnFrameAvailable(uint8* buffer, int length, base::Time timestamp, | |
|
qinmin
2013/01/24 18:41:34
do we need virtual?
wjia(left Chromium)
2013/01/24 22:18:58
Removed.
| |
| 35 int rotation, bool flip_vert, bool flip_horiz); | |
| 36 | |
| 37 jobject java_capture_object() { return j_capture_.obj(); } | |
| 38 | |
| 39 private: | |
| 40 enum InternalState { | |
| 41 kIdle, // The device is opened but not in use. | |
| 42 kAllocated, // All resouces have been allocated and camera can be started. | |
| 43 kCapturing, // Video is being captured. | |
| 44 kError // Hit error. User needs to recover by destroying the object. | |
| 45 }; | |
| 46 | |
| 47 void SetErrorState(const std::string& reason); | |
| 48 | |
| 49 base::Lock lock_; | |
| 50 InternalState state_; | |
| 51 VideoCaptureDevice::EventHandler* observer_; | |
| 52 Name device_name_; | |
| 53 VideoCaptureCapability current_settings_; | |
| 54 scoped_ptr<uint8[]> rotation_buffer_; | |
| 55 int rotation_; | |
| 56 | |
| 57 // Java VideoCaptureAndroid instance. | |
| 58 base::android::ScopedJavaGlobalRef<jobject> j_capture_; | |
| 59 | |
| 60 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoCaptureDeviceAndroid); | |
| 61 }; | |
| 62 | |
| 63 } // namespace media | |
| 64 | |
| 65 #endif // MEDIA_VIDEO_CAPTURE_ANDROID_VIDEO_CAPTURE_DEVICE_ANDROID_H_ | |
| OLD | NEW |