summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames Courtier-Dutton <jcdutton@users.sourceforge.net>2003-05-11 13:44:04 +0000
committerJames Courtier-Dutton <jcdutton@users.sourceforge.net>2003-05-11 13:44:04 +0000
commit374683d4cfa703bacde895a7d52ab0c8fb37f5ff (patch)
treec10668059ecd22365dd23fe3bc8ccb8eba97afdc /src
parent9b37bb8059ada2e9cb3db3d109c4cd919ff1c97b (diff)
downloadxine-lib-374683d4cfa703bacde895a7d52ab0c8fb37f5ff.tar.gz
xine-lib-374683d4cfa703bacde895a7d52ab0c8fb37f5ff.tar.bz2
Update from the libdvdnav project on http://dvd.sf.net
CVS patchset: 4821 CVS date: 2003/05/11 13:44:04
Diffstat (limited to 'src')
-rw-r--r--src/input/libdvdnav/decoder.c4
-rw-r--r--src/input/libdvdnav/decoder.h6
-rw-r--r--src/input/libdvdnav/dvd_input.c4
-rw-r--r--src/input/libdvdnav/dvd_reader.c90
-rw-r--r--src/input/libdvdnav/dvdnav.c133
-rw-r--r--src/input/libdvdnav/dvdnav.h74
-rw-r--r--src/input/libdvdnav/dvdnav_internal.h10
-rw-r--r--src/input/libdvdnav/dvdnav_internal.h.in10
-rw-r--r--src/input/libdvdnav/highlight.c164
-rw-r--r--src/input/libdvdnav/navigation.c86
-rw-r--r--src/input/libdvdnav/searching.c108
-rw-r--r--src/input/libdvdnav/settings.c32
-rw-r--r--src/input/libdvdnav/vmcmd.h6
13 files changed, 377 insertions, 350 deletions
diff --git a/src/input/libdvdnav/decoder.c b/src/input/libdvdnav/decoder.c
index 76b1cc048..ee701ee3a 100644
--- a/src/input/libdvdnav/decoder.c
+++ b/src/input/libdvdnav/decoder.c
@@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: decoder.c,v 1.9 2003/04/29 21:55:47 jcdutton Exp $
+ * $Id: decoder.c,v 1.10 2003/05/11 13:44:04 jcdutton Exp $
*
*/
@@ -35,7 +35,7 @@
#include "dvdnav_internal.h"
-uint32_t vm_getbits(command_t *command, int start, int count) {
+uint32_t vm_getbits(command_t *command, int32_t start, int32_t count) {
uint64_t result = 0;
uint64_t bit_mask = 0;
uint64_t examining = 0;
diff --git a/src/input/libdvdnav/decoder.h b/src/input/libdvdnav/decoder.h
index 0d7e5e401..293f0b53d 100644
--- a/src/input/libdvdnav/decoder.h
+++ b/src/input/libdvdnav/decoder.h
@@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: decoder.h,v 1.7 2003/04/07 18:10:46 mroi Exp $
+ * $Id: decoder.h,v 1.8 2003/05/11 13:44:05 jcdutton Exp $
*
*/
@@ -101,11 +101,11 @@ typedef struct {
/* the big VM function, executing the given commands and writing
* the link where to continue, the return value indicates if a jump
* has been performed */
-int vmEval_CMD(vm_cmd_t commands[], int num_commands,
+int vmEval_CMD(vm_cmd_t commands[], int32_t num_commands,
registers_t *registers, link_t *return_values);
/* extracts some bits from the command */
-uint32_t vm_getbits(command_t* command, int start, int count);
+uint32_t vm_getbits(command_t* command, int32_t start, int32_t count);
#ifdef TRACE
/* for debugging: prints a link in readable form */
diff --git a/src/input/libdvdnav/dvd_input.c b/src/input/libdvdnav/dvd_input.c
index bad7097a2..481f086a9 100644
--- a/src/input/libdvdnav/dvd_input.c
+++ b/src/input/libdvdnav/dvd_input.c
@@ -172,7 +172,11 @@ static dvd_input_t file_open(const char *target)
}
/* Open the device */
+#ifndef _MSC_VER
dev->fd = open(target, O_RDONLY);
+#else
+ dev->fd = open(target, O_RDONLY | O_BINARY);
+#endif
if(dev->fd < 0) {
perror("libdvdread: Could not open input");
free(dev);
diff --git a/src/input/libdvdnav/dvd_reader.c b/src/input/libdvdnav/dvd_reader.c
index 700ad7d20..90930bcdd 100644
--- a/src/input/libdvdnav/dvd_reader.c
+++ b/src/input/libdvdnav/dvd_reader.c
@@ -44,7 +44,6 @@
#include <mntent.h>
#endif
-#include "compat.h"
#include "dvd_udf.h"
#include "dvd_input.h"
#include "dvd_reader.h"
@@ -52,9 +51,9 @@
#define DEFAULT_UDF_CACHE_LEVEL 1
-/**/
-#define WIN32_CSS 0
-/**/
+#ifdef _MSC_VER
+#define fchdir chdir
+#endif
struct dvd_reader_s {
/* Basic information. */
@@ -299,43 +298,53 @@ static char *bsd_block2char( const char *path )
}
#endif
-dvd_reader_t *DVDOpen( const char *path )
+dvd_reader_t *DVDOpen( const char *ppath )
{
-#ifndef _MSC_VER
struct stat fileinfo;
int ret;
-#endif /* _MSC_VER */
-
int have_css;
-
+ dvd_reader_t *ret_val = NULL;
char *dev_name = 0;
-
- if( path == NULL )
- return 0;
+ char *path;
#ifdef _MSC_VER
+ int len;
+#endif
- /* Try to open libdvdcss or fall back to standard functions */
- have_css = dvdinput_setup();
-
- return DVDOpenImageFile( path, have_css );
-
-#else
+ if( ppath == NULL )
+ return 0;
+ path = strdup(ppath);
+
/* Try to open libdvdcss or fall back to standard functions */
have_css = dvdinput_setup();
+
+#ifdef _MSC_VER
+ /* Strip off the trailing \ if it is not a drive */
+ len = strlen(path);
+ if ((len > 1) &&
+ (path[len - 1] == '\\') &&
+ (path[len - 2] != ':'))
+ {
+ path[len-1] = '\0';
+ }
+#endif
ret = stat( path, &fileinfo );
+
if( ret < 0 ) {
/* maybe "host:port" url? try opening it with acCeSS library */
if( strchr(path,':') ) {
- return DVDOpenImageFile( path, have_css );
+ ret_val = DVDOpenImageFile( path, have_css );
+ free(path);
+ return ret_val;
}
/* If we can't stat the file, give up */
fprintf( stderr, "libdvdread: Can't stat %s\n", path );
perror("");
+ free(path);
return 0;
}
@@ -348,13 +357,16 @@ dvd_reader_t *DVDOpen( const char *path )
* Block devices and regular files are assumed to be DVD-Video images.
*/
#if defined(__sun)
- return DVDOpenImageFile( sun_block2char( path ), have_css );
+ ret_val = DVDOpenImageFile( sun_block2char( path ), have_css );
#elif defined(SYS_BSD)
- return DVDOpenImageFile( bsd_block2char( path ), have_css );
+ ret_val = DVDOpenImageFile( bsd_block2char( path ), have_css );
#else
- return DVDOpenImageFile( path, have_css );
+ ret_val = DVDOpenImageFile( path, have_css );
#endif
+ free(path);
+ return ret_val;
+
} else if( S_ISDIR( fileinfo.st_mode ) ) {
dvd_reader_t *auth_drive = 0;
char *path_copy;
@@ -365,7 +377,10 @@ dvd_reader_t *DVDOpen( const char *path )
#endif
/* XXX: We should scream real loud here. */
- if( !(path_copy = strdup( path ) ) ) return 0;
+ if( !(path_copy = strdup( path ) ) ) {
+ free(path);
+ return 0;
+ }
/* Resolve any symlinks and get the absolut dir name. */
{
@@ -374,7 +389,7 @@ dvd_reader_t *DVDOpen( const char *path )
if( cdir >= 0 ) {
chdir( path_copy );
- new_path = getcwd( NULL, XINE_PATH_MAX );
+ new_path = getcwd( NULL, PATH_MAX );
fchdir( cdir );
close( cdir );
if( new_path ) {
@@ -450,13 +465,23 @@ dvd_reader_t *DVDOpen( const char *path )
}
fclose( mntfile );
}
+#elif defined(_MSC_VER)
+ auth_drive = DVDOpenImageFile( path, have_css );
#endif
+
+#ifndef _MSC_VER
if( !dev_name ) {
fprintf( stderr, "libdvdread: Couldn't find device name.\n" );
} else if( !auth_drive ) {
fprintf( stderr, "libdvdread: Device %s inaccessible, "
"CSS authentication not available.\n", dev_name );
}
+#else
+ if( !auth_drive ) {
+ fprintf( stderr, "libdvdread: Device %s inaccessible, "
+ "CSS authentication not available.\n", dev_name );
+ }
+#endif
free( dev_name );
free( path_copy );
@@ -464,17 +489,22 @@ dvd_reader_t *DVDOpen( const char *path )
/**
* If we've opened a drive, just use that.
*/
- if( auth_drive ) return auth_drive;
+ if( auth_drive ) {
+ free(path);
+ return auth_drive;
+ }
/**
* Otherwise, we now try to open the directory tree instead.
*/
- return DVDOpenPath( path );
+ ret_val = DVDOpenPath( path );
+ free( path );
+ return ret_val;
}
-#endif /* _MSC_VER */
/* If it's none of the above, screw it. */
fprintf( stderr, "libdvdread: Could not open %s\n", path );
+ free( path );
return 0;
}
@@ -539,7 +569,7 @@ static int findDirFile( const char *path, const char *file, char *filename )
static int findDVDFile( dvd_reader_t *dvd, const char *file, char *filename )
{
- char video_path[ XINE_PATH_MAX + 1 ];
+ char video_path[ PATH_MAX + 1 ];
const char *nodirfile;
int ret;
@@ -573,7 +603,7 @@ static int findDVDFile( dvd_reader_t *dvd, const char *file, char *filename )
*/
static dvd_file_t *DVDOpenFilePath( dvd_reader_t *dvd, char *filename )
{
- char full_path[ XINE_PATH_MAX + 1 ];
+ char full_path[ PATH_MAX + 1 ];
dvd_file_t *dvd_file;
struct stat fileinfo;
dvd_input_t dev;
@@ -657,7 +687,7 @@ static dvd_file_t *DVDOpenVOBUDF( dvd_reader_t *dvd, int title, int menu )
static dvd_file_t *DVDOpenVOBPath( dvd_reader_t *dvd, int title, int menu )
{
char filename[ MAX_UDF_FILE_NAME_LEN ];
- char full_path[ XINE_PATH_MAX + 1 ];
+ char full_path[ PATH_MAX + 1 ];
struct stat fileinfo;
dvd_file_t *dvd_file;
int i;
diff --git a/src/input/libdvdnav/dvdnav.c b/src/input/libdvdnav/dvdnav.c
index 923f9736d..0b5fc59c8 100644
--- a/src/input/libdvdnav/dvdnav.c
+++ b/src/input/libdvdnav/dvdnav.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: dvdnav.c,v 1.27 2003/04/29 22:18:14 jcdutton Exp $
+ * $Id: dvdnav.c,v 1.28 2003/05/11 13:44:05 jcdutton Exp $
*
*/
@@ -51,6 +51,7 @@ static dvdnav_status_t dvdnav_clear(dvdnav_t * this) {
memset(&this->pci,0,sizeof(this->pci));
memset(&this->dsi,0,sizeof(this->dsi));
+ this->last_cmd_nav_lbn = 0;
/* Set initial values of flags */
this->position_current.still = 0;
@@ -62,7 +63,7 @@ static dvdnav_status_t dvdnav_clear(dvdnav_t * this) {
dvdnav_read_cache_clear(this->cache);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_open(dvdnav_t** dest, const char *path) {
@@ -75,7 +76,7 @@ dvdnav_status_t dvdnav_open(dvdnav_t** dest, const char *path) {
(*dest) = NULL;
this = (dvdnav_t*)malloc(sizeof(dvdnav_t));
if(!this)
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
memset(this, 0, (sizeof(dvdnav_t) ) ); /* Make sure this structure is clean */
pthread_mutex_init(&this->vm_lock, NULL);
@@ -88,14 +89,14 @@ dvdnav_status_t dvdnav_open(dvdnav_t** dest, const char *path) {
printerr("Error initialising the DVD VM.");
pthread_mutex_destroy(&this->vm_lock);
free(this);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
if(!vm_reset(this->vm, path)) {
printerr("Error starting the VM / opening the DVD device.");
pthread_mutex_destroy(&this->vm_lock);
vm_free_vm(this->vm);
free(this);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
/* Set the path. FIXME: Is a deep copy 'right' */
@@ -115,7 +116,7 @@ dvdnav_status_t dvdnav_open(dvdnav_t** dest, const char *path) {
dvdnav_clear(this);
(*dest) = this;
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_close(dvdnav_t *this) {
@@ -126,7 +127,7 @@ dvdnav_status_t dvdnav_close(dvdnav_t *this) {
if(!this) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
if (this->file) {
@@ -151,7 +152,7 @@ dvdnav_status_t dvdnav_close(dvdnav_t *this) {
else
free(this);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_reset(dvdnav_t *this) {
@@ -163,7 +164,7 @@ dvdnav_status_t dvdnav_reset(dvdnav_t *this) {
if(!this) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
pthread_mutex_lock(&this->vm_lock);
@@ -174,7 +175,7 @@ dvdnav_status_t dvdnav_reset(dvdnav_t *this) {
if(!vm_reset(this->vm, NULL)) {
printerr("Error restarting the VM.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
#ifdef LOG_DEBUG
fprintf(MSG_OUT, "libdvdnav: clearing dvdnav\n");
@@ -189,12 +190,12 @@ dvdnav_status_t dvdnav_path(dvdnav_t *this, const char** path) {
if(!this || !path) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
(*path) = this->path;
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
const char* dvdnav_err_to_string(dvdnav_t *this) {
@@ -208,7 +209,7 @@ const char* dvdnav_err_to_string(dvdnav_t *this) {
/* converts a dvd_time_t to PTS ticks */
static int64_t dvdnav_convert_time(dvd_time_t *time) {
int64_t result;
- int frames;
+ int64_t frames;
result = (time->hour >> 4 ) * 10 * 60 * 60 * 90000;
result += (time->hour & 0x0f) * 60 * 60 * 90000;
@@ -235,14 +236,14 @@ static int64_t dvdnav_convert_time(dvd_time_t *time) {
* Most of the code in here is copied from xine's MPEG demuxer
* so any bugs which are found in that should be corrected here also.
*/
-static int dvdnav_decode_packet(dvdnav_t *this, uint8_t *p, dsi_t *nav_dsi, pci_t *nav_pci) {
- int bMpeg1 = 0;
+static int32_t dvdnav_decode_packet(dvdnav_t *this, uint8_t *p, dsi_t *nav_dsi, pci_t *nav_pci) {
+ int32_t bMpeg1 = 0;
uint32_t nHeaderLen;
uint32_t nPacketLen;
uint32_t nStreamID;
if (p[3] == 0xBA) { /* program stream pack header */
- int nStuffingBytes;
+ int32_t nStuffingBytes;
bMpeg1 = (p[4] & 0x40) == 0;
@@ -273,7 +274,7 @@ static int dvdnav_decode_packet(dvdnav_t *this, uint8_t *p, dsi_t *nav_dsi, pci_
if (nStreamID == 0xbf) { /* Private stream 2 */
#if 0
- int i;
+ int32_t i;
fprintf(MSG_OUT, "libdvdnav: nav packet=%u\n",p-p_start-6);
for(i=0;i<80;i++)
fprintf(MSG_OUT, "%02x ",p[i-6]);
@@ -300,9 +301,9 @@ static int dvdnav_decode_packet(dvdnav_t *this, uint8_t *p, dsi_t *nav_dsi, pci_
/* DSI is used for most angle stuff.
* PCI is used for only non-seemless angle stuff
*/
-static int dvdnav_get_vobu(dvdnav_t *this, dsi_t *nav_dsi, pci_t *nav_pci, dvdnav_vobu_t *vobu) {
+static int32_t dvdnav_get_vobu(dvdnav_t *this, dsi_t *nav_dsi, pci_t *nav_pci, dvdnav_vobu_t *vobu) {
uint32_t next;
- int angle, num_angle;
+ int32_t angle, num_angle;
vobu->vobu_start = nav_dsi->dsi_gi.nv_pck_lbn; /* Absolute offset from start of disk */
vobu->vobu_length = nav_dsi->dsi_gi.vobu_ea; /* Relative offset from vobu_start */
@@ -377,14 +378,14 @@ static int dvdnav_get_vobu(dvdnav_t *this, dsi_t *nav_dsi, pci_t *nav_pci, dvdna
* The drawback is the additional memcopy.
*/
-dvdnav_status_t dvdnav_get_next_block(dvdnav_t *this, unsigned char *buf,
- int *event, int *len) {
+dvdnav_status_t dvdnav_get_next_block(dvdnav_t *this, uint8_t *buf,
+ int32_t *event, int32_t *len) {
unsigned char *block;
dvdnav_status_t status;
block = buf;
status = dvdnav_get_next_cache_block(this, &block, event, len);
- if (status == S_OK && block != buf) {
+ if (status == DVDNAV_STATUS_OK && block != buf) {
/* we received a block from the cache, copy it, so we can give it back */
memcpy(buf, block, DVD_VIDEO_LB_LEN);
dvdnav_free_cache_block(this, block);
@@ -392,14 +393,14 @@ dvdnav_status_t dvdnav_get_next_block(dvdnav_t *this, unsigned char *buf,
return status;
}
-dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
- int *event, int *len) {
+dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, uint8_t **buf,
+ int32_t *event, int32_t *len) {
dvd_state_t *state;
- int result;
+ int32_t result;
if(!this || !event || !len || !buf || !*buf) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
pthread_mutex_lock(&this->vm_lock);
@@ -420,7 +421,7 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
(*event) = DVDNAV_STOP;
this->started = 0;
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
vm_position_get(this->vm, &this->position_next);
@@ -439,12 +440,12 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
fprintf(MSG_OUT, "libdvdnav: HOP_CHANNEL\n");
#endif
if (this->position_next.hop_channel - this->position_current.hop_channel >= HOP_SEEK) {
- int num_angles = 0, current;
+ int32_t num_angles = 0, current;
/* we seeked -> check for multiple angles */
vm_get_angle_info(this->vm, &current, &num_angles);
if (num_angles > 1) {
- int result, block;
+ int32_t result, block;
/* we have to skip the first VOBU when seeking in a multiangle feature,
* because it might belong to the wrong angle */
block = this->position_next.cell_start + this->position_next.block;
@@ -452,13 +453,13 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
if(result <= 0) {
printerr("Error reading NAV packet.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
/* 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.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
dvdnav_get_vobu(this, &this->dsi, &this->pci, &this->vobu);
/* skip to next, if there is a next */
@@ -479,7 +480,7 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
this->vobu.blockN = 0;
this->sync_wait = 0;
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
/* Check the HIGHLIGHT flag */
@@ -495,7 +496,7 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
hevent->buttonN = this->position_next.button;
this->position_current.button = this->position_next.button;
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
/* Check the WAIT flag */
@@ -506,14 +507,14 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
#endif
(*len) = 0;
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
/* Check to see if we need to change the currently opened VOB */
if((this->position_current.vts != this->position_next.vts) ||
(this->position_current.domain != this->position_next.domain)) {
dvd_read_domain_t domain;
- int vtsN;
+ int32_t vtsN;
dvdnav_vts_change_event_t *vts_event = (dvdnav_vts_change_event_t *)*buf;
if(this->file) {
@@ -542,7 +543,7 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
default:
printerr("Unknown domain when changing VTS.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
this->position_current.vts = this->position_next.vts;
@@ -556,7 +557,7 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
if(this->file == NULL) {
printerrf("Error opening vtsN=%i, domain=%i.", vtsN, domain);
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
/* File opened successfully so return a VTS change event */
@@ -572,7 +573,7 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
this->position_current.audio_channel = -1; /* Force an update */;
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
/* Check if the cell changed */
@@ -580,7 +581,7 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
(this->position_current.cell_restart != this->position_next.cell_restart) ||
(this->position_current.cell_start != this->position_next.cell_start) ) {
dvdnav_cell_change_event_t *cell_event = (dvdnav_cell_change_event_t *)*buf;
- int first_cell_nr, last_cell_nr, i;
+ int32_t first_cell_nr, last_cell_nr, i;
dvd_state_t *state = &this->vm->state;
(*event) = DVDNAV_CELL_CHANGE;
@@ -635,7 +636,7 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
this->position_current.audio_channel = -1; /* Force an update */
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
/* has the CLUT changed? */
@@ -648,7 +649,7 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
memcpy(*buf, &(state->pgc->palette), 16 * sizeof(uint32_t));
this->spu_clut_changed = 0;
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
/* has the SPU channel changed? */
@@ -673,10 +674,10 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
stream_change->physical_letterbox != -1 &&
stream_change->physical_pan_scan != -1) {
#ifdef LOG_DEBUG
- fprintf(MSG_OUT, "libdvdnav: SPU_STREAM_CHANGE returning S_OK\n");
+ fprintf(MSG_OUT, "libdvdnav: SPU_STREAM_CHANGE returning DVDNAV_STATUS_OK\n");
#endif
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
}
@@ -692,10 +693,10 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
stream_change->physical = vm_get_audio_active_stream( this->vm );
this->position_current.audio_channel = this->position_next.audio_channel;
#ifdef LOG_DEBUG
- fprintf(MSG_OUT, "libdvdnav: AUDIO_STREAM_CHANGE stream_id=%d returning S_OK\n",stream_change->physical);
+ fprintf(MSG_OUT, "libdvdnav: AUDIO_STREAM_CHANGE stream_id=%d returning DVDNAV_STATUS_OK\n",stream_change->physical);
#endif
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
/* Check the STILLFRAME flag */
@@ -709,7 +710,7 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
(*len) = sizeof(dvdnav_still_event_t);
still_event->length = this->position_current.still;
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
/* Have we reached the end of a VOBU? */
@@ -741,7 +742,7 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
(*event) = DVDNAV_NOP;
(*len) = 0;
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
/* Perform remapping jump if necessary (this is always a
@@ -759,13 +760,13 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
if(result <= 0) {
printerr("Error reading NAV packet.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
/* 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.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
/* We need to update the vm state->blockN with which VOBU we are in.
* This is so RSM resumes to the VOBU level and not just the CELL level.
@@ -779,6 +780,10 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
*/
dvdnav_pre_cache_blocks(this->cache, this->vobu.vobu_start+1, this->vobu.vobu_length+1);
+ /* release NAV menu filter, when we reach the same NAV packet again */
+ if (this->last_cmd_nav_lbn == this->pci.pci_gi.nv_pck_lbn)
+ this->last_cmd_nav_lbn = 0;
+
/* Successfully got a NAV packet */
(*event) = DVDNAV_NAV_PACKET;
#ifdef LOG_DEBUG
@@ -786,14 +791,14 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
#endif
(*len) = 2048;
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
/* If we've got here, it must just be a normal block. */
if(!this->file) {
printerr("Attempting to read without opening file.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
this->vobu.blockN++;
@@ -801,24 +806,24 @@ dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *this, unsigned char **buf,
if(result <= 0) {
printerr("Error reading from DVD.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
(*event) = DVDNAV_BLOCK_OK;
(*len) = 2048;
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_get_title_string(dvdnav_t *this, const char **title_str) {
if(!this || !title_str) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
(*title_str) = this->vm->dvd_name;
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
uint8_t dvdnav_get_video_aspect(dvdnav_t *this) {
@@ -1036,12 +1041,12 @@ int8_t dvdnav_is_domain_vts(dvdnav_t *this) {
}
/* Generally delegate angle information handling to VM */
-dvdnav_status_t dvdnav_angle_change(dvdnav_t *this, int angle) {
- int num, current;
+dvdnav_status_t dvdnav_angle_change(dvdnav_t *this, int32_t angle) {
+ int32_t num, current;
if(!this) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
pthread_mutex_lock(&this->vm_lock);
@@ -1052,25 +1057,25 @@ dvdnav_status_t dvdnav_angle_change(dvdnav_t *this, int angle) {
} else {
printerr("Passed an invalid angle number.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
-dvdnav_status_t dvdnav_get_angle_info(dvdnav_t *this, int *current_angle,
- int *number_of_angles) {
+dvdnav_status_t dvdnav_get_angle_info(dvdnav_t *this, int32_t *current_angle,
+ int32_t *number_of_angles) {
if(!this || !current_angle || !number_of_angles) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
pthread_mutex_lock(&this->vm_lock);
vm_get_angle_info(this->vm, current_angle, number_of_angles);
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
pci_t* dvdnav_get_current_nav_pci(dvdnav_t *this) {
diff --git a/src/input/libdvdnav/dvdnav.h b/src/input/libdvdnav/dvdnav.h
index 69fa44c5c..0792f673d 100644
--- a/src/input/libdvdnav/dvdnav.h
+++ b/src/input/libdvdnav/dvdnav.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: dvdnav.h,v 1.12 2003/04/29 15:58:30 jcdutton Exp $
+ * $Id: dvdnav.h,v 1.13 2003/05/11 13:44:05 jcdutton Exp $
*
*/
@@ -60,7 +60,7 @@ extern "C" {
typedef struct dvdnav_s dvdnav_t;
/* Status as reported by most of libdvdnav's functions */
-typedef int dvdnav_status_t;
+typedef int32_t dvdnav_status_t;
/*
* Unless otherwise stated, all functions return DVDNAV_STATUS_OK if
@@ -132,7 +132,7 @@ const char* dvdnav_err_to_string(dvdnav_t *self);
*
* This has _nothing_ to do with the region setting of the DVD drive.
*/
-dvdnav_status_t dvdnav_set_region_mask(dvdnav_t *self, int region_mask);
+dvdnav_status_t dvdnav_set_region_mask(dvdnav_t *self, int32_t region_mask);
/*
* Returns the region mask (bit 0 set implies region 1, bit 1 set implies
@@ -140,7 +140,7 @@ dvdnav_status_t dvdnav_set_region_mask(dvdnav_t *self, int region_mask);
*
* This has _nothing_ to do with the region setting of the DVD drive.
*/
-dvdnav_status_t dvdnav_get_region_mask(dvdnav_t *self, int *region_mask);
+dvdnav_status_t dvdnav_get_region_mask(dvdnav_t *self, int32_t *region_mask);
/*
* Specify whether read-ahead caching should be used. You may not want this if your
@@ -155,12 +155,12 @@ dvdnav_status_t dvdnav_get_region_mask(dvdnav_t *self, int *region_mask);
* If in addition you want to prevent memcpy's to improve performance, have a look
* at dvdnav_get_next_cache_block().
*/
-dvdnav_status_t dvdnav_set_readahead_flag(dvdnav_t *self, int read_ahead_flag);
+dvdnav_status_t dvdnav_set_readahead_flag(dvdnav_t *self, int32_t read_ahead_flag);
/*
* Query whether read-ahead caching/buffering will be used.
*/
-dvdnav_status_t dvdnav_get_readahead_flag(dvdnav_t *self, int *read_ahead_flag);
+dvdnav_status_t dvdnav_get_readahead_flag(dvdnav_t *self, int32_t *read_ahead_flag);
/*
* Specify whether the positioning works PGC or PG based.
@@ -169,12 +169,12 @@ dvdnav_status_t dvdnav_get_readahead_flag(dvdnav_t *self, int *read_ahead_flag);
* functions dvdnav_get_position() and dvdnav_sector_search(). See there.
* Default is PG based positioning.
*/
-dvdnav_status_t dvdnav_set_PGC_positioning_flag(dvdnav_t *self, int pgc_based_flag);
+dvdnav_status_t dvdnav_set_PGC_positioning_flag(dvdnav_t *self, int32_t pgc_based_flag);
/*
* Query whether positioning is PG or PGC based.
*/
-dvdnav_status_t dvdnav_get_PGC_positioning_flag(dvdnav_t *self, int *pgc_based_flag);
+dvdnav_status_t dvdnav_get_PGC_positioning_flag(dvdnav_t *self, int32_t *pgc_based_flag);
/*********************************************************************
@@ -200,8 +200,8 @@ dvdnav_status_t dvdnav_get_PGC_positioning_flag(dvdnav_t *self, int *pgc_based_f
*
* See the dvdnav_events.h header for information on the various events.
*/
-dvdnav_status_t dvdnav_get_next_block(dvdnav_t *self, unsigned char *buf,
- int *event, int *len);
+dvdnav_status_t dvdnav_get_next_block(dvdnav_t *self, uint8_t *buf,
+ int32_t *event, int32_t *len);
/*
* This basically does the same as dvdnav_get_next_block. The only difference is
@@ -211,8 +211,8 @@ dvdnav_status_t dvdnav_get_next_block(dvdnav_t *self, unsigned char *buf,
* Those pointers must _never_ be freed but instead returned to the library via
* dvdnav_free_cache_block().
*/
-dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *self, unsigned char **buf,
- int *event, int *len);
+dvdnav_status_t dvdnav_get_next_cache_block(dvdnav_t *self, uint8_t **buf,
+ int32_t *event, int32_t *len);
/*
* All buffers which came from the internal cache (when dvdnav_get_next_cache_block()
@@ -263,22 +263,22 @@ dvdnav_status_t dvdnav_stop(dvdnav_t *self);
/*
* Returns the number of titles on the disk.
*/
-dvdnav_status_t dvdnav_get_number_of_titles(dvdnav_t *self, int *titles);
+dvdnav_status_t dvdnav_get_number_of_titles(dvdnav_t *self, int32_t *titles);
/*
* Returns the number of parts within the given title.
*/
-dvdnav_status_t dvdnav_get_number_of_parts(dvdnav_t *self, int title, int *parts);
+dvdnav_status_t dvdnav_get_number_of_parts(dvdnav_t *self, int32_t title, int32_t *parts);
/*
* Plays the specified title of the DVD from its beginning (that is: part 1).
*/
-dvdnav_status_t dvdnav_title_play(dvdnav_t *self, int title);
+dvdnav_status_t dvdnav_title_play(dvdnav_t *self, int32_t title);
/*
* Plays the specified title, starting from the specified part.
*/
-dvdnav_status_t dvdnav_part_play(dvdnav_t *self, int title, int part);
+dvdnav_status_t dvdnav_part_play(dvdnav_t *self, int32_t title, int32_t part);
/*
* Play the specified amount of parts of the specified title of
@@ -286,16 +286,16 @@ dvdnav_status_t dvdnav_part_play(dvdnav_t *self, int title, int part);
*
* Currently unimplemented!
*/
-dvdnav_status_t dvdnav_part_play_auto_stop(dvdnav_t *self, int title,
- int part, int parts_to_play);
+dvdnav_status_t dvdnav_part_play_auto_stop(dvdnav_t *self, int32_t title,
+ int32_t part, int32_t parts_to_play);
/*
* Play the specified title starting from the specified time.
*
* Currently unimplemented!
*/
-dvdnav_status_t dvdnav_time_play(dvdnav_t *self, int title,
- unsigned long int time);
+dvdnav_status_t dvdnav_time_play(dvdnav_t *self, int32_t title,
+ uint64_t time);
/*
* Stop playing the current position and jump to the specified menu.
@@ -309,8 +309,8 @@ dvdnav_status_t dvdnav_menu_call(dvdnav_t *self, DVDMenuID_t menu);
* A title of 0 indicates, we are in a menu. In this case, part
* is set to the current menu's ID.
*/
-dvdnav_status_t dvdnav_current_title_info(dvdnav_t *self, int *title,
- int *part);
+dvdnav_status_t dvdnav_current_title_info(dvdnav_t *self, int32_t *title,
+ int32_t *part);
/*
* Return the current position (in blocks) within the current
@@ -320,8 +320,8 @@ dvdnav_status_t dvdnav_current_title_info(dvdnav_t *self, int *title,
* Use is discouraged!
*/
dvdnav_status_t dvdnav_get_position_in_title(dvdnav_t *self,
- unsigned int *pos,
- unsigned int *len);
+ uint32_t *pos,
+ uint32_t *len);
/*
* This function is only available for compatibility reasons.
@@ -329,7 +329,7 @@ dvdnav_status_t dvdnav_get_position_in_title(dvdnav_t *self,
* Stop playing the current position and start playback of the current title
* from the specified part.
*/
-dvdnav_status_t dvdnav_part_search(dvdnav_t *self, int part);
+dvdnav_status_t dvdnav_part_search(dvdnav_t *self, int32_t part);
/*********************************************************************
@@ -351,7 +351,7 @@ dvdnav_status_t dvdnav_part_search(dvdnav_t *self, int part);
* fcntl.h.
*/
dvdnav_status_t dvdnav_sector_search(dvdnav_t *self,
- unsigned long int offset, int origin);
+ uint64_t offset, int32_t origin);
/*
* Stop playing the current position and start playback of the title
@@ -360,7 +360,7 @@ dvdnav_status_t dvdnav_sector_search(dvdnav_t *self,
* Currently unimplemented!
*/
dvdnav_status_t dvdnav_time_search(dvdnav_t *self,
- unsigned long int time);
+ uint64_t time);
/*
* Stop playing current position and play the "GoUp"-program chain.
@@ -394,8 +394,8 @@ dvdnav_status_t dvdnav_next_pg_search(dvdnav_t *self);
* (see dvdnav_set_PGC_positioning_flag()), this will return the
* relative position in and the length of the current program chain.
*/
-dvdnav_status_t dvdnav_get_position(dvdnav_t *self, unsigned int *pos,
- unsigned int *len);
+dvdnav_status_t dvdnav_get_position(dvdnav_t *self, uint32_t *pos,
+ uint32_t *len);
/*********************************************************************
@@ -416,7 +416,7 @@ dvdnav_status_t dvdnav_get_position(dvdnav_t *self, unsigned int *pos,
* Get the currently highlighted button
* number (1..36) or 0 if no button is highlighted.
*/
-dvdnav_status_t dvdnav_get_current_highlight(dvdnav_t *self, int *button);
+dvdnav_status_t dvdnav_get_current_highlight(dvdnav_t *self, int32_t *button);
/*
* Returns the Presentation Control Information (PCI) structure associated
@@ -458,12 +458,12 @@ dvdnav_status_t dvdnav_button_activate(dvdnav_t *self, pci_t *pci);
/*
* Highlight a specific button.
*/
-dvdnav_status_t dvdnav_button_select(dvdnav_t *self, pci_t *pci, int button);
+dvdnav_status_t dvdnav_button_select(dvdnav_t *self, pci_t *pci, int32_t button);
/*
* Activate ("press") specified button.
*/
-dvdnav_status_t dvdnav_button_select_and_activate(dvdnav_t *self, pci_t *pci, int button);
+dvdnav_status_t dvdnav_button_select_and_activate(dvdnav_t *self, pci_t *pci, int32_t button);
/*
* Activate (press) a button and execute specified command.
@@ -473,12 +473,12 @@ dvdnav_status_t dvdnav_button_activate_cmd(dvdnav_t *self, int32_t button, vm_cm
/*
* Select button at specified video frame coordinates.
*/
-dvdnav_status_t dvdnav_mouse_select(dvdnav_t *self, pci_t *pci, int x, int y);
+dvdnav_status_t dvdnav_mouse_select(dvdnav_t *self, pci_t *pci, int32_t x, int32_t y);
/*
* Activate ("press") button at specified video frame coordinates.
*/
-dvdnav_status_t dvdnav_mouse_activate(dvdnav_t *self, pci_t *pci, int x, int y);
+dvdnav_status_t dvdnav_mouse_activate(dvdnav_t *self, pci_t *pci, int32_t x, int32_t y);
/*********************************************************************
@@ -595,13 +595,13 @@ int8_t dvdnav_get_active_spu_stream(dvdnav_t *self);
* Sets the current angle. If you try to follow a non existant angle
* the call fails.
*/
-dvdnav_status_t dvdnav_angle_change(dvdnav_t *self, int angle);
+dvdnav_status_t dvdnav_angle_change(dvdnav_t *self, int32_t angle);
/*
* Returns the current angle and number of angles present.
*/
-dvdnav_status_t dvdnav_get_angle_info(dvdnav_t *self, int *current_angle,
- int *number_of_angles);
+dvdnav_status_t dvdnav_get_angle_info(dvdnav_t *self, int32_t *current_angle,
+ int32_t *number_of_angles);
/*********************************************************************
* domain queries *
diff --git a/src/input/libdvdnav/dvdnav_internal.h b/src/input/libdvdnav/dvdnav_internal.h
index c71b5aed6..7d84d2de8 100644
--- a/src/input/libdvdnav/dvdnav_internal.h
+++ b/src/input/libdvdnav/dvdnav_internal.h
@@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: dvdnav_internal.h,v 1.10 2003/04/29 15:58:30 jcdutton Exp $
+ * $Id: dvdnav_internal.h,v 1.11 2003/05/11 13:44:05 jcdutton Exp $
*
*/
@@ -140,6 +140,7 @@ struct dvdnav_s {
/* NAV data */
pci_t pci;
dsi_t dsi;
+ uint32_t last_cmd_nav_lbn; /* detects when a command is issued on an already left NAV */
/* Flags */
int skip_still; /* Set when skipping a still */
@@ -174,11 +175,4 @@ struct dvdnav_s {
#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 */
-
#endif /* DVDNAV_INTERNAL_H_INCLUDED */
diff --git a/src/input/libdvdnav/dvdnav_internal.h.in b/src/input/libdvdnav/dvdnav_internal.h.in
index 199d28dc3..9ba3082fa 100644
--- a/src/input/libdvdnav/dvdnav_internal.h.in
+++ b/src/input/libdvdnav/dvdnav_internal.h.in
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: dvdnav_internal.h.in,v 1.1 2003/04/29 15:58:30 jcdutton Exp $
+ * $Id: dvdnav_internal.h.in,v 1.2 2003/05/11 13:44:05 jcdutton Exp $
*
*/
@@ -139,6 +139,7 @@ struct dvdnav_s {
/* NAV data */
pci_t pci;
dsi_t dsi;
+ uint32_t last_cmd_nav_lbn; /* detects when a command is issued on an already left NAV */
/* Flags */
int skip_still; /* Set when skipping a still */
@@ -173,11 +174,4 @@ struct dvdnav_s {
#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 */
-
#endif /* DVDNAV_INTERNAL_H_INCLUDED */
diff --git a/src/input/libdvdnav/highlight.c b/src/input/libdvdnav/highlight.c
index 671fac135..47de16097 100644
--- a/src/input/libdvdnav/highlight.c
+++ b/src/input/libdvdnav/highlight.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: highlight.c,v 1.13 2003/04/29 15:58:30 jcdutton Exp $
+ * $Id: highlight.c,v 1.14 2003/05/11 13:44:05 jcdutton Exp $
*
*/
@@ -65,7 +65,7 @@ static void print_time(dvd_time_t *dtime) {
}
static void nav_print_PCI_GI(pci_gi_t *pci_gi) {
- int i;
+ int32_t i;
fprintf(MSG_OUT,"libdvdnav: pci_gi:\n");
fprintf(MSG_OUT,"libdvdnav: nv_pck_lbn 0x%08x\n", pci_gi->nv_pck_lbn);
@@ -90,7 +90,7 @@ static void nav_print_PCI_GI(pci_gi_t *pci_gi) {
}
static void nav_print_NSML_AGLI(nsml_agli_t *nsml_agli) {
- int i, j = 0;
+ int32_t i, j = 0;
for(i = 0; i < 9; i++)
j |= nsml_agli->nsml_agl_dsta[i];
@@ -104,7 +104,7 @@ static void nav_print_NSML_AGLI(nsml_agli_t *nsml_agli) {
nsml_agli->nsml_agl_dsta[i]);
}
-static void nav_print_HL_GI(hl_gi_t *hl_gi, int *btngr_ns, int *btn_ns) {
+static void nav_print_HL_GI(hl_gi_t *hl_gi, int32_t *btngr_ns, int32_t *btn_ns) {
if((hl_gi->hli_ss & 0x03) == 0)
return;
@@ -130,7 +130,7 @@ static void nav_print_HL_GI(hl_gi_t *hl_gi, int *btngr_ns, int *btn_ns) {
}
static void nav_print_BTN_COLIT(btn_colit_t *btn_colit) {
- int i, j;
+ int32_t i, j;
j = 0;
for(i = 0; i < 6; i++)
@@ -146,8 +146,8 @@ static void nav_print_BTN_COLIT(btn_colit_t *btn_colit) {
btn_colit->btn_coli[i][j]);
}
-static void nav_print_BTNIT(btni_t *btni_table, int btngr_ns, int btn_ns) {
- int i, j, k;
+static void nav_print_BTNIT(btni_t *btni_table, int32_t btngr_ns, int32_t btn_ns) {
+ int32_t i, j, k;
fprintf(MSG_OUT,"libdvdnav: btnit:\n");
fprintf(MSG_OUT,"libdvdnav: btngr_ns: %i\n", btngr_ns);
@@ -185,7 +185,7 @@ static void nav_print_BTNIT(btni_t *btni_table, int btngr_ns, int btn_ns) {
}
static void nav_print_HLI(hli_t *hli) {
- int btngr_ns = 0, btn_ns = 0;
+ int32_t btngr_ns = 0, btn_ns = 0;
fprintf(MSG_OUT,"libdvdnav: hli:\n");
nav_print_HL_GI(&hli->hl_gi, & btngr_ns, & btn_ns);
@@ -205,30 +205,36 @@ void nav_print_PCI(pci_t *pci) {
/* Highlighting API calls */
-dvdnav_status_t dvdnav_get_current_highlight(dvdnav_t *this, int *button) {
+dvdnav_status_t dvdnav_get_current_highlight(dvdnav_t *this, int32_t *button) {
- if(!this) {
+ if(!this || !button) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
/* Simply return the appropriate value based on the SPRM */
(*button) = this->position_current.button;
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
static btni_t *get_current_button(dvdnav_t *this, pci_t *pci) {
- int button = 0;
+ int32_t button = 0;
- if(!this) {
+ if(!this || !pci) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
if(!pci->hli.hl_gi.hli_ss) {
printerr("Not in a menu.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
+#if 0 /* This causes some DVDs to fail to activate buttons. */
+ if(this->last_cmd_nav_lbn == pci->pci_gi.nv_pck_lbn) {
+ printerr("This NAV has already been left.");
+ return DVDNAV_STATUS_ERR;
+ }
+#endif
button = this->vm->state.HL_BTNN_REG >> 10;
#ifdef BUTTON_TESTING
@@ -246,69 +252,49 @@ static dvdnav_status_t button_auto_action(dvdnav_t *this, pci_t *pci) {
dvdnav_status_t dvdnav_upper_button_select(dvdnav_t *this, pci_t *pci) {
btni_t *button_ptr;
- if(!this) {
- printerr("Passed a NULL pointer.");
- return S_ERR;
- }
-
if(!(button_ptr = get_current_button(this, pci)))
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
dvdnav_button_select(this, pci, button_ptr->up);
button_auto_action(this, pci);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_lower_button_select(dvdnav_t *this, pci_t *pci) {
btni_t *button_ptr;
- if(!this) {
- printerr("Passed a NULL pointer.");
- return S_ERR;
- }
-
if(!(button_ptr = get_current_button(this, pci)))
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
dvdnav_button_select(this, pci, button_ptr->down);
button_auto_action(this, pci);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_right_button_select(dvdnav_t *this, pci_t *pci) {
btni_t *button_ptr;
- if(!this) {
- printerr("Passed a NULL pointer.");
- return S_ERR;
- }
-
if(!(button_ptr = get_current_button(this, pci)))
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
dvdnav_button_select(this, pci, button_ptr->right);
button_auto_action(this, pci);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_left_button_select(dvdnav_t *this, pci_t *pci) {
btni_t *button_ptr;
- if(!this) {
- printerr("Passed a NULL pointer.");
- return S_ERR;
- }
-
if(!(button_ptr = get_current_button(this, pci)))
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
dvdnav_button_select(this, pci, button_ptr->left);
button_auto_action(this, pci);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_get_highlight_area(pci_t *nav_pci , int32_t button, int32_t mode,
@@ -320,9 +306,9 @@ dvdnav_status_t dvdnav_get_highlight_area(pci_t *nav_pci , int32_t button, int32
#endif
if(!nav_pci->hli.hl_gi.hli_ss)
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
if((button <= 0) || (button > nav_pci->hli.hl_gi.btn_ns))
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
button_ptr = &nav_pci->hli.btnit[button-1];
@@ -346,22 +332,27 @@ dvdnav_status_t dvdnav_get_highlight_area(pci_t *nav_pci , int32_t button, int32
button);
#endif
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_button_activate(dvdnav_t *this, pci_t *pci) {
- int button;
+ int32_t button;
btni_t *button_ptr = NULL;
- if(!this) {
+ if(!this || !pci) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
if(!pci->hli.hl_gi.hli_ss) {
printerr("Not in a menu.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
-
+#if 0 /* This causes some DVDs to fail to activate buttons. */
+ if(this->last_cmd_nav_lbn == pci->pci_gi.nv_pck_lbn) {
+ printerr("This NAV has already been left.");
+ return DVDNAV_STATUS_ERR;
+ }
+#endif
pthread_mutex_lock(&this->vm_lock);
button = this->vm->state.HL_BTNN_REG >> 10;
@@ -381,13 +372,14 @@ dvdnav_status_t dvdnav_button_activate(dvdnav_t *this, pci_t *pci) {
vm_get_next_cell(this->vm);
this->position_current.still = 0;
this->sync_wait = 0;
+ this->last_cmd_nav_lbn = pci->pci_gi.nv_pck_lbn;
pthread_mutex_unlock(&this->vm_lock);
/* clear error message */
printerr("");
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
button_ptr = get_current_button(this, pci);
@@ -400,17 +392,18 @@ dvdnav_status_t dvdnav_button_activate(dvdnav_t *this, pci_t *pci) {
/* Command caused a jump */
this->vm->hop_channel++;
this->position_current.still = 0;
+ this->last_cmd_nav_lbn = pci->pci_gi.nv_pck_lbn;
}
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_button_activate_cmd(dvdnav_t *this, int32_t button, vm_cmd_t *cmd)
{
- if(!this) {
+ if(!this || !cmd) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
pthread_mutex_lock(&this->vm_lock);
@@ -430,19 +423,25 @@ dvdnav_status_t dvdnav_button_activate_cmd(dvdnav_t *this, int32_t button, vm_cm
this->position_current.still = 0;
this->sync_wait = 0;
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
-dvdnav_status_t dvdnav_button_select(dvdnav_t *this, pci_t *pci, int button) {
+dvdnav_status_t dvdnav_button_select(dvdnav_t *this, pci_t *pci, int32_t button) {
- if(!this) {
+ if(!this || !pci) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
if(!pci->hli.hl_gi.hli_ss) {
printerr("Not in a menu.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
+#if 0 /* This causes some DVDs to fail to activate buttons. */
+ if(this->last_cmd_nav_lbn == pci->pci_gi.nv_pck_lbn) {
+ printerr("This NAV has already been left.");
+ return DVDNAV_STATUS_ERR;
+ }
+#endif
#ifdef BUTTON_TESTING
fprintf(MSG_OUT, "libdvdnav: Button select %i\n", button);
@@ -450,36 +449,42 @@ dvdnav_status_t dvdnav_button_select(dvdnav_t *this, pci_t *pci, int button) {
if((button <= 0) || (button > pci->hli.hl_gi.btn_ns)) {
printerr("Button does not exist.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
this->vm->state.HL_BTNN_REG = (button << 10);
this->position_current.button = -1; /* Force Highligh change */
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_button_select_and_activate(dvdnav_t *this, pci_t *pci,
- int button) {
+ int32_t button) {
/* A trivial function */
- if(dvdnav_button_select(this, pci, button) != S_ERR)
+ if(dvdnav_button_select(this, pci, button) != DVDNAV_STATUS_ERR)
return dvdnav_button_activate(this, pci);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
-dvdnav_status_t dvdnav_mouse_select(dvdnav_t *this, pci_t *pci, int x, int y) {
- int button, cur_button;
- int best,dist,d;
- int mx,my,dx,dy;
+dvdnav_status_t dvdnav_mouse_select(dvdnav_t *this, pci_t *pci, int32_t x, int32_t y) {
+ int32_t button, cur_button;
+ int32_t best,dist,d;
+ int32_t mx,my,dx,dy;
- if(!this) {
+ if(!this || !pci) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
if(!pci->hli.hl_gi.hli_ss) {
printerr("Not in a menu.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
+ }
+#if 0 /* This causes some DVDs to fail to activate buttons. */
+ if(this->last_cmd_nav_lbn == pci->pci_gi.nv_pck_lbn) {
+ printerr("This NAV has already been left.");
+ return DVDNAV_STATUS_ERR;
}
+#endif
cur_button = this->vm->state.HL_BTNN_REG >> 10;
@@ -505,19 +510,18 @@ dvdnav_status_t dvdnav_mouse_select(dvdnav_t *this, pci_t *pci, int x, int y) {
}
}
}
-
/* As an efficiency measure, only re-select the button
* if it is different to the previously selected one. */
if (best != 0 && best != cur_button)
dvdnav_button_select(this, pci, best);
- /* return S_OK only if we actually found a matching button */
- return best ? S_OK : S_ERR;
+ /* return DVDNAV_STATUS_OK only if we actually found a matching button */
+ return best ? DVDNAV_STATUS_OK : DVDNAV_STATUS_ERR;
}
-dvdnav_status_t dvdnav_mouse_activate(dvdnav_t *this, pci_t *pci, int x, int y) {
+dvdnav_status_t dvdnav_mouse_activate(dvdnav_t *this, pci_t *pci, int32_t x, int32_t y) {
/* A trivial function */
- if(dvdnav_mouse_select(this, pci, x,y) != S_ERR)
+ if(dvdnav_mouse_select(this, pci, x,y) != DVDNAV_STATUS_ERR)
return dvdnav_button_activate(this, pci);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
diff --git a/src/input/libdvdnav/navigation.c b/src/input/libdvdnav/navigation.c
index 07d4a2759..ee79f1d45 100644
--- a/src/input/libdvdnav/navigation.c
+++ b/src/input/libdvdnav/navigation.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: navigation.c,v 1.8 2003/04/07 18:10:50 mroi Exp $
+ * $Id: navigation.c,v 1.9 2003/05/11 13:44:05 jcdutton Exp $
*
*/
@@ -32,7 +32,7 @@
dvdnav_status_t dvdnav_still_skip(dvdnav_t *this) {
if(!this) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
this->position_current.still = 0;
@@ -40,25 +40,25 @@ dvdnav_status_t dvdnav_still_skip(dvdnav_t *this) {
this->sync_wait = 0;
this->sync_wait_skip = 1;
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_wait_skip(dvdnav_t *this) {
if(!this) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
this->sync_wait = 0;
this->sync_wait_skip = 1;
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
-dvdnav_status_t dvdnav_get_number_of_titles(dvdnav_t *this, int *titles) {
+dvdnav_status_t dvdnav_get_number_of_titles(dvdnav_t *this, int32_t *titles) {
if(!this || !titles) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
if(!this->started) {
@@ -69,46 +69,46 @@ dvdnav_status_t dvdnav_get_number_of_titles(dvdnav_t *this, int *titles) {
(*titles) = vm_get_vmgi(this->vm)->tt_srpt->nr_of_srpts;
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
-dvdnav_status_t dvdnav_get_number_of_parts(dvdnav_t *this, int title, int *parts) {
+dvdnav_status_t dvdnav_get_number_of_parts(dvdnav_t *this, int32_t title, int32_t *parts) {
if(!this || !parts) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
if(!this->started) {
printerr("Virtual DVD machine not started.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
if ((title < 1) || (title > vm_get_vmgi(this->vm)->tt_srpt->nr_of_srpts) ) {
printerr("Passed a title number out of range.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
(*parts) = vm_get_vmgi(this->vm)->tt_srpt->title[title-1].nr_of_ptts;
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
-dvdnav_status_t dvdnav_current_title_info(dvdnav_t *this, int *title, int *part) {
- int retval;
+dvdnav_status_t dvdnav_current_title_info(dvdnav_t *this, int32_t *title, int32_t *part) {
+ int32_t retval;
if(!this || !title || !part) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
pthread_mutex_lock(&this->vm_lock);
if (!this->vm->vtsi || !this->vm->vmgi) {
printerr("Bad VM state.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
if (!this->vm->state.pgc) {
printerr("No current PGC.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
if ( (this->vm->state.domain == VTSM_DOMAIN)
|| (this->vm->state.domain == VMGM_DOMAIN) ) {
@@ -117,55 +117,55 @@ dvdnav_status_t dvdnav_current_title_info(dvdnav_t *this, int *title, int *part)
if (*part > -1) {
*title = 0;
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
}
if (this->vm->state.domain == VTS_DOMAIN) {
retval = vm_get_current_title_part(this->vm, title, part);
pthread_mutex_unlock(&this->vm_lock);
- return retval ? S_OK : S_ERR;
+ return retval ? DVDNAV_STATUS_OK : DVDNAV_STATUS_ERR;
}
printerr("Not in a title or menu.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
-dvdnav_status_t dvdnav_title_play(dvdnav_t *this, int title) {
+dvdnav_status_t dvdnav_title_play(dvdnav_t *this, int32_t title) {
if(!this) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
return dvdnav_part_play(this, title, 1);
}
-dvdnav_status_t dvdnav_part_play(dvdnav_t *this, int title, int part) {
- int retval;
+dvdnav_status_t dvdnav_part_play(dvdnav_t *this, int32_t title, int32_t part) {
+ int32_t retval;
if(!this) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
pthread_mutex_lock(&this->vm_lock);
if (!this->vm->vmgi) {
printerr("Bad VM state.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
if (!this->vm->state.pgc) {
printerr("No current PGC.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
if((title < 1) || (title > this->vm->vmgi->tt_srpt->nr_of_srpts)) {
printerr("Title out of range.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
if((part < 1) || (part > this->vm->vmgi->tt_srpt->title[title-1].nr_of_ptts)) {
printerr("Part out of range.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
retval = vm_jump_title_part(this->vm, title, part);
@@ -173,45 +173,45 @@ dvdnav_status_t dvdnav_part_play(dvdnav_t *this, int title, int part) {
this->vm->hop_channel++;
pthread_mutex_unlock(&this->vm_lock);
- return retval ? S_OK : S_ERR;
+ return retval ? DVDNAV_STATUS_OK : DVDNAV_STATUS_ERR;
}
-dvdnav_status_t dvdnav_part_play_auto_stop(dvdnav_t *this, int title,
- int part, int parts_to_play) {
+dvdnav_status_t dvdnav_part_play_auto_stop(dvdnav_t *this, int32_t title,
+ int32_t part, int32_t parts_to_play) {
/* FIXME: Implement auto-stop */
- if (dvdnav_part_play(this, title, part) == S_OK)
+ if (dvdnav_part_play(this, title, part) == DVDNAV_STATUS_OK)
printerr("Not implemented yet.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
-dvdnav_status_t dvdnav_time_play(dvdnav_t *this, int title,
- unsigned long int time) {
+dvdnav_status_t dvdnav_time_play(dvdnav_t *this, int32_t title,
+ uint64_t time) {
if(!this) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
/* FIXME: Implement */
printerr("Not implemented yet.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
dvdnav_status_t dvdnav_stop(dvdnav_t *this) {
if(!this) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
pthread_mutex_lock(&this->vm_lock);
this->vm->stopped = 1;
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_go_up(dvdnav_t *this) {
if(!this) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
/* A nice easy function... delegate to the VM */
@@ -219,5 +219,5 @@ dvdnav_status_t dvdnav_go_up(dvdnav_t *this) {
vm_jump_up(this->vm);
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
diff --git a/src/input/libdvdnav/searching.c b/src/input/libdvdnav/searching.c
index 6893d9525..4ccf239d9 100644
--- a/src/input/libdvdnav/searching.c
+++ b/src/input/libdvdnav/searching.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: searching.c,v 1.16 2003/04/29 21:55:53 jcdutton Exp $
+ * $Id: searching.c,v 1.17 2003/05/11 13:44:05 jcdutton Exp $
*
*/
@@ -35,16 +35,16 @@
/* Searching API calls */
dvdnav_status_t dvdnav_time_search(dvdnav_t *this,
- unsigned long int time) {
+ uint64_t time) {
/* FIXME: Time search the current PGC based on the xxx table */
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
/* Scan the ADMAP for a particular block number. */
/* Return placed in vobu. */
/* Returns error status */
/* FIXME: Maybe need to handle seeking outside current cell. */
-static dvdnav_status_t dvdnav_scan_admap(dvdnav_t *this, int domain, uint32_t seekto_block, uint32_t *vobu) {
+static dvdnav_status_t dvdnav_scan_admap(dvdnav_t *this, int32_t domain, uint32_t seekto_block, uint32_t *vobu) {
vobu_admap_t *admap = NULL;
#ifdef LOG_DEBUG
@@ -71,7 +71,7 @@ static dvdnav_status_t dvdnav_scan_admap(dvdnav_t *this, int domain, uint32_t se
if(admap) {
uint32_t address = 0;
uint32_t vobu_start, next_vobu;
- int found = 0;
+ int32_t found = 0;
/* Search through ADMAP for best sector */
vobu_start = SRI_END_OF_CELL;
@@ -91,34 +91,34 @@ static dvdnav_status_t dvdnav_scan_admap(dvdnav_t *this, int domain, uint32_t se
}
if(found) {
*vobu = vobu_start;
- return S_OK;
+ return DVDNAV_STATUS_OK;
} else {
fprintf(MSG_OUT, "libdvdnav: Could not locate block\n");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
}
fprintf(MSG_OUT, "libdvdnav: admap not located\n");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
dvdnav_status_t dvdnav_sector_search(dvdnav_t *this,
- unsigned long int offset, int origin) {
+ uint64_t offset, int32_t origin) {
uint32_t target = 0;
uint32_t length = 0;
uint32_t first_cell_nr, last_cell_nr, cell_nr;
- int found;
+ int32_t found;
cell_playback_t *cell;
dvd_state_t *state;
dvdnav_status_t result;
if(this->position_current.still != 0) {
printerr("Cannot seek in a still frame.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
result = dvdnav_get_position(this, &target, &length);
if(!result) {
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
pthread_mutex_lock(&this->vm_lock);
@@ -126,7 +126,7 @@ dvdnav_status_t dvdnav_sector_search(dvdnav_t *this,
if(!state->pgc) {
printerr("No current PGC.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
#ifdef LOG_DEBUG
fprintf(MSG_OUT, "libdvdnav: seeking to offset=%lu pos=%u length=%u\n", offset, target, length);
@@ -138,7 +138,7 @@ dvdnav_status_t dvdnav_sector_search(dvdnav_t *this,
if(offset > length) {
printerr("Request to seek behind end.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
target = offset;
break;
@@ -146,7 +146,7 @@ dvdnav_status_t dvdnav_sector_search(dvdnav_t *this,
if(target + offset > length) {
printerr("Request to seek behind end.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
target += offset;
break;
@@ -154,7 +154,7 @@ dvdnav_status_t dvdnav_sector_search(dvdnav_t *this,
if(length - offset < 0) {
printerr("Request to seek before start.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
target = length - offset;
break;
@@ -162,7 +162,7 @@ dvdnav_status_t dvdnav_sector_search(dvdnav_t *this,
/* Error occured */
printerr("Illegal seek mode.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
if (this->pgc_based) {
@@ -198,7 +198,7 @@ dvdnav_status_t dvdnav_sector_search(dvdnav_t *this,
fprintf(MSG_OUT, "libdvdnav: Seeking to cell %i from choice of %i to %i\n",
cell_nr, first_cell_nr, last_cell_nr);
#endif
- if (dvdnav_scan_admap(this, state->domain, target, &vobu) == S_OK) {
+ if (dvdnav_scan_admap(this, state->domain, target, &vobu) == DVDNAV_STATUS_OK) {
int32_t start = state->pgc->cell_playback[cell_nr-1].first_sector;
if (vm_jump_cell_block(this->vm, cell_nr, vobu - start)) {
@@ -208,7 +208,7 @@ dvdnav_status_t dvdnav_sector_search(dvdnav_t *this,
#endif
this->vm->hop_channel += HOP_SEEK;
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
}
}
@@ -217,29 +217,29 @@ dvdnav_status_t dvdnav_sector_search(dvdnav_t *this,
fprintf(MSG_OUT, "libdvdnav: FIXME: Implement seeking to location %u\n", target);
printerr("Error when seeking.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
-dvdnav_status_t dvdnav_part_search(dvdnav_t *this, int part) {
- int title, old_part;
+dvdnav_status_t dvdnav_part_search(dvdnav_t *this, int32_t part) {
+ int32_t title, old_part;
- if (dvdnav_current_title_info(this, &title, &old_part) == S_OK)
+ if (dvdnav_current_title_info(this, &title, &old_part) == DVDNAV_STATUS_OK)
return dvdnav_part_play(this, title, part);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
dvdnav_status_t dvdnav_prev_pg_search(dvdnav_t *this) {
if(!this) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
pthread_mutex_lock(&this->vm_lock);
if(!this->vm->state.pgc) {
printerr("No current PGC.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
#ifdef LOG_DEBUG
@@ -249,7 +249,7 @@ dvdnav_status_t dvdnav_prev_pg_search(dvdnav_t *this) {
fprintf(MSG_OUT, "libdvdnav: previous chapter failed.\n");
printerr("Skip to previous chapter failed.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
this->position_current.still = 0;
this->vm->hop_channel++;
@@ -258,21 +258,21 @@ dvdnav_status_t dvdnav_prev_pg_search(dvdnav_t *this) {
#endif
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_top_pg_search(dvdnav_t *this) {
if(!this) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
pthread_mutex_lock(&this->vm_lock);
if(!this->vm->state.pgc) {
printerr("No current PGC.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
#ifdef LOG_DEBUG
@@ -282,7 +282,7 @@ dvdnav_status_t dvdnav_top_pg_search(dvdnav_t *this) {
fprintf(MSG_OUT, "libdvdnav: top chapter failed.\n");
printerr("Skip to top chapter failed.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
this->position_current.still = 0;
this->vm->hop_channel++;
@@ -291,7 +291,7 @@ dvdnav_status_t dvdnav_top_pg_search(dvdnav_t *this) {
#endif
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_next_pg_search(dvdnav_t *this) {
@@ -299,14 +299,14 @@ dvdnav_status_t dvdnav_next_pg_search(dvdnav_t *this) {
if(!this) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
pthread_mutex_lock(&this->vm_lock);
if(!this->vm->state.pgc) {
printerr("No current PGC.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
#ifdef LOG_DEBUG
@@ -324,7 +324,7 @@ dvdnav_status_t dvdnav_next_pg_search(dvdnav_t *this) {
fprintf(MSG_OUT, "libdvdnav: next chapter failed.\n");
printerr("Skip to next chapter failed.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
}
/* merge changes on success */
@@ -337,7 +337,7 @@ dvdnav_status_t dvdnav_next_pg_search(dvdnav_t *this) {
#endif
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_menu_call(dvdnav_t *this, DVDMenuID_t menu) {
@@ -345,14 +345,14 @@ dvdnav_status_t dvdnav_menu_call(dvdnav_t *this, DVDMenuID_t menu) {
if(!this) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
pthread_mutex_lock(&this->vm_lock);
if(!this->vm->state.pgc) {
printerr("No current PGC.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
/* make a copy of current VM and try to navigate the copy to the menu */
@@ -366,7 +366,7 @@ dvdnav_status_t dvdnav_menu_call(dvdnav_t *this, DVDMenuID_t menu) {
this->position_current.still = 0;
this->vm->hop_channel++;
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
}
if (menu == DVD_MENU_Escape) menu = DVD_MENU_Root;
@@ -378,29 +378,29 @@ dvdnav_status_t dvdnav_menu_call(dvdnav_t *this, DVDMenuID_t menu) {
this->position_current.still = 0;
this->vm->hop_channel++;
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
} else {
vm_free_copy(try_vm);
printerr("No such menu or menu not reachable.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
}
-dvdnav_status_t dvdnav_get_position(dvdnav_t *this, unsigned int *pos,
- unsigned int *len) {
+dvdnav_status_t dvdnav_get_position(dvdnav_t *this, uint32_t *pos,
+ uint32_t *len) {
uint32_t cur_sector;
- int cell_nr, first_cell_nr, last_cell_nr;
+ int32_t cell_nr, first_cell_nr, last_cell_nr;
cell_playback_t *cell;
dvd_state_t *state;
if(!this || !pos || !len) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
if(!this->started) {
printerr("Virtual DVD machine not started.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
pthread_mutex_lock(&this->vm_lock);
@@ -408,7 +408,7 @@ dvdnav_status_t dvdnav_get_position(dvdnav_t *this, unsigned int *pos,
if(!state->pgc) {
printerr("No current PGC.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
if (this->position_current.hop_channel != this->vm->hop_channel ||
this->position_current.domain != state->domain ||
@@ -416,7 +416,7 @@ dvdnav_status_t dvdnav_get_position(dvdnav_t *this, unsigned int *pos,
this->position_current.cell_restart != state->cell_restart) {
printerr("New position not yet determined.");
pthread_mutex_unlock(&this->vm_lock);
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
/* Get current sector */
@@ -451,12 +451,12 @@ dvdnav_status_t dvdnav_get_position(dvdnav_t *this, unsigned int *pos,
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_get_position_in_title(dvdnav_t *this,
- unsigned int *pos,
- unsigned int *len) {
+ uint32_t *pos,
+ uint32_t *len) {
uint32_t cur_sector;
uint32_t first_cell_nr;
uint32_t last_cell_nr;
@@ -466,13 +466,13 @@ dvdnav_status_t dvdnav_get_position_in_title(dvdnav_t *this,
if(!this || !pos || !len) {
printerr("Passed a NULL pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
state = &(this->vm->state);
if(!state->pgc) {
printerr("No current PGC.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
/* Get current sector */
@@ -487,5 +487,5 @@ dvdnav_status_t dvdnav_get_position_in_title(dvdnav_t *this,
*pos = cur_sector - first_cell->first_sector;
*len = last_cell->last_sector - first_cell->first_sector;
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
diff --git a/src/input/libdvdnav/settings.c b/src/input/libdvdnav/settings.c
index d760695bb..d8901821e 100644
--- a/src/input/libdvdnav/settings.c
+++ b/src/input/libdvdnav/settings.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: settings.c,v 1.5 2003/03/29 13:19:09 mroi Exp $
+ * $Id: settings.c,v 1.6 2003/05/11 13:44:05 jcdutton Exp $
*
*/
@@ -32,60 +32,60 @@
dvdnav_status_t dvdnav_get_region_mask(dvdnav_t *this, int *region) {
if(!this || !region) {
printerr("Passed a NULL this pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
(*region) = this->vm->state.registers.SPRM[20];
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_set_region_mask(dvdnav_t *this, int mask) {
if(!this) {
printerr("Passed a NULL this pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
pthread_mutex_lock(&this->vm_lock);
this->vm->state.registers.SPRM[20] = (mask & 0xff);
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_set_readahead_flag(dvdnav_t *this, int use_readahead) {
if(!this) {
printerr("Passed a NULL this pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
this->use_read_ahead = use_readahead;
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_get_readahead_flag(dvdnav_t *this, int *flag) {
if(!this || !flag) {
printerr("Passed a NULL this pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
(*flag) = this->use_read_ahead;
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
static dvdnav_status_t set_language_register(dvdnav_t *this, char *code, int reg) {
if(!this || !code) {
printerr("Passed a NULL this pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
if(!code[0] || !code[1]) {
printerr("Passed illegal language code.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
pthread_mutex_lock(&this->vm_lock);
this->vm->state.registers.SPRM[reg] = (code[0] << 8) | code[1];
pthread_mutex_unlock(&this->vm_lock);
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_menu_language_select(dvdnav_t *this, char *code) {
@@ -103,19 +103,19 @@ dvdnav_status_t dvdnav_spu_language_select(dvdnav_t *this, char *code) {
dvdnav_status_t dvdnav_set_PGC_positioning_flag(dvdnav_t *this, int pgc) {
if(!this) {
printerr("Passed a NULL this pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
this->pgc_based = pgc;
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
dvdnav_status_t dvdnav_get_PGC_positioning_flag(dvdnav_t *this, int *flag) {
if(!this || !flag) {
printerr("Passed a NULL this pointer.");
- return S_ERR;
+ return DVDNAV_STATUS_ERR;
}
(*flag) = this->pgc_based;
- return S_OK;
+ return DVDNAV_STATUS_OK;
}
diff --git a/src/input/libdvdnav/vmcmd.h b/src/input/libdvdnav/vmcmd.h
index 5a17339c9..13e1261be 100644
--- a/src/input/libdvdnav/vmcmd.h
+++ b/src/input/libdvdnav/vmcmd.h
@@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: vmcmd.h,v 1.6 2003/04/07 18:10:53 mroi Exp $
+ * $Id: vmcmd.h,v 1.7 2003/05/11 13:44:05 jcdutton Exp $
*
*/
@@ -26,12 +26,8 @@
#define VMCMD_H_INCLUDED
#include <inttypes.h>
-#include "ifo_types.h" /* Only for vm_cmd_t */
-#include "dvdnav_internal.h"
-#ifdef TRACE
void vm_print_mnemonic(vm_cmd_t *command);
void vm_print_cmd(int row, vm_cmd_t *command);
-#endif
#endif /* VMCMD_H_INCLUDED */