[vlc-commits] demux: avformat: fix WTV dvb subtitles (fix #9120)

Francois Cartegnie git at videolan.org
Fri Oct 20 12:55:49 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Oct 20 12:43:08 2017 +0200| [1f9a24aacd3ccfd196830dd73b1588ca5af56f75] | committer: Francois Cartegnie

demux: avformat: fix WTV dvb subtitles (fix #9120)

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

 modules/demux/avformat/demux.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 783220df78..e99a9aa750 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -475,6 +475,13 @@ int OpenDemux( vlc_object_t *p_this )
                     free( psz_buf );
                 }
             }
+            else if( !strcmp( p_sys->ic->iformat->name, "wtv" ) &&
+                     cp->codec_id == AV_CODEC_ID_DVB_SUBTITLE &&
+                     cp->extradata_size > 3 )
+            {
+                es_fmt.subs.dvb.i_id = GetWBE( cp->extradata ) |
+                                      (GetWBE( cp->extradata + 2 ) << 16);
+            }
 
             psz_type = "subtitle";
             break;
@@ -734,6 +741,19 @@ static int Demux( demux_t *p_demux )
             return 1;
         }
     }
+    else if( !strcmp( p_sys->fmt->name, "wtv" ) &&
+             p_stream->codecpar->codec_id == AV_CODEC_ID_DVB_SUBTITLE )
+    {
+        if( ( p_frame = block_Alloc( pkt.size + 3 ) ) == NULL )
+        {
+            av_packet_unref( &pkt );
+            return 0;
+        }
+        p_frame->p_buffer[0] = 0x20;
+        p_frame->p_buffer[1] = 0x00;
+        memcpy( &p_frame->p_buffer[2], pkt.data, pkt.size );
+        p_frame->p_buffer[p_frame->i_buffer - 1] = 0x3f;
+    }
     else
     {
         if( ( p_frame = block_Alloc( pkt.size ) ) == NULL )



More information about the vlc-commits mailing list