Commit 13411a9c authored by Led's avatar Led

0.7.0

parent 82ba78e0
...@@ -79,6 +79,9 @@ rm <string name> ...@@ -79,6 +79,9 @@ rm <string name>
save <string name> save <string name>
saves the current playlist to _name_.m3u in the playlist directory saves the current playlist to _name_.m3u in the playlist directory
repeat <int state>
set repeat state to _state_, _state_ should be 0 or 1
search <string type> <string what> search <string type> <string what>
same as "find" but searches for any song that contain _what_ same as "find" but searches for any song that contain _what_
...@@ -86,7 +89,10 @@ shuffle ...@@ -86,7 +89,10 @@ shuffle
shuffles the current playlist shuffles the current playlist
status status
reports current status of player, one of the folloowing: reports current status of player, and volume level.
volume level is printed first (0-100).
repeat status is printed second (0 or 1).
then player status, one of the following:
"stop" - player is stopped "stop" - player is stopped
"play <int song> <int elapsed>:<time total>" "play <int song> <int elapsed>:<time total>"
- playing _song_ with _elapses_ seconds, and the song - playing _song_ with _elapses_ seconds, and the song
...@@ -99,3 +105,6 @@ stop ...@@ -99,3 +105,6 @@ stop
update update
searches mp3 directory for new music and removes old music from the db searches mp3 directory for new music and removes old music from the db
volume <int change>
change volume by amount _change_
ver 0.7.0 (2003/6/20)
1) use mad instead of mpg123 for mp3 decoding
2) volume support
3) repeate playlist support
4) use autoconf/automake (i.e. "configure")
5) configurable max connections
ver 0.6.2 (2003/6/11) ver 0.6.2 (2003/6/11)
1) Buffer support for ogg 1) Buffer support for ogg
2) new config file options: "connection_timeout" and "mpg123_ignore_junk" 2) new config file options: "connection_timeout" and "mpg123_ignore_junk"
3) new commands: "next", "previous", and "listall" 3) new commands: "next", "previous", and "listall"
Thanks to Nicklas Hofer for "next" and "previous" patches!
4) Search by filename 4) Search by filename
5) bug fix for pause when playing mp3's 5) bug fix for pause when playing mp3's
......
Music Player Daemon - FAQ
By: Nick Texidor
Q) How do I install mpd.
A) The usual way :^). untar the archive file, run 'make' (or 'make ogg' for
ogg vorbis support). Then, as su, 'make install'.
Q) How do I run mpd.
A) Change to the path mpd was installed to, i.e. /usr/local/mpd. Type
'mpd <port> <mp3/ogg directory> <playlist directory> <log file> <error file>'
i.e. mpd 2100 /mnt/jukebox /usr/local/mpd/playlists /usr/local/mpd/mpd.log /usr/local/mpd/mpd.error
Once mpd starts, it will explore your MP3/Ogg directory.
Q) How do I tell mpd to play music?
A) You can use a telnet interface (telnet <machine-name> <port>), or you
can download phpMp and queue songs via a web interface.
Q) How do I use telnet to play music using mpd?
A) login to the telnet session (telnet <machine-name> <port>). You
should see 'OK MPD 0.x.x' (where x is a number).
To queue songs to play, you use the command ADD, i.e.:
add "/path/to/song/song.mp3"
This should respond with 'OK'. If it says that it's an invalid mp3
file, then check the path. The path is relative to your current path.
To check the playlist, type PLAYLIST and press enter. To start
the playlist, type PLAY n (where n is a number from the
playlist, 0 would start playing from the top of the playlist).
Other commands include:
clear - to clear the playlist
pause - to pause playback
lsinfo <directory [optional]> - list contents of directory
save <file name> - saves the current playlist
shuffle - shuffles the playlist
find album|artist|title <search string> - Searches the specified field for
requested string
stop - Stop playing
update - Updates the MP3/Ogg Directory
Q) How do I start mpd automatically at boot time
A) Currently, there isn't a "nice" way of doing this. You can start it
as root (beware!) by entering 'mpd 2100 /mnt/jukebox /usr/local/mpd/playlists/usr/local/mpd/mpd.log /usr/local/mpd/mpd.error'
into your /etc/rc.d/rc.local file.
Q) What do I need to use mpd?
A) 1) mpg123 (or preferably mpg321)
and/or
2) ogg, vorbis, and libao (make sure you have the libogg, libvorbis, and libao
development and library packages installed for your distro. For Red Hat, the
rpm's are libogg, libogg-devel, libvorbis, libvorbis-devel, libao, and i
libao-devel)
Q) I queued a song to the playlist, but when mpd played it, it
didn't play properly
A) hmm, we haven't gotten to the bottom of this yet! It seems some
headers cause some mp3's to not play properly, and instead, appears to
play the track at very highspeed resulting in squeaking. This appears
to be a problem with mpg123. mpg321 has better results, but the track
seems to be distorted, while xmms plays the track without any problems.
Q) How can I get mpd to start playing music automatically when it starts
up
A) This can be done with a bit of jiggery pokery using the rc.local
script. After the command to start mpd, you can automate a telnet
session to load a playlist and issue a shuffle command. (Alternately,
hassle Warren to implement such a wonder feature) :^)
(From Warren - something is coming sonn)
Q) Can I send the output from mpd to IceCast/ShoutCast
A) No. Again, if you email your favourite mpd author, he may be able to
implement this little beaut of a feature! :^)
(if you have a gazillion US dollars to donate to warren's legal defense,
this feature can be implemented more quickly).
...@@ -3,14 +3,10 @@ ...@@ -3,14 +3,10 @@
Requirements Requirements
------------ ------------
mpg123 - http://www.mpg123.de (MPD has been tested with 0.59q and 0.59r) libao - http://www.vorbis.com/download_unix.psp
(mpg123 is included with many distributions and supports many platforms) (This comes with most/all distrobutions. Make sure you have both
the ao libs and development packages for your distrobution installed.
or For Red Hat 8.0, the neccessary packages are: libao and libao-devel)
mpg321 - http://mpg321.sourceforge.net
(debian and other distributions substitute mpg123 with mpg321, if so, make
sure mpg123 is symlinked to mpg321)
Optional Optional
-------- --------
...@@ -21,11 +17,6 @@ ogg and vorbis libs as well as the development packages for your ...@@ -21,11 +17,6 @@ ogg and vorbis libs as well as the development packages for your
distrobution installed. For Red Hat 8.0, the neccessary packages are: distrobution installed. For Red Hat 8.0, the neccessary packages are:
libogg, libogg-devel, libvorbis, and libvorbis-devel). libogg, libogg-devel, libvorbis, and libvorbis-devel).
libao - http://www.xiph.org/ogg/vorbis/ (You need this for ogg vorbis)
(This also comes with most/all distrobutions. Make sure you have both
the libao libs and development packages for your distrobution installed.
For Red Hat 8.0, the neccessary packages are: libao and libao-devel)
Download Download
-------- --------
...@@ -42,25 +33,19 @@ $ tar zxvf mpd-x.x.x.tar.gz ...@@ -42,25 +33,19 @@ $ tar zxvf mpd-x.x.x.tar.gz
$ cd mpd-x.x.x $ cd mpd-x.x.x
3) compile 3) Run configure script (this will determine what dependencies you have)
$ make $ ./configure
NOTE: for Ogg Vorbis support run make with the "ogg" target:
$ make ogg
NOTE: to recompile you must remove the compiled files with: 4) Compile
$ make clean $ make
Install Install (Optional)
------- -------
1) copy "mpd" to a directory in path (Optional)
(as root) (as root)
$ cp mpd /usr/local/bin $ make install
Run Run
--- ---
...@@ -82,7 +67,7 @@ $ mpd-x.x.x/mpd 2100 mp3 playlists mpd.log mpd.err ...@@ -82,7 +67,7 @@ $ mpd-x.x.x/mpd 2100 mp3 playlists mpd.log mpd.err
Note: The first time you run mpd, it will "explore" your mp3 directory for Note: The first time you run mpd, it will "explore" your mp3 directory for
mp3's. mp3's.
Also, for MPD >= 0.6.1, mpd can alternatively use config file. In this case, Also, mpd can alternatively use config file. In this case,
run mpd like this: run mpd like this:
$ mpd <config file> $ mpd <config file>
...@@ -99,4 +84,4 @@ Using MPD ...@@ -99,4 +84,4 @@ Using MPD
You can download a web interface (phpMp) to MPD at You can download a web interface (phpMp) to MPD at
http://musicpd.sourceforge.net . http://musicpd.sourceforge.net .
MPD can be interfaced directly using telnet (see command.c, if you are brave). MPD can be interfaced directly using telnet (see COMMANDS, if you are brave).
EXEC = mpd
OGG_MAKEFILE = Makefile.ogg
-include Makefile.ogg
PREFIX = /usr/local
BIN_DIR = $(PREFIX)/bin
INSTALL_DIR = $(PREFIX)/$(EXEC)
CC = gcc
LIBS = $(OGG_LIBS) -ldl
INCLUDES =
CFLAGS = -Wall $(INCLUDES) $(HAVE_OGG)
OFLAGS = -Wall
DFLAGS = -MM $(INCLUDES) $(HAVE_OGG)
SOURCES = main.c buffer2array.c mpg123.c interface.c command.c playlist.c ls.c \
id3v2lib/charset.c id3v2lib/lib_id3v2.3.c id3v1lib/lib_id3v1.c \
id3v2lib/lib_id3v2.2.c song.c list.c directory.c tables.c utils.c \
tag.c player.c ogg.c listen.c conf.c ogg_decode.c
OBJECTS = $(SOURCES:.c=.o)
DEPENDFILE = Makefile.depend
all: $(EXEC)
ogg: ogg-make
$(MAKE) all
$(MAKE) clean-ogg-make
ogg-make:
echo "HAVE_OGG = -DHAVE_OGG" > $(OGG_MAKEFILE)
echo "OGG_LIBS = -lvorbisfile -lvorbis -lao" >> $(OGG_MAKEFILE)
$(EXEC): $(OBJECTS)
$(CC) $(OFLAGS) -o $(EXEC) $(OBJECTS) $(LIBS)
deps:
$(CC) $(DFLAGS) $(SOURCES) > $(DEPENDFILE)
-include $(DEPENDFILE)
install: $(EXEC)
mkdir -p $(INSTALL_DIR)
cp $(EXEC) $(INSTALL_DIR)
ln -s $(INSTALL_DIR)/$(EXEC) $(BIN_DIR)/$(EXEC)
uninstall:
rm $(BIN_DIR)/$(EXEC)
rm $(INSTALL_DIR)/$(EXEC)
rm -r $(INSTALL_DIR)
clean:
rm -f $(EXEC) $(OBJECTS)
clean-deps:
rm -f $(DEPENDFILE)
clean-ogg-make:
rm -f $(OGG_MAKEFILE)
clean-all: clean clean-deps clean-ogg-make
bin_PROGRAMS = mpd
SUBDIRS = id3v1lib id3v2lib libmad
pkgdata_DATA = mpdconf.example README INSTALL
EXTRA_DIST = COMMANDS UPGRADING $(pkgdata_DATA)
mpd_headers = buffer2array.h interface.h command.h playlist.h ls.h \
song.h list.h directory.h tables.h utils.h path.h \
tag.h player.h listen.h conf.h ogg_decode.h volume.h mp3_decode.h
mpd_SOURCES = main.c buffer2array.c interface.c command.c playlist.c ls.c \
song.c list.c directory.c tables.c utils.c path.c \
tag.c player.c listen.c conf.c ogg_decode.c volume.c mp3_decode.c \
$(mpd_headers)
MAD_LIB = libmad/.libs/libmad.a
ID3_LIB = id3v2lib/libid3v2.a id3v1lib/libid3v1.a
mpd_LDADD = $(MAD_LIB) $(ID3_LIB)
This diff is collapsed. Click to expand it.
...@@ -9,6 +9,10 @@ retrieval, and playlist management can all be managed remotely. ...@@ -9,6 +9,10 @@ retrieval, and playlist management can all be managed remotely.
To install MPD, see INSTALL. To install MPD, see INSTALL.
MPD includes 3 libraries in the source. id3v1lib and id3v2lib are released
under the GPL and copyrighted by Samuel Abels (sam@manicsadness.com). libmad
is copyrighted by Robert Leslie (http://www.underbit.com/products/mad).
MPD is released under the GNU Public License. MPD is released under the GNU Public License.
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
......
1) make timeout and max connections configurabe via config file 1) store song times (possibly after playing)
2) volume control 2) flac support
3) use mpglib from mpg123 for mp3 support 3) seeking
4) use autoconf and automake 4) set flags (such as BAD MP3)
5) broadcast messages (including status changes/updates)
6) store song times (possibly after playing)
7) add a set a flags (such as BAD MP3)
possibly: possibly:
--------- ---------
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -22,6 +22,8 @@ ...@@ -22,6 +22,8 @@
#include "ls.h" #include "ls.h"
#include "directory.h" #include "directory.h"
#include "tables.h" #include "tables.h"
#include "volume.h"
#include "path.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
...@@ -50,6 +52,8 @@ ...@@ -50,6 +52,8 @@
#define COMMAND_NEXT "next" #define COMMAND_NEXT "next"
#define COMMAND_PREVIOUS "previous" #define COMMAND_PREVIOUS "previous"
#define COMMAND_LISTALL "listall" #define COMMAND_LISTALL "listall"
#define COMMAND_VOLUME "volume"
#define COMMAND_REPEAT "repeat"
extern Playlist playlist; extern Playlist playlist;
...@@ -73,10 +77,10 @@ int commandStatus(FILE * fp,int argArrayLength, char ** argArray) { ...@@ -73,10 +77,10 @@ int commandStatus(FILE * fp,int argArrayLength, char ** argArray) {
} }
if(getPlayerState()>0) { if(getPlayerState()>0) {
fprintf(fp,"%s %i %i:%i\n",state,playlist.current,getPlayerElapsedTime(),getPlayerTotalTime()); fprintf(fp,"%i %i %s %i %i:%i\n",getVolumeLevel(),getPlaylistRepeatStatus(),state,playlist.current,getPlayerElapsedTime(),getPlayerTotalTime());
} }
else { else {
fprintf(fp,"%s\n",state); fprintf(fp,"%i %i %s\n",getVolumeLevel(),getPlaylistRepeatStatus(),state);
} }
free(state); free(state);
...@@ -180,6 +184,34 @@ int processCommand(FILE * fp, int argArrayLength, char ** argArray) { ...@@ -180,6 +184,34 @@ int processCommand(FILE * fp, int argArrayLength, char ** argArray) {
} }
return deleteFromPlaylist(fp,song); return deleteFromPlaylist(fp,song);
} }
else if(0==strcmp(argArray[0],COMMAND_VOLUME)) {
int change;
char * test;
if(argArrayLength!=2) {
fprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
return -1;
}
change = strtol(argArray[1],&test,10);
if(*test!='\0') {
fprintf(fp,"%s need a integer\n",COMMAND_RESPOND_ERROR);
return -1;
}
return changeVolumeLevel(fp,change);
}
else if(0==strcmp(argArray[0],COMMAND_REPEAT)) {
int status;
char * test;
if(argArrayLength!=2) {
fprintf(fp,"%s wrong number of arguments for \"%s\"\n",COMMAND_RESPOND_ERROR,argArray[0]);
return -1;
}
status = strtol(argArray[1],&test,10);
if(*test!='\0') {
fprintf(fp,"%s need a integer\n",COMMAND_RESPOND_ERROR);
return -1;
}
return setPlaylistRepeatStatus(fp,status);
}
else if(0==strcmp(argArray[0],COMMAND_PLAYLISTINFO)) { else if(0==strcmp(argArray[0],COMMAND_PLAYLISTINFO)) {
int song = -1; int song = -1;
char * test; char * test;
......
...@@ -28,25 +28,23 @@ ...@@ -28,25 +28,23 @@
#define MAX_STRING_SIZE MAXPATHLEN+80 #define MAX_STRING_SIZE MAXPATHLEN+80
#define CONF_NUMBER_OF_PARAMS 9 #define CONF_NUMBER_OF_PARAMS 8
#define CONF_NUMBER_OF_PATHS 4 #define CONF_NUMBER_OF_PATHS 4
#define CONF_NUMBER_OF_REQUIRED 5 #define CONF_NUMBER_OF_REQUIRED 5
#define CONF_MPG123_COMMAND_DEFAULT "mpg123 -b 2048 -R foo"
#define CONF_MPG123_PROCESS_DEFAULT "mpg123"
#define CONF_MPG123_IGNORE_JUNK_DEFAULT "yes"
#define CONF_CONNECTION_TIMEOUT_DEFAULT "60" #define CONF_CONNECTION_TIMEOUT_DEFAULT "60"
#define CONF_MIXER_DEVICE_DEFAULT "/dev/mixer"
#define CONF_MAX_CONNECTIONS_DEFAULT "5"
char conf_strings[CONF_NUMBER_OF_PARAMS][24] = { char conf_strings[CONF_NUMBER_OF_PARAMS][24] = {
"mpg123_command",
"port", "port",
"music_directory", "music_directory",
"playlist_directory", "playlist_directory",
"log_file", "log_file",
"error_file", "error_file",
"mpg123_process", "connection_timeout",
"mpg123_ignore_junk", "mixer_device",
"connection_timeout" "max_connections"
}; };
int conf_absolutePaths[CONF_NUMBER_OF_PATHS] = { int conf_absolutePaths[CONF_NUMBER_OF_PATHS] = {
...@@ -72,10 +70,9 @@ void initConf() { ...@@ -72,10 +70,9 @@ void initConf() {
for(i=0;i<CONF_NUMBER_OF_PARAMS;i++) conf_params[i] = NULL; for(i=0;i<CONF_NUMBER_OF_PARAMS;i++) conf_params[i] = NULL;
/* we don't specify these on the command line */ /* we don't specify these on the command line */
conf_params[CONF_MPG123_COMMAND] = strdup(CONF_MPG123_COMMAND_DEFAULT);
conf_params[CONF_MPG123_PROCESS] = strdup(CONF_MPG123_PROCESS_DEFAULT);
conf_params[CONF_MPG123_IGNORE_JUNK] = strdup(CONF_MPG123_IGNORE_JUNK_DEFAULT);
conf_params[CONF_CONNECTION_TIMEOUT] = strdup(CONF_CONNECTION_TIMEOUT_DEFAULT); conf_params[CONF_CONNECTION_TIMEOUT] = strdup(CONF_CONNECTION_TIMEOUT_DEFAULT);
conf_params[CONF_MIXER_DEVICE] = strdup(CONF_MIXER_DEVICE_DEFAULT);
conf_params[CONF_MAX_CONNECTIONS] = strdup(CONF_MAX_CONNECTIONS_DEFAULT);
} }
char ** readConf(char * file) { char ** readConf(char * file) {
......
...@@ -19,15 +19,14 @@ ...@@ -19,15 +19,14 @@
#ifndef CONF_H #ifndef CONF_H
#define CONF_H #define CONF_H
#define CONF_MPG123_COMMAND 0 #define CONF_PORT 0
#define CONF_PORT 1 #define CONF_MUSIC_DIRECTORY 1
#define CONF_MUSIC_DIRECTORY 2 #define CONF_PLAYLIST_DIRECTORY 2
#define CONF_PLAYLIST_DIRECTORY 3 #define CONF_LOG_FILE 3
#define CONF_LOG_FILE 4 #define CONF_ERROR_FILE 4
#define CONF_ERROR_FILE 5 #define CONF_CONNECTION_TIMEOUT 5
#define CONF_MPG123_PROCESS 6 #define CONF_MIXER_DEVICE 6
#define CONF_MPG123_IGNORE_JUNK 7 #define CONF_MAX_CONNECTIONS 7
#define CONF_CONNECTION_TIMEOUT 8
/* do not free the return value, it is a static variable */ /* do not free the return value, it is a static variable */
char ** readConf(char * file); char ** readConf(char * file);
......
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This source diff could not be displayed because it is too large. You can view the blob instead.
AC_INIT(main.c)
AM_INIT_AUTOMAKE(mpd, 0.7.0)
AC_CONFIG_SUBDIRS(libmad)
CFLAGS="-Wall"
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_LIBTOOL
dnl MAD wants this stuff
AC_SUBST(CCAS)
AC_SUBST(CCASFLAGS)
AM_PATH_AO(LIBS="$LIBS $AO_LIBS" CFLAGS="$CFLAGS $AO_CFLAGS",AC_MSG_ERROR(Must have libao installed!!!))
AC_CHECK_HEADER(sys/soundcard.h,CFLAGS="$CFLAGS",[CFLAGS="$CFLAGS -DNO_LINUX_OSS_MIXER";AC_MSG_WARN(Soundcard headers not found -- disabling mixer)])
AC_ARG_ENABLE(ogg,[ --disable-ogg disable ogg support],,enable_ogg=yes)
if test x$enable_ogg = xyes; then
AM_PATH_OGG(LIBS="$LIBS $OGG_LIBS" CFLAGS="$CFLAGS $OGG_CFLAGS",enable_ogg=no)
fi
if test x$enable_ogg = xyes; then
AM_PATH_VORBIS(LIBS="$LIBS $VORBIS_LIBS $VORBISFILE_LIBS" CFLAGS="$CFLAGS $VORBIS_CFLAGS $VORBISFILE_CFLAGS",enable_ogg=no)
fi
if test x$enable_ogg = xyes; then
CFLAGS="$CFLAGS -DHAVE_OGG"
fi
AC_OUTPUT(Makefile libmad/Makefile id3v1lib/Makefile id3v2lib/Makefile)
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "command.h" #include "command.h"
#include "tables.h" #include "tables.h"
#include "utils.h" #include "utils.h"
#include "path.h"
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
...@@ -145,7 +146,7 @@ int removeDeletedFromDirectory(Directory * directory) { ...@@ -145,7 +146,7 @@ int removeDeletedFromDirectory(Directory * directory) {
cwd[1] = '\0'; cwd[1] = '\0';
if(dirname==NULL) dirname=cwd; if(dirname==NULL) dirname=cwd;
if((dir = opendir(dirname))==NULL) return -1; if((dir = opendir(rmp2amp(dirname)))==NULL) return -1;
while((ent = readdir(dir))) { while((ent = readdir(dir))) {
if(ent->d_name[0]=='.') continue; /* hide hidden stuff */ if(ent->d_name[0]=='.') continue; /* hide hidden stuff */
...@@ -208,7 +209,7 @@ int updateDirectory(Directory * directory) { ...@@ -208,7 +209,7 @@ int updateDirectory(Directory * directory) {
removeDeletedFromDirectory(directory); removeDeletedFromDirectory(directory);
} }
if((dir = opendir(dirname))==NULL) return -1; if((dir = opendir(rmp2amp(dirname)))==NULL) return -1;
while((ent = readdir(dir))) { while((ent = readdir(dir))) {
if(ent->d_name[0]=='.') continue; /* hide hidden stuff */ if(ent->d_name[0]=='.') continue; /* hide hidden stuff */
...@@ -239,7 +240,7 @@ int exploreDirectory(Directory * directory) { ...@@ -239,7 +240,7 @@ int exploreDirectory(Directory * directory) {
cwd[1] = '\0'; cwd[1] = '\0';
if(dirname==NULL) dirname=cwd; if(dirname==NULL) dirname=cwd;
if((dir = opendir(dirname))==NULL) return -1; if((dir = opendir(rmp2amp(dirname)))==NULL) return -1;
printf("explore: %s\n",dirname); printf("explore: %s\n",dirname);
while((ent = readdir(dir))) { while((ent = readdir(dir))) {
......
noinst_LIBRARIES=libid3v1.a
libid3v1_a_headers = lib_id3v1.h genre.h
libid3v1_a_SOURCES = lib_id3v1.c $(libid3v1_a_headers)
# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
AO_CFLAGS = @AO_CFLAGS@
AO_LIBS = @AO_LIBS@
AS = @AS@
CC = @CC@
CCAS = @CCAS@
CCASFLAGS = @CCASFLAGS@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
EXEEXT = @EXEEXT@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OGG_CFLAGS = @OGG_CFLAGS@
OGG_LIBS = @OGG_LIBS@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
STRIP = @STRIP@
VERSION = @VERSION@
VORBISENC_LIBS = @VORBISENC_LIBS@
VORBISFILE_LIBS = @VORBISFILE_LIBS@
VORBIS_CFLAGS = @VORBIS_CFLAGS@
VORBIS_LIBS = @VORBIS_LIBS@
noinst_LIBRARIES = libid3v1.a
libid3v1_a_headers = lib_id3v1.h genre.h
libid3v1_a_SOURCES = lib_id3v1.c $(libid3v1_a_headers)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
DEFS = @DEFS@ -I. -I$(srcdir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
libid3v1_a_LIBADD =
libid3v1_a_OBJECTS = lib_id3v1.$(OBJEXT)
AR = ar
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = README COPYING Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
SOURCES = $(libid3v1_a_SOURCES)
OBJECTS = $(libid3v1_a_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .lo .o .obj .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps id3v1lib/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-noinstLIBRARIES:
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
distclean-noinstLIBRARIES:
maintainer-clean-noinstLIBRARIES:
.c.o:
$(COMPILE) -c $<
# FIXME: We should only use cygpath when building on Windows,
# and only if it is available.
.c.obj:
$(COMPILE) -c `cygpath -w $<`
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
-rm -f *.$(OBJEXT)
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
.c.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.s.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.S.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
maintainer-clean-libtool:
libid3v1.a: $(libid3v1_a_OBJECTS) $(libid3v1_a_DEPENDENCIES)
-rm -f libid3v1.a
$(AR) cru libid3v1.a $(libid3v1_a_OBJECTS) $(libid3v1_a_LIBADD)
$(RANLIB) libid3v1.a
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = id3v1lib
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am:
install-exec: install-exec-am
install-data-am:
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am:
uninstall: uninstall-am
all-am: Makefile $(LIBRARIES)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \
mostlyclean-libtool mostlyclean-tags \
mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-noinstLIBRARIES clean-compile clean-libtool clean-tags \
clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-noinstLIBRARIES distclean-compile \
distclean-libtool distclean-tags distclean-generic \
clean-am
-rm -f libtool
distclean: distclean-am
maintainer-clean-am: maintainer-clean-noinstLIBRARIES \
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-tags maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
install-exec install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
noinst_LIBRARIES=libid3v2.a
libid3v2_a_headers = charset.h lib_id3v2.2.h lib_id3v2.3.h genre.h
libid3v2_a_SOURCES = charset.c lib_id3v2.2.c lib_id3v2.3.c $(libid3v2_a_headers)
# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
AO_CFLAGS = @AO_CFLAGS@
AO_LIBS = @AO_LIBS@
AS = @AS@
CC = @CC@
CCAS = @CCAS@
CCASFLAGS = @CCASFLAGS@
DLLTOOL = @DLLTOOL@
ECHO = @ECHO@
EXEEXT = @EXEEXT@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAKEINFO = @MAKEINFO@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OGG_CFLAGS = @OGG_CFLAGS@
OGG_LIBS = @OGG_LIBS@
PACKAGE = @PACKAGE@
RANLIB = @RANLIB@
STRIP = @STRIP@
VERSION = @VERSION@
VORBISENC_LIBS = @VORBISENC_LIBS@
VORBISFILE_LIBS = @VORBISFILE_LIBS@
VORBIS_CFLAGS = @VORBIS_CFLAGS@
VORBIS_LIBS = @VORBIS_LIBS@
noinst_LIBRARIES = libid3v2.a
libid3v2_a_headers = charset.h lib_id3v2.2.h lib_id3v2.3.h genre.h
libid3v2_a_SOURCES = charset.c lib_id3v2.2.c lib_id3v2.3.c $(libid3v2_a_headers)
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_CLEAN_FILES =
LIBRARIES = $(noinst_LIBRARIES)
DEFS = @DEFS@ -I. -I$(srcdir)
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
libid3v2_a_LIBADD =
libid3v2_a_OBJECTS = charset.$(OBJEXT) lib_id3v2.2.$(OBJEXT) \
lib_id3v2.3.$(OBJEXT)
AR = ar
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
DIST_COMMON = README COPYING Makefile.am Makefile.in
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = tar
GZIP_ENV = --best
SOURCES = $(libid3v2_a_SOURCES)
OBJECTS = $(libid3v2_a_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .lo .o .obj .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --foreign --include-deps id3v2lib/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-noinstLIBRARIES:
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
distclean-noinstLIBRARIES:
maintainer-clean-noinstLIBRARIES:
.c.o:
$(COMPILE) -c $<
# FIXME: We should only use cygpath when building on Windows,
# and only if it is available.
.c.obj:
$(COMPILE) -c `cygpath -w $<`
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
-rm -f *.$(OBJEXT)
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
.c.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.s.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.S.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
maintainer-clean-libtool:
libid3v2.a: $(libid3v2_a_OBJECTS) $(libid3v2_a_DEPENDENCIES)
-rm -f libid3v2.a
$(AR) cru libid3v2.a $(libid3v2_a_OBJECTS) $(libid3v2_a_LIBADD)
$(RANLIB) libid3v2.a
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = id3v2lib
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am:
install-exec: install-exec-am
install-data-am:
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am:
uninstall: uninstall-am
all-am: Makefile $(LIBRARIES)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
mostlyclean-generic:
clean-generic:
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
mostlyclean-am: mostlyclean-noinstLIBRARIES mostlyclean-compile \
mostlyclean-libtool mostlyclean-tags \
mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-noinstLIBRARIES clean-compile clean-libtool clean-tags \
clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-noinstLIBRARIES distclean-compile \
distclean-libtool distclean-tags distclean-generic \
clean-am
-rm -f libtool
distclean: distclean-am
maintainer-clean-am: maintainer-clean-noinstLIBRARIES \
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-tags maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-noinstLIBRARIES distclean-noinstLIBRARIES \
clean-noinstLIBRARIES maintainer-clean-noinstLIBRARIES \
mostlyclean-compile distclean-compile clean-compile \
maintainer-clean-compile mostlyclean-libtool distclean-libtool \
clean-libtool maintainer-clean-libtool tags mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir info-am info \
dvi-am dvi check check-am installcheck-am installcheck install-exec-am \
install-exec install-data-am install-data install-am install \
uninstall-am uninstall all-redirect all-am all installdirs \
mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
#!/bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0
...@@ -30,13 +30,11 @@ ...@@ -30,13 +30,11 @@
#include <string.h> #include <string.h>
#include <fcntl.h> #include <fcntl.h>
#define VERSION "0.6.2"
#define GREETING "MPD" #define GREETING "MPD"
#define INTERFACE_MAX_BUFFER_LENGTH 1024 #define INTERFACE_MAX_BUFFER_LENGTH 1024
#define INTERFACE_MAX_CONNECTIONS 5 int interface_max_connections;
int interface_timeout; int interface_timeout;
typedef struct _Interface { typedef struct _Interface {
...@@ -48,7 +46,7 @@ typedef struct _Interface { ...@@ -48,7 +46,7 @@ typedef struct _Interface {
time_t lastTime; time_t lastTime;
} Interface; } Interface;
Interface interfaces[INTERFACE_MAX_CONNECTIONS]; Interface * interfaces = NULL;
void openInterface(Interface * interface, int fd) { void openInterface(Interface * interface, int fd) {
assert(interface->open==0); assert(interface->open==0);
...@@ -77,9 +75,9 @@ void closeInterface(Interface * interface) { ...@@ -77,9 +75,9 @@ void closeInterface(Interface * interface) {
void openAInterface(int fd) { void openAInterface(int fd) {
int i; int i;
for(i=0;i<INTERFACE_MAX_CONNECTIONS && interfaces[i].open;i++); for(i=0;i<interface_max_connections && interfaces[i].open;i++);
if(i==INTERFACE_MAX_CONNECTIONS) { if(i==interface_max_connections) {
FILE * fp = fdopen(fd,"w"); FILE * fp = fdopen(fd,"w");
fprintf(fp,"%s Max Connections Reached!\n",COMMAND_RESPOND_ERROR); fprintf(fp,"%s Max Connections Reached!\n",COMMAND_RESPOND_ERROR);
fclose(fp); fclose(fp);
...@@ -134,7 +132,7 @@ void addInterfacesToFdSet(fd_set * fds) { ...@@ -134,7 +132,7 @@ void addInterfacesToFdSet(fd_set * fds) {
FD_ZERO(fds); FD_ZERO(fds);
for(i=0;i<INTERFACE_MAX_CONNECTIONS;i++) { for(i=0;i<interface_max_connections;i++) {
if(interfaces[i].open) { if(interfaces[i].open) {
FD_SET(interfaces[i].fd,fds); FD_SET(interfaces[i].fd,fds);
} }
...@@ -152,7 +150,7 @@ int readInputFromInterfaces() { ...@@ -152,7 +150,7 @@ int readInputFromInterfaces() {
addInterfacesToFdSet(&fds); addInterfacesToFdSet(&fds);
while(select(FD_SETSIZE,&fds,NULL,NULL,&tv)) { while(select(FD_SETSIZE,&fds,NULL,NULL,&tv)) {
for(i=0;i<INTERFACE_MAX_CONNECTIONS;i++) { for(i=0;i<interface_max_connections;i++) {
if(interfaces[i].open && FD_ISSET(interfaces[i].fd,&fds)) { if(interfaces[i].open && FD_ISSET(interfaces[i].fd,&fds)) {
if(COMMAND_RETURN_KILL==interfaceReadInput(&(interfaces[i]))) { if(COMMAND_RETURN_KILL==interfaceReadInput(&(interfaces[i]))) {
return COMMAND_RETURN_KILL; return COMMAND_RETURN_KILL;
...@@ -170,41 +168,45 @@ void initInterfaces() { ...@@ -170,41 +168,45 @@ void initInterfaces() {
int i; int i;
char * test; char * test;
for(i=0;i<INTERFACE_MAX_CONNECTIONS;i++) {
interfaces[i].open = 0;
}
interface_timeout = strtol((getConf())[CONF_CONNECTION_TIMEOUT],&test,10); interface_timeout = strtol((getConf())[CONF_CONNECTION_TIMEOUT],&test,10);
if(*test!='\0') { if(*test!='\0') {
fprintf(stderr,"connection timeout \"%s\" is not an integer\n",(getConf())[CONF_CONNECTION_TIMEOUT]); fprintf(stderr,"connection timeout \"%s\" is not an integer\n",(getConf())[CONF_CONNECTION_TIMEOUT]);
exit(-1); exit(-1);
} }
interface_max_connections = strtol((getConf())[CONF_MAX_CONNECTIONS],&test,10);
if(*test!='\0') {
fprintf(stderr,"max connections \"%s\" is not an integer\n",(getConf())[CONF_MAX_CONNECTIONS]);
exit(-1);
}
interfaces = malloc(sizeof(Interface)*interface_max_connections);
for(i=0;i<interface_max_connections;i++) {
interfaces[i].open = 0;
}
} }
void closeAllInterfaces() { void closeAllInterfaces() {
int i; int i;
for(i=0;i<INTERFACE_MAX_CONNECTIONS;i++) { for(i=0;i<interface_max_connections;i++) {
if(interfaces[i].open) { if(interfaces[i].open) {
closeInterface(&(interfaces[i])); closeInterface(&(interfaces[i]));
} }
} }
} }
void closeAllInterfaceFDs() { void freeAllInterfaces() {
int i; closeAllInterfaces();
for(i=0;i<INTERFACE_MAX_CONNECTIONS;i++) { free(interfaces);
if(interfaces[i].open) {
close(interfaces[i].fd);
}
}
} }
void closeOldInterfaces() { void closeOldInterfaces() {
int i; int i;
for(i=0;i<INTERFACE_MAX_CONNECTIONS;i++) { for(i=0;i<interface_max_connections;i++) {
if(interfaces[i].open && (time(NULL)-interfaces[i].lastTime>interface_timeout)) { if(interfaces[i].open && (time(NULL)-interfaces[i].lastTime>interface_timeout)) {
closeInterface(&(interfaces[i])); closeInterface(&(interfaces[i]));
} }
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
void initInterfaces(); void initInterfaces();
void openAInterface(int fd); void openAInterface(int fd);
void closeAllInterfaces(); void closeAllInterfaces();
void closeAllInterfaceFDs(); void freeAllInterfaces();
void closeOldInterfaces(); void closeOldInterfaces();
int readInputFromInterfaces(); int readInputFromInterfaces();
......
This diff is collapsed. Click to expand it.
libmad - MPEG audio decoder library
Copyright (C) 2000-2001 Robert Leslie
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
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
If you would like to negotiate alternate licensing terms, you may do
so by contacting the author: Robert Leslie <rob@mars.org>
This diff is collapsed. Click to expand it.
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.
##
## libmad - MPEG audio decoder library
## Copyright (C) 2000-2001 Robert Leslie
##
## 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
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##
## $Id: Makefile.am,v 1.2 2003/06/18 20:46:35 shank Exp $
##
## Process this file with automake to produce Makefile.in
noinst_LTLIBRARIES = libmad.la
noinst_HEADERS = mad.h
EXTRA_DIST = COPYRIGHT mad.h.sed
exported_headers = \
version.h fixed.h bit.h timer.h stream.h frame.h synth.h decoder.h
headers = \
$(exported_headers) global.h layer12.h layer3.h huffman.h
data_includes = \
D.dat imdct_s.dat qc_table.dat rq_table.dat sf_table.dat
libmad_la_SOURCES = \
version.c fixed.c bit.c timer.c stream.c frame.c synth.c decoder.c \
layer12.c layer3.c huffman.c $(headers) $(data_includes)
EXTRA_libmad_la_SOURCES = imdct_l_arm.S #synth_mmx.S
libmad_la_DEPENDENCIES = @ASO_OBJS@
libmad_la_LIBADD = @ASO_OBJS@
#CFLAGS = -Wall @CFLAGS@ $(ARCH) $(DEBUGGER) $(OPTIMIZER) $(PROFILER)
#LDFLAGS = @LDFLAGS@ $(PROFILER)
INCLUDES = $(FPM) $(ASO)
BUILT_SOURCES = mad.h
CLEANFILES = mad.h
## From the libtool documentation on library versioning:
##
## CURRENT
## The most recent interface number that this library implements.
##
## REVISION
## The implementation number of the CURRENT interface.
##
## AGE
## The difference between the newest and oldest interfaces that this
## library implements. In other words, the library implements all the
## interface numbers in the range from number `CURRENT - AGE' to
## `CURRENT'.
##
## If two libraries have identical CURRENT and AGE numbers, then the
## dynamic linker chooses the library with the greater REVISION number.
##
## 1. Start with version information of `0:0:0' for each libtool library.
##
## 2. Update the version information only immediately before a public
## release of your software. More frequent updates are unnecessary,
## and only guarantee that the current interface number gets larger
## faster.
##
## 3. If the library source code has changed at all since the last
## update, then increment REVISION (`C:R:A' becomes `C:r+1:A').
##
## 4. If any interfaces have been added, removed, or changed since the
## last update, increment CURRENT, and set REVISION to 0.
##
## 5. If any interfaces have been added since the last public release,
## then increment AGE.
##
## 6. If any interfaces have been removed since the last public release,
## then set AGE to 0.
version_current = 1
version_revision = 0
version_age = 1
version_info = $(version_current):$(version_revision):$(version_age)
libmad_la_LDFLAGS = -version-info $(version_info)
## -release $(VERSION)
mad.h: config.status config.h Makefile.am \
$(srcdir)/COPYRIGHT $(srcdir)/mad.h.sed $(exported_headers)
(sed -e '1s|.*|/*|' -e '1b' -e '$$s|.*| */|' -e '$$b' \
-e 's/^.*/ *&/' $(srcdir)/COPYRIGHT; echo; \
echo "# ifdef __cplusplus"; \
echo 'extern "C" {'; \
echo "# endif"; echo; \
if [ ".$(FPM)" != "." ]; then \
echo ".$(FPM)" | sed -e 's|^\.-D|# define |'; echo; \
fi; \
sed -ne 's/^# *define *\(HAVE_.*_ASM\).*/# define \1/p' \
config.h; echo; \
sed -ne 's/^# *define *OPT_\(SPEED\|ACCURACY\).*/# define OPT_\1/p' \
config.h; echo; \
sed -ne 's/^# *define *\(SIZEOF_.*\)/# define \1/p' \
config.h; echo; \
for header in $(exported_headers); do \
echo; \
sed -n -f $(srcdir)/mad.h.sed $(srcdir)/$$header; echo; \
done; \
echo "# ifdef __cplusplus"; \
echo '}'; \
echo "# endif") | cat -s >$@
libtool: $(LIBTOOL_DEPS)
$(SHELL) ./config.status --recheck
.c.s:
$(COMPILE) -S $<
again: clean all
.PHONY: again
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: acconfig.h,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
# ifndef LIBMAD_CONFIG_H
# define LIBMAD_CONFIG_H
/*****************************************************************************
* Definitions selected automatically by `configure' *
*****************************************************************************/
@TOP@
/* Define to optimize for speed over accuracy. */
#undef OPT_SPEED
/* Define to optimize for accuracy over speed. */
#undef OPT_ACCURACY
/* Define to enable a fast subband synthesis approximation optimization. */
#undef OPT_SSO
/* Define to influence a strict interpretation of the ISO/IEC standards,
even if this is in opposition with best accepted practices. */
#undef OPT_STRICT
/* Define if your MIPS CPU supports a 2-operand MADD instruction. */
#undef HAVE_MADD_ASM
/* Define if your MIPS CPU supports a 2-operand MADD16 instruction. */
#undef HAVE_MADD16_ASM
/* Define to enable diagnostic debugging support. */
#undef DEBUG
/* Define to disable debugging assertions. */
#undef NDEBUG
/* Define to enable experimental code. */
#undef EXPERIMENTAL
@BOTTOM@
/*****************************************************************************
* End of automatically configured definitions *
*****************************************************************************/
# endif
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: bit.c,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
# ifdef HAVE_CONFIG_H
# include "config.h"
# endif
# include "global.h"
# ifdef HAVE_LIMITS_H
# include <limits.h>
# else
# define CHAR_BIT 8
# endif
# include "bit.h"
/*
* This is the lookup table for computing the CRC-check word.
* As described in section 2.4.3.1 and depicted in Figure A.9
* of ISO/IEC 11172-3, the generator polynomial is:
*
* G(X) = X^16 + X^15 + X^2 + 1
*/
static
unsigned short const crc_table[256] = {
0x0000, 0x8005, 0x800f, 0x000a, 0x801b, 0x001e, 0x0014, 0x8011,
0x8033, 0x0036, 0x003c, 0x8039, 0x0028, 0x802d, 0x8027, 0x0022,
0x8063, 0x0066, 0x006c, 0x8069, 0x0078, 0x807d, 0x8077, 0x0072,
0x0050, 0x8055, 0x805f, 0x005a, 0x804b, 0x004e, 0x0044, 0x8041,
0x80c3, 0x00c6, 0x00cc, 0x80c9, 0x00d8, 0x80dd, 0x80d7, 0x00d2,
0x00f0, 0x80f5, 0x80ff, 0x00fa, 0x80eb, 0x00ee, 0x00e4, 0x80e1,
0x00a0, 0x80a5, 0x80af, 0x00aa, 0x80bb, 0x00be, 0x00b4, 0x80b1,
0x8093, 0x0096, 0x009c, 0x8099, 0x0088, 0x808d, 0x8087, 0x0082,
0x8183, 0x0186, 0x018c, 0x8189, 0x0198, 0x819d, 0x8197, 0x0192,
0x01b0, 0x81b5, 0x81bf, 0x01ba, 0x81ab, 0x01ae, 0x01a4, 0x81a1,
0x01e0, 0x81e5, 0x81ef, 0x01ea, 0x81fb, 0x01fe, 0x01f4, 0x81f1,
0x81d3, 0x01d6, 0x01dc, 0x81d9, 0x01c8, 0x81cd, 0x81c7, 0x01c2,
0x0140, 0x8145, 0x814f, 0x014a, 0x815b, 0x015e, 0x0154, 0x8151,
0x8173, 0x0176, 0x017c, 0x8179, 0x0168, 0x816d, 0x8167, 0x0162,
0x8123, 0x0126, 0x012c, 0x8129, 0x0138, 0x813d, 0x8137, 0x0132,
0x0110, 0x8115, 0x811f, 0x011a, 0x810b, 0x010e, 0x0104, 0x8101,
0x8303, 0x0306, 0x030c, 0x8309, 0x0318, 0x831d, 0x8317, 0x0312,
0x0330, 0x8335, 0x833f, 0x033a, 0x832b, 0x032e, 0x0324, 0x8321,
0x0360, 0x8365, 0x836f, 0x036a, 0x837b, 0x037e, 0x0374, 0x8371,
0x8353, 0x0356, 0x035c, 0x8359, 0x0348, 0x834d, 0x8347, 0x0342,
0x03c0, 0x83c5, 0x83cf, 0x03ca, 0x83db, 0x03de, 0x03d4, 0x83d1,
0x83f3, 0x03f6, 0x03fc, 0x83f9, 0x03e8, 0x83ed, 0x83e7, 0x03e2,
0x83a3, 0x03a6, 0x03ac, 0x83a9, 0x03b8, 0x83bd, 0x83b7, 0x03b2,
0x0390, 0x8395, 0x839f, 0x039a, 0x838b, 0x038e, 0x0384, 0x8381,
0x0280, 0x8285, 0x828f, 0x028a, 0x829b, 0x029e, 0x0294, 0x8291,
0x82b3, 0x02b6, 0x02bc, 0x82b9, 0x02a8, 0x82ad, 0x82a7, 0x02a2,
0x82e3, 0x02e6, 0x02ec, 0x82e9, 0x02f8, 0x82fd, 0x82f7, 0x02f2,
0x02d0, 0x82d5, 0x82df, 0x02da, 0x82cb, 0x02ce, 0x02c4, 0x82c1,
0x8243, 0x0246, 0x024c, 0x8249, 0x0258, 0x825d, 0x8257, 0x0252,
0x0270, 0x8275, 0x827f, 0x027a, 0x826b, 0x026e, 0x0264, 0x8261,
0x0220, 0x8225, 0x822f, 0x022a, 0x823b, 0x023e, 0x0234, 0x8231,
0x8213, 0x0216, 0x021c, 0x8219, 0x0208, 0x820d, 0x8207, 0x0202
};
# define CRC_POLY 0x8005
/*
* NAME: bit->init()
* DESCRIPTION: initialize bit pointer struct
*/
void mad_bit_init(struct mad_bitptr *bitptr, unsigned char const *byte)
{
bitptr->byte = byte;
bitptr->cache = 0;
bitptr->left = CHAR_BIT;
}
/*
* NAME: bit->length()
* DESCRIPTION: return number of bits between start and end points
*/
unsigned int mad_bit_length(struct mad_bitptr const *begin,
struct mad_bitptr const *end)
{
return begin->left +
CHAR_BIT * (end->byte - (begin->byte + 1)) + (CHAR_BIT - end->left);
}
/*
* NAME: bit->nextbyte()
* DESCRIPTION: return pointer to next unprocessed byte
*/
unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *bitptr)
{
return bitptr->left == CHAR_BIT ? bitptr->byte : bitptr->byte + 1;
}
/*
* NAME: bit->skip()
* DESCRIPTION: advance bit pointer
*/
void mad_bit_skip(struct mad_bitptr *bitptr, unsigned int len)
{
bitptr->byte += len / CHAR_BIT;
bitptr->left -= len % CHAR_BIT;
if (bitptr->left > CHAR_BIT) {
bitptr->byte++;
bitptr->left += CHAR_BIT;
}
if (bitptr->left < CHAR_BIT)
bitptr->cache = *bitptr->byte;
}
/*
* NAME: bit->read()
* DESCRIPTION: read an arbitrary number of bits and return their UIMSBF value
*/
unsigned long mad_bit_read(struct mad_bitptr *bitptr, unsigned int len)
{
register unsigned long value;
if (bitptr->left == CHAR_BIT)
bitptr->cache = *bitptr->byte;
if (len < bitptr->left) {
value = (bitptr->cache & ((1 << bitptr->left) - 1)) >>
(bitptr->left - len);
bitptr->left -= len;
return value;
}
/* remaining bits in current byte */
value = bitptr->cache & ((1 << bitptr->left) - 1);
len -= bitptr->left;
bitptr->byte++;
bitptr->left = CHAR_BIT;
/* more bytes */
while (len >= CHAR_BIT) {
value = (value << CHAR_BIT) | *bitptr->byte++;
len -= CHAR_BIT;
}
if (len > 0) {
bitptr->cache = *bitptr->byte;
value = (value << len) | (bitptr->cache >> (CHAR_BIT - len));
bitptr->left -= len;
}
return value;
}
# if 0
/*
* NAME: bit->write()
* DESCRIPTION: write an arbitrary number of bits
*/
void mad_bit_write(struct mad_bitptr *bitptr, unsigned int len,
unsigned long value)
{
unsigned char *ptr;
ptr = (unsigned char *) bitptr->byte;
/* ... */
}
# endif
/*
* NAME: bit->crc()
* DESCRIPTION: compute CRC-check word
*/
unsigned short mad_bit_crc(struct mad_bitptr bitptr, unsigned int len,
unsigned short init)
{
register unsigned int crc;
for (crc = init; len >= 32; len -= 32) {
register unsigned long data;
data = mad_bit_read(&bitptr, 32);
crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 24)) & 0xff];
crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 16)) & 0xff];
crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 8)) & 0xff];
crc = (crc << 8) ^ crc_table[((crc >> 8) ^ (data >> 0)) & 0xff];
}
switch (len / 8) {
case 3: crc = (crc << 8) ^
crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
case 2: crc = (crc << 8) ^
crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
case 1: crc = (crc << 8) ^
crc_table[((crc >> 8) ^ mad_bit_read(&bitptr, 8)) & 0xff];
len %= 8;
case 0: break;
}
while (len--) {
register unsigned int msb;
msb = mad_bit_read(&bitptr, 1) ^ (crc >> 15);
crc <<= 1;
if (msb & 1)
crc ^= CRC_POLY;
}
return crc & 0xffff;
}
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: bit.h,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
# ifndef LIBMAD_BIT_H
# define LIBMAD_BIT_H
struct mad_bitptr {
unsigned char const *byte;
unsigned short cache;
unsigned short left;
};
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 *,
struct mad_bitptr const *);
# define mad_bit_bitsleft(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);
void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long);
unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short);
# endif
/* config.h.in. Generated automatically from configure.in by autoheader 2.13. */
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: acconfig.h,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
# ifndef LIBMAD_CONFIG_H
# define LIBMAD_CONFIG_H
/*****************************************************************************
* Definitions selected automatically by `configure' *
*****************************************************************************/
/* Define to empty if the keyword does not work. */
#undef const
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define as __inline if that's what the C compiler calls it. */
#undef inline
/* Define to `int' if <sys/types.h> doesn't define. */
#undef pid_t
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to optimize for speed over accuracy. */
#undef OPT_SPEED
/* Define to optimize for accuracy over speed. */
#undef OPT_ACCURACY
/* Define to enable a fast subband synthesis approximation optimization. */
#undef OPT_SSO
/* Define to influence a strict interpretation of the ISO/IEC standards,
even if this is in opposition with best accepted practices. */
#undef OPT_STRICT
/* Define if your MIPS CPU supports a 2-operand MADD instruction. */
#undef HAVE_MADD_ASM
/* Define if your MIPS CPU supports a 2-operand MADD16 instruction. */
#undef HAVE_MADD16_ASM
/* Define to enable diagnostic debugging support. */
#undef DEBUG
/* Define to disable debugging assertions. */
#undef NDEBUG
/* Define to enable experimental code. */
#undef EXPERIMENTAL
/* The number of bytes in a int. */
#undef SIZEOF_INT
/* The number of bytes in a long. */
#undef SIZEOF_LONG
/* The number of bytes in a long long. */
#undef SIZEOF_LONG_LONG
/* Define if you have the fcntl function. */
#undef HAVE_FCNTL
/* Define if you have the fork function. */
#undef HAVE_FORK
/* Define if you have the pipe function. */
#undef HAVE_PIPE
/* Define if you have the waitpid function. */
#undef HAVE_WAITPID
/* Define if you have the <assert.h> header file. */
#undef HAVE_ASSERT_H
/* Define if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Name of package */
#undef PACKAGE
/* Version number of package */
#undef VERSION
/*****************************************************************************
* End of automatically configured definitions *
*****************************************************************************/
# endif
This source diff could not be displayed because it is too large. You can view the blob instead.
dnl -*- m4 -*-
dnl
dnl libmad - MPEG audio decoder library
dnl Copyright (C) 2000-2001 Robert Leslie
dnl
dnl This program is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
dnl the Free Software Foundation; either version 2 of the License, or
dnl (at your option) any later version.
dnl
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
dnl GNU General Public License for more details.
dnl
dnl You should have received a copy of the GNU General Public License
dnl along with this program; if not, write to the Free Software
dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl
AC_REVISION([$Id: configure.in,v 1.3 2003/06/19 02:27:00 shank Exp $])dnl
dnl Process this file with autoconf to produce a configure script.
AC_INIT(decoder.h)
AM_INIT_AUTOMAKE(libmad, 0.14.2b)
AM_CONFIG_HEADER(config.h)
dnl System type.
AC_CANONICAL_HOST
dnl Checks for programs.
AC_PROG_CC
dnl Support for libtool.
AC_DISABLE_SHARED
dnl AC_LIBTOOL_WIN32_DLL
AM_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
dnl Compiler options.
arch=""
debug=""
optimize=""
profile=""
set -- $CFLAGS
CFLAGS="-Wall"
if test "$GCC" = yes
then
case "$host" in
*-pc-cygwin)
CPPFLAGS="$CPPFLAGS -mno-cygwin"
LDFLAGS="$LDFLAGS -mno-cygwin"
;;
esac
fi
while test $# -gt 0
do
case "$1" in
-Wall)
shift
;;
-g)
debug="-g"
shift
;;
-mno-cygwin)
shift
;;
-m*)
arch="$arch $1"
shift
;;
-O2)
optimize="-O"
shift
;;
-fomit-frame-pointer)
shift
;;
-O*|-f*)
optimize="$optimize $1"
shift
;;
*)
CFLAGS="$CFLAGS $1"
shift
;;
esac
done
if test "$GCC" = yes
then
if test -z "$arch"
then
case "$host" in
i386-*) ;;
i?86-*) arch="-m486" ;;
arm*-empeg-*) arch="-march=armv4 -mtune=strongarm1100" ;;
armv4*-*) arch="-march=armv4 -mtune=strongarm" ;;
powerpc-*) ;;
mips*-agenda-*) arch="-mcpu=vr4100" ;;
mips*-luxsonor-*) arch="-mips1 -mcpu=r3000 -Wa,-m4010" ;;
esac
fi
case "$optimize" in
-O|"-O "*)
optimize="-O"
optimize="$optimize -fforce-mem"
optimize="$optimize -fforce-addr"
: #x optimize="$optimize -finline-functions"
: #- optimize="$optimize -fstrength-reduce"
optimize="$optimize -fthread-jumps"
optimize="$optimize -fcse-follow-jumps"
optimize="$optimize -fcse-skip-blocks"
: #x optimize="$optimize -frerun-cse-after-loop"
: #x optimize="$optimize -frerun-loop-opt"
: #x optimize="$optimize -fgcse"
optimize="$optimize -fexpensive-optimizations"
optimize="$optimize -fregmove"
: #* optimize="$optimize -fdelayed-branch"
: #x optimize="$optimize -fschedule-insns"
optimize="$optimize -fschedule-insns2"
: #? optimize="$optimize -ffunction-sections"
: #? optimize="$optimize -fcaller-saves"
: #> optimize="$optimize -funroll-loops"
: #> optimize="$optimize -funroll-all-loops"
: #x optimize="$optimize -fmove-all-movables"
: #x optimize="$optimize -freduce-all-givs"
: #? optimize="$optimize -fstrict-aliasing"
: #* optimize="$optimize -fstructure-noalias"
case "$host" in
arm*-*)
# this may provoke bugs in gcc 2.95.2
optimize="$optimize -fstrength-reduce"
#
# this may actually be slower but it
# triggers bugs if not included
optimize="$optimize -finline-functions"
;;
mips*-*)
optimize="$optimize -fstrength-reduce"
optimize="$optimize -finline-functions"
;;
i?86-*)
optimize="$optimize -fstrength-reduce"
;;
*)
# this sometimes provokes bugs in gcc 2.95.2
: #optimize="$optimize -fstrength-reduce"
;;
esac
;;
esac
fi
case "$host" in
mips*-agenda-*) AC_DEFINE(HAVE_MADD16_ASM) ;;
mips*-luxsonor-*) AC_DEFINE(HAVE_MADD_ASM) ;;
esac
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(assert.h limits.h unistd.h sys/types.h fcntl.h errno.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_PID_T
AC_CHECK_SIZEOF(int, 2)
AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(long long, 8)
dnl Checks for library functions.
AC_CHECK_FUNCS(waitpid fcntl pipe fork)
dnl Other options.
AC_SUBST(FPM)
AC_SUBST(ASO)
AC_SUBST(ASO_OBJS)
AC_SUBST(CCAS)
AC_SUBST(CCASFLAGS)
dnl handle --enable and --disable options
AC_CACHE_SAVE
AC_MSG_CHECKING(whether to optimize for speed or for accuracy)
AC_ARG_ENABLE(speed,
[ --enable-speed optimize for speed over accuracy], [
case "$enableval" in
yes)
optimize_for="speed"
AC_DEFINE(OPT_SPEED)
;;
esac
])
AC_ARG_ENABLE(accuracy,
[ --enable-accuracy optimize for accuracy over speed], [
case "$enableval" in
yes)
if test "$optimize_for" = "speed"
then
optimize_for="both"
else
optimize_for="accuracy"
fi
AC_DEFINE(OPT_ACCURACY)
;;
esac
])
AC_MSG_RESULT(${optimize_for-default})
if test "$optimize_for" = "both"
then
AC_MSG_ERROR(cannot optimize for both speed and accuracy)
fi
AC_MSG_CHECKING(for architecture-specific fixed-point math routines)
AC_ARG_ENABLE(fpm,
[ --enable-fpm=ARCH use ARCH-specific fixed-point math routines
(one of: intel, arm, mips, sparc, ppc,
64bit, default)], [
case "$enableval" in
yes) ;;
no|default|approx) FPM="DEFAULT" ;;
intel|i?86) FPM="INTEL" ;;
arm) FPM="ARM" ;;
mips) FPM="MIPS" ;;
sparc) FPM="SPARC" ;;
ppc|powerpc) FPM="PPC" ;;
64bit) FPM="64BIT" ;;
float) FPM="FLOAT" ;;
*)
AC_MSG_RESULT(failed)
AC_MSG_ERROR([bad --enable-fpm option])
;;
esac
])
if test -z "$FPM" && test "$GCC" = yes
then
case "$host" in
i?86-*) FPM="INTEL" ;;
arm*-*) FPM="ARM" ;;
mips*-*) FPM="MIPS" ;;
sparc*-*) FPM="SPARC" ;;
powerpc*-*) FPM="PPC" ;;
# FIXME: need to test for 64-bit long long...
esac
fi
AC_MSG_RESULT(${FPM=DEFAULT})
if test "$FPM" = "DEFAULT"
then
AC_MSG_WARN([default fixed-point math will yield limited accuracy])
fi
FPM="-DFPM_$FPM"
AC_ARG_ENABLE(sso,
[ --enable-sso use subband synthesis optimization], [
case "$enableval" in
yes) AC_DEFINE(OPT_SSO) ;;
esac
])
AC_ARG_ENABLE(aso,
[ --disable-aso disable architecture-specific optimizations],
[], [enable_aso=yes])
if test "$enable_aso" = yes
then
case "$host" in
i?86-*)
: #ASO="$ASO -DASO_INTERLEAVE1"
ASO="$ASO -DASO_ZEROCHECK"
: #not yet #ASO="$ASO -DASO_SYNTH"
: #not yet #ASO_OBJS="synth_mmx.lo"
;;
arm*-*)
ASO="$ASO -DASO_INTERLEAVE1"
ASO="$ASO -DASO_IMDCT"
ASO_OBJS="imdct_l_arm.lo"
;;
mips*-*)
ASO="$ASO -DASO_INTERLEAVE2"
ASO="$ASO -DASO_ZEROCHECK"
;;
esac
fi
AC_MSG_CHECKING(for ISO/IEC interpretation)
AC_ARG_ENABLE(strict-iso,
[ --enable-strict-iso use strict ISO/IEC interpretations], [
case "$enableval" in
yes)
AC_DEFINE(OPT_STRICT)
interpretation="strict"
;;
esac
])
AC_MSG_RESULT(${interpretation-best accepted practices})
AC_MSG_CHECKING(whether to enable profiling)
AC_ARG_ENABLE(profiling,
[ --enable-profiling generate profiling code], [
case "$enableval" in
yes) profile="-pg" ;;
esac
])
AC_MSG_RESULT(${enable_profiling-no})
AC_MSG_CHECKING(whether to enable debugging)
AC_ARG_ENABLE(debugging,
[ --enable-debugging enable diagnostic debugging support
--disable-debugging do not enable debugging and use more optimization], [
case "$enableval" in
yes)
AC_DEFINE(DEBUG)
optimize=""
;;
no)
if test -n "$profile"
then
AC_MSG_ERROR(--enable-profiling and --disable-debugging are incompatible)
fi
AC_DEFINE(NDEBUG)
debug=""
if test "$GCC" = yes
then
optimize="$optimize -fomit-frame-pointer"
fi
;;
esac
])
AC_MSG_RESULT(${enable_debugging-default})
AC_MSG_CHECKING(whether to enable experimental code)
AC_ARG_ENABLE(experimental,
[ --enable-experimental enable experimental code], [
case "$enableval" in
yes) AC_DEFINE(EXPERIMENTAL) ;;
esac
])
AC_MSG_RESULT(${enable_experimental-no})
dnl Create output files.
test -n "$arch" && CFLAGS="$CFLAGS $arch"
test -n "$debug" && CFLAGS="$CFLAGS $debug"
test -n "$optimize" && CFLAGS="$CFLAGS $optimize"
test -n "$profile" && CFLAGS="$CFLAGS $profile" LDFLAGS="$LDFLAGS $profile"
LTLIBOBJS=`echo "$LIBOBJS" | sed -e 's/\.o/.lo/g'`
AC_SUBST(LTLIBOBJS)
AC_OUTPUT(Makefile)
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: decoder.h,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
# ifndef LIBMAD_DECODER_H
# define LIBMAD_DECODER_H
# include "stream.h"
# include "frame.h"
# include "synth.h"
enum mad_decoder_mode {
MAD_DECODER_MODE_SYNC = 0,
MAD_DECODER_MODE_ASYNC
};
enum mad_flow {
MAD_FLOW_CONTINUE = 0x0000, /* continue normally */
MAD_FLOW_STOP = 0x0010, /* stop decoding normally */
MAD_FLOW_BREAK = 0x0011, /* stop decoding and signal an error */
MAD_FLOW_IGNORE = 0x0020 /* ignore the current frame */
};
struct mad_decoder {
enum mad_decoder_mode mode;
int options;
struct {
long pid;
int in;
int out;
} async;
struct {
struct mad_stream stream;
struct mad_frame frame;
struct mad_synth synth;
} *sync;
void *cb_data;
enum mad_flow (*input_func)(void *, struct mad_stream *);
enum mad_flow (*header_func)(void *, struct mad_header const *);
enum mad_flow (*filter_func)(void *,
struct mad_stream const *, struct mad_frame *);
enum mad_flow (*output_func)(void *,
struct mad_header const *, struct mad_pcm *);
enum mad_flow (*error_func)(void *, struct mad_stream *, struct mad_frame *);
enum mad_flow (*message_func)(void *, void *, unsigned int *);
};
void mad_decoder_init(struct mad_decoder *, void *,
enum mad_flow (*)(void *, struct mad_stream *),
enum mad_flow (*)(void *, struct mad_header const *),
enum mad_flow (*)(void *,
struct mad_stream const *,
struct mad_frame *),
enum mad_flow (*)(void *,
struct mad_header const *,
struct mad_pcm *),
enum mad_flow (*)(void *,
struct mad_stream *,
struct mad_frame *),
enum mad_flow (*)(void *, void *, unsigned int *));
int mad_decoder_finish(struct mad_decoder *);
# define mad_decoder_options(decoder, opts) \
((void) ((decoder)->options = (opts)))
int mad_decoder_run(struct mad_decoder *, enum mad_decoder_mode);
int mad_decoder_message(struct mad_decoder *, void *, unsigned int *);
# endif
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: fixed.c,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
# ifdef HAVE_CONFIG_H
# include "config.h"
# endif
# include "global.h"
# include "fixed.h"
/*
* NAME: fixed->abs()
* DESCRIPTION: return absolute value of a fixed-point number
*/
mad_fixed_t mad_f_abs(mad_fixed_t x)
{
return x < 0 ? -x : x;
}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: frame.h,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
# ifndef LIBMAD_FRAME_H
# define LIBMAD_FRAME_H
# include "fixed.h"
# include "timer.h"
# include "stream.h"
enum mad_layer {
MAD_LAYER_I = 1, /* Layer I */
MAD_LAYER_II = 2, /* Layer II */
MAD_LAYER_III = 3 /* Layer III */
};
enum mad_mode {
MAD_MODE_SINGLE_CHANNEL = 0, /* single channel */
MAD_MODE_DUAL_CHANNEL = 1, /* dual channel */
MAD_MODE_JOINT_STEREO = 2, /* joint (MS/intensity) stereo */
MAD_MODE_STEREO = 3 /* normal LR stereo */
};
enum mad_emphasis {
MAD_EMPHASIS_NONE = 0, /* no emphasis */
MAD_EMPHASIS_50_15_US = 1, /* 50/15 microseconds emphasis */
MAD_EMPHASIS_CCITT_J_17 = 3 /* CCITT J.17 emphasis */
};
struct mad_header {
enum mad_layer layer; /* audio layer (1, 2, or 3) */
enum mad_mode mode; /* channel mode (see above) */
int mode_extension; /* additional mode info */
enum mad_emphasis emphasis; /* de-emphasis to use (see above) */
unsigned long bitrate; /* stream bitrate (bps) */
unsigned int samplerate; /* sampling frequency (Hz) */
unsigned short crc_check; /* frame CRC accumulator */
unsigned short crc_target; /* final target CRC checksum */
int flags; /* flags (see below) */
int private_bits; /* private bits (see below) */
mad_timer_t duration; /* audio playing time of frame */
};
struct mad_frame {
struct mad_header header; /* MPEG audio header */
int options; /* decoding options (from stream) */
mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples */
mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
};
# define MAD_NCHANNELS(header) ((header)->mode ? 2 : 1)
# define MAD_NSBSAMPLES(header) \
((header)->layer == MAD_LAYER_I ? 12 : \
(((header)->layer == MAD_LAYER_III && \
((header)->flags & MAD_FLAG_LSF_EXT)) ? 18 : 36))
enum {
MAD_FLAG_NPRIVATE_III = 0x0007, /* number of Layer III private bits */
MAD_FLAG_INCOMPLETE = 0x0008, /* header but not data is decoded */
MAD_FLAG_PROTECTION = 0x0010, /* frame has CRC protection */
MAD_FLAG_COPYRIGHT = 0x0020, /* frame is copyright */
MAD_FLAG_ORIGINAL = 0x0040, /* frame is original (else copy) */
MAD_FLAG_PADDING = 0x0080, /* frame has additional slot */
MAD_FLAG_I_STEREO = 0x0100, /* uses intensity joint stereo */
MAD_FLAG_MS_STEREO = 0x0200, /* uses middle/side joint stereo */
MAD_FLAG_FREEFORMAT = 0x0400, /* uses free format bitrate */
MAD_FLAG_LSF_EXT = 0x1000, /* lower sampling freq. extension */
MAD_FLAG_MC_EXT = 0x2000, /* multichannel audio extension */
MAD_FLAG_MPEG_2_5_EXT = 0x4000 /* MPEG 2.5 (unofficial) extension */
};
enum {
MAD_PRIVATE_HEADER = 0x0100, /* header private bit */
MAD_PRIVATE_III = 0x001f /* Layer III private bits (up to 5) */
};
void mad_header_init(struct mad_header *);
# define mad_header_finish(header) /* nothing */
int mad_header_decode(struct mad_header *, struct mad_stream *);
void mad_frame_init(struct mad_frame *);
void mad_frame_finish(struct mad_frame *);
int mad_frame_decode(struct mad_frame *, struct mad_stream *);
void mad_frame_mute(struct mad_frame *);
# endif
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: global.h,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
# ifndef LIBMAD_GLOBAL_H
# define LIBMAD_GLOBAL_H
/* conditional debugging */
# if defined(DEBUG) && defined(NDEBUG)
# error "cannot define both DEBUG and NDEBUG"
# endif
# if defined(DEBUG)
# include <stdio.h>
# endif
/* conditional features */
# if defined(OPT_SPEED) && defined(OPT_ACCURACY)
# error "cannot optimize for both speed and accuracy"
# endif
# if defined(OPT_SPEED) && !defined(OPT_SSO)
# define OPT_SSO 1
# endif
# if defined(HAVE_UNISTD_H) && defined(HAVE_WAITPID) && \
defined(HAVE_FCNTL) && defined(HAVE_PIPE) && defined(HAVE_FORK)
# define USE_ASYNC
# endif
# if !defined(HAVE_ASSERT_H)
# if defined(NDEBUG)
# define assert(x) /* nothing */
# else
# define assert(x) do { if (!(x)) abort(); } while (0)
# endif
# endif
# endif
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: huffman.h,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
# ifndef LIBMAD_HUFFMAN_H
# define LIBMAD_HUFFMAN_H
union huffquad {
struct {
unsigned short final : 1;
unsigned short bits : 3;
unsigned short offset : 12;
} ptr;
struct {
unsigned short final : 1;
unsigned short hlen : 3;
unsigned short v : 1;
unsigned short w : 1;
unsigned short x : 1;
unsigned short y : 1;
} value;
unsigned short final : 1;
};
union huffpair {
struct {
unsigned short final : 1;
unsigned short bits : 3;
unsigned short offset : 12;
} ptr;
struct {
unsigned short final : 1;
unsigned short hlen : 3;
unsigned short x : 4;
unsigned short y : 4;
} value;
unsigned short final : 1;
};
struct hufftable {
union huffpair const *table;
unsigned short linbits;
unsigned short startbits;
};
extern union huffquad const *const mad_huff_quad_table[2];
extern struct hufftable const mad_huff_pair_table[32];
# endif
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: imdct_s.dat,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
/* 0 */ { MAD_F(0x09bd7ca0) /* 0.608761429 */,
-MAD_F(0x0ec835e8) /* -0.923879533 */,
-MAD_F(0x0216a2a2) /* -0.130526192 */,
MAD_F(0x0fdcf549) /* 0.991444861 */,
-MAD_F(0x061f78aa) /* -0.382683432 */,
-MAD_F(0x0cb19346) /* -0.793353340 */ },
/* 6 */ { -MAD_F(0x0cb19346) /* -0.793353340 */,
MAD_F(0x061f78aa) /* 0.382683432 */,
MAD_F(0x0fdcf549) /* 0.991444861 */,
MAD_F(0x0216a2a2) /* 0.130526192 */,
-MAD_F(0x0ec835e8) /* -0.923879533 */,
-MAD_F(0x09bd7ca0) /* -0.608761429 */ },
/* 1 */ { MAD_F(0x061f78aa) /* 0.382683432 */,
-MAD_F(0x0ec835e8) /* -0.923879533 */,
MAD_F(0x0ec835e8) /* 0.923879533 */,
-MAD_F(0x061f78aa) /* -0.382683432 */,
-MAD_F(0x061f78aa) /* -0.382683432 */,
MAD_F(0x0ec835e8) /* 0.923879533 */ },
/* 7 */ { -MAD_F(0x0ec835e8) /* -0.923879533 */,
-MAD_F(0x061f78aa) /* -0.382683432 */,
MAD_F(0x061f78aa) /* 0.382683432 */,
MAD_F(0x0ec835e8) /* 0.923879533 */,
MAD_F(0x0ec835e8) /* 0.923879533 */,
MAD_F(0x061f78aa) /* 0.382683432 */ },
/* 2 */ { MAD_F(0x0216a2a2) /* 0.130526192 */,
-MAD_F(0x061f78aa) /* -0.382683432 */,
MAD_F(0x09bd7ca0) /* 0.608761429 */,
-MAD_F(0x0cb19346) /* -0.793353340 */,
MAD_F(0x0ec835e8) /* 0.923879533 */,
-MAD_F(0x0fdcf549) /* -0.991444861 */ },
/* 8 */ { -MAD_F(0x0fdcf549) /* -0.991444861 */,
-MAD_F(0x0ec835e8) /* -0.923879533 */,
-MAD_F(0x0cb19346) /* -0.793353340 */,
-MAD_F(0x09bd7ca0) /* -0.608761429 */,
-MAD_F(0x061f78aa) /* -0.382683432 */,
-MAD_F(0x0216a2a2) /* -0.130526192 */ }
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: layer12.h,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
# ifndef LIBMAD_LAYER12_H
# define LIBMAD_LAYER12_H
# include "stream.h"
# include "frame.h"
int mad_layer_I(struct mad_stream *, struct mad_frame *);
int mad_layer_II(struct mad_stream *, struct mad_frame *);
# endif
This diff is collapsed. Click to expand it.
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: layer3.h,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
# ifndef LIBMAD_LAYER3_H
# define LIBMAD_LAYER3_H
# include "stream.h"
# include "frame.h"
int mad_layer_III(struct mad_stream *, struct mad_frame *);
# endif
This diff is collapsed. Click to expand it.
#
# libmad - MPEG audio decoder library
# Copyright (C) 2000-2001 Robert Leslie
#
# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id: mad.h.sed,v 1.1 2003/06/18 19:19:19 shank Exp $
#
/^\/\*$/{
N
s/ \* libmad - /&/
t copy
b next
: copy
g
n
s|^ \* \$\(Id: .*\) \$$|/* \1 */|p
/^ \*\/$/d
b copy
}
/^# *include "/d
: next
p
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: qc_table.dat,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
/*
* These are the Layer II classes of quantization.
* The table is derived from Table B.4 of ISO/IEC 11172-3.
*/
{ 3, 2, 5,
MAD_F(0x15555555) /* 1.33333333333 => 1.33333333209, e 0.00000000124 */,
MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ },
{ 5, 3, 7,
MAD_F(0x1999999a) /* 1.60000000000 => 1.60000000149, e -0.00000000149 */,
MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ },
{ 7, 0, 3,
MAD_F(0x12492492) /* 1.14285714286 => 1.14285714179, e 0.00000000107 */,
MAD_F(0x04000000) /* 0.25000000000 => 0.25000000000, e 0.00000000000 */ },
{ 9, 4, 10,
MAD_F(0x1c71c71c) /* 1.77777777777 => 1.77777777612, e 0.00000000165 */,
MAD_F(0x08000000) /* 0.50000000000 => 0.50000000000, e 0.00000000000 */ },
{ 15, 0, 4,
MAD_F(0x11111111) /* 1.06666666666 => 1.06666666642, e 0.00000000024 */,
MAD_F(0x02000000) /* 0.12500000000 => 0.12500000000, e 0.00000000000 */ },
{ 31, 0, 5,
MAD_F(0x10842108) /* 1.03225806452 => 1.03225806355, e 0.00000000097 */,
MAD_F(0x01000000) /* 0.06250000000 => 0.06250000000, e 0.00000000000 */ },
{ 63, 0, 6,
MAD_F(0x10410410) /* 1.01587301587 => 1.01587301493, e 0.00000000094 */,
MAD_F(0x00800000) /* 0.03125000000 => 0.03125000000, e 0.00000000000 */ },
{ 127, 0, 7,
MAD_F(0x10204081) /* 1.00787401575 => 1.00787401572, e 0.00000000003 */,
MAD_F(0x00400000) /* 0.01562500000 => 0.01562500000, e 0.00000000000 */ },
{ 255, 0, 8,
MAD_F(0x10101010) /* 1.00392156863 => 1.00392156839, e 0.00000000024 */,
MAD_F(0x00200000) /* 0.00781250000 => 0.00781250000, e 0.00000000000 */ },
{ 511, 0, 9,
MAD_F(0x10080402) /* 1.00195694716 => 1.00195694715, e 0.00000000001 */,
MAD_F(0x00100000) /* 0.00390625000 => 0.00390625000, e 0.00000000000 */ },
{ 1023, 0, 10,
MAD_F(0x10040100) /* 1.00097751711 => 1.00097751617, e 0.00000000094 */,
MAD_F(0x00080000) /* 0.00195312500 => 0.00195312500, e 0.00000000000 */ },
{ 2047, 0, 11,
MAD_F(0x10020040) /* 1.00048851979 => 1.00048851967, e 0.00000000012 */,
MAD_F(0x00040000) /* 0.00097656250 => 0.00097656250, e 0.00000000000 */ },
{ 4095, 0, 12,
MAD_F(0x10010010) /* 1.00024420024 => 1.00024420023, e 0.00000000001 */,
MAD_F(0x00020000) /* 0.00048828125 => 0.00048828125, e 0.00000000000 */ },
{ 8191, 0, 13,
MAD_F(0x10008004) /* 1.00012208522 => 1.00012208521, e 0.00000000001 */,
MAD_F(0x00010000) /* 0.00024414063 => 0.00024414062, e 0.00000000000 */ },
{ 16383, 0, 14,
MAD_F(0x10004001) /* 1.00006103888 => 1.00006103888, e -0.00000000000 */,
MAD_F(0x00008000) /* 0.00012207031 => 0.00012207031, e -0.00000000000 */ },
{ 32767, 0, 15,
MAD_F(0x10002000) /* 1.00003051851 => 1.00003051758, e 0.00000000093 */,
MAD_F(0x00004000) /* 0.00006103516 => 0.00006103516, e 0.00000000000 */ },
{ 65535, 0, 16,
MAD_F(0x10001000) /* 1.00001525902 => 1.00001525879, e 0.00000000023 */,
MAD_F(0x00002000) /* 0.00003051758 => 0.00003051758, e 0.00000000000 */ }
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: sf_table.dat,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
/*
* These are the scalefactor values for Layer I and Layer II.
* The values are from Table B.1 of ISO/IEC 11172-3.
*
* There is some error introduced by the 32-bit fixed-point representation;
* the amount of error is shown. For 16-bit PCM output, this shouldn't be
* too much of a problem.
*/
MAD_F(0x20000000), /* 2.000000000000 => 2.000000000000, e 0.000000000000 */
MAD_F(0x1965fea5), /* 1.587401051968 => 1.587401051074, e 0.000000000894 */
MAD_F(0x1428a2fa), /* 1.259921049895 => 1.259921051562, e -0.000000001667 */
MAD_F(0x10000000), /* 1.000000000000 => 1.000000000000, e 0.000000000000 */
MAD_F(0x0cb2ff53), /* 0.793700525984 => 0.793700527400, e -0.000000001416 */
MAD_F(0x0a14517d), /* 0.629960524947 => 0.629960525781, e -0.000000000833 */
MAD_F(0x08000000), /* 0.500000000000 => 0.500000000000, e 0.000000000000 */
MAD_F(0x06597fa9), /* 0.396850262992 => 0.396850261837, e 0.000000001155 */
MAD_F(0x050a28be), /* 0.314980262474 => 0.314980261028, e 0.000000001446 */
MAD_F(0x04000000), /* 0.250000000000 => 0.250000000000, e 0.000000000000 */
MAD_F(0x032cbfd5), /* 0.198425131496 => 0.198425132781, e -0.000000001285 */
MAD_F(0x0285145f), /* 0.157490131237 => 0.157490130514, e 0.000000000723 */
MAD_F(0x02000000), /* 0.125000000000 => 0.125000000000, e 0.000000000000 */
MAD_F(0x01965fea), /* 0.099212565748 => 0.099212564528, e 0.000000001220 */
MAD_F(0x01428a30), /* 0.078745065618 => 0.078745067120, e -0.000000001501 */
MAD_F(0x01000000), /* 0.062500000000 => 0.062500000000, e 0.000000000000 */
MAD_F(0x00cb2ff5), /* 0.049606282874 => 0.049606282264, e 0.000000000610 */
MAD_F(0x00a14518), /* 0.039372532809 => 0.039372533560, e -0.000000000751 */
MAD_F(0x00800000), /* 0.031250000000 => 0.031250000000, e 0.000000000000 */
MAD_F(0x006597fb), /* 0.024803141437 => 0.024803142995, e -0.000000001558 */
MAD_F(0x0050a28c), /* 0.019686266405 => 0.019686266780, e -0.000000000375 */
MAD_F(0x00400000), /* 0.015625000000 => 0.015625000000, e 0.000000000000 */
MAD_F(0x0032cbfd), /* 0.012401570719 => 0.012401569635, e 0.000000001084 */
MAD_F(0x00285146), /* 0.009843133202 => 0.009843133390, e -0.000000000188 */
MAD_F(0x00200000), /* 0.007812500000 => 0.007812500000, e 0.000000000000 */
MAD_F(0x001965ff), /* 0.006200785359 => 0.006200786680, e -0.000000001321 */
MAD_F(0x001428a3), /* 0.004921566601 => 0.004921566695, e -0.000000000094 */
MAD_F(0x00100000), /* 0.003906250000 => 0.003906250000, e 0.000000000000 */
MAD_F(0x000cb2ff), /* 0.003100392680 => 0.003100391477, e 0.000000001202 */
MAD_F(0x000a1451), /* 0.002460783301 => 0.002460781485, e 0.000000001816 */
MAD_F(0x00080000), /* 0.001953125000 => 0.001953125000, e 0.000000000000 */
MAD_F(0x00065980), /* 0.001550196340 => 0.001550197601, e -0.000000001262 */
MAD_F(0x00050a29), /* 0.001230391650 => 0.001230392605, e -0.000000000955 */
MAD_F(0x00040000), /* 0.000976562500 => 0.000976562500, e 0.000000000000 */
MAD_F(0x00032cc0), /* 0.000775098170 => 0.000775098801, e -0.000000000631 */
MAD_F(0x00028514), /* 0.000615195825 => 0.000615194440, e 0.000000001385 */
MAD_F(0x00020000), /* 0.000488281250 => 0.000488281250, e 0.000000000000 */
MAD_F(0x00019660), /* 0.000387549085 => 0.000387549400, e -0.000000000315 */
MAD_F(0x0001428a), /* 0.000307597913 => 0.000307597220, e 0.000000000693 */
MAD_F(0x00010000), /* 0.000244140625 => 0.000244140625, e 0.000000000000 */
MAD_F(0x0000cb30), /* 0.000193774542 => 0.000193774700, e -0.000000000158 */
MAD_F(0x0000a145), /* 0.000153798956 => 0.000153798610, e 0.000000000346 */
MAD_F(0x00008000), /* 0.000122070313 => 0.000122070313, e 0.000000000000 */
MAD_F(0x00006598), /* 0.000096887271 => 0.000096887350, e -0.000000000079 */
MAD_F(0x000050a3), /* 0.000076899478 => 0.000076901168, e -0.000000001689 */
MAD_F(0x00004000), /* 0.000061035156 => 0.000061035156, e 0.000000000000 */
MAD_F(0x000032cc), /* 0.000048443636 => 0.000048443675, e -0.000000000039 */
MAD_F(0x00002851), /* 0.000038449739 => 0.000038448721, e 0.000000001018 */
MAD_F(0x00002000), /* 0.000030517578 => 0.000030517578, e 0.000000000000 */
MAD_F(0x00001966), /* 0.000024221818 => 0.000024221838, e -0.000000000020 */
MAD_F(0x00001429), /* 0.000019224870 => 0.000019226223, e -0.000000001354 */
MAD_F(0x00001000), /* 0.000015258789 => 0.000015258789, e -0.000000000000 */
MAD_F(0x00000cb3), /* 0.000012110909 => 0.000012110919, e -0.000000000010 */
MAD_F(0x00000a14), /* 0.000009612435 => 0.000009611249, e 0.000000001186 */
MAD_F(0x00000800), /* 0.000007629395 => 0.000007629395, e -0.000000000000 */
MAD_F(0x00000659), /* 0.000006055454 => 0.000006053597, e 0.000000001858 */
MAD_F(0x0000050a), /* 0.000004806217 => 0.000004805624, e 0.000000000593 */
MAD_F(0x00000400), /* 0.000003814697 => 0.000003814697, e 0.000000000000 */
MAD_F(0x0000032d), /* 0.000003027727 => 0.000003028661, e -0.000000000934 */
MAD_F(0x00000285), /* 0.000002403109 => 0.000002402812, e 0.000000000296 */
MAD_F(0x00000200), /* 0.000001907349 => 0.000001907349, e -0.000000000000 */
MAD_F(0x00000196), /* 0.000001513864 => 0.000001512468, e 0.000000001396 */
MAD_F(0x00000143) /* 0.000001201554 => 0.000001203269, e -0.000000001714 */
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: stream.c,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
# ifdef HAVE_CONFIG_H
# include "config.h"
# endif
# include "global.h"
# include <stdlib.h>
# include "bit.h"
# include "stream.h"
/*
* NAME: stream->init()
* DESCRIPTION: initialize stream struct
*/
void mad_stream_init(struct mad_stream *stream)
{
stream->buffer = 0;
stream->bufend = 0;
stream->skiplen = 0;
stream->sync = 0;
stream->freerate = 0;
stream->this_frame = 0;
stream->next_frame = 0;
mad_bit_init(&stream->ptr, 0);
mad_bit_init(&stream->anc_ptr, 0);
stream->anc_bitlen = 0;
stream->main_data = 0;
stream->md_len = 0;
stream->options = 0;
stream->error = MAD_ERROR_NONE;
}
/*
* NAME: stream->finish()
* DESCRIPTION: deallocate any dynamic memory associated with stream
*/
void mad_stream_finish(struct mad_stream *stream)
{
if (stream->main_data) {
free(stream->main_data);
stream->main_data = 0;
}
mad_bit_finish(&stream->anc_ptr);
mad_bit_finish(&stream->ptr);
}
/*
* NAME: stream->buffer()
* DESCRIPTION: set stream buffer pointers
*/
void mad_stream_buffer(struct mad_stream *stream,
unsigned char const *buffer, unsigned long length)
{
stream->buffer = buffer;
stream->bufend = buffer + length;
stream->this_frame = buffer;
stream->next_frame = buffer;
stream->sync = 1;
mad_bit_init(&stream->ptr, buffer);
}
/*
* NAME: stream->skip()
* DESCRIPTION: arrange to skip bytes before the next frame
*/
void mad_stream_skip(struct mad_stream *stream, unsigned long length)
{
stream->skiplen += length;
}
/*
* NAME: stream->sync()
* DESCRIPTION: locate the next stream sync word
*/
int mad_stream_sync(struct mad_stream *stream)
{
register unsigned char const *ptr, *end;
ptr = mad_bit_nextbyte(&stream->ptr);
end = stream->bufend;
while (ptr < end - 1 &&
!(ptr[0] == 0xff && (ptr[1] & 0xe0) == 0xe0))
++ptr;
if (end - ptr < MAD_BUFFER_GUARD)
return -1;
mad_bit_init(&stream->ptr, ptr);
return 0;
}
/*
* NAME: stream->errorstr()
* DESCRIPTION: return a string description of the current error condition
*/
char const *mad_stream_errorstr(struct mad_stream const *stream)
{
switch (stream->error) {
case MAD_ERROR_NONE: return "no error";
case MAD_ERROR_BUFLEN: return "input buffer too small (or EOF)";
case MAD_ERROR_BUFPTR: return "invalid (null) buffer pointer";
case MAD_ERROR_NOMEM: return "not enough memory";
case MAD_ERROR_LOSTSYNC: return "lost synchronization";
case MAD_ERROR_BADLAYER: return "reserved header layer value";
case MAD_ERROR_BADBITRATE: return "forbidden bitrate value";
case MAD_ERROR_BADSAMPLERATE: return "reserved sample frequency value";
case MAD_ERROR_BADEMPHASIS: return "reserved emphasis value";
case MAD_ERROR_BADCRC: return "CRC check failed";
case MAD_ERROR_BADBITALLOC: return "forbidden bit allocation value";
case MAD_ERROR_BADSCALEFACTOR: return "bad scalefactor index";
case MAD_ERROR_BADFRAMELEN: return "bad frame length";
case MAD_ERROR_BADBIGVALUES: return "bad big_values count";
case MAD_ERROR_BADBLOCKTYPE: return "reserved block_type";
case MAD_ERROR_BADSCFSI: return "bad scalefactor selection info";
case MAD_ERROR_BADDATAPTR: return "bad main_data_begin pointer";
case MAD_ERROR_BADPART3LEN: return "bad audio data length";
case MAD_ERROR_BADHUFFTABLE: return "bad Huffman table select";
case MAD_ERROR_BADHUFFDATA: return "Huffman data overrun";
case MAD_ERROR_BADSTEREO: return "incompatible block_type for JS";
}
return 0;
}
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: stream.h,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
# ifndef LIBMAD_STREAM_H
# define LIBMAD_STREAM_H
# include "bit.h"
# define MAD_BUFFER_GUARD 8
# define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD)
enum mad_error {
MAD_ERROR_NONE = 0x0000, /* no error */
MAD_ERROR_BUFLEN = 0x0001, /* input buffer too small (or EOF) */
MAD_ERROR_BUFPTR = 0x0002, /* invalid (null) buffer pointer */
MAD_ERROR_NOMEM = 0x0031, /* not enough memory */
MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */
MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */
MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */
MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value */
MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value */
MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */
MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */
MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */
MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */
MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */
MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */
MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */
MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */
MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */
MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */
MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */
MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */
};
# define MAD_RECOVERABLE(error) ((error) & 0xff00)
struct mad_stream {
unsigned char const *buffer; /* input bitstream buffer */
unsigned char const *bufend; /* end of buffer */
unsigned long skiplen; /* bytes to skip before next frame */
int sync; /* stream sync found */
unsigned long freerate; /* free bitrate (fixed) */
unsigned char const *this_frame; /* start of current frame */
unsigned char const *next_frame; /* start of next frame */
struct mad_bitptr ptr; /* current processing bit pointer */
struct mad_bitptr anc_ptr; /* ancillary bits pointer */
unsigned int anc_bitlen; /* number of ancillary bits */
unsigned char (*main_data)[MAD_BUFFER_MDLEN];
/* Layer III main_data() */
unsigned int md_len; /* bytes in main_data */
int options; /* decoding options (see below) */
enum mad_error error; /* error code (see above) */
};
enum {
MAD_OPTION_IGNORECRC = 0x0001, /* ignore CRC errors */
MAD_OPTION_HALFSAMPLERATE = 0x0002 /* generate PCM at 1/2 sample rate */
# if 0 /* not yet implemented */
MAD_OPTION_LEFTCHANNEL = 0x0010, /* decode left channel only */
MAD_OPTION_RIGHTCHANNEL = 0x0020, /* decode right channel only */
MAD_OPTION_SINGLECHANNEL = 0x0030 /* combine channels */
# endif
};
void mad_stream_init(struct mad_stream *);
void mad_stream_finish(struct mad_stream *);
# define mad_stream_options(stream, opts) \
((void) ((stream)->options = (opts)))
void mad_stream_buffer(struct mad_stream *,
unsigned char const *, unsigned long);
void mad_stream_skip(struct mad_stream *, unsigned long);
int mad_stream_sync(struct mad_stream *);
char const *mad_stream_errorstr(struct mad_stream const *);
# endif
This diff is collapsed. Click to expand it.
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: synth.h,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
# ifndef LIBMAD_SYNTH_H
# define LIBMAD_SYNTH_H
# include "fixed.h"
# include "frame.h"
struct mad_pcm {
unsigned int samplerate; /* sampling frequency (Hz) */
unsigned short channels; /* number of channels */
unsigned short length; /* number of samples per channel */
mad_fixed_t samples[2][1152]; /* PCM output samples [ch][sample] */
};
struct mad_synth {
mad_fixed_t filter[2][2][2][16][8]; /* polyphase filterbank outputs */
/* [ch][eo][peo][s][v] */
unsigned int phase; /* current processing phase */
struct mad_pcm pcm; /* PCM output */
};
/* single channel PCM selector */
enum {
MAD_PCM_CHANNEL_SINGLE = 0
};
/* dual channel PCM selector */
enum {
MAD_PCM_CHANNEL_DUAL_1 = 0,
MAD_PCM_CHANNEL_DUAL_2 = 1
};
/* stereo PCM selector */
enum {
MAD_PCM_CHANNEL_STEREO_LEFT = 0,
MAD_PCM_CHANNEL_STEREO_RIGHT = 1
};
void mad_synth_init(struct mad_synth *);
# define mad_synth_finish(synth) /* nothing */
void mad_synth_mute(struct mad_synth *);
void mad_synth_frame(struct mad_synth *, struct mad_frame const *);
# endif
This diff is collapsed. Click to expand it.
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: timer.h,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
# ifndef LIBMAD_TIMER_H
# define LIBMAD_TIMER_H
typedef struct {
signed long seconds; /* whole seconds */
unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */
} mad_timer_t;
extern mad_timer_t const mad_timer_zero;
# define MAD_TIMER_RESOLUTION 352800000UL
enum mad_units {
MAD_UNITS_HOURS = -2,
MAD_UNITS_MINUTES = -1,
MAD_UNITS_SECONDS = 0,
/* metric units */
MAD_UNITS_DECISECONDS = 10,
MAD_UNITS_CENTISECONDS = 100,
MAD_UNITS_MILLISECONDS = 1000,
/* audio sample units */
MAD_UNITS_8000_HZ = 8000,
MAD_UNITS_11025_HZ = 11025,
MAD_UNITS_12000_HZ = 12000,
MAD_UNITS_16000_HZ = 16000,
MAD_UNITS_22050_HZ = 22050,
MAD_UNITS_24000_HZ = 24000,
MAD_UNITS_32000_HZ = 32000,
MAD_UNITS_44100_HZ = 44100,
MAD_UNITS_48000_HZ = 48000,
/* video frame/field units */
MAD_UNITS_24_FPS = 24,
MAD_UNITS_25_FPS = 25,
MAD_UNITS_30_FPS = 30,
MAD_UNITS_48_FPS = 48,
MAD_UNITS_50_FPS = 50,
MAD_UNITS_60_FPS = 60,
/* CD audio frames */
MAD_UNITS_75_FPS = 75,
/* video drop-frame units */
MAD_UNITS_23_976_FPS = -24,
MAD_UNITS_24_975_FPS = -25,
MAD_UNITS_29_97_FPS = -30,
MAD_UNITS_47_952_FPS = -48,
MAD_UNITS_49_95_FPS = -50,
MAD_UNITS_59_94_FPS = -60
};
# define mad_timer_reset(timer) ((void) (*(timer) = mad_timer_zero))
int mad_timer_compare(mad_timer_t, mad_timer_t);
# define mad_timer_sign(timer) mad_timer_compare((timer), mad_timer_zero)
void mad_timer_negate(mad_timer_t *);
mad_timer_t mad_timer_abs(mad_timer_t);
void mad_timer_set(mad_timer_t *, unsigned long, unsigned long, unsigned long);
void mad_timer_add(mad_timer_t *, mad_timer_t);
void mad_timer_multiply(mad_timer_t *, signed long);
signed long mad_timer_count(mad_timer_t, enum mad_units);
unsigned long mad_timer_fraction(mad_timer_t, unsigned long);
void mad_timer_string(mad_timer_t, char *, char const *,
enum mad_units, enum mad_units, unsigned long);
# endif
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: version.c,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
# ifdef HAVE_CONFIG_H
# include "config.h"
# endif
# include "global.h"
# include "version.h"
char const mad_version[] = "MPEG Audio Decoder " MAD_VERSION;
char const mad_copyright[] = "Copyright (C) " MAD_PUBLISHYEAR " " MAD_AUTHOR;
char const mad_author[] = MAD_AUTHOR " <" MAD_EMAIL ">";
char const mad_build[] = ""
# if defined(FPM_64BIT)
"FPM_64BIT "
# elif defined(FPM_INTEL)
"FPM_INTEL "
# elif defined(FPM_ARM)
"FPM_ARM "
# elif defined(FPM_MIPS)
"FPM_MIPS "
# elif defined(FPM_SPARC)
"FPM_SPARC "
# elif defined(FPM_PPC)
"FPM_PPC "
# elif defined(FPM_DEFAULT)
"FPM_DEFAULT "
# endif
# if defined(ASO_IMDCT)
"ASO_IMDCT "
# endif
# if defined(ASO_INTERLEAVE1)
"ASO_INTERLEAVE1 "
# endif
# if defined(ASO_INTERLEAVE2)
"ASO_INTERLEAVE2 "
# endif
# if defined(ASO_ZEROCHECK)
"ASO_ZEROCHECK "
# endif
# if defined(OPT_SPEED)
"OPT_SPEED "
# elif defined(OPT_ACCURACY)
"OPT_ACCURACY "
# endif
# if defined(OPT_SSO)
"OPT_SSO "
# endif
# if defined(OPT_DCTO) /* never defined here */
"OPT_DCTO "
# endif
# if defined(OPT_STRICT)
"OPT_STRICT "
# endif
# if defined(EXPERIMENTAL)
"EXPERIMENTAL "
# endif
# if defined(DEBUG)
"DEBUG "
# elif defined(NDEBUG)
"NDEBUG "
# endif
;
/*
* libmad - MPEG audio decoder library
* Copyright (C) 2000-2001 Robert Leslie
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* $Id: version.h,v 1.1 2003/06/18 19:19:19 shank Exp $
*/
# ifndef LIBMAD_VERSION_H
# define LIBMAD_VERSION_H
# define MAD_VERSION_MAJOR 0
# define MAD_VERSION_MINOR 14
# define MAD_VERSION_PATCH 2
# define MAD_VERSION_EXTRA " (beta)"
# define MAD_VERSION_STRINGIZE(str) #str
# define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num)
# define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \
MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \
MAD_VERSION_STRING(MAD_VERSION_PATCH) \
MAD_VERSION_EXTRA
# define MAD_PUBLISHYEAR "2000-2001"
# define MAD_AUTHOR "Robert Leslie"
# define MAD_EMAIL "rob@mars.org"
extern char const mad_version[];
extern char const mad_copyright[];
extern char const mad_author[];
extern char const mad_build[];
# endif
...@@ -31,29 +31,21 @@ ...@@ -31,29 +31,21 @@
#include <netdb.h> #include <netdb.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <resolv.h>
#define MAXHOSTNAME 1024 #define MAXHOSTNAME 1024
int listenSocket; int listenSocket;
int establish(unsigned short port) { int establish(unsigned short port) {
char myname[MAXHOSTNAME+1];
int sock; int sock;
struct sockaddr_in sockAddr; struct sockaddr_in sockAddr;
struct hostent * he;
memset(&sockAddr, 0, sizeof(struct sockaddr_in)); memset(&sockAddr, 0, sizeof(struct sockaddr_in));
gethostname(myname,MAXHOSTNAME); sockAddr.sin_family = AF_INET;
he = gethostbyname(myname);
if(he == NULL) {
fprintf(stderr,"he == NULL\n");
return -1;
}
sockAddr.sin_family = he->h_addrtype;
sockAddr.sin_port = htons(port); sockAddr.sin_port = htons(port);
sockAddr.sin_addr.s_addr = INADDR_ANY;
if((sock = socket(AF_INET,SOCK_STREAM,0)) < 0) { if((sock = socket(AF_INET,SOCK_STREAM,0)) < 0) {
fprintf(stderr,"socket < 0\n"); fprintf(stderr,"socket < 0\n");
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "ls.h" #include "ls.h"
#include "command.h" #include "command.h"
#include "playlist.h" #include "playlist.h"
#include "path.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
...@@ -40,7 +41,7 @@ int ls(FILE * fp, char * dirname) { ...@@ -40,7 +41,7 @@ int ls(FILE * fp, char * dirname) {
cwd[1] = '\0'; cwd[1] = '\0';
if(dirname==NULL) dirname=cwd; if(dirname==NULL) dirname=cwd;
if((dir = opendir(dirname))==NULL) { if((dir = opendir(rmp2amp(dirname)))==NULL) {
fprintf(fp,"%s problems opening directory\n",COMMAND_RESPOND_ERROR); fprintf(fp,"%s problems opening directory\n",COMMAND_RESPOND_ERROR);
return -1; return -1;
} }
...@@ -117,7 +118,7 @@ time_t isMusic(char * file) { ...@@ -117,7 +118,7 @@ time_t isMusic(char * file) {
time_t isOgg(char * file) { time_t isOgg(char * file) {
struct stat st; struct stat st;
if(stat(file,&st)==0) { if(stat(rmp2amp(file),&st)==0) {
if(S_ISREG(st.st_mode)) { if(S_ISREG(st.st_mode)) {
char * dup; char * dup;
char * cLast; char * cLast;
...@@ -141,7 +142,7 @@ time_t isOgg(char * file) { ...@@ -141,7 +142,7 @@ time_t isOgg(char * file) {
time_t isMp3(char * file) { time_t isMp3(char * file) {
struct stat st; struct stat st;
if(stat(file,&st)==0) { if(stat(rmp2amp(file),&st)==0) {
if(S_ISREG(st.st_mode)) { if(S_ISREG(st.st_mode)) {
char * dup; char * dup;
char * cLast; char * cLast;
...@@ -165,7 +166,7 @@ time_t isMp3(char * file) { ...@@ -165,7 +166,7 @@ time_t isMp3(char * file) {
time_t isDir(char * name) { time_t isDir(char * name) {
struct stat st; struct stat st;
if(stat(name,&st)==0) { if(stat(rmp2amp(name),&st)==0) {
if(S_ISDIR(st.st_mode)) return st.st_mtime; if(S_ISDIR(st.st_mode)) return st.st_mtime;
} }
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "player.h" #include "player.h"
#include "listen.h" #include "listen.h"
#include "conf.h" #include "conf.h"
#include "path.h"
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
...@@ -88,15 +89,6 @@ int main(int argc, char * argv[]) { ...@@ -88,15 +89,6 @@ int main(int argc, char * argv[]) {
return -1; return -1;
} }
if((stat(musicDirArg,&st))<0) {
fprintf(stderr,"problem stat'ing \"%s\"\n",musicDirArg);
return -1;
}
if(!S_ISDIR(st.st_mode)) {
fprintf(stderr,"\"%s\" is not a directory\n",musicDirArg);
return -1;
}
if(playlistDirArg[0]=='/') { if(playlistDirArg[0]=='/') {
strcpy(playlistDir,playlistDirArg); strcpy(playlistDir,playlistDirArg);
} }
...@@ -115,7 +107,23 @@ int main(int argc, char * argv[]) { ...@@ -115,7 +107,23 @@ int main(int argc, char * argv[]) {
return -1; return -1;
} }
chdir(musicDirArg); if(musicDirArg[0]=='/') {
strcpy(musicDir,musicDirArg);
}
else {
getcwd(musicDir,MAXPATHLEN-strlen(musicDirArg)-1);
strcat(musicDir,"/");
strcat(musicDir,musicDirArg);
}
strcat(musicDir,"/");
if((stat(musicDir,&st))<0) {
fprintf(stderr,"problem stat'ing \"%s\"\n",musicDirArg);
return -1;
}
if(!S_ISDIR(st.st_mode)) {
fprintf(stderr,"\"%s\" is not a directory\n",musicDirArg);
return -1;
}
initTables(); initTables();
...@@ -138,7 +146,7 @@ int main(int argc, char * argv[]) { ...@@ -138,7 +146,7 @@ int main(int argc, char * argv[]) {
initInterfaces(); initInterfaces();
initPlaylist(); initPlaylist();
daemon(1,0); daemon(0,0);
dup2(fileno(out),STDOUT_FILENO); dup2(fileno(out),STDOUT_FILENO);
dup2(fileno(err),STDERR_FILENO); dup2(fileno(err),STDERR_FILENO);
...@@ -152,7 +160,7 @@ int main(int argc, char * argv[]) { ...@@ -152,7 +160,7 @@ int main(int argc, char * argv[]) {
} }
clearPlaylist(stderr); clearPlaylist(stderr);
closeAllInterfaces(); freeAllInterfaces();
close(listenSocket); close(listenSocket);
playerStop(stderr); playerStop(stderr);
......
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996.
# 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
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
case "$1" in
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
yacc create \`y.tab.[ch]', if possible, from existing .[ch]"
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing - GNU libit 0.0"
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
aclocal)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acinclude.m4' or \`configure.in'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`configure.in'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`acconfig.h' or \`configure.in'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case "$f" in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
if [ ! -f y.tab.c ]; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if [ $# -ne 1 ]; then
eval LASTARG="\${$#}"
case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
makeinfo)
echo 1>&2 "\
WARNING: \`$1' is missing on your system. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
fi
touch $file
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and you do not seem to have it handy on your
system. You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequirements for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
errstatus=0
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here
This diff is collapsed. Click to expand it.
...@@ -16,27 +16,11 @@ ...@@ -16,27 +16,11 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef MPG123_H #ifndef MP3_DECODE_H
#define MPG123_H #define MP3_DECODE_H
#include <stdio.h> #include <stdio.h>
void mpg123_sigHandler(int signal); int mp3_decode(char * file, FILE * in, FILE * out);
int mpg123play(FILE * fp, char * file);
int mpg123pause(FILE * fp);
int mpg123stop(FILE * fp);
void mpg123kill();
int mpg123processMessages();
int getMpg123totalTime();
int getMpg123elapsedTime();
int getMpg123state();
#endif #endif
...@@ -3,7 +3,5 @@ music_directory "/home/shank/mp3" ...@@ -3,7 +3,5 @@ music_directory "/home/shank/mp3"
playlist_directory "/home/shank/playlists" playlist_directory "/home/shank/playlists"
log_file "/home/shank/mpd.log" log_file "/home/shank/mpd.log"
error_file "/home/shank/mpd.error" error_file "/home/shank/mpd.error"
mpg123_command "mpg123 -b 2048 -R foo"
mpg123_process "mpg123"
mpg123_ignore_junk "yes"
connection_timeout "60" connection_timeout "60"
max_connections "5"
/* the Music Player Daemon (MPD)
* (c)2003 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://musicpd.sourceforge.net
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_OGG
#include "ogg.h"
#include "ogg_decode.h"
#include "command.h"
#include "interface.h"
#include "playlist.h"
#include "ls.h"
#include "utils.h"
#include "player.h"
#include "listen.h"
#include <stdio.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#include <errno.h>
#include <vorbis/vorbisfile.h>
#include <ao/ao.h>
#define MAX_BUFFER_LENGTH 1024
int ogg_pid = 0;
int ogg_state = PLAYER_STATE_STOP;
int ogg_elapsedTime = 0;
int ogg_totalTime = 0;
int ogg_send = -1;
int ogg_recv = -1;
int ogg_leavePlay = 1;
int ogg_leavePause = 1;
char ogg_buffer[MAX_BUFFER_LENGTH+1];
int ogg_bufferLength = 0;
char ogg_currentSong[MAXPATHLEN+1] = "\0";
void ogg_sigHandler(int signal) {
if(signal==SIGCHLD) {
wait3(NULL,WNOHANG,NULL);
ogg_pid = 0;
close(ogg_recv);
close(ogg_send);
ogg_leavePause = 1;
if(ogg_state==PLAYER_STATE_PLAY) {
ogg_leavePlay = 1;
fprintf(stderr,"ogg died while playing \%s\"\n",ogg_currentSong);
}
ogg_state = PLAYER_STATE_STOP;
ogg_currentSong[0] = '\0';
}
}
int oggInit(char * file) {
int fd_send[2], fd_recv[2];
if(socketpair(AF_UNIX,SOCK_STREAM,0,fd_send)<0) {
fprintf(stderr,"%s ogg Problems socketpair'ing\n",COMMAND_RESPOND_ERROR);
return -1;
}
if(socketpair(AF_UNIX,SOCK_STREAM,0,fd_recv)<0) {
fprintf(stderr,"%s ogg Problems socketpair()'ing\n",COMMAND_RESPOND_ERROR);
return -1;
}
signal(SIGPIPE,SIG_IGN);
signal(SIGCHLD,ogg_sigHandler);
fflush(NULL);
ogg_pid = fork();
if(ogg_pid==0) {
FILE * in;
FILE * out;
close(listenSocket);
closeAllInterfaces();
close(fd_send[0]);
close(fd_recv[0]);
in = fdopen(fd_send[1],"r");
out = fdopen(fd_recv[1],"w");
if(ogg_decode(file,in,out)<0) {
fprintf(stderr,"%s Problems spawning ogg\n",COMMAND_RESPOND_ERROR);
fclose(in);
fclose(out);
exit(-1);
}
fclose(in);
fclose(out);
exit(0);
}
else if(ogg_pid<0) {
fprintf(stderr,"%s ogg Problems fork()'ing\n",COMMAND_RESPOND_ERROR);
ogg_pid = 0;
close(fd_send[0]);
close(fd_send[1]);
close(fd_recv[0]);
close(fd_recv[1]);
return -1;
}
close(fd_send[1]);
close(fd_recv[1]);
ogg_send = fd_send[0];
ogg_recv = fd_recv[0];
return 0;
}
int oggPlay(FILE * fp, char * file) {
if(fp==NULL) fp=stderr;
if(!isOgg(file)) {
fprintf(fp,"%s \"%s\" is not a ogg\n",file,COMMAND_RESPOND_ERROR);
return -1;
}
if(oggStop(fp)<0) return -1;
if(oggInit(file)<0) {
fprintf(fp,"%s problems init'ing ogg\n",COMMAND_RESPOND_ERROR);
return -1;
}
if(ogg_pid<=0) {
printf("OOOPS, ogg_pid = %i\n",ogg_pid);
}
ogg_leavePlay = 0;
ogg_currentSong[0] = '\0';
strcpy(ogg_currentSong,file);
ogg_state = PLAYER_STATE_PLAY;
/*sleep until status is updated*/
while(!ogg_leavePlay) {
oggProcessMessages();
usleep(1000);
}
return 0;
}
int oggStop(FILE * fp) {
if(ogg_pid>0) {
char string[1024];
ogg_state = PLAYER_STATE_STOP;
sprintf(string,"%s\n",OGG_STOP);
if(write(ogg_send,string,strlen(string))<0) {
fprintf(fp,"%s problems write'ing\n",COMMAND_RESPOND_ERROR);
return -1;
}
waitpid(ogg_pid,NULL,0);
}
ogg_state = PLAYER_STATE_STOP;
return 0;
}
int oggPause(FILE * fp) {
char string[1024];
if(ogg_pid>0) {
ogg_leavePause = 0;
sprintf(string,"%s\n",OGG_PAUSE);
if(write(ogg_send,string,strlen(string))<0) {
fprintf(fp,"%s problems write'ing\n",COMMAND_RESPOND_ERROR);
}
if(ogg_state==PLAYER_STATE_PLAY) {
ogg_state = PLAYER_STATE_PAUSE;
}
else if(ogg_state==PLAYER_STATE_PAUSE) {
ogg_state = PLAYER_STATE_PLAY;
}
while(!ogg_leavePause) {
oggProcessMessages();
usleep(1000);
}
}
return 0;
}
int oggReadline() {
fd_set fdsr;
struct timeval tv;
FD_ZERO(&fdsr);
FD_SET(ogg_recv,&fdsr);
tv.tv_sec = tv.tv_usec = 0;
if(select(ogg_recv+1,&fdsr,NULL,NULL,&tv)==1) {
int rc;
while(1) {
rc = read(ogg_recv,ogg_buffer+ogg_bufferLength,1);
if(rc<=0) {
return -1;
}
if(ogg_buffer[ogg_bufferLength]=='\0' || ogg_buffer[ogg_bufferLength]=='\n' || ogg_bufferLength == MAX_BUFFER_LENGTH) {
ogg_buffer[ogg_bufferLength] = '\0';
ogg_bufferLength = 0;
return -1;
}
ogg_bufferLength++;
}
}
return 0;
}
int oggProcessMessages() {
if(ogg_pid>0) {
while(oggReadline()) {
char * c[4];
c[0] = strtok(ogg_buffer," ");
if(c[0]) {
if(0==strcmp(c[0],OGG_TIME)) {
c[1] = strtok(NULL," ");
c[2] = strtok(NULL," ");
ogg_totalTime = atof(c[2])+0.5;
ogg_elapsedTime = atof(c[1])+0.5;
}
else if(0==strcmp(c[0],OGG_DONE)) {
wait3(NULL,WNOHANG,NULL);
}
else if(0==strcmp(c[0],OGG_ERROR)) {
fprintf(stderr,"ogg error: file \"%s\" : %s\n",ogg_currentSong,c[1]);
}
else if(0==strcmp(c[0],OGG_START)) {
ogg_leavePlay = 1;
}
else if(0==strcmp(c[0],OGG_PAUSE_GOT)) {
ogg_leavePause = 1;
}
}
}
}
return 0;
}
void oggKill() {
if(ogg_pid>0) {
kill(ogg_pid,SIGKILL);
wait3(NULL,WNOHANG,NULL);
}
}
int getOggElapsedTime() {
return ogg_elapsedTime;
}
int getOggTotalTime() {
return ogg_totalTime;
}
int getOggState() {
return ogg_state;
}
#endif
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment