JSAPI2_TransportAPI.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #pragma once
  2. #include <ocidl.h>
  3. #include <vector>
  4. #include "JSAPI_Info.h"
  5. #include "JSAPI_CallbackParameters.h"
  6. namespace JSAPI2
  7. {
  8. class TransportAPI : public IDispatch
  9. {
  10. public:
  11. TransportAPI(const wchar_t *_key, JSAPI::ifc_info *info);
  12. ~TransportAPI();
  13. STDMETHOD(QueryInterface)(REFIID riid, PVOID *ppvObject);
  14. STDMETHOD_(ULONG, AddRef)(void);
  15. STDMETHOD_(ULONG, Release)(void);
  16. // *** IDispatch Methods ***
  17. STDMETHOD (GetIDsOfNames)(REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, LCID lcid, DISPID FAR* rgdispid);
  18. STDMETHOD (GetTypeInfo)(unsigned int itinfo, LCID lcid, ITypeInfo FAR* FAR* pptinfo);
  19. STDMETHOD (GetTypeInfoCount)(unsigned int FAR * pctinfo);
  20. STDMETHOD (Invoke)(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, EXCEPINFO FAR * pexecinfo, unsigned int FAR *puArgErr);
  21. public:
  22. /** Callbacks
  23. ** JSAPI2::CallbackManager will have been nice enough to marshall onto our thread
  24. ** so we don't have to worry about that
  25. */
  26. void OnStop(int position, int is_full_stop);
  27. void OnPlay(const wchar_t *filename);
  28. void OnPause(bool pause_state);
  29. void InvokeEvent(const wchar_t *eventName, JSAPI::CallbackParameters::PropertyTemplate *parameters, size_t parametersCount);
  30. private:
  31. const wchar_t *key;
  32. volatile LONG refCount;
  33. JSAPI::ifc_info *info;
  34. typedef std::vector<IDispatch*> EventsList;
  35. EventsList events;
  36. STDMETHOD (ButtonPress)(WPARAM button, const wchar_t *action, WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
  37. STDMETHOD (Prev)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
  38. STDMETHOD (Play)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
  39. STDMETHOD (Pause)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
  40. STDMETHOD (Stop)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
  41. STDMETHOD (Next)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
  42. STDMETHOD (shuffle)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
  43. STDMETHOD (repeat)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
  44. STDMETHOD (position)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
  45. STDMETHOD (length)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
  46. STDMETHOD (url)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
  47. STDMETHOD (title)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
  48. STDMETHOD (playing)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
  49. STDMETHOD (paused)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
  50. STDMETHOD (GetMetadata)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
  51. STDMETHOD (RegisterForEvents)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
  52. STDMETHOD (UnregisterFromEvents)(WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, unsigned int FAR *puArgErr);
  53. };
  54. }