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.

V4L2 Capture to OMX components


I'm trying to connect a V4L2 capture port to OMX components for h.264 encode.
Looking at gstreamer 0.4 for an example what steps are required to connect these systems?

So far the steps I see are:

1. OMX_Init()
2. pHeap = SharedRegion_getHeap(2);
3. for num_v4l2_buffs, virtual_address[i++] = Memory_alloc(pHeap, MAX_BUFFER_SIZE, ALIGNMENT, NULL);
4. Setup V4L2 for user pointers
5. Queue buffers in V4L2 using virtual addresses from step 3
6. create OMX buffer headers the input of the component and assign pBuffer the virtual addresses from step 3
7. OMX transition to loaded and idle
8. V4L2 Stream On, and OMX transition to Execute
9. Pass buffers from V4L2 buffer dequeue to OMX empty this buffer using matching buffer header from step 6

Is there anything I missed? I currently can't get past step 5.
This is for 8168 on EZSDK 5.3.1.15




  • Hi Scott,

    I am also trying to do something similar to this. Did you get any success?

    I am allocating buffers from framebuffer buffer and passing their virtual address to V4l2 as userpointer. I am able to do this and its working.

    Now, I want to pass that virtual buffer address (dequeued from V4l2 driver) to OMX Encoder component (useBuffer() API). But it fails with unknown error.

    Regards,

    Krunal

  • Hi Krunal,

    I was able to get this running.

    I haven't tried sending the frame buffer addresses to OMX.  The buffers I send to V4L2/OMX come from shared region 2 or the IPC_SR_FRAME_BUFFERS region on the EZSDK memory map.  

  • Hi Scott,

    Thanks for the response.

    After reading few post on this forum, I have started working in this direction (using shared region). The frame-buffer drivers does not use "IPC_SR_FRAME_BUFFERS" shared region so mostly it wont work.

    I am using Android so it will be slightly difficult to implement this in Android framework. Can you please share section of code (for allocating shared memory from IPC_SR_FRAME_BUFFERS)?

    Regards,

    Krunal

  • Scott Dunnington said:

    Hi Krunal,

    I was able to get this running.

    I haven't tried sending the frame buffer addresses to OMX.  The buffers I send to V4L2/OMX come from shared region 2 or the IPC_SR_FRAME_BUFFERS region on the EZSDK memory map.  

    Scott,
    Can you provide some code snippets about how you've gotten the OMX buffers to be handed to V4L2 and then receiving them back for processing?
    What I'm trying to do is the following:
    V4L2 device (/dev/video5 connected to standard definition decoder) -> SC5 (up-scale to 1920x1080) -> HDMI
    I'm following the OMX examples about setting up the SC5 -> HDMI connection and I've followed you steps to allocate buffers from IPC_SRC_FRAME_BUFFERS and am using V4L2 "QBUF" commands to queue them as USERPTR. I can do a "DQBUF" and get a single buffer back from the V4L2 device, but what do I do to get the rest of the OMX chain kicked off to process that particular frame of data?
    Thanks
    ~Ashwin