From cf926bfd57ccfe86a888d331b2c9af45943293aa Mon Sep 17 00:00:00 2001 From: Jerry Date: Thu, 18 Apr 2024 17:08:01 +0800 Subject: [PATCH] init --- Makefile | 8 ++++++++ nyav1.c | 13 +++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 Makefile create mode 100644 nyav1.c diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2c5c5bc --- /dev/null +++ b/Makefile @@ -0,0 +1,8 @@ +CC ?= gcc +CFLAGS += -fPIC -shared +nyav1.so: + $(CC) $(CFLAGS) nyav1.c -o nyav1.so + +.PHONY: clean +clean: + rm -f nyav1.so diff --git a/nyav1.c b/nyav1.c new file mode 100644 index 0000000..a87daa6 --- /dev/null +++ b/nyav1.c @@ -0,0 +1,13 @@ +#include +#include +static int (*old) (void *a, void *b) = NULL; +int dav1d_open (void *a, void *b) { + int max_frame_delay = *(((int*)b)+1); + if (max_frame_delay == 1) { + if (!old) old = dlsym(RTLD_NEXT, "dav1d_open"); + printf("dav1d_open passthrough, max_frame_delay=%d\n", max_frame_delay); + return old(a, b); + } + printf("dav1d_open force -1, max_frame_delay=%d\n", max_frame_delay); + return -1; +}