[MPlayer-cygwin] None
Joey Parrish
joey at nicewarrior.org
Fri Nov 21 17:26:46 CET 2003
On Thu, Nov 20, 2003 at 11:34:47PM +0100, Hammer László wrote:
> Sorry I do not realy look after in the archive, but has anybody got
> the same problem that I got?
> In the ogm files I can't switch between the sounds or the subtitles.
> Under win2k.
There is no support for switching either afaict. Try applying the
attached patches, in this order: dvd_slang.patch, ogg_sub.patch.
Then add dvdsub_lang command to your input config and that command will
switch subtitle streams for both dvds and ogm files. Both of these
patches will appear in my next package. Let me know what you think.
Audio stream switching is a different problem, because you can have
streams of different codecs. Switching audio is unsafe and unsupported
by MPlayer because there's no really good way to reinit audio codec
midstream afaik. It's a design issue that MPlayer G2 aims to fix.
--Joey
--
"Of the seven dwarves, the only one who shaved was Dopey.
That should tell us something about the wisdom of shaving."
-------------- next part --------------
allow runtime selection of dvd subtitle language (including 'none')
diff -ur main.sofar/input/input.c main.dev/input/input.c
--- main.sofar/input/input.c 2003-11-18 11:07:20.641913600 -0600
+++ main.dev/input/input.c 2003-11-18 11:07:34.401699200 -0600
@@ -78,6 +78,7 @@
{ MP_CMD_SUB_ALIGNMENT, "sub_alignment",0, { {MP_CMD_ARG_INT,{-1}}, {-1,{0}} } },
{ MP_CMD_SUB_VISIBILITY, "sub_visibility", 0, { {-1,{0}} } },
{ MP_CMD_VOBSUB_LANG, "vobsub_lang", 0, { {-1,{0}} } },
+ { MP_CMD_DVDSUB_LANG, "dvdsub_lang", 0, { {-1,{0}} } },
{ MP_CMD_GET_PERCENT_POS, "get_percent_pos", 0, { {-1,{0}} } },
{ MP_CMD_GET_TIME_LENGTH, "get_time_length", 0, { {-1,{0}} } },
#ifdef USE_TV
diff -ur main.sofar/input/input.h main.dev/input/input.h
--- main.sofar/input/input.h 2003-09-21 09:21:43.000000000 -0500
+++ main.dev/input/input.h 2003-11-18 11:09:38.470100800 -0600
@@ -53,6 +53,8 @@
#define MP_CMD_GET_SUB_VISIBILITY 49
#define MP_CMD_SUB_FORCED_ONLY 50
+#define MP_CMD_DVDSUB_LANG 101
+
#define MP_CMD_GUI_EVENTS 5000
#define MP_CMD_GUI_LOADFILE 5001
#define MP_CMD_GUI_LOADSUBTITLE 5002
diff -ur main.sofar/libmpdemux/open.c main.dev/libmpdemux/open.c
--- main.sofar/libmpdemux/open.c 2003-11-18 11:07:20.671956800 -0600
+++ main.dev/libmpdemux/open.c 2003-11-18 11:07:34.431742400 -0600
@@ -624,6 +624,25 @@
return d->nr_of_channels ? d->audio_streams[0].id : -1;
}
+int dvd_number_of_subs(stream_t *stream)
+{
+ dvd_priv_t *d;
+ if (!stream) return -1;
+ d = stream->priv;
+ if (!d) return -1;
+ return d->nr_of_subtitles;
+}
+
+int dvd_lang_from_sid(stream_t *stream, int id)
+{
+ 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;
+}
+
int dvd_sid_from_lang(stream_t *stream, unsigned char* lang){
dvd_priv_t *d=stream->priv;
int code,i;
diff -ur main.sofar/libmpdemux/stream.h main.dev/libmpdemux/stream.h
--- main.sofar/libmpdemux/stream.h 2003-11-18 11:07:20.691985600 -0600
+++ main.dev/libmpdemux/stream.h 2003-11-18 11:07:34.451771200 -0600
@@ -308,6 +308,8 @@
stream_language_t subtitles[32];
} dvd_priv_t;
+int dvd_number_of_subs(stream_t *stream);
+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);
int dvd_chapter_from_cell(dvd_priv_t *dvd,int title,int cell);
diff -ur main.sofar/mplayer.c main.dev/mplayer.c
--- main.sofar/mplayer.c 2003-11-18 11:07:20.722028800 -0600
+++ main.dev/mplayer.c 2003-11-18 11:07:34.481814400 -0600
@@ -1543,7 +1543,7 @@
demux_info_print(demuxer);
//================== Read SUBTITLES (DVD & TEXT) ==========================
-if(d_dvdsub->id >= 0 && vo_spudec==NULL && sh_video){
+if(vo_spudec==NULL && sh_video && stream->type==STREAMTYPE_DVD){
if (spudec_ifo) {
unsigned int palette[16], width, height;
@@ -3040,6 +3040,20 @@
}
#endif
} break;
+ case MP_CMD_DVDSUB_LANG:
+ if (vo_spudec && stream->type == STREAMTYPE_DVD)
+ {
+ int new_id = dvdsub_id + 1;
+ if (dvdsub_id < 0)
+ new_id = 0;
+ if ((unsigned int) new_id >= dvd_number_of_subs(stream))
+ new_id = -1;
+ if(new_id != dvdsub_id)
+ osd_show_vobsub_changed = 40;
+ d_dvdsub->id = dvdsub_id = new_id;
+ spudec_reset(vo_spudec);
+ }
+ break;
case MP_CMD_VOBSUB_LANG:
if (vo_vobsub)
{
@@ -3481,10 +3495,22 @@
osd_show_sub_visibility--;
} else
if (osd_show_vobsub_changed) {
- const char *language = "none";
- if (vo_vobsub && vobsub_id >= 0)
+ if (vo_vobsub && vobsub_id >= 0) {
+ const char *language = "none";
language = vobsub_get_id(vo_vobsub, (unsigned int) vobsub_id);
snprintf(osd_text_tmp, 63, "Subtitles: (%d) %s", vobsub_id, language ? language : "unknown");
+ }
+ if (vo_spudec) {
+ char lang[5] = "none";
+ int code = 0;
+ if (dvdsub_id >= 0) code = dvd_lang_from_sid(stream, dvdsub_id);
+ if (code) {
+ lang[0] = code >> 8;
+ lang[1] = code;
+ lang[2] = 0;
+ }
+ snprintf(osd_text_tmp, 63, "Subtitles: (%d) %s", dvdsub_id, lang);
+ }
osd_show_vobsub_changed--;
} else
#ifdef USE_SUB
-------------- next part --------------
diff -ur main.sofar/libmpdemux/demux_ogg.c main.dev/libmpdemux/demux_ogg.c
--- main.sofar/libmpdemux/demux_ogg.c 2003-11-17 10:48:17.000000000 -0600
+++ main.dev/libmpdemux/demux_ogg.c 2003-11-19 13:48:07.442804800 -0600
@@ -556,12 +556,18 @@
extern void print_wave_header(WAVEFORMATEX *h);
extern void print_video_header(BITMAPINFOHEADER *h);
+static int n_text = 0;
+static int *text_ids = NULL;
+
+int demux_ogg_num_subs() { return n_text; }
+int demux_ogg_sub_id(int index) { return (index < 0) ? index : text_ids[index]; }
+
/// Open an ogg physical stream
int demux_ogg_open(demuxer_t* demuxer) {
ogg_demuxer_t* ogg_d;
stream_t *s;
char* buf;
- int np,s_no, n_audio = 0, n_video = 0, n_text = 0;
+ int np,s_no, n_audio = 0, n_video = 0;
ogg_sync_state* sync;
ogg_page* page;
ogg_packet pack;
@@ -799,6 +805,8 @@
mp_msg(MSGT_DEMUX, MSGL_V, "OGG stream %d is text\n", ogg_d->num_sub);
ogg_d->subs[ogg_d->num_sub].samplerate= get_uint64(&st->time_unit)/10;
n_text++;
+ text_ids = (int *)realloc(text_ids, sizeof(int) * n_text);
+ text_ids[n_text - 1] = ogg_d->num_sub;
demux_ogg_init_sub();
//// Unknown header type
} else
diff -ur main.sofar/mplayer.c main.dev/mplayer.c
--- main.sofar/mplayer.c 2003-11-18 21:46:19.000000000 -0600
+++ main.dev/mplayer.c 2003-11-19 14:00:30.251017600 -0600
@@ -3130,6 +3130,18 @@
d_dvdsub->id = dvdsub_id = new_id;
spudec_reset(vo_spudec);
}
+ else if (d_dvdsub && demuxer->type == DEMUXER_TYPE_OGG)
+ {
+ int new_id = dvdsub_id + 1;
+ if (dvdsub_id < 0)
+ new_id = 0;
+ if ((unsigned int) new_id >= demux_ogg_num_subs())
+ new_id = -1;
+ if(new_id != dvdsub_id)
+ osd_show_vobsub_changed = 40;
+ dvdsub_id = new_id;
+ d_dvdsub->id = demux_ogg_sub_id(new_id);
+ }
break;
case MP_CMD_VOBSUB_LANG:
if (vo_vobsub)
@@ -3602,6 +3602,12 @@
language = vobsub_get_id(vo_vobsub, (unsigned int) vobsub_id);
snprintf(osd_text_tmp, 63, "Subtitles: (%d) %s", vobsub_id, language ? language : "unknown");
}
+ if (d_dvdsub && demuxer->type == DEMUXER_TYPE_OGG) {
+ if (dvdsub_id < 0)
+ snprintf(osd_text_tmp, 63, "Subtitles: (off)");
+ else
+ snprintf(osd_text_tmp, 63, "Subtitles: (%d)", dvdsub_id);
+ }
if (vo_spudec) {
char lang[5] = "none";
int code = 0;
More information about the MPlayer-cygwin
mailing list