[MPlayer-cvslog] r31694 - in trunk: av_sub.c libmpdemux/demux_lavf.c mpcommon.c

reimar subversion at mplayerhq.hu
Sun Jul 11 11:04:29 CEST 2010


Author: reimar
Date: Sun Jul 11 11:04:29 2010
New Revision: 31694

Log:
Add support for DVB and XSUB subtitles, not yet working properly.

Modified:
   trunk/av_sub.c
   trunk/libmpdemux/demux_lavf.c
   trunk/mpcommon.c

Modified: trunk/av_sub.c
==============================================================================
--- trunk/av_sub.c	Sun Jul 11 11:03:59 2010	(r31693)
+++ trunk/av_sub.c	Sun Jul 11 11:04:29 2010	(r31694)
@@ -49,11 +49,20 @@ int decode_avsub(struct sh_sub *sh, uint
     if (*pts != MP_NOPTS_VALUE && *endpts != MP_NOPTS_VALUE)
         pkt.convergence_duration = (*endpts - *pts) * 1000;
     if (!ctx) {
+        enum CodecID cid = CODEC_ID_NONE;
         AVCodec *sub_codec;
         avcodec_init();
         avcodec_register_all();
         ctx = avcodec_alloc_context();
-        sub_codec = avcodec_find_decoder(CODEC_ID_HDMV_PGS_SUBTITLE);
+        switch (sh->type) {
+        case 'b':
+            cid = CODEC_ID_DVB_SUBTITLE; break;
+        case 'p':
+            cid = CODEC_ID_HDMV_PGS_SUBTITLE; break;
+        case 'x':
+            cid = CODEC_ID_XSUB; break;
+        }
+        sub_codec = avcodec_find_decoder(cid);
         if (!ctx || !sub_codec || avcodec_open(ctx, sub_codec) < 0) {
             mp_msg(MSGT_SUBREADER, MSGL_FATAL, "Could not open subtitle decoder\n");
             av_freep(&ctx);

Modified: trunk/libmpdemux/demux_lavf.c
==============================================================================
--- trunk/libmpdemux/demux_lavf.c	Sun Jul 11 11:03:59 2010	(r31693)
+++ trunk/libmpdemux/demux_lavf.c	Sun Jul 11 11:04:29 2010	(r31694)
@@ -422,6 +422,10 @@ static void handle_stream(demuxer_t *dem
                 type = 'a';
             else if(codec->codec_id == CODEC_ID_DVD_SUBTITLE)
                 type = 'v';
+            else if(codec->codec_id == CODEC_ID_XSUB)
+                type = 'x';
+            else if(codec->codec_id == CODEC_ID_DVB_SUBTITLE)
+                type = 'b';
             else if(codec->codec_id == CODEC_ID_DVB_TELETEXT)
                 type = 'd';
             else if(codec->codec_id == CODEC_ID_HDMV_PGS_SUBTITLE)

Modified: trunk/mpcommon.c
==============================================================================
--- trunk/mpcommon.c	Sun Jul 11 11:03:59 2010	(r31693)
+++ trunk/mpcommon.c	Sun Jul 11 11:04:29 2010	(r31694)
@@ -92,7 +92,7 @@ static int is_text_sub(int type)
 
 static int is_av_sub(int type)
 {
-    return type == 'p';
+    return type == 'b' || type == 'p' || type == 'x';
 }
 
 void update_subtitles(sh_video_t *sh_video, double refpts, demux_stream_t *d_dvdsub, int reset)


More information about the MPlayer-cvslog mailing list