hwvideo.pas 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225
  1. {
  2. $Id$
  3. Copyright (c) 1991, 1992, 1993 International Business Machines Corporation
  4. Copyright (c) 2002 by Valery Gaynullin
  5. Copyright (c) 2002-2003 by Yuri Prokushev ([email protected])
  6. This is Video Acceleration Interface
  7. This program is free software; you can redistribute it and/or modify it
  8. under the terms of the GNU Library General Public License (LGPL) as
  9. published by the Free Software Foundation; either version 2 of the
  10. License, or (at your option) any later version. This program is
  11. distributed in the hope that it will be useful, but WITHOUT ANY
  12. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13. FITNESS FOR A PARTICULAR PURPOSE.
  14. See the GNU Library General Public License for more details. You should
  15. have received a copy of the GNU Library General Public License along
  16. with this program; if not, write to the Free Software Foundation, Inc.,
  17. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. **********************************************************************}
  19. {
  20. @abstract(Video Acceleration Interface)
  21. @author(Valery Gaynullin)
  22. @author(Yuri Prokushev ([email protected]))
  23. @created(29 Nov 2002)
  24. @lastmod(19 Jan 2003)
  25. This is Video Acceleration Interface.
  26. Warning: This code is alfa. Future versions of this unit will propably
  27. not be compatible.
  28. }
  29. Unit HWVideo;
  30. Interface
  31. Uses
  32. Os2Def,
  33. PMWin,
  34. PMGpi;
  35. // GRADD function class
  36. Const
  37. VA2_FUNCTION_CLASS='Video Acceleration 2';
  38. Type
  39. THWVIDEOCAPS=record
  40. ulLength: Cardinal;
  41. ulCapsFlags: Cardinal; //flags, describing HW capability
  42. szlSrcMax: SIZEL; //maximum source size (pixels)
  43. rctlDstMargin: RECTL; //destination rectangle margins
  44. fccDstColor: Cardinal; //screen FOURCC
  45. ulScanAlign: Cardinal; //requered scanline aligment-1
  46. ulNumColors: Cardinal; //count of supported source FOURCC
  47. fccColorType: ^Cardinal; //array of supported FOURCC
  48. ulAttrCount: Cardinal; //count of viewport attributes
  49. end;
  50. PHWVIDEOCAPS=^THWVIDEOCAPS;
  51. //ulCapsFlag defines
  52. Const
  53. HWVIDEOCAPS_MINIFY = $00000001; //Chip can perform downscaling
  54. HWVIDEOCAPS_FILTER = $00000002; //Image filtering present
  55. HWVIDEOCAPS_NONINTEGER_SCALE = $00000004; //allow scale to noninteger ratio
  56. HWVIDEOCAPS_COLOR_KEYING = $00000008; //allow color keying
  57. HWVIDEOCAPS_OVERLAY = $00000010; //overlay-type HW
  58. HWVIDEOCAPS_SEPARATE_OUT = $00000020; //used separate output connector (like TV out)
  59. HWVIDEOCAPS_DECODE = $00000040; //support non-RAW data
  60. HWVIDEOCAPS_NEEDPROTECT = $00000080; //HW need to lock VRAM
  61. Type
  62. THWATTRIBUTE=record
  63. ulLength: Cardinal; //size of structure in bytes
  64. szAttrDesc: Array[0..64] of Char; //string, describing attribute
  65. ulAttrType: Cardinal; //type of attribute, check ATTRTYPE_* const
  66. ulValueSize: Cardinal; //size in bytes of each value member
  67. ulValueCount: Cardinal; //count of value members
  68. pValueList: Pointer; //list of supported values
  69. ulCurrentValue: Cardinal; //current value
  70. ulDefaultValue: Cardinal; //default value
  71. ulAttribFlags: Cardinal; //flags to define some additional properties
  72. end;
  73. PHWATTRIBUTE=^THWATTRIBUTE;
  74. //types of attributes.
  75. // if ATTRTYPE_BOOLEAN, ATTRTYPE_STATICTEXT or ATTRTYPE_BYTE,
  76. // ulValueCount & ulValueSize undefined,
  77. // pValueList can be NULL,
  78. // else this must be actual value of allocated chunk of memory.
  79. Const
  80. //attribute of ON/OFF type
  81. ATTRTYPE_BOOLEAN = 1;
  82. //attribute can be member of set string type
  83. ATTRTYPE_AGGREGATE_STRING = 2;
  84. //attribute have no value - this is static text string
  85. ATTRTYPE_STATICTEXT = 3;
  86. //attribute can be any value in 0..255 margins
  87. ATTRTYPE_BYTE = 4;
  88. //defines for ulAttribFlags field
  89. //changing this attribute affect HW capability, so application
  90. //must re-read Caps after changing value of this attribute
  91. //application must not assume preserving any capability when this
  92. //attribute was changed
  93. ATTRIB_CHANGE_CAPS = 1;
  94. //some common attribute names
  95. Const
  96. ATTRIBUTE_BRIGHTNESS = 'Brightness';
  97. ATTRIBUTE_CONTRAST = 'Contrast';
  98. ATTRIBUTE_SATURATION = 'Saturation';
  99. ATTRIBUTE_HUE = 'Hue';
  100. ATTRIBUTE_FILTERING = 'Filtering';
  101. ATTRIBUTE_TVOUT = 'Output to TV';
  102. ATTRIBUTE_COLORKEY = 'Color Keying';
  103. Type
  104. THWVIDEOSETUP=record
  105. ulLength: Cardinal;
  106. rctlDstRect: RECTL; //destination screen rectangle
  107. szlSrcSize: SIZEL; //source image size
  108. ulSrcPitch: Cardinal; //byte offset between image rows
  109. fccColor: Cardinal; //image format
  110. ulKeyColor: Cardinal; //color key
  111. rctlSrcRect: RECTL;
  112. end;
  113. PHWVIDEOSETUP=^THWVIDEOSETUP;
  114. //return codes
  115. Const
  116. //no error
  117. HWVIDEO_DONE = 0;
  118. //unspecified error
  119. HWVIDEO_ERROR = 3;
  120. //FS session active, accelerator not available
  121. HWVIDEO_ERROR_BACKGROUND = 4;
  122. //HW not available
  123. HWVIDEO_ERROR_NO_HW = 6;
  124. //incorrect parameter
  125. HWVIDEO_ERROR_PARAMETER = 7;
  126. //to low offscreen VRAM to handle setup
  127. HWVIDEO_ERROR_LOW_VRAM = 8;
  128. //HW already in use
  129. HWVIDEO_ERROR_USED = 9;
  130. //Init HWVideo subsystem
  131. //check for presence and avilability of accelerated HW, if present and
  132. //available - lock it for this process.
  133. Function HWVIDEOInit: Cardinal; cdecl;
  134. //Get HW capability
  135. //return filled structure. When called, ulNumColors must be
  136. //set to actual allocated size of fccColorType array.
  137. //if call returned with error, then need to check returned
  138. //ulNumColors, allocate larger space and call again.
  139. Function HWVIDEOCaps(pCaps: PHWVIDEOCAPS): Cardinal; cdecl;
  140. //Set HWVideo viewport
  141. //Check HW capability to handle this setup, allocate buffers.
  142. //one special case: pSetup==NULL - disable video and free all
  143. //buffers
  144. Function HWVIDEOSetup(pSetup: PHWVIDEOSETUP): Cardinal; cdecl;
  145. //Get HWVideo buffer pointer
  146. //return linear pointer to overlay buffer and it's physical address
  147. Function HWVIDEOBeginUpdate(var ppBuffer: Pointer; var pulPhysBuffer: Cardinal): Cardinal; cdecl;
  148. //Display HWVideo buffer
  149. //set pending state for last accessed videobuffer, switch
  150. //buffers on next VSYNC
  151. Function HWVIDEOEndUpdate: Cardinal; cdecl;
  152. //Get current HW attributes
  153. //0<=ulAttribNum<pCaps->ulAttrCount, else error returned.
  154. Function HWVIDEOGetAttrib(ulAttribNum: Cardinal; pAttrib: PHWATTRIBUTE): Cardinal; cdecl;
  155. //Set new attribute value
  156. //0<=ulAttribNum<pCaps.ulAttrCount, else error returned.
  157. //pAttrib->ulCurrentValue filled with new value
  158. Function HWVIDEOSetAttrib(ulAttribNum: Cardinal; pAttrib: PHWATTRIBUTE): Cardinal; cdecl;
  159. //Close HWVideo
  160. Function HWVIDEOClose: Cardinal; cdecl;
  161. Implementation
  162. Function HWVIDEOInit: Cardinal; cdecl;
  163. external 'hwvideo' name 'HWVIDEOInit';
  164. Function HWVIDEOCaps(pCaps: PHWVIDEOCAPS): Cardinal; cdecl;
  165. external 'hwvideo' name 'HWVIDEOCaps';
  166. Function HWVIDEOSetup(pSetup: PHWVIDEOSETUP): Cardinal; cdecl;
  167. external 'hwvideo' name 'HWVIDEOSetup';
  168. Function HWVIDEOBeginUpdate(var ppBuffer: Pointer; var pulPhysBuffer: Cardinal): Cardinal; cdecl;
  169. external 'hwvideo' name 'HWVIDEOBeginUpdate';
  170. Function HWVIDEOEndUpdate: Cardinal; cdecl;
  171. external 'hwvideo' name 'HWVIDEOEndUpdate';
  172. Function HWVIDEOGetAttrib(ulAttribNum: Cardinal; pAttrib: PHWATTRIBUTE): Cardinal; cdecl;
  173. external 'hwvideo' name 'HWVIDEOGetAttrib';
  174. Function HWVIDEOSetAttrib(ulAttribNum: Cardinal; pAttrib: PHWATTRIBUTE): Cardinal; cdecl;
  175. external 'hwvideo' name 'HWVIDEOSetAttrib';
  176. Function HWVIDEOClose: Cardinal; cdecl;
  177. external 'hwvideo' name 'HWVIDEOClose';
  178. End.
  179. {
  180. $Log$
  181. Revision 1.1 2003-02-12 18:42:58 hajny
  182. + hwvideo moved to standalone package
  183. Revision 1.1 2003/02/09 13:49:06 hajny
  184. + mmtk added
  185. }