⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exolvidvbi.c

📁 pnx1500 video test demo
💻 C
📖 第 1 页 / 共 5 页
字号:
            pVrendGfxVoSetup->maxLayerSetup[1].needBuffer = False;            pVrendGfxVoSetup->maxLayerSetup[1].size = 0;        }        DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "                       dstRect: %d %d %d %d",                                                    pVrendGfxVoSetup->layerSetup[1].dstRect.ul.x,                                                    pVrendGfxVoSetup->layerSetup[1].dstRect.ul.y,                                                    pVrendGfxVoSetup->layerSetup[1].dstRect.lr.x,                                                    pVrendGfxVoSetup->layerSetup[1].dstRect.lr.y));    }    else    {        // set to some legal values        pVrendGfxVoSetup->layerSetup[1].srcRect.ul.x = 0;        pVrendGfxVoSetup->layerSetup[1].srcRect.ul.y = 0;        pVrendGfxVoSetup->layerSetup[1].srcRect.lr.x = ScreenWidth;        pVrendGfxVoSetup->layerSetup[1].srcRect.lr.y = ScreenHeight;        pVrendGfxVoSetup->layerSetup[1].dstRect.ul.x = 0;        pVrendGfxVoSetup->layerSetup[1].dstRect.ul.y = 0;        pVrendGfxVoSetup->layerSetup[1].dstRect.lr.x = ScreenWidth;        pVrendGfxVoSetup->layerSetup[1].dstRect.lr.y = ScreenHeight;        pVrendGfxVoSetup->layerSetup[1].connect = False;    }    /*-----------------------------------------------------------------------*/    pVrendGfxVoSetup->zOrder.layerZPos[0] = 0;    pVrendGfxVoSetup->zOrder.layerZPos[1] = 1;    pVrendGfxVoSetup->clockHandles[0] =  Null;    pVrendGfxVoSetup->clockHandles[1] =  Null;    if(((exolVideoSetupFlags & exolVideoSetup_UseLayer1) != 0) && ((exolVideoSetupFlags & exolVideoSetup_UseLayer0) == 0))        pVrendGfxVoSetup->mainLayer = 1;     else        pVrendGfxVoSetup->mainLayer = 0;     pVrendGfxVoSetup->mbsClockFreq = tmolVrendGfxVo_mbsClockFreq144Mhz;	pVrendGfxVoSetup->vbiSetup.buffer1 = Null;	pVrendGfxVoSetup->vbiSetup.buffer2 = Null;	if(ivp->VbiInsertionEnabled)	{		pVrendGfxVoSetup->vbiSetup.vbiEnable = True;	}	else	{		pVrendGfxVoSetup->vbiSetup.vbiEnable = False;	}	    tmError = tmolVrendGfxVoInstanceSetup(ivp->hVrendGfxVo, pVrendGfxVoSetup);    DBG_ASSERT2((tmError == TM_OK),("tmolVrendGfxVoInstanceSetup failed:0x%X\n",tmError));    /*------------------------ Setup Denc (VencAna) -------------------------*/        tmError = tmVideoMode_GetName (                        ivp->OutputVideoMode,       //  I: mode to query                        VideoModeName);             //  O: receives mode name    DBG_ASSERT2((tmError == TM_OK),("tmVideoMode_GetName failed:0x%X\n",tmError));    if(ivp->AnalogVideoEncoder)    {    // Setup VencAna.    tmError =           (strcmp(VideoModeName, "pal") == 0) ?   tmVencAna_SetColorSystem(ivp->pVencAnaInst, tmVencAna_PalBg):        (strcmp(VideoModeName, "ntsc") == 0)?   tmVencAna_SetColorSystem(ivp->pVencAnaInst, tmVencAna_NtscM):        TM_OK ;    DBG_ASSERT2((tmError == TM_OK),("tmVencAna_SetColorSystem failed:0x%X\n",tmError));    tmError = tmVencAna_SetEncodingType(ivp->pVencAnaInst, ivp->OutputVideoAdapter);    DBG_ASSERT2((tmError == TM_OK),("tmVencAna_SetEncodingType failed:0x%X\n",tmError));    tmError = tmVencAna_ApplyExtInterfaceSettings(ivp->pVencAnaInst);        DBG_ASSERT2((tmError == TM_OK),("tmVencAna_ApplyExtInterfaceSettings failed:0x%X\n",tmError));    }        DBG_PRINT((dbgexolVideo, DBG_INTERFACE_LEAVE, "exolVideoSetupVrendGfxVo" ));    return tmError;}//-----------------------------------------------------------------------------// FUNCTION:    exolVideoCreateIoDescr://// DESCRIPTION: This function does//                          set input format//                          set src rect//                          set dst rect//// RETURN:      tmErrorCode_t//// NOTES:       None//-----------------------------------------------------------------------------//tmErrorCode_t exolVideoCreateIoDescr(     ptsaDefaultCapabilities_t   pDefaultCap1,    ptsaDefaultInstanceSetup_t  pDefaultSetup1,    int                         SenderIndex,    ptsaDefaultCapabilities_t   pDefaultCap2,    ptsaDefaultInstanceSetup_t  pDefaultSetup2,    int                         ReceiverIndex,    ptmVideoFormat_t            pSetupFormat,    int                         NrPackets,    tmmlMmspHandle_t            hMemSpace,    ptsaInOutDescriptor_t*      ppIoDescr){    tmErrorCode_t                   tmError = TM_OK;    ptsaInOutDescriptorSetup_t      pIodSetup=Null;    UInt32                          NrBuffers=0;    UInt32                          BufferSize=0;    int i;    DBG_PRINT((dbgexolVideo, DBG_INTERFACE_ENTER, "exolVideoCreateIoDescr" ));    DBG_ASSERT2((pDefaultCap1 != 0),("exolVideoCreateIoDescr pDefaultCap1 Null"));    DBG_ASSERT2((pDefaultCap2 != 0),("exolVideoCreateIoDescr pDefaultCap2 Null"));    DBG_ASSERT2((ppIoDescr != 0),("exolVideoCreateIoDescr ppIoDescr Null"));    DBG_ASSERT2((pSetupFormat != 0),("exolVideoCreateIoDescr pSetupFormat Null"));    tmError = tmVideoUtilGetFormatNrBuffers(                                    pSetupFormat,           //const Void *  pFormat,        //  I: av format                                    &NrBuffers);            //pUInt32       pNrBuffers      //  O: nr buffers this format uses.    DBG_ASSERT2((tmError == TM_OK),("tmVideoUtilGetFormatNrBuffers failed:0x%X\n",tmError));    /*-----------------------------------------------------------------------*/    /*                     Create InOutDescriptors                           */    /*-----------------------------------------------------------------------*/    //pIodSetup = (ptsaInOutDescriptorSetup_t)malloc((sizeof(tsaInOutDescriptorSetup_t)) + (NrBuffers - 1) * sizeof(UInt32));    tmError = tmmlMalloc(                            hMemSpace,                            sizeof(tsaInOutDescriptorSetup_t) + 8,                            (pVoid*)&pIodSetup,tmmlMallocCacheAligned | tmmlMallocCleared);    pIodSetup->format          = Null; //(ptmAvFormat_t)pSetupFormat; //Null; // using Null format let us change the format afterwards    pIodSetup->flags           = tsaIODescSetupFlagCacheMalloc | tsaIODescSetupFlagInvalidateDataout;    pIodSetup->fullQName       = "A0IF";    pIodSetup->emptyQName      = "A0IE";    pIodSetup->queueFlags      = 0;    pIodSetup->senderCap       = pDefaultCap1;  //ivp->pVcapVipCap->defaultCapabilities;    pIodSetup->receiverCap     = pDefaultCap2;  //ivp->pVrendGfxVoCap->defaultCapabilities;    pIodSetup->senderIndex     = SenderIndex;   //VCAPVIP2_MAIN_OUTPUT;    pIodSetup->receiverIndex   = ReceiverIndex; //VRENDGFXVO_MAIN_INPUT;    pIodSetup->packetBase      = 0xF40;    pIodSetup->numberOfPackets = NrPackets;    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "Allocating iodescr buffers:" ));    for(i=0;i < NrBuffers;i++)    {        tmError = tmVideoUtilGetFormatBufferSize(                                    pSetupFormat,           //const Void *        pFormat,        //  I: av format                                     i,                      //UInt32              bufferNr,       //  I: buffer index                                    &BufferSize);           //pUInt32             pBufferSize     //  O: size of buffer.        DBG_ASSERT2((tmError == TM_OK),("tmVideoUtilGetFormatBufferSize failed:0x%X\n",tmError));        pIodSetup->bufSize[i]      = BufferSize;            //768 * 576 * 2;        DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "Buffer %d size: %d",i,BufferSize ));    }        pIodSetup->numberOfBuffers = NrBuffers;        // create IO descriptor    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "Creating IO descriptor..." ));    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->format:0x%X",pIodSetup->format ));    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->format->size:%d",pSetupFormat->size ));    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->format->dataClass:%d",pSetupFormat->dataClass ));    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->format->dataType:0x%X",pSetupFormat->dataType ));    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->format->dataSubtype:0x%X",pSetupFormat->dataSubtype ));    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->format->description:0x%X",pSetupFormat->description ));    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->senderCap:0x%X",pIodSetup->senderCap ));    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->receiverCap:0x%X",pIodSetup->receiverCap ));    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->senderIndex:%d",pIodSetup->senderIndex ));    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->receiverIndex:%d",pIodSetup->receiverIndex ));    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->numberOfPackets:%d",pIodSetup->numberOfPackets ));    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->numberOfBuffers:%d",pIodSetup->numberOfBuffers ));    tmError = tsaDefaultInOutDescriptorCreateInMmsp(                                                        ppIoDescr,                                                         pIodSetup,                                                        hMemSpace,                                                        tmmlMallocCacheAligned | tmmlMallocCleared);    DBG_ASSERT2((tmError == TM_OK),("tsaDefaultInOutDescriptorCreate failed:0x%X\n",tmError));    tmmlFree(pIodSetup);    pIodSetup=Null;    /*-----------------------------------------------------------------------*/    /*                     Install Format                                    */    /*-----------------------------------------------------------------------*/        tmError = tsaDefaultSenderReconnect(*ppIoDescr,                                 SenderIndex,                                 pDefaultCap1,                                 NULL);    DBG_ASSERT2((tmError == TM_OK),("tsaDefaultSenderReconnect failed:0x%X\n",tmError));        tmError = tsaDefaultReceiverReconnect(*ppIoDescr,                                 ReceiverIndex,                                 pDefaultCap2);    DBG_ASSERT2((tmError == TM_OK),("tsaDefaultReceiverReconnect failed:0x%X\n",tmError));    if(pDefaultSetup1)        pDefaultSetup1->outputDescriptors[SenderIndex] = *ppIoDescr;        if(pDefaultSetup2)        pDefaultSetup2->inputDescriptors[ReceiverIndex] = *ppIoDescr;            tmError = tsaDefaultInstallFormat(*ppIoDescr,(ptmAvFormat_t) pSetupFormat);    DBG_ASSERT2((tmError == TM_OK),("tsaDefaultInstallFormat failed:0x%X\n",tmError));        DBG_PRINT((dbgexolVideo, DBG_INTERFACE_LEAVE, "exolVideoCreateIoDescr" ));    return tmError;}

//-----------------------------------------------------------------------------
// FUNCTION:    exolVideoCreateIoDescr:
//
// DESCRIPTION: This function does
//                          set input format
//                          set src rect
//                          set dst rect
//
// RETURN:      tmErrorCode_t
//
// NOTES:       None
//-----------------------------------------------------------------------------
//


tmErrorCode_t 
exolVbiCreateIoDescr( 
    ptsaDefaultCapabilities_t   pDefaultCap1,
    ptsaDefaultInstanceSetup_t  pDefaultSetup1,
    int                         SenderIndex,
    ptsaDefaultCapabilities_t   pDefaultCap2,
    ptsaDefaultInstanceSetup_t  pDefaultSetup2,
    int                         ReceiverIndex,
    ptmVideoFormat_t            pSetupFormat,
    int                         NrPackets,
    tmmlMmspHandle_t            hMemSpace,
    ptsaInOutDescriptor_t*      ppIoDescr)
{
    tmErrorCode_t                   tmError = TM_OK;
    ptsaInOutDescriptorSetup_t      pIodSetup=Null;

	(void)NrPackets;
    
    DBG_PRINT((dbgexolVideo, DBG_INTERFACE_ENTER, "exolVbiCreateIoDescr" ));
    DBG_ASSERT2((pDefaultCap1 != 0),("exolVbiCreateIoDescr pDefaultCap1 Null"));
    DBG_ASSERT2((pDefaultCap2 != 0),("exolVbiCreateIoDescr pDefaultCap2 Null"));
    DBG_ASSERT2((ppIoDescr != 0),("exolVbiCreateIoDescr ppIoDescr Null"));
    DBG_ASSERT2((pSetupFormat != 0),("exolVbiCreateIoDescr pSetupFormat Null"));

    /*-----------------------------------------------------------------------*/
    /*                     Create InOutDescriptors                           */
    /*-----------------------------------------------------------------------*/
    
    tmError = tmmlMalloc(
                            hMemSpace,
                            sizeof(tsaInOutDescriptorSetup_t) + 8,
                            (pVoid*)&pIodSetup,tmmlMallocCacheAligned | tmmlMallocCleared);

    pIodSetup->format          = Null; //(ptmAvFormat_t)pSetupFormat; //Null; // using Null format let us change the format afterwards
    pIodSetup->flags           = tsaIODescSetupFlagCacheMalloc | tsaIODescSetupFlagInvalidateDataout;
    pIodSetup->fullQName       = "vb0f";
    pIodSetup->emptyQName      = "vb0e";
    pIodSetup->queueFlags      = 0;
    pIodSetup->senderCap       = pDefaultCap1;  //ivp->pVcapVipCap->defaultCapabilities;
    pIodSetup->receiverCap     = pDefaultCap2;  //ivp->pVrendGfxVoCap->defaultCapabilities;
    pIodSetup->senderIndex     = SenderIndex;   //VCAPVIP2_MAIN_OUTPUT;
    pIodSetup->receiverIndex   = ReceiverIndex; //VRENDGFXVO_MAIN_INPUT;
    pIodSetup->packetBase      = 0x120;
    //pIodSetup->numberOfPackets = 12;
	//There is no VBI 'A/V sync' implemented which means that the pin can run out of packets 
	//at the start for a while until things start getting in stride. The reason for this is 
	//that at startup the VIP floods the pin with full packets (it gets started first) and the 
	//renderer never catches up so data is missed. For the moment I have increased the number 
	//of packets on the pin but the correct solution is to drop the out of date packets and 
	//not try and play them (VBI version of AV Sync). A/V sync is not implemented in MPTK 
	//and so when the video A/V sync gets implemented - the VBI sync will also need to be implemented.
	//( Please note : I have increased the number of packets so this problem is not currently seen,
	//the number of packets should be decreased when VBI 'A/V Sync' is implemented in MPTK)
	pIodSetup->numberOfPackets = 18;

	// buffer1 = offset(0x2004) + (42 * 50) + 128 byte alignment => 10368
	// buffer2 = offset(0xc0) + 256 + 128 byte alignment => 512

	pIodSetup->bufSize[0]      = 10368;
    pIodSetup->bufSize[1]      = 512;
    pIodSetup->numberOfBuffers = 2;

    
    // create IO descriptor
    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "Creating IO descriptor..." ));
    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->format:0x%X",pIodSetup->format ));
    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->format->size:%d",pSetupFormat->size ));
    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->format->dataClass:%d",pSetupFormat->dataClass ));
    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->format->dataType:0x%X",pSetupFormat->dataType ));
    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->format->dataSubtype:0x%X",pSetupFormat->dataSubtype ));
    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->format->description:0x%X",pSetupFormat->description ));
    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->senderCap:0x%X",pIodSetup->senderCap ));
    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->receiverCap:0x%X",pIodSetup->receiverCap ));
    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->senderIndex:%d",pIodSetup->senderIndex ));
    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->receiverIndex:%d",pIodSetup->receiverIndex ));
    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->numberOfPackets:%d",pIodSetup->numberOfPackets ));
    DBG_PRINT((dbgexolVideo, DBG_LEVEL_1, "pIodSetup->numberOfBuffers:%d",pIodSetup->numberOfBuffers ));

    tmError = tsaDefaultInOutDescriptorCreateInMmsp(
                                                        ppIoDescr, 
                                

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -