shithub: aacdec

Download patch

ref: 178d2f4e52662b325a770a58dee562f7461e9ce0
parent: d1e15f69a0813f68fe0af4478fb59a5b32ce8921
author: menno <menno>
date: Sat Dec 20 04:56:46 EST 2003

rermoved foo_mp4
mp4 playback now part of foo_input_std

diff: cannot open a/plugins/foo_mp4//null: file does not exist: 'a/plugins/foo_mp4//null'
--- a/plugins/foo_mp4/compiling.txt
+++ /dev/null
@@ -1,3 +1,0 @@
-How to compile foo_mp4.dll:
-Extract the 2 directories (\foobar2000, \pfc) from the foobar2000
-SDK to this directory, open the foo_mp4 project for VC and compile.
--- a/plugins/foo_mp4/convert.cpp
+++ /dev/null
@@ -1,503 +1,0 @@
-/*
-** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
-**  
-** 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.
-**
-** Any non-GPL usage of this software or parts of this software is strictly
-** forbidden.
-**
-** Commercial non-GPL licensing of this software is possible.
-** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
-**/
-
-#include "convert.h"
-
-static int GetAACTrack(MP4FileHandle infile)
-{
-    // find AAC track
-    int i, rc;
-    int numTracks = MP4GetNumberOfTracks(infile, NULL, /* subType */ 0);
-
-    for (i = 0; i < numTracks; i++)
-    {
-        MP4TrackId trackId = MP4FindTrackId(infile, i, NULL, /* subType */ 0);
-        const char* trackType = MP4GetTrackType(infile, trackId);
-
-        if (!strcmp(trackType, MP4_AUDIO_TRACK_TYPE))
-        {
-            unsigned char *buff = NULL;
-            int buff_size = 0;
-            mp4AudioSpecificConfig mp4ASC;
-
-            MP4GetTrackESConfiguration(infile, trackId,
-                (unsigned __int8**)&buff, (unsigned __int32*)&buff_size);
-
-            if (buff)
-            {
-                rc = AudioSpecificConfig(buff, buff_size, &mp4ASC);
-                free(buff);
-
-                if (rc < 0)
-                    return -1;
-                return trackId;
-            }
-        }
-    }
-
-    // can't decode this
-    return -1;
-}
-
-converter::converter(const char *in_file, const char *out_file, const file_info *infos)
-{
-    in = 0;
-    out = 0;
-
-    if (in_file) in = file::g_open(in_file, reader::MODE_READ);
-    if (out_file) out = file::g_open(out_file, reader::MODE_WRITE_NEW);
-
-    mp4File = MP4_INVALID_FILE_HANDLE;
-    if (infos)
-    {
-        info.copy(infos);
-        info.info_remove_all();
-    }
-    else
-    {
-        info.reset();
-    }
-}
-
-converter::~converter()
-{
-    if (mp4File != MP4_INVALID_FILE_HANDLE) MP4Close(mp4File);
-    if (in) in->reader_release();
-    if (out) out->reader_release();
-}
-
-bool converter::aac_to_mp4()
-{
-    if (!in || !out) return false;
-
-    mp4File = MP4CreateCb(0, 0, 0, open_cb, close_cb, read_cb, write_cb, setpos_cb, getpos_cb, filesize_cb, (void *)out);
-    if (mp4File == MP4_INVALID_FILE_HANDLE) return false;
-
-    MP4SetTimeScale(mp4File, 90000);
-
-    MP4TrackId createdTrackId = ConvertAAC();
-    if (createdTrackId == MP4_INVALID_TRACK_ID) return false;
-
-    WriteTagMP4();
-
-    /*
-    int allMpeg4Streams = 0;
-    const char *type = MP4GetTrackType(mp4File, createdTrackId);
-
-    if (!strcmp(type, MP4_AUDIO_TRACK_TYPE))
-        allMpeg4Streams &= (MP4GetTrackAudioType(mp4File, createdTrackId) == MP4_MPEG4_AUDIO_TYPE);
-
-    MP4Close(mp4File);
-    mp4File = MP4_INVALID_FILE_HANDLE;
-    MP4MakeIsmaCompliant(mp4FileName, 0, allMpeg4Streams);
-    */
-
-    return true;
-}
-
-bool converter::mp4_to_aac()
-{
-    if (!in || !out) return false;
-
-    mp4File = MP4ReadCb(0, open_cb, close_cb, read_cb, write_cb, setpos_cb, getpos_cb, filesize_cb, (void*)in);
-    if (mp4File == MP4_INVALID_FILE_HANDLE) return false;
-
-    MP4TrackId track = GetAACTrack(mp4File);
-    if (track < 0) return false;
-
-    if (!ExtractTrack(track)) return false;
-
-    WriteTagAAC();
-
-    return true;
-}
-
-// private:
-
-// hdr must point to at least ADTS_HEADER_MAX_SIZE bytes of memory
-bool converter::LoadNextAdtsHeader(u_int8_t *hdr)
-{
-    u_int state = 0;
-    u_int dropped = 0;
-    u_int hdrByteSize = ADTS_HEADER_MAX_SIZE;
-
-    while (1) {
-        u_int8_t b;
-        if (in->read(&b, 1) != 1) return false;
-
-        // header is complete, return it
-        if (state == hdrByteSize - 1) {
-            hdr[state] = b;
-            if (dropped > 0)
-                console::warning(string_printf("Dropped %u input bytes", dropped));
-            return true;
-        }
-
-        // collect requisite number of bytes, no constraints on data
-        if (state >= 2) {
-            hdr[state++] = b;
-        } else {
-            // have first byte, check if we have 1111X00X
-            if (state == 1) {
-                if ((b & 0xF6) == 0xF0) {
-                    hdr[state] = b;
-                    state = 2;
-                    // compute desired header size
-                    hdrByteSize = MP4AV_AdtsGetHeaderByteSize(hdr);
-                } else {
-                    state = 0;
-                }
-            }
-            // initial state, looking for 11111111
-            if (state == 0) {
-                if (b == 0xFF) {
-                    hdr[state] = b;
-                    state = 1;
-                } else {
-                    // else drop it
-                    dropped++;
-                }
-            }
-        }
-    }
-}
-
-// Load the next frame from the file
-// into the supplied buffer, which better be large enough!
-//
-// Note: Frames are padded to byte boundaries
-bool converter::LoadNextAacFrame(u_int8_t *pBuf, u_int32_t *pBufSize, bool stripAdts)
-{
-    u_int16_t frameSize;
-    u_int16_t hdrBitSize, hdrByteSize;
-    u_int8_t hdrBuf[ADTS_HEADER_MAX_SIZE];
-
-    // get the next AAC frame header, more or less
-    if (!LoadNextAdtsHeader(hdrBuf)) return false;
-
-    // get frame size from header
-    frameSize = MP4AV_AdtsGetFrameSize(hdrBuf);
-
-    // get header size in bits and bytes from header
-    hdrBitSize = MP4AV_AdtsGetHeaderBitSize(hdrBuf);
-    hdrByteSize = MP4AV_AdtsGetHeaderByteSize(hdrBuf);
-
-    // adjust the frame size to what remains to be read
-    frameSize -= hdrByteSize;
-
-    if (stripAdts) {
-        if ((hdrBitSize % 8) == 0) {
-            // header is byte aligned, i.e. MPEG-2 ADTS
-            // read the frame data into the buffer
-            if (in->read(pBuf, frameSize) != frameSize) return false;
-            (*pBufSize) = frameSize;
-        } else {
-            // header is not byte aligned, i.e. MPEG-4 ADTS
-            u_int8_t newByte;
-            int upShift = hdrBitSize % 8;
-            int downShift = 8 - upShift;
-
-            pBuf[0] = hdrBuf[hdrBitSize / 8] << upShift;
-
-            for (int i = 0; i < frameSize; i++) {
-                if (in->read(&newByte, 1) != 1) return false;
-                pBuf[i] |= (newByte >> downShift);
-                pBuf[i+1] = (newByte << upShift);
-            }
-            (*pBufSize) = frameSize + 1;
-        }
-    } else { // don't strip ADTS headers
-        memcpy(pBuf, hdrBuf, hdrByteSize);
-        if (in->read(&pBuf[hdrByteSize], frameSize) != frameSize) return false;
-    }
-
-    return true;
-}
-
-bool converter::GetFirstHeader()
-{
-    // already read first header
-    if (firstHeader[0] == 0xff) return true;
-
-    __int64 pos = in->get_position();
-    in->seek(0);
-
-    if (!LoadNextAdtsHeader(firstHeader)) return false;
-
-    in->seek(pos);
-
-    return true;
-}
-
-MP4TrackId converter::ConvertAAC()
-{
-    // collect all the necessary meta information
-    u_int32_t samplesPerSecond;
-    u_int8_t mpegVersion;
-    u_int8_t profile;
-    u_int8_t channelConfig;
-
-    if (!GetFirstHeader()) return MP4_INVALID_TRACK_ID;
-
-    samplesPerSecond = MP4AV_AdtsGetSamplingRate(firstHeader);
-    mpegVersion = MP4AV_AdtsGetVersion(firstHeader);
-    profile = MP4AV_AdtsGetProfile(firstHeader);
-    channelConfig = MP4AV_AdtsGetChannels(firstHeader);
-
-    u_int8_t audioType = MP4_INVALID_AUDIO_TYPE;
-    switch (mpegVersion) {
-    case 0:
-        audioType = MP4_MPEG4_AUDIO_TYPE;
-        break;
-    case 1:
-        switch (profile) {
-        case 0:
-            audioType = MP4_MPEG2_AAC_MAIN_AUDIO_TYPE;
-            break;
-        case 1:
-            audioType = MP4_MPEG2_AAC_LC_AUDIO_TYPE;
-            break;
-        case 2:
-            audioType = MP4_MPEG2_AAC_SSR_AUDIO_TYPE;
-            break;
-        case 3:
-            return MP4_INVALID_TRACK_ID;
-        }
-        break;
-    }
-
-    // add the new audio track
-    MP4TrackId trackId = MP4AddAudioTrack(mp4File, samplesPerSecond, 1024, audioType);
-
-    if (trackId == MP4_INVALID_TRACK_ID) return MP4_INVALID_TRACK_ID;
-
-    if (MP4GetNumberOfTracks(mp4File, MP4_AUDIO_TRACK_TYPE) == 1)
-        MP4SetAudioProfileLevel(mp4File, 0x0F);
-
-    u_int8_t* pConfig = NULL;
-    u_int32_t configLength = 0;
-
-    MP4AV_AacGetConfiguration(
-        &pConfig,
-        &configLength,
-        profile,
-        samplesPerSecond,
-        channelConfig);
-
-    if (!MP4SetTrackESConfiguration(mp4File, trackId, pConfig, configLength)) {
-        MP4DeleteTrack(mp4File, trackId);
-        return MP4_INVALID_TRACK_ID;
-    }
-
-    // parse the ADTS frames, and write the MP4 samples
-    u_int8_t sampleBuffer[8 * 1024];
-    u_int32_t sampleSize = sizeof(sampleBuffer);
-    MP4SampleId sampleId = 1;
-
-    while (LoadNextAacFrame(sampleBuffer, &sampleSize, true)) {
-        if (!MP4WriteSample(mp4File, trackId, sampleBuffer, sampleSize)) {
-            MP4DeleteTrack(mp4File, trackId);
-            return MP4_INVALID_TRACK_ID;
-        }
-        sampleId++;
-        sampleSize = sizeof(sampleBuffer);
-    }
-
-    return trackId;
-}
-
-bool converter::WriteTagMP4()
-{
-    int count = info.meta_get_count();
-
-    if (count <= 0) return true;
-
-    for ( int i = 0; i < count; i++ ) {
-        char *pName = (char *)info.meta_enum_name ( i );
-        const char *val = info.meta_enum_value ( i );
-        if ( !val || (val && !(*val)) ) continue;
-
-        if ( !stricmp (pName, "TITLE") ) {
-            MP4SetMetadataName ( mp4File, val );
-        }
-        else if ( !stricmp (pName, "ARTIST") ) {
-            MP4SetMetadataArtist ( mp4File, val );
-        }
-        else if ( !stricmp (pName, "WRITER") ) {
-            MP4SetMetadataWriter ( mp4File, val );
-        }
-        else if ( !stricmp (pName, "ALBUM") ) {
-            MP4SetMetadataAlbum ( mp4File, val );
-        }
-        else if ( !stricmp (pName, "YEAR") || !stricmp (pName, "DATE") ) {
-            MP4SetMetadataYear ( mp4File, val );
-        }
-        else if ( !stricmp (pName, "COMMENT") ) {
-            MP4SetMetadataComment ( mp4File, val );
-        }
-        else if ( !stricmp (pName, "GENRE") ) {
-            MP4SetMetadataGenre ( mp4File, val );
-        }
-        else if ( !stricmp (pName, "TRACKNUMBER") ) {
-            unsigned __int16 trkn = atoi(val), tot = 0;
-            MP4SetMetadataTrack ( mp4File, trkn, tot );
-        }
-        else if ( !stricmp (pName, "DISKNUMBER") || !stricmp (pName, "DISC") ) {
-            unsigned __int16 disk = atoi(val), tot = 0;
-            MP4SetMetadataDisk ( mp4File, disk, tot );
-        }
-        else if ( !stricmp (pName, "COMPILATION") ) {
-            unsigned __int8 cpil = atoi(val);
-            MP4SetMetadataCompilation ( mp4File, cpil );
-        }
-        else if ( !stricmp (pName, "TEMPO") ) {
-            unsigned __int16 tempo = atoi(val);
-            MP4SetMetadataTempo ( mp4File, tempo );
-        } else {
-            MP4SetMetadataFreeForm ( mp4File, pName, (unsigned __int8*)val, strlen(val) );
-        }
-    }
-
-    return true;
-}
-
-bool converter::WriteTagAAC()
-{
-    if (info.meta_get_count() <= 0) return true;
-
-    return !!tag_writer::g_run(out, &info, "ape");
-}
-
-bool converter::ExtractTrack(MP4TrackId trackId)
-{
-    // some track types have special needs
-    // to properly recreate their raw ES file
-
-    bool prependES = false;
-    bool prependADTS = false;
-
-    const char *trackType = MP4GetTrackType(mp4File, trackId);
-
-    if (!strcmp(trackType, MP4_VIDEO_TRACK_TYPE))
-    {
-        if (MP4_IS_MPEG4_VIDEO_TYPE(MP4GetTrackEsdsObjectTypeId(mp4File, trackId)))
-            prependES = true;
-    }
-    else if (!strcmp(trackType, MP4_AUDIO_TRACK_TYPE))
-    {
-        if (MP4_IS_AAC_AUDIO_TYPE(MP4GetTrackEsdsObjectTypeId(mp4File, trackId)))
-            prependADTS = true;
-    }
-
-    /*
-    u_int8_t *pConfig = NULL;
-    u_int32_t configSize = 0;
-    mp4AudioSpecificConfig mp4ASC;
-
-    MP4GetTrackESConfiguration(mp4File, trackId, &pConfig, &configSize);
-    if (!pConfig)
-    {
-        console::error("Unable to read track specific configuration.");
-        return false;
-    }
-
-    AudioSpecificConfig((unsigned char*)pConfig, configSize, &mp4ASC);
-    */
-
-    MP4SampleId numSamples = MP4GetTrackNumberOfSamples(mp4File, trackId);
-    u_int8_t *pSample;
-    u_int32_t sampleSize;
-
-    // extraction loop
-    for (MP4SampleId sampleId = 1; sampleId <= numSamples; sampleId++)
-    {
-        // signal to ReadSample() 
-        // that it should malloc a buffer for us
-        pSample = NULL;
-        sampleSize = 0;
-
-        if (prependADTS)
-        {
-            // need some very specialized work for these
-            MP4AV_AdtsMakeFrameFromMp4Sample(
-                mp4File,
-                trackId,
-                sampleId,
-                0/*aacProfileLevel*/,
-                &pSample,
-                &sampleSize);
-        }
-        else
-        {
-            // read the sample
-            int rc = MP4ReadSample(
-                mp4File, 
-                trackId, 
-                sampleId, 
-                &pSample, 
-                &sampleSize);
-
-            if (rc == 0 || !pSample)
-            {
-                if (pSample) free(pSample);
-                console::error(string_printf("Failed to read sample %u", (unsigned int)sampleId));
-                return false;
-            }
-
-            if (prependES && sampleId == 1)
-            {
-                u_int8_t *pConfig = NULL;
-                u_int32_t configSize = 0;
-
-                MP4GetTrackESConfiguration(mp4File, trackId, &pConfig, &configSize);
-                if (!pConfig)
-                {
-                    console::error("Unable to read track specific configuration.");
-                    return false;
-                }
-
-                if (out->write(pConfig, configSize) != configSize)
-                {
-                    free(pConfig);
-                    console::error("Failed to write to output");
-                    return false;
-                }
-
-                free(pConfig);
-            }
-        }
-
-        if (out->write(pSample, sampleSize) != sampleSize)
-        {
-            free(pSample);
-            console::error("Failed to write to output");
-            return false;
-        }
-
-        free(pSample);
-    }
-
-    return true;
-}
--- a/plugins/foo_mp4/convert.h
+++ /dev/null
@@ -1,100 +1,0 @@
-/*
-** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
-**  
-** 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.
-**
-** Any non-GPL usage of this software or parts of this software is strictly
-** forbidden.
-**
-** Commercial non-GPL licensing of this software is possible.
-** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
-**/
-
-#ifndef CONVERT_H__
-#define CONVERT_H__
-
-#include <mpeg4ip.h>
-#include <mp4.h>
-#include <mp4av.h>
-#include <faad.h>
-#include "../SDK/foobar2000.h"
-
-#define ADTS_HEADER_MAX_SIZE 10 // bytes
-
-class converter
-{
-public:
-    converter(const char *in_file, const char *out_file, const file_info *infos=0);
-    ~converter();
-
-    bool aac_to_mp4();
-    bool mp4_to_aac();
-
-private:
-    reader *in, *out;
-    file_info_i_full info;
-    MP4FileHandle mp4File;
-    u_int8_t firstHeader[ADTS_HEADER_MAX_SIZE];
-
-    // AAC to MP4 conversion
-    bool LoadNextAdtsHeader(u_int8_t *hdr);
-    bool LoadNextAacFrame(u_int8_t *pBuf, u_int32_t *pBufSize, bool stripAdts);
-    bool GetFirstHeader();
-    MP4TrackId ConvertAAC();
-
-    //MP4 to AAC conversion
-    bool ExtractTrack(MP4TrackId trackId);
-
-    bool WriteTagMP4();
-    bool WriteTagAAC();
-
-    // MP4 I/O callbacks
-    static unsigned __int32 open_cb ( const char *pName, const char *mode, void *userData ) { return 1; }
-
-    static void close_cb ( void *userData ) { return; }
-
-    static unsigned __int32 read_cb ( void *pBuffer, unsigned int nBytesToRead, void *userData )
-    {
-        reader *r = (reader *)userData;
-        return r->read ( pBuffer, nBytesToRead );
-    }
-
-    static unsigned __int32 write_cb ( void *pBuffer, unsigned int nBytesToWrite, void *userData )
-    {
-        reader *r = (reader *)userData;
-        return r->write ( pBuffer, nBytesToWrite );
-    }
-
-    static __int64 getpos_cb ( void *userData )
-    {
-        reader *r = (reader *)userData;
-        return r->get_position();
-    }
-
-    static __int32 setpos_cb ( unsigned __int32 pos, void *userData )
-    {
-        reader *r = (reader *)userData;
-        return !r->seek ( pos );
-    }
-
-    static __int64 filesize_cb ( void *userData )
-    {
-        reader *r = (reader *)userData;
-        return r->get_length();
-    }
-};
-
-#endif
--- a/plugins/foo_mp4/foo_mp4.dsp
+++ /dev/null
@@ -1,156 +1,0 @@
-# Microsoft Developer Studio Project File - Name="foo_mp4" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
-CFG=foo_mp4 - Win32 Debug
-!MESSAGE This is not a valid makefile. To build this project using NMAKE,
-!MESSAGE use the Export Makefile command and run
-!MESSAGE 
-!MESSAGE NMAKE /f "foo_mp4.mak".
-!MESSAGE 
-!MESSAGE You can specify a configuration when running NMAKE
-!MESSAGE by defining the macro CFG on the command line. For example:
-!MESSAGE 
-!MESSAGE NMAKE /f "foo_mp4.mak" CFG="foo_mp4 - Win32 Debug"
-!MESSAGE 
-!MESSAGE Possible choices for configuration are:
-!MESSAGE 
-!MESSAGE "foo_mp4 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE "foo_mp4 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
-!MESSAGE 
-
-# Begin Project
-# PROP AllowPerConfigDependencies 0
-# PROP Scc_ProjName ""
-# PROP Scc_LocalPath ""
-CPP=xicl6.exe
-MTL=midl.exe
-RSC=rc.exe
-
-!IF  "$(CFG)" == "foo_mp4 - Win32 Release"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /O1 /I "../../include" /I "../../common/mp4ff" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
-# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x413 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=xilink6.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-
-!ELSEIF  "$(CFG)" == "foo_mp4 - Win32 Debug"
-
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Ignore_Export_Lib 0
-# PROP Target_Dir ""
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c
-# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "../../include" /I "../../common/mp4ff" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /GZ /c
-# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
-# ADD BASE RSC /l 0x413 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
-BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-LINK32=xilink6.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
-
-!ENDIF 
-
-# Begin Target
-
-# Name "foo_mp4 - Win32 Release"
-# Name "foo_mp4 - Win32 Debug"
-# Begin Group "Source Files"
-
-# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
-
-SOURCE=.\convert.cpp
-# PROP Exclude_From_Build 1
-# End Source File
-# Begin Source File
-
-SOURCE=.\input_aac.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\mp4_parser.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\packet_decoder_aac.cpp
-# End Source File
-# End Group
-# Begin Group "Header Files"
-
-# PROP Default_Filter "h;hpp;hxx;hm;inl"
-# Begin Source File
-
-SOURCE=.\convert.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\include\faad.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\common\mp4v2\mp4.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\common\mp4v2\mpeg4ip.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\common\mp4v2\systems.h
-# End Source File
-# Begin Source File
-
-SOURCE=..\..\common\mp4v2\win32_ver.h
-# End Source File
-# End Group
-# Begin Group "Resource Files"
-
-# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
-# End Group
-# Begin Group "Shared"
-
-# PROP Default_Filter ""
-# Begin Source File
-
-SOURCE=.\foobar2000\foo_input_std\id3v2_hacks.cpp
-# End Source File
-# Begin Source File
-
-SOURCE=.\foobar2000\foo_input_std\id3v2_hacks.h
-# End Source File
-# End Group
-# End Target
-# End Project
--- a/plugins/foo_mp4/foo_mp4.dsw
+++ /dev/null
@@ -1,122 +1,0 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
-# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
-
-###############################################################################
-
-Project: "foo_mp4"=.\foo_mp4.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-    Begin Project Dependency
-    Project_Dep_Name libfaad
-    End Project Dependency
-    Begin Project Dependency
-    Project_Dep_Name foobar2000_component_client
-    End Project Dependency
-    Begin Project Dependency
-    Project_Dep_Name mp4ff
-    End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "foobar2000_SDK"=.\foobar2000\SDK\foobar2000_SDK.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-    Begin Project Dependency
-    Project_Dep_Name pfc
-    End Project Dependency
-    Begin Project Dependency
-    Project_Dep_Name utf8api
-    End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "foobar2000_component_client"=.\foobar2000\foobar2000_component_client\foobar2000_component_client.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-    Begin Project Dependency
-    Project_Dep_Name foobar2000_SDK
-    End Project Dependency
-}}}
-
-###############################################################################
-
-Project: "libfaad"=..\..\libfaad\libfaad.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "mp4ff"=..\..\common\mp4ff\mp4ff.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "pfc"=.\pfc\pfc.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-}}}
-
-###############################################################################
-
-Project: "utf8api"=.\foobar2000\utf8api\utf8api.dsp - Package Owner=<4>
-
-Package=<5>
-{{{
-}}}
-
-Package=<4>
-{{{
-    Begin Project Dependency
-    Project_Dep_Name pfc
-    End Project Dependency
-}}}
-
-###############################################################################
-
-Global:
-
-Package=<5>
-{{{
-}}}
-
-Package=<3>
-{{{
-}}}
-
-###############################################################################
-
--- a/plugins/foo_mp4/foo_mp4.sln
+++ /dev/null
@@ -1,60 +1,0 @@
-Microsoft Visual Studio Solution File, Format Version 7.00
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "foo_mp4", "foo_mp4.vcproj", "{5CEB23D7-5BDB-4D77-978A-D5B8572843FF}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "foobar2000_SDK", "foobar2000\SDK\foobar2000_SDK.vcproj", "{409102E1-0B45-41CD-A3F8-C37371520D9B}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libfaad", "..\..\libfaad\libfaad.vcproj", "{AB39547E-6CAC-4E25-8BC4-C97EFC144800}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pfc_unicode", "pfc\pfc_unicode.vcproj", "{5C9C90BE-0FEA-4C67-9A4C-C2513C2E27C4}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmp4v2_cb", "..\..\common\mp4v2\libmp4v2_cb.vcproj", "{FAEB6203-052A-4073-AC1C-9CF6FB5B40CC}"
-EndProject
-Global
-	GlobalSection(SolutionConfiguration) = preSolution
-		ConfigName.0 = Debug
-		ConfigName.1 = Release
-		ConfigName.2 = Release ANSI
-	EndGlobalSection
-	GlobalSection(ProjectDependencies) = postSolution
-		{5CEB23D7-5BDB-4D77-978A-D5B8572843FF}.0 = {409102E1-0B45-41CD-A3F8-C37371520D9B}
-		{5CEB23D7-5BDB-4D77-978A-D5B8572843FF}.1 = {FAEB6203-052A-4073-AC1C-9CF6FB5B40CC}
-		{5CEB23D7-5BDB-4D77-978A-D5B8572843FF}.2 = {AB39547E-6CAC-4E25-8BC4-C97EFC144800}
-		{5CEB23D7-5BDB-4D77-978A-D5B8572843FF}.3 = {5C9C90BE-0FEA-4C67-9A4C-C2513C2E27C4}
-	EndGlobalSection
-	GlobalSection(ProjectConfiguration) = postSolution
-		{5CEB23D7-5BDB-4D77-978A-D5B8572843FF}.Debug.ActiveCfg = Debug|Win32
-		{5CEB23D7-5BDB-4D77-978A-D5B8572843FF}.Debug.Build.0 = Debug|Win32
-		{5CEB23D7-5BDB-4D77-978A-D5B8572843FF}.Release.ActiveCfg = Release|Win32
-		{5CEB23D7-5BDB-4D77-978A-D5B8572843FF}.Release.Build.0 = Release|Win32
-		{5CEB23D7-5BDB-4D77-978A-D5B8572843FF}.Release ANSI.ActiveCfg = Release|Win32
-		{5CEB23D7-5BDB-4D77-978A-D5B8572843FF}.Release ANSI.Build.0 = Release|Win32
-		{409102E1-0B45-41CD-A3F8-C37371520D9B}.Debug.ActiveCfg = Debug|Win32
-		{409102E1-0B45-41CD-A3F8-C37371520D9B}.Debug.Build.0 = Debug|Win32
-		{409102E1-0B45-41CD-A3F8-C37371520D9B}.Release.ActiveCfg = Release|Win32
-		{409102E1-0B45-41CD-A3F8-C37371520D9B}.Release.Build.0 = Release|Win32
-		{409102E1-0B45-41CD-A3F8-C37371520D9B}.Release ANSI.ActiveCfg = Release|Win32
-		{409102E1-0B45-41CD-A3F8-C37371520D9B}.Release ANSI.Build.0 = Release|Win32
-		{AB39547E-6CAC-4E25-8BC4-C97EFC144800}.Debug.ActiveCfg = Debug|Win32
-		{AB39547E-6CAC-4E25-8BC4-C97EFC144800}.Debug.Build.0 = Debug|Win32
-		{AB39547E-6CAC-4E25-8BC4-C97EFC144800}.Release.ActiveCfg = Release|Win32
-		{AB39547E-6CAC-4E25-8BC4-C97EFC144800}.Release.Build.0 = Release|Win32
-		{AB39547E-6CAC-4E25-8BC4-C97EFC144800}.Release ANSI.ActiveCfg = Release|Win32
-		{AB39547E-6CAC-4E25-8BC4-C97EFC144800}.Release ANSI.Build.0 = Release|Win32
-		{5C9C90BE-0FEA-4C67-9A4C-C2513C2E27C4}.Debug.ActiveCfg = Debug|Win32
-		{5C9C90BE-0FEA-4C67-9A4C-C2513C2E27C4}.Debug.Build.0 = Debug|Win32
-		{5C9C90BE-0FEA-4C67-9A4C-C2513C2E27C4}.Release.ActiveCfg = Release|Win32
-		{5C9C90BE-0FEA-4C67-9A4C-C2513C2E27C4}.Release.Build.0 = Release|Win32
-		{5C9C90BE-0FEA-4C67-9A4C-C2513C2E27C4}.Release ANSI.ActiveCfg = Release ANSI|Win32
-		{5C9C90BE-0FEA-4C67-9A4C-C2513C2E27C4}.Release ANSI.Build.0 = Release ANSI|Win32
-		{FAEB6203-052A-4073-AC1C-9CF6FB5B40CC}.Debug.ActiveCfg = Debug|Win32
-		{FAEB6203-052A-4073-AC1C-9CF6FB5B40CC}.Debug.Build.0 = Debug|Win32
-		{FAEB6203-052A-4073-AC1C-9CF6FB5B40CC}.Release.ActiveCfg = Release|Win32
-		{FAEB6203-052A-4073-AC1C-9CF6FB5B40CC}.Release.Build.0 = Release|Win32
-		{FAEB6203-052A-4073-AC1C-9CF6FB5B40CC}.Release ANSI.ActiveCfg = Release|Win32
-		{FAEB6203-052A-4073-AC1C-9CF6FB5B40CC}.Release ANSI.Build.0 = Release|Win32
-	EndGlobalSection
-	GlobalSection(ExtensibilityGlobals) = postSolution
-	EndGlobalSection
-	GlobalSection(ExtensibilityAddIns) = postSolution
-	EndGlobalSection
-EndGlobal
--- a/plugins/foo_mp4/foo_mp4.vcproj
+++ /dev/null
@@ -1,220 +1,0 @@
-<?xml version="1.0" encoding = "Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.00"
-	Name="foo_mp4"
-	SccProjectName=""
-	SccLocalPath="">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="2"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE">
-			<Tool
-				Name="VCCLCompilerTool"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="../../include,../../common/mp4v2"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
-				StringPooling="TRUE"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Release/foo_mp4.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				CompileAs="0">
-				<IntelOptions
-					Optimization="2"
-					InlineFuncExpansion="1"
-					OmitFramePtrs="1"
-					StringPooling="1"
-					RuntimeLibrary="0"
-					BufferSecurityCheck="1"
-					FunctionLevelLinking="1"
-					AllOptions="/c  /I &quot;../../include&quot; /I &quot;../../common/mp4v2&quot; /nologo /W3 /O2 /Ob1 /Oy /D &quot;WIN32&quot; /D &quot;NDEBUG&quot; /D &quot;_WINDOWS&quot; /D &quot;_WINDLL&quot; /GF /FD /EHsc /MT /GS /Gy /YX&quot;StdAfx.h&quot; /Fp&quot;.\Release/foo_mp4.pch&quot; /Fo&quot;.\Release/&quot; /Fd&quot;.\Release/&quot; /Gd"/>
-			</Tool>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/MACHINE:I386"
-				AdditionalDependencies="ws2_32.lib odbc32.lib odbccp32.lib"
-				OutputFile=".\Release/foo_mp4.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				ProgramDatabaseFile=".\Release/foo_mp4.pdb"
-				SubSystem="2"
-				ImportLibrary=".\Release/foo_mp4.lib">
-				<IntelOptions
-					AllOptions="/NOLOGO /DLL /OUT:&quot;.\Release/foo_mp4.dll&quot; /INCREMENTAL:NO ws2_32.lib odbc32.lib odbccp32.lib /PDB:&quot;.\Release/foo_mp4.pdb&quot; /SUBSYSTEM:WINDOWS /TLBID:1 /IMPLIB:&quot;.\Release/foo_mp4.lib&quot; /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
-			</Tool>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
-				MkTypLibCompatible="TRUE"
-				SuppressStartupBanner="TRUE"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Release/foo_mp4.tlb"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1043"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<IntelOptions
-				CompilerName="1"/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="2"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="../../include,../../common/mp4v2"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderFile=".\Debug/foo_mp4.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"
-				CompileAs="0">
-				<IntelOptions
-					Optimization="0"
-					MinimalRebuild="1"
-					BasicRuntimeChecks="3"
-					RuntimeLibrary="1"
-					AllOptions="/c  /I &quot;../../include&quot; /I &quot;../../common/mp4v2&quot; /ZI /nologo /W3 /Od /D &quot;WIN32&quot; /D &quot;_DEBUG&quot; /D &quot;_WINDOWS&quot; /D &quot;_WINDLL&quot; /Gm /EHsc /RTC1 /MTd /YX&quot;StdAfx.h&quot; /Fp&quot;.\Debug/foo_mp4.pch&quot; /Fo&quot;.\Debug/&quot; /Fd&quot;.\Debug/&quot; /Gd"/>
-			</Tool>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalOptions="/MACHINE:I386"
-				AdditionalDependencies="ws2_32.lib odbc32.lib odbccp32.lib"
-				OutputFile=".\Debug/foo_mp4.dll"
-				LinkIncremental="2"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/foo_mp4.pdb"
-				SubSystem="2"
-				ImportLibrary=".\Debug/foo_mp4.lib">
-				<IntelOptions
-					AllOptions="/NOLOGO /DLL /OUT:&quot;.\Debug/foo_mp4.dll&quot; /INCREMENTAL ws2_32.lib odbc32.lib odbccp32.lib /DEBUG /PDB:&quot;.\Debug/foo_mp4.pdb&quot; /SUBSYSTEM:WINDOWS /TLBID:1 /IMPLIB:&quot;.\Debug/foo_mp4.lib&quot; /MACHINE:I386 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"/>
-			</Tool>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="TRUE"
-				SuppressStartupBanner="TRUE"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Debug/foo_mp4.tlb"/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1043"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-		</Configuration>
-	</Configurations>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath=".\foobar2000\component_client\component_client.cpp"/>
-			<File
-				RelativePath=".\foo_mp4.cpp"/>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-			<File
-				RelativePath=".\foobar2000\SDK\audio_chunk.h"/>
-			<File
-				RelativePath="..\..\..\..\..\Program Files\DXSDK\include\basetsd.h"/>
-			<File
-				RelativePath=".\pfc\cfg_memblock.h"/>
-			<File
-				RelativePath=".\pfc\cfg_var.h"/>
-			<File
-				RelativePath=".\foobar2000\SDK\component.h"/>
-			<File
-				RelativePath=".\pfc\critsec.h"/>
-			<File
-				RelativePath="..\..\include\faad.h"/>
-			<File
-				RelativePath=".\foobar2000\SDK\file_info.h"/>
-			<File
-				RelativePath=".\foobar2000\SDK\foobar2000.h"/>
-			<File
-				RelativePath=".\pfc\grow_buf.h"/>
-			<File
-				RelativePath=".\foobar2000\SDK\input.h"/>
-			<File
-				RelativePath=".\foobar2000\SDK\interface_helper.h"/>
-			<File
-				RelativePath=".\pfc\mem_block.h"/>
-			<File
-				RelativePath=".\pfc\mem_block_mgr.h"/>
-			<File
-				RelativePath="..\..\common\mp4v2\mp4.h"/>
-			<File
-				RelativePath="..\..\common\mp4v2\mpeg4ip.h"/>
-			<File
-				RelativePath=".\pfc\pfc.h"/>
-			<File
-				RelativePath=".\foobar2000\SDK\playlist_entry.h"/>
-			<File
-				RelativePath=".\pfc\ptr_list.h"/>
-			<File
-				RelativePath=".\foobar2000\SDK\reader.h"/>
-			<File
-				RelativePath=".\foobar2000\SDK\service.h"/>
-			<File
-				RelativePath=".\pfc\string_unicode.h"/>
-			<File
-				RelativePath="..\..\common\mp4v2\systems.h"/>
-			<File
-				RelativePath="..\..\common\mp4v2\win32_ver.h"/>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"/>
-	</Files>
-	<Globals/>
-</VisualStudioProject>
--- a/plugins/foo_mp4/input_aac.cpp
+++ /dev/null
@@ -1,616 +1,0 @@
-/*
-** FAAD2 - Freeware Advanced Audio (AAC) Decoder including SBR decoding
-** Copyright (C) 2003 M. Bakker, Ahead Software AG, http://www.nero.com
-**
-** 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.
-**
-** Any non-GPL usage of this software or parts of this software is strictly
-** forbidden.
-**
-** Commercial non-GPL licensing of this software is possible.
-** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
-**
-** $Id: input_aac.cpp,v 1.4 2003/12/15 17:47:56 menno Exp $
-**/
-
-#include "foobar2000/SDK/foobar2000.h"
-#include "foobar2000/foo_input_std/id3v2_hacks.h"
-#include <faad.h>
-
-//#define DBG_OUT(A) OutputDebugString(A)
-#define DBG_OUT(A)
-
-static const char *object_type_string(int type)
-{
-    static const char *types[31] = {
-        "AAC Main",
-        "AAC LC",
-        "AAC SSR",
-        "AAC LTP",
-        "AAC HE",
-        "AAC Scalable",
-        "TwinVQ",
-        "CELP",
-        "HVXC",
-        "Reserved",
-        "Reserved",
-        "TTSI",
-        "Main synthetic",
-        "Wavetable synthesis",
-        "General MIDI",
-        "Algorithmic Synthesis and Audio FX",
-        "ER AAC LC",
-        "Reserved",
-        "ER AAC LTP",
-        "ER AAC scalable",
-        "ER TwinVQ",
-        "ER BSAC",
-        "ER AAC LD",
-        "ER CELP",
-        "ER HVXC",
-        "ER HILN",
-        "ER Parametric",
-        "Reserved",
-        "Reserved",
-        "Reserved",
-        "Reserved",
-    };
-
-    if (type<1 || type>31) return NULL;
-
-    return types[type-1];
-}
-
-
-struct seek_list
-{
-    seek_list *next;
-    __int64 offset;
-};
-
-class input_aac : public input
-{
-public:
-
-    virtual bool test_filename(const char * fn,const char * ext)
-    {
-        return !stricmp(ext,"AAC");
-    }
-
-    virtual bool open(reader *r, file_info *info, unsigned flags)
-    {
-        int tagsize = 0, tmp = 0;
-        int bread = 0;
-        double length = 1.;
-        __int64 bitrate = 128;
-        unsigned char channels = 0;
-        unsigned long samplerate = 0;
-        int sbr = 0;
-        int header_type = 0;
-        int profile = 0;
-
-        m_reader = r;
-        tagsize = (int)id3v2_calc_size(m_reader);
-        if (tagsize<0) return 0;
-
-        if (!(m_aac_buffer = (unsigned char*)malloc(768*6)))
-        {
-            console::error("Memory allocation error.");
-            return 0;
-        }
-
-        for (int init=0; init<2; init++)
-        {
-            faacDecConfigurationPtr config;
-
-            hDecoder = faacDecOpen();
-            if (!hDecoder)
-            {
-                console::error("Failed to open FAAD2 library.");
-                return 0;
-            }
-
-            config = faacDecGetCurrentConfiguration(hDecoder);
-            config->outputFormat = FAAD_FMT_DOUBLE;
-            faacDecSetConfiguration(hDecoder, config);
-
-            memset(m_aac_buffer, 0, 768*6);
-            bread = m_reader->read(m_aac_buffer, 768*6);
-            m_aac_bytes_into_buffer = bread;
-            m_aac_bytes_consumed = 0;
-            m_file_offset = 0;
-            m_last_offset = -1;
-            m_at_eof = (bread != 768*6) ? 1 : 0;
-
-            if (init==0)
-            {
-                faacDecFrameInfo frameInfo;
-
-                fill_buffer();
-                if ((m_aac_bytes_consumed = faacDecInit(hDecoder,
-                    m_aac_buffer, m_aac_bytes_into_buffer,
-                    &samplerate, &channels)) < 0)
-                {
-                    console::error("Can't initialize decoder library.");
-                    return 0;
-                }
-                advance_buffer(m_aac_bytes_consumed);
-
-                do {
-                    memset(&frameInfo, 0, sizeof(faacDecFrameInfo));
-                    fill_buffer();
-                    faacDecDecode(hDecoder, &frameInfo, m_aac_buffer, m_aac_bytes_into_buffer);
-                } while (!frameInfo.samples && !frameInfo.error);
-
-                if (frameInfo.error)
-                {
-                    console::error(faacDecGetErrorMessage(frameInfo.error));
-                    return 0;
-                }
-
-                m_samplerate = frameInfo.samplerate;
-                m_framesize = (frameInfo.channels != 0) ? frameInfo.samples/frameInfo.channels : 0;
-                sbr = frameInfo.sbr;
-                profile = frameInfo.object_type;
-                header_type = frameInfo.header_type;
-
-                faacDecClose(hDecoder);
-                m_reader->seek(tagsize);
-            }
-        }
-
-        m_head = (struct seek_list*)malloc(sizeof(struct seek_list));
-        m_tail = m_head;
-        m_tail->next = NULL;
-
-        m_header_type = 0;
-        if ((m_aac_buffer[0] == 0xFF) && ((m_aac_buffer[1] & 0xF6) == 0xF0))
-        {
-            if (m_reader->can_seek())
-            {
-                adts_parse(&bitrate, &length);
-                m_reader->seek(tagsize);
-
-                bread = m_reader->read(m_aac_buffer, 768*6);
-                if (bread != 768*6)
-                    m_at_eof = 1;
-                else
-                    m_at_eof = 0;
-                m_aac_bytes_into_buffer = bread;
-                m_aac_bytes_consumed = 0;
-
-                m_header_type = 1;
-            }
-        } else if (memcmp(m_aac_buffer, "ADIF", 4) == 0) {
-            int skip_size = (m_aac_buffer[4] & 0x80) ? 9 : 0;
-            bitrate = ((unsigned int)(m_aac_buffer[4 + skip_size] & 0x0F)<<19) |
-                ((unsigned int)m_aac_buffer[5 + skip_size]<<11) |
-                ((unsigned int)m_aac_buffer[6 + skip_size]<<3) |
-                ((unsigned int)m_aac_buffer[7 + skip_size] & 0xE0);
-
-            length = (double)m_reader->get_length();
-            if (length == -1.)
-            {
-                length = 1;
-            } else {
-                length = ((double)length*8.)/((double)bitrate) + 0.5;
-            }
-
-            bitrate = (__int64)((double)bitrate/1000.0 + 0.5);
-
-            m_header_type = 2;
-        }
-
-        if (!m_reader->can_seek())
-        {
-            length = 0;
-        }
-
-        fill_buffer();
-        if ((m_aac_bytes_consumed = faacDecInit(hDecoder,
-            m_aac_buffer, m_aac_bytes_into_buffer,
-            &samplerate, &channels)) < 0)
-        {
-            console::error("Can't initialize decoder library.");
-            return 0;
-        }
-        advance_buffer(m_aac_bytes_consumed);
-
-        m_length = length;
-        info->set_length(m_length);
-
-        if (flags & OPEN_FLAG_GET_INFO) {
-            const char *profile_str = object_type_string(profile);
-            const char *header_str = NULL;
-
-            info->info_set_int("bitrate", bitrate);
-            info->info_set_int("channels", (__int64)channels);
-            info->info_set_int("samplerate", (__int64)m_samplerate);
-
-            if (profile_str)
-                info->info_set("aac_profile", profile_str);
-
-            if (header_type == RAW)
-                header_str = "RAW";
-            else if (header_type == ADIF)
-                header_str = "ADIF";
-            else if (header_type == ADTS)
-                header_str = "ADTS";
-
-            if (header_str)
-                info->info_set("aac_header_type", header_str);
-
-            if (sbr == 1 || sbr == 2) /* SBR: 0: off, 1: on; upsample, 2: on; downsampled, 3: off; upsampled */
-                info->info_set("codec", "AAC+SBR");
-            else
-                info->info_set("codec", "AAC");
-
-            tag_reader::g_run_multi(m_reader, info, "ape|id3v2|lyrics3|id3v1");
-        }
-
-        return 1;
-    }
-
-    input_aac()
-    {
-        m_head = NULL;
-        m_tail = NULL;
-        m_samplerate = 0;
-        hDecoder = NULL;
-        m_aac_buffer = NULL;
-        m_samples = 0;
-        m_samplepos = 0;
-        m_seekskip = 0;
-        m_eof = false;
-    }
-
-    ~input_aac()
-    {
-        struct seek_list *target = m_head;
-
-        if (hDecoder)
-            faacDecClose(hDecoder);
-        if (m_aac_buffer)
-            free(m_aac_buffer);
-
-        while (target)
-        {
-            struct seek_list *tmp = target;
-            target = target->next;
-            if (tmp) free(tmp);
-        }
-    }
-
-    virtual int run(audio_chunk * chunk)
-    {
-        while (1) {
-            if (m_eof || (m_samples > 0 && m_samplepos >= m_samples)) return 0; // gapless playback
-
-            if (m_aac_bytes_into_buffer == 0) return 0;
-
-            faacDecFrameInfo frameInfo;
-            audio_sample *sample_buffer = 0;
-
-            memset(&frameInfo, 0, sizeof(faacDecFrameInfo));
-
-            do
-            {
-                fill_buffer();
-
-                if (m_aac_bytes_into_buffer != 0)
-                {
-                    sample_buffer = (audio_sample*)faacDecDecode(hDecoder, &frameInfo,
-                        m_aac_buffer, m_aac_bytes_into_buffer);
-
-                    if (m_header_type != 1)
-                    {
-                        if (m_last_offset < m_file_offset)
-                        {
-                            m_tail->offset = m_file_offset;
-                            m_tail->next = (struct seek_list*)malloc(sizeof(struct seek_list));
-                            m_tail = m_tail->next;
-                            m_tail->next = NULL;
-                            m_last_offset = m_file_offset;
-                        }
-                    }
-
-                    advance_buffer(frameInfo.bytesconsumed);
-                }
-
-                if (frameInfo.error || !sample_buffer)
-                {
-                    if (!frameInfo.error) return 0; // EOF
-                    const char *msg = faacDecGetErrorMessage(frameInfo.error);
-                    if (msg) console::error(msg);
-                    return 0; //-1;
-                }
-
-                if (m_aac_bytes_into_buffer == 0) break;
-            } while (!frameInfo.samples || !frameInfo.channels);
-
-            if (!frameInfo.samples || !frameInfo.channels) return 0;
-
-            unsigned int samples = frameInfo.samples/frameInfo.channels;
-
-            m_samplerate = frameInfo.samplerate;
-            m_framesize = samples;
-
-            if (m_samples > 0) { // gapless playback
-                if (m_samplepos + samples > m_samples) samples = (unsigned int)(m_samples - m_samplepos);
-            }
-
-            m_samplepos += samples;
-
-            if ((unsigned)m_seekskip < samples) {
-                if (frameInfo.channels == 6 && frameInfo.num_lfe_channels)
-                {
-                    //channel order for 5.1: L/R/C/LF/BL/BR
-                    audio_sample r1, r2, r3, r4, r5, r6;
-                    for (unsigned int i = 0; i < frameInfo.samples; i += frameInfo.channels)
-                    {
-                        r1 = sample_buffer[i];
-                        r2 = sample_buffer[i+1];
-                        r3 = sample_buffer[i+2];
-                        r4 = sample_buffer[i+3];
-                        r5 = sample_buffer[i+4];
-                        r6 = sample_buffer[i+5];
-                        sample_buffer[i] = r2;
-                        sample_buffer[i+1] = r3;
-                        sample_buffer[i+2] = r1;
-                        sample_buffer[i+3] = r6;
-                        sample_buffer[i+4] = r4;
-                        sample_buffer[i+5] = r5;
-                    }
-                }
-
-                samples -= m_seekskip;
-                if (chunk)
-                {
-                    chunk->set_data((audio_sample*)sample_buffer + m_seekskip*frameInfo.channels,
-                        samples, frameInfo.channels, frameInfo.samplerate);
-                }
-                m_seekskip = 0;
-                break;
-            } else {
-                m_seekskip -= samples;
-            }
-        }
-
-        return 1;
-    }
-
-    virtual set_info_t set_info(reader *r,const file_info *info)
-    {
-        tag_remover::g_run(r);
-        return tag_writer::g_run(r,info,"ape") ? SET_INFO_SUCCESS : SET_INFO_FAILURE;
-    }
-
-    virtual bool seek(double seconds)
-    {
-        unsigned int i, frames;
-        int bread;
-        struct seek_list *target = m_head;
-
-        if (seconds >= m_length) {
-            m_eof = true;
-            return true;
-        }
-
-        double cur_pos_sec = (double)(__int64)m_samplepos / (double)(__int64)m_samplerate;
-
-        if (m_reader->can_seek() && ((m_header_type == 1) || (seconds < cur_pos_sec)))
-        {
-            frames = (unsigned int)(seconds*((double)m_samplerate/(double)m_framesize));
-            if (frames > 1) frames--;
-
-            for (i = 0; i < frames; i++)
-            {
-                if (target->next)
-                    target = target->next;
-                else
-                    return false;
-            }
-            if (target->offset == 0 && frames > 0)
-                return false;
-            m_file_offset = target->offset;
-            m_reader->seek(m_file_offset);
-
-            bread = m_reader->read(m_aac_buffer, 768*6);
-            if (bread != 768*6)
-                m_at_eof = 1;
-            else
-                m_at_eof = 0;
-            m_aac_bytes_into_buffer = bread;
-            m_aac_bytes_consumed = 0;
-            m_file_offset += bread;
-            m_samplepos =(frames > 1) ? (unsigned __int64)(frames-1) * m_framesize : 0;
-            m_seekskip = (int)((unsigned __int64)(seconds * m_samplerate + 0.5) - m_samplepos);// + m_framesize;
-            if (m_seekskip < 0) return false; // should never happen
-            faacDecPostSeekReset(hDecoder, -1);
-
-            faacDecFrameInfo frameInfo;
-            memset(&frameInfo, 0, sizeof(faacDecFrameInfo));
-            fill_buffer();
-            faacDecDecode(hDecoder, &frameInfo, m_aac_buffer, m_aac_bytes_into_buffer);
-
-            return true;
-        } else {
-            if (seconds > cur_pos_sec)
-            {
-                frames = (unsigned int)((seconds - cur_pos_sec)*((double)m_samplerate/(double)m_framesize));
-
-                if (frames > 0)
-                {
-                    for (i = 0; i < frames; i++)
-                    {
-                        if (!run(NULL))
-                            return false;
-                    }
-                }
-
-                m_seekskip = (int)((unsigned __int64)(seconds * m_samplerate + 0.5) - m_samplepos);
-                if (m_seekskip < 0) return false; // should never happen
-                faacDecPostSeekReset(hDecoder, -1);
-            }
-            return true;
-        }
-        return false;
-    }
-
-    virtual bool is_our_content_type(const char *url, const char *type)
-    {
-        return !stricmp(type, "audio/aac") || !stricmp(type, "audio/x-aac");
-    }
-
-private:
-
-    reader *m_reader;
-
-    faacDecHandle hDecoder;
-
-    long m_aac_bytes_into_buffer;
-    long m_aac_bytes_consumed;
-    __int64 m_file_offset;
-    __int64 m_last_offset;
-    unsigned char *m_aac_buffer;
-    int m_at_eof;
-
-    unsigned long m_samplerate;
-    int m_header_type;
-
-    struct seek_list *m_head;
-    struct seek_list *m_tail;
-
-    unsigned __int64 m_samples;
-    unsigned int m_framesize;
-    unsigned __int64 m_samplepos;
-    int m_seekskip;
-    double m_length;
-    bool m_eof;
-
-    int fill_buffer()
-    {
-        int bread;
-
-        if (m_aac_bytes_consumed > 0)
-        {
-            if (m_aac_bytes_into_buffer)
-            {
-                memmove((void*)m_aac_buffer, (void*)(m_aac_buffer + m_aac_bytes_consumed),
-                    m_aac_bytes_into_buffer*sizeof(unsigned char));
-            }
-
-            if (!m_at_eof)
-            {
-                bread = m_reader->read((void*)(m_aac_buffer + m_aac_bytes_into_buffer),
-                    m_aac_bytes_consumed);
-
-                if (bread != m_aac_bytes_consumed)
-                    m_at_eof = 1;
-
-                m_aac_bytes_into_buffer += bread;
-            }
-
-            m_aac_bytes_consumed = 0;
-
-            if (m_aac_bytes_into_buffer > 3)
-            {
-                if (memcmp(m_aac_buffer, "TAG", 3) == 0)
-                    m_aac_bytes_into_buffer = 0;
-            }
-            if (m_aac_bytes_into_buffer > 11)
-            {
-                if (memcmp(m_aac_buffer, "LYRICSBEGIN", 11) == 0)
-                    m_aac_bytes_into_buffer = 0;
-            }
-            if (m_aac_bytes_into_buffer > 8)
-            {
-                if (memcmp(m_aac_buffer, "APETAGEX", 8) == 0)
-                    m_aac_bytes_into_buffer = 0;
-            }
-        }
-
-        return 1;
-    }
-
-    void advance_buffer(int bytes)
-    {
-        m_file_offset += bytes;
-        m_aac_bytes_consumed = bytes;
-        m_aac_bytes_into_buffer -= bytes;
-    }
-
-    int adts_parse(__int64 *bitrate, double *length)
-    {
-        static int sample_rates[] = {96000,88200,64000,48000,44100,32000,24000,22050,16000,12000,11025,8000};
-        int frames, frame_length;
-        int t_framelength = 0;
-        int samplerate;
-        double frames_per_sec, bytes_per_frame;
-
-        /* Read all frames to ensure correct time and bitrate */
-        for (frames = 0; /* */; frames++)
-        {
-            fill_buffer();
-
-            if (m_aac_bytes_into_buffer > 7)
-            {
-                /* check syncword */
-                if (!((m_aac_buffer[0] == 0xFF)&&((m_aac_buffer[1] & 0xF6) == 0xF0)))
-                    break;
-
-                m_tail->offset = m_file_offset;
-                m_tail->next = (struct seek_list*)malloc(sizeof(struct seek_list));
-                m_tail = m_tail->next;
-                m_tail->next = NULL;
-
-                if (frames == 0)
-                    samplerate = sample_rates[(m_aac_buffer[2]&0x3c)>>2];
-
-                frame_length = ((((unsigned int)m_aac_buffer[3] & 0x3)) << 11)
-                    | (((unsigned int)m_aac_buffer[4]) << 3) | (m_aac_buffer[5] >> 5);
-
-                t_framelength += frame_length;
-
-                if (frame_length > m_aac_bytes_into_buffer)
-                    break;
-
-                advance_buffer(frame_length);
-            } else {
-                break;
-            }
-        }
-
-        frames_per_sec = (double)samplerate/1024.0;
-        if (frames != 0)
-            bytes_per_frame = (double)t_framelength/(double)(frames*1000);
-        else
-            bytes_per_frame = 0;
-        *bitrate = (__int64)(8. * bytes_per_frame * frames_per_sec + 0.5);
-        if (frames_per_sec != 0)
-            *length = (double)frames/frames_per_sec;
-        else
-            *length = 1;
-
-        return 1;
-    }
-};
-
-static service_factory_t<input, input_aac> foo_aac;
-
-
-DECLARE_COMPONENT_VERSION ("MPEG-4 AAC decoder",
-                           "2.0",
-                           "Based on FAAD2 v" FAAD2_VERSION "\nCopyright (C) 2002-2003 http://www.audiocoding.com" );
--- a/plugins/foo_mp4/mp4_parser.cpp
+++ /dev/null
@@ -1,619 +1,0 @@
-#include "foobar2000/SDK/foobar2000.h"
-#define USE_TAGGING
-#include <mp4ff.h>
-
-bool is_valid_aac_decoder_config(const void * data,unsigned bytes);
-
-static int find_track_to_decode(mp4ff_t *infile,string_base & codec)
-{
-    /* find AAC track */
-    int i;
-    int numTracks = mp4ff_total_tracks(infile);
-
-    for (i = 0; i < numTracks; i++)
-    {
-		if (mp4ff_get_track_type(infile,i)==1)
-		{
-			switch(mp4ff_get_audio_type(infile,i))
-			{
-			case 0x40:
-			case 0x66:
-			case 0x67:
-			case 0x68:
-				codec = "AAC";
-				return i;
-			case 0x6B:
-			case 0x69:
-				codec = "MP3";
-				return i;
-/*			case 0xE1:
-				codec = "Vorbis";
-				return i;
-			case 0xE2:
-				codec = "AC3";
-				return i;*/
-			}
-		}
-    }
-	return -1;
-}
-
-static const char * tech_info_fields[] = {"replaygain_track_gain","replaygain_track_peak","replaygain_album_gain","replaygain_album_peak","tool"};
-
-const char * check_tech_info(const char * name)
-{
-	unsigned n;
-	for(n=0;n<tabsize(tech_info_fields);n++)
-	{
-		if (!stricmp_utf8(name,tech_info_fields[n])) return tech_info_fields[n];
-	}
-	return 0;
-}
-
-
-static void meta_mp4_to_fb2k(const char * name,const char * value,file_info * out)
-{
-	{
-		const char * p_tech_info = check_tech_info(name);
-		if (p_tech_info)
-		{
-			out->info_set(p_tech_info,value);
-			return;
-		}
-	}
-
-	if (!stricmp_utf8(name,"track")) name = "tracknumber";
-
-	out->meta_add(name,value);
-}
-
-
-static void meta_fb2k_to_mp4(const char * name,const char * value,string_base & out_name,string_base & out_value)
-{
-	if (!stricmp_utf8(name,"tracknumber"))
-	{
-		out_name = "track";
-		out_value = value;
-	}
-	else
-	{
-		out_name = name;
-		out_value = value;
-	}
-}
-
-class input_mp4 : public input
-{
-public:
-    int track;
-    void *sample_buffer;
-
-    mp4ff_t *infile;
-    unsigned sampleId, numSamples;
-	unsigned m_offset;
-
-	reader * mp4file;
-
-	packet_decoder * p_decoder;
-
-
-
-    /* for gapless decoding */
-
-	mp4ff_callback_t mp4cb;
-	
-	double m_length;
-	unsigned m_timescale;
-	unsigned m_skip_samples;
-	unsigned m_skip_frames;
-	double m_timescale_div;
-	unsigned m_expected_sample_rate,m_expected_channels;
-	
-	double m_vbr_last_duration;
-	unsigned m_vbr_update_frames,m_vbr_update_bytes;
-	double m_vbr_update_time;
-	bool m_vbr_update_enabled;
-	unsigned m_vbr_update_interval;
-
-
-	int64_t duration_to_samples(int64_t val)
-	{
-		return (int64_t) ( (double)val * (double) m_expected_sample_rate * m_timescale_div + 0.5);
-	}
-
-	int64_t samples_to_duration(int64_t val)
-	{
-		return (int64_t) ( (double)val * (double)m_timescale / (double)m_expected_sample_rate + 0.5);
-	}
-
-	audio_chunk_i m_tempchunk;
-
-    static uint32_t callback_read(void *udata, void *buffer, uint32_t length)
-	{
-		return reinterpret_cast<input_mp4*>(udata)->mp4file->read(buffer,length);
-	}
-
-    static uint32_t callback_write(void *udata, void *buffer, uint32_t length)
-	{
-		return reinterpret_cast<input_mp4*>(udata)->mp4file->write(buffer,length);
-	}
-
-    static uint32_t callback_seek(void *udata, uint64_t position)
-	{
-		return reinterpret_cast<input_mp4*>(udata)->mp4file->seek(position) ? 1 : 0;
-	}
-	
-	static uint32_t callback_truncate(void *udata)
-	{
-		return reinterpret_cast<input_mp4*>(udata)->mp4file->set_eof() ? 1 : 0;
-	}
-	
-	void vbr_update_reset()
-	{
-		m_vbr_update_frames = 0; m_vbr_update_bytes = 0;
-		m_vbr_update_time = 0;
-		m_vbr_update_enabled = true;//make this configurable ?
-		m_vbr_update_interval = 16;
-	}
-
-	void cleanup()
-	{
-		if (infile) {mp4ff_close(infile);infile=0;}
-		if (p_decoder)
-		{
-			p_decoder->service_release();
-			p_decoder = 0;
-		}
-		vbr_update_reset();
-	}
-
-    input_mp4()
-    {
-		mp4cb.user_data = reinterpret_cast<void*>(this);
-		mp4cb.read = callback_read;
-		mp4cb.write = callback_write;
-		mp4cb.seek = callback_seek;
-		mp4cb.truncate = callback_truncate;
-
-		m_skip_frames = 0;
-		p_decoder = 0;
-		infile = 0;
-		m_offset = 0;
-		m_skip_samples = 0;
-
-		vbr_update_reset();
-
-    }
-
-    ~input_mp4()
-    {
-		cleanup();
-    }
-
-    virtual bool test_filename(const char * fn,const char * ext)
-    {
-        return (!stricmp(ext,"MP4") || !stricmp(ext,"M4A"));
-    }
-
-	bool read_mp4_track_info(file_info * info)
-	{
-		m_expected_sample_rate = mp4ff_get_sample_rate(infile,track);
-		m_expected_channels = mp4ff_get_channel_count(infile,track);
-
-		if (m_expected_sample_rate == 0)
-		{
-			console::error("Invalid MP4 sample rate.");
-			return false;
-		}
-
-		if (m_expected_channels == 0)
-		{
-			console::error("Invalid MP4 channel count.");
-			return false;
-		}
-		m_timescale = mp4ff_time_scale(infile,track);
-		
-		if (m_timescale == 0)
-		{
-			console::error("Invalid MP4 time scale.");
-			return false;
-		}
-/*		if (m_timescale != m_expected_sample_rate)
-		{
-			console::error("Different sample rate / time scales not supported.");
-			return false;
-		}*/
-
-		m_timescale_div = 1.0 / (double) m_timescale;
-
-		{
-			int64_t duration = mp4ff_get_track_duration_use_offsets(infile,track);
-			if (duration == -1)
-				m_length = -1.0;
-			else
-			{
-				m_length = (double)duration * m_timescale_div;
-			}
-		}
-
-		info->set_length(m_length);
-
-		info->info_set_int("bitrate",(mp4ff_get_avg_bitrate(infile,track) + 500) / 1000);
-		info->info_set_int("channels",m_expected_channels);
-		info->info_set_int("samplerate",m_expected_sample_rate);
-//		info->info_set_int("mp4_timescale",m_timescale);
-		
-		return true;
-	}
-
-    virtual bool open(reader *r, file_info *info, unsigned flags)
-    {
-		if (!r->can_seek())
-		{
-			console::error("Unseekable streams not supported.");
-			return false;
-		}
-		string8 codecname;
-
-		cleanup();
-
-		mp4file = r;
-
-
-
-		infile = mp4ff_open_read(&mp4cb);
-		if (!infile)
-		{
-			cleanup();
-			console::error("Error parsing MP4 file.");
-			return false;
-		}
-
-		if ((track = find_track_to_decode(infile,codecname)) < 0)
-		{
-			cleanup();
-			console::error("Unable to find correct sound track in the MP4 file.");
-			return false;
-		}
-
-		info->info_set("codec",codecname);
-
-		if (!read_mp4_track_info(info))
-		{
-			cleanup();
-			return false;
-		}
-
-		p_decoder = packet_decoder::create(codecname);
-		if (p_decoder == 0)
-		{
-			cleanup();
-			console::error("Unable to find correct packet decoder object.");
-			return false;
-		}
-
-	    unsigned char *buffer;
-		unsigned int buffer_size;
-
-		buffer = NULL;
-		buffer_size = 0;
-		mp4ff_get_decoder_config(infile, track, &buffer, &buffer_size);
-
-		if (!p_decoder->init(buffer,buffer_size,info))
-		{
-			if (buffer) free(buffer);
-			cleanup();
-			console::error("Error initializing decoder.");
-			return false;
-		}
-
-		m_expected_channels = (unsigned)info->info_get_int("channels");
-		m_expected_sample_rate = (unsigned)info->info_get_int("samplerate");
-
-		if (m_expected_channels==0 || m_expected_sample_rate==0)
-		{
-			cleanup();
-			console::error("Decoder returned invalid info.");
-			return false;
-		}
-
-		if (buffer)
-		{
-			free(buffer);
-		}
-
-
-		{
-			char *tag = NULL, *item = NULL;
-			int k, j;
-			
-			if (flags & OPEN_FLAG_GET_INFO)
-			{
-
-				j = mp4ff_meta_get_num_items(infile);
-				for (k = 0; k < j; k++)
-				{
-					if (mp4ff_meta_get_by_index(infile, k, &item, &tag))
-					{
-						if (item != NULL && tag != NULL)
-						{
-							meta_mp4_to_fb2k(item,tag,info);
-							free(item); item = NULL;
-							free(tag); tag = NULL;
-						}
-					}
-				}
-			}
-		}
-
-		numSamples = mp4ff_num_samples(infile, track);
-
-		m_skip_samples = 0;
-
-		m_offset = 0;
-
-		vbr_update_reset();
-
-		sampleId = 0;
-
-        return 1;
-    }
-
-    virtual int run(audio_chunk * chunk)
-    {
-		if (p_decoder==0)
-		{
-			console::error("Attempting to decode while not open.");
-			return -1;
-		}
-
-		if (sampleId >= numSamples) return 0;
-
-		bool done = false;
-
-		do		
-		{
-			unsigned char *buffer;
-			unsigned int buffer_size;
-
-			/* get acces unit from MP4 file */
-			buffer = NULL;
-			buffer_size = 0;
-
-			if (mp4ff_read_sample(infile, track, sampleId, &buffer,  &buffer_size) == 0)
-			{
-				cleanup();
-				console::error(uStringPrintf("Reading from MP4 file failed: frame %u of %u.",sampleId,numSamples));
-				return -1;
-			}
-
-			m_tempchunk.reset();
-			if (!p_decoder->decode(buffer,buffer_size,&m_tempchunk))
-			{
-				cleanup();
-				console::error("Decode error.");
-				return -1;
-			}
-
-			if (buffer) free(buffer);
-
-			if (m_skip_frames>0) m_skip_frames--;
-			else
-			{
-				unsigned offset = (unsigned)duration_to_samples(mp4ff_get_sample_offset(infile,track,sampleId));
-				unsigned duration = (unsigned)duration_to_samples(mp4ff_get_sample_duration(infile, track, sampleId));
-	//			console::info(uStringPrintf("duration: %u, offset: %u",duration,offset));
-
-				if (m_tempchunk.is_empty())
-				{
-					if (duration > 0)
-					{
-						m_tempchunk.set_srate(m_expected_sample_rate);
-						m_tempchunk.set_channels(m_expected_channels);
-						m_tempchunk.pad_with_silence(duration);
-					//	console::warning("Decoder returned empty chunk from a non-empty MP4 frame.");
-					}
-				}
-				else
-				{
-					m_vbr_update_frames++;
-					m_vbr_update_bytes += buffer_size;
-					m_vbr_update_time += (m_vbr_last_duration = m_tempchunk.get_duration());
-
-					if (m_tempchunk.get_srate() != m_expected_sample_rate)
-					{
-						cleanup();
-						console::error(uStringPrintf("Expected sample rate: %u, got: %u.",m_expected_sample_rate,m_tempchunk.get_srate()));
-						return -1;
-					}
-/*					if (m_tempchunk.get_channels() != m_expected_channels)
-					{
-						cleanup();
-						console::error(uStringPrintf("Expected channels: %u, got: %u.",m_expected_channels,m_tempchunk.get_channels()));
-						return -1;
-					}*/
-				}
-				unsigned samplerate,channels,decoded_sample_count;
-
-				samplerate = m_tempchunk.get_srate();
-				channels = m_tempchunk.get_channels();
-				decoded_sample_count = m_tempchunk.get_sample_count();
-
-				if (decoded_sample_count < duration)
-				{
-					//console::warning("Decoded MP4 frame smaller than expected.");
-					decoded_sample_count = duration;
-					m_tempchunk.pad_with_silence(decoded_sample_count);
-				}
-
-				if (duration < offset) duration = 0;
-				else duration -= offset;
-
-				if (m_skip_samples>0)
-				{
-					unsigned int delta = (unsigned)m_skip_samples;
-					if (delta > duration) delta = duration;
-					offset += delta;
-					duration -= delta;
-					m_skip_samples -= delta;
-				}
-
-
-				if (duration > 0)
-				{
-					chunk->set_data_64(m_tempchunk.get_data() + offset * channels,duration,channels,samplerate);
-					done = true;
-				}
-			}
-			sampleId++;
-		}
-		while(!done && sampleId < numSamples);
-		
-
-        return done ? 1 : 0;
-    }
-
-    virtual set_info_t set_info(reader *r, const file_info * info)
-    {
-#if 0
-/* metadata tag structure */
-typedef struct
-{
-    char *item;
-    char *value;
-} mp4ff_tag_t;
-
-/* metadata list structure */
-typedef struct
-{
-    mp4ff_tag_t *tags;
-    uint32_t count;
-} mp4ff_metadata_t;
-#endif
-
-
-
-		unsigned rv;
-		ptr_list_t<char> freeme;
-		mem_block_list_t<mp4ff_tag_t> tags;
-		mp4ff_metadata_t mp4meta;
-
-		{
-			string8_fastalloc name,value;
-			mp4ff_tag_t tag;
-
-			unsigned n, m;
-			
-			m = info->meta_get_count();
-			for(n=0;n<m;n++)
-			{
-				meta_fb2k_to_mp4(info->meta_enum_name(n),info->meta_enum_value(n),name,value);
-				freeme.add_item(tag.item = strdup(name));
-				freeme.add_item(tag.value = strdup(value));
-				tags.add_item(tag);
-			}
-
-
-			m = info->info_get_count();
-
-			for(n=0;n<m;n++)
-			{
-				const char * p_name = check_tech_info(info->info_enum_name(n));
-				if (p_name)
-				{
-					tag.item = const_cast<char*>(p_name);
-					tag.value = const_cast<char*>(info->info_enum_value(n));
-					tags.add_item(tag);
-				}
-			}
-		}
-
-		mp4meta.count = tags.get_count();
-		mp4meta.tags = const_cast<mp4ff_tag_t*>(tags.get_ptr());
-
-		mp4file = r;
-		rv = mp4ff_meta_update(&mp4cb,&mp4meta);
-		mp4file = 0;
-
-		freeme.free_all();
-
-		return rv ? SET_INFO_SUCCESS : SET_INFO_FAILURE;
-
-    }
-
-    virtual bool seek(double seconds)
-    {
-		if (p_decoder == 0)
-		{
-			console::error("Attempting to seek while not open.");
-			return false;
-		}
-        if (seconds >= m_length) {
-            sampleId = numSamples;
-            return true;
-        }
-		
-		unsigned max_frame_dependency = p_decoder->get_max_frame_dependency();
-		int64_t offset = (int64_t)(seconds * m_timescale + 0.5);
-		int32_t skip_samples = 0;
-		unsigned dest_sample = mp4ff_find_sample_use_offsets(infile,track,offset,&skip_samples);
-//		console::info(uStringPrintf("%u %u %u",(unsigned)offset,dest_sample,skip_samples));
-
-		if (dest_sample == (-1)) return false;
-
-		if (dest_sample < max_frame_dependency)
-		{
-			m_skip_frames = dest_sample;
-			dest_sample = 0;
-		}
-		else
-		{
-			m_skip_frames = max_frame_dependency;
-			dest_sample -= max_frame_dependency;
-		}
-
-		sampleId = dest_sample;
-		
-		m_skip_samples = (unsigned)duration_to_samples(skip_samples);
-
-		m_offset = 0;
-
-		p_decoder->reset_after_seek();
-		
-		vbr_update_reset();
-
-        return true;
-
-    }
-
-    virtual bool is_our_content_type(const char *url, const char *type)
-    {
-        return !stricmp(type, "audio/mp4") || !stricmp(type, "audio/x-mp4");
-    }
-
-	virtual bool get_dynamic_info(file_info * out,double * timestamp_delta,bool * b_track_change)
-	{
-		bool ret = false;
-		if (m_vbr_update_enabled)
-		{
-			if (m_vbr_update_time > 0 && m_vbr_update_frames >= m_vbr_update_interval)
-			{
-				double delay = - (m_vbr_update_time - m_vbr_last_duration);
-				int val = (int) ( ((double)m_vbr_update_bytes * 8.0 / m_vbr_update_time + 500.0) / 1000.0 );
-				if (val != out->info_get_bitrate_vbr())
-				{
-					*timestamp_delta = delay;
-					out->info_set_bitrate_vbr(val);
-					ret = true;
-				}
-				m_vbr_update_frames = 0; m_vbr_update_bytes = 0;
-				m_vbr_update_time = 0;
-			}
-		}
-
-		return ret;
-	}
-
-};
-
-static service_factory_t<input, input_mp4> foo_mp4;
\ No newline at end of file
--- a/plugins/foo_mp4/packet_decoder_aac.cpp
+++ /dev/null
@@ -1,150 +1,0 @@
-#include "foobar2000/SDK/foobar2000.h"
-#include <faad.h>
-
-
-class packet_decoder_aac : public packet_decoder
-{
-    faacDecHandle hDecoder;
-    faacDecFrameInfo frameInfo;
-	void cleanup()
-	{
-		if (hDecoder) {faacDecClose(hDecoder);hDecoder=0;}
-	}
-public:
-	packet_decoder_aac()
-	{
-		hDecoder = 0;
-	}
-
-	~packet_decoder_aac()
-	{
-		cleanup();
-	}
-	
-	virtual bool is_our_type(const char * name) {return !stricmp_utf8(name,"AAC");}
-	
-	virtual unsigned get_max_frame_dependency() {return 1;}
-	
-	virtual bool init(const void * data,unsigned bytes,file_info * info)
-	{
-		if (hDecoder) faacDecClose(hDecoder);
-		if (data==0) return false;
-		hDecoder = faacDecOpen();
-		if (hDecoder == 0)
-		{
-			cleanup();
-			console::error("Failed to open FAAD2 library.");
-			return false;
-		}
-
-		{
-			faacDecConfigurationPtr config;
-            config = faacDecGetCurrentConfiguration(hDecoder);
-            config->outputFormat = 
-#if audio_sample_size == 64
-				FAAD_FMT_DOUBLE
-#else
-				FAAD_FMT_FLOAT
-#endif
-				;
-            faacDecSetConfiguration(hDecoder, config);
-		}
-
-		unsigned long t_samplerate;
-		unsigned char t_channels;
-
-		if(faacDecInit2(hDecoder, (unsigned char*)data, bytes,
-						&t_samplerate,&t_channels) < 0)
-		{
-			faacDecClose(hDecoder);
-			hDecoder = 0;
-			return false;
-		}
-
-		info->info_set_int("samplerate",t_samplerate);
-		info->info_set_int("channels",t_channels);
-
-		{
-			mp4AudioSpecificConfig mp4ASC;
-			if (AudioSpecificConfig((unsigned char*)data, bytes, &mp4ASC) >= 0)
-			{
-				static const char *ot[6] = { "NULL", "MAIN AAC", "LC AAC", "SSR AAC", "LTP AAC", "HE AAC" };
-				info->info_set("aac_profile",ot[(mp4ASC.objectTypeIndex > 5)?0:mp4ASC.objectTypeIndex]);
-			}
-		}
-
-
-
-		return true;
-
-
-	}
-	
-	virtual void reset_after_seek()
-	{
-		if (hDecoder)
-		{
-			faacDecPostSeekReset(hDecoder, -1);
-		}
-	}
-
-	virtual bool decode(const void * buffer,unsigned bytes,audio_chunk * out)
-	{
-		audio_sample * sample_buffer = (audio_sample*)faacDecDecode(hDecoder, &frameInfo, (unsigned char*)buffer, bytes);
-
-		if (frameInfo.error > 0)
-		{
-			cleanup();
-			console::error(faacDecGetErrorMessage(frameInfo.error));
-			return false;
-		}
-
-		if (frameInfo.channels<=0)
-		{
-			cleanup();
-			console::error("Internal decoder error.");
-			return false;
-		}
-
-		if (frameInfo.samples)
-		{
-            if (frameInfo.channels == 6 && frameInfo.num_lfe_channels)
-            {
-                //channel order for 5.1: L/R/C/LF/BL/BR
-                audio_sample r1, r2, r3, r4, r5, r6;
-                for (unsigned int i = 0; i < frameInfo.samples; i += frameInfo.channels)
-                {
-                    r1 = sample_buffer[i];
-                    r2 = sample_buffer[i+1];
-                    r3 = sample_buffer[i+2];
-                    r4 = sample_buffer[i+3];
-                    r5 = sample_buffer[i+4];
-                    r6 = sample_buffer[i+5];
-                    sample_buffer[i] = r2;
-                    sample_buffer[i+1] = r3;
-                    sample_buffer[i+2] = r1;
-                    sample_buffer[i+3] = r6;
-                    sample_buffer[i+4] = r4;
-                    sample_buffer[i+5] = r5;
-                }
-            }
-
-			return out->set_data(sample_buffer,frameInfo.samples / frameInfo.channels,frameInfo.channels,frameInfo.samplerate);
-		}
-		else
-		{
-			out->reset();
-			return true;
-		}
-	}
-	virtual const char * get_name() {return "MPEG-4 AAC";}
-};
-
-static packet_decoder_factory<packet_decoder_aac> AHAHAHAHA;
-
-
-bool is_valid_aac_decoder_config(const void * data,unsigned bytes)
-{
-	mp4AudioSpecificConfig mp4ASC;
-	return AudioSpecificConfig((unsigned char*)data, bytes, &mp4ASC)>=0;
-}
\ No newline at end of file