home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mmpm21tk.zip / TK / ULIOT / IOFORMAT.C < prev    next >
C/C++ Source or Header  |  1993-04-15  |  8KB  |  160 lines

  1. /*************************START OF SPECIFICATIONS *************************/
  2. /* SOURCE FILE NAME:  IOFORMAT.C                                          */
  3. /*                                                                        */
  4. /* DESCRIPTIVE NAME: File Format IO Proc format access module             */
  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 routines to get format info.     */
  13. /*                                                                        */
  14. /* NOTES:                                                                 */
  15. /*    DEPENDENCIES: none                                                  */
  16. /*    RESTRICTIONS: Runs in 32 bit protect mode (OS/2 2.0)                */
  17. /*                                                                        */
  18. /* ENTRY POINTS:                                                          */
  19. /*      IOProcGetFormatInfo                                               */
  20. /*      IOProcGetFormatName                                               */
  21. /*      ioGetFormatString                                                 */
  22. /*                                                                        */
  23. /************************* END OF SPECIFICATIONS **************************/
  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. #define FORMAT_NAME  "UMB (UltiMotion Beta) IO Procedure"
  44. #define NAME_LENGTH  sizeof(FORMAT_NAME)
  45.  
  46. /************************** START OF SPECIFICATIONS *************************/
  47. /*                                                                          */
  48. /* SUBROUTINE NAME: IOProcGetFormatInfo                                     */
  49. /*                                                                          */
  50. /* DESCRIPTIVE NAME: Get Format Information                                 */
  51. /*                                                                          */
  52. /* FUNCTION: This function provides access pre-defined structure values.    */
  53. /*                                                                          */
  54. /* NOTES: None                                                              */
  55. /*                                                                          */
  56. /* ENTRY POINT: IOProcGetFormatInfo                                         */
  57. /*   LINKAGE:   CALL FAR (00:32)                                            */
  58. /*                                                                          */
  59. /* INPUT:                                                                   */
  60. /*              PMMFORMATINFO  pmmformatinfo - Pointer to format info struct*/
  61. /*                                                                          */
  62. /* EXIT-NORMAL:                                                             */
  63. /*              MMIO_SUCCESS                                                */
  64. /*                                                                          */
  65. /* EXIT-ERROR:                                                              */
  66. /*              MMIO_ERROR                                                  */
  67. /*                                                                          */
  68. /* SIDE EFFECTS:                                                            */
  69. /*                                                                          */
  70. /*************************** END OF SPECIFICATIONS **************************/
  71. LONG IOProcGetFormatInfo ( PMMFORMATINFO pmmformatinfo )
  72.  
  73. {
  74.    LONG         rc;                              /* Return code.            */
  75.  
  76.   /*
  77.    * Validates parameters passed.
  78.    */
  79.   if (pmmformatinfo == NULL) {
  80.      return(MMIOERR_INVALID_STRUCTURE);
  81.      }
  82.  
  83.   if (CheckMem((PVOID)pmmformatinfo, sizeof(MMFORMATINFO), PAG_WRITE))
  84.      return (MMIOERR_INVALID_STRUCTURE);
  85.  
  86.   /**************************************************************************/
  87.   /* Copies IOProc_Entry information and capability flags to pmmformatinfo. */
  88.   /**************************************************************************/
  89.  
  90.    pmmformatinfo->ulStructLen  = sizeof (MMFORMATINFO);
  91.    pmmformatinfo->fccIOProc    = mmioFOURCC('U','L','I','O');
  92.    pmmformatinfo->ulIOProcType = MMIO_IOPROC_FILEFORMAT;
  93.    pmmformatinfo->ulMediaType  = MMIO_MEDIATYPE_MOVIE;
  94.    pmmformatinfo->ulFlags      = VALID_FORMAT_FLAGS;
  95.                                  
  96.    memset( pmmformatinfo->szDefaultFormatExt, '\0',
  97.           sizeof( pmmformatinfo->szDefaultFormatExt) );
  98.    strcpy ((PSZ) pmmformatinfo->szDefaultFormatExt, "UMB");
  99.  
  100.    pmmformatinfo->ulCodePage   = MMIO_DEFAULT_CODE_PAGE;
  101.    pmmformatinfo->ulLanguage   = MMIO_LC_US_ENGLISH;
  102.    pmmformatinfo->lNameLength  = NAME_LENGTH;
  103.  
  104.    return(MMIO_SUCCESS);
  105. }
  106.  
  107.  
  108. /************************** START OF SPECIFICATIONS *************************/
  109. /*                                                                          */
  110. /* SUBROUTINE NAME: IOProcGetFormatName                                     */
  111. /*                                                                          */
  112. /* DESCRIPTIVE NAME: Get Format Name.                                       */
  113. /*                                                                          */
  114. /* FUNCTION: This function provides access to the format name.              */
  115. /*                                                                          */
  116. /* NOTES: String is not NULL terminated.                                    */
  117. /*                                                                          */
  118. /* ENTRY POINT: IOProcGetFormatName                                         */
  119. /*   LINKAGE:   CALL FAR (00:32)                                            */
  120. /*                                                                          */
  121. /* INPUT:                                                                   */
  122. /*           PSZ        pszNameBuf - Pointer to caller's text buffer.       */
  123. /*           LONG       NameBufLen - Length of caller's text buffer.        */
  124. /*                                                                          */
  125. /* EXIT-NORMAL:                                                             */
  126. /*              Length of format name string. (MaxLen)                      */
  127. /*                                                                          */
  128. /* EXIT-ERROR:                                                              */
  129. /*              0L                                                          */
  130. /*                                                                          */
  131. /* SIDE EFFECTS:                                                            */
  132. /*                                                                          */
  133. /*************************** END OF SPECIFICATIONS **************************/
  134. LONG IOProcGetFormatName ( PSZ  pszNameBuf,
  135.                            LONG NameBufLen )
  136.  
  137. {
  138.    LONG         rc;
  139.  
  140.    /*
  141.     * Validates parameters passed.
  142.     */
  143.    if (pszNameBuf == NULL) {               /* Must have text buffer.  */
  144.       return(0L);
  145.       }
  146.  
  147.    if ((NameBufLen <= 0L) ||
  148.        CheckMem((PVOID)pszNameBuf, NameBufLen, PAG_WRITE))
  149.       return (0L);
  150.  
  151.    if (NameBufLen < NAME_LENGTH)
  152.       return (0L);
  153.  
  154.    memcpy(pszNameBuf, FORMAT_NAME, NAME_LENGTH);
  155.  
  156.    return(NAME_LENGTH);
  157. }
  158.  
  159.  
  160.