On 12/16/2024 5:54 PM, Scott Theisen wrote:
On 12/16/24 15:25, James Almer wrote:
On 12/16/2024 5:05 PM, Scott Theisen wrote:
On 12/15/24 22:25, James Almer wrote:
On 12/15/2024 1:14 AM, Scott Theisen wrote:
Originally from:
https://github.com/MythTV/mythtv/ commit/669955c6cb29196b4b5120451b5b998d67a65749
---
  libavcodec/v4l2_buffers.c | 38 ++++++++++++++++++++++++++++++++++ ++++
  1 file changed, 38 insertions(+)

diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
index 23474ee143..56a8f0825c 100644
--- a/libavcodec/v4l2_buffers.c
+++ b/libavcodec/v4l2_buffers.c
@@ -210,6 +210,43 @@ static enum AVColorTransferCharacteristic v4l2_get_color_trc(V4L2Buffer *buf)
      return AVCOL_TRC_UNSPECIFIED;
  }
  +static void v4l2_get_interlacing(AVFrame *frame, V4L2Buffer *buf)
+{
+    enum v4l2_field field;
+    field = V4L2_TYPE_IS_MULTIPLANAR(buf->buf.type) ?
+        buf->context->format.fmt.pix_mp.field :
+        buf->context->format.fmt.pix.field;
+
+    if (field == V4L2_FIELD_INTERLACED || field == V4L2_FIELD_INTERLACED_TB) {
+        frame->flags |=  AV_FRAME_FLAG_INTERLACED;
+        frame->flags |=  AV_FRAME_FLAG_TOP_FIELD_FIRST;
+#if FF_API_INTERLACED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+        frame->interlaced_frame = 1;
+        frame->top_field_first  = 1;

No need to set these two fields. It's done by the generic code.


OK, I'll remove those lines.  Although it is not clear to me when those will be set after libavcodec/pthread_frame.c calls ff_decode_receive_frame_internal().

They are set in decode_receive_frame_internal(), libavcodec/decode.c, not too long before the frame is ultimately returned to the caller.

I saw that decode_receive_frame_internal() calls ff_decode_receive_frame_internal() and then sets the flags, but ff_decode_receive_frame_internal() is called directly in libavcodec/ pthread_frame.c.

It is not clear to me what calls decode_receive_frame_internal() to set the flags after the call to ff_decode_receive_frame_internal() in libavcodec/pthread_frame.c.  However, if it is called at some point to set the flags and it works, it works, so it is not really that important, just that is was not obvious to me when it would be called.

It's a bit convoluted, but the contexts that are processed in pthread_frame.c are workers and internal. All those frames are in the end passed to the main thread and returned to the caller, a process that will go through decode_receive_frame_internal().

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

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

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

Reply via email to