Commit ec788f2d authored by Rafaël Carré's avatar Rafaël Carré

vout thread: split out command processing function

parent cb21f5e9
......@@ -1462,45 +1462,20 @@ static int ThreadReinit(vout_thread_t *vout,
return VLC_SUCCESS;
}
/*****************************************************************************
* 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)
static int ThreadControl(vout_thread_t *vout, vout_control_cmd_t cmd)
{
vout_thread_t *vout = object;
vout_interlacing_support_t interlacing = {
.is_interlaced = false,
.date = mdate(),
};
mtime_t deadline = VLC_TS_INVALID;
for (;;) {
vout_control_cmd_t cmd;
/* FIXME remove thoses ugly timeouts
*/
while (!vout_control_Pop(&vout->p->control, &cmd, deadline, 100000)) {
switch(cmd.type) {
case VOUT_CONTROL_INIT:
ThreadInit(vout);
if (ThreadStart(vout, NULL)) {
ThreadStop(vout, NULL);
ThreadClean(vout);
return NULL;
}
if (!ThreadStart(vout, NULL))
break;
case VOUT_CONTROL_CLEAN:
ThreadStop(vout, NULL);
ThreadClean(vout);
return NULL;
return -1;
case VOUT_CONTROL_REINIT:
if (ThreadReinit(vout, cmd.u.cfg))
return NULL;
return -1;
break;
case VOUT_CONTROL_SUBPICTURE:
ThreadDisplaySubpicture(vout, cmd.u.subpicture);
......@@ -1568,9 +1543,33 @@ static void *Thread(void *object)
break;
}
vout_control_cmd_Clean(&cmd);
}
return 0;
}
/*****************************************************************************
* 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_interlacing_support_t interlacing = {
.is_interlaced = false,
.date = mdate(),
};
mtime_t deadline = VLC_TS_INVALID;
for (;;) {
vout_control_cmd_t cmd;
/* FIXME remove thoses ugly timeouts */
while (!vout_control_Pop(&vout->p->control, &cmd, deadline, 100000))
if (ThreadControl(vout, cmd))
return NULL;
ThreadManage(vout, &deadline, &interlacing);
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment