view hrutil/cod-parse.c @ 545:b07dba7b8a4f

doc/EFR-library-API: document RTP input wrapper
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 03 Oct 2024 09:26:04 +0000
parents bb36ef735f25
children
line wrap: on
line source

/*
 * This program reads an HRv1 *.cod file in ETSI test sequence format
 * (encoder output format) and displays its content in human-readable form.
 */

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "../libgsmhr1/tw_gsmhr.h"

main(argc, argv)
	char **argv;
{
	char *infname;
	FILE *inf;
	int big_endian;
	unsigned frame_no;
	int16_t params[GSMHR_NUM_PARAMS_ENC];
	int rc;

	if (argc == 2 && argv[1][0] != '-') {
		big_endian = 0;
		infname = argv[1];
	} else if (argc == 3 && !strcmp(argv[1], "-b")) {
		big_endian = 1;
		infname = argv[2];
	} else {
		fprintf(stderr, "usage: %s [-b] file.cod\n", argv[0]);
		exit(1);
	}
	inf = fopen(infname, "r");
	if (!inf) {
		perror(infname);
		exit(1);
	}
	for (frame_no = 0; ; frame_no++) {
		rc = read_cod_frame(inf, big_endian, params, infname, frame_no);
		if (!rc)
			break;
		printf("#%u: VAD=%d SP=%d\n", frame_no, params[18], params[19]);
		print_frame_params(params);
	}
	exit(0);
}