acconfig.h   acconfig.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: acconfig.h,v 1.4 2000/03/05 05:19:16 rob Exp $ * $Id: acconfig.h,v 1.5 2000/03/19 06:43:38 rob Exp $
*/ */
/************************************************************************** *** /************************************************************************** ***
* Definitions selected automatically by `configure' * * Definitions selected automatically by `configure' *
************************************************************************** ***/ ************************************************************************** ***/
@TOP@ @TOP@
/* Define to enable a Layer III intensity stereo kluge. */ /* Define to enable a Layer III intensity stereo kluge. */
#undef OPT_ISKLUGE #undef OPT_ISKLUGE
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 audio.h   audio.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: audio.h,v 1.5 2000/03/06 15:20:43 rob Exp $ * $Id: audio.h,v 1.6 2000/03/19 06:43:38 rob Exp $
*/ */
# ifndef AUDIO_H # ifndef AUDIO_H
# define AUDIO_H # define AUDIO_H
# include "libmad.h" # include "libmad.h"
# define MAX_NSAMPLES 1152 # define MAX_NSAMPLES 1152
enum { enum {
skipping to change at line 38 skipping to change at line 38
enum { enum {
audio_cmd_init, audio_cmd_init,
audio_cmd_config, audio_cmd_config,
audio_cmd_play, audio_cmd_play,
audio_cmd_finish audio_cmd_finish
}; };
union audio_control { union audio_control {
short command; short command;
struct audio_init { struct audio_init {
short command; short command;
char const *path; char const *path;
} init; } init;
struct audio_config { struct audio_config {
short command; short command;
unsigned short channels; unsigned short channels;
unsigned int speed; unsigned int speed;
} config; } config;
struct audio_play { struct audio_play {
short command; short command;
unsigned short nsamples; unsigned short nsamples;
fixed_t const *samples[2]; fixed_t const *samples[2];
} play; } play;
struct audio_finish { struct audio_finish {
short command; short command;
} finish; } finish;
}; };
extern char const *audio_error; extern char const *audio_error;
typedef int (*audio_ctlfunc_t)(union audio_control *); typedef int (*audio_ctlfunc_t)(union audio_control *);
audio_ctlfunc_t audio_output(char const *); audio_ctlfunc_t audio_output(char const **);
int audio_oss(union audio_control *); int audio_oss(union audio_control *);
int audio_sun(union audio_control *); int audio_sun(union audio_control *);
int audio_wav(union audio_control *); int audio_wav(union audio_control *);
int audio_raw(union audio_control *);
int audio_hex(union audio_control *); int audio_hex(union audio_control *);
int audio_null(union audio_control *); int audio_null(union audio_control *);
# endif # endif
 End of changes. 7 change blocks. 
2 lines changed or deleted 7 lines changed or added


 bit.h   bit.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: bit.h,v 1.4 2000/03/05 07:31:54 rob Exp $ * $Id: bit.h,v 1.6 2000/03/19 06:43:38 rob Exp $
*/ */
# ifndef BIT_H # ifndef BIT_H
# define BIT_H # define BIT_H
struct mad_bitptr { struct mad_bitptr {
unsigned char const *byte; unsigned char const *byte;
unsigned short cache; unsigned short cache;
unsigned short left; unsigned short left;
}; };
void mad_bit_init(struct mad_bitptr *, unsigned char const *); void mad_bit_init(struct mad_bitptr *, unsigned char const *);
# define mad_bit_finish(bitptr) /* nothing */
unsigned int mad_bit_length(struct mad_bitptr const *, unsigned int mad_bit_length(struct mad_bitptr const *,
struct mad_bitptr const *); struct mad_bitptr const *);
unsigned char const *mad_bit_byte(struct mad_bitptr const *);
void mad_bit_seek(struct mad_bitptr *, unsigned int); # define mad_bit_left(bitptr) ((bitptr)->left)
unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *);
void mad_bit_skip(struct mad_bitptr *, unsigned int);
unsigned long mad_bit_read(struct mad_bitptr *, unsigned int); unsigned long mad_bit_read(struct mad_bitptr *, unsigned int);
void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long);
# define mad_bit_left(bits) ((bits)->left) unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short) ;
# endif # endif
 End of changes. 5 change blocks. 
4 lines changed or deleted 11 lines changed or added


 config.h   config.h 
