home *** CD-ROM | disk | FTP | other *** search
- #include <windows.h>
- #include <objbase.h>
- #include <initguid.h>
- #if (1100 > _MSC_VER)
- #include <olectlid.h>
- #else
- #include <olectl.h>
- #endif
- #include <stdio.h>
-
-
- /////////////////////////////////////////////////////////////////////////////
- //
- // KMP┐δ ┐└╡≡┐└/║±╡≡┐└ ╟├╖»▒╫└╬ └╬┼═╞Σ└╠╜║
- //
- // KMP└╟ ╟├╖»▒╫└╬ ╕≡╡Γ└║ └⌐╛┌╟┴└╟ DSP╟├╖»▒╫└╬░·
- // ▒╕┴╢░í ░┼└╟ ░░┤┘. ┐└╡≡┐└ ╟├╖»▒╫└╬└╟ ░µ┐∞┤┬ └╚╛┌╟┴┐═ ▒╕┴╢░í
- // ░░▒Γ ╢º╣«┐í └⌐╛┌╟┴└╟ DSP╟├╖»▒╫└╬└╗ KMP┐í╝¡ ╗τ┐δ╟╧┤┬ ░═└╠ ░í┤╔╟╧┤┘.
- // ║±╡≡┐└ ╟├╖»▒╫└╬└╟ ░µ┐∞╡╡ ░┼└╟ ║±╜┴╟╧╣╟╖╬ ╜▒░╘ └█╝║╟╥╝÷░í └╓└╗░═└╠┤┘.
- // ▒╫╕«░φ ╟╘╝÷ ▒╘╛α└╠ cdel└╠┤┘.. ┬ⁿ░φ...
- //
- // ┐╡╗≤╟├╖»▒╫└╬└╟ ░µ┐∞┤┬ WaSaVi┐═ ┤▐╢≤┴│┤┘... ╢╟╟╤ ┬ⁿ░φ...
- //
- /////////////////////////////////////////////////////////////////////////////
-
-
- // header version: 0x20 == 0.20 == winamp 2.0
- #define DSP_HDRVER 0x20
-
-
-
- // DSP plugin interface
-
- // notes:
- // any window that remains in foreground should optimally pass unused
- // keystrokes to the parent (winamp's) window, so that the user
- // can still control it. As for storing configuration,
- // Configuration data should be stored in <dll directory>\plugin.ini
- // (look at the vis plugin for configuration code)
-
- typedef struct winampDSPModule {
- char *description; // description
- HWND hwndParent; // parent window (filled in by calling app)
- HINSTANCE hDllInstance; // instance handle to this DLL (filled in by calling app)
-
- void (*Config)(struct winampDSPModule *this_mod); // configuration dialog (if needed)
- int (*Init)(struct winampDSPModule *this_mod); // 0 on success, creates window, etc (if needed)
-
- // modify waveform samples: returns number of samples to actually write
- // (typically numsamples, but no more than twice numsamples, and no less than half numsamples)
- // numsamples should always be at least 128. should, but I'm not sure
- int (*ModifySamples)(struct winampDSPModule *this_mod, short int *samples, int numsamples, int bps, int nch, int srate);
- // └⌐╛┌╟┴┐í╝¡ ╗τ┐δ╟╧┤┬ └╜╝║└╗ ║»░µ╟╧┤┬ ╟╘╝÷...
- // samples : ╗∙╟├└╠ ╡Θ╛ε░í └╓┤┬ ╣÷╞█
- // numsamples : ╗∙╟├└╟ ░╣╝÷(╜╟┴·└√└╬ ╣÷╞█└╟ ▒µ└╠░í ╛╞┤╧╢≤ ╗∙╟├└╟ ░╣╝÷└╙...
- // bps : ╗∙╟├┤τ ║±╞«╝÷ 8 or 16
- // nch : ├ñ│╬╝÷ 1 : ╕≡│δ , 2 : ╜║╞«╖╣┐└
- // srate : ╗∙╟├╕╡ ╖╣└╠╞« 44000╡ε╡ε..
- // └╠╟╘╝÷┐í╝¡ ╕«┼╧░¬└╠ ║»░µ╟╤ ╡Ñ└╠┼╕└╟ ░╣╝÷└╠┤┘. ╢╟╟╤ ╜╟┴·└√└╕╖╬ ├Γ╖┬└╕╖╬
- // │¬░í┤┬ ░╣╝÷└╠▒Γ╡╡ ╟╧┤┘. └⌐╛┌╟┴┐í╝¡ ┼╫╜║╞«╟╤ ░µ┐∞┤┬ └╘╖┬╣▐└║ ╗∙╟├║╕┤┘
- // ╕╣░╘╟╪╡╡ ╡┐└█└╗ ╟╧┐┤┤┘. ╡√╢≤╝¡ KMP┐í╝¡╡╡ └╘╖┬║╕┤┘ 3-4╣Φ┴ñ╡╡└╟
- // ╕▐╕≡╕«╕ª │╗║╬└√└╕╖╬ ╟╥┤τ└╗ ╟╪│⌡╛╥┤┘. ▒╫╖»╣╟╖╬ 3-4╣Φ └╠╗≤└╗ ├│╕«╟╧╕Θ ┐└╖∙░í
- // └╧╛ε│»╝÷╡╡ └╓┤┘...
- //
-
-
- void (*Quit)(struct winampDSPModule *this_mod); // called when unloading
-
- void *userData; // user data, optional
- } winampDSPModule;
-
- typedef struct {
- int version; // DSP_HDRVER
- char *description; // description of library
- winampDSPModule* (*getModule)(int); // module retrieval function
- } winampDSPHeader;
-
- // exported symbols
- typedef winampDSPHeader* (*winampDSPGetHeaderType)();
- // winampDSPHeader *winampDSPGetHeader2()
- // └╜╝║ DLL┐í╝¡ Exports╟╪╛▀ ╡╟┤┬ ╟╘╝÷└╟ ╟ⁿ╜─
- // ┴∩ └º└╟ ╟╘╝÷╕ª │δ├Γ╜├─╤╛▀ ╟╤┤┘....
-
-
-
-
-
- ////////////////////////////////////////////////////////////////////////////
- //
- // Video PlugIn Type( Modifyed from Winamp DSP Plugin type ...)
- //
- // └⌐╛┌╟┴└╟ DSP╟├╖»▒╫└╬└╟ ▒╕┴╢╕ª ┴╢▒▌ ║»░µ╟╪╝¡ KMP└╟ ║±╡≡┐└
- // ╟├╖»▒╫└╬└╗ ╗τ┐δ╟╤┤┘.
- ////////////////////////////////////////////////////////////////////////////
-
-
-
-
- // KMP┐í╝¡ ┴ª░°╡╟┤┬ ╚¡╗≤└╟ ▒╕┴╢
- // KMP┐í╝¡┤┬ ╟├╖╣└╬ YV12└╠╣╠┴÷└╟ ▒╕┴╢╕ª ╗τ┐δ╟╤┤┘.
- // Y└╟ ┼⌐▒Γ┤┬ └╠╣╠┴÷└╟ ┼⌐▒Γ┐═ ░░░φ,
- // U,V└╟ ┼⌐▒Γ┤┬ ░í╖╬░í 2╣Φ└█░φ, ╝╝╖╬░í 2╣Φ└█┤┘.
- // ┴∩ U,V└╟ ┼⌐▒Γ┤┬ Y└╟ ┼⌐▒Γ║╕┤┘ 4╣Φ░í └█┤┘.
- typedef struct kmpYV12Image {
- int Width, Height; // ░í╖╬, ╝╝╖╬└╟ ┼⌐▒Γ
- unsigned char *y_plain; // Y╟├╖╣└╬ ╣÷╞█, ┼⌐▒Γ:Width*Height
- unsigned char *u_plain; // U╟├╖╣└╬ ╣÷╞█, ┼⌐▒Γ:Width*Height/4
- unsigned char *v_plain; // V╟├╖╣└╬ ╣÷╞█, ┼⌐▒Γ:Width*Height/4
- unsigned char *Mask; // ┼⌡╕φ└╗ └º╟╤ ╕╢╜║┼⌐ │╗║╬└√└╕╖╬ ╗τ┐δ
- } kmpYV12Image;
-
-
- DEFINE_GUID(IID_IYV12ImageProcessor,
- 0x249F44BC, 0xB8BF, 0x411F, 0xB0, 0x47, 0xD9, 0xC0, 0x17, 0xDF, 0xEC, 0xF2);
-
- DECLARE_INTERFACE_(IkmpYV12ImageProcessor, IUnknown)
- {
- // YV12└╠╣╠┴÷╕ª ░ⁿ╕«╟╧░φ ├│╕«╟╧┤┬╡Ñ ╡╡┐≥└╗ ┴╓┤┬ └╬┼═╞Σ└╠╜║
- // ╟÷└τ RGB32,24,565,555└╟ DIB└╠╣╠┴÷╕╕ ┴÷┐°╟╤┤┘.
- // ┐╣┴ª╕ª ┬ⁿ░φ╟╧▒Γ ╣┘╢≈...
- STDMETHOD(kmpAllocYV12Image) (THIS_
- int width,int height,kmpYV12Image **pImage
- ) PURE;
- // width, height└╟ ┼⌐▒Γ╖╬ YV12Image▒╕┴╢├╝╕ª ╕╕╡τ┤┘...
- // 2└╟ ╣Φ╝÷╖╬ ┴ñ╖─└╠ ╡╟╛ε └╓╛ε╛▀ ╡╟░φ,
- // ░í┤╔╟╧╕Θ 16└╟ ╣Φ╝÷░í ╡╟╛ε └╓╛ε╛▀╕╕ ╛╚┴ñ╟╧░╘ ╡┐└█╟╤┤┘.
- // AllocYV12Image╖╬ ╕╕╡τ░═└║ ╛╞╖í└╟ FreeYV12Image╖╬ ╟╪┴ª╕ª ╟╪╛▀ ╡╚┤┘.
- STDMETHOD(kmpFreeYV12Image) (THIS_
- kmpYV12Image **pImage
- ) PURE;
- // AllocYV12Image╖╬ ╕╕╡τ └╠╣╠┴÷╕ª ╟╪┴ª ╟╤┤┘.
- STDMETHOD(kmpCopyYV12Image) (THIS_
- kmpYV12Image *pSrc,kmpYV12Image *pDst
- ) PURE;
- // YV12Image╕ª ║╣╗τ╟╤┤┘.
- STDMETHOD(kmpRGB32ToYV12) (THIS_
- void *DIB32,int Width,int Height,kmpYV12Image *pImage
- ) PURE;
- STDMETHOD(kmpRGB24ToYV12) (THIS_
- void *DIB24,int Width,int Height,kmpYV12Image *pImage
- ) PURE;
- STDMETHOD(kmpRGB565ToYV12) (THIS_
- void *DIB565,int Width,int Height,kmpYV12Image *pImage
- ) PURE;
- STDMETHOD(kmpRGB555ToYV12) (THIS_
- void *DIB555,int Width,int Height,kmpYV12Image *pImage
- ) PURE;
- // RGB╞≈╕Σ(DIB)└╗ YV12└╠╣╠┴÷╖╬ ╣┘▓█┤┘.
- STDMETHOD(kmpYV12ToRGB32) (THIS_
- kmpYV12Image *pImage,void *DIB32,int Width,int Height
- ) PURE;
- STDMETHOD(kmpYV12ToRGB24) (THIS_
- kmpYV12Image *pImage,void *DIB24,int Width,int Height
- ) PURE;
- STDMETHOD(kmpYV12ToRGB565) (THIS_
- kmpYV12Image *pImage,void *DIB565,int Width,int Height
- ) PURE;
- STDMETHOD(kmpYV12ToRGB555) (THIS_
- kmpYV12Image *pImage,void *DIB555,int Width,int Height
- ) PURE;
- // YV12Image└╟ ╟ⁿ╜─└╕╖╬ ╡╚░═└╗ RGB(DIB)└╟ ╟ⁿ╜─└╕╖╬ ╣┘▓█┤┘.
- // └╠╢º Height┐í └╜└╟╝÷╕ª │╓╛ε┴╓╕Θ ╚¡╕Θ└╠ ╡┌┴²╛ε┴«╝¡ │¬┐┬┤┘.
- // Width┤┬ ╛τ╕╕ ┴÷┐°╟╘...
- STDMETHOD(kmpYV12NormalDraw) (THIS_
- kmpYV12Image *Src,kmpYV12Image *Dst,RECT *SRect,int dx,int dy
- ) PURE;
- // ╛╞╣½╖▒ ╚┐░· ╛°└╠ └╠╣╠┴÷╕ª ▒╫╕░┤┘.
- STDMETHOD(kmpYV12BlendDraw) (THIS_
- kmpYV12Image *Src,kmpYV12Image *Dst,RECT *SRect,int dx,int dy,int alpha
- ) PURE;
- // ╣▌┼⌡╕φ╚┐░·╖╬ └╠╣╠┴÷╕ª ▒╫╕░┤┘. 0<=alpha<=255
- STDMETHOD(kmpYV12TransDraw) (THIS_
- kmpYV12Image *Src,kmpYV12Image *Dst,RECT *SRect,int dx,int dy
- ) PURE;
- // ╣Φ░µ╗÷└╗ ┼⌡╕φ└╕╖╬ ▒╫╕░┤┘. ╣Φ░µ╗÷└║ 0╣°┬░ ╗÷└╗ ▒Γ┴╪└╕╖╬ ╟╤┤┘.
- STDMETHOD(kmpYV12BlendTransDraw) (THIS_
- kmpYV12Image *Src,kmpYV12Image *Dst,RECT *SRect,int dx,int dy,int alpha
- ) PURE;
- // ╣Φ░µ╗÷└╗ ┼⌡╕φ└╕╖╬ ▒╫╕«░φ, └ⁿ├╝╕ª ╣▌┼⌡╕φ╚┐░·╖╬ ▒╫╕░┤┘. 0<=alpha<=255
- };
-
-
-
- typedef struct kmpDSPModule {
- char *description; // description
- HWND hwndParent; // parent window (filled in by calling app)
- HINSTANCE hDllInstance; // instance handle to this DLL (filled in by calling app)
-
- void (*Config)(struct kmpDSPModule *this_mod); // configuration dialog (if needed)
- int (*Init)(struct kmpDSPModule *this_mod); // 0 on success, creates window, etc (if needed)
-
- // modify waveform samples: returns number of samples to actually write
- // (typically numsamples, but no more than twice numsamples, and no less than half numsamples)
- // numsamples should always be at least 128. should, but I'm not sure
- int (*BeforeModifySamples)(struct kmpDSPModule *this_mod,struct kmpYV12Image *image,int ewidth); // ╗∙╟├└╗ ║»░µ╟╧┤┬╟╘╝÷
- // kmp┐í╝¡ ╗τ┐δ╟╧┤┬ ┐╡╗≤└╗ ║»░µ╟╧┤┬ ╟╘╝÷...
- // image : └╠╣╠┴÷└╟ ╣÷╞█, └º┐í╝¡ ╝│╕φ
- // ewidth : ╜╟┴·└√└╬ └╠╣╠┴÷└╟ ░í╖╬ ▒µ└╠
- // image└╟ width┤┬ ╟╥┤τ╡╚ └╠╣╠┴÷└╟ ░í╖╬▒µ└╠└╠┤┘.
- // ╜╟┴·└√└╬░═░· ╟╥┤τ└√└╬░═└╠ ┬≈└╠░í │¬┤┬ └╠└»┤┬ ╟╩┼═╡Θ└╠ ┐¼░ß╡╔╢º┐í┤┬
- // ╣÷╞█░í ┴ñ╖─└╠ ╡╟╛ε └╓╛ε╛▀ ╡╩... ╡√╢≤╝¡ ╜╟┴ª╖╬ ┐╡╗≤└╠ ╡Θ╛ε░í └╓┤┬ ▒µ└╠┐═
- // ╟╥┤τ╡╚ ╣÷╞█└╟ ▒µ└╠░í ╞▓╖┴┴÷░╘╡╩...
- // ║╕┼δ ╚¡╗≤└╗ ├│╕«╟╧┤┬ ░µ┐∞┤┬ ║░╖╬ ╜┼░µ└╗ ╛╩╛▓╡╡ ╡╟┴÷╕╕ ┴┬┐∞╕ª ╡┌┴²┤┬ ░µ┐∞┤┬
- // ┐╡╗≤└╟ │í└╗ ╛╦╛╞╛▀╡╟▒Γ ╢º╣«┐í ╞─╢≤╕▐┼═╖╬ │╤░▄┴╪┤┘...
- // ┴∩ image└╟ width=ewidth+?? ┐⌐▒Γ╝¡ ??┤┬ ├▀░í ╣┘└╠╞«╖╬ ┴ñ╖─└╗ └º╟╪╝¡ ├▀░í╡╚ ╣┘└╠╞«└╠┤┘.
- // ╝╝╖╬┐í╝¡┤┬ ┴ñ╖─└╠ ╟╩┐Σ░í ╛°┤┘.
- // ┐╡╗≤└║ ┼⌐▒Γ╕ª ║»░µ╟╥╝÷░í ╛°┤┘.
- // ╕«┼╧░¬└║ └╓┴÷╕╕ ├│╕«╟╧┴÷ ╛╩╛╞╡╡ ╡╚┤┘.
- int (*AfterModifySamples)(struct kmpDSPModule *this_mod,struct kmpYV12Image *image,int ewidth); // ╗∙╟├└╗ ║»░µ╟╧┤┬╟╘╝÷
- // ╞─╢≤╣╠┼═┤┬ └º┐═ ░░└╜.
- // BeforeModifyImage└╟ ░µ┐∞┤┬ ┤⌡║φ╗∙╟├└╠ ╡┐└█╟╥╢º╕╕ ║╥╕«╛ε┴÷░╘ ╡╚┤┘.
- // ╡√╢≤╝¡ ┴╗┤⌡║ⁿ╕Ñ └╠╣╠┴÷ ├│╕«╕ª └º╟╪╝¡┤┬ BeforeModifyImage╕ª
- // ├│╕«╟╧╕Θ ╡╚┤┘.
- // ┴∩ ┤⌡║φ╗∙╟├ ╡┐└█╜├ BeforeModifyImage -> AfterModifyImage
- // ╛╚╟╧╕Θ AfterModifyImage
- // ├│╕«╕ª ╛╚╟╥╖┴╕Θ NULL╖╬ ╝│┴ñ╟╧╕Θ ╡╩....
- //
-
- void (*Quit)(struct kmpDSPModule *this_mod); // called when unloading
-
- void *userData; // user data, optional
- IkmpYV12ImageProcessor *ImageProcessor; // └╠╣╠┴÷├│╕«╕ª └º╟╤ └╬┼═╞Σ└╠╜║
- // └º┐í╝¡ ╝│╕φ
- } kmpDSPModule;
-
- typedef struct {
- int version; // DSP_HDRVER
- char *description; // description of library
- kmpDSPModule* (*getModule)(int); // module retrieval function
- } kmpDSPHeader;
-
- // exported symbols
- typedef kmpDSPHeader* (*kmpDSPGetHeaderType)();
- // kmpDSPHeader *kmpDSPGetHeader2()
- // ┐╡╗≤ DLL┐í╝¡ Export╟╪╛▀╡╟┤┬ ╟╘╝÷└╟ ╟ⁿ╜─
- // ┴∩ └º└╟ ╟╘╝÷╕ª │δ├Γ╜├─╤╛▀ ╟╤┤┘....
-