Dear all,
I have a inquiry about ALG_vidEncSetImageSize function which involves in EUCDK_GA1.5/av_capture/framework/alg/src/alg_vidEnc.c. This function can change the resolution of ALG_VID_CODEC_H264 and ALG_VID_CODEC_MJPEG dynamically. But this function does not judge the MPEG4. However, I have add the MPEG4 support at blow marked. Unfortunately, they modify this way will encounter unnormal content like green display. So, I want to confirm that change the MPEG4 resolution dynamically whether is support or not.
int ALG_vidEncSetImageSize(void
*hndl, Uint16 width, Uint16 height)
{
ALG_VidEncObj *pObj =
(ALG_VidEncObj*)hndl;
XDAS_Int32 status;
static Uint16
savedWidth0 = 640, savedHeight0=480;
static Uint16 savedWidth1 = 640,
savedHeight1=480;
static int count=0;
if(pObj->createPrm.codec == ALG_VID_CODEC_H264) // change to if(pObj->createPrm.codec == ALG_VID_CODEC_H264 || pObj->createPrm.codec == ALG_VID_CODEC_MPEG4)
{
/* check for change in resolution */
if (savedWidth0 != width
||savedHeight0 != height )
{
savedWidth0 =
width;
savedHeight0 = height;
count =
30;
OSA_printf("ALG_vidEncSetImageSize %d x %d\n", width, height);
}
// set 30
times for fast switching
if (count == 0)
return OSA_SOK;
count--;
/* Reset the encoder */
status =
VIDENC1_control(pObj->hEncode,
XDM_RESET,
(VIDENC1_DynamicParams*)&pObj->dynamicParams,
&pObj->encStatus);
pObj->createPrm.width = width;
pObj->createPrm.height =
height;
pObj->dynamicParams.inputHeight =
pObj->createPrm.height;
pObj->dynamicParams.inputWidth =
pObj->createPrm.width;
/* Set new input resolution*/
status =
VIDENC1_control(pObj->hEncode,
XDM_SETPARAMS,
(VIDENC1_DynamicParams*)&pObj->dynamicParams,
&pObj->encStatus);
if (status !=
VIDENC1_EOK)
return OSA_EFAIL;
else
return
OSA_SOK;
}else
if(pObj->createPrm.codec == ALG_VID_CODEC_MJPEG) {
/*
check for change in resolution */
if (savedWidth1 != width ||savedHeight1
!= height )
{
savedWidth1 = width;
savedHeight1 =
height;
ALG_jpgEncSetFormat(pObj->hJpgEncode, width,
height);
//OSA_printf("ALG_VID_CODEC_MJPEG ALG_vidEncSetImageSize %d x
%d\n", width, height);
}
}
}
B.R.
Omin