aboutsummaryrefslogtreecommitdiff
path: root/lib/libdvd
diff options
context:
space:
mode:
authorVoyager1 <voyager@xbmc.org>2014-01-28 20:59:24 +0100
committerVoyager1 <voyager@xbmc.org>2014-02-11 19:23:34 +0100
commitf27f00ba39757e543e911b06333907389e4a28f8 (patch)
tree78e22f481d4ad8ff02cadf2e9c0ee4c867d3e273 /lib/libdvd
parentd3f79278ca2b6839b64a70b4c5f45b985173a5fb (diff)
libdvdread-libdvdnav - updated diff files
Diffstat (limited to 'lib/libdvd')
-rw-r--r--lib/libdvd/patches/01-libdvdread.diff64
-rw-r--r--lib/libdvd/patches/02-libdvdread_fix_symlinks_resolution_vfs.diff15
-rw-r--r--lib/libdvd/patches/cores.diff372
-rw-r--r--lib/libdvd/patches/libdvdnav-accurate_seek.diff689
-rw-r--r--lib/libdvd/patches/libdvdnav.diff1188
-rw-r--r--lib/libdvd/patches/libdvdnav_correct_audio_format_enum.diff23
-rw-r--r--lib/libdvd/patches/libdvdnav_correct_dvdnav_audio_stream_format.diff33
-rw-r--r--lib/libdvd/patches/libdvdnav_reenable_serialstring.diff28
-rw-r--r--lib/libdvd/patches/libdvdnav_remove_unneeded_defines.diff15
9 files changed, 1023 insertions, 1404 deletions
diff --git a/lib/libdvd/patches/01-libdvdread.diff b/lib/libdvd/patches/01-libdvdread.diff
index fbf185f0dd..d31c566053 100644
--- a/lib/libdvd/patches/01-libdvdread.diff
+++ b/lib/libdvd/patches/01-libdvdread.diff
@@ -1,6 +1,6 @@
-diff -uwr libdvdread-4.2.0/Makefile xbmc/lib/libdvd/libdvdread/Makefile
---- libdvdread-4.2.0/Makefile 2008-12-31 09:43:04 +0100
-+++ xbmc/lib/libdvd/libdvdread/Makefile 2013-02-07 14:42:34 +0100
+diff -uwr libdvdread-4.2.1/Makefile xbmc/lib/libdvd/libdvdread/Makefile
+--- libdvdread-4.2.1/Makefile Wed Dec 31 08:43:04 2008
++++ xbmc/lib/libdvd/libdvdread/Makefile Wed Jan 29 20:43:09 2014
@@ -121,7 +121,7 @@
# Clean targets
@@ -10,9 +10,12 @@ diff -uwr libdvdread-4.2.0/Makefile xbmc/lib/libdvd/libdvdread/Makefile
distclean: clean
-diff -uwr libdvdread-4.2.0/src/dvd_input.h xbmc/lib/libdvd/libdvdread/src/dvd_input.h
---- libdvdread-4.2.0/src/dvd_input.h 2010-06-01 19:07:14 +0200
-+++ xbmc/lib/libdvd/libdvdread/src/dvd_input.h 2013-02-07 14:42:34 +0100
+Only in xbmc/lib/libdvd/libdvdread/: config.h
+Only in xbmc/lib/libdvd/libdvdread/: config.mak
+Only in xbmc/lib/libdvd/libdvdread/: obj
+diff -uwr libdvdread-4.2.1/src/dvd_input.h xbmc/lib/libdvd/libdvdread/src/dvd_input.h
+--- libdvdread-4.2.1/src/dvd_input.h Tue Jun 1 18:07:14 2010
++++ xbmc/lib/libdvd/libdvdread/src/dvd_input.h Sun Jan 26 18:36:38 2014
@@ -34,6 +34,13 @@
#if defined( __MINGW32__ )
# undef lseek
@@ -27,10 +30,10 @@ diff -uwr libdvdread-4.2.0/src/dvd_input.h xbmc/lib/libdvd/libdvdread/src/dvd_in
# undef off_t
# define off_t off64_t
# undef stat
-diff -uwr libdvdread-4.2.0/src/dvd_reader.c xbmc/lib/libdvd/libdvdread/src/dvd_reader.c
---- libdvdread-4.2.0/src/dvd_reader.c 2011-06-15 20:09:16 +0200
-+++ xbmc/lib/libdvd/libdvdread/src/dvd_reader.c 2013-02-07 14:42:34 +0100
-@@ -32,6 +32,11 @@
+diff -uwr libdvdread-4.2.1/src/dvd_reader.c xbmc/lib/libdvd/libdvdread/src/dvd_reader.c
+--- libdvdread-4.2.1/src/dvd_reader.c Sun Mar 17 14:08:06 2013
++++ xbmc/lib/libdvd/libdvdread/src/dvd_reader.c Wed Jan 29 20:48:38 2014
+@@ -33,6 +33,11 @@
#include <unistd.h>
#include <limits.h>
#include <dirent.h>
@@ -42,7 +45,7 @@ diff -uwr libdvdread-4.2.0/src/dvd_reader.c xbmc/lib/libdvd/libdvdread/src/dvd_r
/* misc win32 helpers */
#ifdef WIN32
-@@ -105,6 +110,10 @@
+@@ -106,6 +111,10 @@
uint32_t lb_start;
uint32_t seek_pos;
@@ -53,7 +56,18 @@ diff -uwr libdvdread-4.2.0/src/dvd_reader.c xbmc/lib/libdvd/libdvdread/src/dvd_r
/* Information required for a directory path drive. */
size_t title_sizes[ TITLES_MAX ];
dvd_input_t title_devs[ TITLES_MAX ];
-@@ -617,6 +626,10 @@
+@@ -417,8 +426,9 @@
+ if( !(path_copy = strdup( path ) ) )
+ goto DVDOpen_error;
+
+-#ifndef WIN32 /* don't have fchdir, and getcwd( NULL, ... ) is strange */
++#if !defined(WIN32) && !defined(_XBMC) /* don't have fchdir, and getcwd( NULL, ... ) is strange */
+ /* Also WIN32 does not have symlinks, so we don't need this bit of code. */
++ /* XBMC also doesn't need symlink resolution */
+
+ /* Resolve any symlinks and get the absolute dir name. */
+ {
+@@ -618,6 +628,10 @@
memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
dvd_file->filesize = len / DVD_VIDEO_LB_LEN;
@@ -64,7 +78,7 @@ diff -uwr libdvdread-4.2.0/src/dvd_reader.c xbmc/lib/libdvd/libdvdread/src/dvd_r
return dvd_file;
}
-@@ -628,6 +641,18 @@
+@@ -629,6 +643,18 @@
*/
static int findDirFile( const char *path, const char *file, char *filename )
{
@@ -83,7 +97,7 @@ diff -uwr libdvdread-4.2.0/src/dvd_reader.c xbmc/lib/libdvd/libdvdread/src/dvd_r
DIR *dir;
struct dirent *ent;
-@@ -644,6 +669,7 @@
+@@ -645,6 +671,7 @@
}
}
closedir(dir);
@@ -91,7 +105,7 @@ diff -uwr libdvdread-4.2.0/src/dvd_reader.c xbmc/lib/libdvd/libdvdread/src/dvd_r
return -1;
}
-@@ -722,6 +748,9 @@
+@@ -723,6 +750,9 @@
dvd_file->title_devs[ 0 ] = dev;
dvd_file->filesize = dvd_file->title_sizes[ 0 ];
@@ -101,7 +115,7 @@ diff -uwr libdvdread-4.2.0/src/dvd_reader.c xbmc/lib/libdvd/libdvdread/src/dvd_r
return dvd_file;
}
-@@ -749,6 +778,9 @@
+@@ -750,6 +780,9 @@
memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
dvd_file->filesize = len / DVD_VIDEO_LB_LEN;
@@ -111,7 +125,7 @@ diff -uwr libdvdread-4.2.0/src/dvd_reader.c xbmc/lib/libdvd/libdvdread/src/dvd_r
/* Calculate the complete file size for every file in the VOBS */
if( !menu ) {
int cur;
-@@ -792,6 +824,10 @@
+@@ -793,6 +826,10 @@
memset( dvd_file->title_devs, 0, sizeof( dvd_file->title_devs ) );
dvd_file->filesize = 0;
@@ -122,7 +136,7 @@ diff -uwr libdvdread-4.2.0/src/dvd_reader.c xbmc/lib/libdvd/libdvdread/src/dvd_r
if( menu ) {
dvd_input_t dev;
-@@ -1203,6 +1239,100 @@
+@@ -1204,6 +1241,100 @@
return ret + ret2;
}
@@ -223,7 +237,7 @@ diff -uwr libdvdread-4.2.0/src/dvd_reader.c xbmc/lib/libdvd/libdvdread/src/dvd_r
/* This is broken reading more than 2Gb at a time is ssize_t is 32-bit. */
ssize_t DVDReadBlocks( dvd_file_t *dvd_file, int offset,
size_t block_count, unsigned char *data )
-@@ -1213,6 +1343,10 @@
+@@ -1214,6 +1345,10 @@
if( dvd_file == NULL || offset < 0 || data == NULL )
return -1;
@@ -234,7 +248,7 @@ diff -uwr libdvdread-4.2.0/src/dvd_reader.c xbmc/lib/libdvd/libdvdread/src/dvd_r
/* Hack, and it will still fail for multiple opens in a threaded app ! */
if( dvd_file->dvd->css_title != dvd_file->css_title ) {
dvd_file->dvd->css_title = dvd_file->css_title;
-@@ -1295,6 +1429,10 @@
+@@ -1296,6 +1431,10 @@
return 0;
}
@@ -245,7 +259,7 @@ diff -uwr libdvdread-4.2.0/src/dvd_reader.c xbmc/lib/libdvd/libdvdread/src/dvd_r
if( dvd_file->dvd->isImageFile ) {
ret = DVDReadBlocksUDF( dvd_file, (uint32_t) seek_sector,
(size_t) numsec, secbuf, DVDINPUT_NOFLAGS );
-@@ -1302,6 +1440,7 @@
+@@ -1303,6 +1442,7 @@
ret = DVDReadBlocksPath( dvd_file, seek_sector,
(size_t) numsec, secbuf, DVDINPUT_NOFLAGS );
}
@@ -253,10 +267,10 @@ diff -uwr libdvdread-4.2.0/src/dvd_reader.c xbmc/lib/libdvd/libdvdread/src/dvd_r
if( ret != (int) numsec ) {
free( secbuf_base );
-Only in xbmc/lib/libdvd/libdvdread: version.h
-diff -uwr libdvdread-4.2.0/version.sh xbmc/lib/libdvd/libdvdread/version.sh
---- libdvdread-4.2.0/version.sh 2008-05-01 11:27:16 +0200
-+++ xbmc/lib/libdvd/libdvdread/version.sh 2013-02-07 14:42:34 +0100
+Only in xbmc/lib/libdvd/libdvdread/: version.h
+diff -uwr libdvdread-4.2.1/version.sh xbmc/lib/libdvd/libdvdread/version.sh
+--- libdvdread-4.2.1/version.sh Thu May 1 10:27:16 2008
++++ xbmc/lib/libdvd/libdvdread/version.sh Sun Jan 26 19:00:58 2014
@@ -1,18 +1,18 @@
-#!/bin/sh
-
diff --git a/lib/libdvd/patches/02-libdvdread_fix_symlinks_resolution_vfs.diff b/lib/libdvd/patches/02-libdvdread_fix_symlinks_resolution_vfs.diff
deleted file mode 100644
index 016387b831..0000000000
--- a/lib/libdvd/patches/02-libdvdread_fix_symlinks_resolution_vfs.diff
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/lib/libdvd/libdvdread/src/dvd_reader.c b/lib/libdvd/libdvdread/src/dvd_reader.c
-index d9544b3..57dd2d0 100644
---- a/lib/libdvd/libdvdread/src/dvd_reader.c
-+++ b/lib/libdvd/libdvdread/src/dvd_reader.c
-@@ -425,8 +425,9 @@ dvd_reader_t *DVDOpen( const char *ppath )
- if( !(path_copy = strdup( path ) ) )
- goto DVDOpen_error;
-
--#ifndef WIN32 /* don't have fchdir, and getcwd( NULL, ... ) is strange */
-+#if !defined(WIN32) && !defined(_XBMC) /* don't have fchdir, and getcwd( NULL, ... ) is strange */
- /* Also WIN32 does not have symlinks, so we don't need this bit of code. */
-+ /* XBMC also doesn't need symlink resolution */
-
- /* Resolve any symlinks and get the absolute dir name. */
- {
diff --git a/lib/libdvd/patches/cores.diff b/lib/libdvd/patches/cores.diff
index 6ebb8bc4fe..72463226ae 100644
--- a/lib/libdvd/patches/cores.diff
+++ b/lib/libdvd/patches/cores.diff
@@ -1,6 +1,6 @@
-diff -uw dvdnav_diff/config.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/config.h
---- dvdnav_diff/config.h 2013-02-07 14:42:34 +0100
-+++ xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/config.h 2013-01-26 23:33:20 +0100
+diff -uwr ../../dvdnav_diff/config.h xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/config.h
+--- ../../dvdnav_diff/config.h Sun Sep 14 22:02:38 2008
++++ xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/config.h Sat Oct 19 06:29:41 2013
@@ -1,56 +1,95 @@
-/* config.h. Generated by hand. */
+#pragma once
@@ -29,7 +29,7 @@ diff -uw dvdnav_diff/config.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/c
-#define HAVE_DLFCN_H 1
+/* config.h. Generated by hand. */
-+#if defined(_LINUX)
++#if defined(TARGET_POSIX)
+#include "PlatformInclude.h"
+#else
+#include <windows.h>
@@ -116,25 +116,22 @@ diff -uw dvdnav_diff/config.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/c
-
-#endif /* LIBDVDREAD_CONFIG_H */
+#endif
-diff -uw dvdnav_diff/decoder.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/decoder.h
---- dvdnav_diff/decoder.h 2013-02-07 14:42:34 +0100
-+++ xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/decoder.h 2013-02-04 14:58:00 +0100
-@@ -22,6 +22,12 @@
+diff -uwr ../../dvdnav_diff/decoder.h xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/decoder.h
+--- ../../dvdnav_diff/decoder.h Sun Sep 14 21:31:44 2008
++++ xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/decoder.h Fri Feb 7 19:51:38 2014
+@@ -22,6 +22,9 @@
#ifndef LIBDVDNAV_DECODER_H
#define LIBDVDNAV_DECODER_H
-+//#include <inttypes.h>
-+//#include <sys/time.h>
-+
+#include "ifo_types.h" /* vm_cmd_t */
+#include "dvdnav_internal.h"
+
/* link command types */
typedef enum {
LinkNoLink = 0,
-diff -uw dvdnav_diff/dvd_reader.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvd_reader.h
---- dvdnav_diff/dvd_reader.h 2013-02-07 14:42:34 +0100
-+++ xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvd_reader.h 2013-02-04 14:58:00 +0100
+diff -uwr ../../dvdnav_diff/dvd_reader.h xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvd_reader.h
+--- ../../dvdnav_diff/dvd_reader.h Mon Dec 7 03:50:20 2009
++++ xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvd_reader.h Thu Feb 7 18:22:32 2013
@@ -24,14 +24,14 @@
#define LIBDVDREAD_DVD_READER_H
@@ -152,19 +149,10 @@ diff -uw dvdnav_diff/dvd_reader.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdn
/**
* The DVD access interface.
-diff -uw dvdnav_diff/dvd_types.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvd_types.h
---- dvdnav_diff/dvd_types.h 2013-02-07 14:42:34 +0100
-+++ xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvd_types.h 2013-02-04 14:58:00 +0100
-@@ -26,6 +26,8 @@
- #ifndef LIBDVDNAV_DVD_TYPES_H
- #define LIBDVDNAV_DVD_TYPES_H
-
-+//#include <inttypes.h>
-+
- /*
- * DVD Menu ID
- * (see dvdnav_menu_call())
-@@ -60,7 +62,8 @@
+diff -uwr ../../dvdnav_diff/dvd_types.h xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvd_types.h
+--- ../../dvdnav_diff/dvd_types.h Tue Dec 30 14:48:46 2008
++++ xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvd_types.h Fri Feb 7 20:03:34 2014
+@@ -60,7 +60,8 @@
/* the following types are currently unused */
@@ -174,7 +162,28 @@ diff -uw dvdnav_diff/dvd_types.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdna
/* Domain */
typedef enum {
-@@ -222,6 +225,10 @@
+@@ -161,14 +162,13 @@
+ /* The audio format */
+ typedef enum {
+ DVD_AUDIO_FORMAT_AC3 = 0,
+- DVD_AUDIO_FORMAT_MPEG1 = 1,
+- DVD_AUDIO_FORMAT_MPEG1_DRC = 2,
+- DVD_AUDIO_FORMAT_MPEG2 = 3,
+- DVD_AUDIO_FORMAT_MPEG2_DRC = 4,
+- DVD_AUDIO_FORMAT_LPCM = 5,
++ DVD_AUDIO_FORMAT_UNKNOWN_1 = 1,
++ DVD_AUDIO_FORMAT_MPEG = 2,
++ DVD_AUDIO_FORMAT_MPEG2_EXT = 3,
++ DVD_AUDIO_FORMAT_LPCM = 4,
++ DVD_AUDIO_FORMAT_UNKNOWN_5 = 5,
+ DVD_AUDIO_FORMAT_DTS = 6,
+- DVD_AUDIO_FORMAT_SDDS = 7,
+- DVD_AUDIO_FORMAT_Other = 8
++ DVD_AUDIO_FORMAT_SDDS = 7
+ } DVDAudioFormat_t;
+
+ /* Audio language extension */
+@@ -222,6 +222,10 @@
DVD_DISPLAY_MODE_4x3Letterboxed = 3
} DVDDisplayMode_t;
@@ -185,7 +194,7 @@ diff -uw dvdnav_diff/dvd_types.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdna
/* Audio attributes */
typedef struct {
DVDAudioAppMode_t AppMode;
-@@ -233,9 +240,6 @@
+@@ -233,9 +237,6 @@
DVDAudioSampleQuant_t SampleQuantization;
DVDChannelNumber_t NumberOfChannels;
} DVDAudioAttributes_t;
@@ -195,7 +204,7 @@ diff -uw dvdnav_diff/dvd_types.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdna
/* Subpicture attributes */
typedef enum {
-@@ -255,6 +259,8 @@
+@@ -255,6 +256,8 @@
DVDSubpictureLangExt_t LanguageExtension;
} DVDSubpictureAttributes_t;
@@ -204,7 +213,7 @@ diff -uw dvdnav_diff/dvd_types.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdna
/* Video attributes */
typedef struct {
DVDBool_t PanscanPermitted;
-@@ -268,7 +274,6 @@
+@@ -268,7 +271,6 @@
DVDBool_t Line21Field2InGop;
int more_to_come;
} DVDVideoAttributes_t;
@@ -212,69 +221,40 @@ diff -uw dvdnav_diff/dvd_types.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdna
#endif
-diff -uw dvdnav_diff/dvdnav.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvdnav.h
---- dvdnav_diff/dvdnav.h 2013-02-07 14:42:34 +0100
-+++ xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvdnav.h 2013-02-04 14:58:00 +0100
-@@ -32,11 +32,14 @@
+diff -uwr ../../dvdnav_diff/dvdnav.h xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvdnav.h
+--- ../../dvdnav_diff/dvdnav.h Sun Oct 6 21:47:20 2013
++++ xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvdnav.h Fri Feb 7 19:58:51 2014
+@@ -32,11 +32,11 @@
extern "C" {
#endif
--# 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>
+-#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>
+# include "dvd_types.h"
+# include "dvd_reader.h"
+# include "nav_types.h"
+# include "ifo_types.h" /* For vm_cmd_t */
+# include "dvdnav_events.h"
-+# include "dvd_types.h"
-+# include "dvd_reader.h"
-+# include "ifo_types.h" /* For vm_cmd_t */
-
-
-@@ -63,11 +66,6 @@
- #define DVDNAV_STATUS_ERR 0
- #define DVDNAV_STATUS_OK 1
--#define DVDNAV_FORMAT_AC3 0
--#define DVDNAV_FORMAT_MPEGAUDIO 3
--#define DVDNAV_FORMAT_LPCM 4
--#define DVDNAV_FORMAT_DTS 5
--#define DVDNAV_FORMAT_SDDS 6
-
- /*********************************************************************
- * initialisation & housekeeping functions *
-@@ -281,7 +279,7 @@
- /*
- * 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);
-+dvdnav_status_t dvdnav_program_play(dvdnav_t *self, int32_t title, int32_t pgcn, int32_t pgn);
- /*
- * Stores in *times an array (that the application *must* free) of
-@@ -695,6 +693,15 @@
+@@ -695,6 +695,10 @@
*/
int8_t dvdnav_is_domain_vts(dvdnav_t *self);
+/* XBMC added functions */
-+int dvdnav_get_nr_of_subtitle_streams(dvdnav_t *self);
-+
-+int dvdnav_get_nr_of_audio_streams(dvdnav_t *self);
-+
+int dvdnav_get_button_info(dvdnav_t* self, int alpha[2][4], int color[2][4]);
+
+int64_t dvdnav_convert_time(dvd_time_t *time);
-+
- ////////// RATDVD stuff ///////////////
- /*
-diff -uw dvdnav_diff/dvdnav_events.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvdnav_events.h
---- dvdnav_diff/dvdnav_events.h 2013-02-07 14:42:34 +0100
-+++ xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvdnav_events.h 2013-02-04 14:58:00 +0100
+ #ifdef __cplusplus
+ }
+diff -uwr ../../dvdnav_diff/dvdnav_events.h xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvdnav_events.h
+--- ../../dvdnav_diff/dvdnav_events.h Tue Dec 30 14:48:46 2008
++++ xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvdnav_events.h Sat Feb 9 11:12:51 2013
@@ -25,6 +25,10 @@
#ifndef LIBDVDNAV_DVDNAV_EVENTS_H
#define LIBDVDNAV_DVDNAV_EVENTS_H
@@ -286,117 +266,64 @@ diff -uw dvdnav_diff/dvdnav_events.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/d
/*
* DVDNAV_BLOCK_OK
*
-diff -uw dvdnav_diff/dvdnav_internal.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvdnav_internal.h
---- dvdnav_diff/dvdnav_internal.h 2013-02-07 14:42:34 +0100
-+++ xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvdnav_internal.h 2013-02-07 14:33:08 +0100
-@@ -1,6 +1,5 @@
--/* !! DO NO EDIT THIS FILE, it is automatically generated */
- /*
-- * Copyright (C) 2001 Rich Wareham <richwareham@users.sourceforge.net>
-+ * Copyright (C) 2001-2004 Rich Wareham <richwareham@users.sourceforge.net>
- *
- * This file is part of libdvdnav, a DVD navigation library.
- *
-@@ -19,8 +18,8 @@
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
--#ifndef LIBDVDREAD_DVDNAV_INTERNAL_H
--#define LIBDVDREAD_DVDNAV_INTERNAL_H
-+#ifndef LIBDVDNAV_DVDNAV_INTERNAL_H
-+#define LIBDVDNAV_DVDNAV_INTERNAL_H
-
- #ifdef HAVE_CONFIG_H
+diff -uwr ../../dvdnav_diff/dvdnav_internal.h xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvdnav_internal.h
+--- ../../dvdnav_diff/dvdnav_internal.h Sun Dec 9 21:22:16 2012
++++ xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/dvdnav_internal.h Fri Feb 7 20:06:27 2014
+@@ -25,9 +25,15 @@
#include "config.h"
-@@ -28,16 +27,47 @@
+ #endif
- #include <stdlib.h>
- #include <stdio.h>
--#include <unistd.h>
-+//#include <unistd.h>
- #include <limits.h>
- #include <string.h>
--#include <pthread.h>
-
--#undef WORDS_BIGENDIAN
-+#ifdef WIN32
-+
-+/* pthread_mutex_* wrapper for win32 */
-+#ifndef _LINUX
-+#include <windows.h>
-+#include <process.h>
-+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) DeleteCriticalSection(a)
-+#endif // !_LINUX
-+
-+#ifndef HAVE_GETTIMEOFDAY
-+/* replacement gettimeofday implementation */
-+#include <sys/timeb.h>
-+static inline int _private_gettimeofday( struct timeval *tv, void *tz )
-+{
-+ struct timeb t;
-+ ftime( &t );
-+ tv->tv_sec = t.time;
-+ tv->tv_usec = t.millitm * 1000;
-+ return 0;
-+}
-+#define gettimeofday(TV, TZ) _private_gettimeofday((TV), (TZ))
-+#endif
-+
-+#ifndef _LINUX
-+#include <io.h> /* read() */
-+#define lseek64 _lseeki64
-+#endif // !_LINUX
-
--#include "dvd_reader.h"
--#include "ifo_read.h"
--#include "ifo_types.h"
-+#else
-+
-+#include <pthread.h>
+-#ifdef WIN32
++#include <stdlib.h>
++#include <stdio.h>
++#include <limits.h>
++#include <string.h>
+
-+#endif /* WIN32 */
++#ifdef TARGET_WINDOWS
+
+ /* pthread_mutex_* wrapper for win32 */
++#ifndef TARGET_POSIX
+ #include <windows.h>
+ #include <process.h>
+ typedef CRITICAL_SECTION pthread_mutex_t;
+@@ -35,6 +41,7 @@
+ #define pthread_mutex_lock(a) EnterCriticalSection(a)
+ #define pthread_mutex_unlock(a) LeaveCriticalSection(a)
+ #define pthread_mutex_destroy(a) DeleteCriticalSection(a)
++#endif // !TARGET_POSIX
+
+ #ifndef HAVE_GETTIMEOFDAY
+ /* replacement gettimeofday implementation */
+@@ -50,14 +57,24 @@
+ #define gettimeofday(TV, TZ) _private_gettimeofday((TV), (TZ))
+ #endif
- /* Uncomment for VM command tracing */
- /* #define TRACE */
-@@ -48,7 +78,7 @@
- #include "vmcmd.h"
++#ifndef TARGET_POSIX
+ #include <io.h> /* read() */
+ #define lseek64 _lseeki64
++#endif // !TARGET_POSIX
- /* 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
-@@ -126,8 +156,6 @@
- /* General data */
- char path[MAX_PATH_LEN]; /* Path to DVD device/dir */
- dvd_file_t *file; /* Currently opened file */
-- int open_vtsN; /* The domain and number of the... */
-- int open_domain; /* ..currently opened VOB */
-
- /* Position data */
- vm_position_t position_next;
-@@ -147,6 +175,7 @@
- int started; /* vm_start has been called? */
- int use_read_ahead; /* 1 - use read-ahead cache, 0 - don't */
- int pgc_based; /* positioning works PGC based instead of PG based */
-+ int cur_cell_time; /* time expired since the beginning of the current cell, read from the dsi */
-
- /* VM */
- vm_t *vm;
-@@ -159,24 +188,38 @@
- char err_str[MAX_ERR_LEN];
- };
-
-+/** HELPER FUNCTIONS **/
+ #else
+
+ #include <pthread.h>
+
+-#endif /* WIN32 */
++#endif /* TARGET_WINDOWS */
+
-+/* converts a dvd_time_t to PTS ticks */
-+int64_t dvdnav_convert_time(dvd_time_t *time);
++/* Uncomment for VM command tracing */
++/* #define TRACE */
+
++#include "decoder.h"
++#include "dvdnav.h"
++#include "vm.h"
++#include "vmcmd.h"
+
+ /* where should libdvdnav write its messages (stdout/stderr) */
+ #define MSG_OUT stderr
+@@ -183,6 +200,18 @@
+ /* converts a dvd_time_t to PTS ticks */
+ int64_t dvdnav_convert_time(dvd_time_t *time);
+
+/* XBMC added functions */
+/*
+ * Get current playback state
@@ -412,36 +339,18 @@ diff -uw dvdnav_diff/dvdnav_internal.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams
/** USEFUL MACROS **/
#ifdef __GNUC__
--#define printerrf(format, args...) snprintf(this->err_str, MAX_ERR_LEN, format, ## args);
-+#define printerrf(format, args...) \
-+ do { if (this) snprintf(this->err_str, MAX_ERR_LEN, format, ## args); } while (0)
- #else
- #ifdef _MSC_VER
--#define printerrf(str) snprintf(this->err_str, MAX_ERR_LEN, str);
-+#define printerrf(str) \
-+ do { if (this) snprintf(this->err_str, MAX_ERR_LEN, str); } while (0)
+@@ -195,7 +224,7 @@
#else
--#define printerrf(...) snprintf(this->err_str, MAX_ERR_LEN, __VA_ARGS__);
-+#define printerrf(...) \
-+ do { if (this) snprintf(this->err_str, MAX_ERR_LEN, __VA_ARGS__); } while (0)
- #endif /* WIN32 */
+ #define printerrf(...) \
+ do { if (this) snprintf(this->err_str, MAX_ERR_LEN, __VA_ARGS__); } while (0)
+-#endif /* WIN32 */
++#endif /* TARGET_WINDOWS */
#endif
--#define printerr(str) strncpy(this->err_str, str, MAX_ERR_LEN);
--
--/* Save my typing */
--#define S_ERR DVDNAV_STATUS_ERR
--
--#ifndef _MSC_VER
--#define S_OK DVDNAV_STATUS_OK
--#endif /* MSC_VER */
-+#define printerr(str) \
-+ do { if (this) strncpy(this->err_str, str, MAX_ERR_LEN - 1); } while (0)
-
--#endif /* LIBDVDREAD_DVDNAV_INTERNAL_H */
-+#endif /* LIBDVDNAV_DVDNAV_INTERNAL_H */
-diff -uw dvdnav_diff/ifo_types.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/ifo_types.h
---- dvdnav_diff/ifo_types.h 2013-02-07 14:42:34 +0100
-+++ xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/ifo_types.h 2013-02-04 14:58:00 +0100
+ #define printerr(str) \
+ do { if (this) strncpy(this->err_str, str, MAX_ERR_LEN - 1); } while (0)
+diff -uwr ../../dvdnav_diff/ifo_types.h xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/ifo_types.h
+--- ../../dvdnav_diff/ifo_types.h Sun Dec 9 21:08:00 2012
++++ xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/ifo_types.h Fri Feb 7 19:24:37 2014
@@ -22,8 +22,8 @@
#ifndef LIBDVDREAD_IFO_TYPES_H
#define LIBDVDREAD_IFO_TYPES_H
@@ -453,9 +362,9 @@ diff -uw dvdnav_diff/ifo_types.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdna
#undef ATTRIBUTE_PACKED
-diff -uw dvdnav_diff/nav_types.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/nav_types.h
---- dvdnav_diff/nav_types.h 2013-02-07 14:42:34 +0100
-+++ xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/nav_types.h 2013-02-04 14:58:00 +0100
+diff -uwr ../../dvdnav_diff/nav_types.h xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/nav_types.h
+--- ../../dvdnav_diff/nav_types.h Sun Aug 8 23:49:28 2010
++++ xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/nav_types.h Thu Feb 7 18:22:32 2013
@@ -28,9 +28,27 @@
#ifndef LIBDVDREAD_NAV_TYPES_H
#define LIBDVDREAD_NAV_TYPES_H
@@ -498,9 +407,10 @@ diff -uw dvdnav_diff/nav_types.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdna
/**
* PCI General Information
*/
-diff -uw dvdnav_diff/vm.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/vm.h
---- dvdnav_diff/vm.h 2013-02-07 14:42:34 +0100
-+++ xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/vm.h 2013-02-07 14:33:08 +0100
+Only in xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/: remap.h
+diff -uwr ../../dvdnav_diff/vm.h xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/vm.h
+--- ../../dvdnav_diff/vm.h Sat Jul 31 00:34:16 2010
++++ xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/vm.h Fri Feb 7 19:37:55 2014
@@ -23,6 +23,9 @@
#ifndef LIBDVDNAV_VM_H
#define LIBDVDNAV_VM_H
@@ -511,19 +421,17 @@ diff -uw dvdnav_diff/vm.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/vm.h
/* DOMAIN enum */
typedef enum {
-@@ -156,11 +159,8 @@
- int vm_get_audio_active_stream(vm_t *vm);
- int vm_get_subp_active_stream(vm_t *vm, int mode);
- void vm_get_angle_info(vm_t *vm, int *current, int *num_avail);
--// _XBMC #if 0
--/* 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);
--// _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);
-@@ -180,5 +180,7 @@
+@@ -170,6 +173,9 @@
+ ifo_handle_t *vm_get_title_ifo(vm_t *vm, uint32_t title);
+ void vm_ifo_close(ifo_handle_t *ifo);
+
++int vm_get_state(vm_t *vm, dvd_state_t *save_state);
++int vm_set_state(vm_t *vm, dvd_state_t *save_state);
++
+ /* Uncomment for VM command tracing */
+ /* #define TRACE */
+ #ifdef TRACE
+@@ -177,5 +183,7 @@
void vm_position_print(vm_t *vm, vm_position_t *position);
#endif
@@ -531,15 +439,3 @@ diff -uw dvdnav_diff/vm.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/vm.h
+vm_t* dvdnav_get_vm(dvdnav_t *self);
#endif /* LIBDVDNAV_VM_H */
-diff -uw dvdnav_diff/vmcmd.h xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/vmcmd.h
---- dvdnav_diff/vmcmd.h 2013-02-07 14:42:34 +0100
-+++ xbmc/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/vmcmd.h 2013-02-04 14:58:00 +0100
-@@ -22,6 +22,8 @@
- #ifndef LIBDVDNAV_VMCMD_H
- #define LIBDVDNAV_VMCMD_H
-
-+//#include <inttypes.h>
-+
- void vm_print_mnemonic(vm_cmd_t *command);
- void vm_print_cmd(int row, vm_cmd_t *command);
-
diff --git a/lib/libdvd/patches/libdvdnav-accurate_seek.diff b/lib/libdvd/patches/libdvdnav-accurate_seek.diff
deleted file mode 100644
index efcda5f8d3..0000000000
--- a/lib/libdvd/patches/libdvdnav-accurate_seek.diff
+++ /dev/null
@@ -1,689 +0,0 @@
-More accurate seeking with libdvdnav
-
-applied to current codebase from:
- http://lists.mplayerhq.hu/pipermail/dvdnav-discuss/2012-December/001837.html
-
-full credit goes to gnosygnu, see
- http://forum.videolan.org/viewtopic.php?f=32&t=76308&start=20#p316583
- https://github.com/xbmc/xbmc/pull/2957#issuecomment-20855719
-
-related tickets:
- http://trac.xbmc.org/ticket/12212
- http://trac.xbmc.org/ticket/14493
-
-
-diff --git a/libdvdnav/src/dvdnav/dvdnav.h b/libdvdnav/src/dvdnav/dvdnav.h
-index 359b951..506a286 100644
---- a/libdvdnav/src/dvdnav/dvdnav.h
-+++ b/libdvdnav/src/dvdnav/dvdnav.h
-@@ -373,6 +373,14 @@ dvdnav_status_t dvdnav_sector_search(dvdnav_t *self,
- int64_t dvdnav_get_current_time(dvdnav_t *self);
-
- /*
-+ * Find the nearest vobu and jump to it
-+ *
-+ * Alternative to dvdnav_time_search
-+ */
-+dvdnav_status_t dvdnav_jump_to_sector_by_time(dvdnav_t *this,
-+ uint64_t time_in_pts_ticks, int32_t mode);
-+
-+/*
- * Stop playing the current position and start playback of the title
- * from the specified timecode.
- *
-diff --git a/libdvdnav/src/dvdnav_internal.h b/libdvdnav/src/dvdnav_internal.h
-index d64a5ba..df26014 100644
---- a/libdvdnav/src/dvdnav_internal.h
-+++ b/libdvdnav/src/dvdnav_internal.h
-@@ -125,6 +125,45 @@ typedef struct {
- } ATTRIBUTE_PACKED spu_status_t;
- #endif
-
-+/*
-+ * Describes a given time, and the closest sector, vobu and tmap index
-+ */
-+typedef struct {
-+ uint64_t time;
-+ uint32_t sector;
-+ uint32_t vobu_idx;
-+ int32_t tmap_idx;
-+} dvdnav_pos_data_t;
-+
-+/*
-+ * Encapsulates cell data
-+ */
-+typedef struct {
-+ int32_t idx;
-+ dvdnav_pos_data_t *bgn;
-+ dvdnav_pos_data_t *end;
-+} dvdnav_cell_data_t;
-+
-+/*
-+ * Encapsulates common variables used by internal functions of jump_to_time
-+ */
-+typedef struct {
-+ vobu_admap_t *admap;
-+ int32_t admap_len;
-+ vts_tmap_t *tmap;
-+ int32_t tmap_len;
-+ int32_t tmap_interval;
-+} dvdnav_jump_args_t;
-+
-+/*
-+ * Utility constants for jump_to_time
-+ */
-+#define TMAP_IDX_EDGE_BGN -1
-+#define TMAP_IDX_EDGE_END -2
-+#define JUMP_MODE_TIME_AFTER 1
-+#define JUMP_MODE_TIME_DEFAULT 0
-+#define JUMP_MODE_TIME_BEFORE -1
-+
- typedef struct dvdnav_vobu_s {
- int32_t vobu_start; /* Logical Absolute. MAX needed is 0x300000 */
- int32_t vobu_length;
-diff --git a/libdvdnav/src/searching.c b/libdvdnav/src/searching.c
-index a5e48fe..0115e2f 100644
---- a/libdvdnav/src/searching.c
-+++ b/libdvdnav/src/searching.c
-@@ -36,6 +36,7 @@
- #include "vm/decoder.h"
- #include "vm/vm.h"
- #include "dvdnav_internal.h"
-+#include <dvdread/ifo_read.h>
-
- /*
- #define LOG_DEBUG
-@@ -805,3 +806,593 @@ dvdnav_status_t dvdnav_set_state(dvdnav_t *this, dvd_state_t *save_state)
- pthread_mutex_unlock(&this->vm_lock);
- return DVDNAV_STATUS_OK;
- }
-+
-+
-+
-+/* Get an admap and admap_len */
-+static vobu_admap_t* dvdnav_admap_get(dvdnav_t *this, dvd_state_t *state,
-+ int32_t *admap_len) {
-+ vobu_admap_t *admap = NULL;
-+ switch(state->domain) {
-+ case FP_DOMAIN:
-+ case VMGM_DOMAIN:
-+ admap = this->vm->vmgi->menu_vobu_admap;
-+ break;
-+ case VTSM_DOMAIN:
-+ admap = this->vm->vtsi->menu_vobu_admap;
-+ break;
-+ case VTS_DOMAIN:
-+ admap = this->vm->vtsi->vts_vobu_admap;
-+ break;
-+ default: {
-+ fprintf(MSG_OUT, "Unknown domain");
-+ return NULL;
-+ }
-+ }
-+ if (admap == NULL) return NULL;
-+
-+ *admap_len = (admap->last_byte + 1 - VOBU_ADMAP_SIZE) / VOBU_ADMAP_SIZE;
-+ if (*admap_len <= 0) {
-+ fprintf(MSG_OUT, "admap_len <= 0");
-+ return NULL;
-+ }
-+ return admap;
-+}
-+
-+/* Get a tmap, tmap_len and tmap_interval */
-+static vts_tmap_t* dvdnav_tmap_get(dvdnav_t *this, dvd_state_t *state,
-+ int32_t *tmap_len, int32_t *tmap_interval) {
-+ int32_t vts_idx = 0;
-+ domain_t domain;
-+ ifo_handle_t *ifo = NULL;
-+ vts_tmapt_t *tmapt = NULL;
-+ uint16_t tmap_count = 0;
-+ int32_t pgcN = 0;
-+ vts_tmap_t *tmap = NULL;
-+ int32_t result = 0;
-+
-+ vts_idx = state->vtsN;
-+ domain = state->domain;
-+ switch(domain) {
-+ case FP_DOMAIN:
-+ case VTSM_DOMAIN:
-+ case VMGM_DOMAIN: {
-+ ifo = this->vm->vmgi;
-+ break;
-+ }
-+ case VTS_DOMAIN: {
-+ ifo = this->vm->vtsi;
-+ break;
-+ }
-+ default: {
-+ fprintf(MSG_OUT, "unknown domain for tmap");
-+ return NULL;
-+ }
-+ }
-+ if (ifo == NULL) return NULL;
-+ tmapt = ifo->vts_tmapt;
-+ /* HACK: ifo->vts_tmapt is NULL b/c ifo_read.c never loads it
-+ * load ifo->vts_tmapt directly*/
-+ if (tmapt == NULL) {
-+ result = ifoRead_VTS_TMAPT(ifo);
-+ if (!result) {
-+ return NULL;
-+ }
-+ tmapt = ifo->vts_tmapt;
-+ if (tmapt == NULL) return NULL;
-+ }
-+
-+ tmap_count = tmapt->nr_of_tmaps;
-+ pgcN = state->pgcN - 1; /* -1 b/c pgcN is base1 */
-+ if (pgcN < 0) {
-+ fprintf(MSG_OUT, "pgcN < 0");
-+ return NULL;
-+ }
-+
-+ /* get tmap */
-+ switch(domain) {
-+ case FP_DOMAIN:
-+ case VMGM_DOMAIN:
-+ case VTSM_DOMAIN: {
-+ if (tmap_count == 0) {
-+ fprintf(MSG_OUT, "tmap_count == 0");
-+ return NULL;
-+ }
-+ tmap = &tmapt->tmap[0]; /* ASSUME: vmgi only has one time map */
-+ break;
-+ }
-+ case VTS_DOMAIN: {
-+ if (pgcN >= tmap_count) {
-+ fprintf(MSG_OUT, "pgcN >= tmap_count; pgcN=%i tmap_count=%i",
-+ pgcN, tmap_count);
-+ return NULL;
-+ }
-+ tmap = &tmapt->tmap[pgcN];
-+ break;
-+ }
-+ }
-+ if (tmap == NULL) return NULL;
-+
-+ /* tmap->tmu is in seconds; convert to millisecs */
-+ *tmap_interval = tmap->tmu * 1000;
-+ if (*tmap_interval == 0) {
-+ fprintf(MSG_OUT, "tmap_interval == 0");
-+ return NULL;
-+ }
-+ *tmap_len = tmap->nr_of_entries;
-+ if (*tmap_len == 0) {
-+ fprintf(MSG_OUT, "tmap_len == 0");
-+ return NULL;
-+ }
-+ return tmap;
-+}
-+
-+/* Get a sector from a tmap */
-+static int32_t dvdnav_tmap_get_entry(vts_tmap_t *tmap, uint16_t tmap_len,
-+ int32_t idx, uint32_t *sector) {
-+ /* tmaps start at idx 0 which represents a sector at time 1 * tmap_interval
-+ * this creates a "fake" tmap index at idx -1 for sector 0 */
-+ if (idx == TMAP_IDX_EDGE_BGN) {
-+ *sector = 0;
-+ return 1;
-+ }
-+ if (idx < TMAP_IDX_EDGE_BGN || idx >= tmap_len) {
-+ fprintf(MSG_OUT, "idx out of bounds idx=%i %i", idx, tmap_len);
-+ return 0;
-+ }
-+ /* 0x7fffffff unsets discontinuity bit if present */
-+ *sector = tmap->map_ent[idx] & 0x7fffffff;
-+ return 1;
-+}
-+
-+/* Do a binary search for earlier admap index near find_sector */
-+static int32_t dvdnav_admap_search(vobu_admap_t *admap, uint32_t admap_len,
-+ uint32_t find_sector, uint32_t *vobu) {
-+ int32_t adj = 1;
-+ int32_t prv_pos = 0;
-+ int32_t prv_len = admap_len;
-+ int32_t cur_len = 0;
-+ int32_t cur_idx = 0;
-+ uint32_t cur_sector = 0;
-+ while (1) {
-+ cur_len = prv_len / 2;
-+ /* need to add 1 when prv_len == 3 (cur_len shoud go to 2, not 1) */
-+ if (prv_len % 2 == 1) ++cur_len;
-+ cur_idx = prv_pos + (cur_len * adj);
-+ if (cur_idx < 0) cur_idx = 0;
-+ else if (cur_idx >= admap_len) cur_idx = admap_len - 1;
-+
-+ cur_sector = admap->vobu_start_sectors[cur_idx];
-+ if (find_sector < cur_sector) adj = -1;
-+ else if (find_sector > cur_sector) adj = 1;
-+ else if (find_sector == cur_sector) {
-+ *vobu = cur_idx;
-+ return 1;
-+ }
-+ if (cur_len == 1) {/* no smaller intervals left */
-+ if (adj == -1) {/* last comparison was greater; take lesser */
-+ cur_idx -= 1;
-+ cur_sector = admap->vobu_start_sectors[cur_idx];
-+ }
-+ *vobu = cur_idx;
-+ return 1;
-+ }
-+ prv_len = cur_len;
-+ prv_pos = cur_idx;
-+ }
-+}
-+
-+/* Do a binary search for the earlier tmap entry near find_sector */
-+static int32_t dvdnav_tmap_search(vts_tmap_t *tmap, uint32_t tmap_len,
-+ uint32_t find_sector, int32_t *tmap_idx, uint32_t *sector) {
-+ int32_t adj = 1;
-+ int32_t prv_pos = 0;
-+ int32_t prv_len = tmap_len;
-+ int32_t result = 0;
-+ int32_t cur_len = 0;
-+ int32_t cur_idx = 0;
-+ uint32_t cur_sector = 0;
-+ while (1) {
-+ cur_len = prv_len / 2;
-+ /* need to add 1 when prv_len == 3 (cur_len shoud go to 2, not 1) */
-+ if (prv_len % 2 == 1) ++cur_len;
-+ cur_idx = prv_pos + (cur_len * adj);
-+ if (cur_idx < 0) cur_idx = 0;
-+ else if (cur_idx >= tmap_len) cur_idx = tmap_len - 1;
-+ cur_sector = 0;
-+ result = dvdnav_tmap_get_entry(tmap, tmap_len, cur_idx, &cur_sector);
-+ if (!result) return 0;
-+ if (find_sector < cur_sector) adj = -1;
-+ else if (find_sector > cur_sector) adj = 1;
-+ else if (find_sector == cur_sector) {
-+ *tmap_idx = cur_idx;
-+ *sector = cur_sector;
-+ return 1;
-+ }
-+ if (cur_len == 1) {/* no smaller intervals left */
-+ if (adj == -1) {/* last comparison was greater; take lesser */
-+ if (cur_idx == 0) { /* fake tmap index for sector 0 */
-+ cur_idx = TMAP_IDX_EDGE_BGN;
-+ cur_sector = 0;
-+ }
-+ else {
-+ cur_idx -= 1;
-+ result = dvdnav_tmap_get_entry(tmap, tmap_len, cur_idx, &cur_sector);
-+ if (!result) return 0;
-+ }
-+ }
-+ *tmap_idx = cur_idx;
-+ *sector = cur_sector;
-+ return 1;
-+ }
-+ prv_len = cur_len;
-+ prv_pos = cur_idx;
-+ }
-+}
-+
-+/* Find the cell for a given time */
-+static int32_t dvdnav_cell_find(dvdnav_t *this, dvd_state_t *state,
-+ uint64_t find_val, dvdnav_cell_data_t *cell_data) {
-+ uint32_t cells_len = 0;
-+ uint32_t cells_bgn = 0;
-+ uint32_t cells_end = 0;
-+ uint32_t cell_idx = 0;
-+ pgc_t *pgc = NULL;
-+ int pgN = 0;
-+ cell_playback_t *cell = NULL;
-+ int found = 0;
-+
-+ pgc = state->pgc;
-+ if (pgc == NULL) return 0;
-+ cells_len = pgc->nr_of_cells;
-+ if (cells_len == 0) {
-+ fprintf(MSG_OUT, "cells_len == 0");
-+ return 0;
-+ }
-+
-+ /* get cells_bgn, cells_end */
-+ if (this->pgc_based) {
-+ cells_bgn = 1;
-+ cells_end = cells_len;
-+ }
-+ else {
-+ pgN = state->pgN;
-+ cells_bgn = pgc->program_map[pgN - 1]; /* -1 b/c pgN is 1 based? */
-+ if (pgN < pgc->nr_of_programs) {
-+ cells_end = pgc->program_map[pgN] - 1;
-+ }
-+ else {
-+ cells_end = cells_len;
-+ }
-+ }
-+
-+ /* search cells */
-+ for (cell_idx = cells_bgn; cell_idx <= cells_end; cell_idx++) {
-+ cell = &(pgc->cell_playback[cell_idx - 1]); /* -1 b/c cell is base1 */
-+ /* if angle block, only consider first angleBlock
-+ * (others are "redundant" for purpose of search) */
-+ if ( cell->block_type == BLOCK_TYPE_ANGLE_BLOCK
-+ && cell->block_mode != BLOCK_MODE_FIRST_CELL) {
-+ continue;
-+ }
-+ cell_data->bgn->sector = cell->first_sector;
-+ cell_data->end->sector = cell->last_sector;
-+
-+ /* 90 pts to ms */
-+ cell_data->end->time += (dvdnav_convert_time(&cell->playback_time) / 90);
-+ if ( find_val >= cell_data->bgn->time
-+ && find_val <= cell_data->end->time) {
-+ found = 1;
-+ break;
-+ }
-+ cell_data->bgn->time = cell_data->end->time;
-+ }
-+
-+ /* found cell: set var */
-+ if (found) {
-+ cell_data->idx = cell_idx;
-+ }
-+ else
-+ fprintf(MSG_OUT, "cell not found; find=%"PRId64"", find_val);
-+ return found;
-+}
-+
-+/* Given two sectors and a fraction, calc the corresponding vobu */
-+static int32_t dvdnav_admap_interpolate_vobu(dvdnav_jump_args_t *args,
-+ dvdnav_pos_data_t *bgn, dvdnav_pos_data_t *end, uint32_t fraction,
-+ uint32_t *jump_sector) {
-+ int32_t result = 0;
-+ uint32_t vobu_len = 0;
-+ uint32_t vobu_adj = 0;
-+ uint32_t vobu_idx = 0;
-+
-+ /* get bgn->vobu_idx */
-+ result = dvdnav_admap_search(args->admap, args->admap_len,
-+ bgn->sector, &bgn->vobu_idx);
-+ if (!result) {
-+ fprintf(MSG_OUT, "admap_interpolate: could not find sector_bgn");
-+ return 0;
-+ }
-+
-+ /* get end->vobu_idx */
-+ result = dvdnav_admap_search(args->admap, args->admap_len,
-+ end->sector, &end->vobu_idx);
-+ if (!result) {
-+ fprintf(MSG_OUT, "admap_interpolate: could not find sector_end");
-+ return 0;
-+ }
-+
-+ vobu_len = end->vobu_idx - bgn->vobu_idx;
-+ /* +500 to round up else 74% of a 4 sec interval = 2 sec */
-+ vobu_adj = ((fraction * vobu_len) + 500) / 1000;
-+ /* HACK: need to add +1, or else will land too soon (not sure why) */
-+ vobu_adj++;
-+ vobu_idx = bgn->vobu_idx + vobu_adj;
-+ if (vobu_idx >= args->admap_len) {
-+ fprintf(MSG_OUT, "admap_interpolate: vobu_idx >= admap_len");
-+ return 0;
-+ }
-+ *jump_sector = args->admap->vobu_start_sectors[vobu_idx];
-+ return 1;
-+}
-+
-+/* Given two tmap entries and a time, calc the time for the lo tmap entry */
-+static int32_t dvdnav_tmap_calc_time_for_tmap_entry(dvdnav_jump_args_t *args,
-+ dvdnav_pos_data_t *lo, dvdnav_pos_data_t *hi,
-+ dvdnav_pos_data_t *pos, uint64_t *out_time) {
-+ int32_t result = 0;
-+ uint32_t vobu_pct = 0;
-+ uint64_t time_adj = 0;
-+
-+ if (lo->sector == hi->sector) {
-+ fprintf(MSG_OUT, "lo->sector == hi->sector: %i", lo->sector);
-+ return 0;
-+ }
-+
-+ /* get vobus corresponding to lo, hi, pos */
-+ result = dvdnav_admap_search(args->admap, args->admap_len,
-+ lo->sector, &lo->vobu_idx);
-+ if (!result) {
-+ fprintf(MSG_OUT, "lo->vobu: lo->sector=%i", lo->sector);
-+ return 0;
-+ }
-+ result = dvdnav_admap_search(args->admap, args->admap_len,
-+ hi->sector, &hi->vobu_idx);
-+ if (!result) {
-+ fprintf(MSG_OUT, "hi->vobu: hi->sector=%i", hi->sector);
-+ return 0;
-+ }
-+ result = dvdnav_admap_search(args->admap, args->admap_len,
-+ pos->sector, &pos->vobu_idx);
-+ if (!result) {
-+ fprintf(MSG_OUT, "pos->vobu: pos->sector=%i", pos->sector);
-+ return 0;
-+ }
-+
-+ /* calc position of cell relative to lo */
-+ vobu_pct = ((pos->vobu_idx - lo->vobu_idx) * 1000)
-+ / ( hi->vobu_idx - lo->vobu_idx);
-+ if (vobu_pct < 0 || vobu_pct > 1000) {
-+ fprintf(MSG_OUT, "vobu_pct must be between 0 and 1000");
-+ return 0;
-+ }
-+
-+ /* calc time of lo */
-+ time_adj = (uint64_t)((args->tmap_interval * vobu_pct) / 1000);
-+ *out_time = pos->time - time_adj;
-+ return 1;
-+}
-+
-+/* Find the tmap entries on either side of a given sector */
-+static int32_t dvdnav_tmap_get_entries_for_sector(dvdnav_t *this,
-+ dvd_state_t *state, dvdnav_jump_args_t *args,
-+ dvdnav_cell_data_t *cell_data, uint32_t find_sector,
-+ dvdnav_pos_data_t *lo, dvdnav_pos_data_t *hi) {
-+ int32_t result = 0;
-+
-+ result = dvdnav_tmap_search(args->tmap, args->tmap_len, find_sector,
-+ &lo->tmap_idx, &lo->sector);
-+ if (!result) {
-+ fprintf(MSG_OUT, "could not find lo idx: %i", find_sector);
-+ return 0;
-+ }
-+
-+ /* HACK: Most DVDs have a tmap that starts at sector 0
-+ * However, some have initial dummy cells that are not seekable
-+ * (restricted = y).
-+ * These cells will throw off the tmap calcs when in the first playable cell.
-+ * For now, assume that lo->sector is equal to the cell->bgn->sector
-+ * Note that for most DVDs this will be 0
-+ * (Since they will have no dummy cells and cell 1 will start at sector 0)
-+ */
-+ if (lo->tmap_idx == TMAP_IDX_EDGE_BGN) {
-+ lo->sector = cell_data->bgn->sector;
-+ }
-+
-+ if (lo->tmap_idx == args->tmap_len - 1) {
-+ /* lo is last tmap entry; "fake" entry for one beyond
-+ * and mark it with cell_end_sector */
-+ hi->tmap_idx = TMAP_IDX_EDGE_END;
-+ hi->sector = cell_data->end->sector;
-+ }
-+ else {
-+ hi->tmap_idx = lo->tmap_idx + 1;
-+ result = dvdnav_tmap_get_entry(args->tmap, args->tmap_len,
-+ hi->tmap_idx, &hi->sector);
-+ if (!result) {
-+ fprintf(MSG_OUT, "could not find hi idx: %i", find_sector);
-+ return 0;
-+ }
-+ }
-+ return 1;
-+}
-+
-+/* Find the nearest vobu by using the tmap */
-+static int32_t dvdnav_find_vobu_by_tmap(dvdnav_t *this, dvd_state_t *state,
-+ dvdnav_jump_args_t *args, dvdnav_cell_data_t *cell_data,
-+ dvdnav_pos_data_t *jump) {
-+ uint64_t seek_offset = 0;
-+ uint32_t seek_idx = 0;
-+ int32_t result = 0;
-+ dvdnav_pos_data_t *cell_bgn_lo = NULL;
-+ dvdnav_pos_data_t *cell_bgn_hi = NULL;
-+ dvdnav_pos_data_t *jump_lo = NULL;
-+ dvdnav_pos_data_t *jump_hi = NULL;
-+
-+ /* get tmap, tmap_len, tmap_interval */
-+ args->tmap = dvdnav_tmap_get(this, state,
-+ &args->tmap_len, &args->tmap_interval);
-+ if (args->tmap == NULL) return 0;
-+
-+ /* get tmap entries on either side of cell_bgn */
-+ cell_bgn_lo = &(dvdnav_pos_data_t){0};
-+ cell_bgn_hi = &(dvdnav_pos_data_t){0};
-+ result = dvdnav_tmap_get_entries_for_sector(this, state, args, cell_data,
-+ cell_data->bgn->sector, cell_bgn_lo, cell_bgn_hi);
-+ if (!result) return 0;
-+
-+ /* calc time of cell_bgn_lo */
-+ result = dvdnav_tmap_calc_time_for_tmap_entry(args, cell_bgn_lo, cell_bgn_hi,
-+ cell_data->bgn, &cell_bgn_lo->time);
-+ if (!result) return 0;
-+
-+ /* calc time of jump_time relative to cell_bgn_lo */
-+ seek_offset = jump->time - cell_bgn_lo->time;
-+ seek_idx = (uint32_t)(seek_offset / args->tmap_interval);
-+ uint32_t seek_remainder = seek_offset - (seek_idx * args->tmap_interval);
-+ uint32_t seek_pct = (seek_remainder * 1000) / args->tmap_interval;
-+
-+ /* get tmap entries on either side of jump_time */
-+ jump_lo = &(dvdnav_pos_data_t){0};
-+ jump_hi = &(dvdnav_pos_data_t){0};
-+
-+ /* if seek_idx == 0, then tmap_indexes are the same, do not re-get
-+ * also, note cell_bgn_lo will already have sector if TMAP_IDX_EDGE_BGN */
-+ if (seek_idx == 0) {
-+ jump_lo = cell_bgn_lo;
-+ jump_hi = cell_bgn_hi;
-+ }
-+ else {
-+ jump_lo->tmap_idx = (uint32_t)(cell_bgn_lo->tmap_idx + seek_idx);
-+ result = dvdnav_tmap_get_entry(args->tmap, args->tmap_len,
-+ jump_lo->tmap_idx, &jump_lo->sector);
-+ if (!result) return 0;
-+
-+ /* +1 handled by dvdnav_tmap_get_entry */
-+ jump_hi->tmap_idx = jump_lo->tmap_idx + 1;
-+ result = dvdnav_tmap_get_entry(args->tmap, args->tmap_len,
-+ jump_hi->tmap_idx, &jump_hi->sector);
-+ if (!result) return 0;
-+ }
-+
-+ /* interpolate sector */
-+ result = dvdnav_admap_interpolate_vobu(args, jump_lo, jump_hi,
-+ seek_pct, &jump->sector);
-+
-+ return result;
-+}
-+
-+/* Find the nearest vobu by using the cell boundaries */
-+static int32_t dvdnav_find_vobu_by_cell_boundaries(dvdnav_t *this,
-+ dvdnav_jump_args_t *args, dvdnav_cell_data_t *cell_data,
-+ dvdnav_pos_data_t *jump) {
-+ uint64_t jump_offset = 0;
-+ uint64_t cell_len = 0;
-+ uint32_t jump_pct = 0;
-+ int32_t result = 0;
-+
-+ /* get jump_offset */
-+ jump_offset = jump->time - cell_data->bgn->time;
-+ if (jump_offset < 0) {
-+ fprintf(MSG_OUT, "jump_offset < 0");
-+ return 0;
-+ }
-+ cell_len = cell_data->end->time - cell_data->bgn->time;
-+ if (cell_len < 0) {
-+ fprintf(MSG_OUT, "cell_len < 0");
-+ return 0;
-+ }
-+ jump_pct = (jump_offset * 1000) / cell_len;
-+
-+ /* get sector */
-+ /* NOTE: end cell sector in VTS_PGC is last sector of cell
-+ * this last sector is not the start of a VOBU
-+ * +1 to get sector that is the start of a VOBU
-+ * start of a VOBU is needed in order to index into admap */
-+ cell_data->end->sector += 1;
-+ result = dvdnav_admap_interpolate_vobu(args,
-+ cell_data->bgn, cell_data->end, jump_pct, &jump->sector);
-+ if (!result) {
-+ fprintf(MSG_OUT, "find_by_admap.interpolate");
-+ return 0;
-+ }
-+ return 1;
-+}
-+
-+/* Jump to sector by time */
-+/* NOTE: Mode is currently unimplemented. Only 0 should be passed. */
-+/* 1 and -1 are for future implementation */
-+/* 0: Default. Jump to a time which may be either <> time_in_pts_ticks */
-+/* 1: After. Always jump to a time that is > time_in_pts_ticks */
-+/* -1: Before. Always jump to a time that is < time_in_pts_ticks */
-+dvdnav_status_t dvdnav_jump_to_sector_by_time(dvdnav_t *this,
-+ uint64_t time_in_pts_ticks, int32_t mode) {
-+ if (mode != JUMP_MODE_TIME_DEFAULT) return DVDNAV_STATUS_ERR;
-+ int32_t result = DVDNAV_STATUS_ERR;
-+ dvd_state_t *state = NULL;
-+ uint32_t sector_off = 0;
-+ dvdnav_pos_data_t *jump = NULL;
-+ dvdnav_cell_data_t *cell_data = NULL;
-+ dvdnav_jump_args_t *args = NULL;
-+
-+ jump = &(dvdnav_pos_data_t){0};
-+ /* convert time to milliseconds */
-+ jump->time = time_in_pts_ticks / 90;
-+
-+ /* get variables that will be used across both functions */
-+ state = &(this->vm->state);
-+ if (state == NULL) goto exit;
-+
-+ /* get cell info */
-+ cell_data = &(dvdnav_cell_data_t){0};
-+ cell_data->bgn = &(dvdnav_pos_data_t){0};
-+ cell_data->end = &(dvdnav_pos_data_t){0};
-+ result = dvdnav_cell_find(this, state, jump->time, cell_data);
-+ if (!result) goto exit;
-+
-+ /* get admap */
-+ args = &(dvdnav_jump_args_t){0};
-+ args->admap = dvdnav_admap_get(this, state, &args->admap_len);
-+ if (args->admap == NULL) goto exit;
-+
-+ /* find sector */
-+ result = dvdnav_find_vobu_by_tmap(this, state, args, cell_data, jump);
-+ if (!result) {/* bad tmap; interpolate over cell */
-+ result = dvdnav_find_vobu_by_cell_boundaries(this, args, cell_data, jump);
-+ if (!result) {
-+ goto exit;
-+ }
-+ }
-+
-+#ifdef LOG_DEBUG
-+ fprintf(MSG_OUT, "libdvdnav: seeking to time=%lu\n", jump->time);
-+ fprintf(MSG_OUT, "libdvdnav: Before cellN=%u blockN=%u\n", state->cellN, state->blockN);
-+#endif
-+
-+ /* jump to sector */
-+ sector_off = jump->sector - cell_data->bgn->sector;
-+ this->cur_cell_time = 0;
-+ if (vm_jump_cell_block(this->vm, cell_data->idx, sector_off)) {
-+ pthread_mutex_lock(&this->vm_lock);
-+ this->vm->hop_channel += HOP_SEEK;
-+ pthread_mutex_unlock(&this->vm_lock);
-+ result = DVDNAV_STATUS_OK;
-+ }
-+
-+#ifdef LOG_DEBUG
-+ fprintf(MSG_OUT, "libdvdnav: After cellN=%u blockN=%u\n", state->cellN, state->blockN);
-+#endif
-+
-+exit:
-+ return result;
-+}
diff --git a/lib/libdvd/patches/libdvdnav.diff b/lib/libdvd/patches/libdvdnav.diff
index 32f7f0837a..cb702a4b38 100644
--- a/lib/libdvd/patches/libdvdnav.diff
+++ b/lib/libdvd/patches/libdvdnav.diff
@@ -1,6 +1,6 @@
-diff -uwr libdvdnav-4.2.0/Makefile xbmc/lib/libdvd/libdvdnav/Makefile
---- libdvdnav-4.2.0/Makefile 2008-12-30 15:48:46 +0100
-+++ xbmc/lib/libdvd/libdvdnav/Makefile 2013-02-07 14:42:34 +0100
+diff -uwr ../libdvdnav-4.2.1/Makefile lib/libdvd/libdvdnav/Makefile
+--- ../libdvdnav-4.2.1/Makefile Tue Dec 30 14:48:46 2008
++++ lib/libdvd/libdvdnav/Makefile Wed Jan 29 20:43:09 2014
@@ -112,7 +112,7 @@
# Clean targets
@@ -10,67 +10,149 @@ diff -uwr libdvdnav-4.2.0/Makefile xbmc/lib/libdvd/libdvdnav/Makefile
pcedit = sed \
-e 's,@prefix@,$(PREFIX),' \
-diff -uwr libdvdnav-4.2.0/src/dvdnav/dvdnav.h xbmc/lib/libdvd/libdvdnav/src/dvdnav/dvdnav.h
---- libdvdnav-4.2.0/src/dvdnav/dvdnav.h 2011-02-26 21:32:32 +0100
-+++ xbmc/lib/libdvd/libdvdnav/src/dvdnav/dvdnav.h 2013-02-07 14:42:34 +0100
-@@ -695,6 +695,42 @@
- */
- int8_t dvdnav_is_domain_vts(dvdnav_t *self);
+Only in lib/libdvd/libdvdnav/: config.h
+Only in lib/libdvd/libdvdnav/: config.mak
+diff -uwr ../libdvdnav-4.2.1/configure.ac lib/libdvd/libdvdnav/configure.ac
+--- ../libdvdnav-4.2.1/configure.ac Wed Dec 4 23:52:30 2013
++++ lib/libdvd/libdvdnav/configure.ac Fri Feb 7 19:24:37 2014
+@@ -89,7 +89,6 @@
+ AC_PROG_MAKE_SET
+ AC_PROG_INSTALL
+ AC_PROG_LN_S
+-PKG_PROG_PKG_CONFIG
-+////////// RATDVD stuff ///////////////
-+
-+/*
-+ * Get the number of audio streams.
-+ */
-+int32_t dvdnav_get_audio_stream_count(dvdnav_t * self);
-+
-+/*
-+ * Get the number of subpicture streams.
-+ */
-+int32_t dvdnav_get_subpicture_stream_count(dvdnav_t * self);
-+
-+/*
-+ * Get attributes of the current audio stream.
-+ */
-+dvdnav_status_t dvdnav_get_audio_info(dvdnav_t * self, int32_t streamid, audio_attr_t* audio_attributes);
-+
-+/*
-+ * Get attributes of the current subpicture stream.
-+ */
-+dvdnav_status_t dvdnav_get_stitle_info(dvdnav_t * self, int32_t streamid, subp_attr_t* stitle_attributes);
-+
-+/*
-+ * Get information about the current video stream
-+ */
-+dvdnav_status_t dvdnav_get_video_info(dvdnav_t * self, video_attr_t* video_attributes);
-+
-+/*
-+ * Select the audio stream to be played
-+ */
-+dvdnav_status_t dvdnav_audio_change(dvdnav_t *self, int32_t audio);
-+
-+/*
-+ * Select the spu stream to be displayed
-+ */
-+dvdnav_status_t dvdnav_subpicture_change(dvdnav_t *self, int32_t subpicture);
+ dnl --------------------------------------------------------------
+ dnl Libtool
+@@ -186,25 +185,15 @@
+ [AS_HELP_STRING([--with-dvdread-config=PROG],
+ [dvdread-config program to use @<:@default=from PATH@:>@])],
+ [DVDREAD_CONFIG="$withval"],
+- [DVDREAD_CONFIG=""])
+-
+-dnl by default, search pkg-config, and then fall back to dvdread-config
+-DVDREAD_PKG_CONFIG="no"
+-if test "x$DVDREAD_CONFIG" = "x"; then
+- PKG_CHECK_MODULES([DVDREAD], [dvdread],
+- [DVDREAD_PKG_CONFIG="yes"],
+ [dnl User didn't specify program, search PATH
+ AC_PATH_PROG([DVDREAD_CONFIG], [dvdread-config], [no])
+ test "x$DVDREAD_CONFIG" = xno && \
+ AC_MSG_ERROR([dvdread-config required to link with libdvdread])
+ ])
+-fi
+-if test "x$DVDREAD_PKG_CONFIG" != "xyes"; then
+ DVDREAD_CFLAGS=`$DVDREAD_CONFIG --cflags` || \
+ AC_MSG_ERROR([Could not get libdvdread CFLAGS from $DVDREAD_CONFIG])
+ DVDREAD_LIBS=`$DVDREAD_CONFIG --libs` || \
+ AC_MSG_ERROR([Could not get libdvdread LIBS from $DVDREAD_CONFIG])
+-fi
+ AC_SUBST([DVDREAD_CFLAGS])
+ AC_SUBST([DVDREAD_LIBS])
- #ifdef __cplusplus
+diff -uwr ../libdvdnav-4.2.1/configure2 lib/libdvd/libdvdnav/configure2
+--- ../libdvdnav-4.2.1/configure2 Thu Dec 19 21:43:16 2013
++++ lib/libdvd/libdvdnav/configure2 Fri Feb 7 19:24:37 2014
+@@ -5,7 +5,6 @@
+
+ cc=gcc
+ make=make
+-: ${PKG_CONFIG:=pkg-config}
+
+ # find source path
+ source_path="`dirname \"$0\"`"
+@@ -44,15 +43,12 @@
+ echo "Developer options:"
+ echo " --disable-strip disable stripping of executables and shared libraries"
+ echo " --disable-opts disable compiler optimizations"
+- echo "Environment variables:"
+- echo " PKG_CONFIG use specified pkg-config [$PKG_CONFIG]"
+ exit 1
}
-diff -uwr libdvdnav-4.2.0/src/dvdnav.c xbmc/lib/libdvd/libdvdnav/src/dvdnav.c
---- libdvdnav-4.2.0/src/dvdnav.c 2010-07-31 01:34:12 +0200
-+++ xbmc/lib/libdvd/libdvdnav/src/dvdnav.c 2013-02-07 14:42:34 +0100
-@@ -337,7 +337,9 @@
- }
- #endif
-- if(num_angle != 0) {
-+ /* only use ILVU information if we are at the last vobunit in ILVU */
-+ /* otherwise we will miss nav packets from vobunits inbetween */
-+ if(num_angle != 0 && (nav_dsi->sml_pbi.category & 0x5000) == 0x5000 ) {
+ SHARED=yes
+ STATIC=yes
+-DVDREAD_CONFIG=""
+-DVDREAD_PKG_CONFIG="${PKG_CONFIG} dvdread"
++DVDREAD_CONFIG=dvdread-config
+ PREFIX=/usr/local/
+ INSTALLSTRIP=-s
+ USEDEBUG=-g
+@@ -108,14 +104,8 @@
+ test -z "$incdir" && incdir=$PREFIX/include/dvdnav
+
+ dvdread=no
+-if test -z "$DVDREAD_CONFIG" ; then
+- DVDREAD_CONFIG=${DVDREAD_PKG_CONFIG}
+- $DVDREAD_CONFIG --exists >> /dev/null 2>&1 && dvdread=yes
+-fi
+-if test "$dvdread" != "yes" ; then
+- DVDREAD_CONFIG=dvdread-config
+ $DVDREAD_CONFIG --prefix >> /dev/null 2>&1 && dvdread=yes
+-fi
++test "$dvdread" != "yes" && $DVDREAD_CONFIG --exists >> /dev/null 2>&1 && dvdread=yes
+ if test "$dvdread" != "yes" ; then
+ echo "$DVDREAD_CONFIG returned an error. Can't proceed"
+ exit 1
+Only in lib/libdvd/libdvdnav/: obj
+diff -uwr ../libdvdnav-4.2.1/src/dvdnav/dvd_types.h lib/libdvd/libdvdnav/src/dvdnav/dvd_types.h
+--- ../libdvdnav-4.2.1/src/dvdnav/dvd_types.h Tue Dec 30 14:48:46 2008
++++ lib/libdvd/libdvdnav/src/dvdnav/dvd_types.h Sun Jan 26 19:51:43 2014
+@@ -161,14 +161,13 @@
+ /* The audio format */
+ typedef enum {
+ DVD_AUDIO_FORMAT_AC3 = 0,
+- DVD_AUDIO_FORMAT_MPEG1 = 1,
+- DVD_AUDIO_FORMAT_MPEG1_DRC = 2,
+- DVD_AUDIO_FORMAT_MPEG2 = 3,
+- DVD_AUDIO_FORMAT_MPEG2_DRC = 4,
+- DVD_AUDIO_FORMAT_LPCM = 5,
++ DVD_AUDIO_FORMAT_UNKNOWN_1 = 1,
++ DVD_AUDIO_FORMAT_MPEG = 2,
++ DVD_AUDIO_FORMAT_MPEG2_EXT = 3,
++ DVD_AUDIO_FORMAT_LPCM = 4,
++ DVD_AUDIO_FORMAT_UNKNOWN_5 = 5,
+ DVD_AUDIO_FORMAT_DTS = 6,
+- DVD_AUDIO_FORMAT_SDDS = 7,
+- DVD_AUDIO_FORMAT_Other = 8
++ DVD_AUDIO_FORMAT_SDDS = 7
+ } DVDAudioFormat_t;
+
+ /* Audio language extension */
+diff -uwr ../libdvdnav-4.2.1/src/dvdnav/dvdnav.h lib/libdvd/libdvdnav/src/dvdnav/dvdnav.h
+--- ../libdvdnav-4.2.1/src/dvdnav/dvdnav.h Sun Oct 6 21:47:20 2013
++++ lib/libdvd/libdvdnav/src/dvdnav/dvdnav.h Fri Feb 7 19:24:42 2014
+@@ -63,12 +63,6 @@
+ #define DVDNAV_STATUS_ERR 0
+ #define DVDNAV_STATUS_OK 1
+
+-#define DVDNAV_FORMAT_AC3 0
+-#define DVDNAV_FORMAT_MPEGAUDIO 3
+-#define DVDNAV_FORMAT_LPCM 4
+-#define DVDNAV_FORMAT_DTS 5
+-#define DVDNAV_FORMAT_SDDS 6
+-
+ /*********************************************************************
+ * initialisation & housekeeping functions *
+ *********************************************************************/
+@@ -377,6 +371,14 @@
+ divide it by 90000 to get the current play time in seconds
+ */
+ int64_t dvdnav_get_current_time(dvdnav_t *self);
++
++/*
++ * Find the nearest vobu and jump to it
++ *
++ * Alternative to dvdnav_time_search
++ */
++dvdnav_status_t dvdnav_jump_to_sector_by_time(dvdnav_t *this,
++ uint64_t time_in_pts_ticks, int32_t mode);
- if((next = nav_pci->nsml_agli.nsml_agl_dsta[angle-1]) != 0) {
- if((next & 0x3fffffff) != 0) {
-@@ -466,6 +468,10 @@
+ /*
+ * Stop playing the current position and start playback of the title
+diff -uwr ../libdvdnav-4.2.1/src/dvdnav.c lib/libdvd/libdvdnav/src/dvdnav.c
+--- ../libdvdnav-4.2.1/src/dvdnav.c Thu Oct 3 23:39:38 2013
++++ lib/libdvd/libdvdnav/src/dvdnav.c Fri Feb 7 19:24:42 2014
+@@ -467,6 +467,10 @@
/* Decode nav into pci and dsi. Then get next VOBU info. */
if(!dvdnav_decode_packet(this, *buf, &this->dsi, &this->pci)) {
printerr("Expected NAV packet but none found.");
@@ -81,7 +163,7 @@ diff -uwr libdvdnav-4.2.0/src/dvdnav.c xbmc/lib/libdvd/libdvdnav/src/dvdnav.c
pthread_mutex_unlock(&this->vm_lock);
return DVDNAV_STATUS_ERR;
}
-@@ -618,9 +624,17 @@
+@@ -619,9 +623,17 @@
cell_event->pgc_length = dvdnav_convert_time(&state->pgc->playback_time);
cell_event->cell_start = 0;
@@ -101,7 +183,7 @@ diff -uwr libdvdnav-4.2.0/src/dvdnav.c xbmc/lib/libdvd/libdvdnav/src/dvdnav.c
cell_event->pg_start = 0;
for (i = 1; i < state->pgc->program_map[state->pgN-1]; i++)
-@@ -769,6 +783,10 @@
+@@ -770,6 +782,10 @@
/* Decode nav into pci and dsi. Then get next VOBU info. */
if(!dvdnav_decode_packet(this, *buf, &this->dsi, &this->pci)) {
printerr("Expected NAV packet but none found.");
@@ -112,7 +194,38 @@ diff -uwr libdvdnav-4.2.0/src/dvdnav.c xbmc/lib/libdvd/libdvdnav/src/dvdnav.c
pthread_mutex_unlock(&this->vm_lock);
return DVDNAV_STATUS_ERR;
}
-@@ -1166,6 +1184,10 @@
+@@ -908,27 +924,10 @@
+ attr = vm_get_audio_attr(this->vm, stream);
+ pthread_mutex_unlock(&this->vm_lock);
+
+- switch(attr.audio_format) {
+- case 0:
+- format = DVDNAV_FORMAT_AC3;
+- break;
+- case 2: /* MPEG-1 or MPEG-2 without extension bitstream. */
+- case 3: /* MPEG-2 with extension bitstream. */
+- format = DVDNAV_FORMAT_MPEGAUDIO;
+- break;
+- case 4:
+- format = DVDNAV_FORMAT_LPCM;
+- break;
+- case 6:
+- format = DVDNAV_FORMAT_DTS;
+- break;
+- case 7:
+- format = DVDNAV_FORMAT_SDDS;
+- break;
+- default:
++ if (attr.audio_format >=0 && attr.audio_format <= 7)
++ format = attr.audio_format;
++ else
+ format = 0xffff;
+- break;
+- }
+
+ return format;
+ }
+@@ -1167,6 +1166,11 @@
ops.ops_int = 0;
@@ -120,10 +233,11 @@ diff -uwr libdvdnav-4.2.0/src/dvdnav.c xbmc/lib/libdvd/libdvdnav/src/dvdnav.c
+ printerr("Passed a NULL pointer.");
+ return ops.ops_struct;
+ }
++
if(!this->started) {
printerr("Virtual DVD machine not started.");
return ops.ops_struct;
-@@ -1180,3 +1202,263 @@
+@@ -1183,3 +1187,50 @@
return ops.ops_struct;
}
@@ -135,68 +249,6 @@ diff -uwr libdvdnav-4.2.0/src/dvdnav.c xbmc/lib/libdvd/libdvdnav/src/dvdnav.c
+ return this->vm;
+}
+
-+int dvdnav_get_nr_of_subtitle_streams(dvdnav_t *this)
-+{
-+ int i;
-+ int count = 0;
-+
-+ if (this && this->vm && this->vm->state.pgc)
-+ {
-+ for (i = 0; i < 32; i++)
-+ {
-+ if (this->vm->state.pgc->subp_control[i] & (1<<31)) count++;
-+ }
-+ }
-+ return count;
-+
-+ /* old code
-+ if(!this || !this->vm || !this->vm->vtsi || !this->vm->vtsi->vtsi_mat) return 0;
-+
-+ switch ((this->vm->state).domain) {
-+ case VTS_DOMAIN:
-+ return this->vm->vtsi->vtsi_mat->nr_of_vts_subp_streams;
-+ case VTSM_DOMAIN:
-+ return this->vm->vtsi->vtsi_mat->nr_of_vtsm_subp_streams; // 1
-+ case VMGM_DOMAIN:
-+ case FP_DOMAIN:
-+ return this->vm->vmgi->vmgi_mat->nr_of_vmgm_subp_streams; // 1
-+ }
-+
-+ return 0;
-+ */
-+}
-+
-+int dvdnav_get_nr_of_audio_streams(dvdnav_t *this)
-+{
-+ int i;
-+ int count = 0;
-+
-+ if (this && this->vm && this->vm->state.pgc)
-+ {
-+ for (i = 0; i < 8; i++)
-+ {
-+ if (this->vm->state.pgc->audio_control[i] & (1<<15)) count++;
-+ }
-+ }
-+ return count;
-+
-+ /* old code
-+ if(!this || !this->vm || !this->vm->vtsi || !this->vm->vtsi->vtsi_mat) return 0;
-+
-+ switch ((this->vm->state).domain) {
-+ case VTS_DOMAIN:
-+ return this->vm->vtsi->vtsi_mat->nr_of_vts_audio_streams;
-+ case VTSM_DOMAIN:
-+ return this->vm->vtsi->vtsi_mat->nr_of_vtsm_audio_streams; // 1
-+ case VMGM_DOMAIN:
-+ case FP_DOMAIN:
-+ return this->vm->vmgi->vmgi_mat->nr_of_vmgm_audio_streams; // 1
-+ }
-+
-+ return 0;
-+ */
-+}
-+
+/* return the alpha and color for the current active button
+ * color, alpha [0][] = selection
+ * color, alpha = color
@@ -232,168 +284,64 @@ diff -uwr libdvdnav-4.2.0/src/dvdnav.c xbmc/lib/libdvd/libdvdnav/src/dvdnav.c
+ return 0;
+}
+
-+/*
-+ * the next stuff is taken from ratdvd
-+ */
-+
+#undef printerr
+#define printerr(str) strncpy(self->err_str, str, MAX_ERR_LEN);
+
-+dvdnav_status_t dvdnav_get_audio_info(dvdnav_t * self, int32_t streamid, audio_attr_t* audio_attributes)
-+{
-+ if(!self) {
-+ printerr("Passed a NULL pointer.");
-+ return -1;
-+ }
-+ if(!self->started) {
-+ printerr("Virtual DVD machine not started.");
-+ return -1;
-+ }
-+
-+ pthread_mutex_lock(&self->vm_lock);
-+ audio_attr_t attributes = vm_get_audio_attr(self->vm,streamid);
-+ pthread_mutex_unlock(&self->vm_lock);
-+ audio_attributes->audio_format = attributes.audio_format;
-+ audio_attributes->multichannel_extension = attributes.multichannel_extension;
-+ audio_attributes->lang_type = attributes.lang_type;
-+ audio_attributes->application_mode = attributes.application_mode;
-+ audio_attributes->quantization = attributes.quantization;
-+ audio_attributes->sample_frequency = attributes.sample_frequency;
-+ audio_attributes->channels = attributes.channels;
-+ audio_attributes->lang_code = attributes.lang_code;
-+ audio_attributes->lang_extension = attributes.lang_extension;
-+ audio_attributes->code_extension = attributes.code_extension;
-+ audio_attributes->unknown3 = attributes.unknown3;
-+ audio_attributes->app_info = attributes.app_info;
-+ return DVDNAV_STATUS_OK;
-+}
-+
-+dvdnav_status_t dvdnav_get_stitle_info(dvdnav_t * self
-+ , int32_t streamid, subp_attr_t* stitle_attributes)
-+{
-+ if(!self) {
-+ printerr("Passed a NULL pointer.");
-+ return -1;
-+ }
-+ if(!self->started) {
-+ printerr("Virtual DVD machine not started.");
-+ return -1;
-+ }
-+
-+ pthread_mutex_lock(&self->vm_lock);
-+ subp_attr_t attributes = vm_get_subp_attr(self->vm,streamid);
-+ pthread_mutex_unlock(&self->vm_lock);
-+ stitle_attributes->code_mode = attributes.code_mode;
-+ stitle_attributes->zero1 = attributes.zero1;
-+ stitle_attributes->type = attributes.type;
-+ stitle_attributes->zero2 = attributes.zero2;
-+ stitle_attributes->lang_code = attributes.lang_code;
-+ stitle_attributes->lang_extension = attributes.lang_extension;
-+ stitle_attributes->code_extension = attributes.code_extension;
-+ return DVDNAV_STATUS_OK;
-+}
-+
-+dvdnav_status_t dvdnav_get_video_info(dvdnav_t * self, video_attr_t* video_attributes)
-+{
-+ if(!self) {
-+ printerr("Passed a NULL pointer.");
-+ return -1;
-+ }
-+ if(!self->started) {
-+ printerr("Virtual DVD machine not started.");
-+ return -1;
-+ }
-+
-+ pthread_mutex_lock(&self->vm_lock);
-+ video_attr_t attributes = vm_get_video_attr(self->vm);
-+ pthread_mutex_unlock(&self->vm_lock);
-+
-+ video_attributes->video_format = attributes.video_format;
-+ video_attributes->permitted_df = attributes.permitted_df;
-+ video_attributes->display_aspect_ratio = attributes.display_aspect_ratio;
-+ video_attributes->mpeg_version = attributes.mpeg_version;
-+ video_attributes->film_mode = attributes.film_mode;
-+ video_attributes->letterboxed = attributes.letterboxed;
-+ video_attributes->picture_size = attributes.picture_size;
-+ video_attributes->bit_rate = attributes.bit_rate;
-+ video_attributes->unknown1 = attributes.unknown1;
-+ video_attributes->line21_cc_2 = attributes.line21_cc_2;
-+ video_attributes->line21_cc_1 = attributes.line21_cc_1;
-+ return DVDNAV_STATUS_OK;
-+}
-+
-+dvdnav_status_t dvdnav_audio_change(dvdnav_t *self, int32_t audio)
-+{
-+ int32_t num;
-+
-+ if(!self) {
-+ printerr("Passed a NULL pointer.");
-+ return DVDNAV_STATUS_ERR;
-+ }
-+
-+ num = dvdnav_get_nr_of_audio_streams(self);
-+ pthread_mutex_lock(&self->vm_lock);
-+ /* Set subp AUDIO if valid */
-+ if((audio >= 0) && (audio <= num)) {
-+ self->vm->state.AST_REG = audio;
-+ } else {
-+ //printerr("Passed an invalid audio number.");
-+ pthread_mutex_unlock(&self->vm_lock);
-+ return DVDNAV_STATUS_ERR;
-+ }
-+ pthread_mutex_unlock(&self->vm_lock);
-+
-+ return DVDNAV_STATUS_OK;
-+}
-+
-+dvdnav_status_t dvdnav_subpicture_change(dvdnav_t *self, int32_t subpicture)
-+{
-+ int32_t num;
-+
-+ if(!self) {
-+ printerr("Passed a NULL pointer.");
-+ return DVDNAV_STATUS_ERR;
-+ }
-+
-+ num = dvdnav_get_nr_of_subtitle_streams(self);
-+ pthread_mutex_lock(&self->vm_lock);
-+ /* Set subp SPRM if valid */
-+ if((subpicture >= 0) && (subpicture <= num)) {
-+ self->vm->state.SPST_REG = subpicture | 0x40;
-+ } else if (subpicture & 0x80) {
-+ self->vm->state.SPST_REG = subpicture & ~0x80;
-+ } else {
-+ self->vm->state.SPST_REG = subpicture;
-+ //printerr("Passed an invalid subpicture number.");
-+ //pthread_mutex_unlock(&self->vm_lock);
-+ //return DVDNAV_STATUS_ERR;
-+ }
-+ pthread_mutex_unlock(&self->vm_lock);
-+
-+ return DVDNAV_STATUS_OK;
-+}
-+
-+void dvdnav_lock(dvdnav_t *self)
-+{
-+ // we do not check for null pointer problems
-+ pthread_mutex_lock(&self->vm_lock);
-+}
++#endif // _XBMC
+diff -uwr ../libdvdnav-4.2.1/src/dvdnav_internal.h lib/libdvd/libdvdnav/src/dvdnav_internal.h
+--- ../libdvdnav-4.2.1/src/dvdnav_internal.h Sun Dec 9 21:22:16 2012
++++ lib/libdvd/libdvdnav/src/dvdnav_internal.h Fri Feb 7 19:24:37 2014
+@@ -133,6 +133,45 @@
+ } ATTRIBUTE_PACKED spu_status_t;
+ #endif
+
++/*
++ * Describes a given time, and the closest sector, vobu and tmap index
++ */
++typedef struct {
++ uint64_t time;
++ uint32_t sector;
++ uint32_t vobu_idx;
++ int32_t tmap_idx;
++} dvdnav_pos_data_t;
+
-+void dvdnav_unlock(dvdnav_t *self)
-+{
-+ // we do not check for null pointer problems
-+ pthread_mutex_unlock(&self->vm_lock);
-+}
++/*
++ * Encapsulates cell data
++ */
++typedef struct {
++ int32_t idx;
++ dvdnav_pos_data_t *bgn;
++ dvdnav_pos_data_t *end;
++} dvdnav_cell_data_t;
+
-+#endif // _XBMC
++/*
++ * Encapsulates common variables used by internal functions of jump_to_time
++ */
++typedef struct {
++ vobu_admap_t *admap;
++ int32_t admap_len;
++ vts_tmap_t *tmap;
++ int32_t tmap_len;
++ int32_t tmap_interval;
++} dvdnav_jump_args_t;
+
-diff -uwr libdvdnav-4.2.0/src/dvdnav_internal.h xbmc/lib/libdvd/libdvdnav/src/dvdnav_internal.h
---- libdvdnav-4.2.0/src/dvdnav_internal.h 2010-06-01 12:02:38 +0200
-+++ xbmc/lib/libdvd/libdvdnav/src/dvdnav_internal.h 2013-02-07 14:42:34 +0100
-@@ -175,6 +175,18 @@
++/*
++ * Utility constants for jump_to_time
++ */
++#define TMAP_IDX_EDGE_BGN -1
++#define TMAP_IDX_EDGE_END -2
++#define JUMP_MODE_TIME_AFTER 1
++#define JUMP_MODE_TIME_DEFAULT 0
++#define JUMP_MODE_TIME_BEFORE -1
++
+ typedef struct dvdnav_vobu_s {
+ int32_t vobu_start; /* Logical Absolute. MAX needed is 0x300000 */
+ int32_t vobu_length;
+@@ -182,6 +221,18 @@
+
/* converts a dvd_time_t to PTS ticks */
int64_t dvdnav_convert_time(dvd_time_t *time);
-
++
+/* XBMC added functions */
+/*
+ * Get current playback state
@@ -405,13 +353,12 @@ diff -uwr libdvdnav-4.2.0/src/dvdnav_internal.h xbmc/lib/libdvd/libdvdnav/src/dv
+ */
+dvdnav_status_t dvdnav_set_state(dvdnav_t *this, dvd_state_t *save_state);
+/* end XBMC */
-+
+
/** USEFUL MACROS **/
- #ifdef __GNUC__
-diff -uwr libdvdnav-4.2.0/src/read_cache.c xbmc/lib/libdvd/libdvdnav/src/read_cache.c
---- libdvdnav-4.2.0/src/read_cache.c 2008-12-30 15:48:46 +0100
-+++ xbmc/lib/libdvd/libdvdnav/src/read_cache.c 2013-02-07 14:42:34 +0100
+diff -uwr ../libdvdnav-4.2.1/src/read_cache.c lib/libdvd/libdvdnav/src/read_cache.c
+--- ../libdvdnav-4.2.1/src/read_cache.c Tue Dec 30 14:48:46 2008
++++ lib/libdvd/libdvdnav/src/read_cache.c Wed Jan 29 20:43:09 2014
@@ -338,7 +338,7 @@
pthread_mutex_lock(&cache->lock);
for (i = 0; i < READ_CACHE_CHUNKS; i++) {
@@ -421,10 +368,18 @@ diff -uwr libdvdnav-4.2.0/src/read_cache.c xbmc/lib/libdvd/libdvdnav/src/read_ca
cache->chunk[i].usage_count--;
}
}
-diff -uwr libdvdnav-4.2.0/src/searching.c xbmc/lib/libdvd/libdvdnav/src/searching.c
---- libdvdnav-4.2.0/src/searching.c 2011-10-07 19:06:24 +0200
-+++ xbmc/lib/libdvd/libdvdnav/src/searching.c 2013-02-07 14:42:34 +0100
-@@ -121,6 +121,12 @@
+diff -uwr ../libdvdnav-4.2.1/src/searching.c lib/libdvd/libdvdnav/src/searching.c
+--- ../libdvdnav-4.2.1/src/searching.c Tue Nov 12 00:55:10 2013
++++ lib/libdvd/libdvdnav/src/searching.c Fri Feb 7 19:24:37 2014
+@@ -36,6 +36,7 @@
+ #include "vm/decoder.h"
+ #include "vm/vm.h"
+ #include "dvdnav_internal.h"
++#include <dvdread/ifo_read.h>
+
+ /*
+ #define LOG_DEBUG
+@@ -121,6 +122,12 @@
return DVDNAV_STATUS_ERR;
}
@@ -437,7 +392,7 @@ diff -uwr libdvdnav-4.2.0/src/searching.c xbmc/lib/libdvd/libdvdnav/src/searchin
this->cur_cell_time = 0;
if (this->pgc_based) {
-@@ -136,24 +142,109 @@
+@@ -136,24 +143,109 @@
last_cell_nr = state->pgc->nr_of_cells;
}
@@ -552,7 +507,7 @@ diff -uwr libdvdnav-4.2.0/src/searching.c xbmc/lib/libdvd/libdvdnav/src/searchin
if(found) {
uint32_t vobu;
#ifdef LOG_DEBUG
-@@ -202,6 +293,7 @@
+@@ -202,6 +294,7 @@
result = dvdnav_get_position(this, &target, &length);
if(!result) {
@@ -560,7 +515,7 @@ diff -uwr libdvdnav-4.2.0/src/searching.c xbmc/lib/libdvd/libdvdnav/src/searchin
return DVDNAV_STATUS_ERR;
}
-@@ -213,7 +305,7 @@
+@@ -213,7 +306,7 @@
return DVDNAV_STATUS_ERR;
}
#ifdef LOG_DEBUG
@@ -569,10 +524,11 @@ diff -uwr libdvdnav-4.2.0/src/searching.c xbmc/lib/libdvd/libdvdnav/src/searchin
fprintf(MSG_OUT, "libdvdnav: Before cellN=%u blockN=%u\n", state->cellN, state->blockN);
#endif
-@@ -654,3 +746,62 @@
+@@ -681,4 +774,653 @@
+ if(!retval && tmp)
free(tmp);
return retval;
- }
++}
+
+dvdnav_status_t dvdnav_get_state(dvdnav_t *this, dvd_state_t *save_state)
+{
@@ -632,10 +588,600 @@ diff -uwr libdvdnav-4.2.0/src/searching.c xbmc/lib/libdvd/libdvdnav/src/searchin
+ pthread_mutex_unlock(&this->vm_lock);
+ return DVDNAV_STATUS_OK;
+}
-diff -uwr libdvdnav-4.2.0/src/vm/vm.c xbmc/lib/libdvd/libdvdnav/src/vm/vm.c
---- libdvdnav-4.2.0/src/vm/vm.c 2010-11-22 00:59:44 +0100
-+++ xbmc/lib/libdvd/libdvdnav/src/vm/vm.c 2013-02-07 14:42:34 +0100
-@@ -255,6 +255,15 @@
++
++
++
++/* Get an admap and admap_len */
++static vobu_admap_t* dvdnav_admap_get(dvdnav_t *this, dvd_state_t *state,
++ int32_t *admap_len) {
++ vobu_admap_t *admap = NULL;
++ switch(state->domain) {
++ case FP_DOMAIN:
++ case VMGM_DOMAIN:
++ admap = this->vm->vmgi->menu_vobu_admap;
++ break;
++ case VTSM_DOMAIN:
++ admap = this->vm->vtsi->menu_vobu_admap;
++ break;
++ case VTS_DOMAIN:
++ admap = this->vm->vtsi->vts_vobu_admap;
++ break;
++ default: {
++ fprintf(MSG_OUT, "Unknown domain");
++ return NULL;
++ }
++ }
++ if (admap == NULL) return NULL;
++
++ *admap_len = (admap->last_byte + 1 - VOBU_ADMAP_SIZE) / VOBU_ADMAP_SIZE;
++ if (*admap_len <= 0) {
++ fprintf(MSG_OUT, "admap_len <= 0");
++ return NULL;
++ }
++ return admap;
++}
++
++/* Get a tmap, tmap_len and tmap_interval */
++static vts_tmap_t* dvdnav_tmap_get(dvdnav_t *this, dvd_state_t *state,
++ int32_t *tmap_len, int32_t *tmap_interval) {
++ int32_t vts_idx = 0;
++ domain_t domain;
++ ifo_handle_t *ifo = NULL;
++ vts_tmapt_t *tmapt = NULL;
++ uint16_t tmap_count = 0;
++ int32_t pgcN = 0;
++ vts_tmap_t *tmap = NULL;
++ int32_t result = 0;
++
++ vts_idx = state->vtsN;
++ domain = state->domain;
++ switch(domain) {
++ case FP_DOMAIN:
++ case VTSM_DOMAIN:
++ case VMGM_DOMAIN: {
++ ifo = this->vm->vmgi;
++ break;
++ }
++ case VTS_DOMAIN: {
++ ifo = this->vm->vtsi;
++ break;
++ }
++ default: {
++ fprintf(MSG_OUT, "unknown domain for tmap");
++ return NULL;
++ }
++ }
++ if (ifo == NULL) return NULL;
++ tmapt = ifo->vts_tmapt;
++ /* HACK: ifo->vts_tmapt is NULL b/c ifo_read.c never loads it
++ * load ifo->vts_tmapt directly*/
++ if (tmapt == NULL) {
++ result = ifoRead_VTS_TMAPT(ifo);
++ if (!result) {
++ return NULL;
++ }
++ tmapt = ifo->vts_tmapt;
++ if (tmapt == NULL) return NULL;
++ }
++
++ tmap_count = tmapt->nr_of_tmaps;
++ pgcN = state->pgcN - 1; /* -1 b/c pgcN is base1 */
++ if (pgcN < 0) {
++ fprintf(MSG_OUT, "pgcN < 0");
++ return NULL;
++ }
++
++ /* get tmap */
++ switch(domain) {
++ case FP_DOMAIN:
++ case VMGM_DOMAIN:
++ case VTSM_DOMAIN: {
++ if (tmap_count == 0) {
++ fprintf(MSG_OUT, "tmap_count == 0");
++ return NULL;
++ }
++ tmap = &tmapt->tmap[0]; /* ASSUME: vmgi only has one time map */
++ break;
++ }
++ case VTS_DOMAIN: {
++ if (pgcN >= tmap_count) {
++ fprintf(MSG_OUT, "pgcN >= tmap_count; pgcN=%i tmap_count=%i",
++ pgcN, tmap_count);
++ return NULL;
++ }
++ tmap = &tmapt->tmap[pgcN];
++ break;
++ }
++ }
++ if (tmap == NULL) return NULL;
++
++ /* tmap->tmu is in seconds; convert to millisecs */
++ *tmap_interval = tmap->tmu * 1000;
++ if (*tmap_interval == 0) {
++ fprintf(MSG_OUT, "tmap_interval == 0");
++ return NULL;
++ }
++ *tmap_len = tmap->nr_of_entries;
++ if (*tmap_len == 0) {
++ fprintf(MSG_OUT, "tmap_len == 0");
++ return NULL;
++ }
++ return tmap;
++}
++
++/* Get a sector from a tmap */
++static int32_t dvdnav_tmap_get_entry(vts_tmap_t *tmap, uint16_t tmap_len,
++ int32_t idx, uint32_t *sector) {
++ /* tmaps start at idx 0 which represents a sector at time 1 * tmap_interval
++ * this creates a "fake" tmap index at idx -1 for sector 0 */
++ if (idx == TMAP_IDX_EDGE_BGN) {
++ *sector = 0;
++ return 1;
++ }
++ if (idx < TMAP_IDX_EDGE_BGN || idx >= tmap_len) {
++ fprintf(MSG_OUT, "idx out of bounds idx=%i %i", idx, tmap_len);
++ return 0;
++ }
++ /* 0x7fffffff unsets discontinuity bit if present */
++ *sector = tmap->map_ent[idx] & 0x7fffffff;
++ return 1;
++}
++
++/* Do a binary search for earlier admap index near find_sector */
++static int32_t dvdnav_admap_search(vobu_admap_t *admap, uint32_t admap_len,
++ uint32_t find_sector, uint32_t *vobu) {
++ int32_t adj = 1;
++ int32_t prv_pos = 0;
++ int32_t prv_len = admap_len;
++ int32_t cur_len = 0;
++ int32_t cur_idx = 0;
++ uint32_t cur_sector = 0;
++ while (1) {
++ cur_len = prv_len / 2;
++ /* need to add 1 when prv_len == 3 (cur_len shoud go to 2, not 1) */
++ if (prv_len % 2 == 1) ++cur_len;
++ cur_idx = prv_pos + (cur_len * adj);
++ if (cur_idx < 0) cur_idx = 0;
++ else if (cur_idx >= admap_len) cur_idx = admap_len - 1;
++
++ cur_sector = admap->vobu_start_sectors[cur_idx];
++ if (find_sector < cur_sector) adj = -1;
++ else if (find_sector > cur_sector) adj = 1;
++ else if (find_sector == cur_sector) {
++ *vobu = cur_idx;
++ return 1;
++ }
++ if (cur_len == 1) {/* no smaller intervals left */
++ if (adj == -1) {/* last comparison was greater; take lesser */
++ cur_idx -= 1;
++ cur_sector = admap->vobu_start_sectors[cur_idx];
++ }
++ *vobu = cur_idx;
++ return 1;
++ }
++ prv_len = cur_len;
++ prv_pos = cur_idx;
++ }
++}
++
++/* Do a binary search for the earlier tmap entry near find_sector */
++static int32_t dvdnav_tmap_search(vts_tmap_t *tmap, uint32_t tmap_len,
++ uint32_t find_sector, int32_t *tmap_idx, uint32_t *sector) {
++ int32_t adj = 1;
++ int32_t prv_pos = 0;
++ int32_t prv_len = tmap_len;
++ int32_t result = 0;
++ int32_t cur_len = 0;
++ int32_t cur_idx = 0;
++ uint32_t cur_sector = 0;
++ while (1) {
++ cur_len = prv_len / 2;
++ /* need to add 1 when prv_len == 3 (cur_len shoud go to 2, not 1) */
++ if (prv_len % 2 == 1) ++cur_len;
++ cur_idx = prv_pos + (cur_len * adj);
++ if (cur_idx < 0) cur_idx = 0;
++ else if (cur_idx >= tmap_len) cur_idx = tmap_len - 1;
++ cur_sector = 0;
++ result = dvdnav_tmap_get_entry(tmap, tmap_len, cur_idx, &cur_sector);
++ if (!result) return 0;
++ if (find_sector < cur_sector) adj = -1;
++ else if (find_sector > cur_sector) adj = 1;
++ else if (find_sector == cur_sector) {
++ *tmap_idx = cur_idx;
++ *sector = cur_sector;
++ return 1;
++ }
++ if (cur_len == 1) {/* no smaller intervals left */
++ if (adj == -1) {/* last comparison was greater; take lesser */
++ if (cur_idx == 0) { /* fake tmap index for sector 0 */
++ cur_idx = TMAP_IDX_EDGE_BGN;
++ cur_sector = 0;
++ }
++ else {
++ cur_idx -= 1;
++ result = dvdnav_tmap_get_entry(tmap, tmap_len, cur_idx, &cur_sector);
++ if (!result) return 0;
++ }
++ }
++ *tmap_idx = cur_idx;
++ *sector = cur_sector;
++ return 1;
++ }
++ prv_len = cur_len;
++ prv_pos = cur_idx;
++ }
++}
++
++/* Find the cell for a given time */
++static int32_t dvdnav_cell_find(dvdnav_t *this, dvd_state_t *state,
++ uint64_t find_val, dvdnav_cell_data_t *cell_data) {
++ uint32_t cells_len = 0;
++ uint32_t cells_bgn = 0;
++ uint32_t cells_end = 0;
++ uint32_t cell_idx = 0;
++ pgc_t *pgc = NULL;
++ int pgN = 0;
++ cell_playback_t *cell = NULL;
++ int found = 0;
++
++ pgc = state->pgc;
++ if (pgc == NULL) return 0;
++ cells_len = pgc->nr_of_cells;
++ if (cells_len == 0) {
++ fprintf(MSG_OUT, "cells_len == 0");
++ return 0;
++ }
++
++ /* get cells_bgn, cells_end */
++ if (this->pgc_based) {
++ cells_bgn = 1;
++ cells_end = cells_len;
++ }
++ else {
++ pgN = state->pgN;
++ cells_bgn = pgc->program_map[pgN - 1]; /* -1 b/c pgN is 1 based? */
++ if (pgN < pgc->nr_of_programs) {
++ cells_end = pgc->program_map[pgN] - 1;
++ }
++ else {
++ cells_end = cells_len;
++ }
++ }
++
++ /* search cells */
++ for (cell_idx = cells_bgn; cell_idx <= cells_end; cell_idx++) {
++ cell = &(pgc->cell_playback[cell_idx - 1]); /* -1 b/c cell is base1 */
++ /* if angle block, only consider first angleBlock
++ * (others are "redundant" for purpose of search) */
++ if ( cell->block_type == BLOCK_TYPE_ANGLE_BLOCK
++ && cell->block_mode != BLOCK_MODE_FIRST_CELL) {
++ continue;
++ }
++ cell_data->bgn->sector = cell->first_sector;
++ cell_data->end->sector = cell->last_sector;
++
++ /* 90 pts to ms */
++ cell_data->end->time += (dvdnav_convert_time(&cell->playback_time) / 90);
++ if ( find_val >= cell_data->bgn->time
++ && find_val <= cell_data->end->time) {
++ found = 1;
++ break;
++ }
++ cell_data->bgn->time = cell_data->end->time;
++ }
++
++ /* found cell: set var */
++ if (found) {
++ cell_data->idx = cell_idx;
++ }
++ else
++ fprintf(MSG_OUT, "cell not found; find=%"PRId64"", find_val);
++ return found;
++}
++
++/* Given two sectors and a fraction, calc the corresponding vobu */
++static int32_t dvdnav_admap_interpolate_vobu(dvdnav_jump_args_t *args,
++ dvdnav_pos_data_t *bgn, dvdnav_pos_data_t *end, uint32_t fraction,
++ uint32_t *jump_sector) {
++ int32_t result = 0;
++ uint32_t vobu_len = 0;
++ uint32_t vobu_adj = 0;
++ uint32_t vobu_idx = 0;
++
++ /* get bgn->vobu_idx */
++ result = dvdnav_admap_search(args->admap, args->admap_len,
++ bgn->sector, &bgn->vobu_idx);
++ if (!result) {
++ fprintf(MSG_OUT, "admap_interpolate: could not find sector_bgn");
++ return 0;
++ }
++
++ /* get end->vobu_idx */
++ result = dvdnav_admap_search(args->admap, args->admap_len,
++ end->sector, &end->vobu_idx);
++ if (!result) {
++ fprintf(MSG_OUT, "admap_interpolate: could not find sector_end");
++ return 0;
++ }
++
++ vobu_len = end->vobu_idx - bgn->vobu_idx;
++ /* +500 to round up else 74% of a 4 sec interval = 2 sec */
++ vobu_adj = ((fraction * vobu_len) + 500) / 1000;
++ /* HACK: need to add +1, or else will land too soon (not sure why) */
++ vobu_adj++;
++ vobu_idx = bgn->vobu_idx + vobu_adj;
++ if (vobu_idx >= args->admap_len) {
++ fprintf(MSG_OUT, "admap_interpolate: vobu_idx >= admap_len");
++ return 0;
++ }
++ *jump_sector = args->admap->vobu_start_sectors[vobu_idx];
++ return 1;
++}
++
++/* Given two tmap entries and a time, calc the time for the lo tmap entry */
++static int32_t dvdnav_tmap_calc_time_for_tmap_entry(dvdnav_jump_args_t *args,
++ dvdnav_pos_data_t *lo, dvdnav_pos_data_t *hi,
++ dvdnav_pos_data_t *pos, uint64_t *out_time) {
++ int32_t result = 0;
++ uint32_t vobu_pct = 0;
++ uint64_t time_adj = 0;
++
++ if (lo->sector == hi->sector) {
++ fprintf(MSG_OUT, "lo->sector == hi->sector: %i", lo->sector);
++ return 0;
++ }
++
++ /* get vobus corresponding to lo, hi, pos */
++ result = dvdnav_admap_search(args->admap, args->admap_len,
++ lo->sector, &lo->vobu_idx);
++ if (!result) {
++ fprintf(MSG_OUT, "lo->vobu: lo->sector=%i", lo->sector);
++ return 0;
++ }
++ result = dvdnav_admap_search(args->admap, args->admap_len,
++ hi->sector, &hi->vobu_idx);
++ if (!result) {
++ fprintf(MSG_OUT, "hi->vobu: hi->sector=%i", hi->sector);
++ return 0;
++ }
++ result = dvdnav_admap_search(args->admap, args->admap_len,
++ pos->sector, &pos->vobu_idx);
++ if (!result) {
++ fprintf(MSG_OUT, "pos->vobu: pos->sector=%i", pos->sector);
++ return 0;
++ }
++
++ /* calc position of cell relative to lo */
++ vobu_pct = ((pos->vobu_idx - lo->vobu_idx) * 1000)
++ / ( hi->vobu_idx - lo->vobu_idx);
++ if (vobu_pct < 0 || vobu_pct > 1000) {
++ fprintf(MSG_OUT, "vobu_pct must be between 0 and 1000");
++ return 0;
++ }
++
++ /* calc time of lo */
++ time_adj = (uint64_t)((args->tmap_interval * vobu_pct) / 1000);
++ *out_time = pos->time - time_adj;
++ return 1;
++}
++
++/* Find the tmap entries on either side of a given sector */
++static int32_t dvdnav_tmap_get_entries_for_sector(dvdnav_t *this,
++ dvd_state_t *state, dvdnav_jump_args_t *args,
++ dvdnav_cell_data_t *cell_data, uint32_t find_sector,
++ dvdnav_pos_data_t *lo, dvdnav_pos_data_t *hi) {
++ int32_t result = 0;
++
++ result = dvdnav_tmap_search(args->tmap, args->tmap_len, find_sector,
++ &lo->tmap_idx, &lo->sector);
++ if (!result) {
++ fprintf(MSG_OUT, "could not find lo idx: %i", find_sector);
++ return 0;
++ }
++
++ /* HACK: Most DVDs have a tmap that starts at sector 0
++ * However, some have initial dummy cells that are not seekable
++ * (restricted = y).
++ * These cells will throw off the tmap calcs when in the first playable cell.
++ * For now, assume that lo->sector is equal to the cell->bgn->sector
++ * Note that for most DVDs this will be 0
++ * (Since they will have no dummy cells and cell 1 will start at sector 0)
++ */
++ if (lo->tmap_idx == TMAP_IDX_EDGE_BGN) {
++ lo->sector = cell_data->bgn->sector;
++ }
++
++ if (lo->tmap_idx == args->tmap_len - 1) {
++ /* lo is last tmap entry; "fake" entry for one beyond
++ * and mark it with cell_end_sector */
++ hi->tmap_idx = TMAP_IDX_EDGE_END;
++ hi->sector = cell_data->end->sector;
++ }
++ else {
++ hi->tmap_idx = lo->tmap_idx + 1;
++ result = dvdnav_tmap_get_entry(args->tmap, args->tmap_len,
++ hi->tmap_idx, &hi->sector);
++ if (!result) {
++ fprintf(MSG_OUT, "could not find hi idx: %i", find_sector);
++ return 0;
++ }
++ }
++ return 1;
++}
++
++/* Find the nearest vobu by using the tmap */
++static int32_t dvdnav_find_vobu_by_tmap(dvdnav_t *this, dvd_state_t *state,
++ dvdnav_jump_args_t *args, dvdnav_cell_data_t *cell_data,
++ dvdnav_pos_data_t *jump) {
++ uint64_t seek_offset = 0;
++ uint32_t seek_idx = 0;
++ int32_t result = 0;
++ dvdnav_pos_data_t *cell_bgn_lo = NULL;
++ dvdnav_pos_data_t *cell_bgn_hi = NULL;
++ dvdnav_pos_data_t *jump_lo = NULL;
++ dvdnav_pos_data_t *jump_hi = NULL;
++
++ /* get tmap, tmap_len, tmap_interval */
++ args->tmap = dvdnav_tmap_get(this, state,
++ &args->tmap_len, &args->tmap_interval);
++ if (args->tmap == NULL) return 0;
++
++ /* get tmap entries on either side of cell_bgn */
++ cell_bgn_lo = &(dvdnav_pos_data_t){0};
++ cell_bgn_hi = &(dvdnav_pos_data_t){0};
++ result = dvdnav_tmap_get_entries_for_sector(this, state, args, cell_data,
++ cell_data->bgn->sector, cell_bgn_lo, cell_bgn_hi);
++ if (!result) return 0;
++
++ /* calc time of cell_bgn_lo */
++ result = dvdnav_tmap_calc_time_for_tmap_entry(args, cell_bgn_lo, cell_bgn_hi,
++ cell_data->bgn, &cell_bgn_lo->time);
++ if (!result) return 0;
++
++ /* calc time of jump_time relative to cell_bgn_lo */
++ seek_offset = jump->time - cell_bgn_lo->time;
++ seek_idx = (uint32_t)(seek_offset / args->tmap_interval);
++ uint32_t seek_remainder = seek_offset - (seek_idx * args->tmap_interval);
++ uint32_t seek_pct = (seek_remainder * 1000) / args->tmap_interval;
++
++ /* get tmap entries on either side of jump_time */
++ jump_lo = &(dvdnav_pos_data_t){0};
++ jump_hi = &(dvdnav_pos_data_t){0};
++
++ /* if seek_idx == 0, then tmap_indexes are the same, do not re-get
++ * also, note cell_bgn_lo will already have sector if TMAP_IDX_EDGE_BGN */
++ if (seek_idx == 0) {
++ jump_lo = cell_bgn_lo;
++ jump_hi = cell_bgn_hi;
++ }
++ else {
++ jump_lo->tmap_idx = (uint32_t)(cell_bgn_lo->tmap_idx + seek_idx);
++ result = dvdnav_tmap_get_entry(args->tmap, args->tmap_len,
++ jump_lo->tmap_idx, &jump_lo->sector);
++ if (!result) return 0;
++
++ /* +1 handled by dvdnav_tmap_get_entry */
++ jump_hi->tmap_idx = jump_lo->tmap_idx + 1;
++ result = dvdnav_tmap_get_entry(args->tmap, args->tmap_len,
++ jump_hi->tmap_idx, &jump_hi->sector);
++ if (!result) return 0;
++ }
++
++ /* interpolate sector */
++ result = dvdnav_admap_interpolate_vobu(args, jump_lo, jump_hi,
++ seek_pct, &jump->sector);
++
++ return result;
++}
++
++/* Find the nearest vobu by using the cell boundaries */
++static int32_t dvdnav_find_vobu_by_cell_boundaries(dvdnav_t *this,
++ dvdnav_jump_args_t *args, dvdnav_cell_data_t *cell_data,
++ dvdnav_pos_data_t *jump) {
++ uint64_t jump_offset = 0;
++ uint64_t cell_len = 0;
++ uint32_t jump_pct = 0;
++ int32_t result = 0;
++
++ /* get jump_offset */
++ jump_offset = jump->time - cell_data->bgn->time;
++ if (jump_offset < 0) {
++ fprintf(MSG_OUT, "jump_offset < 0");
++ return 0;
++ }
++ cell_len = cell_data->end->time - cell_data->bgn->time;
++ if (cell_len < 0) {
++ fprintf(MSG_OUT, "cell_len < 0");
++ return 0;
++ }
++ jump_pct = (jump_offset * 1000) / cell_len;
++
++ /* get sector */
++ /* NOTE: end cell sector in VTS_PGC is last sector of cell
++ * this last sector is not the start of a VOBU
++ * +1 to get sector that is the start of a VOBU
++ * start of a VOBU is needed in order to index into admap */
++ cell_data->end->sector += 1;
++ result = dvdnav_admap_interpolate_vobu(args,
++ cell_data->bgn, cell_data->end, jump_pct, &jump->sector);
++ if (!result) {
++ fprintf(MSG_OUT, "find_by_admap.interpolate");
++ return 0;
++ }
++ return 1;
++}
++
++/* Jump to sector by time */
++/* NOTE: Mode is currently unimplemented. Only 0 should be passed. */
++/* 1 and -1 are for future implementation */
++/* 0: Default. Jump to a time which may be either <> time_in_pts_ticks */
++/* 1: After. Always jump to a time that is > time_in_pts_ticks */
++/* -1: Before. Always jump to a time that is < time_in_pts_ticks */
++dvdnav_status_t dvdnav_jump_to_sector_by_time(dvdnav_t *this,
++ uint64_t time_in_pts_ticks, int32_t mode) {
++ if (mode != JUMP_MODE_TIME_DEFAULT) return DVDNAV_STATUS_ERR;
++ int32_t result = DVDNAV_STATUS_ERR;
++ dvd_state_t *state = NULL;
++ uint32_t sector_off = 0;
++ dvdnav_pos_data_t *jump = NULL;
++ dvdnav_cell_data_t *cell_data = NULL;
++ dvdnav_jump_args_t *args = NULL;
++
++ jump = &(dvdnav_pos_data_t){0};
++ /* convert time to milliseconds */
++ jump->time = time_in_pts_ticks / 90;
++
++ /* get variables that will be used across both functions */
++ state = &(this->vm->state);
++ if (state == NULL) goto exit;
++
++ /* get cell info */
++ cell_data = &(dvdnav_cell_data_t){0};
++ cell_data->bgn = &(dvdnav_pos_data_t){0};
++ cell_data->end = &(dvdnav_pos_data_t){0};
++ result = dvdnav_cell_find(this, state, jump->time, cell_data);
++ if (!result) goto exit;
++
++ /* get admap */
++ args = &(dvdnav_jump_args_t){0};
++ args->admap = dvdnav_admap_get(this, state, &args->admap_len);
++ if (args->admap == NULL) goto exit;
++
++ /* find sector */
++ result = dvdnav_find_vobu_by_tmap(this, state, args, cell_data, jump);
++ if (!result) {/* bad tmap; interpolate over cell */
++ result = dvdnav_find_vobu_by_cell_boundaries(this, args, cell_data, jump);
++ if (!result) {
++ goto exit;
++ }
++ }
++
++#ifdef LOG_DEBUG
++ fprintf(MSG_OUT, "libdvdnav: seeking to time=%lu\n", jump->time);
++ fprintf(MSG_OUT, "libdvdnav: Before cellN=%u blockN=%u\n", state->cellN, state->blockN);
++#endif
++
++ /* jump to sector */
++ sector_off = jump->sector - cell_data->bgn->sector;
++ this->cur_cell_time = 0;
++ if (vm_jump_cell_block(this->vm, cell_data->idx, sector_off)) {
++ pthread_mutex_lock(&this->vm_lock);
++ this->vm->hop_channel += HOP_SEEK;
++ pthread_mutex_unlock(&this->vm_lock);
++ result = DVDNAV_STATUS_OK;
++ }
++
++#ifdef LOG_DEBUG
++ fprintf(MSG_OUT, "libdvdnav: After cellN=%u blockN=%u\n", state->cellN, state->blockN);
++#endif
++
++exit:
++ return result;
+ }
+diff -uwr ../libdvdnav-4.2.1/src/vm/vm.c lib/libdvd/libdvdnav/src/vm/vm.c
+--- ../libdvdnav-4.2.1/src/vm/vm.c Wed Dec 4 23:02:02 2013
++++ lib/libdvd/libdvdnav/src/vm/vm.c Fri Feb 7 19:31:48 2014
+@@ -254,6 +254,15 @@
fprintf(MSG_OUT, "libdvdnav: ifoRead_TITLE_VOBU_ADMAP vtsi failed\n");
return 0;
}
@@ -651,41 +1197,21 @@ diff -uwr libdvdnav-4.2.0/src/vm/vm.c xbmc/lib/libdvd/libdvdnav/src/vm/vm.c
(vm->state).vtsN = vtsN;
return 1;
-@@ -390,7 +399,15 @@
- /* return 0; Not really used for now.. */
+@@ -392,6 +401,13 @@
}
/* ifoRead_TXTDT_MGI(vmgi); Not implemented yet */
+ dvd_read_name(vm->dvd_name, vm->dvd_serial, dvdroot);
+#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) {
-@@ -846,7 +863,7 @@
- }
- }
-
--#if 0
-+// XBMC #if 0
- /* currently unused */
- void vm_get_audio_info(vm_t *vm, int *current, int *num_avail) {
- switch ((vm->state).domain) {
-@@ -884,7 +901,7 @@
- break;
- }
- }
--#endif
-+// XBMC #endif
-
- void vm_get_video_res(vm_t *vm, int *width, int *height) {
- video_attr_t attr = vm_get_video_attr(vm);
-@@ -1981,6 +1998,50 @@
+@@ -1983,6 +1999,50 @@
ifoClose(ifo);
}
@@ -736,23 +1262,9 @@ diff -uwr libdvdnav-4.2.0/src/vm/vm.c xbmc/lib/libdvd/libdvdnav/src/vm/vm.c
/* Debug functions */
#ifdef TRACE
-diff -uwr libdvdnav-4.2.0/src/vm/vm.h xbmc/lib/libdvd/libdvdnav/src/vm/vm.h
---- libdvdnav-4.2.0/src/vm/vm.h 2010-07-31 01:34:16 +0200
-+++ xbmc/lib/libdvd/libdvdnav/src/vm/vm.h 2013-02-07 14:42:34 +0100
-@@ -156,11 +156,11 @@
- int vm_get_audio_active_stream(vm_t *vm);
- int vm_get_subp_active_stream(vm_t *vm, int mode);
- void vm_get_angle_info(vm_t *vm, int *current, int *num_avail);
--#if 0
-+// _XBMC #if 0
- /* 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);
--#endif
-+// _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);
+diff -uwr ../libdvdnav-4.2.1/src/vm/vm.h lib/libdvd/libdvdnav/src/vm/vm.h
+--- ../libdvdnav-4.2.1/src/vm/vm.h Sat Jul 31 00:34:16 2010
++++ lib/libdvd/libdvdnav/src/vm/vm.h Fri Feb 7 19:30:55 2014
@@ -170,6 +170,9 @@
ifo_handle_t *vm_get_title_ifo(vm_t *vm, uint32_t title);
void vm_ifo_close(ifo_handle_t *ifo);
@@ -763,4 +1275,4 @@ diff -uwr libdvdnav-4.2.0/src/vm/vm.h xbmc/lib/libdvd/libdvdnav/src/vm/vm.h
/* Uncomment for VM command tracing */
/* #define TRACE */
#ifdef TRACE
-Only in xbmc/lib/libdvd/libdvdnav: version.h
+Only in lib/libdvd/libdvdnav/: version.h
diff --git a/lib/libdvd/patches/libdvdnav_correct_audio_format_enum.diff b/lib/libdvd/patches/libdvdnav_correct_audio_format_enum.diff
deleted file mode 100644
index 2951de71c9..0000000000
--- a/lib/libdvd/patches/libdvdnav_correct_audio_format_enum.diff
+++ /dev/null
@@ -1,23 +0,0 @@
---- libdvdnav-4.2.0/src/dvdnav/dvd_types.h Wed Mar 20 08:51:10 2013
-+++ lib/libdvd/libdvdnav/src/dvdnav/dvd_types.h Wed Mar 20 12:22:25 2013
-@@ -161,14 +161,13 @@
- /* The audio format */
- typedef enum {
- DVD_AUDIO_FORMAT_AC3 = 0,
-- DVD_AUDIO_FORMAT_MPEG1 = 1,
-- DVD_AUDIO_FORMAT_MPEG1_DRC = 2,
-- DVD_AUDIO_FORMAT_MPEG2 = 3,
-- DVD_AUDIO_FORMAT_MPEG2_DRC = 4,
-- DVD_AUDIO_FORMAT_LPCM = 5,
-+ DVD_AUDIO_FORMAT_UNKNOWN_1 = 1,
-+ DVD_AUDIO_FORMAT_MPEG = 2,
-+ DVD_AUDIO_FORMAT_MPEG2_EXT = 3,
-+ DVD_AUDIO_FORMAT_LPCM = 4,
-+ DVD_AUDIO_FORMAT_UNKNOWN_5 = 5,
- DVD_AUDIO_FORMAT_DTS = 6,
-- DVD_AUDIO_FORMAT_SDDS = 7,
-- DVD_AUDIO_FORMAT_Other = 8
-+ DVD_AUDIO_FORMAT_SDDS = 7
- } DVDAudioFormat_t;
-
- /* Audio language extension */
diff --git a/lib/libdvd/patches/libdvdnav_correct_dvdnav_audio_stream_format.diff b/lib/libdvd/patches/libdvdnav_correct_dvdnav_audio_stream_format.diff
deleted file mode 100644
index d4e3b776d8..0000000000
--- a/lib/libdvd/patches/libdvdnav_correct_dvdnav_audio_stream_format.diff
+++ /dev/null
@@ -1,33 +0,0 @@
---- libdvdnav-4.2.0/src/dvdnav.c Wed Mar 20 11:38:53 2013
-+++ lib/libdvd/libdvdnav/src/dvdnav.c Wed Mar 20 13:20:35 2013
-@@ -907,27 +925,10 @@
- attr = vm_get_audio_attr(this->vm, stream);
- pthread_mutex_unlock(&this->vm_lock);
-
-- switch(attr.audio_format) {
-- case 0:
-- format = DVDNAV_FORMAT_AC3;
-- break;
-- case 2: /* MPEG-1 or MPEG-2 without extension bitstream. */
-- case 3: /* MPEG-2 with extension bitstream. */
-- format = DVDNAV_FORMAT_MPEGAUDIO;
-- break;
-- case 4:
-- format = DVDNAV_FORMAT_LPCM;
-- break;
-- case 6:
-- format = DVDNAV_FORMAT_DTS;
-- break;
-- case 7:
-- format = DVDNAV_FORMAT_SDDS;
-- break;
-- default:
-+ if (attr.audio_format >=0 && attr.audio_format <= 7)
-+ format = attr.audio_format;
-+ else
- format = 0xffff;
-- break;
-- }
-
- return format;
- }
diff --git a/lib/libdvd/patches/libdvdnav_reenable_serialstring.diff b/lib/libdvd/patches/libdvdnav_reenable_serialstring.diff
deleted file mode 100644
index 80b2fd912f..0000000000
--- a/lib/libdvd/patches/libdvdnav_reenable_serialstring.diff
+++ /dev/null
@@ -1,28 +0,0 @@
-diff --git a/libdvdnav/src/vm/vm.c b/libdvdnav/src/vm/vm.c
-index aea50f3..a14e675 100644
---- a/libdvdnav/src/vm/vm.c
-+++ b/libdvdnav/src/vm/vm.c
-@@ -176,7 +176,6 @@ static void dvd_read_name(char *name, char *serial, const char *device) {
- off = lseek( fd, 32 * (off_t) DVD_VIDEO_LB_LEN, SEEK_SET );
- if( off == ( 32 * (off_t) DVD_VIDEO_LB_LEN ) ) {
- off = read( fd, data, DVD_VIDEO_LB_LEN );
-- close(fd);
- if (off == ( (off_t) DVD_VIDEO_LB_LEN )) {
- fprintf(MSG_OUT, "libdvdnav: DVD Title: ");
- for(i=25; i < 73; i++ ) {
-@@ -399,14 +398,13 @@ int vm_reset(vm_t *vm, const char *dvdroot) {
- /* return 0; Not really used for now.. */
- }
- /* ifoRead_TXTDT_MGI(vmgi); Not implemented yet */
-+ dvd_read_name(vm->dvd_name, vm->dvd_serial, dvdroot);
- #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);
- }
diff --git a/lib/libdvd/patches/libdvdnav_remove_unneeded_defines.diff b/lib/libdvd/patches/libdvdnav_remove_unneeded_defines.diff
deleted file mode 100644
index 9609dd0312..0000000000
--- a/lib/libdvd/patches/libdvdnav_remove_unneeded_defines.diff
+++ /dev/null
@@ -1,15 +0,0 @@
---- libdvdnav-4.2.0/src/dvdnav/dvdnav.h Wed Mar 20 11:38:52 2013
-+++ lib/libdvd/libdvdnav/src/dvdnav/dvdnav.h Wed Mar 20 13:19:13 2013
-@@ -63,12 +63,6 @@
- #define DVDNAV_STATUS_ERR 0
- #define DVDNAV_STATUS_OK 1
-
--#define DVDNAV_FORMAT_AC3 0
--#define DVDNAV_FORMAT_MPEGAUDIO 3
--#define DVDNAV_FORMAT_LPCM 4
--#define DVDNAV_FORMAT_DTS 5
--#define DVDNAV_FORMAT_SDDS 6
--
- /*********************************************************************
- * initialisation & housekeeping functions *
- *********************************************************************/