diff options
author | Anton Khirnov <anton@khirnov.net> | 2024-04-02 13:58:59 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2024-04-09 10:34:18 +0200 |
commit | 83304f7c1f26ef12880115ad9b0c82b399759a46 (patch) | |
tree | 843fb11680ff818392511deba71f1ea1b3876169 | |
parent | b8e6802023a5e687c40b6565745a225f8e069657 (diff) | |
download | ffmpeg-83304f7c1f26ef12880115ad9b0c82b399759a46.tar.gz |
fftools/ffmpeg_filter: pass autoscale through OutputFilterOptions
Do not read it from OutputStream directly.
Will allow decoupling filtering from encoding in future commits.
-rw-r--r-- | fftools/ffmpeg.h | 2 | ||||
-rw-r--r-- | fftools/ffmpeg_filter.c | 2 | ||||
-rw-r--r-- | 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), }; |