annotate dvdnav.c @ 55:5674fbd44f26 src

report all spu types (widescreen, letterbox and pan&scan), not widescreen only and report the stream's scale permissions to detect pan&scan material
author mroi
date Fri, 05 Jul 2002 14:18:55 +0000
parents cea44c0d638a
children 18af52093d13
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
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
28 /*
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
29 #define LOG_DEBUG
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
30 */
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
31
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
32 #include <pthread.h>
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
33 #include <dvdnav.h>
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
34 #include "dvdnav_internal.h"
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
35 #include "read_cache.h"
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
36
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
37 #include <dvdread/nav_read.h>
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
38
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
39 #include <stdlib.h>
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
40 #include <stdio.h>
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
41
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
42 /*
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
43 * NOTE:
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
44 * All NLCK_*() function are not mutex locked, this made them reusable in
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
45 * a locked context. Take care.
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
46 *
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
47 */
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
48
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
49 /* Current domain (backend to dvdnav_is_domain_() funcs) */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
50 static int8_t NLCK_dvdnav_is_domain(dvdnav_t *this, domain_t domain) {
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
51 dvd_state_t *state;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
52
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
53 if((!this) || (!this->started) || (!this->vm))
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
54 return -1;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
55
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
56 state = &(this->vm->state);
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
57
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
58 if(!state)
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
59 return -1;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
60
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
61 return (state->domain == domain) ? 1 : 0;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
62 }
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
63
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
64 static int8_t _dvdnav_is_domain(dvdnav_t *this, domain_t domain) {
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
65 int8_t retval;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
66
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
67 pthread_mutex_lock(&this->vm_lock);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
68 retval = NLCK_dvdnav_is_domain(this, domain);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
69 pthread_mutex_unlock(&this->vm_lock);
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
70
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
71 return retval;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
72 }
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
73
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
74 static int8_t NCLK_dvdnav_get_audio_logical_stream(dvdnav_t *this, uint8_t audio_num) {
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
75 dvd_state_t *state;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
76 int8_t logical = -1;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
77
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
78 if(!NLCK_dvdnav_is_domain(this, VTS_DOMAIN))
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
79 audio_num = 0;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
80
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
81 state = &(this->vm->state);
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
82
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
83 if(audio_num < 8) {
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
84 if(state->pgc->audio_control[audio_num] & (1 << 15)) {
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
85 logical = (state->pgc->audio_control[audio_num] >> 8) & 0x07;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
86 }
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
87 }
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
88
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
89 return logical;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
90 }
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
91
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
92 static int8_t NCLK_dvdnav_get_spu_logical_stream(dvdnav_t *this, uint8_t subp_num) {
25
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
93 dvd_state_t *state;
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
94 ifo_handle_t *vtsi;
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
95
25
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
96 if(!this)
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
97 return -1;
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
98
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
99 state = &(this->vm->state);
25
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
100 vtsi = this->vm->vtsi;
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
101
25
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
102 if(subp_num >= vtsi->vtsi_mat->nr_of_vts_subp_streams)
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
103 return -1;
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
104
55
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
105 return vm_get_subp_stream(this->vm, subp_num, 0);
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
106 }
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
107
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
108 static int8_t NLCK_dvdnav_get_active_spu_stream(dvdnav_t *this) {
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
109 dvd_state_t *state;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
110 int8_t subp_num;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
111 int stream_num;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
112
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
113 state = &(this->vm->state);
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
114 subp_num = state->SPST_REG & ~0x40;
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
115 stream_num = NCLK_dvdnav_get_spu_logical_stream(this, subp_num);
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
116
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
117 if(stream_num == -1)
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
118 for(subp_num = 0; subp_num < 32; subp_num++)
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
119 if(state->pgc->subp_control[subp_num] & (1 << 31)) {
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
120 stream_num = NCLK_dvdnav_get_spu_logical_stream(this, subp_num);
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
121 break;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
122 }
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
123
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
124 return stream_num;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
125 }
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
126
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
127 uint8_t dvdnav_get_video_aspect(dvdnav_t *this) {
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
128 uint8_t retval;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
129
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
130 pthread_mutex_lock(&this->vm_lock);
25
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
131 retval = (uint8_t) vm_get_video_aspect(this->vm);
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
132 pthread_mutex_unlock(&this->vm_lock);
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
133
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
134 return retval;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
135 }
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
136
55
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
137 uint8_t dvdnav_get_video_scale_permission(dvdnav_t *this) {
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
138 uint8_t retval;
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
139
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
140 pthread_mutex_lock(&this->vm_lock);
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
141 retval = (uint8_t) vm_get_video_scale_permission(this->vm);
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
142 pthread_mutex_unlock(&this->vm_lock);
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
143
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
144 return retval;
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
145 }
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
146
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
147 dvdnav_status_t dvdnav_clear(dvdnav_t * this) {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
148 if (!this) {
4
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
149 printerr("Passed a NULL pointer");
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
150 return S_ERR;
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
151 }
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
152 /* clear everything except path, file, vm, mutex, readahead */
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
153
34
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
154 /* path */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
155 if (this->file) DVDCloseFile(this->file);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
156 this->file = NULL;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
157 this->open_vtsN = -1;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
158 this->open_domain = -1;
4
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
159
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
160 memset(&this->pci,0,sizeof(this->pci));
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
161 memset(&this->dsi,0,sizeof(this->dsi));
4
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
162
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
163 /* Set initial values of flags */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
164 this->position_current.still = 0;
23
c2d40c38e12f Name stills work better.
jcdutton
parents: 22
diff changeset
165 this->skip_still = 0;
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
166 this->stop = 0;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
167 this->spu_clut_changed = 0;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
168 this->started=0;
34
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
169 /* this->use_read_ahead */
4
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
170
34
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
171 dvdnav_read_cache_clear(this->cache);
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
172
4
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
173 return S_OK;
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
174 }
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
175
17
a68c6da98b73 Actually fix the const this time!
jcdutton
parents: 8
diff changeset
176 dvdnav_status_t dvdnav_open(dvdnav_t** dest, char *path) {
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
177 dvdnav_t *this;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
178
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
179 /* Create a new structure */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
180 (*dest) = NULL;
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
181 this = (dvdnav_t*)malloc(sizeof(dvdnav_t));
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
182 if(!this)
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
183 return S_ERR;
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
184 memset(this, 0, (sizeof(dvdnav_t) ) ); /* Make sure this structure is clean */
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
185
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
186 pthread_mutex_init(&this->vm_lock, NULL);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
187 /* Initialise the error string */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
188 printerr("");
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
189
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
190 /* Initialise the VM */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
191 this->vm = vm_new_vm();
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
192 if(!this->vm) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
193 printerr("Error initialising the DVD VM");
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
194 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
195 }
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
196 if(vm_reset(this->vm, path) == -1) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
197 printerr("Error starting the VM / opening the DVD device");
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
198 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
199 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
200
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
201 /* Set the path. FIXME: Is a deep copy 'right' */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
202 strncpy(this->path, path, MAX_PATH_LEN);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
203
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
204 dvdnav_clear(this);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
205
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
206 /* Pre-open and close a file so that the CSS-keys are cached. */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
207 this->file = DVDOpenFile(vm_get_dvd_reader(this->vm), 0, DVD_READ_MENU_VOBS);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
208 if (this->file) DVDCloseFile(this->file);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
209 this->file = NULL;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
210
54
cea44c0d638a Add more debug info for Menu language selection.
jcdutton
parents: 50
diff changeset
211 //if(!this->started) {
cea44c0d638a Add more debug info for Menu language selection.
jcdutton
parents: 50
diff changeset
212 // /* Start the VM */
cea44c0d638a Add more debug info for Menu language selection.
jcdutton
parents: 50
diff changeset
213 // vm_start(this->vm);
cea44c0d638a Add more debug info for Menu language selection.
jcdutton
parents: 50
diff changeset
214 // this->started = 1;
cea44c0d638a Add more debug info for Menu language selection.
jcdutton
parents: 50
diff changeset
215 //}
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
216
34
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
217 /* Start the read-ahead cache. */
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
218 this->cache = dvdnav_read_cache_new(this);
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
219
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
220 (*dest) = this;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
221 return S_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
222 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
223
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
224 dvdnav_status_t dvdnav_close(dvdnav_t *this) {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
225 if(!this) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
226 printerr("Passed a NULL pointer");
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
227 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
228 }
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
229 #ifdef LOG_DEBUG
3
328eadb3f37e Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents: 0
diff changeset
230 fprintf(stderr,"dvdnav:close:called\n");
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
231 #endif
34
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
232
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
233 /* Stop caching */
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
234
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
235 if(this->cache) {
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
236 dvdnav_read_cache_free(this->cache);
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
237 this->cache = NULL;
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
238 }
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
239
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
240 if (this->file) {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
241 DVDCloseFile(this->file);
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
242 #ifdef LOG_DEBUG
3
328eadb3f37e Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents: 0
diff changeset
243 fprintf(stderr,"dvdnav:close:file closing\n");
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
244 #endif
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
245 this->file = NULL;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
246 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
247
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
248 /* Free the VM */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
249 if(this->vm) {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
250 vm_free_vm(this->vm);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
251 }
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
252 if (this->file) {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
253 DVDCloseFile(this->file);
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
254 #ifdef LOG_DEBUG
3
328eadb3f37e Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents: 0
diff changeset
255 fprintf(stderr,"dvdnav:close2:file closing\n");
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
256 #endif
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
257 this->file = NULL;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
258 }
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
259 pthread_mutex_destroy(&this->vm_lock);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
260 /* Finally free the entire structure */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
261 free(this);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
262
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
263 return S_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
264 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
265
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
266 dvdnav_status_t dvdnav_reset(dvdnav_t *this) {
4
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
267 dvdnav_status_t result;
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
268
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
269 #ifdef LOG_DEBUG
4
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
270 printf("dvdnav:reset:called\n");
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
271 #endif
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
272 if(!this) {
4
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
273 printerr("Passed a NULL pointer");
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
274 return S_ERR;
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
275 }
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
276 #ifdef LOG_DEBUG
4
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
277 printf("getting lock\n");
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
278 #endif
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
279 pthread_mutex_lock(&this->vm_lock);
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
280 #ifdef LOG_DEBUG
4
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
281 printf("reseting vm\n");
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
282 #endif
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
283 if(vm_reset(this->vm, NULL) == -1) {
4
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
284 printerr("Error restarting the VM");
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
285 pthread_mutex_unlock(&this->vm_lock);
4
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
286 return S_ERR;
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
287 }
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
288 #ifdef LOG_DEBUG
4
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
289 printf("clearing dvdnav\n");
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
290 #endif
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
291 result=dvdnav_clear(this);
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
292 #ifdef LOG_DEBUG
4
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
293 printf("starting vm\n");
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
294 #endif
54
cea44c0d638a Add more debug info for Menu language selection.
jcdutton
parents: 50
diff changeset
295 // if(!this->started) {
cea44c0d638a Add more debug info for Menu language selection.
jcdutton
parents: 50
diff changeset
296 // /* Start the VM */
cea44c0d638a Add more debug info for Menu language selection.
jcdutton
parents: 50
diff changeset
297 // vm_start(this->vm);
cea44c0d638a Add more debug info for Menu language selection.
jcdutton
parents: 50
diff changeset
298 // this->started = 1;
cea44c0d638a Add more debug info for Menu language selection.
jcdutton
parents: 50
diff changeset
299 // }
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
300 #ifdef LOG_DEBUG
4
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
301 printf("unlocking\n");
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
302 #endif
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
303 pthread_mutex_unlock(&this->vm_lock);
4
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
304 return result;
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
305 }
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
306
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
307 dvdnav_status_t dvdnav_path(dvdnav_t *this, char** path) {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
308 if(!this || !path || !(*path)) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
309 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
310 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
311
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
312 /* FIXME: Is shallow copy 'right'? */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
313 (*path) = this->path;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
314
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
315 return S_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
316 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
317
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
318 char* dvdnav_err_to_string(dvdnav_t *this) {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
319 if(!this) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
320 /* Shold this be "passed a NULL pointer?" */
3
328eadb3f37e Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents: 0
diff changeset
321 return "Hey! You gave me a NULL pointer you naughty person!";
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
322 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
323
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
324 return this->err_str;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
325 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
326
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
327 /**
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
328 * Returns 1 if block contains NAV packet, 0 otherwise.
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
329 * Precesses said NAV packet if present.
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
330 *
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
331 * Most of the code in here is copied from xine's MPEG demuxer
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
332 * so any bugs which are found in that should be corrected here also.
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
333 */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
334 int dvdnav_decode_packet(dvdnav_t *this, uint8_t *p, dsi_t* nav_dsi, pci_t* nav_pci) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
335 int bMpeg1=0;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
336 uint32_t nHeaderLen;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
337 uint32_t nPacketLen;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
338 uint32_t nStreamID;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
339 /* uint8_t *p_start=p; */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
340
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
341
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
342 if (p==NULL) {
3
328eadb3f37e Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents: 0
diff changeset
343 fprintf(stderr,"Passed a NULL pointer.\n");
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
344 return 0;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
345 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
346
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
347 /* dprint("Checking packet...\n"); */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
348
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
349 if (p[3] == 0xBA) { /* program stream pack header */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
350
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
351 int nStuffingBytes;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
352
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
353 /* xprintf (VERBOSE|DEMUX, "program stream pack header\n"); */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
354
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
355 bMpeg1 = (p[4] & 0x40) == 0;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
356
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
357 if (bMpeg1) {
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
358 p += 12;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
359 } else { /* mpeg2 */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
360 nStuffingBytes = p[0xD] & 0x07;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
361 p += 14 + nStuffingBytes;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
362 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
363 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
364
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
365
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
366 if (p[3] == 0xbb) { /* program stream system header */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
367 int nHeaderLen;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
368
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
369 nHeaderLen = (p[4] << 8) | p[5];
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
370 p += 6 + nHeaderLen;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
371 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
372
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
373 /* we should now have a PES packet here */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
374
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
375 if (p[0] || p[1] || (p[2] != 1)) {
3
328eadb3f37e Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents: 0
diff changeset
376 fprintf(stderr,"demux error! %02x %02x %02x (should be 0x000001) \n",p[0],p[1],p[2]);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
377 return 0;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
378 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
379
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
380 nPacketLen = p[4] << 8 | p[5];
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
381 nStreamID = p[3];
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
382
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
383 nHeaderLen = 6;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
384 p += nHeaderLen;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
385
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
386 if (nStreamID == 0xbf) { /* Private stream 2 */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
387 /*
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
388 * int i;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
389 * printf("dvdnav:nav packet=%u\n",p-p_start-6);
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
390 * for(i=0;i<80;i++) {
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
391 * printf("%02x ",p[i-6]);
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
392 * }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
393 * printf("\n");
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
394 */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
395 if(p[0] == 0x00) {
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
396 navRead_PCI(nav_pci, p+1);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
397 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
398
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
399 p += nPacketLen;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
400
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
401 /* We should now have a DSI packet. */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
402 if(p[6] == 0x01) {
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
403 nPacketLen = p[4] << 8 | p[5];
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
404 p += 6;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
405 /* dprint("NAV DSI packet\n"); */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
406 navRead_DSI(nav_dsi, p+1);
33
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
407
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
408 }
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
409 return 1;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
410 }
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
411 return 0;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
412 }
33
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
413
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
414 /* DSI is used for most angle stuff.
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
415 * PCI is used for only non-seemless angle stuff
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
416 */
33
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
417 int dvdnav_get_vobu(dvdnav_t *self, dsi_t* nav_dsi, pci_t* nav_pci, dvdnav_vobu_t* vobu) {
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
418 uint32_t next;
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
419 int angle, num_angle;
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
420
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
421 vobu->vobu_start = nav_dsi->dsi_gi.nv_pck_lbn; /* Absolute offset from start of disk */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
422 vobu->vobu_length = nav_dsi->dsi_gi.vobu_ea; /* Relative offset from vobu_start */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
423
43
0ba15bf3dc25 Biiiiiiig change to let doxygen generate some docs for the library. Note that I'm in no way sure that the autoconf stuff plays nice.
richwareham
parents: 42
diff changeset
424 /*
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
425 * If we're not at the end of this cell, we can determine the next
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
426 * VOBU to display using the VOBU_SRI information section of the
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
427 * DSI. Using this value correctly follows the current angle,
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
428 * avoiding the doubled scenes in The Matrix, and makes our life
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
429 * really happy.
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
430 *
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
431 * vobu_next is an offset value, 0x3fffffff = SRI_END_OF_CELL
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
432 * DVDs are about 6 Gigs, which is only up to 0x300000 blocks
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
433 * Should really assert if bit 31 != 1
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
434 */
33
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
435
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
436 /* Relative offset from vobu_start */
33
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
437 vobu->vobu_next = ( nav_dsi->vobu_sri.next_vobu & 0x3fffffff );
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
438
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
439 /* Old code -- may still be sueful one day
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
440 if(nav_dsi->vobu_sri.next_vobu != SRI_END_OF_CELL ) {
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
441 vobu->vobu_next = ( nav_dsi->vobu_sri.next_vobu & 0x3fffffff );
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
442 } else {
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
443 vobu->vobu_next = vobu->vobu_length;
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
444 } */
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
445
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
446 dvdnav_get_angle_info(self, &angle, &num_angle);
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
447 #if 0
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
448 /* FIMXE: The angle reset doesn't work for some reason for the moment */
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
449
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
450 if((num_angle < angle) && (angle != 1)) {
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
451 printf("OOOOOOO angle ends!\n");
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
452
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
453 /* This is to switch back to angle one when we
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
454 * finish with angles. */
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
455 dvdnav_angle_change(self, 1);
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
456 }
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
457 #endif
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
458
33
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
459 if(num_angle != 0) {
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
460 next = nav_pci->nsml_agli.nsml_agl_dsta[angle-1];
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
461
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
462 if(next != 0) {
33
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
463 if((next & 0x3fffffff) != 0) {
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
464 if(next & 0x80000000) {
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
465 vobu->vobu_next = - (int32_t)(next & 0x3fffffff);
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
466 } else {
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
467 vobu->vobu_next = + (int32_t)(next & 0x3fffffff);
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
468 }
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
469 }
33
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
470
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
471 } else if( nav_dsi->sml_agli.data[angle-1].address != 0 ) {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
472 next = nav_dsi->sml_agli.data[angle-1].address;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
473 vobu->vobu_length = nav_dsi->sml_pbi.ilvu_ea;
33
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
474
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
475 if((next & 0x80000000) && (next != 0x7fffffff)) {
33
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
476 vobu->vobu_next = - (int32_t)(next & 0x3fffffff);
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
477 } else {
33
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
478 vobu->vobu_next = + (int32_t)(next & 0x3fffffff);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
479 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
480 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
481 }
33
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
482
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
483 return 1;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
484 }
28
da60d6379f95 Add some comments, FIXMEs.
jcdutton
parents: 26
diff changeset
485 /* This is the main get_next_block function which actually gets the media stream video and audio etc.
da60d6379f95 Add some comments, FIXMEs.
jcdutton
parents: 26
diff changeset
486 * The use of this function is optional, with the application programmer
da60d6379f95 Add some comments, FIXMEs.
jcdutton
parents: 26
diff changeset
487 * free to implement their own version of this function
da60d6379f95 Add some comments, FIXMEs.
jcdutton
parents: 26
diff changeset
488 * FIXME: Make the function calls from here public API calls.
da60d6379f95 Add some comments, FIXMEs.
jcdutton
parents: 26
diff changeset
489 */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
490 dvdnav_status_t dvdnav_get_next_block(dvdnav_t *this, unsigned char *buf,
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
491 int *event, int *len) {
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
492 dvd_state_t *state;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
493 int result;
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
494 if(!this || !event || !len || !buf) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
495 printerr("Passed a NULL pointer");
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
496 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
497 }
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
498 pthread_mutex_lock(&this->vm_lock);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
499
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
500 if(!this->started) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
501 /* Start the VM */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
502 vm_start(this->vm);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
503 this->started = 1;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
504 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
505
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
506 state = &(this->vm->state);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
507 (*event) = DVDNAV_NOP;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
508 (*len) = 0;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
509
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
510 /* Check the STOP flag */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
511 if(this->stop) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
512 (*event) = DVDNAV_STOP;
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
513 pthread_mutex_unlock(&this->vm_lock);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
514 return S_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
515 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
516
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
517 /* Check the STILLFRAME flag */
42
131ad65a2398 Removed more C++ style comments
richwareham
parents: 39
diff changeset
518 /* FIXME: Still cell, not still frame */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
519 if(this->position_current.still != 0) {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
520 dvdnav_still_event_t still_event;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
521
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
522 still_event.length = this->position_current.still;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
523
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
524 (*event) = DVDNAV_STILL_FRAME;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
525 (*len) = sizeof(dvdnav_still_event_t);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
526 memcpy(buf, &(still_event), sizeof(dvdnav_still_event_t));
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
527
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
528 pthread_mutex_unlock(&this->vm_lock);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
529 return S_OK;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
530 }
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
531
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
532 vm_position_get(this->vm,&this->position_next);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
533 /**********
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
534 fprintf(stderr, "POS-NEXT ");
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
535 vm_position_print(this->vm, &this->position_next);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
536 fprintf(stderr, "POS-CUR ");
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
537 vm_position_print(this->vm, &this->position_current);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
538 **********/
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
539
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
540 if(this->position_current.hop_channel != this->position_next.hop_channel) {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
541 this->position_current.hop_channel = this->position_next.hop_channel;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
542 (*event) = DVDNAV_HOP_CHANNEL;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
543 (*len) = 0;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
544 pthread_mutex_unlock(&this->vm_lock);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
545 return S_OK;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
546 }
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
547
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
548
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
549
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
550 if(this->spu_clut_changed) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
551 (*event) = DVDNAV_SPU_CLUT_CHANGE;
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
552 #ifdef LOG_DEBUG
3
328eadb3f37e Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents: 0
diff changeset
553 fprintf(stderr,"libdvdnav:SPU_CLUT_CHANGE\n");
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
554 #endif
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
555 (*len) = sizeof(dvdnav_still_event_t);
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
556 memcpy(buf, &(state->pgc->palette), 16 * sizeof(uint32_t));
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
557 this->spu_clut_changed = 0;
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
558 #ifdef LOG_DEBUG
3
328eadb3f37e Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents: 0
diff changeset
559 fprintf(stderr,"libdvdnav:SPU_CLUT_CHANGE returning S_OK\n");
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
560 #endif
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
561 pthread_mutex_unlock(&this->vm_lock);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
562 return S_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
563 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
564
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
565 if(this->position_current.spu_channel != this->position_next.spu_channel) {
55
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
566 dvdnav_spu_stream_change_event_t stream_change;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
567 (*event) = DVDNAV_SPU_STREAM_CHANGE;
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
568 #ifdef LOG_DEBUG
3
328eadb3f37e Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents: 0
diff changeset
569 fprintf(stderr,"libdvdnav:SPU_STREAM_CHANGE\n");
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
570 #endif
55
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
571 (*len) = sizeof(dvdnav_spu_stream_change_event_t);
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
572 stream_change.physical_wide = vm_get_subp_active_stream(this->vm, 0);
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
573 stream_change.physical_letterbox = vm_get_subp_active_stream(this->vm, 1);
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
574 stream_change.physical_pan_scan = vm_get_subp_active_stream(this->vm, 2);
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
575 memcpy(buf, &(stream_change), sizeof( dvdnav_spu_stream_change_event_t));
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
576 this->position_current.spu_channel = this->position_next.spu_channel;
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
577 #ifdef LOG_DEBUG
3
328eadb3f37e Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents: 0
diff changeset
578 fprintf(stderr,"libdvdnav:SPU_STREAM_CHANGE stream_id=%d returning S_OK\n",stream_change.physical);
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
579 #endif
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
580 pthread_mutex_unlock(&this->vm_lock);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
581 return S_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
582 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
583
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
584 if(this->position_current.audio_channel != this->position_next.audio_channel) {
55
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
585 dvdnav_audio_stream_change_event_t stream_change;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
586 (*event) = DVDNAV_AUDIO_STREAM_CHANGE;
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
587 #ifdef LOG_DEBUG
3
328eadb3f37e Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents: 0
diff changeset
588 fprintf(stderr,"libdvdnav:AUDIO_STREAM_CHANGE\n");
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
589 #endif
55
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
590 (*len) = sizeof(dvdnav_audio_stream_change_event_t);
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
591 stream_change.physical= vm_get_audio_active_stream( this->vm );
55
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
592 memcpy(buf, &(stream_change), sizeof( dvdnav_audio_stream_change_event_t));
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
593 this->position_current.audio_channel = this->position_next.audio_channel;
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
594 #ifdef LOG_DEBUG
3
328eadb3f37e Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents: 0
diff changeset
595 fprintf(stderr,"libdvdnav:AUDIO_STREAM_CHANGE stream_id=%d returning S_OK\n",stream_change.physical);
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
596 #endif
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
597 pthread_mutex_unlock(&this->vm_lock);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
598 return S_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
599 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
600
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
601 /* Check the HIGHLIGHT flag */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
602 /* FIXME: Use BUTTON instead of HIGHLIGHT. */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
603 if(this->position_current.button != this->position_next.button) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
604 dvdnav_highlight_event_t hevent;
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
605
30
630b6733e492 Some more cleanups.
jcdutton
parents: 28
diff changeset
606 hevent.display = 1;
630b6733e492 Some more cleanups.
jcdutton
parents: 28
diff changeset
607 hevent.buttonN = this->position_next.button;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
608
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
609 this->position_current.button = this->position_next.button;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
610
30
630b6733e492 Some more cleanups.
jcdutton
parents: 28
diff changeset
611 (*event) = DVDNAV_HIGHLIGHT;
630b6733e492 Some more cleanups.
jcdutton
parents: 28
diff changeset
612 (*len) = sizeof(hevent);
630b6733e492 Some more cleanups.
jcdutton
parents: 28
diff changeset
613 memcpy(buf, &(hevent), sizeof(hevent));
630b6733e492 Some more cleanups.
jcdutton
parents: 28
diff changeset
614 pthread_mutex_unlock(&this->vm_lock);
630b6733e492 Some more cleanups.
jcdutton
parents: 28
diff changeset
615 return S_OK;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
616 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
617
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
618 /* Check to see if we need to change the currently opened VOB */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
619 if((this->position_current.vts != this->position_next.vts) ||
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
620 (this->position_current.domain != this->position_next.domain)) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
621 dvd_read_domain_t domain;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
622 int vtsN;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
623 dvdnav_vts_change_event_t vts_event;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
624
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
625 if(this->file) {
34
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
626 dvdnav_read_cache_clear(this->cache);
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
627 DVDCloseFile(this->file);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
628 this->file = NULL;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
629 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
630
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
631 vts_event.old_vtsN = this->open_vtsN;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
632 vts_event.old_domain = this->open_domain;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
633
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
634 /* Use the current DOMAIN to find whether to open menu or title VOBs */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
635 switch(this->position_next.domain) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
636 case FP_DOMAIN:
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
637 case VMGM_DOMAIN:
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
638 domain = DVD_READ_MENU_VOBS;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
639 vtsN = 0;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
640 break;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
641 case VTSM_DOMAIN:
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
642 domain = DVD_READ_MENU_VOBS;
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
643 vtsN = this->position_next.vts;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
644 break;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
645 case VTS_DOMAIN:
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
646 domain = DVD_READ_TITLE_VOBS;
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
647 vtsN = this->position_next.vts;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
648 break;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
649 default:
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
650 printerr("Unknown domain when changing VTS.");
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
651 pthread_mutex_unlock(&this->vm_lock);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
652 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
653 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
654
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
655 this->position_current.vts = this->position_next.vts;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
656 this->position_current.domain = this->position_next.domain;
34
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
657 dvdnav_read_cache_clear(this->cache);
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
658 this->file = DVDOpenFile(vm_get_dvd_reader(this->vm), vtsN, domain);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
659 vts_event.new_vtsN = this->position_next.vts;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
660 vts_event.new_domain = this->position_next.domain;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
661
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
662 /* If couldn't open the file for some reason, moan */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
663 if(this->file == NULL) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
664 printerrf("Error opening vtsN=%i, domain=%i.", vtsN, domain);
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
665 pthread_mutex_unlock(&this->vm_lock);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
666 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
667 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
668
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
669 /* File opened successfully so return a VTS change event */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
670 (*event) = DVDNAV_VTS_CHANGE;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
671 memcpy(buf, &(vts_event), sizeof(vts_event));
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
672 (*len) = sizeof(vts_event);
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
673
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
674 /* On a VTS change, we want to disable any highlights which
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
675 * may have been shown (FIXME: is this valid?) */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
676 this->spu_clut_changed = 1;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
677 this->position_current.cell = -1; /* Force an update */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
678 this->position_current.spu_channel = -1; /* Force an update */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
679 this->position_current.audio_channel = -1; /* Force an update */;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
680
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
681 pthread_mutex_unlock(&this->vm_lock);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
682 return S_OK;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
683 }
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
684 /* FIXME: Don't really need "cell", we only need vobu_start */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
685 if( (this->position_current.cell != this->position_next.cell) ||
50
578ce1d41479 Rename some of the functions in vm.c to help readability.
jcdutton
parents: 45
diff changeset
686 (this->position_current.cell_restart != this->position_next.cell_restart) ||
24
870a0a1eee41 Re-implemented seeking.
jcdutton
parents: 23
diff changeset
687 (this->position_current.vobu_start != this->position_next.vobu_start) ||
870a0a1eee41 Re-implemented seeking.
jcdutton
parents: 23
diff changeset
688 (this->position_current.vobu_next != this->position_next.vobu_next) ) {
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
689 this->position_current.cell = this->position_next.cell;
50
578ce1d41479 Rename some of the functions in vm.c to help readability.
jcdutton
parents: 45
diff changeset
690 this->position_current.cell_restart = this->position_next.cell_restart;
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
691 /* vobu_start changes when PGC or PG changes. */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
692 this->position_current.vobu_start = this->position_next.vobu_start;
24
870a0a1eee41 Re-implemented seeking.
jcdutton
parents: 23
diff changeset
693 this->position_current.vobu_next = this->position_next.vobu_next;
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
694 /* FIXME: Need to set vobu_start, vobu_next */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
695 this->vobu.vobu_start = this->position_next.vobu_start;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
696 /* vobu_next is use for mid cell resumes */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
697 this->vobu.vobu_next = this->position_next.vobu_next;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
698 this->vobu.vobu_length = 0;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
699 this->vobu.blockN = this->vobu.vobu_length + 1;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
700 /* Make blockN > vobu_lenght to do expected_nav */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
701 (*event) = DVDNAV_CELL_CHANGE;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
702 (*len) = 0;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
703 pthread_mutex_unlock(&this->vm_lock);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
704 return S_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
705 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
706
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
707
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
708 if (this->vobu.blockN > this->vobu.vobu_length) {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
709 /* End of VOBU */
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
710
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
711 if(this->vobu.vobu_next == SRI_END_OF_CELL) {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
712 /* End of Cell from NAV DSI info */
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
713 #ifdef LOG_DEBUG
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
714 fprintf(stderr, "Still set to %x\n", this->position_next.still);
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
715 #endif
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
716 this->position_current.still = this->position_next.still;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
717
23
c2d40c38e12f Name stills work better.
jcdutton
parents: 22
diff changeset
718 if( this->position_current.still == 0 || this->skip_still ) {
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
719 vm_get_next_cell(this->vm);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
720 vm_position_get(this->vm,&this->position_next);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
721 /* FIXME: Need to set vobu_start, vobu_next */
23
c2d40c38e12f Name stills work better.
jcdutton
parents: 22
diff changeset
722 this->position_current.still = 0; /* still gets activated at end of cell */
c2d40c38e12f Name stills work better.
jcdutton
parents: 22
diff changeset
723 this->skip_still = 0;
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
724 this->position_current.cell = this->position_next.cell;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
725 this->position_current.vobu_start = this->position_next.vobu_start;
24
870a0a1eee41 Re-implemented seeking.
jcdutton
parents: 23
diff changeset
726 this->position_current.vobu_next = this->position_next.vobu_next;
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
727 this->vobu.vobu_start = this->position_next.vobu_start;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
728 /* vobu_next is use for mid cell resumes */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
729 this->vobu.vobu_next = this->position_next.vobu_next;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
730 this->vobu.vobu_length = 0;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
731 this->vobu.blockN = this->vobu.vobu_length + 1;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
732 /* Make blockN > vobu_next to do expected_nav */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
733 (*event) = DVDNAV_CELL_CHANGE;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
734 (*len) = 0;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
735 pthread_mutex_unlock(&this->vm_lock);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
736 return S_OK;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
737 } else {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
738 dvdnav_still_event_t still_event;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
739 still_event.length = this->position_current.still;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
740 (*event) = DVDNAV_STILL_FRAME;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
741 (*len) = sizeof(dvdnav_still_event_t);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
742 memcpy(buf, &(still_event), sizeof(dvdnav_still_event_t));
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
743 pthread_mutex_unlock(&this->vm_lock);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
744 return S_OK;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
745 }
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
746
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
747 /* Only set still after whole VOBU has been output. */
42
131ad65a2398 Removed more C++ style comments
richwareham
parents: 39
diff changeset
748 /*
131ad65a2398 Removed more C++ style comments
richwareham
parents: 39
diff changeset
749 if(this->position_next.still != 0) {
131ad65a2398 Removed more C++ style comments
richwareham
parents: 39
diff changeset
750 this->position_current.still = this->position_next.still;
131ad65a2398 Removed more C++ style comments
richwareham
parents: 39
diff changeset
751 }
131ad65a2398 Removed more C++ style comments
richwareham
parents: 39
diff changeset
752 */
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
753
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
754 }
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
755 /* Perform the jump if necessary (this is always a
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
756 * VOBU boundary). */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
757
45
7bf97b8922b4 Revert back to old read_cache method.
jcdutton
parents: 43
diff changeset
758 //result = DVDReadBlocks(this->file, this->vobu.vobu_start + this->vobu.vobu_next, 1, buf);
7bf97b8922b4 Revert back to old read_cache method.
jcdutton
parents: 43
diff changeset
759 result = dvdnav_read_cache_block(this->cache, this->vobu.vobu_start + this->vobu.vobu_next, 1, buf);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
760
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
761 if(result <= 0) {
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
762 printerr("Error reading NAV packet.");
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
763 pthread_mutex_unlock(&this->vm_lock);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
764 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
765 }
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
766 /* Decode nav into pci and dsi. */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
767 /* Then get next VOBU info. */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
768 if(dvdnav_decode_packet(this, buf, &this->dsi, &this->pci) == 0) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
769 printerr("Expected NAV packet but none found.");
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
770 pthread_mutex_unlock(&this->vm_lock);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
771 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
772 }
33
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
773 dvdnav_get_vobu(this, &this->dsi,&this->pci, &this->vobu);
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
774 this->vobu.blockN=1;
28
da60d6379f95 Add some comments, FIXMEs.
jcdutton
parents: 26
diff changeset
775 /* FIXME: We need to update the vm state->blockN with which VOBU we are in.
da60d6379f95 Add some comments, FIXMEs.
jcdutton
parents: 26
diff changeset
776 * This is so RSM resumes to the VOBU level and not just the CELL level.
da60d6379f95 Add some comments, FIXMEs.
jcdutton
parents: 26
diff changeset
777 * This should be implemented with a new Public API call.
da60d6379f95 Add some comments, FIXMEs.
jcdutton
parents: 26
diff changeset
778 */
45
7bf97b8922b4 Revert back to old read_cache method.
jcdutton
parents: 43
diff changeset
779 /* We cache one past the end of the VOBU,
7bf97b8922b4 Revert back to old read_cache method.
jcdutton
parents: 43
diff changeset
780 * in the hope it might catch the next NAV packet as well.
7bf97b8922b4 Revert back to old read_cache method.
jcdutton
parents: 43
diff changeset
781 * This reduces the amount of read commands sent to the DVD device.
7bf97b8922b4 Revert back to old read_cache method.
jcdutton
parents: 43
diff changeset
782 * A cache miss will only happen for 3 reasons.
7bf97b8922b4 Revert back to old read_cache method.
jcdutton
parents: 43
diff changeset
783 * 1) Seeking
7bf97b8922b4 Revert back to old read_cache method.
jcdutton
parents: 43
diff changeset
784 * 2) Menu change
7bf97b8922b4 Revert back to old read_cache method.
jcdutton
parents: 43
diff changeset
785 * 3) The next VOBU does not immeadiately follow the current one. E.g. Multi Angles, ILVU.
7bf97b8922b4 Revert back to old read_cache method.
jcdutton
parents: 43
diff changeset
786 */
7bf97b8922b4 Revert back to old read_cache method.
jcdutton
parents: 43
diff changeset
787 dvdnav_pre_cache_blocks(this->cache, this->vobu.vobu_start+1, this->vobu.vobu_length+1);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
788
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
789 /* Successfully got a NAV packet */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
790 (*event) = DVDNAV_NAV_PACKET;
3
328eadb3f37e Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents: 0
diff changeset
791 (*len) = 2048;
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
792 pthread_mutex_unlock(&this->vm_lock);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
793 return S_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
794 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
795
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
796 /* If we've got here, it must just be a normal block. */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
797 if(!this->file) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
798 printerr("Attempting to read without opening file");
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
799 pthread_mutex_unlock(&this->vm_lock);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
800 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
801 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
802
34
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
803 result = dvdnav_read_cache_block(this->cache, this->vobu.vobu_start + this->vobu.blockN, 1, buf);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
804 if(result <= 0) {
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
805 printerr("Error reading from DVD.");
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
806 pthread_mutex_unlock(&this->vm_lock);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
807 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
808 }
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
809 this->vobu.blockN++;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
810 (*len) = 2048;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
811 (*event) = DVDNAV_BLOCK_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
812
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
813 pthread_mutex_unlock(&this->vm_lock);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
814 return S_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
815 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
816
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
817 uint16_t dvdnav_audio_stream_to_lang(dvdnav_t *this, uint8_t stream) {
25
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
818 audio_attr_t attr;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
819
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
820 if(!this)
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
821 return -1;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
822
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
823 pthread_mutex_lock(&this->vm_lock);
25
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
824 attr = vm_get_audio_attr(this->vm, stream);
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
825 pthread_mutex_unlock(&this->vm_lock);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
826
25
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
827 if(attr.lang_type != 1)
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
828 return 0xffff;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
829
25
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
830 return attr.lang_code;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
831 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
832
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
833 int8_t dvdnav_get_audio_logical_stream(dvdnav_t *this, uint8_t audio_num) {
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
834 int8_t retval;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
835
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
836 if(!this)
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
837 return -1;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
838
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
839 pthread_mutex_lock(&this->vm_lock);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
840 retval = NCLK_dvdnav_get_audio_logical_stream(this, audio_num);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
841 pthread_mutex_unlock(&this->vm_lock);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
842
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
843 return retval;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
844 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
845
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
846 uint16_t dvdnav_spu_stream_to_lang(dvdnav_t *this, uint8_t stream) {
25
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
847 subp_attr_t attr;
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
848
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
849 if(!this)
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
850 return -1;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
851
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
852 pthread_mutex_lock(&this->vm_lock);
25
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
853 attr = vm_get_subp_attr(this->vm, stream);
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
854 pthread_mutex_unlock(&this->vm_lock);
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
855
25
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
856 if(attr.type != 1)
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
857 return 0xffff;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
858
25
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
859 return attr.lang_code;
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
860 }
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
861
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
862 int8_t dvdnav_get_spu_logical_stream(dvdnav_t *this, uint8_t subp_num) {
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
863 int8_t retval;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
864
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
865 if(!this)
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
866 return -1;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
867
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
868 pthread_mutex_lock(&this->vm_lock);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
869 retval = NCLK_dvdnav_get_spu_logical_stream(this, subp_num);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
870 pthread_mutex_unlock(&this->vm_lock);
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
871
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
872 return retval;
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
873 }
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
874
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
875 int8_t dvdnav_get_active_spu_stream(dvdnav_t *this) {
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
876 int8_t retval;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
877
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
878 if(!this)
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
879 return -1;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
880
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
881 pthread_mutex_lock(&this->vm_lock);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
882 retval = NLCK_dvdnav_get_active_spu_stream(this);
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
883 pthread_mutex_unlock(&this->vm_lock);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
884
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
885 return retval;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
886 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
887
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
888 /* First Play domain. (Menu) */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
889 int8_t dvdnav_is_domain_fp(dvdnav_t *this) {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
890 return _dvdnav_is_domain(this, FP_DOMAIN);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
891 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
892 /* Video management Menu domain. (Menu) */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
893 int8_t dvdnav_is_domain_vmgm(dvdnav_t *this) {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
894 return _dvdnav_is_domain(this, VMGM_DOMAIN);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
895 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
896 /* Video Title Menu domain (Menu) */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
897 int8_t dvdnav_is_domain_vtsm(dvdnav_t *this) {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
898 return _dvdnav_is_domain(this, VTSM_DOMAIN);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
899 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
900 /* Video Title domain (playing movie). */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
901 int8_t dvdnav_is_domain_vts(dvdnav_t *this) {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
902 return _dvdnav_is_domain(this, VTS_DOMAIN);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
903 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
904
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
905 /* Generally delegate angle information handling to
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
906 * VM */
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
907 dvdnav_status_t dvdnav_angle_change(dvdnav_t *this, int angle) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
908 int num, current;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
909
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
910 if(!this) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
911 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
912 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
913
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
914 if(dvdnav_get_angle_info(this, &current, &num) != S_OK) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
915 printerr("Error getting angle info");
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
916 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
917 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
918
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
919 /* Set angle SPRM if valid */
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
920 if((angle > 0) && (angle <= num)) {
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
921 this->vm->state.AGL_REG = angle;
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
922 } else {
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
923 printerr("Passed an invalid angle number");
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
924 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
925 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
926
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
927 return S_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
928 }
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
929 /* FIXME: change order of current_angle, number_of_angles */
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
930 dvdnav_status_t dvdnav_get_angle_info(dvdnav_t *this, int* current_angle,
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
931 int *number_of_angles) {
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
932 if(!this || !this->vm) {
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
933 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
934 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
935
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
936 if(!current_angle || !number_of_angles) {
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
937 printerr("Passed a NULL pointer");
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
938 return S_ERR;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
939 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
940
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
941 vm_get_angle_info(this->vm, number_of_angles, current_angle);
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
942
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
943 return S_OK;
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
944 }
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
945
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
946 dvdnav_status_t dvdnav_get_cell_info(dvdnav_t *this, int* current_angle,
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
947 int *number_of_angles) {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
948 if(!this || !this->vm) {
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
949 return S_ERR;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
950 }
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
951 *current_angle=this->position_next.cell;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
952 return S_OK;
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
953 }
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
954
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
955 /*
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
956 * $Log$
55
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
957 * Revision 1.25 2002/07/05 14:18:54 mroi
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
958 * report all spu types (widescreen, letterbox and pan&scan), not widescreen
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
959 * only and report the stream's scale permissions to detect pan&scan material
5674fbd44f26 report all spu types (widescreen, letterbox and pan&scan), not widescreen
mroi
parents: 54
diff changeset
960 *
54
cea44c0d638a Add more debug info for Menu language selection.
jcdutton
parents: 50
diff changeset
961 * Revision 1.24 2002/07/05 01:42:30 jcdutton
cea44c0d638a Add more debug info for Menu language selection.
jcdutton
parents: 50
diff changeset
962 * Add more debug info for Menu language selection.
cea44c0d638a Add more debug info for Menu language selection.
jcdutton
parents: 50
diff changeset
963 * Only do vm_start when we have to.
cea44c0d638a Add more debug info for Menu language selection.
jcdutton
parents: 50
diff changeset
964 *
50
578ce1d41479 Rename some of the functions in vm.c to help readability.
jcdutton
parents: 45
diff changeset
965 * Revision 1.23 2002/07/02 22:57:09 jcdutton
578ce1d41479 Rename some of the functions in vm.c to help readability.
jcdutton
parents: 45
diff changeset
966 * Rename some of the functions in vm.c to help readability.
578ce1d41479 Rename some of the functions in vm.c to help readability.
jcdutton
parents: 45
diff changeset
967 * Hopefully fix __FUNCTION__ problem. Use __func_ as recommended in C99.
578ce1d41479 Rename some of the functions in vm.c to help readability.
jcdutton
parents: 45
diff changeset
968 * Fix bug where libdvdnav would not immeadiately replay the same cell due to menu buttons.
578ce1d41479 Rename some of the functions in vm.c to help readability.
jcdutton
parents: 45
diff changeset
969 *
45
7bf97b8922b4 Revert back to old read_cache method.
jcdutton
parents: 43
diff changeset
970 * Revision 1.22 2002/06/25 13:37:11 jcdutton
7bf97b8922b4 Revert back to old read_cache method.
jcdutton
parents: 43
diff changeset
971 * Revert back to old read_cache method.
7bf97b8922b4 Revert back to old read_cache method.
jcdutton
parents: 43
diff changeset
972 * Some new optimizations added to the old read_cache method, thus reducing the amount of calls to read blocks from the DVD device.
7bf97b8922b4 Revert back to old read_cache method.
jcdutton
parents: 43
diff changeset
973 *
43
0ba15bf3dc25 Biiiiiiig change to let doxygen generate some docs for the library. Note that I'm in no way sure that the autoconf stuff plays nice.
richwareham
parents: 42
diff changeset
974 * Revision 1.21 2002/06/06 15:03:09 richwareham
0ba15bf3dc25 Biiiiiiig change to let doxygen generate some docs for the library. Note that I'm in no way sure that the autoconf stuff plays nice.
richwareham
parents: 42
diff changeset
975 * Biiiiiiig change to let doxygen generate some docs for the library. Note that I'm in no way sure that the autoconf stuff plays nice.
0ba15bf3dc25 Biiiiiiig change to let doxygen generate some docs for the library. Note that I'm in no way sure that the autoconf stuff plays nice.
richwareham
parents: 42
diff changeset
976 *
42
131ad65a2398 Removed more C++ style comments
richwareham
parents: 39
diff changeset
977 * Revision 1.20 2002/06/04 13:35:16 richwareham
131ad65a2398 Removed more C++ style comments
richwareham
parents: 39
diff changeset
978 * Removed more C++ style comments
131ad65a2398 Removed more C++ style comments
richwareham
parents: 39
diff changeset
979 *
39
2433a5a8069e First draft of removing HAVE_DVDREAD9
richwareham
parents: 34
diff changeset
980 * Revision 1.19 2002/05/30 23:15:14 richwareham
2433a5a8069e First draft of removing HAVE_DVDREAD9
richwareham
parents: 34
diff changeset
981 * First draft of removing HAVE_DVDREAD9
2433a5a8069e First draft of removing HAVE_DVDREAD9
richwareham
parents: 34
diff changeset
982 *
34
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
983 * Revision 1.18 2002/05/30 09:52:29 richwareham
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
984 * 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
1f29402ef2ef 'Objectified' the read-ahead cache in preparation to implement a 'proper' threaded cache a-la that recommended in the DVD Demystified book.
richwareham
parents: 33
diff changeset
985 *
33
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
986 * Revision 1.17 2002/05/09 11:57:24 richwareham
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
987 * Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
ef2136c4e7b2 Angles now work (still a few wrinkles though -- e.g. angle does not reset to '1' when returning to menus)
richwareham
parents: 31
diff changeset
988 *
31
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
989 * Revision 1.16 2002/04/24 21:15:25 jcdutton
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
990 * Quiet please!!!
8b08ee66cbff Quiet please!!!
jcdutton
parents: 30
diff changeset
991 *
30
630b6733e492 Some more cleanups.
jcdutton
parents: 28
diff changeset
992 * Revision 1.15 2002/04/24 00:47:46 jcdutton
630b6733e492 Some more cleanups.
jcdutton
parents: 28
diff changeset
993 * Some more cleanups.
630b6733e492 Some more cleanups.
jcdutton
parents: 28
diff changeset
994 * Improve button passing.
630b6733e492 Some more cleanups.
jcdutton
parents: 28
diff changeset
995 *
28
da60d6379f95 Add some comments, FIXMEs.
jcdutton
parents: 26
diff changeset
996 * Revision 1.14 2002/04/23 13:26:08 jcdutton
da60d6379f95 Add some comments, FIXMEs.
jcdutton
parents: 26
diff changeset
997 * Add some comments, FIXMEs.
da60d6379f95 Add some comments, FIXMEs.
jcdutton
parents: 26
diff changeset
998 * The main point being that dvdnav_get_next_block is almost in a state where it can be optional whether the application programmer uses it, or implements their own version of the function. That is been the main reason for the re-write of this function recently.
da60d6379f95 Add some comments, FIXMEs.
jcdutton
parents: 26
diff changeset
999 *
26
794d2e16a4d4 Removed un-needed variables.
jcdutton
parents: 25
diff changeset
1000 * Revision 1.13 2002/04/23 12:55:40 jcdutton
794d2e16a4d4 Removed un-needed variables.
jcdutton
parents: 25
diff changeset
1001 * Removed un-needed variables.
794d2e16a4d4 Removed un-needed variables.
jcdutton
parents: 25
diff changeset
1002 * General Clean up.
794d2e16a4d4 Removed un-needed variables.
jcdutton
parents: 25
diff changeset
1003 *
25
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
1004 * Revision 1.12 2002/04/23 12:34:39 f1rmb
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
1005 * Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
1006 * Comment unused var, shut compiler warnings.
df024077cbc1 Why rewrite vm function, use it instead (this remark is for me, of course ;-) ).
f1rmb
parents: 24
diff changeset
1007 *
24
870a0a1eee41 Re-implemented seeking.
jcdutton
parents: 23
diff changeset
1008 * Revision 1.11 2002/04/23 02:12:27 jcdutton
870a0a1eee41 Re-implemented seeking.
jcdutton
parents: 23
diff changeset
1009 * Re-implemented seeking.
870a0a1eee41 Re-implemented seeking.
jcdutton
parents: 23
diff changeset
1010 *
23
c2d40c38e12f Name stills work better.
jcdutton
parents: 22
diff changeset
1011 * Revision 1.10 2002/04/23 00:07:16 jcdutton
c2d40c38e12f Name stills work better.
jcdutton
parents: 22
diff changeset
1012 * Name stills work better.
c2d40c38e12f Name stills work better.
jcdutton
parents: 22
diff changeset
1013 *
22
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
1014 * Revision 1.9 2002/04/22 22:00:48 jcdutton
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
1015 * Start of rewrite of libdvdnav. Still need to re-implement seeking.
3c1df0cb3aee Start of rewrite of libdvdnav. Still need to re-implement seeking.
jcdutton
parents: 21
diff changeset
1016 *
21
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
1017 * Revision 1.8 2002/04/22 20:57:14 f1rmb
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
1018 * Change/fix SPU active stream id. Same for audio. Few new functions, largely
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
1019 * inspired from libogle ;-).
d2d73f2ad8d3 Change/fix SPU active stream id. Same for audio. Few new functions, largely
f1rmb
parents: 17
diff changeset
1020 *
17
a68c6da98b73 Actually fix the const this time!
jcdutton
parents: 8
diff changeset
1021 * Revision 1.7 2002/04/10 16:45:57 jcdutton
a68c6da98b73 Actually fix the const this time!
jcdutton
parents: 8
diff changeset
1022 * Actually fix the const this time!
a68c6da98b73 Actually fix the const this time!
jcdutton
parents: 8
diff changeset
1023 *
8
66708b4a1b5e Stop C++ bitching about some things and extend the menus example
richwareham
parents: 7
diff changeset
1024 * Revision 1.6 2002/04/07 14:10:11 richwareham
66708b4a1b5e Stop C++ bitching about some things and extend the menus example
richwareham
parents: 7
diff changeset
1025 * Stop C++ bitching about some things and extend the menus example
66708b4a1b5e Stop C++ bitching about some things and extend the menus example
richwareham
parents: 7
diff changeset
1026 *
7
7fdefafa624f Slight correction to handle quicker menu transitions.
jcdutton
parents: 6
diff changeset
1027 * Revision 1.5 2002/04/06 18:42:05 jcdutton
7fdefafa624f Slight correction to handle quicker menu transitions.
jcdutton
parents: 6
diff changeset
1028 * Slight correction to handle quicker menu transitions.
7fdefafa624f Slight correction to handle quicker menu transitions.
jcdutton
parents: 6
diff changeset
1029 *
6
5f319e02e333 Some cleaning up.
jcdutton
parents: 4
diff changeset
1030 * Revision 1.4 2002/04/06 18:31:50 jcdutton
5f319e02e333 Some cleaning up.
jcdutton
parents: 4
diff changeset
1031 * Some cleaning up.
5f319e02e333 Some cleaning up.
jcdutton
parents: 4
diff changeset
1032 * changed exit(1) to assert(0) so they actually get seen by the user so that it helps developers more.
5f319e02e333 Some cleaning up.
jcdutton
parents: 4
diff changeset
1033 *
4
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
1034 * Revision 1.3 2002/04/02 18:22:27 richwareham
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
1035 * Added reset patch from Kees Cook <kees@outflux.net>
99bed5d6db2f Added reset patch from Kees Cook <kees@outflux.net>
richwareham
parents: 3
diff changeset
1036 *
3
328eadb3f37e Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents: 0
diff changeset
1037 * Revision 1.2 2002/04/01 18:56:28 richwareham
328eadb3f37e Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents: 0
diff changeset
1038 * Added initial example programs directory and make sure all debug/error output goes to stderr.
328eadb3f37e Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents: 0
diff changeset
1039 *
328eadb3f37e Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents: 0
diff changeset
1040 * Revision 1.1.1.1 2002/03/12 19:45:57 richwareham
328eadb3f37e Added initial example programs directory and make sure all debug/error output goes to stderr.
richwareham
parents: 0
diff changeset
1041 * Initial import
0
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1042 *
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1043 * Revision 1.28 2002/02/02 23:26:20 richwareham
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1044 * Restored title selection
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1045 *
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1046 * Revision 1.27 2002/02/01 15:48:10 richwareham
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1047 * Re-implemented angle selection and title/chapter display
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1048 *
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1049 * Revision 1.26 2002/01/31 16:53:49 richwareham
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1050 * Big patch from Daniel Caujolle-Bert to (re)implement SPU/Audio language display
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1051 *
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1052 * Revision 1.25 2002/01/24 20:53:50 richwareham
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1053 * Added option to _not_ use DVD read-ahead to options
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1054 *
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1055 * Revision 1.24 2002/01/20 15:54:59 jcdutton
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1056 * Implement seeking.
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1057 * It is still a bit buggy, but works sometimes.
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1058 * I need to find out how to make the jump clean.
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1059 * At the moment, some corruption of the mpeg2 stream occurs,
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1060 * which causes libmpeg2 to crash.
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1061 *
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1062 * Revision 1.23 2002/01/18 00:23:52 jcdutton
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1063 * Support Ejecting of DVD.
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1064 * It will first un-mount the DVD, then eject it.
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1065 *
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1066 * Revision 1.22 2002/01/17 14:50:32 jcdutton
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1067 * Fix corruption of stream during menu transitions.
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1068 * Menu transitions are now clean.
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1069 *
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1070 * Revision 1.21 2002/01/15 00:37:03 jcdutton
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1071 * Just a few cleanups, and a assert fix. (memset fixed it)
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1072 *
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1073 * Revision 1.20 2002/01/13 22:17:57 jcdutton
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1074 * Change logging.
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1075 *
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1076 *
3ddf0eaece51 Initial revision
richwareham
parents:
diff changeset
1077 */