svc_mediacore.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. #ifndef _SVC_MEDIACORE_H
  2. #define _SVC_MEDIACORE_H
  3. #include <api/service/services.h>
  4. #include <bfc/dispatch.h>
  5. #include <api/syscb/callbacks/corecbi.h>
  6. class NOVTABLE svc_mediaCore : public Dispatchable {
  7. public:
  8. static FOURCC getServiceType() { return WaSvc::MEDIACORE; }
  9. void setCallback(CoreCallback *callback) { _voidcall(SETCALLBACK,callback); }
  10. void setCoreToken(CoreToken t) { _voidcall(SETCORETOKEN,t); }
  11. void setNextFile(const char *file, const char *to=NULL, int uniqueid=0) { _voidcall(SETNEXTFILE,file,to,uniqueid); }
  12. void start(void) { _voidcall(START); }
  13. void pause(int pause) { _voidcall(PAUSE,pause); }
  14. void setPosition(int ms) { _voidcall(SETPOSITION,ms); }
  15. void setVolume(int volume) { _voidcall(SETVOLUME,volume); }
  16. void setPan(int pan) { _voidcall(SETPAN,pan); }
  17. void abortCurrentSong() { _voidcall(ABORTCURRENTSONG); }
  18. void stop(int suppress_callback=FALSE) { _voidcall(STOP,suppress_callback); }
  19. int getPlaying(void) { return _call(GETPLAYING,0); }
  20. int getPosition(void) { return _call(GETPOSITION,0); }
  21. int getWritePosition(void) { return _call(GETWRITEPOSITION,0); }
  22. int getTitle(char *title, int maxlen) { return _call(GETTITLE,0,title,maxlen); }
  23. void getInfo(char *info, int maxlen) { _voidcall(GETINFO,info,maxlen); }
  24. int getLength(void) { return _call(GETLENGTH,0); }
  25. int getVolume(void) { return _call(GETVOLUME,0); }
  26. int getPan(void) { return _call(GETPAN,0); }
  27. void mute(int mute) { _voidcall(MUTE,mute); }
  28. int isMuted() { return _call(ISMUTED,0); }
  29. void setEQStatus(int enable) { _voidcall(SETEQSTATUS,enable); }
  30. int getEQStatus() { return _call(GETEQSTATUS,0); }
  31. void setEQPreamp(char pre) { _voidcall(SETEQPREAMP,pre); }
  32. char getEQPreamp() { return _call(GETEQPREAMP,0); }
  33. void setEQBand(int band, char val) { _voidcall(SETEQBAND,band,val); }
  34. char getEQBand(int band) { return _call(GETEQBAND,0,band); }
  35. void setEQBands(char tab[10]) { _voidcall(SETEQBANDS,tab); }
  36. void getEQBands(char *tab) { _voidcall(GETEQBANDS,tab); }
  37. void setEQ(int enable, char pre, char tab[10]) { _voidcall(SETEQ,enable,pre,tab); }
  38. void getEQ(int *enable, char *pre, char *tab) { _voidcall(GETEQ,enable,pre,tab); }
  39. int getMetaData(const char *name, char *data, int data_len) { return _call(GETMETADATA,0,name,data,data_len); }
  40. int getVisData(void *dataptr, int sizedataptr) { return _call(GETVISDATA,0,dataptr,sizedataptr); }
  41. void setPriority(int priority) { _voidcall(SETPRIORITY,priority); }
  42. int getPriority() { return _call(GETPRIORITY,0); }
  43. void rebuildConvertersChain() { _voidcall(REBUILDCONVERTERSCHAIN); }
  44. int sendConvertersMsg(const char *msg, const char *value) { return _call(SENDCONVERTERSMSG,0,msg,value); }
  45. enum {
  46. SETCALLBACK=10,
  47. SETNEXTFILE=20,
  48. START=30,
  49. PAUSE=40,
  50. SETPOSITION=50,
  51. SETVOLUME=60,
  52. SETPAN=70,
  53. ABORTCURRENTSONG=80,
  54. STOP=90,
  55. GETPLAYING=100,
  56. GETPOSITION=110,
  57. GETWRITEPOSITION=120,
  58. GETTITLE=130,
  59. GETINFO=140,
  60. GETLENGTH=150,
  61. GETVOLUME=160,
  62. GETPAN=170,
  63. SETEQSTATUS=180,
  64. GETEQSTATUS=190,
  65. SETEQPREAMP=200,
  66. GETEQPREAMP=210,
  67. SETEQBAND=220,
  68. GETEQBAND=230,
  69. SETEQBANDS=240,
  70. GETEQBANDS=250,
  71. SETEQ=260,
  72. GETEQ=270,
  73. GETMETADATA=280,
  74. GETVISDATA=290,
  75. MUTE=300,
  76. ISMUTED=310,
  77. SETCORETOKEN=320,
  78. SETPRIORITY=330,
  79. GETPRIORITY=340,
  80. REBUILDCONVERTERSCHAIN=350,
  81. SENDCONVERTERSMSG=360,
  82. };
  83. };
  84. // derive from this one
  85. class NOVTABLE svc_mediaCoreI : public svc_mediaCore {
  86. public:
  87. svc_mediaCoreI() : m_coretoken(0) { }
  88. virtual void setCallback(CoreCallback *callback)=0;
  89. virtual void setCoreToken(CoreToken t) { m_coretoken=t; }
  90. virtual void setNextFile(const char *file, const char *to=NULL, int uniqueid=0)=0;
  91. /* call to specify next file from WCM_NEEDNEXTFILE, or before calling start() */
  92. virtual void start(void)=0; /* start playback */
  93. virtual void pause(int pause)=0; /* set/unset paused state (nonzero is paused, zero is unpaused) */
  94. virtual void setPosition(int ms)=0; /* set position of current stream in ms */
  95. virtual void setVolume(int volume)=0; /* volume is 0 to 255 */
  96. virtual void setPan(int pan)=0; /* pan is -127 to 127 */
  97. virtual void abortCurrentSong()=0; /* abort decoding of current song and start playing the next one */
  98. virtual void stop(int suppress_callback=FALSE)=0;
  99. virtual int getPlaying(void)=0; /* 0 is not playing, 1 is playing, -1 is paused */
  100. virtual int getPosition(void)=0; /* get position of current stream in ms */
  101. virtual int getWritePosition(void)=0; /* get written position of current stream in ms */
  102. virtual int getTitle(char *title, int maxlen)=0; // returns uniqueid
  103. virtual void getInfo(char *info, int maxlen)=0;
  104. virtual int getLength(void)=0; /* get length of track in ms. -1 indicates infinite/unknown */
  105. virtual int getVolume(void)=0; /* get volume (0-255) */
  106. virtual int getPan(void)=0; /* get panning (-127 to 127) */
  107. virtual void mute(int mute)=0;
  108. virtual int isMuted()=0;
  109. virtual void setEQStatus(int enable)=0; /* 0 if off, 1 if on */
  110. virtual int getEQStatus()=0; /* 0 if off, 1 if on */
  111. virtual void setEQPreamp(char pre)=0; /* -127 to 127 (-20db to +20db) */
  112. virtual char getEQPreamp()=0; /* -127 to 127 (-20db to +20db) */
  113. virtual void setEQBand(int band, char val)=0; /* band=0-9 */
  114. virtual char getEQBand(int band)=0; /* band=0-9 */
  115. virtual void setEQBands(char tab[10])=0; /* eq values are -127 to 127 (-20db to +20db) */
  116. virtual void getEQBands(char *tab)=0; /* eq values are -127 to 127 (-20db to +20db) */
  117. virtual void setEQ(int enable, char pre, char tab[10])=0;
  118. virtual void getEQ(int *enable, char *pre, char *tab)=0;
  119. virtual int getMetaData(const char *name, char *data, int data_len)=0; // returns size of data
  120. virtual int getVisData(void *dataptr, int sizedataptr)=0; // returns size of data it wanted to copy, if any.
  121. virtual void setPriority(int priority)=0;
  122. virtual int getPriority()=0;
  123. virtual void rebuildConvertersChain()=0;
  124. virtual int sendConvertersMsg(const char *msg, const char *value)=0;
  125. protected:
  126. RECVS_DISPATCH;
  127. CoreToken m_coretoken;
  128. };
  129. #include <api/service/servicei.h>
  130. template <class T>
  131. class MediaCoreCreator : public waServiceFactoryT<svc_mediaCore, T> { };
  132. #endif