
public class MediaAudioResampler extends MediaResampler
MediaResampler.State| Modifier and Type | Method and Description |
|---|---|
MediaAudioResampler |
copyReference()
Create a new MediaAudioResampler object that is actually referring to the
exact same underlying native object.
|
int |
dropOutput(int count)
Set a customized input channel mapping.
|
boolean |
equals(Object obj)
Compares two values, returning true if the underlying objects in native code are the same object.
|
long |
getDelay(long base)
Gets the delay the next input sample will experience relative to the next output sample.
The resampler can buffer data if more input has been provided than available output space, also converting between sample rates needs a delay. This function returns the sum of all such delays. The exact delay is not necessarily an integer value in either input or output sample rate. |
int |
getInputChannels()
Get number of input channels (derived from #getInputLayout()).
|
AudioFormat.Type |
getInputFormat()
Get input audio format.
|
AudioChannel.Layout |
getInputLayout()
Get input channel layout.
|
int |
getInputSampleRate()
Get input sample rate.
|
long |
getNextPts(long pts)
Convert the next timestamp from input to output
timestamps are in 1/(in_sample_rate * out_sample_rate) units. Note: There are 2 slightly differently behaving modes. First is when automatic timestamp compensation is not used, (min_compensation >= FLT_MAX) in this case timestamps will be passed through with delays compensated Second is when automatic timestamp compensation is used, (min_compensation < FLT_MAX) in this case the output timestamps will match output sample numbers |
int |
getNumResampledSamples(int numSamples)
Returns the number of resampled samples (rounded up) that would
be required when resampling a given number of samples. That was a mouthful, yes? So here's the way to think of this. |
int |
getOutputChannels()
Get number of output channels (derived from #getOutputLayout()).
|
AudioFormat.Type |
getOutputFormat()
Get output audio format.
|
AudioChannel.Layout |
getOutputLayout()
Get output channel layout.
|
int |
getOutputSampleRate()
Get output sample rate.
|
MediaResampler.State |
getState() |
Rational |
getTimeBase()
Get the timebase used when outputting time stamps for audio.
Defaults to 1 / (the lowest common multiple of getInputSampleRate() and getOutputSampleRate()) in order to ensure that no rounding of time stamps occur. For example, if the input sample rate is 22050 and the output sample rate is 44100, then the output time base will be (1/44100). |
int |
hashCode()
Get a hashable value for this object.
|
int |
injectSilence(int count)
Injects the specified number of silence samples.
|
static MediaAudioResampler |
make(AudioChannel.Layout outLayout,
int outSampleRate,
AudioFormat.Type outFormat,
AudioChannel.Layout inLayout,
int inSampleRate,
AudioFormat.Type inFormat)
Create a new MediaAudioResampler.
|
void |
open()
Opens the resampler so it can be ready for resampling.
You should NOT set options after you open this object. |
int |
resample(MediaSampled out,
MediaSampled in)
Convert audio.
in can be set to null to flush the last few samples out at the end. If more input is provided than output space then the input will be buffered. You can avoid this buffering by providing more output space than input. Conversion will run directly without copying whenever possible. |
int |
resampleAudio(MediaAudio out,
MediaAudio in) |
void |
setCompensation(int sample_delta,
int compensation_distance)
Activate resampling compensation.
|
void |
setTimeBase(Rational rational)
Set the timebase to use for timestamps on output audio.
|
getNumProperties, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsInt, getPropertyAsLong, getPropertyAsRational, getPropertyAsString, getPropertyMetaData, getPropertyMetaData, setProperty, setProperty, setProperty, setProperty, setProperty, setPropertydelete, getCurrentRefCountpublic MediaAudioResampler copyReference()
copyReference in class MediaResamplerpublic boolean equals(Object obj)
equals in class MediaResamplerpublic int hashCode()
hashCode in class MediaResamplerpublic static MediaAudioResampler make(AudioChannel.Layout outLayout, int outSampleRate, AudioFormat.Type outFormat, AudioChannel.Layout inLayout, int inSampleRate, AudioFormat.Type inFormat)
public AudioChannel.Layout getOutputLayout()
public AudioChannel.Layout getInputLayout()
public int getOutputSampleRate()
public int getInputSampleRate()
public AudioFormat.Type getOutputFormat()
public AudioFormat.Type getInputFormat()
public int getInputChannels()
public int getOutputChannels()
public void open()
public int resample(MediaSampled out, MediaSampled in)
resample in class MediaResamplerout - output audio object. caller is responsible for making the correct size.in - input audio.RuntimeError - if we get an error or InvalidArgument if the attributes ofpublic int resampleAudio(MediaAudio out, MediaAudio in)
public long getNextPts(long pts)
pts - timestamp for the next input sample, INT64_MIN if unknownpublic void setCompensation(int sample_delta,
int compensation_distance)
public int dropOutput(int count)
public int injectSilence(int count)
public long getDelay(long base)
base - timebase in which the returned delay will bepublic int getNumResampledSamples(int numSamples)
getNumResampledSamples(24000) would return 11025 if the inputpublic Rational getTimeBase()
public void setTimeBase(Rational rational)
InvalidArgument - if null.public MediaResampler.State getState()
getState in class MediaResamplerCopyright © 2018 Humble Software. All rights reserved.