home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / dvdmedia.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  14KB  |  365 lines

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