Page 1 of 1

Correct cleanup after video playing in videocube example

Posted: Mon Aug 12, 2013 7:01 am
by cmarty
In examples hello_videocube and hello_teapot there is not correctly done the code which does finishing and cleaning up.
The examples uses egl render component to render video to egl image.
I've tried to fix it up but I'm not omx skilled to find the solution.
The first strange thing above the code is : ... deo.c#L247

Code: Select all

      // wait for EOS from render
      ilclient_wait_for_event(video_render, OMX_EventBufferFlag, 90, 0, OMX_BUFFERFLAG_EOS, 0,
                              ILCLIENT_BUFFER_FLAG_EOS, 10000);
There is use of port 90 of videorender component, but in those examples there isn't active any video_render component. Instead of it there is egl_render component.

Second: the video always finish with exit(1) at my_fill_buffer_done handler. ... ideo.c#L48

Third: after correction of exiting in my_fill_buffer_done handler the code stuck when trying to change component's state to OMX_StateLoaded ... deo.c#L264

Does anybody know how these examples can be modified to correctly clean up and finish the playing of video.

Re: Correct cleanup after video playing in videocube example

Posted: Tue Aug 20, 2013 11:54 pm
by Ed_was_here
I saw those too. For your 3rd issue I removed that line and it seemed to be fine. My fixed version of the code is for the camera board, but might help you out: ... xture_cube

I added a global flag "quitting" to stop the callback from copying data when closing. My shutdown code looks like this:

Code: Select all

	quitting = 1; // set flag to stop the callback from copying data
	if (verbose) printf("close\n");
	ilclient_state_transition(list, OMX_StateIdle);
	// TODO: This hangs.  The code is never executed in the example so it might be a bug
	// The docs say ilclient_state_transition waits for the components to complete the state transition,
	// so one or more may be stuck
	//ilclient_state_transition(list, OMX_StateLoaded);
	if (verbose) printf("cleanup\n");
	if (verbose) printf("omx deinit\n");
	if (verbose) printf("ilclient destroy\n");
	if (verbose) printf("Done quitting preview\n");

Re: Correct cleanup after video playing in videocube example

Posted: Mon Aug 26, 2013 7:41 am
by cmarty
Thanks for that. I solve the callback issue with similar code.
But disable the component state transition to OMX_StateLoaded is not a solution. I can call exit func instead an this will result with the same effect.
I want in my code to fast open new video file without destroying all omx elements and recreating it again. So I think must put them all to OMX_StateLoaded as it was in a begin.
Has anybody seen some videoplay example with egl image that can switch between playing videos.