Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dmACGetMinInputSize(3dm) — IRIX 6.5.3f

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

dmACCreate(3dm)

dmACSetParams(3dm)

dmACGetParams(3dm)

dmACConvert(3dm)

dmACReset(3dm)

dmACDestroy(3dm)



dmACGetMinInputSize(3dm)                              dmACGetMinInputSize(3dm)



NAME
     dmACGetMinInputSize, dmACGetMinOutputSize - auxiliary routines for
     querying input and output buffer sizes for dmACConvert.

SYNOPSIS
     #include <dmedia/dmaudioconvert.h>

     DMstatus dmACGetMinInputSize(
                  DMaudioconverter converter,
                  int outputSize,
                  int *minInputSize)

     DMstatus dmACGetMinOutputSize(
                  DMaudioconverter converter,
                  int inputSize,
                  int *minOutputSize)

PARAMETERS
     converter       is a DMaudioconverter handle created by a previous call
                     to the creation method dmACCreate(3dm).

     outputSize      is a integer set to the requested output buffer size.
                     The units will be bytes if compressing, otherwise frames.

     minInputSize    is a pointer to integer which will be set to the minimum
                     allowable input buffer size for the given outputSize.
                     The units will be bytes if decompressing, otherwise
                     frames.

     inputSize       is a integer set to the requested input buffer size.  The
                     units will be bytes if decompressing, otherwise frames.

     minOutputSize   is a pointer to integer which will be set to the minimum
                     allowable output buffer size for the given inputSize.
                     The units will be bytes if compressing, otherwise frames.

RETURNED VALUE
     Returns DMSUCCESS if the operation succeeds.  If DMFAILURE is returned,
     the error number and/or message can be retrieved via dmGetError(3dm).

DESCRIPTION
     The handle passed to these routines is declared as follows:

     typedef struct DMaudioconverter *DMaudioconverter;

     dmACGetMinInputSize and dmACGetMinOutputSize are a faster way to query
     the value of the two audio conversion parameters DMAUDIOMININPUTLEN
     and DMAUDIOMINOUTPUTLEN.  These values may also be retrieved via
     dmACGetParams(3dm) after a call to dmACSetParams(3dm) with the parameter
     DMAUDIOMAXREQUESTLEN set to either the input or output size,
     depending on the conversion mode.




                                                                        Page 1





dmACGetMinInputSize(3dm)                              dmACGetMinInputSize(3dm)



NOTE
     Only one of these two routines will be valid for any given configuration
     of the audio converter handle -- more specifically, dependent on the
     value of DMAUDIOPROCESSMODE.  A fixed input size indicates the
     converter is running in DMAUDIOPROCESSPUSH mode;  a fixed output size
     similarly indicates DMAUDIOPROCESSPULL mode.  A call to the opposite
     routine will return DMFAILURE, and the error value will be set to
     DMAUDIOBADREQUEST.

     Typically, buffer sizes only need be set and queried if the audio data is
     being compressed, decompressed, or rate-converted. In all other cases,
     the output buffer length (in frames) will and must equal the input
     length.

EXAMPLE
     If an application wishes to compress blocks of data to be written to a
     file or a device, the sequence might look like this (error checking has
     been omitted for brevity):

         #include <dmedia/dm_params.h>
         #include <dmedia/dm_audioconvert.h>

         DMaudioconverter converter;
         DMparams *inputParams, *outputParams;

         /* create the parameter lists and the converter */
         dmParamsCreate(&inputParams);
         dmParamsCreate(&outputParams);
         dmACCreate(&converter);

         /* set up input params for 16bit, mono, 44.1K */
         dmSetAudioDefaults(inputParams, 16, 44100, 1);

         /* set up output params for GSM compression */
         dmSetAudioDefaults(outputParams, 16, 44100, 1);
         dmParamsSetString(params, DM_AUDIO_COMPRESSION, DM_AUDIO_GSM);

         /* configure the converter */
         dmACSetParams(converter, inputParams, outputParams);

         /* loop forever, compressing data from some buffer */
         while(1) {
          int inputFrames; /* app sets this */
          int outputBytes; /* and queries for this */
          void *inBuffer = getInputBuffer(&inputFrames);
          void *outBuffer;

          /* do the query */
          dmACGetMinOutputSize(converter, inputFrames, &outputBytes);

          /* then perhaps the output buffer will be dynamically alloc'd */
          outBuffer = getLargeEnoughOutBuffer(outputBytes);



                                                                        Page 2





dmACGetMinInputSize(3dm)                              dmACGetMinInputSize(3dm)



          /* now we can compress our data into that buffer safely */
          dmACConvert(converter, inBuffer, outBuffer,
                   &inputFrames, &outputBytes);
          ...
         }

SEE ALSO
     dmACCreate(3dm), dmACSetParams(3dm), dmACGetParams(3dm),
     dmACConvert(3dm), dmACReset(3dm), dmACDestroy(3dm),














































                                                                        Page 3



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026