/******************************************************************
 *	snd_dump.c -- dump soundfile header info for testing
 *		stp -- 2/92
 *
 *	usage:	snd_dmp filenames
 *
 ******************************************************************/
#include <stdio.h>
#include <sys/file.h>
#include <sys/types.h>
#include <unistd.h>
#include <malloc.h>
#include <multimedia/audio_filehdr.h>

main(argc, argv) int argc; char *argv[]; {
	int ifd, i, j;
	Audio_filehdr *sf_header;

	sf_header = (Audio_filehdr *) malloc(sizeof(Audio_filehdr));
	for (i=1; i<argc; i++) {
		ifd = open(argv[i], O_RDONLY, 0);
		if (ifd < 0) {
			printf("Error opening input file\n");
			exit(-1);
		}
		j = read(ifd, sf_header, sizeof(Audio_filehdr));
		if (j < sizeof(Audio_filehdr)) {
			fprintf(stderr, "Unable to read header: %s\n", argv[i]);
			break;
		}
		printf("%s\tmagic: %X\thdr: %d\tdata: %d\tfmt: %d\trate: %d\tchan: %d\n", 
			argv[i], sf_header->magic, sf_header->hdr_size, sf_header->data_size, 
			sf_header->encoding, sf_header->sample_rate, sf_header->channels);
		close(ifd);
	}
}

