home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 24 / AACD 24.iso / AACD / Programming / mhi_dev / Autodoc / mhi.doc next >
Encoding:
Text File  |  2001-08-02  |  11.6 KB  |  461 lines

  1. TABLE OF CONTENTS
  2.  
  3. MHI/MHIAllocDecoder
  4. MHI/MHIFreeDecoder
  5. MHI/MHIGetEmpty
  6. MHI/MHIGetStatus
  7. MHI/MHIPause
  8. MHI/MHIPlay
  9. MHI/MHIQuery
  10. MHI/MHIQueueBuffer
  11. MHI/MHISetParam
  12. MHI/MHIStop
  13. MHI/MHIAllocDecoder                                       MHI/MHIAllocDecoder
  14.  
  15.    NAME   
  16.        MHIAllocDecoder - allocate a decoder
  17.  
  18.    SYNOPSIS
  19.        handle = MHIAllocDecoder(task, mhisignal);
  20.        d0                       a0    d0
  21.  
  22.        APTR MHIAllocDecoder (Task *, ULONG mhisignal);
  23.  
  24.    FUNCTION
  25.        Allocate a decoder. This function gives you a handle in d0 which is
  26.        required by other MHI functions. The handle is private and it's
  27.        contents will vary with each decoder, so don't poke it. Note that
  28.        some decoders may allow more than one handle to be allocated,
  29.        meaning that they can output more than one MPEG stream at once.
  30.  
  31.        When you allocate a handle all resources required by the decoder are
  32.        also allocated (memory, hardware etc). The decoder is then ready to
  33.        start decoding.
  34.  
  35.    INPUTS
  36.        task      - a pointer to the task you want to receive signals
  37.                    from MHI
  38.        mhisignal - a signal mask to use when signaling your task
  39.  
  40.    RESULT
  41.        handle    - a pointer to your handle
  42.  
  43.    EXAMPLE
  44.        /* Note: use more error checking! */
  45.        /* See example code               */
  46.        mytask = FindTask(0);
  47.        mysignal = AllocSignal(-1);
  48.        sigmask = 1L << mysignal;
  49.        handle = MHIAllocDecoder(mytask, sigmask);
  50.  
  51.    NOTES
  52.        You must dispose of your handle when done with it.
  53.  
  54.    BUGS
  55.  
  56.    SEE ALSO
  57.        MHIFreeDecoder
  58.  
  59. MHI/MHIFreeDecoder                                         MHI/MHIFreeDecoder
  60.  
  61.    NAME
  62.        MHIFreeDecoder - free a decoder up
  63.  
  64.    SYNOPSIS
  65.        MHIFreeDecoder(handle);
  66.                       a3
  67.  
  68.        VOID MHIFreeDecoder(APTR handle);
  69.  
  70.    FUNCTION
  71.        Free the given handle. You must call this function when you are
  72.        finished with a handle and wish to free the decoder up.
  73.  
  74.    INPUTS
  75.        handle  - the handle you were allocated
  76.  
  77.    RESULT
  78.        None
  79.  
  80.    EXAMPLE
  81.        MHIFreeDecoder(handle);
  82.  
  83.    NOTES
  84.        No checking is done, so don't pass a bad handle.
  85.  
  86.    BUGS
  87.  
  88.    SEE ALSO
  89.        MHIAllocDecoder
  90.  
  91. MHI/MHIGetEmpty                                               MHI/MHIGetEmpty
  92.  
  93.    NAME
  94.        MHIGetEmpty
  95.  
  96.    SYNOPSIS
  97.        buffer = MHIGetEmpty(handle);
  98.        d0                   a3
  99.  
  100.        APTR MHIGetEmpty(APTR handle);
  101.  
  102.    FUNCTION
  103.        Find the next empty buffer in the queue. If there are any empty
  104.        buffers left the first one is freed and removed from the queue,
  105.        and a pointer to it returned to you. You are then free to do what
  106.        you like with that buffer (e.g. FreeMem() it, load more data into
  107.        it etc).
  108.  
  109.    INPUTS
  110.        handle  - the handle you were allocated
  111.  
  112.    RESULT
  113.        buffer  - a pointer to the used buffer
  114.  
  115.    EXAMPLE
  116.        while (usedbuf = MHIGetEmpty(handle))
  117.        {
  118.        ...
  119.        }
  120.  
  121.    NOTES
  122.        Requires a valid handle. You should use this function in a loop
  123.        after you receive a signal from MHI, just as you would when
  124.        checking a Message Port. The buffer that is freed is considered
  125.        'empty' and as such you cannot rely on it's contents at all. It
  126.        may however contain data, as it is not automatically cleared.
  127.  
  128.    BUGS
  129.  
  130.    SEE ALSO
  131.        MHIQueueBuffer
  132.  
  133. MHI/MHIGetStatus                                             MHI/MHIGetStatus
  134.  
  135.    NAME
  136.        MHIGetStatus
  137.  
  138.    SYNOPSIS
  139.        status = MHIGetStatus(handle);
  140.        d0                    a3
  141.  
  142.        UBYTE MHIGetStatus(APTR handle);
  143.  
  144.    FUNCTION
  145.        Return the current status of the MHI decoder. This give you
  146.        information about what the decoder is doing, and if it has
  147.        stalled (MHIF_OUT_OF_DATA).
  148.  
  149.    INPUTS
  150.        handle  - the handle you were allocated
  151.  
  152.    RESULT
  153.        status  - one of: MHIF_PLAYING (player currently outputting sound)
  154.                          MHIF_STOPPED (doing nothing)
  155.                          MHIF_OUT_OF_DATA (run out of data but still
  156.                                            waiting for more)
  157.                          MHIF_PAUSED (play currently paused but can
  158.                                       be restarted)
  159.  
  160.    EXAMPLE
  161.        status = MHIGetStatus(handle);
  162.  
  163.    NOTES
  164.        You can use this to check if an MPEG stream has finished
  165.        decoding by waiting for buffers to be returned to you and
  166.        then checking if status = MHIF_OUT_OF_DATA. See example code.
  167.  
  168.    BUGS
  169.  
  170.    SEE ALSO
  171.        MHIPlay
  172.        MHIStop
  173.        MHIPause
  174.  
  175. MHI/MHIPause                                                     MHI/MHIPause
  176.  
  177.    NAME
  178.        MHIPause
  179.  
  180.    SYNOPSIS
  181.        MHIPause(handle);
  182.                 a3
  183.  
  184.        VOID MHIPause(APTR handle);
  185.  
  186.    FUNCTION
  187.        Halt decoding and audio output. The buffer queue is not
  188.        altered and play may begin again at exactly where it left
  189.        off.
  190.  
  191.    INPUTS
  192.        handle  - the handle you were allocated
  193.  
  194.    RESULT
  195.        None
  196.  
  197.    EXAMPLE
  198.        MHIPause(handle);
  199.  
  200.    NOTES
  201.        Use MHIPlay to start decoding again. MHIStop can also be
  202.        used even if the decoder is paused.
  203.  
  204.    BUGS
  205.  
  206.    SEE ALSO
  207.        MHIGetStatus
  208.        MHIPlay
  209.        MHIStop
  210.  
  211. MHI/MHIPlay                                                       MHI/MHIPlay
  212.  
  213.    NAME
  214.        MHIPlay
  215.  
  216.    SYNOPSIS
  217.        MHIPlay(handle);
  218.                a3
  219.  
  220.        VOID MHIPlay(APTR handle);
  221.  
  222.    FUNCTION
  223.        Set the MHI decoder into play mode. The decoder starts
  224.        decoding the first buffer in the queue.
  225.  
  226.    INPUTS
  227.        handle  - the handle you were allocated
  228.  
  229.    RESULT
  230.        None
  231.  
  232.    EXAMPLE
  233.        MHIPlay(handle);
  234.  
  235.    NOTES
  236.        You may call this function without any buffers in the
  237.        queue, but it is usually best to buffer some data
  238.        before starting the decoding.
  239.  
  240.    BUGS
  241.  
  242.    SEE ALSO
  243.        MHIGetStatus
  244.        MHIStop
  245.        MHIPause
  246.  
  247. MHI/MHIQuery                                                     MHI/MHIQuery
  248.  
  249.    NAME
  250.        MHIQuery
  251.  
  252.    SYNOPSIS
  253.        result = MHIQuery(query);
  254.        d0                d1
  255.  
  256.        ULONG MHIQuery(ULONG query);
  257.  
  258.    FUNCTION
  259.        Query some aspect of the decoder. A complete list of available
  260.        queries can be found in mhi.h.
  261.  
  262.            MHIQ_DECODER_NAME
  263.            MHIQ_DECODER_VERSION
  264.            MHIQ_AUTHOR
  265.                Return a string pointer to the name of the
  266.                decoder/author/version string.
  267.  
  268.            MHIQ_IS_HARDWARE
  269.                MHIF_TRUE if decoder is hardware, MHIF_FALSE if it's
  270.                software based.
  271.  
  272.            MHIQ_IS_68K
  273.            MHIQ_IS_PPC
  274.                Same as MHIQ_IS_HARDWARE for 68k/PPC processor based
  275.                decoders.
  276.  
  277.            MHIQ_MPEG1
  278.            MHIQ_MPEG2
  279.            MHIQ_MPEG25
  280.            MHIQ_MPEG4
  281.                Return MHIF_TRUE if MPEG version is supported, or
  282.                MHIF_FALSE if not.
  283.  
  284.            MHIQ_LAYER1
  285.            MHIQ_LAYER2
  286.            MHIQ_LAYER3
  287.                Return MHIF_TRUE if MPEG layer is supported, or
  288.                MHIF_FALSE if not.
  289.  
  290.            MHIQ_VARIABLE_BITRATE
  291.            MHIQ_JOINT_STEREO
  292.                Return MHIF_TRUE if encoding format is supported, or
  293.                MHIF_FALSE if not.
  294.  
  295.            MHIQ_BASS_CONTROL
  296.            MHIQ_TREBLE_CONTROL
  297.            MHIQ_MID_CONTROL
  298.                Return MHIF_TRUE if tone control is supported, or
  299.                MHIF_FALSE if not.
  300.  
  301.            MHIQ_VOLUME_CONTROL
  302.            MHIQ_PANNING_CONTROL
  303.            MHIQ_CROSSMIXING
  304.                Return MHIF_TRUE if output control is supported, or
  305.                MHIF_FALSE if not.
  306.  
  307.    INPUTS
  308.        query   - an MHIQ_#? query flag.
  309.  
  310.    RESULT
  311.        result  - the result code, see mhi.h and above
  312.  
  313.    EXAMPLE
  314.        /* see if decoder support variable bit rates */
  315.        result = MHIQuery(MHIQ_VARIABLE_BITRATE);
  316.  
  317.    NOTES
  318.  
  319.    BUGS
  320.  
  321.    SEE ALSO
  322.  
  323. MHI/MHIQueueBuffer                                         MHI/MHIQueueBuffer
  324.  
  325.    NAME
  326.        MHIQueueBuffer - add a memory buffer to the decoder queue
  327.  
  328.    SYNOPSIS
  329.        success = MHIQueueBuffer(handle, buffer, size);
  330.        d0                       a3      a0      d0
  331.  
  332.        BOOL MHIQueueBuffer(APTR handle, APTR buffer, ULONG size);
  333.  
  334.    FUNCTION
  335.        Add a buffer to the decoder queue. Once the buffer is in the queue
  336.        you are not allowed to alter it in any way until it is released
  337.        by MHI.
  338.  
  339.    INPUTS
  340.        handle  - the handle you were allocated
  341.        buffer  - a pointer to the start of the buffer to be queued
  342.        size    - the byte size of the buffer
  343.  
  344.    RESULT
  345.        success - TRUE (-1) when buffer was queued or FALSE (0) when
  346.                  for some reason the buffer could not be queued
  347.  
  348.    EXAMPLE
  349.        MHIQueueBuffer(handle, bufmem, size);
  350.  
  351.    NOTES
  352.        Requires a valid handle.
  353.  
  354.    BUGS
  355.  
  356.    SEE ALSO
  357.        MHIGetEmpty
  358.  
  359. MHI/MHISetParam                                               MHI/MHISetParam
  360.  
  361.    NAME
  362.        MHISetParam
  363.  
  364.    SYNOPSIS
  365.        MHISetParam(handle, param, value);
  366.  
  367.        VOID MHISetParam(APTR handle, UWORD param, ULONG value);
  368.                         a3           d0         d1
  369.  
  370.    FUNCTION
  371.        Alter one of the decoder parameters. Commonly used to set volume,
  372.        bass, treble, panning etc. A complete list of parameters can be
  373.        found in mhi.h. Details of current parameters:
  374.  
  375.            MHIP_VOLUME
  376.                Overall sound volume. 100 is max, 0 is silence.
  377.  
  378.            MHIP_PANNING
  379.                Sound panning. 50 is centre (default), 0 is full left and
  380.                100 is full right.
  381.  
  382.            MHIP_CROSSMIXING
  383.                Crossmixing is where some of the sound from the left
  384.                channel is mixed onto the right channel, and vice versa.
  385.                It is often used to lessen the stereo effect for people
  386.                using headphones. Also similar to 'surround' sound
  387.                effects used in some software. 0 is no mixing (default)
  388.                and 100 is maximum (effectively mono).
  389.  
  390.            MHIP_BASS
  391.            MHIP_MID
  392.            MHIP_TREBLE
  393.                These parameters control tone. Bass is low frequencies,
  394.                and treble is high. Mid is everything in between. MHI
  395.                does not specify the exact frequency ranges that these
  396.                cover, as it can vary with hardware for instance.
  397.                50 is the default, with no tone modification. 100 is
  398.                maximum boost, and 0 is is maximum cut.
  399.  
  400.            MHIP_PREFACTOR
  401.                Prefactor allows sound levels to be boosted or reduced
  402.                before it goes through tone control. This is useful to
  403.                prevent 'chopping', where the signal is boosted too
  404.                much by tone control and distorts. It is not the same
  405.                as volume. The default is 50, which is no prefactor.
  406.                100 is maximum cut, where sound levels are lowered,
  407.                and 0 is maximum boost.
  408.  
  409.    INPUTS
  410.              handle    - the handle you were allocated
  411.              param     - the parameter you want to alter
  412.              value     - the value to set
  413. 
  414.    RESULT
  415.              Parameter is set if value is valid
  416.  
  417.    EXAMPLE
  418.              /* pump up the bass man */
  419.              MHISetParam(handle, MHIP_BASS, 90);
  420. 
  421.    NOTES
  422.  
  423.    SEE ALSO
  424.  
  425. MHI/MHIStop                                                       MHI/MHIStop
  426.  
  427.    NAME
  428.        MHIStop
  429.  
  430.    SYNOPSIS
  431.        MHIStop(handle);
  432.                a3
  433.  
  434.        VOID MHIStop(APTR handle);
  435.  
  436.    FUNCTION
  437.        Stop all decoding and audio output. All buffers in the queue
  438.        are flushed.
  439.  
  440.    INPUTS
  441.        handle  - the handle you were allocated
  442.  
  443.    RESULT
  444.        None
  445.  
  446.    EXAMPLE
  447.        MHIStop(handle);
  448.  
  449.    NOTES
  450.        This function will flush the buffer queue. Use MHIPause if
  451.        you want to resume play where you left off later without
  452.        emptying the buffer queue.
  453.  
  454.    BUGS
  455.  
  456.    SEE ALSO
  457.        MHIGetStatus
  458.        MHIPlay
  459.        MHIPause
  460.  
  461.