Mercurial > mplayer.hg
changeset 31628:f15df2e3081b
Add support for DVB and XSUB subtitles, not yet working properly.
author | reimar |
---|---|
date | Sun, 11 Jul 2010 09:04:29 +0000 |
parents | d0f8ed8e1f27 |
children | 82958b5ad419 |
files | av_sub.c libmpdemux/demux_lavf.c mpcommon.c |
diffstat | 3 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/av_sub.c Sun Jul 11 09:03:59 2010 +0000 +++ b/av_sub.c Sun Jul 11 09:04:29 2010 +0000 @@ -49,11 +49,20 @@ 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);
--- a/libmpdemux/demux_lavf.c Sun Jul 11 09:03:59 2010 +0000 +++ b/libmpdemux/demux_lavf.c Sun Jul 11 09:04:29 2010 +0000 @@ -422,6 +422,10 @@ 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)
--- a/mpcommon.c Sun Jul 11 09:03:59 2010 +0000 +++ b/mpcommon.c Sun Jul 11 09:04:29 2010 +0000 @@ -92,7 +92,7 @@ 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)