/*
 *  ======== VIDANALYTICSCOPY_TI_process ========
 */
XDAS_Int32 VIDANALYTICSCOPY_TI_process(IVIDANALYTICS_Handle handle,
    XDM1_BufDesc *inBufs, XDM1_BufDesc *outBufs, IVIDANALYTICS_InArgs *inArgs,
    IVIDANALYTICS_OutArgs *outArgs)
{
    VIDANALYTICSCOPY_TI_Obj *obj = (VIDANALYTICSCOPY_TI_Obj *)handle;

    /* begin this process call with 'good' view */
    obj->viewState = IVIDANALYTICS_VIEWSTATE_GOOD;

    /* validate arguments - this codec only supports "base" XDM. */
    if ((inArgs->size != sizeof(*inArgs)) ||
            (outArgs->size != sizeof(*outArgs))) {
        outArgs->extendedError = obj->extendedError = XDM_UNSUPPORTEDPARAM;

        return (IVIDANALYTICS_EUNSUPPORTED);
    }

    /* validate that there's at least a single inBuf and outBuf */
    if ((inBufs->numBufs < 1) || (outBufs->numBufs < 1)) {
        outArgs->extendedError = obj->extendedError = XDM_UNSUPPORTEDPARAM;

        return (IVIDANALYTICS_EFAIL);
    }

    /*
     * Sanity check that outBufs->descs[0].bufSize can hold the
     * 'analyzed' data.
     */
    if (outBufs->descs[0].bufSize < inBufs->descs[0].bufSize){

        /* "too small" outBuf */
        outArgs->extendedError = obj->extendedError = XDM_UNSUPPORTEDPARAM;

        return (IVIDANALYTICS_EFAIL);
    }

    /* everything looks good, do the 'analysis', set outArgs and return */
    memcpy(outBufs->descs[0].buf, inBufs->descs[0].buf,
        inBufs->descs[0].bufSize);

    /* report _how_ we accessed the input buffer */
    XDM_CLEARACCESSMODE_WRITE(inBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_READ(inBufs->descs[0].accessMask);

    /* indicate how we accessed outBufs it */
    XDM_CLEARACCESSMODE_READ(outBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_WRITE(outBufs->descs[0].accessMask);

    /* didn't detect anything. */
    outArgs->numTargets = 0;
    outArgs->numEvents = 0;

    /* note that this example doesn't set outArgs->date. */

    outArgs->extendedError = 0;

    return (IVIDANALYTICS_EOK);
}
Пример #2
0
/*
 *  ======== AUDENC1COPY_TI_process ========
 */
XDAS_Int32 AUDENC1COPY_TI_process(IAUDENC1_Handle handle, XDM1_BufDesc *inBufs,
    XDM1_BufDesc *outBufs, IAUDENC1_InArgs *inArgs, IAUDENC1_OutArgs *outArgs)
{
    XDAS_Int32 numInBytes;
    AUDENC1COPY_TI_Obj *obj = (AUDENC1COPY_TI_Obj *)handle;

    /* validate arguments - this codec only supports "base" xDM. */
    if ((inArgs->size != sizeof(*inArgs)) ||
            (outArgs->size != sizeof(*outArgs))) {
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IAUDENC1_EUNSUPPORTED);
    }

    /* validate that there's at least a single inBuf and outBuf */
    if ((inBufs->numBufs < 1) || (outBufs->numBufs < 1)) {
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IAUDENC1_EFAIL);
    }

    /* convert samples to bytes */
    numInBytes = inArgs->numInSamples * (obj->inputBitsPerSample / BITSPERBYTE);

    /*
     * Sanity check that inBufs->descs[0].bufSize is really capable of holding
     * numInBytes bytes of data, and that outBufs->descs[0].bufSize
     * can hold the 'encoded' data.
     */
    if ((numInBytes > inBufs->descs[0].bufSize) ||
        (numInBytes > outBufs->descs[0].bufSize)) {

        /* inBuf is smaller than provided data(!) or "too small" outBuf */
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IAUDENC1_EFAIL);
    }

    /* everything looks good, do the 'encode', set outArgs and return */
    memcpy(outBufs->descs[0].buf, inBufs->descs[0].buf, numInBytes);

    /* report _how_ we accessed the 2 data buffers */
    XDM_CLEARACCESSMODE_WRITE(inBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_READ(inBufs->descs[0].accessMask);

    XDM_CLEARACCESSMODE_READ(outBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_WRITE(outBufs->descs[0].accessMask);

    /* outArgs->bytesGenerated reports the total number of bytes encoded */
    outArgs->bytesGenerated = numInBytes;

    /* Fill out the rest of the outArgs struct */
    outArgs->extendedError = 0;
    outArgs->numInSamples = inArgs->numInSamples;
    outArgs->numZeroesPadded = 0;      /* TODO */

    return (IAUDENC1_EOK);
}
Пример #3
0
/* ARGSUSED - this line tells the TI compiler not to warn about unused args. */
XDAS_Int32 IMGDEC1COPY_TI_process(IIMGDEC1_Handle h, XDM1_BufDesc *inBufs,
    XDM1_BufDesc *outBufs, IIMGDEC1_InArgs *inArgs, IIMGDEC1_OutArgs *outArgs)
{
    XDAS_Int32 numInBytes;

    /* validate arguments - this codec only supports "base" XDM. */
    if ((inArgs->size != sizeof(*inArgs)) ||
            (outArgs->size != sizeof(*outArgs))) {
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IIMGDEC1_EUNSUPPORTED);
    }

    /* validate that there's at least a single inBuf and outBuf */
    if ((inBufs->numBufs < 1) || (outBufs->numBufs < 1)) {
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IIMGDEC1_EFAIL);
    }

    numInBytes = inArgs->numBytes;

    /*
     * Sanity check that inBufs->descs[0].bufSize is really capable of holding
     * numInBytes bytes of data, and that outBufs->descs[0].bufSize
     * can hold the 'encoded' data.
     */
    if ((numInBytes > inBufs->descs[0].bufSize) ||
            (numInBytes > outBufs->descs[0].bufSize)) {

        /* inBuf is smaller than provided data(!) or "too small" outBuf */
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IIMGDEC1_EFAIL);
    }

    /* everything looks good, do the decode, set outArgs and return */
    memcpy(outBufs->descs[0].buf, inBufs->descs[0].buf, numInBytes);

    /* report how we accessed the data buffers */
    XDM_CLEARACCESSMODE_WRITE(inBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_READ(inBufs->descs[0].accessMask);

    XDM_CLEARACCESSMODE_READ(outBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_WRITE(outBufs->descs[0].accessMask);

    /* outArgs->bytesConsumed reports the total number of bytes decoded */
    outArgs->bytesConsumed = numInBytes;

    /* Fill out the rest of the outArgs struct */
    outArgs->extendedError = 0;
    outArgs->currentAU = 0;  /* TODO */
    outArgs->currentScan = 0;  /* TODO */

    return (IIMGDEC1_EOK);
}
Пример #4
0
/* ARGSUSED - this line tells the TI compiler not to warn about unused args. */
XDAS_Int32 IMGENC1COPY_TI_process(IIMGENC1_Handle h, XDM1_BufDesc *inBufs,
    XDM1_BufDesc *outBufs, IIMGENC1_InArgs *inArgs, IIMGENC1_OutArgs *outArgs)
{
    XDAS_Int32 numInBytes;

    /* validate arguments - this codec only supports "base" XDM. */
    if ((inArgs->size != sizeof(*inArgs)) ||
            (outArgs->size != sizeof(*outArgs))) {
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IIMGENC1_EUNSUPPORTED);
    }

    /* validate that there's at least a single inBuf and outBuf */
    if ((inBufs->numBufs < 1) || (outBufs->numBufs < 1)) {
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IIMGENC1_EFAIL);
    }

    numInBytes = inBufs->descs[0].bufSize < outBufs->descs[0].bufSize ?
        inBufs->descs[0].bufSize : outBufs->descs[0].bufSize;

    /* everything looks good, do the 'encode', set outArgs and return */
    memcpy(outBufs->descs[0].buf, inBufs->descs[0].buf, numInBytes);

    /* report _how_ we accessed the 2 data buffers */
    XDM_CLEARACCESSMODE_WRITE(inBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_READ(inBufs->descs[0].accessMask);

    XDM_CLEARACCESSMODE_READ(outBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_WRITE(outBufs->descs[0].accessMask);

    /* outArgs->bytesGenerated reports the total number of bytes encoded */
    outArgs->bytesGenerated = numInBytes;

    /* Fill out the rest of the outArgs struct */
    outArgs->extendedError = 0;
    outArgs->currentAU = 0;  /* TODO */

    return (IIMGENC1_EOK);
}
Пример #5
0
/*
 *  ======== SPHDEC1COPY_TI_process ========
 */
XDAS_Int32 SPHDEC1COPY_TI_process(ISPHDEC1_Handle h,
    XDM1_SingleBufDesc *inBuf, XDM1_SingleBufDesc *outBuf,
    ISPHDEC1_InArgs *inArgs, ISPHDEC1_OutArgs *outArgs)
{
    XDAS_Int32 numInBytes;

    /* validate arguments - this codec only supports "base" xDM. */
    if ((inArgs->size != sizeof(*inArgs)) ||
        (outArgs->size != sizeof(*outArgs))) {

        outArgs->extendedError = XDM_UNSUPPORTEDPARAM;

        return (ISPHDEC1_EUNSUPPORTED);
    }

    /*
     * The number of bytes we can consume is the lesser of the specified
     * number of bytes to decode (inBuf->bufSize) and the size of the
     * buffer that will contain the output (outBuf->bufSize).
     */
    numInBytes = (inBuf->bufSize <= outBuf->bufSize) ?
        inBuf->bufSize : outBuf->bufSize;

    /* process the data: read input, produce output */
    memcpy(outBuf->buf, inBuf->buf, numInBytes);

    /* report _how_ we accessed the 2 data buffers */
    XDM_CLEARACCESSMODE_WRITE(inBuf->accessMask);
    XDM_SETACCESSMODE_READ(inBuf->accessMask);

    XDM_CLEARACCESSMODE_READ(outBuf->accessMask);
    XDM_SETACCESSMODE_WRITE(outBuf->accessMask);

    /* Fill out the rest of the outArgs struct */
    outArgs->dataSize = 0;  /* TBD */
    outArgs->extendedError = 0;

    return (ISPHDEC1_EOK);
}
Пример #6
0
/*
 *  ======== AUDENC1COPY_TI_control ========
 */
XDAS_Int32 AUDENC1COPY_TI_control(IAUDENC1_Handle handle, IAUDENC1_Cmd id,
    IAUDENC1_DynamicParams *dynParams, IAUDENC1_Status *status)
{
    XDAS_Int32 retVal;
    AUDENC1COPY_TI_Obj *obj = (AUDENC1COPY_TI_Obj *)handle;

    /* validate arguments - this codec only supports "base" XDM. */
    if ((dynParams->size != sizeof(*dynParams)) ||
            (status->size != sizeof(*status))) {
        return (IAUDENC1_EUNSUPPORTED);
    }

    /* initialize for the general case where we don't access the data buffer */
    XDM_CLEARACCESSMODE_READ(status->data.accessMask);
    XDM_CLEARACCESSMODE_WRITE(status->data.accessMask);

    switch (id) {
        case XDM_GETSTATUS:
        case XDM_GETBUFINFO:
            status->extendedError = 0;
            status->validFlag = XDAS_TRUE;
            status->lfeFlag = obj->lfeFlag;
            status->bitRate = obj->bitRate;
            status->sampleRate = obj->sampleRate;
            status->channelMode = obj->channelMode;
            status->encMode = obj->encMode;

            status->bufInfo.minNumInBufs = MININBUFS;
            status->bufInfo.minNumOutBufs = MINOUTBUFS;
            status->bufInfo.minInBufSize[0] = MININBUFSIZE;
            status->bufInfo.minOutBufSize[0] = MINOUTBUFSIZE;

            retVal = IAUDENC1_EOK;
            break;

        case XDM_SETPARAMS:
            obj->lfeFlag = dynParams->lfeFlag;
            obj->bitRate = dynParams->bitRate;
            obj->sampleRate = dynParams->sampleRate;
            obj->channelMode = dynParams->channelMode;
            obj->dualMonoMode = dynParams->dualMonoMode;

            retVal = IAUDENC1_EOK;
            break;

        case XDM_SETDEFAULT:
            obj->bitRate = AUDENC1COPY_TI_PARAMS.bitRate;
            obj->lfeFlag = AUDENC1COPY_TI_PARAMS.lfeFlag;
            obj->sampleRate = AUDENC1COPY_TI_PARAMS.sampleRate;
            obj->channelMode = AUDENC1COPY_TI_PARAMS.channelMode;
            obj->dualMonoMode = AUDENC1COPY_TI_PARAMS.dualMonoMode;
            obj->encMode = AUDENC1COPY_TI_PARAMS.encMode;
            obj->inputBitsPerSample = AUDENC1COPY_TI_PARAMS.inputBitsPerSample;

            retVal = IAUDENC1_EOK;
            break;

        case XDM_RESET:
        case XDM_FLUSH:
            retVal = IAUDENC1_EOK;
            break;

        case XDM_GETVERSION:
            if ((status->data.buf != NULL) &&
                (status->data.bufSize >= strlen(VERSIONSTRING))) {
                strncpy((char *)status->data.buf, VERSIONSTRING,
                    strlen(VERSIONSTRING));

                /* null terminate the string */
                status->data.buf[strlen(VERSIONSTRING)] = '\0';

                /* strncpy wrote to the data buffer */
                XDM_SETACCESSMODE_WRITE(status->data.accessMask);

                retVal = IAUDENC1_EOK;
            }
            else {
                retVal = IAUDENC1_EFAIL;
            }

            break;

        default:
            /* unsupported cmd */
            retVal = IAUDENC1_EUNSUPPORTED;

            break;
    }

    return (retVal);
}
/*
 *  ======== TRIK_VIDTRANSCODE_RESAMPLE_control ========
 */
XDAS_Int32 TRIK_VIDTRANSCODE_RESAMPLE_control(
    IVIDTRANSCODE_Handle		algHandle,
    IVIDTRANSCODE_Cmd			vidCmd,
    IVIDTRANSCODE_DynamicParams*	vidDynParams,
    IVIDTRANSCODE_Status*		vidStatus)
{
    TrikVideoResampleHandle* handle = (TrikVideoResampleHandle*)algHandle;
    XDAS_Int32 retVal = IVIDTRANSCODE_EFAIL;

    /* initialize for the general case where we don't access the data buffer */
    XDM_CLEARACCESSMODE_READ(vidStatus->data.accessMask);
    XDM_CLEARACCESSMODE_WRITE(vidStatus->data.accessMask);

    switch (vidCmd)
    {
        case XDM_GETSTATUS:
        case XDM_GETBUFINFO:
            vidStatus->extendedError = 0;

            vidStatus->bufInfo.minNumInBufs = 1;
            vidStatus->bufInfo.minNumOutBufs = 1;
            vidStatus->bufInfo.minInBufSize[0] = 0;
            vidStatus->bufInfo.minOutBufSize[0] = 0;

            XDM_SETACCESSMODE_WRITE(vidStatus->data.accessMask);
            retVal = IVIDTRANSCODE_EOK;
            break;

        case XDM_SETPARAMS:
            if (vidDynParams->size == sizeof(IVIDTRANSCODE_DynamicParams))
            {
                handle->m_dynamicParams.base = *((IVIDTRANSCODE_DynamicParams*)vidDynParams);
                handleBuildDynamicParams(handle);
                retVal = handleVerifyParams(handle) ? IVIDTRANSCODE_EOK : IVIDTRANSCODE_EFAIL;
            }
            else if (vidDynParams->size == sizeof(TRIK_VIDTRANSCODE_RESAMPLE_DynamicParams))
            {
                handle->m_dynamicParams = *((TRIK_VIDTRANSCODE_RESAMPLE_DynamicParams*)vidDynParams);
                retVal = handleVerifyParams(handle) ? IVIDTRANSCODE_EOK : IVIDTRANSCODE_EFAIL;
            }
            else
                retVal = IVIDTRANSCODE_EUNSUPPORTED;
            break;

        case XDM_RESET:
        case XDM_SETDEFAULT:
            handle->m_params = *getDefaultParams();
            handle->m_dynamicParams = *getDefaultDynamicParams();
            handleBuildDynamicParams(handle);
            retVal = handleVerifyParams(handle) ? IVIDTRANSCODE_EOK : IVIDTRANSCODE_EFAIL;
            break;

        case XDM_FLUSH:
            retVal = IVIDTRANSCODE_EOK;
            break;

        case XDM_GETVERSION:
            if (reportVersion(vidStatus->data.buf, vidStatus->data.bufSize))
            {
                XDM_SETACCESSMODE_WRITE(vidStatus->data.accessMask);
                retVal = IVIDTRANSCODE_EOK;
            }
            else
                retVal = IVIDTRANSCODE_EFAIL;
            break;

        default:
            /* unsupported cmd */
            retVal = IVIDTRANSCODE_EFAIL;
            break;
    }

    return retVal;
}
/*
 *  ======== TRIK_VIDTRANSCODE_RESAMPLE_process ========
 */
XDAS_Int32 TRIK_VIDTRANSCODE_RESAMPLE_process(
    IVIDTRANSCODE_Handle	algHandle,
    XDM1_BufDesc*		xdmInBufs,
    XDM_BufDesc*		xdmOutBufs,
    IVIDTRANSCODE_InArgs*	vidInArgs,
    IVIDTRANSCODE_OutArgs*	vidOutArgs)
{
    TrikVideoResampleHandle* handle = (TrikVideoResampleHandle*)algHandle;

    if (   (vidInArgs->size  != sizeof(IVIDTRANSCODE_InArgs))
        || (vidOutArgs->size != sizeof(IVIDTRANSCODE_OutArgs)))
    {
        XDM_SETUNSUPPORTEDPARAM(vidOutArgs->extendedError);
        return IVIDTRANSCODE_EUNSUPPORTED;
    }

    if (   xdmInBufs->numBufs != 1
        || handle->m_params.base.numOutputStreams < 0
        || xdmOutBufs->numBufs < handle->m_params.base.numOutputStreams)
    {
        XDM_SETUNSUPPORTEDPARAM(vidOutArgs->extendedError);
        return IVIDTRANSCODE_EFAIL;
    }


    XDM1_SingleBufDesc* xdmInBuf = &xdmInBufs->descs[0];

    if (   xdmInBuf->buf == NULL
        || vidInArgs->numBytes < 0
        || vidInArgs->numBytes > xdmInBuf->bufSize)
    {
        XDM_SETUNSUPPORTEDPARAM(vidOutArgs->extendedError);
        return IVIDTRANSCODE_EFAIL;
    }

    XDAS_Int32 inBufFormat;
    XDAS_Int32 inBufHeight;
    XDAS_Int32 inBufWidth;
    XDAS_Int32 inBufLineLength;
    if (!handlePickInputParams(handle, &inBufFormat, &inBufHeight, &inBufWidth, &inBufLineLength))
    {
        XDM_SETUNSUPPORTEDPARAM(vidOutArgs->extendedError);
        return IVIDTRANSCODE_EFAIL;
    }

    XDM_CLEARACCESSMODE_WRITE(xdmInBuf->accessMask);
    XDM_SETACCESSMODE_READ(xdmInBuf->accessMask);

    vidOutArgs->bitsConsumed			= vidInArgs->numBytes * CHAR_BIT;
    vidOutArgs->decodedPictureType		= IVIDEO_NA_PICTURE;
    vidOutArgs->decodedPictureStructure		= IVIDEO_CONTENTTYPE_NA;
    vidOutArgs->decodedHeight			= handle->m_dynamicParams.inputHeight;
    vidOutArgs->decodedWidth			= handle->m_dynamicParams.inputWidth;


    XDAS_Int32 outBufIndex;
    for (outBufIndex = 0; outBufIndex < handle->m_params.base.numOutputStreams; ++outBufIndex)
    {
        XDM1_SingleBufDesc* xdmOutBuf = &vidOutArgs->encodedBuf[outBufIndex];
        xdmOutBuf->buf		= xdmOutBufs->bufs[outBufIndex];
        xdmOutBuf->bufSize	= xdmOutBufs->bufSizes[outBufIndex];
        xdmOutBuf->accessMask	= 0;

        if (   xdmOutBuf->buf == NULL
            || xdmOutBuf->bufSize < 0)
        {
            XDM_SETCORRUPTEDDATA(vidOutArgs->extendedError);
            return IVIDTRANSCODE_EFAIL;
        }

        XDAS_Int32 outBufFormat;
        XDAS_Int32 outBufHeight;
        XDAS_Int32 outBufWidth;
        XDAS_Int32 outBufLineLength;

        if (!handlePickOutputParams(handle, outBufIndex, &outBufFormat, &outBufHeight, &outBufWidth, &outBufLineLength))
        {
            XDM_SETUNSUPPORTEDPARAM(vidOutArgs->extendedError);
            return IVIDTRANSCODE_EFAIL;
        }

        XDAS_Int32 outBufUsed = 0;
        TrikVideoResampleStatus result = resampleBuffer(xdmInBuf->buf, vidInArgs->numBytes,
                                                        inBufFormat, inBufHeight, inBufWidth, inBufLineLength,
                                                        xdmOutBuf->buf, xdmOutBuf->bufSize, &outBufUsed,
                                                        outBufFormat, outBufHeight, outBufWidth, outBufLineLength);
        switch (result)
        {
            case TRIK_VIDTRANSCODE_RESAMPLE_STATUS_OK:
                break;

            // TODO other statuses
            default:
                XDM_SETCORRUPTEDDATA(vidOutArgs->extendedError);
                return IVIDTRANSCODE_EFAIL;
        }

        XDM_SETACCESSMODE_WRITE(xdmOutBuf->accessMask);

        xdmOutBuf->bufSize					= outBufUsed;
        vidOutArgs->bitsGenerated[outBufIndex]			= outBufUsed * CHAR_BIT;
        vidOutArgs->encodedPictureType[outBufIndex]		= vidOutArgs->decodedPictureType;
        vidOutArgs->encodedPictureStructure[outBufIndex]	= vidOutArgs->decodedPictureStructure;
        vidOutArgs->outputID[outBufIndex]			= vidInArgs->inputID;
        vidOutArgs->inputFrameSkipTranscodeFlag[outBufIndex]	= XDAS_FALSE;
    }

    vidOutArgs->outBufsInUseFlag	= XDAS_FALSE;

    return IVIDTRANSCODE_EOK;
}
Пример #9
0
/*
 *  ======== VIDDEC1COPY_TI_control ========
 */
XDAS_Int32 VIDDEC1COPY_TI_control(IVIDDEC1_Handle handle, IVIDDEC1_Cmd id,
    IVIDDEC1_DynamicParams *dynParams, IVIDDEC1_Status *status)
{
    XDAS_Int32 retVal;
    VIDDEC1COPY_TI_Obj *obj = (VIDDEC1COPY_TI_Obj *)handle;

    /* validate arguments - this codec only supports "base" XDM. */
    if ((dynParams->size != sizeof(*dynParams)) ||
            (status->size != sizeof(*status))) {
        return (IVIDDEC1_EUNSUPPORTED);
    }

    /* initialize for the general case where we don't access the data buffer */
    XDM_CLEARACCESSMODE_READ(status->data.accessMask);
    XDM_CLEARACCESSMODE_WRITE(status->data.accessMask);

    switch (id) {
        case XDM_GETSTATUS:
        case XDM_GETBUFINFO:
            status->extendedError = 0;
            status->outputHeight = 0;  /* TODO */
            status->outputWidth = 0;  /* TODO */
            status->frameRate = 0;  /* TODO */
            status->bitRate = 0;  /* TODO */
            status->contentType = 0;  /* TODO */
            status->outputChromaFormat = obj->outputChromaFormat;

            status->bufInfo.minNumInBufs = MININBUFS;
            status->bufInfo.minNumOutBufs = MINOUTBUFS;
            status->bufInfo.minInBufSize[0] = MININBUFSIZE;
            status->bufInfo.minOutBufSize[0] = MINOUTBUFSIZE;

            retVal = IVIDDEC1_EOK;
            break;

        case XDM_SETPARAMS:
            retVal = IVIDDEC1_EOK;
            break;

        case XDM_SETDEFAULT:
            obj->outputChromaFormat = VIDDEC1COPY_TI_PARAMS.forceChromaFormat;

            retVal = IVIDDEC1_EOK;
            break;

        case XDM_RESET:
        case XDM_FLUSH:
            retVal = IVIDDEC1_EOK;
            break;

        case XDM_GETVERSION:
            if ((status->data.buf != NULL) &&
                (status->data.bufSize >= strlen(VERSIONSTRING))) {
                strncpy((char *)status->data.buf, VERSIONSTRING,
                    strlen(VERSIONSTRING));

                /* null terminate the string */
                status->data.buf[strlen(VERSIONSTRING)] = '\0';

                /* strncpy wrote to the data buffer */
                XDM_SETACCESSMODE_WRITE(status->data.accessMask);

                retVal = IVIDDEC1_EOK;
            }
            else {
                retVal = IVIDDEC1_EFAIL;
            }

            break;

        default:
            /* unsupported cmd */
            retVal = IVIDDEC1_EFAIL;
            break;
    }

    return (retVal);
}
Пример #10
0
/* ARGSUSED - this line tells the TI compiler not to warn about unused args. */
XDAS_Int32 VIDDEC1COPY_TI_process(IVIDDEC1_Handle h, XDM1_BufDesc *inBufs,
    XDM_BufDesc *outBufs, IVIDDEC1_InArgs *inArgs, IVIDDEC1_OutArgs *outArgs)
{
    XDAS_Int32 numInBytes;

    /* validate arguments - this codec only supports "base" XDM. */
    if ((inArgs->size != sizeof(*inArgs)) ||
            (outArgs->size != sizeof(*outArgs))) {
        XDM_SETUNSUPPORTEDPARAM(outArgs->decodedBufs.extendedError);

        return (IVIDDEC1_EUNSUPPORTED);
    }

    /* validate that there's at least a single inBuf and outBuf */
    if ((inBufs->numBufs < 1) || (outBufs->numBufs < 1)) {
        XDM_SETUNSUPPORTEDPARAM(outArgs->decodedBufs.extendedError);

        return (IVIDDEC1_EFAIL);
    }

    numInBytes = inArgs->numBytes;

    /*
     * Sanity check that inBufs->descs[0].bufSize is really capable of holding
     * numInBytes bytes of data, and that outBufs->bufSizes[0]
     * can hold the 'encoded' data.
     */
    if ((inBufs->descs[0].bufSize < inArgs->numBytes) ||
            (outBufs->bufSizes[0] < MINOUTBUFSIZE)){
        /* inBuf is smaller than provided data(!) or "too small" outBuf */
        XDM_SETUNSUPPORTEDPARAM(outArgs->decodedBufs.extendedError);

        return (IVIDDEC1_EFAIL);
    }

    /* everything looks good, do the 'encode', set outArgs and return */
    memcpy(outBufs->bufs[0], inBufs->descs[0].buf, numInBytes);

    /* report _how_ we accessed the input buffer */
    XDM_CLEARACCESSMODE_WRITE(inBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_READ(inBufs->descs[0].accessMask);


    /* outArgs->bytesConsumed reports the total number of bytes decoded */
    outArgs->bytesConsumed = numInBytes;

    /* Fill out the rest of the outArgs struct */
    outArgs->outputID[0] = inArgs->inputID;
    outArgs->outputID[1] = 0;  /* end of array - invalid ID */

    outArgs->decodedBufs.numBufs = 1;
    outArgs->decodedBufs.frameWidth = numInBytes; /* minBytes wide */
    outArgs->decodedBufs.frameHeight = 1;       /* one pixel high */
    outArgs->decodedBufs.framePitch = 0;        /* TODO */

    outArgs->decodedBufs.bufDesc[0].buf = outBufs->bufs[0];
    outArgs->decodedBufs.bufDesc[0].bufSize = outBufs->bufSizes[0];

    /* initialize the accessMask, then indicate how we accessed it */
    outArgs->decodedBufs.bufDesc[0].accessMask = 0;
    XDM_SETACCESSMODE_WRITE(outArgs->decodedBufs.bufDesc[0].accessMask);

    outArgs->decodedBufs.extendedError = 0;
    outArgs->decodedBufs.frameType = 0;         /* TODO */
    outArgs->decodedBufs.topFieldFirstFlag = XDAS_FALSE;  /* TODO */
    outArgs->decodedBufs.repeatFirstFieldFlag = XDAS_FALSE;  /* TODO */
    outArgs->decodedBufs.frameStatus = IVIDEO_FRAME_NOERROR;
    outArgs->decodedBufs.repeatFrame = 0;  /* TODO */
    outArgs->decodedBufs.contentType = IVIDEO_PROGRESSIVE;
    outArgs->decodedBufs.chromaFormat = XDM_CHROMAFORMAT_DEFAULT;

    /* Single display buf equivalent to the decoded buf above */
    outArgs->displayBufs[0] = outArgs->decodedBufs;
    outArgs->displayBufs[1].numBufs = 0;   /* end of array */

    /* MB data support is TBD */
    outArgs->outputMbDataID = 0;  /* invalid ID */
    outArgs->mbDataBuf.buf = NULL;  /* important, set to NULL if no MB Data! */

    outArgs->freeBufID[0] = inArgs->inputID;  /* release the only outBuf */
    outArgs->freeBufID[1] = 0; /* end of array - invalid ID */
    outArgs->outBufsInUseFlag = XDAS_FALSE;

    return (IVIDDEC1_EOK);
}
Пример #11
0
/* ARGSUSED - this line tells the TI compiler not to warn about unused args. */
XDAS_Int32 UNIVERSALCOPY_TI_control(IUNIVERSAL_Handle h,
    IUNIVERSAL_Cmd id, IUNIVERSAL_DynamicParams *dynParams,
    IUNIVERSAL_Status *status)
{
    XDAS_Int32 retVal;

#if (XDAIS_TRACE_OUT == 1)  /* 'handle' only used in TRACE_ statements */
    IALG_Handle handle = (IALG_Handle)h;
#endif

    TRACE_4print(handle, TRACE_ENTER,
            "UNIVERSALCOPY_TI_control> Enter (handle=0x%x, id=0x%x, "
            "dynParams=0x%x, status=0x%x)\n", handle, id, dynParams, status);

    /* validate arguments - this codec only supports "base" XDM. */
    if ((dynParams->size != sizeof(*dynParams)) ||
            (status->size != sizeof(*status))) {

        TRACE_0print(handle, TRACE_ENTER,
                "UNIVERSALCOPY_TI_control> Exit "
                "(status=IUNIVERSAL_EUNSUPPORTED)\n");

        return (IUNIVERSAL_EUNSUPPORTED);
    }

    /* initialize for the general case where we don't access the data buffer */
    XDM_CLEARACCESSMODE_READ(status->data.descs[0].accessMask);
    XDM_CLEARACCESSMODE_WRITE(status->data.descs[0].accessMask);

    switch (id) {
        case XDM_GETVERSION:
            if ((status->data.descs[0].buf != NULL) &&
                (status->data.descs[0].bufSize >=
                    strlen(VERSIONSTRING))) {

                strncpy((char *)status->data.descs[0].buf, VERSIONSTRING,
                        strlen(VERSIONSTRING));

                /* null terminate the string */
                status->data.descs[0].buf[strlen(VERSIONSTRING)] = '\0';

                /* strncpy wrote to the data buffer */
                TRACE_0print(handle, TRACE_4CLASS,
                        "UNIVERSALCOPY_TI_control> Fix the accessMask as we "
                        "wrote to the data buffer\n");
                XDM_SETACCESSMODE_WRITE(status->data.descs[0].accessMask);

                retVal = IUNIVERSAL_EOK;
            }
            else {
                retVal = IUNIVERSAL_EFAIL;
            }

            break;

        default:
            /* unsupported cmd */
            retVal = IUNIVERSAL_EFAIL;
            break;
    }

    TRACE_1print(handle, TRACE_ENTER, "UNIVERSALCOPY_TI_control> Exit"
                " (status=%d)\n", retVal);

    return (retVal);
}
Пример #12
0
/* ARGSUSED - this line tells the TI compiler not to warn about unused args. */
XDAS_Int32 VIDENC1COPY_TI_process(IVIDENC1_Handle h, IVIDEO1_BufDescIn *inBufs,
    XDM_BufDesc *outBufs, IVIDENC1_InArgs *inArgs, IVIDENC1_OutArgs *outArgs)
{
    XDAS_Int32 numInBytes;

#ifdef USE_ACPY3
    const Uint32 maxTransferChunkSize       = 0xffff;
    Uint32       thisTransferChunkSize      = 0x0;
    Uint32       remainingTransferChunkSize;
    Uint32       thisTransferSrcAddr, thisTransferDstAddr;

    ACPY3_Params params;
    VIDENC1COPY_TI_Obj *videncObj = (VIDENC1COPY_TI_Obj *)h;
#endif
    /*
     * Validate arguments - this codec supports "base" XDM and an extended
     * inArgs.
     */
    if (((inArgs->size != sizeof(*inArgs)) &&
            (inArgs->size != sizeof(IVIDENC1CPY_InArgs))) ||
        (outArgs->size != sizeof(*outArgs))) {

        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IVIDENC1_EUNSUPPORTED);
    }

    /* validate that there's at least a single inBuf and outBuf */
    if ((inBufs->numBufs < 1) || (outBufs->numBufs < 1)) {
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IVIDENC1_EFAIL);
    }

    /* validate inputID */
    if (inArgs->inputID == 0) {
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IVIDENC1_EFAIL);
    }

    /* there's an available in and out buffer, how many samples? */
    numInBytes = inBufs->bufDesc[0].bufSize < outBufs->bufSizes[0] ?
        inBufs->bufDesc[0].bufSize : outBufs->bufSizes[0];

    /* and honor the extended maxBytes if it was provided */
    if (inArgs->size == sizeof(IVIDENC1CPY_InArgs)) {
        if (numInBytes > ((IVIDENC1CPY_InArgs *)inArgs)->maxBytes) {
            numInBytes = ((IVIDENC1CPY_InArgs *)inArgs)->maxBytes;
        }
    }
