-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
10,028 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#ifndef _OPUSFILE_HTTP_H | ||
#define _OPUSFILE_HTTP_H (1) | ||
|
||
#ifndef _LARGEFILE_SOURCE | ||
# define _LARGEFILE_SOURCE | ||
#endif | ||
#ifndef _LARGEFILE64_SOURCE | ||
# define _LARGEFILE64_SOURCE | ||
#endif | ||
#ifndef _FILE_OFFSET_BITS | ||
# define _FILE_OFFSET_BITS 64 | ||
#endif | ||
|
||
#include <stdlib.h> | ||
#include <opusfile.h> | ||
|
||
#define OP_FATAL(_str) abort() | ||
#define OP_ASSERT(_cond) | ||
#define OP_ALWAYS_TRUE(_cond) ((void)(_cond)) | ||
|
||
#define OP_INT64_MAX (2*(((ogg_int64_t)1<<62)-1)|1) | ||
#define OP_INT64_MIN (-OP_INT64_MAX-1) | ||
#define OP_INT32_MAX (2*(((ogg_int32_t)1<<30)-1)|1) | ||
#define OP_INT32_MIN (-OP_INT32_MAX-1) | ||
|
||
#define OP_MIN(_a,_b) ((_a)<(_b)?(_a):(_b)) | ||
#define OP_MAX(_a,_b) ((_a)>(_b)?(_a):(_b)) | ||
#define OP_CLAMP(_lo,_x,_hi) (OP_MAX(_lo,OP_MIN(_x,_hi))) | ||
|
||
/* Advance a file offset by the given amount, clamping against OP_INT64_MAX. | ||
* This is used to advance a known offset by things like OP_CHUNK_SIZE or | ||
* OP_PAGE_SIZE_MAX, while making sure to avoid signed overflow. | ||
* It assumes that both _offset and _amount are non-negative. | ||
*/ | ||
#define OP_ADV_OFFSET(_offset,_amount) \ | ||
(OP_MIN(_offset,OP_INT64_MAX-(_amount))+(_amount)) | ||
|
||
/*The maximum channel count for any mapping we'll actually decode.*/ | ||
# define OP_NCHANNELS_MAX (8) | ||
|
||
/*Initial state.*/ | ||
# define OP_NOTOPEN (0) | ||
/*We've found the first Opus stream in the first link.*/ | ||
# define OP_PARTOPEN (1) | ||
# define OP_OPENED (2) | ||
/*We've found the first Opus stream in the current link.*/ | ||
# define OP_STREAMSET (3) | ||
/*We've initialized the decoder for the chosen Opus stream in the current | ||
link.*/ | ||
# define OP_INITSET (4) | ||
|
||
/* Information cached for a single link in a chained Ogg Opus file. | ||
* We choose the first Opus stream encountered in each link to play back (and | ||
* require at least one). | ||
*/ | ||
|
||
int op_strncasecmp(const char *_a,const char *_b,int _n); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
#include "out.h" | ||
|
||
// note: exported symbol is now winampGetInModule2. | ||
|
||
#define IN_VER 0x100 | ||
|
||
typedef struct | ||
{ | ||
int version; // module type (IN_VER) | ||
char *description; // description of module, with version string | ||
|
||
HWND hMainWindow; // winamp's main window (filled in by winamp) | ||
HINSTANCE hDllInstance; // DLL instance handle (Also filled in by winamp) | ||
|
||
char *FileExtensions; // "mp3\0Layer 3 MPEG\0mp2\0Layer 2 MPEG\0mpg\0Layer 1 MPEG\0" | ||
// May be altered from Config, so the user can select what they want | ||
|
||
int is_seekable; // is this stream seekable? | ||
int UsesOutputPlug; // does this plug-in use the output plug-ins? (musn't ever change, ever :) | ||
|
||
void (*Config)(HWND hwndParent); // configuration dialog | ||
void (*About)(HWND hwndParent); // about dialog | ||
|
||
void (*Init)(); // called at program init | ||
void (*Quit)(); // called at program quit | ||
|
||
void (*GetFileInfo)(char *file, char *title, int *length_in_ms); // if file == NULL, current playing is used | ||
int (*InfoBox)(char *file, HWND hwndParent); | ||
|
||
int (*IsOurFile)(char *fn); // called before extension checks, to allow detection of mms://, etc | ||
// playback stuff | ||
int (*Play)(char *fn); // return zero on success, -1 on file-not-found, some other value on other (stopping winamp) error | ||
void (*Pause)(); // pause stream | ||
void (*UnPause)(); // unpause stream | ||
int (*IsPaused)(); // ispaused? return 1 if paused, 0 if not | ||
void (*Stop)(); // stop (unload) stream | ||
|
||
// time stuff | ||
int (*GetLength)(); // get length in ms | ||
int (*GetOutputTime)(); // returns current output time in ms. (usually returns outMod->GetOutputTime() | ||
void (*SetOutputTime)(int time_in_ms); // seeks to point in stream (in ms). Usually you signal yoru thread to seek, which seeks and calls outMod->Flush().. | ||
|
||
// volume stuff | ||
void (*SetVolume)(int volume); // from 0 to 255.. usually just call outMod->SetVolume | ||
void (*SetPan)(int pan); // from -127 to 127.. usually just call outMod->SetPan | ||
|
||
// in-window builtin vis stuff | ||
|
||
void (*SAVSAInit)(int maxlatency_in_ms, int srate); // call once in Play(). maxlatency_in_ms should be the value returned from outMod->Open() | ||
// call after opening audio device with max latency in ms and samplerate | ||
void (*SAVSADeInit)(); // call in Stop() | ||
|
||
|
||
// simple vis supplying mode | ||
void (*SAAddPCMData)(void *PCMData, int nch, int bps, int timestamp); | ||
// sets the spec data directly from PCM data | ||
// quick and easy way to get vis working :) | ||
// needs at least 576 samples :) | ||
|
||
// advanced vis supplying mode, only use if you're cool. Use SAAddPCMData for most stuff. | ||
int (*SAGetMode)(); // gets csa (the current type (4=ws,2=osc,1=spec)) | ||
// use when calling SAAdd() | ||
void (*SAAdd)(void *data, int timestamp, int csa); // sets the spec data, filled in by winamp | ||
|
||
|
||
// vis stuff (plug-in) | ||
// simple vis supplying mode | ||
void (*VSAAddPCMData)(void *PCMData, int nch, int bps, int timestamp); // sets the vis data directly from PCM data | ||
// quick and easy way to get vis working :) | ||
// needs at least 576 samples :) | ||
|
||
// advanced vis supplying mode, only use if you're cool. Use VSAAddPCMData for most stuff. | ||
int (*VSAGetMode)(int *specNch, int *waveNch); // use to figure out what to give to VSAAdd | ||
void (*VSAAdd)(void *data, int timestamp); // filled in by winamp, called by plug-in | ||
|
||
|
||
// call this in Play() to tell the vis plug-ins the current output params. | ||
void (*VSASetInfo)(int nch, int srate); | ||
|
||
|
||
// dsp plug-in processing: | ||
// (filled in by winamp, called by input plug) | ||
|
||
// returns 1 if active (which means that the number of samples returned by dsp_dosamples | ||
// could be greater than went in.. Use it to estimate if you'll have enough room in the | ||
// output buffer | ||
int (*dsp_isactive)(); | ||
|
||
// returns number of samples to output. This can be as much as twice numsamples. | ||
// be sure to allocate enough buffer for samples, then. | ||
int (*dsp_dosamples)(short int *samples, int numsamples, int bps, int nch, int srate); | ||
|
||
|
||
// eq stuff | ||
void (*EQSet)(int on, char data[10], int preamp); // 0-64 each, 31 is +0, 0 is +12, 63 is -12. Do nothing to ignore. | ||
|
||
// info setting (filled in by winamp) | ||
void (*SetInfo)(int bitrate, int srate, int stereo, int synched); // if -1, changes ignored? :) | ||
|
||
Out_Module *outMod; // filled in by winamp, optionally used :) | ||
} In_Module; | ||
|
||
|
Oops, something went wrong.