home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / viscobv6.zip / vac22os2 / ibmcobol / samples / toolkit / mm / ultimoio / ulident.c < prev    next >
C/C++ Source or Header  |  1996-11-19  |  7KB  |  120 lines

  1. /*************************START OF SPECIFICATIONS *************************/
  2. /* SOURCE FILE NAME:  ULIDENT.C                                           */
  3. /*                                                                        */
  4. /* DESCRIPTIVE NAME: Ultimotion IO Proc routine for MMIOM_IDENTIFYFILE    */
  5. /*                                                                        */
  6. /* COPYRIGHT:     IBM - International Business Machines                   */
  7. /*            Copyright (c) IBM Corporation  1991, 1992, 1993             */
  8. /*                        All Rights Reserved                             */
  9. /*                                                                        */
  10. /* STATUS: OS/2 Release 2.0                                               */
  11. /*                                                                        */
  12. /* FUNCTION: This source module contains the identify routine.            */
  13. /*                                                                        */
  14. /* NOTES:                                                                 */
  15. /*    DEPENDENCIES: none                                                  */
  16. /*    RESTRICTIONS: Runs in 32 bit protect mode (OS/2 2.0)                */
  17. /*                                                                        */
  18. /* ENTRY POINTS:                                                          */
  19. /*     IOProcIdentifyFile                                                 */
  20. /*                                                                        */
  21. /************************* END OF SPECIFICATIONS **************************/
  22.  
  23.  
  24. #include        <stdio.h>
  25. #include        <string.h>
  26. #include        <stdlib.h>
  27. #include        <memory.h>
  28.  
  29. #define         INCL_DOS                        /* #define  INCL_DOSPROCESS.*/
  30. #define         INCL_ERRORS
  31. #define         INCL_WIN
  32. #define         INCL_GPI
  33. #include        <os2.h>                         /* OS/2 headers.            */
  34. #include        <pmbitmap.h>
  35.  
  36. #define         INCL_OS2MM
  37. #define         INCL_MMIO_CODEC
  38. #define         INCL_MMIO_DOSIOPROC
  39. #include        <os2me.h>                       /* Multi-Media IO extensions.*/
  40. #include        <ioi.h>
  41.  
  42.  
  43.  
  44. /************************** START OF SPECIFICATIONS *************************/
  45. /*                                                                          */
  46. /* SUBROUTINE NAME: IOProcIdentifyFile                                      */
  47. /*                                                                          */
  48. /* DESCRIPTIVE NAME: Identify file type.                                    */
  49. /*                                                                          */
  50. /* FUNCTION: This function tests if the file is Ultimotion type file.       */
  51. /*                                                                          */
  52. /* NOTES: None                                                              */
  53. /*                                                                          */
  54. /* ENTRY POINT: IOProcIdentifyFile                                          */
  55. /*   LINKAGE:   CALL FAR (00:32)                                            */
  56. /*                                                                          */
  57. /* INPUT:                                                                   */
  58. /*        PMMIOINFO  pmmioinfo   - MMIOINFO structure. (Maybe NULL)         */
  59. /*        PSZ        pszFileName - Pointer to file name.                    */
  60. /*        HMMIO      FileHandle  - MMIO file handle obtained from mmioOpen. */
  61. /*                                                                          */
  62. /* EXIT-NORMAL:                                                             */
  63. /*              MMIO_SUCCESS                                                */
  64. /*                                                                          */
  65. /* EXIT-ERROR:                                                              */
  66. /*              MMIO_ERROR                                                  */
  67. /*                                                                          */
  68. /*                                                                          */
  69. /* SIDE EFFECTS:                                                            */
  70. /*                                                                          */
  71. /*************************** END OF SPECIFICATIONS **************************/
  72. LONG IOProcIdentifyFile ( PMMIOINFO pmmioinfo,
  73.                           PSZ pszFileName,
  74.                           HMMIO FileHandle )
  75.  
  76. {
  77.   ULONG                  rc;                         /* Return code.        */
  78.   LONG                   lFilePosition;              /* Temp file position. */
  79.   HMMIO                  WorkHandle;                 /* Local work handle.  */
  80.   MMCKINFO               mmckinfo;
  81.  
  82.  
  83.   WorkHandle = FileHandle;
  84.  /***************************************************************************/
  85.  /* file hasn't been open, must have file name else error returned.         */
  86.  /***************************************************************************/
  87.   if (WorkHandle == (HMMIO)0L){
  88.       if (pszFileName == (PSZ) 0L){
  89.           return(MMIOERR_INVALID_FILENAME);
  90.           } /* end if */
  91.  
  92.       WorkHandle = mmioOpen(pszFileName, NULL,MMIO_NOIDENTIFY);
  93.  
  94.      /***********************************************************************/
  95.      /* If open file failed, clean up IOProc instant struct, error returned.*/
  96.      /***********************************************************************/
  97.       if (WorkHandle == (HMMIO)0L){
  98.          return(MMIO_ERROR);
  99.           } /* end if */
  100.       } /* end if */
  101.  
  102.  /***************************************************************************/
  103.  /* if file has been opened, temporary resets file position to beginning    */
  104.  /* of file.                                                                */
  105.  /***************************************************************************/
  106.   if (WorkHandle != (HMMIO)0L){
  107.       lFilePosition = ioSeekFile((PLONG)&rc,WorkHandle,0L);
  108.       if (lFilePosition < MMIO_SUCCESS) {
  109.          return(MMIO_ERROR);
  110.          } /* end if */
  111.       } /* end if */
  112.  
  113.   /* Find SMV Riff chunk (This verifies the file is an SMV movie file also */
  114.   memset (&mmckinfo, '\0', sizeof(MMCKINFO));
  115.   mmckinfo.fccType = mmioStringToFOURCC(UMFORM_MOVIE ,0L);
  116.   rc = mmioDescend(WorkHandle,&mmckinfo,NULL,MMIO_FINDRIFF);
  117.   return (rc);
  118.  
  119. }
  120.