demux: allow demuxers to update still_image during demuxing

Whether a DVD title's video track consists of sparse still images (a
slideshow) is only observable from the packet timestamps after
streaming started, and demux_disc wants to flip sh->still_image
accordingly, so that the stream stops being read eagerly.
This commit is contained in:
Kacper Michajłow committed 2026-08-26 01:47:41 +02:00
1 parent a2448f3b81
commit 34c649b864
2 files changed
+24 -8

No files matched your search

+22 -8
View File
@@ -891,15 +891,8 @@ static void wakeup_ds(struct demux_stream *ds)
}
}
static void update_stream_selection_state(struct demux_internal *in,
struct demux_stream *ds)
static void update_stream_eager_state(struct demux_internal *in)
{
ds->eof = false;
ds->refreshing = false;
// We still have to go over the whole stream list to update ds->eager for
// other streams too, because they depend on other stream's selections.
bool any_av_streams = false;
bool any_streams = false;
@@ -926,6 +919,27 @@ static void update_stream_selection_state(struct demux_internal *in,
if (!any_streams)
in->blocked = false;
}
void demux_set_stream_still_image(demuxer_t *demuxer, struct sh_stream *sh,
bool still_image)
{
struct demux_internal *in = demuxer->in;
mp_assert(demuxer == in->d_thread);
mp_mutex_lock(&in->lock);
sh->still_image = still_image;
update_stream_eager_state(in);
mp_mutex_unlock(&in->lock);
}
static void update_stream_selection_state(struct demux_internal *in,
struct demux_stream *ds)
{
ds->eof = false;
ds->refreshing = false;
update_stream_eager_state(in);
ds_clear_reader_state(ds, true);
+2
View File
@@ -329,6 +329,8 @@ void demux_set_wakeup_cb(struct demuxer *demuxer, void (*cb)(void *ctx), void *c
void demux_start_prefetch(struct demuxer *demuxer);
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);
bool demux_cancel_test(struct demuxer *demuxer);
bool demux_read_interrupted(struct demuxer *demuxer);