[vlc-devel] [PATCH 2/2] avformat: enable SPU_ES muxing for text subtitles

Alexandre Janniaux ajanni at videolabs.io
Tue Nov 26 23:54:50 CET 2019


Allows SPU_ES to be muxed as long as they carry text subtitles. It
releases a little bit the constraint on muxing capabilities of avformat
but in particular allows muxing subrip within matroska files.
---
 modules/demux/avformat/mux.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index 76a3c1da4a..e1d3eb99a4 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -220,12 +220,21 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
         i_codec_id = AV_CODEC_ID_MP3;
     }
 
-    if( fmt->i_cat != VIDEO_ES && fmt->i_cat != AUDIO_ES)
+    if( fmt->i_cat != VIDEO_ES
+     && fmt->i_cat != AUDIO_ES
+     && fmt->i_cat != SPU_ES )
     {
         msg_Warn( p_mux, "Unhandled ES category" );
         return VLC_EGENERIC;
     }
 
+    if( fmt->i_cat == SPU_ES && fmt->i_codec != VLC_CODEC_SUBT )
+    {
+        msg_Warn( p_mux, "Unhandled SPU format `%4.4s'",
+                  (const char*)&fmt->i_codec );
+        return VLC_EGENERIC;
+    }
+
     /* */
     p_input->p_sys = malloc( sizeof( int ) );
     if( unlikely(p_input->p_sys == NULL) )
-- 
2.24.0



More information about the vlc-devel mailing list