[vlc-devel] [PATCH 3/9] vlc_codec: add decoder_ResetOuput() to reset failing decoder init

Steve Lhomme robux4 at videolabs.io
Wed Jul 12 16:54:06 CEST 2017


Since the module loading doesn't go back to the decoder loading between
elements, it's up to the failing decoder to clean up the mess it did before
trying the next decoder.
---
 include/vlc_codec.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index c62ccd0e94..2b7a828ced 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -376,6 +376,15 @@ static inline int decoder_UpdateAudioFormat( decoder_t *dec )
 }
 
 /**
+ * This function needs to be called when a decoder modified its fmt_out and
+ * failed to initialized. It will reset the fmt_out for the next decoder loaded.
+ */
+static inline void decoder_ResetOuput( decoder_t *p_dec )
+{
+    es_format_Change( &p_dec->fmt_out, p_dec->fmt_out.i_cat, 0 );
+}
+
+/**
  * This function will return a new audio buffer usable by a decoder as an
  * output buffer. It must be released with block_Release() or returned it to
  * the caller as a decoder_QueueAudio parameter.
-- 
2.12.1



More information about the vlc-devel mailing list