summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libmpdemux/demux_mkv.c20
-rw-r--r--libmpdemux/demux_ogg.c14
-rw-r--r--libmpdemux/matroska.h1
-rw-r--r--mplayer.c32
4 files changed, 21 insertions, 46 deletions
diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c
index 81d00f8676..df60be5c26 100644
--- a/libmpdemux/demux_mkv.c
+++ b/libmpdemux/demux_mkv.c
@@ -3864,26 +3864,6 @@ demux_mkv_control (demuxer_t *demuxer, int cmd, void *arg)
}
}
-/** \brief Return the number of subtitle tracks in the file.
-
- \param demuxer The demuxer for which the number of subtitle tracks
- should be returned.
-*/
-int
-demux_mkv_num_subs (demuxer_t *demuxer)
-{
- mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
- int i, num;
-
- num = 0;
- for (i = 0; i < mkv_d->num_tracks; i++)
- if ((mkv_d->tracks[i]->type == MATROSKA_TRACK_SUBTITLE) &&
- (mkv_d->tracks[i]->subtitle_type != MATROSKA_SUBTYPE_UNKNOWN))
- num++;
-
- return num;
-}
-
/** \brief Change the current subtitle track and return its ID.
Changes the current subtitle track. If the new subtitle track is a
diff --git a/libmpdemux/demux_ogg.c b/libmpdemux/demux_ogg.c
index e0cb4ebb0a..b4ab6e777b 100644
--- a/libmpdemux/demux_ogg.c
+++ b/libmpdemux/demux_ogg.c
@@ -488,7 +488,7 @@ static void demux_ogg_check_comments(demuxer_t *d, ogg_stream_t *os, int id, vor
// check for -slang if subs are uninitialized yet
if (os->text && d->sub->id < 0 && demux_ogg_check_lang(val, dvdsub_lang))
{
- d->sub->id = id;
+ d->sub->id = index;
dvdsub_id = index;
mp_msg(MSGT_DEMUX, MSGL_V, "Ogg demuxer: Displaying subtitle stream id %d which matched -slang %s\n", id, val);
}
@@ -538,7 +538,7 @@ static int demux_ogg_add_packet(demux_stream_t* ds,ogg_stream_t* os,int id,ogg_p
vorbis_info_clear(&vi);
}
if (os->text) {
- if (id == d->sub->id) // don't want to add subtitles to the demuxer for now
+ if (id == demux_ogg_sub_id(d->sub->id)) // don't want to add subtitles to the demuxer for now
demux_ogg_add_sub(os,pack);
return 0;
}
@@ -718,16 +718,6 @@ extern void print_video_header(BITMAPINFOHEADER *h, int verbose_level);
/* defined in demux_mov.c */
extern unsigned int store_ughvlc(unsigned char *s, unsigned int v);
-/** \brief Return the number of subtitle tracks in the file.
-
- \param demuxer The demuxer for which the number of subtitle tracks
- should be returned.
-*/
-int demux_ogg_num_subs(demuxer_t *demuxer) {
- ogg_demuxer_t *ogg_d = (ogg_demuxer_t *)demuxer->priv;
- return ogg_d->n_text;
-}
-
/** \brief Change the current subtitle stream and return its ID.
\param demuxer The demuxer whose subtitle stream will be changed.
diff --git a/libmpdemux/matroska.h b/libmpdemux/matroska.h
index c0c342a3c8..3656076087 100644
--- a/libmpdemux/matroska.h
+++ b/libmpdemux/matroska.h
@@ -61,7 +61,6 @@
#define MKV_S_SSA "S_SSA" // Deprecated
#define MKV_S_ASS "S_ASS" // Deprecated
-int demux_mkv_num_subs(demuxer_t *demuxer);
int demux_mkv_change_subs(demuxer_t *demuxer, int new_num);
void demux_mkv_get_audio_lang(demuxer_t *demuxer, int track_num, char *lang,
int maxlen);
diff --git a/mplayer.c b/mplayer.c
index 0f6d0ac80e..704e0662eb 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -2246,6 +2246,10 @@ static int mp_property_sub(m_option_t* prop,int action,void* arg) {
return M_PROPERTY_OK;
}
#endif
+ if (dvdsub_id >= 0) {
+ snprintf(*(char**)arg, 63, "(%d) %s", dvdsub_id, MSGTR_Unknown);
+ return M_PROPERTY_OK;
+ }
snprintf(*(char**)arg, 63, MSGTR_Disabled);
return M_PROPERTY_OK;
@@ -2316,10 +2320,16 @@ static int mp_property_sub(m_option_t* prop,int action,void* arg) {
spudec_reset(vo_spudec);
}
#endif
-#ifdef HAVE_OGGVORBIS
- if (demuxer->type == DEMUXER_TYPE_OGG)
- d_dvdsub->id = demux_ogg_sub_id(demuxer, dvdsub_id);
-#endif
+ if (stream->type != STREAMTYPE_DVD) {
+ int i = 0;
+ for (d_dvdsub->id = 0; d_dvdsub->id < MAX_S_STREAMS; d_dvdsub->id++) {
+ if (demuxer->s_streams[d_dvdsub->id]) {
+ if (i == dvdsub_id) break;
+ i++;
+ }
+ }
+ d_dvdsub->sh = demuxer->s_streams[d_dvdsub->id];
+ }
if (demuxer->type == DEMUXER_TYPE_MATROSKA) {
d_dvdsub->id = demux_mkv_change_subs(demuxer, dvdsub_id);
#ifdef USE_ASS
@@ -4043,18 +4053,14 @@ if(!demuxer)
}
inited_flags|=INITED_DEMUXER;
-if (demuxer->type==DEMUXER_TYPE_MATROSKA) {
+if (stream->type != STREAMTYPE_DVD) {
+ int i;
// setup global sub numbering
global_sub_indices[SUB_SOURCE_DEMUX] = global_sub_size; // the global # of the first demux-specific sub.
- global_sub_size += demux_mkv_num_subs(demuxer);
+ for (i = 0; i < MAX_S_STREAMS; i++)
+ if (demuxer->s_streams[i])
+ global_sub_size++;
}
-#ifdef HAVE_OGGVORBIS
-if (demuxer->type==DEMUXER_TYPE_OGG) {
- // setup global sub numbering
- global_sub_indices[SUB_SOURCE_DEMUX] = global_sub_size; // the global # of the first demux-specific sub.
- global_sub_size += demux_ogg_num_subs(demuxer);
-}
-#endif
current_module="demux_open2";