Hello,
What I am trying to do would seem straightforward, but I am having a lot of trouble. I have the encoder running and it outputs the buffer to a file. This works fine for me. However, I would like for it to start a new file after 10 frames.This does not work for me.
Simplified, this is what I have:
while (1)
{
//Read filled buffer pointer from the pipe
framecounter++;
read (encILComp->outPortParams->opBufPipe[0], &pBufferOut, sizeof (pBufferOut));
//Every 10 frames
if(frameCounter % 10)
{
// Close this file and start a new one.
sprintf (filename, "/dev/shm/%d.264", frameCounter/10);
fclose(fp);
FILE * fp = fopen(filename, "w+");
}
// Write frame to file
fwrite (pBufferOut->pBuffer, sizeof (char), pBufferOut->nFilledLen, fpFile);
// Pass the input buffer to the component for next frame
err = OMX_FillThisBuffer (encILComp->handle, pBufferOut);
}
This only works on the first file generated. All the other files VLC cannot play. I suspect the encoder puts information in to the first buffer that VLC needs to play, and the remaining frames do not have it. In my closing/opening section, I need to tell OMX to start over or find some other fix.
Is there an OMX call to tell the encoder to start a new file or resend the information that VLC needs?
Thanks,
Dan