[MPlayer-dev-eng] [PATCH] some DVD subtitles won't show
Kalev Soikonen
ksop at hot.ee
Thu Jun 1 22:12:45 CEST 2006
Hello,
the problem with obscured DVD subtitles is apparently an old one.
In mplayer.c there are some helper vars to enumerate all available subs,
int global_sub_pos, global_sub_indices[];
whereas text subs, vobsubs, demuxed subs each have their separate index.
The way it is implemented, it obviously cannot work with discontiguous set
of numbers:
global_sub_pos = global_sub_indices[SUB_SOURCE_VOBSUB] + vobsub_id;
vobsub_id = global_sub_pos - global_sub_indices[SUB_SOURCE_VOBSUB];
...
As a consequence, dvdsub_id (from -sid option) refers not to actual ID,
but is an (array) index. For mencoder, -sid specifies the ID.
Both mplayer and mencoder use
if(...) dvdsub_id=dvd_sid_from_lang(stream,dvdsub_lang);
and one of those seems wrong. In fact, every use of dvdsub_id is suspect.
Besides, dvdsub_id also applies to ogg/mkv, so it's really a misnomer.
Perhaps a global_sub_list[] of { source, id, lang } would be in order?
Ok, enough with that, attached is a diff to fix the problem.
-------------- next part --------------
diff -ru mplayer_20060519/libmpdemux/stream.h main/libmpdemux/stream.h
--- mplayer_20060519/libmpdemux/stream.h 2006-04-02 13:31:03.000000000 +0000
+++ main/libmpdemux/stream.h 2006-05-31 19:33:18.000000000 +0000
@@ -344,6 +344,7 @@
} dvd_priv_t;
int dvd_number_of_subs(stream_t *stream);
+int dvd_subid_from_sid(stream_t *stream, int id);
int dvd_lang_from_sid(stream_t *stream, int id);
int dvd_aid_from_lang(stream_t *stream, unsigned char* lang);
int dvd_sid_from_lang(stream_t *stream, unsigned char* lang);
diff -ru mplayer_20060519/libmpdemux/stream_dvd.c main/libmpdemux/stream_dvd.c
--- mplayer_20060519/libmpdemux/stream_dvd.c 2006-05-01 02:04:09.000000000 +0000
+++ main/libmpdemux/stream_dvd.c 2006-05-31 19:32:56.000000000 +0000
@@ -168,6 +168,13 @@
return d->nr_of_subtitles;
}
+int dvd_subid_from_sid(stream_t *stream, int id) {
+ dvd_priv_t *d=stream->priv;
+ if(d && (unsigned)id < d->nr_of_subtitles)
+ return d->subtitles[id].id;
+ return -1;
+}
+
int dvd_lang_from_sid(stream_t *stream, int id) {
dvd_priv_t *d;
if (!stream) return 0;
diff -ru mplayer_20060519/mplayer.c main/mplayer.c
--- mplayer_20060519/mplayer.c 2006-05-09 07:17:19.000000000 +0000
+++ main/mplayer.c 2006-05-31 19:46:11.000000000 +0000
@@ -1935,7 +1935,7 @@
if (d_dvdsub) {
#ifdef USE_DVDREAD
if (vo_spudec && stream->type == STREAMTYPE_DVD) {
- d_dvdsub->id = dvdsub_id;
+ d_dvdsub->id = dvd_subid_from_sid(stream, dvdsub_id);
spudec_reset(vo_spudec);
}
#endif
More information about the MPlayer-dev-eng
mailing list