gstmemory.inc 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. {
  2. /* GStreamer
  3. * Copyright (C) 2009 Wim Taymans <[email protected]>
  4. *
  5. * gstmemory.h: Header for memory blocks
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Library General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Library General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Library General Public
  18. * License along with this library; if not, write to the
  19. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  20. * Boston, MA 02110-1301, USA.
  21. */
  22. }
  23. Type
  24. P_GstMemory = ^T_GstMemory;
  25. PGstAllocator = ^TGstAllocator;
  26. PGstAllocator_autoptr = ^TGstAllocator_autoptr;
  27. PGstAllocator_listautoptr = ^TGstAllocator_listautoptr;
  28. PGstAllocator_queueautoptr = ^TGstAllocator_queueautoptr;
  29. PGstAllocator_slistautoptr = ^TGstAllocator_slistautoptr;
  30. PGstMapFlags = ^TGstMapFlags;
  31. PGstMapInfo = ^TGstMapInfo;
  32. PGstMemory = ^TGstMemory;
  33. PGstMemory_autoptr = ^TGstMemory_autoptr;
  34. PGstMemory_listautoptr = ^TGstMemory_listautoptr;
  35. PGstMemory_queueautoptr = ^TGstMemory_queueautoptr;
  36. PGstMemory_slistautoptr = ^TGstMemory_slistautoptr;
  37. PGstMemoryCopyFunction = ^TGstMemoryCopyFunction;
  38. PGstMemoryShareFunction = ^TGstMemoryShareFunction;
  39. Pguint8 = ^Tguint8;
  40. {$IFDEF FPC}
  41. {$PACKRECORDS C}
  42. {$ENDIF}
  43. T_GstMemory = record
  44. mini_object : TGstMiniObject;
  45. allocator : PGstAllocator;
  46. parent : PGstMemory;
  47. maxsize : Tgsize;
  48. align : Tgsize;
  49. offset : Tgsize;
  50. size : Tgsize;
  51. end;
  52. TGstMemory = T_GstMemory ;
  53. TGstMapFlags = (
  54. GST_MAP_READ := Ord(GST_LOCK_FLAG_READ),
  55. GST_MAP_WRITE := Ord(GST_LOCK_FLAG_WRITE),
  56. GST_MAP_FLAG_LAST := 1 shl 16);
  57. TGstMapInfo = record
  58. memory : PGstMemory;
  59. flags : TGstMapFlags;
  60. data : Pguint8;
  61. size : Tgsize;
  62. maxsize : Tgsize;
  63. user_data : array[0..3] of Tgpointer;
  64. _gst_reserved : array[0..3] of Tgpointer;
  65. end;
  66. TGstMemoryMapFunction = function (mem:PGstMemory; maxsize:Tgsize; flags:TGstMapFlags):Tgpointer;cdecl;
  67. TGstMemoryMapFullFunction = function (mem:PGstMemory; info:PGstMapInfo; maxsize:Tgsize):Tgpointer;cdecl;
  68. TGstMemoryUnmapFunction = procedure (mem:PGstMemory);cdecl;
  69. TGstMemoryUnmapFullFunction = procedure (mem:PGstMemory; info:PGstMapInfo);cdecl;
  70. TGstMemoryCopyFunction = function (mem:PGstMemory; offset:Tgssize; size:Tgssize):PGstMemory;cdecl;
  71. TGstMemoryShareFunction = function (mem:PGstMemory; offset:Tgssize; size:Tgssize):PGstMemory;cdecl;
  72. TGstMemoryIsSpanFunction = function (mem1:PGstMemory; mem2:PGstMemory; offset:Pgsize):Tgboolean;cdecl;
  73. TGstMemory_autoptr = PGstMemory;
  74. TGstMemory_listautoptr = PGList;
  75. TGstMemory_slistautoptr = PGSList;
  76. TGstMemory_queueautoptr = PGQueue;
  77. TGstAllocator_autoptr = PGstAllocator;
  78. TGstAllocator_listautoptr = PGList;
  79. TGstAllocator_slistautoptr = PGSList;
  80. TGstAllocator_queueautoptr = PGQueue;
  81. // Moved here from gstallocator.inc
  82. TGstAllocatorPrivate = record end;
  83. T_GstAllocatorPrivate = TGstAllocatorPrivate;
  84. PGstAllocatorPrivate = ^TGstAllocatorPrivate;
  85. T_GstAllocator = record
  86. object_ : TGstObject;
  87. mem_type : Pgchar;
  88. mem_map : TGstMemoryMapFunction;
  89. mem_unmap : TGstMemoryUnmapFunction;
  90. mem_copy : TGstMemoryCopyFunction;
  91. mem_share : TGstMemoryShareFunction;
  92. mem_is_span : TGstMemoryIsSpanFunction;
  93. mem_map_full : TGstMemoryMapFullFunction;
  94. mem_unmap_full : TGstMemoryUnmapFullFunction;
  95. _gst_reserved : array[0..(4-2)-1] of Tgpointer;
  96. priv : PGstAllocatorPrivate;
  97. end;
  98. TGstAllocator = T_GstAllocator;
  99. function gst_memory_get_type:TGType;cdecl;external gstreamerlib name 'gst_memory_get_type';
  100. procedure gst_memory_init(mem:PGstMemory; flags:TGstMemoryFlags; allocator:PGstAllocator; parent:PGstMemory; maxsize:Tgsize;
  101. align:Tgsize; offset:Tgsize; size:Tgsize);cdecl;external gstreamerlib name 'gst_memory_init';
  102. (* Const before type ignored *)
  103. function gst_memory_is_type(mem:PGstMemory; mem_type:Pgchar):Tgboolean;cdecl;external gstreamerlib name 'gst_memory_is_type';
  104. {
  105. static inline GstMemory *
  106. gst_memory_ref (GstMemory * memory)
  107. return (GstMemory *) gst_mini_object_ref (((GstMiniObject*)(memory)));
  108. static inline void
  109. gst_memory_unref (GstMemory * memory)
  110. gst_mini_object_unref (((GstMiniObject*)(memory)));
  111. }
  112. function gst_memory_get_sizes(mem:PGstMemory; offset:Pgsize; maxsize:Pgsize):Tgsize;cdecl;external gstreamerlib name 'gst_memory_get_sizes';
  113. procedure gst_memory_resize(mem:PGstMemory; offset:Tgssize; size:Tgsize);cdecl;external gstreamerlib name 'gst_memory_resize';
  114. function gst_memory_make_mapped(mem:PGstMemory; info:PGstMapInfo; flags:TGstMapFlags):PGstMemory;cdecl;external gstreamerlib name 'gst_memory_make_mapped';
  115. function gst_memory_map(mem:PGstMemory; info:PGstMapInfo; flags:TGstMapFlags):Tgboolean;cdecl;external gstreamerlib name 'gst_memory_map';
  116. procedure gst_memory_unmap(mem:PGstMemory; info:PGstMapInfo);cdecl;external gstreamerlib name 'gst_memory_unmap';
  117. function gst_memory_copy(mem:PGstMemory; offset:Tgssize; size:Tgssize):PGstMemory;cdecl;external gstreamerlib name 'gst_memory_copy';
  118. function gst_memory_share(mem:PGstMemory; offset:Tgssize; size:Tgssize):PGstMemory;cdecl;external gstreamerlib name 'gst_memory_share';
  119. function gst_memory_is_span(mem1:PGstMemory; mem2:PGstMemory; offset:Pgsize):Tgboolean;cdecl;external gstreamerlib name 'gst_memory_is_span';
  120. var
  121. _gst_memory_type : TGType;cvar;external;