#ifdef USE_ACPY3
    /*
     * Activate Channel scratch DMA channels.
     */
    ACPY3_activate(videncObj->dmaHandle1D1D8B);

    thisTransferSrcAddr        = (Uint32)inBufs->bufDesc[0].buf;
    thisTransferDstAddr        = (Uint32)outBufs->bufs[0];
    remainingTransferChunkSize = numInBytes;

    while (remainingTransferChunkSize > 0) {

        if (remainingTransferChunkSize > maxTransferChunkSize) {
           thisTransferChunkSize = maxTransferChunkSize;
        }
        else {
           thisTransferChunkSize = remainingTransferChunkSize;
        }

        /* Configure the logical channel */
        params.transferType = ACPY3_1D1D;
        params.srcAddr      = (void *)thisTransferSrcAddr;
        params.dstAddr      = (void *)thisTransferDstAddr;
        params.elementSize  = thisTransferChunkSize;
        params.numElements  = 1;
        params.waitId       = 0;
        params.numFrames    = 1;

        remainingTransferChunkSize -= thisTransferChunkSize;
        thisTransferSrcAddr += thisTransferChunkSize;
        thisTransferDstAddr += thisTransferChunkSize;

        /* Configure logical dma channel */
        ACPY3_configure(videncObj->dmaHandle1D1D8B, &params, 0);

        /* Use DMA to copy data */
        ACPY3_start(videncObj->dmaHandle1D1D8B);

        /* wait for transfer to finish  */
        ACPY3_wait(videncObj->dmaHandle1D1D8B);
    }

    /*
     * Deactivate Channel scratch DMA channels.
     */
    ACPY3_deactivate(videncObj->dmaHandle1D1D8B);

    /*
     * Because we used DMA, the algo processor didn't accessed either of the
     * 2 data buffers.
     */
    XDM_CLEARACCESSMODE_READ(inBufs->bufDesc[0].accessMask);
    XDM_CLEARACCESSMODE_WRITE(inBufs->bufDesc[0].accessMask);

    XDM_CLEARACCESSMODE_READ(outArgs->encodedBuf.accessMask);
    XDM_CLEARACCESSMODE_WRITE(outArgs->encodedBuf.accessMask);

