Mercurial > libdvdnav.hg
annotate dvdnav_internal.h @ 290:54b6a000f6da src
decoder.h needs inclusion of sys/time.h
author | nicodvb |
---|---|
date | Sat, 21 Apr 2007 22:01:34 +0000 |
parents | ce4230602517 |
children | d80a041928be |
rev | line source |
---|---|
201
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
1 /* |
250 | 2 * Copyright (C) 2001-2004 Rich Wareham <richwareham@users.sourceforge.net> |
201
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
3 * |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
4 * This file is part of libdvdnav, a DVD navigation library. |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
5 * |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
6 * libdvdnav is free software; you can redistribute it and/or modify |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
7 * it under the terms of the GNU General Public License as published by |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
8 * the Free Software Foundation; either version 2 of the License, or |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
9 * (at your option) any later version. |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
10 * |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
11 * libdvdnav is distributed in the hope that it will be useful, |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
14 * GNU General Public License for more details. |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
15 * |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
16 * You should have received a copy of the GNU General Public License |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
17 * along with this program; if not, write to the Free Software |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
19 * |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
20 * $Id$ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
21 * |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
22 */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
23 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
24 #ifndef DVDNAV_INTERNAL_H_INCLUDED |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
25 #define DVDNAV_INTERNAL_H_INCLUDED |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
26 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
27 #ifdef HAVE_CONFIG_H |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
28 #include "config.h" |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
29 #endif |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
30 |
230 | 31 #ifdef WIN32 |
239
eaa775ba1306
merge the two #ifdef blocks that both check for WIN32 to improve readability
mroi
parents:
230
diff
changeset
|
32 |
230 | 33 /* pthread_mutex_* wrapper for win32 */ |
34 #include <windows.h> | |
35 #include <process.h> | |
36 typedef CRITICAL_SECTION pthread_mutex_t; | |
37 #define pthread_mutex_init(a, b) InitializeCriticalSection(a) | |
38 #define pthread_mutex_lock(a) EnterCriticalSection(a) | |
39 #define pthread_mutex_unlock(a) LeaveCriticalSection(a) | |
40 #define pthread_mutex_destroy(a) | |
201
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
41 |
230 | 42 /* replacement gettimeofday implementation */ |
43 #include <sys/timeb.h> | |
250 | 44 static inline int _private_gettimeofday( struct timeval *tv, void *tz ) |
230 | 45 { |
46 struct timeb t; | |
47 ftime( &t ); | |
48 tv->tv_sec = t.time; | |
49 tv->tv_usec = t.millitm * 1000; | |
50 return 0; | |
51 } | |
250 | 52 #define gettimeofday(TV, TZ) _private_gettimeofday((TV), (TZ)) |
230 | 53 #include <io.h> /* read() */ |
54 #define lseek64 _lseeki64 | |
239
eaa775ba1306
merge the two #ifdef blocks that both check for WIN32 to improve readability
mroi
parents:
230
diff
changeset
|
55 |
eaa775ba1306
merge the two #ifdef blocks that both check for WIN32 to improve readability
mroi
parents:
230
diff
changeset
|
56 #else |
eaa775ba1306
merge the two #ifdef blocks that both check for WIN32 to improve readability
mroi
parents:
230
diff
changeset
|
57 |
eaa775ba1306
merge the two #ifdef blocks that both check for WIN32 to improve readability
mroi
parents:
230
diff
changeset
|
58 #include <pthread.h> |
eaa775ba1306
merge the two #ifdef blocks that both check for WIN32 to improve readability
mroi
parents:
230
diff
changeset
|
59 |
eaa775ba1306
merge the two #ifdef blocks that both check for WIN32 to improve readability
mroi
parents:
230
diff
changeset
|
60 #endif /* WIN32 */ |
201
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
61 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
62 /* where should libdvdnav write its messages (stdout/stderr) */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
63 #define MSG_OUT stdout |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
64 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
65 /* Maximum length of an error string */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
66 #define MAX_ERR_LEN 255 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
67 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
68 /* Use the POSIX PATH_MAX if available */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
69 #ifdef PATH_MAX |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
70 #define MAX_PATH_LEN PATH_MAX |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
71 #else |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
72 #define MAX_PATH_LEN 255 /* Arbitrary */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
73 #endif |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
74 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
75 #ifndef DVD_VIDEO_LB_LEN |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
76 #define DVD_VIDEO_LB_LEN 2048 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
77 #endif |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
78 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
79 typedef struct read_cache_s read_cache_t; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
80 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
81 /* |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
82 * These are defined here because they are |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
83 * not in ifo_types.h, they maybe one day |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
84 */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
85 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
86 #ifndef audio_status_t |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
87 typedef struct { |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
88 #ifdef WORDS_BIGENDIAN |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
89 unsigned int available : 1; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
90 unsigned int zero1 : 4; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
91 unsigned int stream_number : 3; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
92 uint8_t zero2; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
93 #else |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
94 uint8_t zero2; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
95 unsigned int stream_number : 3; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
96 unsigned int zero1 : 4; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
97 unsigned int available : 1; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
98 #endif |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
99 } ATTRIBUTE_PACKED audio_status_t; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
100 #endif |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
101 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
102 #ifndef spu_status_t |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
103 typedef struct { |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
104 #ifdef WORDS_BIGENDIAN |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
105 unsigned int available : 1; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
106 unsigned int zero1 : 2; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
107 unsigned int stream_number_4_3 : 5; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
108 unsigned int zero2 : 3; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
109 unsigned int stream_number_wide : 5; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
110 unsigned int zero3 : 3; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
111 unsigned int stream_number_letterbox : 5; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
112 unsigned int zero4 : 3; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
113 unsigned int stream_number_pan_scan : 5; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
114 #else |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
115 unsigned int stream_number_pan_scan : 5; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
116 unsigned int zero4 : 3; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
117 unsigned int stream_number_letterbox : 5; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
118 unsigned int zero3 : 3; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
119 unsigned int stream_number_wide : 5; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
120 unsigned int zero2 : 3; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
121 unsigned int stream_number_4_3 : 5; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
122 unsigned int zero1 : 2; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
123 unsigned int available : 1; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
124 #endif |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
125 } ATTRIBUTE_PACKED spu_status_t; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
126 #endif |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
127 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
128 typedef struct dvdnav_vobu_s { |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
129 int32_t vobu_start; /* Logical Absolute. MAX needed is 0x300000 */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
130 int32_t vobu_length; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
131 int32_t blockN; /* Relative offset */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
132 int32_t vobu_next; /* Relative offset */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
133 } dvdnav_vobu_t; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
134 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
135 /** The main DVDNAV type **/ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
136 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
137 struct dvdnav_s { |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
138 /* General data */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
139 char path[MAX_PATH_LEN]; /* Path to DVD device/dir */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
140 dvd_file_t *file; /* Currently opened file */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
141 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
142 /* Position data */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
143 vm_position_t position_next; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
144 vm_position_t position_current; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
145 dvdnav_vobu_t vobu; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
146 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
147 /* NAV data */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
148 pci_t pci; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
149 dsi_t dsi; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
150 uint32_t last_cmd_nav_lbn; /* detects when a command is issued on an already left NAV */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
151 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
152 /* Flags */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
153 int skip_still; /* Set when skipping a still */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
154 int sync_wait; /* applications should wait till they are in sync with us */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
155 int sync_wait_skip; /* Set when skipping wait state */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
156 int spu_clut_changed; /* The SPU CLUT changed */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
157 int started; /* vm_start has been called? */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
158 int use_read_ahead; /* 1 - use read-ahead cache, 0 - don't */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
159 int pgc_based; /* positioning works PGC based instead of PG based */ |
269
77e472cef5f8
implemented dvdnav_get_current_time() with obvious meaning
nicodvb
parents:
265
diff
changeset
|
160 int cur_cell_time; /* time expired since the beginning of the current cell, read from the dsi */ |
201
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
161 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
162 /* VM */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
163 vm_t *vm; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
164 pthread_mutex_t vm_lock; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
165 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
166 /* Read-ahead cache */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
167 read_cache_t *cache; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
168 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
169 /* Errors */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
170 char err_str[MAX_ERR_LEN]; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
171 }; |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
172 |
265 | 173 /** HELPER FUNCTIONS **/ |
174 | |
175 /* converts a dvd_time_t to PTS ticks */ | |
176 int64_t dvdnav_convert_time(dvd_time_t *time); | |
177 | |
201
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
178 /** USEFUL MACROS **/ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
179 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
180 #ifdef __GNUC__ |
258 | 181 #define printerrf(format, args...) \ |
182 do { if (this) snprintf(this->err_str, MAX_ERR_LEN, format, ## args); } while (0) | |
201
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
183 #else |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
184 #ifdef _MSC_VER |
258 | 185 #define printerrf(str) \ |
186 do { if (this) snprintf(this->err_str, MAX_ERR_LEN, str); } while (0) | |
201
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
187 #else |
258 | 188 #define printerrf(...) \ |
189 do { if (this) snprintf(this->err_str, MAX_ERR_LEN, __VA_ARGS__); } while (0) | |
201
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
190 #endif /* WIN32 */ |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
191 #endif |
258 | 192 #define printerr(str) \ |
259
39d2fc310eb9
fix the printerr macro again to have \0-terminated strings
mroi
parents:
258
diff
changeset
|
193 do { if (this) strncpy(this->err_str, str, MAX_ERR_LEN - 1); } while (0) |
201
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
194 |
534f17c79e4a
dvdnav_internal.h is an internal header, only used at compile time;
mroi
parents:
diff
changeset
|
195 #endif /* DVDNAV_INTERNAL_H_INCLUDED */ |