nethfb.h 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. #ifndef _nethfb_h
  2. #define _nethfb_h
  3. #include "duck_hfb.h"
  4. #ifndef NETHFB
  5. #define lHFB_GetDataSize HFB_GetDataSize
  6. #define lHFB_GetStreamingData HFB_GetStreamingData
  7. #define lHFB_ReleaseStreamingData HFB_ReleaseStreamingData
  8. #define lHFB_ReadData HFB_ReadData
  9. #define lHFB_WhatsAhead HFB_WhatsAhead
  10. #define lHFB_GetAudioInfo HFB_GetAudioInfo
  11. #define lHFB_GetInitialFrames HFB_GetInitialFrames
  12. #define lHFB_GetSamplesPerFrame HFB_GetSamplesPerFrame
  13. #define lHFB_GetFrameRates HFB_GetFrameRates
  14. #define lHFB_GetDRMData HFB_GetDRMData
  15. #define lHFB_LoadIndex HFB_LoadIndex
  16. #define lHFB_ParseFile HFB_ParseFile
  17. #define lHFB_Init HFB_Init
  18. #define lHFB_Exit HFB_Exit
  19. #define lHFB_FindFile HFB_FindFile
  20. #define lHFB_OpenFile HFB_OpenFile
  21. #define lHFB_SeekToIndex HFB_SeekToIndex
  22. #define lHFB_BeginLoadIndex HFB_BeginLoadIndex
  23. #define lHFB_FinishLoadIndex HFB_FinishLoadIndex
  24. #define lHFB_ReadMoreIndex HFB_ReadMoreIndex
  25. #define lHFB_ParseBigIndex HFB_ParseBigIndex
  26. #define lHFB_CloseFile HFB_CloseFile
  27. #define lHFB_GetFileInfo HFB_GetFileInfo
  28. #define lHFB_ResetStreams HFB_ResetStreams
  29. #define lHFB_GetStream HFB_GetStream
  30. #define lHFB_ReleaseStream HFB_ReleaseStream
  31. #define lHFB_GetStreamInfo HFB_GetStreamInfo
  32. #define lHFB_CreateBuffer HFB_CreateBuffer
  33. #define lHFB_DestroyBuffer HFB_DestroyBuffer
  34. #define lHFB_ResetBuffer HFB_ResetBuffer
  35. #define lHFB_SetBufferMode HFB_SetBufferMode
  36. #define lHFB_QueueOpenFile HFB_QueueOpenFile
  37. #define lHFB_GetBufferPerCentFull HFB_GetBufferPerCentFull
  38. #define lHFB_GetmovieSize HFB_GetmovieSize
  39. #define lHFB_InitBuffer HFB_InitBuffer
  40. #define lHFB_GetBufferSpace HFB_GetBufferSpace
  41. #define lHFB_FillBuffer HFB_FillBuffer
  42. #define lHFB_GetBufferStatus HFB_GetBufferStatus
  43. #define lHFB_FramestoNextKeyFrame HFB_FramestoNextKeyFrame
  44. #define lHFB_FrameToChunk HFB_FrameToChunk
  45. #define lHFB_PreviousKeyFrame HFB_PreviousKeyFrame
  46. #define lHFB_GetIndexFlags HFB_GetIndexFlags
  47. #define lHFB_AddIndexFlags HFB_AddIndexFlags
  48. #define lHFB_GetDataPosition HFB_GetDataPosition
  49. #define lHFB_ConditionBuffer HFB_ConditionBuffer
  50. #define lHFB_WalkFlags HFB_WalkFlags
  51. #define lHFB_isVideoKeyFrame HFB_isVideoKeyFrame
  52. #define lHFB_GetStreamParentBuffer HFB_GetStreamParentBuffer
  53. #define lHFB_GetStreamParentFile HFB_GetStreamParentFile
  54. #define lHFB_GetStreamRateAndScale HFB_GetStreamRateAndScale
  55. #define lHFB_GetStreamFCCs HFB_GetStreamFCCs
  56. #define lHFB_GetStreamSampleSize HFB_GetStreamSampleSize
  57. #define lHFB_GetLastError HFB_GetLastError
  58. #else
  59. #if defined(__cplusplus)
  60. extern "C" {
  61. #endif
  62. /* main HFB initialization and exit routines */
  63. int lHFB_Init(int ,int ,int );
  64. void lHFB_Exit(void);
  65. /* FWG 9-13-2000 */
  66. int lHFB_SeekToIndex(HFB_FILE_HANDLE FileHandle);
  67. int lHFB_BeginLoadIndex(HFB_BUFFER_HANDLE dckPtr, int size);
  68. int lHFB_FinishLoadIndex(HFB_BUFFER_HANDLE dckPtr, void *data, int size);
  69. /* open specified file, parse its header(s) and load the index */
  70. HFB_FILE_HANDLE lHFB_OpenFile(
  71. const char *fileName,
  72. HFB_BUFFER_HANDLE bufferHandle,
  73. unsigned int userData
  74. );
  75. /* the following three functions, findfile, parsefile and loadindex,
  76. are encapsulated by openfile, they are provided as a convenience
  77. for use on systems with asynchronous i/o */
  78. //HFB_FILE_HANDLE lHFB_FindFile(const char *fileName, unsigned int userData);
  79. int lHFB_ParseFile(
  80. HFB_FILE_HANDLE fileHandle,
  81. HFB_BUFFER_HANDLE bufferHandle
  82. );
  83. int lHFB_LoadIndex(
  84. HFB_FILE_HANDLE fileHandle,
  85. HFB_BUFFER_HANDLE bufferHandle
  86. );
  87. void lHFB_CloseFile(HFB_FILE_HANDLE fHnd);
  88. HFB_FILE_INFO *lHFB_GetFileInfo(HFB_FILE_HANDLE fileHandle);
  89. HFB_BUFFER_HANDLE lHFB_CreateBuffer(
  90. int sizeOfBuffer,
  91. int reserved
  92. );
  93. void lHFB_InitBuffer(
  94. HFB_BUFFER_HANDLE bufferHandle,
  95. HFB_FILE_HANDLE fileToLoad,
  96. int startFrame,
  97. int initialReadSize
  98. );
  99. int lHFB_FillBuffer(
  100. HFB_BUFFER_HANDLE bufferHandle,
  101. int maxToRead,
  102. int frameSyncCounter
  103. );
  104. void lHFB_DestroyBuffer(HFB_BUFFER_HANDLE bufferHandle);
  105. void lHFB_ResetStreams(HFB_BUFFER_HANDLE bufferHandle);
  106. int lHFB_SetBufferMode(
  107. HFB_BUFFER_HANDLE ,
  108. hfbBufferMode mode
  109. );
  110. int lHFB_GetBufferPerCentFull(HFB_BUFFER_HANDLE );
  111. int lHFB_GetmovieSize(HFB_BUFFER_HANDLE );
  112. int lHFB_GetBufferSpace(HFB_BUFFER_HANDLE );
  113. hfbBufferStatus lHFB_GetBufferStatus(HFB_BUFFER_HANDLE );
  114. int lHFB_ConditionBuffer(
  115. HFB_BUFFER_HANDLE bufferHandle,
  116. int bufferSize,
  117. int reserved);
  118. #define lHFB_ResetBuffer lHFB_ConditionBuffer
  119. /* get a stream reference handle */
  120. HFB_STREAM_HANDLE lHFB_GetStream(
  121. HFB_FILE_HANDLE fileHandle,
  122. const char *StreamNameOrNull,
  123. int streamNumber,
  124. unsigned int streamType);
  125. /* relinquish reference to stream */
  126. void lHFB_ReleaseStream(HFB_STREAM_HANDLE streamHandle);
  127. /* get a pointer to stream info struct */
  128. HFB_STREAM_INFO *lHFB_GetStreamInfo(HFB_STREAM_HANDLE );
  129. #define lHFB_GetStreamLength(strmh) \
  130. lHFB_GetStreamInfo(strmh)->lLength
  131. #define lHFB_GetStreamName(strmh) \
  132. lHFB_GetStreamInfo(strmh)->szName
  133. /* get pointer to buffered record and length */
  134. HFB_DATA_HANDLE lHFB_GetStreamingData(
  135. HFB_STREAM_HANDLE streamHandle,
  136. void **ptrToPtr,
  137. int *ptrToLength,
  138. hfbDirection directionToMove,
  139. int framesToMove
  140. );
  141. /* release buffer space occupied by record */
  142. void lHFB_ReleaseStreamingData(
  143. HFB_BUFFER_HANDLE bufferHandle,
  144. HFB_DATA_HANDLE recordToRelease);
  145. /* read data directly from a file into a
  146. supplied buffer, limit is set by initial value
  147. of *ptrToLength */
  148. int lHFB_ReadData(
  149. HFB_STREAM_HANDLE streamHandle,
  150. void *ptrToBuffer,
  151. int *ptrToLength,
  152. hfbDirection directionToMove,
  153. int framesToMove);
  154. int lHFB_FramestoNextKeyFrame(
  155. HFB_STREAM_HANDLE streamHandle,
  156. int recordHandle,
  157. int *numberOfRecordsSpanned
  158. );
  159. int lHFB_FrameToChunk(
  160. HFB_STREAM_HANDLE streamHandle,
  161. int frameNumber
  162. );
  163. /* get the frameNumber of the keyframe
  164. at or prior to the specified frameNumber */
  165. int lHFB_PreviousKeyFrame(
  166. HFB_STREAM_HANDLE streamHandle,
  167. int frameNumber
  168. );
  169. /* get the HFB index flags for the specified record/frame */
  170. int lHFB_GetIndexFlags(
  171. HFB_STREAM_HANDLE ,
  172. hfbFrameNumber frameNumberType,
  173. int recordHandleOrFrameNumber);
  174. /* add the HFB index flags for the specified record/frame */
  175. int lHFB_AddIndexFlags(
  176. HFB_STREAM_HANDLE ,
  177. hfbFrameNumber frameNumberType,
  178. int recordHandleOrFrameNumber,
  179. int flagsToAdd);
  180. /* get current data position
  181. video - frameNumber
  182. audio - sampleCount */
  183. int lHFB_GetDataPosition(
  184. HFB_STREAM_HANDLE streamHandle,
  185. HFB_DATA_HANDLE dataRecordHandle
  186. );
  187. /* get information about audio stream */
  188. DKWAVEFORM *lHFB_GetAudioInfo(
  189. HFB_STREAM_HANDLE nStream,
  190. int *NumChannels,
  191. int *SamplesPerSec,
  192. int *BytesPerSec,
  193. int *wFormat);
  194. /* get the amount of audio skew
  195. expressed in records */
  196. int lHFB_GetInitialFrames(
  197. HFB_STREAM_HANDLE videoStream,
  198. HFB_STREAM_HANDLE audioStream
  199. );
  200. /* get the number of audio frames elapsed
  201. during a single video frame */
  202. int lHFB_GetSamplesPerFrame(
  203. HFB_STREAM_HANDLE videoStream,
  204. HFB_STREAM_HANDLE audioStream
  205. );
  206. /* get video frame rate and
  207. calculated audio skew (in audio samples) */
  208. void lHFB_GetFrameRates(
  209. HFB_STREAM_HANDLE videoStream,
  210. HFB_STREAM_HANDLE audioStream,
  211. int *ptrToIntegerFrameRate,
  212. int *ptrToEstimatedAudioSampleSkew);
  213. /* */
  214. int lHFB_GetDRMData(
  215. HFB_FILE_HANDLE dckPtr,
  216. unsigned int* pOutEncFourCC,
  217. int* pOutLength,
  218. unsigned char** ppOutData);
  219. /*get pointer to stream information streuct */
  220. HFB_STREAM_INFO *lHFB_GetStreamInfo(HFB_STREAM_HANDLE );
  221. /* functions to retrieve parent buffer
  222. and file of a given stream*/
  223. HFB_BUFFER_HANDLE lHFB_GetStreamParentBuffer(HFB_STREAM_HANDLE );
  224. HFB_FILE_HANDLE lHFB_GetStreamParentFile(HFB_STREAM_HANDLE);
  225. /* used to precisely calculate rational frame rates
  226. for a specific stream */
  227. void lHFB_GetStreamRateAndScale(
  228. HFB_STREAM_HANDLE xStream,
  229. int *rate, int *scale
  230. );
  231. /* get stream type and handler fourCC codes,
  232. returns type (not handler) */
  233. unsigned int lHFB_GetStreamFCCs(
  234. HFB_STREAM_HANDLE xStream,
  235. unsigned int *type,
  236. unsigned int *handler
  237. );
  238. /* get the last error that occured in HFB */
  239. int lHFB_GetLastError(
  240. HFB_BUFFER_HANDLE bfHnd,
  241. int* lastErrorCode,
  242. char errorString[],
  243. size_t maxLen
  244. );
  245. /* get streamSampleSize, <= 0 means variable */
  246. int lHFB_GetStreamSampleSize(HFB_STREAM_HANDLE xStream);
  247. int lHFB_WhatsAhead(HFB_STREAM_HANDLE ,int ,int *);
  248. /* windows 95 dll system abstraction functions */
  249. void lHFB_Setmalloc(
  250. void *(*mallocFuncPtr)(unsigned int size)
  251. );
  252. void lHFB_Setcalloc(
  253. void *(*callocFuncPtr)(unsigned int size, unsigned int number)
  254. );
  255. void lHFB_Setfree(
  256. void (*freeFuncPtr)(void *)
  257. );
  258. void lHFB_Setopen(
  259. int (*openFuncPtr)(const char *, int,...)
  260. );
  261. void lHFB_Setclose(
  262. int (*closeFuncPtr)(int)
  263. );
  264. void lHFB_Setread(
  265. int (*readFuncPtr)(int,void *, unsigned int)
  266. );
  267. void lHFB_Setseek(
  268. int (*seekFuncPtr)(int,int,int)
  269. );
  270. #if defined(__cplusplus)
  271. }
  272. #endif
  273. #endif
  274. #endif