home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / mm / ultimoio / ioi.h < prev    next >
Text File  |  1999-05-11  |  21KB  |  434 lines

  1. /**************************START OF SPECIFICATIONS **************************/
  2. /*                                                                          */
  3. /* SOURCE FILE NAME:  IOI.H                                                 */
  4. /*                                                                          */
  5. /* DESCRIPTIVE NAME: File Format IO Proc defintions (Internal)              */
  6. /*                   Multi-Media I/O Procedure for digital video files      */
  7. /*                                                                          */
  8. /* COPYRIGHT:     IBM - International Business Machines                     */
  9. /*            Copyright (c) IBM Corporation  1991, 1992, 1993               */
  10. /*                        All Rights Reserved                               */
  11. /*                                                                          */
  12. /* STATUS: OS/2 Release 2.1                                                 */
  13. /*                                                                          */
  14. /************************** END OF SPECIFICATIONS ***************************/
  15.  
  16. /* XLATOFF */
  17. #pragma pack(4)
  18. /* XLATON */
  19.  
  20. /***********************
  21.  * Forward Declarations:
  22.  ***********************/
  23. typedef struct  _TRACKI          *PTRACKI;       /* Ptr to a track list */
  24. typedef struct  _CCB             *PCCB;          /* Ptr to Compression Control Block */
  25. typedef struct  _INSTANCE        *PINSTANCE;     /* pinstance */
  26. typedef struct  _SUBINDEX        *PSUBINDEX;     /* Ptr to subindex structure */
  27. typedef struct  _CLIPBRDENTRY    *PCLIPBRDENTRY; /* Ptr to clipboard entry */
  28. typedef struct  _EDITELEMENT     *PEDITELEMENT;  /* Ptr to edit element */
  29. typedef struct  _FILEELEMENT     *PFILEELEMENT;  /* Ptr to file element */
  30.  
  31. #include "ff.h"              /* Include the File Format Specific header info */
  32.  
  33. /******************
  34.  * Defines:
  35.  ******************/
  36. #define VOIDPARM          111                          /* Void parameter                */
  37. #define HEAP_SIZE         4096                         /* Heap size for DLL             */
  38. #define MMTIMEUNIT        3000                         /* MMTIME = 1/3000s.             */
  39. #define DEFAULTBUFFERSIZE 16384                        /* Default size of Temp buffer.  */
  40.  
  41. #define IS_AUDIO_TRACK(ulMediaType)  (ulMediaType == MMIO_MEDIATYPE_AUDIO)               // Should include MIDI in future...
  42. #define IS_VIDEO_TRACK(ulMediaType)  (ulMediaType == MMIO_MEDIATYPE_DIGITALVIDEO)
  43.  
  44. /*******************************************
  45.  *  TRACKI    - List of valid tracks for
  46.  *              this file instance.
  47.  *******************************************/
  48. typedef struct _TRACKI { /* tracki */
  49.    PTRACKI     ptrackiNext;           /* Ptr to next tracki list entry */
  50.    ULONG       ulTrackID;             /* Track number */
  51.    ULONG       ulLastReadPos;         /* Last read track position. */
  52.    PVOID       pTrackHeader;          /* Pointer to specific media type header for this track */
  53.    ULONG       ulTrackHdrLength;      /* track header length */
  54.    PVOID       pRawHdr;               /* Ptr to raw File header.*/
  55.    ULONG       ulRawHdrLength;        /* Raw header length */
  56.    ULONG       ulMediaType;           /* Media type for this track */
  57.    ULONG       ulNumEntries;          /* (Temp) Current srcbuftab entry in trackmap table */
  58.    ULONG       ulMisc1;               /* File Format specific field */
  59.    ULONG       ulMisc2;               /* File Format specific field */
  60.    ULONG       ulMisc3;               /* File Format specific field */
  61.    ULONG       ulMisc4;               /* File Format specific field */
  62. } TRACKI;
  63.  
  64. /************************************************
  65.  *  CCB - Compression Control Block.
  66.  ************************************************/
  67. typedef struct _CCB  {  /* ccb */
  68.    PCCB             pccbNext;        /* Ptr to next CCB entry. */
  69.    HMODULE          hmodule;         /* Module handle for Compression IO Proc. */
  70.    PMMIOPROC        pmmioproc;       /* Pointer to Compression entry point procedure. */
  71.    ULONG            hCodec;          /* Handle to Codec IO Proc instance */
  72.    CODECINIFILEINFO cifi;            /* Codec ini file info structure */
  73.    CODECOPEN        codecopen;       /* Codec open structure */
  74.    ULONG            ulLastSrcBuf;    /* Ptr to last src buffer, for Multiaperture decompress calls */
  75.    ULONG            ulMisc1;         /* File Format specific field */
  76.    ULONG            ulMisc2;         /* File Format specific field */
  77. } CCB;
  78.  
  79. /************************************************
  80.  *  SUBINDEX - Sub-Index Structure
  81.  ************************************************/
  82. typedef struct _SUBINDEX {                /* subindex */
  83.    PSUBINDEX        psubindexNext;
  84.    ULONG            ulFrameFlags;
  85.    ULONG            ulFrameLength;
  86.    ULONG            ulFrameOffset;
  87. } SUBINDEX;
  88.  
  89. /************************************************
  90.  *  INDEX - Index Structure
  91.  ************************************************/
  92. typedef struct _INDEX {                   /* index */
  93.    ULONG            ulFrameFlags;         /* Flags*/
  94.    ULONG            ulFrameLength;
  95.    ULONG            ulFrameOffset;
  96.    PSUBINDEX        psubindexList;
  97. } INDEX;
  98. typedef INDEX *PINDEX;
  99.  
  100. /************************************************
  101.  *  INSTANCE - IO proc instance structure.
  102.  ************************************************/
  103. typedef struct _INSTANCE {                          /* instance */
  104.    PRAWFILEHEADER           pRawHdr;                /* Ptr to raw File header.*/
  105.    ULONG                    ulRawHdrLength;         /* Raw header length */
  106.    PMMMOVIEHEADER           pmmhdr;                 /* Ptr to Standard Presentation header for this media type.*/
  107.    ULONG                    ulMmHdrLength;          /* MMOVIEHEADER length.*/
  108.    PTRACKI                  ptrackiList;            /* Pointer to track list of valid tracks for this file.*/
  109.    LONG                     lLastTrack;             /* Last track mmioRead work on. */
  110.    LONG                     lCurrentTrack;          /* Current processing track.*/
  111.    PCCB                     *pccbList;              /* Pointer to Compression IO Proc list.*/
  112.    HMMIO                    hmmioFileHandle;        /* File handle. */
  113.    LONG                     lFileCurrentPosition;   /* File's current position.*/
  114.    ULONG                    ulFileLen;              /* Length of file.*/
  115.    ULONG                    ulFlags;                /* Flags*/
  116.    ULONG                    ulMode;                 /* Current IO Proc operation mode*/
  117.    PVOID                    pTempBuffer;            /* Temp buffer for read track.*/
  118.    ULONG                    ulTempBufferSize;       /* Temp buffer size.*/
  119.    ULONG                    ulDataInTempBuffer;     /* Bytes in temp buffer copied from read buffer.*/
  120.    PVOID                    pLastBuffer;            /* Last buffer read into.*/
  121.    ULONG                    ulLastBufferOffset;     /* Offset into last buffer.*/
  122.    PINDEX                   paindexList;            /* Ptr to Frame index (array ) */
  123.    ULONG                    ulNumIndex;             /* Number of entries in the index List */
  124.    PCCB                     pccbLastUsed;           /* Ptr to last used codec for Multiaperture decompress calls */
  125.    ULONG                    ulEditFlags;            /* Editng state flags */
  126.    PEDITELEMENT             pEditList;              /* Dynamic descrition of an edited file */
  127.    PEDITELEMENT             pUndoList;              /* Stack for undo command */
  128.    PEDITELEMENT             pRedoList;              /* Stack for redo command */
  129.    PFILEELEMENT             pFileList;              /* List of pasted files */
  130.    PEDITELEMENT             pCurrentElement;        /* Element being played now */
  131.    DATETIME                 dtClipbrdTime;          /* time stamp for clipboard data */
  132.    PID                      pidPID;                 /* process id */
  133.    ULONG                    ulFrameCount;           /* Number of frames played in current element */
  134.    ULONG                    ulMisc1;                /* File Format specific field */
  135.    ULONG                    ulMisc2;                /* File Format specific field */
  136.    ULONG                    ulMisc3;                /* File Format specific field */
  137.    ULONG                    ulMisc4;                /* File Format specific field */
  138.    SZ                       szFileName[CCHMAXPATH]; /* file name */
  139.    ULONG                    ulDeltaCount;           /* Number of remaining delta frames before the next I-frame */
  140.    ULONG                    ulCurrentFrame;         /* current frame of video track */
  141.    PMMVIDEOHEADER           pmmVideoHdr;            /* pointer to header of main video track */
  142.    ULONG                    ulCurrentVideoTrack;    /* current video track */
  143.    ULONG                    ulCurrentAudioTrack;    /* current audio track */
  144. } INSTANCE;
  145.  
  146. /* ulFlags defines */
  147. #define     HAVE_PALETTE        0x0001L             /*  Have searched file for first palette is exists */
  148.                                                     /*  so skip it on any MMIOM_MULTITRACKREAD calls   */
  149. #define     OPENED_READONLY     0x0002L             /*  Movie file was opened for Read only (play back) */
  150. #define     OPENED_READWRITE    0x0004L             /*  Movie file was opened for Read/Write (recording/editing) */
  151. #define     OPENED_WRITECREATE  0x0008L             /*  Movie file was opened for Write/Create (recording) */
  152.  
  153. /* ulMode defines */
  154. #define     MODE_NORMALREAD   0x0000L               /* Normal reading operation.*/
  155. #define     MODE_SCANREAD     0x0001L               /* Read only Key frames for video tracks only.*/
  156.                                                     /*  Turn off audio tracks. (return error if.*/
  157.                                                     /*  requested thru MMIOM_MULTITRACKREAD).*/
  158. #define     MODE_REVERSEREAD  0x0002L               /* Read in reverse order. (No audio reads) */
  159.  
  160. // ulEditFlags defines
  161.  
  162. #define     ACTIVE_CLIPBRD_REFERENCE   0x00000001   /* cut or copy outstanding */
  163. #define     DIRTY_BY_EDIT              0x00000002   /* has been edited, needs to be saved */
  164. #define     FULLY_QUALIFIED_PATH       0x00000004   /* szFileName is fully qualified */
  165. #define     CANNOT_CUT_OR_COPY         0x00000008   /* file name is not known */
  166.  
  167. // FFIO specific optional capabilities function defines:
  168.  
  169. typedef struct _FFIOFNCT {
  170.  
  171.    PFN   pfnIOProcGetCF;               // MMIOM_GETCF
  172.    PFN   pfnIOProcGetCFEntry;          // MMIOM_GETCFENTRY
  173.  
  174.    PFN   pfnIOProcOpen;                // MMIOM_CLOSE
  175.    PFN   pfnIOProcClose;               // MMIOM_OPEN
  176.    PFN   pfnIOProcRead;                // MMIOM_READ
  177.    PFN   pfnIOProcSeek;                // MMIOM_SEEK
  178.    PFN   pfnIOProcWrite;               // MMIOM_WRITE
  179.  
  180.    PFN   pfnIOProcIdentifyFile;        // MMIOM_IDENTIFYFILE
  181.    PFN   pfnIOProcGetHeader;           // MMIOM_GETHEADER
  182.    PFN   pfnIOProcSetHeader;           // MMIOM_SETHEADER
  183.    PFN   pfnIOProcQueryHeaderLength;   // MMIOM_QUERYHEADERLENGTH
  184.    PFN   pfnIOProcGetFormatName;       // MMIOM_GETFORMATNAME
  185.    PFN   pfnIOProcGetFormatInfo;       // MMIOM_GETFORMATINFO
  186.    PFN   pfnIOProcSeekByTime;          // MMIOM_SEEKBYTIME
  187.    PFN   pfnIOProcTempChange;          // MMIOM_TEMPCHANGE
  188.    PFN   pfnIOProcBeginInsert;         // MMIOM_BEGININSERT
  189.    PFN   pfnIOProcEndInsert;           // MMIOM_ENDINSERT
  190.    PFN   pfnIOProcSave;                // MMIOM_SAVE
  191.    PFN   pfnIOProcSet;                 // MMIOM_SET
  192.    PFN   pfnIOProcCompress;            // MMIOM_COMPRESS
  193.    PFN   pfnIOProcDecompress;          // MMIOM_DECOMPRESS
  194.    PFN   pfnIOProcMultiTrackRead;      // MMIOM_MULTITRACKREAD
  195.    PFN   pfnIOProcMultiTrackWrite;     // MMIOM_MULTITRACKWRITE
  196.  
  197.    PFN   pfnIOProcDelete;              // MMOIM_DELETE
  198.    PFN   pfnIOProcBeginGroup;          // MMIOM_BEGINGROUP
  199.    PFN   pfnIOProcEndGroup;            // MMIOM_ENDGROUP
  200.    PFN   pfnIOProcUndo;                // MMIOM_UNDO
  201.    PFN   pfnIOProcRedo;                // MMIOM_REDO
  202.    PFN   pfnIOProcBeginStream;         // MMIOM_BEGINSTREAM
  203.    PFN   pfnIOProcEndStream;           // MMIOM_ENDSTREAM
  204.  
  205.    PFN   pfnIOProcCopy;                // MMIOM_COPY
  206.    PFN   pfnIOProcCut;                 // MMIOM_CUT
  207.    PFN   pfnIOProcPaste;               // MMIOM_PASTE
  208.    PFN   pfnIOProcClear;               // MMIOM_CLEAR
  209.    PFN   pfnIOProcStatus;              // MMIOM_STATUS
  210.    PFN   pfnIOProcWinMsg;              // MMIOM_WIN_MESSAGE
  211.  
  212. } FFIOFNCT, *PFFIOFNCT;
  213.  
  214. extern FFIOFNCT ffiofnct;
  215.  
  216. // Macros
  217.  
  218. #define ENTERCRITX             if (DosRequestMutexSem(hmtxGlobalHeap, SEM_INDEFINITE_WAIT)) return(MMIO_ERROR);
  219. #define ENTERCRIT(rc)          (rc = DosRequestMutexSem(hmtxGlobalHeap, SEM_INDEFINITE_WAIT))
  220. #define EXITCRIT               (DosReleaseMutexSem(hmtxGlobalHeap))
  221.  
  222. // Structures for clipboard editing:
  223.  
  224. // A linked list of CLIPBRDENTRY structures is placed in the clipboard
  225. // during cut and copy operations. They are read during paste operations.
  226.  
  227. typedef struct _CLIPBRDENTRY {
  228.    ULONG          ulStructLen;            // length of this structure
  229.    PCLIPBRDENTRY  pNext;                  // pointer to next in linked list
  230.    USEC           ulStartTime;            // starting time in microseconds
  231.    USEC           ulDuration;             // duration in microseconds
  232.    ULONG          ulFormat;               // the CF_ clipboard format type
  233.    DATETIME       dtClipbrdTime;          // time stamp for clipboard data
  234.    PID            pidPID;                 // originator's process id
  235.    SZ             szFileName[CCHMAXPATH]; // fully qualified file name
  236. } CLIPBRDENTRY;
  237.  
  238. /* A linked list of EDITELEMENT structures, anchored from the INSTANCE
  239.  * structure, is used to describe the dynamic contents of edited files.
  240.  * The files logical sequence which is used during play and seek operations
  241.  * is determined by ulStart and ulEnd.  The physical data associated with
  242.  * this range is determined from ulFrom and ulTo.
  243.  */
  244.  
  245. typedef struct _EDITELEMENT {
  246.    PEDITELEMENT   pNext;                  // forward pointer in linked list
  247.    PEDITELEMENT   pPrevious;              // back pointer in linked list
  248.    PEDITELEMENT   pUndoRedoChain;         // links edit lists on the undo/redo lists
  249.    PINSTANCE      pInstance;              // pointer to it's INSTANCE structure
  250.    ULONG          ulFilePosition;         // file position to restore for an undo
  251.    ULONG          ulStart;                // logical starting frame number
  252.    ULONG          ulDuration;             // number of frames
  253.    ULONG          ulPhysical;             // physical starting frame number
  254.    ULONG          ulFlags;                // used by each operation
  255. } EDITELEMENT;
  256.  
  257. // defines for ulFlags - see also individual files for LSB defines
  258.  
  259. #define AVIO_EDIT_PLAYBACK_CUED          0x80000000
  260.  
  261. /* A FILEELEMENT structure is created for each file that is opened
  262.  * during a paste operation. It is used to keep track of those files
  263.  * which must be closed when the target file is saved.
  264.  */
  265.  
  266. typedef struct _FILEELEMENT {
  267.    PFILEELEMENT   pNext;                  // pointer to next in linked list
  268.    PINSTANCE      pInstance;              // pointer files INSTANCE structure
  269.    MMIOINFO       mmioInfo;               // MMIOINFO structure
  270. } FILEELEMENT;
  271.  
  272. // Prototype Declarations
  273.  
  274. /*****************
  275.  * checkmem.c
  276.  *****************/
  277. RC APIENTRY CheckMem( PVOID, ULONG, ULONG );
  278.  
  279. /*****************
  280.  * ioclose.c
  281.  *****************/
  282. LONG IOProcClose ( PMMIOINFO pmmioinfo );
  283. VOID ioCleanUp ( PMMIOINFO pmmioinfo );
  284.  
  285. /*****************
  286.  * iocodec.c
  287.  *****************/
  288.  
  289. LONG ioCheckCodecList(PINSTANCE pinstance);
  290.  
  291. LONG ioDetermineBitCount(PCODECINIFILEINFO pcifi);
  292.  
  293. LONG ioDetermineCodec ( PINSTANCE pinstance,
  294.                         ULONG ulSearchFlags,
  295.                         PCODECINIFILEINFO pcifi );
  296.  
  297. PCCB ioLoadCodecDLL ( PINSTANCE pinstance,
  298.                       PCODECINIFILEINFO pcifi,
  299.                       PULONG phCodec,
  300.                       ULONG ulTrack );
  301.  
  302. PCCB ioLoadCodec ( PMMIOINFO pmmioinfo,
  303.                    PINSTANCE pinstance,
  304.                    PTRACKI ptracki,
  305.                    PCODECINIFILEINFO pcifi );
  306.  
  307. PCCB ioFindCodec ( PINSTANCE pinstance,
  308.                    ULONG ulCompressType );
  309.  
  310. LONG ioCloseCodec ( PCCB pccb );
  311.  
  312. LONG ioAssociateCodec ( PMMIOINFO pmmioinfo,
  313.                         PINSTANCE pinstance,
  314.                         PCODECASSOC pcodecassoc,
  315.                         ULONG ulDefaultBitCount );
  316.  
  317. /*****************
  318.  * ioentry.c
  319.  *****************/
  320. LONG APIENTRY IOProc_Entry ( PVOID pmmiostr,
  321.                              WORD wMessage,
  322.                              LONG lParam1,
  323.                              LONG lParam2  );
  324.  
  325. LONG ioCheckReturnCode ( PMMIOINFO pmmioinfo,
  326.                          WORD wMsg,
  327.                          LONG returncode );
  328.  
  329. LONG ioInvalidEntry( PMMIOINFO pmmioinfo,
  330.                      PINSTANCE *ppinstance,
  331.                      WORD wMessage,
  332.                      LONG lParam1,
  333.                      LONG lParam2 );
  334.  
  335. /*****************
  336.  * ioformat.c
  337.  *****************/
  338. LONG IOProcGetFormatName ( PSZ  pszNameBuf,
  339.                            LONG NameBufLen );
  340.  
  341. LONG IOProcGetFormatInfo ( PMMFORMATINFO pmmformatinfo );
  342.  
  343. /*****************
  344.  * ioheader.c
  345.  *****************/
  346. LONG IOProcGetHeader ( PMMIOINFO pmmioinfo,
  347.                        PVOID pHeader,
  348.                        LONG  lHeaderLength,
  349.                        LONG  lCurrentTrack );
  350.  
  351. LONG IOProcQueryHeaderLength ( PMMIOINFO pmmioinfo,
  352.                                LONG      lCurrentTrack );
  353.  
  354. LONG ioGetTrackHeader ( PTRACKI ptracki,
  355.                         PVOID   pTrackHeader,
  356.                         ULONG   ulHeaderLength,
  357.                         ULONG   ulFlag );
  358.  
  359. /*****************
  360.  * ioopen.c
  361.  *****************/
  362. LONG IOProcOpen ( PMMIOINFO pmmioinfo,
  363.                   PSZ pszFileName );
  364.  
  365. /*****************
  366.  * ioseek.c
  367.  *****************/
  368. LONG IOProcSeek ( PMMIOINFO pmmioinfo,
  369.                   LONG lSeekValue,
  370.                   LONG lSeekType );
  371.  
  372. LONG ioSeekFile ( PLONG plRc,
  373.                   HMMIO hmmio,
  374.                   LONG lSeekValue );
  375.  
  376. /*****************
  377.  * ioset.c
  378.  *****************/
  379. LONG IOProcSet ( PMMIOINFO pmmioinfo,
  380.                  LONG lParam1,
  381.                  LONG lParam2 );
  382.  
  383. /*****************
  384.  * iosrv.c
  385.  *****************/
  386. LONG ioGetPtrInstance ( PMMIOINFO pmmioinfo,
  387.                         PINSTANCE *ppinstance );
  388.  
  389. PTRACKI ioFindTracki ( PINSTANCE pinstance,
  390.                        ULONG ulTrackID );
  391.  
  392. PTRACKMAP ioFindTrackMapEntry ( PTRACKMAP patrackmapList,
  393.                                 ULONG ulNumTracks,
  394.                                 ULONG ulTrackID );
  395.  
  396. LONG ioIdentifyStorageSystem ( PMMIOINFO pmmioinfo,
  397.                                PSZ pszFileName );
  398.  
  399. VOID ioInstanceInit ( PINSTANCE pinstance );
  400.  
  401. LONG ioAddTracksToMovieHeader ( PINSTANCE pinstance );
  402.  
  403. LONG ioValidateRead ( PINSTANCE pinstance,
  404.                       PVOID pReadBuffer,
  405.                       ULONG ulNumTracks,
  406.                       PTRACKMAP patrackmapList );
  407.  
  408. /************************** Editing Prototypes *************************/
  409.  
  410. LONG           ioEditFindHeaders(PINSTANCE, PMMVIDEOHEADER *, PMMAUDIOHEADER *);
  411. LONG           ioEditSetup(PMMIOINFO, PMMIO_EDIT_PARMS);
  412. PEDITELEMENT   ioEditCloneEditList(PINSTANCE);
  413. LONG           ioEditPushEditToUndo(PINSTANCE);
  414. void           ioEditCleanup(PINSTANCE);
  415. ULONG          ioEditTimeToFrame(PMMVIDEOHEADER, ULONG);
  416. ULONG          ioEditFrameToTime(PMMVIDEOHEADER, ULONG);
  417. ULONG          ioEditDuration(PINSTANCE, PMMIO_EDIT_PARMS);
  418. LONG           ioEditGetFullName(PSZ, PSZ);
  419.  
  420. LONG           IOProcUndo(PMMIOINFO,  PMMIO_EDIT_PARMS);
  421. LONG           IOProcRedo(PMMIOINFO,  PMMIO_EDIT_PARMS);
  422. LONG           IOProcClear(PMMIOINFO, PMMIO_EDIT_PARMS);
  423. LONG           IOProcCut(PMMIOINFO,   PMMIO_EDIT_PARMS);
  424. LONG           IOProcCopy(PMMIOINFO,  PMMIO_EDIT_PARMS);
  425. LONG           IOProcPaste(PMMIOINFO, PMMIO_EDIT_PARMS);
  426.  
  427. LONG           IOProcSave(PMMIOINFO, PSZ);
  428. LONG           IOProcStatus(PMMIOINFO, ULONG, PMMIO_STATUS_PARMS);
  429. LONG           IOProcWinMsg(PMMIOINFO, PMMIO_WINMSG);
  430.  
  431. /* XLATOFF */
  432. #pragma pack()
  433. /* XLATON */
  434.