*
* \param fifo Associated FIFO. Passed by reference because it must be non-NULL.
*/
- audio_utils_fifo_writer(audio_utils_fifo& fifo);
+ explicit audio_utils_fifo_writer(audio_utils_fifo& fifo);
virtual ~audio_utils_fifo_writer();
/**
* \param throttlesWriter Whether this reader throttles the writer.
* At most one reader can specify throttlesWriter == true.
*/
- audio_utils_fifo_reader(audio_utils_fifo& fifo, bool throttlesWriter = true);
+ explicit audio_utils_fifo_reader(audio_utils_fifo& fifo, bool throttlesWriter = true);
virtual ~audio_utils_fifo_reader();
/**
* Read interleaved frames
* \return actual number of frames read
*/
-sf_count_t sf_readf_short(SNDFILE *handle, short *ptr, sf_count_t desired);
+sf_count_t sf_readf_short(SNDFILE *handle, int16_t *ptr, sf_count_t desired);
sf_count_t sf_readf_float(SNDFILE *handle, float *ptr, sf_count_t desired);
sf_count_t sf_readf_int(SNDFILE *handle, int *ptr, sf_count_t desired);
* Write interleaved frames
* \return actual number of frames written
*/
-sf_count_t sf_writef_short(SNDFILE *handle, const short *ptr, sf_count_t desired);
+sf_count_t sf_writef_short(SNDFILE *handle, const int16_t *ptr, sf_count_t desired);
sf_count_t sf_writef_float(SNDFILE *handle, const float *ptr, sf_count_t desired);
sf_count_t sf_writef_int(SNDFILE *handle, const int *ptr, sf_count_t desired);
// state variable, true if scanning for start of frame
bool mScanning;
- static const unsigned short kSPDIFSync1; // Pa
- static const unsigned short kSPDIFSync2; // Pb
+ static const uint16_t kSPDIFSync1; // Pa
+ static const uint16_t kSPDIFSync2; // Pb
};
} // namespace android
namespace android {
// Burst Preamble defined in IEC61937-1
-const unsigned short SPDIFEncoder::kSPDIFSync1 = 0xF872; // Pa
-const unsigned short SPDIFEncoder::kSPDIFSync2 = 0x4E1F; // Pb
+const uint16_t SPDIFEncoder::kSPDIFSync1 = 0xF872; // Pa
+const uint16_t SPDIFEncoder::kSPDIFSync2 = 0x4E1F; // Pb
static int32_t sEndianDetector = 1;
#define isLittleEndian() (*((uint8_t *)&sEndianDetector))
sf_close(sfin);
return EXIT_FAILURE;
}
- size_t frameSize = sizeof(short) * sfinfoin.channels;
- short *inputBuffer = new short[sfinfoin.frames * sfinfoin.channels];
+ size_t frameSize = sizeof(int16_t) * sfinfoin.channels;
+ int16_t *inputBuffer = new int16_t[sfinfoin.frames * sfinfoin.channels];
sf_count_t actualRead = sf_readf_short(sfin, inputBuffer, sfinfoin.frames);
if (actualRead != sfinfoin.frames) {
fprintf(stderr, "%s: unexpected EOF or error\n", inputFile);
}
sf_close(sfin);
- short *outputBuffer = new short[sfinfoin.frames * sfinfoin.channels];
+ int16_t *outputBuffer = new int16_t[sfinfoin.frames * sfinfoin.channels];
size_t framesWritten = 0;
size_t framesRead = 0;
- short *fifoBuffer = new short[frameCount * sfinfoin.channels];
+ int16_t *fifoBuffer = new int16_t[frameCount * sfinfoin.channels];
audio_utils_fifo fifo(frameCount, frameSize, fifoBuffer, readerThrottlesWriter);
audio_utils_fifo_writer fifoWriter(fifo);
audio_utils_fifo_reader fifoReader(fifo, readerThrottlesWriter);