[libbluray-devel] [Git][videolan/libbluray][master] Use external libudfread when available

Petri Hintukainen gitlab at videolan.org
Thu Jul 23 19:03:10 CEST 2020



Petri Hintukainen pushed to branch master at VideoLAN / libbluray


Commits:
76b073b8 by hpi1 at 2020-07-23T19:50:26+03:00
Use external libudfread when available

Closes #27.

- - - - -


3 changed files:

- Makefile.am
- configure.ac
- src/libbluray/disc/udf_fs.c


Changes:

=====================================
Makefile.am
=====================================
@@ -39,6 +39,7 @@ libbluray_la_CPPFLAGS = \
 	-I${top_srcdir}/contrib/libudfread/src/ \
 	$(LIBXML2_CFLAGS) \
 	$(FT2_CFLAGS) \
+	$(LIBUDFREAD_CFLAGS) \
 	$(FONTCONFIG_CFLAGS)
 libbluray_la_SOURCES = \
 	src/file/dirs.h \
@@ -169,8 +170,9 @@ libbluray_la_SOURCES += \
 # libudfread
 libbluray_la_SOURCES += \
 	src/libbluray/disc/udf_fs.h \
-	src/libbluray/disc/udf_fs.c\
-	\
+	src/libbluray/disc/udf_fs.c
+if !HAVE_LIBUDFREAD
+libbluray_la_SOURCES += \
 	contrib/libudfread/src/blockinput.h \
 	contrib/libudfread/src/default_blockinput.h \
 	contrib/libudfread/src/default_blockinput.c \
@@ -178,6 +180,7 @@ libbluray_la_SOURCES += \
 	contrib/libudfread/src/ecma167.c \
 	contrib/libudfread/src/udfread.h \
 	contrib/libudfread/src/udfread.c
+endif
 
 if HAVE_DARWIN
 libbluray_la_SOURCES+= \
@@ -205,7 +208,7 @@ endif
 endif
 
 libbluray_la_LDFLAGS= -no-undefined -version-info $(LT_VERSION_INFO) -export-symbols-regex "^bd_"
-libbluray_la_LIBADD= $(LIBXML2_LIBS) $(FT2_LIBS) $(FONTCONFIG_LIBS) $(EXTRA_LIBS)
+libbluray_la_LIBADD= $(LIBXML2_LIBS) $(FT2_LIBS) $(FONTCONFIG_LIBS) $(LIBUDFREAD_LIBS) $(EXTRA_LIBS)
 
 noinst_HEADERS = \
 	jni/jni.h \


=====================================
configure.ac
=====================================
@@ -279,14 +279,19 @@ AM_CONDITIONAL([BDJ_J2SE], [ test x"$BDJ_TYPE" != x"j2me" ])
 dnl bootclasspath
 AC_SUBST(BDJ_BOOTCLASSPATH)
 
-dnl udf support (using git submodule)
-if test ! -f "${srcdir}/contrib/libudfread/src/udfread.h"; then
-    AC_MSG_ERROR("libudfread source tree not found")
-fi
-AC_CHECK_HEADERS([unistd.h fcntl.h])
-AS_IF([test "${SYS}" != "mingw32"], [
-    AC_CHECK_FUNC([pread],, [AC_DEFINE([NEED_PREAD_IMPL], [1], [Define to 1 to use inefficient pread() replacement])])
+PKG_CHECK_MODULES([LIBUDFREAD], [udfread >= 1.1.0],
+    [with_libudfread=yes
+     AC_DEFINE([HAVE_LIBUDFREAD], [1], [Define to 1 if external libudfread is to be used])
+     PACKAGES="$PACKAGES libudfread >= 1.1.0"
+    ],[
+     dnl udf support (using git submodule)
+     with_libudfread=no
+     AS_IF([test ! -f "${srcdir}/contrib/libudfread/src/udfread.h"], [AC_MSG_ERROR("libudfread source tree not found")])
+     AC_CHECK_HEADERS([unistd.h fcntl.h])
+     AS_IF([test "${SYS}" != "mingw32"], [
+         AC_CHECK_FUNC([pread],, [AC_DEFINE([NEED_PREAD_IMPL], [1], [Define to 1 to use inefficient pread() replacement])])])
 ])
+AM_CONDITIONAL([HAVE_LIBUDFREAD], [ test x"$with_libudfread" = x"yes" ])
 
 dnl generate documentation
 DX_INIT_DOXYGEN(libbluray, doc/doxygen-config, [doc/doxygen])
@@ -337,5 +342,6 @@ echo "  Use system fonts:              yes"
 fi
 fi
 echo "  Metadata support (libxml2):    $with_libxml2"
+echo "  External libudfread:           $with_libudfread"
 echo "  Build examples:                $use_examples"
 


=====================================
src/libbluray/disc/udf_fs.c
=====================================
@@ -28,8 +28,13 @@
 #include "util/mutex.h"
 #include "util/logging.h"
 
+#ifdef HAVE_LIBUDFREAD
+#include <udfread/udfread.h>
+#include <udfread/blockinput.h>
+#else
 #include "udfread.h"
 #include "blockinput.h"
+#endif
 
 #include <stdlib.h>
 #include <stdio.h>   // SEEK_SET



View it on GitLab: https://code.videolan.org/videolan/libbluray/-/commit/76b073b8b0701cb817a6bc093494b0acbebb0b04

-- 
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/commit/76b073b8b0701cb817a6bc093494b0acbebb0b04
You're receiving this email because of your account on code.videolan.org.




More information about the libbluray-devel mailing list