blob: 684fcc680dd372cf97c75cb31e0faf1f2a7ad28c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
// Copyright 2015 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_MIDI_MIDI_INPUT_PORT_ANDROID_H_
#define MEDIA_MIDI_MIDI_INPUT_PORT_ANDROID_H_
#include <jni.h>
#include <stddef.h>
#include <stdint.h>
#include "base/android/scoped_java_ref.h"
#include "base/time/time.h"
namespace media {
namespace midi {
class MidiInputPortAndroid final {
public:
class Delegate {
public:
virtual ~Delegate() {}
virtual void OnReceivedData(MidiInputPortAndroid* port,
const uint8_t* data,
size_t size,
base::TimeTicks time) = 0;
};
MidiInputPortAndroid(JNIEnv* env, jobject raw, Delegate* delegate);
~MidiInputPortAndroid();
// Returns true when the operation succeeds.
bool Open();
void Close();
// Called by the Java world.
void OnData(JNIEnv* env,
const base::android::JavaParamRef<jobject>& caller,
const base::android::JavaParamRef<jbyteArray>& data,
jint offset,
jint size,
jlong timestamp);
static bool Register(JNIEnv* env);
private:
base::android::ScopedJavaGlobalRef<jobject> raw_port_;
Delegate* const delegate_;
};
} // namespace midi
} // namespace media
#endif // MEDIA_MIDI_MIDI_INPUT_PORT_ANDROID_H_
|