|
AVPKit
|


Public Member Functions | |
| virtual int64_t | getTimeStamp () |
| Get the time stamp of this object in getTimeBase() units. More... | |
| virtual void | setTimeStamp (int64_t aTimeStamp) |
| Set the time stamp for this object in getTimeBase() units. More... | |
| virtual IRational * | getTimeBase () |
| Get the time base that time stamps of this object are represented in. More... | |
| virtual void | setTimeBase (IRational *aBase) |
| Set the time base that time stamps of this object are represented in. More... | |
| virtual int32_t | getSize () |
| Get the size in bytes of the raw data available for this object. More... | |
| virtual bool | isKey () |
| Is this object a key object? i.e. More... | |
| virtual bool | isComplete () |
| Returns whether or not we think this buffer has been filled with data. More... | |
| virtual int32_t | getSampleRate () |
| Find the sample rate of the samples in this audio buffer. More... | |
| virtual int32_t | getChannels () |
| Return the number of channels of the samples in this buffer. More... | |
| virtual IAudioSamples::ChannelLayout | getChannelLayout () |
| virtual Format | getFormat () |
| Find the Format of the samples in this buffer. More... | |
| virtual int32_t | getSampleBitDepth () |
| Find out the bit-depth of the samples in this buffer. More... | |
| virtual int32_t | getNumSamples () |
| Get the number of samples in this video. More... | |
| virtual int32_t | getMaxBufferSize () |
| virtual int32_t | getSampleSize () |
| virtual int32_t | getMaxSamples () |
| virtual com::avpkit::ferry::IBuffer * | getData () |
| Get any underlying raw data available for this object. More... | |
| virtual int64_t | getPts () |
| What is the Presentation Time Stamp of this set of audio samples. More... | |
| virtual void | setPts (int64_t aValue) |
| Set the Presentation Time Stamp for this set of samples. More... | |
| virtual int64_t | getNextPts () |
| What would be the next Presentation Time Stamp after all the samples in this buffer were played? More... | |
| virtual int32_t | setSample (int32_t sampleIndex, int32_t channel, Format format, int32_t sample) |
| Sets the sample at the given index and channel to the sample. More... | |
| virtual int32_t | getSample (int32_t sampleIndex, int32_t channel, Format format) |
| Get the sample at the given sampleIndex and channel, and return it in the asked for format. More... | |
| virtual void | setData (com::avpkit::ferry::IBuffer *buffer) |
| Sets the underlying buffer used by this object. More... | |
| virtual void | setComplete (bool complete, int32_t numSamples, int32_t sampleRate, int32_t channels, Format sampleFmt, int64_t pts) |
| Call this if you modify the samples and are now done. More... | |
| virtual void | setComplete (bool complete, int32_t numSamples, int32_t sampleRate, int32_t channels, ChannelLayout channelLayout, Format format, int64_t pts) |
| virtual short * | getRawSamples (uint32_t startingSample) |
| virtual int32_t | ensureCapacity (int32_t capacityInBytes) |
| Called by decoder before decoding to ensure sufficient space. | |
Public Member Functions inherited from com::avpkit::ferry::RefCounted | |
| virtual int32_t | acquire () |
| Internal Only. More... | |
| virtual int32_t | release () |
| Internal Only. More... | |
| virtual RefCounted * | copyReference () |
| Create a new Java object that refers to the same native object. More... | |
| virtual int32_t | getCurrentRefCount () |
| Return the current reference count on this object. More... | |
| void | setJavaAllocator (void *allocator) |
| This method is public but not part of the standard API. More... | |
| void * | getJavaAllocator () |
| This method is public but not part of the standard API. More... | |
Static Public Member Functions | |
| static AudioSamples * | make (int32_t numSamples, int32_t numChannels) |
| static AudioSamples * | make (int32_t numSamples, int32_t numChannels, IAudioSamples::Format) |
| static AudioSamples * | make (com::avpkit::ferry::IBuffer *buffer, int32_t channels, IAudioSamples::Format format) |
Static Public Member Functions inherited from com::avpkit::core::IAudioSamples | |
| static int32_t | findSampleBitDepth (Format format) |
| A convenience method that returns the # of bits in a given format. More... | |
| static IAudioSamples * | make (int32_t numSamples, int32_t numChannels) |
| Get a new audio samples buffer. More... | |
| static int64_t | samplesToDefaultPts (int64_t samples, int sampleRate) |
| Converts a number of samples at a given sampleRate into Microseconds. More... | |
| static int64_t | defaultPtsToSamples (int64_t duration, int sampleRate) |
| Converts a duration in microseconds into a number of samples, assuming a given sampleRate. More... | |
| static IAudioSamples * | make (com::avpkit::ferry::IBuffer *buffer, int channels, IAudioSamples::Format format) |
| Creates an IAudioSamples object by wrapping an object. More... | |
| static IAudioSamples * | make (int32_t numSamples, int32_t numChannels, IAudioSamples::Format format) |
| Get a new audio samples buffer. More... | |
Additional Inherited Members | |
Public Types inherited from com::avpkit::core::IAudioSamples | |
| enum | Format { FMT_NONE = -1 , FMT_U8 , FMT_S16 , FMT_S32 , FMT_FLT , FMT_DBL , FMT_U8P , FMT_S16P , FMT_S32P , FMT_FLTP , FMT_DBLP } |
| The format we use to represent audio. More... | |
| enum class | ChannelLayout : uint64_t { CH_NONE = 0 , CH_FRONT_LEFT = 0x00000001 , CH_FRONT_RIGHT = 0x00000002 , CH_FRONT_CENTER = 0x00000004 , CH_LOW_FREQUENCY = 0x00000008 , CH_BACK_LEFT = 0x00000010 , CH_BACK_RIGHT = 0x00000020 , CH_FRONT_LEFT_OF_CENTER = 0x00000040 , CH_FRONT_RIGHT_OF_CENTER = 0x00000080 , CH_BACK_CENTER = 0x00000100 , CH_SIDE_LEFT = 0x00000200 , CH_SIDE_RIGHT = 0x00000400 , CH_TOP_CENTER = 0x00000800 , CH_TOP_FRONT_LEFT = 0x00001000 , CH_TOP_FRONT_CENTER = 0x00002000 , CH_TOP_FRONT_RIGHT = 0x00004000 , CH_TOP_BACK_LEFT = 0x00008000 , CH_TOP_BACK_CENTER = 0x00010000 , CH_TOP_BACK_RIGHT = 0x00020000 , CH_STEREO_LEFT = 0x20000000 , CH_STEREO_RIGHT = 0x40000000 , CH_WIDE_LEFT = 0x0000000080000000ULL , CH_WIDE_RIGHT = 0x0000000100000000ULL , CH_SURROUND_DIRECT_LEFT = 0x0000000200000000ULL , CH_SURROUND_DIRECT_RIGHT = 0x0000000400000000ULL , CH_LOW_FREQUENCY_2 = 0x0000000800000000ULL , CH_LAYOUT_NATIVE = 0x8000000000000000ULL , , channel_mask_c , CH_LAYOUT_MONO = (CH_FRONT_CENTER) , CH_LAYOUT_STEREO = (CH_FRONT_LEFT|CH_FRONT_RIGHT) , CH_LAYOUT_2POINT1 = (CH_LAYOUT_STEREO|CH_LOW_FREQUENCY) , CH_LAYOUT_2_1 = (CH_LAYOUT_STEREO|CH_BACK_CENTER) , CH_LAYOUT_SURROUND = (CH_LAYOUT_STEREO|CH_FRONT_CENTER) , CH_LAYOUT_3POINT1 = (CH_LAYOUT_SURROUND|CH_LOW_FREQUENCY) , CH_LAYOUT_4POINT0 = (CH_LAYOUT_SURROUND|CH_BACK_CENTER) , CH_LAYOUT_4POINT1 = (CH_LAYOUT_4POINT0|CH_LOW_FREQUENCY) , CH_LAYOUT_2_2 = (CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_SIDE_RIGHT) , CH_LAYOUT_QUAD = (CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT) , CH_LAYOUT_5POINT0 = (CH_LAYOUT_SURROUND|CH_SIDE_LEFT|CH_SIDE_RIGHT) , CH_LAYOUT_5POINT1 = (CH_LAYOUT_5POINT0|CH_LOW_FREQUENCY) , CH_LAYOUT_5POINT0_BACK = (CH_LAYOUT_SURROUND|CH_BACK_LEFT|CH_BACK_RIGHT) , CH_LAYOUT_5POINT1_BACK = (CH_LAYOUT_5POINT0_BACK|CH_LOW_FREQUENCY) , CH_LAYOUT_6POINT0 = (CH_LAYOUT_5POINT0|CH_BACK_CENTER) , CH_LAYOUT_6POINT0_FRONT = (CH_LAYOUT_2_2|CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER) , CH_LAYOUT_HEXAGONAL = (CH_LAYOUT_5POINT0_BACK|CH_BACK_CENTER) , CH_LAYOUT_6POINT1 = (CH_LAYOUT_5POINT1|CH_BACK_CENTER) , CH_LAYOUT_6POINT1_BACK = (CH_LAYOUT_5POINT1_BACK|CH_BACK_CENTER) , CH_LAYOUT_6POINT1_FRONT = (CH_LAYOUT_6POINT0_FRONT|CH_LOW_FREQUENCY) , CH_LAYOUT_7POINT0 = (CH_LAYOUT_5POINT0|CH_BACK_LEFT|CH_BACK_RIGHT) , CH_LAYOUT_7POINT0_FRONT = (CH_LAYOUT_5POINT0|CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER) , CH_LAYOUT_7POINT1 = (CH_LAYOUT_5POINT1|CH_BACK_LEFT|CH_BACK_RIGHT) , CH_LAYOUT_7POINT1_WIDE = (CH_LAYOUT_5POINT1|CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER) , CH_LAYOUT_7POINT1_WIDE_BACK = (CH_LAYOUT_5POINT1_BACK|CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER) , CH_LAYOUT_OCTAGONAL = (CH_LAYOUT_5POINT0|CH_BACK_LEFT|CH_BACK_CENTER|CH_BACK_RIGHT) , CH_LAYOUT_HEXADECAGONAL = (CH_LAYOUT_OCTAGONAL|CH_WIDE_LEFT|CH_WIDE_RIGHT|CH_TOP_BACK_LEFT|CH_TOP_BACK_RIGHT|CH_TOP_BACK_CENTER|CH_TOP_FRONT_CENTER|CH_TOP_FRONT_LEFT|CH_TOP_FRONT_RIGHT) , CH_LAYOUT_STEREO_DOWNMIX = (CH_STEREO_LEFT|CH_STEREO_RIGHT) } |
| typedef enum com::avpkit::core::IAudioSamples::Format | Format |
| The format we use to represent audio. More... | |
Protected Member Functions inherited from com::avpkit::ferry::RefCounted | |
| virtual void | destroy () |
| This method is called by RefCounted objects when their Ref Count reaches zero and they are about to be destroyed. | |
Protected Attributes inherited from com::avpkit::ferry::RefCounted | |
| AtomicInteger * | mRefCount |
| This is the internal reference count, represented as an AtomicInteger to make sure it is thread safe. | |
| void * | mAllocator |
| Not part of public API. | |
Definition at line 32 of file AudioSamples.h.
|
virtual |
Return the number of channels of the samples in this buffer.
For example, 1 is mono, 2 is stereo.
Implements com::avpkit::core::IAudioSamples.
Definition at line 215 of file AudioSamples.cpp.
Referenced by com::avpkit::core::BufferSource::addAudioSamples(), com::avpkit::core::StreamCoder::encodeAudio(), com::avpkit::core::BufferSink::fillAudioSamples(), and com::avpkit::core::AudioResampler::resample().
|
virtual |
Get any underlying raw data available for this object.
Implements com::avpkit::core::IMediaData.
Definition at line 257 of file AudioSamples.cpp.
|
virtual |
Find the Format of the samples in this buffer.
Right now only FMT_S16 is supported.
Implements com::avpkit::core::IAudioSamples.
Definition at line 203 of file AudioSamples.cpp.
Referenced by com::avpkit::core::BufferSource::addAudioSamples(), and com::avpkit::core::AudioResampler::resample().
|
virtual |
Implements com::avpkit::core::IAudioSamples.
Definition at line 234 of file AudioSamples.cpp.
Referenced by com::avpkit::core::StreamCoder::decodeAudio(), and com::avpkit::core::AudioResampler::resample().
|
virtual |
Implements com::avpkit::core::IAudioSamples.
Definition at line 267 of file AudioSamples.cpp.
|
virtual |
What would be the next Presentation Time Stamp after all the samples in this buffer were played?
Implements com::avpkit::core::IAudioSamples.
Definition at line 329 of file AudioSamples.cpp.
References com::avpkit::core::Global::NO_PTS, and com::avpkit::core::IAudioSamples::samplesToDefaultPts().
|
virtual |
Get the number of samples in this video.
For example, if you have 100 bytes of stereo (2-channel) 16-bit audio in this buffer, there are 25 samples. If you have 100 bytes of mono (1-channel) 16-bit audio in this buffer, you have 50 samples.
Implements com::avpkit::core::IAudioSamples.
Definition at line 228 of file AudioSamples.cpp.
Referenced by com::avpkit::core::BufferSource::addAudioSamples(), com::avpkit::core::StreamCoder::encodeAudio(), getSize(), and com::avpkit::core::AudioResampler::resample().
|
virtual |
What is the Presentation Time Stamp of this set of audio samples.
Implements com::avpkit::core::IAudioSamples.
Definition at line 317 of file AudioSamples.cpp.
Referenced by com::avpkit::core::BufferSource::addAudioSamples(), com::avpkit::core::StreamCoder::encodeAudio(), getTimeStamp(), and com::avpkit::core::AudioResampler::resample().
|
virtual |
Get the sample at the given sampleIndex and channel, and return it in the asked for format.
| sampleIndex | The zero-based index into this set of samples. |
| channel | The zero-based channel to get the sample from |
| format | The format to return in |
Implements com::avpkit::core::IAudioSamples.
Definition at line 366 of file AudioSamples.cpp.
|
virtual |
Find out the bit-depth of the samples in this buffer.
Implements com::avpkit::core::IAudioSamples.
Definition at line 241 of file AudioSamples.cpp.
References com::avpkit::core::IAudioSamples::findSampleBitDepth().
Referenced by com::avpkit::core::AudioResampler::resample().
|
virtual |
Find the sample rate of the samples in this audio buffer.
Implements com::avpkit::core::IAudioSamples.
Definition at line 209 of file AudioSamples.cpp.
Referenced by com::avpkit::core::BufferSource::addAudioSamples(), com::avpkit::core::StreamCoder::encodeAudio(), com::avpkit::core::BufferSink::fillAudioSamples(), and com::avpkit::core::AudioResampler::resample().
|
virtual |
Implements com::avpkit::core::IAudioSamples.
Definition at line 247 of file AudioSamples.cpp.
Referenced by com::avpkit::core::StreamCoder::encodeAudio(), and getSize().
|
inlinevirtual |
Get the size in bytes of the raw data available for this object.
Implements com::avpkit::core::IMediaData.
Definition at line 41 of file AudioSamples.h.
References getNumSamples(), and getSampleSize().
|
inlinevirtual |
Get the time base that time stamps of this object are represented in.
Caller must release the returned value.
Implements com::avpkit::core::IMediaData.
Definition at line 39 of file AudioSamples.h.
Referenced by com::avpkit::core::BufferSource::addAudioSamples(), and com::avpkit::core::BufferSink::fillAudioSamples().
|
inlinevirtual |
Get the time stamp of this object in getTimeBase() units.
Implements com::avpkit::core::IMediaData.
Definition at line 37 of file AudioSamples.h.
References getPts().
Referenced by com::avpkit::core::StreamCoder::encodeAudio().
|
virtual |
Returns whether or not we think this buffer has been filled with data.
Implements com::avpkit::core::IAudioSamples.
Definition at line 197 of file AudioSamples.cpp.
Referenced by com::avpkit::core::StreamCoder::encodeAudio(), and com::avpkit::core::AudioResampler::resample().
|
inlinevirtual |
Is this object a key object? i.e.
it can be interpreted without needing any other media objects
Implements com::avpkit::core::IMediaData.
Definition at line 42 of file AudioSamples.h.
|
virtual |
Call this if you modify the samples and are now done.
This updates the pertinent information in the structure.
| complete | Is this set of samples complete? |
| numSamples | Number of samples in this update (note that 4 shorts of 16-bit audio in stereo is actually 1 sample). |
| sampleRate | The sample rate (in Hz) of this set of samples. |
| channels | The number of channels in this set of samples. |
| format | The sample-format of this set of samples. |
| pts | The presentation time stamp of the starting sample in this buffer. Caller must ensure pts is in units of 1/1,000,000 of a second |
Implements com::avpkit::core::IAudioSamples.
Definition at line 273 of file AudioSamples.cpp.
Referenced by com::avpkit::core::StreamCoder::decodeAudio(), com::avpkit::core::BufferSink::fillAudioSamples(), and com::avpkit::core::AudioResampler::resample().
|
virtual |
Sets the underlying buffer used by this object.
This is an advanced method and is not recommended for use by those who don't fully understand how IBuffers work. Implementations of IMediaData may behave in undefined ways if the buffer you pass in is not big enough for what you ask them to do (e.g. they may discard your buffer and allocate a larger one if they need more space). It is up to the caller to ensure the buffer passed in is large enough, and is not simultaneously in use by another part of the system.
| buffer | The buffer to set. If null, this method is ignored. |
Implements com::avpkit::core::IMediaData.
Definition at line 189 of file AudioSamples.cpp.
|
virtual |
Set the Presentation Time Stamp for this set of samples.
| aValue | the new value |
Implements com::avpkit::core::IAudioSamples.
Definition at line 323 of file AudioSamples.cpp.
Referenced by setTimeStamp().
|
virtual |
Sets the sample at the given index and channel to the sample.
In theory we assume input is the given Format, and will convert if needed, but right now we only support FMT_S16 anyway.
| sampleIndex | The zero-based index into the set of samples |
| channel | The zero-based channel number. If this set of samples doesn't have that given channel, an error is returned. |
| format | The format of the given sample |
| sample | The actual sample |
Implements com::avpkit::core::IAudioSamples.
Definition at line 339 of file AudioSamples.cpp.
|
inlinevirtual |
Set the time base that time stamps of this object are represented in.
| aBase | the new time base. If null an exception is thrown. |
Implements com::avpkit::core::IMediaData.
Definition at line 40 of file AudioSamples.h.
|
inlinevirtual |
Set the time stamp for this object in getTimeBase() units.
| aTimeStamp | The time stamp |
Implements com::avpkit::core::IMediaData.
Definition at line 38 of file AudioSamples.h.
References setPts().