android: add next and previous track to the jni bridge
This will allow the android client to directly make calls to the mpd process to change tracks I went with camel case on the function names here, if you use an underscore javac generates a function tht looks like this: JNIEXPORT void JNICALL Java_org_musicpd_Bridge_play_1previous I figured what we ended up with looks a little nicer: JNIEXPORT void JNICALL Java_org_musicpd_Bridge_playPrevious
This commit is contained in:
parent
468eceabff
commit
e086f09d48
|
@ -18,4 +18,6 @@ public class Bridge {
|
||||||
public static native void run(Context context, LogListener logListener);
|
public static native void run(Context context, LogListener logListener);
|
||||||
public static native void shutdown();
|
public static native void shutdown();
|
||||||
public static native void pause();
|
public static native void pause();
|
||||||
|
public static native void playNext();
|
||||||
|
public static native void playPrevious();
|
||||||
}
|
}
|
||||||
|
|
22
src/Main.cxx
22
src/Main.cxx
|
@ -614,6 +614,28 @@ Java_org_musicpd_Bridge_pause(JNIEnv *, jclass)
|
||||||
partition.pc.LockSetPause(true);
|
partition.pc.LockSetPause(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gcc_visibility_default
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_org_musicpd_Bridge_playNext(JNIEnv *, jclass)
|
||||||
|
{
|
||||||
|
if (global_instance != nullptr)
|
||||||
|
BlockingCall(global_instance->event_loop, [&](){
|
||||||
|
for (auto &partition : global_instance->partitions)
|
||||||
|
partition.PlayNext();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
gcc_visibility_default
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_org_musicpd_Bridge_playPrevious(JNIEnv *, jclass)
|
||||||
|
{
|
||||||
|
if (global_instance != nullptr)
|
||||||
|
BlockingCall(global_instance->event_loop, [&](){
|
||||||
|
for (auto &partition : global_instance->partitions)
|
||||||
|
partition.PlayPrevious();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
|
Loading…
Reference in New Issue