[FFmpeg-devel] [PATCH] Include field_mode information in NUT stream info

Anders Rein anders at onemimir.com
Sat Mar 8 23:00:34 EET 2025


This will make it possible to transmit raw video over NUT without losing
the field order information.
---
 libavformat/nutdec.c | 4 ++++
 libavformat/nutenc.c | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 34b7e3cb9a..07eff23134 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -607,6 +607,10 @@ static int decode_info_header(NUTContext *nut)
                 continue;
             }
 
+            if (stream_id_plus1 && !strcmp(name, "field_order")) {
+              sscanf(str_value, "%d", &st->codecpar->field_order);
+            }
+
             if (metadata && av_strcasecmp(name, "Uses") &&
                 av_strcasecmp(name, "Depends") && av_strcasecmp(name, "Replaces")) {
                 if (event_flags)
diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
index 55efb114c3..0853fecf5c 100644
--- a/libavformat/nutenc.c
+++ b/libavformat/nutenc.c
@@ -566,6 +566,9 @@ static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id) {
         else
             snprintf(buf, sizeof(buf), "%d/%d", st->avg_frame_rate.num, st->avg_frame_rate.den);
         count += add_info(dyn_bc, "r_frame_rate", buf);
+
+        snprintf(buf, sizeof(buf), "%d", st->codecpar->field_order);
+        count += add_info(dyn_bc, "field_order", buf);
     }
     dyn_size = avio_close_dyn_buf(dyn_bc, &dyn_buf);
 
-- 
2.48.1


-- 
Disclaimer: This email and any files transmitted with it are confidential 
and intended solely for the use of the individual or entity to whom they 
are addressed. If you have received this email in error or are not the 
named addressee, you should not disseminate, distribute or copy this email. 
Please notify the author by replying to this e-mail and destroy this email 
and any attachments.


More information about the ffmpeg-devel mailing list