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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1 /*
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
2 * Copyright (C) 2000 Rich Wareham <richwareham@users.sourceforge.net>
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
3 *
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
4 * This file is part of libdvdnav, a DVD navigation library.
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
5 *
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
6 * libdvdnav is free software; you can redistribute it and/or modify
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
9 * (at your option) any later version.
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
10 *
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
11 * libdvdnav is distributed in the hope that it will be useful,
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
14 * GNU General Public License for more details.
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
15 *
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
19 *
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
20 * $Id$
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
21 *
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
22 */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
23
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
25 #include "config.h"
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
26 #endif
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
27
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
28 #include <dvdnav.h>
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
29 #include "dvdnav_internal.h"
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
30
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
31 #include "vm.h"
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
32
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
33 /* Navigation API calls */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
34
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
38 cell_playback_t *cell = &(state->pgc->cell_playback[state->cellN - 1]);
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
44 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
48 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
c2d40c38e12f Name stills work better.
jcdutton
parents: 22
diff changeset
51 this->skip_still = 1;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
52
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
53 return S_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
54 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
58 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
59
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
60 if(!titles) {
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
61 printerr("Passed a NULL pointer");
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
62 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
63 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
66
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
67 return S_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
68 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
85 int num_titles;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
86
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 5
diff changeset
87 if(!this) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
88 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
89 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
90
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
93 if((title > num_titles) || (title <= 0)) {
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
94 printerrf("Invalid title passed (%i, maximum %i)", title,
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
95 num_titles);
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
96 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
97 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
104
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
105 return S_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
106 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
109 int num_titles, num_progs;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
110
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 5
diff changeset
111 if(!this) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
112 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
113 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
114
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
117 if((title > num_titles) || (title <= 0)) {
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
118 printerrf("Invalid title passed (%i, maximum %i)", title,
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
119 num_titles);
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
120 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
121 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
124
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
125
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
128 if((part > num_progs) || (part <= 0)) {
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
129 printerrf("Invalid program passed (%i, maximum %i)", part,
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
130 num_progs);
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
131 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
132 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
139
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
140 return S_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
141 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
144 int part, int parts_to_play) {
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
145 /* Perform jump as per usual */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
148
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
149 /* FIXME: Impement auto-stop */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
150
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
151 /* return S_OK;*/
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
152 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
155 unsigned long int time) {
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
156 /* FIXME: Implement */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
157
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
158 return S_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
159 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
163 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
164
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
165 /* Set the STOP flag */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
166
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 5
diff changeset
167 this->stop = 1;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
168
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
169 return S_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
170 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
174 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
175
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
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
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
180
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
181 return S_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
182 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
183
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
184
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
185