summaryrefslogtreecommitdiffstats
path: root/demux/demux_disc.c
diff options
context:
space:
mode:
Diffstat (limited to 'demux/demux_disc.c')
-rw-r--r--demux/demux_disc.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/demux/demux_disc.c b/demux/demux_disc.c
index 1abae38d35..90c276b414 100644
--- a/demux/demux_disc.c
+++ b/demux/demux_disc.c
@@ -54,9 +54,10 @@ struct priv {
static void reselect_streams(demuxer_t *demuxer)
{
struct priv *p = demuxer->priv;
- for (int n = 0; n < MPMIN(p->slave->num_streams, p->num_streams); n++) {
+ int num_slave = demux_get_num_stream(p->slave);
+ for (int n = 0; n < MPMIN(num_slave, p->num_streams); n++) {
if (p->streams[n]) {
- demuxer_select_track(p->slave, p->slave->streams[n],
+ demuxer_select_track(p->slave, demux_get_stream(p->slave, n),
demux_stream_is_selected(p->streams[n]));
}
}
@@ -81,9 +82,7 @@ static void add_dvd_streams(demuxer_t *demuxer)
struct stream_dvd_info_req info;
if (stream_control(stream, STREAM_CTRL_GET_DVD_INFO, &info) > 0) {
for (int n = 0; n < MPMIN(32, info.num_subs); n++) {
- struct sh_stream *sh = new_sh_stream(demuxer, STREAM_SUB);
- if (!sh)
- break;
+ struct sh_stream *sh = demux_alloc_sh_stream(STREAM_SUB);
sh->demuxer_id = n + 0x20;
sh->codec = "dvd_subtitle";
get_disc_lang(stream, sh);
@@ -114,6 +113,8 @@ static void add_dvd_streams(demuxer_t *demuxer)
sh->extradata = s;
sh->extradata_size = strlen(s);
+
+ demux_add_sh_stream(demuxer, sh);
}
}
}
@@ -122,8 +123,8 @@ static void add_streams(demuxer_t *demuxer)
{
struct priv *p = demuxer->priv;
- for (int n = p->num_streams; n < p->slave->num_streams; n++) {
- struct sh_stream *src = p->slave->streams[n];
+ for (int n = p->num_streams; n < demux_get_num_stream(p->slave); n++) {
+ struct sh_stream *src = demux_get_stream(p->slave, n);
if (src->sub) {
struct sh_stream *sub = NULL;
if (src->demuxer_id >= 0x20 && src->demuxer_id <= 0x3F)
@@ -134,9 +135,7 @@ static void add_streams(demuxer_t *demuxer)
continue;
}
}
- struct sh_stream *sh = new_sh_stream(demuxer, src->type);
- if (!sh)
- break;
+ struct sh_stream *sh = demux_alloc_sh_stream(src->type);
assert(p->num_streams == n); // directly mapped
MP_TARRAY_APPEND(p, p->streams, p->num_streams, sh);
// Copy all stream fields that might be relevant
@@ -159,6 +158,7 @@ static void add_streams(demuxer_t *demuxer)
if (src->audio)
sh->audio = src->audio;
get_disc_lang(demuxer->stream, sh);
+ demux_add_sh_stream(demuxer, sh);
}
reselect_streams(demuxer);
}