comparison navigation.c @ 193:b80dff4bef76 src

Remove all references to S_OK and S_ERR. DVDNAV_STATUS_OK will always be 1. DVDNAV_STATUS_ERR will always be 0.
author jcdutton
date Sun, 11 May 2003 00:25:24 +0000
parents 25b0c4f881c3
children 6b1bfe8f5283
comparison
equal deleted inserted replaced
192:a3d7b149cc0f 193:b80dff4bef76
30 /* Navigation API calls */ 30 /* Navigation API calls */
31 31
32 dvdnav_status_t dvdnav_still_skip(dvdnav_t *this) { 32 dvdnav_status_t dvdnav_still_skip(dvdnav_t *this) {
33 if(!this) { 33 if(!this) {
34 printerr("Passed a NULL pointer."); 34 printerr("Passed a NULL pointer.");
35 return S_ERR; 35 return DVDNAV_STATUS_ERR;
36 } 36 }
37 37
38 this->position_current.still = 0; 38 this->position_current.still = 0;
39 this->skip_still = 1; 39 this->skip_still = 1;
40 this->sync_wait = 0; 40 this->sync_wait = 0;
41 this->sync_wait_skip = 1; 41 this->sync_wait_skip = 1;
42 42
43 return S_OK; 43 return DVDNAV_STATUS_OK;
44 } 44 }
45 45
46 dvdnav_status_t dvdnav_wait_skip(dvdnav_t *this) { 46 dvdnav_status_t dvdnav_wait_skip(dvdnav_t *this) {
47 if(!this) { 47 if(!this) {
48 printerr("Passed a NULL pointer."); 48 printerr("Passed a NULL pointer.");
49 return S_ERR; 49 return DVDNAV_STATUS_ERR;
50 } 50 }
51 51
52 this->sync_wait = 0; 52 this->sync_wait = 0;
53 this->sync_wait_skip = 1; 53 this->sync_wait_skip = 1;
54 54
55 return S_OK; 55 return DVDNAV_STATUS_OK;
56 } 56 }
57 57
58 dvdnav_status_t dvdnav_get_number_of_titles(dvdnav_t *this, int *titles) { 58 dvdnav_status_t dvdnav_get_number_of_titles(dvdnav_t *this, int *titles) {
59 if(!this || !titles) { 59 if(!this || !titles) {
60 printerr("Passed a NULL pointer."); 60 printerr("Passed a NULL pointer.");
61 return S_ERR; 61 return DVDNAV_STATUS_ERR;
62 } 62 }
63 63
64 if(!this->started) { 64 if(!this->started) {
65 /* Start the VM */ 65 /* Start the VM */
66 vm_start(this->vm); 66 vm_start(this->vm);
67 this->started = 1; 67 this->started = 1;
68 } 68 }
69 69
70 (*titles) = vm_get_vmgi(this->vm)->tt_srpt->nr_of_srpts; 70 (*titles) = vm_get_vmgi(this->vm)->tt_srpt->nr_of_srpts;
71 71
72 return S_OK; 72 return DVDNAV_STATUS_OK;
73 } 73 }
74 74
75 dvdnav_status_t dvdnav_get_number_of_parts(dvdnav_t *this, int title, int *parts) { 75 dvdnav_status_t dvdnav_get_number_of_parts(dvdnav_t *this, int title, int *parts) {
76 if(!this || !parts) { 76 if(!this || !parts) {
77 printerr("Passed a NULL pointer."); 77 printerr("Passed a NULL pointer.");
78 return S_ERR; 78 return DVDNAV_STATUS_ERR;
79 } 79 }
80 if(!this->started) { 80 if(!this->started) {
81 printerr("Virtual DVD machine not started."); 81 printerr("Virtual DVD machine not started.");
82 return S_ERR; 82 return DVDNAV_STATUS_ERR;
83 } 83 }
84 if ((title < 1) || (title > vm_get_vmgi(this->vm)->tt_srpt->nr_of_srpts) ) { 84 if ((title < 1) || (title > vm_get_vmgi(this->vm)->tt_srpt->nr_of_srpts) ) {
85 printerr("Passed a title number out of range."); 85 printerr("Passed a title number out of range.");
86 return S_ERR; 86 return DVDNAV_STATUS_ERR;
87 } 87 }
88 88
89 (*parts) = vm_get_vmgi(this->vm)->tt_srpt->title[title-1].nr_of_ptts; 89 (*parts) = vm_get_vmgi(this->vm)->tt_srpt->title[title-1].nr_of_ptts;
90 90
91 return S_OK; 91 return DVDNAV_STATUS_OK;
92 } 92 }
93 93
94 dvdnav_status_t dvdnav_current_title_info(dvdnav_t *this, int *title, int *part) { 94 dvdnav_status_t dvdnav_current_title_info(dvdnav_t *this, int *title, int *part) {
95 int retval; 95 int retval;
96 96
97 if(!this || !title || !part) { 97 if(!this || !title || !part) {
98 printerr("Passed a NULL pointer."); 98 printerr("Passed a NULL pointer.");
99 return S_ERR; 99 return DVDNAV_STATUS_ERR;
100 } 100 }
101 101
102 pthread_mutex_lock(&this->vm_lock); 102 pthread_mutex_lock(&this->vm_lock);
103 if (!this->vm->vtsi || !this->vm->vmgi) { 103 if (!this->vm->vtsi || !this->vm->vmgi) {
104 printerr("Bad VM state."); 104 printerr("Bad VM state.");
105 pthread_mutex_unlock(&this->vm_lock); 105 pthread_mutex_unlock(&this->vm_lock);
106 return S_ERR; 106 return DVDNAV_STATUS_ERR;
107 } 107 }
108 if (!this->vm->state.pgc) { 108 if (!this->vm->state.pgc) {
109 printerr("No current PGC."); 109 printerr("No current PGC.");
110 pthread_mutex_unlock(&this->vm_lock); 110 pthread_mutex_unlock(&this->vm_lock);
111 return S_ERR; 111 return DVDNAV_STATUS_ERR;
112 } 112 }
113 if ( (this->vm->state.domain == VTSM_DOMAIN) 113 if ( (this->vm->state.domain == VTSM_DOMAIN)
114 || (this->vm->state.domain == VMGM_DOMAIN) ) { 114 || (this->vm->state.domain == VMGM_DOMAIN) ) {
115 /* Get current Menu ID: into *part. */ 115 /* Get current Menu ID: into *part. */
116 vm_get_current_menu(this->vm, part); 116 vm_get_current_menu(this->vm, part);
117 if (*part > -1) { 117 if (*part > -1) {
118 *title = 0; 118 *title = 0;
119 pthread_mutex_unlock(&this->vm_lock); 119 pthread_mutex_unlock(&this->vm_lock);
120 return S_OK; 120 return DVDNAV_STATUS_OK;
121 } 121 }
122 } 122 }
123 if (this->vm->state.domain == VTS_DOMAIN) { 123 if (this->vm->state.domain == VTS_DOMAIN) {
124 retval = vm_get_current_title_part(this->vm, title, part); 124 retval = vm_get_current_title_part(this->vm, title, part);
125 pthread_mutex_unlock(&this->vm_lock); 125 pthread_mutex_unlock(&this->vm_lock);
126 return retval ? S_OK : S_ERR; 126 return retval ? DVDNAV_STATUS_OK : DVDNAV_STATUS_ERR;
127 } 127 }
128 printerr("Not in a title or menu."); 128 printerr("Not in a title or menu.");
129 pthread_mutex_unlock(&this->vm_lock); 129 pthread_mutex_unlock(&this->vm_lock);
130 return S_ERR; 130 return DVDNAV_STATUS_ERR;
131 } 131 }
132 132
133 dvdnav_status_t dvdnav_title_play(dvdnav_t *this, int title) { 133 dvdnav_status_t dvdnav_title_play(dvdnav_t *this, int title) {
134 if(!this) { 134 if(!this) {
135 printerr("Passed a NULL pointer."); 135 printerr("Passed a NULL pointer.");
136 return S_ERR; 136 return DVDNAV_STATUS_ERR;
137 } 137 }
138 return dvdnav_part_play(this, title, 1); 138 return dvdnav_part_play(this, title, 1);
139 } 139 }
140 140
141 dvdnav_status_t dvdnav_part_play(dvdnav_t *this, int title, int part) { 141 dvdnav_status_t dvdnav_part_play(dvdnav_t *this, int title, int part) {
142 int retval; 142 int retval;
143 143
144 if(!this) { 144 if(!this) {
145 printerr("Passed a NULL pointer."); 145 printerr("Passed a NULL pointer.");
146 return S_ERR; 146 return DVDNAV_STATUS_ERR;
147 } 147 }
148 148
149 pthread_mutex_lock(&this->vm_lock); 149 pthread_mutex_lock(&this->vm_lock);
150 if (!this->vm->vmgi) { 150 if (!this->vm->vmgi) {
151 printerr("Bad VM state."); 151 printerr("Bad VM state.");
152 pthread_mutex_unlock(&this->vm_lock); 152 pthread_mutex_unlock(&this->vm_lock);
153 return S_ERR; 153 return DVDNAV_STATUS_ERR;
154 } 154 }
155 if (!this->vm->state.pgc) { 155 if (!this->vm->state.pgc) {
156 printerr("No current PGC."); 156 printerr("No current PGC.");
157 pthread_mutex_unlock(&this->vm_lock); 157 pthread_mutex_unlock(&this->vm_lock);
158 return S_ERR; 158 return DVDNAV_STATUS_ERR;
159 } 159 }
160 if((title < 1) || (title > this->vm->vmgi->tt_srpt->nr_of_srpts)) { 160 if((title < 1) || (title > this->vm->vmgi->tt_srpt->nr_of_srpts)) {
161 printerr("Title out of range."); 161 printerr("Title out of range.");
162 pthread_mutex_unlock(&this->vm_lock); 162 pthread_mutex_unlock(&this->vm_lock);
163 return S_ERR; 163 return DVDNAV_STATUS_ERR;
164 } 164 }
165 if((part < 1) || (part > this->vm->vmgi->tt_srpt->title[title-1].nr_of_ptts)) { 165 if((part < 1) || (part > this->vm->vmgi->tt_srpt->title[title-1].nr_of_ptts)) {
166 printerr("Part out of range."); 166 printerr("Part out of range.");
167 pthread_mutex_unlock(&this->vm_lock); 167 pthread_mutex_unlock(&this->vm_lock);
168 return S_ERR; 168 return DVDNAV_STATUS_ERR;
169 } 169 }
170 170
171 retval = vm_jump_title_part(this->vm, title, part); 171 retval = vm_jump_title_part(this->vm, title, part);
172 if (retval) 172 if (retval)
173 this->vm->hop_channel++; 173 this->vm->hop_channel++;
174 pthread_mutex_unlock(&this->vm_lock); 174 pthread_mutex_unlock(&this->vm_lock);
175 175
176 return retval ? S_OK : S_ERR; 176 return retval ? DVDNAV_STATUS_OK : DVDNAV_STATUS_ERR;
177 } 177 }
178 178
179 dvdnav_status_t dvdnav_part_play_auto_stop(dvdnav_t *this, int title, 179 dvdnav_status_t dvdnav_part_play_auto_stop(dvdnav_t *this, int title,
180 int part, int parts_to_play) { 180 int part, int parts_to_play) {
181 /* FIXME: Implement auto-stop */ 181 /* FIXME: Implement auto-stop */
182 if (dvdnav_part_play(this, title, part) == S_OK) 182 if (dvdnav_part_play(this, title, part) == DVDNAV_STATUS_OK)
183 printerr("Not implemented yet."); 183 printerr("Not implemented yet.");
184 return S_ERR; 184 return DVDNAV_STATUS_ERR;
185 } 185 }
186 186
187 dvdnav_status_t dvdnav_time_play(dvdnav_t *this, int title, 187 dvdnav_status_t dvdnav_time_play(dvdnav_t *this, int title,
188 unsigned long int time) { 188 unsigned long int time) {
189 if(!this) { 189 if(!this) {
190 printerr("Passed a NULL pointer."); 190 printerr("Passed a NULL pointer.");
191 return S_ERR; 191 return DVDNAV_STATUS_ERR;
192 } 192 }
193 193
194 /* FIXME: Implement */ 194 /* FIXME: Implement */
195 printerr("Not implemented yet."); 195 printerr("Not implemented yet.");
196 return S_ERR; 196 return DVDNAV_STATUS_ERR;
197 } 197 }
198 198
199 dvdnav_status_t dvdnav_stop(dvdnav_t *this) { 199 dvdnav_status_t dvdnav_stop(dvdnav_t *this) {
200 if(!this) { 200 if(!this) {
201 printerr("Passed a NULL pointer."); 201 printerr("Passed a NULL pointer.");
202 return S_ERR; 202 return DVDNAV_STATUS_ERR;
203 } 203 }
204 204
205 pthread_mutex_lock(&this->vm_lock); 205 pthread_mutex_lock(&this->vm_lock);
206 this->vm->stopped = 1; 206 this->vm->stopped = 1;
207 pthread_mutex_unlock(&this->vm_lock); 207 pthread_mutex_unlock(&this->vm_lock);
208 return S_OK; 208 return DVDNAV_STATUS_OK;
209 } 209 }
210 210
211 dvdnav_status_t dvdnav_go_up(dvdnav_t *this) { 211 dvdnav_status_t dvdnav_go_up(dvdnav_t *this) {
212 if(!this) { 212 if(!this) {
213 printerr("Passed a NULL pointer."); 213 printerr("Passed a NULL pointer.");
214 return S_ERR; 214 return DVDNAV_STATUS_ERR;
215 } 215 }
216 216
217 /* A nice easy function... delegate to the VM */ 217 /* A nice easy function... delegate to the VM */
218 pthread_mutex_lock(&this->vm_lock); 218 pthread_mutex_lock(&this->vm_lock);
219 vm_jump_up(this->vm); 219 vm_jump_up(this->vm);
220 pthread_mutex_unlock(&this->vm_lock); 220 pthread_mutex_unlock(&this->vm_lock);
221 221
222 return S_OK; 222 return DVDNAV_STATUS_OK;
223 } 223 }