20 #ifndef IAUDIOSAMPLES_H_
21 #define IAUDIOSAMPLES_H_
23 #include <com/avpkit/core/AVPKit.h>
24 #include <com/avpkit/core/IMediaData.h>
25 #include <com/avpkit/core/IRational.h>
26 #include <com/avpkit/ferry/IBuffer.h>
27 namespace com {
namespace avpkit {
namespace core
173 int32_t sampleRate, int32_t channels,
Format format,
185 virtual short *getRawSamples(uint32_t startingSample) = 0;
202 virtual int32_t
setSample(int32_t sampleIndex, int32_t channel,
Format format, int32_t sample)=0;
230 static int32_t findSampleBitDepth(
Format format);
247 int32_t numChannels);
257 static int64_t samplesToDefaultPts(int64_t samples,
int sampleRate);
266 static int64_t defaultPtsToSamples(int64_t duration,
int sampleRate);
278 CH_FRONT_LEFT= 0x00000001,
279 CH_FRONT_RIGHT= 0x00000002,
280 CH_FRONT_CENTER= 0x00000004,
281 CH_LOW_FREQUENCY= 0x00000008,
282 CH_BACK_LEFT= 0x00000010,
283 CH_BACK_RIGHT= 0x00000020,
284 CH_FRONT_LEFT_OF_CENTER= 0x00000040,
285 CH_FRONT_RIGHT_OF_CENTER= 0x00000080,
286 CH_BACK_CENTER= 0x00000100,
287 CH_SIDE_LEFT= 0x00000200,
288 CH_SIDE_RIGHT= 0x00000400,
289 CH_TOP_CENTER= 0x00000800,
290 CH_TOP_FRONT_LEFT= 0x00001000,
291 CH_TOP_FRONT_CENTER= 0x00002000,
292 CH_TOP_FRONT_RIGHT= 0x00004000,
293 CH_TOP_BACK_LEFT= 0x00008000,
294 CH_TOP_BACK_CENTER= 0x00010000,
295 CH_TOP_BACK_RIGHT= 0x00020000,
296 CH_STEREO_LEFT= 0x20000000,
297 CH_STEREO_RIGHT= 0x40000000,
298 CH_WIDE_LEFT= 0x0000000080000000ULL,
299 CH_WIDE_RIGHT= 0x0000000100000000ULL,
300 CH_SURROUND_DIRECT_LEFT= 0x0000000200000000ULL,
301 CH_SURROUND_DIRECT_RIGHT= 0x0000000400000000ULL,
302 CH_LOW_FREQUENCY_2= 0x0000000800000000ULL,
307 CH_LAYOUT_NATIVE= 0x8000000000000000ULL,
314 CH_LAYOUT_MONO= (CH_FRONT_CENTER),
315 CH_LAYOUT_STEREO= (CH_FRONT_LEFT|CH_FRONT_RIGHT),
316 CH_LAYOUT_2POINT1= (CH_LAYOUT_STEREO|CH_LOW_FREQUENCY),
317 CH_LAYOUT_2_1= (CH_LAYOUT_STEREO|CH_BACK_CENTER),
318 CH_LAYOUT_SURROUND= (CH_LAYOUT_STEREO|CH_FRONT_CENTER),
319 CH_LAYOUT_3POINT1= (CH_LAYOUT_SURROUND|CH_LOW_FREQUENCY),
320 CH_LAYOUT_4POINT0= (CH_LAYOUT_SURROUND|CH_BACK_CENTER),
321 CH_LAYOUT_4POINT1= (CH_LAYOUT_4POINT0|CH_LOW_FREQUENCY),
322 CH_LAYOUT_2_2= (CH_LAYOUT_STEREO|CH_SIDE_LEFT|CH_SIDE_RIGHT),
323 CH_LAYOUT_QUAD= (CH_LAYOUT_STEREO|CH_BACK_LEFT|CH_BACK_RIGHT),
324 CH_LAYOUT_5POINT0= (CH_LAYOUT_SURROUND|CH_SIDE_LEFT|CH_SIDE_RIGHT),
325 CH_LAYOUT_5POINT1= (CH_LAYOUT_5POINT0|CH_LOW_FREQUENCY),
326 CH_LAYOUT_5POINT0_BACK= (CH_LAYOUT_SURROUND|CH_BACK_LEFT|CH_BACK_RIGHT),
327 CH_LAYOUT_5POINT1_BACK= (CH_LAYOUT_5POINT0_BACK|CH_LOW_FREQUENCY),
328 CH_LAYOUT_6POINT0= (CH_LAYOUT_5POINT0|CH_BACK_CENTER),
329 CH_LAYOUT_6POINT0_FRONT= (CH_LAYOUT_2_2|CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER),
330 CH_LAYOUT_HEXAGONAL= (CH_LAYOUT_5POINT0_BACK|CH_BACK_CENTER),
331 CH_LAYOUT_6POINT1= (CH_LAYOUT_5POINT1|CH_BACK_CENTER),
332 CH_LAYOUT_6POINT1_BACK= (CH_LAYOUT_5POINT1_BACK|CH_BACK_CENTER),
333 CH_LAYOUT_6POINT1_FRONT= (CH_LAYOUT_6POINT0_FRONT|CH_LOW_FREQUENCY),
334 CH_LAYOUT_7POINT0= (CH_LAYOUT_5POINT0|CH_BACK_LEFT|CH_BACK_RIGHT),
335 CH_LAYOUT_7POINT0_FRONT= (CH_LAYOUT_5POINT0|CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER),
336 CH_LAYOUT_7POINT1= (CH_LAYOUT_5POINT1|CH_BACK_LEFT|CH_BACK_RIGHT),
337 CH_LAYOUT_7POINT1_WIDE= (CH_LAYOUT_5POINT1|CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER),
338 CH_LAYOUT_7POINT1_WIDE_BACK= (CH_LAYOUT_5POINT1_BACK|CH_FRONT_LEFT_OF_CENTER|CH_FRONT_RIGHT_OF_CENTER),
339 CH_LAYOUT_OCTAGONAL= (CH_LAYOUT_5POINT0|CH_BACK_LEFT|CH_BACK_CENTER|CH_BACK_RIGHT),
340 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),
341 CH_LAYOUT_STEREO_DOWNMIX= (CH_STEREO_LEFT|CH_STEREO_RIGHT),
346 virtual ChannelLayout getChannelLayout() = 0;
348 virtual void setComplete(
bool complete, int32_t numSamples,
349 int32_t sampleRate, int32_t channels, ChannelLayout channelLayout, Format format,
A set of raw (decoded) samples, plus a timestamp for when to play those samples relative to other ite...
virtual int32_t setSample(int32_t sampleIndex, int32_t channel, Format format, int32_t sample)=0
Sets the sample at the given index and channel to the sample.
virtual int32_t getChannels()=0
Return the number of channels of the samples in this buffer.
virtual void setComplete(bool complete, int32_t numSamples, int32_t sampleRate, int32_t channels, Format format, int64_t pts)=0
Call this if you modify the samples and are now done.
virtual int32_t getSampleRate()=0
Find the sample rate of the samples in this audio buffer.
virtual int32_t getSample(int32_t sampleIndex, int32_t channel, Format format)=0
Get the sample at the given sampleIndex and channel, and return it in the asked for format.
virtual bool isComplete()=0
Returns whether or not we think this buffer has been filled with data.
virtual void setPts(int64_t aValue)=0
Set the Presentation Time Stamp for this set of samples.
virtual int32_t getMaxSamples()=0
virtual int64_t getNextPts()=0
What would be the next Presentation Time Stamp after all the samples in this buffer were played?
virtual int32_t getSampleBitDepth()=0
Find out the bit-depth of the samples in this buffer.
virtual Format getFormat()=0
Find the Format of the samples in this buffer.
virtual int32_t getNumSamples()=0
Get the number of samples in this video.
virtual int32_t getMaxBufferSize()=0
Format
The format we use to represent audio.
@ FMT_S32P
signed 32 bits, planar
@ FMT_U8P
unsigned 8 bits, planar
@ FMT_S16P
signed 16 bits, planar
virtual int64_t getPts()=0
What is the Presentation Time Stamp of this set of audio samples.
virtual int32_t getSampleSize()=0
Allows Java code to get data from a native buffers, and optionally modify native memory directly.
WARNING: Do not use logging in this class, and do not set any static file variables to values other t...