home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / mm / admct / admcload.c < prev    next >
C/C++ Source or Header  |  1999-05-11  |  22KB  |  690 lines

  1. /********************* START OF SPECIFICATIONS *********************
  2. *
  3. * SUBROUTINE NAME: MCILOAD.C
  4. *
  5. * DESCRIPTIVE NAME: Audio MCD Load Element Routine.
  6. *
  7. *
  8. *
  9. *              Copyright (c) IBM Corporation  1991, 1993
  10. *                        All Rights Reserved
  11. *
  12. * FUNCTION:Load an Waveform Element.
  13. *
  14. * NOTES:
  15. *
  16. * ENTRY POINTS:
  17. *
  18. * INPUT: MCI_LOAD message.
  19. *
  20. * EXIT-NORMAL: MCIERR_SUCCESS.
  21. *
  22. * EXIT_ERROR:  Error Code.
  23. *
  24. * EFFECTS:
  25. *
  26. * INTERNAL REFERENCES:    CreateNAssocStream ().
  27. *                         DestroyStream().
  28. *                         SetAudioDevice().
  29. *                         VSDInstToWaveSetParms().
  30. *                         OpenFile().
  31. *
  32. * EXTERNAL REFERENCES:    SpiStopStream  ().
  33. *                         SpiAssociate   ().
  34. *                         SpiDisableEvent().
  35. *                         SpiSeekStream  ().
  36. *
  37. *********************** END OF SPECIFICATIONS **********************/
  38. #define INCL_BASE
  39. #define INCL_DOSMODULEMGR
  40. #define INCL_DOSSEMAPHORES
  41.  
  42. #include <os2.h>
  43. #include <string.h>
  44. #include <os2medef.h>                   // MME includes files.
  45. #include <ssm.h>                        // SSM spi includes.
  46. #include <meerror.h>                    // MM Error Messages.
  47. #include <mmioos2.h>                    // MMIO Include.
  48. #include <mcios2.h>                     // MM System Include.
  49. #include <mmdrvos2.h>                   // Mci Driver Include.
  50. #include <mcipriv.h>                    // MCI Connection stuff
  51. #include <mcd.h>                        // VSDIDriverInterface.
  52. #include <hhpheap.h>                    // Heap Manager Definitions
  53. #include <qos.h>
  54. #include <audiomcd.h>                   // Component Definitions.
  55. #include "admcfunc.h"                   // Function Prototypes
  56. #include <sw.h>
  57. #include <checkmem.h>
  58.  
  59. /********************* START OF SPECIFICATIONS *********************
  60. *
  61. * SUBROUTINE NAME: MCILOAD.C
  62. *
  63. * DESCRIPTIVE NAME: Audio MCD Load Element Routine.
  64. *
  65. * FUNCTION:Load an Waveform Element.
  66. *
  67. * NOTES: The following concepts are illustrated in this file.
  68. *  A. How to check flags on a load.
  69. *  B. How to stop any commands which are in process.
  70. *  C. Why cuepoints/positionadvises need to be turned off on a MCI_LOAD.
  71. *  D. Handling OPEN_MMIO on an MCI_LOAD.
  72. *  E. Why reassociation of a stream on MCI_LOAD is desirable and
  73. *     when it is appropriate.
  74. *
  75. * ENTRY POINTS:
  76. *
  77. * INPUT: MCI_LOAD message.
  78. *
  79. * EXIT-NORMAL: Return Code 0.
  80. *
  81. * EXIT_ERROR:  Error Code.
  82. *
  83. * EFFECTS:
  84. *
  85. * INTERNAL REFERENCES:DestroyStream(), ReadRIFFWaveHeaderInfo()
  86. *                     SetAmpDefaults(), SetWaveDeviceDefaults().
  87. *                     SetAudioDevice().
  88. *
  89. * EXTERNAL REFERENCES:
  90. *
  91. *********************** END OF SPECIFICATIONS **********************/
  92.  
  93.  
  94. RC MCILoad ( FUNCTION_PARM_BLOCK *pFuncBlock)
  95. {
  96.  
  97.   ULONG                ulrc;                // MME Propogated Error RC
  98.   ULONG                ulHoldError;         /* Hold status of errors */
  99.   ULONG                ulParam1;            // Incoming MCI Flags
  100.   ULONG                ulAbortNotify = FALSE;// indicates whether to abort a previous
  101.   ULONG                ulOldMode;           // indicates if stream must be destroyed
  102.                                             // or reassociated
  103.   ULONG                ulOldDataType;       // ditto--see comments below.
  104.                                             // operation
  105.   ULONG                ulOldBPS;
  106.   ULONG                ulOldSampRate;
  107.   ULONG                ulOldChannels;
  108.  
  109.   ULONG                ulLoadFlags;         // Incoming Flags Mask
  110. //  ULONG                ulSetAll;            //  Reinit AudioIF
  111.  
  112.   BOOL                 fMustReinit = FALSE;
  113.   INSTANCE             *ulpInstance;        // Local Instance//
  114.  
  115.   PMCI_LOAD_PARMS      pLoadParms;         // App MCI Data Struct
  116. //  MCI_WAVE_SET_PARMS   SetParms;            // App MCI Data Struct
  117.  
  118. //  MCI_AMP_INSTANCE     BackupAmp;           // Hold old amp values
  119.  
  120. //  extern HHUGEHEAP     heap;                // Global MCD Heap
  121.   extern HID           hidASource;          // hid's for FSSH
  122.   extern HID           hidATarget;          // "     "      "
  123.  
  124.   MTIME_EVCB           *pMCuePtEVCB;
  125.   MTIME_EVCB           *pTempCuePtEVCB;
  126.  
  127.  
  128.  
  129.   /**************************************
  130.   * Dereference Pointers
  131.   **************************************/
  132.   ulpInstance = (INSTANCE *)pFuncBlock->ulpInstance;
  133.   ulParam1 = pFuncBlock->ulParam1;
  134.   ulParam1 &= ~MCI_OPEN_ELEMENT;
  135.   ulLoadFlags = ulParam1;
  136.  
  137.   /*---------------------------------------------------------
  138.   * Make a copy of the amp/mixer instance in case any errors
  139.   * happened.
  140.   *---------------------------------------------------------*/
  141.  
  142. //  memmove( &BackupAmp, &MIX, sizeof( MCI_AMP_INSTANCE ) );
  143.  
  144.  
  145.   /**************************************
  146.   * Mask UnWanted Bits
  147.   **************************************/
  148.   ulLoadFlags &= ~(MCI_NOTIFY + MCI_WAIT + MCI_OPEN_MMIO + MCI_READONLY );
  149.  
  150.  
  151. //  ulSetAll = MCI_WAVE_SET_BITSPERSAMPLE | MCI_WAVE_SET_FORMATTAG     |
  152. //             MCI_WAVE_SET_CHANNELS      | MCI_WAVE_SET_SAMPLESPERSEC;
  153.  
  154.  
  155.   if ( ulLoadFlags > 0 )
  156.      {
  157.  
  158.      if ( ulParam1 & MCI_OPEN_PLAYLIST)
  159.         {
  160.         return ( MCIERR_UNSUPPORTED_FLAG );
  161.         }
  162.  
  163.      return ( MCIERR_INVALID_FLAG );
  164.      }
  165.  
  166.  
  167.  
  168.   /****************************************
  169.   * Check For Valid Parameters and memory
  170.   ****************************************/
  171.  
  172.   pLoadParms = (PMCI_LOAD_PARMS) pFuncBlock->ulParam2;
  173.  
  174.   ulrc = CheckMem ( (PVOID)pLoadParms,
  175.                     sizeof (MCI_LOAD_PARMS),
  176.                     PAG_READ);
  177.  
  178.   if (ulrc != MCIERR_SUCCESS)
  179.           return ( MCIERR_MISSING_PARAMETER );
  180.  
  181.  
  182.   /*-------------------------------------------
  183.   * If the caller used a readonly flag and
  184.   * there was no filename, this is an
  185.   * invalid combination.
  186.   *------------------------------------------*/
  187.  
  188.   if ( ulParam1 & MCI_READONLY &&
  189.        !pLoadParms->pszElementName )
  190.      {
  191.      return ( MCIERR_MISSING_PARAMETER );
  192.      }
  193.  
  194.   /******************************************
  195.   * If these variables change during the
  196.   * load, then the stream must be destroyed
  197.   * rather than reassociated since SSM's
  198.   * buffer sizes can easily change.
  199.   *******************************************/
  200.  
  201. // 6421--don't use VSD instance--maintain own local copy.
  202.  
  203. //  ulOldMode     = AMPMIX.ulOperation;
  204. //  ulOldBPS      = AMPMIX.lBitsPerSRate;
  205. //  ulOldSampRate = AMPMIX.lSRate;
  206. //  ulOldDataType = AMPMIX.sMode;
  207. //  ulOldChannels = AMPMIX.sChannels;
  208.  
  209.   ulOldMode     = ulpInstance->ulOperation;
  210.   ulOldBPS      = WAVEHDR.usBitsPerSample;
  211.   ulOldSampRate = WAVEHDR.ulSamplesPerSec;
  212.   ulOldDataType = WAVEHDR.usFormatTag;
  213.   ulOldChannels = WAVEHDR.usChannels;
  214.  
  215.   /****************************************************
  216.   * Get the semaphore which allows us to abort pending
  217.   * plays and records.
  218.   ****************************************************/
  219.  
  220.   GetNotifyAbortAccess ( ulpInstance, &ulAbortNotify );
  221.  
  222.   /****************************************************
  223.   * Interrupt any plays/records/saves which are pending
  224.   * so the load can continue
  225.   ****************************************************/
  226.  
  227.   ulrc = LoadAbortNotifies( ulpInstance, pFuncBlock, ulAbortNotify );
  228.  
  229.   if ( ulrc )
  230.      {
  231.      return ( ulrc );
  232.      }
  233.  
  234.   ulpInstance->ulOldStreamPos  = 0;
  235.  
  236.  
  237.   /********************************************
  238.   * If the user has enabled cuepoints discard
  239.   * them since this is a new file.  If we do not
  240.   * do this, then cuepoints could pop up in the
  241.   * new file which were set in the old file.
  242.   ********************************************/
  243.  
  244.   if ((ulpInstance->usCuePt == TRUE) || (ulpInstance->usCuePt == EVENT_ENABLED))
  245.      {
  246.      pMCuePtEVCB = CUEPOINT;
  247.  
  248.      while ( pMCuePtEVCB )
  249.         {
  250.         if (ulpInstance->ulCreateFlag == PREROLL_STATE)
  251.             {
  252.             ADMCDisableEvent (pMCuePtEVCB->HCuePtHndl );
  253.             }
  254.         pTempCuePtEVCB = pMCuePtEVCB;
  255.         pMCuePtEVCB = pMCuePtEVCB->pNextEVCB;
  256.         CleanUp( pTempCuePtEVCB );
  257.         } /* while there are cue points to remove */
  258.  
  259.      CUEPOINT = NULL;
  260.  
  261.      } /* if we have cue points in use */
  262.  
  263.  
  264.   /****************************************************
  265.   * Disable Position Advise (i.e. the user may have
  266.   * turned on position advise in the previous stream
  267.   * and since we can possibly reusing the stream, turn
  268.   * off position advise.
  269.   ****************************************************/
  270.  
  271. // why is there two states for this flag--why not just one?
  272.  
  273.   if ( (ulpInstance->usPosAdvise == TRUE) ||
  274.        (ulpInstance->usPosAdvise == EVENT_ENABLED))
  275.       {
  276.       if (ulpInstance->ulCreateFlag == PREROLL_STATE)
  277.  
  278.           ADMCDisableEvent (ulpInstance->StreamInfo.hPosEvent);
  279.  
  280.       ulpInstance->usPosAdvise = FALSE;
  281.       }
  282.  
  283.   /* Remove any undo nodes if they were allocated */
  284.  
  285.   RemoveUndoNodes( ulpInstance );
  286.  
  287.   /************************************************
  288.   * If a file was previously opened then close it
  289.   * (however, if it was opened with the OPEN_MMIO
  290.   * flag, then don't close it.  That is the
  291.   * applications responsibility).
  292.   ************************************************/
  293.  
  294.   ulrc = CloseFile( ulpInstance );
  295.  
  296.  
  297.   /**************************************************
  298.   * Check for valid element names -- ONLY if the user
  299.   * passed in a filename, not a file handle
  300.   **************************************************/
  301.  
  302.   if ( !( ulParam1 & MCI_OPEN_MMIO )  )
  303.      {
  304.  
  305.      ulrc = CheckForValidElement( ulpInstance,
  306.                                   pLoadParms->pszElementName,
  307.                                   ulParam1 );
  308.  
  309.      if ( ulrc )
  310.         {
  311.         ulpInstance->fFileExists = FALSE;
  312.         return ( ulrc );
  313.         }
  314.  
  315.      } /* if the user did not pass in a file handle instead of a file name */
  316.  
  317.  
  318.  
  319.  
  320.   /******************************************************
  321.   * If hmmio is passed in just update instance copy of
  322.   * hmmio, reset filexists flag and return success
  323.   *****************************************************/
  324.  
  325.   ulrc = OpenHandle( ulpInstance,
  326.                      ulParam1,
  327.                      (HMMIO) pLoadParms->pszElementName);
  328.  
  329.   if ( ulrc )
  330.      {
  331.      /* Set a flag to indicate that there no longer is a valid file loaded */
  332.  
  333.      ulpInstance->fFileExists = TRUE;
  334.      return ( ulrc );
  335.      }
  336.  
  337.   /**************************************************************
  338.   * Temporary File creation Flags.  If the io proc cannot
  339.   * perform temporary changes or the user specifically requested
  340.   * that the file was opened read only then do not try to
  341.   * perform temporary changes on the file (both of those actions
  342.   * require the ability to write).
  343.   ***************************************************************/
  344.  
  345.   if ( ulParam1 & MCI_READONLY )
  346.      {
  347.      ulpInstance->ulOpenTemp = MCI_FALSE;
  348.      }
  349.   else
  350.      {
  351.      ulpInstance->ulOpenTemp = MCI_TRUE;
  352.      }
  353.  
  354.  
  355.   ulpInstance->ulUsingTemp = MCI_FALSE;
  356.   /* Set flag to indicate no codec is active */
  357.  
  358.   ulpInstance->ulRealTimeTranslation = MMIO_NONREALTIME;
  359.  
  360.  
  361.   if ( !( ulParam1 & MCI_OPEN_MMIO ) )
  362.  
  363.       {
  364.       ulrc = ProcessElement( ulpInstance, ulParam1, MCI_LOAD );
  365.  
  366.       if ( ulrc )
  367.          {
  368.          /* If processelements fails, it sets fFileExists to false */
  369.  
  370.          return ( ulrc );
  371.          }
  372.  
  373.       } /* Element Specified on Load */
  374.  
  375.  
  376.   /*******************************************
  377.   * Copy audio device attributes into MCI
  378.   * Wave Set structure
  379.   ********************************************/
  380. // 6421--no longer needed
  381. //  VSDInstToWaveSetParms ( &SetParms, ulpInstance);
  382.  
  383.   /**********************************************
  384.   * Set the Audio device attributes.
  385.   * ulSetAll is a flag set to waveaudio extensions
  386.   *************************************************/
  387.  
  388.   /**************************************************
  389.   * If the audio card switched modes (i.e. from play
  390.   * to record) because of the file load, then the
  391.   * stream must be destroyed and there is no
  392.   **************************************************/
  393.  
  394. //  if ( ulOldMode     != AMPMIX.ulOperation     ||   WAVEHDR.usBitsPerSample
  395. //       ulOldDataType != ( ULONG ) AMPMIX.sMode ||   WAVEHDR.ulSamplesPerSec
  396. //       ulOldBPS      != AMPMIX.lBitsPerSRate   ||   ;
  397. //       ulOldSampRate != AMPMIX.lSRate          ||   WAVEHDR.usChannels;
  398. //       ulOldChannels != AMPMIX.sChannels )
  399.  
  400.   if ( ulOldMode     != ulpInstance->ulOperation ||
  401.        ulOldDataType != WAVEHDR.usFormatTag      ||
  402.        ulOldBPS      != WAVEHDR.usBitsPerSample  ||
  403.        ulOldSampRate != WAVEHDR.ulSamplesPerSec  ||
  404.        ulOldChannels != WAVEHDR.usChannels )
  405.      {
  406.      fMustReinit = TRUE;
  407.  
  408.      /******************************************
  409.      * Determine if the network can go into the
  410.      * mode that matches the file we just loaded.
  411.      ********************************************/
  412.      ulrc = ModifyConnection( ulpInstance );
  413. // CONNECTION FEATURE
  414. //     ulrc = SetAudioDevice (ulpInstance, &SetParms, ulSetAll);
  415. // CONNECTION FEATURE
  416.      if (ulrc)
  417.  
  418.         {
  419.         ulHoldError = ulrc;
  420. #ifndef CONNECTION
  421.  
  422.         if ( ulrc == MCIERR_UNSUPP_FORMAT_TAG )
  423.            {
  424.            /******************************************
  425.            * Connected device will update the the audio
  426.            * header to reflect the mode that the device
  427.            * should be opened in.
  428.            ********************************************/
  429.            ulrc = ModifyConnection( ulpInstance );
  430.            }
  431.  
  432. #endif
  433.         if ( ulrc )
  434.            {
  435.            /* Dont leave the file open */
  436.  
  437.            CloseFile( ulpInstance );
  438.  
  439.            /* Set a flag to indicate that there no longer is a valid file loaded */
  440.  
  441.            ulpInstance->fFileExists = FALSE;
  442.  
  443.            /* Ensure that our instance remains the same as before the load attempt */
  444.  
  445.            return ( ulHoldError );
  446.            } /* if error on 2nd call */
  447.  
  448.         ulpInstance->ulRealTimeTranslation = MMIO_REALTIME;
  449.  
  450.         } /* If error on modify connection */
  451.      else
  452.         {
  453.         ulpInstance->ulRealTimeTranslation = MMIO_NONREALTIME;
  454.         }
  455.  
  456.      }
  457.   else
  458.      {
  459.      fMustReinit = FALSE;
  460.      }
  461.  
  462.   /*************************************************************
  463.   * If a stream has previously been created, it will be simpler
  464.   * and quicker to just reassociate the stream handlers.
  465.   * reassociation requires that the stream be stoped however
  466.   * before continuing.
  467.   *************************************************************/
  468.  
  469.   if (ulpInstance->ulCreateFlag == PREROLL_STATE)
  470.      {
  471.      /**************************************************
  472.      * If the audio card switched modes (i.e. from play
  473.      * to record) because of the file load, then the
  474.      * stream must be destroyed and there is no
  475.      * way to reassociate it.  In addition, reassociation
  476.      * is only possible if the data type, bits/sample
  477.      * sampling rate and channels remain the same.  If
  478.      * you have a non-audio streaming MCD, then reassociation
  479.      * is only possible when the data type and subtype
  480.      * remain the same.
  481.      *
  482.      * We also must recreate the stream if we had
  483.      * previously installed a protocol with spiInstallProtocol
  484.      **************************************************/
  485.  
  486.      if ( fMustReinit || ulpInstance->fInstalledProtocol )
  487.  
  488.          {
  489.          /**********************************************
  490.          * Destroy The Stream -- no hope to reassociate
  491.          ***********************************************/
  492. // CONNECTION FEATURE--what do I do with this???????
  493. #ifndef CONNECTION
  494.          DestroyStream ( ulpInstance);
  495. #endif
  496. // CONNECTION FEATURE--what do I do with this???????
  497.  
  498.          /*************************************
  499.          * Set Stream Creation Flag-- so that
  500.          * following routines know to create
  501.          * the stream
  502.          **************************************/
  503.  
  504.          ulpInstance->ulCreateFlag = CREATE_STATE;
  505.  
  506.          }
  507.      else
  508.          {
  509.          /*************************************
  510.          * Place the stream in a stopped state
  511.          * which is required for reassociation.
  512.          *************************************/
  513. // CONNECTOR FEATURE
  514.          ulrc = StopStream2( ulpInstance, MCIDRV_DISCARD_STREAM_NETWORK );
  515. //         ulrc = ADMCStopStream (ulpInstance->StreamInfo.hStream, SPI_STOP_DISCARD );
  516. //
  517. //         if (!ulrc)
  518. //            {
  519. //            DosWaitEventSem (ulpInstance->hEventSem, (ULONG) -1 );
  520. //            }
  521.          } /* the audio card did not switch modes */
  522. // CONNECTOR FEATURE
  523.  
  524.      }  /* Stream in PreRoll (started) State */
  525.  
  526.  
  527.  
  528.   /***********************************************************
  529.   * perform this after the open because open file will modify
  530.   * the state of the following flags
  531.   ***********************************************************/
  532.  
  533.   if ( ulParam1 & MCI_READONLY )
  534.      {
  535.      ulpInstance->ulCapabilities &= ~( CAN_SAVE | CAN_RECORD );
  536.      }
  537.  
  538.  
  539.   /*****************************************************
  540.   * Currently return true if a playlst strm was created
  541.   *****************************************************/
  542.   if (ulpInstance->usPlayLstStrm == TRUE)
  543.       {
  544.       ulpInstance->StreamInfo.hidASource = hidASource;
  545.       ulpInstance->StreamInfo.hidATarget = hidATarget;
  546.  
  547.       ulpInstance->usPlayLstStrm = FALSE;
  548.  
  549.       }  /* Trash the old Stream Handler Handles */
  550.  
  551.   /*************************************************
  552.   * Reassociate The Stream Handlers with the new
  553.   * stream object if the stream has been created
  554.   * in the correct direction already.
  555.   *************************************************/
  556.   if (ulpInstance->ulCreateFlag == PREROLL_STATE)
  557.       {
  558.       /*********************************************
  559.       * Fill in Associate Control Block Info for
  560.       * file system stream handler (FSSH).  FSSH will
  561.       * use the mmio handle we are associating to
  562.       * stream information.
  563.       *********************************************/
  564.       ulpInstance->StreamInfo.acbmmio.ulObjType = ACBTYPE_MMIO;
  565.       ulpInstance->StreamInfo.acbmmio.ulACBLen = sizeof (ACB_MMIO);
  566.       ulpInstance->StreamInfo.acbmmio.hmmio = ulpInstance->hmmio;
  567.  
  568.       /***********************************************
  569.       * Associate FileSystem as source if Playing. Note
  570.       * the association is always done with the file
  571.       * system stream handler since it is invovled with
  572.       * mmio operations.  If you try this with the
  573.       * audio stream handler, you will get invalid
  574.       * handle back.
  575.       ***********************************************/
  576.  
  577.       if (ulpInstance->ulOperation == MCIDRV_OUTPUT )
  578.          {
  579.          ulrc = ADMCAssociate ( ulpInstance->StreamInfo.hStream,
  580.                                ulpInstance->StreamInfo.hidASource,
  581.                                (PVOID) &ulpInstance->StreamInfo.acbmmio );
  582.          }
  583.       /***********************************************
  584.       * Associate FileSystem as target if recording
  585.       ***********************************************/
  586.  
  587.       else
  588.          {
  589.          ulrc = ADMCAssociate ( ulpInstance->StreamInfo.hStream,
  590.                                ulpInstance->StreamInfo.hidATarget,
  591.                                (PVOID) &ulpInstance->StreamInfo.acbmmio );
  592.  
  593.          } /* else we are in record mode */
  594.  
  595.       /* If the SpiAssociate failed, return an error */
  596.  
  597.       if ( ulrc )
  598.          {
  599.          return ( ulrc );
  600.          }
  601.  
  602.          /******************************************************************
  603.          * We need to seek to 0 to reset the target stream handlers position
  604.          * since an associate DOES NOT reset the current stream's time.
  605.          *******************************************************************/
  606.  
  607.          ulrc = ADMCSeekStream ( ulpInstance,
  608.                                 SPI_SEEK_ABSOLUTE,
  609.                                 0L );
  610.  
  611.          if (ulrc)
  612.             {
  613.             return (ulrc);
  614.             }
  615.  
  616.       } /* Preoll State Flag */
  617.  
  618.   /****************************************************
  619.   * If the user did not pass in the read only flag then
  620.   * tell the io proc that we have opened to to use temp
  621.   * files (if it can).  Temp files will allow the user
  622.   * to abort changes.
  623.   *****************************************************/
  624.  
  625.   if ( ulpInstance->ulOpenTemp )
  626.     {
  627.  
  628.     ulrc = SetupTempFiles( ulpInstance, ulParam1 );
  629.  
  630.     if ( ulrc )
  631.        {
  632.        ulpInstance->fFileExists = FALSE;
  633.        return ( ulrc );
  634.        }
  635.     }
  636.  
  637.  
  638.   /****************************************************
  639.   * Inform the io proc whether or not the data should
  640.   * be translated real-time or not.
  641.   *****************************************************/
  642.  
  643. // ignore error--io procs may not support this
  644. // CONNECTOR FEATURE
  645. #ifndef CONNECTION
  646.   ulpInstance->ulCodecDescription = MAKE_SOURCE | SOURCE_CODEC;
  647.  
  648.   ulrc = DataTranslation( ulpInstance );
  649.   if ( ulrc )
  650.      {
  651.      ulpInstance->fFileExists = FALSE;
  652.      return ( ulHoldError );
  653.      }
  654. #endif
  655. // CONNECTOR FEATURE
  656.  
  657.  
  658.   /********************************************
  659.   * We will say that the stream is in a stopped
  660.   * state so that subsequent operations know
  661.   * that it will be safe to do operations on
  662.   * the stream--such as a cue or a seek.
  663.   ********************************************/
  664.  
  665.   STRMSTATE = MCI_STOP;
  666.  
  667.   /*---------------------------------------------------
  668.   * If the file is readonly, we are guaranteed that
  669.   * it will not change.  In addition, if the file
  670.   * is small, SSM may be allocating too many buffers
  671.   * (since they are unaware of the file size).
  672.   * Check to see if we can reduce memory consumption.
  673.   *--------------------------------------------------*/
  674.  
  675.   if ( ulParam1 & MCI_READONLY )
  676.      {
  677.      InstallProtocol( ulpInstance );
  678.      }
  679.  
  680.  
  681.   return (ulrc);
  682.  
  683. } /* MCILoad */
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.