Posts: 15
Joined: Tue Jun 18, 2013 10:01 pm

Setting a pipeline with openmax

Wed Jun 19, 2013 12:19 pm

I want to setup a simple pipeline consiting of decode -> resize -> encode. Here is the sequence of operations I'm doing but unfortunately I cannot get it to work:

1. Omx_GetHandle for the three components <- Success (they are in stateloaded)
1.1 transition decoder into stateidle
1.2. Config decoder via omx_setparameter <- success
1.3. send commandportenable on port 130 (decode input)
1.4 allocate input buffers for port 130
1.5. transition decoder to state executing

All of these succeed.

I then wait until I get port settings changed from the decoder and proceed to set up the other components:

2. get OMX_IndexParamPortDefinition from port 131 (e.g. get information about the decoded video)
2.1 Configure resizer's port 60 (input) via 'format.image' struct by filling it with data from format.video taken in 4
2.2 configure resizer port 61 via format.image with my desired settings
2.3 setup tunnel via decoder output port to resizer input port
2.4 Transition resizer into state idle
2.5 enable decoder port 131
2.6 enable resizer port 60
2.7 transition resizer into stateexecuting

Again, this succeeds with no problems.

Now I wait until I get port settings changed from the resizer - meaning there output

3. Get OMX_IndexParamPortDefinition from resizer port 61 to get information about its output
3.1 configure encoder port 200 via format.video with data from step 3
3.2 configure encoder's OMX_VIDEO_PARAM_PORTFORMATTYPE for the output (port 201)
3.3 configure encoder's bitrate on port 201
3.4 transition encoder into state idle
3.5 setup tunnel between resizer port 61 and encoder port 201
3.6 send portenable for port 201 on encoder
3.6.1 allocate output buffers
3.6.2 wait until port is enabled
3.7 send commandportenable on resizer port 61 <- Fails - OMX_EventCmdComplete callback is ever send.

I wonder whether I have any error in the in the sequence of events which i'm doing to configure the whole pipeline. Any help will be much appreciated. I have read omxtx's code and have modeled my sequence of events closely to what is happening in the configure function but I cannot get it to work, since my code blocks on waiting for the eventcmdcomplete event for the last sent command ( I have used code from pidvbip in order to do this).

Furthermore, I exclude the possibility of the bug being somewhere in the blocking wrapper around OMX_SendCommand since I'm using the same code in order to do the previous steps and it works flawlessly.

Posts: 15
Joined: Tue Jun 18, 2013 10:01 pm

Re: Setting a pipeline with openmax

Sat Jun 22, 2013 7:51 pm

So the problem was that the encoder's input port wouldn't be enabled (eventcmdcomplete callback invoked) until resizer's port was enabled. And the resizer's output port wouldn't be enabled until encoder's input was enabled. The solution was to send raw OMX_SendCommand to enable both ports and then they both were enabled and I could transition the encoder to the executing state.

Return to “OpenMAX”