skipping to change at line 21 skipping to change at line 21
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: acconfig.h,v 1.4 2000/03/05 05:19:16 rob Exp $ * Id: acconfig.h,v 1.5 2000/03/19 06:43:38 rob Exp
*/ */
/************************************************************************** *** /************************************************************************** ***
* Definitions selected automatically by `configure' * * Definitions selected automatically by `configure' *
************************************************************************** ***/ ************************************************************************** ***/
/* Define to empty if the keyword does not work. */ /* Define to empty if the keyword does not work. */
/* #undef const */ /* #undef const */
/* Define if you don't have vprintf but do have _doprnt. */ /* Define if you don't have vprintf but do have _doprnt. */
/* #undef HAVE_DOPRNT */ /* #undef HAVE_DOPRNT */
/* Define if you have a working `mmap' system call. */ /* Define if you have a working `mmap' system call. */
#define HAVE_MMAP 1 #define HAVE_MMAP 1
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#define HAVE_SYS_WAIT_H 1
/* Define if you have the vprintf function. */ /* Define if you have the vprintf function. */
#define HAVE_VPRINTF 1 #define HAVE_VPRINTF 1
/* Define as __inline if that's what the C compiler calls it. */ /* Define as __inline if that's what the C compiler calls it. */
/* #undef inline */ /* #undef inline */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef pid_t */
/* Define if you have the ANSI C header files. */ /* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1 #define STDC_HEADERS 1
/* Define to enable a Layer III intensity stereo kluge. */ /* Define to enable a Layer III intensity stereo kluge. */
#define OPT_ISKLUGE 1 #define OPT_ISKLUGE 1
/* Define to be the name of your default audio output module. */ /* Define to be the name of your default audio output module. */
#define AUDIO_DEFAULT audio_oss #define AUDIO_DEFAULT audio_oss
/* Define only if compiling for the empeg-car. */ /* Define only if compiling for the empeg-car. */
skipping to change at line 67 skipping to change at line 73
/* Define if you have the getpagesize function. */ /* Define if you have the getpagesize function. */
/* #undef HAVE_GETPAGESIZE */ /* #undef HAVE_GETPAGESIZE */
/* Define if you have the <fcntl.h> header file. */ /* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1 #define HAVE_FCNTL_H 1
/* Define if you have the <limits.h> header file. */ /* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1 #define HAVE_LIMITS_H 1
/* Define if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define if you have the <sys/ioctl.h> header file. */ /* Define if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1 #define HAVE_SYS_IOCTL_H 1
/* Define if you have the <unistd.h> header file. */ /* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1 #define HAVE_UNISTD_H 1
/************************************************************************** *** /************************************************************************** ***
* End of automatically configured definitions * * End of automatically configured definitions *
************************************************************************** ***/ ************************************************************************** ***/
 End of changes. 4 change blocks. 
4 lines changed or deleted 7 lines changed or added


 fixed.h   fixed.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: fixed.h,v 1.7 2000/03/05 07:31:55 rob Exp $ * $Id: fixed.h,v 1.8 2000/03/08 14:01:11 rob Exp $
*/ */
# ifndef FIXED_H # ifndef FIXED_H
# define FIXED_H # define FIXED_H
typedef signed long fixed_t; typedef signed long fixed_t;
typedef signed long fixed64hi_t; typedef signed long fixed64hi_t;
typedef unsigned long fixed64lo_t; typedef unsigned long fixed64lo_t;
skipping to change at line 171 skipping to change at line 171
# if 0 # if 0
/* assembler doesn't recognize this instruction? */ /* assembler doesn't recognize this instruction? */
# define FPM_MACC # define FPM_MACC
# define f_macc(hi, lo, x, y) \ # define f_macc(hi, lo, x, y) \
asm ("macc r0,%2,%3" \ asm ("macc r0,%2,%3" \
: "+l" (lo), "+h" (hi) \ : "+l" (lo), "+h" (hi) \
: "%r" (x), "r" (y)); : "%r" (x), "r" (y));
# endif # endif
# elif defined(FPM_SPARC)
/* This SPARC V8 version is accurate but always rounds down the least
significant bit. */
# define FPM_MACRO
# define f_mul(x, y) \
({ fixed64hi_t __hi; \
fixed64lo_t __lo; \
asm ("smul %2,%3,%0; rd %%y,%1" \
: "=r" (__lo), "=r" (__hi) \
: "%r" (x), "rI" (y)); \
f_scale64(__hi, __lo); \
})
# else # else
fixed_t f_mul(fixed_t, fixed_t); fixed_t f_mul(fixed_t, fixed_t);
# endif # endif
fixed_t f_abs(fixed_t); fixed_t f_abs(fixed_t);
# ifdef DEBUG # ifdef DEBUG
fixed_t f_tofixed(double); fixed_t f_tofixed(double);
double f_todouble(fixed_t); double f_todouble(fixed_t);
# endif # endif
 End of changes. 2 change blocks. 
1 lines changed or deleted 16 lines changed or added


 frame.h   frame.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: frame.h,v 1.2 2000/03/05 07:31:55 rob Exp $ * $Id: frame.h,v 1.4 2000/03/19 06:43:38 rob Exp $
