From e23a4c7fcc0b585c0708be114fa364e391da4843 Mon Sep 17 00:00:00 2001
From: Sven Gothel
* May return {@link AudioSink#DefaultFormat} if undefined.
*
- * Must be set before {@link #getPreferredFormat()}, {@link #isSupported(AudioFormat)} and naturally {@link #init(AudioFormat, int, int, int, int)}. + * Must be set before {@link #getPreferredFormat()}, {@link #isSupported(AudioFormat)} and naturally {@link #init(AudioFormat, int, int)}. *
** May be utilized to enforce 1 channel (mono) downsampling @@ -270,7 +266,7 @@ public interface AudioSink { * @see #getNativeFormat() * @see #getPreferredFormat() * @see #isSupported(AudioFormat) - * @see #init(AudioFormat, int, int, int, int) + * @see #init(AudioFormat, int, int) */ public void setChannelLimit(final int cc); @@ -279,7 +275,7 @@ public interface AudioSink { *
* The {@link #getPreferredFormat()} is used to validate compatibility with the given format. *
- * @see #init(AudioFormat, float, int, int, int) + * @see #init(AudioFormat, float, int) * @see #getPreferredFormat() */ public boolean isSupported(AudioFormat format); @@ -296,35 +292,28 @@ public interface AudioSink { * * @param requestedFormat the requested {@link AudioFormat}. * @param frameDurationHint average {@link AudioFrame} duration hint in milliseconds. - * May assist to shape the {@link AudioFrame} initial queue size using `initialQueueSize`. * May assist to adjust latency of the backend, as currently used for JOAL's ALAudioSink. * A value below 30ms or {@link #DefaultFrameDuration} may increase the audio processing load. * Assumed as {@link #DefaultFrameDuration}, ifframeDuration < 1 ms
.
- * @param initialQueueSize initial queue size in milliseconds, see {@link #DefaultInitialQueueSize}.
- * May use `frameDurationHint` to determine initial {@link AudioFrame} queue size.
- * @param queueGrowAmount queue grow size in milliseconds if queue is full, see {@link #DefaultQueueGrowAmount}.
- * May use {@link #getAvgFrameDuration()} to determine {@link AudioFrame} queue growth amount.
- * @param queueLimit maximum time in milliseconds the queue can hold (and grow), see {@link #DefaultQueueLimitWithVideo} and {@link #DefaultQueueLimitAudioOnly}.
- * May use {@link #getAvgFrameDuration()} to determine {@link AudioFrame} queue limit.
+ * @param queueSize queue size in milliseconds, see {@link #DefaultQueueSize}.
* @return true if successful, otherwise false
* @see #enqueueData(int, ByteBuffer, int)
* @see #getAvgFrameDuration()
*/
- public boolean init(AudioFormat requestedFormat, int frameDurationHint,
- int initialQueueSize, int queueGrowAmount, int queueLimit);
+ public boolean init(AudioFormat requestedFormat, int frameDurationHint, int queueSize);
/**
- * Returns the {@link AudioFormat} as chosen by {@link #init(AudioFormat, float, int, int, int)},
+ * Returns the {@link AudioFormat} as chosen by {@link #init(AudioFormat, float, int)},
* i.e. it shall match the requestedFormat.
*/
public AudioFormat getChosenFormat();
/**
- * Returns the (minimum) latency in seconds of this sink as set by {@link #init(AudioFormat, float, int, int, int)}, see {@link #getDefaultLatency()}.
+ * Returns the (minimum) latency in seconds of this sink as set by {@link #init(AudioFormat, float, int)}, see {@link #getDefaultLatency()}.
* * Latency might be the reciprocal mixer-refresh-interval [Hz], e.g. 50 Hz refresh-rate = 20ms minimum latency. *
- * @see #init(AudioFormat, float, int, int, int) + * @see #init(AudioFormat, float, int) */ public float getLatency(); @@ -353,12 +342,12 @@ public interface AudioSink { /** * Flush all queued buffers, implies {@link #pause()}. *- * {@link #init(AudioFormat, float, int, int, int)} must be called first. + * {@link #init(AudioFormat, float, int)} must be called first. *
* @see #play() * @see #pause() * @see #enqueueData(AudioFrame) - * @see #init(AudioFormat, float, int, int, int) + * @see #init(AudioFormat, float, int) */ public void flush(); @@ -367,41 +356,41 @@ public interface AudioSink { /** * Returns the number of allocated buffers as requested by - * {@link #init(AudioFormat, float, int, int, int)}. - * @see #init(AudioFormat, float, int, int, int) + * {@link #init(AudioFormat, float, int)}. + * @see #init(AudioFormat, float, int) */ public int getFrameCount(); /** - * Returns the current enqueued frames count since {@link #init(AudioFormat, float, int, int, int)}. - * @see #init(AudioFormat, float, int, int, int) + * Returns the current enqueued frames count since {@link #init(AudioFormat, float, int)}. + * @see #init(AudioFormat, float, int) */ public int getEnqueuedFrameCount(); /** * Returns the current number of frames queued for playing. *- * {@link #init(AudioFormat, float, int, int, int)} must be called first. + * {@link #init(AudioFormat, float, int)} must be called first. *
- * @see #init(AudioFormat, float, int, int, int) + * @see #init(AudioFormat, float, int) */ public int getQueuedFrameCount(); /** * Returns the current number of bytes queued for playing. *- * {@link #init(AudioFormat, float, int, int, int)} must be called first. + * {@link #init(AudioFormat, float, int)} must be called first. *
- * @see #init(AudioFormat, float, int, int, int) + * @see #init(AudioFormat, float, int) */ public int getQueuedByteCount(); /** * Returns the current queued frame time in seconds for playing. *- * {@link #init(AudioFormat, float, int, int, int)} must be called first. + * {@link #init(AudioFormat, float, int)} must be called first. *
- * @see #init(AudioFormat, float, int, int, int) + * @see #init(AudioFormat, float, int) */ public float getQueuedTime(); @@ -418,27 +407,32 @@ public interface AudioSink { */ public int getPTS(); + /** + * Return the last buffered audio presentation timestamp (PTS) in milliseconds. + */ + public int getLastBufferedPTS(); + /** * Returns the current number of frames in the sink available for writing. *- * {@link #init(AudioFormat, float, int, int, int)} must be called first. + * {@link #init(AudioFormat, float, int)} must be called first. *
- * @see #init(AudioFormat, float, int, int, int) + * @see #init(AudioFormat, float, int) */ public int getFreeFrameCount(); /** * EnqueuebyteCount
bytes as a new {@link AudioFrame} to this sink.
* - * The data must comply with the chosen {@link AudioFormat} as set via {@link #init(AudioFormat, float, int, int, int)}. + * The data must comply with the chosen {@link AudioFormat} as set via {@link #init(AudioFormat, float, int)}. *
*- * {@link #init(AudioFormat, float, int, int, int)} must be called first. + * {@link #init(AudioFormat, float, int)} must be called first. *
* @param pts presentation time stamp in milliseconds for the newly enqueued {@link AudioFrame} * @param bytes audio data for the newly enqueued {@link AudioFrame} * @returns the enqueued internal {@link AudioFrame}. - * @see #init(AudioFormat, float, int, int, int) + * @see #init(AudioFormat, float, int) */ public AudioFrame enqueueData(int pts, ByteBuffer bytes, int byteCount); } diff --git a/src/java/jogamp/common/av/JavaSoundAudioSink.java b/src/java/jogamp/common/av/JavaSoundAudioSink.java index 58f0fec..94ad236 100644 --- a/src/java/jogamp/common/av/JavaSoundAudioSink.java +++ b/src/java/jogamp/common/av/JavaSoundAudioSink.java @@ -179,7 +179,7 @@ public final class JavaSoundAudioSink implements AudioSink { } @Override - public boolean init(final AudioFormat requestedFormat, final int frameDuration, final int initialQueueSize, final int queueGrowAmount, final int queueLimit) { + public boolean init(final AudioFormat requestedFormat, final int frameDuration, final int queueSize) { if( !staticAvailable ) { return false; } @@ -317,4 +317,7 @@ public final class JavaSoundAudioSink implements AudioSink { @Override public final int getPTS() { 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 904b863..0626ca8 100644 --- a/src/java/jogamp/common/av/NullAudioSink.java +++ b/src/java/jogamp/common/av/NullAudioSink.java @@ -127,7 +127,7 @@ public final class NullAudioSink implements AudioSink { } @Override - public boolean init(final AudioFormat requestedFormat, final int frameDuration, final int initialQueueSize, final int queueGrowAmount, final int queueLimit) { + public boolean init(final AudioFormat requestedFormat, final int frameDuration, final int queueSize) { chosenFormat = requestedFormat; return true; } @@ -153,8 +153,7 @@ public final class NullAudioSink implements AudioSink { } @Override - public void flush() { - } + public void flush() { } @Override public void destroy() { @@ -163,42 +162,31 @@ public final class NullAudioSink implements AudioSink { } @Override - public final int getEnqueuedFrameCount() { - return 0; - } + public final int getEnqueuedFrameCount() { return 0; } @Override - public int getFrameCount() { - return 0; - } + public int getFrameCount() { return 0; } @Override - public int getQueuedFrameCount() { - return 0; - } + public int getQueuedFrameCount() { return 0; } @Override - public int getQueuedByteCount() { - return 0; - } + public int getQueuedByteCount() { return 0; } @Override - public float getQueuedTime() { - return 0f; - } + public float getQueuedTime() { return 0f; } @Override - public float getAvgFrameDuration() { - return 0f; - } + public float getAvgFrameDuration() { return 0f; } @Override public final int getPTS() { return playingPTS; } @Override - public int getFreeFrameCount() { - return 1; - } + public int getLastBufferedPTS() { return 0; } + + @Override + public int getFreeFrameCount() { return 1; } @Override public AudioFrame enqueueData(final int pts, final ByteBuffer bytes, final int byteCount) { -- cgit v1.2.3