diff options
author | Sven Gothel <[email protected]> | 2023-10-06 12:21:08 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-10-06 12:21:08 +0200 |
commit | dbd0236203f3d969575e62097f42a2a86e2a36ae (patch) | |
tree | 02ac1a1d9f3aa4a398c96fead906ebd2559d3ac5 | |
parent | 8376f21f2b6f25f3fc8ff2688ef49a2e9c91f966 (diff) |
AudioSink: Rename getQueued{Time->Duration}(), add updateQueue()
-rw-r--r-- | src/java/com/jogamp/common/av/AudioSink.java | 16 | ||||
-rw-r--r-- | src/java/jogamp/common/av/JavaSoundAudioSink.java | 5 | ||||
-rw-r--r-- | src/java/jogamp/common/av/NullAudioSink.java | 5 |
3 files changed, 22 insertions, 4 deletions
diff --git a/src/java/com/jogamp/common/av/AudioSink.java b/src/java/com/jogamp/common/av/AudioSink.java index f3ed5a8..6f36e6f 100644 --- a/src/java/com/jogamp/common/av/AudioSink.java +++ b/src/java/com/jogamp/common/av/AudioSink.java @@ -392,12 +392,12 @@ public interface AudioSink { * </p> * @see #init(AudioFormat, float, int) */ - public float getQueuedTime(); + public float getQueuedDuration(); /** * Returns average frame duration last assessed @ {@link #enqueueData(int, ByteBuffer, int)} when queue was full. * <pre> - * avgFrameDuration = {@link #getQueuedTime()} / {@link #getQueuedFrameCount()} + * avgFrameDuration = {@link #getQueuedDuration()} / {@link #getQueuedFrameCount()} * </pre> */ public float getAvgFrameDuration(); @@ -446,4 +446,16 @@ public interface AudioSink { * @see #init(AudioFormat, float, int) */ public AudioFrame enqueueData(int pts, ByteBuffer bytes, int byteCount); + + /** + * Update queue beyond {@link #enqueueData(int, ByteBuffer, int)} including audio PTS. + * <p> + * Useful in case implementation only updates the buffer passively via {@link #enqueueData(int, ByteBuffer, int) enqueueing data} + * to add new data to the queue and not on a event basis. + * </p> + * @return the updated current audio PTS + * @see #getPTS() + * @see #enqueueData(int, ByteBuffer, int) + */ + public int updateQueue(); } diff --git a/src/java/jogamp/common/av/JavaSoundAudioSink.java b/src/java/jogamp/common/av/JavaSoundAudioSink.java index 94ad236..556ada4 100644 --- a/src/java/jogamp/common/av/JavaSoundAudioSink.java +++ b/src/java/jogamp/common/av/JavaSoundAudioSink.java @@ -305,7 +305,7 @@ public final class JavaSoundAudioSink implements AudioSink { } @Override - public float getQueuedTime() { + public float getQueuedDuration() { return chosenFormat.getBytesDuration( getQueuedByteCount() ); } @@ -318,6 +318,9 @@ public final class JavaSoundAudioSink implements AudioSink { public final int getPTS() { return 0; } // FIXME @Override + public final int updateQueue() { return 0; } // FIXME + + @Override public int getLastBufferedPTS() { return 0; } // FIXME } diff --git a/src/java/jogamp/common/av/NullAudioSink.java b/src/java/jogamp/common/av/NullAudioSink.java index 0626ca8..d38c040 100644 --- a/src/java/jogamp/common/av/NullAudioSink.java +++ b/src/java/jogamp/common/av/NullAudioSink.java @@ -174,7 +174,7 @@ public final class NullAudioSink implements AudioSink { public int getQueuedByteCount() { return 0; } @Override - public float getQueuedTime() { return 0f; } + public float getQueuedDuration() { return 0f; } @Override public float getAvgFrameDuration() { return 0f; } @@ -183,6 +183,9 @@ public final class NullAudioSink implements AudioSink { public final int getPTS() { return playingPTS; } @Override + public final int updateQueue() { return playingPTS; } + + @Override public int getLastBufferedPTS() { return 0; } @Override |