Skip to content

Commit

Permalink
changed: compile adpcm codec instead of keeping binary in svn (x86 li…
Browse files Browse the repository at this point in the history
…nux only)

git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/linuxport/XBMC@13925 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
  • Loading branch information
spiff_ committed Jul 4, 2008
1 parent fbdefc6 commit 99bff7f
Show file tree
Hide file tree
Showing 10 changed files with 860 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile.in
@@ -1,4 +1,4 @@
DIRS=guilib xbmc xbmc/FileSystem xbmc/FileSystem/MusicDatabaseDirectory xbmc/FileSystem/VideoDatabaseDirectory xbmc/cores xbmc/cores/paplayer xbmc/cores/DllLoader xbmc/cores/DllLoader/exports xbmc/cores/DllLoader/exports/util xbmc/xbox xbmc/linux xbmc/visualizations xbmc/screensavers xbmc/utils guilib/common guilib/tinyXML xbmc/lib/sqLite xbmc/lib/libPython xbmc/lib/libPython/xbmcmodule xbmc/lib/libPython/linux xbmc/lib/libscrobbler xbmc/lib/UnrarXLib xbmc/lib/libGoAhead xbmc/lib/libUPnP xbmc/cores/dvdplayer xbmc/cores/dvdplayer/DVDSubtitles xbmc/cores/dvdplayer/DVDInputStreams xbmc/cores/dvdplayer/DVDCodecs xbmc/cores/dvdplayer/DVDCodecs/Audio xbmc/cores/dvdplayer/DVDCodecs/Video xbmc/cores/dvdplayer/DVDCodecs/Overlay xbmc/cores/dvdplayer/DVDCodecs/Overlay/libspucc xbmc/cores/dvdplayer/DVDDemuxers xbmc/cores/VideoRenderers xbmc/cores/VideoRenderers/VideoShaders xbmc/cdrip xbmc/lib/libcmyth tools/EventClients xbmc/lib/libRTMP xbmc/cores/paplayer/AC3Codec
DIRS=guilib xbmc xbmc/FileSystem xbmc/FileSystem/MusicDatabaseDirectory xbmc/FileSystem/VideoDatabaseDirectory xbmc/cores xbmc/cores/paplayer xbmc/cores/DllLoader xbmc/cores/DllLoader/exports xbmc/cores/DllLoader/exports/util xbmc/xbox xbmc/linux xbmc/visualizations xbmc/screensavers xbmc/utils guilib/common guilib/tinyXML xbmc/lib/sqLite xbmc/lib/libPython xbmc/lib/libPython/xbmcmodule xbmc/lib/libPython/linux xbmc/lib/libscrobbler xbmc/lib/UnrarXLib xbmc/lib/libGoAhead xbmc/lib/libUPnP xbmc/cores/dvdplayer xbmc/cores/dvdplayer/DVDSubtitles xbmc/cores/dvdplayer/DVDInputStreams xbmc/cores/dvdplayer/DVDCodecs xbmc/cores/dvdplayer/DVDCodecs/Audio xbmc/cores/dvdplayer/DVDCodecs/Video xbmc/cores/dvdplayer/DVDCodecs/Overlay xbmc/cores/dvdplayer/DVDCodecs/Overlay/libspucc xbmc/cores/dvdplayer/DVDDemuxers xbmc/cores/VideoRenderers xbmc/cores/VideoRenderers/VideoShaders xbmc/cdrip xbmc/lib/libcmyth tools/EventClients xbmc/lib/libRTMP xbmc/cores/paplayer/AC3Codec xbmc/cores/paplayer/ADPCMCodec

LIBS=@LIBS@
DEBUG_FLAGS=@DEBUG_FLAGS@
Expand Down Expand Up @@ -86,6 +86,7 @@ librtmp:
$(MAKE) -C xbmc/lib/libRTMP
papcodecs:
$(MAKE) -C xbmc/cores/paplayer/AC3Codec
$(MAKE) -C xbmc/cores/paplayer/ADPCMCodec

compile: guilib xbmc filesystem musicdatabase videodatabase cores paplayer dllloader exports xbox linux visualizations screensavers utils common tinyxml sqllite libscrobbler libgoahead unrarxlib libpython dvdplayer libupnp cdrip libcmyth librtmp papcodecs

