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 | a2892dbe06161452ec6592bcdddd0cbe8b0f6780 (patch) | |
tree | dde4fa7efaf9b2604194298ed85edf5c957decae /fftools/ffmpeg_filter.c | |
parent | 83304f7c1f26ef12880115ad9b0c82b399759a46 (diff) | |
download | ffmpeg-a2892dbe06161452ec6592bcdddd0cbe8b0f6780.tar.gz |
fftools/ffmpeg_filter: pass trim parameters through OutputFilterOptions
Do not read them from OutputStream directly.
Will allow decoupling filtering from encoding in future commits.
Diffstat (limited to 'fftools/ffmpeg_filter.c')
-rw-r--r-- | fftools/ffmpeg_filter.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c index dc9556bbc1..225fa4bda2 100644 --- a/fftools/ffmpeg_filter.c +++ b/fftools/ffmpeg_filter.c @@ -220,6 +220,8 @@ typedef struct OutputFilterPriv { const int *sample_rates; AVRational enc_timebase; + int64_t trim_start_us; + int64_t trim_duration_us; // offset for output timestamps, in AV_TIME_BASE_Q int64_t ts_offset; int64_t next_pts; @@ -812,6 +814,9 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost, ofp->ts_offset = opts->ts_offset; ofp->enc_timebase = opts->output_tb; + ofp->trim_start_us = opts->trim_start_us; + ofp->trim_duration_us = opts->trim_duration_us; + ofp->name = av_strdup(opts->name); if (!ofp->name) return AVERROR(EINVAL); @@ -1349,8 +1354,6 @@ static int configure_output_video_filter(FilterGraph *fg, AVFilterGraph *graph, OutputFilter *ofilter, AVFilterInOut *out) { OutputFilterPriv *ofp = ofp_from_ofilter(ofilter); - OutputStream *ost = ofilter->ost; - OutputFile *of = ost->file; AVFilterContext *last_filter = out->filter_ctx; AVBPrint bprint; int pad_idx = out->pad_idx; @@ -1411,7 +1414,7 @@ static int configure_output_video_filter(FilterGraph *fg, AVFilterGraph *graph, } snprintf(name, sizeof(name), "trim_out_%s", ofp->name); - ret = insert_trim(of->start_time, of->recording_time, + ret = insert_trim(ofp->trim_start_us, ofp->trim_duration_us, &last_filter, &pad_idx, name); if (ret < 0) return ret; @@ -1503,7 +1506,7 @@ static int configure_output_audio_filter(FilterGraph *fg, AVFilterGraph *graph, } snprintf(name, sizeof(name), "trim for output %s", ofp->name); - ret = insert_trim(of->start_time, of->recording_time, + ret = insert_trim(ofp->trim_start_us, ofp->trim_duration_us, &last_filter, &pad_idx, name); if (ret < 0) goto fail; |