嵌入式开发之davinci--- 8148/8168/8127 中swms、Mosaic’s、display 显示pal 模式
(1)
(2)
(3)
(4)
-------------------------author:pkf
------------------------------time:2-3
-----------------------------------------------qq:1327706646
()
Void VdecVdis_start()
{
VSYS_PARAMS_S vsysParams;
VDEC_PARAMS_S vdecParams;
VDIS_PARAMS_S vdisParams;
VDIS_MOSAIC_S sVdMosaicParam;
UInt32 i,status;
Bool forceLowCostScale = FALSE;
UInt32 startChID;
UInt64 wallTimeBase;
VdecVdis_bitsRdInit();
#ifdef VDEC_VDIS_ENABLE_IPCFRAMESOUT
VdecVdis_ipcFramesCreate();
#endif
/*
gDemo_info.maxVcapChannels = 0;
gDemo_info.maxVdisChannels = gVdecVdis_config.fileNum;
gDemo_info.maxVencChannels = 0;
gDemo_info.maxVdecChannels = gVdecVdis_config.fileNum;
*/
UInt32 type_process = DEMO_TYPE_PROGRESSIVE;
vdecParams.numChn = gVdecVdis_config.fileNum;
vdisParams.numChannels = gVdecVdis_config.fileNum;
Vsys_params_init(&vsysParams);
vsysParams.systemUseCase = VSYS_USECASE_MULTICHN_VDEC_VDIS;
vsysParams.enableCapture = FALSE;
vsysParams.enableNsf = FALSE;
vsysParams.enableEncode = FALSE;
vsysParams.enableDecode = TRUE;
vsysParams.enableNullSrc = FALSE;
vsysParams.enableAVsync = FALSE;//TRUE;
vsysParams.numDeis = 2;//0
vsysParams.enableSecondaryOut = FALSE;//
#if defined(TI_814X_BUILD) || defined(TI_8107_BUILD)
vsysParams.numSwMs = 2;
vsysParams.numDisplays = 2;
#else
vsysParams.numSwMs = 2;
vsysParams.numDisplays = 2;
#endif
printf ("--------------- CHANNEL DETAILS-------------\n");
printf ("Dec Channels => %d\n", vdecParams.numChn);
printf ("Disp Channels => %d\n", vdisParams.numChannels);
printf ("-------------------------------------------\n");
/* Override the context here as needed */
Vsys_init(&vsysParams);
Vdec_params_init(&vdecParams);
/* Override the context here as needed */
vdecParams.numChn = gVdecVdis_config.fileNum;
vdecParams.forceUseDecChannelParams = TRUE;
OSA_assert( vdecParams.numChn <= VDEC_CHN_MAX );
for (i=0; i < vdecParams.numChn; i++) {
vdecParams.decChannelParams[i].dynamicParam.frameRate = 60; // NOT USED
vdecParams.decChannelParams[i].dynamicParam.targetBitRate = 2 * 1000 * 1000; // NOT USED
if (gVdecVdis_config.fileInfo[i].width != 0 && gVdecVdis_config.fileInfo[i].height != 0)
{
vdecParams.decChannelParams[i].maxVideoWidth = gVdecVdis_config.fileInfo[i].width;
vdecParams.decChannelParams[i].maxVideoHeight = gVdecVdis_config.fileInfo[i].height;
}
else
{
printf(" ERROR: Invalid Decoder width x height !!!\n");
OSA_assert(0);
}
/*If the codec type is missing, by default choose h264*/
if(strlen(gVdecVdis_config.fileInfo[i].codec) == 0)
strcpy(gVdecVdis_config.fileInfo[i].codec,"h264");
if(strcmp(gVdecVdis_config.fileInfo[i].codec,"h264") == 0)
{
vdecParams.decChannelParams[i].isCodec = VDEC_CHN_H264;
printf("ch[%d], h264\n",i);
}
else if(strcmp(gVdecVdis_config.fileInfo[i].codec,"mpeg4") == 0)
{
vdecParams.decChannelParams[i].isCodec = VDEC_CHN_MPEG4;
vdecParams.decChannelParams[i].dynamicParam.frameRate = 30;
vdecParams.decChannelParams[i].dynamicParam.targetBitRate = 2 * 1000 * 1000;
printf("ch[%d], mpeg4\n",i);
}
else if(strcmp(gVdecVdis_config.fileInfo[i].codec,"mjpeg") == 0)
{
vdecParams.decChannelParams[i].isCodec = VDEC_CHN_MJPEG;
vdecParams.decChannelParams[i].dynamicParam.frameRate = 1;
vdecParams.decChannelParams[i].dynamicParam.targetBitRate = 2 * 1000 * 1000;
printf("ch[%d], jpeg\n",i);
}
vdecParams.decChannelParams[i].displayDelay = gVdecVdis_config.fileInfo[i].displaydelay;
vdecParams.decChannelParams[i].numBufPerCh = gVdecVdis_config.fileInfo[i].numbuf;
}
Vdec_init(&vdecParams);
Vdis_params_init(&vdisParams);
/* Override the context here as needed */
vdisParams.numChannels = gVdecVdis_config.fileNum;
vdisParams.deviceParams[VDIS_DEV_HDMI].resolution = VSYS_STD_1080P_60;
/* Since HDCOMP and DVO2 are tied together they must have same resolution */
vdisParams.deviceParams[VDIS_DEV_HDCOMP].resolution = VSYS_STD_1080P_60;
vdisParams.deviceParams[VDIS_DEV_DVO2].resolution =
vdisParams.deviceParams[VDIS_DEV_HDMI].resolution;
vdisParams.deviceParams[VDIS_DEV_SD].resolution = VSYS_STD_PAL;//VSYS_STD_NTSC;
#if defined(TI_814X_BUILD) || defined(TI_8107_BUILD)
/* set for 2 displays */
i = 0;
Demo_swMsGenerateLayout(VDIS_DEV_HDMI, 0, vdecParams.numChn,
DEMO_LAYOUT_MODE_4CH,
&vdisParams.mosaicParams[i], forceLowCostScale, type_process,
vdisParams.deviceParams[VDIS_DEV_HDMI].resolution);
vdisParams.mosaicParams[i].userSetDefaultSWMLayout = TRUE;
VdecVdis_setDefaultSwMs(VDIS_DEV_HDMI, &vdisParams);
if(vdecParams.numChn < 16)
startChID = 0;
else
startChID = 16;
i = 1;
printf("mut_flag =%d \n",decoder_param.p_rtspaddr.mult_flag);
if(decoder_param.p_rtspaddr.mult_flag==1)
{
Demo_swMsGenerateLayout(VDIS_DEV_SD, startChID, vdecParams.numChn,
DEMO_LAYOUT_MODE_1CH/*DEMO_LAYOUT_MODE_1CH*/,
&vdisParams.mosaicParams[i], forceLowCostScale, type_process,
vdisParams.deviceParams[VDIS_DEV_SD].resolution);
}
else
{
Demo_swMsGenerateLayout(VDIS_DEV_SD, startChID, vdecParams.numChn,
DEMO_LAYOUT_MODE_4CH/*DEMO_LAYOUT_MODE_1CH*/,
&vdisParams.mosaicParams[i], forceLowCostScale, type_process,
vdisParams.deviceParams[VDIS_DEV_SD].resolution);
}
vdisParams.mosaicParams[i].userSetDefaultSWMLayout = TRUE;
VdecVdis_setDefaultSwMs(VDIS_DEV_SD, &vdisParams);
#else
/* set for 3 displays */
i = 0;
Demo_swMsGenerateLayout(VDIS_DEV_HDMI, 0, vdecParams.numChn,
DEMO_LAYOUT_MODE_4CH_4CH,
&vdisParams.mosaicParams[i], forceLowCostScale,
type_process,
vdisParams.deviceParams[VDIS_DEV_HDMI].resolution);
vdisParams.mosaicParams[i].userSetDefaultSWMLayout = TRUE;
if(vdecParams.numChn < 16)
startChID = 0;
else
startChID = 16;
i = 1;
Demo_swMsGenerateLayout(VDIS_DEV_HDCOMP, startChID, vdecParams.numChn,
DEMO_LAYOUT_MODE_4CH_4CH,
&vdisParams.mosaicParams[i], forceLowCostScale,
type_process,
vdisParams.deviceParams[VDIS_DEV_HDCOMP].resolution);
vdisParams.mosaicParams[i].userSetDefaultSWMLayout = TRUE;
#endif
Vdis_init(&vdisParams);
wallTimeBase = get_current_time_to_msec();
wallTimeBase = 0;
Vdis_setWallTimeBase(wallTimeBase);
/* Configure display */
Vsys_configureDisplay();
#if USE_FBDEV
grpx_init(GRPX_FORMAT_RGB565);
#endif
/* Create Link instances and connects compoent blocks */
Vsys_create();
/* This is done to re-map ch to window mappping when no. of chan are <16 */
if(vdecParams.numChn < 16)
{
status = Vdis_getMosaicParams(1,&sVdMosaicParam);
status = Vdis_setMosaicParams(1, &sVdMosaicParam);
//status = Vdis_getMosaicParams(VDIS_DEV_SD,&sVdMosaicParam);//1
}
/* Start components in reverse order */
Vdis_start();
Vdec_start();
#ifdef VDEC_VDIS_ENABLE_IPCFRAMESOUT
VdecVdis_ipcFramesStart();
#endif
VdecVdis_bitsRdStart();
}
http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/t/345538
http://bbs.csdn.net/topics/390591462?page=1
http://www.deyisupport.com/question_answer/dsp_arm/davinci_digital_media_processors/f/39/t/9577.aspx
http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/716/t/290242
http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/t/259891
http://www.deyisupport.com/question_answer/dsp_arm/davinci_digital_media_processors/f/39/p/47289/104280.aspx
http://e2e.ti.com/support/dsp/davinci_digital_media_processors/f/717/t/310208