# HG changeset patch # User eugeni # Date 1203450082 0 # Node ID 4437c030ec0062ec7395f3678c0293e6ff404054 # Parent aff1f94af7ba384bc1ee4139632490ae18ad9a94 Support -slang in lavf demuxer. diff -r aff1f94af7ba -r 4437c030ec00 libmpdemux/demux_lavf.c --- a/libmpdemux/demux_lavf.c Tue Feb 19 18:04:10 2008 +0000 +++ b/libmpdemux/demux_lavf.c Tue Feb 19 19:41:22 2008 +0000 @@ -46,6 +46,8 @@ #define PROBE_BUF_SIZE 2048 extern char *audio_lang; +extern char *dvdsub_lang; +extern int dvdsub_id; static unsigned int opt_probesize = 0; static unsigned int opt_analyzeduration = 0; static char *opt_format; @@ -433,7 +435,14 @@ memcpy(sh_sub->extradata, codec->extradata, codec->extradata_size); sh_sub->extradata_len = codec->extradata_size; } - demuxer->sub->sh = demuxer->s_streams[priv->sub_streams++]; + if (demuxer->sub->id == -1 + || (demuxer->sub->id == -2 && (dvdsub_lang && st->language[0] && !strncmp(dvdsub_lang, st->language, 3))) + || demuxer->sub->id == priv->sub_streams) { + dvdsub_id = i; + demuxer->sub->id = priv->sub_streams; + demuxer->sub->sh = sh_sub; + } + priv->sub_streams++; break; } case CODEC_TYPE_ATTACHMENT:{