[FFmpeg-cvslog] fftools/ffmpeg_filter: pass autoscale through OutputFilterOptions

Anton Khirnov git at videolan.org
Tue Apr 9 11:54:44 EEST 2024


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Tue Apr  2 13:58:59 2024 +0200| [83304f7c1f26ef12880115ad9b0c82b399759a46] | committer: Anton Khirnov

fftools/ffmpeg_filter: pass autoscale through OutputFilterOptions

Do not read it from OutputStream directly.

Will allow decoupling filtering from encoding in future commits.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=83304f7c1f26ef12880115ad9b0c82b399759a46
---

 fftools/ffmpeg.h          | 2 +-
 fftools/ffmpeg_filter.c   | 2 +-
 fftools/ffmpeg_mux_init.c | 7 ++++---
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index c61a670103..4059b1dcc3 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -267,6 +267,7 @@ enum OFilterFlags {
     OFILTER_FLAG_DISABLE_CONVERT    = (1 << 0),
     // produce 24-bit audio
     OFILTER_FLAG_AUDIO_24BIT        = (1 << 1),
+    OFILTER_FLAG_AUTOSCALE          = (1 << 2),
 };
 
 typedef struct OutputFilterOptions {
@@ -565,7 +566,6 @@ typedef struct OutputStream {
 #if FFMPEG_OPT_TOP
     int top_field_first;
 #endif
-    int autoscale;
     int bitexact;
     int bits_per_raw_sample;
 
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index 8aa4053716..dc9556bbc1 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -1366,7 +1366,7 @@ static int configure_output_video_filter(FilterGraph *fg, AVFilterGraph *graph,
     if (ret < 0)
         return ret;
 
-    if ((ofp->width || ofp->height) && ofilter->ost->autoscale) {
+    if ((ofp->width || ofp->height) && (ofp->flags & OFILTER_FLAG_AUTOSCALE)) {
         char args[255];
         AVFilterContext *filter;
         const AVDictionaryEntry *e = NULL;
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index 8f4b73f8a7..51c31eeb72 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -1045,7 +1045,7 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type,
     OutputStream *ost;
     const AVCodec *enc;
     AVStream *st;
-    int ret = 0, keep_pix_fmt = 0;
+    int ret = 0, keep_pix_fmt = 0, autoscale = 1;
     AVRational enc_tb = { 0, 0 };
     enum VideoSyncMethod vsync_method = VSYNC_AUTO;
     const char *bsfs = NULL, *time_base = NULL;
@@ -1170,8 +1170,8 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type,
             return ret;
 
         MATCH_PER_STREAM_OPT(presets, str, preset, oc, st);
-        ost->autoscale = 1;
-        MATCH_PER_STREAM_OPT(autoscale, i, ost->autoscale, oc, st);
+
+        MATCH_PER_STREAM_OPT(autoscale, i, autoscale, oc, st);
         if (preset && (!(ret = get_preset_file_2(preset, enc->codec->name, &s)))) {
             AVBPrint bprint;
             av_bprint_init(&bprint, 0, AV_BPRINT_SIZE_UNLIMITED);
@@ -1392,6 +1392,7 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type,
             .ts_offset = mux->of.start_time == AV_NOPTS_VALUE ?
                          0 : mux->of.start_time,
             .flags = OFILTER_FLAG_DISABLE_CONVERT * !!keep_pix_fmt |
+                     OFILTER_FLAG_AUTOSCALE       * !!autoscale    |
                      OFILTER_FLAG_AUDIO_24BIT * !!(av_get_exact_bits_per_sample(ost->enc_ctx->codec_id) == 24),
         };
 



More information about the ffmpeg-cvslog mailing list