This commit is contained in:
intelligence committed 2026-08-29 23:11:50 +02:00
1 parent 32e7f32e0a
commit 523acd3349
23 files changed
+482 -98

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
#include "transui_mp3.h"
#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
const size_t pcm_size = 16000 * 2;
uint8_t *pcm = calloc(pcm_size, 1);
assert(pcm != NULL);
uint8_t *mp3 = NULL;
size_t mp3_size = 0;
assert(transui_mp3_encode_mono_16k_32kbps(pcm, pcm_size, &mp3,
&mp3_size) == TRANSUI_MP3_OK);
assert(mp3 != NULL);
assert(mp3_size > 2);
assert(mp3[0] == 0xff);
assert((mp3[1] & 0xe0) == 0xe0);
if (argc == 2) {
FILE *output = fopen(argv[1], "wb");
assert(output != NULL);
assert(fwrite(mp3, 1, mp3_size, output) == mp3_size);
assert(fclose(output) == 0);
}
transui_mp3_free(mp3);
free(pcm);
assert(transui_mp3_encode_mono_16k_32kbps(NULL, 0, &mp3, &mp3_size) ==
TRANSUI_MP3_INVALID_INPUT);
return 0;
}