From 0004af3e7191f728da3637f7c973ce277ec8c5d0 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 21 Oct 2017 20:35:03 +0200 Subject: demux: replace redundant field with a better redundant field --- demux/demux.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'demux') diff --git a/demux/demux.c b/demux/demux.c index aa68ce7e13..54d243c10f 100644 --- a/demux/demux.c +++ b/demux/demux.c @@ -184,6 +184,7 @@ struct demux_internal { struct demux_stream { struct demux_internal *in; + struct sh_stream *sh; enum stream_type type; // --- all fields are protected by in->lock @@ -216,8 +217,6 @@ struct demux_stream { struct demux_packet *reader_head; // points at current decoder position bool attached_picture_added; - struct demux_packet *attached_picture; - // for closed captions (demuxer_feed_caption) struct sh_stream *cc; bool ignore_eof; // ignore stream in underrun detection @@ -310,6 +309,7 @@ void demux_add_sh_stream(struct demuxer *demuxer, struct sh_stream *sh) sh->ds = talloc(sh, struct demux_stream); *sh->ds = (struct demux_stream) { .in = in, + .sh = sh, .type = sh->type, .selected = in->autoselect, }; @@ -317,8 +317,6 @@ void demux_add_sh_stream(struct demuxer *demuxer, struct sh_stream *sh) if (!sh->codec->codec) sh->codec->codec = ""; - sh->ds->attached_picture = sh->attached_picture; - sh->index = in->num_streams; if (sh->ff_index < 0) sh->ff_index = sh->index; @@ -891,12 +889,12 @@ static void *demux_thread(void *pctx) static struct demux_packet *dequeue_packet(struct demux_stream *ds) { - if (ds->attached_picture) { + if (ds->sh->attached_picture) { ds->eof = true; if (ds->attached_picture_added) return NULL; ds->attached_picture_added = true; - return demux_copy_packet(ds->attached_picture); + return demux_copy_packet(ds->sh->attached_picture); } if (!ds->reader_head) return NULL; @@ -957,7 +955,7 @@ static struct demux_packet *dequeue_packet(struct demux_stream *ds) // try to exceed default readahead in order to find a new packet. static bool use_lazy_packet_reading(struct demux_stream *ds) { - if (ds->attached_picture) + if (ds->sh->attached_picture) return true; if (ds->type != STREAM_SUB) return false; @@ -965,7 +963,8 @@ static bool use_lazy_packet_reading(struct demux_stream *ds) // stream. for (int n = 0; n < ds->in->num_streams; n++) { struct demux_stream *s = ds->in->streams[n]->ds; - if (s->type != STREAM_SUB && s->selected && !s->eof && !s->attached_picture) + if (s->type != STREAM_SUB && s->selected && !s->eof && ! + s->sh->attached_picture) return true; } return false; -- cgit v1.2.3