* [FFmpeg-devel] [PATCH] Include field_mode information in NUT stream info
@ 2025-03-08 21:00 Anders Rein
2025-03-09 18:08 ` Michael Niedermayer
0 siblings, 1 reply; 2+ messages in thread
From: Anders Rein @ 2025-03-08 21:00 UTC (permalink / raw)
To: ffmpeg-devel; +Cc: Anders Rein
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.
_______________________________________________
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".
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [FFmpeg-devel] [PATCH] Include field_mode information in NUT stream info
2025-03-08 21:00 [FFmpeg-devel] [PATCH] Include field_mode information in NUT stream info Anders Rein
@ 2025-03-09 18:08 ` Michael Niedermayer
0 siblings, 0 replies; 2+ messages in thread
From: Michael Niedermayer @ 2025-03-09 18:08 UTC (permalink / raw)
To: FFmpeg development discussions and patches
[-- Attachment #1.1: Type: text/plain, Size: 2531 bytes --]
Hi Anders
On Sat, Mar 08, 2025 at 10:00:34PM +0100, Anders Rein wrote:
> 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);
> + }
> +
indention is inconsistant, data is not checkecked for validity
> 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);
a numeric field order is not well defined. Also if you place this in
streaminfo. Please explain what shall be done if it changes
and it would need an update to fate tests (which break)
--- ./tests/ref/fate/ffmpeg-loopback-decoding 2025-03-03 01:18:34.299595988 +0100
+++ tests/data/fate/ffmpeg-loopback-decoding 2025-03-09 18:59:36.248837197 +0100
@@ -1,5 +1,5 @@
-e4e0e27eb8ed99eedc2458d92401c5e4 *tests/data/fate/ffmpeg-loopback-decoding.nut
-7435259 tests/data/fate/ffmpeg-loopback-decoding.nut
+460c64b2deef77f80c3afe6135c0a464 *tests/data/fate/ffmpeg-loopback-decoding.nut
+7435274 tests/data/fate/ffmpeg-loopback-decoding.nut
#tb 0: 1/25
#media_type 0: video
#codec_id 0: rawvideo
and update to nut.txt (which lists no field_order IIRC)
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I have often repented speaking, but never of holding my tongue.
-- Xenocrates
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
[-- Attachment #2: Type: text/plain, Size: 251 bytes --]
_______________________________________________
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".
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-03-09 18:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-08 21:00 [FFmpeg-devel] [PATCH] Include field_mode information in NUT stream info Anders Rein
2025-03-09 18:08 ` Michael Niedermayer
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