Skip to content

Commit

Permalink
[libdvdnav,libdvdread] New ports, with ffmpeg integration (#40898)
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt authored Oct 23, 2024
1 parent 61a6ef5 commit 07b30b4
Show file tree
Hide file tree
Showing 14 changed files with 313 additions and 4 deletions.
16 changes: 15 additions & 1 deletion ports/ffmpeg/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ffmpeg",
"version": "7.0.2",
"port-version": 5,
"port-version": 6,
"description": [
"a library to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created.",
"FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations."
Expand Down Expand Up @@ -355,6 +355,20 @@
"harfbuzz"
]
},
"dvdvideo": {
"description": "DVD-Video demuxer",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"gpl"
]
},
"libdvdnav",
"libdvdread"
]
},
"fdk-aac": {
"description": "AAC de/encoding via libfdk-aac, **including GPL-incompatible patent-encumbered HE-AAC**. If you do not require HE-AAC, use the built-in FFmpeg AAC codec.",
"dependencies": [
Expand Down
73 changes: 73 additions & 0 deletions ports/libdvdnav/msvc.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
diff --git a/msvc/config.h b/msvc/config.h
index 25f68fb..c3f00f1 100644
--- a/msvc/config.h
+++ b/msvc/config.h
@@ -28,7 +28,8 @@
#define inline __inline
/* #undef size_t */

-#define ssize_t __int64
+#include <windows.h>
+typedef SSIZE_T ssize_t;

#ifndef PATH_MAX
#define PATH_MAX MAX_PATH
@@ -43,14 +44,6 @@
#define S_ISCHR(m) 0

/* Fallback types (very x86-centric, sorry) */
-typedef unsigned char uint8_t;
-typedef signed char int8_t;
-typedef unsigned short uint16_t;
-typedef signed short int16_t;
-typedef unsigned int uint32_t;
-typedef signed int int32_t;
-typedef unsigned __int64 uint64_t;
-typedef signed __int64 int64_t;
-typedef unsigned int uintptr_t;
+#include <stdint.h>

#endif /* LIBDVNAV_CONFIG_H */
diff --git a/msvc/include/sys/time.h b/msvc/include/sys/time.h
index 843e252..8014739 100644
--- a/msvc/include/sys/time.h
+++ b/msvc/include/sys/time.h
@@ -26,3 +26,4 @@
*/

#include <time.h>
+#include <winsock2.h>
diff --git a/src/dvdnav_internal.h b/src/dvdnav_internal.h
index 495f032..a0aaeaf 100644
--- a/src/dvdnav_internal.h
+++ b/src/dvdnav_internal.h
@@ -39,6 +39,7 @@ typedef CRITICAL_SECTION pthread_mutex_t;
#ifndef HAVE_GETTIMEOFDAY
/* replacement gettimeofday implementation */
#include <sys/timeb.h>
+#include <winsock2.h>
static inline int _private_gettimeofday( struct timeval *tv, void *tz )
{
struct timeb t;
@@ -232,7 +233,7 @@ int64_t dvdnav_convert_time(dvd_time_t *time);
#define printerrf(format, args...) \
do { if (this) snprintf(this->err_str, MAX_ERR_LEN, format, ## args); } while (0)
#else
-#ifdef _MSC_VER
+#if 0
#define printerrf(str) \
do { if (this) snprintf(this->err_str, MAX_ERR_LEN, str); } while (0)
#else
diff --git a/src/read_cache.c b/src/read_cache.c
index 1b2862d..abc786a 100644
--- a/src/read_cache.c
+++ b/src/read_cache.c
@@ -87,7 +87,7 @@ struct read_cache_s {
# if READ_CACHE_TRACE
# define dprintf(fmt, ...) fprintf(MSG_OUT, "libdvdnav: %s: "fmt, __func__ , __VA_ARGS__)
# else
-#ifdef _MSC_VER
+#if 0
# define dprintf(fmt, str) /* Nowt */
#else
# define dprintf(fmt, ...) /* Nowt */
12 changes: 12 additions & 0 deletions ports/libdvdnav/no-undefined.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/configure.ac b/configure.ac
index 595378b..516f26e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -118,6 +118,7 @@ dnl
dnl This should be after all checks
dnl ---------------------------------------------
AS_CASE([$host_os],
+ [*mingw32*], LDFLAGS="-no-undefined $LDFLAGS",
[os2*], [LDFLAGS="$LDFLAGS -no-undefined"])

dnl ---------------------------------------------
43 changes: 43 additions & 0 deletions ports/libdvdnav/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
vcpkg_from_gitlab(
OUT_SOURCE_PATH SOURCE_PATH
GITLAB_URL https://code.videolan.org/
REPO videolan/libdvdnav
REF ${VERSION}
SHA512 080814c30f193176393bf6d4496a1e815b3b288cd102201ba177a13a46f733e1e0b5e05d6ca169e902c669d6f3567926c97e5a20a6712ed5620dcb10c3c3a022
HEAD_REF master
PATCHES
msvc.diff
no-undefined.diff
)
file(REMOVE_RECURSE "${SOURCE_PATH}/msvc/include/inttypes.h")

vcpkg_find_acquire_program(PKGCONFIG)
cmake_path(GET PKGCONFIG PARENT_PATH pkgconfig_dir)
vcpkg_add_to_path("${pkgconfig_dir}")

set(cppflags "")
if(VCPKG_TARGET_IS_WINDOWS)
# PATH_MAX from msvc/libdvdcss.vcxproj
set(cppflags "CPPFLAGS=\$CPPFLAGS -DPATH_MAX=2048 -DWIN32_LEAN_AND_MEAN")
if(NOT VCPKG_TARGET_IS_MINGW)
cmake_path(RELATIVE_PATH SOURCE_PATH BASE_DIRECTORY "${CURRENT_BUILDTREES_DIR}" OUTPUT_VARIABLE sources)
string(APPEND cppflags " -I../${sources}/msvc/include -D_CRT_SECURE_NO_WARNINGS")
endif()
endif()

vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
OPTIONS
${cppflags}
)
vcpkg_install_make()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
11 changes: 11 additions & 0 deletions ports/libdvdnav/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "libdvdnav",
"version-semver": "6.1.1",
"description": "Library to navigate DVD disks",
"homepage": "https://www.videolan.org/developers/libdvdnav.html",
"license": "GPL-2.0-or-later",
"supports": "!uwp & !xbox",
"dependencies": [
"libdvdread"
]
}
55 changes: 55 additions & 0 deletions ports/libdvdread/msvc.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
diff --git a/msvc/config.h b/msvc/config.h
index 4e9b60e..2f1e615 100644
--- a/msvc/config.h
+++ b/msvc/config.h
@@ -28,7 +28,6 @@
#define inline __inline
/* #undef size_t */

-#define ssize_t __int64

#ifndef PATH_MAX
#define PATH_MAX MAX_PATH
@@ -43,14 +42,6 @@
#define S_ISCHR(m) 0

/* Fallback types (very x86-centric, sorry) */
-typedef unsigned char uint8_t;
-typedef signed char int8_t;
-typedef unsigned short uint16_t;
-typedef signed short int16_t;
-typedef unsigned int uint32_t;
-typedef signed int int32_t;
-typedef unsigned __int64 uint64_t;
-typedef signed __int64 int64_t;
-typedef unsigned int uintptr_t;
+#include <stdint.h>

#endif /* LIBDVDREAD_CONFIG_H */
diff --git a/src/dvd_reader.c b/src/dvd_reader.c
index c4d9641..b3b0158 100644
--- a/src/dvd_reader.c
+++ b/src/dvd_reader.c
@@ -60,6 +60,7 @@

#if defined(_WIN32)
# include <windows.h>
+# include <winsock2.h>
# include "msvc/contrib/win32_cs.h"
#endif

diff --git a/src/dvdread/dvd_reader.h b/src/dvdread/dvd_reader.h
index 5681e0e..6c1cee6 100644
--- a/src/dvdread/dvd_reader.h
+++ b/src/dvdread/dvd_reader.h
@@ -24,7 +24,9 @@
#define LIBDVDREAD_DVD_READER_H

#ifdef _MSC_VER
-#include <config.h>
+#include <windows.h>
+typedef SSIZE_T ssize_t;
+#include <stdint.h>

#include <stdio.h>
#include <stdlib.h>
12 changes: 12 additions & 0 deletions ports/libdvdread/no-undefined.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/configure.ac b/configure.ac
index a60ef0c..eeb6715 100644
--- a/configure.ac
+++ b/configure.ac
@@ -63,6 +63,7 @@ AS_CASE([$host],
[*mingw32* | *cygwin*], [AC_CHECK_FUNCS(gettimeofday)])

AS_CASE([$host],
+ [*mingw32*], LDFLAGS="-no-undefined $LDFLAGS",
[*-os2-*], LDFLAGS="-no-undefined -Zbin-files $LDFLAGS")

AS_CASE([$host],
47 changes: 47 additions & 0 deletions ports/libdvdread/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
vcpkg_from_gitlab(
OUT_SOURCE_PATH SOURCE_PATH
GITLAB_URL https://code.videolan.org/
REPO videolan/libdvdread
REF ${VERSION}
SHA512 9eb6d551489ab1d214c56461eebafd6ecba7de8dcc60aecb7e22f82c019fd3d045fc09af66507c2e14bc53e099aec8e87620dfd988fe047a7bfa5e5d1d2c46bd
HEAD_REF master
PATCHES
msvc.diff
no-undefined.diff
)
file(REMOVE_RECURSE "${SOURCE_PATH}/msvc/include/inttypes.h")
file(TOUCH "${SOURCE_PATH}/msvc/include/strings.h")
file(WRITE "${SOURCE_PATH}/ChangeLog" "Cf. https://code.videolan.org/videolan/libdvdread/-/commits/${VERSION}/") # not in git

vcpkg_find_acquire_program(PKGCONFIG)
cmake_path(GET PKGCONFIG PARENT_PATH pkgconfig_dir)
vcpkg_add_to_path("${pkgconfig_dir}")

set(cppflags "")
if(VCPKG_TARGET_IS_WINDOWS)
# PATH_MAX from msvc/libdvdcss.vcxproj
set(cppflags "CPPFLAGS=\$CPPFLAGS -DPATH_MAX=2048 -DWIN32_LEAN_AND_MEAN")
if(NOT VCPKG_TARGET_IS_MINGW)
cmake_path(RELATIVE_PATH SOURCE_PATH BASE_DIRECTORY "${CURRENT_BUILDTREES_DIR}" OUTPUT_VARIABLE sources)
string(APPEND cppflags " -I../${sources}/msvc/include -D_CRT_SECURE_NO_WARNINGS")
endif()
endif()

vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
OPTIONS
--disable-apidoc
--with-libdvdcss
${cppflags}
)
vcpkg_install_make()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()

file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
11 changes: 11 additions & 0 deletions ports/libdvdread/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "libdvdread",
"version-semver": "6.1.3",
"description": "Library to read DVD disks",
"homepage": "https://www.videolan.org/developers/libdvdnav.html",
"license": "GPL-2.0-or-later",
"supports": "!uwp & !xbox",
"dependencies": [
"libdvdcss"
]
}
4 changes: 2 additions & 2 deletions scripts/test_ports/vcpkg-ci-ffmpeg/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "vcpkg-ci-ffmpeg",
"version-string": "1",
"port-version": 3,
"version-string": "ci",
"description": "Port to force features of certain ports within CI",
"homepage": "https://github.com/microsoft/vcpkg",
"dependencies": [
Expand Down Expand Up @@ -68,6 +67,7 @@
"default-features": false,
"features": [
"ass",
"dvdvideo",
"ffmpeg",
"fontconfig",
"fribidi",
Expand Down
10 changes: 9 additions & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2738,7 +2738,7 @@
},
"ffmpeg": {
"baseline": "7.0.2",
"port-version": 5
"port-version": 6
},
"ffnvcodec": {
"baseline": "12.2.72.0",
Expand Down Expand Up @@ -4440,6 +4440,14 @@
"baseline": "1.4.3",
"port-version": 0
},
"libdvdnav": {
"baseline": "6.1.1",
"port-version": 0
},
"libdvdread": {
"baseline": "6.1.3",
"port-version": 0
},
"libdwarf": {
"baseline": "0.11.0",
"port-version": 0
Expand Down
5 changes: 5 additions & 0 deletions versions/f-/ffmpeg.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "a269e8f98d0aabee2671587388602275bd7af837",
"version": "7.0.2",
"port-version": 6
},
{
"git-tree": "d4bc112c6581274674b70429dacd87e5d0715ac4",
"version": "7.0.2",
Expand Down
9 changes: 9 additions & 0 deletions versions/l-/libdvdnav.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "f485b361aac72478f3e46980db33aa01d2be99e4",
"version-semver": "6.1.1",
"port-version": 0
}
]
}
9 changes: 9 additions & 0 deletions versions/l-/libdvdread.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "6ffa5a51a9de24eab67fc6f620f05e03f5a21222",
"version-semver": "6.1.3",
"port-version": 0
}
]
}

0 comments on commit 07b30b4

Please sign in to comment.