home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / cset21v6.zip / MMPM2TK / TK / H / CODEC.H < prev    next >
C/C++ Source or Header  |  1993-04-27  |  20KB  |  456 lines

  1. /****************************************************************************/
  2. /*                                                                          */
  3. /* Module Name: CODEC.H                                                     */
  4. /*                                                                          */
  5. /* OS/2 2.0 Multimedia Extensions CODEC  Definitions file                   */
  6. /*                                                                          */
  7. /* Copyright (c) International Business Machines Corporation 1992, 1993,    */
  8. /*                        All Rights Reserved                               */
  9. /*                                                                          */
  10. /****************************************************************************/
  11.  
  12. #ifndef _CODEC_H_
  13. #define _CODEC_H_
  14.  
  15. /* XLATOFF */
  16. #pragma pack(4)
  17. /* XLATON */
  18.  
  19. /******************
  20.  * Defines:
  21.  ******************/
  22.  
  23. /* Ultimotion CODEC type for CODECINIFILEINFO ulCompressType */
  24. #define  FOURCC_ULTI       mmioFOURCC('U', 'L', 'T', 'I')
  25. #define  HEX_FOURCC_ULTI   0x49544C55L     /* ITLU */
  26.  
  27. /* Indeo CODEC type for CODECINIFILEINFO ulCompressType */
  28. #define  FOURCC_RT21       mmioFOURCC('R', 'T', '2', '1')
  29. #define  HEX_FOURCC_RT21   0x31325452L     /* 12TR */
  30.  
  31.  
  32.  
  33. /**********************************************
  34.  *
  35.  * GENPAL - Generic Header Palette
  36.  *
  37.  **********************************************/
  38. typedef struct _GENPAL {          /* genpal */
  39.    ULONG       ulStartIndex;      /* starting RGB index */
  40.    ULONG       ulNumColors;       /* number of following entries */
  41.    PRGB2       prgb2Entries;      /* 256 RGB entries */
  42.    } GENPAL;
  43. typedef GENPAL *PGENPAL;          /* Ptr to a generic palette */
  44.  
  45.  
  46. /**********************************************
  47.  *
  48.  * RECTL1 - Rectangle Structure (TEMP - h2inc problem)
  49.  *
  50.  **********************************************/
  51. typedef struct _RECTL1 {          /* rcl1 */
  52.     LONG  xLeft;
  53.     LONG  yBottom;
  54.     LONG  xRight;
  55.     LONG  yTop;
  56. } RECTL1;
  57. typedef RECTL1 *PRECTL1;
  58.  
  59.  
  60. /**********************************************
  61.  *
  62.  * CODECVIDEOHEADER - CODEC video Header
  63.  *
  64.  **********************************************/
  65. typedef struct _CODECVIDEOHEADER {  /* codecvidhdr */
  66.    ULONG  ulStructLen;
  67.    ULONG  cx;
  68.    ULONG  cy;
  69.    USHORT cPlanes;
  70.    USHORT cBitCount;
  71.    ULONG  ulColorEncoding;
  72.    GENPAL genpal;
  73. } CODECVIDEOHEADER;
  74. typedef CODECVIDEOHEADER *PCODECVIDEOHEADER;
  75.  
  76. /* ulColorEncoding defines: */
  77. #define  MMIO_RGB_5_6_5    0x0001L  /* Each pixel is a RGB_5_6_5 datatype */
  78. #define  MMIO_RGB_24       0x0002L  /* Each pixel is a RGB_24 datatype */
  79. #define  MMIO_YUV_4_1_1    0x0004L  /* Each pixel is a YUV_4_1_1 datatype */
  80. #define  MMIO_COMPRESSED   0x0008L  /* The data is compressed */
  81. #define  MMIO_YUV_24       0x0010L  /* Each pixel is a YUV_24 datatype */
  82. #define  MMIO_PALETTIZED   0x0020L  /* The data is palettized */
  83.  
  84.  
  85. /**********************************************
  86.  *
  87.  * MMVIDEOOPEN - Video Open Structure
  88.  *
  89.  * This structure is passed on the CODEC open
  90.  * message when video compression is being done
  91.  * to indicate information such as quality,
  92.  * frame rate, data rate, and key frame rate.
  93.  *
  94.  * Quality:
  95.  *
  96.  * The ulQuality field specifies a scalar value
  97.  * in the range 0 - 10000, where 0 is the lowest
  98.  * quality and 10000 is the highest quality. A
  99.  * value of -1 specifies the default quality level,
  100.  * and the default quality level (e.g. 5000) is
  101.  * returned in the ulQuality field.
  102.  *
  103.  *
  104.  * Key Frame rate:
  105.  *
  106.  * The ulKeyFrameRate structure specifies the key
  107.  * frame (aka I-frame, reference frame) frequency.
  108.  * Every Nth frame is a key frame as specified.
  109.  * A value of zero specifies that no periodic key
  110.  * are to be compressed.  Additional key frames may
  111.  * be inserted at any point by specifying
  112.  * MMIO_IS_KEY_FRAME in the MMCOMPRESS structure.
  113.  *
  114.  * example:  ulKeyFrameRate = 5  results in:
  115.  *
  116.  *    key delta delta delta delta key delta delta delta delta key delta...
  117.  *
  118.  *
  119.  * Frame rate:
  120.  *
  121.  * Rate = number of time units per second
  122.  * Scale = number of time units per frame
  123.  *
  124.  * examples:  Rate = 30  Scale = 1     =>    30 FPS
  125.  *            Rate = 15  Scale = 1     =>    15 FPS
  126.  *            Rate = 25  Scale = 2     =>    12.5 FPS
  127.  *
  128.  *
  129.  * Data Constraint:
  130.  *
  131.  * Compressors which are capable of constraining the
  132.  * resultant compressed video data rate use the
  133.  * information in the ulDataConstraint and
  134.  * ulConstraintInterval fields.  A non-zero value
  135.  * in ulDataConstraint specifies the number of bytes
  136.  * which is not to be exceeded over an interval of
  137.  * frames in the output data stream, regardless of
  138.  * the requested quality level.  This value only
  139.  * considers video data, i.e. audio data and file format
  140.  * overhead must be considered seperately when determining
  141.  * the final output file data rate.  The interval of
  142.  * frames over which the data is constrained is specified
  143.  * in ulConstraintInterval.  A value of zero for
  144.  * ulDataContraint specifies that the data rate is not
  145.  * to be constrained and is to compressed according to
  146.  * the requested quality level.
  147.  *
  148.  * example 1:  ulDataConstraint = 150000   ulConstraintInterval = 15
  149.  *
  150.  *             This results in an output stream wherein the sizes of any 15
  151.  *             consecutive frames does not exceed 150000 bytes.  If the
  152.  *             frame rate is 15 FPS, the resultant data rate will not
  153.  *             exceed 150000 bytes per second.
  154.  *
  155.  * example 2:  ulDataConstraint = 10000    ulConstraintInterval = 1
  156.  *
  157.  *             This results in an output stream wherein any single frame
  158.  *             does not exceed 10000 bytes.  If the frame rate is 15 FPS,
  159.  *             the resultant data rate will not exceed 150000 bytes per
  160.  *             second.  Note the difference between this case and example 1
  161.  *             where individual frames may exceed 10000 bytes (the average)
  162.  *             so long other frames in any 15 frame sequence are sufficiently
  163.  *             smaller to satisfy the constraint within the constraint interval.
  164.  *
  165.  **********************************************/
  166. typedef struct _MMVIDEOOPEN  {      /* mmvidopen */
  167.    ULONG       ulStructLen;
  168.    ULONG       ulQuality;
  169.    ULONG       ulKeyFrameRate;
  170.    ULONG       ulScale;
  171.    ULONG       ulRate;
  172.    ULONG       ulDataConstraint;
  173.    ULONG       ulConstraintInterval;
  174.    } MMVIDEOOPEN;
  175. typedef MMVIDEOOPEN *PMMVIDEOOPEN;
  176.  
  177.  
  178. /**********************************************
  179.  *
  180.  * CODECOPEN - CODEC open structure
  181.  *
  182.  **********************************************/
  183. typedef struct _CODECOPEN  {        /* codecopen */
  184.    ULONG       ulFlags;             /* flags & events - Refer to ulCapsFlags in CODECINIFILEINFO */
  185.    PVOID       pControlHdr;         /* control header - (codec specific) */
  186.    PVOID       pSrcHdr;             /* source header - Ptr CODECVIDEOHEADER */
  187.    PVOID       pDstHdr;             /* destination header - Ptr CODECVIDEOHEADER */
  188.    PVOID       pOtherInfo;          /* other information - Ptr MMVIDEOOPEN */
  189.    } CODECOPEN;
  190. typedef CODECOPEN *PCODECOPEN;
  191.  
  192. #define VALID_CODECOPEN_INPUTFLAGS   (CODEC_DECOMPRESS |       \
  193.                                       CODEC_WINDOW_CLIPPING |  \
  194.                                       CODEC_PALETTE_TRANS |    \
  195.                                       CODEC_SELFHEAL |         \
  196.                                       CODEC_SCALE_PEL_DOUBLE | \
  197.                                       CODEC_SCALE_PEL_HALVED | \
  198.                                       CODEC_SCALE_CONTINUOUS | \
  199.                                       CODEC_MULAPERTURE |      \
  200.                                       CODEC_HARDWARE |         \
  201.                                       CODEC_DIRECT_DISPLAY)
  202.  
  203.  
  204. /**********************************************
  205.  *
  206.  * MMCOMPRESS - Compress structure
  207.  *
  208.  **********************************************/
  209. typedef struct _MMCOMPRESS  {     /* mmcomp */
  210.    ULONG       ulStructLen;       /* length of this structure */
  211.    ULONG       ulFlags;           /* command and status flags */
  212.    ULONG       ulSrcBufLen;       /* source buffer size */
  213.    PVOID       pSrcBuf;           /* source buffer */
  214.    ULONG       ulDstBufLen;       /* destination buffer length */
  215.    PVOID       pDstBuf;           /* destination buffer */
  216.    PVOID       pRunTimeInfo;      /* control information - Ptr MMVIDEOCOMPRESS */
  217.    } MMCOMPRESS;
  218. typedef MMCOMPRESS *PMMCOMPRESS;
  219.  
  220. /* ulFlags defines: (Defined below) */
  221. /* #define  MMIO_IS_KEY_FRAME 0x0001L */ /* This bit is set by the application */
  222.                                          /* to instruct the IOProc to compress */
  223.                                          /* the pSrcBuf into a key or reference */
  224.                                          /* frame. If the bit is not set, a delta */
  225.                                          /* frame is compressed. */
  226. /* #define  MMIO_IS_PALETTE    0x0002L */ /* A video palette is provided.  This is */
  227.                                           /* set by the application. */
  228.  
  229.  
  230. /**********************************************
  231.  *
  232.  * MMVIDEOCOMPRESS - Video Compress structure
  233.  *
  234.  **********************************************/
  235. typedef struct _MMVIDEOCOMPRESS { /* mmvidcomp */
  236.    ULONG       ulStructLen;       /* Structure length */
  237.    GENPAL      genpalVideo;       /* Video stream palette */
  238.    PVOID       pControlHdr;       /* control header (codec specific) */
  239.    } MMVIDEOCOMPRESS;
  240. typedef MMVIDEOCOMPRESS *PMMVIDEOCOMPRESS;
  241.  
  242.  
  243. /**********************************************
  244.  *
  245.  * MMDECOMPRESS - Decompress Structure
  246.  *
  247.  **********************************************/
  248. typedef struct _MMDECOMPRESS  {   /* mmdec */
  249.    ULONG       ulStructLen;       /* length of this structure */
  250.    ULONG       ulFlags;           /* command and status flags */
  251.    ULONG       ulSrcBufLen;       /* source buffer size */
  252.    PVOID       pSrcBuf;           /* source buffer */
  253.    ULONG       ulDstBufLen;       /* destination buffer length */
  254.    PVOID       pDstBuf;           /* destination buffer */
  255.    PVOID       pRunTimeInfo;      /* control information Ptr to MMVIDEODECOMPRESS */
  256.    } MMDECOMPRESS;
  257. typedef MMDECOMPRESS *PMMDECOMPRESS;
  258.  
  259. /* ulFlags defines: */
  260. #define MMIO_DROP_DELTA_FRAME 0x0001L /* Input/Output - Tells the IOProc to drop the delta */
  261.                                       /* frame if the pSrcBuf contains a delta */
  262.                                       /* frame.  On return, the bit is reset */
  263.                                       /* if the delta frame is dropped. */
  264. #define MMIO_IS_KEY_FRAME     0x0002L /* Output - This bit is set by the IOProc when */
  265.                                       /* the data contained in the pSrcBuf is */
  266.                                       /* a key or reference frame. */
  267. #define MMIO_IS_PALETTE       0x0004L /* Output - A video palette has been found. */
  268.                                       /* This is set by the IOProc. */
  269. #define MMIO_PALETTE_CHANGE   0x0008L /* Input - The physical palette has been changed */
  270.                                       /* in...  This is set by the application. */
  271. #define MMIO_ORIGIN_LOWERLEFT 0x0010L /* Input - The video frame origin */
  272. #define MMIO_RECTL_CHANGE     0x0020L /* Input - The valid rectl list has changed. */
  273. #define MMIO_ORIGIN_UPPERLEFT 0x0040L /* Input - The video frame origin */
  274. #define MMIO_DROP_FRAME_DECODE 0x0080L /* Input - Tells the IOProc to drop decoding  */
  275.                                       /* of the frame.                         */
  276.  
  277. #define VALID_DECOMPRESS_INPUTFLAGS   (MMIO_DROP_DELTA_FRAME | \
  278.                                        MMIO_PALETTE_CHANGE |   \
  279.                                        MMIO_ORIGIN_LOWERLEFT | \
  280.                                        MMIO_RECTL_CHANGE |     \
  281.                                        MMIO_DROP_FRAME_DECODE | \
  282.                                        MMIO_ORIGIN_UPPERLEFT)
  283.  
  284.  
  285. /**********************************************
  286.  *
  287.  * MMVIDEODECOMPRESS - Video Decompress structure
  288.  *
  289.  **********************************************/
  290. typedef struct _MMVIDEODECOMPRESS {    /* mmviddec */
  291.    ULONG       ulStructLen;            /* Structure length */
  292.    ULONG       ulRectlCount;           /* Valid rectangle count - for clipping */
  293.    PRECTL1     prectl;                 /* Valid rectangle array - for clipping */
  294.    ULONG       ulSkipLength;           /* Skipped line length */
  295.    ULONG       ulDecodeLines;          /* Num of lines to decompress */
  296.    GENPAL      genpalPhysical;         /* Physical palette */
  297.    GENPAL      genpalVideo;            /* Video stream palette */
  298.    RECTL1      rectlSrc;               /* Source window rectangle */
  299.    RECTL1      rectlDst;               /* Destination window rectangle */
  300.    } MMVIDEODECOMPRESS;
  301. typedef MMVIDEODECOMPRESS *PMMVIDEODECOMPRESS;
  302.  
  303.  
  304. /*************************************************
  305.  *
  306.  * RECORDTAB - Record table
  307.  *
  308.  * NOTE: This structure maps to ESRCBUFTAB in ssm.h
  309.  *************************************************/
  310. typedef struct _RECORDTAB {       /* recordtab */
  311.    ULONG       ulReserved1;       /* reserved for system */
  312.    PVOID       pRecord;           /* ptr to record in buffer */
  313.    ULONG       ulLength;          /* length of record */
  314.    ULONG       ulReserved2;       /* reserved for system */
  315.    ULONG       ulReserved3;       /* reserved for system */
  316.    ULONG       ulParm1;           /* Record specific data */
  317.    ULONG       ulParm2;           /* Record specific data */
  318.    } RECORDTAB;
  319. typedef RECORDTAB FAR *PRECORDTAB;/* Ptr to a buffer entry  */
  320.  
  321.  
  322. /* ulParm1 Return values for MULTITRACK_READ only: */
  323. #define MMIO_INVISIBLE_FRAME   0x1000L
  324.  
  325.  
  326. /* ulParm1 Input values for MULTITRACK_WRITE only: */
  327. /* #define  MMIO_IS_KEY_FRAME  0x0001L */ /* Frame is a Key frame */
  328. /* #define  MMIO_IS_PALETTE    0x0002L */ /* Buffer contains a video palette  */
  329.  
  330.  
  331.  
  332. /************************************************
  333.  *
  334.  *  TRACKMAP - This structure maps a track to
  335.  *             a record table.
  336.  *
  337.  ************************************************/
  338. typedef struct _TRACKMAP {        /* trackmap */
  339.    ULONG       ulTrackID;         /* Input - track ID */
  340.    ULONG       ulNumEntries;      /* Input - number of record entries */
  341.    PRECORDTAB  pRecordTabList;    /* Input/Output - Ptr to a record table */
  342.    } TRACKMAP;
  343. typedef TRACKMAP *PTRACKMAP;      /* Ptr to a track map table entry */
  344.  
  345.  
  346. /**********************************************
  347.  *
  348.  * MMMULTITRACKREAD - Multiple Track Read
  349.  *
  350.  **********************************************/
  351. typedef struct _MMMULTITRACKREAD  {   /* mtread */
  352.    ULONG       ulLength;          /* Input - length of read buffer */
  353.    PVOID       pBuffer;           /* Input - ptr to read buffer */
  354.    ULONG       ulFlags;           /* Output - read flags */
  355.    ULONG       ulNumTracks;       /* Input - number of track entries */
  356.    PTRACKMAP   pTrackMapList;     /* Input - ptr to track-to-record list */
  357.    } MMMULTITRACKREAD;
  358. typedef MMMULTITRACKREAD *PMMMULTITRACKREAD;
  359.  
  360. /* ulFlags Defines: */
  361. #define MULTITRACKREAD_NOTDONE        0x0001L /* Read is not done. Another read of the same */
  362.                                               /* buffer is necessary. There were not enough record */
  363.                                               /* entries in the record table passed to this api. */
  364. #define MULTITRACKREAD_EOF            0x0002L /* End of File. Used because # bytes read may not */
  365.                                               /* match the length of the buffer in cases of a */
  366.                                               /* record that spans in the next buffer. */
  367.  
  368.  
  369. /**********************************************
  370.  *
  371.  * MMMULTITRACKWRITE - Multiple Track Write
  372.  *
  373.  **********************************************/
  374. typedef struct _MMMULTITRACKWRITE  {   /* mtwrite */
  375.    ULONG       ulNumTracks;       /* number of track entries */
  376.    PTRACKMAP   pTrackMapList;     /* ptr to track-to-record list */
  377.    } MMMULTITRACKWRITE;
  378. typedef MMMULTITRACKWRITE *PMMMULTITRACKWRITE;
  379.  
  380.  
  381. /**********************************************
  382.  *
  383.  * MMMOVIEHEADER - standard movie header data
  384.  *
  385.  **********************************************/
  386. typedef struct _MMMOVIEHEADER {   /* mmhdr */
  387.    ULONG         ulStructLen;       /* length of this structure */
  388.    ULONG         ulReserved;        /* Reserved for future use */
  389.    ULONG         ulMediaType;       /* video media type */
  390.    ULONG         ulMovieCapsFlags;  /* capabilities */
  391.    ULONG         ulMaxBytesPerSec;  /* maximum transfer rate */
  392.    ULONG         ulPaddingGranularity;/* pad to a multiple of this size */
  393.    ULONG         ulSuggestedBufferSize;
  394.    ULONG         ulStart;
  395.    ULONG         ulLength;
  396.    ULONG         ulNextTrackID;     /* next available track id */
  397.    ULONG         ulNumEntries;      /* number of track entries */
  398.    PMMTRACKINFO  pmmTrackInfoList;  /* track information */
  399.    PSZ           pszMovieTitle;     /* movie title */
  400.    ULONG         ulCountry;         /* country code for the title string */
  401.    ULONG         ulCodePage;        /* country code page the title string */
  402.    } MMMOVIEHEADER;
  403. typedef MMMOVIEHEADER *PMMMOVIEHEADER;
  404.  
  405. /* ulContentType Defines: */
  406. #define MMIO_VIDEO_UNKNOWN          0x00000000L  /* Unknown video content */
  407. #define MMIO_VIDEO_DATA             0x00000001L  /* Video                 */
  408.  
  409. /* ulMovieCapsFlags Defines: */
  410. #define  MOVIE_HAS_VIDEO         0x0001L  /* The movie contains video. */
  411. #define  MOVIE_HAS_AUDIO         0x0002L  /* The movie contains audio. */
  412. #define  MOVIE_CAN_SEEK          0x0004L  /* The movie can seek. */
  413. #define  MOVIE_CAN_SCAN          0x0008L  /* The movie can fast scan. */
  414. #define  MOVIE_HAS_COPYRIGHT     0x0010L  /* The movie contains copyrighted data. */
  415. #define  MOVIE_WAS_CAPTUREFILE   0x0020L  /* The movie is a specially allocated  */
  416.                                           /* file used for capturing real-time */
  417.                                           /* video.  Applications should warn  */
  418.                                           /* the user before writing over a file */
  419.                                           /* with this flag set because the user  */
  420.                                           /* probably defragmented this file. */
  421.  
  422. /**********************************************
  423.  *
  424.  * MMVIDEOHEADER - Movie Video Track Header
  425.  *
  426.  **********************************************/
  427. typedef struct _MMVIDEOHEADER {   /* mmvhdr */
  428.    ULONG         ulStructLen;       /* length of this structure */
  429.    ULONG         ulContentType;     /* video content type */
  430.    ULONG         ulMediaType;       /* video media type */
  431.    ULONG         ulVideoCapsFlags;  /* capabilities */
  432.    ULONG         ulWidth;           /* video width in pels */
  433.    ULONG         ulHeight;          /* video height in pels */
  434.    ULONG         ulScale;
  435.    ULONG         ulRate;            /* Rate / Scale == frames/second */
  436.    ULONG         ulStart;
  437.    ULONG         ulLength;
  438.    ULONG         ulTotalFrames;     /* total number of video frames */
  439.    ULONG         ulInitialFrames;
  440.    MMTIME        mmtimePerFrame;    /* frame display time or 0L */
  441.    ULONG         ulSuggestedBufferSize;
  442.    GENPAL        genpalVideo;       /* palette */
  443.    PMMXDIBHEADER pmmXDIBHeader;     /* windows DIB compatible header */
  444.    } MMVIDEOHEADER;
  445. typedef MMVIDEOHEADER *PMMVIDEOHEADER;
  446.  
  447. /* ulContentType Defines: */
  448. #define MMIO_VIDEO_UNKNOWN          0x00000000L  /* Unknown video content */
  449. #define MMIO_VIDEO_DATA             0x00000001L  /* Video                 */
  450.  
  451. /* XLATOFF */
  452. #pragma pack()
  453. /* XLATON */
  454.  
  455. #endif /* _CODEC_H_ */
  456.