aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--libmpdemux/demux_demuxers.c6
-rw-r--r--libmpdemux/demuxer.h2
-rw-r--r--mpcommon.c4
3 files changed, 12 insertions, 0 deletions
diff --git a/libmpdemux/demux_demuxers.c b/libmpdemux/demux_demuxers.c
index 4cfc59edb9..9c13ed7304 100644
--- a/libmpdemux/demux_demuxers.c
+++ b/libmpdemux/demux_demuxers.c
@@ -54,9 +54,15 @@ demuxer_t* new_demuxers_demuxer(demuxer_t* vd, demuxer_t* ad, demuxer_t* sd) {
ret->video = vd->video;
ret->audio = ad->audio;
ret->sub = sd->sub;
+ if (sd && sd != vd && sd != ad) sd->sub->non_interleaved = 1;
+
+ // without these, demux_demuxers_fill_buffer will never be called,
+ // but they break the demuxer-specific code in video.c
+#if 0
if (vd) vd->video->demuxer = ret;
if (ad) ad->audio->demuxer = ret;
if (sd) sd->sub->demuxer = ret;
+#endif
// HACK?, necessary for subtitle (and audio and video when implemented) switching
memcpy(ret->v_streams, vd->v_streams, sizeof(ret->v_streams));
diff --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h
index 77b20e1bcf..5d62f1bb52 100644
--- a/libmpdemux/demuxer.h
+++ b/libmpdemux/demuxer.h
@@ -142,6 +142,8 @@ typedef struct {
off_t dpos; // position in the demuxed stream
int pack_no; // serial number of packet
int flags; // flags of current packet (keyframe etc)
+ int non_interleaved; // 1 if this stream is not properly interleaved,
+ // so e.g. subtitle handling must do explicit reads.
//---------------
int packs; // number of packets in buffer
int bytes; // total bytes of packets in buffer
diff --git a/mpcommon.c b/mpcommon.c
index 442fba9560..ed0c11e725 100644
--- a/mpcommon.c
+++ b/mpcommon.c
@@ -145,6 +145,8 @@ void update_subtitles(sh_video_t *sh_video, double refpts, demux_stream_t *d_dvd
} else if (dvdsub_id >= 0 && (type == 't' || type == 'm' || type == 'a')) {
double curpts = refpts + sub_delay;
double endpts;
+ if (d_dvdsub->non_interleaved)
+ ds_get_next_pts(d_dvdsub);
while (d_dvdsub->first) {
double subpts = ds_get_next_pts(d_dvdsub);
if (subpts > curpts)
@@ -195,6 +197,8 @@ void update_subtitles(sh_video_t *sh_video, double refpts, demux_stream_t *d_dvd
sub_add_text(&subs, packet, len, endpts);
set_osd_subtitle(&subs);
}
+ if (d_dvdsub->non_interleaved)
+ ds_get_next_pts(d_dvdsub);
}
if (sub_clear_text(&subs, curpts))
set_osd_subtitle(&subs);