This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

how to write data into file with dm8168

Hi all,

Using the example code capture_encode from OMX, I need to write and store the video captured in a SATA SSD.

/* ========================================================================== */
/**
* IL_ClientOutputBitStreamWriteTask() : This task function is file writetask for
* encoder component.
*
* @param threadsArg        : Handle to the application
*
*/
/* ========================================================================== */

void IL_ClientOutputBitStreamWriteTask (void *threadsArg)
{
  //unsigned int dataRead = 0;
  OMX_ERRORTYPE err = OMX_ErrorNone;
  IL_CLIENT_COMP_PRIVATE *encILComp = NULL;
  OMX_BUFFERHEADERTYPE *pBufferOut = NULL;
  static unsigned int frameCounter = 0;

  encILComp = ((IL_Client *) threadsArg)->encILComp;

  /* use the initial i/p buffers and make empty this buffer calls */
  err = IL_ClientEncUseInitialOutputResources (encILComp);

  while (1)
  {
    /* Read filled buffer pointer from the pipe */
    read (encILComp->outPortParams->opBufPipe[0],
          &pBufferOut, sizeof (pBufferOut));

    /* write data to output file */
    fwrite (pBufferOut->pBuffer,
            sizeof (char),
            pBufferOut->nFilledLen, ((IL_Client *) threadsArg)->fOut);
    frameCounter++;
    if((frameCounter == encILComp->numFrames) || (gILClientExit == OMX_TRUE))
    {
      frameCounter = 0;
      semp_post(encILComp->eos);
      pthread_exit(encILComp);
    }

    /* Pass the input buffer to the component */
    err = OMX_FillThisBuffer (encILComp->handle, pBufferOut);

    if (OMX_ErrorNone != err)
    {
      /* put back the frame in pipe and wait for state change */
      write (encILComp->outPortParams->opBufPipe[1],
             &pBufferOut, sizeof (pBufferOut));
      printf (" waiting for action from IL Client \n");

      /* since in this example we are changing states in other thread it will
         return error for giving ETB/FTB calls in non-execute state. Since
         example is shutting down, we exit the thread */

      pthread_exit (encILComp);

    }
  }

}

The code above is the example code of the writing task. It writes captured frames in a output file, but, this file is located in memory or disk or in a I/O hard drive?

The application I need to modify, needs to store data (write in a SATA SSD) and then read it (playback the video frames, the wrote file).

Any idea, suggestion or advice is needed.

Regards,

Inigo