Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: James Almer <jamrial@gmail.com>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 4/5] fftools: use the new AVFrame interlace flags
Date: Wed, 12 Apr 2023 16:49:35 -0300
Message-ID: <20230412194936.48022-4-jamrial@gmail.com> (raw)
In-Reply-To: <20230412194936.48022-1-jamrial@gmail.com>

Signed-off-by: James Almer <jamrial@gmail.com>
---
 fftools/ffmpeg.c     |  2 +-
 fftools/ffmpeg_enc.c | 11 +++++++----
 fftools/ffprobe.c    |  4 ++--
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 750ab76693..3b271e8f59 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1502,7 +1502,7 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_
         return ret;
 
     if(ist->top_field_first>=0)
-        decoded_frame->top_field_first = ist->top_field_first;
+        decoded_frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
 
     ist->frames_decoded++;
 
diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
index 2f1803a74c..969aa0d019 100644
--- a/fftools/ffmpeg_enc.c
+++ b/fftools/ffmpeg_enc.c
@@ -238,13 +238,16 @@ int enc_open(OutputStream *ost, AVFrame *frame)
         if (frame) {
             if (enc_ctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT | AV_CODEC_FLAG_INTERLACED_ME) &&
                 ost->top_field_first >= 0)
-                frame->top_field_first = !!ost->top_field_first;
+                if (ost->top_field_first)
+                    frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
+                else
+                    frame->flags &= ~AV_FRAME_FLAG_TOP_FIELD_FIRST;
 
-            if (frame->interlaced_frame) {
+            if (frame->flags & AV_FRAME_FLAG_INTERLACED) {
                 if (enc->id == AV_CODEC_ID_MJPEG)
-                    enc_ctx->field_order = frame->top_field_first ? AV_FIELD_TT:AV_FIELD_BB;
+                    enc_ctx->field_order = (frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST) ? AV_FIELD_TT:AV_FIELD_BB;
                 else
-                    enc_ctx->field_order = frame->top_field_first ? AV_FIELD_TB:AV_FIELD_BT;
+                    enc_ctx->field_order = (frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST) ? AV_FIELD_TB:AV_FIELD_BT;
             } else
                 enc_ctx->field_order = AV_FIELD_PROGRESSIVE;
         }
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index d6e5a79c7e..cb765bd95b 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2640,8 +2640,8 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream,
         print_int("display_picture_number", frame->display_picture_number);
     )
 #endif
-        print_int("interlaced_frame",       frame->interlaced_frame);
-        print_int("top_field_first",        frame->top_field_first);
+        print_int("interlaced_frame",       !!(frame->flags & AV_FRAME_FLAG_INTERLACED));
+        print_int("top_field_first",        !!(frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST));
         print_int("repeat_pict",            frame->repeat_pict);
 
         print_color_range(w, frame->color_range);
-- 
2.40.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2023-04-12 19:50 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12 19:49 [FFmpeg-devel] [PATCH 1/5] avutil/frame: add new interlaced and top_field_first flags James Almer
2023-04-12 19:49 ` [FFmpeg-devel] [PATCH 2/5] avcodec: use the new AVFrame interlace flags in all decoders and encoders James Almer
2023-04-23 19:47   ` Anton Khirnov
2023-04-24 12:31     ` James Almer
2023-04-12 19:49 ` [FFmpeg-devel] [PATCH 3/5] avfilter: use the new AVFrame interlace flags in all filters James Almer
2023-04-12 19:49 ` James Almer [this message]
2023-04-12 19:49 ` [FFmpeg-devel] [PATCH 5/5] avutil/frame: deprecate interlaced_frame and top_field_first James Almer
2023-04-15 12:55 ` [FFmpeg-devel] [PATCH 1/5] avutil/frame: add new interlaced and top_field_first flags James Almer
2023-04-17 10:49 ` Anton Khirnov
2023-04-17 11:32   ` James Almer
2023-04-17 11:51     ` Anton Khirnov
2023-04-21 21:10       ` James Almer
2023-04-30  0:19 ` James Almer
2023-05-04 23:52   ` James Almer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230412194936.48022-4-jamrial@gmail.com \
    --to=jamrial@gmail.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git