mpegaudio port

This commit is contained in:
angelos 1998-05-20 06:41:37 +00:00
parent ac8bf4456a
commit ac96896452
11 changed files with 628 additions and 0 deletions

22
audio/mpegaudio/Makefile Normal file
View File

@ -0,0 +1,22 @@
# OpenBSD makefile for: mpegaudio
# Date created: May 20 1998
# Whom: Angelos D. Keromytis
#
# $OpenBSD: Makefile,v 1.1.1.1 1998/05/20 06:41:37 angelos Exp $
#
DISTNAME= mpegaudio
PKGNAME= mpegaudio-3.9
CATEGORIES= audio
MASTER_SITES= ftp://ftp.iuma.com/audio_utils/converters/source/
EXTRACT_SUFX= .tar.Z
MAINTAINER= angelos@openbsd.org
MAN1= mpeg_musicin.1 mpeg_musicout.1
post-install:
${INSTALL_MAN} ${FILESDIR}/mpeg_musicin.1 ${PREFIX}/man/man1
${INSTALL_MAN} ${FILESDIR}/mpeg_musicout.1 ${PREFIX}/man/man1
.include <bsd.port.mk>

View File

@ -0,0 +1 @@
MD5 (mpegaudio.tar.Z) = 7df5c3fdef022275902e35ff3f473035

View File

@ -0,0 +1,122 @@
.\" Copyright (c) 1997 Andreas Klemm <andreas@FreeBSD.org>. Neuss.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: mpeg_musicin.1,v 1.1.1.1 1998/05/20 06:41:37 angelos Exp $
.Dd August 17, 1997
.Dt MPEG_MUSICIN 1
.Os FreeBSD
.Sh NAME
.Nm mpeg_musicin
.Nd MPEG/audio Layer 1 and Layer 2 decoder
.Sh SYNOPSIS
.Nm mpeg_musicin
queries for all arguments, or
.br
.Nm mpeg_musicin
.Op Fl l Ar lay
.br
.Op Fl m Ar mode
.br
.Op Fl p Ar psy
.br
.Op Fl s Ar sfrq
.br
.Op Fl b Ar br
.br
.Op Fl d Ar emp
.br
.Op Fl c
.br
.Op Fl o
.br
.Op Fl e
.br
inputCM
.br
.Op Ar outBS
.br
.Sh DESCRIPTION
The encoder and decoder software are configured to output
the coded audio bitstreams as a string of hexadecimal ascii
characters. For greater compression efficiency, compile flag,
BS_FORMAT, in common.h can be switched to configure the bitstream
reading and writing routines to process raw binary bitstreams.
.br
The decoder program has a very crude implementation of bitstream
synchword detection. It may not be able to correctly decode valid
bitstreams which have false synchword patterns in the ancillary data
portion of the bitstream.
.Sh RESTRICTIONS
The software implements levels I and II and psychophysical auditory
models I and II as described in the ISO 3-11171 rev 1 standard.
There are future plans to implement level III.
.br
The input/output audio data may either be headerless raw 16 bit data
or alternatively an AIFF formatted file (Audio Interchange File Format)
with certain limitations.
.br
For more information on the AIFF format see the postscript file
/sgi/aiff-c.9.26.91.ps at the anonymous ftp site FTP.SGI.COM
(192.48.153.1).
.br
The AIFF formatted file is a convenient way for storing sampling rate
of the audio file.
.br
The encoder and decoder software are configured to output the coded
audio bitstreams as a string of hexadecimal ascii characters.
For greater compression efficiency, compile flag, BS_FORMAT,
in common.h can be switched to configure the bitstream reading
and writing routines to process raw binary bitstreams.
.br
This software has been run and verified on a large variety of
computers and operating systems. In particular UNIX, MS_DOS (with
MicroSoft C version 6), Macintosh, AIX Platform (RS6000) and Convex.
.Sh OPTIONS
.Bl -tag -width Ds
.It Sy -l lay
use layer <lay> coding (default: 2)
.It Sy -m mode
channel mode : s/d/j/m (default: s)
.It Sy -p psy
psychoacoustic model 1/2 (default: 2)
.It Sy -s sfrq
input smpl rate in kHz (default: 44.1)
.It Sy -b br
total bitrate in kbps (default: 384)
.It Sy -d emp
de-emphasis n/5/c (default: n)
.It Sy -c
mark as copyright
.It Sy -o
mark as original
.It Sy -e
add error protection
.It Sy inputPCM
input PCM sound file (standard or AIFF)
.It Sy outBS
output bit stream of encoded audio (dflt inName+.mpg)
.Sh SEE ALSO
.Xr mpeg_musicout 1
.Sh HISTORY
Written by Andreas Klemm, August 17, 1997