*/ */
# ifndef FRAME_H # ifndef FRAME_H
# define FRAME_H # define FRAME_H
# include "timer.h"
# include "fixed.h" # include "fixed.h"
# include "timer.h"
# include "stream.h"
struct mad_frame { struct mad_frame {
int layer; /* audio layer (1, 2, or 3) */ int layer; /* audio layer (1, 2, or 3) */
int mode; /* channel mode (see below) */ int mode; /* channel mode (see below) */
int mode_ext; /* additional mode info */ int mode_ext; /* additional mode info */
int emphasis; /* de-emphasis to use (see b elow) */ int emphasis; /* de-emphasis to use (see b elow) */
unsigned int bitrate; /* stream bitrate (bps) */ unsigned int bitrate; /* stream bitrate (bps) */
unsigned int samplefreq; /* sampling frequency (Hz) */ unsigned int sfreq; /* sampling frequency (Hz) */
struct mad_timer duration; /* audio playing time of frame */ struct mad_timer duration; /* audio playing time of frame */
int flags; /* flags and private bits (below) */ int flags; /* flags and private bits (below) */
fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */ fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
fixed_t overlap[2][32][18]; /* layer III block overlap data */ fixed_t (*overlap)[2][32][18]; /* layer III block overlap data */
}; };
# define MAD_NUMCHANNELS(frame) ((frame)->mode ? 2 : 1) # define MAD_NUMCHANNELS(frame) ((frame)->mode ? 2 : 1)
# define MAD_NUMSAMPLES(frame) ((frame)->layer == 1 ? 12 : 36) # define MAD_NUMSBSAMPLES(frame) ((frame)->layer == 1 ? 12 : 36)
# define MAD_MODE_SINGLE_CHANNEL 0 # define MAD_MODE_SINGLE_CHANNEL 0
# define MAD_MODE_DUAL_CHANNEL 1 # define MAD_MODE_DUAL_CHANNEL 1
# define MAD_MODE_JOINT_STEREO 2 # define MAD_MODE_JOINT_STEREO 2
# define MAD_MODE_STEREO 3 # define MAD_MODE_STEREO 3
# define MAD_EMPH_NONE 0 /* no emphasis */ # define MAD_EMPH_NONE 0 /* no emphasis */
# define MAD_EMPH_50_15_MS 1 /* 50/15 microseconds */ # define MAD_EMPH_50_15_MS 1 /* 50/15 microseconds */
# define MAD_EMPH_CCITT_J_17 3 /* CCITT J.17 */ # define MAD_EMPH_CCITT_J_17 3 /* CCITT J.17 */
skipping to change at line 68 skipping to change at line 69
# define MAD_FLAG_CRCFAILED 0x0200 /* frame CRC failed */ # define MAD_FLAG_CRCFAILED 0x0200 /* frame CRC failed */
# define MAD_FLAG_COPYRIGHT 0x0400 /* frame is copyright */ # define MAD_FLAG_COPYRIGHT 0x0400 /* frame is copyright */
# define MAD_FLAG_ORIGINAL 0x0800 /* frame is original (else copy) */ # define MAD_FLAG_ORIGINAL 0x0800 /* frame is original (else copy) */
# define MAD_FLAG_PADDING 0x1000 /* frame has additional slot */ # define MAD_FLAG_PADDING 0x1000 /* frame has additional slot */
# define MAD_FLAG_PRIVATE 0x0040 /* header private bit */ # define MAD_FLAG_PRIVATE 0x0040 /* header private bit */
# define MAD_FLAG_III_PRIVATE 0x001f /* layer III private bits */ # define MAD_FLAG_III_PRIVATE 0x001f /* layer III private bits */
# define MAD_FLAG_III_5BITPRIV 0x0020 /* 5 bits in III private (else 3) */ # define MAD_FLAG_III_5BITPRIV 0x0020 /* 5 bits in III private (else 3) */
void mad_frame_init(struct mad_frame *); void mad_frame_init(struct mad_frame *);
void mad_frame_finish(struct mad_frame *);
void mad_frame_mute(struct mad_frame *); void mad_frame_mute(struct mad_frame *);
int mad_frame_header(struct mad_frame *, struct mad_stream *,
unsigned short *);
int mad_frame_decode(struct mad_frame *, struct mad_stream *);
# endif # endif
 End of changes. 8 change blocks. 
5 lines changed or deleted 12 lines changed or added


 huffman.h   huffman.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: huffman.h,v 1.3 2000/02/28 02:31:01 rob Exp $ * $Id: huffman.h,v 1.4 2000/03/19 06:43:38 rob Exp $
*/ */
# ifndef HUFFMAN_H # ifndef HUFFMAN_H
# define HUFFMAN_H # define HUFFMAN_H
union huffquad { union huffquad {
struct { struct {
unsigned short final : 1; unsigned short final : 1;
unsigned short hlen : 3; unsigned short hlen : 3;
unsigned short v : 1; unsigned short v : 1;
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 layer12.h   layer12.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: layer12.h,v 1.2 2000/02/28 02:31:01 rob Exp $ * $Id: layer12.h,v 1.4 2000/03/19 06:43:38 rob Exp $
*/ */
# include "stream.h"
# include "frame.h"
int mad_layer_I(struct mad_stream *, struct mad_frame *, int mad_layer_I(struct mad_stream *, struct mad_frame *,
unsigned short const [2]); unsigned short const [2]);
int mad_layer_II(struct mad_stream *, struct mad_frame *, int mad_layer_II(struct mad_stream *, struct mad_frame *,
unsigned short const [2]); unsigned short const [2]);
 End of changes. 2 change blocks. 
1 lines changed or deleted 4 lines changed or added


 layer3.h   layer3.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: layer3.h,v 1.2 2000/02/28 02:31:01 rob Exp $ * $Id: layer3.h,v 1.4 2000/03/19 06:43:38 rob Exp $
*/ */
# include "stream.h"
# include "frame.h"
int mad_layer_III(struct mad_stream *, struct mad_frame *, int mad_layer_III(struct mad_stream *, struct mad_frame *,
unsigned short const [2]); unsigned short const [2]);
 End of changes. 2 change blocks. 
1 lines changed or deleted 4 lines changed or added


