Hello,
I want to use jpeg codec on dvsdk encode demo (using DM365EVM).
I changed the source code of three files.
1. codec.c 2. encode.cnf 3. video.c
The source code was able to be compile. But JPEG image was not able to be displayed .
Why cannot I do ?
An additional content is the following :
● codec.c
static Char *jpegExtensions[] = { ".jpeg", NULL };
static Codec videoEncoders[] = {
{
"jpegenc",
"JPEG Video",
jpegExtensions,
NULL,
NULL
},
{
"mpeg4enc",
"MPEG4 Video",
mpeg4Extensions,
NULL,
NULL
},
{
"h264enc",
"H.264 HP",
h264Extensions,
NULL,
NULL
},
{ NULL }
};
● encode .cnf
var JPEGENC = xdc.useModule('ti.sdo.codecs.jpegenc.ce.JPEGENC');
var myEngine = Engine.create("encode", [
{name: "jpegenc", mod: JPEGENC, local: true, groupId: 1},
{name: "mpeg4enc", mod: MPEG4ENC, local: true, groupId: 1},
{name: "h264enc", mod: H264ENC, local: true, groupId: 1},
{name: "g711enc", mod: G711ENC, local: true},
]);
● video.c
Encoder = strcmp(envp->videoEncoder,"jpegenc");
if (Encoder == 0){
printf("JPEG encode start %s\n",envp->videoEncoder);
/* Open the codec engine */
JEngine = Engine_open(envp->engineName, NULL, NULL);
if (JEngine == NULL) {
ERR("Failed to open jpeg codec engine %s\n", envp->engineName);
cleanup(THREAD_FAILURE);
}
/* Set up codec parameters */
iparams = envp->params ? envp->params : &idefaultParams;
idynParams = envp->dynParams ? envp->dynParams : &idefaultDynParams;
iparams->size = sizeof(IMGENC1_Params);
iparams->maxWidth = envp->imageWidth;
iparams->maxHeight = envp->imageHeight;
iparams->maxScans = 1;
iparams->dataEndianness = XDM_BYTE;
iparams->forceChromaFormat = XDM_YUV_422P;
idynParams->inputWidth = iparams->maxWidth;
idynParams->inputHeight = iparams->maxHeight;
hIe1 = Ienc1_create(JEngine, envp->videoEncoder, iparams, idynParams);
if (hIe1 == NULL) {
ERR("Failed to create JPEG encoder: %s\n", envp->videoEncoder);
cleanup(THREAD_FAILURE);
}
/* Store the output buffer size in the environment */
envp->outBufSize = Ienc1_getOutBufSize(hIe1);
}
else {
/* H.264 encode */
}
while (!gblGetQuit()) {
...
if (Encoder == JPEG){
if (Ienc1_process(hIe1, hCapBuf, hDstBuf) < 0) {
ERR("Failed to JPEG encode video buffer\n");
cleanup(THREAD_FAILURE);
}
}
else {
if (Venc1_process(hVe1, hCapBuf, hDstBuf) < 0) {
ERR("Failed to encode video buffer\n");
cleanup(THREAD_FAILURE);
}
}
}
}

