fftools/ffmpeg_dec: eliminate all remaining InputStream uses

Previously, the demuxer would register decoder with the scheduler, using
InputStream as opaque, and pass the scheduling index to the decoder.

Now the registration is done by the decoder itself, using DecoderPriv as
opaque, and the scheduling index is returned to demuxer from dec_open().

decoder_thread() then no longer needs to be accessed from outside of
ffmpeg_dec and can be made static.
This commit is contained in:
Anton Khirnov
2024-01-23 19:53:59 +01:00
parent fe3be6f78f
commit 0d00e2e2f7
3 changed files with 23 additions and 21 deletions

View File

@@ -895,18 +895,9 @@ static int ist_use(InputStream *ist, int decoding_needed)
if (decoding_needed && ds->sch_idx_dec < 0) {
int is_audio = ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO;
ret = sch_add_dec(d->sch, decoder_thread, ist, d->loop && is_audio);
if (ret < 0)
return ret;
ds->sch_idx_dec = ret;
ret = sch_connect(d->sch, SCH_DSTREAM(d->f.index, ds->sch_idx_stream),
SCH_DEC(ds->sch_idx_dec));
if (ret < 0)
return ret;
ds->dec_opts.flags = (!!ist->fix_sub_duration * DECODER_FLAG_FIX_SUB_DURATION) |
(!!(d->f.ctx->iformat->flags & AVFMT_NOTIMESTAMPS) * DECODER_FLAG_TS_UNRELIABLE)
(!!(d->f.ctx->iformat->flags & AVFMT_NOTIMESTAMPS) * DECODER_FLAG_TS_UNRELIABLE) |
(!!(d->loop && is_audio) * DECODER_FLAG_SEND_END_TS)
#if FFMPEG_OPT_TOP
| ((ist->top_field_first >= 0) * DECODER_FLAG_TOP_FIELD_FIRST)
#endif
@@ -935,10 +926,16 @@ static int ist_use(InputStream *ist, int decoding_needed)
ds->dec_opts.log_parent = ist;
ret = dec_open(&ist->decoder, d->sch, ds->sch_idx_dec,
ret = dec_open(&ist->decoder, d->sch,
&ist->decoder_opts, &ds->dec_opts);
if (ret < 0)
return ret;
ds->sch_idx_dec = ret;
ret = sch_connect(d->sch, SCH_DSTREAM(d->f.index, ds->sch_idx_stream),
SCH_DEC(ds->sch_idx_dec));
if (ret < 0)
return ret;
d->have_audio_dec |= is_audio;
}