Expand Down
Binary file removed system/players/paplayer/adpcm-i486-linux.so
Binary file not shown.
144 changes: 144 additions & 0 deletions xbmc/cores/paplayer/ADPCMCodec/ADPCMDll.cpp
@@ -0,0 +1,144 @@
#ifdef _LINUX
#define __declspec(x)
#endif

extern "C"
{
#include "mywav.h"
#include "uXboxAdpcmDecoder.h"
#include <stdlib.h>

#define GETLENGTH(x,SAMPLERATE,NCH) (((x * 10) / ((SAMPLERATE / 100) * NCH * (16 >> 3)) / XBOX_ADPCM_SRCSIZE) * XBOX_ADPCM_DSTSIZE)

struct ADPCMInfo
{
FILE* f;
mywav_fmtchunk fmt;
unsigned int length;
int data_offset;
char* szInputBuffer;
char* szBuf;
char* szStartOfBuf;
int bufLen;
};

int getwavinfo(ADPCMInfo* info) {
int wavsize;

wavsize = mywav_data(info->f, &info->fmt);
if(wavsize >= 0) {
if(info->fmt.wFormatTag != 0x0069) {
fseek(info->f,0,SEEK_SET);
return(-1);
}
info->data_offset = ftell(info->f);
} else {
fseek(info->f,0,SEEK_END);
wavsize = ftell(info->f);
fseek(info->f,0,SEEK_SET);
}

info->length = GETLENGTH(wavsize,info->fmt.dwSamplesPerSec,info->fmt.wChannels);
return(wavsize);
}


int __declspec(dllexport) DLL_LoadXWAV(const char* szFileName)
{
ADPCMInfo* info = (ADPCMInfo*)malloc(sizeof(ADPCMInfo));
info->f = fopen(szFileName,"rb");
if (!info->f)
{
free(info);
return NULL;
}

int iResult = getwavinfo(info);
if (iResult == -1)
{
fclose(info->f);
free(info);
return NULL;
}

info->szBuf = (char*)malloc(XBOX_ADPCM_DSTSIZE*info->fmt.wChannels*4);
info->szInputBuffer = (char*)malloc(XBOX_ADPCM_SRCSIZE*info->fmt.wChannels*4);
info->szStartOfBuf = info->szBuf+XBOX_ADPCM_DSTSIZE*info->fmt.wChannels*4;
info->bufLen = XBOX_ADPCM_DSTSIZE*info->fmt.wChannels*4;
return (int)info;
}

void __declspec(dllexport) DLL_FreeXWAV(int info)
{
ADPCMInfo* pInfo = (ADPCMInfo*)info;
fclose(pInfo->f);
free(pInfo);
}

int __declspec(dllexport) DLL_Seek(int info, int pos)
{
ADPCMInfo* pInfo = (ADPCMInfo*)info;
int offs = pInfo->data_offset + ((((pos/ 1000) * pInfo->fmt.dwSamplesPerSec) / XBOX_ADPCM_DSTSIZE) * XBOX_ADPCM_SRCSIZE * pInfo->fmt.wChannels * (16 >> 3));

fseek(pInfo->f,offs,SEEK_SET);
// invalidate buffer
pInfo->szStartOfBuf = pInfo->szBuf+XBOX_ADPCM_DSTSIZE*pInfo->fmt.wChannels*4;
return pos;
}

long __declspec(dllexport) DLL_FillBuffer(int info, char* buffer, int size)
{
ADPCMInfo* pInfo = (ADPCMInfo*)info;
int iCurrSize = size;
while (iCurrSize > 0)
{
if (pInfo->szStartOfBuf >= pInfo->szBuf+pInfo->bufLen)
{
// Read data into input buffer
int read = fread(pInfo->szInputBuffer,XBOX_ADPCM_SRCSIZE*pInfo->fmt.wChannels,4,pInfo->f);
if (!read)
break;

TXboxAdpcmDecoder_Decode_Memory((uint8_t*)pInfo->szInputBuffer, read*XBOX_ADPCM_SRCSIZE*pInfo->fmt.wChannels, (uint8_t*)pInfo->szBuf, pInfo->fmt.wChannels);
pInfo->szStartOfBuf = pInfo->szBuf;
}
int iCopy=0;
if (iCurrSize > pInfo->szBuf+pInfo->bufLen-pInfo->szStartOfBuf)
iCopy = pInfo->szBuf+pInfo->bufLen-pInfo->szStartOfBuf;
else
iCopy = iCurrSize;

memcpy(buffer,pInfo->szStartOfBuf,iCopy);
buffer += iCopy;
iCurrSize -= iCopy;
pInfo->szStartOfBuf += iCopy;
}

return size-iCurrSize;
}

int __declspec(dllexport) DLL_GetPlaybackRate(int info)
{
ADPCMInfo* pInfo = (ADPCMInfo*)info;
return pInfo->fmt.dwSamplesPerSec;
}

int __declspec(dllexport) DLL_GetNumberOfChannels(int info)
{
ADPCMInfo* pInfo = (ADPCMInfo*)info;
return pInfo->fmt.wChannels;
}

int __declspec(dllexport) DLL_GetSampleSize(int info)
{
ADPCMInfo* pInfo = (ADPCMInfo*)info;
return pInfo->fmt.wBitsPerSample;
}

int __declspec(dllexport) DLL_GetLength(int info)
{
ADPCMInfo* pInfo = (ADPCMInfo*)info;
return pInfo->length;
}
}

