diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-06-24 08:14:10 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-06-24 08:14:10 +0000 |
commit | 865605639c49de1297b4248953dc6104b7c2dcf8 (patch) | |
tree | c1199d7af10d0016d285e27bc49d58fdeab76d5b /stream | |
parent | 65d087b955bb0ab5959ef2657b987461fbd548d4 (diff) |
Fix dvd:// subtitle handling to always report the MPEG stream id, because
this is the only thing the remaining parts of MPlayer care about.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23621 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'stream')
-rw-r--r-- | stream/stream_dvd.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/stream/stream_dvd.c b/stream/stream_dvd.c index a07f6b82dd..fd330327c4 100644 --- a/stream/stream_dvd.c +++ b/stream/stream_dvd.c @@ -262,20 +262,26 @@ int dvd_aid_from_lang(stream_t *stream, unsigned char* lang) { } int dvd_number_of_subs(stream_t *stream) { + int i; + int maxid = -1; dvd_priv_t *d; if (!stream) return -1; d = stream->priv; if (!d) return -1; - return d->nr_of_subtitles; + for (i = 0; i < d->nr_of_subtitles; i++) + if (d->subtitles[i].id > maxid) maxid = d->subtitles[i].id; + return maxid + 1; } int dvd_lang_from_sid(stream_t *stream, int id) { + int i; dvd_priv_t *d; if (!stream) return 0; d = stream->priv; if (!d) return 0; - if (id >= d->nr_of_subtitles) return 0; - return d->subtitles[id].language; + for (i = 0; i < d->nr_of_subtitles; i++) + if (d->subtitles[i].id == id && d->subtitles[i].language) return d->subtitles[i].language; + return 0; } int dvd_sid_from_lang(stream_t *stream, unsigned char* lang) { @@ -286,7 +292,7 @@ int dvd_sid_from_lang(stream_t *stream, unsigned char* lang) { for(i=0;i<d->nr_of_subtitles;i++) { if(d->subtitles[i].language==code) { mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_DVDsubtitleChannel, i, lang[0],lang[1]); - return i; + return d->subtitles[i].id; } } lang+=2; @@ -1067,10 +1073,10 @@ static int open_s(stream_t *stream,int mode, void* opts, int* file_format) { sub_stream->id = pgc->subp_control[i] >> 8 & 31; #endif - mp_msg(MSGT_OPEN,MSGL_STATUS,MSGTR_DVDsubtitleLanguage, d->nr_of_subtitles, tmp); - mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SUBTITLE_ID=%d\n", d->nr_of_subtitles); + mp_msg(MSGT_OPEN,MSGL_STATUS,MSGTR_DVDsubtitleLanguage, sub_stream->id, tmp); + mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SUBTITLE_ID=%d\n", sub_stream->id); if(language && tmp[0]) - mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SID_%d_LANG=%s\n", d->nr_of_subtitles, tmp); + mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_SID_%d_LANG=%s\n", sub_stream->id, tmp); d->nr_of_subtitles++; } mp_msg(MSGT_OPEN,MSGL_STATUS,MSGTR_DVDnumSubtitles,d->nr_of_subtitles); |