commit 08f4e45b69c614d870eb13b4bff779a7fdc41472
Author: Mamoru TASAKA <mtasaka(a)fedoraproject.org>
Date: Tue Dec 31 16:54:38 2024 +0900
Port to ffmpeg 7
libndi-c14b40c-ffmpeg7.patch | 76 ++++++++++++++++++++++++++++++++++++++++++++
libndi.spec | 7 +++-
2 files changed, 82 insertions(+), 1 deletion(-)
---
diff --git a/libndi-c14b40c-ffmpeg7.patch b/libndi-c14b40c-ffmpeg7.patch
new file mode 100644
index 0000000..2ff5dcd
--- /dev/null
+++ b/libndi-c14b40c-ffmpeg7.patch
@@ -0,0 +1,76 @@
+diff --git a/libndi.c b/libndi.c
+index 1edecbf..d01e9f8 100644
+--- a/libndi.c
++++ b/libndi.c
+@@ -68,7 +68,7 @@ typedef struct ndi_message
+ struct ndi_ctx
+ {
+ /* buffers */
+- AVFifoBuffer *fifo;
++ AVFifo *fifo;
+
+ int target_size;
+
+@@ -378,7 +378,7 @@ static int handle_ndi_packet(ndi_ctx *ndi_ctx)
+ {
+ if(!ndi_ctx->target_size) {
+ uint8_t data[12];
+- av_fifo_generic_peek(ndi_ctx->fifo, data, 12, NULL); // fixme
++ av_fifo_peek(ndi_ctx->fifo, data, 0, 12); // fixme
+
+ /* MSB = scrambled bit */
+ uint16_t header_type = data[0] | (data[1] << 8);
+@@ -394,17 +394,17 @@ static int handle_ndi_packet(ndi_ctx *ndi_ctx)
+ }
+
+ //printf("target size %i \n", ndi_ctx->target_size);
+- if(av_fifo_space(ndi_ctx->fifo) < ndi_ctx->target_size)
+- av_fifo_grow(ndi_ctx->fifo, ndi_ctx->target_size * 3 / 2);
++ if(av_fifo_can_write(ndi_ctx->fifo) < ndi_ctx->target_size)
++ av_fifo_grow2(ndi_ctx->fifo, ndi_ctx->target_size * 3 / 2);
+ }
+
+- if(av_fifo_size(ndi_ctx->fifo) >= ndi_ctx->target_size) {
++ if(av_fifo_can_read(ndi_ctx->fifo) >= ndi_ctx->target_size) {
+ /* FIXME: make this zero copy */
+ uint8_t *data = malloc(ndi_ctx->target_size);
+ if(!data)
+ return -1;
+
+- av_fifo_generic_read(ndi_ctx->fifo, data, ndi_ctx->target_size, NULL);
++ av_fifo_read(ndi_ctx->fifo, data, ndi_ctx->target_size);
+ process_ndi_packet(ndi_ctx, data, ndi_ctx->target_size);
+ //printf("draining %i \n", ndi_ctx->target_size);
+ free(data);
+@@ -426,10 +426,10 @@ static int receive_ndi_packet(ndi_ctx *ndi_ctx)
+ if(len == 0)
+ printf("end \n");
+
+- if(av_fifo_space(ndi_ctx->fifo) < len)
+- av_fifo_grow(ndi_ctx->fifo, 5000); // fixme
++ if(av_fifo_can_write(ndi_ctx->fifo) < len)
++ av_fifo_grow2(ndi_ctx->fifo, 5000); // fixme
+
+- av_fifo_generic_write(ndi_ctx->fifo, tmp, len, NULL);
++ av_fifo_write(ndi_ctx->fifo, tmp, len);
+
+ if(handle_ndi_packet(ndi_ctx) < 0) {
+ printf("handle fail \n");
+@@ -462,7 +462,7 @@ ndi_ctx *libndi_init(void)
+ return NULL;
+ }
+
+- ndi_ctx->fifo = av_fifo_alloc(10000);
++ ndi_ctx->fifo = av_fifo_alloc2(10000, 1, 0);
+ if(!ndi_ctx->fifo)
+ goto end;
+
+@@ -629,7 +629,7 @@ void libndi_close(ndi_ctx *ndi_ctx)
+ for(int i = 0; i < 4; i++)
+ free(ndi_ctx->ndi_request[i].buf);
+
+- av_fifo_free(ndi_ctx->fifo);
++ av_fifo_freep2(&ndi_ctx->fifo);
+
+ free(ndi_ctx);
+ }
diff --git a/libndi.spec b/libndi.spec
index 3b85e4a..0512a5e 100644
--- a/libndi.spec
+++ b/libndi.spec
@@ -3,12 +3,14 @@
Name: libndi
Version: 0.0.1
-Release: 12.git%{?shortcommit0}%{?dist}
+Release: 13.git%{?shortcommit0}%{?dist}
Summary: Open-source library done to interact with NDI streams
License: LGPLv2+
URL:
https://code.videolan.org/jbk/libndi
Source0: %{url}/-/archive/%{commit0}/%{name}-%{shortcommit0}.tar.gz
+# Port to ffmpeg 7
+Patch0: libndi-c14b40c-ffmpeg7.patch
BuildRequires: gcc
BuildRequires: meson
@@ -71,6 +73,9 @@ The %{name}-utils package contains utilities for %{name}.
%changelog
+* Tue Dec 31 2024 Mamoru TASAKA <mtasaka(a)fedoraproject.org> - 0.0.1-13.gitc14b40c
+- Port to ffmpeg 7
+
* Wed Nov 06 2024 Sérgio Basto <sergio(a)serjux.com> - 0.0.1-12.gitc14b40c
- Rebuild for ffmeg-7