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
273 273
274 int64_t ts_offset;274 int64_t ts_offset;
275 275
276 /* Desired output timebase.
277 * Numerator can be one of EncTimeBase values, or 0 when no preference.
278 */
279 AVRational output_tb;
280
276 // A combination of OFilterFlags.281 // A combination of OFilterFlags.
277 unsigned flags;282 unsigned flags;
278} OutputFilterOptions;283} OutputFilterOptions;
@@ -529,8 +534,6 @@ typedef struct OutputStream { · 250 unmodified lines
529 534
530 AVStream *st; /* stream in the output file */535 AVStream *st; /* stream in the output file */
531 536
532 AVRational enc_timebase;
533
534 Encoder *enc;537 Encoder *enc;
535 AVCodecContext *enc_ctx;538 AVCodecContext *enc_ctx;
536 539
fftools/ffmpeg_filter.c+1−1
@@ -780,7 +780,7 @@ int ofilter_bind_ost(OutputFilter *ofilter, OutputStream *ost, · 779 unmodified lines
780 780
781 ofp->flags = opts->flags;781 ofp->flags = opts->flags;
782 ofp->ts_offset = opts->ts_offset;782 ofp->ts_offset = opts->ts_offset;
783 ofp->enc_timebase = ost->enc_timebase;783 ofp->enc_timebase = opts->output_tb;
784 784
785 switch (ost->enc_ctx->codec_type) {785 switch (ost->enc_ctx->codec_type) {
786 case AVMEDIA_TYPE_VIDEO:786 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
1042 const AVCodec *enc;1042 const AVCodec *enc;
1043 AVStream *st;1043 AVStream *st;
1044 int ret = 0, keep_pix_fmt = 0;1044 int ret = 0, keep_pix_fmt = 0;
1045 AVRational enc_tb = { 0, 0 };
1045 const char *bsfs = NULL, *time_base = NULL;1046 const char *bsfs = NULL, *time_base = NULL;
1046 char *filters = NULL, *next, *codec_tag = NULL;1047 char *filters = NULL, *next, *codec_tag = NULL;
1047 double qscale = -1;1048 double qscale = -1;
@@ -1260,7 +1261,7 @@ static int ost_add(Muxer *mux, const OptionsContext *o, enum AVMediaType type, · 212 unmodified lines
1260#endif1261#endif
1261 }1262 }
1262 1263
1263 ost->enc_timebase = q;1264 enc_tb = q;
1264 }1265 }
1265 } else {1266 } else {
1266 ret = filter_codec_opts(o->g->codec_opts, AV_CODEC_ID_NONE, oc, st,1267 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
1377 (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)) {1378 (type == AVMEDIA_TYPE_VIDEO || type == AVMEDIA_TYPE_AUDIO)) {
1378 OutputFilterOptions opts = {1379 OutputFilterOptions opts = {
1379 .enc = enc,1380 .enc = enc,
1381 .output_tb = enc_tb,
1380 .ts_offset = mux->of.start_time == AV_NOPTS_VALUE ?1382 .ts_offset = mux->of.start_time == AV_NOPTS_VALUE ?
1381 0 : mux->of.start_time,1383 0 : mux->of.start_time,
1382 .flags = OFILTER_FLAG_DISABLE_CONVERT * !!keep_pix_fmt,1384 .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