View File

@ -0,0 +1,94 @@
.\" Copyright (c) 1997 Andreas Klemm <andreas@FreeBSD.org>. Neuss.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $Id: mpeg_musicout.1,v 1.1.1.1 1998/05/20 06:41:37 angelos Exp $
.Dd August 17, 1997
.Dt MPEG_MUSICOUT 1
.Os FreeBSD
.Sh NAME
.Nm mpeg_musicout
.Nd MPEG/audio Layer 1 and Layer 2 encoder
.Sh SYNOPSIS
.Nm mpeg_musicout
queries for all arguments, or
.br
.Nm mpeg_musicout
.Op Fl A
.br
.Op Fl s Ar sb
.br
inputBS
.br
.Op Ar outPCM
.br
.Sh DESCRIPTION
The encoder and decoder software are configured to output
the coded audio bitstreams as a string of hexadecimal ascii
characters. For greater compression efficiency, compile flag,
BS_FORMAT, in common.h can be switched to configure the bitstream
reading and writing routines to process raw binary bitstreams.
.br
The decoder program has a very crude implementation of bitstream
synchword detection. It may not be able to correctly decode valid
bitstreams which have false synchword patterns in the ancillary data
portion of the bitstream.
.Sh RESTRICTIONS
The software implements levels I and II and psychophysical auditory
models I and II as described in the ISO 3-11171 rev 1 standard.
There are future plans to implement level III.
.br
The input/output audio data may either be headerless raw 16 bit data
or alternatively an AIFF formatted file (Audio Interchange File Format)
with certain limitations.
.br
For more information on the AIFF format see the postscript file
/sgi/aiff-c.9.26.91.ps at the anonymous ftp site FTP.SGI.COM
(192.48.153.1).
.br
The AIFF formatted file is a convenient way for storing sampling rate
of the audio file.
.br
The encoder and decoder software are configured to output the coded
audio bitstreams as a string of hexadecimal ascii characters.
For greater compression efficiency, compile flag, BS_FORMAT,
in common.h can be switched to configure the bitstream reading
and writing routines to process raw binary bitstreams.
.br
This software has been run and verified on a large variety of
computers and operating systems. In particular UNIX, MS_DOS (with
MicroSoft C version 6), Macintosh, AIX Platform (RS6000) and Convex.
.Sh OPTIONS
.Bl -tag -width Ds
.It Sy -A
write an AIFF output PCM sound file
.It Sy -s sb
resynth only up to this sb (debugging only)
.It Sy inputBS
input bit stream of encoded audio
.It Sy outPCM
output PCM sound file (dflt inName+.dec)
.Sh SEE ALSO
.Xr mpeg_musicin 1
.Sh HISTORY
Written by Andreas Klemm, August 17, 1997

View File

@ -0,0 +1,37 @@
*** Makefile.orig Wed Jan 5 02:47:50 1994
--- Makefile Mon Jul 1 23:16:53 1996
***************
*** 1,10 ****
ALL : musicin musicout
! CFLAGS = -O2
! LDFLAGS=
musicin: musicin.o common.o encode.o subs.o psy.o tonal.o
! cc $(LDFLAGS) -o musicin musicin.o common.o encode.o subs.o psy.o tonal.o -lm
musicout: musicout.o common.o decode.o subs.o
! cc $(LDFLAGS) musicout.o common.o decode.o subs.o -o musicout -lm
--- 1,22 ----
ALL : musicin musicout
! CFLAGS += -DPREFIX=\"${PREFIX}\"
!
! all: musicin musicout
musicin: musicin.o common.o encode.o subs.o psy.o tonal.o
! cc -o musicin musicin.o common.o encode.o subs.o psy.o tonal.o -lm
musicout: musicout.o common.o decode.o subs.o
! cc musicout.o common.o decode.o subs.o -o musicout -lm
!
! clean:
! rm -f *.core *.o musicin musicout
!
! install:
! install -c -m 0755 -o bin -g bin musicin ${PREFIX}/bin/mpeg_musicin
! install -c -m 0755 -o bin -g bin musicout ${PREFIX}/bin/mpeg_musicout
! mkdir -m 0755 -p ${PREFIX}/lib/mpegaudio/tables
! install -c -m 0644 -o bin -g bin tables/* \
! ${PREFIX}/lib/mpegaudio/tables/
!

View File

@ -0,0 +1,19 @@
*** common.h.orig Mon Jul 1 23:00:51 1996
--- common.h Mon Jul 1 23:04:47 1996
***************
*** 73,79 ****
#endif
#ifdef UNIX
! #define TABLES_PATH "tables" /* to find data files */
/* name of environment variable holding path of table files */
#define MPEGTABENV "MPEGTABLES"
#define PATH_SEPARATOR "/" /* how to build paths */
--- 73,79 ----
#endif
#ifdef UNIX
! #define TABLES_PATH PREFIX "/lib/mpegaudio/tables" /* to find data files */
/* name of environment variable holding path of table files */
#define MPEGTABENV "MPEGTABLES"
#define PATH_SEPARATOR "/" /* how to build paths */

