changeset 113:0d81ce87dea5

trau-decode AMR8 common: return number of T bits
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 22 Dec 2025 06:59:45 +0000
parents bf038fdde8da
children 4ff5c798c75d
files trau-decode/amr8-common.c
diffstat 1 files changed, 14 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/trau-decode/amr8-common.c	Mon Dec 22 06:46:40 2025 +0000
+++ b/trau-decode/amr8-common.c	Mon Dec 22 06:59:45 2025 +0000
@@ -344,7 +344,7 @@
 	check_spare_bits(d_bits + 64, 61, "D65..D125");
 }
 
-static void
+static int
 handle_amr8_low(frame_bits)
 	ubit_t *frame_bits;
 {
@@ -378,9 +378,11 @@
 	if (c_bits[3] || c_bits[4]) {
 		decode_speech_frame(c_bits, d_bits);
 		printf("  T=%u\n", frame_bits[159]);
+		return 1;
 	} else {
 		decode_nospeech_frame(c_bits, d_bits);
 		printf("  D126=%u T=%u\n", frame_bits[158], frame_bits[159]);
+		return 2;
 	}
 }
 
@@ -422,7 +424,7 @@
 	}
 }
 
-static void
+static int
 handle_amr8_6k7(frame_bits)
 	ubit_t *frame_bits;
 {
@@ -460,9 +462,10 @@
 	print_speech_params(d_bits + 112, params_67_sf24);
 
 	saved_mode_valid = 0;
+	return 0;
 }
 
-static void
+static int
 handle_amr8_7k4(frame_bits)
 	ubit_t *frame_bits;
 {
@@ -492,18 +495,18 @@
 	print_speech_params(d_bits + 122, params_74_sf24);
 
 	saved_mode_valid = 0;
+	return 0;
 }
 
-void
 print_amr8_frame(frame_bits)
 	ubit_t *frame_bits;
 {
 	if (is_amr_low(frame_bits))
-		handle_amr8_low(frame_bits);
-	else if (is_amr_67(frame_bits))
-		handle_amr8_6k7(frame_bits);
-	else if (is_amr_74(frame_bits))
-		handle_amr8_7k4(frame_bits);
-	else
-		puts("  Unrecognized format by sync pattern");
+		return handle_amr8_low(frame_bits);
+	if (is_amr_67(frame_bits))
+		return handle_amr8_6k7(frame_bits);
+	if (is_amr_74(frame_bits))
+		return handle_amr8_7k4(frame_bits);
+	puts("  Unrecognized format by sync pattern");
+	return 0;
 }