[vlc-commits] decoder: add decoder_AbortPictures

Thomas Guillem git at videolan.org
Mon Dec 21 15:52:57 CET 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Fri Dec 11 11:58:14 2015 +0100| [99f74096d5214ad99f52ad5da8f27eb18c52d7e2] | committer: Thomas Guillem

decoder: add decoder_AbortPictures

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=99f74096d5214ad99f52ad5da8f27eb18c52d7e2
---

 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 6e5bde0..4160d26 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -593,6 +593,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 c05acef..e2dc8c4 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



More information about the vlc-commits mailing list