History

fftools/ffmpeg_filter: pass enc_timebase through OutputFilterOptions

Reduces the need to access OutputStream, which will allow decoupling filtering from encoding in future commits.

Anton Khirnov committed 2 years ago

Commit 9d5bf2d1 parent 606c71b3 files · +9 −4Browse files

Unified · Split

3 files
  1. fftools/ffmpeg.h +5 −2
  2. fftools/ffmpeg_filter.c +1 −1
  3. fftools/ffmpeg_mux_init.c +3 −1
fftools/ffmpeg.h+5−2
@@ -273,6 +273,11 @@ typedef struct OutputFilterOptions { · 272 unmodified lines
273273
274274 int64_t ts_offset;
275275
276+ /* Desired output timebase.
277+ * Numerator can be one of EncTimeBase values, or 0 when no preference.
278+ */
279+ AVRational output_tb;
280+
276281 // A combination of OFilterFlags.
277282 unsigned flags;
278283 } OutputFilterOptions;
@@ -529,8 +534,6 @@ typedef struct OutputStream { · 250 unmodified lines
529534
530535 AVStream *st; /* stream in the output file */
531536
532− AVRational enc_timebase;
533−
534537 Encoder *enc;
535538 AVCodecContext *enc_ctx;
536539
fftools/ffmpeg_filter.c+1−1
@@ -780,7 +780,7 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost, · 779 unmodified lines
780780
781781 ofp->flags = opts->flags;
782782 ofp->ts_offset = opts->ts_offset;
783− ofp->enc_timebase = ost->enc_timebase;
783+ ofp->enc_timebase = opts->output_tb;
784784
785785 switch (ost->enc_ctx->codec_type) {
786786 case AVMEDIA_TYPE_VIDEO:
fftools/ffmpeg_mux_init.c+3−1
@@ -1042,6 +1042,7 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, · 1041 unmodified lines
10421042 const AVCodec *enc;
10431043 AVStream *st;
10441044 int ret = 0, keep_pix_fmt = 0;
1045+ AVRational enc_tb = { 0, 0 };
10451046 const char *bsfs = NULL, *time_base = NULL;
10461047 char *filters = NULL, *next, *codec_tag = NULL;
10471048 double qscale = -1;
@@ -1260,7 +1261,7 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, · 212 unmodified lines
12601261 #endif
12611262 }
12621263
1263− ost->enc_timebase = q;
1264+ enc_tb = q;
12641265 }
12651266 } else {
12661267 ret = filter_codec_opts(o->g->codec_opts, AV_CODEC_ID_NONE, oc, st,
@@ -1377,6 +1378,7 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, · 110 unmodified lines
13771378 (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)) {
13781379 OutputFilterOptions opts = {
13791380 .enc = enc,
1381+ .output_tb = enc_tb,
13801382 .ts_offset = mux->of.start_time == AV_NOPTS_VALUE ?
13811383 0 : mux->of.start_time,
13821384 .flags = OFILTER_FLAG_DISABLE_CONVERT * !!keep_pix_fmt,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t