00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef DVDNAV_INTERNAL_H_INCLUDED
00025 #define DVDNAV_INTERNAL_H_INCLUDED
00026
00027 #include <stdlib.h>
00028 #include <stdio.h>
00029 #include <unistd.h>
00030 #include <limits.h>
00031 #include <string.h>
00032
00033
00034 #include "mythconfig.h"
00035 #include "compat.h"
00036
00037 #ifdef WIN32
00038
00039
00040 #include <windows.h>
00041 #include <process.h>
00042 typedef CRITICAL_SECTION pthread_mutex_t;
00043 #define pthread_mutex_init(a, b) InitializeCriticalSection(a)
00044 #define pthread_mutex_lock(a) EnterCriticalSection(a)
00045 #define pthread_mutex_unlock(a) LeaveCriticalSection(a)
00046 #define pthread_mutex_destroy(a)
00047
00048
00049 #include <sys/timeb.h>
00050 static inline int _private_gettimeofday( struct timeval *tv, void *tz )
00051 {
00052 struct timeb t;
00053 ftime( &t );
00054 tv->tv_sec = t.time;
00055 tv->tv_usec = t.millitm * 1000;
00056 return 0;
00057 }
00058 #define gettimeofday(TV, TZ) _private_gettimeofday((TV), (TZ))
00059 #include <io.h>
00060 #define lseek64 _lseeki64
00061
00062 #else
00063
00064 #include <pthread.h>
00065
00066 #endif
00067
00068
00069
00070
00071 #include "decoder.h"
00072 #include "dvdnav.h"
00073 #include "vm.h"
00074 #include "vmcmd.h"
00075
00076
00077 #define MSG_OUT stdout
00078
00079
00080 #define MAX_ERR_LEN 255
00081
00082
00083 #ifdef PATH_MAX
00084 #define MAX_PATH_LEN PATH_MAX
00085 #else
00086 #define MAX_PATH_LEN 255
00087 #endif
00088
00089 #ifndef DVD_VIDEO_LB_LEN
00090 #define DVD_VIDEO_LB_LEN 2048
00091 #endif
00092
00093 typedef struct read_cache_s read_cache_t;
00094
00095
00096
00097
00098
00099
00100 #ifndef audio_status_t
00101 typedef struct {
00102 #ifdef WORDS_BIGENDIAN
00103 unsigned int available : 1;
00104 unsigned int zero1 : 4;
00105 unsigned int stream_number : 3;
00106 uint8_t zero2;
00107 #else
00108 uint8_t zero2;
00109 unsigned int stream_number : 3;
00110 unsigned int zero1 : 4;
00111 unsigned int available : 1;
00112 #endif
00113 } ATTRIBUTE_PACKED audio_status_t;
00114 #endif
00115
00116 #ifndef spu_status_t
00117 typedef struct {
00118 #ifdef WORDS_BIGENDIAN
00119 unsigned int available : 1;
00120 unsigned int zero1 : 2;
00121 unsigned int stream_number_4_3 : 5;
00122 unsigned int zero2 : 3;
00123 unsigned int stream_number_wide : 5;
00124 unsigned int zero3 : 3;
00125 unsigned int stream_number_letterbox : 5;
00126 unsigned int zero4 : 3;
00127 unsigned int stream_number_pan_scan : 5;
00128 #else
00129 unsigned int stream_number_pan_scan : 5;
00130 unsigned int zero4 : 3;
00131 unsigned int stream_number_letterbox : 5;
00132 unsigned int zero3 : 3;
00133 unsigned int stream_number_wide : 5;
00134 unsigned int zero2 : 3;
00135 unsigned int stream_number_4_3 : 5;
00136 unsigned int zero1 : 2;
00137 unsigned int available : 1;
00138 #endif
00139 } ATTRIBUTE_PACKED spu_status_t;
00140 #endif
00141
00142 typedef struct dvdnav_vobu_s {
00143 int32_t vobu_start;
00144 int32_t vobu_length;
00145 int32_t blockN;
00146 int32_t vobu_next;
00147 } dvdnav_vobu_t;
00148
00151 struct dvdnav_s {
00152
00153 char path[MAX_PATH_LEN];
00154 dvd_file_t *file;
00155
00156
00157 vm_position_t position_next;
00158 vm_position_t position_current;
00159 dvdnav_vobu_t vobu;
00160
00161
00162 pci_t pci;
00163 dsi_t dsi;
00164 uint32_t last_cmd_nav_lbn;
00165
00166
00167 int skip_still;
00168 int sync_wait;
00169 int sync_wait_skip;
00170 int spu_clut_changed;
00171 int started;
00172 int use_read_ahead;
00173 int pgc_based;
00174
00175
00176 vm_t *vm;
00177 pthread_mutex_t vm_lock;
00178
00179
00180 read_cache_t *cache;
00181
00182
00183 char err_str[MAX_ERR_LEN];
00184 };
00185
00188 #ifdef __GNUC__
00189 #define printerrf(format, args...) \
00190 do { if (this) snprintf(this->err_str, MAX_ERR_LEN, format, ## args); } \
00191 while (0)
00192 #else
00193 #ifdef _MSC_VER
00194 #define printerrf(str) \
00195 do { if (this) snprintf(this->err_str, MAX_ERR_LEN, str); } \
00196 while (0)
00197 #else
00198 #define printerrf(...) \
00199 do { if (this) snprintf(this->err_str, MAX_ERR_LEN, __VA_ARGS__); } \
00200 while (0)
00201 #endif
00202 #endif
00203 #define printerr(str) \
00204 do { if (this) strncpy(this->err_str, str, MAX_ERR_LEN); } \
00205 while (0)
00206
00207 #endif