Mercurial > mplayer.hg
changeset 29816:94bde7a3ac51
Fixup the dvdnav <-> sid mapping, dvdnav_spu_stream_to_lang and
dvdnav_get_spu_logical_stream both take the same numbering (i.e.
not the ids used in the MPEG-TS).
author | reimar |
---|---|
date | Mon, 09 Nov 2009 10:27:48 +0000 |
parents | 3e8bf15f96d6 |
children | b44a41886ed9 |
files | stream/stream_dvdnav.c |
diffstat | 1 files changed, 13 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/stream/stream_dvdnav.c Sun Nov 08 23:31:43 2009 +0000 +++ b/stream/stream_dvdnav.c Mon Nov 09 10:27:48 2009 +0000 @@ -549,16 +549,16 @@ char tmp[] = "unknown"; lg = dvdnav_get_spu_logical_stream(nav, i); if(lg == 0xff) continue; - lang = dvdnav_spu_stream_to_lang(nav, lg); + lang = dvdnav_spu_stream_to_lang(nav, i); if(lang != 0xFFFF) { tmp[0] = lang >> 8; tmp[1] = lang & 0xFF; tmp[2] = 0; } - mp_msg(MSGT_OPEN,MSGL_STATUS,MSGTR_DVDsubtitleLanguage, i, tmp); + mp_msg(MSGT_OPEN,MSGL_STATUS,MSGTR_DVDsubtitleLanguage, lg, tmp); if (lang != 0xFFFF && lang && tmp[0]) - mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SID_%d_LANG=%s\n", i, tmp); + mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SID_%d_LANG=%s\n", lg, tmp); } } @@ -797,9 +797,9 @@ for(k=0; k<32; k++) { lg = dvdnav_get_spu_logical_stream(priv->dvdnav, k); if(lg == 0xff) continue; - lang = dvdnav_spu_stream_to_lang(priv->dvdnav, lg); + lang = dvdnav_spu_stream_to_lang(priv->dvdnav, k); if(lang != 0xFFFF && lang == lcode) { - return k; + return lg; } } language += 2; @@ -816,12 +816,16 @@ * \return 0 on error, 1 if successful */ int mp_dvdnav_lang_from_sid(stream_t *stream, int sid, unsigned char *buf) { - uint8_t lg; + uint8_t lg, k; uint16_t lang; dvdnav_priv_t *priv = stream->priv; if(sid < 0) return 0; - lg = dvdnav_get_spu_logical_stream(priv->dvdnav, sid); - lang = dvdnav_spu_stream_to_lang(priv->dvdnav, lg); + for (k=0; k<32; k++) + if (dvdnav_get_spu_logical_stream(priv->dvdnav, k) == sid) + break; + if (k == 32) + return 0; + lang = dvdnav_spu_stream_to_lang(priv->dvdnav, k); if(lang == 0xffff) return 0; buf[0] = lang >> 8; buf[1] = lang & 0xFF; @@ -842,7 +846,7 @@ for(k=0; k<32; k++) { lg = dvdnav_get_spu_logical_stream(priv->dvdnav, k); if(lg == 0xff) continue; - n++; + if(lg >= n) n = lg + 1; } return n; }