diff options
author | Jean-Francois Mauguit <jfmauguit@mac.com> | 2024-09-24 09:03:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 09:03:25 -0400 |
commit | bab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Plugins/Input/in_mp3/DXHEAD.C | |
parent | 4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff) | |
parent | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff) | |
download | winamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz |
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/Plugins/Input/in_mp3/DXHEAD.C')
-rw-r--r-- | Src/Plugins/Input/in_mp3/DXHEAD.C | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Src/Plugins/Input/in_mp3/DXHEAD.C b/Src/Plugins/Input/in_mp3/DXHEAD.C new file mode 100644 index 00000000..f739240a --- /dev/null +++ b/Src/Plugins/Input/in_mp3/DXHEAD.C @@ -0,0 +1,54 @@ + +/*---- DXhead.c -------------------------------------------- + + +decoder MPEG Layer III + +handle Xing header + +mod 12/7/98 add vbr scale + +Copyright 1998 Xing Technology Corp. +-----------------------------------------------------------*/ +#include <windows.h> +#include <stdlib.h> +#include <stdio.h> +#include <float.h> +#include <math.h> +#include "dxhead.h" + + +/*-------------------------------------------------------------*/ +int SeekPoint(unsigned char TOC[100], int file_bytes, float percent) +{ + // interpolate in TOC to get file seek point in bytes + int a, seekpoint; + float fa, fb, fx; + + + if (percent < 0.0f) + percent = 0.0f; + if (percent > 100.0f) + percent = 100.0f; + + a = (int)percent; + if (a > 99) a = 99; + fa = TOC[a]; + if (a < 99) + { + fb = TOC[a + 1]; + } + else + { + fb = 256.0f; + } + + + fx = fa + (fb - fa) * (percent - a); + + seekpoint = (int) ((1.0f / 256.0f) * fx * file_bytes); + + + return seekpoint; +} +/*-------------------------------------------------------------*/ |