 libmad.h   libmad.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* Id: version.h,v 1.10 2000/03/06 15:20:43 rob Exp * Id: version.h,v 1.12 2000/03/19 06:43:39 rob Exp
*/ */
# define MAD_VERSION "0.9.7 (beta)" # define MAD_VERSION "0.10.0 (beta)"
# define MAD_PUBLISHYEAR "2000" # define MAD_PUBLISHYEAR "2000"
# define MAD_AUTHOR "Robert Leslie" # define MAD_AUTHOR "Robert Leslie"
# define MAD_EMAIL "rob@mars.org" # define MAD_EMAIL "rob@mars.org"
extern char const mad_version[]; extern char const mad_version[];
extern char const mad_copyright[]; extern char const mad_copyright[];
extern char const mad_author[]; extern char const mad_author[];
extern char const mad_license[]; extern char const mad_license[];
/* /*
skipping to change at line 50 skipping to change at line 50
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* Id: fixed.h,v 1.7 2000/03/05 07:31:55 rob Exp * Id: fixed.h,v 1.8 2000/03/08 14:01:11 rob Exp
*/ */
# ifndef FIXED_H # ifndef FIXED_H
# define FIXED_H # define FIXED_H
typedef signed long fixed_t; typedef signed long fixed_t;
typedef signed long fixed64hi_t; typedef signed long fixed64hi_t;
typedef unsigned long fixed64lo_t; typedef unsigned long fixed64lo_t;
skipping to change at line 202 skipping to change at line 202
# if 0 # if 0
/* assembler doesn't recognize this instruction? */ /* assembler doesn't recognize this instruction? */
# define FPM_MACC # define FPM_MACC
# define f_macc(hi, lo, x, y) \ # define f_macc(hi, lo, x, y) \
asm ("macc r0,%2,%3" \ asm ("macc r0,%2,%3" \
: "+l" (lo), "+h" (hi) \ : "+l" (lo), "+h" (hi) \
: "%r" (x), "r" (y)); : "%r" (x), "r" (y));
# endif # endif
# elif defined(FPM_SPARC)
/* This SPARC V8 version is accurate but always rounds down the least
significant bit. */
# define FPM_MACRO
# define f_mul(x, y) \
({ fixed64hi_t __hi; \
fixed64lo_t __lo; \
asm ("smul %2,%3,%0; rd %%y,%1" \
: "=r" (__lo), "=r" (__hi) \
: "%r" (x), "rI" (y)); \
f_scale64(__hi, __lo); \
})
# else # else
fixed_t f_mul(fixed_t, fixed_t); fixed_t f_mul(fixed_t, fixed_t);
# endif # endif
fixed_t f_abs(fixed_t); fixed_t f_abs(fixed_t);
# ifdef DEBUG # ifdef DEBUG
fixed_t f_tofixed(double); fixed_t f_tofixed(double);
double f_todouble(fixed_t); double f_todouble(fixed_t);
# endif # endif
skipping to change at line 233 skipping to change at line 248
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* Id: bit.h,v 1.4 2000/03/05 07:31:54 rob Exp * Id: bit.h,v 1.6 2000/03/19 06:43:38 rob Exp
*/ */
# ifndef BIT_H # ifndef BIT_H
# define BIT_H # define BIT_H
struct mad_bitptr { struct mad_bitptr {
unsigned char const *byte; unsigned char const *byte;
unsigned short cache; unsigned short cache;
unsigned short left; unsigned short left;
}; };
void mad_bit_init(struct mad_bitptr *, unsigned char const *); void mad_bit_init(struct mad_bitptr *, unsigned char const *);
# define mad_bit_finish(bitptr) /* nothing */
unsigned int mad_bit_length(struct mad_bitptr const *, unsigned int mad_bit_length(struct mad_bitptr const *,
struct mad_bitptr const *); struct mad_bitptr const *);
unsigned char const *mad_bit_byte(struct mad_bitptr const *);
void mad_bit_seek(struct mad_bitptr *, unsigned int); # define mad_bit_left(bitptr) ((bitptr)->left)
unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *);
void mad_bit_skip(struct mad_bitptr *, unsigned int);
unsigned long mad_bit_read(struct mad_bitptr *, unsigned int); unsigned long mad_bit_read(struct mad_bitptr *, unsigned int);
void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long);
# define mad_bit_left(bits) ((bits)->left) unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short) ;
# endif # endif
/* /*
* mad - MPEG audio decoder * mad - MPEG audio decoder
* Copyright (C) 2000 Robert Leslie * Copyright (C) 2000 Robert Leslie
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
skipping to change at line 274 skipping to change at line 296
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* Id: timer.h,v 1.5 2000/03/07 07:59:25 rob Exp * Id: timer.h,v 1.6 2000/03/19 06:43:39 rob Exp
*/ */
# ifndef TIMER_H # ifndef TIMER_H
# define TIMER_H # define TIMER_H
enum {
timer_hours,
timer_minutes,
timer_seconds
};
struct mad_timer { struct mad_timer {
unsigned long seconds; /* whole seconds */ unsigned long seconds; /* whole seconds */
unsigned int parts36750; /* 1/36750 seconds */ unsigned int parts36750; /* 1/36750 seconds */
}; };
void mad_timer_init(struct mad_timer *); void mad_timer_init(struct mad_timer *);
# define mad_timer_finish(timer) /* nothing */
void mad_timer_add(struct mad_timer *, struct mad_timer const *); void mad_timer_add(struct mad_timer *, struct mad_timer const *);
void mad_timer_str(struct mad_timer const *, char *, char const *, int); void mad_timer_str(struct mad_timer const *, char *, char const *, int);
# define mad_timer_seconds(timer) ((timer)->seconds) # define mad_timer_seconds(timer) ((timer)->seconds)
# define mad_timer_tenths(timer) ((timer)->parts36750 / 3675)
# define MAD_TIMER_HOURS 0x0002
# define MAD_TIMER_MINUTES 0x0001
# define MAD_TIMER_SECONDS 0x0000
# define MAD_TIMER_DECISECONDS 0x0003
# define MAD_TIMER_CENTISECONDS 0x0004
# define MAD_TIMER_MILLISECONDS 0x0005
# endif # endif
/* /*
* mad - MPEG audio decoder * mad - MPEG audio decoder
* Copyright (C) 2000 Robert Leslie * Copyright (C) 2000 Robert Leslie
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
skipping to change at line 318 skipping to change at line 344
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* Id: stream.h,v 1.2 2000/03/05 07:31:55 rob Exp * Id: stream.h,v 1.4 2000/03/19 06:43:38 rob Exp
*/ */
# ifndef STREAM_H # ifndef STREAM_H
# define STREAM_H # define STREAM_H
struct mad_stream { struct mad_stream {
unsigned char const *buffer; /* input bitstream buffer */ unsigned char const *buffer; /* input bitstream buffer */
unsigned char const *bufend; /* end of buffer */ unsigned char const *bufend; /* end of buffer */
unsigned long skiplen; /* bytes to skip before next frame * /
int sync; /* stream sync found */ int sync; /* stream sync found */
unsigned int freerate; /* free bitrate (fixed) */ unsigned int freerate; /* free bitrate (fixed) */
unsigned char const *this_frame; /* start of current frame */ unsigned char const *this_frame; /* start of current frame */
unsigned char const *next_frame; /* start of next frame */ unsigned char const *next_frame; /* start of next frame */
struct mad_bitptr ptr; /* current processing bit pointer */ struct mad_bitptr ptr; /* current processing bit pointer */
struct mad_bitptr anc_ptr; /* ancillary bits pointer */ struct mad_bitptr anc_ptr; /* ancillary bits pointer */
unsigned int anc_bitlen; /* number of ancillary bits */ unsigned int anc_bitlen; /* number of ancillary bits */
unsigned char main_data[1935]; /* layer III main_data */ unsigned char (*main_data)[1935]; /* layer III main_data */
unsigned int md_len; /* bytes in main_data */ unsigned int md_len; /* bytes in main_data */
int error; /* error code (see below) */ int error; /* error code (see below) */
}; };
# define MAD_ERR_BUFLEN 0x0001 /* input buffer too small (o r EOF) */ # define MAD_ERR_BUFLEN 0x0001 /* input buffer too small (o r EOF) */
# define MAD_ERR_BUFPTR 0x0002 /* invalid (null) buffer poi nter */ # define MAD_ERR_BUFPTR 0x0002 /* invalid (null) buffer poi nter */
# define MAD_ERR_NOMEM 0x0031 /* not enough memory */
# define MAD_ERR_LOSTSYNC 0x0101 /* lost synchronization */ # define MAD_ERR_LOSTSYNC 0x0101 /* lost synchronization */
# define MAD_ERR_BADID 0x0102 /* bad header ID field */ # define MAD_ERR_BADID 0x0102 /* bad header ID field */
# define MAD_ERR_BADLAYER 0x0103 /* reserved header layer value */ # define MAD_ERR_BADLAYER 0x0103 /* reserved header layer value */
# define MAD_ERR_BADBITRATE 0x0104 /* forbidden bitrate value */ # define MAD_ERR_BADBITRATE 0x0104 /* forbidden bitrate value */
# define MAD_ERR_BADSAMPLEFREQ 0x0105 /* reserved sample frequency value * / # define MAD_ERR_BADSAMPLEFREQ 0x0105 /* reserved sample frequency value * /
# define MAD_ERR_BADEMPHASIS 0x0106 /* reserved emphasis value */ # define MAD_ERR_BADEMPHASIS 0x0106 /* reserved emphasis value */
# define MAD_ERR_BADCRC 0x0201 /* CRC check failed */ # define MAD_ERR_BADCRC 0x0201 /* CRC check failed */
# define MAD_ERR_BADBITALLOC 0x0211 /* forbidden bit allocation value */ # define MAD_ERR_BADBITALLOC 0x0211 /* forbidden bit allocation value */
skipping to change at line 369 skipping to change at line 397
# define MAD_ERR_BADDATAPTR 0x0233 /* bad main_data_begin pointer */ # define MAD_ERR_BADDATAPTR 0x0233 /* bad main_data_begin pointer */
# define MAD_ERR_BADDATALENGTH 0x0234 /* bad main data length */ # define MAD_ERR_BADDATALENGTH 0x0234 /* bad main data length */
# define MAD_ERR_BADPART3LEN 0x0235 /* bad audio data length */ # define MAD_ERR_BADPART3LEN 0x0235 /* bad audio data length */
# define MAD_ERR_BADHUFFTABLE 0x0236 /* bad Huffman table select */ # define MAD_ERR_BADHUFFTABLE 0x0236 /* bad Huffman table select */
# define MAD_ERR_BADHUFFDATA 0x0237 /* Huffman data value out of range * / # define MAD_ERR_BADHUFFDATA 0x0237 /* Huffman data value out of range * /
# define MAD_ERR_BADSTEREO 0x0238 /* incompatible block_type for M/S * / # define MAD_ERR_BADSTEREO 0x0238 /* incompatible block_type for M/S * /
# define MAD_RECOVERABLE(error) ((error) & 0xff00) # define MAD_RECOVERABLE(error) ((error) & 0xff00)
void mad_stream_init(struct mad_stream *); void mad_stream_init(struct mad_stream *);
void mad_stream_finish(struct mad_stream *);
void mad_stream_buffer(struct mad_stream *, void mad_stream_buffer(struct mad_stream *,
unsigned char const *, unsigned long); unsigned char const *, unsigned long);
void mad_stream_skip(struct mad_stream *, unsigned long);
unsigned char const *mad_stream_sync(unsigned char const *,
unsigned char const *);
# endif # endif
/* /*
* mad - MPEG audio decoder * mad - MPEG audio decoder
* Copyright (C) 2000 Robert Leslie * Copyright (C) 2000 Robert Leslie
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
skipping to change at line 392 skipping to change at line 426
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* Id: frame.h,v 1.2 2000/03/05 07:31:55 rob Exp * Id: frame.h,v 1.4 2000/03/19 06:43:38 rob Exp
*/ */
# ifndef FRAME_H # ifndef FRAME_H
# define FRAME_H # define FRAME_H
struct mad_frame { struct mad_frame {
int layer; /* audio layer (1, 2, or 3) */ int layer; /* audio layer (1, 2, or 3) */
int mode; /* channel mode (see below) */ int mode; /* channel mode (see below) */
int mode_ext; /* additional mode info */ int mode_ext; /* additional mode info */
int emphasis; /* de-emphasis to use (see b elow) */ int emphasis; /* de-emphasis to use (see b elow) */
unsigned int bitrate; /* stream bitrate (bps) */ unsigned int bitrate; /* stream bitrate (bps) */
unsigned int samplefreq; /* sampling frequency (Hz) */ unsigned int sfreq; /* sampling frequency (Hz) */
struct mad_timer duration; /* audio playing time of frame */ struct mad_timer duration; /* audio playing time of frame */
int flags; /* flags and private bits (below) */ int flags; /* flags and private bits (below) */
fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */ fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
fixed_t overlap[2][32][18]; /* layer III block overlap data */ fixed_t (*overlap)[2][32][18]; /* layer III block overlap data */
}; };
# define MAD_NUMCHANNELS(frame) ((frame)->mode ? 2 : 1) # define MAD_NUMCHANNELS(frame) ((frame)->mode ? 2 : 1)
# define MAD_NUMSAMPLES(frame) ((frame)->layer == 1 ? 12 : 36) # define MAD_NUMSBSAMPLES(frame) ((frame)->layer == 1 ? 12 : 36)
# define MAD_MODE_SINGLE_CHANNEL 0 # define MAD_MODE_SINGLE_CHANNEL 0
# define MAD_MODE_DUAL_CHANNEL 1 # define MAD_MODE_DUAL_CHANNEL 1
# define MAD_MODE_JOINT_STEREO 2 # define MAD_MODE_JOINT_STEREO 2
# define MAD_MODE_STEREO 3 # define MAD_MODE_STEREO 3
# define MAD_EMPH_NONE 0 /* no emphasis */ # define MAD_EMPH_NONE 0 /* no emphasis */
# define MAD_EMPH_50_15_MS 1 /* 50/15 microseconds */ # define MAD_EMPH_50_15_MS 1 /* 50/15 microseconds */
# define MAD_EMPH_CCITT_J_17 3 /* CCITT J.17 */ # define MAD_EMPH_CCITT_J_17 3 /* CCITT J.17 */
skipping to change at line 438 skipping to change at line 472
# define MAD_FLAG_CRCFAILED 0x0200 /* frame CRC failed */ # define MAD_FLAG_CRCFAILED 0x0200 /* frame CRC failed */
# define MAD_FLAG_COPYRIGHT 0x0400 /* frame is copyright */ # define MAD_FLAG_COPYRIGHT 0x0400 /* frame is copyright */
# define MAD_FLAG_ORIGINAL 0x0800 /* frame is original (else copy) */ # define MAD_FLAG_ORIGINAL 0x0800 /* frame is original (else copy) */
# define MAD_FLAG_PADDING 0x1000 /* frame has additional slot */ # define MAD_FLAG_PADDING 0x1000 /* frame has additional slot */
# define MAD_FLAG_PRIVATE 0x0040 /* header private bit */ # define MAD_FLAG_PRIVATE 0x0040 /* header private bit */
# define MAD_FLAG_III_PRIVATE 0x001f /* layer III private bits */ # define MAD_FLAG_III_PRIVATE 0x001f /* layer III private bits */
# define MAD_FLAG_III_5BITPRIV 0x0020 /* 5 bits in III private (else 3) */ # define MAD_FLAG_III_5BITPRIV 0x0020 /* 5 bits in III private (else 3) */
void mad_frame_init(struct mad_frame *); void mad_frame_init(struct mad_frame *);
void mad_frame_finish(struct mad_frame *);
void mad_frame_mute(struct mad_frame *); void mad_frame_mute(struct mad_frame *);
int mad_frame_header(struct mad_frame *, struct mad_stream *,
unsigned short *);
int mad_frame_decode(struct mad_frame *, struct mad_stream *);
# endif # endif
/* /*
* mad - MPEG audio decoder * mad - MPEG audio decoder
* Copyright (C) 2000 Robert Leslie * Copyright (C) 2000 Robert Leslie
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* Id: synth.h,v 1.3 2000/03/05 18:11:34 rob Exp * Id: synth.h,v 1.5 2000/03/19 06:43:38 rob Exp
*/ */
# ifndef SYNTH_H # ifndef SYNTH_H
# define SYNTH_H # define SYNTH_H
struct mad_synth { struct mad_synth {
fixed_t filterout[2][2][256]; /* polyphase filterbank outp uts */ fixed_t filterout[2][2][256]; /* polyphase filterbank outp uts */
unsigned short slot; /* current processing slot */ unsigned short slot; /* current processing slot */
unsigned short pcmlen; /* number of PCM samples */ unsigned short pcmlen; /* number of PCM samples */
fixed_t pcmout[2][1152]; /* PCM sample outputs */ fixed_t pcmout[2][1152]; /* PCM sample outputs */
}; };
void mad_synth_init(struct mad_synth *); void mad_synth_init(struct mad_synth *);
void mad_synthesis(struct mad_frame *, struct mad_synth *); # define mad_synth_finish(synth) /* nothing */
void mad_synth_frame(struct mad_synth *, struct mad_frame const *);
# endif # endif
/* /*
* mad - MPEG audio decoder * mad - MPEG audio decoder
* Copyright (C) 2000 Robert Leslie * Copyright (C) 2000 Robert Leslie
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
skipping to change at line 498 skipping to change at line 540
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* Id: mad.h,v 1.4 2000/03/05 07:31:55 rob Exp * Id: decoder.h,v 1.2 2000/03/19 06:43:38 rob Exp
*/ */
# ifndef MAD_H # ifndef DECODER_H
# define MAD_H # define DECODER_H
unsigned short mad_crc(unsigned short, struct mad_bitptr, unsigned int); struct mad_decoder {
int mad_decode(struct mad_stream *, struct mad_frame *); int mode;
struct {
int mode;
int pid;
int in;
int out;
} async;
struct {
struct mad_stream stream;
struct mad_frame frame;
struct mad_synth synth;
} *sync;
int (*input_func)(void *, struct mad_stream *);
int (*filter_func)(void *, struct mad_frame *);
int (*output_func)(void *, struct mad_frame const *,
struct mad_synth const *);
int (*error_func)(void *, struct mad_stream *, struct mad_frame *);
void *input_data;
void *filter_data;
void *output_data;
void *error_data;
};
enum {
mad_cmd_play,
mad_cmd_pause,
mad_cmd_rewind,
mad_cmd_skip,
mad_cmd_stop
};
union mad_control {
short command;
struct mad_cmd_play {
short command;
} play;
struct mad_cmd_pause {
short command;
} pause;
struct mad_cmd_rewind {
short command;
} rewind;
struct mad_cmd_skip {
short command;
} skip;
struct mad_cmd_stop {
short command;
} stop;
};
void mad_decoder_init(struct mad_decoder *);
int mad_decoder_finish(struct mad_decoder *);
void mad_decoder_input(struct mad_decoder *,
int (*)(void *, struct mad_stream *), void *);
void mad_decoder_filter(struct mad_decoder *,
int (*)(void *, struct mad_frame *), void *);
void mad_decoder_output(struct mad_decoder *,
int (*)(void *, struct mad_frame const *,
struct mad_synth const *), void *);
void mad_decoder_error(struct mad_decoder *,
int (*)(void *, struct mad_stream *,
struct mad_frame *), void *);
int mad_decoder_run(struct mad_decoder *, int);
int mad_decoder_command(struct mad_decoder *, union mad_control *);
# define MAD_DECODER_SYNC 0x0000
# define MAD_DECODER_ASYNC 0x0001
# define MAD_DECODER_CONTINUE 0x0000
# define MAD_DECODER_STOP 0x0010
# define MAD_DECODER_BREAK 0x0011
# define MAD_DECODER_IGNORE 0x0020
# endif # endif
 End of changes. 30 change blocks. 
28 lines changed or deleted 152 lines changed or added


