commit cf926bfd57ccfe86a888d331b2c9af45943293aa Author: Jerry Date: Thu Apr 18 17:08:01 2024 +0800 init 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; +}