Leaked source code of windows server 2003
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.

69 lines
2.4 KiB

  1. /*
  2. * Copyright (C) Microsoft Corporation 1992. All rights reserved.
  3. */
  4. /*
  5. * aviread.h interface functions to read module providing asynchronous
  6. * reading of mmio files.
  7. * Only in WIN32 case.
  8. *
  9. * Creating an avird object causes a worker thread to start
  10. * up and callback to a caller-defined function to read blocks
  11. * and queue them.
  12. * The caller can then call avird_getnextbuffer to get each buffer
  13. * in turn, and once finished with them, should call
  14. * avird_emptybuffer: this will notify the avird object that
  15. * the buffer is no longer wanted and can be used to read
  16. * ahead further blocks.
  17. */
  18. #ifdef _WIN32
  19. /* handles to avird */
  20. typedef struct avird_header * HAVIRD;
  21. /* caller passes us a AVIRD_FUNC pointer to a function that
  22. * will fill the buffer. It takes four args: the buffer to be filled,
  23. * a dword instance data (containing the mmio handle or npMCI or whatever),
  24. * a long giving the
  25. * size of the block to read, and a pointer to the long where it should
  26. * return the size of the next block. This function will be never
  27. * be called out of sequence, so assuming the file pointer is at the
  28. * correct place before calling avird_startread, blocks will be read
  29. * in sequence by this function (on the worker thread). The function should
  30. * return FALSE if the read failed in any way.
  31. */
  32. typedef BOOL (*AVIRD_FUNC)(PBYTE pData, DWORD_PTR dwInstanceData, long lSize, long * plNextSize);
  33. /*
  34. * start an avird operation and return a handle to use in subsequent
  35. * calls. This will cause an asynchronous read (achieved using a separate
  36. * thread) to start reading the next few buffers. it will not read past
  37. * nblocks assuming that filler will start at firstblock.
  38. */
  39. HAVIRD avird_startread(AVIRD_FUNC func, DWORD_PTR dwInstanceData, long lFirstSize,
  40. int firstblock, int nblocks);
  41. /*
  42. * return the next buffer from an HAVIRD object. also set plSize to
  43. * the size of the buffer. Returns NULL if there was an error reading
  44. * the buffer.
  45. */
  46. PBYTE avird_getnextbuffer(HAVIRD havird, long * plSize);
  47. /*
  48. * return a buffer that has been finished with (is now empty)
  49. */
  50. void avird_emptybuffer(HAVIRD havird, PBYTE pBuffer);
  51. /*
  52. * delete an avird object. the worker thread will be stopped and all
  53. * data allocated will be freed. The HAVIRD handle is no longer valid after
  54. * this call.
  55. */
  56. void avird_endread(HAVIRD havird);
  57. #endif /* _WIN32 */