fftools/ffmpeg_dec: move flags to DecoderOpts

Will be useful in the following commit.
This commit is contained in:
Anton Khirnov 2024-01-23 18:28:57 +01:00
parent 4bdffec814
commit e0a6cb07b2
3 changed files with 9 additions and 6 deletions

View File

@ -287,6 +287,8 @@ enum DecoderFlags {
}; };
typedef struct DecoderOpts { typedef struct DecoderOpts {
int flags;
/* hwaccel options */ /* hwaccel options */
enum HWAccelID hwaccel_id; enum HWAccelID hwaccel_id;
enum AVHWDeviceType hwaccel_device_type; enum AVHWDeviceType hwaccel_device_type;
@ -738,7 +740,7 @@ AVBufferRef *hw_device_for_filter(void);
* is transferred to the decoder. * is transferred to the decoder.
*/ */
int dec_open(InputStream *ist, Scheduler *sch, unsigned sch_idx, int dec_open(InputStream *ist, Scheduler *sch, unsigned sch_idx,
AVDictionary **dec_opts, int flags, const DecoderOpts *o); AVDictionary **dec_opts, const DecoderOpts *o);
void dec_free(Decoder **pdec); void dec_free(Decoder **pdec);
int dec_add_filter(Decoder *dec, InputFilter *ifilter); int dec_add_filter(Decoder *dec, InputFilter *ifilter);

View File

@ -943,7 +943,7 @@ static const AVClass dec_class = {
}; };
int dec_open(InputStream *ist, Scheduler *sch, unsigned sch_idx, int dec_open(InputStream *ist, Scheduler *sch, unsigned sch_idx,
AVDictionary **dec_opts, int flags, const DecoderOpts *o) AVDictionary **dec_opts, const DecoderOpts *o)
{ {
DecoderPriv *dp; DecoderPriv *dp;
const AVCodec *codec = ist->dec; const AVCodec *codec = ist->dec;
@ -957,7 +957,7 @@ int dec_open(InputStream *ist, Scheduler *sch, unsigned sch_idx,
dp->sch = sch; dp->sch = sch;
dp->sch_idx = sch_idx; dp->sch_idx = sch_idx;
dp->flags = flags; dp->flags = o->flags;
dp->dec.class = &dec_class; dp->dec.class = &dec_class;
dp->log_parent = ist; dp->log_parent = ist;

View File

@ -893,8 +893,6 @@ static int ist_use(InputStream *ist, int decoding_needed)
if (decoding_needed && ds->sch_idx_dec < 0) { if (decoding_needed && ds->sch_idx_dec < 0) {
int is_audio = ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO; int is_audio = ist->st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO;
int dec_flags = (!!ist->fix_sub_duration * DECODER_FLAG_FIX_SUB_DURATION) |
(!!(d->f.ctx->iformat->flags & AVFMT_NOTIMESTAMPS) * DECODER_FLAG_TS_UNRELIABLE);
ret = sch_add_dec(d->sch, decoder_thread, ist, d->loop && is_audio); ret = sch_add_dec(d->sch, decoder_thread, ist, d->loop && is_audio);
if (ret < 0) if (ret < 0)
@ -906,8 +904,11 @@ static int ist_use(InputStream *ist, int decoding_needed)
if (ret < 0) if (ret < 0)
return ret; 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);
ret = dec_open(ist, d->sch, ds->sch_idx_dec, ret = dec_open(ist, d->sch, ds->sch_idx_dec,
&ist->decoder_opts, dec_flags, &ds->dec_opts); &ist->decoder_opts, &ds->dec_opts);
if (ret < 0) if (ret < 0)
return ret; return ret;