ffmpeg | branch: master | Anton Khirnov <an...@khirnov.net> | Tue Feb 13 12:18:27 2024 +0100| [fef3052df3166c477f4ab5311f4ee2e18d0296de] | committer: Anton Khirnov
fftools/ffmpeg_filter: pass autorotate/reinit flags through InputFilterOptions Rather than read them directly from InputStream. This is a step towards avoiding the assumption that filtergraph inputs are always fed by demuxers. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fef3052df3166c477f4ab5311f4ee2e18d0296de --- fftools/ffmpeg.h | 10 ++++++++-- fftools/ffmpeg_demux.c | 8 ++++++-- fftools/ffmpeg_filter.c | 5 +++-- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 7d31291d5f..b4cba521f6 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -250,6 +250,11 @@ typedef struct OptionsContext { SpecifierOptList mux_stats_fmt; } OptionsContext; +enum IFilterFlags { + IFILTER_FLAG_AUTOROTATE = (1 << 0), + IFILTER_FLAG_REINIT = (1 << 1), +}; + typedef struct InputFilterOptions { int64_t trim_start_us; int64_t trim_end_us; @@ -258,6 +263,9 @@ typedef struct InputFilterOptions { int sub2video_width; int sub2video_height; + + // a combination of IFILTER_FLAG_* + unsigned flags; } InputFilterOptions; typedef struct InputFilter { @@ -381,8 +389,6 @@ typedef struct InputStream { */ struct OutputStream **outputs; int nb_outputs; - - int reinit_filters; } InputStream; typedef struct InputFile { diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 87ed8225c2..317e27e294 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -63,6 +63,7 @@ typedef struct DemuxStream { int streamcopy_needed; int have_sub2video; + int reinit_filters; int wrap_correction_done; int saw_first_ts; @@ -1033,6 +1034,9 @@ int ist_filter_add(InputStream *ist, InputFilter *ifilter, int is_simple, if (!opts->name) return AVERROR(ENOMEM); + opts->flags |= IFILTER_FLAG_AUTOROTATE * !!(ist->autorotate) | + IFILTER_FLAG_REINIT * !!(ds->reinit_filters); + return ds->sch_idx_dec; } @@ -1309,8 +1313,8 @@ static int ist_add(const OptionsContext *o, Demuxer *d, AVStream *st) if (ret < 0) return ret; - ist->reinit_filters = -1; - MATCH_PER_STREAM_OPT(reinit_filters, i, ist->reinit_filters, ic, st); + ds->reinit_filters = -1; + MATCH_PER_STREAM_OPT(reinit_filters, i, ds->reinit_filters, ic, st); ist->user_set_discard = AVDISCARD_NONE; diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index d182f3ab2e..56aa3edd78 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -1534,7 +1534,8 @@ static int configure_input_video_filter(FilterGraph *fg, AVFilterGraph *graph, av_assert0(desc); // TODO: insert hwaccel enabled filters like transpose_vaapi into the graph - if (ist->autorotate && !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) { + if ((ifp->opts.flags & IFILTER_FLAG_AUTOROTATE) && + !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) { int32_t *displaymatrix = ifp->displaymatrix; double theta; @@ -2614,7 +2615,7 @@ static int send_frame(FilterGraph *fg, FilterGraphThread *fgt, } else if (ifp->displaymatrix_present) need_reinit |= MATRIX_CHANGED; - if (!ifp->ist->reinit_filters && fgt->graph) + if (!(ifp->opts.flags & IFILTER_FLAG_REINIT) && fgt->graph) need_reinit = 0; if (!!ifp->hw_frames_ctx != !!frame->hw_frames_ctx || _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".