This sets up API to release OutputSurface from LTHClient.
[chromium-blink-merge.git] / media / midi / midi_input_port_android.h
blob448c158903dda2f483850ff2206d9222759929ab
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
3 // found in the LICENSE file.
5 #ifndef MEDIA_MIDI_MIDI_INPUT_PORT_ANDROID_H_
6 #define MEDIA_MIDI_MIDI_INPUT_PORT_ANDROID_H_
8 #include <jni.h>
10 #include "base/android/scoped_java_ref.h"
11 #include "base/time/time.h"
13 namespace media {
14 namespace midi {
16 class MidiInputPortAndroid final {
17 public:
18 class Delegate {
19 public:
20 virtual ~Delegate() {}
21 virtual void OnReceivedData(MidiInputPortAndroid* port,
22 const uint8* data,
23 size_t size,
24 base::TimeTicks time) = 0;
26 MidiInputPortAndroid(JNIEnv* env, jobject raw, Delegate* delegate);
27 ~MidiInputPortAndroid();
29 // Returns true when the operation succeeds.
30 bool Open();
31 void Close();
33 // Called by the Java world.
34 void OnData(JNIEnv* env,
35 jobject caller,
36 jbyteArray data,
37 jint offset,
38 jint size,
39 jlong timestamp);
41 static bool Register(JNIEnv* env);
43 private:
44 base::android::ScopedJavaGlobalRef<jobject> raw_port_;
45 Delegate* const delegate_;
48 } // namespace midi
49 } // namespace media
51 #endif // MEDIA_MIDI_MIDI_INPUT_PORT_ANDROID_H_