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 @@ -1,56 +1,95 @@ -/* config.h. Generated by hand. */ +#pragma once -#ifndef LIBDVDREAD_CONFIG_H -#define LIBDVDREAD_CONFIG_H +/* + * Copyright (C) 2005-2013 Team XBMC + * http://xbmc.org + * + * This Program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This Program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with XBMC; see the file COPYING. If not, see + * . + * + */ -#define HAVE_DLFCN_H 1 +/* config.h. Generated by hand. */ +#if defined(_LINUX) +#include "PlatformInclude.h" +#else +#include +#endif +#include + +//#define HAVE_DLFCN_H 1 +#define HAVE_DVDCSS_DVDCSS_H 1 /* #undef HAVE_DVDCSS_DVDCSS_H*/ /* #undef HAVE_INTTYPES_H */ #define HAVE_MEMORY_H 1 -/* #undef HAVE_STDINT_H */ +#define HAVE_STDINT_H 1 #define HAVE_STDLIB_H 1 #define HAVE_STRINGS_H 1 #define HAVE_STRING_H 1 #define HAVE_SYS_STAT_H 1 #define HAVE_SYS_TYPES_H 1 /* #undef HAVE_UNISTD_H */ +#ifndef PACKAGE #define PACKAGE "libdvdread" +#endif +#ifndef PACKAGE_BUGREPORT #define PACKAGE_BUGREPORT "" +#endif +#ifndef PACKAGE_NAME #define PACKAGE_NAME "" +#endif +#ifndef PACKAGE_STRING #define PACKAGE_STRING "" +#endif +#ifndef PACKAGE_TARNAME #define PACKAGE_TARNAME "" +#endif +#ifndef PACKAGE_VERSION #define PACKAGE_VERSION "" +#endif #define STDC_HEADERS 1 +#ifndef VERSION #define VERSION "1.2.6" +#endif /* #undef WORDS_BIGENDIAN */ /* #undef __DARWIN__ */ /* #undef const */ #define inline __inline /* #undef size_t */ -#define ssize_t __int64 +#define ssize_t int #ifndef PATH_MAX #define PATH_MAX MAX_PATH #endif +#ifndef strcasecmp #define strcasecmp stricmp +#endif +#ifndef strncasecmp #define strncasecmp strnicmp +#endif +#ifndef S_ISDIR #define S_ISDIR(m) ((m) & _S_IFDIR) +#endif +#ifndef S_ISREG #define S_ISREG(m) ((m) & _S_IFREG) +#endif +#ifndef S_ISBLK #define S_ISBLK(m) 0 +#endif +#ifndef S_ISCHR #define S_ISCHR(m) 0 - -/* Fallback types (very x86-centric, sorry) */ -typedef unsigned char uint8_t; -typedef signed char int8_t; -typedef unsigned short uint16_t; -typedef signed short int16_t; -typedef unsigned int uint32_t; -typedef signed int int32_t; -typedef unsigned __int64 uint64_t; -typedef signed __int64 int64_t; -typedef unsigned int uintptr_t; - -#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 @@ #ifndef LIBDVDNAV_DECODER_H #define LIBDVDNAV_DECODER_H +//#include +//#include + +#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 @@ -24,14 +24,14 @@ #define LIBDVDREAD_DVD_READER_H #ifdef _MSC_VER -#include +#include "config.h" #include #include #endif #include -#include +//#include /** * 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 + /* * DVD Menu ID * (see dvdnav_menu_call()) @@ -60,7 +62,8 @@ /* the following types are currently unused */ -#if 0 +//XBMC Needs some of these +#if 1 /* Domain */ typedef enum { @@ -222,6 +225,10 @@ DVD_DISPLAY_MODE_4x3Letterboxed = 3 } DVDDisplayMode_t; +typedef int DVDAudioSampleFreq_t; +typedef int DVDAudioSampleQuant_t; +typedef int DVDChannelNumber_t; + /* Audio attributes */ typedef struct { DVDAudioAppMode_t AppMode; @@ -233,9 +240,6 @@ DVDAudioSampleQuant_t SampleQuantization; DVDChannelNumber_t NumberOfChannels; } DVDAudioAttributes_t; -typedef int DVDAudioSampleFreq_t; -typedef int DVDAudioSampleQuant_t; -typedef int DVDChannelNumber_t; /* Subpicture attributes */ typedef enum { @@ -255,6 +259,8 @@ DVDSubpictureLangExt_t LanguageExtension; } DVDSubpictureAttributes_t; +typedef int DVDVideoCompression_t; + /* Video attributes */ typedef struct { DVDBool_t PanscanPermitted; @@ -268,7 +274,6 @@ DVDBool_t Line21Field2InGop; int more_to_come; } DVDVideoAttributes_t; -typedef int DVDVideoCompression_t; #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 @@ extern "C" { #endif -# include -# include -# include -# include /* For vm_cmd_t */ -# include +# 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 @@ */ 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 @@ -25,6 +25,10 @@ #ifndef LIBDVDNAV_DVDNAV_EVENTS_H #define LIBDVDNAV_DVDNAV_EVENTS_H +#include "ifo_types.h" +#include "dvd_reader.h" +#include "nav_types.h" + /* * 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 + * Copyright (C) 2001-2004 Rich Wareham * * 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 #include "config.h" @@ -28,16 +27,47 @@ #include #include -#include +//#include #include #include -#include -#undef WORDS_BIGENDIAN +#ifdef WIN32 + +/* pthread_mutex_* wrapper for win32 */ +#ifndef _LINUX +#include +#include +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 +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 /* read() */ +#define lseek64 _lseeki64 +#endif // !_LINUX -#include "dvd_reader.h" -#include "ifo_read.h" -#include "ifo_types.h" +#else + +#include + +#endif /* WIN32 */ /* Uncomment for VM command tracing */ /* #define TRACE */ @@ -48,7 +78,7 @@ #include "vmcmd.h" /* 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 **/ + +/* converts a dvd_time_t to PTS ticks */ +int64_t dvdnav_convert_time(dvd_time_t *time); + +/* XBMC added functions */ +/* + * Get current playback state + */ +dvdnav_status_t dvdnav_get_state(dvdnav_t *self, dvd_state_t *save_state); + +/* + * Resume playback state + */ +dvdnav_status_t dvdnav_set_state(dvdnav_t *self, dvd_state_t *save_state); +/* end XBMC */ + /** 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) #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 */ #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 @@ -22,8 +22,8 @@ #ifndef LIBDVDREAD_IFO_TYPES_H #define LIBDVDREAD_IFO_TYPES_H -#include -#include "dvdread/dvd_reader.h" +//#include +#include "dvd_reader.h" #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 @@ -28,9 +28,27 @@ #ifndef LIBDVDREAD_NAV_TYPES_H #define LIBDVDREAD_NAV_TYPES_H -#include +//#include #include "ifo_types.h" /* only dvd_time_t, vm_cmd_t and user_ops_t */ + +#undef ATTRIBUTE_PACKED +#undef PRAGMA_PACK_BEGIN +#undef PRAGMA_PACK_END + +#if defined(__GNUC__) +#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +#define ATTRIBUTE_PACKED __attribute__ ((packed)) +#define PRAGMA_PACK 0 +#endif +#endif + +#if !defined(ATTRIBUTE_PACKED) +#define ATTRIBUTE_PACKED +#define PRAGMA_PACK 1 +#endif + + /* The length including the substream id byte. */ #define PCI_BYTES 0x3d4 #define DSI_BYTES 0x3fa @@ -41,6 +59,12 @@ /* Remove this */ #define DSI_START_BYTE 1031 + +#if PRAGMA_PACK +#pragma pack(1) +#endif + + /** * 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 @@ -23,6 +23,9 @@ #ifndef LIBDVDNAV_VM_H #define LIBDVDNAV_VM_H +#include "remap.h" +#include "dvdnav_internal.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 @@ void vm_position_print(vm_t *vm, vm_position_t *position); #endif +/* XBMC added functions */ +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 + void vm_print_mnemonic(vm_cmd_t *command); void vm_print_cmd(int row, vm_cmd_t *command);