I have a working encode demo app that is modified to work on my custom
hardware.
It compiles and runs, encodes the video with the codec engine, etc.
But now I am trying to simply clean it out and make it into a library to use
in a streaming application.
I changed very little besides the organization of the source code and built
an interface so another application can control it and get the frames from
it instaed of them being written to disk.
I did not even touch the part that initializes the device, codec engine,
encoder, and capture device.
But it does not run and exits with an error at VIDENC_Process.
If I remove VIDENC_Process, the program runs and captures raw frames and
then, of course, does not encode them.
So the problem seems completely centered around the way I call
VIDENC_Process or the parameters that are being passed to it.
Here is some debug trace:
Encode Debug: captureWidth = 480, captureHeight = 272
Encodeov3640_setup: UYVY mode !
Debug: Set the ov3640_set_scaleformat: width: 480, height: 272
capture input toov3640_set_qwga: 480x272
id 0
Encode Debug: Setting capture video format
VIDIOC_G_FMT: V4L2_BUF_TYPE_VIDEO_CAPTURE
Encode Debug: Setting capture cropping (480x272)
Capturing 480x272 video (cropped to 480x272)
Encode Debug: 3 capture buffers were successfully allocated.
Encode Debug: Capture buffer 0 mapped to address 0x41b5d000
Encode Debug: Capture buffer 1 mapped to address 0x4215d000
Encode Debug: Capture buffer 2 mapped to address 0x4275d000
Encode Debug: Video capture initialized and started
Encode Debug: Codec Engine opened in video thread
Encode Debug: Video encoder created
Encode Debug: Contiguous buffer allocated at physical address 0x8c36a000
Encode Debug: Contiguous buffer allocated at physical address 0x8c435000
Encode Debug: Entering video main loop.
CMEMK Error: get_phys: Unable to find phys addr for 0xbedda4f3
index 0
CMEMK Error: get_phys: get_user_pages() failed: -14
CMEMK Error: GETPHYS: Failed to convert virtual 0xbedda4f3 to physical.
CMEM Error: getPhys: Failed to get physical address of 0xbedda4f3
Encode Error: VIDENC_process() failed with a fatal error (-2 ext: 0x3f9
Encode Error: no frame captured
My CMEM insmod from the loadmodules.sh script:
insmod /lib/modules/cmemk.ko phys_start=0x87800000 phys_end=0x88000000
pools=1x3145728,3x829440,1x61440,1x10240
Here is the encodeVideoBuffer function that calls the VIDENC_Process and
always fails.
static int encodeVideoBuffer(VIDENC_Handle hEncode, char *inBuf, int
inBufSize,
char *outBuf, int *outBufSize)
{
XDM_BufDesc inBufDesc;
XDM_BufDesc outBufDesc;
XDAS_Int32 inBufSizeArray[1];
XDAS_Int32 outBufSizeArray[1];
XDAS_Int32 status;
VIDENC_InArgs inArgs;
VIDENC_OutArgs outArgs;
inBufSizeArray[0] = inBufSize;
#ifdef WIDESCREEN_LCD
outBufSizeArray[0] = LCD_FRAME_SIZE;
#else /* !WIDESCREEN_LCD */
outBufSizeArray[0] = D1_FRAME_SIZE;
#endif /* WIDESCREEN_LCD */
inBufDesc.numBufs = 1;
inBufDesc.bufSizes = inBufSizeArray;
inBufDesc.bufs = (XDAS_Int8 **) &inBuf;
outBufDesc.numBufs = 1;
outBufDesc.bufSizes = outBufSizeArray;
outBufDesc.bufs = (XDAS_Int8 **) &outBuf;
inArgs.size = sizeof(VIDENC_InArgs);
outArgs.size = sizeof(VIDENC_OutArgs);
/* Encode video buffer */
status = VIDENC_process(hEncode, &inBufDesc, &outBufDesc, &inArgs,
&outArgs);
if (status != VIDENC_EOK) {
ERR("VIDENC_process() failed with a fatal error (%ld ext: %#lx\n",
status, outArgs.extendedError);
return FAILURE;
}
*outBufSize = outArgs.bytesGenerated;
return SUCCESS;
}
Any help would be appreciated. I have gone over this so many times and it
just looks the same as the encode demo which is working fine.
Thanks,
-mat
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source