[vlc-commits] demux: mkv: add support for S_DVBSUB

Filip Roséen git at videolan.org
Mon Jul 16 12:46:38 CEST 2018


vlc | branch: master | Filip Roséen <filip at atch.se> | Mon Jul 16 03:19:55 2018 +0200| [4d22be6dcc60eed789a278b1105a01f59168f8cb] | committer: Steve Lhomme

demux: mkv: add support for S_DVBSUB

fixes: #14577

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>

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

 modules/demux/mkv/matroska_segment_parse.cpp | 12 ++++++++++++
 modules/demux/mkv/mkv.cpp                    | 13 +++++++++++++
 2 files changed, 25 insertions(+)

diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index e263f8dfb2..c58d02746a 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -2057,6 +2057,18 @@ bool matroska_segment_c::TrackInit( mkv_track_t * p_tk )
                 }
             }
         }
+        S_CASE("S_DVBSUB")
+        {
+            vars.p_fmt->i_codec = VLC_CODEC_DVBS;
+
+            if( vars.p_tk->i_extra_data < 4 )
+                throw std::runtime_error( "not enough codec data for S_DVBSUB" );
+
+            uint16_t page_id = GetWBE( &vars.p_tk->p_extra_data[0] );
+            uint16_t ancillary_id = GetWBE( &vars.p_tk->p_extra_data[2] );
+
+            vars.p_fmt->subs.dvb.i_id = ( ancillary_id << 16 ) | page_id;
+        }
         S_CASE("S_HDMV/PGS") {
             vars.p_fmt->i_codec = VLC_CODEC_BD_PG;
         }
diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index d58bf48624..c259ea630f 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -639,6 +639,19 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
                         / CLOCK_FREQ;
             }
             break;
+
+         case VLC_CODEC_DVBS:
+            {
+                p_block = block_Realloc( p_block, 2, p_block->i_buffer + 1);
+
+                if( unlikely( !p_block ) )
+                    continue;
+
+                p_block->p_buffer[0] = 0x20; // data identifier
+                p_block->p_buffer[1] = 0x00; // subtitle stream id
+                p_block->p_buffer[ p_block->i_buffer - 1 ] = 0x3f; // end marker
+            }
+            break;
         }
 
         if( track.fmt.i_cat != VIDEO_ES )



More information about the vlc-commits mailing list