[FFmpeg-devel] [PATCH] Include field_mode information in NUT stream info
Michael Niedermayer
michael at niedermayer.cc
Mon Mar 10 22:18:46 EET 2025
Hi
On Mon, Mar 10, 2025 at 05:44:22PM +0100, Anders Rein wrote:
> This will make it possible to transmit raw video over NUT without losing
> the field order information.
[...]
> diff --git a/libavformat/nutenc.c b/libavformat/nutenc.c
> index 55efb114c3..abe4e3fb98 100644
> --- a/libavformat/nutenc.c
> +++ b/libavformat/nutenc.c
> @@ -21,6 +21,7 @@
>
> #include <stdint.h>
>
> +#include "libavcodec/defs.h"
> #include "libavutil/intreadwrite.h"
> #include "libavutil/mathematics.h"
> #include "libavutil/mem.h"
> @@ -560,12 +561,22 @@ static int write_streaminfo(NUTContext *nut, AVIOContext *bc, int stream_id) {
> count += add_info(dyn_bc, "Disposition", ff_nut_dispositions[i].str);
> }
> if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
> + const char* field_order;
> uint8_t buf[256];
> if (st->r_frame_rate.num>0 && st->r_frame_rate.den>0)
> snprintf(buf, sizeof(buf), "%d/%d", st->r_frame_rate.num, st->r_frame_rate.den);
> 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);
> +
> + // Since the NUT specifications (nut.txt) do not support field order information,
> + // the stream_info side channel is used as a means to transfer this information.
> + // This is strictly not a part of the NUT specifications and should not be required.
> + field_order = ff_nut_serialized_field_order_value_or_null(st->codecpar->field_order);
> + if (field_order != NULL) {
> + count += add_info(dyn_bc, "field_order", field_order);
> + }
either send a patch to nut.txt or it should be "X-field_order" for non
standard fields
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250310/6d856613/attachment.sig>
More information about the ffmpeg-devel
mailing list