aboutsummaryrefslogtreecommitdiff
path: root/Src/Winamp/JSAPI2_AsyncDownloader.h
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Winamp/JSAPI2_AsyncDownloader.h
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/Winamp/JSAPI2_AsyncDownloader.h')
-rw-r--r--Src/Winamp/JSAPI2_AsyncDownloader.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/Src/Winamp/JSAPI2_AsyncDownloader.h b/Src/Winamp/JSAPI2_AsyncDownloader.h
new file mode 100644
index 00000000..f05da9d5
--- /dev/null
+++ b/Src/Winamp/JSAPI2_AsyncDownloader.h
@@ -0,0 +1,47 @@
+#pragma once
+#include <ocidl.h>
+#include "JSAPI_Info.h"
+#include <vector>
+#include "JSAPI_CallbackParameters.h"
+
+namespace JSAPI2
+{
+ class AsyncDownloaderAPI : public IDispatch
+ {
+ public:
+ AsyncDownloaderAPI(const wchar_t *_key, JSAPI::ifc_info *info);
+ ~AsyncDownloaderAPI();
+ STDMETHOD(QueryInterface)(REFIID riid, PVOID *ppvObject);
+ STDMETHOD_(ULONG, AddRef)(void);
+ STDMETHOD_(ULONG, Release)(void);
+ // *** IDispatch Methods ***
+ STDMETHOD (GetIDsOfNames)(REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, LCID lcid, DISPID FAR* rgdispid);
+ STDMETHOD (GetTypeInfo)(unsigned int itinfo, LCID lcid, ITypeInfo FAR* FAR* pptinfo);
+ STDMETHOD (GetTypeInfoCount)(unsigned int FAR * pctinfo);
+ STDMETHOD (Invoke)(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, EXCEPINFO FAR * pexecinfo, unsigned int FAR *puArgErr);
+ public:
+ /** Callbacks
+ ** JSAPI2::CallbackManager will have been nice enough to marshall onto our thread
+ ** so we don't have to worry about that
+ */
+ void OnInit(const wchar_t *url);
+ void OnConnect(const wchar_t *url);
+ void OnData(const wchar_t *url, size_t downloadedlen, size_t totallen);
+ void OnCancel(const wchar_t *url);
+ void OnError(const wchar_t *url, int error);
+ void OnFinish(const wchar_t *url, const wchar_t *destfilename);
+ void InvokeEvent(const wchar_t *eventName, JSAPI::CallbackParameters::PropertyTemplate *parameters, size_t parametersCount);
+ //Getter for key
+ const wchar_t *GetKey();
+ private:
+ const wchar_t *key;
+ volatile LONG refCount;
+ JSAPI::ifc_info *info;
+ typedef std::vector<IDispatch*> EventsList;
+ EventsList events;
+
+ STDMETHOD (DownloadMedia)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
+ STDMETHOD (RegisterForEvents)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
+ STDMETHOD (UnregisterFromEvents)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
+ };
+} \ No newline at end of file