summaryrefslogtreecommitdiffstats
path: root/av_sub.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-07-11 09:04:29 +0000
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-11-02 04:14:43 +0200
commit9e537d1f6e90c4aca4778e47c082367639df28ca (patch)
tree27b4ea29765f9ad1836ba2cd9c63d67d863aea88 /av_sub.c
parent3b92d754814e1e3db98192d6fbd29df1a73ed7ff (diff)
downloadmpv-9e537d1f6e90c4aca4778e47c082367639df28ca.tar.bz2
mpv-9e537d1f6e90c4aca4778e47c082367639df28ca.tar.xz
subs: Add support for DVB and XSUB subtitles, not yet working properly
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31694 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'av_sub.c')
-rw-r--r--av_sub.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/av_sub.c b/av_sub.c
index 9a7c832594..d55a5674de 100644
--- a/av_sub.c
+++ b/av_sub.c
@@ -50,11 +50,20 @@ int decode_avsub(struct sh_sub *sh, uint8_t **data, int *size, double *pts, doub
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);