[vlc-commits] decoder: add input_DecoderFlush()
Rémi Denis-Courmont
git at videolan.org
Sat Mar 21 17:52:01 CET 2015
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Mar 21 17:57:46 2015 +0200| [7a530806100fd5444b1b873fe8f300613ae5c585] | committer: Rémi Denis-Courmont
decoder: add input_DecoderFlush()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7a530806100fd5444b1b873fe8f300613ae5c585
---
include/vlc_input.h | 1 +
src/input/decoder.c | 19 ++++++++++++++++---
src/libvlccore.sym | 5 +++--
3 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/include/vlc_input.h b/include/vlc_input.h
index c18bea6..a6ea432 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -617,6 +617,7 @@ static inline int input_ModifyPcrSystem( input_thread_t *p_input, bool b_absolut
VLC_API decoder_t * input_DecoderCreate( vlc_object_t *, const es_format_t *, input_resource_t * ) VLC_USED;
VLC_API void input_DecoderDelete( decoder_t * );
VLC_API void input_DecoderDecode( decoder_t *, block_t *, bool b_do_pace );
+VLC_API void input_DecoderFlush( decoder_t * );
/**
* This function creates a sane filename path.
diff --git a/src/input/decoder.c b/src/input/decoder.c
index b5ac464..8cb162c 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -514,15 +514,28 @@ void input_DecoderChangeDelay( decoder_t *p_dec, mtime_t i_delay )
vlc_mutex_unlock( &p_owner->lock );
}
+/**
+ * Requests that the decoder immediately discard all pending buffers.
+ * This is useful at end of stream, when seeking or when deselecting a stream.
+ */
+void input_DecoderFlush( decoder_t *p_dec )
+{
+ decoder_owner_sys_t *p_owner = p_dec->p_owner;
+
+ vlc_mutex_lock( &p_owner->lock );
+ DecoderFlush( p_dec );
+ vlc_mutex_unlock( &p_owner->lock );
+}
+
void input_DecoderStartWait( decoder_t *p_dec )
{
decoder_owner_sys_t *p_owner = p_dec->p_owner;
assert( !p_owner->b_waiting );
- vlc_mutex_lock( &p_owner->lock );
- DecoderFlush( p_dec );
+ input_DecoderFlush( p_dec );
+ vlc_mutex_lock( &p_owner->lock );
p_owner->b_first = true;
p_owner->b_has_data = false;
p_owner->b_waiting = true;
@@ -579,6 +592,7 @@ void input_DecoderFrameNext( decoder_t *p_dec, mtime_t *pi_duration )
else
{
/* TODO subtitle should not be flushed */
+ p_owner->b_waiting = false;
DecoderFlush( p_dec );
}
vlc_mutex_unlock( &p_owner->lock );
@@ -942,7 +956,6 @@ static void DecoderFlush( decoder_t *p_dec )
/* Empty the fifo */
block_FifoEmpty( p_owner->p_fifo );
- p_owner->b_waiting = false;
/* Monitor for flush end */
p_owner->b_flushing = true;
vlc_cond_signal( &p_owner->wait_request );
diff --git a/src/libvlccore.sym b/src/libvlccore.sym
index 13427ba..3cc89b5 100644
--- a/src/libvlccore.sym
+++ b/src/libvlccore.sym
@@ -174,9 +174,10 @@ input_Control
input_Create
input_CreateAndStart
input_CreateFilename
-input_DecoderDecode
-input_DecoderDelete
input_DecoderCreate
+input_DecoderDelete
+input_DecoderDecode
+input_DecoderFlush
input_GetItem
input_item_AddInfo
input_item_AddOption
More information about the vlc-commits
mailing list