api_core.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. #ifndef __API_CORE_H
  2. #define __API_CORE_H
  3. #include <bfc/dispatch.h>
  4. typedef unsigned int CoreToken;
  5. class CoreCallback;
  6. class ItemSequencer;
  7. class NOVTABLE api_core : public Dispatchable
  8. {
  9. public:
  10. const wchar_t *core_getSupportedExtensions();
  11. const wchar_t *core_getExtSupportedExtensions();
  12. CoreToken core_create();
  13. int core_free(CoreToken core);
  14. int core_setNextFile(CoreToken core, const wchar_t *playstring);
  15. int core_getStatus(CoreToken core);
  16. const wchar_t *core_getCurrent(CoreToken core);
  17. int core_getCurPlaybackNumber(CoreToken core);
  18. int core_getPosition(CoreToken core);
  19. int core_getWritePosition(CoreToken core);
  20. int core_setPosition(CoreToken core, int ms);
  21. int core_getLength(CoreToken core);
  22. int core_getPluginData(const wchar_t *playstring, const wchar_t *name, wchar_t *data, int data_len, int data_type = 0);
  23. unsigned int core_getVolume(CoreToken core);
  24. void core_setVolume(CoreToken core, unsigned int vol);
  25. int core_getPan(CoreToken core);
  26. void core_setPan(CoreToken core, int val);
  27. void core_addCallback(CoreToken core, CoreCallback *cb);
  28. void core_delCallback(CoreToken core, CoreCallback *cb);
  29. int core_getVisData(CoreToken core, void *dataptr, int sizedataptr);
  30. int core_getLeftVuMeter(CoreToken core);
  31. int core_getRightVuMeter(CoreToken core);
  32. int core_registerSequencer(CoreToken core, ItemSequencer *seq);
  33. int core_deregisterSequencer(CoreToken core, ItemSequencer *seq);
  34. void core_userButton(CoreToken core, int button);
  35. int core_getEqStatus(CoreToken core);
  36. void core_setEqStatus(CoreToken core, int enable);
  37. int core_getEqPreamp(CoreToken core);
  38. void core_setEqPreamp(CoreToken core, int pre);
  39. int core_getEqBand(CoreToken core, int band);
  40. void core_setEqBand(CoreToken core, int band, int val);
  41. int core_getEqAuto(CoreToken core);
  42. void core_setEqAuto(CoreToken core, int enable);
  43. void core_setCustomMsg(CoreToken core, const wchar_t *text);
  44. void core_registerExtension(const wchar_t *extensions, const wchar_t *extension_name, const wchar_t *family = NULL);
  45. const wchar_t *core_getExtensionFamily(const wchar_t *extension);
  46. void core_unregisterExtension(const wchar_t *extensions);
  47. const wchar_t *core_getTitle(CoreToken core);
  48. void core_setTitle(const wchar_t *new_title);
  49. const wchar_t *core_getDecoderName(const wchar_t *filename);
  50. // these don't necessarily belong here, but api_core is already over-bloated :)
  51. int core_getRating();
  52. void core_setRating(int newRating);
  53. enum
  54. {
  55. API_CORE_GETSUPPORTEDEXTENSIONS = 0,
  56. API_CORE_GETEXTSUPPORTEDEXTENSIONS = 10,
  57. API_CORE_CREATE = 20,
  58. API_CORE_FREE = 30,
  59. API_CORE_SETNEXTFILE = 40,
  60. API_CORE_GETSTATUS = 50,
  61. API_CORE_GETCURRENT = 60,
  62. API_CORE_GETCURPLAYBACKNUMBER = 70,
  63. API_CORE_GETPOSITION = 80,
  64. API_CORE_GETWRITEPOSITION = 90,
  65. API_CORE_SETPOSITION = 100,
  66. API_CORE_GETLENGTH = 110,
  67. API_CORE_GETPLUGINDATA = 120,
  68. API_CORE_GETVOLUME = 130,
  69. API_CORE_SETVOLUME = 140,
  70. API_CORE_GETPAN = 150,
  71. API_CORE_SETPAN = 160,
  72. API_CORE_ADDCALLBACK = 170,
  73. API_CORE_DELCALLBACK = 180,
  74. API_CORE_GETVISDATA = 190,
  75. API_CORE_GETLEFTVUMETER = 200,
  76. API_CORE_GETRIGHTVUMETER = 210,
  77. API_CORE_REGISTERSEQUENCER = 220,
  78. API_CORE_DEREGISTERSEQUENCER = 230,
  79. API_CORE_USERBUTTON = 240,
  80. API_CORE_GETEQSTATUS = 250,
  81. API_CORE_SETEQSTATUS = 260,
  82. API_CORE_GETEQPREAMP = 270,
  83. API_CORE_SETEQPREAMP = 280,
  84. API_CORE_GETEQBAND = 290,
  85. API_CORE_SETEQBAND = 300,
  86. API_CORE_GETEQAUTO = 310,
  87. API_CORE_SETEQAUTO = 320,
  88. API_CORE_SETCUSTOMMSG = 330,
  89. API_CORE_REGISTEREXTENSION = 340,
  90. API_CORE_GETEXTENSIONFAMILY = 350,
  91. API_CORE_UNREGISTEREXTENSION = 360,
  92. API_CORE_GETTITLE = 370,
  93. API_CORE_GETRATING = 380,
  94. API_CORE_SETRATING = 390,
  95. API_CORE_GETDECODERNAME = 400,
  96. API_CORE_SETTITLE = 410,
  97. };
  98. };
  99. inline const wchar_t *api_core::core_getSupportedExtensions()
  100. {
  101. return _call(API_CORE_GETSUPPORTEDEXTENSIONS, (const wchar_t *)0);
  102. }
  103. inline const wchar_t *api_core::core_getExtSupportedExtensions()
  104. {
  105. return _call(API_CORE_GETEXTSUPPORTEDEXTENSIONS, (const wchar_t *)0);
  106. }
  107. inline CoreToken api_core::core_create()
  108. {
  109. return _call(API_CORE_CREATE, (CoreToken)NULL);
  110. }
  111. inline int api_core::core_free(CoreToken core)
  112. {
  113. return _call(API_CORE_FREE, (int)0, core);
  114. }
  115. inline int api_core::core_setNextFile(CoreToken core, const wchar_t *playstring)
  116. {
  117. return _call(API_CORE_SETNEXTFILE, (int)0, core, playstring);
  118. }
  119. inline int api_core::core_getStatus(CoreToken core)
  120. {
  121. return _call(API_CORE_GETSTATUS, (int)0, core);
  122. }
  123. inline const wchar_t *api_core::core_getCurrent(CoreToken core)
  124. {
  125. return _call(API_CORE_GETCURRENT, (const wchar_t *)0, core);
  126. }
  127. inline int api_core::core_getCurPlaybackNumber(CoreToken core)
  128. {
  129. return _call(API_CORE_GETCURPLAYBACKNUMBER, (int)0, core);
  130. }
  131. inline int api_core::core_getPosition(CoreToken core)
  132. {
  133. return _call(API_CORE_GETPOSITION, (int)0, core);
  134. }
  135. inline int api_core::core_getWritePosition(CoreToken core)
  136. {
  137. return _call(API_CORE_GETWRITEPOSITION, (int)0, core);
  138. }
  139. inline int api_core::core_setPosition(CoreToken core, int ms)
  140. {
  141. return _call(API_CORE_SETPOSITION, (int)0, core, ms);
  142. }
  143. inline int api_core::core_getLength(CoreToken core)
  144. {
  145. return _call(API_CORE_GETLENGTH, (int)0, core);
  146. }
  147. inline int api_core::core_getPluginData(const wchar_t *playstring, const wchar_t *name, wchar_t *data, int data_len, int data_type)
  148. {
  149. return _call(API_CORE_GETPLUGINDATA, (int)0, playstring, name, data, data_len, data_type);
  150. }
  151. inline unsigned int api_core::core_getVolume(CoreToken core)
  152. {
  153. return _call(API_CORE_GETVOLUME, (unsigned int)0, core);
  154. }
  155. inline void api_core::core_setVolume(CoreToken core, unsigned int vol)
  156. {
  157. _voidcall(API_CORE_SETVOLUME, core, vol);
  158. }
  159. inline int api_core::core_getPan(CoreToken core)
  160. {
  161. return _call(API_CORE_GETPAN, (int)0, core);
  162. }
  163. inline void api_core::core_setPan(CoreToken core, int val)
  164. {
  165. _voidcall(API_CORE_SETPAN, core, val);
  166. }
  167. inline void api_core::core_addCallback(CoreToken core, CoreCallback *cb)
  168. {
  169. _voidcall(API_CORE_ADDCALLBACK, core, cb);
  170. }
  171. inline void api_core::core_delCallback(CoreToken core, CoreCallback *cb)
  172. {
  173. _voidcall(API_CORE_DELCALLBACK, core, cb);
  174. }
  175. inline int api_core::core_getVisData(CoreToken core, void *dataptr, int sizedataptr)
  176. {
  177. return _call(API_CORE_GETVISDATA, (int)0, core, dataptr, sizedataptr);
  178. }
  179. inline int api_core::core_getLeftVuMeter(CoreToken core)
  180. {
  181. return _call(API_CORE_GETLEFTVUMETER, (int)0, core);
  182. }
  183. inline int api_core::core_getRightVuMeter(CoreToken core)
  184. {
  185. return _call(API_CORE_GETRIGHTVUMETER, (int)0, core);
  186. }
  187. inline int api_core::core_registerSequencer(CoreToken core, ItemSequencer *seq)
  188. {
  189. return _call(API_CORE_REGISTERSEQUENCER, (int)0, core, seq);
  190. }
  191. inline int api_core::core_deregisterSequencer(CoreToken core, ItemSequencer *seq)
  192. {
  193. return _call(API_CORE_DEREGISTERSEQUENCER, (int)0, core, seq);
  194. }
  195. inline void api_core::core_userButton(CoreToken core, int button)
  196. {
  197. _voidcall(API_CORE_USERBUTTON, core, button);
  198. }
  199. inline int api_core::core_getEqStatus(CoreToken core)
  200. {
  201. return _call(API_CORE_GETEQSTATUS, (int)0, core);
  202. }
  203. inline void api_core::core_setEqStatus(CoreToken core, int enable)
  204. {
  205. _voidcall(API_CORE_SETEQSTATUS, core, enable);
  206. }
  207. inline int api_core::core_getEqPreamp(CoreToken core)
  208. {
  209. return _call(API_CORE_GETEQPREAMP, (int)0, core);
  210. }
  211. inline void api_core::core_setEqPreamp(CoreToken core, int pre)
  212. {
  213. _voidcall(API_CORE_SETEQPREAMP, core, pre);
  214. }
  215. inline int api_core::core_getEqBand(CoreToken core, int band)
  216. {
  217. return _call(API_CORE_GETEQBAND, (int)0, core, band);
  218. }
  219. inline void api_core::core_setEqBand(CoreToken core, int band, int val)
  220. {
  221. _voidcall(API_CORE_SETEQBAND, core, band, val);
  222. }
  223. inline int api_core::core_getEqAuto(CoreToken core)
  224. {
  225. return _call(API_CORE_GETEQAUTO, (int)0, core);
  226. }
  227. inline void api_core::core_setEqAuto(CoreToken core, int enable)
  228. {
  229. _voidcall(API_CORE_SETEQAUTO, core, enable);
  230. }
  231. inline void api_core::core_setCustomMsg(CoreToken core, const wchar_t *text)
  232. {
  233. _voidcall(API_CORE_SETCUSTOMMSG, core, text);
  234. }
  235. inline void api_core::core_registerExtension(const wchar_t *extensions, const wchar_t *extension_name, const wchar_t *family)
  236. {
  237. _voidcall(API_CORE_REGISTEREXTENSION, extensions, extension_name, family);
  238. }
  239. inline const wchar_t *api_core::core_getExtensionFamily(const wchar_t *extension)
  240. {
  241. return _call(API_CORE_GETEXTENSIONFAMILY, (const wchar_t *)0, extension);
  242. }
  243. inline void api_core::core_unregisterExtension(const wchar_t *extensions)
  244. {
  245. _voidcall(API_CORE_UNREGISTEREXTENSION, extensions);
  246. }
  247. inline const wchar_t *api_core::core_getTitle(CoreToken core)
  248. {
  249. return _call(API_CORE_GETTITLE, (const wchar_t *)0, core);
  250. }
  251. inline void api_core::core_setTitle(const wchar_t *new_title)
  252. {
  253. _voidcall(API_CORE_SETTITLE, new_title);
  254. }
  255. inline int api_core::core_getRating()
  256. {
  257. return _call(API_CORE_GETRATING, (int)0);
  258. }
  259. inline void api_core::core_setRating(int newRating)
  260. {
  261. _voidcall(API_CORE_SETRATING, newRating);
  262. }
  263. inline const wchar_t *api_core::core_getDecoderName(const wchar_t *filename)
  264. {
  265. return _call(API_CORE_GETDECODERNAME, (const wchar_t *)0, filename);
  266. }
  267. class api_coreI : public api_core
  268. {
  269. public:
  270. virtual const wchar_t *core_getSupportedExtensions() = 0;
  271. virtual const wchar_t *core_getExtSupportedExtensions() = 0;
  272. virtual CoreToken core_create() = 0;
  273. virtual int core_free(CoreToken core) = 0;
  274. virtual int core_setNextFile(CoreToken core, const wchar_t *playstring) = 0;
  275. virtual int core_getStatus(CoreToken core) = 0;
  276. virtual const wchar_t *core_getCurrent(CoreToken core) = 0;
  277. virtual int core_getCurPlaybackNumber(CoreToken core) = 0;
  278. virtual int core_getPosition(CoreToken core) = 0;
  279. virtual int core_getWritePosition(CoreToken core) = 0;
  280. virtual int core_setPosition(CoreToken core, int ms) = 0;
  281. virtual int core_getLength(CoreToken core) = 0;
  282. virtual int core_getPluginData(const wchar_t *playstring, const wchar_t *name, wchar_t *data, int data_len, int data_type = 0) = 0;
  283. virtual unsigned int core_getVolume(CoreToken core) = 0;
  284. virtual void core_setVolume(CoreToken core, unsigned int vol) = 0;
  285. virtual int core_getPan(CoreToken core) = 0;
  286. virtual void core_setPan(CoreToken core, int val) = 0;
  287. virtual void core_addCallback(CoreToken core, CoreCallback *cb) = 0;
  288. virtual void core_delCallback(CoreToken core, CoreCallback *cb) = 0;
  289. virtual int core_getVisData(CoreToken core, void *dataptr, int sizedataptr) = 0;
  290. virtual int core_getLeftVuMeter(CoreToken core) = 0;
  291. virtual int core_getRightVuMeter(CoreToken core) = 0;
  292. virtual int core_registerSequencer(CoreToken core, ItemSequencer *seq) = 0;
  293. virtual int core_deregisterSequencer(CoreToken core, ItemSequencer *seq) = 0;
  294. virtual void core_userButton(CoreToken core, int button) = 0;
  295. virtual int core_getEqStatus(CoreToken core) = 0;
  296. virtual void core_setEqStatus(CoreToken core, int enable) = 0;
  297. virtual int core_getEqPreamp(CoreToken core) = 0;
  298. virtual void core_setEqPreamp(CoreToken core, int pre) = 0;
  299. virtual int core_getEqBand(CoreToken core, int band) = 0;
  300. virtual void core_setEqBand(CoreToken core, int band, int val) = 0;
  301. virtual int core_getEqAuto(CoreToken core) = 0;
  302. virtual void core_setEqAuto(CoreToken core, int enable) = 0;
  303. virtual void core_setCustomMsg(CoreToken core, const wchar_t *text) = 0;
  304. virtual void core_registerExtension(const wchar_t *extensions, const wchar_t *extension_name, const wchar_t *family = NULL) = 0;
  305. virtual const wchar_t *core_getExtensionFamily(const wchar_t *extension) = 0;
  306. virtual void core_unregisterExtension(const wchar_t *extensions) = 0;
  307. virtual const wchar_t *core_getTitle(CoreToken core) = 0;
  308. virtual void core_setTitle(const wchar_t *new_title) = 0;
  309. virtual int core_getRating()=0;
  310. virtual void core_setRating(int newRating)=0;
  311. virtual const wchar_t *core_getDecoderName(const wchar_t *filename)=0;
  312. protected:
  313. RECVS_DISPATCH;
  314. };
  315. // {966E3DA1-C2C5-43a9-A931-EB5F8B040A4F}
  316. static const GUID coreApiServiceGuid =
  317. { 0x966e3da1, 0xc2c5, 0x43a9, { 0xa9, 0x31, 0xeb, 0x5f, 0x8b, 0x4, 0xa, 0x4f } };
  318. extern api_core *coreApi;
  319. #endif