Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Tunneling #145

Closed
devalexqt opened this Issue Feb 6, 2013 · 9 comments

Comments

Projects
None yet
3 participants

Its possible to use tunnel with passed data from video_decoder to video_encoder ?
I always get error:

-5: the data format was not acceptable to the sink
Need special configuration?

This my port setup configuration:

OMX_ERRORTYPE r;
OMX_VIDEO_PARAM_PORTFORMATTYPE in_dec_format,out_enc_format,out_dec_Format;
OMX_PARAM_PORTDEFINITIONTYPE in_enc_format;
COMPONENT_T _video_decode = NULL,_video_encode=NULL,*video_resize=NULL, *video_render = NULL;
COMPONENT_T *list[5];
TUNNEL_T tunnel[4];
ILCLIENT_T *client;
int status = 0;

memset(list, 0, sizeof(list));
memset(tunnel, 0, sizeof(tunnel));

if((client = ilclient_init()) == NULL){printf("=>Can't init ilclient_init()!\n");exit(-1);}
if(OMX_Init() != OMX_ErrorNone){ilclient_destroy(client);printf("=>Can't init omx!\n");exit(-1);}

// create video_decode
if(ilclient_create_component(client, &video_decode, "video_decode", ILCLIENT_DISABLE_ALL_PORTS | ILCLIENT_ENABLE_INPUT_BUFFERS) != 0)
status = -14;
list[0] = video_decode;

// create resize
if(ilclient_create_component(client, &video_resize, "resize",ILCLIENT_DISABLE_ALL_PORTS) != 0){status = -14; printf("=> ilclient_create_component() for video_resize failed!!\n");exit(1);}
list[1] = video_resize;

// create video_encode
if(ilclient_create_component(client, &video_encode, "video_encode",ILCLIENT_DISABLE_ALL_PORTS | ILCLIENT_ENABLE_OUTPUT_BUFFERS) != 0){status = -14; printf("=> ilclient_create_component() for video_encode failed!!\n");exit(1);}
list[2] = video_encode;

// create video_render
if(status == 0 && ilclient_create_component(client, &video_render, "video_render", ILCLIENT_DISABLE_ALL_PORTS) != 0)
status = -14;
list[3] = video_render;

// set_tunnel(tunnel, video_decode, 131, video_render, 90);
set_tunnel(tunnel, video_decode, 131, video_encode, 200);

if(status == 0){
ilclient_change_component_state(video_decode, OMX_StateIdle);
ilclient_change_component_state(video_encode, OMX_StateIdle);
}//if status

//input dec format
memset(&in_dec_format, 0, sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE));
in_dec_format.nSize = sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE);
in_dec_format.nVersion.nVersion = OMX_VERSION;
in_dec_format.nPortIndex = 130;
in_dec_format.eCompressionFormat = OMX_VIDEO_CodingAVC;
r = OMX_SetParameter(ILC_GET_HANDLE(video_decode), OMX_IndexParamVideoPortFormat, &in_dec_format);
if ( r!= OMX_ErrorNone){printf("%s:%d: OMX_SetParameter() for video_decode port 130 failed with 0x%08x!\n",FUNCTION, LINE, r);exit(-1);}

//output dec format
memset(&out_dec_Format, 0, sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE));
out_dec_Format.nSize = sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE);
out_dec_Format.nVersion.nVersion = OMX_VERSION;
out_dec_Format.nPortIndex = 131;
// out_dec_Format.eColorFormat = OMX_COLOR_FormatYUV420PackedPlanar;
//if (OMX_GetParameter(ILC_GET_HANDLE(video_decode), OMX_IndexParamPortDefinition, &out_dec_Format) != OMX_ErrorNone) {printf("%s:%d: OMX_GetParameter() for video_encode port 131 failed!\n", FUNCTION, LINE);status=-1;exit(-1);}

if(OMX_SetParameter(ILC_GET_HANDLE(video_decode), OMX_IndexParamVideoPortFormat, &out_dec_Format)!=OMX_ErrorNone){printf("=> Failed set output port formats of buffers for port (video_decode) : 131 \n");status=-1;exit(-1);}

// //input video_encode
memset(&in_enc_format, 0, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
in_enc_format.nSize = sizeof(OMX_PARAM_PORTDEFINITIONTYPE);
in_enc_format.nVersion.nVersion = OMX_VERSION;
in_enc_format.nPortIndex = 200;
if (OMX_GetParameter(ILC_GET_HANDLE(video_encode), OMX_IndexParamPortDefinition,&in_enc_format) != OMX_ErrorNone) {printf("%s:%d: OMX_GetParameter() for video_encode port 200 failed!\n", FUNCTION, LINE);exit(1);}
// Port 200: in 1/1 115200 16 enabled,not pop.,not cont. 320x240 320x240 @1966080 20
in_enc_format.format.video.nFrameWidth = WIDTH;
in_enc_format.format.video.nFrameHeight = HEIGHT;
in_enc_format.format.video.xFramerate = 30 << 16;
in_enc_format.format.video.nSliceHeight = in_enc_format.format.video.nFrameHeight;
in_enc_format.format.video.nStride = in_enc_format.format.video.nFrameWidth;
in_enc_format.format.video.eColorFormat = OMX_COLOR_FormatYUV420PackedPlanar;
if (( r = OMX_SetParameter(ILC_GET_HANDLE(video_encode),OMX_IndexParamPortDefinition, &in_enc_format)) != OMX_ErrorNone){printf("%s:%d: OMX_SetParameter() for video_encode port 200 failed with %x!\n", FUNCTION, LINE, r);exit(1);}

//output video_encode
memset(&out_enc_format, 0, sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE));
out_enc_format.nSize = sizeof(OMX_VIDEO_PARAM_PORTFORMATTYPE);
out_enc_format.nVersion.nVersion = OMX_VERSION;
out_enc_format.nPortIndex = 201;
out_enc_format.eCompressionFormat = OMX_VIDEO_CodingAVC;
if ((r = OMX_SetParameter(ILC_GET_HANDLE(video_encode),OMX_IndexParamVideoPortFormat, &out_enc_format)) != OMX_ErrorNone){printf("%s:%d: OMX_SetParameter() for video_encode port 201 failed with %x!\n",FUNCTION, LINE, r);exit(1);}

