changeset 539:0daaae66b3f6

libtest: add TW-TS-005 write helper function
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 22 Sep 2024 00:21:16 +0000
parents 4d596bfdf8d9
children 5595293e4f29
files libtest/Makefile libtest/tw5writer.c libtest/tw5writer.h
diffstat 3 files changed, 24 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libtest/Makefile	Sat Sep 21 23:58:27 2024 +0000
+++ b/libtest/Makefile	Sun Sep 22 00:21:16 2024 +0000
@@ -1,5 +1,5 @@
 OBJS=	binreader.o parse_dlcap.o pcmwrite.o roberead.o robewrite.o tw5reader.o\
-	wavrdhelp.o wavreader.o wavwriter.o
+	tw5writer.o wavrdhelp.o wavreader.o wavwriter.o
 LIB=	libtest.a
 
 include ../config.defs
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libtest/tw5writer.c	Sun Sep 22 00:21:16 2024 +0000
@@ -0,0 +1,16 @@
+/*
+ * Here we implement our emit_hex_frame() function.
+ */
+
+#include <stdio.h>
+#include <stdint.h>
+#include "tw5writer.h"
+
+void emit_hex_frame(FILE *outf, const uint8_t *frame, unsigned nbytes)
+{
+	unsigned n;
+
+	for (n = 0; n < nbytes; n++)
+		fprintf(outf, "%02X", frame[n]);
+	putc('\n', outf);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libtest/tw5writer.h	Sun Sep 22 00:21:16 2024 +0000
@@ -0,0 +1,7 @@
+/*
+ * This header file declares the interface to our writer function for
+ * hexadecimal RTP frame sequence files in TW-TS-005 format.  It is
+ * a simple function that emits an array of bytes as a hexadecimal line.
+ */
+
+void emit_hex_frame(FILE *outf, const uint8_t *frame, unsigned nbytes);