diff options
Diffstat (limited to 'stream/stream_concat.c')
-rw-r--r-- | stream/stream_concat.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/stream/stream_concat.c b/stream/stream_concat.c index 060583a604..21f04f9d62 100644 --- a/stream/stream_concat.c +++ b/stream/stream_concat.c @@ -87,6 +87,18 @@ static void s_close(struct stream *s) free_stream(p->streams[n]); } +// Return the "worst" origin value of the two. cur can be 0 to mean unset. +static int combine_origin(int cur, int new) +{ + if (cur == STREAM_ORIGIN_UNSAFE || new == STREAM_ORIGIN_UNSAFE) + return STREAM_ORIGIN_UNSAFE; + if (cur == STREAM_ORIGIN_NET || new == STREAM_ORIGIN_NET) + return STREAM_ORIGIN_NET; + if (cur == STREAM_ORIGIN_FS || new == STREAM_ORIGIN_FS) + return STREAM_ORIGIN_FS; + return new; // including cur==0 +} + static int open2(struct stream *stream, struct stream_open_args *args) { struct priv *p = talloc_zero(stream, struct priv); @@ -104,6 +116,8 @@ static int open2(struct stream *stream, struct stream_open_args *args) return STREAM_ERROR; } + stream->stream_origin = 0; + for (int n = 0; n < list->num_streams; n++) { struct stream *sub = list->streams[n]; @@ -119,6 +133,9 @@ static int open2(struct stream *stream, struct stream_open_args *args) if (!sub->seekable) stream->seekable = false; + stream->stream_origin = + combine_origin(stream->stream_origin, sub->stream_origin); + MP_TARRAY_APPEND(p, p->streams, p->num_streams, sub); } |