static void omx_mp_init(media_pipe_t *mp) { if(!(mp->mp_flags & MP_VIDEO)) return; mp->mp_seek_initiate = omx_mp_begin_seek; mp->mp_seek_audio_done = omx_mp_seek_audio_done; mp->mp_seek_video_done = omx_mp_seek_video_done; mp->mp_hold_changed = omx_mp_hold_changed; mp->mp_clock_setup = omx_mp_clock_setup; omx_clk_t *clk = calloc(1, sizeof(omx_clk_t)); TAILQ_INIT(&clk->q); clk->mp = mp; clk->c = omx_component_create("OMX.broadcom.clock", &mp->mp_mutex, NULL); hts_cond_init(&clk->cond, &mp->mp_mutex); mp->mp_extra = clk; omx_set_state(clk->c, OMX_StateIdle); omx_clk_do(clk, OMX_CLK_INIT, 1); hts_thread_create_joinable("omxclkctrl", &clk->tid, omx_clk_thread, clk, THREAD_PRIO_DEMUXER); }
static void omx_mp_seek_video_done(media_pipe_t *mp) { hts_mutex_lock(&mp->mp_mutex); omx_clk_do(mp->mp_extra, OMX_CLK_SEEK_VIDEO_DONE, 0); hts_mutex_unlock(&mp->mp_mutex); }
static void omx_mp_fini(media_pipe_t *mp) { if(mp->mp_extra == NULL) return; omx_clk_t *clk = mp->mp_extra; hts_mutex_lock(&mp->mp_mutex); omx_clk_do(clk, OMX_CLK_QUIT, 0); hts_mutex_unlock(&mp->mp_mutex); hts_thread_join(&clk->tid); omx_component_destroy(clk->c); free(clk); }
static void omx_mp_clock_setup(media_pipe_t *mp, int has_audio) { omx_clk_do(mp->mp_extra, OMX_CLK_INIT, has_audio); }
static void omx_mp_hold_changed(media_pipe_t *mp) { omx_clk_do(mp->mp_extra, mp->mp_hold_gate ? OMX_CLK_PAUSE : OMX_CLK_PLAY, 0); }
static void omx_mp_begin_seek(media_pipe_t *mp) { omx_clk_do(mp->mp_extra, OMX_CLK_BEGIN_SEEK, 0); }
static void omx_mp_hold_changed(media_pipe_t *mp) { omx_clk_t *clk = mp->mp_extra; omx_clk_do(clk, mp->mp_hold ? OMX_CLK_PAUSE : OMX_CLK_PLAY); }