15 changes: 15 additions & 0 deletions xbmc/cores/paplayer/ADPCMCodec/Makefile
@@ -0,0 +1,15 @@
CC=gcc
OBJS=uXboxAdpcmDecoder.o ADPCMDll.o
CFLAGS=-D_LINUX -fPIC -O2

apdcm-i486-linux.so: $(OBJS)
$(CC) -shared -o $@ *.o `cat ../../DllLoader/exports/wrapper.def` ../../DllLoader/exports/wrapper.o && cp $@ ../../../../system/players/paplayer/

clean:
$(RM) $(OBJS) *.so

%o : %cpp
g++ -c -o $@ $< $(CFLAGS)

%o : %c
$(CC) -c -o $@ $< $(CFLAGS)
21 changes: 21 additions & 0 deletions xbmc/cores/paplayer/ADPCMCodec/adpcm.sln
@@ -0,0 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "adpcm", "adpcm.vcproj", "{2A8CBFB5-C226-4BB3-8C03-7C75D511A4A2}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{2A8CBFB5-C226-4BB3-8C03-7C75D511A4A2}.Debug.ActiveCfg = Debug|Win32
{2A8CBFB5-C226-4BB3-8C03-7C75D511A4A2}.Debug.Build.0 = Debug|Win32
{2A8CBFB5-C226-4BB3-8C03-7C75D511A4A2}.Release.ActiveCfg = Release|Win32
{2A8CBFB5-C226-4BB3-8C03-7C75D511A4A2}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal
155 changes: 155 additions & 0 deletions xbmc/cores/paplayer/ADPCMCodec/adpcm.vcproj
@@ -0,0 +1,155 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Name="adpcm"
ProjectGUID="{2A8CBFB5-C226-4BB3-8C03-7C75D511A4A2}"
Keyword="Win32Proj">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
MinimalRebuild="TRUE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/adpcm.dll"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile="$(OutDir)/adpcm.pdb"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
ResourceOutputFileName=""/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="2"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="TRUE"
DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/adpcm.dll"
LinkIncremental="1"
GenerateDebugInformation="TRUE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
ResourceOutputFileName=""/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath=".\ADPCMDll.cpp">
</File>
<File
RelativePath=".\mywav.h">
</File>
<File
RelativePath=".\uXboxAdpcmDecoder.c">
</File>
<File
RelativePath=".\uXboxAdpcmDecoder.h">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
<File
RelativePath=".\adpcm.ico">
</File>
<File
RelativePath=".\adpcm.rc">
</File>
<File
RelativePath=".\small.ico">
</File>
</Filter>
<File
RelativePath=".\ReadMe.txt">
</File>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

0 comments on commit 99bff7f

Please sign in to comment.