[FFmpeg-cvslog] fftools/ffmpeg_filter: pass ts offset through OutputFilterOptions
Anton Khirnov
git at videolan.org
Tue Apr 9 11:54:14 EEST 2024
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Mon Apr 1 06:29:16 2024 +0200| [b3864e7a080d5716d6a6d8dd8e327ed6c6dd2d2f] | committer: Anton Khirnov
fftools/ffmpeg_filter: pass ts offset through OutputFilterOptions
Reduces the need to access OutputFile, which will allow decoupling
filtering from encoding in future commits.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b3864e7a080d5716d6a6d8dd8e327ed6c6dd2d2f
---
fftools/ffmpeg.h | 2 ++
fftools/ffmpeg_filter.c | 3 +--
fftools/ffmpeg_mux_init.c | 2 ++
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 8455cb23e4..7288a48aa1 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -266,6 +266,8 @@ typedef struct InputFilterOptions {
typedef struct OutputFilterOptions {
// Codec used for encoding, may be NULL
const AVCodec *enc;
+
+ int64_t ts_offset;
} OutputFilterOptions;
typedef struct InputFilter {
diff --git a/fftools/ffmpeg_filter.c b/fftools/ffmpeg_filter.c
index a59c61b312..8b05262622 100644
--- a/fftools/ffmpeg_filter.c
+++ b/fftools/ffmpeg_filter.c
@@ -766,7 +766,6 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost,
unsigned sched_idx_enc,
const OutputFilterOptions *opts)
{
- const OutputFile *of = ost->file;
OutputFilterPriv *ofp = ofp_from_ofilter(ofilter);
FilterGraph *fg = ofilter->graph;
FilterGraphPriv *fgp = fgp_from_fg(fg);
@@ -778,7 +777,7 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost,
ofilter->ost = ost;
av_freep(&ofilter->linklabel);
- ofp->ts_offset = of->start_time == AV_NOPTS_VALUE ? 0 : of->start_time;
+ ofp->ts_offset = opts->ts_offset;
ofp->enc_timebase = ost->enc_timebase;
switch (ost->enc_ctx->codec_type) {
diff --git a/fftools/ffmpeg_mux_init.c b/fftools/ffmpeg_mux_init.c
index b5869feb80..83eab4276e 100644
--- a/fftools/ffmpeg_mux_init.c
+++ b/fftools/ffmpeg_mux_init.c
@@ -1373,6 +1373,8 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type,
(type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)) {
OutputFilterOptions opts = {
.enc = enc,
+ .ts_offset = mux->of.start_time == AV_NOPTS_VALUE ?
+ 0 : mux->of.start_time,
};
if (ofilter) {
More information about the ffmpeg-cvslog
mailing list