aboutsummaryrefslogtreecommitdiffstats
path: root/dabp-decode/main.cpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2026-01-15 11:06:55 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2026-01-15 11:07:47 +0100
commit1f112f14ff0bb3cb77f97c8d945bece9dd90fc4c (patch)
treeb5bbe1d19799fb240f8fd93349937fb0051aa6e4 /dabp-decode/main.cpp
parent23ade5792e57fd380aa72de9039148a7f946f3d6 (diff)
downloadmmbtools-aux-1f112f14ff0bb3cb77f97c8d945bece9dd90fc4c.tar.gz
mmbtools-aux-1f112f14ff0bb3cb77f97c8d945bece9dd90fc4c.tar.bz2
mmbtools-aux-1f112f14ff0bb3cb77f97c8d945bece9dd90fc4c.zip
Add dabp-decoderHEADmaster
Diffstat (limited to 'dabp-decode/main.cpp')
-rw-r--r--dabp-decode/main.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/dabp-decode/main.cpp b/dabp-decode/main.cpp
new file mode 100644
index 0000000..e674f74
--- /dev/null
+++ b/dabp-decode/main.cpp
@@ -0,0 +1,42 @@
+#include <iostream>
+#include <string>
+#include <vector>
+#include "AACDecoder.h"
+
+int main(int argc, char **argv)
+{
+ if (argc != 4) {
+ std::cerr << "Usage: " << argv[0] << " INFILE FRAME_SIZE OUTFILE\n";
+ return 1;
+ }
+
+ auto frame_size = std::stol(argv[2]);
+ if (frame_size == 0) {
+ std::cerr << "Frame size 0 !\n";
+ return 1;
+ }
+
+ FILE *fd = fopen(argv[1], "r");
+ if (fd == nullptr) {
+ std::cerr << "Could not open file !\n";
+ return 1;
+ }
+
+ AACDecoder aacdec(argv[3]);
+
+ std::vector<uint8_t> buf;
+ buf.resize(frame_size);
+
+ while (not feof(fd)) {
+ if (fread(buf.data(), buf.size(), 1, fd) == 0) {
+ std::cerr << "fread 0\n";
+ break;
+ }
+
+ aacdec.decode_frame(buf.data(), buf.size());
+ }
+
+ fclose(fd);
+
+ return 0;
+}