Mercurial > hg > pulseaudio
changeset 87:9a23cb09d073
2008-08-18 Omair Majid <omajid@redhat.com>
* src/java/org/classpath/icedtea/pulseaudio/Stream.java
(native_pa_stream_get_time): New function.
(getTime): Return the time provided by PulseAudio.
* src/native/org_classpath_icedtea_pulseaudio_Stream.c
(Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1get_1time):
New function.
author | Omair Majid <omajid@redhat.com> |
---|---|
date | Mon, 18 Aug 2008 15:53:50 -0400 |
parents | 23ff317f0c99 |
children | 6dd17faac024 |
files | src/java/org/classpath/icedtea/pulseaudio/Stream.java src/native/org_classpath_icedtea_pulseaudio_Stream.c |
diffstat | 2 files changed, 26 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/java/org/classpath/icedtea/pulseaudio/Stream.java Mon Aug 18 15:36:12 2008 -0400 +++ b/src/java/org/classpath/icedtea/pulseaudio/Stream.java Mon Aug 18 15:53:50 2008 -0400 @@ -131,14 +131,11 @@ /* returns an operationPointer */ private native long native_pa_stream_set_name(String name); - /* - * Return the current playback/recording time private native int - * native_pa_stream_get_time (pa_usec_t r_usec); - */ + /* Return the current playback/recording time */ + private native long native_pa_stream_get_time(); /* Return the total stream latency */ - private native long native_pa_stream_get_latency(); - + private native long native_pa_stream_get_latency(); /* * const pa_timing_info * pa_stream_get_timing_info (pa_stream *s) Return @@ -574,14 +571,16 @@ return setNameOperation; } - public long getTimeInMicroseconds() { - return -1; + public long getTime() { + return native_pa_stream_get_time(); } + + /** * @returns the total stream latency in microseconds */ - public long getLatency() { + public long getLatency() { return native_pa_stream_get_latency(); }
--- a/src/native/org_classpath_icedtea_pulseaudio_Stream.c Mon Aug 18 15:36:12 2008 -0400 +++ b/src/native/org_classpath_icedtea_pulseaudio_Stream.c Mon Aug 18 15:53:50 2008 -0400 @@ -565,6 +565,24 @@ /* * Class: org_classpath_icedtea_pulseaudio_Stream + * Method: native_pa_stream_get_time + * Signature: ()J + */ +JNIEXPORT jlong JNICALL Java_org_classpath_icedtea_pulseaudio_Stream_native_1pa_1stream_1get_1time +(JNIEnv* env, jobject obj) { + pa_stream* stream = (pa_stream*)getJavaPointer(env, obj, "streamPointer"); + assert(stream); + + pa_usec_t time = 0; + int result = pa_stream_get_time (stream,&time); + assert(result == 0); + + return time; + +} + +/* + * Class: org_classpath_icedtea_pulseaudio_Stream * Method: native_pa_stream_get_latency * Signature: ()J */