if(status != 0 &&
ilclient_enable_port_buffers(video_decode, 130, NULL, NULL, NULL) != 0 &&
ilclient_enable_port_buffers(video_encode, 201, NULL, NULL, NULL) != 0){printf("Failed ilclient_enable_port_buffers\n");exit(-1);}
......
......

Yes.
But then I changed "tunnel" to "buffer", and have problem again, I never can get out buffer from decoder , but with video_render its work...

d_out = ilclient_get_output_buffer(video_decode, 131, 1);

I don't understand why?

Sorry for my question, but where I can post my question? Forum is dead for this issues, I think...
I found same buggy!
Simply firs I created component: video_decoder, video_render and video_encoder. All component created successful.

//create video_decode
if(ilclient_create_component(client, &video_decode, "video_decode",ILCLIENT_DISABLE_ALL_PORTS | ILCLIENT_ENABLE_INPUT_BUFFERS | ILCLIENT_ENABLE_OUTPUT_BUFFERS ) != 0){status = -14;exit(-1);}//| ILCLIENT_ENABLE_OUTPUT_BUFFERS
list[0] = video_decode;

// create video_encode
if(ilclient_create_component(client, &video_encode, "video_encode",ILCLIENT_DISABLE_ALL_PORTS | ILCLIENT_ENABLE_INPUT_BUFFERS | ILCLIENT_ENABLE_OUTPUT_BUFFERS) != 0){status = -14; printf("=> ilclient_create_component() for video_encode failed!!\n");exit(1);}
list[2] = video_encode;

// create video_render
if(ilclient_create_component(client, &video_render, "video_render", ILCLIENT_DISABLE_ALL_PORTS) != 0){status = -14;exit(-1);}
list[3] = video_render;

But now in code I don't use video_encoder, only decoder&render for step by step ....
Next I enable input and output ports of decoder (in case if I disabled tunneling to video_render for use decoder in&out buffers). But if I enable video_encode buffer when I cant get output buffer OMX_FillThisBuffer(ILC_GET_HANDLE(video_decode), d_out); from decoder or if I enable render for view real picture (like it's works!) and enable encoder ports then render don't work too.

ilclient_enable_port_buffers(video_decode, 130, NULL, NULL, NULL) ;
if(!isRender){if(ilclient_enable_port_buffers(video_decode, 131, NULL, NULL, NULL) ;}

        ilclient_enable_port_buffers(video_encode, 200, NULL, NULL, NULL); ?????
        ilclient_enable_port_buffers(video_encode, 201, NULL, NULL, NULL) ; ????

I don't understand that I why ? What I need to do?

I have one more thinks, all component created on one pointer 'client' its correct? or I need create components on different 'client' ?

// create video_decode
if(ilclient_create_component(client, &video_decode, "video_decode",ILCLIENT_DISABLE_ALL_PORTS | ILCLIENT_ENABLE_INPUT_BUFFERS | ILCLIENT_ENABLE_OUTPUT_BUFFERS ) != 0){status = -14;exit(-1);}//| ILCLIENT_ENABLE_OUTPUT_BUFFERS
list[0] = video_decode;

// create video_encode
if(ilclient_create_component(client, &video_encode, "video_encode",ILCLIENT_DISABLE_ALL_PORTS | ILCLIENT_ENABLE_INPUT_BUFFERS | ILCLIENT_ENABLE_OUTPUT_BUFFERS) != 0){status = -14; printf("=> ilclient_create_component() for video_encode failed!!\n");exit(1);}
list[2] = video_encode;

Contributor

popcornmix commented Feb 8, 2013

I'm not an expert, but all our omx test apps use a single client, so I think that is fine.

I found what same example use native omx api without "ilclient", and it works....
I don't understand, why if I simple add video_encode component (don't full implement, only add and set port) and turn on 200, 201 port decoder not longer works (in console log I see that input buffer is full but out buff don't flush- don't render on the screen)

Contributor

popcornmix commented Feb 8, 2013

Have you read the spec:
http://www.khronos.org/registry/omxil/specs/OpenMAX_IL_1_1_2_Specification.pdf
It's pretty strictly defined which operations are allowed in which states.

Ruffio commented Jun 19, 2015

@devalexqt is this still an issue?

Contributor

popcornmix commented Jun 22, 2015

I see no evidence of a firmware bug. It sounds like a bug in the user code. Reopen if there is more information.

@popcornmix popcornmix closed this Jun 22, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment