annotate navigation.c @ 0:427b7da5cbdb src

first split of dvdread; it's just a copy of dvdnav still to be cleaned
author nicodvb
date Sun, 01 Jun 2008 08:39:07 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
1 /*
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
2 * Copyright (C) 2000 Rich Wareham <richwareham@users.sourceforge.net>
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
3 *
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
4 * This file is part of libdvdnav, a DVD navigation library.
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
5 *
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
6 * libdvdnav is free software; you can redistribute it and/or modify
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
9 * (at your option) any later version.
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
10 *
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
11 * libdvdnav is distributed in the hope that it will be useful,
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
14 * GNU General Public License for more details.
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
15 *
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
19 *
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
20 * $Id$
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
21 *
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
22 */
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
23
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
25 #include "config.h"
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
26 #endif
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
27
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
28 #include <inttypes.h>
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
29 #include <limits.h>
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
30 #include <string.h>
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
31 #include <sys/time.h>
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
32 #include "dvd_types.h"
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
33 #include "nav_types.h"
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
34 #include "ifo_types.h"
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
35 #include "remap.h"
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
36 #include "vm/decoder.h"
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
37 #include "vm/vm.h"
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
38 #include "dvdnav.h"
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
39 #include "dvdnav_internal.h"
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
40
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
41 /* Navigation API calls */
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
42
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
43 dvdnav_status_t dvdnav_still_skip(dvdnav_t *this) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
44 this->position_current.still = 0;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
45 this->skip_still = 1;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
46 this->sync_wait = 0;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
47 this->sync_wait_skip = 1;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
48
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
49 return DVDNAV_STATUS_OK;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
50 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
51
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
52 dvdnav_status_t dvdnav_wait_skip(dvdnav_t *this) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
53 this->sync_wait = 0;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
54 this->sync_wait_skip = 1;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
55
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
56 return DVDNAV_STATUS_OK;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
57 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
58
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
59 dvdnav_status_t dvdnav_get_number_of_titles(dvdnav_t *this, int32_t *titles) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
60 if (!this->vm->vmgi) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
61 printerr("Bad VM state.");
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
62 return DVDNAV_STATUS_ERR;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
63 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
64
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
65 (*titles) = vm_get_vmgi(this->vm)->tt_srpt->nr_of_srpts;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
66
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
67 return DVDNAV_STATUS_OK;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
68 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
69
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
70 dvdnav_status_t dvdnav_get_number_of_parts(dvdnav_t *this, int32_t title, int32_t *parts) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
71 if (!this->vm->vmgi) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
72 printerr("Bad VM state.");
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
73 return DVDNAV_STATUS_ERR;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
74 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
75 if ((title < 1) || (title > vm_get_vmgi(this->vm)->tt_srpt->nr_of_srpts) ) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
76 printerr("Passed a title number out of range.");
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
77 return DVDNAV_STATUS_ERR;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
78 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
79
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
80 (*parts) = vm_get_vmgi(this->vm)->tt_srpt->title[title-1].nr_of_ptts;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
81
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
82 return DVDNAV_STATUS_OK;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
83 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
84
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
85 dvdnav_status_t dvdnav_current_title_info(dvdnav_t *this, int32_t *title, int32_t *part) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
86 int32_t retval;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
87
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
88 pthread_mutex_lock(&this->vm_lock);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
89 if (!this->vm->vtsi || !this->vm->vmgi) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
90 printerr("Bad VM state.");
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
91 pthread_mutex_unlock(&this->vm_lock);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
92 return DVDNAV_STATUS_ERR;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
93 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
94 if (!this->started) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
95 printerr("Virtual DVD machine not started.");
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
96 pthread_mutex_unlock(&this->vm_lock);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
97 return DVDNAV_STATUS_ERR;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
98 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
99 if (!this->vm->state.pgc) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
100 printerr("No current PGC.");
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
101 pthread_mutex_unlock(&this->vm_lock);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
102 return DVDNAV_STATUS_ERR;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
103 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
104 if ( (this->vm->state.domain == VTSM_DOMAIN)
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
105 || (this->vm->state.domain == VMGM_DOMAIN) ) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
106 /* Get current Menu ID: into *part. */
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
107 if(! vm_get_current_menu(this->vm, part)) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
108 pthread_mutex_unlock(&this->vm_lock);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
109 return DVDNAV_STATUS_ERR;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
110 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
111 if (*part > -1) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
112 *title = 0;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
113 pthread_mutex_unlock(&this->vm_lock);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
114 return DVDNAV_STATUS_OK;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
115 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
116 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
117 if (this->vm->state.domain == VTS_DOMAIN) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
118 retval = vm_get_current_title_part(this->vm, title, part);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
119 pthread_mutex_unlock(&this->vm_lock);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
120 return retval ? DVDNAV_STATUS_OK : DVDNAV_STATUS_ERR;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
121 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
122 printerr("Not in a title or menu.");
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
123 pthread_mutex_unlock(&this->vm_lock);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
124 return DVDNAV_STATUS_ERR;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
125 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
126
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
127 dvdnav_status_t dvdnav_title_play(dvdnav_t *this, int32_t title) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
128 return dvdnav_part_play(this, title, 1);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
129 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
130
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
131 dvdnav_status_t dvdnav_part_play(dvdnav_t *this, int32_t title, int32_t part) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
132 int32_t retval;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
133
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
134 pthread_mutex_lock(&this->vm_lock);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
135 if (!this->vm->vmgi) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
136 printerr("Bad VM state.");
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
137 pthread_mutex_unlock(&this->vm_lock);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
138 return DVDNAV_STATUS_ERR;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
139 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
140 if (!this->started) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
141 /* don't report an error but be nice */
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
142 vm_start(this->vm);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
143 this->started = 1;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
144 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
145 if (!this->vm->state.pgc) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
146 printerr("No current PGC.");
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
147 pthread_mutex_unlock(&this->vm_lock);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
148 return DVDNAV_STATUS_ERR;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
149 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
150 if((title < 1) || (title > this->vm->vmgi->tt_srpt->nr_of_srpts)) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
151 printerr("Title out of range.");
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
152 pthread_mutex_unlock(&this->vm_lock);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
153 return DVDNAV_STATUS_ERR;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
154 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
155 if((part < 1) || (part > this->vm->vmgi->tt_srpt->title[title-1].nr_of_ptts)) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
156 printerr("Part out of range.");
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
157 pthread_mutex_unlock(&this->vm_lock);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
158 return DVDNAV_STATUS_ERR;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
159 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
160
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
161 retval = vm_jump_title_part(this->vm, title, part);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
162 if (retval)
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
163 this->vm->hop_channel++;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
164 pthread_mutex_unlock(&this->vm_lock);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
165
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
166 return retval ? DVDNAV_STATUS_OK : DVDNAV_STATUS_ERR;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
167 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
168
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
169 dvdnav_status_t dvdnav_part_play_auto_stop(dvdnav_t *this, int32_t title,
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
170 int32_t part, int32_t parts_to_play) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
171 /* FIXME: Implement auto-stop */
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
172 if (dvdnav_part_play(this, title, part) == DVDNAV_STATUS_OK)
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
173 printerr("Not implemented yet.");
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
174 return DVDNAV_STATUS_ERR;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
175 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
176
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
177 dvdnav_status_t dvdnav_time_play(dvdnav_t *this, int32_t title,
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
178 uint64_t time) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
179 /* FIXME: Implement */
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
180 printerr("Not implemented yet.");
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
181 return DVDNAV_STATUS_ERR;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
182 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
183
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
184 dvdnav_status_t dvdnav_stop(dvdnav_t *this) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
185 pthread_mutex_lock(&this->vm_lock);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
186 this->vm->stopped = 1;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
187 pthread_mutex_unlock(&this->vm_lock);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
188 return DVDNAV_STATUS_OK;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
189 }
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
190
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
191 dvdnav_status_t dvdnav_go_up(dvdnav_t *this) {
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
192 /* A nice easy function... delegate to the VM */
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
193 pthread_mutex_lock(&this->vm_lock);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
194 vm_jump_up(this->vm);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
195 pthread_mutex_unlock(&this->vm_lock);
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
196
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
197 return DVDNAV_STATUS_OK;
427b7da5cbdb first split of dvdread; it's just a copy of dvdnav still to be cleaned
nicodvb
parents:
diff changeset
198 }