fftools/ffmpeg_filter: pass enc_timebase through OutputFilterOptions

Reduces the need to access OutputStream, which will allow decoupling
filtering from encoding in future commits.
release/7.1
Anton Khirnov 8 months ago
parent 606c71bb11
commit 9d5bf2d69e
  1. 7
      fftools/ffmpeg.h
  2. 2
      fftools/ffmpeg_filter.c
  3. 4
      fftools/ffmpeg_mux_init.c

@ -273,6 +273,11 @@ typedef struct OutputFilterOptions {
int64_t ts_offset;
/* Desired output timebase.
* Numerator can be one of EncTimeBase values, or 0 when no preference.
*/
AVRational output_tb;
// A combination of OFilterFlags.
unsigned flags;
} OutputFilterOptions;
@ -529,8 +534,6 @@ typedef struct OutputStream {
AVStream *st; /* stream in the output file */
AVRational enc_timebase;
Encoder *enc;
AVCodecContext *enc_ctx;

@ -780,7 +780,7 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost,
ofp->flags = opts->flags;
ofp->ts_offset = opts->ts_offset;
ofp->enc_timebase = ost->enc_timebase;
ofp->enc_timebase = opts->output_tb;
switch (ost->enc_ctx->codec_type) {
case AVMEDIA_TYPE_VIDEO:

@ -1042,6 +1042,7 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type,
const AVCodec *enc;
AVStream *st;
int ret = 0, keep_pix_fmt = 0;
AVRational enc_tb = { 0, 0 };
const char *bsfs = NULL, *time_base = NULL;
char *filters = NULL, *next, *codec_tag = NULL;
double qscale = -1;
@ -1260,7 +1261,7 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type,
#endif
}
ost->enc_timebase = q;
enc_tb = q;
}
} else {
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,
(type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)) {
OutputFilterOptions opts = {
.enc = enc,
.output_tb = enc_tb,
.ts_offset = mux->of.start_time == AV_NOPTS_VALUE ?
0 : mux->of.start_time,
.flags = OFILTER_FLAG_DISABLE_CONVERT * !!keep_pix_fmt,

Loading…
Cancel
Save