Mercurial > libdvdnav.hg
annotate navigation.c @ 184:c2e7199becdb src
Remove log info from file.
One can use "cvs log" instead.
author | jcdutton |
---|---|
date | Tue, 29 Apr 2003 15:25:20 +0000 |
parents | 25b0c4f881c3 |
children | b80dff4bef76 |
rev | line source |
---|---|
0 | 1 /* |
2 * Copyright (C) 2000 Rich Wareham <richwareham@users.sourceforge.net> | |
3 * | |
4 * This file is part of libdvdnav, a DVD navigation library. | |
5 * | |
6 * libdvdnav is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * libdvdnav is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | |
19 * | |
20 * $Id$ | |
21 * | |
22 */ | |
23 | |
24 #ifdef HAVE_CONFIG_H | |
25 #include "config.h" | |
26 #endif | |
27 | |
28 #include "dvdnav_internal.h" | |
29 | |
30 /* Navigation API calls */ | |
31 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
32 dvdnav_status_t dvdnav_still_skip(dvdnav_t *this) { |
114 | 33 if(!this) { |
34 printerr("Passed a NULL pointer."); | |
35 return S_ERR; | |
36 } | |
0 | 37 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
38 this->position_current.still = 0; |
23 | 39 this->skip_still = 1; |
116 | 40 this->sync_wait = 0; |
41 this->sync_wait_skip = 1; | |
42 | |
43 return S_OK; | |
44 } | |
45 | |
46 dvdnav_status_t dvdnav_wait_skip(dvdnav_t *this) { | |
47 if(!this) { | |
48 printerr("Passed a NULL pointer."); | |
49 return S_ERR; | |
50 } | |
51 | |
52 this->sync_wait = 0; | |
53 this->sync_wait_skip = 1; | |
0 | 54 |
55 return S_OK; | |
56 } | |
57 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
58 dvdnav_status_t dvdnav_get_number_of_titles(dvdnav_t *this, int *titles) { |
114 | 59 if(!this || !titles) { |
60 printerr("Passed a NULL pointer."); | |
0 | 61 return S_ERR; |
62 } | |
63 | |
94
e29110f67f3a
Get xine dvd:///dev/dvd:1.2 i.e. title play working again.
jcdutton
parents:
90
diff
changeset
|
64 if(!this->started) { |
e29110f67f3a
Get xine dvd:///dev/dvd:1.2 i.e. title play working again.
jcdutton
parents:
90
diff
changeset
|
65 /* Start the VM */ |
e29110f67f3a
Get xine dvd:///dev/dvd:1.2 i.e. title play working again.
jcdutton
parents:
90
diff
changeset
|
66 vm_start(this->vm); |
e29110f67f3a
Get xine dvd:///dev/dvd:1.2 i.e. title play working again.
jcdutton
parents:
90
diff
changeset
|
67 this->started = 1; |
e29110f67f3a
Get xine dvd:///dev/dvd:1.2 i.e. title play working again.
jcdutton
parents:
90
diff
changeset
|
68 } |
e29110f67f3a
Get xine dvd:///dev/dvd:1.2 i.e. title play working again.
jcdutton
parents:
90
diff
changeset
|
69 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
70 (*titles) = vm_get_vmgi(this->vm)->tt_srpt->nr_of_srpts; |
0 | 71 |
72 return S_OK; | |
73 } | |
74 | |
95 | 75 dvdnav_status_t dvdnav_get_number_of_parts(dvdnav_t *this, int title, int *parts) { |
114 | 76 if(!this || !parts) { |
77 printerr("Passed a NULL pointer."); | |
5
c1b55dc1bfed
Add API call to get number of programmes in current title.
richwareham
parents:
0
diff
changeset
|
78 return S_ERR; |
c1b55dc1bfed
Add API call to get number of programmes in current title.
richwareham
parents:
0
diff
changeset
|
79 } |
95 | 80 if(!this->started) { |
81 printerr("Virtual DVD machine not started."); | |
82 return S_ERR; | |
83 } | |
84 if ((title < 1) || (title > vm_get_vmgi(this->vm)->tt_srpt->nr_of_srpts) ) { | |
114 | 85 printerr("Passed a title number out of range."); |
95 | 86 return S_ERR; |
87 } | |
114 | 88 |
95 | 89 (*parts) = vm_get_vmgi(this->vm)->tt_srpt->title[title-1].nr_of_ptts; |
114 | 90 |
5
c1b55dc1bfed
Add API call to get number of programmes in current title.
richwareham
parents:
0
diff
changeset
|
91 return S_OK; |
c1b55dc1bfed
Add API call to get number of programmes in current title.
richwareham
parents:
0
diff
changeset
|
92 } |
c1b55dc1bfed
Add API call to get number of programmes in current title.
richwareham
parents:
0
diff
changeset
|
93 |
90 | 94 dvdnav_status_t dvdnav_current_title_info(dvdnav_t *this, int *title, int *part) { |
114 | 95 int retval; |
96 | |
97 if(!this || !title || !part) { | |
98 printerr("Passed a NULL pointer."); | |
99 return S_ERR; | |
100 } | |
101 | |
102 pthread_mutex_lock(&this->vm_lock); | |
103 if (!this->vm->vtsi || !this->vm->vmgi) { | |
104 printerr("Bad VM state."); | |
105 pthread_mutex_unlock(&this->vm_lock); | |
90 | 106 return S_ERR; |
107 } | |
114 | 108 if (!this->vm->state.pgc) { |
109 printerr("No current PGC."); | |
110 pthread_mutex_unlock(&this->vm_lock); | |
111 return S_ERR; | |
112 } | |
158 | 113 if ( (this->vm->state.domain == VTSM_DOMAIN) |
114 || (this->vm->state.domain == VMGM_DOMAIN) ) { | |
115 /* Get current Menu ID: into *part. */ | |
116 vm_get_current_menu(this->vm, part); | |
159 | 117 if (*part > -1) { |
118 *title = 0; | |
157
7094c8661c05
Return details about menu number in dvdnav_current_title_info()
jcdutton
parents:
146
diff
changeset
|
119 pthread_mutex_unlock(&this->vm_lock); |
7094c8661c05
Return details about menu number in dvdnav_current_title_info()
jcdutton
parents:
146
diff
changeset
|
120 return S_OK; |
7094c8661c05
Return details about menu number in dvdnav_current_title_info()
jcdutton
parents:
146
diff
changeset
|
121 } |
114 | 122 } |
158 | 123 if (this->vm->state.domain == VTS_DOMAIN) { |
124 retval = vm_get_current_title_part(this->vm, title, part); | |
125 pthread_mutex_unlock(&this->vm_lock); | |
126 return retval ? S_OK : S_ERR; | |
127 } | |
128 printerr("Not in a title or menu."); | |
114 | 129 pthread_mutex_unlock(&this->vm_lock); |
158 | 130 return S_ERR; |
90 | 131 } |
132 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
133 dvdnav_status_t dvdnav_title_play(dvdnav_t *this, int title) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
134 if(!this) { |
114 | 135 printerr("Passed a NULL pointer."); |
0 | 136 return S_ERR; |
137 } | |
90 | 138 return dvdnav_part_play(this, title, 1); |
0 | 139 } |
140 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
141 dvdnav_status_t dvdnav_part_play(dvdnav_t *this, int title, int part) { |
114 | 142 int retval; |
0 | 143 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
144 if(!this) { |
114 | 145 printerr("Passed a NULL pointer."); |
146 return S_ERR; | |
147 } | |
148 | |
149 pthread_mutex_lock(&this->vm_lock); | |
137 | 150 if (!this->vm->vmgi) { |
114 | 151 printerr("Bad VM state."); |
152 pthread_mutex_unlock(&this->vm_lock); | |
0 | 153 return S_ERR; |
154 } | |
114 | 155 if (!this->vm->state.pgc) { |
156 printerr("No current PGC."); | |
157 pthread_mutex_unlock(&this->vm_lock); | |
158 return S_ERR; | |
159 } | |
160 if((title < 1) || (title > this->vm->vmgi->tt_srpt->nr_of_srpts)) { | |
161 printerr("Title out of range."); | |
162 pthread_mutex_unlock(&this->vm_lock); | |
163 return S_ERR; | |
164 } | |
140 | 165 if((part < 1) || (part > this->vm->vmgi->tt_srpt->title[title-1].nr_of_ptts)) { |
166 printerr("Part out of range."); | |
167 pthread_mutex_unlock(&this->vm_lock); | |
168 return S_ERR; | |
169 } | |
170 | |
114 | 171 retval = vm_jump_title_part(this->vm, title, part); |
133
d09a81cf65ce
determine correct PG and PTT numbers when seeking across PG boundaries
mroi
parents:
116
diff
changeset
|
172 if (retval) |
d09a81cf65ce
determine correct PG and PTT numbers when seeking across PG boundaries
mroi
parents:
116
diff
changeset
|
173 this->vm->hop_channel++; |
114 | 174 pthread_mutex_unlock(&this->vm_lock); |
0 | 175 |
114 | 176 return retval ? S_OK : S_ERR; |
0 | 177 } |
178 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
179 dvdnav_status_t dvdnav_part_play_auto_stop(dvdnav_t *this, int title, |
114 | 180 int part, int parts_to_play) { |
181 /* FIXME: Implement auto-stop */ | |
182 if (dvdnav_part_play(this, title, part) == S_OK) | |
183 printerr("Not implemented yet."); | |
184 return S_ERR; | |
0 | 185 } |
186 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
187 dvdnav_status_t dvdnav_time_play(dvdnav_t *this, int title, |
114 | 188 unsigned long int time) { |
189 if(!this) { | |
190 printerr("Passed a NULL pointer."); | |
191 return S_ERR; | |
192 } | |
193 | |
0 | 194 /* FIXME: Implement */ |
114 | 195 printerr("Not implemented yet."); |
196 return S_ERR; | |
0 | 197 } |
198 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
199 dvdnav_status_t dvdnav_stop(dvdnav_t *this) { |
114 | 200 if(!this) { |
201 printerr("Passed a NULL pointer."); | |
202 return S_ERR; | |
203 } | |
0 | 204 |
114 | 205 pthread_mutex_lock(&this->vm_lock); |
146
7f242ec838fd
do not stop the VM here, get_next_block will do that without races
mroi
parents:
140
diff
changeset
|
206 this->vm->stopped = 1; |
114 | 207 pthread_mutex_unlock(&this->vm_lock); |
0 | 208 return S_OK; |
209 } | |
210 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
211 dvdnav_status_t dvdnav_go_up(dvdnav_t *this) { |
114 | 212 if(!this) { |
213 printerr("Passed a NULL pointer."); | |
214 return S_ERR; | |
215 } | |
0 | 216 |
217 /* A nice easy function... delegate to the VM */ | |
114 | 218 pthread_mutex_lock(&this->vm_lock); |
219 vm_jump_up(this->vm); | |
220 pthread_mutex_unlock(&this->vm_lock); | |
0 | 221 |
222 return S_OK; | |
223 } |