 stream.h   stream.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: stream.h,v 1.2 2000/03/05 07:31:55 rob Exp $ * $Id: stream.h,v 1.4 2000/03/19 06:43:38 rob Exp $
*/ */
# ifndef STREAM_H # ifndef STREAM_H
# define STREAM_H # define STREAM_H
# include "bit.h" # include "bit.h"
struct mad_stream { struct mad_stream {
unsigned char const *buffer; /* input bitstream buffer */ unsigned char const *buffer; /* input bitstream buffer */
unsigned char const *bufend; /* end of buffer */ unsigned char const *bufend; /* end of buffer */
unsigned long skiplen; /* bytes to skip before next frame * /
int sync; /* stream sync found */ int sync; /* stream sync found */
unsigned int freerate; /* free bitrate (fixed) */ unsigned int freerate; /* free bitrate (fixed) */
unsigned char const *this_frame; /* start of current frame */ unsigned char const *this_frame; /* start of current frame */
unsigned char const *next_frame; /* start of next frame */ unsigned char const *next_frame; /* start of next frame */
struct mad_bitptr ptr; /* current processing bit pointer */ struct mad_bitptr ptr; /* current processing bit pointer */
struct mad_bitptr anc_ptr; /* ancillary bits pointer */ struct mad_bitptr anc_ptr; /* ancillary bits pointer */
unsigned int anc_bitlen; /* number of ancillary bits */ unsigned int anc_bitlen; /* number of ancillary bits */
unsigned char main_data[1935]; /* layer III main_data */ unsigned char (*main_data)[1935]; /* layer III main_data */
unsigned int md_len; /* bytes in main_data */ unsigned int md_len; /* bytes in main_data */
int error; /* error code (see below) */ int error; /* error code (see below) */
}; };
# define MAD_ERR_BUFLEN 0x0001 /* input buffer too small (o r EOF) */ # define MAD_ERR_BUFLEN 0x0001 /* input buffer too small (o r EOF) */
# define MAD_ERR_BUFPTR 0x0002 /* invalid (null) buffer poi nter */ # define MAD_ERR_BUFPTR 0x0002 /* invalid (null) buffer poi nter */
# define MAD_ERR_NOMEM 0x0031 /* not enough memory */
# define MAD_ERR_LOSTSYNC 0x0101 /* lost synchronization */ # define MAD_ERR_LOSTSYNC 0x0101 /* lost synchronization */
# define MAD_ERR_BADID 0x0102 /* bad header ID field */ # define MAD_ERR_BADID 0x0102 /* bad header ID field */
# define MAD_ERR_BADLAYER 0x0103 /* reserved header layer value */ # define MAD_ERR_BADLAYER 0x0103 /* reserved header layer value */
# define MAD_ERR_BADBITRATE 0x0104 /* forbidden bitrate value */ # define MAD_ERR_BADBITRATE 0x0104 /* forbidden bitrate value */
# define MAD_ERR_BADSAMPLEFREQ 0x0105 /* reserved sample frequency value * / # define MAD_ERR_BADSAMPLEFREQ 0x0105 /* reserved sample frequency value * /
# define MAD_ERR_BADEMPHASIS 0x0106 /* reserved emphasis value */ # define MAD_ERR_BADEMPHASIS 0x0106 /* reserved emphasis value */
# define MAD_ERR_BADCRC 0x0201 /* CRC check failed */ # define MAD_ERR_BADCRC 0x0201 /* CRC check failed */
# define MAD_ERR_BADBITALLOC 0x0211 /* forbidden bit allocation value */ # define MAD_ERR_BADBITALLOC 0x0211 /* forbidden bit allocation value */
skipping to change at line 72 skipping to change at line 74
# define MAD_ERR_BADDATAPTR 0x0233 /* bad main_data_begin pointer */ # define MAD_ERR_BADDATAPTR 0x0233 /* bad main_data_begin pointer */
# define MAD_ERR_BADDATALENGTH 0x0234 /* bad main data length */ # define MAD_ERR_BADDATALENGTH 0x0234 /* bad main data length */
# define MAD_ERR_BADPART3LEN 0x0235 /* bad audio data length */ # define MAD_ERR_BADPART3LEN 0x0235 /* bad audio data length */
# define MAD_ERR_BADHUFFTABLE 0x0236 /* bad Huffman table select */ # define MAD_ERR_BADHUFFTABLE 0x0236 /* bad Huffman table select */
# define MAD_ERR_BADHUFFDATA 0x0237 /* Huffman data value out of range * / # define MAD_ERR_BADHUFFDATA 0x0237 /* Huffman data value out of range * /
# define MAD_ERR_BADSTEREO 0x0238 /* incompatible block_type for M/S * / # define MAD_ERR_BADSTEREO 0x0238 /* incompatible block_type for M/S * /
# define MAD_RECOVERABLE(error) ((error) & 0xff00) # define MAD_RECOVERABLE(error) ((error) & 0xff00)
void mad_stream_init(struct mad_stream *); void mad_stream_init(struct mad_stream *);
void mad_stream_finish(struct mad_stream *);
void mad_stream_buffer(struct mad_stream *, void mad_stream_buffer(struct mad_stream *,
unsigned char const *, unsigned long); unsigned char const *, unsigned long);
void mad_stream_skip(struct mad_stream *, unsigned long);
unsigned char const *mad_stream_sync(unsigned char const *,
unsigned char const *);
# endif # endif
 End of changes. 6 change blocks. 
2 lines changed or deleted 10 lines changed or added


