Mercurial > mplayer.hg
diff av_sub.c @ 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 | 40c30c70ead0 |
children | 67f2fb3ff4c7 |
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);