[vlc-devel] [PATCH 3/5] vout: add vout_Cancel

Rémi Denis-Courmont remi at remlab.net
Mon Nov 30 18:02:07 CET 2015


From: Thomas Guillem <thomas at gllm.fr>

This function will cancel the decoder picture pool.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
---
 src/video_output/control.h      |  1 +
 src/video_output/video_output.c | 14 ++++++++++++++
 src/video_output/vout_control.h |  5 +++++
 3 files changed, 20 insertions(+)

diff --git a/src/video_output/control.h b/src/video_output/control.h
index 159e5f8..eff9aa1 100644
--- a/src/video_output/control.h
+++ b/src/video_output/control.h
@@ -29,6 +29,7 @@ enum {
     VOUT_CONTROL_INIT,
     VOUT_CONTROL_CLEAN,
     VOUT_CONTROL_REINIT,                /* cfg */
+    VOUT_CONTROL_CANCEL,
 
 #if 0
     /* */
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 8a70ce7..1c62d9b 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -303,6 +303,12 @@ static void VoutDestructor(vlc_object_t *object)
 }
 
 /* */
+void vout_Cancel(vout_thread_t *vout)
+{
+    vout_control_PushVoid(&vout->p->control, VOUT_CONTROL_CANCEL);
+    vout_control_WaitEmpty(&vout->p->control);
+}
+
 void vout_ChangePause(vout_thread_t *vout, bool is_paused, mtime_t date)
 {
     vout_control_cmd_t cmd;
@@ -1447,6 +1453,11 @@ static int ThreadReinit(vout_thread_t *vout,
     return VLC_SUCCESS;
 }
 
+static void ThreadCancel(vout_thread_t *vout)
+{
+    picture_pool_Cancel(vout->p->decoder_pool);
+}
+
 static int ThreadControl(vout_thread_t *vout, vout_control_cmd_t cmd)
 {
     switch(cmd.type) {
@@ -1466,6 +1477,9 @@ static int ThreadControl(vout_thread_t *vout, vout_control_cmd_t cmd)
         if (ThreadReinit(vout, cmd.u.cfg))
             return 1;
         break;
+    case VOUT_CONTROL_CANCEL:
+        ThreadCancel(vout);
+        break;
     case VOUT_CONTROL_SUBPICTURE:
         ThreadDisplaySubpicture(vout, cmd.u.subpicture);
         cmd.u.subpicture = NULL;
diff --git a/src/video_output/vout_control.h b/src/video_output/vout_control.h
index 2cbb9f9..2c73c9a 100644
--- a/src/video_output/vout_control.h
+++ b/src/video_output/vout_control.h
@@ -52,6 +52,11 @@ void vout_Flush( vout_thread_t *p_vout, mtime_t i_date );
  */
 void vout_Reset( vout_thread_t *p_vout );
 
+/*
+ * Cancel the vout, it won't return any pictures after this call.
+ */
+void vout_Cancel( vout_thread_t *p_vout );
+
 /**
  * This function will force to display the next picture while paused
  */
-- 
2.6.2



More information about the vlc-devel mailing list