aRts audio server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

kmedia2.idl 5.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. /*
  2. NEW KMedia2 tqlayout:
  3. ===================
  4. KMedia1 itself doesn't play anything. Instead it has a backend for every
  5. media type to play. It tells these backends: "start playing now", "stop
  6. playing now" and similar things (using libmediatool). So there is a backend
  7. for wave files, tacker files, midi files, etc., which all provide one
  8. common interface.
  9. The idea is to keep everything the old KMedia1 interface could do, but to
  10. move to a new IPC architecture (MCOP).
  11. That way, KMedia2 objects will be able to use the aRts streaming abilities.
  12. Of course, not every KMedia2 object will need these, but some of them. The
  13. result will be much nicer, if every of these objects can be treated in the
  14. standard "flow graph" way, like other aRts objects can.
  15. The ultimate media player, which KMedia2 aims to be, should play midi,
  16. video, audio, etc. It is about seeing a file, choosing a component which
  17. might be able to decode it, and play it. So it is not about starting
  18. the right application, but about loading the right component.
  19. This gives you the advantage that you can for instance reuse components
  20. even between quite different media types. It may for instance make sense
  21. to reuse a reverb effect to play midi, audio and video files.
  22. */
  23. #include "artsflow.idl"
  24. module Arts {
  25. enum poState {
  26. posIdle,
  27. posPlaying,
  28. posPaused
  29. };
  30. // use 2^n values here, since they can (should) be or'd together
  31. enum poCapabilities {
  32. capSeek = 1,
  33. capPause = 2
  34. };
  35. /**
  36. * KMedia2 time information
  37. *
  38. * This is a time value which contains either milliseconds & seconds, or
  39. * a custom unit or both. It is a flexible time base.
  40. *
  41. * If a value isn't there, it is set to -1.
  42. */
  43. struct poTime {
  44. /**
  45. * time it takes in seconds; -1 if no clock time known
  46. */
  47. long seconds;
  48. /**
  49. * additional time in milliseconds (this doesn't contain all the time)
  50. * -1 if no clock time known
  51. */
  52. long ms;
  53. /**
  54. * some custom time information
  55. * -1 if no custom time known
  56. */
  57. float custom;
  58. /**
  59. * for instance for a tracker "pattern"
  60. */
  61. string customUnit;
  62. };
  63. /**
  64. * private part of the PlayObject API (don't use)
  65. */
  66. interface PlayObject_private {
  67. /**
  68. * loads a file
  69. */
  70. boolean loadMedia(string filename);
  71. };
  72. /**
  73. * KMedia2 PlayObject - these can be used by Kaiman for instance
  74. */
  75. interface PlayObject : PlayObject_private {
  76. readonly attribute string description;
  77. readonly attribute poTime currentTime;
  78. readonly attribute poTime overallTime;
  79. readonly attribute poCapabilities capabilities;
  80. readonly attribute string mediaName;
  81. readonly attribute poState state;
  82. /**
  83. * starts playing the media
  84. */
  85. void play();
  86. /**
  87. * seeks to a specific time
  88. */
  89. void seek(poTime newTime); // could be handled by setting currentTime
  90. /**
  91. * pauses playing the media
  92. */
  93. void pause();
  94. /**
  95. * stop playing the media. Normally this function would called stop,
  96. * but the name is reserved for the start/stop mechanism of the
  97. * aRts objects.
  98. */
  99. void halt();
  100. };
  101. /**
  102. * use this to create new PlayObjects for media
  103. */
  104. interface PlayObjectFactory {
  105. /**
  106. * creates a play object (or returns a null reference if this is not
  107. * possible)
  108. *
  109. * @param filename the name of the file to create a play object for
  110. */
  111. PlayObject createPlayObject(string filename);
  112. };
  113. /**
  114. * UNSTABLE/EXPERIMENTAL!
  115. */
  116. interface InputStream : SynthModule {
  117. /**
  118. * whether the stream is at the end of the input
  119. */
  120. readonly attribute boolean eof;
  121. /**
  122. * total size of the stream in bytes
  123. * -1: unknown
  124. */
  125. readonly attribute long size;
  126. /**
  127. * whether the stream can be seeked
  128. */
  129. readonly attribute boolean seekOk;
  130. /**
  131. * this returns the new AGE of the stream, where AGE is defined as the
  132. * number of bytes that have been sent since the stream exists
  133. */
  134. long seek(long position);
  135. /**
  136. * the stream data
  137. */
  138. async out byte stream outdata;
  139. };
  140. /**
  141. * UNSTABLE/EXPERIMENTAL! Example stream for files.
  142. */
  143. interface FileInputStream : InputStream {
  144. attribute string filename;
  145. boolean open(string filename);
  146. };
  147. interface StdoutWriter : SynthModule {
  148. async in byte stream indata;
  149. };
  150. interface StreamPlayObject : PlayObject {
  151. /**
  152. * prepares the playobject for the stream
  153. */
  154. boolean streamMedia(InputStream instream);
  155. /**
  156. * last used inputstream
  157. * it should never change
  158. */
  159. InputStream inputStream();
  160. };
  161. /**
  162. * Playobject with adjustable speed
  163. */
  164. interface PitchablePlayObject {
  165. /**
  166. * speed relative to "original"/intended one
  167. * (1.0=normal, 2.0=double ;-), 1.05=5% faster)
  168. */
  169. attribute float speed;
  170. };
  171. /**
  172. * KMedia2 VideoPlayObject - new interface for video support
  173. *
  174. * Some of the communication is done using the X11 protocol.
  175. */
  176. interface VideoPlayObject {
  177. /**
  178. * video output window (active)
  179. */
  180. attribute long x11WindowId;
  181. /**
  182. * take a snapshot and draw it onto a pixmap
  183. * returns the X11 pixmap ID or -1 on error
  184. */
  185. long x11Snapshot();
  186. };
  187. /**
  188. * Extended Version of PlayObjectFactory
  189. */
  190. interface PlayObjectFactoryV2 : PlayObjectFactory {
  191. /**
  192. * creates a PlayObject
  193. *
  194. * @param url the url to create a play object for
  195. * @param mimetype mimetype for the url
  196. * @param createBUS specifies wheter to create the bus-uplink or not
  197. */
  198. PlayObject createPlayObjectForURL(string url, string mimetype, boolean createBUS);
  199. /**
  200. * creates a StreamPlayObject (used internally!)
  201. *
  202. * @param instream specifies the InputStream
  203. * @param mimetype mimetype for the InputStream
  204. * @param createBUS specifies wheter to create the bus-uplink or not
  205. */
  206. PlayObject createPlayObjectForStream(InputStream instream, string mimetype, boolean createBUS);
  207. };
  208. };