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.

293 lines
8.6 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 2000 - 2001
  3. Module Name:
  4. MsTpFmt.h
  5. Abstract:
  6. Header file for AV/C Tape format data.
  7. Last changed by:
  8. $Author:: $
  9. Environment:
  10. Kernel mode only
  11. Revision History:
  12. $Revision:: $
  13. $Date:: $
  14. --*/
  15. #ifndef _DVFORMAT_INC
  16. #define _DVFORMAT_INC
  17. // ****************
  18. // Support switches
  19. // ****************
  20. //
  21. // Differnt level of WDM supports may use different API
  22. //
  23. // e.g. MmGetSystemAddressForMdl (win9x)
  24. // Return NULL for Win9x; bugcheck for Win2000 if NULL would have returned.
  25. //
  26. // MmGetSystemAddressForMdlSafe (win2000)
  27. // Not supported in Win9x or Millen
  28. //
  29. // #define USE_WDM110 // Define this if WDM1.10 is used; e.g. Win2000 code base; Set this in SOURCES file.
  30. //
  31. // Turn this on to support HD DVCR
  32. //#define MSDV_SUPPORT_HD_DVCR
  33. //
  34. // Turn this on to support SDL DVCR
  35. //#define SUPPORT_SDL_DVCR
  36. //
  37. // Turn on this switch to support bus reset KS event
  38. // #define MSDVDV_SUPPORT_BUSRESET_EVENT
  39. //
  40. // Turn this define to extract timecode from a video frame
  41. // Advantage: faster turn around compare to an AVC status command
  42. // #define MSDV_SUPPORT_EXTRACT_SUBCODE_DATA
  43. //
  44. // To get recorded date and time
  45. // #define MSDV_SUPPORT_EXTRACT_DV_DATE_TIME
  46. //
  47. // Mute audio when in pause state while transmitting to DV
  48. #define MSDV_SUPPORT_MUTE_AUDIO
  49. //
  50. // Support getting regitry value for this device
  51. //
  52. // #define READ_CUTOMIZE_REG_VALUES
  53. //
  54. // Suuport accessing to the device's interface section
  55. //
  56. #define SUPPORT_ACCESS_DEVICE_INTERFACE
  57. //
  58. // Support new AVC - plug connection ..etc.
  59. //
  60. // #define SUPPORT_NEW_AVC
  61. //
  62. // Support local plug.
  63. //
  64. #define SUPPORT_LOCAL_PLUG
  65. //
  66. // Testing
  67. //
  68. #if DBG
  69. #define EnterAVCStrm(pMutex) \
  70. { \
  71. KeWaitForMutexObject(pMutex, Executive, KernelMode, FALSE, NULL);\
  72. InterlockedIncrement(&MSDVCRMutextUseCount);\
  73. }
  74. #define LeaveAVCStrm(pMutex) \
  75. { \
  76. KeReleaseMutex(pMutex, FALSE);\
  77. InterlockedDecrement(&MSDVCRMutextUseCount);\
  78. }
  79. #else
  80. #define EnterAVCStrm(pMutex) KeWaitForMutexObject(pMutex, Executive, KernelMode, FALSE, NULL);
  81. #define LeaveAVCStrm(pMutex) KeReleaseMutex(pMutex, FALSE);
  82. #endif
  83. //
  84. // DV format tables
  85. //
  86. typedef struct _STREAM_INFO_AND_OBJ {
  87. HW_STREAM_INFORMATION hwStreamInfo;
  88. HW_STREAM_OBJECT hwStreamObject;
  89. } STREAM_INFO_AND_OBJ, *PSTREAM_INFO_AND_OBJ;
  90. // All CIP sizes are in quads. The upper third byte is the size.
  91. #define CIP_HDR_FMT_DV 0x00
  92. #define CIP_HDR_FMT_DVCPRO 0x1e
  93. //
  94. // 1394 stuff
  95. //
  96. #define SPEED_100_INDEX 0
  97. #define SPEED_200_INDEX 1
  98. #define SPEED_400_INDEX 2
  99. #define CIP_DBS_SD_DVCR 120 // quadlets in a data block of the SD DVCR; BlueBook Part 2
  100. #define CIP_DBS_HD_DVCR 240 // quadlets in a data block of the HD DVCR; BlueBook Part 3
  101. #define CIP_DBS_SDL_DVCR 108 // quadlets in a data block of the SDL DVCR; BlueBook Part 5
  102. #define CIP_FN_SD_DVCR 0 // Data blocks in a source pacaket of SD DVCR; BlueBook Part 2
  103. #define CIP_FN_HD_DVCR 0 // Data blocks in a source pacaket of HD DVCR; BlueBook Part 3
  104. #define CIP_FN_SDL_DVCR 0 // Data blocks in a source pacaket of SDL DVCR; BlueBook Part 5
  105. #define MAX_FCP_PAYLOAD_SIZE 512
  106. // CIP header definition:
  107. // FMT: "Blue book" Part 1, page 25, Table 3; DVCR:000000
  108. #define FMT_DVCR 0x80 // 10:FMT(00:0000)
  109. #define FMT_DVCR_CANON 0x20 // 10:FMT(00:0000); but Canon return 00:FMT(10:0000)
  110. #define FMT_MPEG 0xa0 // 10:FMT(10:0000)
  111. // FDF
  112. #define FDF0_50_60_MASK 0x80
  113. #define FDF0_50_60_PAL 0x80
  114. #define FDF0_50_60_NTSC 0x00
  115. #define FDF0_STYPE_MASK 0x7c
  116. #define FDF0_STYPE_SD_DVCR 0x00 // STYPE: 000:00
  117. #define FDF0_STYPE_SDL_DVCR 0x04 // STYPE: 000:01
  118. #define FDF0_STYPE_HD_DVCR 0x08 // STYPE: 000:10
  119. #define FDF0_STYPE_SD_DVCPRO 0x78 // STYPE: 111:10
  120. // PCR constants
  121. #define PCR_OVERHEAD_ID_SDDV_DEF 0xf // 480; delays caused by IEEE 1394 bus parmeters
  122. #define PCR_PAYLOAD_SDDV_DEF 122 // Fixed: 122 * 4 = 480 + 8
  123. #define PCR_OVERHEAD_ID_MPEG2TS_DEF 0xf // 480; delays caused by IEEE 1394 bus parmeters
  124. #define PCR_PAYLOAD_MPEG2TS_DEF 146 // Variable but this is based on oPCR of a Panasonic's D-VHS
  125. //
  126. // FCP and AVCC stuff. Used in conjunction with defs in 1394.h
  127. //
  128. // DVCR:
  129. #define SUBUNIT_TYPE_CAMCORDER 4
  130. #define SUBUNIT_ID_CAMCORDER 0
  131. #define DIF_SEQS_PER_NTSC_FRAME 10
  132. #define DIF_SEQS_PER_PAL_FRAME 12
  133. #define SRC_PACKETS_PER_NTSC_FRAME 250
  134. #define SRC_PACKETS_PER_PAL_FRAME 300
  135. #define NUM_OF_RCV_BUFFERS_DV 8
  136. #define NUM_OF_XMT_BUFFERS_DV 8
  137. // MPEG2TS
  138. #define MPEG2TS_STRIDE_OFFSET 4 // 4 byte of SPH
  139. #define MPEG2TS_STRIDE_PACKET_LEN 188 // standard 188-byte packet
  140. #define MPEG2TS_STRIDE_STRIDE_LEN (MPEG2TS_STRIDE_OFFSET+MPEG2TS_STRIDE_PACKET_LEN) // Stride packet length
  141. //
  142. // Data buffers
  143. //
  144. #define NUM_BUF_ATTACHED_THEN_ISOCH 4 // number of buffers attached before streaming and also as the water mark.
  145. #define DV_NUM_EXTRA_USER_XMT_BUFFERS 12 // Extra user buffers that the data source can send to us as a read ahead.
  146. #define DV_NUM_OF_XMT_BUFFERS (NUM_BUF_ATTACHED_THEN_ISOCH + DV_NUM_EXTRA_USER_XMT_BUFFERS)
  147. //
  148. // The "signature" of the header section of Seq0 of incoming source packets:
  149. //
  150. // "Blue" book, Part2, 11.4 (page 50); Figure 66, table 36 (page 111)
  151. //
  152. // ID0 = {SCT2,SCT1,SCT0,RSV,Seq3,Seq2,Seq1,Seq0} = {0,0,0,1, 1,1,1,1} = 0x1f
  153. //
  154. // SCT2-0 = {0,0,0}
  155. // RSV = {1}
  156. // Seq3-0 = {1,1,1,1} for NoInfo or {0,0,0,} for Sequence 0
  157. //
  158. // ID1 = {DSeq3-0, 0, RSV, RSV, RSV} = {0,0,0,0, 0,1,1,1} = 0x07
  159. // DSeq3-0 = {0, 0, 0, 0} // Start from seq 0
  160. //
  161. #define ID0_SEQ0_HEADER_MASK 0xf0 // 11110000 Seq3-0 = xxxx Don't care!; check only SCT2-0:000 and RSV:1
  162. #define ID0_SEQ0_HEADER_NO_INFO 0x1f // 00011111 Seq3-0 = 1111 no data (Most of Consumer DV)
  163. #define ID0_SEQ0_HEADER_0000 0x10 // 00010000 Seq3-0 = 0000 sequence 0 (DVCPRO)
  164. #define ID1_SEQ0_HEADER 0x07 // 00000111
  165. //
  166. // AV/C command response data definition
  167. //
  168. #define AVC_SUBTYPE_MASK 0xf8
  169. #define AVC_DEVICE_TAPE_REC 0x20 // 00100:000
  170. #define AVC_DEVICE_CAMERA 0x38 // 00111:000
  171. #define AVC_DEVICE_TUNER 0x28 // 00101:000
  172. #define AVC_DEVICE_UNKNOWN 0xff // 11111:111
  173. //
  174. // GUID definitions for pins and DV format types.
  175. //
  176. // DV vid only output pin
  177. #define STATIC_PINNAME_DV_VID_OUTPUT \
  178. 0x5b21c540L, 0x7aee, 0x11d1, 0x88, 0x3b, 0x00, 0x60, 0x97, 0xf0, 0x5c, 0x70
  179. DEFINE_GUIDSTRUCT("5b21c540-7aee-11d1-883b-006097f05c70", PINNAME_DV_VID_OUTPUT);
  180. #define PINNAME_DV_VID_OUTPUT DEFINE_GUIDNAMED(PINNAME_DV_VID_OUTPUT)
  181. #define PINNAME_VID_OUT PINNAME_DV_VID_OUTPUT
  182. // DV A/V output pin
  183. #define STATIC_PINNAME_DV_AV_OUTPUT \
  184. 0x5b21c541L, 0x7aee, 0x11d1, 0x88, 0x3b, 0x00, 0x60, 0x97, 0xf0, 0x5c, 0x70
  185. DEFINE_GUIDSTRUCT("5b21c540-7aee-11d1-883b-006097f05c70", PINNAME_DV_AV_OUTPUT);
  186. #define PINNAME_DV_AV_OUTPUT DEFINE_GUIDNAMED(PINNAME_DV_AV_OUTPUT)
  187. #define PINNAME_AV_OUTPUT PINNAME_DV_AV_OUTPUT
  188. // DV A/V input pin
  189. #define STATIC_PINNAME_DV_AV_INPUT \
  190. 0x5b21c543L, 0x7aee, 0x11d1, 0x88, 0x3b, 0x00, 0x60, 0x97, 0xf0, 0x5c, 0x70
  191. DEFINE_GUIDSTRUCT("5b21c543-7aee-11d1-883b-006097f05c70", PINNAME_DV_AV_INPUT);
  192. #define PINNAME_DV_AV_INPUT DEFINE_GUIDNAMED(PINNAME_DV_AV_INPUT)
  193. #define PINNAME_AV_INPUT PINNAME_DV_AV_INPUT
  194. // MPEG2TS Output pin
  195. #define STATIC_PINNAME_MPEG2TS_OUTPUT \
  196. 0x2CFF7B83L, 0x96F1, 0x47e3, 0x98, 0xEC, 0x57, 0xBD, 0x8A, 0x99, 0x72, 0x15
  197. DEFINE_GUIDSTRUCT("2CFF7B83-96F1-47e3-98EC-57BD8A997215", PINNAME_MPEG2TS_OUTPUT);
  198. #define PINNAME_MPEG2TS_OUTPUT DEFINE_GUIDNAMED(PINNAME_MPEG2TS_OUTPUT)
  199. #define PINNAME_AV_MPEG2TS_OUTPUT PINNAME_MPEG2TS_OUTPUT
  200. // MPEG2TS Input pin
  201. #define STATIC_PINNAME_MPEG2TS_INPUT \
  202. 0xCF4C59A3L, 0xACE3, 0x444B, 0x8C, 0x37, 0xB, 0x22, 0x66, 0x1A, 0x4A, 0x29
  203. DEFINE_GUIDSTRUCT("CF4C59A3-ACE3-444b-8C37-0B22661A4A29", PINNAME_MPEG2TS_INPUT);
  204. #define PINNAME_MPEG2TS_INPUT DEFINE_GUIDNAMED(PINNAME_MPEG2TS_INPUT)
  205. #define PINNAME_AV_MPEG2TS_INPUT PINNAME_MPEG2TS_INPUT
  206. #endif