예제 #1
0
/* ARGSUSED - this line tells the TI compiler not to warn about unused args. */
XDAS_Int32 VIDENC1COPY_TI_control(IVIDENC1_Handle handle, IVIDENC1_Cmd id,
    IVIDENC1_DynamicParams *params, IVIDENC1_Status *status)
{
    XDAS_Int32 retVal;

    /* validate arguments - this codec only supports "base" XDM. */
    if ((params->size != sizeof(*params)) ||
            (status->size != sizeof(*status))) {
        return (IVIDENC1_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->bufInfo.minNumInBufs = MININBUFS;
            status->bufInfo.minNumOutBufs = MINOUTBUFS;
            status->bufInfo.minInBufSize[0] = MININBUFSIZE;
            status->bufInfo.minOutBufSize[0] = MINOUTBUFSIZE;

            retVal = IVIDENC1_EOK;
            break;

        case XDM_SETPARAMS:
            retVal = IVIDENC1_EOK;
            break;

        case XDM_SETDEFAULT:
            retVal = IVIDENC1_EOK;
            break;

        case XDM_RESET:
        case XDM_FLUSH:
            retVal = IVIDENC1_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 = IVIDENC1_EOK;
            }
            else {
                retVal = IVIDENC1_EFAIL;
            }

            break;

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

    return (retVal);
}
예제 #2
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);
}
예제 #3
0
/*
 *  ======== AUDDEC1_TI_control ========
 */
XDAS_Int32 AUDDEC1_TI_control(IAUDDEC1_Handle handle, IAUDDEC1_Cmd id,
    IAUDDEC1_DynamicParams *dynParams, IAUDDEC1_Status *status)
{
    XDAS_Int32 retVal;
    AUDDEC1_TI_Obj *obj = (AUDDEC1_TI_Obj *)handle;

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

        return (IAUDDEC1_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 = XDAS_FALSE;  /* TODO */
            status->bitRate = 0;  /* TODO */
            status->sampleRate = 0;  /* TODO */
            status->channelMode = IAUDIO_2_0;  /* TODO */
            status->pcmFormat = obj->pcmFormat;
            status->numSamples = 0;  /* TODO */
            status->outputBitsPerSample = 8;  /* a sample == a byte */
            status->dualMonoMode = 0;  /* TODO */

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

            retVal = IAUDDEC1_EOK;
            break;

        case XDM_SETPARAMS:
            retVal = IAUDDEC1_EOK;
            break;

        case XDM_SETDEFAULT:
            obj->outputPCMWidth = AUDDEC1_TI_PARAMS.outputPCMWidth;
            obj->pcmFormat = AUDDEC1_TI_PARAMS.pcmFormat;
            obj->dataEndianness = AUDDEC1_TI_PARAMS.dataEndianness;

            retVal = IAUDDEC1_EOK;
            break;

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

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

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

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

                retVal = IAUDDEC1_EOK;
            }
            else {
                retVal = IAUDDEC1_EFAIL;
            }

            break;

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

            break;
    }

    return (retVal);
}
예제 #4
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);
}
예제 #5
0
/*
 *  ======== IMGDEC1COPY_TI_control ========
 */
XDAS_Int32 IMGDEC1COPY_TI_control(IIMGDEC1_Handle handle, IIMGDEC1_Cmd id,
    IIMGDEC1_DynamicParams *dynParams, IIMGDEC1_Status *status)
{
    XDAS_Int32 retVal;
    IMGDEC1COPY_TI_Obj *obj = (IMGDEC1COPY_TI_Obj *)handle;

    /* validate arguments - this codec only supports "base" XDM. */
    if ((dynParams->size != sizeof(*dynParams)) ||
            (status->size != sizeof(*status))) {
        return (IIMGDEC1_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->imageWidth = 0;  /* TODO */
            status->outputChromaFormat = obj->outputChromaFormat;
            status->totalAU = 0;  /* TODO */
            status->totalScan = 0;  /* TODO */

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

            retVal = IIMGDEC1_EOK;
            break;

        case XDM_SETPARAMS:
            retVal = IIMGDEC1_EOK;
            break;

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

            retVal = IIMGDEC1_EOK;
            break;

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

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

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

                retVal = IIMGDEC1_EOK;
            }
            else {
                retVal = IIMGDEC1_EFAIL;
            }

            break;

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

    return (retVal);
}
예제 #6
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);
}
예제 #8
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);
}
예제 #9
0
/*
 *  ======== 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))) {
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);
        XDM_SETUNSUPPORTEDPARAM(obj->extendedError);

        return (IVIDANALYTICS_EUNSUPPORTED);
    }

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

        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 */
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);
        XDM_SETUNSUPPORTEDPARAM(obj->extendedError);

        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);
}
예제 #10
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) + 1);

                /* 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);
}
예제 #11
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);
}