Mercurial > libdvdnav.hg
annotate navigation.c @ 23:c2d40c38e12f src
Name stills work better.
author | jcdutton |
---|---|
date | Tue, 23 Apr 2002 00:07:16 +0000 |
parents | 3c1df0cb3aee |
children | 794d2e16a4d4 |
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.h> | |
29 #include "dvdnav_internal.h" | |
30 | |
31 #include "vm.h" | |
32 | |
33 /* Navigation API calls */ | |
34 | |
35 /* Common things we do everytime we do a jump */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
36 void dvdnav_do_post_jump(dvdnav_t *this) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
37 dvd_state_t *state = &(this->vm->state); |
0 | 38 cell_playback_t *cell = &(state->pgc->cell_playback[state->cellN - 1]); |
39 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
40 this->jmp_blockN = 0; /* FIXME: Should this be different? */ |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
41 this->jmp_vobu_start = cell->first_sector; |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
42 this->jumping = 1; |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
43 this->position_current.still = 0; |
0 | 44 } |
45 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
46 dvdnav_status_t dvdnav_still_skip(dvdnav_t *this) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
47 if(!this) |
0 | 48 return S_ERR; |
49 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
50 this->position_current.still = 0; |
23 | 51 this->skip_still = 1; |
0 | 52 |
53 return S_OK; | |
54 } | |
55 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
56 dvdnav_status_t dvdnav_get_number_of_titles(dvdnav_t *this, int *titles) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
57 if(!this) |
0 | 58 return S_ERR; |
59 | |
60 if(!titles) { | |
61 printerr("Passed a NULL pointer"); | |
62 return S_ERR; | |
63 } | |
64 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
65 (*titles) = vm_get_vmgi(this->vm)->tt_srpt->nr_of_srpts; |
0 | 66 |
67 return S_OK; | |
68 } | |
69 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
70 dvdnav_status_t dvdnav_get_number_of_programs(dvdnav_t *this, int *programs) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
71 if(!this) |
5
c1b55dc1bfed
Add API call to get number of programmes in current title.
richwareham
parents:
0
diff
changeset
|
72 return S_ERR; |
c1b55dc1bfed
Add API call to get number of programmes in current title.
richwareham
parents:
0
diff
changeset
|
73 |
c1b55dc1bfed
Add API call to get number of programmes in current title.
richwareham
parents:
0
diff
changeset
|
74 if(!programs) { |
c1b55dc1bfed
Add API call to get number of programmes in current title.
richwareham
parents:
0
diff
changeset
|
75 printerr("Passed a NULL pointer"); |
c1b55dc1bfed
Add API call to get number of programmes in current title.
richwareham
parents:
0
diff
changeset
|
76 return S_ERR; |
c1b55dc1bfed
Add API call to get number of programmes in current title.
richwareham
parents:
0
diff
changeset
|
77 } |
c1b55dc1bfed
Add API call to get number of programmes in current title.
richwareham
parents:
0
diff
changeset
|
78 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
79 (*programs) = this->vm->state.pgc->nr_of_programs; |
5
c1b55dc1bfed
Add API call to get number of programmes in current title.
richwareham
parents:
0
diff
changeset
|
80 |
c1b55dc1bfed
Add API call to get number of programmes in current title.
richwareham
parents:
0
diff
changeset
|
81 return S_OK; |
c1b55dc1bfed
Add API call to get number of programmes in current title.
richwareham
parents:
0
diff
changeset
|
82 } |
c1b55dc1bfed
Add API call to get number of programmes in current title.
richwareham
parents:
0
diff
changeset
|
83 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
84 dvdnav_status_t dvdnav_title_play(dvdnav_t *this, int title) { |
0 | 85 int num_titles; |
86 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
87 if(!this) { |
0 | 88 return S_ERR; |
89 } | |
90 | |
91 /* Check number of titles */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
92 dvdnav_get_number_of_titles(this, &num_titles); |
0 | 93 if((title > num_titles) || (title <= 0)) { |
94 printerrf("Invalid title passed (%i, maximum %i)", title, | |
95 num_titles); | |
96 return S_ERR; | |
97 } | |
98 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
99 vm_start_title(this->vm, title); |
0 | 100 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
101 /* this->expecting_nav_packet = 1; */ |
0 | 102 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
103 dvdnav_do_post_jump(this); |
0 | 104 |
105 return S_OK; | |
106 } | |
107 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
108 dvdnav_status_t dvdnav_part_play(dvdnav_t *this, int title, int part) { |
0 | 109 int num_titles, num_progs; |
110 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
111 if(!this) { |
0 | 112 return S_ERR; |
113 } | |
114 | |
115 /* Check number of titles */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
116 dvdnav_get_number_of_titles(this, &num_titles); |
0 | 117 if((title > num_titles) || (title <= 0)) { |
118 printerrf("Invalid title passed (%i, maximum %i)", title, | |
119 num_titles); | |
120 return S_ERR; | |
121 } | |
122 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
123 vm_start_title(this->vm, title); |
0 | 124 |
125 | |
126 /* Check number of parts */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
127 num_progs = this->vm->state.pgc->nr_of_programs; |
0 | 128 if((part > num_progs) || (part <= 0)) { |
129 printerrf("Invalid program passed (%i, maximum %i)", part, | |
130 num_progs); | |
131 return S_ERR; | |
132 } | |
133 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
134 vm_jump_prog(this->vm, part); |
0 | 135 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
136 /* this->expecting_nav_packet = 1; */ |
0 | 137 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
138 dvdnav_do_post_jump(this); |
0 | 139 |
140 return S_OK; | |
141 } | |
142 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
143 dvdnav_status_t dvdnav_part_play_auto_stop(dvdnav_t *this, int title, |
0 | 144 int part, int parts_to_play) { |
145 /* Perform jump as per usual */ | |
146 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
147 return dvdnav_part_play(this, title, part); |
0 | 148 |
149 /* FIXME: Impement auto-stop */ | |
150 | |
151 /* return S_OK;*/ | |
152 } | |
153 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
154 dvdnav_status_t dvdnav_time_play(dvdnav_t *this, int title, |
0 | 155 unsigned long int time) { |
156 /* FIXME: Implement */ | |
157 | |
158 return S_OK; | |
159 } | |
160 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
161 dvdnav_status_t dvdnav_stop(dvdnav_t *this) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
162 if(!this) |
0 | 163 return S_ERR; |
164 | |
165 /* Set the STOP flag */ | |
166 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
167 this->stop = 1; |
0 | 168 |
169 return S_OK; | |
170 } | |
171 | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
172 dvdnav_status_t dvdnav_go_up(dvdnav_t *this) { |
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
173 if(!this) |
0 | 174 return S_ERR; |
175 | |
176 /* A nice easy function... delegate to the VM */ | |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
177 vm_go_up(this->vm); |
0 | 178 |
22
3c1df0cb3aee
Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents:
5
diff
changeset
|
179 dvdnav_do_post_jump(this); |
0 | 180 |
181 return S_OK; | |
182 } | |
183 | |
184 | |
185 |