summaryrefslogtreecommitdiff
path: root/fftools/ffmpeg_enc.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-09-14 17:07:29 +0200
committerAnton Khirnov <anton@khirnov.net>2023-09-18 17:16:06 +0200
commit5d58a35f983fa0ce028fad593697903aecae9adf (patch)
treefa03b51fa6257b4cdeb1fdc0afee78cd66064b55 /fftools/ffmpeg_enc.c
parent43a0004b5c23dd8258cfe723a5c4e9fd9ee8f5ef (diff)
fftools/ffmpeg: deprecate the -top option
It is badly named (should have been -top_field_first, or at least -tff), underdocumented and underspecified, and (most importantly) entirely redundant with the setfield filter.
Diffstat (limited to 'fftools/ffmpeg_enc.c')
-rw-r--r--fftools/ffmpeg_enc.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index 902ba3c37a..b40a6211a9 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -357,9 +357,17 @@ int enc_open(OutputStream *ost, AVFrame *frame)
enc_ctx->chroma_sample_location = frame->chroma_location;
if (enc_ctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT | AV_CODEC_FLAG_INTERLACED_ME) ||
- (frame->flags & AV_FRAME_FLAG_INTERLACED) || ost->top_field_first >= 0) {
- int top_field_first = ost->top_field_first >= 0 ?
- ost->top_field_first : !!(frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST);
+ (frame->flags & AV_FRAME_FLAG_INTERLACED)
+#if FFMPEG_OPT_TOP
+ || ost->top_field_first >= 0
+#endif
+ ) {
+ int top_field_first =
+#if FFMPEG_OPT_TOP
+ ost->top_field_first >= 0 ?
+ ost->top_field_first :
+#endif
+ !!(frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST);
if (enc->id == AV_CODEC_ID_MJPEG)
enc_ctx->field_order = top_field_first ? AV_FIELD_TT : AV_FIELD_BB;
@@ -1156,10 +1164,12 @@ static int do_video_out(OutputFile *of, OutputStream *ost, AVFrame *frame)
in_picture->quality = enc->global_quality;
in_picture->pict_type = forced_kf_apply(ost, &ost->kf, enc->time_base, in_picture, i);
+#if FFMPEG_OPT_TOP
if (ost->top_field_first >= 0) {
in_picture->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST;
in_picture->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST * (!!ost->top_field_first);
}
+#endif
ret = submit_encode_frame(of, ost, in_picture);
if (ret == AVERROR_EOF)