diff options
author | Josep Torra <n770galaxy@gmail.com> | 2014-03-26 11:07:29 +0100 |
---|---|---|
committer | Josep Torra <n770galaxy@gmail.com> | 2014-03-26 11:07:29 +0100 |
commit | 1b38283ce3deda5abf9b70e6a4373ce53ddcfafd (patch) | |
tree | c68b1830ba89925d36f8367e517a19b7f01502f9 | |
parent | 08f3ae7010169874a4c5f4f604b7de8e6883b629 (diff) |
Stop application on EOS
-rw-r--r-- | video.c | 28 |
1 files changed, 19 insertions, 9 deletions
@@ -44,8 +44,8 @@ void my_fill_buffer_done(void* data, COMPONENT_T* comp) { if (OMX_FillThisBuffer(ilclient_get_handle(egl_render), eglBuffer) != OMX_ErrorNone) { - printf("OMX_FillThisBuffer failed in callback\n"); - exit(1); + printf("WARNING: OMX_FillThisBuffer failed in callback\n"); + //exit(1); } } @@ -157,9 +157,10 @@ void *video_decode_test(void* arg) unsigned char *dest = buf->pBuffer; // loop if at end - if (feof(in)) - rewind(in); - + if (feof(in)) { + printf ("EOS\n"); + break; // rewind(in); + } data_len += fread(dest, 1, buf->nAllocLen-data_len, in); if(port_settings_changed == 0 && @@ -234,33 +235,42 @@ void *video_decode_test(void* arg) } } + printf ("Sending EOS buffer\n"); buf->nFilledLen = 0; buf->nFlags = OMX_BUFFERFLAG_TIME_UNKNOWN | OMX_BUFFERFLAG_EOS; if(OMX_EmptyThisBuffer(ILC_GET_HANDLE(video_decode), buf) != OMX_ErrorNone) status = -20; + printf ("Pause media processing pipeline\n"); + ilclient_state_transition(list, OMX_StatePause); + printf ("Flushing tunnel\n"); // need to flush the renderer to allow video_decode to disable its input port ilclient_flush_tunnels(tunnel, 0); - + printf ("Disable video decoder input port\n"); ilclient_disable_port_buffers(video_decode, 130, NULL, NULL, NULL); } fclose(in); + printf ("change media processing pipeline to idle state\n"); + ilclient_state_transition(list, OMX_StateIdle); + + printf ("Disable tunnels\n"); ilclient_disable_tunnel(tunnel); ilclient_disable_tunnel(tunnel+1); ilclient_disable_tunnel(tunnel+2); ilclient_teardown_tunnels(tunnel); - ilclient_state_transition(list, OMX_StateIdle); - ilclient_state_transition(list, OMX_StateLoaded); - + printf ("release components\n"); ilclient_cleanup_components(list); + printf ("deinit OpenMAX\n"); OMX_Deinit(); + printf ("destroy IL client\n"); ilclient_destroy(client); + exit(1); return (void *)status; } |