aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPär Björklund <per.bjorklund@gmail.com>2013-01-27 19:24:11 +0100
committerPär Björklund <per.bjorklund@gmail.com>2013-02-05 17:37:37 +0100
commit421d9fdb0658abb01306a62e5d57da044263b216 (patch)
treeb461210eba0ca04506c7ec7e063978106aae78d7 /lib
parent7b2dddca5e48219a2cb2bc0128dc5d5e94fc9e00 (diff)
Updated libdvdcss, read and nav to the latest versions
All XBMC modifications are kept intact Moved get/set state functions from vm.h to dvdnav_internal.h where they should be Added comments to clarify which functions are added by XBMC
Diffstat (limited to 'lib')
-rw-r--r--lib/libdvd/build-xbmc-win32.sh4
-rw-r--r--lib/libdvd/includes/dvdnav/.ignoreme2
-rw-r--r--lib/libdvd/libdvdcss/AUTHORS20
-rw-r--r--lib/libdvd/libdvdcss/ChangeLog323
-rw-r--r--lib/libdvd/libdvdcss/INSTALL8
-rw-r--r--lib/libdvd/libdvdcss/Makefile.am2
-rw-r--r--lib/libdvd/libdvdcss/NEWS18
-rw-r--r--lib/libdvd/libdvdcss/README24
-rwxr-xr-xlib/libdvd/libdvdcss/bootstrap2
-rw-r--r--lib/libdvd/libdvdcss/configure.ac8
-rw-r--r--lib/libdvd/libdvdcss/doc/doxygen.cfg.in4
-rw-r--r--lib/libdvd/libdvdcss/doc/footer.html2
-rw-r--r--lib/libdvd/libdvdcss/doc/header.html2
-rw-r--r--lib/libdvd/libdvdcss/src/bsdi_dvd.h8
-rw-r--r--lib/libdvd/libdvdcss/src/common.h16
-rw-r--r--lib/libdvd/libdvdcss/src/css.c73
-rw-r--r--lib/libdvd/libdvdcss/src/css.h15
-rw-r--r--lib/libdvd/libdvdcss/src/csstables.h11
-rw-r--r--lib/libdvd/libdvdcss/src/device.c135
-rw-r--r--lib/libdvd/libdvdcss/src/device.h16
-rw-r--r--lib/libdvd/libdvdcss/src/dvdcss/dvdcss.h8
-rw-r--r--lib/libdvd/libdvdcss/src/error.c12
-rw-r--r--lib/libdvd/libdvdcss/src/ioctl.c12
-rw-r--r--lib/libdvd/libdvdcss/src/ioctl.h15
-rw-r--r--lib/libdvd/libdvdcss/src/libdvdcss.c56
-rw-r--r--lib/libdvd/libdvdcss/src/libdvdcss.h17
-rw-r--r--lib/libdvd/libdvdnav/ChangeLog13
-rw-r--r--lib/libdvd/libdvdnav/Makefile4
-rw-r--r--lib/libdvd/libdvdnav/README2
-rwxr-xr-xlib/libdvd/libdvdnav/autogen.sh2
-rw-r--r--lib/libdvd/libdvdnav/configure.ac27
-rwxr-xr-xlib/libdvd/libdvdnav/configure22
-rw-r--r--lib/libdvd/libdvdnav/examples/menus.c23
-rw-r--r--lib/libdvd/libdvdnav/m4/Makefile.am4
-rwxr-xr-xlib/libdvd/libdvdnav/msvc/config.h5
-rwxr-xr-xlib/libdvd/libdvdnav/msvc/contrib/dlfcn.c3
-rwxr-xr-xlib/libdvd/libdvdnav/msvc/contrib/getopt.c4
-rwxr-xr-xlib/libdvd/libdvdnav/msvc/contrib/timer/timer.c4
-rwxr-xr-xlib/libdvd/libdvdnav/msvc/include/dlfcn.h7
-rw-r--r--lib/libdvd/libdvdnav/msvc/include/dvdnav_internal.h15
-rwxr-xr-xlib/libdvd/libdvdnav/msvc/include/getopt.h4
-rwxr-xr-xlib/libdvd/libdvdnav/msvc/include/inttypes.h4
-rwxr-xr-xlib/libdvd/libdvdnav/msvc/include/os_types.h3
-rwxr-xr-xlib/libdvd/libdvdnav/msvc/include/pthreads/pthread.h4
-rwxr-xr-xlib/libdvd/libdvdnav/msvc/include/pthreads/sched.h4
-rwxr-xr-xlib/libdvd/libdvdnav/msvc/include/sys/time.h4
-rwxr-xr-xlib/libdvd/libdvdnav/msvc/include/unistd.h4
-rw-r--r--lib/libdvd/libdvdnav/src/Makefile.am4
-rw-r--r--lib/libdvd/libdvdnav/src/dvdnav.c51
-rw-r--r--lib/libdvd/libdvdnav/src/dvdnav/dvd_types.h (renamed from lib/libdvd/libdvdnav/src/dvd_types.h)17
-rw-r--r--lib/libdvd/libdvdnav/src/dvdnav/dvdnav.h (renamed from lib/libdvd/libdvdnav/src/dvdnav.h)71
-rw-r--r--lib/libdvd/libdvdnav/src/dvdnav/dvdnav_events.h (renamed from lib/libdvd/libdvdnav/src/dvdnav_events.h)15
-rw-r--r--lib/libdvd/libdvdnav/src/dvdnav_internal.h31
-rw-r--r--lib/libdvd/libdvdnav/src/highlight.c16
-rw-r--r--lib/libdvd/libdvdnav/src/navigation.c92
-rw-r--r--lib/libdvd/libdvdnav/src/read_cache.c12
-rw-r--r--lib/libdvd/libdvdnav/src/read_cache.h15
-rw-r--r--lib/libdvd/libdvdnav/src/remap.c13
-rw-r--r--lib/libdvd/libdvdnav/src/remap.h14
-rw-r--r--lib/libdvd/libdvdnav/src/searching.c68
-rw-r--r--lib/libdvd/libdvdnav/src/settings.c12
-rw-r--r--lib/libdvd/libdvdnav/src/vm/decoder.c14
-rw-r--r--lib/libdvd/libdvdnav/src/vm/decoder.h17
-rw-r--r--lib/libdvd/libdvdnav/src/vm/vm.c183
-rw-r--r--lib/libdvd/libdvdnav/src/vm/vm.h21
-rw-r--r--lib/libdvd/libdvdnav/src/vm/vmcmd.c14
-rw-r--r--lib/libdvd/libdvdnav/src/vm/vmcmd.h17
-rw-r--r--lib/libdvd/libdvdnav/version.h2
-rwxr-xr-xlib/libdvd/libdvdnav/version.sh36
-rw-r--r--lib/libdvd/libdvdread/ChangeLog18
-rw-r--r--lib/libdvd/libdvdread/Makefile18
-rw-r--r--lib/libdvd/libdvdread/README2
-rwxr-xr-xlib/libdvd/libdvdread/autogen.sh2
-rw-r--r--lib/libdvd/libdvdread/configure.ac29
-rwxr-xr-xlib/libdvd/libdvdread/configure216
-rw-r--r--lib/libdvd/libdvdread/m4/Makefile.am4
-rwxr-xr-xlib/libdvd/libdvdread/msvc/config.h5
-rwxr-xr-xlib/libdvd/libdvdread/msvc/contrib/dlfcn.c3
-rwxr-xr-xlib/libdvd/libdvdread/msvc/contrib/getopt.c4
-rwxr-xr-xlib/libdvd/libdvdread/msvc/contrib/timer/timer.c4
-rwxr-xr-xlib/libdvd/libdvdread/msvc/include/dlfcn.h7
-rw-r--r--lib/libdvd/libdvdread/msvc/include/dvdnav_internal.h15
-rwxr-xr-xlib/libdvd/libdvdread/msvc/include/getopt.h4
-rwxr-xr-xlib/libdvd/libdvdread/msvc/include/inttypes.h4
-rwxr-xr-xlib/libdvd/libdvdread/msvc/include/os_types.h3
-rwxr-xr-xlib/libdvd/libdvdread/msvc/include/pthreads/pthread.h10
-rwxr-xr-xlib/libdvd/libdvdread/msvc/include/pthreads/sched.h4
-rwxr-xr-xlib/libdvd/libdvdread/msvc/include/sys/time.h6
-rwxr-xr-xlib/libdvd/libdvdread/msvc/include/unistd.h8
-rw-r--r--lib/libdvd/libdvdread/src/Makefile.am4
-rw-r--r--lib/libdvd/libdvdread/src/bitreader.c18
-rw-r--r--lib/libdvd/libdvdread/src/bswap.h24
-rw-r--r--lib/libdvd/libdvdread/src/dvd_input.c27
-rw-r--r--lib/libdvd/libdvdread/src/dvd_input.h27
-rw-r--r--lib/libdvd/libdvdread/src/dvd_reader.c334
-rw-r--r--lib/libdvd/libdvdread/src/dvd_udf.c112
-rw-r--r--lib/libdvd/libdvdread/src/dvdread/bitreader.h (renamed from lib/libdvd/libdvdread/src/bitreader.h)21
-rw-r--r--lib/libdvd/libdvdread/src/dvdread/dvd_reader.h (renamed from lib/libdvd/libdvdread/src/dvd_reader.h)70
-rw-r--r--lib/libdvd/libdvdread/src/dvdread/dvd_udf.h (renamed from lib/libdvd/libdvdread/src/dvd_udf.h)36
-rw-r--r--lib/libdvd/libdvdread/src/dvdread/ifo_print.h28
-rw-r--r--lib/libdvd/libdvdread/src/dvdread/ifo_read.h (renamed from lib/libdvd/libdvdread/src/ifo_read.h)26
-rw-r--r--lib/libdvd/libdvdread/src/dvdread/ifo_types.h (renamed from lib/libdvd/libdvdread/src/ifo_types.h)32
-rw-r--r--lib/libdvd/libdvdread/src/dvdread/nav_print.h (renamed from lib/libdvd/libdvdread/src/nav_print.h)32
-rw-r--r--lib/libdvd/libdvdread/src/dvdread/nav_read.h (renamed from lib/libdvd/libdvdread/src/nav_read.h)22
-rw-r--r--lib/libdvd/libdvdread/src/dvdread/nav_types.h (renamed from lib/libdvd/libdvdread/src/nav_types.h)19
-rw-r--r--lib/libdvd/libdvdread/src/dvdread_internal.h36
-rw-r--r--lib/libdvd/libdvdread/src/ifo_print.c174
-rw-r--r--lib/libdvd/libdvdread/src/ifo_print.h53
-rw-r--r--lib/libdvd/libdvdread/src/ifo_read.c232
-rw-r--r--lib/libdvd/libdvdread/src/md5.c6
-rw-r--r--lib/libdvd/libdvdread/src/md5.h8
-rw-r--r--lib/libdvd/libdvdread/src/nav_print.c16
-rw-r--r--lib/libdvd/libdvdread/src/nav_read.c22
-rw-r--r--lib/libdvd/libdvdread/version.h2
114 files changed, 2144 insertions, 1093 deletions
diff --git a/lib/libdvd/build-xbmc-win32.sh b/lib/libdvd/build-xbmc-win32.sh
index e32b81f2fa..b7fc950cd5 100644
--- a/lib/libdvd/build-xbmc-win32.sh
+++ b/lib/libdvd/build-xbmc-win32.sh
@@ -47,7 +47,7 @@ echo "***** Building libdvdread *****"
--extra-cflags="-DHAVE_DVDCSS_DVDCSS_H -D_XBMC -DNDEBUG -D_MSC_VER -I`pwd`/../includes" \
--disable-debug
mkdir -p ../includes/dvdread
-cp ../libdvdread/src/*.h ../includes/dvdread
+cp ../libdvdread/src/dvdread/*.h ../includes/dvdread
make $MAKEFLAGS
cd ..
@@ -65,6 +65,8 @@ echo "***** Building libdvdnav *****"
--extra-cflags="-D_XBMC -DNDEBUG -I`pwd`/../includes" \
--with-dvdread-config="`pwd`/../libdvdread/obj/dvdread-config" \
--disable-debug
+mkdir -p ../includes/dvdnav
+cp ../libdvdnav/src/dvdnav/*.h ../includes/dvdnav
make $MAKEFLAGS
gcc \
-shared \
diff --git a/lib/libdvd/includes/dvdnav/.ignoreme b/lib/libdvd/includes/dvdnav/.ignoreme
new file mode 100644
index 0000000000..62d0910142
--- /dev/null
+++ b/lib/libdvd/includes/dvdnav/.ignoreme
@@ -0,0 +1,2 @@
+Dummy file so that this directory shows up for git users.
+Ignore this file.
diff --git a/lib/libdvd/libdvdcss/AUTHORS b/lib/libdvd/libdvdcss/AUTHORS
index 810cbdd0e2..fd0321c101 100644
--- a/lib/libdvd/libdvdcss/AUTHORS
+++ b/lib/libdvd/libdvdcss/AUTHORS
@@ -2,7 +2,7 @@
#
# Authors and contributors are listed alphabetically.
#
-# The fields are: name (N), email (E), web-address (W), CVS account login (C),
+# The fields are: name (N), email (E), web-address (W), CVS/SVN account login (C),
# PGP key ID and fingerprint (P), description (D), and snail-mail address (S).
N: Billy Biggs
@@ -20,6 +20,7 @@ D: cache bug fix for discs with identical content but different keys
N: Håkan Hjort
E: d95hjort@dtek.chalmers.se
+C: hjort
D: Solaris port of the DVD ioctls
D: libdvdcss enhancements
@@ -39,6 +40,15 @@ C: jlj
D: Win32 port
D: Fixes to the Darwin port
+N: KO Myung-Hun
+E: komh@chollian.net
+D: OS/2 port
+
+N: Jean-Baptiste Kempf
+C: jb
+E: jb@videolan.org
+D: maintainer
+
N: Markus Kuespert
E: ltlBeBoy@beosmail.com
D: BeOS port of the DVD ioctls
@@ -47,6 +57,14 @@ N: Pascal Levesque
E: Pascal.Levesque@mindready.com
D: QNX port
+N: Steve Lhomme
+E: steve.lhomme@free.fr
+D: win32 improvements
+
+N: Christophe Massiot
+E: massiot@via.ecp.fr
+D: former maintainer
+
N: Steven M. Schultz
E: sms@TO.GD-ES.COM
D: BSD/OS port
diff --git a/lib/libdvd/libdvdcss/ChangeLog b/lib/libdvd/libdvdcss/ChangeLog
index 7b3abcacc8..984083e6c5 100644
--- a/lib/libdvd/libdvdcss/ChangeLog
+++ b/lib/libdvd/libdvdcss/ChangeLog
@@ -1,4 +1,327 @@
------------------------------------------------------------------------
+r251 | jb | 2012-03-11 13:33:49 +0000 (Sun, 11 Mar 2012) | 3 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/configure.ac
+ M /trunk/doc/doxygen.cfg.in
+
+Prepare 1.2.12
+
+
+------------------------------------------------------------------------
+r250 | jb | 2012-03-11 12:37:40 +0000 (Sun, 11 Mar 2012) | 3 lines
+Changed paths:
+ M /trunk/AUTHORS
+
+Update Authors file
+
+
+------------------------------------------------------------------------
+r249 | jb | 2012-02-18 16:22:03 +0000 (Sat, 18 Feb 2012) | 4 lines
+Changed paths:
+ M /trunk/src/css.c
+
+If unsure, assume the drive is of RPC-I type
+
+This can happen when patched drives do not answer to ioctl_ReportRPC correctly
+
+------------------------------------------------------------------------
+r247 | jb | 2011-11-14 10:40:05 +0000 (Mon, 14 Nov 2011) | 3 lines
+Changed paths:
+ M /trunk/ChangeLog
+
+Update Changelog
+
+
+------------------------------------------------------------------------
+r246 | jb | 2011-11-14 10:27:32 +0000 (Mon, 14 Nov 2011) | 3 lines
+Changed paths:
+ M /trunk/NEWS
+ M /trunk/configure.ac
+ M /trunk/doc/doxygen.cfg.in
+ M /trunk/msvc/config.h
+
+Bumping version to 1.2.11
+
+
+------------------------------------------------------------------------
+r245 | jb | 2011-11-14 10:26:47 +0000 (Mon, 14 Nov 2011) | 3 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/README
+
+Update README and INSTALL to be a bit less out-of-date
+
+
+------------------------------------------------------------------------
+r244 | jb | 2011-10-26 05:10:24 +0000 (Wed, 26 Oct 2011) | 3 lines
+Changed paths:
+ M /trunk/Makefile.am
+
+Fix "doc" Makefile target
+
+
+------------------------------------------------------------------------
+r243 | jb | 2011-10-26 05:01:11 +0000 (Wed, 26 Oct 2011) | 12 lines
+Changed paths:
+ M /trunk/src/common.h
+
+Win32: Drop #define of snprintf() to _snprintf() if the former is undefined.
+
+This workaround was added for MinGW originally, but nowadays MinGW supports
+snprintf() directly so it has become unnecessary.
+
+Furthermore this can play havoc with Cygwin which does not have a _snprintf()
+declaration and gives implicit function declaration warnings. Depending on
+compiler flags, this can be a fatal error.
+
+Patch by Diego Biurrun - diego at biurrun d0t de
+
+
+------------------------------------------------------------------------
+r242 | jb | 2011-10-26 04:59:23 +0000 (Wed, 26 Oct 2011) | 8 lines
+Changed paths:
+ M /trunk/src/device.c
+
+Win32: consistently use snprintf() instead of _snprintf()
+
+Both functions are available on Cygwin and MinGW nowadays so there is
+no need to be inconsistent anymore.
+
+Patch by Diego Biurrun - diego at biurrun d0t de
+
+
+------------------------------------------------------------------------
+r241 | jb | 2011-08-16 10:41:24 +0000 (Tue, 16 Aug 2011) | 4 lines
+Changed paths:
+ M /trunk/INSTALL
+ M /trunk/README
+
+Fix typos in README and INSTALL
+
+Patch by bryce, ref http://trac.videolan.org/vlc/ticket/5200
+
+------------------------------------------------------------------------
+r240 | jb | 2011-03-23 15:00:06 +0000 (Wed, 23 Mar 2011) | 3 lines
+Changed paths:
+ M /trunk/src/libdvdcss.h
+
+Remove excessive whitespace
+
+
+------------------------------------------------------------------------
+r239 | jb | 2011-03-23 14:59:36 +0000 (Wed, 23 Mar 2011) | 5 lines
+Changed paths:
+ M /trunk/src/css.c
+
+Fix a small memleak
+
+Reported by Thélesphonse Bigorneault
+
+
+------------------------------------------------------------------------
+r238 | jb | 2011-02-09 22:48:29 +0000 (Wed, 09 Feb 2011) | 3 lines
+Changed paths:
+ M /trunk/doc/doxygen.cfg.in
+
+Update documentation version
+
+
+------------------------------------------------------------------------
+r237 | reimar | 2010-09-25 14:21:47 +0000 (Sat, 25 Sep 2010) | 3 lines
+Changed paths:
+ M /trunk/src/libdvdcss.c
+
+Ensure dvdcss->css.p_disc_key is always initialized,
+even if _dvdcss_disckey fails.
+
+------------------------------------------------------------------------
+r236 | jb | 2010-08-02 15:59:13 +0000 (Mon, 02 Aug 2010) | 9 lines
+Changed paths:
+ M /trunk/src/css.h
+ M /trunk/src/device.h
+ M /trunk/src/libdvdcss.h
+
+Make libdvdcss headers self-sufficient
+
+This patch adds required #includes to libdvdcss headers so that they can be used
+without other headers as prerequisites.
+This leaves out limits.h and stdint.h, for the moment, since they aren't on all systems.
+
+Patch by Diego Biurrun - diego at biurrun d0t de
+
+
+------------------------------------------------------------------------
+r235 | jb | 2010-08-02 15:41:14 +0000 (Mon, 02 Aug 2010) | 8 lines
+Changed paths:
+ M /trunk/src/common.h
+ M /trunk/src/css.h
+ M /trunk/src/csstables.h
+ M /trunk/src/device.h
+ M /trunk/src/ioctl.h
+ M /trunk/src/libdvdcss.h
+
+Add multiple inclusion guards to header files
+
+Most header files in libdvdcss lack multiple inclusion guards, although they are
+a sensible thing to have for header files. This adds them where currently missing.
+
+Patch by Diego Biurrun - diego at biurrun d0t de
+
+
+------------------------------------------------------------------------
+r234 | jb | 2010-08-02 15:38:08 +0000 (Mon, 02 Aug 2010) | 7 lines
+Changed paths:
+ M /trunk/src/bsdi_dvd.h
+
+Use filename as multiple inclusion guard
+
+For some reason bsdi_dvd.h does not use the (full) filename as multiple
+inclusion guard.
+
+Patch by Diego Biurrun - diego at biurrun d0t de
+
+------------------------------------------------------------------------
+r233 | jb | 2010-08-02 14:04:16 +0000 (Mon, 02 Aug 2010) | 7 lines
+Changed paths:
+ M /trunk/doc/doxygen.cfg.in
+
+Shut up doxygen run
+
+Doxygen is terribly verbose by default and spams the console with useless by
+the metric ton. This patch makes its output more terse and thus more sensible.
+
+Patch by Diego Biurrun - diego at biurrun d0t de
+
+------------------------------------------------------------------------
+r232 | jb | 2010-08-02 13:56:10 +0000 (Mon, 02 Aug 2010) | 4 lines
+Changed paths:
+ M /trunk/src
+
+svn:ignore src/libdvdcss.pc
+
+As tipped by Diego
+
+------------------------------------------------------------------------
+r231 | jb | 2010-05-10 10:03:06 +0000 (Mon, 10 May 2010) | 5 lines
+Changed paths:
+ M /trunk/src/css.c
+
+Try other methods also if GetBusKey fails instead of failing completely
+
+Patch from MPlayer, from Reimar Döffinger, forwarded by Diego Biurrun
+
+
+------------------------------------------------------------------------
+r230 | sam | 2009-09-02 22:07:32 +0000 (Wed, 02 Sep 2009) | 3 lines
+Changed paths:
+ M /trunk/src/libdvdcss.c
+ M /trunk/src/libdvdcss.h
+
+Remove the RPC-II sanity check and only issue a warning. Capable drives are
+far too common.
+
+------------------------------------------------------------------------
+r229 | sam | 2009-09-02 22:01:07 +0000 (Wed, 02 Sep 2009) | 2 lines
+Changed paths:
+ M /trunk/src/device.c
+
+Use 64-bit IO and binary mode on OS/2. Patch courtesy of KO Myung-Hun.
+
+------------------------------------------------------------------------
+r228 | sam | 2009-05-13 21:28:53 +0000 (Wed, 13 May 2009) | 1 line
+Changed paths:
+ M /trunk/src/css.c
+
+Prepend 0x to the region mask for clarity.
+------------------------------------------------------------------------
+r227 | sam | 2009-05-13 21:00:31 +0000 (Wed, 13 May 2009) | 1 line
+Changed paths:
+ M /trunk/src/libdvdcss.c
+
+Duh, typo in the RPC-II sanity check.
+------------------------------------------------------------------------
+r226 | sam | 2009-05-13 20:54:40 +0000 (Wed, 13 May 2009) | 2 lines
+Changed paths:
+ M /trunk/src/libdvdcss.c
+ M /trunk/src/libdvdcss.h
+
+Add support for the DVDCSS_IGNORE_RPC environment variable in order to
+bypass our new RPC-II sanity check.
+------------------------------------------------------------------------
+r225 | sam | 2009-05-13 20:54:39 +0000 (Wed, 13 May 2009) | 1 line
+Changed paths:
+ M /trunk/src/css.c
+
+Add a debug message in the copyright information retrieval.
+------------------------------------------------------------------------
+r224 | sam | 2009-05-13 20:54:37 +0000 (Wed, 13 May 2009) | 3 lines
+Changed paths:
+ M /trunk/src/css.c
+ M /trunk/src/libdvdcss.c
+
+Check drive's RPC status before trying to access a scrambled disc. Patch
+provided by Ori Avtalion <ori@avtalion.name> and refactored by Sam Hocevar
+<sam@hocevar.net>.
+------------------------------------------------------------------------
+r223 | sam | 2009-05-13 20:54:35 +0000 (Wed, 13 May 2009) | 1 line
+Changed paths:
+ M /trunk/src/libdvdcss.c
+
+Fix a potential format string crash.
+------------------------------------------------------------------------
+r221 | sam | 2009-02-09 00:45:44 +0000 (Mon, 09 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/src/css.c
+ M /trunk/src/device.c
+ M /trunk/src/error.c
+ M /trunk/src/ioctl.c
+ M /trunk/src/libdvdcss.c
+
+Remove occurrences of "this program" from the license headers.
+------------------------------------------------------------------------
+r220 | sam | 2009-02-09 00:45:33 +0000 (Mon, 09 Feb 2009) | 1 line
+Changed paths:
+ M /trunk/AUTHORS
+ M /trunk/configure.ac
+ M /trunk/src/device.c
+ M /trunk/src/device.h
+ M /trunk/src/libdvdcss.c
+ M /trunk/src/libdvdcss.h
+
+Adding OS/2 support, courtesy of KO Myung-Hun <komh@chollian.net>.
+------------------------------------------------------------------------
+r219 | jb | 2009-02-09 00:03:47 +0000 (Mon, 09 Feb 2009) | 5 lines
+Changed paths:
+ M /trunk/src/common.h
+ M /trunk/src/css.c
+ M /trunk/src/css.h
+ M /trunk/src/csstables.h
+ M /trunk/src/device.c
+ M /trunk/src/device.h
+ M /trunk/src/dvdcss/dvdcss.h
+ M /trunk/src/error.c
+ M /trunk/src/ioctl.c
+ M /trunk/src/ioctl.h
+ M /trunk/src/libdvdcss.c
+ M /trunk/src/libdvdcss.h
+
+Update the FSF address.
+
+Patch by Diego Biurrun
+
+
+------------------------------------------------------------------------
+r218 | sam | 2008-08-29 19:00:14 +0000 (Fri, 29 Aug 2008) | 2 lines
+Changed paths:
+ M /trunk/ChangeLog
+ M /trunk/NEWS
+ M /trunk/configure.ac
+ M /trunk/msvc/config.h
+
+ * Bump version number to 1.2.10.
+ * Update NEWS and ChangeLog.
+------------------------------------------------------------------------
r217 | sam | 2008-08-29 18:57:52 +0000 (Fri, 29 Aug 2008) | 2 lines
Changed paths:
M /trunk/src/Makefile.am
diff --git a/lib/libdvd/libdvdcss/INSTALL b/lib/libdvd/libdvdcss/INSTALL
index 254758f753..fa53b011f4 100644
--- a/lib/libdvd/libdvdcss/INSTALL
+++ b/lib/libdvd/libdvdcss/INSTALL
@@ -10,6 +10,12 @@ A typical way to configure libdvdcss is:
See `./configure --help' for more information.
+
+If you got libdvdcss from its version control system, please bootstrap first:
+
+ ./bootstrap
+
+
Building libdvdcss
==================
@@ -34,7 +40,7 @@ You have two alternatives to build libdvdcss for Win32:
- natively on Windows, using MSYS + MINGW (www.mingw.org):
- (MSYS is a minimal build environnement to compile unixish projects under
+ (MSYS is a minimal build environment to compile unixish projects under
windoze. It provides all the common unix tools like sh, gmake...)
You will need to download and install the latest MSYS (version 1.0.7 as
diff --git a/lib/libdvd/libdvdcss/Makefile.am b/lib/libdvd/libdvdcss/Makefile.am
index bc8b81d6d9..8cfaef6ac3 100644
--- a/lib/libdvd/libdvdcss/Makefile.am
+++ b/lib/libdvd/libdvdcss/Makefile.am
@@ -8,5 +8,5 @@ AUTOMAKE_OPTIONS = foreign dist-bzip2 subdir-objects
doc-dummy:
doc: doc-dummy
- $(MAKE) -C doc doc
+ $(MAKE) -C doc
diff --git a/lib/libdvd/libdvdcss/NEWS b/lib/libdvd/libdvdcss/NEWS
index 87df99944e..2a3d429ea6 100644
--- a/lib/libdvd/libdvdcss/NEWS
+++ b/lib/libdvd/libdvdcss/NEWS
@@ -1,4 +1,20 @@
-$Id$
+$Id: NEWS 251 2012-03-11 13:33:49Z jb $
+
+Changes between 1.2.11 and 1.2.12:
+----------------------------------
+
+ * fix regression on RPC-I drives handling.
+
+
+Changes between 1.2.10 and 1.2.11:
+----------------------------------
+
+ * improvements on RPC-II handling.
+ * more robust key retrieval.
+ * fixes for MingW compilation.
+ * fixes for OS/2 compilation.
+ * various bug fixes for small issues, memleaks, crashes and build issues.
+
Changes between 1.2.9 and 1.2.10:
---------------------------------
diff --git a/lib/libdvd/libdvdcss/README b/lib/libdvd/libdvdcss/README
index 5b63385e7b..fbb60ad653 100644
--- a/lib/libdvd/libdvdcss/README
+++ b/lib/libdvd/libdvdcss/README
@@ -1,13 +1,13 @@
README for libdvdcss, a portable abstraction library for DVD decryption
-$Id$
+$Id: README 245 2011-11-14 10:26:47Z jb $
Introduction
============
-libdvdcss is part of the VideoLAN project, a full MPEG2 client/server
-solution. The VideoLAN Client can also be used as a standalone program
-to play MPEG2 streams from a hard disk or a DVD.
+libdvdcss is part of the VideoLAN project, a full video client/server
+streaming solution. VLC can also be used as a standalone program
+to play video streams from a hard disk or a DVD.
Building and Installing libdvdcss
@@ -23,7 +23,7 @@ variables:
DVDCSS_METHOD={title|disc|key}: method for key decryption
title: decrypted title key is guessed from the encrypted sectors of
the stream. Thus it should work with a file as well as the
- DVD device. But it sometimes takes much time to decrypt a title
+ DVD device. But it sometimes takes too much time to decrypt a title
key and may even fail. With this method, the key is only checked
at the beginning of each title, so it won't work if the key
changes in the middle of a title.
@@ -33,7 +33,7 @@ variables:
compilation time. If you do, the decryption of the disc key
will be faster with this method. It is the one that was used by
libcss.
- This is the default method,
+ This is the default method.
DVDCSS_VERBOSE={0|1|2}: libdvdcss verbosity
0: no error messages, no debug messages (this is the default)
1: only error messages
@@ -46,17 +46,11 @@ Troubleshooting
A mailing-list has been set up for support and discussion about
libdvdcss. Its address is :
- <libdvdcss@videolan.org>
+ <libdvdcss-devel@videolan.org>
-To subscribe, send a mail to <listar@videolan.org> with the following
-words in the mail body :
-
- subscribe libdvdcss
-
-To unsubscribe, do the same with the words :
-
- unsubscribe libdvdcss
+To subscribe or unsubscribe, go to:
+ http://mailman.videolan.org/
When reporting bugs, try to be as precise as possible (which OS, which
distribution, what plugins you were trying, and so on).
diff --git a/lib/libdvd/libdvdcss/bootstrap b/lib/libdvd/libdvdcss/bootstrap
index 434d6e3fca..b72f15d86f 100755
--- a/lib/libdvd/libdvdcss/bootstrap
+++ b/lib/libdvd/libdvdcss/bootstrap
@@ -1,5 +1,5 @@
#! /bin/sh
-# $Id: bootstrap 2005 2008-07-16 20:51:50Z sam $
+# $Id: bootstrap 214 2008-08-29 18:57:45Z sam $
# bootstrap: generic bootstrap/autogen.sh script for autotools projects
#
diff --git a/lib/libdvd/libdvdcss/configure.ac b/lib/libdvd/libdvdcss/configure.ac
index a40a161d93..f01126e907 100644
--- a/lib/libdvd/libdvdcss/configure.ac
+++ b/lib/libdvd/libdvdcss/configure.ac
@@ -4,8 +4,8 @@ AC_PREREQ(2.50)
AC_CONFIG_AUX_DIR(.auto)
AC_CANONICAL_SYSTEM
-AM_INIT_AUTOMAKE(libdvdcss, 1.2.10)
-AC_CONFIG_HEADERS(config.h)
+AM_INIT_AUTOMAKE(libdvdcss, 1.2.12)
+AM_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_STDC_HEADERS
@@ -38,6 +38,10 @@ case x"${target_os}" in
xbeos*)
AC_DEFINE(SYS_BEOS, 1, Have a BeOS system.)
;;
+ xos2*)
+ LDFLAGS="-Zbin-files"
+ AC_DEFINE(SYS_OS2, 1, Have a OS/2 system.)
+ ;;
x*msvc*)
SYS_MSVC=1
;;
diff --git a/lib/libdvd/libdvdcss/doc/doxygen.cfg.in b/lib/libdvd/libdvdcss/doc/doxygen.cfg.in
index c27228a17c..45eb9ca718 100644
--- a/lib/libdvd/libdvdcss/doc/doxygen.cfg.in
+++ b/lib/libdvd/libdvdcss/doc/doxygen.cfg.in
@@ -31,7 +31,7 @@ PROJECT_NAME = libdvdcss
# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER = 1.2.5
+PROJECT_NUMBER = 1.2.12
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
@@ -481,7 +481,7 @@ FILE_VERSION_FILTER =
# The QUIET tag can be used to turn on/off the messages that are generated
# by doxygen. Possible values are YES and NO. If left blank NO is used.
-QUIET = NO
+QUIET = YES
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated by doxygen. Possible values are YES and NO. If left blank
diff --git a/lib/libdvd/libdvdcss/doc/footer.html b/lib/libdvd/libdvdcss/doc/footer.html
index b1f50f56cc..b73335daf8 100644
--- a/lib/libdvd/libdvdcss/doc/footer.html
+++ b/lib/libdvd/libdvdcss/doc/footer.html
@@ -1,3 +1,3 @@
-<!-- $Id$ -->
+<!-- $Id: footer.html 186 2005-09-04 07:43:15Z robux4 $ -->
</body>
</html>
diff --git a/lib/libdvd/libdvdcss/doc/header.html b/lib/libdvd/libdvdcss/doc/header.html
index b6c70da037..08b048d669 100644
--- a/lib/libdvd/libdvdcss/doc/header.html
+++ b/lib/libdvd/libdvdcss/doc/header.html
@@ -7,4 +7,4 @@
<link href="/doxygen.css" rel="stylesheet" type="text/css">
</head>
<body>
-<!-- $Id$ -->
+<!-- $Id: header.html 186 2005-09-04 07:43:15Z robux4 $ -->
diff --git a/lib/libdvd/libdvdcss/src/bsdi_dvd.h b/lib/libdvd/libdvdcss/src/bsdi_dvd.h
index f4c8b89f6d..efc5248e7b 100644
--- a/lib/libdvd/libdvdcss/src/bsdi_dvd.h
+++ b/lib/libdvd/libdvdcss/src/bsdi_dvd.h
@@ -1,9 +1,9 @@
/*
- * $Id$
+ * $Id: bsdi_dvd.h 234 2010-08-02 15:38:08Z jb $
*/
-#ifndef DVDCSS_DVD_H
-#define DVDCSS_DVD_H
+#ifndef DVDCSS_BSDI_DVD_H
+#define DVDCSS_BSDI_DVD_H
#include <sys/cdefs.h>
#include <machine/endian.h>
@@ -341,4 +341,4 @@ typedef struct
int error;
} tracktype;
-#endif /* DVDCSS_DVD_H */
+#endif /* DVDCSS_BSDI_DVD_H */
diff --git a/lib/libdvd/libdvdcss/src/common.h b/lib/libdvd/libdvdcss/src/common.h
index aff5ccbaa7..cf9f966754 100644
--- a/lib/libdvd/libdvdcss/src/common.h
+++ b/lib/libdvd/libdvdcss/src/common.h
@@ -3,7 +3,7 @@
* Collection of useful common types and macros definitions
*****************************************************************************
* Copyright (C) 1998, 1999, 2000 VideoLAN
- * $Id$
+ * $Id: common.h 243 2011-10-26 05:01:11Z jb $
*
* Authors: Sam Hocevar <sam@via.ecp.fr>
* Vincent Seguin <seguin@via.ecp.fr>
@@ -19,11 +19,14 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdcss; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*****************************************************************************/
+#ifndef DVDCSS_COMMON_H
+#define DVDCSS_COMMON_H
+
/*****************************************************************************
* Basic types definitions
*****************************************************************************/
@@ -73,9 +76,6 @@ typedef __int64 off_t;
# define stat _stati64
# endif
-# ifndef snprintf
-# define snprintf _snprintf /* snprintf not defined in mingw32 (bug?) */
-# endif
-
#endif
+#endif /* DVDCSS_COMMON_H */
diff --git a/lib/libdvd/libdvdcss/src/css.c b/lib/libdvd/libdvdcss/src/css.c
index 4e24bbf68f..3a1c225976 100644
--- a/lib/libdvd/libdvdcss/src/css.c
+++ b/lib/libdvd/libdvdcss/src/css.c
@@ -2,7 +2,7 @@
* css.c: Functions for DVD authentication and descrambling
*****************************************************************************
* Copyright (C) 1999-2008 VideoLAN
- * $Id$
+ * $Id: css.c 249 2012-02-18 16:22:03Z jb $
*
* Authors: Stéphane Borel <stef@via.ecp.fr>
* HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>
@@ -16,19 +16,19 @@
* - DecVOB
* see http://www.lemuria.org/DeCSS/ by Tom Vogt for more information.
*
- * This program is free software; you can redistribute it and/or modify
+ * This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this library; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*****************************************************************************/
/*****************************************************************************
@@ -89,10 +89,19 @@ static int AttackPadding ( uint8_t const[], int, uint8_t * );
/*****************************************************************************
* _dvdcss_test: check if the disc is encrypted or not
+ *****************************************************************************
+ * Return values:
+ * 1: DVD is scrambled but can be read
+ * 0: DVD is not scrambled and can be read
+ * -1: could not get "copyright" information
+ * -2: could not get RPC information (reading the disc might be possible)
+ * -3: drive is RPC-II, region is not set, and DVD is scrambled: the RPC
+ * scheme will prevent us from reading the scrambled data
*****************************************************************************/
int _dvdcss_test( dvdcss_t dvdcss )
{
- int i_ret, i_copyright;
+ char const *psz_type, *psz_rpc;
+ int i_ret, i_copyright, i_type, i_mask, i_rpc;
i_ret = ioctl_ReadCopyright( dvdcss->i_fd, 0 /* i_layer */, &i_copyright );
@@ -115,14 +124,51 @@ int _dvdcss_test( dvdcss_t dvdcss )
if( i_ret < 0 )
{
/* Since it's the first ioctl we try to issue, we add a notice */
- print_error( dvdcss, "css error: ioctl_ReadCopyright failed, "
- "make sure there is a DVD in the drive, and that "
- "you have used the correct device node." );
+ print_error( dvdcss, "css error: could not get \"copyright\""
+ " information, make sure there is a DVD in the drive,"
+ " and that you have used the correct device node." );
+
+ return -1;
+ }
+
+ print_debug( dvdcss, "disc reports copyright information 0x%x",
+ i_copyright );
- return i_ret;
+ i_ret = ioctl_ReportRPC( dvdcss->i_fd, &i_type, &i_mask, &i_rpc);
+
+ if( i_ret < 0 )
+ {
+ print_error( dvdcss, "css error: could not get RPC status. Assuming RPC-I drive." );
+ i_type = i_mask = i_rpc = 0;
}
- return i_copyright;
+ switch( i_rpc )
+ {
+ case 0: psz_rpc = "RPC-I"; break;
+ case 1: psz_rpc = "RPC-II"; break;
+ default: psz_rpc = "unknown RPC scheme"; break;
+ }
+
+ switch( i_type )
+ {
+ case 0: psz_type = "no region code set"; break;
+ case 1: psz_type = "region code set"; break;
+ case 2: psz_type = "one region change remaining"; break;
+ case 3: psz_type = "region code set permanently"; break;
+ default: psz_type = "unknown status"; break;
+ }
+
+ print_debug( dvdcss, "drive region mask 0x%x, %s, %s",
+ i_mask, psz_rpc, psz_type );
+
+ if( i_copyright && i_rpc == 1 && i_type == 0 )
+ {
+ print_error( dvdcss, "css error: drive will prevent access to "
+ "scrambled data" );
+ return -3;
+ }
+
+ return i_copyright ? 1 : 0;
}
/*****************************************************************************
@@ -379,7 +425,7 @@ int _dvdcss_titlekey( dvdcss_t dvdcss, int i_pos, dvd_key_t p_title_key )
/* We need to authenticate again every time to get a new session key */
if( GetBusKey( dvdcss ) < 0 )
{
- return -1;
+ i_ret = -1;
}
/* Get encrypted title key */
@@ -1153,6 +1199,7 @@ static int CrackDiscKey( dvdcss_t dvdcss, uint8_t *p_disc_key )
memset( BigTable, 0 , 16777216 * sizeof(int) );
if( BigTable == NULL )
{
+ free( K1table );
return -1;
}
diff --git a/lib/libdvd/libdvdcss/src/css.h b/lib/libdvd/libdvdcss/src/css.h
index 03becda17c..26ad6996a2 100644
--- a/lib/libdvd/libdvdcss/src/css.h
+++ b/lib/libdvd/libdvdcss/src/css.h
@@ -2,7 +2,7 @@
* css.h: Structures for DVD authentication and unscrambling
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id$
+ * $Id: css.h 236 2010-08-02 15:59:13Z jb $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
@@ -22,10 +22,16 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdcss; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*****************************************************************************/
+
+#ifndef DVDCSS_CSS_H
+#define DVDCSS_CSS_H
+
+#include "dvdcss/dvdcss.h"
+
#define KEY_SIZE 5
typedef uint8_t dvd_key_t[KEY_SIZE];
@@ -54,3 +60,4 @@ int _dvdcss_disckey ( dvdcss_t );
int _dvdcss_titlekey ( dvdcss_t, int , dvd_key_t );
int _dvdcss_unscramble ( uint8_t *, uint8_t * );
+#endif /* DVDCSS_CSS_H */
diff --git a/lib/libdvd/libdvdcss/src/csstables.h b/lib/libdvd/libdvdcss/src/csstables.h
index bd0fc3a706..d8dfa98ee5 100644
--- a/lib/libdvd/libdvdcss/src/csstables.h
+++ b/lib/libdvd/libdvdcss/src/csstables.h
@@ -2,7 +2,7 @@
* csstables.h: CSS Tables for DVD unscrambling
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id$
+ * $Id: csstables.h 235 2010-08-02 15:41:14Z jb $
*
* Author: Stéphane Borel <stef@via.ecp.fr>
*
@@ -24,11 +24,13 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdcss; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*****************************************************************************/
+#ifndef DVDCSS_CSSTABLES_H
+#define DVDCSS_CSSTABLES_H
static uint8_t p_css_tab1[ 256 ] =
{
@@ -390,3 +392,4 @@ static uint8_t p_crypt_tab3[ 288 ] =
0xC3, 0x82, 0xC9, 0x15, 0x57, 0x16, 0x5D, 0x81
};
+#endif /* DVDCSS_CSSTABLES_H */
diff --git a/lib/libdvd/libdvdcss/src/device.c b/lib/libdvd/libdvdcss/src/device.c
index 45d6f0d3d2..cfd3504b5a 100644
--- a/lib/libdvd/libdvdcss/src/device.c
+++ b/lib/libdvd/libdvdcss/src/device.c
@@ -2,25 +2,25 @@
* device.h: DVD device access
*****************************************************************************
* Copyright (C) 1998-2006 VideoLAN
- * $Id$
+ * $Id: device.c 242 2011-10-26 04:59:23Z jb $
*
* Authors: Stéphane Borel <stef@via.ecp.fr>
* Sam Hocevar <sam@zoy.org>
* HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>
*
- * This program is free software; you can redistribute it and/or modify
+ * This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this library; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*****************************************************************************/
/*
@@ -69,6 +69,14 @@
# include <IOKit/storage/IODVDMedia.h>
#endif
+#ifdef SYS_OS2
+# define INCL_DOS
+# define INCL_DOSDEVIOCTL
+# include <os2.h>
+# include <io.h> /* setmode() */
+# include <fcntl.h> /* O_BINARY */
+#endif
+
#include "dvdcss/dvdcss.h"
#include "common.h"
@@ -95,6 +103,12 @@ static int aspi_read ( dvdcss_t, void *, int );
static int win_readv ( dvdcss_t, struct iovec *, int );
static int aspi_read_internal ( int, void *, int );
+#elif defined( SYS_OS2 )
+static int os2_open ( dvdcss_t, char const * );
+/* just use macros for libc */
+# define os2_seek libc_seek
+# define os2_read libc_read
+# define os2_readv libc_readv
#endif
int _dvdcss_use_ioctls( dvdcss_t dvdcss )
@@ -114,6 +128,16 @@ int _dvdcss_use_ioctls( dvdcss_t dvdcss )
{
return 1;
}
+#elif defined( SYS_OS2 )
+ ULONG ulMode;
+
+ if( DosQueryFHState( dvdcss->i_fd, &ulMode ) != 0 )
+ return 1; /* What to do? Be conservative and try to use the ioctls */
+
+ if( ulMode & OPEN_FLAGS_DASD )
+ return 1;
+
+ return 0;
#else
struct stat fileinfo;
int ret;
@@ -161,6 +185,28 @@ void _dvdcss_check ( dvdcss_t dvdcss )
kern_return_t kern_result;
io_iterator_t media_iterator;
CFMutableDictionaryRef classes_to_match;
+#elif defined( SYS_OS2 )
+#pragma pack( 1 )
+ struct
+ {
+ BYTE bCmdInfo;
+ BYTE bDrive;
+ } param;
+
+ struct
+ {
+ BYTE abEBPB[31];
+ USHORT usCylinders;
+ BYTE bDevType;
+ USHORT usDevAttr;
+ } data;
+#pragma pack()
+
+ ULONG ulParamLen;
+ ULONG ulDataLen;
+ ULONG rc;
+
+ int i;
#else
char *ppsz_devices[] = { "/dev/dvd", "/dev/cdrom", "/dev/hdc", NULL };
int i, i_fd;
@@ -274,6 +320,32 @@ void _dvdcss_check ( dvdcss_t dvdcss )
}
IOObjectRelease( media_iterator );
+#elif defined( SYS_OS2 )
+ for( i = 0; i < 26; i++ )
+ {
+ param.bCmdInfo = 0;
+ param.bDrive = i;
+
+ rc = DosDevIOCtl( ( HFILE )-1, IOCTL_DISK, DSK_GETDEVICEPARAMS,
+ &param, sizeof( param ), &ulParamLen,
+ &data, sizeof( data ), &ulDataLen );
+
+ if( rc == 0 )
+ {
+ /* Check for removable and for cylinders */
+ if( ( data.usDevAttr & 1 ) == 0 && data.usCylinders == 0xFFFF )
+ {
+ char psz_dvd[] = "A:";
+
+ psz_dvd[0] += i;
+
+ print_debug( dvdcss, "defaulting to drive `%s'", psz_dvd );
+ free( dvdcss->psz_device );
+ dvdcss->psz_device = strdup( psz_dvd );
+ return;
+ }
+ }
+ }
#else
for( i = 0; ppsz_devices[i]; i++ )
{
@@ -335,6 +407,18 @@ int _dvdcss_open ( dvdcss_t dvdcss )
return aspi_open( dvdcss, psz_device );
}
else
+#elif defined( SYS_OS2 )
+ /* If device is "X:" or "X:\", we are not actually opening a file. */
+ if( psz_device[0] && psz_device[1] == ':' &&
+ ( !psz_device[2] || ( psz_device[2] == '\\' && !psz_device[3] ) ) )
+ {
+ print_debug( dvdcss, "using OS2 API for access" );
+ dvdcss->pf_seek = os2_seek;
+ dvdcss->pf_read = os2_read;
+ dvdcss->pf_readv = os2_readv;
+ return os2_open( dvdcss, psz_device );
+ }
+ else
#endif
{
print_debug( dvdcss, "using libc for access" );
@@ -345,7 +429,7 @@ int _dvdcss_open ( dvdcss_t dvdcss )
}
}
-#ifndef WIN32
+#if !defined(WIN32) && !defined(SYS_OS2)
int _dvdcss_raw_open ( dvdcss_t dvdcss, char const *psz_device )
{
dvdcss->i_raw_fd = open( psz_device, 0 );
@@ -400,11 +484,13 @@ int _dvdcss_close ( dvdcss_t dvdcss )
#else
close( dvdcss->i_fd );
+#ifndef SYS_OS2
if( dvdcss->i_raw_fd >= 0 )
{
close( dvdcss->i_raw_fd );
dvdcss->i_raw_fd = -1;
}
+#endif
return 0;
#endif
@@ -417,7 +503,7 @@ int _dvdcss_close ( dvdcss_t dvdcss )
*****************************************************************************/
static int libc_open ( dvdcss_t dvdcss, char const *psz_device )
{
-#if !defined( WIN32 )
+#if !defined( WIN32 ) && !defined( SYS_OS2 )
dvdcss->i_fd = dvdcss->i_read_fd = open( psz_device, 0 );
#else
dvdcss->i_fd = dvdcss->i_read_fd = open( psz_device, O_BINARY );
@@ -444,7 +530,7 @@ static int win2k_open ( dvdcss_t dvdcss, char const *psz_device )
strcpy(psz_dvd, "cdrom0:");
#else
char psz_dvd[7];
- _snprintf( psz_dvd, 7, "\\\\.\\%c:", psz_device[0] );
+ snprintf( psz_dvd, 7, "\\\\.\\%c:", psz_device[0] );
#endif
/* To work around an M$ bug in IOCTL_DVD_READ_STRUCTURE, we need read
@@ -605,6 +691,37 @@ static int aspi_open( dvdcss_t dvdcss, char const * psz_device )
}
#endif
+#ifdef SYS_OS2
+static int os2_open ( dvdcss_t dvdcss, char const *psz_device )
+{
+ char psz_dvd[] = "X:";
+ HFILE hfile;
+ ULONG ulAction;
+ ULONG rc;
+
+ psz_dvd[0] = psz_device[0];
+
+ rc = DosOpenL( ( PSZ )psz_dvd, &hfile, &ulAction, 0, FILE_NORMAL,
+ OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW,
+ OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE | OPEN_FLAGS_DASD,
+ NULL );
+
+ if( rc )
+ {
+ print_error( dvdcss, "failed to open device" );
+ return -1;
+ }
+
+ setmode( hfile, O_BINARY );
+
+ dvdcss->i_fd = dvdcss->i_read_fd = hfile;
+
+ dvdcss->i_pos = 0;
+
+ return 0;
+}
+#endif
+
/*****************************************************************************
* Seek commands.
*****************************************************************************/
diff --git a/lib/libdvd/libdvdcss/src/device.h b/lib/libdvd/libdvdcss/src/device.h
index d8a73f0d4e..8511ad3c15 100644
--- a/lib/libdvd/libdvdcss/src/device.h
+++ b/lib/libdvd/libdvdcss/src/device.h
@@ -2,7 +2,7 @@
* device.h: DVD device access
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
- * $Id$
+ * $Id: device.h 236 2010-08-02 15:59:13Z jb $
*
* Authors: Stéphane Borel <stef@via.ecp.fr>
* Sam Hocevar <sam@zoy.org>
@@ -18,11 +18,14 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdcss; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*****************************************************************************/
+#ifndef DVDCSS_DEVICE_H
+#define DVDCSS_DEVICE_H
+
/*****************************************************************************
* iovec structure: vectored data entry
*****************************************************************************/
@@ -33,6 +36,8 @@
# include <sys/uio.h> /* struct iovec */
#endif
+#include "dvdcss/dvdcss.h"
+
#if defined( WIN32 ) && !defined( SYS_CYGWIN )
struct iovec
{
@@ -52,7 +57,8 @@ int _dvdcss_close ( dvdcss_t );
/*****************************************************************************
* Device reading prototypes, raw-device specific
*****************************************************************************/
-#ifndef WIN32
+#if !defined(WIN32) && !defined(SYS_OS2)
int _dvdcss_raw_open ( dvdcss_t, char const * );
#endif
+#endif /* DVDCSS_DEVICE_H */
diff --git a/lib/libdvd/libdvdcss/src/dvdcss/dvdcss.h b/lib/libdvd/libdvdcss/src/dvdcss/dvdcss.h
index c97f996824..0323329a33 100644
--- a/lib/libdvd/libdvdcss/src/dvdcss/dvdcss.h
+++ b/lib/libdvd/libdvdcss/src/dvdcss/dvdcss.h
@@ -10,7 +10,7 @@
/*
* Copyright (C) 1998-2008 VideoLAN
- * $Id$
+ * $Id: dvdcss.h 219 2009-02-09 00:03:47Z jb $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -22,9 +22,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdcss; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef DVDCSS_DVDCSS_H
diff --git a/lib/libdvd/libdvdcss/src/error.c b/lib/libdvd/libdvdcss/src/error.c
index 66d2b67ad4..ac190e4256 100644
--- a/lib/libdvd/libdvdcss/src/error.c
+++ b/lib/libdvd/libdvdcss/src/error.c
@@ -2,23 +2,23 @@
* error.c: error management functions
*****************************************************************************
* Copyright (C) 1998-2002 VideoLAN
- * $Id$
+ * $Id: error.c 221 2009-02-09 00:45:44Z sam $
*
* Author: Sam Hocevar <sam@zoy.org>
*
- * This program is free software; you can redistribute it and/or modify
+ * This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this library; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*****************************************************************************/
#include "config.h"
diff --git a/lib/libdvd/libdvdcss/src/ioctl.c b/lib/libdvd/libdvdcss/src/ioctl.c
index 1e5ebead8f..3fcffa2567 100644
--- a/lib/libdvd/libdvdcss/src/ioctl.c
+++ b/lib/libdvd/libdvdcss/src/ioctl.c
@@ -2,7 +2,7 @@
* ioctl.c: DVD ioctl replacement function
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id$
+ * $Id: ioctl.c 221 2009-02-09 00:45:44Z sam $
*
* Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
* Sam Hocevar <sam@zoy.org>
@@ -13,19 +13,19 @@
* Alex Strelnikov <lelik@os2.ru>
* Gildas Bazin <gbazin@netcourrier.com>
*
- * This program is free software; you can redistribute it and/or modify
+ * This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this library; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*****************************************************************************/
/*****************************************************************************
diff --git a/lib/libdvd/libdvdcss/src/ioctl.h b/lib/libdvd/libdvdcss/src/ioctl.h
index b1ea287b0a..fa1361efc8 100644
--- a/lib/libdvd/libdvdcss/src/ioctl.h
+++ b/lib/libdvd/libdvdcss/src/ioctl.h
@@ -2,7 +2,7 @@
* ioctl.h: DVD ioctl replacement function
*****************************************************************************
* Copyright (C) 1999-2001 VideoLAN
- * $Id$
+ * $Id: ioctl.h 235 2010-08-02 15:41:14Z jb $
*
* Authors: Sam Hocevar <sam@zoy.org>
*
@@ -16,11 +16,14 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdcss; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*****************************************************************************/
+#ifndef DVDCSS_IOCTL_H
+#define DVDCSS_IOCTL_H
+
int ioctl_ReadCopyright ( int, int, int * );
int ioctl_ReadDiscKey ( int, int *, uint8_t * );
int ioctl_ReadTitleKey ( int, int *, int, uint8_t * );
@@ -321,7 +324,7 @@ typedef struct SCSI_PASS_THROUGH_DIRECT
typedef DWORD (CALLBACK *GETASPI32SUPPORTINFO)(VOID);
typedef DWORD (CALLBACK *SENDASPI32COMMAND)(LPVOID);
-#if defined(_XBOX) || defined(WIN32)
+#if defined(_XBOX)
#define WIN2K 1
#else
#define WIN2K ( GetVersion() < 0x80000000 )
@@ -431,3 +434,5 @@ struct OS2_ExecSCSICmd
#pragma pack()
#endif
+
+#endif /* DVDCSS_IOCTL_H */
diff --git a/lib/libdvd/libdvdcss/src/libdvdcss.c b/lib/libdvd/libdvdcss/src/libdvdcss.c
index 49bccf3b4b..8ae9111f60 100644
--- a/lib/libdvd/libdvdcss/src/libdvdcss.c
+++ b/lib/libdvd/libdvdcss/src/libdvdcss.c
@@ -5,21 +5,21 @@
* HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>
*
* Copyright (C) 1998-2008 VideoLAN
- * $Id$
+ * $Id: libdvdcss.c 237 2010-09-25 14:21:47Z reimar $
*
- * This program is free software; you can redistribute it and/or modify
+ * This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this library; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/**
@@ -166,7 +166,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
char *psz_method = getenv( "DVDCSS_METHOD" );
char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
char *psz_cache = getenv( "DVDCSS_CACHE" );
-#ifndef WIN32
+#if !defined(WIN32) && !defined(SYS_OS2)
char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );
#endif
@@ -184,7 +184,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
/*
* Initialize structure with default values
*/
-#ifndef WIN32
+#if !defined(WIN32) && !defined(SYS_OS2)
dvdcss->i_raw_fd = -1;
#endif
dvdcss->p_titles = NULL;
@@ -310,7 +310,25 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
/* Cache our keys in ${HOME}/.dvdcss/ */
if( psz_home )
{
- snprintf( psz_buffer, PATH_MAX, "%s/.dvdcss", psz_home );
+ int home_pos = 0;
+
+#ifdef SYS_OS2
+ if( *psz_home == '/' || *psz_home == '\\')
+ {
+ char *psz_unixroot = getenv("UNIXROOT");
+
+ if( psz_unixroot &&
+ psz_unixroot[0] &&
+ psz_unixroot[1] == ':' &&
+ psz_unixroot[2] == '\0')
+ {
+ strcpy( psz_buffer, psz_unixroot );
+ home_pos = 2;
+ }
+ }
+#endif
+ snprintf( psz_buffer + home_pos, PATH_MAX - home_pos,
+ "%s/.dvdcss", psz_home );
psz_buffer[PATH_MAX-1] = '\0';
psz_cache = psz_buffer;
}
@@ -353,7 +371,14 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
if( dvdcss->b_ioctls )
{
i_ret = _dvdcss_test( dvdcss );
- if( i_ret < 0 )
+
+ if( i_ret == -3 )
+ {
+ print_debug( dvdcss, "scrambled disc on a region-free RPC-II "
+ "drive: possible failure, but continuing "
+ "anyway" );
+ }
+ else if( i_ret < 0 )
{
/* Disable the CSS ioctls and hope that it works? */
print_debug( dvdcss,
@@ -369,7 +394,6 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
}
/* if wo don't have b_ioctls, we don't have a disk key, make sure area is nulled */
memset( dvdcss->css.p_disc_key, 0, KEY_SIZE );
-
/* If disc is CSS protected and the ioctls work, authenticate the drive */
if( dvdcss->b_scrambled && dvdcss->b_ioctls )
{
@@ -380,10 +404,6 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
print_debug( dvdcss, "could not get disc key" );
}
}
- else
- {
- memset( dvdcss->css.p_disc_key, 0, KEY_SIZE );
- }
/* If the cache is enabled, write the cache directory tag */
if( psz_cache )
@@ -408,7 +428,6 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
if( psz_cache )
{
uint8_t p_sector[DVDCSS_BLOCK_SIZE];
- char psz_debug[PATH_MAX + 30];
char psz_key[1 + KEY_SIZE * 2 + 1];
char *psz_title;
uint8_t *psz_serial;
@@ -554,13 +573,12 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
/* Pointer to the filename we will use. */
dvdcss->psz_block = dvdcss->psz_cachefile + i;
- sprintf( psz_debug, "using CSS key cache dir: %s",
+ print_debug( dvdcss, "using CSS key cache dir: %s",
dvdcss->psz_cachefile );
- print_debug( dvdcss, "%s", psz_debug );
}
nocache:
-#ifndef WIN32
+#if !defined(WIN32) && !defined(SYS_OS2)
if( psz_raw_device != NULL )
{
_dvdcss_raw_open( dvdcss, psz_raw_device );
diff --git a/lib/libdvd/libdvdcss/src/libdvdcss.h b/lib/libdvd/libdvdcss/src/libdvdcss.h
index 80f78c3062..6171c35e75 100644
--- a/lib/libdvd/libdvdcss/src/libdvdcss.h
+++ b/lib/libdvd/libdvdcss/src/libdvdcss.h
@@ -2,7 +2,7 @@
* libdvdcss.h: private DVD reading library data
*****************************************************************************
* Copyright (C) 1998-2001 VideoLAN
- * $Id$
+ * $Id: libdvdcss.h 240 2011-03-23 15:00:06Z jb $
*
* Authors: Stéphane Borel <stef@via.ecp.fr>
* Sam Hocevar <sam@zoy.org>
@@ -17,11 +17,17 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdcss; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*****************************************************************************/
+#ifndef DVDCSS_LIBDVDCSS_H
+#define DVDCSS_LIBDVDCSS_H
+
+#include "dvdcss/dvdcss.h"
+#include "css.h"
+
struct iovec;
/*****************************************************************************
@@ -62,7 +68,7 @@ struct dvdcss_s
int i_readv_buf_size;
#endif
-#ifndef WIN32
+#if !defined(WIN32) && !defined(SYS_OS2)
int i_raw_fd;
#endif
};
@@ -102,3 +108,4 @@ __forceinline void print_debug(dvdcss_t dvdcss, const char *msg,...)
void _print_error ( dvdcss_t, char * );
+#endif /* DVDCSS_LIBDVDCSS_H */
diff --git a/lib/libdvd/libdvdnav/ChangeLog b/lib/libdvd/libdvdnav/ChangeLog
index 46b43d0fa7..c038ef11be 100644
--- a/lib/libdvd/libdvdnav/ChangeLog
+++ b/lib/libdvd/libdvdnav/ChangeLog
@@ -1,3 +1,16 @@
+libdvdnav (4.2.0)
+ * OS/2 support
+ * added dvdnav_get_serial_string() function
+ * fixed ifo leak in dvdnav_describe_chapters()
+ * added dvdnav_get_video_resolution() to retrieve video resolution
+ * added dvdnav_program_play() & dvdnav_current_title_program() for
+ more reliable playback
+ * fixed deadlock between dvdnav_reset() and dvd_clear()
+ * fixed pthread_mutex_destroy macro for Win32
+ * fixed numerous assertion failures occuring when playing DVDs with
+ new "copy protection" schemes
+ * fixed forward seeks to always move forward
+
libdvdnav (4.1.3)
* an embarassing amount of fixes regarding potential memory and resource leaks
(patches contributed by Erik Hovland)
diff --git a/lib/libdvd/libdvdnav/Makefile b/lib/libdvd/libdvdnav/Makefile
index 85245b7a4d..ded87cd7e3 100644
--- a/lib/libdvd/libdvdnav/Makefile
+++ b/lib/libdvd/libdvdnav/Makefile
@@ -12,11 +12,11 @@ SRCS = dvdnav.c highlight.c navigation.c read_cache.c remap.c searching.c settin
VPATH+= $(SRC_PATH_BARE)/src/vm
SRCS+= decoder.c vm.c vmcmd.c
-HEADERS = src/dvd_types.h src/dvdnav.h src/dvdnav_events.h
+HEADERS = src/dvdnav/dvd_types.h src/dvdnav/dvdnav.h src/dvdnav/dvdnav_events.h
CFLAGS += $(USEDEBUG) -Wall -funsigned-char
CFLAGS += -I$(CURDIR) -I$(SRC_PATH)/src -I$(SRC_PATH)/src/vm
-CFLAGS += -DDVDNAV_COMPILE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
+CFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
CFLAGS += -DHAVE_CONFIG_H -DHAVE_DLFCN_H
L=libdvdnav
diff --git a/lib/libdvd/libdvdnav/README b/lib/libdvd/libdvdnav/README
index d7f78d48a2..de3422c849 100644
--- a/lib/libdvd/libdvdnav/README
+++ b/lib/libdvd/libdvdnav/README
@@ -26,7 +26,7 @@ from xine-dvdnav and went into the first version of libdvdnav.
Where is it now?
----------------
-libdvdnav is hosted on http://www.mplayerhq.hu/MPlayer/releases/dvdnav/ .
+libdvdnav is hosted at http://dvdnav.mplayerhq.hu/ .
Please report bugs to the developers mailinglist at
mailto:dvdnav-discuss@mplayerhq.hu .
diff --git a/lib/libdvd/libdvdnav/autogen.sh b/lib/libdvd/libdvdnav/autogen.sh
index 6ffc84e710..077b682d49 100755
--- a/lib/libdvd/libdvdnav/autogen.sh
+++ b/lib/libdvd/libdvdnav/autogen.sh
@@ -1,7 +1,5 @@
#!/bin/sh
#
-# $Id: autogen.sh 1091 2008-06-08 06:37:22Z nicodvb $
-#
# run this to generate all the initial makefiles, etc.
srcdir=`dirname "$0"`
diff --git a/lib/libdvd/libdvdnav/configure.ac b/lib/libdvd/libdvdnav/configure.ac
index e76fa25b8f..20acae17e8 100644
--- a/lib/libdvd/libdvdnav/configure.ac
+++ b/lib/libdvd/libdvdnav/configure.ac
@@ -13,8 +13,8 @@ dnl
dnl These are defined in m4 so they can be passed to AC_INIT
dnl --------------------------------------------------------------
m4_define([dvdnav_major], [4])
-m4_define([dvdnav_minor], [1])
-m4_define([dvdnav_sub], [3])
+m4_define([dvdnav_minor], [2])
+m4_define([dvdnav_sub], [0])
m4_define([dvdnav_pre], [])
AC_INIT([libdvdnav], [dvdnav_major.dvdnav_minor.dvdnav_sub[]dvdnav_pre])
@@ -165,6 +165,9 @@ case $host in
*cygwin*)
LDFLAGS="-no-undefined $LDFLAGS"
;;
+ *os2*)
+ LDFLAGS="-no-undefined -Zbin-files $LDFLAGS"
+ ;;
*)
AC_CHECK_LIB(c, dlopen,
DYNAMIC_LD_LIBS="",
@@ -204,26 +207,6 @@ DEBUG_CFLAGS="-g -DDEBUG $CFLAGS"
AC_SUBST(DEBUG_CFLAGS)
dnl ---------------------------------------------
-dnl Get where .m4 should be installed.
-dnl ---------------------------------------------
-case "`id`" in
- uid=0\(* )
- AC_MSG_CHECKING(for aclocal directory)
- if (aclocal --version) < /dev/null > /dev/null 2>&1; then
- ACLOCAL_DIR="`eval $ACLOCAL --print-ac-dir`"
- AC_MSG_RESULT($ACLOCAL_DIR)
- else
- ACLOCAL_DIR="/usr/local/share/aclocal"
- AC_MSG_RESULT(none - will be installed in $ACLOCAL_DIR)
- fi
- escapedprefix="`echo $prefix | sed -e 's/\\//\\\\\//g'`"
- ACLOCAL_DIR="`echo $ACLOCAL_DIR|sed -e 's/^'$escapedprefix/'\${prefix}'/`"
- AC_SUBST(ACLOCAL_DIR)
- ;;
-esac
-AM_CONDITIONAL(INSTALL_M4, test x"$ACLOCAL_DIR" != "x")
-
-dnl ---------------------------------------------
dnl Check for doxygen (dynamic documentation generator)
dnl ---------------------------------------------
AC_CHECK_PROG(DOXYGEN, doxygen, doxygen, no)
diff --git a/lib/libdvd/libdvdnav/configure2 b/lib/libdvd/libdvdnav/configure2
index 5767a5ab94..8c3b917c2b 100755
--- a/lib/libdvd/libdvdnav/configure2
+++ b/lib/libdvd/libdvdnav/configure2
@@ -1,6 +1,6 @@
#!/bin/sh
-dvdnav_sh_version=4.1.3
+dvdnav_sh_version=4.2.0
dvdnav_sh_major=`echo $dvdnav_sh_version | awk -F. '{print $1}'`
cc=gcc
diff --git a/lib/libdvd/libdvdnav/examples/menus.c b/lib/libdvd/libdvdnav/examples/menus.c
index 5f83005576..3e454ff2ee 100644
--- a/lib/libdvd/libdvdnav/examples/menus.c
+++ b/lib/libdvd/libdvdnav/examples/menus.c
@@ -13,12 +13,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: menus.c 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <stdio.h>
@@ -27,12 +24,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
-#include "dvd_types.h"
-#include <dvdread/dvd_reader.h>
-#include <dvdread/nav_types.h>
-#include <dvdread/ifo_types.h> /* For vm_cmd_t */
-#include "dvdnav.h"
-#include "dvdnav_events.h"
+#include <dvdnav/dvdnav.h>
/* shall we use libdvdnav's read ahead cache? */
#define DVD_READ_CACHE 1
@@ -51,9 +43,14 @@ int main(int argc, char **argv) {
int output_fd = 0;
int dump = 0, tt_dump = 0;
+ if (argc < 2) {
+ printf("Specify DVD device.\n");
+ return 1;
+ }
+
/* open dvdnav handle */
printf("Opening DVD...\n");
- if (dvdnav_open(&dvdnav, "/dev/dvd") != DVDNAV_STATUS_OK) {
+ if (dvdnav_open(&dvdnav, argv[1]) != DVDNAV_STATUS_OK) {
printf("Error on dvdnav_open\n");
return 1;
}
diff --git a/lib/libdvd/libdvdnav/m4/Makefile.am b/lib/libdvd/libdvdnav/m4/Makefile.am
index fdcb9410e4..7f444b1c89 100644
--- a/lib/libdvd/libdvdnav/m4/Makefile.am
+++ b/lib/libdvd/libdvdnav/m4/Makefile.am
@@ -2,10 +2,6 @@ include $(top_srcdir)/misc/Makefile.common
EXTRA_DIST = dvdnav.m4
-if INSTALL_M4
-m4datadir = @ACLOCAL_DIR@
-else
m4datadir = $(datadir)/aclocal
-endif
m4data_DATA = dvdnav.m4
diff --git a/lib/libdvd/libdvdnav/msvc/config.h b/lib/libdvd/libdvdnav/msvc/config.h
index c6c6f94dc3..25f68fbef1 100755
--- a/lib/libdvd/libdvdnav/msvc/config.h
+++ b/lib/libdvd/libdvdnav/msvc/config.h
@@ -1,5 +1,8 @@
/* config.h. Generated by hand. */
+#ifndef LIBDVNAV_CONFIG_H
+#define LIBDVNAV_CONFIG_H
+
#define HAVE_DLFCN_H 1
/* #undef HAVE_DVDCSS_DVDCSS_H*/
/* #undef HAVE_INTTYPES_H */
@@ -49,3 +52,5 @@ typedef signed int int32_t;
typedef unsigned __int64 uint64_t;
typedef signed __int64 int64_t;
typedef unsigned int uintptr_t;
+
+#endif /* LIBDVNAV_CONFIG_H */
diff --git a/lib/libdvd/libdvdnav/msvc/contrib/dlfcn.c b/lib/libdvd/libdvdnav/msvc/contrib/dlfcn.c
index 3eb996bd13..3a00045057 100755
--- a/lib/libdvd/libdvdnav/msvc/contrib/dlfcn.c
+++ b/lib/libdvd/libdvdnav/msvc/contrib/dlfcn.c
@@ -1,7 +1,4 @@
/*
- * $Id: dlfcn.c 1135 2008-09-06 21:55:51Z rathann $
- * $Name$
- *
* Adopted from Apache DSO code.
* Portions copyright Apache Software Foundation
*
diff --git a/lib/libdvd/libdvdnav/msvc/contrib/getopt.c b/lib/libdvd/libdvdnav/msvc/contrib/getopt.c
index 4b3ce3db40..b4634e10a2 100755
--- a/lib/libdvd/libdvdnav/msvc/contrib/getopt.c
+++ b/lib/libdvd/libdvdnav/msvc/contrib/getopt.c
@@ -21,8 +21,8 @@
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ Floor, Boston, MA 02110-1301 USA. */
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
Ditto for AIX 3.2 and <stdlib.h>. */
diff --git a/lib/libdvd/libdvdnav/msvc/contrib/timer/timer.c b/lib/libdvd/libdvdnav/msvc/contrib/timer/timer.c
index 60efe86db9..f99a73b3ed 100755
--- a/lib/libdvd/libdvdnav/msvc/contrib/timer/timer.c
+++ b/lib/libdvd/libdvdnav/msvc/contrib/timer/timer.c
@@ -14,8 +14,8 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* WIN32 PORT,
* by Matthew Grooms <elon@altavista.com>
diff --git a/lib/libdvd/libdvdnav/msvc/include/dlfcn.h b/lib/libdvd/libdvdnav/msvc/include/dlfcn.h
index 7a2416c843..b5fe376c34 100755
--- a/lib/libdvd/libdvdnav/msvc/include/dlfcn.h
+++ b/lib/libdvd/libdvdnav/msvc/include/dlfcn.h
@@ -1,11 +1,6 @@
#ifndef __DLFCN_H__
# define __DLFCN_H__
-/*
- * $Id: dlfcn.h 1135 2008-09-06 21:55:51Z rathann $
- * $Name$
- *
- *
- */
+
extern void *dlopen (const char *file, int mode);
extern int dlclose (void *handle);
extern void *dlsym (void * handle, const char * name);
diff --git a/lib/libdvd/libdvdnav/msvc/include/dvdnav_internal.h b/lib/libdvd/libdvdnav/msvc/include/dvdnav_internal.h
index cee785472e..72f8393faf 100644
--- a/lib/libdvd/libdvdnav/msvc/include/dvdnav_internal.h
+++ b/lib/libdvd/libdvdnav/msvc/include/dvdnav_internal.h
@@ -14,16 +14,13 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: dvdnav_internal.h 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef DVDNAV_INTERNAL_H_INCLUDED
-#define DVDNAV_INTERNAL_H_INCLUDED
+#ifndef LIBDVDNAV_DVDNAV_INTERNAL_H
+#define LIBDVDNAV_DVDNAV_INTERNAL_H
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -182,4 +179,4 @@ struct dvdnav_s {
#define S_OK DVDNAV_STATUS_OK
#endif /* MSC_VER */
-#endif /* DVDNAV_INTERNAL_H_INCLUDED */
+#endif /* LIBDVDNAV_DVDNAV_INTERNAL_H */
diff --git a/lib/libdvd/libdvdnav/msvc/include/getopt.h b/lib/libdvd/libdvdnav/msvc/include/getopt.h
index 2fa12f7baf..5f4643aa9c 100755
--- a/lib/libdvd/libdvdnav/msvc/include/getopt.h
+++ b/lib/libdvd/libdvdnav/msvc/include/getopt.h
@@ -16,8 +16,8 @@
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ Floor, Boston, MA 02110-1301 USA. */
#ifndef _GETOPT_H
#define _GETOPT_H 1
diff --git a/lib/libdvd/libdvdnav/msvc/include/inttypes.h b/lib/libdvd/libdvdnav/msvc/include/inttypes.h
index 55fd6a33e0..4e1cbe1efe 100755
--- a/lib/libdvd/libdvdnav/msvc/include/inttypes.h
+++ b/lib/libdvd/libdvdnav/msvc/include/inttypes.h
@@ -14,8 +14,8 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* WIN32 PORT,
* by Matthew Grooms <elon@altavista.com>
diff --git a/lib/libdvd/libdvdnav/msvc/include/os_types.h b/lib/libdvd/libdvdnav/msvc/include/os_types.h
index 69f05a8d93..294847ea3f 100755
--- a/lib/libdvd/libdvdnav/msvc/include/os_types.h
+++ b/lib/libdvd/libdvdnav/msvc/include/os_types.h
@@ -1,9 +1,6 @@
#ifndef __OS_TYPES_H__
#define __OS_TYPES_H__
/*
- * $Id: os_types.h 1135 2008-09-06 21:55:51Z rathann $
- * $Name$
- *
* win32 types
* 04 Sept 2001 - Chris Wolf create.
*/
diff --git a/lib/libdvd/libdvdnav/msvc/include/pthreads/pthread.h b/lib/libdvd/libdvdnav/msvc/include/pthreads/pthread.h
index 7b89ca8401..9f6fae54fa 100755
--- a/lib/libdvd/libdvdnav/msvc/include/pthreads/pthread.h
+++ b/lib/libdvd/libdvdnav/msvc/include/pthreads/pthread.h
@@ -15,8 +15,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA.
*/
#if !defined( PTHREAD_H )
diff --git a/lib/libdvd/libdvdnav/msvc/include/pthreads/sched.h b/lib/libdvd/libdvdnav/msvc/include/pthreads/sched.h
index ab277920e0..d7596b292d 100755
--- a/lib/libdvd/libdvdnav/msvc/include/pthreads/sched.h
+++ b/lib/libdvd/libdvdnav/msvc/include/pthreads/sched.h
@@ -22,8 +22,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA.
*/
#ifndef _SCHED_H
#define _SCHED_H
diff --git a/lib/libdvd/libdvdnav/msvc/include/sys/time.h b/lib/libdvd/libdvdnav/msvc/include/sys/time.h
index f874fa655f..843e252c66 100755
--- a/lib/libdvd/libdvdnav/msvc/include/sys/time.h
+++ b/lib/libdvd/libdvdnav/msvc/include/sys/time.h
@@ -14,8 +14,8 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* WIN32 PORT,
* by Matthew Grooms <elon@altavista.com>
diff --git a/lib/libdvd/libdvdnav/msvc/include/unistd.h b/lib/libdvd/libdvdnav/msvc/include/unistd.h
index 7e4c63f3a5..2f3c4587ed 100755
--- a/lib/libdvd/libdvdnav/msvc/include/unistd.h
+++ b/lib/libdvd/libdvdnav/msvc/include/unistd.h
@@ -14,8 +14,8 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* WIN32 PORT,
* by Matthew Grooms <elon@altavista.com>
diff --git a/lib/libdvd/libdvdnav/src/Makefile.am b/lib/libdvd/libdvdnav/src/Makefile.am
index c39b2e7bec..c7502a3751 100644
--- a/lib/libdvd/libdvdnav/src/Makefile.am
+++ b/lib/libdvd/libdvdnav/src/Makefile.am
@@ -4,7 +4,7 @@ SUBDIRS = vm
includedir = ${prefix}/include/dvdnav
-AM_CPPFLAGS = -DDVDNAV_COMPILE $(THREAD_CFLAGS) $(DVDREAD_CFLAGS) \
+AM_CPPFLAGS = $(THREAD_CFLAGS) $(DVDREAD_CFLAGS) \
-I$(top_srcdir)/src/vm
EXTRA_DIST = README.MAP FELLOWSHIP.map
@@ -31,4 +31,4 @@ libdvdnavmini_la_LIBADD = $(THREAD_LIBS) \
libdvdnavmini_la_LDFLAGS = $(libdvdnav_la_LDFLAGS)
-include_HEADERS = dvdnav.h dvdnav_events.h dvd_types.h
+include_HEADERS = dvdnav/dvdnav.h dvdnav/dvdnav_events.h dvdnav/dvd_types.h
diff --git a/lib/libdvd/libdvdnav/src/dvdnav.c b/lib/libdvd/libdvdnav/src/dvdnav.c
index 5af111ca06..b10b61ef2f 100644
--- a/lib/libdvd/libdvdnav/src/dvdnav.c
+++ b/lib/libdvd/libdvdnav/src/dvdnav.c
@@ -13,12 +13,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: dvdnav.c 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef HAVE_CONFIG_H
@@ -36,15 +33,13 @@
#include <limits.h>
#include <string.h>
#include <sys/time.h>
-#include "dvd_types.h"
+#include "dvdnav/dvdnav.h"
#include <dvdread/dvd_reader.h>
#include <dvdread/nav_types.h>
#include <dvdread/ifo_types.h> /* For vm_cmd_t */
#include "remap.h"
#include "vm/decoder.h"
#include "vm/vm.h"
-#include "dvdnav.h"
-#include "dvdnav_events.h"
#include "dvdnav_internal.h"
#include "read_cache.h"
#include <dvdread/nav_read.h>
@@ -57,12 +52,12 @@ static dvdnav_status_t dvdnav_clear(dvdnav_t * this) {
if (this->file) DVDCloseFile(this->file);
this->file = NULL;
+ memset(&this->position_current,0,sizeof(this->position_current));
memset(&this->pci,0,sizeof(this->pci));
memset(&this->dsi,0,sizeof(this->dsi));
this->last_cmd_nav_lbn = SRI_END_OF_CELL;
/* Set initial values of flags */
- this->position_current.still = 0;
this->skip_still = 0;
this->sync_wait = 0;
this->sync_wait_skip = 0;
@@ -183,9 +178,9 @@ dvdnav_status_t dvdnav_reset(dvdnav_t *this) {
#ifdef LOG_DEBUG
fprintf(MSG_OUT, "libdvdnav: clearing dvdnav\n");
#endif
+ pthread_mutex_unlock(&this->vm_lock);
result = dvdnav_clear(this);
- pthread_mutex_unlock(&this->vm_lock);
return result;
}
@@ -674,7 +669,7 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, uint8_t **buf,
fprintf(MSG_OUT, "libdvdnav: SPU_CLUT_CHANGE\n");
#endif
(*len) = 16 * sizeof(uint32_t);
- memcpy(*buf, state->pgc->palette, 16 * sizeof(uint32_t));
+ memcpy(*buf, &(state->pgc->palette), 16 * sizeof(uint32_t));
this->spu_clut_changed = 0;
pthread_mutex_unlock(&this->vm_lock);
return DVDNAV_STATUS_OK;
@@ -848,6 +843,11 @@ dvdnav_status_t dvdnav_get_title_string(dvdnav_t *this, const char **title_str)
return DVDNAV_STATUS_OK;
}
+dvdnav_status_t dvdnav_get_serial_string(dvdnav_t *this, const char **serial_str) {
+ (*serial_str) = this->vm->dvd_serial;
+ return DVDNAV_STATUS_OK;
+}
+
uint8_t dvdnav_get_video_aspect(dvdnav_t *this) {
uint8_t retval;
@@ -862,6 +862,22 @@ uint8_t dvdnav_get_video_aspect(dvdnav_t *this) {
return retval;
}
+int dvdnav_get_video_resolution(dvdnav_t *this, uint32_t *width, uint32_t *height) {
+ int w, h;
+
+ if(!this->started) {
+ printerr("Virtual DVD machine not started.");
+ return -1;
+ }
+
+ pthread_mutex_lock(&this->vm_lock);
+ vm_get_video_res(this->vm, &w, &h);
+ pthread_mutex_unlock(&this->vm_lock);
+
+ *width = w;
+ *height = h;
+ return 0;
+}
uint8_t dvdnav_get_video_scale_permission(dvdnav_t *this) {
uint8_t retval;
@@ -1164,7 +1180,7 @@ user_ops_t dvdnav_get_restrictions(dvdnav_t* this) {
union {
user_ops_t ops_struct;
uint32_t ops_int;
- } ops, tmp;
+ } ops;
ops.ops_int = 0;
@@ -1178,13 +1194,10 @@ user_ops_t dvdnav_get_restrictions(dvdnav_t* this) {
}
pthread_mutex_lock(&this->vm_lock);
- tmp.ops_struct = this->pci.pci_gi.vobu_uop_ctl;
- ops.ops_int |= tmp.ops_int;
+ ops.ops_int |= *(uint32_t*)&this->pci.pci_gi.vobu_uop_ctl;
- if(this->vm && this->vm->state.pgc) {
- tmp.ops_struct = this->vm->state.pgc->prohibited_ops;
- ops.ops_int |= tmp.ops_int;
- }
+ if(this->vm && this->vm->state.pgc)
+ ops.ops_int |= *(uint32_t*)&this->vm->state.pgc->prohibited_ops;
pthread_mutex_unlock(&this->vm_lock);
return ops.ops_struct;
diff --git a/lib/libdvd/libdvdnav/src/dvd_types.h b/lib/libdvd/libdvdnav/src/dvdnav/dvd_types.h
index 43c21c9674..08b46d385b 100644
--- a/lib/libdvd/libdvdnav/src/dvd_types.h
+++ b/lib/libdvd/libdvdnav/src/dvdnav/dvd_types.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2001 Björn Englund, Håkan Hjort
+ * Copyright (C) 2000, 2001 Björn Englund, Håkan Hjort
*
* This file is part of libdvdnav, a DVD navigation library. It is a modified
* file originally part of the Ogle DVD player project.
@@ -14,20 +14,17 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: dvd_types.h 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* Various useful structs and enums for DVDs.
*/
-#ifndef DVD_H_INCLUDED
-#define DVD_H_INCLUDED
+#ifndef LIBDVDNAV_DVD_TYPES_H
+#define LIBDVDNAV_DVD_TYPES_H
/*
* DVD Menu ID
@@ -275,4 +272,4 @@ typedef int DVDVideoCompression_t;
#endif
-#endif /* DVD_H_INCLUDED */
+#endif /* LIBDVDNAV_DVD_TYPES_H */
diff --git a/lib/libdvd/libdvdnav/src/dvdnav.h b/lib/libdvd/libdvdnav/src/dvdnav/dvdnav.h
index 0a6d5db2cc..7f3e86922b 100644
--- a/lib/libdvd/libdvdnav/src/dvdnav.h
+++ b/lib/libdvd/libdvdnav/src/dvdnav/dvdnav.h
@@ -13,12 +13,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: dvdnav.h 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
@@ -26,8 +23,8 @@
* to access dvdnav functionality.
*/
-#ifndef DVDNAV_H_INCLUDED
-#define DVDNAV_H_INCLUDED
+#ifndef LIBDVDNAV_DVDNAV_H
+#define LIBDVDNAV_DVDNAV_H
#define MP_DVDNAV 1
@@ -35,13 +32,11 @@
extern "C" {
#endif
-#ifndef DVDNAV_COMPILE
# include <dvdnav/dvd_types.h>
# include <dvdread/dvd_reader.h>
# include <dvdread/nav_types.h>
# include <dvdread/ifo_types.h> /* For vm_cmd_t */
# include <dvdnav/dvdnav_events.h>
-#endif
@@ -185,7 +180,7 @@ dvdnav_status_t dvdnav_get_PGC_positioning_flag(dvdnav_t *self, int32_t *pgc_bas
*********************************************************************/
/*
- * These functions are used to poll the playback enginge and actually get data
+ * These functions are used to poll the playback engine and actually get data
* off the DVD.
*/
@@ -209,7 +204,7 @@ dvdnav_status_t dvdnav_get_next_block(dvdnav_t *self, uint8_t *buf,
/*
* This basically does the same as dvdnav_get_next_block. The only difference is
* that it avoids a memcopy, when the requested block was found in the cache.
- * I such a case (cache hit) this function will return a different pointer than
+ * In such a case (cache hit) this function will return a different pointer than
* the one handed in, pointing directly into the relevant block in the cache.
* Those pointers must _never_ be freed but instead returned to the library via
* dvdnav_free_cache_block().
@@ -284,6 +279,11 @@ dvdnav_status_t dvdnav_title_play(dvdnav_t *self, int32_t title);
dvdnav_status_t dvdnav_part_play(dvdnav_t *self, int32_t title, int32_t part);
/*
+ * Plays the specified title, starting from the specified program
+ */
+dvdnav_status_t dvdnav_program_play(dvdnav_t *this, int32_t title, int32_t pgcn, int32_t pgn);
+
+/*
* Stores in *times an array (that the application *must* free) of
* dvdtimes corresponding to the chapter times for the chosen title.
* *duration will have the duration of the title
@@ -318,13 +318,20 @@ dvdnav_status_t dvdnav_menu_call(dvdnav_t *self, DVDMenuID_t menu);
/*
* Return the title number and part currently being played.
- * A title of 0 indicates, we are in a menu. In this case, part
+ * A title of 0 indicates we are in a menu. In this case, part
* is set to the current menu's ID.
*/
dvdnav_status_t dvdnav_current_title_info(dvdnav_t *self, int32_t *title,
int32_t *part);
/*
+ * Return the title number, pgcn and pgn currently being played.
+ * A title of 0 indicates, we are in a menu.
+ */
+dvdnav_status_t dvdnav_current_title_program(dvdnav_t *self, int32_t *title,
+ int32_t *pgcn, int32_t *pgn);
+
+/*
* Return the current position (in blocks) within the current
* title and the length (in blocks) of said title.
*
@@ -353,7 +360,7 @@ dvdnav_status_t dvdnav_part_search(dvdnav_t *self, int32_t part);
* VOBU boundary before the given sector. The sector number is not
* meant to be an absolute physical DVD sector, but a relative sector
* in the current program. This function cannot leave the current
- * program and will fail, if asked to do so.
+ * program and will fail if asked to do so.
*
* If program chain based positioning is enabled
* (see dvdnav_set_PGC_positioning_flag()), this will seek to the relative
@@ -382,7 +389,7 @@ dvdnav_status_t dvdnav_time_search(dvdnav_t *self,
/*
* Stop playing current position and play the "GoUp"-program chain.
- * (which generally leads to the title menu or a higer-level menu).
+ * (which generally leads to the title menu or a higher-level menu).
*/
dvdnav_status_t dvdnav_go_up(dvdnav_t *self);
@@ -422,12 +429,12 @@ dvdnav_status_t dvdnav_get_position(dvdnav_t *self, uint32_t *pos,
/*
* Most functions related to highlights take a NAV PCI packet as a parameter.
- * While you can get the such a packet from libdvdnav, for players with internal
- * FIFOs, this will result in errors, because due to the FIFO length, libdvdnav will
- * be ahead in the stream compared to what the user is seeing on screen.
- * Therefore, player applications who have a NAV packet available, which is
- * better in sync with the actual playback should always pass this one to these
- * functions.
+ * While you can get such a packet from libdvdnav, this will result in
+ * errors for players with internal FIFOs because due to the FIFO length,
+ * libdvdnav will be ahead in the stream compared to what the user is
+ * seeing on screen. Therefore, player applications who have a NAV
+ * packet available, which is better in sync with the actual playback,
+ * should always pass this one to these functions.
*/
/*
@@ -484,7 +491,7 @@ dvdnav_status_t dvdnav_button_select(dvdnav_t *self, pci_t *pci, int32_t button)
dvdnav_status_t dvdnav_button_select_and_activate(dvdnav_t *self, pci_t *pci, int32_t button);
/*
- * Activate (press) a button and execute specified command.
+ * Activate ("press") a button and execute specified command.
*/
dvdnav_status_t dvdnav_button_activate_cmd(dvdnav_t *self, int32_t button, vm_cmd_t *cmd);
@@ -534,7 +541,7 @@ dvdnav_status_t dvdnav_spu_language_select(dvdnav_t *self,
/*
* Return a string describing the title of the DVD.
* This is an ID string encoded on the disc by the author. In many cases
- * this is a descriptive string such as `THE_MATRIX' but sometimes is sigularly
+ * this is a descriptive string such as `THE_MATRIX' but sometimes is singularly
* uninformative such as `PDVD-011421'. Some DVD authors even forget to set this,
* so you may also read the default of the authoring software they used, like
* `DVDVolume'.
@@ -542,6 +549,13 @@ dvdnav_status_t dvdnav_spu_language_select(dvdnav_t *self,
dvdnav_status_t dvdnav_get_title_string(dvdnav_t *self, const char **title_str);
/*
+ * Returns a string containing the serial number of the DVD.
+ * This has a max of 15 characters and should be more unique than the
+ * title string.
+ */
+dvdnav_status_t dvdnav_get_serial_string(dvdnav_t *self, const char **serial_str);
+
+/*
* Get video aspect code.
* The aspect code does only change on VTS boundaries.
* See the DVDNAV_VTS_CHANGE event.
@@ -551,6 +565,11 @@ dvdnav_status_t dvdnav_get_title_string(dvdnav_t *self, const char **title_str);
uint8_t dvdnav_get_video_aspect(dvdnav_t *self);
/*
+ * Get video resolution.
+ */
+int dvdnav_get_video_resolution(dvdnav_t *self, uint32_t *width, uint32_t *height);
+
+/*
* Get video scaling permissions.
* The scaling permission does only change on VTS boundaries.
* See the DVDNAV_VTS_CHANGE event.
@@ -572,7 +591,7 @@ uint16_t dvdnav_audio_stream_to_lang(dvdnav_t *self, uint8_t stream);
uint16_t dvdnav_audio_stream_format(dvdnav_t *self, uint8_t stream);
/*
- * Returns number of channelsn in *logical* audio stream 'stream'
+ * Returns number of channels in *logical* audio stream 'stream'
* (returns 0xffff if no such stream).
*/
uint16_t dvdnav_audio_stream_channels(dvdnav_t *self, uint8_t stream);
@@ -641,7 +660,7 @@ user_ops_t dvdnav_get_restrictions(dvdnav_t *self);
*/
/*
- * Sets the current angle. If you try to follow a non existant angle
+ * Sets the current angle. If you try to follow a non existent angle
* the call fails.
*/
dvdnav_status_t dvdnav_angle_change(dvdnav_t *self, int32_t angle);
@@ -717,4 +736,4 @@ dvdnav_status_t dvdnav_subpicture_change(dvdnav_t *self, int32_t subpicture);
}
#endif
-#endif /* DVDNAV_H_INCLUDED */
+#endif /* LIBDVDNAV_DVDNAV_H */
diff --git a/lib/libdvd/libdvdnav/src/dvdnav_events.h b/lib/libdvd/libdvdnav/src/dvdnav/dvdnav_events.h
index a4d460eeca..921e8d8b97 100644
--- a/lib/libdvd/libdvdnav/src/dvdnav_events.h
+++ b/lib/libdvd/libdvdnav/src/dvdnav/dvdnav_events.h
@@ -13,20 +13,17 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: dvdnav_events.h 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* This header defines events and event types
*/
-#ifndef DVDNAV_EVENTS_H_INCLUDED
-#define DVDNAV_EVENTS_H_INCLUDED
+#ifndef LIBDVDNAV_DVDNAV_EVENTS_H
+#define LIBDVDNAV_DVDNAV_EVENTS_H
/*
* DVDNAV_BLOCK_OK
@@ -236,4 +233,4 @@ typedef struct {
#define DVDNAV_WAIT 13
-#endif /* DVDNAV_EVENTS_H_INCLUDED */
+#endif /* LIBDVDNAV_DVDNAV_EVENTS_H */
diff --git a/lib/libdvd/libdvdnav/src/dvdnav_internal.h b/lib/libdvd/libdvdnav/src/dvdnav_internal.h
index 996723ea7e..d64a5ba7cd 100644
--- a/lib/libdvd/libdvdnav/src/dvdnav_internal.h
+++ b/lib/libdvd/libdvdnav/src/dvdnav_internal.h
@@ -13,29 +13,18 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: dvdnav_internal.h 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef DVDNAV_INTERNAL_H_INCLUDED
-#define DVDNAV_INTERNAL_H_INCLUDED
+#ifndef LIBDVDNAV_DVDNAV_INTERNAL_H
+#define LIBDVDNAV_DVDNAV_INTERNAL_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
-/* Uncomment for VM command tracing */
-/* #define TRACE */
-
-#include "decoder.h"
-#include "dvdnav.h"
-#include "vm.h"
-#include "vmcmd.h"
-
#ifdef WIN32
/* pthread_mutex_* wrapper for win32 */
@@ -45,7 +34,7 @@ typedef CRITICAL_SECTION pthread_mutex_t;
#define pthread_mutex_init(a, b) InitializeCriticalSection(a)
#define pthread_mutex_lock(a) EnterCriticalSection(a)
#define pthread_mutex_unlock(a) LeaveCriticalSection(a)
-#define pthread_mutex_destroy(a)
+#define pthread_mutex_destroy(a) DeleteCriticalSection(a)
#ifndef HAVE_GETTIMEOFDAY
/* replacement gettimeofday implementation */
@@ -71,7 +60,7 @@ static inline int _private_gettimeofday( struct timeval *tv, void *tz )
#endif /* WIN32 */
/* where should libdvdnav write its messages (stdout/stderr) */
-#define MSG_OUT stdout
+#define MSG_OUT stderr
/* Maximum length of an error string */
#define MAX_ERR_LEN 255
@@ -186,6 +175,7 @@ struct dvdnav_s {
/* converts a dvd_time_t to PTS ticks */
int64_t dvdnav_convert_time(dvd_time_t *time);
+/* XBMC added functions */
/*
* Get current playback state
*/
@@ -195,8 +185,7 @@ dvdnav_status_t dvdnav_get_state(dvdnav_t *this, dvd_state_t *save_state);
* Resume playback state
*/
dvdnav_status_t dvdnav_set_state(dvdnav_t *this, dvd_state_t *save_state);
-
-
+/* end XBMC */
/** USEFUL MACROS **/
@@ -215,4 +204,4 @@ dvdnav_status_t dvdnav_set_state(dvdnav_t *this, dvd_state_t *save_state);
#define printerr(str) \
do { if (this) strncpy(this->err_str, str, MAX_ERR_LEN - 1); } while (0)
-#endif /* DVDNAV_INTERNAL_H_INCLUDED */
+#endif /* LIBDVDNAV_DVDNAV_INTERNAL_H */
diff --git a/lib/libdvd/libdvdnav/src/highlight.c b/lib/libdvd/libdvdnav/src/highlight.c
index bdf652a5b2..f484357c7c 100644
--- a/lib/libdvd/libdvdnav/src/highlight.c
+++ b/lib/libdvd/libdvdnav/src/highlight.c
@@ -13,12 +13,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: highlight.c 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef HAVE_CONFIG_H
@@ -33,13 +30,12 @@
#include <string.h>
#include <sys/time.h>
#include <dvdread/nav_types.h>
-#include "dvd_types.h"
+#include "dvdnav/dvdnav.h"
#include "remap.h"
#include "vm/decoder.h"
#include "vm/vm.h"
#include "vm/vmcmd.h"
#include "dvdnav_internal.h"
-#include "dvdnav.h"
/*
#define BUTTON_TESTING
@@ -372,7 +368,7 @@ dvdnav_status_t dvdnav_button_activate(dvdnav_t *this, pci_t *pci) {
button_ptr = get_current_button(this, pci);
/* Finally, make the VM execute the appropriate code and probably
- * scedule a jump */
+ * schedule a jump */
#ifdef BUTTON_TESTING
fprintf(MSG_OUT, "libdvdnav: Evaluating Button Activation commands.\n");
#endif
@@ -429,7 +425,7 @@ dvdnav_status_t dvdnav_button_select(dvdnav_t *this, pci_t *pci, int32_t button)
}
this->vm->state.HL_BTNN_REG = (button << 10);
- this->position_current.button = -1; /* Force Highligh change */
+ this->position_current.button = -1; /* Force Highlight change */
return DVDNAV_STATUS_OK;
}
diff --git a/lib/libdvd/libdvdnav/src/navigation.c b/lib/libdvd/libdvdnav/src/navigation.c
index e28cb640bb..efce45e102 100644
--- a/lib/libdvd/libdvdnav/src/navigation.c
+++ b/lib/libdvd/libdvdnav/src/navigation.c
@@ -13,12 +13,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: navigation.c 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef HAVE_CONFIG_H
@@ -29,13 +26,12 @@
#include <limits.h>
#include <string.h>
#include <sys/time.h>
-#include "dvd_types.h"
+#include "dvdnav/dvdnav.h"
#include <dvdread/nav_types.h>
#include <dvdread/ifo_types.h>
#include "remap.h"
#include "vm/decoder.h"
#include "vm/vm.h"
-#include "dvdnav.h"
#include "dvdnav_internal.h"
/* Navigation API calls */
@@ -126,10 +122,90 @@ dvdnav_status_t dvdnav_current_title_info(dvdnav_t *this, int32_t *title, int32_
return DVDNAV_STATUS_ERR;
}
+dvdnav_status_t dvdnav_current_title_program(dvdnav_t *this, int32_t *title, int32_t *pgcn, int32_t *pgn) {
+ int32_t retval;
+ int32_t part;
+
+ pthread_mutex_lock(&this->vm_lock);
+ if (!this->vm->vtsi || !this->vm->vmgi) {
+ printerr("Bad VM state.");
+ pthread_mutex_unlock(&this->vm_lock);
+ return DVDNAV_STATUS_ERR;
+ }
+ if (!this->started) {
+ printerr("Virtual DVD machine not started.");
+ pthread_mutex_unlock(&this->vm_lock);
+ return DVDNAV_STATUS_ERR;
+ }
+ if (!this->vm->state.pgc) {
+ printerr("No current PGC.");
+ pthread_mutex_unlock(&this->vm_lock);
+ return DVDNAV_STATUS_ERR;
+ }
+ if ( (this->vm->state.domain == VTSM_DOMAIN)
+ || (this->vm->state.domain == VMGM_DOMAIN) ) {
+ /* Get current Menu ID: into *part. */
+ if(! vm_get_current_menu(this->vm, &part)) {
+ pthread_mutex_unlock(&this->vm_lock);
+ return DVDNAV_STATUS_ERR;
+ }
+ if (part > -1) {
+ *title = 0;
+ *pgcn = this->vm->state.pgcN;
+ *pgn = this->vm->state.pgN;
+ pthread_mutex_unlock(&this->vm_lock);
+ return DVDNAV_STATUS_OK;
+ }
+ }
+ if (this->vm->state.domain == VTS_DOMAIN) {
+ retval = vm_get_current_title_part(this->vm, title, &part);
+ *pgcn = this->vm->state.pgcN;
+ *pgn = this->vm->state.pgN;
+ pthread_mutex_unlock(&this->vm_lock);
+ return retval ? DVDNAV_STATUS_OK : DVDNAV_STATUS_ERR;
+ }
+ printerr("Not in a title or menu.");
+ pthread_mutex_unlock(&this->vm_lock);
+ return DVDNAV_STATUS_ERR;
+}
+
dvdnav_status_t dvdnav_title_play(dvdnav_t *this, int32_t title) {
return dvdnav_part_play(this, title, 1);
}
+dvdnav_status_t dvdnav_program_play(dvdnav_t *this, int32_t title, int32_t pgcn, int32_t pgn) {
+ int32_t retval;
+
+ pthread_mutex_lock(&this->vm_lock);
+ if (!this->vm->vmgi) {
+ printerr("Bad VM state.");
+ pthread_mutex_unlock(&this->vm_lock);
+ return DVDNAV_STATUS_ERR;
+ }
+ if (!this->started) {
+ /* don't report an error but be nice */
+ vm_start(this->vm);
+ this->started = 1;
+ }
+ if (!this->vm->state.pgc) {
+ printerr("No current PGC.");
+ pthread_mutex_unlock(&this->vm_lock);
+ return DVDNAV_STATUS_ERR;
+ }
+ if((title < 1) || (title > this->vm->vmgi->tt_srpt->nr_of_srpts)) {
+ printerr("Title out of range.");
+ pthread_mutex_unlock(&this->vm_lock);
+ return DVDNAV_STATUS_ERR;
+ }
+
+ retval = vm_jump_title_program(this->vm, title, pgcn, pgn);
+ if (retval)
+ this->vm->hop_channel++;
+ pthread_mutex_unlock(&this->vm_lock);
+
+ return retval ? DVDNAV_STATUS_OK : DVDNAV_STATUS_ERR;
+}
+
dvdnav_status_t dvdnav_part_play(dvdnav_t *this, int32_t title, int32_t part) {
int32_t retval;
diff --git a/lib/libdvd/libdvdnav/src/read_cache.c b/lib/libdvd/libdvdnav/src/read_cache.c
index b5e16f0784..80a79a7b5c 100644
--- a/lib/libdvd/libdvdnav/src/read_cache.c
+++ b/lib/libdvd/libdvdnav/src/read_cache.c
@@ -14,12 +14,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: read_cache.c 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/*
* There was a multithreaded read ahead cache in here for some time, but
@@ -36,13 +33,12 @@
#include <limits.h>
#include <sys/time.h>
#include <time.h>
-#include "dvd_types.h"
+#include "dvdnav/dvdnav.h"
#include <dvdread/nav_types.h>
#include <dvdread/ifo_types.h>
#include "remap.h"
#include "vm/decoder.h"
#include "vm/vm.h"
-#include "dvdnav.h"
#include "dvdnav_internal.h"
#include "read_cache.h"
diff --git a/lib/libdvd/libdvdnav/src/read_cache.h b/lib/libdvd/libdvdnav/src/read_cache.h
index 92f9c5caba..3a0e48cad0 100644
--- a/lib/libdvd/libdvdnav/src/read_cache.h
+++ b/lib/libdvd/libdvdnav/src/read_cache.h
@@ -13,16 +13,13 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: read_cache.h 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __DVDNAV_READ_CACHE_H
-#define __DVDNAV_READ_CACHE_H
+#ifndef LIBDVDNAV_READ_CACHE_H
+#define LIBDVDNAV_READ_CACHE_H
/* Opaque cache type -- defined in dvdnav_internal.h */
/* typedef struct read_cache_s read_cache_t; */
@@ -46,4 +43,4 @@ void dvdnav_pre_cache_blocks(read_cache_t *self, int sector, size_t block_count)
* Those buffers must _never_ be freed. */
int dvdnav_read_cache_block(read_cache_t *self, int sector, size_t block_count, uint8_t **buf);
-#endif /* __DVDNAV_READ_CACHE_H */
+#endif /* LIBDVDNAV_READ_CACHE_H */
diff --git a/lib/libdvd/libdvdnav/src/remap.c b/lib/libdvd/libdvdnav/src/remap.c
index eb40b9d841..f1dea937c4 100644
--- a/lib/libdvd/libdvdnav/src/remap.c
+++ b/lib/libdvd/libdvdnav/src/remap.c
@@ -11,11 +11,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: remap.c 1135 2008-09-06 21:55:51Z rathann $
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef HAVE_CONFIG_H
@@ -25,10 +23,10 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
-#include <fcntl.h>
#ifndef _MSC_VER
#include <sys/param.h>
+#include <fcntl.h>
#else
#ifndef MAXPATHLEN
#define MAXPATHLEN 255
@@ -38,13 +36,12 @@
#include <inttypes.h>
#include <limits.h>
#include <sys/time.h>
-#include "dvd_types.h"
+#include "dvdnav/dvdnav.h"
#include <dvdread/nav_types.h>
#include <dvdread/ifo_types.h>
#include "remap.h"
#include "vm/decoder.h"
#include "vm/vm.h"
-#include "dvdnav.h"
#include "dvdnav_internal.h"
struct block_s {
diff --git a/lib/libdvd/libdvdnav/src/remap.h b/lib/libdvd/libdvdnav/src/remap.h
index 0a8a81636b..3d4dcedadb 100644
--- a/lib/libdvd/libdvdnav/src/remap.h
+++ b/lib/libdvd/libdvdnav/src/remap.h
@@ -11,15 +11,13 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: remap.h 1135 2008-09-06 21:55:51Z rathann $
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef __REMAP__H
-#define __REMAP__H
+#ifndef LIBDVDNAV_REMAP_H
+#define LIBDVDNAV_REMAP_H
typedef struct block_s block_t;
typedef struct remap_s remap_t;
@@ -30,4 +28,4 @@ unsigned long remap_block(
remap_t *map, int domain, int title, int program,
unsigned long cblock, unsigned long offset);
-#endif
+#endif /* LIBDVDNAV_REMAP_H */
diff --git a/lib/libdvd/libdvdnav/src/searching.c b/lib/libdvd/libdvdnav/src/searching.c
index ed66bf4d99..a5e48fe7da 100644
--- a/lib/libdvd/libdvdnav/src/searching.c
+++ b/lib/libdvd/libdvdnav/src/searching.c
@@ -13,12 +13,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: searching.c 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef HAVE_CONFIG_H
@@ -32,13 +29,12 @@
#include <string.h>
#include <stdlib.h>
#include <sys/time.h>
-#include "dvd_types.h"
+#include "dvdnav/dvdnav.h"
#include <dvdread/nav_types.h>
#include <dvdread/ifo_types.h>
#include "remap.h"
#include "vm/decoder.h"
#include "vm/vm.h"
-#include "dvdnav.h"
#include "dvdnav_internal.h"
/*
@@ -51,7 +47,7 @@
/* Return placed in vobu. */
/* Returns error status */
/* FIXME: Maybe need to handle seeking outside current cell. */
-static dvdnav_status_t dvdnav_scan_admap(dvdnav_t *this, int32_t domain, uint32_t seekto_block, uint32_t *vobu) {
+static dvdnav_status_t dvdnav_scan_admap(dvdnav_t *this, int32_t domain, uint32_t seekto_block, int next, uint32_t *vobu) {
vobu_admap_t *admap = NULL;
#ifdef LOG_DEBUG
@@ -93,20 +89,22 @@ static dvdnav_status_t dvdnav_scan_admap(dvdnav_t *this, int32_t domain, uint32_
vobu_start = next_vobu;
address++;
}
- *vobu = vobu_start;
+ *vobu = next ? next_vobu : vobu_start;
return DVDNAV_STATUS_OK;
}
fprintf(MSG_OUT, "libdvdnav: admap not located\n");
return DVDNAV_STATUS_ERR;
}
+/* FIXME: right now, this function does not use the time tables but interpolates
+ only the cell times */
dvdnav_status_t dvdnav_time_search(dvdnav_t *this,
uint64_t time) {
- uint32_t target;
+ uint64_t target = time;
uint64_t length = 0;
uint32_t first_cell_nr, last_cell_nr, cell_nr;
- int32_t found = 0;
+ int32_t found;
cell_playback_t *cell;
dvd_state_t *state;
@@ -130,7 +128,7 @@ dvdnav_status_t dvdnav_time_search(dvdnav_t *this,
return DVDNAV_STATUS_ERR;
}
- /* setup what cells we should be working within */
+ this->cur_cell_time = 0;
if (this->pgc_based) {
first_cell_nr = 1;
last_cell_nr = state->pgc->nr_of_cells;
@@ -215,10 +213,9 @@ dvdnav_status_t dvdnav_time_search(dvdnav_t *this,
timemapdone:
-
+ found = 0;
for(cell_nr = first_cell_nr; cell_nr <= last_cell_nr; cell_nr ++) {
cell = &(state->pgc->cell_playback[cell_nr-1]);
-
if(cell->block_type == BLOCK_TYPE_ANGLE_BLOCK && cell->block_mode != BLOCK_MODE_FIRST_CELL)
continue;
@@ -248,14 +245,13 @@ timemapdone:
}
}
}
-
if(found) {
uint32_t vobu;
#ifdef LOG_DEBUG
fprintf(MSG_OUT, "libdvdnav: Seeking to cell %i from choice of %i to %i\n",
cell_nr, first_cell_nr, last_cell_nr);
#endif
- if (dvdnav_scan_admap(this, state->domain, target, &vobu) == DVDNAV_STATUS_OK) {
+ if (dvdnav_scan_admap(this, state->domain, target, 0, &vobu) == DVDNAV_STATUS_OK) {
uint32_t start = state->pgc->cell_playback[cell_nr-1].first_sector;
if (vm_jump_cell_block(this->vm, cell_nr, vobu - start)) {
@@ -279,9 +275,13 @@ timemapdone:
dvdnav_status_t dvdnav_sector_search(dvdnav_t *this,
uint64_t offset, int32_t origin) {
uint32_t target = 0;
+ uint32_t current_pos;
+ uint32_t cur_sector;
+ uint32_t cur_cell_nr;
uint32_t length = 0;
uint32_t first_cell_nr, last_cell_nr, cell_nr;
int32_t found;
+ int forward = 0;
cell_playback_t *cell;
dvd_state_t *state;
dvdnav_status_t result;
@@ -309,6 +309,10 @@ dvdnav_status_t dvdnav_sector_search(dvdnav_t *this,
fprintf(MSG_OUT, "libdvdnav: Before cellN=%u blockN=%u\n", state->cellN, state->blockN);
#endif
+ current_pos = target;
+ cur_sector = this->vobu.vobu_start + this->vobu.blockN;
+ cur_cell_nr = state->cellN;
+
switch(origin) {
case SEEK_SET:
if(offset >= length) {
@@ -340,6 +344,7 @@ dvdnav_status_t dvdnav_sector_search(dvdnav_t *this,
pthread_mutex_unlock(&this->vm_lock);
return DVDNAV_STATUS_ERR;
}
+ forward = target > current_pos;
this->cur_cell_time = 0;
if (this->pgc_based) {
@@ -366,6 +371,27 @@ dvdnav_status_t dvdnav_sector_search(dvdnav_t *this,
} else {
/* convert the target sector from Cell-relative to absolute physical sector */
target += cell->first_sector;
+ if (forward && (cell_nr == cur_cell_nr)) {
+ uint32_t vobu;
+ /* if we are seeking forward from the current position, make sure
+ * we move to a new position that is after our current position.
+ * simply truncating to the vobu will go backwards */
+ if (dvdnav_scan_admap(this, state->domain, target, 0, &vobu) != DVDNAV_STATUS_OK)
+ break;
+ if (vobu <= cur_sector) {
+ if (dvdnav_scan_admap(this, state->domain, target, 1, &vobu) != DVDNAV_STATUS_OK)
+ break;
+ if (vobu > cell->last_sector) {
+ if (cell_nr == last_cell_nr)
+ break;
+ cell_nr++;
+ cell = &(state->pgc->cell_playback[cell_nr-1]);
+ target = cell->first_sector;
+ } else {
+ target = vobu;
+ }
+ }
+ }
found = 1;
break;
}
@@ -377,7 +403,7 @@ dvdnav_status_t dvdnav_sector_search(dvdnav_t *this,
fprintf(MSG_OUT, "libdvdnav: Seeking to cell %i from choice of %i to %i\n",
cell_nr, first_cell_nr, last_cell_nr);
#endif
- if (dvdnav_scan_admap(this, state->domain, target, &vobu) == DVDNAV_STATUS_OK) {
+ if (dvdnav_scan_admap(this, state->domain, target, 0, &vobu) == DVDNAV_STATUS_OK) {
int32_t start = state->pgc->cell_playback[cell_nr-1].first_sector;
if (vm_jump_cell_block(this->vm, cell_nr, vobu - start)) {
@@ -647,7 +673,7 @@ uint32_t dvdnav_describe_title_chapters(dvdnav_t *this, int32_t title, uint64_t
uint16_t parts, i;
title_info_t *ptitle = NULL;
ptt_info_t *ptt = NULL;
- ifo_handle_t *ifo;
+ ifo_handle_t *ifo = NULL;
pgc_t *pgc;
cell_playback_t *cell;
uint64_t length, *tmp=NULL;
@@ -667,6 +693,7 @@ uint32_t dvdnav_describe_title_chapters(dvdnav_t *this, int32_t title, uint64_t
ifo = vm_get_title_ifo(this->vm, title);
if(!ifo || !ifo->vts_pgcit) {
printerr("Couldn't open IFO for chosen title, exit.");
+ retval = 0;
goto fail;
}
@@ -707,11 +734,14 @@ uint32_t dvdnav_describe_title_chapters(dvdnav_t *this, int32_t title, uint64_t
}
*duration = length;
vm_ifo_close(ifo);
+ ifo = NULL;
retval = parts;
*times = tmp;
fail:
pthread_mutex_unlock(&this->vm_lock);
+ if(!retval && ifo)
+ vm_ifo_close(ifo);
if(!retval && tmp)
free(tmp);
return retval;
diff --git a/lib/libdvd/libdvdnav/src/settings.c b/lib/libdvd/libdvdnav/src/settings.c
index 7261f1d502..b05e9bee79 100644
--- a/lib/libdvd/libdvdnav/src/settings.c
+++ b/lib/libdvd/libdvdnav/src/settings.c
@@ -13,12 +13,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: settings.c 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef HAVE_CONFIG_H
@@ -29,13 +26,12 @@
#include <limits.h>
#include <string.h>
#include <sys/time.h>
-#include "dvd_types.h"
+#include "dvdnav/dvdnav.h"
#include <dvdread/nav_types.h>
#include <dvdread/ifo_types.h>
#include "remap.h"
#include "vm/decoder.h"
#include "vm/vm.h"
-#include "dvdnav.h"
#include "dvdnav_internal.h"
/* Characteristics/setting API calls */
diff --git a/lib/libdvd/libdvdnav/src/vm/decoder.c b/lib/libdvd/libdvdnav/src/vm/decoder.c
index 8a26c1d558..fb4ade5463 100644
--- a/lib/libdvd/libdvdnav/src/vm/decoder.c
+++ b/lib/libdvd/libdvdnav/src/vm/decoder.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2001 Martin Norbäck, Håkan Hjort
+ * Copyright (C) 2000, 2001 Martin Norbäck, Håkan Hjort
* 2002-2004 the dvdnav project
*
* This file is part of libdvdnav, a DVD navigation library. It is modified
@@ -15,12 +15,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: decoder.c 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef HAVE_CONFIG_H
@@ -36,12 +33,11 @@
#include <dvdread/nav_types.h>
#include <dvdread/ifo_types.h> /* vm_cmd_t */
-#include "dvd_types.h"
+#include "dvdnav/dvdnav.h"
#include "remap.h"
#include "decoder.h"
#include "vm.h"
#include "vmcmd.h"
-#include "dvdnav.h"
#include "dvdnav_internal.h"
uint32_t vm_getbits(command_t *command, int32_t start, int32_t count) {
diff --git a/lib/libdvd/libdvdnav/src/vm/decoder.h b/lib/libdvd/libdvdnav/src/vm/decoder.h
index 1e834a786d..4306d66a4c 100644
--- a/lib/libdvd/libdvdnav/src/vm/decoder.h
+++ b/lib/libdvd/libdvdnav/src/vm/decoder.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2001 Martin Norbäck, Håkan Hjort
+ * Copyright (C) 2000, 2001 Martin Norbäck, Håkan Hjort
*
* This file is part of libdvdnav, a DVD navigation library. It is modified
* from a file originally part of the Ogle DVD player.
@@ -14,16 +14,13 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: decoder.h 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef DECODER_H_INCLUDED
-#define DECODER_H_INCLUDED
+#ifndef LIBDVDNAV_DECODER_H
+#define LIBDVDNAV_DECODER_H
/* link command types */
typedef enum {
@@ -109,4 +106,4 @@ void vm_print_link(link_t value);
void vm_print_registers( registers_t *registers );
#endif
-#endif /* DECODER_H_INCLUDED */
+#endif /* LIBDVDNAV_DECODER_H */
diff --git a/lib/libdvd/libdvdnav/src/vm/vm.c b/lib/libdvd/libdvdnav/src/vm/vm.c
index 9c9a5c4d2a..aea50f397c 100644
--- a/lib/libdvd/libdvdnav/src/vm/vm.c
+++ b/lib/libdvd/libdvdnav/src/vm/vm.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2001 Håkan Hjort
+ * Copyright (C) 2000, 2001 HÃ¥kan Hjort
* Copyright (C) 2001 Rich Wareham <richwareham@users.sourceforge.net>
* 2002-2004 the dvdnav project
*
@@ -16,12 +16,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: vm.c 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef HAVE_CONFIG_H
@@ -43,18 +40,24 @@
#include <dvdread/nav_types.h>
#include <dvdread/ifo_types.h>
#include <dvdread/ifo_read.h>
-#include "dvd_types.h"
+#include "dvdnav/dvdnav.h"
#include "decoder.h"
#include "remap.h"
#include "vm.h"
-#include "dvdnav.h"
#include "dvdnav_internal.h"
#ifdef _MSC_VER
#include <io.h> /* read() */
#endif /* _MSC_VER */
+#ifdef __OS2__
+#define INCL_DOS
+#include <os2.h>
+#include <io.h> /* setmode() */
+#include <fcntl.h> /* O_BINARY */
+#endif
+
/*
#define STRICT
*/
@@ -82,6 +85,8 @@ static int set_TT(vm_t *vm, int tt);
static int set_PTT(vm_t *vm, int tt, int ptt);
static int set_VTS_TT(vm_t *vm, int vtsN, int vts_ttn);
static int set_VTS_PTT(vm_t *vm, int vtsN, int vts_ttn, int part);
+static int set_PROG(vm_t *vm, int tt, int pgcn, int pgn);
+static int set_VTS_PROG(vm_t *vm, int vtsN, int vts_ttn, int pgcn, int pgn);
static int set_FP_PGC(vm_t *vm);
static int set_MENU(vm_t *vm, int menu);
static int set_PGCN(vm_t *vm, int pgcN);
@@ -134,7 +139,30 @@ static void vm_print_current_domain_state(vm_t *vm) {
}
#endif
-static void dvd_read_name(char *name, const char *device) {
+#ifdef __OS2__
+#define open os2_open
+
+static int os2_open(const char *name, int oflag)
+{
+ HFILE hfile;
+ ULONG ulAction;
+ ULONG rc;
+
+ rc = DosOpenL(name, &hfile, &ulAction, 0, FILE_NORMAL,
+ OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW,
+ OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE | OPEN_FLAGS_DASD,
+ NULL);
+
+ if(rc)
+ return -1;
+
+ setmode(hfile, O_BINARY);
+
+ return (int)hfile;
+}
+#endif
+
+static void dvd_read_name(char *name, char *serial, const char *device) {
/* Because we are compiling with _FILE_OFFSET_BITS=64
* all off_t are 64bit.
*/
@@ -170,6 +198,8 @@ static void dvd_read_name(char *name, const char *device) {
fprintf(MSG_OUT, " ");
}
}
+ strncpy(serial, (char*) &data[73], (i-73));
+ serial[14] = 0;
fprintf(MSG_OUT, "\nlibdvdnav: DVD Title (Alternative): ");
for(i=89; i < 128; i++ ) {
if((data[i] == 0)) break;
@@ -339,16 +369,6 @@ int vm_reset(vm_t *vm, const char *dvdroot) {
fprintf(MSG_OUT, "libdvdnav: vm: failed to open/read the DVD\n");
return 0;
}
-#ifdef _XBMC
- if(DVDUDFVolumeInfo(vm->dvd, vm->dvd_name, sizeof(vm->dvd_name), NULL, 0))
- if(DVDISOVolumeInfo(vm->dvd, vm->dvd_name, sizeof(vm->dvd_name), NULL, 0))
- strcpy(vm->dvd_name, "");
-
- fprintf(MSG_OUT, "libdvdnav: vm: DVD Title: %s\n", vm->dvd_name);
-#else
- dvd_read_name(vm->dvd_name, dvdroot);
-#endif
- vm->map = remap_loadmap(vm->dvd_name);
vm->vmgi = ifoOpenVMGI(vm->dvd);
if(!vm->vmgi) {
fprintf(MSG_OUT, "libdvdnav: vm: failed to read VIDEO_TS.IFO\n");
@@ -379,6 +399,16 @@ int vm_reset(vm_t *vm, const char *dvdroot) {
/* return 0; Not really used for now.. */
}
/* ifoRead_TXTDT_MGI(vmgi); Not implemented yet */
+#ifdef _XBMC
+ if(DVDUDFVolumeInfo(vm->dvd, vm->dvd_name, sizeof(vm->dvd_name), NULL, 0))
+ if(DVDISOVolumeInfo(vm->dvd, vm->dvd_name, sizeof(vm->dvd_name), NULL, 0))
+ strcpy(vm->dvd_name, "");
+
+ fprintf(MSG_OUT, "libdvdnav: vm: DVD Title: %s\n", vm->dvd_name);
+#else
+ dvd_read_name(vm->dvd_name, vm->dvd_serial, dvdroot);
+#endif
+ vm->map = remap_loadmap(vm->dvd_name);
}
if (vm->vmgi) {
int i, mask;
@@ -509,6 +539,24 @@ int vm_jump_cell_block(vm_t *vm, int cell, int block) {
return 1;
}
+int vm_jump_title_program(vm_t *vm, int title, int pgcn, int pgn) {
+ link_t link;
+
+ if(!set_PROG(vm, title, pgcn, pgn))
+ return 0;
+ /* Some DVDs do not want us to jump directly into a title and have
+ * PGC pre commands taking us back to some menu. Since we do not like that,
+ * we do not execute PGC pre commands that would do a jump. */
+ /* process_command(vm, play_PGC_PG(vm, (vm->state).pgN)); */
+ link = play_PGC_PG(vm, (vm->state).pgN);
+ if (link.command != PlayThis)
+ /* jump occured -> ignore it and play the PG anyway */
+ process_command(vm, play_PG(vm));
+ else
+ process_command(vm, link);
+ return 1;
+}
+
int vm_jump_title_part(vm_t *vm, int title, int part) {
link_t link;
@@ -578,6 +626,9 @@ int vm_jump_menu(vm_t *vm, DVDMenuID_t menuid) {
switch(menuid) {
case DVD_MENU_Title:
case DVD_MENU_Escape:
+ if(vm->vmgi == NULL || vm->vmgi->pgci_ut == NULL) {
+ return 0;
+ }
(vm->state).domain = VMGM_DOMAIN;
break;
case DVD_MENU_Root:
@@ -585,6 +636,9 @@ int vm_jump_menu(vm_t *vm, DVDMenuID_t menuid) {
case DVD_MENU_Audio:
case DVD_MENU_Angle:
case DVD_MENU_Part:
+ if(vm->vtsi == NULL || vm->vtsi->pgci_ut == NULL) {
+ return 0;
+ }
(vm->state).domain = VTSM_DOMAIN;
break;
}
@@ -847,8 +901,8 @@ void vm_get_subp_info(vm_t *vm, int *current, int *num_avail) {
break;
}
}
+// XBMC #endif
-/* currently unused */
void vm_get_video_res(vm_t *vm, int *width, int *height) {
video_attr_t attr = vm_get_video_attr(vm);
@@ -872,7 +926,6 @@ void vm_get_video_res(vm_t *vm, int *width, int *height) {
break;
}
}
-// XBMC #endif
int vm_get_video_aspect(vm_t *vm) {
int aspect = vm_get_video_attr(vm).display_aspect_ratio;
@@ -1405,7 +1458,8 @@ static int process_command(vm_t *vm, link_t link_values) {
if(link_values.data2 != 0)
(vm->state).HL_BTNN_REG = link_values.data2 << 10;
if(!set_VTS_PTT(vm, (vm->state).vtsN, (vm->state).VTS_TTN_REG, link_values.data1))
- assert(0);
+ link_values.command = Exit;
+ else
link_values = play_PG(vm);
break;
case LinkPGN:
@@ -1451,7 +1505,8 @@ static int process_command(vm_t *vm, link_t link_values) {
/* Set SPRM1 and SPRM2 */
assert((vm->state).domain == VTSM_DOMAIN || (vm->state).domain == VTS_DOMAIN); /* ?? */
if(!set_VTS_TT(vm, (vm->state).vtsN, link_values.data1))
- assert(0);
+ link_values.command = Exit;
+ else
link_values = play_PGC(vm);
break;
case JumpVTS_PTT:
@@ -1462,7 +1517,8 @@ static int process_command(vm_t *vm, link_t link_values) {
/* Set SPRM1 and SPRM2 */
assert((vm->state).domain == VTSM_DOMAIN || (vm->state).domain == VTS_DOMAIN); /* ?? */
if(!set_VTS_PTT(vm, (vm->state).vtsN, link_values.data1, link_values.data2))
- assert(0);
+ link_values.command = Exit;
+ else
link_values = play_PGC_PG(vm, (vm->state).pgN);
break;
@@ -1477,10 +1533,14 @@ static int process_command(vm_t *vm, link_t link_values) {
link_values = play_PGC(vm);
break;
case JumpSS_VMGM_MENU:
- /* Jump to Video Manger domain - Title Menu:data1 or any PGC in VMG */
+ /* Jump to Video Manager domain - Title Menu:data1 or any PGC in VMG */
/* Allowed from anywhere except the VTS Title domain */
/* Stop SPRM9 Timer and any GPRM counters */
assert((vm->state).domain != VTS_DOMAIN); /* ?? */
+ if(vm->vmgi == NULL || vm->vmgi->pgci_ut == NULL) {
+ link_values.command = Exit;
+ break;
+ }
(vm->state).domain = VMGM_DOMAIN;
if(!set_MENU(vm, link_values.data1))
assert(0);
@@ -1497,14 +1557,22 @@ static int process_command(vm_t *vm, link_t link_values) {
if (link_values.data1 != (vm->state).vtsN) {
/* the normal case */
assert((vm->state).domain == VMGM_DOMAIN || (vm->state).domain == FP_DOMAIN); /* ?? */
- (vm->state).domain = VTSM_DOMAIN;
if (!ifoOpenNewVTSI(vm, vm->dvd, link_values.data1)) /* Also sets (vm->state).vtsN */
assert(0);
+ if(vm->vtsi == NULL || vm->vtsi->pgci_ut == NULL) {
+ link_values.command = Exit;
+ break;
+ }
+ (vm->state).domain = VTSM_DOMAIN;
} else {
/* This happens on some discs like "Captain Scarlet & the Mysterons" or
* the German RC2 of "Anatomie" in VTSM. */
assert((vm->state).domain == VTSM_DOMAIN ||
(vm->state).domain == VMGM_DOMAIN || (vm->state).domain == FP_DOMAIN); /* ?? */
+ if(vm->vtsi == NULL || vm->vtsi->pgci_ut == NULL) {
+ link_values.command = Exit;
+ break;
+ }
(vm->state).domain = VTSM_DOMAIN;
}
} else {
@@ -1526,6 +1594,10 @@ static int process_command(vm_t *vm, link_t link_values) {
/* set_PGCN:data1 */
/* Stop SPRM9 Timer and any GPRM counters */
assert((vm->state).domain != VTS_DOMAIN); /* ?? */
+ if(vm->vmgi == NULL || vm->vmgi->pgci_ut == NULL) {
+ link_values.command = Exit;
+ break;
+ }
(vm->state).domain = VMGM_DOMAIN;
if(!set_PGCN(vm, link_values.data1))
assert(0);
@@ -1545,6 +1617,10 @@ static int process_command(vm_t *vm, link_t link_values) {
/* set_RSMinfo:data2 */
assert((vm->state).domain == VTS_DOMAIN); /* ?? */
/* Must be called before domain is changed */
+ if(vm->vmgi == NULL || vm->vmgi->pgci_ut == NULL) {
+ link_values.command = Exit;
+ break;
+ }
set_RSMinfo(vm, link_values.data2, /* We dont have block info */ 0);
(vm->state).domain = VMGM_DOMAIN;
if(!set_MENU(vm, link_values.data1))
@@ -1556,6 +1632,10 @@ static int process_command(vm_t *vm, link_t link_values) {
/* set_RSMinfo:data2 */
assert((vm->state).domain == VTS_DOMAIN); /* ?? */
/* Must be called before domain is changed */
+ if(vm->vtsi == NULL || vm->vtsi->pgci_ut == NULL) {
+ link_values.command = Exit;
+ break;
+ }
set_RSMinfo(vm, link_values.data2, /* We dont have block info */ 0);
(vm->state).domain = VTSM_DOMAIN;
if(!set_MENU(vm, link_values.data1))
@@ -1567,6 +1647,10 @@ static int process_command(vm_t *vm, link_t link_values) {
/* set_RSMinfo:data2 */
assert((vm->state).domain == VTS_DOMAIN); /* ?? */
/* Must be called before domain is changed */
+ if(vm->vmgi == NULL || vm->vmgi->pgci_ut == NULL) {
+ link_values.command = Exit;
+ break;
+ }
set_RSMinfo(vm, link_values.data2, /* We dont have block info */ 0);
(vm->state).domain = VMGM_DOMAIN;
if(!set_PGCN(vm, link_values.data1))
@@ -1627,6 +1711,42 @@ static int set_VTS_PTT(vm_t *vm, int vtsN, int vts_ttn, int part) {
(vm->state).TT_PGCN_REG = pgcN;
(vm->state).PTTN_REG = part;
(vm->state).TTN_REG = get_TT(vm, vtsN, vts_ttn);
+ if( (vm->state.TTN_REG) == 0 )
+ return 0;
+
+ (vm->state).VTS_TTN_REG = vts_ttn;
+ (vm->state).vtsN = vtsN; /* Not sure about this one. We can get to it easily from TTN_REG */
+ /* Any other registers? */
+
+ res = set_PGCN(vm, pgcN); /* This clobber's state.pgN (sets it to 1), but we don't want clobbering here. */
+ (vm->state).pgN = pgN;
+ return res;
+}
+
+static int set_PROG(vm_t *vm, int tt, int pgcn, int pgn) {
+ assert(tt <= vm->vmgi->tt_srpt->nr_of_srpts);
+ return set_VTS_PROG(vm, vm->vmgi->tt_srpt->title[tt - 1].title_set_nr,
+ vm->vmgi->tt_srpt->title[tt - 1].vts_ttn, pgcn, pgn);
+}
+
+static int set_VTS_PROG(vm_t *vm, int vtsN, int vts_ttn, int pgcn, int pgn) {
+ int pgcN, pgN, res, title, part = 0;
+
+ (vm->state).domain = VTS_DOMAIN;
+
+ if (vtsN != (vm->state).vtsN)
+ if (!ifoOpenNewVTSI(vm, vm->dvd, vtsN)) /* Also sets (vm->state).vtsN */
+ return 0;
+
+ if ((vts_ttn < 1) || (vts_ttn > vm->vtsi->vts_ptt_srpt->nr_of_srpts)) {
+ return 0;
+ }
+
+ pgcN = pgcn;
+ pgN = pgn;
+
+ (vm->state).TT_PGCN_REG = pgcN;
+ (vm->state).TTN_REG = get_TT(vm, vtsN, vts_ttn);
assert( (vm->state.TTN_REG) != 0 );
(vm->state).VTS_TTN_REG = vts_ttn;
(vm->state).vtsN = vtsN; /* Not sure about this one. We can get to it easily from TTN_REG */
@@ -1634,6 +1754,8 @@ static int set_VTS_PTT(vm_t *vm, int vtsN, int vts_ttn, int part) {
res = set_PGCN(vm, pgcN); /* This clobber's state.pgN (sets it to 1), but we don't want clobbering here. */
(vm->state).pgN = pgN;
+ vm_get_current_title_part(vm, &title, &part);
+ (vm->state).PTTN_REG = part;
return res;
}
@@ -1679,6 +1801,7 @@ static int set_PGCN(vm_t *vm, int pgcN) {
/* Figure out the correct pgN from the cell and update (vm->state). */
static int set_PGN(vm_t *vm) {
int new_pgN = 0;
+ int dummy, part = 0;
while(new_pgN < (vm->state).pgc->nr_of_programs
&& (vm->state).cellN >= (vm->state).pgc->program_map[new_pgN])
@@ -1695,14 +1818,8 @@ static int set_PGN(vm_t *vm) {
if((vm->state).TTN_REG > vm->vmgi->tt_srpt->nr_of_srpts)
return 0; /* ?? */
pb_ty = &vm->vmgi->tt_srpt->title[(vm->state).TTN_REG - 1].pb_ty;
- if(pb_ty->multi_or_random_pgc_title == /* One_Sequential_PGC_Title */ 0) {
- int dummy, part;
vm_get_current_title_part(vm, &dummy, &part);
(vm->state).PTTN_REG = part;
- } else {
- /* FIXME: Handle RANDOM or SHUFFLE titles. */
- fprintf(MSG_OUT, "libdvdnav: RANDOM or SHUFFLE titles are NOT handled yet.\n");
- }
}
return 1;
}
diff --git a/lib/libdvd/libdvdnav/src/vm/vm.h b/lib/libdvd/libdvdnav/src/vm/vm.h
index fff9a7d9b1..2405489c69 100644
--- a/lib/libdvd/libdvdnav/src/vm/vm.h
+++ b/lib/libdvd/libdvdnav/src/vm/vm.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2001 Håkan Hjort
+ * Copyright (C) 2000, 2001 HÃ¥kan Hjort
* Copyright (C) 2001 Rich Wareham <richwareham@users.sourceforge.net>
*
* This file is part of libdvdnav, a DVD navigation library. It is modified
@@ -15,16 +15,13 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: vm.h 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef VM_H_INCLUDED
-#define VM_H_INCLUDED
+#ifndef LIBDVDNAV_VM_H
+#define LIBDVDNAV_VM_H
/* DOMAIN enum */
@@ -85,6 +82,7 @@ typedef struct {
dvd_state_t state;
int32_t hop_channel;
char dvd_name[50];
+ char dvd_serial[15];
remap_t *map;
int stopped;
} vm_t;
@@ -141,6 +139,7 @@ void vm_get_next_cell(vm_t *vm);
int vm_jump_pg(vm_t *vm, int pg);
int vm_jump_cell_block(vm_t *vm, int cell, int block);
int vm_jump_title_part(vm_t *vm, int title, int part);
+int vm_jump_title_program(vm_t *vm, int title, int pgcn, int pgn);
int vm_jump_top_pg(vm_t *vm);
int vm_jump_next_pg(vm_t *vm);
int vm_jump_prev_pg(vm_t *vm);
@@ -161,8 +160,8 @@ void vm_get_angle_info(vm_t *vm, int *current, int *num_avail);
/* currently unused */
void vm_get_audio_info(vm_t *vm, int *current, int *num_avail);
void vm_get_subp_info(vm_t *vm, int *current, int *num_avail);
-void vm_get_video_res(vm_t *vm, int *width, int *height);
// _XBMC #endif
+void vm_get_video_res(vm_t *vm, int *width, int *height);
int vm_get_video_aspect(vm_t *vm);
int vm_get_video_scale_permission(vm_t *vm);
video_attr_t vm_get_video_attr(vm_t *vm);
@@ -182,4 +181,4 @@ void vm_position_print(vm_t *vm, vm_position_t *position);
#endif
-#endif /* VM_HV_INCLUDED */
+#endif /* LIBDVDNAV_VM_H */
diff --git a/lib/libdvd/libdvdnav/src/vm/vmcmd.c b/lib/libdvd/libdvdnav/src/vm/vmcmd.c
index 9f68dbd399..bca3a1dd53 100644
--- a/lib/libdvd/libdvdnav/src/vm/vmcmd.c
+++ b/lib/libdvd/libdvdnav/src/vm/vmcmd.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2001 Martin Norbäck, Håkan Hjort
+ * Copyright (C) 2000, 2001 Martin Norbäck, Håkan Hjort
* 2002-2004 the dvdnav project
*
* This file is part of libdvdnav, a DVD navigation library. It is modified
@@ -15,12 +15,9 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: vmcmd.c 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef HAVE_CONFIG_H
@@ -33,14 +30,13 @@
#include <limits.h>
#include <sys/time.h>
-#include "dvd_types.h"
+#include "dvdnav/dvdnav.h"
#include <dvdread/nav_types.h>
#include <dvdread/ifo_types.h>
#include "decoder.h"
#include "remap.h"
#include "vm.h"
#include "vmcmd.h"
-#include "dvdnav.h"
#include "dvdnav_internal.h"
/* freebsd compatibility */
diff --git a/lib/libdvd/libdvdnav/src/vm/vmcmd.h b/lib/libdvd/libdvdnav/src/vm/vmcmd.h
index 4340b5df76..1e28c115ce 100644
--- a/lib/libdvd/libdvdnav/src/vm/vmcmd.h
+++ b/lib/libdvd/libdvdnav/src/vm/vmcmd.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2001 Martin Norbäck, Håkan Hjort
+ * Copyright (C) 2000, 2001 Martin Norbäck, Håkan Hjort
*
* This file is part of libdvdnav, a DVD navigation library. It is modified
* from a file originally part of the Ogle DVD player.
@@ -14,18 +14,15 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: vmcmd.h 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef VMCMD_H_INCLUDED
-#define VMCMD_H_INCLUDED
+#ifndef LIBDVDNAV_VMCMD_H
+#define LIBDVDNAV_VMCMD_H
void vm_print_mnemonic(vm_cmd_t *command);
void vm_print_cmd(int row, vm_cmd_t *command);
-#endif /* VMCMD_H_INCLUDED */
+#endif /* LIBDVDNAV_VMCMD_H */
diff --git a/lib/libdvd/libdvdnav/version.h b/lib/libdvd/libdvdnav/version.h
index fd4fb3ab13..8a8730651b 100644
--- a/lib/libdvd/libdvdnav/version.h
+++ b/lib/libdvd/libdvdnav/version.h
@@ -1 +1 @@
-#define VERSION "4.1.3"
+#define VERSION "4.2.0"
diff --git a/lib/libdvd/libdvdnav/version.sh b/lib/libdvd/libdvdnav/version.sh
index 230da4a8af..b774a8de52 100755
--- a/lib/libdvd/libdvdnav/version.sh
+++ b/lib/libdvd/libdvdnav/version.sh
@@ -1,18 +1,18 @@
-##!/bin/sh
-#
-#svn_revision=`cd "$1" && LC_ALL=C svn info 2> /dev/null | grep Revision | cut -d' ' -f2`
-#test $svn_revision || svn_revision=`cd "$1" && grep revision .svn/entries 2>/dev/null | \
-# cut -d '"' -f2 2> /dev/null`
-#test $svn_revision || svn_revision=UNKNOWN
-#
-#if test "$svn_revision" = UNKNOWN && test -n "$2"; then
-# NEW_REVISION="#define VERSION \"$2\""
-#else
-# NEW_REVISION="#define VERSION \"SVN-r$svn_revision\""
-#fi
-#OLD_REVISION=`cat version.h 2> /dev/null`
-#
-## Update version.h only on revision changes to avoid spurious rebuilds
-#if test "$NEW_REVISION" != "$OLD_REVISION"; then
-# echo "$NEW_REVISION" > version.h
-#fi
+#!/bin/sh
+
+svn_revision=`cd "$1" && LC_ALL=C svn info 2> /dev/null | grep Revision | cut -d' ' -f2`
+test $svn_revision || svn_revision=`cd "$1" && grep revision .svn/entries 2>/dev/null | \
+ cut -d '"' -f2 2> /dev/null`
+test $svn_revision || svn_revision=UNKNOWN
+
+if test "$svn_revision" = UNKNOWN && test -n "$2"; then
+ NEW_REVISION="#define VERSION \"$2\""
+else
+ NEW_REVISION="#define VERSION \"SVN-r$svn_revision\""
+fi
+OLD_REVISION=`cat version.h 2> /dev/null`
+
+# Update version.h only on revision changes to avoid spurious rebuilds
+if test "$NEW_REVISION" != "$OLD_REVISION"; then
+ echo "$NEW_REVISION" > version.h
+fi
diff --git a/lib/libdvd/libdvdread/ChangeLog b/lib/libdvd/libdvdread/ChangeLog
index 3bd83761ae..ab8eaaeceb 100644
--- a/lib/libdvd/libdvdread/ChangeLog
+++ b/lib/libdvd/libdvdread/ChangeLog
@@ -1,3 +1,21 @@
+libdvdread (4.2.0)
+ * added OS/2 support
+ * fixed ARM memory alignment issue
+ * portability fixes for *BSD, Mac OS X, MINGW and OS/2
+ * added a missing DVDFileStat function
+ * exposed the dvd_stat_t struct in header
+ * fixed libdvdread closing stdin if it can't open the file/device
+ * fixed a segfault in UDFFileEntry on some badly mastered DVDs
+ * fixed big-endian builds
+ * Win32: large file support under Mingw to go over 2G limits
+ * configure: remove the special case test for uid=0
+ * provide BUP file support for more issues
+ * move UDFReadBlocksRaw declaration to dvdread_internal.h
+ * fixed double free of parental management information
+ * configure2: Use a single = instead of ==
+ * fixed crash when PTT is too short
+ * fixed segfault when reading certain DVDs, for example "Thor"
+
libdvdread (4.1.3)
* an embarassing amount of fixes regarding potential memory and resource leaks
(patches contributed by Erik Hovland)
diff --git a/lib/libdvd/libdvdread/Makefile b/lib/libdvd/libdvdread/Makefile
index dc2c906c4f..097f2fac19 100644
--- a/lib/libdvd/libdvdread/Makefile
+++ b/lib/libdvd/libdvdread/Makefile
@@ -18,15 +18,15 @@ DVDREAD_L=libdvdread
DVDREAD_LIB = $(DVDREAD_L).a
DVDREAD_SHLIB = $(DVDREAD_L).so
VPATH+= $(SRC_PATH_BARE)/src
-DVDREAD_HEADERS = src/dvd_reader.h \
- src/ifo_print.h \
- src/ifo_read.h \
- src/ifo_types.h \
- src/nav_print.h \
- src/nav_read.h \
- src/dvd_udf.h \
- src/nav_types.h \
- src/bitreader.h
+DVDREAD_HEADERS = src/dvdread/dvd_reader.h \
+ src/dvdread/ifo_print.h \
+ src/dvdread/ifo_read.h \
+ src/dvdread/ifo_types.h \
+ src/dvdread/nav_print.h \
+ src/dvdread/nav_read.h \
+ src/dvdread/dvd_udf.h \
+ src/dvdread/nav_types.h \
+ src/dvdread/bitreader.h
DVDREAD_SRCS = dvd_input.c dvd_reader.c dvd_udf.c ifo_print.c ifo_read.c \
md5.c nav_print.c nav_read.c bitreader.c
CFLAGS += -I$(SRC_PATH)/src
diff --git a/lib/libdvd/libdvdread/README b/lib/libdvd/libdvdread/README
index d7f78d48a2..caac86dd84 100644
--- a/lib/libdvd/libdvdread/README
+++ b/lib/libdvd/libdvdread/README
@@ -26,7 +26,7 @@ from xine-dvdnav and went into the first version of libdvdnav.
Where is it now?
----------------
-libdvdnav is hosted on http://www.mplayerhq.hu/MPlayer/releases/dvdnav/ .
+libdvdnav is hosted on http://dvdnav.mplayerhq.hu/ .
Please report bugs to the developers mailinglist at
mailto:dvdnav-discuss@mplayerhq.hu .
diff --git a/lib/libdvd/libdvdread/autogen.sh b/lib/libdvd/libdvdread/autogen.sh
index 72f2ac80ee..077b682d49 100755
--- a/lib/libdvd/libdvdread/autogen.sh
+++ b/lib/libdvd/libdvdread/autogen.sh
@@ -1,7 +1,5 @@
#!/bin/sh
#
-# $Id: autogen.sh 1128 2008-08-30 22:32:00Z rathann $
-#
# run this to generate all the initial makefiles, etc.
srcdir=`dirname "$0"`
diff --git a/lib/libdvd/libdvdread/configure.ac b/lib/libdvd/libdvdread/configure.ac
index 1425c371ac..596a752c7c 100644
--- a/lib/libdvd/libdvdread/configure.ac
+++ b/lib/libdvd/libdvdread/configure.ac
@@ -13,12 +13,12 @@ dnl
dnl These are defined in m4 so they can be passed to AC_INIT
dnl --------------------------------------------------------------
m4_define([dvdread_major], [4])
-m4_define([dvdread_minor], [1])
-m4_define([dvdread_sub], [3])
+m4_define([dvdread_minor], [2])
+m4_define([dvdread_sub], [0])
m4_define([dvdread_pre], [])
AC_INIT([libdvdread], [dvdread_major.dvdread_minor.dvdread_sub[]dvdread_pre])
-AC_CONFIG_SRCDIR([src/dvd_reader.h])
+AC_CONFIG_SRCDIR([src/dvdread/dvd_reader.h])
AM_INIT_AUTOMAKE([1.6])
dnl create a config.h file (Automake will add -DHAVE_CONFIG_H)
@@ -145,6 +145,9 @@ case $host in
*cygwin*)
LDFLAGS="-no-undefined $LDFLAGS"
;;
+ *os2*)
+ LDFLAGS="-no-undefined -Zbin-files $LDFLAGS"
+ ;;
*)
AC_CHECK_LIB(c, dlopen,
DYNAMIC_LD_LIBS="",
@@ -165,26 +168,6 @@ DEBUG_CFLAGS="-g -DDEBUG $CFLAGS"
AC_SUBST(DEBUG_CFLAGS)
dnl ---------------------------------------------
-dnl Get where .m4 should be installed.
-dnl ---------------------------------------------
-case "`id`" in
- uid=0\(* )
- AC_MSG_CHECKING(for aclocal directory)
- if (aclocal --version) < /dev/null > /dev/null 2>&1; then
- ACLOCAL_DIR="`eval $ACLOCAL --print-ac-dir`"
- AC_MSG_RESULT($ACLOCAL_DIR)
- else
- ACLOCAL_DIR="/usr/local/share/aclocal"
- AC_MSG_RESULT(none - will be installed in $ACLOCAL_DIR)
- fi
- escapedprefix="`echo $prefix | sed -e 's/\\//\\\\\//g'`"
- ACLOCAL_DIR="`echo $ACLOCAL_DIR|sed -e 's/^'$escapedprefix/'\${prefix}'/`"
- AC_SUBST(ACLOCAL_DIR)
- ;;
-esac
-AM_CONDITIONAL(INSTALL_M4, test x"$ACLOCAL_DIR" != "x")
-
-dnl ---------------------------------------------
dnl Check for doxygen (dynamic documentation generator)
dnl ---------------------------------------------
AC_CHECK_PROG(DOXYGEN, doxygen, doxygen, no)
diff --git a/lib/libdvd/libdvdread/configure2 b/lib/libdvd/libdvdread/configure2
index 08c0c40e15..f9facbee7d 100755
--- a/lib/libdvd/libdvdread/configure2
+++ b/lib/libdvd/libdvdread/configure2
@@ -1,6 +1,6 @@
#!/bin/sh
-dvdread_sh_version=4.1.3
+dvdread_sh_version=4.2.0
dvdread_sh_major=`echo $dvdread_sh_version | awk -F. '{print $1}'`
cc=gcc
@@ -108,6 +108,19 @@ case $targetos in
;;
esac
+echo -n "Checking if we're big-endian... "
+bigendian=no
+TMPD=`mktemp -d`
+TMPC=$TMPD/endian.c
+TMPO=$TMPD/endian.o
+cat > $TMPC <<EOF
+unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
+EOF
+$cc $optimizations $cflags -c -o $TMPO $TMPC
+od -A n -t x1 $TMPO | grep -q '42 *49 *47 *45' && bigendian=yes
+rm -rf $TMPD
+echo "$bigendian"
+
cat > config.mak << EOF
# Automatically generated by configure, do not edit
PREFIX=$PREFIX
@@ -136,6 +149,7 @@ cat > config.h << EOF
/* Automatically generated by configure, do not edit */
#include "version.h"
EOF
+test "$bigendian" = "yes" && echo "#define WORDS_BIGENDIAN" || echo "#undef WORDS_BIGENDIAN" >> config.h
# build tree in object directory if source path is different from current one
if test "$source_path_used" != "no"; then
diff --git a/lib/libdvd/libdvdread/m4/Makefile.am b/lib/libdvd/libdvdread/m4/Makefile.am
index a29b467bb7..0c422128c2 100644
--- a/lib/libdvd/libdvdread/m4/Makefile.am
+++ b/lib/libdvd/libdvdread/m4/Makefile.am
@@ -2,10 +2,6 @@ include $(top_srcdir)/misc/Makefile.common
EXTRA_DIST = dvdread.m4
-if INSTALL_M4
-m4datadir = @ACLOCAL_DIR@
-else
m4datadir = $(datadir)/aclocal
-endif
m4data_DATA = dvdread.m4
diff --git a/lib/libdvd/libdvdread/msvc/config.h b/lib/libdvd/libdvdread/msvc/config.h
index c6c6f94dc3..4e9b60ee1f 100755
--- a/lib/libdvd/libdvdread/msvc/config.h
+++ b/lib/libdvd/libdvdread/msvc/config.h
@@ -1,5 +1,8 @@
/* config.h. Generated by hand. */
+#ifndef LIBDVDREAD_CONFIG_H
+#define LIBDVDREAD_CONFIG_H
+
#define HAVE_DLFCN_H 1
/* #undef HAVE_DVDCSS_DVDCSS_H*/
/* #undef HAVE_INTTYPES_H */
@@ -49,3 +52,5 @@ typedef signed int int32_t;
typedef unsigned __int64 uint64_t;
typedef signed __int64 int64_t;
typedef unsigned int uintptr_t;
+
+#endif /* LIBDVDREAD_CONFIG_H */
diff --git a/lib/libdvd/libdvdread/msvc/contrib/dlfcn.c b/lib/libdvd/libdvdread/msvc/contrib/dlfcn.c
index 3eb996bd13..3a00045057 100755
--- a/lib/libdvd/libdvdread/msvc/contrib/dlfcn.c
+++ b/lib/libdvd/libdvdread/msvc/contrib/dlfcn.c
@@ -1,7 +1,4 @@
/*
- * $Id: dlfcn.c 1135 2008-09-06 21:55:51Z rathann $
- * $Name$
- *
* Adopted from Apache DSO code.
* Portions copyright Apache Software Foundation
*
diff --git a/lib/libdvd/libdvdread/msvc/contrib/getopt.c b/lib/libdvd/libdvdread/msvc/contrib/getopt.c
index 4b3ce3db40..b4634e10a2 100755
--- a/lib/libdvd/libdvdread/msvc/contrib/getopt.c
+++ b/lib/libdvd/libdvdread/msvc/contrib/getopt.c
@@ -21,8 +21,8 @@
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ Floor, Boston, MA 02110-1301 USA. */
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
Ditto for AIX 3.2 and <stdlib.h>. */
diff --git a/lib/libdvd/libdvdread/msvc/contrib/timer/timer.c b/lib/libdvd/libdvdread/msvc/contrib/timer/timer.c
index 60efe86db9..f99a73b3ed 100755
--- a/lib/libdvd/libdvdread/msvc/contrib/timer/timer.c
+++ b/lib/libdvd/libdvdread/msvc/contrib/timer/timer.c
@@ -14,8 +14,8 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* WIN32 PORT,
* by Matthew Grooms <elon@altavista.com>
diff --git a/lib/libdvd/libdvdread/msvc/include/dlfcn.h b/lib/libdvd/libdvdread/msvc/include/dlfcn.h
index 7a2416c843..b5fe376c34 100755
--- a/lib/libdvd/libdvdread/msvc/include/dlfcn.h
+++ b/lib/libdvd/libdvdread/msvc/include/dlfcn.h
@@ -1,11 +1,6 @@
#ifndef __DLFCN_H__
# define __DLFCN_H__
-/*
- * $Id: dlfcn.h 1135 2008-09-06 21:55:51Z rathann $
- * $Name$
- *
- *
- */
+
extern void *dlopen (const char *file, int mode);
extern int dlclose (void *handle);
extern void *dlsym (void * handle, const char * name);
diff --git a/lib/libdvd/libdvdread/msvc/include/dvdnav_internal.h b/lib/libdvd/libdvdread/msvc/include/dvdnav_internal.h
index cee785472e..70ef3e6dfe 100644
--- a/lib/libdvd/libdvdread/msvc/include/dvdnav_internal.h
+++ b/lib/libdvd/libdvdread/msvc/include/dvdnav_internal.h
@@ -14,16 +14,13 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: dvdnav_internal.h 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#ifndef DVDNAV_INTERNAL_H_INCLUDED
-#define DVDNAV_INTERNAL_H_INCLUDED
+#ifndef LIBDVDREAD_DVDNAV_INTERNAL_H
+#define LIBDVDREAD_DVDNAV_INTERNAL_H
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -182,4 +179,4 @@ struct dvdnav_s {
#define S_OK DVDNAV_STATUS_OK
#endif /* MSC_VER */
-#endif /* DVDNAV_INTERNAL_H_INCLUDED */
+#endif /* LIBDVDREAD_DVDNAV_INTERNAL_H */
diff --git a/lib/libdvd/libdvdread/msvc/include/getopt.h b/lib/libdvd/libdvdread/msvc/include/getopt.h
index 2fa12f7baf..5f4643aa9c 100755
--- a/lib/libdvd/libdvdread/msvc/include/getopt.h
+++ b/lib/libdvd/libdvdread/msvc/include/getopt.h
@@ -16,8 +16,8 @@
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
- write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
+ Floor, Boston, MA 02110-1301 USA. */
#ifndef _GETOPT_H
#define _GETOPT_H 1
diff --git a/lib/libdvd/libdvdread/msvc/include/inttypes.h b/lib/libdvd/libdvdread/msvc/include/inttypes.h
index 55fd6a33e0..4e1cbe1efe 100755
--- a/lib/libdvd/libdvdread/msvc/include/inttypes.h
+++ b/lib/libdvd/libdvdread/msvc/include/inttypes.h
@@ -14,8 +14,8 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* WIN32 PORT,
* by Matthew Grooms <elon@altavista.com>
diff --git a/lib/libdvd/libdvdread/msvc/include/os_types.h b/lib/libdvd/libdvdread/msvc/include/os_types.h
index 69f05a8d93..294847ea3f 100755
--- a/lib/libdvd/libdvdread/msvc/include/os_types.h
+++ b/lib/libdvd/libdvdread/msvc/include/os_types.h
@@ -1,9 +1,6 @@
#ifndef __OS_TYPES_H__
#define __OS_TYPES_H__
/*
- * $Id: os_types.h 1135 2008-09-06 21:55:51Z rathann $
- * $Name$
- *
* win32 types
* 04 Sept 2001 - Chris Wolf create.
*/
diff --git a/lib/libdvd/libdvdread/msvc/include/pthreads/pthread.h b/lib/libdvd/libdvdread/msvc/include/pthreads/pthread.h
index 7b89ca8401..202bc001c9 100755
--- a/lib/libdvd/libdvdread/msvc/include/pthreads/pthread.h
+++ b/lib/libdvd/libdvdread/msvc/include/pthreads/pthread.h
@@ -15,8 +15,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA.
*/
#if !defined( PTHREAD_H )
@@ -196,7 +196,7 @@ extern "C"
* pthread_attr_setstackaddr
*
* _POSIX_THREAD_PRIORITY_SCHEDULING (set)
- * If set, you can use realtime scheduling.
+ * If set, you can use real-time scheduling.
* Indicates the availability of:
* pthread_attr_getinheritsched
* pthread_attr_getschedparam
@@ -393,7 +393,7 @@ enum {
PTHREAD_SCOPE_SYSTEM = 1, /* Default */
/*
- * pthread_setcancelstate paramters
+ * pthread_setcancelstate parameters
*/
PTHREAD_CANCEL_ENABLE = 0, /* Default */
PTHREAD_CANCEL_DISABLE = 1,
@@ -420,7 +420,7 @@ enum {
/*
* ====================
* ====================
- * Cancelation
+ * Cancellation
* ====================
* ====================
*/
diff --git a/lib/libdvd/libdvdread/msvc/include/pthreads/sched.h b/lib/libdvd/libdvdread/msvc/include/pthreads/sched.h
index ab277920e0..d7596b292d 100755
--- a/lib/libdvd/libdvdread/msvc/include/pthreads/sched.h
+++ b/lib/libdvd/libdvdread/msvc/include/pthreads/sched.h
@@ -22,8 +22,8 @@
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
- * MA 02111-1307, USA
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301 USA.
*/
#ifndef _SCHED_H
#define _SCHED_H
diff --git a/lib/libdvd/libdvdread/msvc/include/sys/time.h b/lib/libdvd/libdvdread/msvc/include/sys/time.h
index f874fa655f..fe7fd84504 100755
--- a/lib/libdvd/libdvdread/msvc/include/sys/time.h
+++ b/lib/libdvd/libdvdread/msvc/include/sys/time.h
@@ -14,13 +14,13 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* WIN32 PORT,
* by Matthew Grooms <elon@altavista.com>
*
- * sys/time.h - There is no seperate sys/time.h for win32 so we simply
+ * sys/time.h - There is no separate sys/time.h for win32 so we simply
* include the standard time header as well as our xine
* timer functions.
*/
diff --git a/lib/libdvd/libdvdread/msvc/include/unistd.h b/lib/libdvd/libdvdread/msvc/include/unistd.h
index 7e4c63f3a5..9292fee2e5 100755
--- a/lib/libdvd/libdvdread/msvc/include/unistd.h
+++ b/lib/libdvd/libdvdread/msvc/include/unistd.h
@@ -14,14 +14,14 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* WIN32 PORT,
* by Matthew Grooms <elon@altavista.com>
*
* unistd.h - This is mostly a catch all header that maps standard unix
- * libc calls to the equivelent win32 functions.
+ * libc calls to the equivalent win32 functions.
*
*/
@@ -63,7 +63,7 @@
#define snprintf _snprintf
#define vsnprintf _vsnprintf
-// FIXME : I dont remember why this is here
+// FIXME : I don't remember why this is here
#define readlink
#endif
diff --git a/lib/libdvd/libdvdread/src/Makefile.am b/lib/libdvd/libdvdread/src/Makefile.am
index f79280cfbb..094e2b7c09 100644
--- a/lib/libdvd/libdvdread/src/Makefile.am
+++ b/lib/libdvd/libdvdread/src/Makefile.am
@@ -15,5 +15,5 @@ libdvdread_la_LIBADD = $(DYNAMIC_LD_LIBS)
libdvdread_la_LDFLAGS = -version-info $(DVDREAD_LT_CURRENT):$(DVDREAD_LT_REVISION):$(DVDREAD_LT_AGE) \
-export-symbols-regex "(^dvd.*|^nav.*|^ifo.*|^DVD.*|^UDF.*)"
-include_HEADERS = dvd_reader.h nav_read.h ifo_read.h \
- nav_print.h ifo_print.h ifo_types.h nav_types.h dvd_udf.h bitreader.h
+include_HEADERS = dvdread/dvd_reader.h dvdread/nav_read.h dvdread/ifo_read.h \
+ dvdread/nav_print.h dvdread/ifo_print.h dvdread/ifo_types.h dvdread/nav_types.h dvdread/dvd_udf.h dvdread/bitreader.h
diff --git a/lib/libdvd/libdvdread/src/bitreader.c b/lib/libdvd/libdvdread/src/bitreader.c
index 441659f721..9fa1b71844 100644
--- a/lib/libdvd/libdvdread/src/bitreader.c
+++ b/lib/libdvd/libdvdread/src/bitreader.c
@@ -1,29 +1,29 @@
/*
- * Copyright (C) 2000, 2001, 2002, 2003 Håkan Hjort <d95hjort@dtek.chalmers.se>
+ * Copyright (C) 2000, 2001, 2002, 2003 HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>
*
- * This program is free software; you can redistribute it and/or modify
+ * This file is part of libdvdread.
+ *
+ * libdvdread is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * libdvdread is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdread; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "config.h"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
-#include "bitreader.h"
+#include "dvdread/bitreader.h"
int dvdread_getbits_init(getbits_state_t *state, uint8_t *start) {
if ((state == NULL) || (start == NULL)) return 0;
diff --git a/lib/libdvd/libdvdread/src/bswap.h b/lib/libdvd/libdvdread/src/bswap.h
index 45286db0e5..3b6e60d519 100644
--- a/lib/libdvd/libdvdread/src/bswap.h
+++ b/lib/libdvd/libdvdread/src/bswap.h
@@ -1,25 +1,27 @@
-#ifndef BSWAP_H_INCLUDED
-#define BSWAP_H_INCLUDED
-
/*
* Copyright (C) 2000, 2001 Billy Biggs <vektor@dumbterm.net>,
- * Håkan Hjort <d95hjort@dtek.chalmers.se>
+ * HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>
+ *
+ * This file is part of libdvdread.
*
- * This program is free software; you can redistribute it and/or modify
+ * libdvdread is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * libdvdread is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdread; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifndef LIBDVDREAD_BSWAP_H
+#define LIBDVDREAD_BSWAP_H
+
#include <config.h>
#if defined(WORDS_BIGENDIAN)
@@ -71,7 +73,7 @@
* functionality!
*/
-#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(WIN32) || defined(__CYGWIN__) || defined(__BEOS__)
+#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined(WIN32) || defined(__CYGWIN__) || defined(__BEOS__) || defined(__OS2__)
#define B2N_16(x) \
x = ((((x) & 0xff00) >> 8) | \
(((x) & 0x00ff) << 8))
@@ -101,4 +103,4 @@
#endif /* WORDS_BIGENDIAN */
-#endif /* BSWAP_H_INCLUDED */
+#endif /* LIBDVDREAD_BSWAP_H */
diff --git a/lib/libdvd/libdvdread/src/dvd_input.c b/lib/libdvd/libdvdread/src/dvd_input.c
index 3fbc2ae2f7..43b8292afa 100644
--- a/lib/libdvd/libdvdread/src/dvd_input.c
+++ b/lib/libdvd/libdvdread/src/dvd_input.c
@@ -1,30 +1,31 @@
/*
* Copyright (C) 2002 Samuel Hocevar <sam@zoy.org>,
- * Håkan Hjort <d95hjort@dtek.chalmers.se>
+ * HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>
*
- * This program is free software; you can redistribute it and/or modify
+ * This file is part of libdvdread.
+ *
+ * libdvdread is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * libdvdread is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdread; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "config.h"
-
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
-#include "dvd_reader.h"
+#include "config.h"
+#include "dvdread/dvd_reader.h"
#include "dvd_input.h"
@@ -38,7 +39,7 @@ char * (*dvdinput_error) (dvd_input_t);
#ifdef HAVE_DVDCSS_DVDCSS_H
/* linking to libdvdcss */
-#include "dvdcss/dvdcss.h"
+#include <dvdcss/dvdcss.h>
#define DVDcss_open(a) dvdcss_open((char*)(a))
#define DVDcss_close dvdcss_close
#define DVDcss_seek dvdcss_seek
@@ -164,7 +165,7 @@ static dvd_input_t file_open(const char *target)
}
/* Open the device */
-#ifndef WIN32
+#if !defined(WIN32) && !defined(__OS2__)
dev->fd = open(target, O_RDONLY);
#else
dev->fd = open(target, O_RDONLY | O_BINARY);
@@ -286,13 +287,15 @@ int dvdinput_setup(void)
#define CSS_LIB "libdvdcss.2.dylib"
#elif defined(WIN32)
#define CSS_LIB "libdvdcss.dll"
+#elif defined(__OS2__)
+ #define CSS_LIB "dvdcss.dll"
#else
#define CSS_LIB "libdvdcss.so.2"
#endif
dvdcss_library = dlopen(CSS_LIB, RTLD_LAZY);
if(dvdcss_library != NULL) {
-#if defined(__OpenBSD__) && !defined(__ELF__)
+#if defined(__OpenBSD__) && !defined(__ELF__) || defined(__OS2__)
#define U_S "_"
#else
#define U_S
diff --git a/lib/libdvd/libdvdread/src/dvd_input.h b/lib/libdvd/libdvdread/src/dvd_input.h
index ccd2e74fe1..f73f67edf5 100644
--- a/lib/libdvd/libdvdread/src/dvd_input.h
+++ b/lib/libdvd/libdvdread/src/dvd_input.h
@@ -1,25 +1,27 @@
-#ifndef DVD_INPUT_H_INCLUDED
-#define DVD_INPUT_H_INCLUDED
-
/*
* Copyright (C) 2001, 2002 Samuel Hocevar <sam@zoy.org>,
- * Håkan Hjort <d95hjort@dtek.chalmers.se>
+ * HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>
+ *
+ * This file is part of libdvdread.
*
- * This program is free software; you can redistribute it and/or modify
+ * libdvdread is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * libdvdread is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdread; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifndef LIBDVDREAD_DVD_INPUT_H
+#define LIBDVDREAD_DVD_INPUT_H
+
/**
* Defines and flags. Make sure they fit the libdvdcss API!
*/
@@ -27,6 +29,8 @@
#define DVDINPUT_READ_DECRYPT (1 << 0)
+typedef struct dvd_input_s *dvd_input_t;
+
#if defined( __MINGW32__ )
# undef lseek
# define lseek _lseeki64
@@ -45,9 +49,6 @@
# define wstat _wstati64
#endif
-
-typedef struct dvd_input_s *dvd_input_t;
-
/**
* Function pointers that will be filled in by the input implementation.
* These functions provide the main API.
@@ -64,4 +65,4 @@ extern char * (*dvdinput_error) (dvd_input_t);
*/
int dvdinput_setup(void);
-#endif /* DVD_INPUT_H_INCLUDED */
+#endif /* LIBDVDREAD_DVD_INPUT_H */
diff --git a/lib/libdvd/libdvdread/src/dvd_reader.c b/lib/libdvd/libdvdread/src/dvd_reader.c
index 8849e848e3..d9544b3264 100644
--- a/lib/libdvd/libdvdread/src/dvd_reader.c
+++ b/lib/libdvd/libdvdread/src/dvd_reader.c
@@ -1,25 +1,25 @@
/*
* Copyright (C) 2001-2004 Billy Biggs <vektor@dumbterm.net>,
- * HÂkan Hjort <d95hjort@dtek.chalmers.se>,
- * Bjˆrn Englund <d4bjorn@dtek.chalmers.se>
+ * HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>,
+ * Björn Englund <d4bjorn@dtek.chalmers.se>
*
- * This program is free software; you can redistribute it and/or modify
+ * This file is part of libdvdread.
+ *
+ * libdvdread is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * libdvdread is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdread; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "config.h"
-
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h> /* For the timing of dvdcss_title crack. */
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <errno.h>
#include <string.h>
+#include <ctype.h>
#include <unistd.h>
#include <limits.h>
#include <dirent.h>
@@ -56,7 +57,7 @@ static inline int _private_gettimeofday( struct timeval *tv, void *tz )
#define lseek64 _lseeki64
#endif
-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__)|| defined(__DARWIN__)
+#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__bsdi__) || defined(__APPLE__)
#define SYS_BSD 1
#endif
@@ -66,11 +67,12 @@ static inline int _private_gettimeofday( struct timeval *tv, void *tz )
#include <fstab.h>
#elif defined(__linux__)
#include <mntent.h>
+#include <paths.h>
#endif
-#include "dvd_udf.h"
+#include "dvdread/dvd_udf.h"
#include "dvd_input.h"
-#include "dvd_reader.h"
+#include "dvdread/dvd_reader.h"
#include "md5.h"
#define DEFAULT_UDF_CACHE_LEVEL 1
@@ -177,7 +179,6 @@ static int initAllCSSKeys( dvd_reader_t *dvd )
fprintf( stderr, "libdvdread: Attempting to retrieve all CSS keys\n" );
fprintf( stderr, "libdvdread: This can take a _long_ time, "
"please be patient\n\n" );
-
gettimeofday(&all_s, NULL);
for( title = 0; title < 100; title++ ) {
@@ -257,7 +258,7 @@ static dvd_reader_t *DVDOpenImageFile( const char *location, int have_css )
if( have_css ) {
/* Only if DVDCSS_METHOD = title, a bit if it's disc or if
- * DVDCSS_METHOD = key but region missmatch. Unfortunaly we
+ * DVDCSS_METHOD = key but region mismatch. Unfortunately we
* don't have that information. */
dvd->css_state = 1; /* Need key init. */
@@ -280,7 +281,6 @@ static dvd_reader_t *DVDOpenPath( const char *path_root )
free(dvd);
return 0;
}
-
dvd->udfcache_level = DEFAULT_UDF_CACHE_LEVEL;
dvd->udfcache = NULL;
@@ -313,17 +313,23 @@ static char *sun_block2char( const char *path )
#endif
#if defined(SYS_BSD)
-/* FreeBSD /dev/(r)(a)cd0c (a is for atapi), recomended to _not_ use r
+/* FreeBSD /dev/(r)(a)cd0c (a is for atapi), recommended to _not_ use r
+ update: FreeBSD and DragonFly no longer uses the prefix so don't add it.
OpenBSD /dev/rcd0c, it needs to be the raw device
NetBSD /dev/rcd0[d|c|..] d for x86, c (for non x86), perhaps others
Darwin /dev/rdisk0, it needs to be the raw device
- BSD/OS /dev/sr0c (if not mounted) or /dev/rsr0c ('c' any letter will do) */
+ BSD/OS /dev/sr0c (if not mounted) or /dev/rsr0c ('c' any letter will do)
+ returns a string allocated with strdup. It should be freed when no longer
+ used. */
static char *bsd_block2char( const char *path )
{
+#if defined(__FreeBSD__) || defined(__DragonFly__)
+ return (char *) strdup( path );
+#else
char *new_path;
/* If it doesn't start with "/dev/" or does start with "/dev/r" exit */
- if( !strncmp( path, "/dev/", 5 ) || strncmp( path, "/dev/r", 6 ) )
+ if( strncmp( path, "/dev/", 5 ) || !strncmp( path, "/dev/r", 6 ) )
return (char *) strdup( path );
/* Replace "/dev/" with "/dev/r" */
@@ -332,33 +338,34 @@ static char *bsd_block2char( const char *path )
strcat( new_path, path + strlen( "/dev/" ) );
return new_path;
+#endif /* __FreeBSD__ || __DragonFly__ */
}
#endif
+
dvd_reader_t *DVDOpen( const char *ppath )
{
struct stat fileinfo;
- int ret;
- int have_css;
+ int ret, have_css, retval, cdir = -1;
dvd_reader_t *ret_val = NULL;
char *dev_name = NULL;
- char *path;
+ char *path = NULL, *new_path = NULL, *path_copy = NULL;
-#ifdef _MSC_VER
+#if defined(_WIN32) || defined(__OS2__)
int len;
#endif
if( ppath == NULL )
- return 0;
+ goto DVDOpen_error;
path = strdup(ppath);
if( path == NULL )
- return 0;
+ goto DVDOpen_error;
/* Try to open libdvdcss or fall back to standard functions */
have_css = dvdinput_setup();
-#ifdef _MSC_VER
+#if defined(_WIN32) || defined(__OS2__)
/* Strip off the trailing \ if it is not a drive */
len = strlen(path);
if ((len > 1) &&
@@ -372,17 +379,18 @@ dvd_reader_t *DVDOpen( const char *ppath )
ret = stat( path, &fileinfo );
if( ret < 0 ) {
+
/* maybe "host:port" url? try opening it with acCeSS library */
if( strchr(path,':') ) {
ret_val = DVDOpenImageFile( path, have_css );
free(path);
return ret_val;
}
+
/* If we can't stat the file, give up */
fprintf( stderr, "libdvdread: Can't stat %s\n", path );
perror("");
- free(path);
- return NULL;
+ goto DVDOpen_error;
}
/* First check if this is a block/char device or a file*/
@@ -393,20 +401,20 @@ dvd_reader_t *DVDOpen( const char *ppath )
/**
* Block devices and regular files are assumed to be DVD-Video images.
*/
+ dvd_reader_t *dvd = NULL;
#if defined(__sun)
- ret_val = DVDOpenImageFile( sun_block2char( path ), have_css );
+ dev_name = sun_block2char( path );
#elif defined(SYS_BSD)
- ret_val = DVDOpenImageFile( bsd_block2char( path ), have_css );
+ dev_name = bsd_block2char( path );
#else
- ret_val = DVDOpenImageFile( path, have_css );
+ dev_name = strdup( path );
#endif
-
+ dvd = DVDOpenImageFile( dev_name, have_css );
+ free( dev_name );
free(path);
- return ret_val;
-
+ return dvd;
} else if( S_ISDIR( fileinfo.st_mode ) ) {
dvd_reader_t *auth_drive = 0;
- char *path_copy;
#if defined(SYS_BSD)
struct fstab* fe;
#elif defined(__sun) || defined(__linux__)
@@ -414,44 +422,55 @@ dvd_reader_t *DVDOpen( const char *ppath )
#endif
/* XXX: We should scream real loud here. */
- if( !(path_copy = strdup( path ) ) ) {
- free(path);
- return NULL;
- }
+ if( !(path_copy = strdup( path ) ) )
+ goto DVDOpen_error;
#ifndef WIN32 /* don't have fchdir, and getcwd( NULL, ... ) is strange */
/* Also WIN32 does not have symlinks, so we don't need this bit of code. */
- /* Resolve any symlinks and get the absolut dir name. */
+ /* Resolve any symlinks and get the absolute dir name. */
{
- char *new_path;
- int cdir = open( ".", O_RDONLY );
-
- if( cdir >= 0 ) {
- chdir( path_copy );
+ if( ( cdir = open( ".", O_RDONLY ) ) >= 0 ) {
+ if( chdir( path_copy ) == -1 ) {
+ goto DVDOpen_error;
+ }
new_path = malloc(PATH_MAX+1);
if(!new_path) {
- free(path);
- return NULL;
+ goto DVDOpen_error;
+ }
+ if( getcwd( new_path, PATH_MAX ) == NULL ) {
+ goto DVDOpen_error;
}
- getcwd(new_path, PATH_MAX );
- fchdir( cdir );
+ retval = fchdir( cdir );
close( cdir );
- free( path_copy );
+ cdir = -1;
+ if( retval == -1 ) {
+ goto DVDOpen_error;
+ }
path_copy = new_path;
+ new_path = NULL;
}
}
#endif
+
/**
* If we're being asked to open a directory, check if that directory
* is the mountpoint for a DVD-ROM which we can use instead.
*/
if( strlen( path_copy ) > 1 ) {
- if( path_copy[ strlen( path_copy ) - 1 ] == '/' )
+ if( path_copy[ strlen( path_copy ) - 1 ] == '/' ) {
path_copy[ strlen( path_copy ) - 1 ] = '\0';
}
+ }
+#if defined(_WIN32) || defined(__OS2__)
+ if(strlen(path_copy) > TITLES_MAX) {
+ if(!strcasecmp(&(path_copy[strlen( path_copy ) - TITLES_MAX]),
+ "\\video_ts"))
+ path_copy[strlen(path_copy) - (TITLES_MAX-1)] = '\0';
+ }
+#endif
if( strlen( path_copy ) > TITLES_MAX ) {
if( !strcasecmp( &(path_copy[ strlen( path_copy ) - TITLES_MAX ]),
"/video_ts" ) ) {
@@ -513,11 +532,17 @@ dvd_reader_t *DVDOpen( const char *ppath )
}
fclose( mntfile );
}
-#elif defined(_MSC_VER)
+#elif defined(_WIN32) || defined(__OS2__)
+#ifdef __OS2__
+ /* Use DVDOpenImageFile() only if it is a drive */
+ if(isalpha(path[0]) && path[1] == ':' &&
+ ( !path[2] ||
+ ((path[2] == '\\' || path[2] == '/') && !path[3])))
+#endif
auth_drive = DVDOpenImageFile( path, have_css );
#endif
-#ifndef _MSC_VER
+#if !defined(_WIN32) && !defined(__OS2__)
if( !dev_name ) {
fprintf( stderr, "libdvdread: Couldn't find device name.\n" );
} else if( !auth_drive ) {
@@ -527,12 +552,14 @@ dvd_reader_t *DVDOpen( const char *ppath )
#else
if( !auth_drive ) {
fprintf( stderr, "libdvdread: Device %s inaccessible, "
- "CSS authentication not available.\n", dev_name );
+ "CSS authentication not available.\n", path );
}
#endif
free( dev_name );
+ dev_name = NULL;
free( path_copy );
+ path_copy = NULL;
/**
* If we've opened a drive, just use that.
@@ -541,7 +568,6 @@ dvd_reader_t *DVDOpen( const char *ppath )
free(path);
return auth_drive;
}
-
/**
* Otherwise, we now try to open the directory tree instead.
*/
@@ -550,9 +576,17 @@ dvd_reader_t *DVDOpen( const char *ppath )
return ret_val;
}
+DVDOpen_error:
/* If it's none of the above, screw it. */
fprintf( stderr, "libdvdread: Could not open %s\n", path );
+ if( path != NULL )
free( path );
+ if ( path_copy != NULL )
+ free( path_copy );
+ if ( cdir >= 0 )
+ close( cdir );
+ if ( new_path != NULL )
+ free( new_path );
return NULL;
}
@@ -634,7 +668,6 @@ static int findDirFile( const char *path, const char *file, char *filename )
return 0;
}
}
-
closedir( dir );
#endif // _XBMC
return -1;
@@ -908,9 +941,7 @@ void DVDCloseFile( dvd_file_t *dvd_file )
int i;
if( dvd_file ) {
- if( dvd_file->dvd->isImageFile ) {
- ;
- } else {
+ if( !dvd_file->dvd->isImageFile ) {
for( i = 0; i < TITLES_MAX; ++i ) {
if( dvd_file->title_devs[ i ] ) {
dvdinput_close( dvd_file->title_devs[i] );
@@ -923,12 +954,187 @@ void DVDCloseFile( dvd_file_t *dvd_file )
}
}
+static int DVDFileStatVOBUDF( dvd_reader_t *dvd, int title,
+ int menu, dvd_stat_t *statbuf )
+{
+ char filename[ MAX_UDF_FILE_NAME_LEN ];
+ uint32_t size;
+ off_t tot_size;
+ off_t parts_size[ 9 ];
+ int nr_parts = 0;
+ int n;
+
+ if( title == 0 )
+ sprintf( filename, "/VIDEO_TS/VIDEO_TS.VOB" );
+ else
+ sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, menu ? 0 : 1 );
+
+ if( !UDFFindFile( dvd, filename, &size ) )
+ return -1;
+
+ tot_size = size;
+ nr_parts = 1;
+ parts_size[ 0 ] = size;
+
+ if( !menu ) {
+ int cur;
+
+ for( cur = 2; cur < 10; cur++ ) {
+ sprintf( filename, "/VIDEO_TS/VTS_%02d_%d.VOB", title, cur );
+ if( !UDFFindFile( dvd, filename, &size ) )
+ break;
+
+ parts_size[ nr_parts ] = size;
+ tot_size += size;
+ nr_parts++;
+ }
+ }
+
+ statbuf->size = tot_size;
+ statbuf->nr_parts = nr_parts;
+ for( n = 0; n < nr_parts; n++ )
+ statbuf->parts_size[ n ] = parts_size[ n ];
+
+ return 0;
+}
+
+
+static int DVDFileStatVOBPath( dvd_reader_t *dvd, int title,
+ int menu, dvd_stat_t *statbuf )
+{
+ char filename[ MAX_UDF_FILE_NAME_LEN ];
+ char full_path[ PATH_MAX + 1 ];
+ struct stat fileinfo;
+ off_t tot_size;
+ off_t parts_size[ 9 ];
+ int nr_parts = 0;
+ int n;
+
+ if( title == 0 )
+ sprintf( filename, "VIDEO_TS.VOB" );
+ else
+ sprintf( filename, "VTS_%02d_%d.VOB", title, menu ? 0 : 1 );
+
+ if( !findDVDFile( dvd, filename, full_path ) )
+ return -1;
+
+ if( stat( full_path, &fileinfo ) < 0 ) {
+ fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
+ return -1;
+ }
+
+ tot_size = fileinfo.st_size;
+ nr_parts = 1;
+ parts_size[ 0 ] = fileinfo.st_size;
+
+ if( !menu ) {
+ int cur;
+ for( cur = 2; cur < 10; cur++ ) {
+ sprintf( filename, "VTS_%02d_%d.VOB", title, cur );
+ if( !findDVDFile( dvd, filename, full_path ) )
+ break;
+
+ if( stat( full_path, &fileinfo ) < 0 ) {
+ fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
+ break;
+ }
+
+ parts_size[ nr_parts ] = fileinfo.st_size;
+ tot_size += parts_size[ nr_parts ];
+ nr_parts++;
+ }
+ }
+
+ statbuf->size = tot_size;
+ statbuf->nr_parts = nr_parts;
+ for( n = 0; n < nr_parts; n++ )
+ statbuf->parts_size[ n ] = parts_size[ n ];
+
+ return 0;
+}
+
+
+int DVDFileStat( dvd_reader_t *dvd, int titlenum,
+ dvd_read_domain_t domain, dvd_stat_t *statbuf )
+{
+ char filename[ MAX_UDF_FILE_NAME_LEN ];
+ char full_path[ PATH_MAX + 1 ];
+ struct stat fileinfo;
+ uint32_t size;
+
+ /* Check arguments. */
+ if( dvd == NULL || titlenum < 0 ) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ switch( domain ) {
+ case DVD_READ_INFO_FILE:
+ if( titlenum == 0 )
+ sprintf( filename, "/VIDEO_TS/VIDEO_TS.IFO" );
+ else
+ sprintf( filename, "/VIDEO_TS/VTS_%02i_0.IFO", titlenum );
+
+ break;
+ case DVD_READ_INFO_BACKUP_FILE:
+ if( titlenum == 0 )
+ sprintf( filename, "/VIDEO_TS/VIDEO_TS.BUP" );
+ else
+ sprintf( filename, "/VIDEO_TS/VTS_%02i_0.BUP", titlenum );
+
+ break;
+ case DVD_READ_MENU_VOBS:
+ if( dvd->isImageFile )
+ return DVDFileStatVOBUDF( dvd, titlenum, 1, statbuf );
+ else
+ return DVDFileStatVOBPath( dvd, titlenum, 1, statbuf );
+
+ break;
+ case DVD_READ_TITLE_VOBS:
+ if( titlenum == 0 )
+ return -1;
+
+ if( dvd->isImageFile )
+ return DVDFileStatVOBUDF( dvd, titlenum, 0, statbuf );
+ else
+ return DVDFileStatVOBPath( dvd, titlenum, 0, statbuf );
+
+ break;
+ default:
+ fprintf( stderr, "libdvdread: Invalid domain for file stat.\n" );
+ errno = EINVAL;
+ return -1;
+ }
+
+ if( dvd->isImageFile ) {
+ if( UDFFindFile( dvd, filename, &size ) ) {
+ statbuf->size = size;
+ statbuf->nr_parts = 1;
+ statbuf->parts_size[ 0 ] = size;
+ return 0;
+ }
+ } else {
+ if( findDVDFile( dvd, filename, full_path ) ) {
+ if( stat( full_path, &fileinfo ) < 0 )
+ fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
+ else {
+ statbuf->size = fileinfo.st_size;
+ statbuf->nr_parts = 1;
+ statbuf->parts_size[ 0 ] = statbuf->size;
+ return 0;
+ }
+ }
+ }
+ return -1;
+}
+
/* Internal, but used from dvd_udf.c */
int UDFReadBlocksRaw( dvd_reader_t *device, uint32_t lb_number,
size_t block_count, unsigned char *data,
int encrypted )
{
int ret;
+
if( !device->dev ) {
fprintf( stderr, "libdvdread: Fatal error in block read.\n" );
return 0;
@@ -1132,6 +1338,7 @@ ssize_t DVDReadBlocks( dvd_file_t *dvd_file, int offset,
size_t block_count, unsigned char *data )
{
int ret;
+
/* Check arguments. */
if( dvd_file == NULL || offset < 0 || data == NULL )
return -1;
@@ -1283,6 +1490,7 @@ int DVDDiscID( dvd_reader_t *dvd, unsigned char *discid )
"allocate memory for file read!\n" );
return -1;
}
+
bytes_read = DVDReadBytes( dvd_file, buffer, file_size );
if( bytes_read != file_size ) {
fprintf( stderr, "libdvdread: DVDDiscId read returned %zd bytes"
diff --git a/lib/libdvd/libdvdread/src/dvd_udf.c b/lib/libdvd/libdvdread/src/dvd_udf.c
index 26a663a1c9..81491d8b38 100644
--- a/lib/libdvd/libdvdread/src/dvd_udf.c
+++ b/lib/libdvd/libdvdread/src/dvd_udf.c
@@ -4,32 +4,30 @@
*
* Modifications by:
* Billy Biggs <vektor@dumbterm.net>.
- * Björn Englund <d4bjorn@dtek.chalmers.se>.
+ * Björn Englund <d4bjorn@dtek.chalmers.se>.
*
* dvdudf: parse and read the UDF volume information of a DVD Video
* Copyright (C) 1999 Christian Wolff for convergence integrated media
* GmbH The author can be reached at scarabaeus@convergence.de, the
* project's page is at http://linuxtv.org/dvd/
*
- * This program is free software; you can redistribute it and/or modify
+ * This file is part of libdvdread.
+ *
+ * libdvdread is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * libdvdread is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA. Or, point your browser to
- * http://www.gnu.org/copyleft/gpl.html
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdread; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "config.h"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -39,13 +37,9 @@
#include <unistd.h>
#include <inttypes.h>
-#include "dvd_reader.h"
-#include "dvd_udf.h"
-
-/* Private but located in/shared with dvd_reader.c */
-extern int UDFReadBlocksRaw( dvd_reader_t *device, uint32_t lb_number,
- size_t block_count, unsigned char *data,
- int encrypted );
+#include "dvdread_internal.h"
+#include "dvdread/dvd_reader.h"
+#include "dvdread/dvd_udf.h"
/* It's required to either fail or deliver all the blocks asked for. */
static int DVDReadLBUDF( dvd_reader_t *device, uint32_t lb_number,
@@ -56,6 +50,7 @@ static int DVDReadLBUDF( dvd_reader_t *device, uint32_t lb_number,
size_t count = block_count;
while(count > 0) {
+
ret = UDFReadBlocksRaw(device, lb_number, count, data, encrypted);
if(ret <= 0) {
@@ -334,16 +329,17 @@ static int SetUDFCache(dvd_reader_t *device, UDFCacheType type,
static int Unicodedecode( uint8_t *data, int len, char *target )
{
int p = 1, i = 0;
+ int err = 0;
if( ( data[ 0 ] == 8 ) || ( data[ 0 ] == 16 ) ) do {
- if( data[ 0 ] == 16 ) p++; /* Ignore MSB of unicode16 */
+ if( data[ 0 ] == 16 ) err |= data[p++]; /* character cannot be converted to 8bit, return error */
if( p < len ) {
target[ i++ ] = data[ p++ ];
}
} while( p < len );
target[ i ] = '\0';
- return 0;
+ return !err;
}
static int UDFDescriptor( uint8_t *data, uint16_t *TagID )
@@ -444,22 +440,42 @@ static int UDFFileEntry( uint8_t *data, uint8_t *FileType,
L_EA = GETN4( 168 );
L_AD = GETN4( 172 );
+
+ if (176 + L_EA + L_AD > DVD_VIDEO_LB_LEN)
+ return 0;
+
p = 176 + L_EA;
while( p < 176 + L_EA + L_AD ) {
switch( flags & 0x0007 ) {
- case 0: UDFShortAD( &data[ p ], ad, partition ); p += 8; break;
- case 1: UDFLongAD( &data[ p ], ad ); p += 16; break;
- case 2: UDFExtAD( &data[ p ], ad ); p += 20; break;
+ case 0:
+ UDFShortAD( &data[ p ], ad, partition );
+ p += 8;
+ break;
+ case 1:
+ UDFLongAD( &data[ p ], ad );
+ p += 16;
+ break;
+ case 2:
+ UDFExtAD( &data[ p ], ad );
+ p += 20;
+ break;
case 3:
switch( L_AD ) {
- case 8: UDFShortAD( &data[ p ], ad, partition ); break;
- case 16: UDFLongAD( &data[ p ], ad ); break;
- case 20: UDFExtAD( &data[ p ], ad ); break;
+ case 8:
+ UDFShortAD( &data[ p ], ad, partition );
+ break;
+ case 16:
+ UDFLongAD( &data[ p ], ad );
+ break;
+ case 20:
+ UDFExtAD( &data[ p ], ad );
+ break;
}
p += L_AD;
break;
default:
- p += L_AD; break;
+ p += L_AD;
+ break;
}
}
return 0;
@@ -475,8 +491,9 @@ static int UDFFileIdentifier( uint8_t *data, uint8_t *FileCharacteristics,
L_FI = GETN1(19);
UDFLongAD(&data[20], FileICB);
L_IU = GETN2(36);
- if (L_FI) Unicodedecode(&data[38 + L_IU], L_FI, FileName);
- else FileName[0] = '\0';
+ if (L_FI) {
+ if (!Unicodedecode(&data[38 + L_IU], L_FI, FileName)) FileName[0] = 0;
+ } else FileName[0] = '\0';
return 4 * ((38 + L_FI + L_IU + 3) / 4);
}
@@ -556,7 +573,6 @@ static int UDFScanDir( dvd_reader_t *device, struct AD Dir, char *FileName,
dir_lba = (Dir.Length + DVD_VIDEO_LB_LEN) / DVD_VIDEO_LB_LEN;
if((cached_dir_base = malloc(dir_lba * DVD_VIDEO_LB_LEN + 2048)) == NULL)
return 0;
-
cached_dir = (uint8_t *)(((uintptr_t)cached_dir_base & ~((uintptr_t)2047)) + 2048);
if( DVDReadLBUDF( device, lbnum, dir_lba, cached_dir, 0) <= 0 ) {
free(cached_dir_base);
@@ -585,7 +601,8 @@ static int UDFScanDir( dvd_reader_t *device, struct AD Dir, char *FileName,
while( p < Dir.Length ) {
UDFDescriptor( &cached_dir[ p ], &TagID );
if( TagID == 257 ) {
- p += UDFFileIdentifier( &cached_dir[ p ], &filechar, filename, &tmpICB );
+ p += UDFFileIdentifier( &cached_dir[ p ], &filechar,
+ filename, &tmpICB );
if(cache_file_info && !in_cache) {
uint8_t tmpFiletype;
struct AD tmpFile;
@@ -670,8 +687,7 @@ static int UDFGetAVDP( dvd_reader_t *device,
if( terminate ) return 0; /* Final try failed */
if( lastsector ) {
- /*
- * We already found the last sector. Try #3, alternative
+ /* We already found the last sector. Try #3, alternative
* backup anchor. If that fails, don't try again.
*/
lbnum = lastsector;
@@ -807,19 +823,23 @@ uint32_t UDFFindFile( dvd_reader_t *device, char *filename,
&& ( TagID != 8 ) && ( TagID != 256 ) );
/* Sanity checks. */
- if( TagID != 256 ) return 0;
- if( RootICB.Partition != 0 ) return 0;
+ if( TagID != 256 )
+ return 0;
+ if( RootICB.Partition != 0 )
+ return 0;
SetUDFCache(device, RootICBCache, 0, &RootICB);
}
/* Find root dir */
- if( !UDFMapICB( device, RootICB, &filetype, &partition, &File ) ) return 0;
- if( filetype != 4 ) return 0; /* Root dir should be dir */
-
+ if( !UDFMapICB( device, RootICB, &filetype, &partition, &File ) )
+ return 0;
+ if( filetype != 4 )
+ return 0; /* Root dir should be dir */
{
int cache_file_info = 0;
/* Tokenize filepath */
token = strtok(tokenline, "/");
+
while( token != NULL ) {
if( !UDFScanDir( device, File, token, &partition, &ICB,
cache_file_info))
@@ -833,7 +853,8 @@ uint32_t UDFFindFile( dvd_reader_t *device, char *filename,
}
/* Sanity check. */
- if( File.Partition != 0 ) return 0;
+ if( File.Partition != 0 )
+ return 0;
*filesize = File.Length;
/* Hack to not return partition.Start for empty files. */
if( !File.Location )
@@ -872,6 +893,7 @@ static int UDFGetDescriptor( dvd_reader_t *device, int id,
/* Main volume descriptor */
MVDS_location = avdp.mvds.location;
MVDS_length = avdp.mvds.length;
+
i = 1;
do {
/* Find Descriptor */
@@ -906,7 +928,7 @@ static int UDFGetPVD(dvd_reader_t *device, struct pvd_t *pvd)
if(GetUDFCache(device, PVDCache, 0, pvd))
return 1;
- if(!UDFGetDescriptor( device, 1, pvd_buf, sizeof(pvd_buf)))
+ if(!UDFGetDescriptor( device, 1, pvd_buf, DVD_VIDEO_LB_LEN))
return 0;
memcpy(pvd->VolumeIdentifier, &pvd_buf[24], 32);
@@ -938,6 +960,7 @@ int UDFGetVolumeIdentifier(dvd_reader_t *device, char *volid,
if(volid_size > volid_len)
volid_size = volid_len;
Unicodedecode(pvd.VolumeIdentifier, volid_size, volid);
+
return volid_len;
}
@@ -964,5 +987,6 @@ int UDFGetVolumeSetIdentifier(dvd_reader_t *device, uint8_t *volsetid,
volsetid_size = 128;
memcpy(volsetid, pvd.VolumeSetIdentifier, volsetid_size);
+
return 128;
}
diff --git a/lib/libdvd/libdvdread/src/bitreader.h b/lib/libdvd/libdvdread/src/dvdread/bitreader.h
index 54d421507d..59b3756028 100644
--- a/lib/libdvd/libdvdread/src/bitreader.h
+++ b/lib/libdvd/libdvdread/src/dvdread/bitreader.h
@@ -1,24 +1,25 @@
-#ifndef BITREADER_H_INCLUDED
-#define BITREADER_H_INCLUDED
-
/*
- * Copyright (C) 2000, 2001, 2002 Håkan Hjort <d95hjort@dtek.chalmers.se>.
+ * Copyright (C) 2000, 2001, 2002 HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>.
+ *
+ * This file is part of libdvdread.
*
- * This program is free software; you can redistribute it and/or modify
+ * libdvdread is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * libdvdread is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdread; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifndef LIBDVDREAD_BITREADER_H
+#define LIBDVDREAD_BITREADER_H
#ifdef __cplusplus
extern "C" {
@@ -37,4 +38,4 @@ uint32_t dvdread_getbits(getbits_state_t *state, uint32_t number_of_bits);
#ifdef __cplusplus
};
#endif
-#endif /* BITREADER_H_INCLUDED */
+#endif /* LIBDVDREAD_BITREADER_H */
diff --git a/lib/libdvd/libdvdread/src/dvd_reader.h b/lib/libdvd/libdvdread/src/dvdread/dvd_reader.h
index 8c91242c98..3fecdcc047 100644
--- a/lib/libdvd/libdvdread/src/dvd_reader.h
+++ b/lib/libdvd/libdvdread/src/dvdread/dvd_reader.h
@@ -1,26 +1,28 @@
-#ifndef DVD_READER_H_INCLUDED
-#define DVD_READER_H_INCLUDED
-
/*
* Copyright (C) 2001, 2002 Billy Biggs <vektor@dumbterm.net>,
- * Håkan Hjort <d95hjort@dtek.chalmers.se>,
- * Björn Englund <d4bjorn@dtek.chalmers.se>
+ * HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>,
+ * Björn Englund <d4bjorn@dtek.chalmers.se>
+ *
+ * This file is part of libdvdread.
*
- * This program is free software; you can redistribute it and/or modify
+ * libdvdread is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * libdvdread is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdread; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifndef LIBDVDREAD_DVD_READER_H
+#define LIBDVDREAD_DVD_READER_H
+
#ifdef _MSC_VER
#include <config.h>
@@ -68,6 +70,15 @@ typedef struct dvd_reader_s dvd_reader_t;
typedef struct dvd_file_s dvd_file_t;
/**
+ * Public type that is used to provide statistics on a handle.
+ */
+typedef struct {
+ off_t size; /**< Total size of file in bytes */
+ int nr_parts; /**< Number of file parts */
+ off_t parts_size[9]; /**< Size of each part in bytes */
+} dvd_stat_t;
+
+/**
* Opens a block device of a DVD-ROM file, or an image file, or a directory
* name for a mounted DVD or HD copy of a DVD.
*
@@ -115,6 +126,33 @@ typedef enum {
} dvd_read_domain_t;
/**
+ * Stats a file on the DVD given the title number and domain.
+ * The information about the file is stored in a dvd_stat_t
+ * which contains information about the size of the file and
+ * the number of parts in case of a multipart file and the respective
+ * sizes of the parts.
+ * A multipart file is for instance VTS_02_1.VOB, VTS_02_2.VOB, VTS_02_3.VOB
+ * The size of VTS_02_1.VOB will be stored in stat->parts_size[0],
+ * VTS_02_2.VOB in stat->parts_size[1], ...
+ * The total size (sum of all parts) is stored in stat->size and
+ * stat->nr_parts will hold the number of parts.
+ * Only DVD_READ_TITLE_VOBS (VTS_??_[1-9].VOB) can be multipart files.
+ *
+ * This function is only of use if you want to get the size of each file
+ * in the filesystem. These sizes are not needed to use any other
+ * functions in libdvdread.
+ *
+ * @param dvd A dvd read handle.
+ * @param titlenum Which Video Title Set should be used, VIDEO_TS is 0.
+ * @param domain Which domain.
+ * @param stat Pointer to where the result is stored.
+ * @return If successful 0, otherwise -1.
+ *
+ * int DVDFileStat(dvd, titlenum, domain, stat);
+ */
+int DVDFileStat(dvd_reader_t *, int, dvd_read_domain_t, dvd_stat_t *);
+
+/**
* Opens a file on the DVD given the title number and domain.
*
* If the title number is 0, the video manager information is opened
@@ -272,4 +310,4 @@ int DVDUDFCacheLevel( dvd_reader_t *, int );
#ifdef __cplusplus
};
#endif
-#endif /* DVD_READER_H_INCLUDED */
+#endif /* LIBDVDREAD_DVD_READER_H */
diff --git a/lib/libdvd/libdvdread/src/dvd_udf.h b/lib/libdvd/libdvdread/src/dvdread/dvd_udf.h
index 3f38e8070c..5a6bd84d04 100644
--- a/lib/libdvd/libdvdread/src/dvd_udf.h
+++ b/lib/libdvd/libdvdread/src/dvdread/dvd_udf.h
@@ -1,39 +1,39 @@
-#ifndef DVD_UDF_H_INCLUDED
-#define DVD_UDF_H_INCLUDED
-
/*
* This code is based on dvdudf by:
* Christian Wolff <scarabaeus@convergence.de>.
*
* Modifications by:
* Billy Biggs <vektor@dumbterm.net>.
- * Björn Englund <d4bjorn@dtek.chalmers.se>.
+ * Björn Englund <d4bjorn@dtek.chalmers.se>.
*
* dvdudf: parse and read the UDF volume information of a DVD Video
* Copyright (C) 1999 Christian Wolff for convergence integrated media
* GmbH The author can be reached at scarabaeus@convergence.de, the
* project's page is at http://linuxtv.org/dvd/
*
- * This program is free software; you can redistribute it and/or modify
+ * This file is part of libdvdread.
+ *
+ * libdvdread is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * libdvdread is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA. Or, point your browser to
- * http://www.gnu.org/copyleft/gpl.html
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdread; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifndef LIBDVDREAD_DVD_UDF_H
+#define LIBDVDREAD_DVD_UDF_H
+
#include <inttypes.h>
-#include "dvd_reader.h"
+#include "dvdread/dvd_reader.h"
#ifdef __cplusplus
extern "C" {
@@ -59,4 +59,4 @@ void SetUDFCacheHandle(dvd_reader_t *device, void *cache);
#ifdef __cplusplus
};
#endif
-#endif /* DVD_UDF_H_INCLUDED */
+#endif /* LIBDVDREAD_DVD_UDF_H */
diff --git a/lib/libdvd/libdvdread/src/dvdread/ifo_print.h b/lib/libdvd/libdvdread/src/dvdread/ifo_print.h
new file mode 100644
index 0000000000..c3068cbe1b
--- /dev/null
+++ b/lib/libdvd/libdvdread/src/dvdread/ifo_print.h
@@ -0,0 +1,28 @@
+/*
+ * This file is part of libdvdread.
+ *
+ * libdvdread is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libdvdread is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdread; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef LIBDVDREAD_IFO_PRINT_H
+#define LIBDVDREAD_IFO_PRINT_H
+
+#include <inttypes.h>
+#include "ifo_types.h"
+
+void ifo_print(dvd_reader_t *dvd, int title);
+void dvdread_print_time(dvd_time_t *dtime);
+
+#endif /* LIBDVDREAD_IFO_PRINT_H */
diff --git a/lib/libdvd/libdvdread/src/ifo_read.h b/lib/libdvd/libdvdread/src/dvdread/ifo_read.h
index 3f4ea24ec2..97f4179f0c 100644
--- a/lib/libdvd/libdvdread/src/ifo_read.h
+++ b/lib/libdvd/libdvdread/src/dvdread/ifo_read.h
@@ -1,27 +1,29 @@
-#ifndef IFO_READ_H_INCLUDED
-#define IFO_READ_H_INCLUDED
-
/*
- * Copyright (C) 2000, 2001, 2002 Björn Englund <d4bjorn@dtek.chalmers.se>,
- * Håkan Hjort <d95hjort@dtek.chalmers.se>
+ * Copyright (C) 2000, 2001, 2002 Björn Englund <d4bjorn@dtek.chalmers.se>,
+ * HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>
+ *
+ * This file is part of libdvdread.
*
- * This program is free software; you can redistribute it and/or modify
+ * libdvdread is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * libdvdread is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdread; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifndef LIBDVDREAD_IFO_READ_H
+#define LIBDVDREAD_IFO_READ_H
+
#include "ifo_types.h"
-#include "dvd_reader.h"
+#include "dvdread/dvd_reader.h"
#ifdef __cplusplus
extern "C" {
@@ -224,4 +226,4 @@ void ifoFree_TXTDT_MGI(ifo_handle_t *);
#ifdef __cplusplus
};
#endif
-#endif /* IFO_READ_H_INCLUDED */
+#endif /* LIBDVDREAD_IFO_READ_H */
diff --git a/lib/libdvd/libdvdread/src/ifo_types.h b/lib/libdvd/libdvdread/src/dvdread/ifo_types.h
index 44e95da1f9..7db7d34dbb 100644
--- a/lib/libdvd/libdvdread/src/ifo_types.h
+++ b/lib/libdvd/libdvdread/src/dvdread/ifo_types.h
@@ -1,27 +1,29 @@
-#ifndef IFO_TYPES_H_INCLUDED
-#define IFO_TYPES_H_INCLUDED
-
/*
- * Copyright (C) 2000, 2001 Björn Englund <d4bjorn@dtek.chalmers.se>,
- * Håkan Hjort <d95hjort@dtek.chalmers.se>
+ * Copyright (C) 2000, 2001 Björn Englund <d4bjorn@dtek.chalmers.se>,
+ * HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>
+ *
+ * This file is part of libdvdread.
*
- * This program is free software; you can redistribute it and/or modify
+ * libdvdread is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * libdvdread is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdread; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifndef LIBDVDREAD_IFO_TYPES_H
+#define LIBDVDREAD_IFO_TYPES_H
+
#include <inttypes.h>
-#include "dvd_reader.h"
+#include "dvdread/dvd_reader.h"
#undef ATTRIBUTE_PACKED
@@ -120,7 +122,7 @@ typedef struct {
unsigned char dolby_encoded : 1; /* suitable for surround decoding */
unsigned char unknown6 : 3;
} surround;
- } app_info;
+ } ATTRIBUTE_PACKED app_info;
} ATTRIBUTE_PACKED audio_attr_t;
@@ -209,6 +211,7 @@ typedef struct {
unsigned int interleaved : 1;
unsigned int stc_discontinuity: 1;
unsigned int seamless_angle : 1;
+
unsigned int playback_mode : 1; /**< When set, enter StillMode after each VOBU */
unsigned int restricted : 1; /**< ?? drop out of fastforward? */
unsigned int unknown2 : 6;
@@ -472,7 +475,8 @@ typedef struct {
* Parental Management Information Unit Table.
* Level 1 (US: G), ..., 7 (US: NC-17), 8
*/
-typedef uint16_t pf_level_t[8];
+#define PTL_MAIT_NUM_LEVEL 8
+typedef uint16_t pf_level_t[PTL_MAIT_NUM_LEVEL];
/**
* Parental Management Information Unit Table.
@@ -744,4 +748,4 @@ typedef struct {
vobu_admap_t *vts_vobu_admap;
} ifo_handle_t;
-#endif /* IFO_TYPES_H_INCLUDED */
+#endif /* LIBDVDREAD_IFO_TYPES_H */
diff --git a/lib/libdvd/libdvdread/src/nav_print.h b/lib/libdvd/libdvdread/src/dvdread/nav_print.h
index bc79ab641f..4960615265 100644
--- a/lib/libdvd/libdvdread/src/nav_print.h
+++ b/lib/libdvd/libdvdread/src/dvdread/nav_print.h
@@ -1,25 +1,27 @@
-#ifndef NAV_PRINT_H_INCLUDED
-#define NAV_PRINT_H_INCLUDED
-
/*
* Copyright (C) 2001, 2002 Billy Biggs <vektor@dumbterm.net>,
- * Håkan Hjort <d95hjort@dtek.chalmers.se>
+ * HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>
+ *
+ * This file is part of libdvdread.
*
- * This program is free software; you can redistribute it and/or modify
+ * libdvdread is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or (at
- * your option) any later version.
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * libdvdread is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdread; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifndef LIBDVDREAD_NAV_PRINT_H
+#define LIBDVDREAD_NAV_PRINT_H
+
#include "nav_types.h"
/**
@@ -47,4 +49,4 @@ void navPrint_DSI(dsi_t *);
#ifdef __cplusplus
};
#endif
-#endif /* NAV_PRINT_H_INCLUDED */
+#endif /* LIBDVDREAD_NAV_PRINT_H */
diff --git a/lib/libdvd/libdvdread/src/nav_read.h b/lib/libdvd/libdvdread/src/dvdread/nav_read.h
index 48fe2c8524..0c16958701 100644
--- a/lib/libdvd/libdvdread/src/nav_read.h
+++ b/lib/libdvd/libdvdread/src/dvdread/nav_read.h
@@ -1,24 +1,26 @@
-#ifndef NAV_READ_H_INCLUDED
-#define NAV_READ_H_INCLUDED
-
/*
- * Copyright (C) 2000, 2001, 2002 Håkan Hjort <d95hjort@dtek.chalmers.se>.
+ * Copyright (C) 2000, 2001, 2002 HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>.
+ *
+ * This file is part of libdvdread.
*
- * This program is free software; you can redistribute it and/or modify
+ * libdvdread is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * libdvdread is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdread; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifndef LIBDVDREAD_NAV_READ_H
+#define LIBDVDREAD_NAV_READ_H
+
#include "nav_types.h"
/**
@@ -48,4 +50,4 @@ void navRead_DSI(dsi_t *, unsigned char *);
#ifdef __cplusplus
};
#endif
-#endif /* NAV_READ_H_INCLUDED */
+#endif /* LIBDVDREAD_NAV_READ_H */
diff --git a/lib/libdvd/libdvdread/src/nav_types.h b/lib/libdvd/libdvdread/src/dvdread/nav_types.h
index e0bbe2f57b..29446f9076 100644
--- a/lib/libdvd/libdvdread/src/nav_types.h
+++ b/lib/libdvd/libdvdread/src/dvdread/nav_types.h
@@ -1,8 +1,5 @@
-#ifndef NAV_TYPES_H_INCLUDED
-#define NAV_TYPES_H_INCLUDED
-
/*
- * Copyright (C) 2000, 2001, 2002 Håkan Hjort <d95hjort@dtek.chalmers.se>
+ * Copyright (C) 2000, 2001, 2002 HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>
*
* The data structures in this file should represent the layout of the
* pci and dsi packets as they are stored in the stream. Information
@@ -24,11 +21,13 @@
* the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
- * USA
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#ifndef LIBDVDREAD_NAV_TYPES_H
+#define LIBDVDREAD_NAV_TYPES_H
+
#include <inttypes.h>
#include "ifo_types.h" /* only dvd_time_t, vm_cmd_t and user_ops_t */
@@ -193,7 +192,7 @@ typedef struct {
} ATTRIBUTE_PACKED sml_pbi_t;
/**
- * Seamless Angle Infromation for one angle
+ * Seamless Angle Information for one angle
*/
typedef struct {
uint32_t address; /**< offset to next ILVU, high bit is before/after */
@@ -201,7 +200,7 @@ typedef struct {
} ATTRIBUTE_PACKED sml_agl_data_t;
/**
- * Seamless Angle Infromation
+ * Seamless Angle Information
*/
typedef struct {
sml_agl_data_t data[9];
@@ -246,4 +245,4 @@ typedef struct {
#pragma pack()
#endif
-#endif /* NAV_TYPES_H_INCLUDED */
+#endif /* LIBDVDREAD_NAV_TYPES_H */
diff --git a/lib/libdvd/libdvdread/src/dvdread_internal.h b/lib/libdvd/libdvdread/src/dvdread_internal.h
index ed9fd0f7a9..cdc298c8ff 100644
--- a/lib/libdvd/libdvdread/src/dvdread_internal.h
+++ b/lib/libdvd/libdvdread/src/dvdread_internal.h
@@ -1,9 +1,32 @@
-#ifndef DVDREAD_INTERNAL_H
-#define DVDREAD_INTERNAL_H
+/*
+ * This file is part of libdvdread.
+ *
+ * libdvdread is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * libdvdread is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdread; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
-#ifdef _MSC_VER
+#ifndef LIBDVDREAD_DVDREAD_INTERNAL_H
+#define LIBDVDREAD_DVDREAD_INTERNAL_H
+
+#include <stdint.h>
+#include <sys/types.h>
+
+#ifdef _WIN32
#include <unistd.h>
-#endif /* _MSC_VER */
+#endif /* _WIN32 */
+
+#include "dvdread/dvd_reader.h"
#define CHECK_VALUE(arg) \
if(!(arg)) { \
@@ -12,4 +35,7 @@
__FILE__, __LINE__, # arg ); \
}
-#endif /* DVDREAD_INTERNAL_H */
+int UDFReadBlocksRaw(dvd_reader_t *device, uint32_t lb_number,
+ size_t block_count, unsigned char *data, int encrypted);
+
+#endif /* LIBDVDREAD_DVDREAD_INTERNAL_H */
diff --git a/lib/libdvd/libdvdread/src/ifo_print.c b/lib/libdvd/libdvdread/src/ifo_print.c
index fd1e7edb1d..4d4eb885b9 100644
--- a/lib/libdvd/libdvdread/src/ifo_print.c
+++ b/lib/libdvd/libdvdread/src/ifo_print.c
@@ -1,20 +1,19 @@
/*
- * This program is free software; you can redistribute it and/or modify
+ * This file is part of libdvdread.
+ *
+ * libdvdread is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * libdvdread is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * $Id: ifo_print.c 1135 2008-09-06 21:55:51Z rathann $
- *
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdread; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <stdio.h>
@@ -25,9 +24,9 @@
#include <ctype.h>
#include <assert.h>
-#include "ifo_types.h"
-#include "ifo_read.h"
-#include "ifo_print.h"
+#include "dvdread/ifo_types.h"
+#include "dvdread/ifo_read.h"
+#include "dvdread/ifo_print.h"
/* Put this in some other file / package? It's used in nav_print too. */
static void ifo_print_time(int level, dvd_time_t *dtime) {
@@ -131,7 +130,7 @@ static void ifo_print_video_attributes(int level, video_attr_t *attr) {
printf("(please send a bug report), ");
}
- // Wide is allways allowed..!!!
+ // Wide is always allowed..!!!
switch(attr->permitted_df) {
case 0:
printf("pan&scan+letterboxed, ");
@@ -329,7 +328,7 @@ static void ifo_print_audio_attributes(int level, audio_attr_t *attr) {
case 1: // Normal audio
printf("Normal Caption ");
break;
- case 2: // visually imparied
+ case 2: // visually impaired
printf("Audio for visually impaired ");
break;
case 3: // Directors 1
@@ -427,7 +426,7 @@ static void ifo_print_subp_attributes(int level, subp_attr_t *attr) {
}
-static void ifo_print_USER_OPS(user_ops_t *user_ops) {
+static void ifoPrint_USER_OPS(user_ops_t *user_ops) {
uint32_t uops;
unsigned char *ptr = (unsigned char *)user_ops;
@@ -496,7 +495,7 @@ static void ifo_print_USER_OPS(user_ops_t *user_ops) {
}
-void ifo_print_VMGI_MAT(vmgi_mat_t *vmgi_mat) {
+static void ifoPrint_VMGI_MAT(vmgi_mat_t *vmgi_mat) {
printf("VMG Identifier: %.12s\n", vmgi_mat->vmg_identifier);
printf("Last Sector of VMG: %08x\n", vmgi_mat->vmg_last_sector);
@@ -545,7 +544,7 @@ void ifo_print_VMGI_MAT(vmgi_mat_t *vmgi_mat) {
}
-void ifo_print_VTSI_MAT(vtsi_mat_t *vtsi_mat) {
+static void ifoPrint_VTSI_MAT(vtsi_mat_t *vtsi_mat) {
int i;
printf("VTS Identifier: %.12s\n", vtsi_mat->vts_identifier);
@@ -609,7 +608,7 @@ void ifo_print_VTSI_MAT(vtsi_mat_t *vtsi_mat) {
}
-static void ifo_print_PGC_COMMAND_TBL(pgc_command_tbl_t *cmd_tbl) {
+static void ifoPrint_PGC_COMMAND_TBL(pgc_command_tbl_t *cmd_tbl) {
int i;
if(cmd_tbl == NULL) {
@@ -634,7 +633,7 @@ static void ifo_print_PGC_COMMAND_TBL(pgc_command_tbl_t *cmd_tbl) {
}
-static void ifo_print_PGC_PROGRAM_MAP(pgc_program_map_t *program_map, int nr) {
+static void ifoPrint_PGC_PROGRAM_MAP(pgc_program_map_t *program_map, int nr) {
int i;
if(program_map == NULL) {
@@ -648,7 +647,7 @@ static void ifo_print_PGC_PROGRAM_MAP(pgc_program_map_t *program_map, int nr) {
}
-static void ifo_print_CELL_PLAYBACK(cell_playback_t *cell_playback, int nr) {
+static void ifoPrint_CELL_PLAYBACK(cell_playback_t *cell_playback, int nr) {
int i;
if(cell_playback == NULL) {
@@ -686,7 +685,7 @@ static void ifo_print_CELL_PLAYBACK(cell_playback_t *cell_playback, int nr) {
break;
case 2:
case 3:
- printf("(send bug repport) ");
+ printf("(send bug report) ");
break;
}
}
@@ -718,7 +717,7 @@ static void ifo_print_CELL_PLAYBACK(cell_playback_t *cell_playback, int nr) {
}
}
-static void ifo_print_CELL_POSITION(cell_position_t *cell_position, int nr) {
+static void ifoPrint_CELL_POSITION(cell_position_t *cell_position, int nr) {
int i;
if(cell_position == NULL) {
@@ -733,7 +732,7 @@ static void ifo_print_CELL_POSITION(cell_position_t *cell_position, int nr) {
}
-void ifo_print_PGC(pgc_t *pgc) {
+static void ifoPrint_PGC(pgc_t *pgc) {
int i;
if (!pgc) {
@@ -748,7 +747,7 @@ void ifo_print_PGC(pgc_t *pgc) {
/* If no programs/no time then does this mean anything? */
printf("Prohibited user operations: ");
- ifo_print_USER_OPS(&pgc->prohibited_ops);
+ ifoPrint_USER_OPS(&pgc->prohibited_ops);
for(i = 0; i < 8; i++) {
if(pgc->audio_control[i] & 0x8000) { /* The 'is present' bit */
@@ -782,15 +781,15 @@ void ifo_print_PGC(pgc_t *pgc) {
}
}
- /* Memmory offsets to div. tables. */
- ifo_print_PGC_COMMAND_TBL(pgc->command_tbl);
- ifo_print_PGC_PROGRAM_MAP(pgc->program_map, pgc->nr_of_programs);
- ifo_print_CELL_PLAYBACK(pgc->cell_playback, pgc->nr_of_cells);
- ifo_print_CELL_POSITION(pgc->cell_position, pgc->nr_of_cells);
+ /* Memory offsets to div. tables. */
+ ifoPrint_PGC_COMMAND_TBL(pgc->command_tbl);
+ ifoPrint_PGC_PROGRAM_MAP(pgc->program_map, pgc->nr_of_programs);
+ ifoPrint_CELL_PLAYBACK(pgc->cell_playback, pgc->nr_of_cells);
+ ifoPrint_CELL_POSITION(pgc->cell_position, pgc->nr_of_cells);
}
-void ifo_print_TT_SRPT(tt_srpt_t *tt_srpt) {
+static void ifoPrint_TT_SRPT(tt_srpt_t *tt_srpt) {
int i;
printf("Number of TitleTrack search pointers: %i\n",
@@ -807,7 +806,7 @@ void ifo_print_TT_SRPT(tt_srpt_t *tt_srpt) {
printf("\tTitle playback type: (%02x)\n",
*(uint8_t *)&(tt_srpt->title[i].pb_ty));
printf("\t\t%s\n",
- tt_srpt->title[i].pb_ty.multi_or_random_pgc_title ? "Random or Shuffle" : "Sequencial");
+ tt_srpt->title[i].pb_ty.multi_or_random_pgc_title ? "Random or Shuffle" : "Sequential");
if (tt_srpt->title[i].pb_ty.jlc_exists_in_cell_cmd) printf("\t\tJump/Link/Call exists in cell cmd\n");
if (tt_srpt->title[i].pb_ty.jlc_exists_in_prepost_cmd) printf("\t\tJump/Link/Call exists in pre/post cmd\n");
if (tt_srpt->title[i].pb_ty.jlc_exists_in_button_cmd) printf("\t\tJump/Link/Call exists in button cmd\n");
@@ -823,7 +822,7 @@ void ifo_print_TT_SRPT(tt_srpt_t *tt_srpt) {
}
-void ifo_print_VTS_PTT_SRPT(vts_ptt_srpt_t *vts_ptt_srpt) {
+static void ifoPrint_VTS_PTT_SRPT(vts_ptt_srpt_t *vts_ptt_srpt) {
int i, j;
printf(" nr_of_srpts %i last byte %i\n",
vts_ptt_srpt->nr_of_srpts,
@@ -844,7 +843,7 @@ static void hexdump(uint8_t *ptr, int len) {
printf("%02x ", *ptr++);
}
-void ifo_print_PTL_MAIT(ptl_mait_t *ptl_mait) {
+static void ifoPrint_PTL_MAIT(ptl_mait_t *ptl_mait) {
int i, j;
printf("Number of Countries: %i\n", ptl_mait->nr_of_countries);
@@ -873,7 +872,7 @@ void ifo_print_PTL_MAIT(ptl_mait_t *ptl_mait) {
}
}
-void ifo_print_VTS_TMAPT(vts_tmapt_t *vts_tmapt) {
+static void ifoPrint_VTS_TMAPT(vts_tmapt_t *vts_tmapt) {
unsigned int timeunit;
int i, j;
@@ -896,7 +895,7 @@ void ifo_print_VTS_TMAPT(vts_tmapt_t *vts_tmapt) {
}
}
-void ifo_print_C_ADT(c_adt_t *c_adt) {
+static void ifoPrint_C_ADT(c_adt_t *c_adt) {
int i, entries;
printf("Number of VOBs in this VOBS: %i\n", c_adt->nr_of_vobs);
@@ -913,7 +912,7 @@ void ifo_print_C_ADT(c_adt_t *c_adt) {
}
-void ifo_print_VOBU_ADMAP(vobu_admap_t *vobu_admap) {
+static void ifoPrint_VOBU_ADMAP(vobu_admap_t *vobu_admap) {
int i, entries;
entries = (vobu_admap->last_byte + 1 - VOBU_ADMAP_SIZE)/4;
@@ -923,7 +922,7 @@ void ifo_print_VOBU_ADMAP(vobu_admap_t *vobu_admap) {
}
}
-const char *ifo_print_menu_name(int type) {
+static const char *ifo_print_menu_name(int type) {
const char *menu_name;
menu_name="";
switch (type) {
@@ -953,7 +952,7 @@ const char *ifo_print_menu_name(int type) {
}
/* pgc_type=1 for menu, 0 for title. */
-void ifo_print_PGCIT(pgcit_t *pgcit, int pgc_type) {
+static void ifoPrint_PGCIT(pgcit_t *pgcit, int pgc_type) {
int i;
printf("\nNumber of Program Chains: %3i\n", pgcit->nr_of_pgci_srp);
@@ -972,12 +971,12 @@ void ifo_print_PGCIT(pgcit_t *pgcit, int pgc_type) {
pgcit->pgci_srp[i].entry_id);
}
printf("Parental ID mask 0x%04x\n", pgcit->pgci_srp[i].ptl_id_mask);
- ifo_print_PGC(pgcit->pgci_srp[i].pgc);
+ ifoPrint_PGC(pgcit->pgci_srp[i].pgc);
}
}
-void ifo_print_PGCI_UT(pgci_ut_t *pgci_ut) {
+static void ifoPrint_PGCI_UT(pgci_ut_t *pgci_ut) {
int i, menu;
printf("Number of Menu Language Units (PGCI_LU): %3i\n", pgci_ut->nr_of_lus);
@@ -1017,12 +1016,12 @@ void ifo_print_PGCI_UT(pgci_ut_t *pgci_ut) {
menu^=0x08;
}
printf("\n");
- ifo_print_PGCIT(pgci_ut->lu[i].pgcit, 1);
+ ifoPrint_PGCIT(pgci_ut->lu[i].pgcit, 1);
}
}
-static void ifo_print_VTS_ATTRIBUTES(vts_attributes_t *vts_attributes) {
+static void ifoPrint_VTS_ATTRIBUTES(vts_attributes_t *vts_attributes) {
int i;
printf("VTS_CAT Application type: %08x\n", vts_attributes->vts_cat);
@@ -1066,13 +1065,13 @@ static void ifo_print_VTS_ATTRIBUTES(vts_attributes_t *vts_attributes) {
}
-void ifo_print_VTS_ATRT(vts_atrt_t *vts_atrt) {
+static void ifoPrint_VTS_ATRT(vts_atrt_t *vts_atrt) {
int i;
printf("Number of Video Title Sets: %3i\n", vts_atrt->nr_of_vtss);
for(i = 0; i < vts_atrt->nr_of_vtss; i++) {
printf("\nVideo Title Set %i\n", i + 1);
- ifo_print_VTS_ATTRIBUTES(&vts_atrt->vts[i]);
+ ifoPrint_VTS_ATTRIBUTES(&vts_atrt->vts[i]);
}
}
@@ -1090,37 +1089,37 @@ void ifo_print(dvd_reader_t *dvd, int title) {
if(ifohandle->vmgi_mat) {
printf("VMG top level\n-------------\n");
- ifo_print_VMGI_MAT(ifohandle->vmgi_mat);
+ ifoPrint_VMGI_MAT(ifohandle->vmgi_mat);
printf("\nFirst Play PGC\n--------------\n");
if(ifohandle->first_play_pgc)
- ifo_print_PGC(ifohandle->first_play_pgc);
+ ifoPrint_PGC(ifohandle->first_play_pgc);
else
printf("No First Play PGC present\n");
printf("\nTitle Track search pointer table\n");
printf( "------------------------------------------------\n");
- ifo_print_TT_SRPT(ifohandle->tt_srpt);
+ ifoPrint_TT_SRPT(ifohandle->tt_srpt);
printf("\nMenu PGCI Unit table\n");
printf( "--------------------\n");
if(ifohandle->pgci_ut) {
- ifo_print_PGCI_UT(ifohandle->pgci_ut);
+ ifoPrint_PGCI_UT(ifohandle->pgci_ut);
} else {
printf("No PGCI Unit table present\n");
}
- printf("\nParental Manegment Information table\n");
+ printf("\nParental Management Information table\n");
printf( "------------------------------------\n");
if(ifohandle->ptl_mait) {
- ifo_print_PTL_MAIT(ifohandle->ptl_mait);
+ ifoPrint_PTL_MAIT(ifohandle->ptl_mait);
} else {
printf("No Parental Management Information present\n");
}
printf("\nVideo Title Set Attribute Table\n");
printf( "-------------------------------\n");
- ifo_print_VTS_ATRT(ifohandle->vts_atrt);
+ ifoPrint_VTS_ATRT(ifohandle->vts_atrt);
printf("\nText Data Manager Information\n");
printf( "-----------------------------\n");
@@ -1130,18 +1129,18 @@ void ifo_print(dvd_reader_t *dvd, int title) {
printf("No Text Data Manager Information present\n");
}
- printf("\nMenu Cell Adress table\n");
+ printf("\nMenu Cell Address table\n");
printf( "-----------------\n");
if(ifohandle->menu_c_adt) {
- ifo_print_C_ADT(ifohandle->menu_c_adt);
+ ifoPrint_C_ADT(ifohandle->menu_c_adt);
} else {
- printf("No Menu Cell Adress table present\n");
+ printf("No Menu Cell Address table present\n");
}
printf("\nVideo Manager Menu VOBU address map\n");
printf( "-----------------\n");
if(ifohandle->menu_vobu_admap) {
- ifo_print_VOBU_ADMAP(ifohandle->menu_vobu_admap);
+ ifoPrint_VOBU_ADMAP(ifohandle->menu_vobu_admap);
} else {
printf("No Menu VOBU address map present\n");
}
@@ -1151,20 +1150,20 @@ void ifo_print(dvd_reader_t *dvd, int title) {
if(ifohandle->vtsi_mat) {
printf("VTS top level\n-------------\n");
- ifo_print_VTSI_MAT(ifohandle->vtsi_mat);
+ ifoPrint_VTSI_MAT(ifohandle->vtsi_mat);
printf("\nPart of Title Track search pointer table\n");
printf( "----------------------------------------------\n");
- ifo_print_VTS_PTT_SRPT(ifohandle->vts_ptt_srpt);
+ ifoPrint_VTS_PTT_SRPT(ifohandle->vts_ptt_srpt);
printf("\nPGCI Unit table\n");
printf( "--------------------\n");
- ifo_print_PGCIT(ifohandle->vts_pgcit, 0);
+ ifoPrint_PGCIT(ifohandle->vts_pgcit, 0);
printf("\nMenu PGCI Unit table\n");
printf( "--------------------\n");
if(ifohandle->pgci_ut) {
- ifo_print_PGCI_UT(ifohandle->pgci_ut);
+ ifoPrint_PGCI_UT(ifohandle->pgci_ut);
} else {
printf("No Menu PGCI Unit table present\n");
}
@@ -1172,80 +1171,35 @@ void ifo_print(dvd_reader_t *dvd, int title) {
printf("\nVTS Time Map table\n");
printf( "-----------------\n");
if(ifohandle->vts_tmapt) {
- ifo_print_VTS_TMAPT(ifohandle->vts_tmapt);
+ ifoPrint_VTS_TMAPT(ifohandle->vts_tmapt);
} else {
printf("No VTS Time Map table present\n");
}
- printf("\nMenu Cell Adress table\n");
+ printf("\nMenu Cell Address table\n");
printf( "-----------------\n");
if(ifohandle->menu_c_adt) {
- ifo_print_C_ADT(ifohandle->menu_c_adt);
+ ifoPrint_C_ADT(ifohandle->menu_c_adt);
} else {
- printf("No Cell Adress table present\n");
+ printf("No Cell Address table present\n");
}
printf("\nVideo Title Set Menu VOBU address map\n");
printf( "-----------------\n");
if(ifohandle->menu_vobu_admap) {
- ifo_print_VOBU_ADMAP(ifohandle->menu_vobu_admap);
+ ifoPrint_VOBU_ADMAP(ifohandle->menu_vobu_admap);
} else {
printf("No Menu VOBU address map present\n");
}
printf("\nCell Adress table\n");
printf( "-----------------\n");
- ifo_print_C_ADT(ifohandle->vts_c_adt);
+ ifoPrint_C_ADT(ifohandle->vts_c_adt);
printf("\nVideo Title Set VOBU address map\n");
printf( "-----------------\n");
- ifo_print_VOBU_ADMAP(ifohandle->vts_vobu_admap);
+ ifoPrint_VOBU_ADMAP(ifohandle->vts_vobu_admap);
}
ifoClose(ifohandle);
}
-
-/*
- * $Log$
- * Revision 1.3 2004/10/22 11:36:19 jcdutton
- * Stop seg fault when using ifo_dump.
- *
- * Revision 1.2 2004/09/27 12:24:01 jcdutton
- * Add extra info to printout when using ifo_dump.
- *
- * Revision 1.1 2004/01/11 21:43:13 mroi
- * big build system changes
- * * cleaned up all Makefiles and added a Makefile.common
- * * added relchk script
- * * moved libdvdread files to a dvdread subdir
- * * moved DVD VM to a vm subdir
- * * removed unused code in read_cache.c
- *
- * Revision 1.4 2004/01/01 15:13:13 jcdutton
- * Put ifo_print.c and .h back in.
- *
- * Revision 1.7 2003/04/28 15:17:17 jcdutton
- * Update ifodump to work with new libdvdnav cvs, instead of needing libdvdread.
- *
- * Revision 1.6 2003/04/05 22:49:04 jcdutton
- * Update with more info from the latest libdvdread.
- *
- * Revision 1.5 2003/04/05 13:03:49 jcdutton
- * Small updates.
- *
- * Revision 1.4 2003/04/01 08:01:03 jcdutton
- * Add VTS Time map display. Requires libdvdread 0.9.4. The same version that comes with xine.
- *
- * Revision 1.3 2003/03/14 15:49:18 mroi
- * adjust to new libdvdread version
- *
- * Revision 1.2 2002/08/30 05:12:33 jcdutton
- * Minor update now that I know what PGC Entry IDs are for.
- *
- * Revision 1.1.1.1 2002/08/28 09:48:35 jcdutton
- * Initial import into CVS.
- *
- *
- *
- */
-
diff --git a/lib/libdvd/libdvdread/src/ifo_print.h b/lib/libdvd/libdvdread/src/ifo_print.h
deleted file mode 100644
index 4c958f1c12..0000000000
--- a/lib/libdvd/libdvdread/src/ifo_print.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *
- * $Id: ifo_print.h 1135 2008-09-06 21:55:51Z rathann $
- *
- */
-
-#ifndef IFO_PRINT_H_INCLUDED
-#define IFO_PRINT_H_INCLUDED
-
-#include <inttypes.h>
-#include "ifo_types.h"
-
-void ifo_print(dvd_reader_t *dvd, int title);
-void dvdread_print_time(dvd_time_t *dtime);
-
-#endif /* IFO_PRINT_H_INCLUDED */
-
-/*
- * $Log$
- * Revision 1.1 2004/01/11 21:43:13 mroi
- * big build system changes
- * * cleaned up all Makefiles and added a Makefile.common
- * * added relchk script
- * * moved libdvdread files to a dvdread subdir
- * * moved DVD VM to a vm subdir
- * * removed unused code in read_cache.c
- *
- * Revision 1.4 2004/01/01 15:13:13 jcdutton
- * Put ifo_print.c and .h back in.
- *
- * Revision 1.2 2003/04/28 15:17:17 jcdutton
- * Update ifodump to work with new libdvdnav cvs, instead of needing libdvdread.
- *
- * Revision 1.1.1.1 2002/08/28 09:48:35 jcdutton
- * Initial import into CVS.
- *
- *
- *
- */
-
diff --git a/lib/libdvd/libdvdread/src/ifo_read.c b/lib/libdvd/libdvdread/src/ifo_read.c
index a89d7f2273..1bf1d6702d 100644
--- a/lib/libdvd/libdvdread/src/ifo_read.c
+++ b/lib/libdvd/libdvdread/src/ifo_read.c
@@ -1,21 +1,23 @@
/*
* Copyright (C) 2000, 2001, 2002, 2003
- * Björn Englund <d4bjorn@dtek.chalmers.se>,
- * Håkan Hjort <d95hjort@dtek.chalmers.se>
+ * Björn Englund <d4bjorn@dtek.chalmers.se>,
+ * HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>
*
- * This program is free software; you can redistribute it and/or modify
+ * This file is part of libdvdread.
+ *
+ * libdvdread is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * libdvdread is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdread; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
@@ -26,11 +28,11 @@
#include <string.h>
#include "bswap.h"
-#include "ifo_types.h"
-#include "ifo_read.h"
-#include "dvd_reader.h"
+#include "dvdread/ifo_types.h"
+#include "dvdread/ifo_read.h"
+#include "dvdread/dvd_reader.h"
#include "dvdread_internal.h"
-#include "bitreader.h"
+#include "dvdread/bitreader.h"
#ifndef DVD_BLOCK_LEN
#define DVD_BLOCK_LEN 2048
@@ -287,6 +289,8 @@ static void free_ptl_mait(ptl_mait_t* ptl_mait, int num_entries) {
ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) {
ifo_handle_t *ifofile;
+ int bup_file_opened = 0;
+ char ifo_filename[13];
ifofile = (ifo_handle_t *)malloc(sizeof(ifo_handle_t));
if(!ifofile)
@@ -295,14 +299,20 @@ ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) {
memset(ifofile, 0, sizeof(ifo_handle_t));
ifofile->file = DVDOpenFile(dvd, title, DVD_READ_INFO_FILE);
- if(!ifofile->file) /* Should really catch any error and try to fallback */
+ if(!ifofile->file) { /* Failed to open IFO, try to open BUP */
ifofile->file = DVDOpenFile(dvd, title, DVD_READ_INFO_BACKUP_FILE);
+ bup_file_opened = 1;
+ }
+
+ if (title)
+ snprintf(ifo_filename, 12, "VTS_%02d_0.%s", title, bup_file_opened ? "BUP" : "IFO");
+ else
+ snprintf(ifo_filename, 12, "VIDEO_TS.%s", bup_file_opened ? "BUP" : "IFO");
+
+ ifo_filename[12] = '\0';
+
if(!ifofile->file) {
- if(title) {
- fprintf(stderr, "libdvdread: Can't open file VTS_%02d_0.IFO.\n", title);
- } else {
- fprintf(stderr, "libdvdread: Can't open file VIDEO_TS.IFO.\n");
- }
+ fprintf(stderr, "libdvdread: Can't open file %s.\n", ifo_filename);
free(ifofile);
return NULL;
}
@@ -311,21 +321,15 @@ ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) {
if(ifoRead_VMG(ifofile)) {
/* These are both mandatory. */
- if(!ifoRead_FP_PGC(ifofile) || !ifoRead_TT_SRPT(ifofile)) {
- fprintf(stderr, "libdvdread: Invalid main menu IFO (VIDEO_TS.IFO), ifoRead_FP_PGC() failed.\n");
- ifoClose(ifofile);
- return NULL;
- }
+ if(!ifoRead_FP_PGC(ifofile) || !ifoRead_TT_SRPT(ifofile))
+ goto ifoOpen_try_bup;
ifoRead_PGCI_UT(ifofile);
ifoRead_PTL_MAIT(ifofile);
/* This is also mandatory. */
- if(!ifoRead_VTS_ATRT(ifofile)) {
- fprintf(stderr, "libdvdread: Invalid main menu IFO (VIDEO_TS.IFO), ifoRead_VTS_ATRT() failed.\n");
- ifoClose(ifofile);
- return NULL;
- }
+ if(!ifoRead_VTS_ATRT(ifofile))
+ goto ifoOpen_try_bup;
ifoRead_TXTDT_MGI(ifofile);
ifoRead_C_ADT(ifofile);
@@ -336,35 +340,85 @@ ifo_handle_t *ifoOpen(dvd_reader_t *dvd, int title) {
if(ifoRead_VTS(ifofile)) {
- if(!ifoRead_VTS_PTT_SRPT(ifofile) || !ifoRead_PGCIT(ifofile)) {
- fprintf(stderr, "libdvdread: Invalid title IFO (VTS_%02d_0.IFO).\n",
- title);
+ if(!ifoRead_VTS_PTT_SRPT(ifofile) || !ifoRead_PGCIT(ifofile))
+ goto ifoOpen_try_bup;
+
+ ifoRead_PGCI_UT(ifofile);
+ ifoRead_VTS_TMAPT(ifofile);
+ ifoRead_C_ADT(ifofile);
+ ifoRead_VOBU_ADMAP(ifofile);
+
+ if(!ifoRead_TITLE_C_ADT(ifofile) || !ifoRead_TITLE_VOBU_ADMAP(ifofile))
+ goto ifoOpen_try_bup;
+
+ return ifofile;
+ }
+
+ifoOpen_try_bup:
+ if (bup_file_opened)
+ goto ifoOpen_fail;
+
+ /* Try BUP instead */
ifoClose(ifofile);
+
+ ifofile = (ifo_handle_t *)malloc(sizeof(ifo_handle_t));
+ if(!ifofile)
return NULL;
+
+ memset(ifofile, 0, sizeof(ifo_handle_t));
+ ifofile->file = DVDOpenFile(dvd, title, DVD_READ_INFO_BACKUP_FILE);
+
+ if (title)
+ snprintf(ifo_filename, 12, "VTS_%02d_0.BUP", title);
+ else
+ strncpy(ifo_filename, "VIDEO_TS.BUP", 12);
+
+ if (!ifofile->file) {
+ fprintf(stderr, "libdvdread: Can't open file %s.\n", ifo_filename);
+ free(ifofile);
+ return NULL;
+ }
+ bup_file_opened = 1;
+
+ /* First check if this is a VMGI file. */
+ if(ifoRead_VMG(ifofile)) {
+
+ /* These are both mandatory. */
+ if(!ifoRead_FP_PGC(ifofile) || !ifoRead_TT_SRPT(ifofile))
+ goto ifoOpen_fail;
+
+ ifoRead_PGCI_UT(ifofile);
+ ifoRead_PTL_MAIT(ifofile);
+
+ /* This is also mandatory. */
+ if(!ifoRead_VTS_ATRT(ifofile))
+ goto ifoOpen_fail;
+
+ ifoRead_TXTDT_MGI(ifofile);
+ ifoRead_C_ADT(ifofile);
+ ifoRead_VOBU_ADMAP(ifofile);
+
+ return ifofile;
}
+ if(ifoRead_VTS(ifofile)) {
+
+ if(!ifoRead_VTS_PTT_SRPT(ifofile) || !ifoRead_PGCIT(ifofile))
+ goto ifoOpen_fail;
ifoRead_PGCI_UT(ifofile);
ifoRead_VTS_TMAPT(ifofile);
ifoRead_C_ADT(ifofile);
ifoRead_VOBU_ADMAP(ifofile);
- if(!ifoRead_TITLE_C_ADT(ifofile) || !ifoRead_TITLE_VOBU_ADMAP(ifofile)) {
- fprintf(stderr, "libdvdread: Invalid title IFO (VTS_%02d_0.IFO).\n",
- title);
- ifoClose(ifofile);
- return NULL;
- }
+ if(!ifoRead_TITLE_C_ADT(ifofile) || !ifoRead_TITLE_VOBU_ADMAP(ifofile))
+ goto ifoOpen_fail;
return ifofile;
}
- if(title) {
- fprintf(stderr, "libdvdread: Invalid IFO for title %d (VTS_%02d_0.IFO).\n",
- title, title);
- } else {
- fprintf(stderr, "libdvdread: Invalid IFO for VMGM (VIDEO_TS.IFO).\n");
- }
+ifoOpen_fail:
+ fprintf(stderr, "libdvdread: Invalid IFO for title %d (%s).\n", title, ifo_filename);
ifoClose(ifofile);
return NULL;
}
@@ -843,10 +897,10 @@ static int ifoRead_PGC(ifo_handle_t *ifofile, pgc_t *pgc, unsigned int offset) {
/* verify time (look at print_time) */
for(i = 0; i < 8; i++)
- if(!pgc->audio_control[i] & 0x8000) /* The 'is present' bit */
+ if(!(pgc->audio_control[i] & 0x8000)) /* The 'is present' bit */
CHECK_ZERO(pgc->audio_control[i]);
for(i = 0; i < 32; i++)
- if(!pgc->subp_control[i] & 0x80000000) /* The 'is present' bit */
+ if(!(pgc->subp_control[i] & 0x80000000)) /* The 'is present' bit */
CHECK_ZERO(pgc->subp_control[i]);
/* Check that time is 0:0:0:0 also if nr_of_programs == 0 */
@@ -1085,9 +1139,9 @@ void ifoFree_TT_SRPT(ifo_handle_t *ifofile) {
int ifoRead_VTS_PTT_SRPT(ifo_handle_t *ifofile) {
- vts_ptt_srpt_t *vts_ptt_srpt;
+ vts_ptt_srpt_t *vts_ptt_srpt = NULL;
int info_length, i, j;
- uint32_t *data;
+ uint32_t *data = NULL;
if(!ifofile)
return 0;
@@ -1102,16 +1156,16 @@ int ifoRead_VTS_PTT_SRPT(ifo_handle_t *ifofile) {
ifofile->vtsi_mat->vts_ptt_srpt * DVD_BLOCK_LEN))
return 0;
- vts_ptt_srpt = (vts_ptt_srpt_t *)malloc(sizeof(vts_ptt_srpt_t));
+ vts_ptt_srpt = malloc(sizeof(vts_ptt_srpt_t));
if(!vts_ptt_srpt)
return 0;
+ vts_ptt_srpt->title = NULL;
ifofile->vts_ptt_srpt = vts_ptt_srpt;
if(!(DVDReadBytes(ifofile->file, vts_ptt_srpt, VTS_PTT_SRPT_SIZE))) {
fprintf(stderr, "libdvdread: Unable to read PTT search table.\n");
- free(vts_ptt_srpt);
- return 0;
+ goto fail;
}
B2N_16(vts_ptt_srpt->nr_of_srpts);
@@ -1122,21 +1176,19 @@ int ifoRead_VTS_PTT_SRPT(ifo_handle_t *ifofile) {
CHECK_VALUE(vts_ptt_srpt->nr_of_srpts < 100); /* ?? */
info_length = vts_ptt_srpt->last_byte + 1 - VTS_PTT_SRPT_SIZE;
+ data = malloc(info_length);
+ if(!data)
+ goto fail;
- data = (uint32_t *)malloc(info_length);
- if(!data) {
- free(vts_ptt_srpt);
- ifofile->vts_ptt_srpt = 0;
- return 0;
- }
if(!(DVDReadBytes(ifofile->file, data, info_length))) {
fprintf(stderr, "libdvdread: Unable to read PTT search table.\n");
- free(vts_ptt_srpt);
- free(data);
- ifofile->vts_ptt_srpt = 0;
- return 0;
+ goto fail;
}
+ if(vts_ptt_srpt->nr_of_srpts > info_length / sizeof(*data)) {
+ fprintf(stderr, "libdvdread: PTT search table too small.\n");
+ goto fail;
+ }
for(i = 0; i < vts_ptt_srpt->nr_of_srpts; i++) {
B2N_32(data[i]);
/* assert(data[i] + sizeof(ptt_info_t) <= vts_ptt_srpt->last_byte + 1);
@@ -1149,22 +1201,21 @@ int ifoRead_VTS_PTT_SRPT(ifo_handle_t *ifofile) {
vts_ptt_srpt->ttu_offset = data;
vts_ptt_srpt->title = malloc(vts_ptt_srpt->nr_of_srpts * sizeof(ttu_t));
- if(!vts_ptt_srpt->title) {
- free(vts_ptt_srpt);
- free(data);
- ifofile->vts_ptt_srpt = 0;
- return 0;
- }
+ if(!vts_ptt_srpt->title)
+ goto fail;
+
for(i = 0; i < vts_ptt_srpt->nr_of_srpts; i++) {
int n;
if(i < vts_ptt_srpt->nr_of_srpts - 1)
n = (data[i+1] - data[i]);
else
n = (vts_ptt_srpt->last_byte + 1 - data[i]);
+
/* assert(n > 0 && (n % 4) == 0);
Magic Knight Rayearth Daybreak is mastered very strange and has
Titles with 0 PTTs. */
if(n < 0) n = 0;
+
CHECK_VALUE(n % 4 == 0);
vts_ptt_srpt->title[i].nr_of_ptts = n / 4;
@@ -1172,10 +1223,8 @@ int ifoRead_VTS_PTT_SRPT(ifo_handle_t *ifofile) {
if(!vts_ptt_srpt->title[i].ptt) {
for(n = 0; n < i; n++)
free(vts_ptt_srpt->title[n].ptt);
- free(vts_ptt_srpt);
- free(data);
- ifofile->vts_ptt_srpt = 0;
- return 0;
+
+ goto fail;
}
for(j = 0; j < vts_ptt_srpt->title[i].nr_of_ptts; j++) {
/* The assert placed here because of Magic Knight Rayearth Daybreak */
@@ -1205,6 +1254,13 @@ int ifoRead_VTS_PTT_SRPT(ifo_handle_t *ifofile) {
}
return 1;
+
+fail:
+ free(data);
+ ifofile->vts_ptt_srpt = 0;
+ free(vts_ptt_srpt->title);
+ free(vts_ptt_srpt);
+ return 0;
}
@@ -1235,7 +1291,7 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofile) {
if(!ifofile->vmgi_mat)
return 0;
- if(ifofile->vmgi_mat->ptl_mait == 0)
+ if(ifofile->vmgi_mat->ptl_mait == NULL)
return 1;
if(!DVDFileSeek_(ifofile->file, ifofile->vmgi_mat->ptl_mait * DVD_BLOCK_LEN))
@@ -1249,7 +1305,7 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofile) {
if(!(DVDReadBytes(ifofile->file, ptl_mait, PTL_MAIT_SIZE))) {
free(ptl_mait);
- ifofile->ptl_mait = 0;
+ ifofile->ptl_mait = NULL;
return 0;
}
@@ -1268,16 +1324,19 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofile) {
ptl_mait->countries = (ptl_mait_country_t *)malloc(info_length);
if(!ptl_mait->countries) {
free(ptl_mait);
- ifofile->ptl_mait = 0;
+ ifofile->ptl_mait = NULL;
return 0;
}
+ for(i = 0; i < ptl_mait->nr_of_countries; i++) {
+ ptl_mait->countries[i].pf_ptl_mai = NULL;
+ }
for(i = 0; i < ptl_mait->nr_of_countries; i++) {
if(!(DVDReadBytes(ifofile->file, &ptl_mait->countries[i], PTL_MAIT_COUNTRY_SIZE))) {
fprintf(stderr, "libdvdread: Unable to read PTL_MAIT.\n");
free(ptl_mait->countries);
free(ptl_mait);
- ifofile->ptl_mait = 0;
+ ifofile->ptl_mait = NULL;
return 0;
}
}
@@ -1291,7 +1350,7 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofile) {
CHECK_ZERO(ptl_mait->countries[i].zero_1);
CHECK_ZERO(ptl_mait->countries[i].zero_2);
CHECK_VALUE(ptl_mait->countries[i].pf_ptl_mai_start_byte
- + 8*2 * (ptl_mait->nr_of_vtss + 1) <= ptl_mait->last_byte + 1);
+ + sizeof(pf_level_t) * (ptl_mait->nr_of_vtss + 1) <= ptl_mait->last_byte + 1);
}
for(i = 0; i < ptl_mait->nr_of_countries; i++) {
@@ -1300,21 +1359,24 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofile) {
if(!DVDFileSeek_(ifofile->file,
ifofile->vmgi_mat->ptl_mait * DVD_BLOCK_LEN
+ ptl_mait->countries[i].pf_ptl_mai_start_byte)) {
- fprintf(stderr, "libdvdread: Unable to seak PTL_MAIT table.\n");
+ fprintf(stderr, "libdvdread: Unable to seek PTL_MAIT table at index %d.\n",i);
free(ptl_mait->countries);
free(ptl_mait);
+ ifofile->ptl_mait = NULL;
return 0;
}
info_length = (ptl_mait->nr_of_vtss + 1) * sizeof(pf_level_t);
pf_temp = (uint16_t *)malloc(info_length);
if(!pf_temp) {
free_ptl_mait(ptl_mait, i);
+ ifofile->ptl_mait = NULL;
return 0;
}
if(!(DVDReadBytes(ifofile->file, pf_temp, info_length))) {
- fprintf(stderr, "libdvdread: Unable to read PTL_MAIT table.\n");
+ fprintf(stderr, "libdvdread: Unable to read PTL_MAIT table at index %d.\n",i);
free(pf_temp);
free_ptl_mait(ptl_mait, i);
+ ifofile->ptl_mait = NULL;
return 0;
}
for (j = 0; j < ((ptl_mait->nr_of_vtss + 1) * 8); j++) {
@@ -1324,11 +1386,12 @@ int ifoRead_PTL_MAIT(ifo_handle_t *ifofile) {
if(!ptl_mait->countries[i].pf_ptl_mai) {
free(pf_temp);
free_ptl_mait(ptl_mait, i);
+ ifofile->ptl_mait = NULL;
return 0;
}
{ /* Transpose the array so we can use C indexing. */
int level, vts;
- for(level = 0; level < 8; level++) {
+ for(level = 0; level < PTL_MAIT_NUM_LEVEL; level++) {
for(vts = 0; vts <= ptl_mait->nr_of_vtss; vts++) {
ptl_mait->countries[i].pf_ptl_mai[vts][level] =
pf_temp[(7-level)*(ptl_mait->nr_of_vtss+1) + vts];
@@ -1352,7 +1415,7 @@ void ifoFree_PTL_MAIT(ifo_handle_t *ifofile) {
}
free(ifofile->ptl_mait->countries);
free(ifofile->ptl_mait);
- ifofile->ptl_mait = 0;
+ ifofile->ptl_mait = NULL;
}
}
@@ -1574,7 +1637,7 @@ static int ifoRead_C_ADT_internal(ifo_handle_t *ifofile,
Enemy of the State region 2 (de) has Titles where nr_of_vobs field
is to high, they high ones are never referenced though. */
if(info_length / sizeof(cell_adr_t) < c_adt->nr_of_vobs) {
- fprintf(stderr, "libdvdread: *C_ADT nr_of_vobs > avaiable info entries\n");
+ fprintf(stderr, "libdvdread: *C_ADT nr_of_vobs > available info entries\n");
c_adt->nr_of_vobs = info_length / sizeof(cell_adr_t);
}
@@ -1833,6 +1896,7 @@ static int ifoRead_PGCIT_internal(ifo_handle_t *ifofile, pgcit_t *pgcit,
ifoFree_PGC(pgcit->pgci_srp[j].pgc);
free(pgcit->pgci_srp[j].pgc);
}
+ free(pgcit->pgci_srp[i].pgc);
goto fail;
}
}
@@ -1847,7 +1911,8 @@ fail:
static void ifoFree_PGCIT_internal(pgcit_t *pgcit) {
if(pgcit) {
int i;
- for(i = 0; i < pgcit->nr_of_pgci_srp; i++) {
+ for(i = 0; i < pgcit->nr_of_pgci_srp; i++)
+ {
ifoFree_PGC(pgcit->pgci_srp[i].pgc);
free(pgcit->pgci_srp[i].pgc);
}
@@ -1985,10 +2050,8 @@ int ifoRead_PGCI_UT(ifo_handle_t *ifofile) {
ifofile->pgci_ut = 0;
return 0;
}
- /*
- * FIXME: Iterate and verify that all menus that should exists accordingly
- * to pgci_ut->lu[i].exists really do?
- */
+ /* FIXME: Iterate and verify that all menus that should exists accordingly
+ * to pgci_ut->lu[i].exists really do? */
}
return 1;
@@ -2209,4 +2272,3 @@ void ifoFree_TXTDT_MGI(ifo_handle_t *ifofile) {
ifofile->txtdt_mgi = 0;
}
}
-
diff --git a/lib/libdvd/libdvdread/src/md5.c b/lib/libdvd/libdvdread/src/md5.c
index 2bfdddee44..197664850a 100644
--- a/lib/libdvd/libdvdread/src/md5.c
+++ b/lib/libdvd/libdvdread/src/md5.c
@@ -16,14 +16,10 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
/* Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995. */
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
#include <sys/types.h>
#include <stdlib.h>
diff --git a/lib/libdvd/libdvdread/src/md5.h b/lib/libdvd/libdvdread/src/md5.h
index 3b7dea1699..810113dd82 100644
--- a/lib/libdvd/libdvdread/src/md5.h
+++ b/lib/libdvd/libdvdread/src/md5.h
@@ -16,10 +16,10 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */
-#ifndef _MD5_H
-#define _MD5_H 1
+#ifndef LIBDVDREAD_MD5_H
+#define LIBDVDREAD_MD5_H
#include <stdio.h>
@@ -158,4 +158,4 @@ rol(md5_uint32 x, int n)
# define rol(x,n) ( ((x) << (n)) | ((x) >> (32-(n))) )
#endif
-#endif
+#endif /* LIBDVDREAD_MD5_H */
diff --git a/lib/libdvd/libdvdread/src/nav_print.c b/lib/libdvd/libdvdread/src/nav_print.c
index a4370c16e6..e027bf5baf 100644
--- a/lib/libdvd/libdvdread/src/nav_print.c
+++ b/lib/libdvd/libdvdread/src/nav_print.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2000, 2001, 2002, 2003 Håkan Hjort <d95hjort@dtek.chalmers.se>
+ * Copyright (C) 2000, 2001, 2002, 2003 HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>
*
* Much of the contents in this file is based on VOBDUMP.
*
@@ -19,18 +19,16 @@
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "config.h"
-
#include <stdio.h>
#include <inttypes.h>
-#include "nav_types.h"
-#include "nav_print.h"
-#include "ifo_print.h"
+#include "dvdread/nav_types.h"
+#include "dvdread/nav_print.h"
+#include "dvdread/ifo_print.h"
static void navPrint_PCI_GI(pci_gi_t *pci_gi) {
int i;
@@ -248,5 +246,3 @@ void navPrint_DSI(dsi_t *dsi) {
navPrint_VOBU_SRI(&dsi->vobu_sri);
navPrint_SYNCI(&dsi->synci);
}
-
-
diff --git a/lib/libdvd/libdvdread/src/nav_read.c b/lib/libdvd/libdvdread/src/nav_read.c
index 8ee6033a25..82e304cd9e 100644
--- a/lib/libdvd/libdvdread/src/nav_read.c
+++ b/lib/libdvd/libdvdread/src/nav_read.c
@@ -1,19 +1,21 @@
/*
- * Copyright (C) 2000, 2001, 2002, 2003 Håkan Hjort <d95hjort@dtek.chalmers.se>
+ * Copyright (C) 2000, 2001, 2002, 2003 HÃ¥kan Hjort <d95hjort@dtek.chalmers.se>
*
- * This program is free software; you can redistribute it and/or modify
+ * This file is part of libdvdread.
+ *
+ * libdvdread is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * libdvdread is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * You should have received a copy of the GNU General Public License along
+ * with libdvdread; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
@@ -24,10 +26,10 @@
#include <inttypes.h>
#include "bswap.h"
-#include "nav_types.h"
-#include "nav_read.h"
+#include "dvdread/nav_types.h"
+#include "dvdread/nav_read.h"
#include "dvdread_internal.h"
-#include "bitreader.h"
+#include "dvdread/bitreader.h"
#define getbits_init dvdread_getbits_init
#define getbits dvdread_getbits
@@ -138,7 +140,6 @@ void navRead_PCI(pci_t *pci, unsigned char *buffer) {
}
-
#ifndef NDEBUG
/* Asserts */
@@ -262,4 +263,3 @@ void navRead_DSI(dsi_t *dsi, unsigned char *buffer) {
/* dsi dsi gi */
CHECK_VALUE(dsi->dsi_gi.zero1 == 0);
}
-
diff --git a/lib/libdvd/libdvdread/version.h b/lib/libdvd/libdvdread/version.h
index fd4fb3ab13..8a8730651b 100644
--- a/lib/libdvd/libdvdread/version.h
+++ b/lib/libdvd/libdvdread/version.h
@@ -1 +1 @@
-#define VERSION "4.1.3"
+#define VERSION "4.2.0"