[vlc-devel] [PATCH 3/5] decoder: add decoder_AbortPictures

Thomas Guillem thomas at gllm.fr
Fri Dec 11 13:34:46 CET 2015


---
 include/vlc_codec.h | 10 ++++++++++
 src/input/decoder.c | 10 ++++++++++
 src/libvlccore.sym  |  1 +
 3 files changed, 21 insertions(+)

diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index 9927ec1..389d398 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -246,6 +246,16 @@ static inline picture_t *decoder_NewPicture( decoder_t *dec )
 }
 
 /**
+ * Abort any calls of decoder_NewPicture / decoder_GetPicture
+ *
+ * If b_abort is true, all pending and futures calls of decoder_NewPicture /
+ * decoder_GetPicture will be aborted. This function can be used by
+ * asynchronous video decoders to unblock a thread that is waiting for a
+ * picture.
+ */
+VLC_API void decoder_AbortPictures( decoder_t *dec, bool b_abort );
+
+/**
  * This function queues a picture to the video output.
  *
  * \note
diff --git a/src/input/decoder.c b/src/input/decoder.c
index 83031ba..880e813 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -594,6 +594,16 @@ int decoder_GetDisplayRate( decoder_t *p_dec )
     return p_dec->pf_get_display_rate( p_dec );
 }
 
+void decoder_AbortPictures( decoder_t *p_dec, bool b_abort )
+{
+    decoder_owner_sys_t *p_owner = p_dec->p_owner;
+
+    vlc_mutex_lock( &p_owner->lock );
+    if( p_owner->p_vout != NULL )
+        vout_Cancel( p_owner->p_vout, b_abort );
+    vlc_mutex_unlock( &p_owner->lock );
+}
+
 static void DecoderWaitUnblock( decoder_t *p_dec )
 {
     decoder_owner_sys_t *p_owner = p_dec->p_owner;
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 95152e8..a427066 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -73,6 +73,7 @@ date_Increment
 date_Init
 date_Move
 date_Set
+decoder_AbortPictures
 decoder_GetDisplayDate
 decoder_GetDisplayRate
 decoder_GetInputAttachments
-- 
2.1.4



More information about the vlc-devel mailing list