demux: let a demuxer mark a stream as absent
Media can stop providing a stream mid-playback, for example a disc program that does not carry the Dolby Vision enhancement layer the previous one had. Since mpv always try to keep at least 1 packet buffered in all tracks, it can keep reading it till EOF.
This commit is contained in:
1 parent
96b9d84b60
commit
795cd15438
3 files changed
+21
-1
No files matched your search
+18
-1
@@ -900,7 +900,7 @@ static void update_stream_eager_state(struct demux_internal *in)
|
||||
struct demux_stream *s = in->streams[n]->ds;
|
||||
|
||||
s->still_image = s->sh->still_image;
|
||||
s->eager = s->selected && !s->sh->attached_picture;
|
||||
s->eager = s->selected && !s->sh->absent && !s->sh->attached_picture;
|
||||
if (s->eager && !s->still_image)
|
||||
any_av_streams |= s->type != STREAM_SUB;
|
||||
any_streams |= s->selected;
|
||||
@@ -933,6 +933,23 @@ void demux_set_stream_still_image(demuxer_t *demuxer, struct sh_stream *sh,
|
||||
mp_mutex_unlock(&in->lock);
|
||||
}
|
||||
|
||||
// Set whether the media provides data for this stream at all.
|
||||
void demux_set_stream_absent(demuxer_t *demuxer, struct sh_stream *sh,
|
||||
bool absent)
|
||||
{
|
||||
struct demux_internal *in = demuxer->in;
|
||||
mp_assert(demuxer == in->d_thread);
|
||||
|
||||
mp_mutex_lock(&in->lock);
|
||||
if (sh->absent != absent) {
|
||||
MP_VERBOSE(in, "stream %d is %s\n", sh->index,
|
||||
absent ? "absent" : "present");
|
||||
sh->absent = absent;
|
||||
update_stream_eager_state(in);
|
||||
}
|
||||
mp_mutex_unlock(&in->lock);
|
||||
}
|
||||
|
||||
static void update_stream_selection_state(struct demux_internal *in,
|
||||
struct demux_stream *ds)
|
||||
{
|
||||
|
||||
@@ -331,6 +331,8 @@ void demux_drive_nav(struct demuxer *demuxer);
|
||||
void demux_nav_refresh(struct demuxer *demuxer);
|
||||
void demux_set_stream_still_image(struct demuxer *demuxer,
|
||||
struct sh_stream *sh, bool still_image);
|
||||
void demux_set_stream_absent(struct demuxer *demuxer, struct sh_stream *sh,
|
||||
bool absent);
|
||||
|
||||
bool demux_cancel_test(struct demuxer *demuxer);
|
||||
bool demux_read_interrupted(struct demuxer *demuxer);
|
||||
|
||||
@@ -68,6 +68,7 @@ struct sh_stream {
|
||||
bool commentary_track; // container flag
|
||||
bool image; // video stream is an image
|
||||
bool still_image; // video consists of multiple sparse still images
|
||||
bool absent; // the media provides no data for this stream
|
||||
int hls_bitrate;
|
||||
int *program_ids;
|
||||
int num_program_ids;
|
||||
|
||||
Reference in new issue
Block a user