dr_flac library
git-svn-id: svn://kolibrios.org@8035 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
3f8e85d0b3
commit
05a05aaf23
10
contrib/media/dr_flac/Tupfile.lua
Normal file
10
contrib/media/dr_flac/Tupfile.lua
Normal file
@ -0,0 +1,10 @@
|
||||
if tup.getconfig("NO_GCC") ~= "" then return end
|
||||
if tup.getconfig("HELPERDIR") == ""
|
||||
then
|
||||
HELPERDIR = "../../../programs"
|
||||
end
|
||||
tup.include(HELPERDIR .. "/use_gcc.lua")
|
||||
NEWLIB_INCLUDE = "../../sdk/sources/newlib/libc/include"
|
||||
INCLUDES = INCLUDES .. " -I" .. NEWLIB_INCLUDE
|
||||
CFLAGS = CFLAGS_OPTIMIZE_SPEED .. " -nostdlib -fwhole-program"
|
||||
compile_gcc("dr_flac.c", "dr_flac.obj")
|
3
contrib/media/dr_flac/compile kolibrios lib.bat
Normal file
3
contrib/media/dr_flac/compile kolibrios lib.bat
Normal file
@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
gcc -c dr_flac.c -o dr_flac.obj -O3 -march=i586 -mfpmath=387 -ffast-math -fwhole-program -nostdlib
|
||||
pause
|
101
contrib/media/dr_flac/dr_flac.c
Normal file
101
contrib/media/dr_flac/dr_flac.c
Normal file
@ -0,0 +1,101 @@
|
||||
// FLAC decoder for KolibriOS in native shared COFF library format.
|
||||
|
||||
// https://github.com/mackron/dr_libs/blob/master/dr_flac.h
|
||||
|
||||
// Some functions to allow us building without any external libs
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
void* memset(void *base, int val, size_t len)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < len; ++i) ((char *) base)[i] = val;
|
||||
}
|
||||
|
||||
int memcmp(const void *p1, const void *p2, size_t len)
|
||||
{
|
||||
unsigned char *q1 = (unsigned char *) p1;
|
||||
unsigned char *q2 = (unsigned char *) p2;
|
||||
int i;
|
||||
for (i=0; i < len; ++i)
|
||||
if (q1[i] < q2[i]) return -1;
|
||||
else if (q1[i] > q2[i]) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* memcpy(void *dest, const void *src, size_t num)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < num; ++i)
|
||||
((char *)dest)[i] = ((char *) src)[i];
|
||||
}
|
||||
|
||||
// For building with mingw compiler
|
||||
__attribute__((externally_visible)) void __chkstk_ms(){
|
||||
return;
|
||||
}
|
||||
|
||||
void* malloc(size_t size) {
|
||||
asm("int3");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* realloc(void *ptr, size_t size) {
|
||||
asm("int3");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void free(void *ptr) {
|
||||
asm("int3");
|
||||
return;
|
||||
}
|
||||
|
||||
#define DRFLAC_ASSERT(expr) ((void) (0))
|
||||
#define DRFLAC_MALLOC(sz) malloc((sz))
|
||||
#define DRFLAC_REALLOC(p, sz) realloc((p), (sz))
|
||||
#define DRFLAC_FREE(p) free((p))
|
||||
|
||||
// Actual dr_flac related stuff starts here
|
||||
|
||||
#define DRFLAC_IMPLEMENTATION
|
||||
|
||||
#define DR_FLAC_NO_STDIO
|
||||
//#define DR_FLAC_NO_OGG
|
||||
//#define DR_FLAC_BUFFER_SIZE 4096
|
||||
//#define DR_FLAC_NO_CRC
|
||||
#define DR_FLAC_NO_SIMD
|
||||
|
||||
#include "dr_flac.h"
|
||||
|
||||
// KolibriOS type EXPORTS header
|
||||
|
||||
int __stdcall libInit(){
|
||||
return 1;
|
||||
}
|
||||
|
||||
typedef struct{
|
||||
char *name;
|
||||
void *f;
|
||||
}export_t;
|
||||
|
||||
char szLibInit[] ="lib_init";
|
||||
char szVersion[] ="version";
|
||||
char szClose[] ="close";
|
||||
char szOpen[] ="open";
|
||||
char szOpenRelaxed[] ="open_relaxed";
|
||||
char szReadPCMS16[] ="read_pcm_frames_s16";
|
||||
|
||||
|
||||
__attribute__((externally_visible)) export_t EXPORTS[] __asm__("EXPORTS") =
|
||||
{
|
||||
{ szLibInit, libInit },
|
||||
{ szVersion, (void*)0x00010001 },
|
||||
{ szClose, drflac_close },
|
||||
{ szOpen, drflac_open },
|
||||
{ szOpenRelaxed, drflac_open_relaxed },
|
||||
{ szReadPCMS16, drflac_read_pcm_frames_s16},
|
||||
|
||||
{ NULL, NULL },
|
||||
};
|
||||
|
||||
// End of file
|
12099
contrib/media/dr_flac/dr_flac.h
Normal file
12099
contrib/media/dr_flac/dr_flac.h
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user