 synth.h   synth.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: synth.h,v 1.3 2000/03/05 18:11:34 rob Exp $ * $Id: synth.h,v 1.5 2000/03/19 06:43:38 rob Exp $
*/ */
# ifndef SYNTH_H # ifndef SYNTH_H
# define SYNTH_H # define SYNTH_H
# include "fixed.h"
# include "frame.h" # include "frame.h"
struct mad_synth { struct mad_synth {
fixed_t filterout[2][2][256]; /* polyphase filterbank outp uts */ fixed_t filterout[2][2][256]; /* polyphase filterbank outp uts */
unsigned short slot; /* current processing slot */ unsigned short slot; /* current processing slot */
unsigned short pcmlen; /* number of PCM samples */ unsigned short pcmlen; /* number of PCM samples */
fixed_t pcmout[2][1152]; /* PCM sample outputs */ fixed_t pcmout[2][1152]; /* PCM sample outputs */
}; };
void mad_synth_init(struct mad_synth *); void mad_synth_init(struct mad_synth *);
void mad_synthesis(struct mad_frame *, struct mad_synth *); # define mad_synth_finish(synth) /* nothing */
void mad_synth_frame(struct mad_synth *, struct mad_frame const *);
# endif # endif
 End of changes. 3 change blocks. 
2 lines changed or deleted 5 lines changed or added


