| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_MIDI_MIDI_MANAGER_ANDROID_H_ | 5 #ifndef MEDIA_MIDI_MIDI_MANAGER_ANDROID_H_ |
| 6 #define MEDIA_MIDI_MIDI_MANAGER_ANDROID_H_ | 6 #define MEDIA_MIDI_MIDI_MANAGER_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/android/scoped_java_ref.h" | 11 #include "base/android/scoped_java_ref.h" |
| 12 #include "base/basictypes.h" | |
| 13 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
| 14 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 16 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 17 #include "media/midi/midi_input_port_android.h" | 16 #include "media/midi/midi_input_port_android.h" |
| 18 #include "media/midi/midi_manager.h" | 17 #include "media/midi/midi_manager.h" |
| 19 #include "media/midi/midi_scheduler.h" | 18 #include "media/midi/midi_scheduler.h" |
| 20 | 19 |
| 21 namespace media { | 20 namespace media { |
| 22 namespace midi { | 21 namespace midi { |
| 23 | 22 |
| 24 class MidiDeviceAndroid; | 23 class MidiDeviceAndroid; |
| 25 class MidiOutputPortAndroid; | 24 class MidiOutputPortAndroid; |
| 26 | 25 |
| 27 // MidiManagerAndroid is a MidiManager subclass for Android M or newer. For | 26 // MidiManagerAndroid is a MidiManager subclass for Android M or newer. For |
| 28 // older android OSes, we use MidiManagerUsb. | 27 // older android OSes, we use MidiManagerUsb. |
| 29 class MidiManagerAndroid final : public MidiManager, | 28 class MidiManagerAndroid final : public MidiManager, |
| 30 public MidiInputPortAndroid::Delegate { | 29 public MidiInputPortAndroid::Delegate { |
| 31 public: | 30 public: |
| 32 MidiManagerAndroid(); | 31 MidiManagerAndroid(); |
| 33 ~MidiManagerAndroid() override; | 32 ~MidiManagerAndroid() override; |
| 34 | 33 |
| 35 // MidiManager implementation. | 34 // MidiManager implementation. |
| 36 void StartInitialization() override; | 35 void StartInitialization() override; |
| 37 void DispatchSendMidiData(MidiManagerClient* client, | 36 void DispatchSendMidiData(MidiManagerClient* client, |
| 38 uint32 port_index, | 37 uint32_t port_index, |
| 39 const std::vector<uint8>& data, | 38 const std::vector<uint8_t>& data, |
| 40 double timestamp) override; | 39 double timestamp) override; |
| 41 | 40 |
| 42 // MidiInputPortAndroid::Delegate implementation. | 41 // MidiInputPortAndroid::Delegate implementation. |
| 43 void OnReceivedData(MidiInputPortAndroid*, | 42 void OnReceivedData(MidiInputPortAndroid*, |
| 44 const uint8* data, | 43 const uint8_t* data, |
| 45 size_t size, | 44 size_t size, |
| 46 base::TimeTicks timestamp) override; | 45 base::TimeTicks timestamp) override; |
| 47 | 46 |
| 48 // Called from the Java world. | 47 // Called from the Java world. |
| 49 void OnInitialized(JNIEnv* env, | 48 void OnInitialized(JNIEnv* env, |
| 50 const base::android::JavaParamRef<jobject>& caller, | 49 const base::android::JavaParamRef<jobject>& caller, |
| 51 const base::android::JavaParamRef<jobjectArray>& devices); | 50 const base::android::JavaParamRef<jobjectArray>& devices); |
| 52 void OnAttached(JNIEnv* env, | 51 void OnAttached(JNIEnv* env, |
| 53 const base::android::JavaParamRef<jobject>& caller, | 52 const base::android::JavaParamRef<jobject>& caller, |
| 54 const base::android::JavaParamRef<jobject>& device); | 53 const base::android::JavaParamRef<jobject>& device); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 79 base::hash_map<MidiOutputPortAndroid*, size_t> output_port_to_index_; | 78 base::hash_map<MidiOutputPortAndroid*, size_t> output_port_to_index_; |
| 80 | 79 |
| 81 base::android::ScopedJavaGlobalRef<jobject> raw_manager_; | 80 base::android::ScopedJavaGlobalRef<jobject> raw_manager_; |
| 82 scoped_ptr<MidiScheduler> scheduler_; | 81 scoped_ptr<MidiScheduler> scheduler_; |
| 83 }; | 82 }; |
| 84 | 83 |
| 85 } // namespace midi | 84 } // namespace midi |
| 86 } // namespace media | 85 } // namespace media |
| 87 | 86 |
| 88 #endif // MEDIA_MIDI_MIDI_MANAGER_ANDROID_H_ | 87 #endif // MEDIA_MIDI_MIDI_MANAGER_ANDROID_H_ |
| OLD | NEW |