#else
    /* everything looks good, do the 'encode', set outArgs and return */
    memcpy(outBufs->bufs[0], inBufs->bufDesc[0].buf, numInBytes);

    /* memcpy read from inBuf and wrote to encodedBuf (in our case, outBuf) */
    XDM_CLEARACCESSMODE_WRITE(inBufs->bufDesc[0].accessMask);
    XDM_SETACCESSMODE_READ(inBufs->bufDesc[0].accessMask);

    XDM_CLEARACCESSMODE_READ(outArgs->encodedBuf.accessMask);
    XDM_SETACCESSMODE_WRITE(outArgs->encodedBuf.accessMask);
#endif

    /* outArgs->bytesGenerated reports the total number of bytes encoded */
    outArgs->bytesGenerated = numInBytes;

    /* report that the encoded data is in outArgs->encodedBuf */
    outArgs->encodedBuf.buf = outBufs->bufs[0];
    outArgs->encodedBuf.bufSize = outBufs->bufSizes[0];

    /* Fill out the rest of the outArgs struct */
    outArgs->extendedError = 0;
    outArgs->encodedFrameType = 0;     /* TODO */
    outArgs->inputFrameSkip = IVIDEO_FRAME_ENCODED;
    outArgs->outputID = inArgs->inputID;

    /* TODO - add support for reconBufs */
    outArgs->reconBufs.numBufs = 0;

    return (IVIDENC1_EOK);
}
Пример #13
0
/* ARGSUSED - this line tells the TI compiler not to warn about unused args. */
XDAS_Int32 AUDDEC1_TI_process(IAUDDEC1_Handle handle, XDM1_BufDesc *inBufs,
    XDM1_BufDesc *outBufs, IAUDDEC1_InArgs *inArgs, IAUDDEC1_OutArgs *outArgs)
{
    AUDDEC1_TI_Obj *obj = (AUDDEC1_TI_Obj *)handle;
    BUFRES_Handle    bufres = obj->bufres;
    Int              i;
    XDAS_Int32       numInBytes;

    /* validate arguments - this codec only supports "base" xDM. */
    if ((inArgs->size != sizeof(*inArgs)) ||
            (outArgs->size != sizeof(*outArgs))) {
        outArgs->extendedError = XDM_UNSUPPORTEDPARAM;

        return (IAUDDEC1_EUNSUPPORTED);
    }

    /* validate that there's at least a single inBuf and outBuf */
    if ((inBufs->numBufs < 1) || (outBufs->numBufs < 1)) {
        outArgs->extendedError = XDM_UNSUPPORTEDPARAM;

        return (IAUDDEC1_EFAIL);
    }

    numInBytes = inArgs->numBytes;

    /*
     * Sanity check that inBufs->bufSizes[0] is really capable of holding
     * numInBytes bytes of data, and that outBufs->bufSizes[0]
     * can hold the 'encoded' data.
     */
    if ((numInBytes > inBufs->descs[0].bufSize) ||
        (numInBytes > outBufs->descs[0].bufSize)) {

        outArgs->extendedError = XDM_UNSUPPORTEDPARAM;

        return (IAUDDEC1_EFAIL);
    }

    /* Do something 'interesting' with the buffer resource */
    for (i = 0; i < bufres->length / sizeof(Int); i++) {
        ((Int *)(bufres->base))[i] = i;
    }

    /* everything looks good, do the 'encode', set outArgs and return */
    memcpy(outBufs->descs[0].buf, inBufs->descs[0].buf, numInBytes);

    /* report _how_ we accessed the 2 data buffers */
    XDM_CLEARACCESSMODE_WRITE(inBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_READ(inBufs->descs[0].accessMask);

    XDM_CLEARACCESSMODE_READ(outBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_WRITE(outBufs->descs[0].accessMask);

    /* outArgs->bytesGenerated reports the total number of bytes encoded */
    outArgs->bytesConsumed = numInBytes;

    /* Fill out the rest of the outArgs struct */
    outArgs->extendedError = 0;
    outArgs->numSamples = outArgs->bytesConsumed;  /* a sample == a byte */
    outArgs->channelMode = IAUDIO_2_0;  /* TODO */
    outArgs->lfeFlag = XDAS_FALSE;  /* TODO */
    outArgs->dualMonoMode = 0;  /* TODO */
    outArgs->sampleRate = 0;  /* TODO */

    return (IAUDDEC1_EOK);
}
/*
 *  ======== VIDANALYTICSCOPY_TI_control ========
 */
XDAS_Int32 VIDANALYTICSCOPY_TI_control(IVIDANALYTICS_Handle handle,
    IVIDANALYTICS_Cmd id, IVIDANALYTICS_DynamicParams *dynParams,
    IVIDANALYTICS_Status *status)
{
    VIDANALYTICSCOPY_TI_Obj *obj = (VIDANALYTICSCOPY_TI_Obj *)handle;
    XDAS_Int32 retVal;
    Int i;

    /* validate arguments - this codec only supports "base" XDM. */
    if ((dynParams->size != sizeof(*dynParams)) ||
            (status->size != sizeof(*status))) {
        return (IVIDANALYTICS_EUNSUPPORTED);
    }

    /* validate data field. */
    if (status->data.numBufs > XDM_MAX_IO_BUFFERS) {
        /* too many buffers.  App forgot to initialize the data field? */
        return (IVIDANALYTICS_EUNSUPPORTED);
    }

    /*
     * Initialize for the general case where we don't access any data buffers.
     * Note, this is not a sparse array.
     */
    for (i = 0; i < status->data.numBufs; i++) {
        XDM_CLEARACCESSMODE_READ(status->data.descs[i].accessMask);
        XDM_CLEARACCESSMODE_WRITE(status->data.descs[i].accessMask);
    }

    switch (id) {
        case XDM_GETSTATUS:
            status->extendedError = obj->extendedError;
            status->viewState = obj->viewState;

            retVal = IVIDANALYTICS_EOK;
            break;

        case XDM_GETBUFINFO:
            status->bufInfo.minNumInBufs = MININBUFS;
            status->bufInfo.minNumOutBufs = MINOUTBUFS;
            status->bufInfo.minInBufSize[0] = MININBUFSIZE;
            status->bufInfo.minOutBufSize[0] = MINOUTBUFSIZE;

            retVal = IVIDANALYTICS_EOK;
            break;

        case XDM_SETPARAMS:
            retVal = IVIDANALYTICS_EOK;
            break;

        case XDM_SETDEFAULT:
            retVal = IVIDANALYTICS_EOK;
            break;

        case XDM_RESET:
        case XDM_FLUSH:
            obj->viewState = IVIDANALYTICS_VIEWSTATE_GOOD;
            obj->extendedError = 0;

            retVal = IVIDANALYTICS_EOK;
            break;

        case XDM_GETVERSION:
            if ((status->data.descs[0].buf != NULL) &&
                (status->data.descs[0].bufSize >=
                    strlen(VERSIONSTRING))) {

                strncpy((char *)status->data.descs[0].buf, VERSIONSTRING,
                        strlen(VERSIONSTRING));

                /* null terminate the string */
                status->data.descs[0].buf[strlen(VERSIONSTRING)] = '\0';

                /* strncpy wrote to the data buffer */
                XDM_SETACCESSMODE_WRITE(status->data.descs[0].accessMask);

                retVal = IVIDANALYTICS_EOK;
            }
            else {
                retVal = IVIDANALYTICS_EFAIL;
            }

            break;

        default:
            /* unsupported cmd */
            retVal = IVIDANALYTICS_EFAIL;
            break;
    }

    return (retVal);
}
Пример #15
0
/*
 *  ======== VIDTRANSCODECOPY_TI_process ========
 */
XDAS_Int32 VIDTRANSCODECOPY_TI_process(IVIDTRANSCODE_Handle h,
    XDM1_BufDesc *inBufs, XDM_BufDesc *outBufs, IVIDTRANSCODE_InArgs *inArgs,
    IVIDTRANSCODE_OutArgs *outArgs)
{
    XDAS_Int32 numInBytes;

    /* validate arguments - this codec only supports "base" xDM. */
    if ((inArgs->size != sizeof(*inArgs)) ||
        (outArgs->size != sizeof(*outArgs))) {

        outArgs->extendedError = XDM_UNSUPPORTEDPARAM;

        return (IVIDTRANSCODE_EUNSUPPORTED);
    }

    /* validate that there's at least a single inBuf and outBuf */
    if ((inBufs->numBufs < 1) || (outBufs->numBufs < 1)) {

        outArgs->extendedError = XDM_UNSUPPORTEDPARAM;

        return (IVIDTRANSCODE_EFAIL);
    }

    numInBytes = inArgs->numBytes;

    /*
     * Sanity check that inBufs->descs[0].bufSize is really capable of holding
     * numInBytes bytes of data, and that outBufs->bufSizes[0]
     * can hold the 'transcoded' data.
     */
    if ((inBufs->descs[0].bufSize < inArgs->numBytes) ||
        (outBufs->bufSizes[0] < MINOUTBUFSIZE)){

        /* inBuf is smaller than provided data(!) or "too small" outBuf */
        outArgs->extendedError = XDM_UNSUPPORTEDPARAM;

        return (IVIDTRANSCODE_EFAIL);
    }

    /* everything looks good, do the 'transcode', set outArgs and return */
    memcpy(outBufs->bufs[0], inBufs->descs[0].buf, numInBytes);

    /* report _how_ we accessed the input buffer */
    XDM_CLEARACCESSMODE_WRITE(inBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_READ(inBufs->descs[0].accessMask);


    /* outArgs->bytesConsumed reports the total number of bytes decoded */
    outArgs->bitsConsumed = numInBytes * BITSPERBYTE;

    outArgs->bitsGenerated[0] = outArgs->bitsConsumed;
    outArgs->bitsGenerated[1] = 0;

    outArgs->decodedPictureType = IVIDEO_I_PICTURE;  /* Simple for now */
    outArgs->decodedPictureStructure = IVIDEO_INTERLACED_FRAME;

    outArgs->encodedPictureType[0] = IVIDEO_I_PICTURE;
    outArgs->encodedPictureType[1] = IVIDEO_NA_PICTURE;

    outArgs->encodedPictureStructure[0] = IVIDEO_INTERLACED_FRAME;
    outArgs->encodedPictureStructure[1] = IVIDEO_CONTENTTYPE_NA;

    outArgs->decodedHeight = 1;  /* one pixel high */
    outArgs->decodedWidth = numInBytes;  /* numInBytes wide */

    outArgs->outputID[0] = inArgs->inputID;
    outArgs->outputID[1] = 0;  /* invalid ID */

    outArgs->inputFrameSkipTranscodeFlag[0] = XDAS_FALSE;
    outArgs->inputFrameSkipTranscodeFlag[1] = XDAS_TRUE;  /* don't care */

    outArgs->encodedBuf[0].buf = outBufs->bufs[0];
    outArgs->encodedBuf[0].bufSize = outBufs->bufSizes[0];

    /* initialize the accessMask, then indicate how we accessed it */
    outArgs->encodedBuf[0].accessMask = 0;
    XDM_SETACCESSMODE_WRITE(outArgs->encodedBuf[0].accessMask);

    outArgs->outBufsInUseFlag = XDAS_FALSE;

    return (IVIDTRANSCODE_EOK);
}
Пример #16
0
/*
 *  ======== SPHDEC1COPY_TI_control ========
 */
XDAS_Int32 SPHDEC1COPY_TI_control(ISPHDEC1_Handle handle, ISPHDEC1_Cmd id,
    ISPHDEC1_DynamicParams *dynParams, ISPHDEC1_Status *status)
{
    XDAS_Int32 retVal;
    SPHDEC1COPY_TI_Obj *obj = (SPHDEC1COPY_TI_Obj *)handle;

    /* validate arguments - this codec only supports "base" xDM. */
    if ((dynParams->size != sizeof(*dynParams)) ||
        (status->size != sizeof(*status))) {

        return (ISPHDEC1_EUNSUPPORTED);
    }

    /* initialize for the general case where we don't access the data buffer */
    XDM_CLEARACCESSMODE_READ(status->data.accessMask);
    XDM_CLEARACCESSMODE_WRITE(status->data.accessMask);

    switch (id) {
        case XDM_GETSTATUS:
        case XDM_GETBUFINFO:
            status->postFilter = obj->postFilter;
            status->extendedError = 0;
            status->compandingLaw = obj->compandingLaw;
            status->packingType = obj->packingType;
            status->codecSelection = obj->codecSelection;
            status->bitRate = obj->bitRate;

            status->bufInfo.minNumInBufs = MININBUFS;
            status->bufInfo.minNumOutBufs = MINOUTBUFS;
            status->bufInfo.minInBufSize[0] = MININBUFSIZE;
            status->bufInfo.minOutBufSize[0] = MINOUTBUFSIZE;

            retVal = ISPHDEC1_EOK;
            break;

        case XDM_SETPARAMS:
            obj->postFilter = dynParams->postFilter;
            retVal = ISPHDEC1_EOK;
            break;

        case XDM_SETDEFAULT:
            obj->compandingLaw = SPHDEC1COPY_TI_PARAMS.compandingLaw;
            obj->packingType = SPHDEC1COPY_TI_PARAMS.packingType;
            obj->codecSelection = SPHDEC1COPY_TI_PARAMS.codecSelection;
            obj->postFilter = ISPEECH1_POSTFILTER_DEFAULT;

            retVal = ISPHDEC1_EOK;
            break;

        case XDM_RESET:
        case XDM_FLUSH:
            retVal = ISPHDEC1_EOK;
            break;

        case XDM_GETVERSION:
            if ((status->data.buf != NULL) &&
                (status->data.bufSize >= strlen(SPHDEC1_COPY_VERSIONSTRING))) {
                strncpy((char *)status->data.buf, SPHDEC1_COPY_VERSIONSTRING,
                    strlen(SPHDEC1_COPY_VERSIONSTRING));

                /* null terminate the string */
                status->data.buf[strlen(SPHDEC1_COPY_VERSIONSTRING)] = '\0';

                /* strncpy wrote to the data buffer */
                XDM_SETACCESSMODE_WRITE(status->data.accessMask);

                retVal = ISPHDEC1_EOK;
            }
            else {
                retVal = ISPHDEC1_EFAIL;
            }

            break;

        default:
            /* unsupported cmd */
            retVal = ISPHDEC1_EFAIL;
            break;
    }

    return (retVal);
}