Source code of Windows XP (NT5)
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.

418 lines
17 KiB

  1. //------------------------------------------------------------------------------
  2. // File: DVDMedia.h
  3. //
  4. // Desc: Contains typedefs and defines necessary for user mode (ring 3) DVD
  5. // filters and applications.
  6. //
  7. // This should be included in the DirectShow SDK for user mode filters.
  8. // The types defined here should be kept in synch with ksmedia.h WDM
  9. // DDK for kernel mode filters.
  10. //
  11. // Copyright (c) 1997 - 2000, Microsoft Corporation. All rights reserved.
  12. //------------------------------------------------------------------------------
  13. #ifndef __DVDMEDIA_H__
  14. #define __DVDMEDIA_H__
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif // __cplusplus
  18. // -----------------------------------------------------------------------
  19. // AC-3 definition for the AM_KSPROPSETID_AC3 property set
  20. // -----------------------------------------------------------------------
  21. typedef enum {
  22. AM_PROPERTY_AC3_ERROR_CONCEALMENT = 1,
  23. AM_PROPERTY_AC3_ALTERNATE_AUDIO = 2,
  24. AM_PROPERTY_AC3_DOWNMIX = 3,
  25. AM_PROPERTY_AC3_BIT_STREAM_MODE = 4,
  26. AM_PROPERTY_AC3_DIALOGUE_LEVEL = 5,
  27. AM_PROPERTY_AC3_LANGUAGE_CODE = 6,
  28. AM_PROPERTY_AC3_ROOM_TYPE = 7
  29. } AM_PROPERTY_AC3;
  30. typedef struct {
  31. BOOL fRepeatPreviousBlock;
  32. BOOL fErrorInCurrentBlock;
  33. } AM_AC3_ERROR_CONCEALMENT, *PAM_AC3_ERROR_CONCEALMENT;
  34. typedef struct {
  35. BOOL fStereo;
  36. ULONG DualMode;
  37. } AM_AC3_ALTERNATE_AUDIO, *PAM_AC3_ALTERNATE_AUDIO;
  38. #define AM_AC3_ALTERNATE_AUDIO_1 1
  39. #define AM_AC3_ALTERNATE_AUDIO_2 2
  40. #define AM_AC3_ALTERNATE_AUDIO_BOTH 3
  41. typedef struct {
  42. BOOL fDownMix;
  43. BOOL fDolbySurround;
  44. } AM_AC3_DOWNMIX, *PAM_AC3_DOWNMIX;
  45. typedef struct {
  46. LONG BitStreamMode;
  47. } AM_AC3_BIT_STREAM_MODE, *PAM_AC3_BIT_STREAM_MODE;
  48. #define AM_AC3_SERVICE_MAIN_AUDIO 0
  49. #define AM_AC3_SERVICE_NO_DIALOG 1
  50. #define AM_AC3_SERVICE_VISUALLY_IMPAIRED 2
  51. #define AM_AC3_SERVICE_HEARING_IMPAIRED 3
  52. #define AM_AC3_SERVICE_DIALOG_ONLY 4
  53. #define AM_AC3_SERVICE_COMMENTARY 5
  54. #define AM_AC3_SERVICE_EMERGENCY_FLASH 6
  55. #define AM_AC3_SERVICE_VOICE_OVER 7
  56. typedef struct {
  57. ULONG DialogueLevel;
  58. } AM_AC3_DIALOGUE_LEVEL, *PAM_AC3_DIALOGUE_LEVEL;
  59. typedef struct {
  60. BOOL fLargeRoom;
  61. } AM_AC3_ROOM_TYPE, *PAM_AC3_ROOM_TYPE;
  62. // -----------------------------------------------------------------------
  63. // subpicture definition for the AM_KSPROPSETID_DvdSubPic property set
  64. // -----------------------------------------------------------------------
  65. typedef enum {
  66. AM_PROPERTY_DVDSUBPIC_PALETTE = 0,
  67. AM_PROPERTY_DVDSUBPIC_HLI = 1,
  68. AM_PROPERTY_DVDSUBPIC_COMPOSIT_ON = 2 // TRUE for subpicture is displayed
  69. } AM_PROPERTY_DVDSUBPIC;
  70. typedef struct _AM_DVD_YUV {
  71. UCHAR Reserved;
  72. UCHAR Y;
  73. UCHAR U;
  74. UCHAR V;
  75. } AM_DVD_YUV, *PAM_DVD_YUV;
  76. typedef struct _AM_PROPERTY_SPPAL {
  77. AM_DVD_YUV sppal[16];
  78. } AM_PROPERTY_SPPAL, *PAM_PROPERTY_SPPAL;
  79. typedef struct _AM_COLCON {
  80. UCHAR emph1col:4;
  81. UCHAR emph2col:4;
  82. UCHAR backcol:4;
  83. UCHAR patcol:4;
  84. UCHAR emph1con:4;
  85. UCHAR emph2con:4;
  86. UCHAR backcon:4;
  87. UCHAR patcon:4;
  88. } AM_COLCON, *PAM_COLCON;
  89. typedef struct _AM_PROPERTY_SPHLI {
  90. USHORT HLISS; //
  91. USHORT Reserved;
  92. ULONG StartPTM; // start presentation time in x/90000
  93. ULONG EndPTM; // end PTM in x/90000
  94. USHORT StartX;
  95. USHORT StartY;
  96. USHORT StopX;
  97. USHORT StopY;
  98. AM_COLCON ColCon; // color contrast description (4 bytes as given in HLI)
  99. } AM_PROPERTY_SPHLI, *PAM_PROPERTY_SPHLI;
  100. typedef BOOL AM_PROPERTY_COMPOSIT_ON, *PAM_PROPERTY_COMPOSIT_ON;
  101. // -----------------------------------------------------------------------
  102. // copy protection definitions
  103. // -----------------------------------------------------------------------
  104. // AM_UseNewCSSKey for the dwTypeSpecificFlags in IMediaSample2 to indicate
  105. // the exact point in a stream after which to start applying a new CSS key.
  106. // This is typically sent on an empty media sample just before attempting
  107. // to renegotiate a CSS key.
  108. #define AM_UseNewCSSKey 0x1
  109. //
  110. // AM_KSPROPSETID_CopyProt property set definitions
  111. //
  112. typedef enum {
  113. AM_PROPERTY_DVDCOPY_CHLG_KEY = 0x01,
  114. AM_PROPERTY_DVDCOPY_DVD_KEY1 = 0x02,
  115. AM_PROPERTY_DVDCOPY_DEC_KEY2 = 0x03,
  116. AM_PROPERTY_DVDCOPY_TITLE_KEY = 0x04,
  117. AM_PROPERTY_COPY_MACROVISION = 0x05,
  118. AM_PROPERTY_DVDCOPY_REGION = 0x06,
  119. AM_PROPERTY_DVDCOPY_SET_COPY_STATE = 0x07,
  120. AM_PROPERTY_DVDCOPY_DISC_KEY = 0x80
  121. } AM_PROPERTY_DVDCOPYPROT;
  122. typedef struct _AM_DVDCOPY_CHLGKEY {
  123. BYTE ChlgKey[10];
  124. BYTE Reserved[2];
  125. } AM_DVDCOPY_CHLGKEY, *PAM_DVDCOPY_CHLGKEY;
  126. typedef struct _AM_DVDCOPY_BUSKEY {
  127. BYTE BusKey[5];
  128. BYTE Reserved[1];
  129. } AM_DVDCOPY_BUSKEY, *PAM_DVDCOPY_BUSKEY;
  130. typedef struct _AM_DVDCOPY_DISCKEY {
  131. BYTE DiscKey[2048];
  132. } AM_DVDCOPY_DISCKEY, *PAM_DVDCOPY_DISCKEY;
  133. typedef struct AM_DVDCOPY_TITLEKEY {
  134. ULONG KeyFlags;
  135. ULONG Reserved1[2];
  136. UCHAR TitleKey[6];
  137. UCHAR Reserved2[2];
  138. } AM_DVDCOPY_TITLEKEY, *PAM_DVDCOPY_TITLEKEY;
  139. typedef struct _AM_COPY_MACROVISION {
  140. ULONG MACROVISIONLevel;
  141. } AM_COPY_MACROVISION, *PAM_COPY_MACROVISION;
  142. typedef struct AM_DVDCOPY_SET_COPY_STATE {
  143. ULONG DVDCopyState;
  144. } AM_DVDCOPY_SET_COPY_STATE, *PAM_DVDCOPY_SET_COPY_STATE;
  145. typedef enum {
  146. AM_DVDCOPYSTATE_INITIALIZE = 0,
  147. AM_DVDCOPYSTATE_INITIALIZE_TITLE = 1, // indicates we are starting a title
  148. // key copy protection sequence
  149. AM_DVDCOPYSTATE_AUTHENTICATION_NOT_REQUIRED = 2,
  150. AM_DVDCOPYSTATE_AUTHENTICATION_REQUIRED = 3,
  151. AM_DVDCOPYSTATE_DONE = 4
  152. } AM_DVDCOPYSTATE;
  153. typedef enum {
  154. AM_MACROVISION_DISABLED = 0,
  155. AM_MACROVISION_LEVEL1 = 1,
  156. AM_MACROVISION_LEVEL2 = 2,
  157. AM_MACROVISION_LEVEL3 = 3
  158. } AM_COPY_MACROVISION_LEVEL, *PAM_COPY_MACROVISION_LEVEL;
  159. // CSS region stucture
  160. typedef struct _DVD_REGION {
  161. UCHAR CopySystem;
  162. UCHAR RegionData;
  163. UCHAR SystemRegion;
  164. UCHAR Reserved;
  165. } DVD_REGION, *PDVD_REGION;
  166. //
  167. // CGMS Copy Protection Flags
  168. //
  169. #define AM_DVD_CGMS_RESERVED_MASK 0x00000078
  170. #define AM_DVD_CGMS_COPY_PROTECT_MASK 0x00000018
  171. #define AM_DVD_CGMS_COPY_PERMITTED 0x00000000
  172. #define AM_DVD_CGMS_COPY_ONCE 0x00000010
  173. #define AM_DVD_CGMS_NO_COPY 0x00000018
  174. #define AM_DVD_COPYRIGHT_MASK 0x00000040
  175. #define AM_DVD_NOT_COPYRIGHTED 0x00000000
  176. #define AM_DVD_COPYRIGHTED 0x00000040
  177. #define AM_DVD_SECTOR_PROTECT_MASK 0x00000020
  178. #define AM_DVD_SECTOR_NOT_PROTECTED 0x00000000
  179. #define AM_DVD_SECTOR_PROTECTED 0x00000020
  180. // -----------------------------------------------------------------------
  181. // video format blocks
  182. // -----------------------------------------------------------------------
  183. enum AM_MPEG2Level {
  184. AM_MPEG2Level_Low = 1,
  185. AM_MPEG2Level_Main = 2,
  186. AM_MPEG2Level_High1440 = 3,
  187. AM_MPEG2Level_High = 4
  188. };
  189. enum AM_MPEG2Profile {
  190. AM_MPEG2Profile_Simple = 1,
  191. AM_MPEG2Profile_Main = 2,
  192. AM_MPEG2Profile_SNRScalable = 3,
  193. AM_MPEG2Profile_SpatiallyScalable = 4,
  194. AM_MPEG2Profile_High = 5
  195. };
  196. #define AMINTERLACE_IsInterlaced 0x00000001 // if 0, other interlace bits are irrelevent
  197. #define AMINTERLACE_1FieldPerSample 0x00000002 // else 2 fields per media sample
  198. #define AMINTERLACE_Field1First 0x00000004 // else Field 2 is first; top field in PAL is field 1, top field in NTSC is field 2?
  199. #define AMINTERLACE_UNUSED 0x00000008 //
  200. #define AMINTERLACE_FieldPatternMask 0x00000030 // use this mask with AMINTERLACE_FieldPat*
  201. #define AMINTERLACE_FieldPatField1Only 0x00000000 // stream never contains a Field2
  202. #define AMINTERLACE_FieldPatField2Only 0x00000010 // stream never contains a Field1
  203. #define AMINTERLACE_FieldPatBothRegular 0x00000020 // There will be a Field2 for every Field1 (required for Weave?)
  204. #define AMINTERLACE_FieldPatBothIrregular 0x00000030 // Random pattern of Field1s and Field2s
  205. #define AMINTERLACE_DisplayModeMask 0x000000c0
  206. #define AMINTERLACE_DisplayModeBobOnly 0x00000000
  207. #define AMINTERLACE_DisplayModeWeaveOnly 0x00000040
  208. #define AMINTERLACE_DisplayModeBobOrWeave 0x00000080
  209. #define AMCOPYPROTECT_RestrictDuplication 0x00000001 // duplication of this stream should be restricted
  210. #define AMMPEG2_DoPanScan 0x00000001 //if set, the MPEG-2 video decoder should crop output image
  211. // based on pan-scan vectors in picture_display_extension
  212. // and change the picture aspect ratio accordingly.
  213. #define AMMPEG2_DVDLine21Field1 0x00000002 //if set, the MPEG-2 decoder must be able to produce an output
  214. // pin for DVD style closed caption data found in GOP layer of field 1
  215. #define AMMPEG2_DVDLine21Field2 0x00000004 //if set, the MPEG-2 decoder must be able to produce an output
  216. // pin for DVD style closed caption data found in GOP layer of field 2
  217. #define AMMPEG2_SourceIsLetterboxed 0x00000008 //if set, indicates that black bars have been encoded in the top
  218. // and bottom of the video.
  219. #define AMMPEG2_FilmCameraMode 0x00000010 //if set, indicates "film mode" used for 625/50 content. If cleared,
  220. // indicates that "camera mode" was used.
  221. #define AMMPEG2_LetterboxAnalogOut 0x00000020 //if set and this stream is sent to an analog output, it should
  222. // be letterboxed. Streams sent to VGA should be letterboxed only by renderers.
  223. #define AMMPEG2_DSS_UserData 0x00000040 //if set, the MPEG-2 decoder must process DSS style user data
  224. #define AMMPEG2_DVB_UserData 0x00000080 //if set, the MPEG-2 decoder must process DVB style user data
  225. #define AMMPEG2_27MhzTimebase 0x00000100 //if set, the PTS,DTS timestamps advance at 27MHz rather than 90KHz
  226. #define AMMPEG2_WidescreenAnalogOut 0x00000200 //if set and this stream is sent to an analog output, it should
  227. // be in widescreen format (4x3 content should be centered on a 16x9 output).
  228. // Streams sent to VGA should be widescreened only by renderers.
  229. // PRESENT in dwReserved1 field in VIDEOINFOHEADER2
  230. #define AMCONTROL_USED 0x00000001 // Used to test if these flags are supported. Set and test for AcceptMediaType.
  231. // If rejected, then you cannot use the AMCONTROL flags (send 0 for dwReserved1)
  232. #define AMCONTROL_PAD_TO_4x3 0x00000002 // if set means display the image in a 4x3 area
  233. #define AMCONTROL_PAD_TO_16x9 0x00000004 // if set means display the image in a 16x9 area
  234. typedef struct tagVIDEOINFOHEADER2 {
  235. RECT rcSource;
  236. RECT rcTarget;
  237. DWORD dwBitRate;
  238. DWORD dwBitErrorRate;
  239. REFERENCE_TIME AvgTimePerFrame;
  240. DWORD dwInterlaceFlags; // use AMINTERLACE_* defines. Reject connection if undefined bits are not 0
  241. DWORD dwCopyProtectFlags; // use AMCOPYPROTECT_* defines. Reject connection if undefined bits are not 0
  242. DWORD dwPictAspectRatioX; // X dimension of picture aspect ratio, e.g. 16 for 16x9 display
  243. DWORD dwPictAspectRatioY; // Y dimension of picture aspect ratio, e.g. 9 for 16x9 display
  244. union {
  245. DWORD dwControlFlags; // use AMCONTROL_* defines, use this from now on
  246. DWORD dwReserved1; // for backward compatiblity (was "must be 0"; connection rejected otherwise)
  247. };
  248. DWORD dwReserved2; // must be 0; reject connection otherwise
  249. BITMAPINFOHEADER bmiHeader;
  250. } VIDEOINFOHEADER2;
  251. typedef struct tagMPEG2VIDEOINFO {
  252. VIDEOINFOHEADER2 hdr;
  253. DWORD dwStartTimeCode; // ?? not used for DVD ??
  254. DWORD cbSequenceHeader; // is 0 for DVD (no sequence header)
  255. DWORD dwProfile; // use enum MPEG2Profile
  256. DWORD dwLevel; // use enum MPEG2Level
  257. DWORD dwFlags; // use AMMPEG2_* defines. Reject connection if undefined bits are not 0
  258. DWORD dwSequenceHeader[1]; // DWORD instead of Byte for alignment purposes
  259. // For MPEG-2, if a sequence_header is included, the sequence_extension
  260. // should also be included
  261. } MPEG2VIDEOINFO;
  262. #define SIZE_MPEG2VIDEOINFO(pv) (FIELD_OFFSET(MPEG2VIDEOINFO, dwSequenceHeader[0]) + (pv)->cbSequenceHeader)
  263. // do not use
  264. #define MPEG1_SEQUENCE_INFO(pv) ((const BYTE *)(pv)->bSequenceHeader)
  265. // use this macro instead, the previous only works for MPEG1VIDEOINFO structures
  266. #define MPEG2_SEQUENCE_INFO(pv) ((const BYTE *)(pv)->dwSequenceHeader)
  267. //===================================================================================
  268. // flags for dwTypeSpecificFlags in AM_SAMPLE2_PROPERTIES which define type specific
  269. // data in IMediaSample2
  270. //===================================================================================
  271. #define AM_VIDEO_FLAG_FIELD_MASK 0x0003L // use this mask to check whether the sample is field1 or field2 or frame
  272. #define AM_VIDEO_FLAG_INTERLEAVED_FRAME 0x0000L // the sample is a frame (remember to use AM_VIDEO_FLAG_FIELD_MASK when using this)
  273. #define AM_VIDEO_FLAG_FIELD1 0x0001L // the sample is field1 (remember to use AM_VIDEO_FLAG_FIELD_MASK when using this)
  274. #define AM_VIDEO_FLAG_FIELD2 0x0002L // the sample is the field2 (remember to use AM_VIDEO_FLAG_FIELD_MASK when using this)
  275. #define AM_VIDEO_FLAG_FIELD1FIRST 0x0004L // if set means display field1 first, else display field2 first.
  276. // this bit is irrelavant for 1FieldPerSample mode
  277. #define AM_VIDEO_FLAG_WEAVE 0x0008L // if set use bob display mode else weave
  278. #define AM_VIDEO_FLAG_IPB_MASK 0x0030L // use this mask to check whether the sample is I, P or B
  279. #define AM_VIDEO_FLAG_I_SAMPLE 0x0000L // I Sample (remember to use AM_VIDEO_FLAG_IPB_MASK when using this)
  280. #define AM_VIDEO_FLAG_P_SAMPLE 0x0010L // P Sample (remember to use AM_VIDEO_FLAG_IPB_MASK when using this)
  281. #define AM_VIDEO_FLAG_B_SAMPLE 0x0020L // B Sample (remember to use AM_VIDEO_FLAG_IPB_MASK when using this)
  282. #define AM_VIDEO_FLAG_REPEAT_FIELD 0x0040L // if set means display the field which has been displayed first again after displaying
  283. // both fields first. This bit is irrelavant for 1FieldPerSample mode
  284. // -----------------------------------------------------------------------
  285. // AM_KSPROPSETID_DvdKaraoke property set definitions
  286. // -----------------------------------------------------------------------
  287. typedef struct tagAM_DvdKaraokeData
  288. {
  289. DWORD dwDownmix; // bitwise OR of AM_DvdKaraoke_Downmix flags
  290. DWORD dwSpeakerAssignment; // AM_DvdKaraoke_SpeakerAssignment
  291. } AM_DvdKaraokeData;
  292. typedef enum {
  293. AM_PROPERTY_DVDKARAOKE_ENABLE = 0, // BOOL
  294. AM_PROPERTY_DVDKARAOKE_DATA = 1,
  295. } AM_PROPERTY_DVDKARAOKE;
  296. // -----------------------------------------------------------------------
  297. // AM_KSPROPSETID_TSRateChange property set definitions for time stamp
  298. // rate changes.
  299. // -----------------------------------------------------------------------
  300. typedef enum {
  301. AM_RATE_SimpleRateChange = 1, // rw, use AM_SimpleRateChange
  302. AM_RATE_ExactRateChange = 2, // rw, use AM_ExactRateChange
  303. AM_RATE_MaxFullDataRate = 3, // r, use AM_MaxFullDataRate
  304. AM_RATE_Step = 4 // w, use AM_Step
  305. } AM_PROPERTY_TS_RATE_CHANGE;
  306. // -------------------------------------------------------------------
  307. // AM_KSPROPSETID_DVD_RateChange property set definitions for new DVD
  308. // rate change scheme.
  309. // -------------------------------------------------------------------
  310. typedef enum {
  311. AM_RATE_ChangeRate = 1, // w, use AM_DVD_ChangeRate
  312. AM_RATE_FullDataRateMax = 2, // r, use AM_MaxFullDataRate
  313. AM_RATE_ReverseDecode = 3, // r, use LONG
  314. AM_RATE_DecoderPosition = 4, // r, use AM_DVD_DecoderPosition
  315. AM_RATE_DecoderVersion = 5 // r, use LONG
  316. } AM_PROPERTY_DVD_RATE_CHANGE;
  317. typedef struct {
  318. // this is the simplest mechanism to set a time stamp rate change on
  319. // a filter (simplest for the person setting the rate change, harder
  320. // for the filter doing the rate change).
  321. REFERENCE_TIME StartTime; //stream time at which to start this rate
  322. LONG Rate; //new rate * 10000 (decimal)
  323. } AM_SimpleRateChange;
  324. typedef struct {
  325. REFERENCE_TIME OutputZeroTime; //input TS that maps to zero output TS
  326. LONG Rate; //new rate * 10000 (decimal)
  327. } AM_ExactRateChange;
  328. typedef LONG AM_MaxFullDataRate; //rate * 10000 (decimal)
  329. typedef DWORD AM_Step; // number of frame to step
  330. // New rate change property set, structs. enums etc.
  331. typedef struct {
  332. REFERENCE_TIME StartInTime; // stream time (input) at which to start decoding at this rate
  333. REFERENCE_TIME StartOutTime; // reference time (output) at which to start showing at this rate
  334. LONG Rate; // new rate * 10000 (decimal)
  335. } AM_DVD_ChangeRate ;
  336. typedef LONGLONG AM_DVD_DecoderPosition ;
  337. typedef enum {
  338. DVD_DIR_FORWARD = 0,
  339. DVD_DIR_BACKWARD = 1
  340. } DVD_PLAY_DIRECTION ;
  341. #ifdef __cplusplus
  342. }
  343. #endif // __cplusplus
  344. #endif // __DVDMEDIA_H__