c, python : add option to query encode size

This commit is contained in:
Georgi Gerganov
2021-01-23 17:13:13 +02:00
parent 0c746c1b15
commit ba8e0cd2b1
8 changed files with 58 additions and 21 deletions

View File

@@ -49,7 +49,8 @@ int ggwave_encode(
int dataSize,
ggwave_TxProtocolId txProtocolId,
int volume,
char * outputBuffer) {
char * outputBuffer,
int query) {
GGWave * ggWave = (GGWave *) g_instances[instance];
if (ggWave == nullptr) {
@@ -62,6 +63,14 @@ int ggwave_encode(
return -1;
}
if (query != 0) {
if (query == 1) {
return ggWave->encodeSize_bytes();
}
return ggWave->encodeSize_samples();
}
int nSamples = 0;
GGWave::CBWaveformOut cbWaveformOut = [&](const void * data, uint32_t nBytes) {