//vout中其实有两个线程,分别名为Thread和ThreadStep,视频正常播放走的是Thread,步进播放走的是ThreadStep(类似ffplay的s键),这里主要还是介绍Thread /***************************************************************************** * Thread: video output thread ***************************************************************************** * Video output thread. This function does only returns when the thread is * terminated. It handles the pictures arriving in the video heap and the * display device events. *****************************************************************************/ static void *Thread( void *object) {
vout_thread_t *vout = object; vout_thread_sys_t *sys = vout->p; mtime_t deadline = VLC_TS_INVALID; bool wait = false ; //这里是一个大的死循环 for (;;) {
vout_control_cmd_t cmd; //对deadline进行修正 if (wait) {
const mtime_t max_deadline = mdate() + 100000 ; deadline = deadline <= VLC_TS_INVALID ? max_deadline : __MIN(deadline, max_deadline); } else {
deadline = VLC_TS_INVALID; } //处理control while (!vout_control_Pop(&sys->control, &cmd, deadline)) if (ThreadControl(vout, cmd)) return NULL; //显示Picture deadline = VLC_TS_INVALID; wait = ThreadDisplayPicture(vout, &deadline) != VLC_SUCCESS; const bool picture_interlaced = sys->displayed.is_interlaced; vout_SetInterlacingState(vout, picture_interlaced); vout_ManageWrapper(vout); } } |