View File

@ -0,0 +1,225 @@
*** musicin.c.orig Tue Jan 4 20:13:44 1994
--- musicin.c Wed May 20 02:39:32 1998
***************
*** 101,106 ****
--- 101,108 ----
#include "common.h"
#include "encoder.h"
+ #include <stdlib.h>
+
/* Global variable definitions for "musicin.c" */
FILE *musicin;
***************
*** 144,150 ****
do {
printf("Enter PCM input file name <required>: ");
! gets(original_file_name);
if (original_file_name[0] == NULL_CHAR)
printf("PCM input file name is required.\n");
} while (original_file_name[0] == NULL_CHAR);
--- 146,152 ----
do {
printf("Enter PCM input file name <required>: ");
! fgets(original_file_name, MAX_NAME_SIZE-1, stdin);
if (original_file_name[0] == NULL_CHAR)
printf("PCM input file name is required.\n");
} while (original_file_name[0] == NULL_CHAR);
***************
*** 163,169 ****
original_file_name, DFLT_EXT);
#endif
! gets(encoded_file_name);
if (encoded_file_name[0] == NULL_CHAR) {
#ifdef MS_DOS
/* replace old extension with new one, 92-08-19 shn */
--- 165,171 ----
original_file_name, DFLT_EXT);
#endif
! fgets(encoded_file_name, MAX_NAME_SIZE-1, stdin);
if (encoded_file_name[0] == NULL_CHAR) {
#ifdef MS_DOS
/* replace old extension with new one, 92-08-19 shn */
***************
*** 207,213 ****
else { /* Not using Audio IFF sound file headers. */
printf("What is the sampling frequency? <44100>[Hz]: ");
! gets(t);
freq = atol(t);
switch (freq) {
case 48000 : info->sampling_frequency = 1;
--- 209,215 ----
else { /* Not using Audio IFF sound file headers. */
printf("What is the sampling frequency? <44100>[Hz]: ");
! fgets(t, 49, stdin);
freq = atol(t);
switch (freq) {
case 48000 : info->sampling_frequency = 1;
***************
*** 236,242 ****
printf("Which layer do you want to use?\n");
printf("Available: Layer (1), Layer (<2>): ");
! gets(t);
switch(*t){
case '1': info->lay = 1; printf(">>> Using Layer %s\n",t); break;
case '2': info->lay = 2; printf(">>> Using Layer %s\n",t); break;
--- 238,244 ----
printf("Which layer do you want to use?\n");
printf("Available: Layer (1), Layer (<2>): ");
! fgets(t, 49, stdin);
switch(*t){
case '1': info->lay = 1; printf(">>> Using Layer %s\n",t); break;
case '2': info->lay = 2; printf(">>> Using Layer %s\n",t); break;
***************
*** 246,252 ****
printf("Which mode do you want?\n");
printf("Available: (<s>)tereo, (j)oint stereo, ");
printf("(d)ual channel, s(i)ngle Channel: ");
! gets(t);
switch(*t){
case 's':
case 'S':
--- 248,254 ----
printf("Which mode do you want?\n");
printf("Available: (<s>)tereo, (j)oint stereo, ");
printf("(d)ual channel, s(i)ngle Channel: ");
! fgets(t, 49, stdin);
switch(*t){
case 's':
case 'S':
***************
*** 275,281 ****
}
printf("Which psychoacoustic model do you want to use? <2>: ");
! gets(t);
model = atoi(t);
if (model > 2 || model < 1) {
printf(">>> Default model 2 selected\n");
--- 277,283 ----
}
printf("Which psychoacoustic model do you want to use? <2>: ");
! fgets(t, 49, stdin);
model = atoi(t);
if (model > 2 || model < 1) {
printf(">>> Default model 2 selected\n");
***************
*** 287,293 ****
}
printf("What is the total bitrate? <%u>[kbps]: ", DFLT_BRT);
! gets(t);
brt = atoi(t);
if (brt == 0) brt = -10;
j=0;
--- 289,295 ----
}
printf("What is the total bitrate? <%u>[kbps]: ", DFLT_BRT);
! fgets(t, 49, stdin);
brt = atoi(t);
if (brt == 0) brt = -10;
j=0;
***************
*** 310,316 ****
printf("What type of de-emphasis should the decoder use?\n");
printf("Available: (<n>)one, (5)0/15 microseconds, (c)citt j.17: ");
! gets(t);
if (*t != 'n' && *t != '5' && *t != 'c') {
printf(">>> Using default no de-emphasis\n");
info->emphasis = 0;
--- 312,318 ----
printf("What type of de-emphasis should the decoder use?\n");
printf("Available: (<n>)one, (5)0/15 microseconds, (c)citt j.17: ");
! fgets(t, 49, stdin);
if (*t != 'n' && *t != '5' && *t != 'c') {
printf(">>> Using default no de-emphasis\n");
info->emphasis = 0;
***************
*** 325,331 ****
/* Start 2. Part changes for CD Ver 3.2; jsp; 22-Aug-1991 */
printf("Do you want to set the private bit? (y/<n>): ");
! gets(t);
if (*t == 'y' || *t == 'Y') info->extension = 1;
else info->extension = 0;
if(info->extension) printf(">>> Private bit set\n");
--- 327,333 ----
/* Start 2. Part changes for CD Ver 3.2; jsp; 22-Aug-1991 */
printf("Do you want to set the private bit? (y/<n>): ");
! fgets(t, 49, stdin);
if (*t == 'y' || *t == 'Y') info->extension = 1;
else info->extension = 0;
if(info->extension) printf(">>> Private bit set\n");
***************
*** 334,361 ****
/* End changes for CD Ver 3.2; jsp; 22-Aug-1991 */
printf("Do you want error protection? (y/<n>): ");
! gets(t);
if (*t == 'y' || *t == 'Y') info->error_protection = TRUE;
else info->error_protection = FALSE;
if(info->error_protection) printf(">>> Error protection used\n");
else printf(">>> Error protection not used\n");
printf("Is the material copyrighted? (y/<n>): ");
! gets(t);
if (*t == 'y' || *t == 'Y') info->copyright = 1;
else info->copyright = 0;
if(info->copyright) printf(">>> Copyrighted material\n");
else printf(">>> Material not copyrighted\n");
printf("Is this the original? (y/<n>): ");
! gets(t);
if (*t == 'y' || *t == 'Y') info->original = 1;
else info->original = 0;
if(info->original) printf(">>> Original material\n");
else printf(">>> Material not original\n");
printf("Do you wish to exit (last chance before encoding)? (y/<n>): ");
! gets(t);
if (*t == 'y' || *t == 'Y') exit(0);
}
--- 336,363 ----
/* End changes for CD Ver 3.2; jsp; 22-Aug-1991 */
printf("Do you want error protection? (y/<n>): ");
! fgets(t, 49, stdin);
if (*t == 'y' || *t == 'Y') info->error_protection = TRUE;
else info->error_protection = FALSE;
if(info->error_protection) printf(">>> Error protection used\n");
else printf(">>> Error protection not used\n");
printf("Is the material copyrighted? (y/<n>): ");
! fgets(t, 49, stdin);
if (*t == 'y' || *t == 'Y') info->copyright = 1;
else info->copyright = 0;
if(info->copyright) printf(">>> Copyrighted material\n");
else printf(">>> Material not copyrighted\n");
printf("Is this the original? (y/<n>): ");
! fgets(t, 49, stdin);
if (*t == 'y' || *t == 'Y') info->original = 1;
else info->original = 0;
if(info->original) printf(">>> Original material\n");
else printf(">>> Material not original\n");
printf("Do you wish to exit (last chance before encoding)? (y/<n>): ");
! fgets(t, 49, stdin);
if (*t == 'y' || *t == 'Y') exit(0);
}

View File

@ -0,0 +1,81 @@
*** musicout.c.orig Tue Jan 4 23:39:27 1994
--- musicout.c Wed May 20 02:41:53 1998
***************
*** 58,63 ****
--- 58,65 ----
#include "common.h"
#include "decoder.h"
+ #include <stdlib.h>
+
/********************************************************************
/*
/* This part contains the MPEG I decoder for Layers I & II.
***************
*** 139,145 ****
if(argc==1) { /* no command line args -> interact */
do {
printf ("Enter encoded file name <required>: ");
! gets (encoded_file_name);
if (encoded_file_name[0] == NULL_CHAR)
printf ("Encoded file name is required. \n");
} while (encoded_file_name[0] == NULL_CHAR);
--- 141,147 ----
if(argc==1) { /* no command line args -> interact */
do {
printf ("Enter encoded file name <required>: ");
! fgets (encoded_file_name, MAX_NAME_SIZE-1, stdin);
if (encoded_file_name[0] == NULL_CHAR)
printf ("Encoded file name is required. \n");
} while (encoded_file_name[0] == NULL_CHAR);
***************
*** 151,157 ****
printf ("Enter MPEG decoded file name <%s%s>: ", encoded_file_name,
DFLT_OPEXT);
#endif
! gets (decoded_file_name);
if (decoded_file_name[0] == NULL_CHAR) {
#ifdef MS_DOS
/* replace old extension with new one, 92-08-19 shn */
--- 153,159 ----
printf ("Enter MPEG decoded file name <%s%s>: ", encoded_file_name,
DFLT_OPEXT);
#endif
! fgets (decoded_file_name, MAX_NAME_SIZE-1,stdin);
if (decoded_file_name[0] == NULL_CHAR) {
#ifdef MS_DOS
/* replace old extension with new one, 92-08-19 shn */
***************
*** 164,170 ****
printf(
"Do you wish to write an AIFF compatible sound file ? (y/<n>) : ");
! gets(t);
if (*t == 'y' || *t == 'Y') need_aiff = TRUE;
else need_aiff = FALSE;
if (need_aiff)
--- 166,172 ----
printf(
"Do you wish to write an AIFF compatible sound file ? (y/<n>) : ");
! fgets(t, 49, stdin);
if (*t == 'y' || *t == 'Y') need_aiff = TRUE;
else need_aiff = FALSE;
if (need_aiff)
***************
*** 173,179 ****
printf(
"Do you wish to exit (last chance before decoding) ? (y/<n>) : ");
! gets(t);
if (*t == 'y' || *t == 'Y') exit(0);
}
else { /* interpret CL Args */
--- 175,181 ----
printf(
"Do you wish to exit (last chance before decoding) ? (y/<n>) : ");
! fgets(t, 49, stdin);
if (*t == 'y' || *t == 'Y') exit(0);
}
else { /* interpret CL Args */

View File

@ -0,0 +1 @@
An MPEG/audio Layer 1 and Layer 2 encoder/decoder package.

View File

@ -0,0 +1 @@
mpegaudio is an MPEG/audio Layer 1 and Layer 2 software package

25
audio/mpegaudio/pkg/PLIST Normal file
View File

@ -0,0 +1,25 @@
bin/mpeg_musicin
bin/mpeg_musicout
lib/mpegaudio/tables/1cb0
lib/mpegaudio/tables/1cb1
lib/mpegaudio/tables/1cb2
lib/mpegaudio/tables/1th0
lib/mpegaudio/tables/1th1
lib/mpegaudio/tables/1th2
lib/mpegaudio/tables/2cb0
lib/mpegaudio/tables/2cb1
lib/mpegaudio/tables/2cb2
lib/mpegaudio/tables/2th0
lib/mpegaudio/tables/2th1
lib/mpegaudio/tables/2th2
lib/mpegaudio/tables/absthr_0
lib/mpegaudio/tables/absthr_1
lib/mpegaudio/tables/absthr_2
lib/mpegaudio/tables/alloc_0
lib/mpegaudio/tables/alloc_1
lib/mpegaudio/tables/alloc_2
lib/mpegaudio/tables/alloc_3
lib/mpegaudio/tables/dewindow
lib/mpegaudio/tables/enwindow
man/man1/mpeg_musicin.1
man/man1/mpeg_musicout.1