Skip to content

Commit c3cbff6

Browse files
committed
rename writeSamples to writeData
1 parent 2206521 commit c3cbff6

File tree

6 files changed

+352
-359
lines changed

6 files changed

+352
-359
lines changed

examples/sandbox/basic-a2dp-vs1053/basic-a2dp-vs1053.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ VS1053Config cfg;
2121
void read_data_stream(const uint8_t *data, uint32_t bytes) {
2222
int samples = bytes / sizeof(int16_t);
2323
// split up writes to max 512 samples
24-
writeSamples<int16_t>(&out, (int16_t*) data, samples, 512);
24+
writeData<int16_t>(&out, (int16_t*) data, samples, 512);
2525
}
2626

2727

src/AudioTools/AudioCodecs/CodecADTS.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class ADTSParser {
121121
LOGW(error_fmt, "freq", header.sampling_freq_idx);
122122
is_valid = false;
123123
}
124-
if (header.channel_cfg > 2) {
124+
if (header.channel_cfg == 0 || header.channel_cfg > 2) {
125125
LOGW(error_fmt, "channels", header.channel_cfg);
126126
is_valid = false;
127127
}
@@ -321,13 +321,13 @@ class ADTSDecoder : public AudioDecoder {
321321
size_t writeData(uint8_t *data, size_t size) {
322322
LOGI("writeData: %d", (int)size);
323323
if (p_print) {
324-
size_t len = p_print->write(data, size);
324+
size_t len = ::writeData<uint8_t>(p_print,data, size);
325325
assert(len == size);
326326
return (len == size);
327327
}
328328
if (p_dec) {
329329
LOGI("write to decoder: %d", (int)size);
330-
size_t len = p_dec->write(data, size);
330+
size_t len = writeDataT<uint8_t, AudioDecoder>(p_dec, data, size);
331331
assert(len == size);
332332
return (len == size);
333333
}

src/AudioTools/AudioCodecs/CodecMTS.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#define MTS_WRITE_BUFFER_SIZE 2000
77
#endif
88

9+
#include "AudioToolsConfig.h"
10+
#include "AudioTools/CoreAudio/AudioTypes.h"
911
#include "AudioTools/AudioCodecs/AudioCodecsBase.h"
1012
#include "stdlib.h"
1113

@@ -409,14 +411,15 @@ class MTSDecoder : public AudioDecoder {
409411
open_pes_data_size -= dataSize;
410412

411413
LOGI("- writing %d bytes (open: %d)", dataSize, open_pes_data_size);
412-
// if (open_pes_data_size == 9) {
413-
// uint8_t *tmp = pes + len;
414-
// for (int j = 0; j <= 9; j++) {
415-
// LOGI(" 0x%02X", tmp[j]);
416-
// }
417-
// }
418-
if (p_print) p_print->write(data, dataSize);
419-
if (p_dec) p_dec->write(data, dataSize);
414+
415+
if (p_print) {
416+
size_t result = writeData<uint8_t>(p_print, data, dataSize);
417+
assert(result==dataSize);
418+
}
419+
if (p_dec) {
420+
size_t result = writeDataT<uint8_t, AudioDecoder>(p_dec, data, dataSize);
421+
assert(result==dataSize);
422+
}
420423
}
421424

422425
// check for PES packet start code prefix

src/AudioTools/AudioCodecs/CodecTSDemux.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ class MTSDecoderTSDemux : public AudioDecoder {
281281
if (p_print != nullptr) {
282282
// size_t eff = p_print->write(pes->data_bytes,
283283
// pes->data_bytes_length);
284-
size_t eff = writeSamples<uint8_t>(
284+
size_t eff = writeData<uint8_t>(
285285
p_print, (uint8_t *)pes->data_bytes, pes->data_bytes_length);
286286
if (eff != pes->data_bytes_length) {
287287
// we should not get here

src/AudioTools/AudioCodecs/ContainerOgg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,7 @@ class OggContainerOutput : public AudioOutput {
329329
return 0;
330330
}
331331
// self->out.write((uint8_t *)buf, n);
332-
writeSamples<uint8_t>(self->p_out, (uint8_t *)buf, n);
332+
writeData<uint8_t>(self->p_out, (uint8_t *)buf, n);
333333
// 0 = continue
334334
return 0;
335335
}

0 commit comments

Comments
 (0)