aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--demux/demux_timeline.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/demux/demux_timeline.c b/demux/demux_timeline.c
index 6b375261f4..76bb106a7d 100644
--- a/demux/demux_timeline.c
+++ b/demux/demux_timeline.c
@@ -61,7 +61,7 @@ struct priv {
struct segment *current;
// As the demuxer user sees it.
- struct virtual_stream *streams;
+ struct virtual_stream **streams;
int num_streams;
// Total number of packets received past end of segment. Used
@@ -97,7 +97,7 @@ static void associate_streams(struct demuxer *demuxer, struct segment *seg)
if (!other || !target_stream_used(seg, other->index)) {
// Try to associate the first unused stream with matching media type.
for (int i = 0; i < p->num_streams; i++) {
- struct sh_stream *cur = p->streams[i].sh;
+ struct sh_stream *cur = p->streams[i]->sh;
if (cur->type == sh->type && !target_stream_used(seg, cur->index))
{
other = cur;
@@ -118,7 +118,7 @@ static void reselect_streams(struct demuxer *demuxer)
struct priv *p = demuxer->priv;
for (int n = 0; n < p->num_streams; n++) {
- struct virtual_stream *vs = &p->streams[n];
+ struct virtual_stream *vs = p->streams[n];
vs->selected = demux_stream_is_selected(vs->sh);
}
@@ -131,7 +131,7 @@ static void reselect_streams(struct demuxer *demuxer)
struct sh_stream *sh = demux_get_stream(seg->d, i);
bool selected = false;
if (seg->stream_map[i] >= 0)
- selected = p->streams[seg->stream_map[i]].selected;
+ selected = p->streams[seg->stream_map[i]]->selected;
// This stops demuxer readahead for inactive segments.
if (!p->current || seg->d != p->current->d)
selected = false;
@@ -195,7 +195,7 @@ static void switch_segment(struct demuxer *demuxer, struct segment *new,
demux_seek(new->d, start_pts, flags);
for (int n = 0; n < p->num_streams; n++) {
- struct virtual_stream *vs = &p->streams[n];
+ struct virtual_stream *vs = p->streams[n];
vs->new_segment = true;
vs->eos_packets = 0;
}
@@ -244,7 +244,7 @@ static int d_fill_buffer(struct demuxer *demuxer)
bool eos_reached = p->eos_packets > 0;
if (eos_reached && p->eos_packets < 100) {
for (int n = 0; n < p->num_streams; n++) {
- struct virtual_stream *vs = &p->streams[n];
+ struct virtual_stream *vs = p->streams[n];
if (vs->selected) {
int max_packets = 0;
if (vs->sh->type == STREAM_AUDIO)
@@ -293,7 +293,7 @@ static int d_fill_buffer(struct demuxer *demuxer)
if (pkt->pos >= 0)
pkt->pos |= (seg->index & 0x7FFFULL) << 48;
- struct virtual_stream *vs = &p->streams[pkt->stream];
+ struct virtual_stream *vs = p->streams[pkt->stream];
if (pkt->pts != MP_NOPTS_VALUE && pkt->pts >= seg->end) {
// Trust the keyframe flag. Might not always be a good idea, but will
@@ -378,7 +378,8 @@ static int d_open(struct demuxer *demuxer, enum demux_check check)
new->hls_bitrate = sh->hls_bitrate;
new->missing_timestamps = sh->missing_timestamps;
demux_add_sh_stream(demuxer, new);
- struct virtual_stream vs = {
+ struct virtual_stream *vs = talloc_ptrtype(p, vs);
+ *vs = (struct virtual_stream){
.sh = new,
};
MP_TARRAY_APPEND(p, p->streams, p->num_streams, vs);