 timer.h   timer.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: timer.h,v 1.5 2000/03/07 07:59:25 rob Exp $ * $Id: timer.h,v 1.6 2000/03/19 06:43:39 rob Exp $
*/ */
# ifndef TIMER_H # ifndef TIMER_H
# define TIMER_H # define TIMER_H
enum {
timer_hours,
timer_minutes,
timer_seconds
};
struct mad_timer { struct mad_timer {
unsigned long seconds; /* whole seconds */ unsigned long seconds; /* whole seconds */
unsigned int parts36750; /* 1/36750 seconds */ unsigned int parts36750; /* 1/36750 seconds */
}; };
void mad_timer_init(struct mad_timer *); void mad_timer_init(struct mad_timer *);
# define mad_timer_finish(timer) /* nothing */
void mad_timer_add(struct mad_timer *, struct mad_timer const *); void mad_timer_add(struct mad_timer *, struct mad_timer const *);
void mad_timer_str(struct mad_timer const *, char *, char const *, int); void mad_timer_str(struct mad_timer const *, char *, char const *, int);
# define mad_timer_seconds(timer) ((timer)->seconds) # define mad_timer_seconds(timer) ((timer)->seconds)
# define mad_timer_tenths(timer) ((timer)->parts36750 / 3675)
# define MAD_TIMER_HOURS 0x0002
# define MAD_TIMER_MINUTES 0x0001
# define MAD_TIMER_SECONDS 0x0000
# define MAD_TIMER_DECISECONDS 0x0003
# define MAD_TIMER_CENTISECONDS 0x0004
# define MAD_TIMER_MILLISECONDS 0x0005
# endif # endif
 End of changes. 4 change blocks. 
8 lines changed or deleted 12 lines changed or added


 version.h   version.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: version.h,v 1.10 2000/03/06 15:20:43 rob Exp $ * $Id: version.h,v 1.12 2000/03/19 06:43:39 rob Exp $
*/ */
# define MAD_VERSION "0.9.7 (beta)" # define MAD_VERSION "0.10.0 (beta)"
# define MAD_PUBLISHYEAR "2000" # define MAD_PUBLISHYEAR "2000"
# define MAD_AUTHOR "Robert Leslie" # define MAD_AUTHOR "Robert Leslie"
# define MAD_EMAIL "rob@mars.org" # define MAD_EMAIL "rob@mars.org"
extern char const mad_version[]; extern char const mad_version[];
extern char const mad_copyright[]; extern char const mad_copyright[];
extern char const mad_author[]; extern char const mad_author[];
extern char const mad_license[]; extern char const mad_license[];
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/