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