matroska.pas 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. {
  2. Translation of the libmatroska headers for FreePascal
  3. Copyright (C) 2006 by Ivo Steinmann
  4. }
  5. (****************************************************************************
  6. ** libmatroska : parse Matroska files, see http://www.matroska.org/
  7. **
  8. ** <file/class description>
  9. **
  10. ** Copyright (C) 2002-2003 Steve Lhomme. All rights reserved.
  11. **
  12. ** This file is part of libmatroska.
  13. **
  14. ** This library is free software; you can redistribute it and/or
  15. ** modify it under the terms of the GNU Lesser General Public
  16. ** License as published by the Free Software Foundation; either
  17. ** version 2.1 of the License, or (at your option) any later version.
  18. **
  19. ** This library is distributed in the hope that it will be useful,
  20. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  22. ** Lesser General Public License for more details.
  23. **
  24. ** You should have received a copy of the GNU Lesser General Public
  25. ** License along with this library; if not, write to the Free Software
  26. ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  27. **
  28. ** See http://www.matroska.org/license/lgpl/ for LGPL licensing information.**
  29. ** Contact [email protected] if any conditions of this licensing are
  30. ** not clear to you.
  31. **
  32. **********************************************************************)
  33. unit matroska;
  34. {$mode objfpc}
  35. {$MINENUMSIZE 4}
  36. interface
  37. uses
  38. ctypes;
  39. {$IFDEF WINDOWS}
  40. {$DEFINE DYNLINK}
  41. {$ENDIF}
  42. {$IFDEF DYNLINK}
  43. const
  44. {$IF Defined(WINDOWS)}
  45. matroskalib = 'libmatroska.dll';
  46. {$ELSEIF Defined(UNIX)}
  47. matroskalib = 'libmatroska.so';
  48. {$ELSE}
  49. {$MESSAGE ERROR 'DYNLINK not supported'}
  50. {$IFEND}
  51. {$ELSE}
  52. {$LINKLIB a52}
  53. {$ENDIF}
  54. (*!
  55. \file libebml_t.h
  56. \version \$Id: libebml_t.h 1011 2005-01-05 16:15:25Z robux4 $
  57. \author Steve Lhomme <robux4 @ users.sf.net>
  58. \author Ingo Ralf Blum <ingoralfblum @ users.sf.net>
  59. \author Moritz Bunkus <[email protected]>
  60. \brief Misc type definitions for the C API of LIBEBML
  61. \note These types should be compiler/language independant (just platform dependant)
  62. \todo recover the sized types (uint16, int32, etc) here too (or maybe here only)
  63. *)
  64. type
  65. binary = cuint8;
  66. open_mode = (
  67. MODE_READ,
  68. MODE_WRITE,
  69. MODE_CREATE,
  70. MODE_SAFE
  71. );
  72. (*!
  73. \file libmatroska_t.h
  74. \version \$Id: libmatroska_t.h,v 1.3 2004/04/14 23:26:17 robux4 Exp $
  75. \author Steve Lhomme <robux4 @ users.sf.net>
  76. \author Ingo Ralf Blum <ingoralfblum @ users.sf.net>
  77. \brief Misc type definitions for the C API of libmatroska
  78. \note These types should be compiler/language independant (just platform dependant)
  79. \todo recover the sized types (uint16, int32, etc) here too (or maybe here only)
  80. *)
  81. (*!
  82. \enum track_type
  83. *)
  84. type
  85. track_type = cuint32;
  86. const
  87. track_video = $01; ///< Rectangle-shaped non-transparent pictures aka video
  88. track_audio = $02; ///< Anything you can hear
  89. track_complex = $03; ///< Audio and video in same track, used by DV
  90. track_logo = $10; ///< Overlay-pictures, displayed over video
  91. track_subtitle = $11; ///< Text-subtitles. One track contains one language and only one track can be active (player-side configuration)
  92. track_buttons = $12; ///< Buttons meta-infos.
  93. track_control = $20; ///< Control-codes for menus and other stuff
  94. (*!
  95. \enum matroska_error_t
  96. \brief a callback that the library use to inform of errors happening
  97. \note this should be used by the libmatroska internals
  98. *)
  99. type
  100. matroska_error_t = (
  101. error_null_pointer ///< NULL pointer where something else is expected
  102. );
  103. matroska_stream = pointer;
  104. (*!
  105. \var void* matroska_id
  106. \brief UID used to access an Matroska file instance
  107. *)
  108. matroska_id = pointer;
  109. (*!
  110. \var void* matroska_track
  111. \brief UID used to access a track
  112. *)
  113. matroska_track = pointer;
  114. (*!
  115. \var char* c_string
  116. \brief C-String, ie a buffer with characters terminated by \0
  117. *)
  118. c_string = pcchar;
  119. (*!
  120. \var unsigned int matroska_file_mode
  121. \brief A bit buffer, each bit representing a value for the file opening
  122. \todo replace the unsigned int by a sized type (8 or 16 bits)
  123. *)
  124. matroska_file_mode = pcchar;
  125. (*!
  126. \var void ( *matroska_error_callback)(matroska_error_t error_code, char* error_message)
  127. \brief a callback that the library use to inform of errors happening
  128. *)
  129. matroska_error_callback = procedure(error_code: matroska_error_t; error_message: pcchar); cdecl;
  130. track_info = pointer;
  131. (*!
  132. \file libmatroska.h
  133. \version \$Id: libmatroska.h,v 1.2 2004/04/14 23:26:17 robux4 Exp $
  134. \author Steve Lhomme <robux4 @ users.sf.net>
  135. \author Ingo Ralf Blum <ingoralfblum @ users.sf.net>
  136. \brief C API to the libmatroska library
  137. \note These are the functions that should be exported (visible from outisde the library)
  138. \todo Put a function here for all the MUST in the Matroska spec
  139. \todo Put a brief description of each function, and a description of the params and return value
  140. \todo Change the int values to sized types
  141. *)
  142. (*!
  143. \fn int matroska_plug_log(matroska_error_callback)
  144. \brief Attach a callback to be informed when error occurs
  145. \param callback The callback that will be called when logging occurs \return 0 if successfull
  146. *)
  147. function matroska_plug_log(callback: matroska_error_callback): cint; cdecl; external {$IFDEF DYNLINK}matroskalib{$ENDIF};
  148. (*!
  149. \fn int matroska_unplug_log(matroska_error_callback)
  150. \brief Unattach an attached callback to be informed when error occurs
  151. \param callback The callback that was called when logging occurs \return 0 if successfull
  152. *)
  153. function matroska_unplug_log(callback: matroska_error_callback): cint; cdecl; external {$IFDEF DYNLINK}matroskalib{$ENDIF};
  154. (*!
  155. \fn matroska_id matroska_open_file(c_string,matroska_file_mode)
  156. \brief Open an instance of an Matroska file
  157. \param string The name of the file to open (including OS depedant path) \param mode The mode to open the file (read, write, etc)
  158. \return NULL if the opening failed or an ID that will be used to access this file from the API
  159. *)
  160. function matroska_open_stream_file(_string: c_string; mode: open_mode): matroska_stream; cdecl; external {$IFDEF DYNLINK}matroskalib{$ENDIF};
  161. function matroska_open_stream(a_stream: matroska_stream): matroska_id; cdecl; external {$IFDEF DYNLINK}matroskalib{$ENDIF};
  162. (*!
  163. \fn matroska_id matroska_open_url(c_string)
  164. \brief Open an instance of an Matroska file from a URL
  165. \param string The name of the URL to open \return NULL if the opening failed or an ID that will be used to access this file from the API
  166. \warning Open only for reading ?
  167. \note It requires that Curl is compiled or installed
  168. *)
  169. function matroska_open_url(_string: c_string): matroska_id; cdecl; external {$IFDEF DYNLINK}matroskalib{$ENDIF};
  170. (*!
  171. \fn int matroska_close(matroska_id)
  172. \brief Close the specified Matroska instance
  173. \param id The instance to close \return 0 if successfull
  174. *)
  175. procedure matroska_close(id: matroska_id); cdecl; external {$IFDEF DYNLINK}matroskalib{$ENDIF};
  176. procedure matroska_end(id: matroska_id; totaltime: cuint32); cdecl; external {$IFDEF DYNLINK}matroskalib{$ENDIF};
  177. function matroska_create_track(id: matroska_id; _type: track_type): matroska_track; cdecl; external {$IFDEF DYNLINK}matroskalib{$ENDIF};
  178. procedure matroska_read_head(id: matroska_id); cdecl; external {$IFDEF DYNLINK}matroskalib{$ENDIF};
  179. procedure matroska_read_tracks(id: matroska_id); cdecl; external {$IFDEF DYNLINK}matroskalib{$ENDIF};
  180. function matroska_get_number_track(id: matroska_id): cuint8; cdecl; external {$IFDEF DYNLINK}matroskalib{$ENDIF};
  181. function matroska_get_track(id: matroska_id; track_index: cuint8): matroska_track; cdecl; external {$IFDEF DYNLINK}matroskalib{$ENDIF};
  182. procedure matroska_get_track_info(id: matroska_id; track: matroska_track; var infos: track_info); cdecl; external {$IFDEF DYNLINK}matroskalib{$ENDIF};
  183. (*
  184. int matroska_track_write_block(matroska_track, void* buffer, unsigned int size);
  185. int matroska_track_close(matroska_track);
  186. *)
  187. implementation
  188. end.