Put mp4ff back into the tree

git-svn-id: https://svn.musicpd.org/mpd/trunk@4461 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Avuton Olrich 2006-07-26 03:05:50 +00:00
parent 1523e8a842
commit bf3848ef94
3 changed files with 38 additions and 40 deletions

View File

@ -7,6 +7,8 @@ AM_INIT_AUTOMAKE($PACKAGE_NAME, $PACKAGE_VERSION)
AC_SUBST(MPD_LIBS)
AC_SUBST(MPD_CFLAGS)
AC_SUBST(MP4FF_LIB)
AC_SUBST(MP4FF_SUBDIR)
AC_PROG_CC
AC_PROG_INSTALL
@ -357,6 +359,8 @@ if test x$enable_mpc = xyes; then
CPPFLAGS=$oldcppflags
fi
MP4FF_SUBDIR=""
if test x$enable_aac = xyes; then
if test "x$faad_libraries" != "x" ; then
FAAD_LIBS="-L$faad_libraries"
@ -366,7 +370,7 @@ if test x$enable_aac = xyes; then
FAAD_LIBS="-L$libdir"
fi
FAAD_LIBS="$FAAD_LIBS -lfaad -lmp4ff"
FAAD_LIBS="$FAAD_LIBS -lfaad"
if test "x$faad_includes" != "x" ; then
FAAD_CFLAGS="-I$faad_includes"
@ -383,7 +387,6 @@ if test x$enable_aac = xyes; then
LIBS="$LIBS $MPD_LIBS $FAAD_LIBS"
CPPFLAGS=$CFLAGS
AC_CHECK_HEADER(faad.h,,enable_aac=no)
AC_CHECK_HEADER(mp4ff.h,,enable_aac=no)
if test x$enable_aac = xyes; then
AC_CHECK_DECL(FAAD2_VERSION,,enable_aac=no,[#include <faad.h>])
fi
@ -391,17 +394,14 @@ if test x$enable_aac = xyes; then
AC_CHECK_DECL(faacDecInit2,,enable_aac=no,[#include <faad.h>])
fi
if test x$enable_aac = xyes; then
AC_CHECK_LIB(faad,faacDecInit2,[MPD_LIBS="$MPD_LIBS $FAAD_LIBS";MPD_CFLAGS="$MPD_CFLAGS $FAAD_CFLAGS"],enable_aac=no)
AC_CHECK_LIB(faad,faacDecInit2,[MPD_LIBS="$MPD_LIBS $FAAD_LIBS";MPD_CFLAGS="$MPD_CFLAGS $FAAD_CFLAGS";MP4FF_SUBDIR="mp4ff";MP4FF_LIB="mp4ff/libmp4ff.la"],enable_aac=no)
if test x$enable_aac = xno; then
enable_aac=yes
AC_CHECK_LIB(faad,NeAACDecInit2,[MPD_LIBS="$MPD_LIBS $FAAD_LIBS";MPD_CFLAGS="$MPD_CFLAGS $FAAD_CFLAGS"],enable_aac=no)
AC_CHECK_LIB(faad,NeAACDecInit2,[MPD_LIBS="$MPD_LIBS $FAAD_LIBS";MPD_CFLAGS="$MPD_CFLAGS $FAAD_CFLAGS";MP4FF_SUBDIR="mp4ff";MP4FF_LIB="mp4ff/libmp4ff.la"],enable_aac=no)
fi
fi
if test x$enable_aac = xyes; then
AC_CHECK_LIB(mp4ff,mp4ff_open_read,[MPD_LIBS="$MPD_LIBS $FAAD_LIBS";MPD_CFLAGS="$MPD_CFLAGS $FAAD_CFLAGS"],enable_aac=no)
fi
if test x$enable_aac = xyes; then
AC_MSG_CHECKING(that FAAD2 uses buffer and bufferlen)
AC_MSG_CHECKING(that FAAD2 uses buffer and bufferlen)
AC_COMPILE_IFELSE([
#include <faad.h>
@ -636,7 +636,7 @@ if test x$enable_mod = xyes; then
fi
fi
AC_OUTPUT(doc/Makefile src/Makefile Makefile )
AC_OUTPUT(src/mp4ff/Makefile doc/Makefile src/Makefile Makefile )
echo ""
echo "########### MPD CONFIGURATION ############"

View File

@ -1,4 +1,5 @@
bin_PROGRAMS = mpd
SUBDIRS = $(MP4FF_SUBDIR)
mpd_audioOutputs = \
audioOutputs/audioOutput_alsa.c \
@ -115,7 +116,9 @@ mpd_SOURCES = \
mpd_CFLAGS = $(MPD_CFLAGS)
mpd_LDADD = $(MPD_LIBS)
mpd_LDADD = $(MPD_LIBS) $(MP4FF_LIB)
DIST_SUBDIRS = mp4ff
# sparse is a semantic parser
# URL: git://www.kernel.org/pub/scm/devel/sparse/sparse.git

View File

@ -28,12 +28,13 @@
#include "../outputBuffer.h"
#include "../decode.h"
#include "../mp4ff/mp4ff.h"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <faad.h>
#include <mp4ff.h>
/* all code here is either based on or copied from FAAD2's frontend code */
@ -45,7 +46,7 @@ static int mp4_getAACTrack(mp4ff_t * infile)
for (i = 0; i < numTracks; i++) {
unsigned char *buff = NULL;
unsigned int *buff_size = 0;
int buff_size = 0;
#ifdef HAVE_MP4AUDIOSPECIFICCONFIG
mp4AudioSpecificConfig mp4ASC;
#else
@ -54,11 +55,11 @@ static int mp4_getAACTrack(mp4ff_t * infile)
dummy7_8, dummy8_8;
#endif
mp4ff_get_decoder_config(infile, i, &buff, buff_size);
mp4ff_get_decoder_config(infile, i, &buff, &buff_size);
if (buff) {
#ifdef HAVE_MP4AUDIOSPECIFICCONFIG
rc = AudioSpecificConfig(buff, *buff_size, &mp4ASC);
rc = AudioSpecificConfig(buff, buff_size, &mp4ASC);
#else
rc = AudioSpecificConfig(buff, &dummy1_32, &dummy2_8,
&dummy3_8, &dummy4_8,
@ -87,24 +88,6 @@ static uint32_t mp4_inputStreamSeekCallback(void *inStream, uint64_t position)
return seekInputStream((InputStream *) inStream, position, SEEK_SET);
}
static faacDecHandle *openConfigureFaad()
{
faacDecConfigurationPtr config;
faacDecHandle decoder = faacDecOpen();
config = faacDecGetCurrentConfiguration(decoder);
config->outputFormat = FAAD_FMT_16BIT;
#ifdef HAVE_FAACDECCONFIGURATION_DOWNMATRIX
config->downMatrix = 1;
#endif
#ifdef HAVE_FAACDECCONFIGURATION_DONTUPSAMPLEIMPLICITSBR
config->dontUpSampleImplicitSBR = 0;
#endif
faacDecSetConfiguration(decoder, config);
return decoder;
}
static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, char *path)
{
mp4ff_t *mp4fh;
@ -112,11 +95,12 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, char *path)
int32_t track;
float time;
int32_t scale;
faacDecHandle *decoder;
faacDecHandle decoder;
faacDecFrameInfo frameInfo;
faacDecConfigurationPtr config;
unsigned char *mp4Buffer;
unsigned int mp4BufferSize;
uint32_t sampleRate;
int mp4BufferSize;
unsigned long sampleRate;
unsigned char channels;
long sampleId;
long numSamples;
@ -161,7 +145,17 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, char *path)
return -1;
}
decoder = openConfigureFaad();
decoder = faacDecOpen();
config = faacDecGetCurrentConfiguration(decoder);
config->outputFormat = FAAD_FMT_16BIT;
#ifdef HAVE_FAACDECCONFIGURATION_DOWNMATRIX
config->downMatrix = 1;
#endif
#ifdef HAVE_FAACDECCONFIGURATION_DONTUPSAMPLEIMPLICITSBR
config->dontUpSampleImplicitSBR = 0;
#endif
faacDecSetConfiguration(decoder, config);
dc->audioFormat.bits = 16;
@ -170,8 +164,7 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, char *path)
mp4ff_get_decoder_config(mp4fh, track, &mp4Buffer, &mp4BufferSize);
if (faacDecInit2
(decoder, mp4Buffer, mp4BufferSize, &sampleRate, &channels)
< 0) {
(decoder, mp4Buffer, mp4BufferSize, &sampleRate, &channels) < 0) {
ERROR("Error not a AAC stream.\n");
faacDecClose(decoder);
mp4ff_close(mp4fh);
@ -321,9 +314,11 @@ static int mp4_decode(OutputBuffer * cb, DecoderControl * dc, char *path)
}
flushOutputBuffer(cb);
if (dc->stop)
if (dc->stop) {
dc->state = DECODE_STATE_STOP;
dc->stop = 0;
dc->state = DECODE_STATE_STOP;
} else
dc->state = DECODE_STATE_STOP;
return 0;
}