home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / header45.zip / umformat.h < prev    next >
C/C++ Source or Header  |  1999-03-15  |  18KB  |  314 lines

  1. /**************************START OF SPECIFICATIONS **************************/
  2. /*                                                                          */
  3. /* COPYRIGHT:     IBM - International Business Machines                     */
  4. /*              Copyright (c) IBM Corporation  1991, 1992, 1993             */
  5. /*                        All Rights Reserved                               */
  6. /*                                                                          */
  7. /*                                                                          */
  8. /* SOURCE FILE NAME:  UMFORMAT.H                                            */
  9. /*                                                                          */
  10. /* DESCRIPTIVE NAME: Ultimotion File Format Headers (Beta)                  */
  11. /*                                                                          */
  12. /*   An Ultimotion file consists of interlevaed audio and video and text    */
  13. /*   chunks within the data list chunk.                                     */
  14. /*                                                                          */
  15. /*   A file may contain interleaved audio chunks or the soundtrack may      */
  16. /*   be contained in a seperate file specified in the header chunk, or      */
  17. /*   there may be no associated soundtrack (a silent movie).  Multiple      */
  18. /*   audio tracks are supported by this file format, either interleaved     */
  19. /*   or in seperate files.  Only one video track, track 0, is supported in  */
  20. /*   a single file.  Audio tracks are identified by a track number, with    */
  21. /*   the first audio track being track 1.                                   */
  22. /*                                                                          */
  23. /*   If a file specifies both interleaved audio tracks and external         */
  24. /*   audio tracks (.WAV files), the external audio tracks are numbered      */
  25. /*   consecutively following the interleaved audio tracks.  For             */
  26. /*   example, if a file specifies two interleaved audio tracks and two      */
  27. /*   external audio tracks, the interleaved audio tracks will be tracks     */
  28. /*   0 and 1, and the external audio tracks will be tracks 2 and 3.         */
  29. /*   Note that tracks can carry distinct audio information such as          */
  30. /*   multiple languages, and that stereo audio can be carried in a          */
  31. /*   single track.                                                          */
  32. /*                                                                          */
  33. /************************** END OF SPECIFICATIONS ***************************/
  34. #ifdef __cplusplus
  35.    extern "C" {
  36. #endif
  37.  
  38.  
  39. /* XLATOFF */
  40. #pragma pack(1)
  41. /* XLATON */
  42.  
  43.  
  44. /* The hex fourcc value is also the SPCBKEY.ulDataSubType value for the */
  45. /* Ultimotion file format - OS2MEDEF.H                                  */
  46. #define     FOURCC_FFIO                 mmioFOURCC('U', 'L', 'T', 'I')
  47. #define     HEX_FOURCC_FFIO             0x49544c55L
  48.  
  49. /****************************************************************************/
  50. /* Ultimotion File Format:                                                  */
  51. /*                                                                          */
  52. /*                                                                          */
  53. /*    Conventions used in this format:                                      */
  54. /*                                                                          */
  55. /*    - A file is a collection of chunks                                    */
  56. /*    - The first ULONG in a chunk is the chunk type (chunk ID)             */
  57. /*    - The second ULONG in a chunk is the length of the chunk,             */
  58. /*         including the header and the data, but excluding the chunk       */
  59. /*         ID and chunk length.                                             */
  60. /*    - For each interleaved audio track there is one audio frame that      */
  61. /*         corresponds to each video frame                                  */
  62. /*    - An audio frame has the same duration as its corresponding video     */
  63. /*         frame                                                            */
  64. /*    - Audio frames always follow their corresponding video frame, and     */
  65. /*         as such preceed the next video frame                             */
  66. /*                                                                          */
  67. /* Legend:                                                                  */
  68. /*     [<element name>]      optional                                       */
  69. /*     <element name>        1                                              */
  70. /*     <element name>...     1 or more                                      */
  71. /*     [<element name>]...   0 or more                                      */
  72. /*                                                                          */
  73. /*                                                                          */
  74. /*                                                                          */
  75. /*  SMV form                                                                */
  76. /*  ---------                                                               */
  77. /*                                                                          */
  78. /* <RIFF( 'ummv'                                                            */
  79. /*       <LIST( 'umhl'                             - Header LIST            */
  80. /*             <Videoheader-ck>                    - Video header chunk     */
  81. /*             <videotitle-ck>...                  - Video title chunk(s)   */
  82. /*                                                 -                        */
  83. /*             [<LIST( 'umal'                      - Audio LIST(s)          */
  84. /*                    {<extaudiofilename-ck> |     - Ext. WAV files         */
  85. /*                     <audioheader-ck>}           - Audio header           */
  86. /*                    <audiotitle-ck>...)>]...     - Audio title            */
  87. /*                                                 -                        */
  88. /*             [<LIST( 'umtl'                      - Text LIST              */
  89. /*                     <textheader-ck>...)>])>     - Text header            */
  90. /*                                                 -                        */
  91. /*       <LIST( 'umfd'                             - Frame data LIST        */
  92. /*             <LIST( 'umcd' {                     - Chapter data LIST      */
  93. /*                   <videoframe-ck>               - Video frame            */
  94. /*                   [<audioframe-ck>]             - Audio frame            */
  95. /*                   [<textframe-ck>]}...)>...)    - Text frame             */
  96. /*                                                 -                        */
  97. /*        [<LIST( 'umci'                           - Chap index table LIST  */
  98. /*               <LIST( 'umce'                     - Chap index entry LIST  */
  99. /*                     <chapterheader-ck>          - Chapter index hdr      */
  100. /*                     <chapttitle-ck>...          - Chapter title          */
  101. /*                     <frameindex-ck>)>...)>])>   - frame index            */
  102. /*                                                 -  table                 */
  103. /*                                                                          */
  104. /****************************************************************************/
  105.  
  106. #define UMAUDIOFILENAMELENGTH   60
  107. #define SIZEOF_FORM         4
  108.  
  109. /* ULTIMOTION FORMS */
  110. #define  UMFORM_MOVIE                   "ummv"
  111. #define  UMFORM_HEADERLIST              "umhl"
  112. #define  UMFORM_AUDIOHDRLIST            "umal"
  113. #define  UMFORM_TEXTHDRLIST             "umtl"
  114. #define  UMFORM_FRAMEDATALIST           "umfd"
  115. #define  UMFORM_CHAPTERDATALIST         "umcd"
  116. #define  UMFORM_CHAPTERTABLELIST        "umci"
  117. #define  UMFORM_CHAPTERENTRYLIST        "umce"
  118.  
  119. /* byte swapped hex defines for ulong assignments... */
  120. #define  HEX_UMFORM_MOVIE               0x766d6d75L     /* vmmu */
  121. #define  HEX_UMFORM_HEADERLIST          0x6c686d75L     /* lhmu */
  122. #define  HEX_UMFORM_AUDIOHDRLIST        0x6c616d75L     /* lamu */
  123. #define  HEX_UMFORM_TEXTHDRLIST         0x6c746d75L     /* ltmu */
  124. #define  HEX_UMFORM_FRAMEDATALIST       0x64666d75L     /* dfmu */
  125. #define  HEX_UMFORM_CHAPTERDATALIST     0x64636d75L     /* dcmu */
  126. #define  HEX_UMFORM_CHAPTERTABLELIST    0x69636d75L     /* icmu */
  127. #define  HEX_UMFORM_CHAPTERENTRYLIST    0x65636d75L     /* ecmu */
  128.  
  129. /* ULTIMOTION CHUNK IDS */
  130. #define  UMID_VIDEOHEADER               "umvh"
  131. #define  UMID_EXTAUDIONAME              "umea"
  132. #define  UMID_AUDIOHEADER               "umah"
  133. #define  UMID_TEXTHEADER                "umth"
  134. #define  UMID_VIDEOTITLE                "umvt"
  135. #define  UMID_AUDIOTITLE                "umat"
  136. #define  UMID_TEXTFRAME                 "umtf"
  137. #define  UMID_VIDEOFRAME                "umvf"
  138. #define  UMID_AUDIOFRAME                "umaf"
  139. #define  UMID_CHAPTERHEADER             "umch"
  140. #define  UMID_CHAPTERTITLE              "umct"
  141. #define  UMID_FRAMETABLE                "umfi"
  142.  
  143. /* byte swapped hex defines for ulong assignments... */
  144. #define  HEX_UMID_VIDEOHEADER           0x68766d75L      /* hvmu */
  145. #define  HEX_UMID_EXTAUDIONAME          0x61656d75L      /* aemu */
  146. #define  HEX_UMID_AUDIOHEADER           0x68616d75L      /* hamu */
  147. #define  HEX_UMID_TEXTHEADER            0x68746d75L      /* htmu */
  148. #define  HEX_UMID_VIDEOTITLE            0x74766d75L      /* tvmu */
  149. #define  HEX_UMID_AUDIOTITLE            0x74616d75L      /* tamu */
  150. #define  HEX_UMID_TEXTFRAME             0x66746d75L      /* ftmu */
  151. #define  HEX_UMID_VIDEOFRAME            0x66766d75L      /* fvmu */
  152. #define  HEX_UMID_AUDIOFRAME            0x66616d75L      /* famu */
  153. #define  HEX_UMID_CHAPTERHEADER         0x68636d75L      /* hcmu */
  154. #define  HEX_UMID_CHAPTERTITLE          0x74636d75L      /* tcmu */
  155. #define  HEX_UMID_FRAMETABLE            0x69666d75L      /* ifmu */
  156.  
  157.  
  158.  
  159. /****************************************************************************/
  160. /* CHUNK HEADER STRUCTURE - APPEARS AT START OF EACH CHUNK                  */
  161. /****************************************************************************/
  162. typedef struct _UMCHUNKHEADER {  /* umch */
  163.    ULONG          ulChunkID;              /* ID for this chunk                   */
  164.    ULONG          ulChunkLength;          /* Length of chunk that follows        */
  165. }  UMCHUNKHEADER;
  166. typedef UMCHUNKHEADER *PUMCHUNKHEADER;   /* pumch */
  167.  
  168.  
  169. /****************************************************************************/
  170. /* VIDEO HEADER CHUNK -                                                     */
  171. /*                                                                          */
  172. /* The UMVIDEOHEADER structure is followed by a list of                     */
  173. /* usInterleavedTracks null-terminated external audio (.WAV) file           */
  174. /* names.  The audio file name fields are fixed size to better enable       */
  175. /* changing the file names without re-writing the file.                     */
  176. /****************************************************************************/
  177. typedef struct _UMVIDEOHEADER {   /* umvh */
  178.    ULONG         ulTotalDuration;        /* Video duration in MMTIME            */
  179.    ULONG         ulMaxFrameSize;         /* Max video frame size in bytes       */
  180.    ULONG         ulMaxAvgDataRate;       /* Max avergage data rate              */
  181.    ULONG         ulMaxBurstInterval;     /* Max interval for max data rate      */
  182.    ULONG         ulCompressionRatioX100; /* Compression ratio                   */
  183.    ULONG         ulPosterFrameOffset;    /* Poster for video (from beginning)   */
  184.    USHORT        usMaxFrameX;            /* Max horizontal frame size           */
  185.    USHORT        usMaxFrameY;            /* Max vertical frame size             */
  186.    USHORT        usNomFrameDuration;     /* Nominal recorded frame duration     */
  187.    USHORT        usNomIFrameInterval;    /* I-frame every this many frames      */
  188.    USHORT        usNumCompressionTypes;  /* number of different CODECS used in file */
  189.    ULONG         aulCompressionTypes[20];/* List of CODECs found in this file */
  190.    ULONG         Reserved[16];           /* Reserved space */
  191. }  UMVIDEOHEADER;
  192. typedef UMVIDEOHEADER *PUMVIDEOHEADER;  /* pumvh */
  193.  
  194.  
  195. /****************************************************************************/
  196. /* EXTERNAL AUDIO FILE NAME CHUNK                                           */
  197. /****************************************************************************/
  198. typedef struct _EXTAUDIONAME  {   /* umea */
  199.    USHORT        usTrackNumber;          /* Audio track number for this format  */
  200.    CHAR          szFileName[UMAUDIOFILENAMELENGTH];
  201. }  EXTAUDIONAME;
  202. typedef EXTAUDIONAME *PEXTAUDIONAME;  /* pumea */
  203.  
  204.  
  205. /****************************************************************************/
  206. /* INTERLEAVED AUDIO TRACK HEADER CHUNK                                     */
  207. /****************************************************************************/
  208. typedef struct  _AUDIOHEADER {   /* umah */
  209.    USHORT        usTrackNumber;          /* Audio track number for this format  */
  210.    USHORT        usFormatTag;            /* Type of wave format                 */
  211.    USHORT        usChannels;             /* Number of channels (1=mono 2=stereo)*/
  212.    ULONG         ulSamplesPerSec;        /* Sampling rate                       */
  213.    ULONG         ulAvgBytesPerSec;       /* Avg bytes per sec                   */
  214.    USHORT        usBlockAlign;           /* Block alignment in bytes            */
  215.    USHORT        usBitsPerSample;        /* Bits per sample                     */
  216.    USHORT        usCountryCode;          /* Country code for this title         */
  217.    } AUDIOHEADER;
  218. typedef AUDIOHEADER *PAUDIOHEADER; /* pumah */
  219.  
  220.  
  221. /****************************************************************************/
  222. /* INTERLEAVED TEXT TRACK HEADER CHUNK                                      */
  223. /****************************************************************************/
  224. typedef struct  _TEXTHEADER {   /* umth */
  225.    USHORT        usTrackNumber;          /* Audio track number for this format  */
  226.    USHORT        usCountryCode;          /* Country code for this title         */
  227.    } TEXTHEADER;
  228. typedef TEXTHEADER *PTEXTHEADER; /* pumth */
  229.  
  230.  
  231. /****************************************************************************/
  232. /* TITLE CHUNK                                                              */
  233. /****************************************************************************/
  234. typedef struct _TITLE {  /* ttl */
  235.    USHORT        usCountryCode;         /* Country code for this title         */
  236.    CHAR          szTitle[1];            /* Video title null-terminated         */
  237.    } TITLE;
  238. typedef TITLE *PTITLE; /* pttl */
  239.  
  240.  
  241. /****************************************************************************/
  242. /* AUDIO FRAME CHUNK                                                        */
  243. /****************************************************************************/
  244. typedef struct _AUDIOFRAME { /* umaf */
  245.    USHORT        usTrackNumber;         /* audio track number                  */
  246.    BYTE          bData[1];
  247. }  AUDIOFRAME;
  248. typedef AUDIOFRAME *PAUDIOFRAME; /* pumaf */
  249.  
  250.  
  251. /****************************************************************************/
  252. /* TEXT FRAME CHUNK                                                         */
  253. /****************************************************************************/
  254. typedef struct _TEXTFRAME {  /* umtf */
  255.    USHORT        usTrackNumber;         /* Text track number                   */
  256.    CHAR          szText[1];             /* Text null-terminated                */
  257.    } TEXTFRAME;
  258.  
  259.  
  260. /****************************************************************************/
  261. /* VIDEO FRAME CHUNK                                                        */
  262. /****************************************************************************/
  263. typedef struct _VIDEOFRAME { /* umvf */
  264.    USHORT        usTrackNumber;         /* Video track number  (0L only for now) */
  265.    ULONG         ulDuration;            /* Frame duration in MMTIME            */
  266.    ULONG         ulFrameFlags;          /* Frame flags                         */
  267.    ULONG         ulCompressionType;     /* Compression type                    */
  268.    BYTE          bData[1];
  269. } VIDEOFRAME;
  270. typedef VIDEOFRAME *PVIDEOFRAME; /* pumvf */
  271.  
  272. /* ulCompressionType defines: */
  273. #define  UM_VIDEO_COMPRESSION_TYPE_RAWRGB565        1L
  274. #define  UM_VIDEO_COMPRESSION_TYPE_RAWUVY556        2L
  275. #define  UM_VIDEO_COMPRESSION_TYPE_RAWYUV411        3L
  276. #define  UM_VIDEO_COMPRESSION_TYPE_BH146           10L   /* BETA-RGB16 */
  277. #define  UM_VIDEO_COMPRESSION_TYPE_BH211SCS4       11L   /* 1.1 YUV16 subsampled chroma sub4 */
  278. #define  UM_VIDEO_COMPRESSION_TYPE_BH211UCS4       12L   /* unique chroma sub4 */
  279.  
  280. /* ulVideoFrameFlags defines: */
  281. #define  UM_VIDEO_FRAME_FLAG_DELTAFRAME   0x1L   /* 1: delta frame, 0: I frame */
  282. #define  UM_VIDEO_FRAME_FLAG_SCENECHANGE  0x2L
  283.  
  284.  
  285. /****************************************************************************/
  286. /* CHAPTER INDEX HEADER (header for each entry in chapter index LIST        */
  287. /****************************************************************************/
  288. typedef struct _UMCHAPTERINDEX {  /* umch */
  289.    ULONG    ulChapterOffset;            /* Offset from beginning of file       */
  290.    ULONG    ulChapterDuration;          /* Duration of chapter in MMTIME       */
  291.    ULONG    ulPosterFrameOffset;        /* Poster for chapter (offset from chapter)*/
  292. }  UMCHAPTERINDEX;
  293. typedef UMCHAPTERINDEX *PUMCHAPTERINDEX;  /* pumch */
  294.  
  295.  
  296. /****************************************************************************/
  297. /* FRAME INDEX ENTRY                                                        */
  298. /****************************************************************************/
  299. typedef struct _UMFRAMEINDEX {  /* umfi */
  300.    ULONG        ulFrameOffsets;         /* Offset from beginning of chapter    */
  301.    ULONG        ulFrameFlags;           /* Frame flags (Refer to frame header) */
  302. }  UMFRAMEINDEX;
  303. typedef UMFRAMEINDEX *PUMFRAMEINDEX;  /* pumfi */
  304.  
  305.  
  306. /* XLATOFF */
  307. #pragma pack()
  308. /* XLATON */
  309.  
  310. #ifdef __cplusplus
  311. }
  312. #endif
  313.  
  314.